* feat: open linked .md files in read-only tabs with TOC navigation
When a plan references local .md files via markdown links, they now open
in a new browser tab using the full Plannotator viewer in read-only mode.
Changes:
- server: add /api/doc?path= endpoint with 4-strategy path resolution
(absolute, relative to project root, bare filename search). Returns 400
with match list on ambiguous filenames, 404 when not found, 403 on
path traversal. Only resolves files within process.cwd().
- Viewer: detect local .md links in InlineMarkdown and route them to
/?doc=<path>&readonly=true with a new-tab icon. Add isReadOnly prop
that guards the web-highlighter init (prevents phantom highlights) and
suppresses annotation toolbars.
- App: parse ?doc= URL param on load and fetch from /api/doc instead of
/api/plan. Set isReadOnly mode which shows a read-only banner, hides
approve/deny/feedback buttons, ModeSwitcher, Settings, AnnotationPanel,
and annotation panel toggle. Shows an error view (not a silent fallback)
when the document cannot be found or is ambiguous. Opens the sidebar to
the TOC tab automatically.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: upgrade linked docs to same-view annotatable navigation with aggregated feedback
Replace the new-tab read-only approach with same-view navigation: clicking a
.md link swaps the plan content in-place, preserving all annotations via a
docCache. Users can annotate linked docs and all feedback (plan + linked docs)
is aggregated into the deny/approve payload sent to Claude.
Key changes:
- New useLinkedDoc hook for state swapping, caching, and highlight restoration
- React key on Viewer forces clean unmount/remount (fixes web-highlighter DOM crash)
- exportLinkedDocAnnotations() aggregates linked doc feedback with filepath context
- UI: 2px primary border, "Linked File" badge, "Copy file" button, TOC filepath
indicator with back-to-plan button
- Fix Tailwind v4 cascade: move * { border-color } to @layer base so utility
classes like border-primary actually override it
- Compact TOC spacing (padding, gaps, line-height) without affecting Version Browser
- Exclude node_modules/.git from /api/doc bare filename glob
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: harden /api/doc endpoint and align linked doc annotation output
Restrict /api/doc to .md/.mdx files only, fix heading hierarchy and
sorting in exportLinkedDocAnnotations, and update CLAUDE.md docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: complete linked doc annotations in getDocAnnotations and fix useMemo deps
- getDocAnnotations() now includes the active linked doc's live
annotations alongside the cache, removing the implicit requirement
to call back() before reading
- Remove unstable linkedDocHook object from annotationsOutput useMemo
dependency array (was defeating memoization every render)
- Guard Cmd+Enter shortcut against linkedDocHook.isActive to prevent
accidental approve/deny while viewing a linked doc
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: include linked doc annotations in approve feedback gate
The handleApprove gate only checked plan-level annotations, silently
dropping linked-doc-only feedback on "approve with notes" (OpenCode).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add getDocAnnotations to annotationsOutput useMemo deps
Ensures memo recomputes when navigating to/from linked docs, preventing
stale annotation output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Michael Ramos <mdramos8@gmail.com>
* Add feature plan for VS Code diff viewer button
Scoping document for a new PlanDiffViewer button that opens
the plan diff in VS Code's native diff viewer via `code --diff`.
https://claude.ai/code/session_01FYcJkGsWfuiGy53x3pwCSW
* feat: add "Open in VS Code" button to plan diff viewer
Add a button in the PlanDiffViewer toolbar that opens the current
plan diff in VS Code's native side-by-side diff viewer. The server
writes both versions to temp files and spawns `code --diff`.
- New POST /api/plan/vscode-diff endpoint in packages/server/index.ts
- VS Code button with loading/error states in PlanDiffViewer.tsx
- Wire currentPlan/basePlan/baseVersion props from App.tsx
https://claude.ai/code/session_01FYcJkGsWfuiGy53x3pwCSW
* chore: update bun.lock after install
https://claude.ai/code/session_01FYcJkGsWfuiGy53x3pwCSW
* refactor: server reads plan versions directly instead of receiving from client
The server already has the current plan in its closure and can read
any version from disk via getPlanVersion(). No need to send plan
text from the UI — just send baseVersion.
https://claude.ai/code/session_01FYcJkGsWfuiGy53x3pwCSW
* chore: remove plan.md scoping document from repo
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract editor diff logic into shared packages/server/editor.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: use official VS Code SVG icon in plan diff viewer button
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: use history file paths directly for VS Code diff instead of writing temp files
Both plan versions already exist on disk in ~/.plannotator/history/.
Eliminates redundant file writes, fixes UPLOAD_DIR semantic misuse,
and corrects HTTP status codes for editor errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: rename editor.ts to ide.ts to avoid confusion with plan editor UI
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add ide.ts and vscode-diff endpoint to CLAUDE.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Adds an npm-publish job to the release workflow that publishes
@plannotator/opencode and @plannotator/pi-extension to npm with
OIDC trusted publishing and provenance attestation.
- Add pull_request and workflow_dispatch triggers (with dry-run input)
- Derive DRY_RUN env var; publish only on tag pushes or explicit opt-in
- Pin all action refs to SHA for supply-chain security
- Gate the release job on tag refs to avoid spurious GH releases
- Add id-token: write permission at workflow and job level for OIDC
* feat: add Plan Diff marketing dialog, Pi origin support, and docs
- Add PlanDiffMarketing first-run dialog announcing the Plan Diff feature
with per-origin video demo URLs (Claude Code, OpenCode, Pi)
- Add 'pi' as a first-class origin with display name and violet badge
- Add Plan Diff blog post (plan-diff-see-what-changed.md)
- Add brief Plan Diff mentions across READMEs and marketing docs
* polish: tighten blog post copy and reduce em dash usage
* fix: move PlanDiffMarketing to plan-diff/ and fix stale useEffect deps
* add plan diff preview screenshot for marketing dialog
* feat: add plan diff UI with sidebar, badge, and dual view modes
Shows what changed between plan iterations when Claude revises after
feedback. Adds a +N/-M badge below repo info that toggles the diff view,
a shared left sidebar with TOC and Version Browser tabs, and two diff
modes: rendered (color-coded borders) and raw markdown (+/- lines).
Closes#138, closes#111
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update CLAUDE.md project structure and align first-run dialog labels
- Add plan-diff/ and sidebar/ component subdirectories to CLAUDE.md
- Add new hooks and utils to CLAUDE.md project structure
- Rename "Table of Contents" to "Auto-open Sidebar" in UIFeaturesSetup
to match Settings.tsx label
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address code review findings for plan diff UX
- Fix badge stats mixing block counts with line counts (modifications
now fold into additions/deletions)
- Gate hasPreviousVersion on diffBasePlan being loaded to prevent
"Show Changes" no-op and ModeSwitcher disappearing
- Make sidebar reactive to Settings toggle (useEffect on tocEnabled)
- Match PlanDiffViewer badge layout to Viewer (flex-col) so badge
doesn't jump position on toggle
- Add "Exit Diff" label to the close button in diff view
- Remove dead CSS (plan-diff-removed-marker, plan-diff-modified)
- Clean up stale header comment and unused lines prop
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: second-round review cleanup for plan diff UX
- Fix stale "amber border" JSDoc in PlanCleanDiffView (actually green)
- Rename sidebar tab from "diff" to "versions" for clarity
- Gate VersionBrowser fetch on versionInfo being available
- Move .sidebar-tab-flag CSS into its own Sidebar section
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add loading state for version selection in sidebar
Add isSelectingVersion to selectBaseVersion, mirroring the existing
isLoadingVersions pattern. Shows "Loading..." on the selected version
button while the fetch is in progress.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address third-round code review findings
- Fix duplicate border/backdrop on TOC inside sidebar (className override)
- Fix loading indicator targeting wrong version button (fetchingVersion state)
- Fix "Show Changes" button silent no-op (gate on hasPreviousVersion)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: move date to slug suffix, improve Other Plans UX
- Slug format changed from YYYY-MM-DD-{heading} to {heading}-YYYY-MM-DD
- Other Plans: single "coming soon" banner instead of per-item labels
- Strip date suffix from plan names in sidebar for readability
- Remove cursor-not-allowed from Other Plans items
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add Plan Diff section to CLAUDE.md, alert on version fetch failure
- Document plan diff feature: engine, view modes, state management, sidebar
- Update slug format documentation to {heading}-YYYY-MM-DD
- Show native alert when version fetch fails instead of silent swallow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add table rendering to clean diff view
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add plan version history (backend + API)
Save plan versions to ~/.plannotator/history/{project}/{slug}/ on every
plan arrival. Serves previousPlan and versionInfo via /api/plan, and adds
GET /api/plan/version?v=N for fetching any historical version. Enables
future diff UI. Deduplicates identical resubmissions.
Closes#138, closes#111
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add version listing and project history APIs
Add GET /api/plan/versions to list all versions of the current plan with
timestamps, and GET /api/plan/history to list all plans in the current
project. Both endpoints available in shared server and pi extension.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add version history section and API endpoints to CLAUDE.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: rename misleading "diff" terminology to "annotations" in plan review context
The plan review flow used "diff" naming (exportDiff, diffOutput, .diff.md,
"Raw Diff", "Download .diff") for what is actually user annotations/feedback
on a plan. This was confusing since the code review flow legitimately uses
"diff" for actual git diffs. Renames all plan-review-context "diff" references
to "annotations" across code, UI labels, file extensions, and docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: update stale exportDiff references in ANNOTATE.md
Missed during the diff→annotations rename. Updates two references
to exportDiff() → exportAnnotations() in the annotate flow docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: rename remaining "Download Diff" label and tab type in App.tsx
The quick-save dropdown button still showed "Download Diff" and the
initialExportTab state type still used 'diff' instead of 'annotations'.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Add blog post about local diff review for coding agents
Covers the /plannotator-review command flow: slash command triggers
git diff capture, browser-based diff viewer with file tree and
line-level annotations, structured feedback sent back to the agent.
Technical details verified against server/index.ts, git.ts,
review.ts, App.tsx, DiffViewer.tsx, and FileTree.tsx.
https://claude.ai/code/session_01DxFhdSxDAcAQy6MYL49K4H
* Add blog post introducing Plannotator's Pi coding agent integration
Covers the full extension architecture: three-phase state machine
(idle/planning/executing), bash safety gating, file-based plan mode
with PLAN.md, browser-based review UI, progress tracking via [DONE:n]
markers, Node.js server constraint, and comparison table across all
three supported agents (Claude Code, OpenCode, Pi).
The workspace:* protocol is unresolvable outside the monorepo, causing
BunInstallFailedError for npm consumers. Since the build bundles
@plannotator/server into dist/index.js rather than externalizing it,
the dependency is build-time only and belongs in devDependencies.
* 🐛 fix(opencode): add missing @plannotator/server dependency
The opencode build failed because @plannotator/server was not declared
in apps/opencode-plugin/package.json, causing bun bundler to fail
resolving workspace packages.
* ✨ feat(ui): add auto-close delay with countdown on completion overlay
- Extend auto-close setting from boolean to delay options (off/immediate/3s/5s)
- Extract shared CompletionOverlay component from both editor and review apps
- Show countdown timer on completion screen when delay is set
- Add checkbox on completion overlay to enable auto-close (defaults to 3s)
- Replace toggle with select dropdown in Settings
* ♻️ refactor(ui): extract useAutoClose hook and clean up completion overlay
- Extract countdown logic into useAutoClose hook with phase state machine
- Extract SVG icons into named components (CheckIcon, ChatBubbleIcon)
- Add AUTO_CLOSE_OPTIONS constant for dropdown single source of truth
- Remove dead getAutoClose/setAutoClose boolean wrappers
* 🐛 fix(ui): handle window.close() failure with fallback message
Browsers block window.close() on tabs not opened by script. Add tryClose()
helper that detects failure via window.closed check, and show a fallback
message guiding the user to close manually.
The /api/image endpoint serves files from the local filesystem based on
a user-provided path parameter with no validation. This allows any
process on localhost to read arbitrary files (e.g., /etc/passwd,
~/.ssh/id_rsa) by requesting /api/image?path=<any-path>.
This commit adds:
- Path validation requiring image file extensions (png, jpg, gif, etc.)
- Path resolution via path.resolve() to normalize traversal sequences
- Upload extension validation against the same image allowlist
- Shared image.ts module used by all three servers (plan, review, annotate)
[agent]
* fix(browser): use open -a only for PLANNOTATOR_BROWSER on macOS
BROWSER env var follows Unix convention (executable + URL as arg),
so BROWSER=open correctly resolves to `open <url>` instead of
the broken `open -a open <url>`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(browser): use cmd.exe only for PLANNOTATOR_BROWSER on WSL
Same fix as the macOS open -a change: when only BROWSER is set (e.g.
VS Code devcontainer helper script), execute it directly instead of
routing through cmd.exe /c start, which can't run Linux paths.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Michael Ramos <mdramos8@gmail.com>
* feat: use BROWSER env var as fallback for opening UI
Closes#119
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add missing reference docs (were gitignored by reference/ pattern)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Migrate marketing site from Vite React SPA to Astro 5 with documentation (15 pages) and blog. Preserves landing page design, OKLCH design system, and S3/CloudFront deploy pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: named image references and annotate command (#67, #109)
Add human-readable names to image attachments throughout the annotation
pipeline, and add a new `plannotator annotate <file.md>` command for
annotating arbitrary markdown files.
Image names: ImageAttachment type replaces plain string paths, upload
endpoints return originalName, editable name inputs under thumbnails,
[name] path format in exported feedback, backward-compatible sharing.
Annotate command: new server module reusing plan editor HTML with
mode:"annotate", CLI subcommand, slash commands for Claude Code and
OpenCode, annotate mode UI (hides Approve, shows Send Annotations).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: move image name input to ImageAnnotator screen
The name input now appears on the full-screen annotator modal that opens
immediately when uploading/pasting an image, pre-populated from the
filename. Removes the disruptive inline name editing from thumbnails.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: stale closure in paste handler, update CLAUDE.md for new features
Fix race condition where globalAttachments was captured as empty array
in the paste event listener (missing dependency). Also update CLAUDE.md
to document ImageAttachment type, annotate server/flow, updated sharing
format with image support, and new slash commands.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add PLANNOTATOR_SHARE_URL env var so users can point share links at
their own self-hosted portal instance instead of share.plannotator.ai.
Threads the base URL through the same path as sharingEnabled: env var →
server options → API response → editor state → useSharing hook →
generateShareUrl(). Includes self-hosting guide and documentation.
Closes#12
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add drag-to-resize for the annotation panel, table of contents,
and file tree sidebar. Panel widths persist in cookie storage
across sessions and random-port hook invocations.
- Add useResizablePanel hook with left/right side support
- Extract ResizeHandle component with spread-friendly handleProps API
- Apply to AnnotationPanel, ReviewPanel, TableOfContents, FileTree
- Double-click handle to reset to default width
- Add min-w-0 on content areas for proper flex shrinking
Install scripts now check for the CLAUDE_CONFIG_DIR environment
variable when determining where to place the slash command file.
Falls back to the default ~/.claude/ when unset.
Closes#136
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>