* fix(opencode): reuse local server for review flows
Try the default local OpenCode server before spawning a new one, and resolve bundled assets and command paths correctly when the plugin is loaded from source during local testing.
* Fix typecheck after narrowing the opencode type to the sdk
* feat(plan-diff): word-level inline diff rendering
Two-pass hierarchical diff (diffLines outer + diffWordsWithSpace inner)
so modified plan blocks render with inline insertions/deletions in
context instead of showing the whole old block struck-through above the
whole new block. Resolves#560.
Engine (packages/ui/utils/planDiffEngine.ts):
- computeInlineDiff runs a second-pass word diff on modified blocks
that pass a whitelist gate (paragraph/heading/list-item with matching
structural fields).
- Sentinel substitution atomizes inline-code spans, markdown links, and
fenced code blocks before diffWordsWithSpace runs, so diff markers
never land inside backticks, link hrefs, or across fence boundaries.
Fence regex uses a backreference so variable-length (e.g., 4-backtick
wrapping 3-backtick) fences are matched atomically.
- Annotation context for an inline-diffed modified block now captures
both old and new content so comments on struck-through words preserve
that text in the exported feedback.
Renderer (packages/ui/components/plan-diff/PlanCleanDiffView.tsx):
- New InlineModifiedBlock component renders a modified block as one
structural wrapper with <ins>/<del> wrappers inside, parsed through
the local InlineMarkdown in a single pass so markdown delimiter pairs
survive across token boundaries.
- InlineMarkdown extended to recognize <ins>/<del> tag passthrough
(with recursive parsing of the wrapped content) and to recursively
parse link anchor text so diff markers inside links render correctly.
- Plain-text stop-char scanner includes '<' so <ins>/<del> dispatch
re-enters the loop instead of swallowing tag text.
- Click-to-annotate works in every editor mode (not just comment), with
the block-level onClick opening the popover directly.
Mode switcher (packages/ui/components/plan-diff/PlanDiffModeSwitcher.tsx):
- Adds a third "Classic" tab between Rendered and Raw. Rendered is the
new word-level default (labeled "exp"); Classic forces the legacy
block-level stacked fallback for every modified block.
Styling (packages/ui/theme.css, packages/editor/index.css):
- plan-diff-word-added / plan-diff-word-removed utility classes for
inline highlights with box-decoration-break: clone across line wraps.
- Inline <code> inside the diff wrappers picks up a tinted background
so code-pill changes read unambiguously green/red.
- New plan-diff-modified class (amber border) for inline-diff modified
blocks, matching the GitHub/VSCode convention of green=add,
red=remove, yellow=both.
Tests (packages/ui/utils/planDiffEngine.test.ts):
- 18 tests covering the engine's qualification gate, structural-field
matching, sentinel round-trip (inline code / links / fences), token
content for common edit patterns.
For provenance purposes, this commit was AI assisted.
* chore(demo): restructure default demo, add VITE_DIFF_DEMO stress test
Demo content changes that support the word-level diff work but do not
alter shipped app behavior — only what other devs see running dev:hook.
packages/editor/demoPlan.ts (default V3 editor content):
- Added a "Context" section at the top of the plan with prose that
showcases the word-level engine in V2→V3 diff: bold phrase swap,
inline-code pill swaps, a link URL change, and a single-line code
edit inside a config block.
- Moved the mermaid architecture diagram and graphviz service map to
an "Appendix: Diagrams" section at the end of the plan; they were
rendering ugly mid-document.
apps/hook/dev-mock-api.ts (Vite mock for the diff API):
- PLAN_V1 / PLAN_V2 split into *_DEFAULT (original Real-time
Collaboration plan — preserved identically from pre-branch state) and
*_DIFF_TEST (the 20-case Auth Service Refactor diff-engine stress
test, kept as an opt-in tool).
- Resolves which pair to serve based on VITE_DIFF_DEMO env var. Matches
the V2 Context section to the new V3 Context, with differences that
produce rich word-level inline diffs on first load.
- Diagrams moved to Appendix in V2_DEFAULT to match V3.
packages/editor/App.tsx:
- Both demo imports are active. VITE_DIFF_DEMO=1 swaps
DIFF_DEMO_PLAN_CONTENT into the editor's default; unset renders the
original Real-time Collaboration plan as before.
packages/editor/demoPlanDiffDemo.ts (new):
- 20-case stress test (paragraphs, headings, lists, tables, fences,
blockquotes, known limitations). Each case has an identical
"What to watch for" blockquote label in both V2 and V3 so the diff
view cleanly isolates each case. Opt-in only.
.gitignore:
- Ignore .claude/ runtime lock/state files. Machine-specific content
that should not be tracked.
For provenance purposes, this commit was AI assisted.
* style(plan-diff): refine modified-block visual — amber gutter, no fill
Drop the yellow background fill from .plan-diff-modified and keep only a
softened amber left border. Added/removed blocks remain loud (full fill +
strong border) because add/remove are block-scope events — the whole
block matters. Modify is a word-scope event — the individual changed
words carry loud inline red/green highlights, and a block-level fill
would compete with that inline work. The amber gutter at 75% opacity now
reads as a quiet "look inside, the change is in the text" marker that
sits coherently with the rest of the palette.
For provenance purposes, this commit was AI assisted.
* fix(plan-diff): sanitize link hrefs against javascript: / data: schemes
PlanCleanDiffView has its own local copy of InlineMarkdown (separate
from the one in Viewer.tsx). The link-rendering branch was passing the
captured URL directly to href with no validation, so a plan containing
[click me](javascript:alert(document.cookie))
would render as a live clickable anchor in the diff view. Plan content
is attacker-influenced — Claude pulls from source comments, READMEs,
fetched URLs — so this is a real exploit path in the diff flow.
Port the same guard Viewer.tsx already has: sanitizeLinkUrl() rejects
javascript:, data:, vbscript:, and file: schemes (case-insensitive, with
optional leading whitespace). Rejected links render their anchor text as
plain text instead of a clickable <a>, so the content is still visible
to the reader but no longer dangerous.
For provenance purposes, this commit was AI assisted.
When a plan contains hex color values (#rgb, #rrggbb, #rgba, #rrggbbaa),
the InlineMarkdown renderer now shows a small filled swatch inline to the
left of the code so the actual color is immediately visible.
Sites that support Cloudflare's "Markdown for Agents" (or similar
content negotiation) now return markdown directly, skipping the Jina
Reader and Turndown conversion entirely. The negotiation attempt uses
a short 5s timeout so failures fall through quickly to the existing
pipeline.
For provenance purposes, this commit was AI assisted.
Runs three checks on the linux-x64 binary after compilation, before
artifact upload: --help (binary loads), review server startup (full
import chain + bundled HTML + git integration + HTTP binding), and
annotate server startup. Catches the class of build breakage where
compilation succeeds but the binary crashes on launch.
For provenance purposes, this commit was AI assisted.
- Rewrote the annotate command docs page to cover all four input types
(URLs, HTML files, folders, markdown) with Jina Reader pipeline details,
--no-jina flag, JINA_API_KEY, and source badge
- Added PLANNOTATOR_JINA and JINA_API_KEY to the environment variables
reference page
- New blog post: "Annotate Any Web Page or HTML File" with embedded video
For provenance purposes, this commit was AI assisted.
Renovate's Immortal mode recreates closed PRs and automerges them
immediately. This is how #548 (Bun 1.3.12) landed on main despite
being explicitly closed. Disabling automerge ensures all dependency
PRs require human review.
For provenance purposes, this commit was AI assisted.
* fix(annotate): sanitize dangerous link protocols in markdown renderer
Block javascript:, data:, and vbscript: URLs in InlineMarkdown link
rendering. Links with dangerous protocols render as plain text instead
of clickable anchors. Uses a blocklist approach so existing links with
custom protocols (obsidian://, vscode://, Windows C:\ paths) continue
to work.
For provenance purposes, this commit was AI assisted.
* feat(annotate): add HTML-to-markdown and URL-to-markdown utilities
- html-to-markdown.ts: Turndown wrapper with GFM table rule, strips
script/style/noscript tags
- url-to-markdown.ts: Jina Reader (free, returns markdown) with
fetch+Turndown fallback. Warns on Jina failure, auto-skips Jina for
local/private URLs (localhost, 192.168.*, 10.*, etc.)
- config.ts: add jina setting and resolveUseJina() with priority chain
--no-jina flag > PLANNOTATOR_JINA env > config.json > default true
For provenance purposes, this commit was AI assisted.
* feat(annotate): support HTML files and URLs in annotate command
Extend the annotate subcommand to accept .html/.htm local files
(converted via Turndown) and https:// URLs (fetched via Jina Reader
with fetch+Turndown fallback). URL content is fetched terminal-side
before opening the browser.
Add --no-jina global flag to disable Jina Reader per-invocation.
Add 10MB file size guard for local HTML files.
For provenance purposes, this commit was AI assisted.
* feat(annotate): HTML files in folder browser and on-demand conversion
- Widen file browser glob to include .html/.htm alongside markdown
- handleDoc converts HTML files via Turndown on demand when selected
- hasMarkdownFiles accepts optional extensions param for folder validation
- Add sourceInfo field to annotate server API response
- Add _site/, public/, out/, .docusaurus/, .jekyll-cache/,
storybook-static/ to FILE_BROWSER_EXCLUDED
For provenance purposes, this commit was AI assisted.
* feat(annotate): source attribution badge for HTML/URL annotations
Show a subtle badge in DocBadges displaying the URL hostname or HTML
filename for converted content. Thread sourceInfo from API response
through App → Viewer → DocBadges.
Also update Pi extension to accept HTML-only folders in annotate mode.
For provenance purposes, this commit was AI assisted.
* test: update CLI help text assertion for HTML/URL annotate support
For provenance purposes, this commit was AI assisted.
* fix(annotate): address PR review findings
Security:
- Add project-root containment check for HTML files in /api/doc handler
using exported isWithinProjectRoot() from resolve-file.ts
- Blocks path traversal via absolute paths or ../ escapes
isLocalUrl fixes:
- Add bracketed IPv6 loopback [::1] detection
- Replace hostname.startsWith('10.') with proper IPv4 regex to avoid
matching public hostnames like 10.example.com
Revert Pi extension change:
- Pi server doesn't implement HTML file browsing or conversion yet
- Keep Pi folder validation markdown-only until both implementations
are updated per CLAUDE.md guidelines
Cleanup:
- Remove dead el.children || el.childNodes fallback in table rule
- Extract hostnameOrFallback() helper to @plannotator/shared/project
replacing duplicated try/catch IIFEs in DocBadges and index.ts
For provenance purposes, this commit was AI assisted.
* feat(annotate): Pi extension HTML annotation parity
Bring the Pi extension to full parity with the Bun server for HTML
annotation support:
- Vendor html-to-markdown and url-to-markdown via vendor.sh
- walkMarkdownFiles now scans .html/.htm alongside markdown
- handleDocRequest converts HTML files on-demand via Turndown with
isWithinProjectRoot containment check
- serverAnnotate includes sourceInfo in /api/plan response
- index.ts supports URL detection (Jina Reader + fallback), HTML file
detection with Turndown conversion, folder HTML validation, and 10MB
file size guard
- openMarkdownAnnotation accepts and threads sourceInfo
- Add turndown as a Pi extension dependency
For provenance purposes, this commit was AI assisted.
* fix(pi): Obsidian vault walks stay markdown-only, add try/catch for HTML
- Add extensions param to walkMarkdownFiles (default: HTML-inclusive)
- Obsidian callers pass /\.mdx?$/i to match Bun server behavior
- Add try/catch around HTML file reads in handleDocRequest
For provenance purposes, this commit was AI assisted.
* fix(annotate): address second review — base-block traversal, metadata IP, dead code
Security:
- Add isWithinProjectRoot check to the base-relative block for HTML
files in both Bun and Pi /api/doc handlers. Previously HTML files
served via the base query param bypassed the containment guard.
- Add 169.254.0.0/16 (link-local / cloud metadata) to isLocalUrl
private IP ranges
Cleanup:
- Remove dead hostname === "[::1]" check (WHATWG URL parser strips
brackets; hostname === "::1" already handles it)
- Remove dead parent?.childNodes fallback in table cell() function
For provenance purposes, this commit was AI assisted.
* refactor(annotate): replace custom table rules with turndown-plugin-gfm
Drop ~60 lines of hand-rolled GFM table conversion that had a bug
(tables without explicit <thead> produced invalid GFM). Use the
official turndown-plugin-gfm plugin (24KB) which correctly handles
all table patterns plus adds strikethrough and task list support.
For provenance purposes, this commit was AI assisted.
* fix(annotate): handle all CommonMark backslash escapes in InlineMarkdown
Expand the backslash escape regex to cover all CommonMark-defined
escapable characters (. ) - # > + | { } &), not just the subset
the parser uses for formatting. Fixes literal backslashes appearing
in rendered output for Turndown-escaped content like "1\." → "1.".
For provenance purposes, this commit was AI assisted.
* fix(annotate): prevent SSRF via redirect to private/local URLs
Replace redirect: "follow" with redirect: "manual" in fetchViaTurndown
and validate each redirect hop against isLocalUrl. Blocks attacks where
an external URL redirects to cloud metadata endpoints (169.254.169.254)
or other private IPs. Limits redirect chain to 10 hops.
For provenance purposes, this commit was AI assisted.
* chore: update lockfile for turndown-plugin-gfm in Pi extension
bun install needed to resolve turndown-plugin-gfm in the Pi extension
workspace after adding it to apps/pi-extension/package.json.
For provenance purposes, this commit was AI assisted.
* fix(annotate): switch to @joplin/turndown-plugin-gfm, fix TS errors
Replace unmaintained turndown-plugin-gfm (2017, v1.0.2) with the
actively maintained Joplin fork (2025, v1.0.64, 16KB).
Fix TypeScript errors that broke CI:
- Add @ts-expect-error for untyped @joplin/turndown-plugin-gfm import
- Restructure fetchViaTurndown redirect loop to avoid uninitialized
variable — first fetch before loop, loop only for redirects
For provenance purposes, this commit was AI assisted.
* fix(annotate): use proper declarations.d.ts instead of ts-expect-error
Add declarations.d.ts for @joplin/turndown-plugin-gfm with typed
function signatures, remove the ts-expect-error suppression.
For provenance purposes, this commit was AI assisted.
* fix: explicitly include declarations.d.ts in shared tsconfig
CI's tsc wasn't finding the ambient module declaration with implicit
include. Add explicit include to ensure declarations.d.ts is always
picked up regardless of environment.
For provenance purposes, this commit was AI assisted.
* fix: use ts-expect-error for @joplin/turndown-plugin-gfm types
CI's tsc does not pick up ambient declarations.d.ts files despite
local tsc finding them — likely a module resolution discrepancy
between environments. Revert to @ts-expect-error which passes in
both CI and local typecheck.
For provenance purposes, this commit was AI assisted.
* fix(annotate): body size limit for URL fetches, redirect error, file: protocol
- Add 10MB body size limit to both Jina and fetch+Turndown URL paths,
matching the local HTML file guard. Streams response body and aborts
if limit exceeded.
- Distinguish "Too many redirects" from a genuine 3xx response after
redirect loop exhaustion.
- Add file: to the dangerous protocol blocklist in sanitizeLinkUrl.
For provenance purposes, this commit was AI assisted.
* fix(annotate): HTML folder outside cwd, HTML linked doc navigation
- Remove containment check from base-relative block for HTML files in
both Bun and Pi /api/doc handlers. Matches markdown behavior so HTML
files in annotated folders outside cwd are served correctly.
Standalone block (no base) retains its cwd check as fallback.
- Widen isLocalMd → isLocalDoc to treat .html/.htm links as linked
documents. Clicking [Next](next.html) in a converted page now opens
it via /api/doc with Turndown conversion instead of a new browser tab.
For provenance purposes, this commit was AI assisted.
* fix(annotate): full loopback range, drain redirect bodies, document env vars
- Expand loopback check from just 127.0.0.1 to the full 127.0.0.0/8
range so all loopback addresses skip Jina Reader
- Cancel redirect response body before re-fetching to avoid leaking
TCP connections back to the pool
- Document PLANNOTATOR_JINA and JINA_API_KEY in CLAUDE.md env var table
For provenance purposes, this commit was AI assisted.
* fix(annotate): IPv6 loopback, readBodyWithLimit fallback, env var docs, comments
- Add [::1] back to isLocalUrl — WHATWG URL hostname getter preserves
brackets for IPv6 (verified: Bun and Node both return "[::1]").
Add comment explaining the empirical verification so future reviewers
don't re-flag.
- Fix readBodyWithLimit null-body fallback to still enforce the 10MB
limit via text length check instead of silently falling through.
- Document PLANNOTATOR_JINA and JINA_API_KEY in AGENTS.md env var table
(CLAUDE.md is a symlink to AGENTS.md).
- Add comments to base-relative blocks in both Bun and Pi handleDoc
explaining the intentional lack of containment check (matches
pre-existing markdown behavior, base is set server-side).
For provenance purposes, this commit was AI assisted.
* fix(annotate): block IPv4-mapped IPv6 and private IPv6 ranges in isLocalUrl
Add PRIVATE_IPV6 regex matching bracketed IPv6 private/reserved ranges:
- ::ffff: (IPv4-mapped — embeds private IPv4 as hex, e.g. [::ffff:c0a8:1])
- fe80: (link-local)
- fc00::/7 (unique-local, covers fc00:: through fdff::)
Closes the redirect-SSRF bypass where a public URL redirects to a
private address expressed as IPv4-mapped IPv6, e.g.
http://[::ffff:169.254.169.254]/latest/meta-data/
For provenance purposes, this commit was AI assisted.
* fix(annotate): document IPv6 hostname verification, sourceInfo type, annotate flow
- Expand isLocalUrl comment with full empirical verification table
showing actual hostname getter output for every IPv6 format in both
Bun and Node — prevents false-positive review findings about brackets
- Add sourceInfo to /api/plan response type in App.tsx for type safety
- Update CLAUDE.md annotate flow diagram to reflect HTML/URL/folder
input types
For provenance purposes, this commit was AI assisted.
* fix(annotate): escape \(, cancel response bodies on error, doc sourceInfo
- Add ( to backslash escape regex alongside existing ) — Turndown
emits \( in link-adjacent contexts
- Cancel response body before throwing on !res.ok in both fetchViaJina
and fetchViaTurndown error paths (redirect loop already did this)
- Document sourceInfo field in AGENTS.md annotate server API table
For provenance purposes, this commit was AI assisted.
* fix(annotate): skip base injection for URL annotations, body cleanup
- Skip dirname(filePath) base injection when filePath is a URL in both
Bun and Pi annotate servers. dirname on a URL string produces a
nonsensical filesystem path, causing linked doc clicks to 404.
URL annotations now let links open normally instead.
- Cancel response body before throwing on content-type mismatch and
content-length overflow in fetchViaTurndown/readBodyWithLimit.
- Fix double parseInt in readBodyWithLimit content-length check.
- Correct AGENTS.md flow diagram: OpenCode not yet implemented for
HTML/URL annotation.
For provenance purposes, this commit was AI assisted.
* feat(annotate): OpenCode HTML file and URL annotation support
Add URL detection (Jina Reader + fallback), HTML file detection with
Turndown conversion, 10MB file size guard, and sourceInfo threading
to OpenCode's handleAnnotateCommand. Uses the same shared utilities
as the Bun CLI and Pi extension.
OpenCode uses the Bun server directly (startAnnotateServer from
@plannotator/server/annotate), so no server-side changes needed —
only the command handler routing was missing.
Note: folder annotation mode is not added (OpenCode didn't have it
before this PR for markdown either — separate scope).
For provenance purposes, this commit was AI assisted.
* chore(annotate): update slash command description, align fetch log messages
- OpenCode plannotator-annotate.md description now mentions HTML/URL
- Align fetch progress messages across all three clients: all now show
"(via Jina Reader)" or "(via fetch+Turndown)" consistently
For provenance purposes, this commit was AI assisted.
* fix(annotate): skip conversion for .md URLs, wikilink HTML targets, cleanup
- URLs ending in .md/.mdx are fetched raw — no Jina, no Turndown.
Content is already markdown. Removes text/plain from fetchViaTurndown
content-type whitelist since .md URLs are now short-circuited.
- Wikilink regex widened to preserve .html/.htm targets instead of
appending .md (e.g. [[page.html]] no longer becomes page.html.md)
- Remove redundant existsSync before statSync in OpenCode handler
For provenance purposes, this commit was AI assisted.
* test(annotate): add htmlToMarkdown conversion tests
Tests cover the core conversion utility that all three clients depend on:
- Basic HTML → markdown (headings, paragraphs, links, code blocks)
- Tables with and without <thead> (the GFM plugin bug that was caught)
- Script/style/noscript stripping
- Strikethrough (GFM)
- Empty HTML handling
- Dangerous links preserved (sanitization is in the renderer, not here)
For provenance purposes, this commit was AI assisted.
* fix(annotate): check content-type before treating .md URLs as raw markdown
URLs ending in .md/.mdx (e.g. GitHub's viewer page for README.md)
may return HTML instead of raw markdown. fetchRawText now checks the
response content-type — if the server returns HTML, returns null so
the caller falls through to Jina/Turndown for proper conversion.
For provenance purposes, this commit was AI assisted.
* fix(annotate): add SSRF redirect protection to fetchRawText
fetchRawText (for .md/.mdx URLs) was using default redirect: "follow"
with no isLocalUrl validation on redirect hops — a .md URL redirecting
to 169.254.169.254 would be followed and credentials returned as
"markdown". Now uses redirect: "manual" with per-hop isLocalUrl checks,
matching fetchViaTurndown's SSRF protection.
For provenance purposes, this commit was AI assisted.
Safari's compositor resets scrollTop to 0 when momentum-scrolling ends
inside a container whose child is a web-component shadow DOM (the
@pierre/diffs `<diffs-container>`). The reset bypasses all JavaScript
APIs — neither scrollTo nor the scrollTop setter fires.
Add a WebKit-only scroll event listener that detects the bogus reset
(scrollTop jumping from >200 to 0 in a single event, which cannot
happen during normal scrolling) and synchronously restores the last
known good position before the browser paints the wrong frame.
Closes#540
For provenance purposes, this commit was AI assisted.
Switch outside-click dismiss from pointerdown to mousedown and skip
on multi-click (event.detail >= 2).
The capture-phase pointerdown listener from useDismissOnOutsideAndEscape
was calling handleToolbarClose on the 3rd click of a triple-click,
which removed the word <mark> and normalised text nodes. That DOM
mutation between pointerdown and mousedown reset the browser's
click-count tracking, so mousedown fired with detail=1 instead of
detail=3 — placing a cursor instead of selecting the paragraph.
Using mousedown instead of pointerdown because MouseEvent.detail is
spec-guaranteed to carry the click count (UI Events spec), whereas
the Pointer Events spec says PointerEvent.detail SHOULD be 0.
Multi-click mousedowns are part of an active selection gesture; the
web-highlighter CREATE handler already cleans up stale pending
highlights when a new selection commits, so the eager dismiss is
unnecessary.
Side-benefit: touch scroll gestures no longer dismiss the toolbar
(browsers suppress compatibility mousedown for scrolls); only taps
dismiss. closeOnScrollOut already handles the anchor-scrolled-away
case.
Regression introduced in 39b63c9.
Fixes#544
For provenance purposes, this commit was AI assisted.
Bun 1.3.12 introduced a regression where cross-compiled macOS binaries
lose their ad-hoc linker signature, causing macOS Sequoia to SIGKILL
them immediately. Pin bun-version to 1.3.11 across all three workflow
jobs (test, build, npm-publish) until the Bun issue is resolved.
Fixes#541
Bumps version to 0.17.9.
* fix(annotate): include original file annotations when submitting from linked doc view
When using `plannotator annotate` on a file with markdown links, annotations
on the original file were silently dropped if the user clicked "Send
Annotations" while viewing a linked document. The root cause was that
`getDocAnnotations()` only read from `docCache` (previously-visited linked
docs) and the current linked doc — it never read from `savedPlanState`, where
the original file's annotations are stashed during navigation.
This adds a `sourceFilePath` option to `useLinkedDoc` so the hook can key the
stashed annotations in the returned Map. Also updates `docAnnotationCount` in
`open()` so button visibility and exit warnings reflect reality immediately,
not only after calling `back()`.
Closes#535
For provenance purposes, this commit was AI assisted.
* fix(annotate): include docCache in count when re-entering linked doc navigation
The first branch of open() set docAnnotationCount from only the original
file's annotations, ignoring any linked docs already cached from prior
navigation. After original → linkedA → back → linkedB, the count dropped
to 0 if the original had no annotations, hiding the Send Annotations button
despite linkedA's annotations sitting in docCache.
Also adds defensive spread copies for savedPlanState arrays in
getDocAnnotations() to match the hook's existing pattern.
For provenance purposes, this commit was AI assisted.
* fix(annotate): exclude destination doc from docAnnotationCount to prevent double-counting
When navigating to a previously-cached linked doc, the destination's
cached annotations were included in docAnnotationCount AND loaded into
allAnnotations, causing the exit warning to report an inflated count.
Skip the destination filepath when summing the non-active total.
For provenance purposes, this commit was AI assisted.
* fix(annotate): treat backlinks to source file as back() navigation
When a linked document contains a link back to the source file (e.g.,
original.md → design.md → backlink to original.md), opening it as a
linked doc created two competing Map entries for the same filepath in
getDocAnnotations(). The empty linked-doc entry overwrote the stashed
annotations, silently dropping them.
Now detects when the resolved destination matches sourceFilePath and
routes through back() instead, which caches the current linked doc
and restores the source file with its annotations intact.
For provenance purposes, this commit was AI assisted.
feat(review): configurable default diff type with first-run setup
Add `defaultDiffType` as a persistent user setting (cookie + config.json) with 'unstaged' as the default, matching `git diff` semantics. A first-run setup dialog prompts users to choose their preferred default on first review session. The setting is also available in Settings > Display.
Entry points (hook, opencode, pi-extension) read the config via `resolveDefaultDiffType()` instead of hardcoding. The setup dialog applies the chosen diff type to the active review immediately. P4 users are excluded from the Git-specific dialog.
Based on the community contribution in #521 by Hendrik Richert.
Co-authored-by: Hendrik Richert <hendrik.richert@swisscom.com>
Adds a Close button to review and annotation sessions so users can exit
cleanly without sending feedback or killing the agent. Works across all
agent origins and includes a warning dialog when annotations would be lost.
Fixes#522
Co-authored-by: gwynnnplaine <vladyslav.hrabovyii@gmail.com>
* fix: pin bullet markers to top of multi-line list items
- Add `items-start` to list item flex container so markers align to the
first line instead of centering vertically across the full item height
- Use consistent bullet glyph (•) across all nesting levels
- Add test fixture 10 covering all bullet/list types and inline gap cases
For provenance purposes, this commit was AI assisted.
* fix: improve inline markdown rendering
- Add strikethrough support (~~text~~)
- Fix ***bold italic*** by checking triple-asterisk before double
- Nudge checkbox icons down 3px to align with text baseline
For provenance purposes, this commit was AI assisted.
* fix: add backslash escaping to inline markdown renderer
- Add \* \_ \` \[ \~ \\ escape sequences — consume backslash and emit literal character
- Add \ to nextSpecial scanner so the escape handler fires correctly mid-text
For provenance purposes, this commit was AI assisted.
* fix: add autolink support to inline markdown renderer
- Handle <https://url> as clickable external links
- Handle <email@domain.com> as mailto links
- Add < to nextSpecial scanner so autolinks are detected mid-text
For provenance purposes, this commit was AI assisted.
* chore: remove HTML entities from test fixture
Not a supported feature — matches Obsidian behavior.
For provenance purposes, this commit was AI assisted.
* fix: prevent empty DocBadges wrapper in sticky header row layout
In row layout, check hasPreviousVersion && planDiffStats (what
PlanDiffBadge actually needs) instead of onPlanDiffToggle (always
truthy). Prevents an empty wrapper div that created phantom width
via gap-x-3 in the sticky bar.
For provenance purposes, this commit was AI assisted.
The installation page was bloated with 55 lines of SLSA/SHA256
verification details before users could see agent setup instructions.
Moved to /docs/reference/verifying-your-install/ with a one-line link.
For provenance purposes, this commit was AI assisted.
Windows CMD install script had no cache busting at all — OpenCode
users on CMD stayed on stale plugin versions indefinitely.
For provenance purposes, this commit was AI assisted.
* fix(annotate): add missing obsidian vault endpoints to annotate servers
Both the Bun and Pi annotate servers were missing the three Obsidian
reference endpoints (/api/obsidian/vaults, /api/reference/obsidian/files,
/api/reference/obsidian/doc), making the vault browser unavailable in
annotate mode. Added the handlers to both servers.
For provenance purposes, this commit was AI assisted.
* feat(sidebar): merge vault browser into files tab
Vault is conceptually just another directory — same tree UI, same
expand/collapse, same annotation counts. Rather than maintaining a
parallel tab and hook, vault now appears as a collapsible section
inside the Files tab alongside any other configured directories.
Changes:
- Add `isVault` flag to `DirState` and `addVaultDir()` to
`useFileBrowser` — fetches from the Obsidian endpoint and stamps
the dir so downstream code can route to the correct API
- Remove `useVaultBrowser` hook and `VaultBrowser` component entirely
- Remove `"vault"` from `SidebarTab` type
- Update `App.tsx`: drop all parallel vault state; wire vault into the
combined file browser fetch effect; update `handleFileBrowserSelect`
to pick the right URL builder based on `isVault`; update
`handleOpenLinkedDoc` and annotation count derivation to cover vault
dirs via the same path
- Fix sticky header lane: remove the `!linkedDocHook.isActive` gate
that was suppressing sticky headers for linked docs and annotate mode
- Remove primary border on linked doc viewer card
- Add `ObsidianIcon` (full branded logo) and `ObsidianIconRaw`
(compact purple mark) to `packages/ui/components/icons/ObsidianIcons.tsx`
- Display `ObsidianIconRaw` in the FileBrowser directory header for
vault dirs
Net: -334 lines. One Files tab handles all directory types uniformly.
For provenance purposes, this commit was AI assisted.
* fix(sidebar): fix stale vault dirs and unrecoverable vault load failures
Three issues identified in review:
1. Switching vault paths accumulated stale sections — addVaultDir now
atomically replaces all existing vault dirs instead of appending,
so changing the configured vault never leaves a ghost section behind.
2. Disabling the vault left the old section visible until reload —
a new clearVaultDirs() method prunes all isVault entries, called
via a dedicated effect that fires whenever vaultPath becomes empty.
3. Vault load failures were unrecoverable in-session — the Retry button
only called fetchAll(regularDirs). FileBrowser now accepts an
onRetryVaultDir prop and routes vault dir retries to addVaultDir
(which re-fetches from the Obsidian endpoint) instead of the
regular-dirs-only fetchAll.
For provenance purposes, this commit was AI assisted.
PR #446 refactored the session_start handler to use applyPhaseConfig()
but changed the idle branch to only call restoreSavedState(), which
no-ops when savedState is null (i.e., fresh sessions that were never
in planning mode). This left plannotator_submit_plan in the active
tool set even though plan mode hadn't been activated — a regression
from the fix in #387.
Now the idle branch explicitly strips planning-only tools when there
is no saved state to restore.
* feat(themes): add Kanagawa Dragon, Wave, and Bones themes
Adds all three Kanagawa variants as dark-only themes, mapped from the
official Ghostty color palette to the app's CSS variable schema.
For provenance purposes, this commit was AI assisted.
* fix(themes): sort Kanagawa themes into alphabetical position
For provenance purposes, this commit was AI assisted.
* feat(themes): replace Kanagawa Bones with Kanagawa Lotus
Bones is a community derivative; Lotus is the official third variant
from kanagawa.nvim. Light-only theme with yellow-tan paper background
mapped from the canonical lotusWhite/lotusInk palette.
For provenance purposes, this commit was AI assisted.
* style(themes): standardize border radius to 0.625rem
Replaces the previous defaults (0.5rem, 0.75rem, 1rem) with 0.625rem
across all themes. Intentionally sharp themes preserved: Doom 64 (0px),
Terminal (4px), Solar Dusk (0.3rem).
For provenance purposes, this commit was AI assisted.
The sticky header lane's row-layout DocBadges was rendering repo + branch +
plan-diff badges. With hasPreviousVersion true, the unwrapped flex content
exceeded availableForBar, causing the inline-flex flex-wrap container to
snap to max-width and wrap internally — leaving an empty rounded rectangle
extending under the right-side action buttons.
Gate the repo/branch block on !isRow so the sticky lane only shows the
plan-diff badge. Column layout (top-of-doc card) is unchanged.
For provenance purposes, this commit was AI assisted.