Skip to content

feat(wiki-viewer): single-file HTML viewer for any wiki#55

Merged
rohitg00 merged 1 commit into
mainfrom
feat/wiki-viewer
May 9, 2026
Merged

feat(wiki-viewer): single-file HTML viewer for any wiki#55
rohitg00 merged 1 commit into
mainfrom
feat/wiki-viewer

Conversation

@rohitg00
Copy link
Copy Markdown
Owner

@rohitg00 rohitg00 commented May 9, 2026

Summary

Adds a sixth knowledge-plane skill: wiki-viewer. Renders any pro-workflow wiki as a self-contained HTML artifact — pages, sources, seed queue, link graph, in-browser search, "copy as seed" CTAs — in one file with no CDN refs and no external dependencies.

Why

Thariq Shihipar's "Unreasonable Effectiveness of HTML" argues that markdown stops scaling once outputs grow past ~100 lines. Auto-research wikis hit that wall fast — after a 5-page run with 30 cited claims, navigating raw wiki/ markdown is painful. HTML gives information density, visual clarity, and shareability.

Concrete value:

  • Browse pages, jump to citations, click between linked pages.
  • Audit a research run at a glance: pages, sources, seeds, embedding count, kill-switch state.
  • Hand off the file via S3 / static host. Recipients don't need pro-workflow installed.
  • Pending seeds get a "Copy as command" button (Thariq's two-way playground pattern) that pastes back into Claude Code.

What changed

skills/wiki-viewer/ (new)

  • SKILL.md — when to use, layout, design principles, limits.
  • scripts/render.js — single-pass renderer. Reads ~/.pro-workflow/data.db, emits <wiki-root>/derived/viewer.html.

commands/wiki.md

  • New subcommand: /wiki view <slug> [--out path] [--theme dark|light].

README.md + docs/infographic.html

  • 60-second tour gains "Browse the wiki visually".
  • Counts bumped 33 → 34 skills.
  • v3.3 skill table + section 10 list + components grid all reflect the new skill.

What's in the rendered HTML

Panel Contents
Header slug, flavor, scope, root path, page/source/seed/embedding counts
Sidebar page list grouped by type, chip filter, text filter (token + substring AND-match)
Main selected-page detail: rendered markdown, inline footnote citations resolve to sources, click anchors flash the matching row
Sources full source table (db rows + sources.md rows)
Seeds queue grouped by status; "Copy as command" button per pending seed
Graph precomputed circular-layout SVG of cross-page citations; click a node to render that page
Learnings wiki-scoped learnings_wiki rows

Self-contained: inline CSS, inline JSON, inline SVG, inline JS only. No CDN, no <script src=>, no external fonts.

Security

  • Every db-sourced string passes through escapeHtml.
  • Inline JSON injected with <\/script and <\!-- escapes to defeat tag-break attacks via wiki content.
  • File system access is read-only at render time; output path is user-supplied or the wiki's own derived/ folder.

Test plan

  • Smoke render: 5 pages → 26 KB single-file output, all anchors resolve, copy-as-command produces correct seed CLI.
  • Theme toggle: --theme light works.
  • XSS balance: <script> open/close pairs balance after JSON injection.
  • Empty-state handling: no pages / no sources / no seeds → empty placeholders, no crashes.
  • Visual review at 1200px and 600px (responsive layout collapses sidebar at < 900px).
  • Print preview: @media print collapses aside, content prints clean.

Out of scope (follow-ups)

  • --include-council to bundle linked council transcripts inline.
  • --include-survey to bundle generated surveys.
  • "Copy as council prompt" CTA for contested claims.
  • Diff mode: --against <prev.html> to highlight new claims.

Summary by CodeRabbit

  • New Features
    • Added wiki-viewer skill (34 skills total)—a single-file HTML viewer for wiki data
    • New /wiki view command generates interactive HTML viewer with customizable theme and output options
    • Viewer includes pages, sources, seed queue, link graph, learnings, and search capabilities
    • Supports filtering, pane switching, and content navigation

Review Change Stack

Inspired by Thariq Shihipar's "Unreasonable Effectiveness of HTML"
(https://x.com/trq212/status/2034017024445244382): markdown is
limiting once outputs cross a hundred lines, so render the wiki as
a self-contained HTML artifact instead.

skills/wiki-viewer/scripts/render.js:
- Reads ~/.pro-workflow/data.db for the target slug.
- Pulls pages, sources (db + sources.md table parse), seed queue,
  wiki-scoped learnings, and embedding count.
- Emits a single .html file with no CDN refs, no external fonts,
  no <script src=>. Uploadable to S3 as-is.
- Sidebar = page list grouped by type with a chip filter and a
  text filter that runs against title+summary+content tokens.
- Main pane = page detail rendered from a small inline markdown
  parser (headings, lists, code blocks, tables, blockquotes,
  footnote citations [^src-id]).
- Citation links resolve to source rows in the Sources pane and
  flash on jump.
- Seeds pane lists the queue grouped by status; pending rows have
  a "Copy as command" button (Thariq's playground / two-way
  pattern) that yields the exact research-loop seed command.
- Link graph pane is a precomputed circular-layout SVG of
  cross-page citations; click a node to render that page.
- Theme: dark by default, --theme light supported.
- XSS guards: every db-sourced string runs through escapeHtml;
  inline JSON has </script and <!-- escaped before serialization.

commands/wiki.md:
- /wiki view <slug> [--out path] [--theme dark|light].

README.md, docs/infographic.html:
- 60-second tour gains a "Browse the wiki visually" step.
- v3.3 skill table + section 10 list + components grid show
  34 skills (was 33).
- Skill rows for wiki-viewer added in both surfaces.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This pull request introduces the wiki-viewer skill, a new feature that generates a single self-contained HTML viewer for wiki data. The implementation includes CLI command routing, markdown-to-HTML rendering, interactive client-side filtering across multiple panels (Overview, Pages, Sources, Seeds, Link Graph, Learnings), and a link graph visualization. Documentation and version counts are updated to reflect the new skill.

Changes

Wiki Viewer Feature

Layer / File(s) Summary
Skill Contract & Documentation
skills/wiki-viewer/SKILL.md
Defines the wiki-viewer skill: single-file HTML viewer for wiki pages, sources, seed queue, and link graph. Documents CLI usage (node .../render.js <slug> [--out] [--theme]), output panels, design principles, initial feature limits, and future hooks.
Command Routing
commands/wiki.md
Documents /wiki view <slug> [--out path] [--theme dark|light] subcommand and adds route mapping from view to wiki-viewer skill.
Render Script Implementation
skills/wiki-viewer/scripts/render.js
CLI script that loads wiki data from dist/db/store.js, parses arguments, converts page markdown to escaped HTML, constructs link graph with SVG rendering, reads and parses sources, builds search indexing, assembles main HTML payload with embedded pages/sources JSON, renders seeds queue and learnings tables, generates full single-file HTML with inline CSS/JS, and implements client-side filtering, pane switching, page rendering, smooth-scrolling cite clicks, and clipboard copy for seed commands.
Version & Documentation Updates
README.md, docs/infographic.html
Updates skill count from 33 to 34 across README (feature counts, tour step for wiki viewer, v3.3 feature list, comparison table, structure tree) and infographic.html (subtitle, component tile, skills library section title, and new wiki-viewer table entry).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • rohitg00/pro-workflow#53: The wiki-viewer feature relies on the wiki DB schema and store added in this PR.
  • rohitg00/pro-workflow#54: Both PRs update the same documentation files (README.md, docs/infographic.html, commands/wiki.md) for wiki-related features.

Poem

🐰 A viewer springs forth, all in one file,
With pages and sources aligned in style,
The seeds and their graphs in HTML gleam,
No external dance—just a self-contained dream!
One click to explore, one file to behold,
The wiki's whole story, in pixels of gold.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(wiki-viewer): single-file HTML viewer for any wiki' clearly and concisely summarizes the main change: adding a new wiki-viewer skill that renders wikis as self-contained HTML files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wiki-viewer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rohitg00 rohitg00 merged commit 9fc35f5 into main May 9, 2026
4 of 5 checks passed
@rohitg00 rohitg00 deleted the feat/wiki-viewer branch May 9, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant