Repository navigation
fix(annotate): support @ markdown file references - #488
Merged
Merged
Conversation
OpenCode can pass annotate targets as @file references, so resolve markdown paths with an @ fallback only after the primary lookup misses. This preserves real @-prefixed filenames while making @README.md and quoted @ inputs resolve reliably.
backnotprop
added a commit
that referenced
this pull request
Apr 23, 2026
parseAnnotateArgs now returns rawFilePath alongside the stripped filePath so dispatch code can fall back to the literal form when the stripped form doesn't resolve — the node_modules / scoped- package case (e.g. @plannotator/ui/README.md). Wired in every dispatch site: apps/hook/server/index.ts (binary: folder, HTML, markdown) apps/opencode-plugin/commands.ts (OpenCode plugin: HTML, markdown) apps/pi-extension/index.ts (Pi extension: all three) Folder and HTML branches use resolveAtReference(rawFilePath, existsSync- style predicate). Markdown branches use a small inline fallback against resolveMarkdownFile since that resolver has its own fuzzy-match and ambiguous-case handling we want to preserve. Reference-mode priority (strip wins when both exist) is preserved end- to-end — the helper tries stripped first on every call. #488's existing resolver tests pass unchanged. Full suite: 702/702. For provenance purposes, this commit was AI assisted.
backnotprop
added a commit
that referenced
this pull request
Apr 23, 2026
parseAnnotateArgs now returns rawFilePath alongside the stripped filePath so dispatch code can fall back to the literal form when the stripped form doesn't resolve — the node_modules / scoped- package case (e.g. @plannotator/ui/README.md). Wired in every dispatch site: apps/hook/server/index.ts (binary: folder, HTML, markdown) apps/opencode-plugin/commands.ts (OpenCode plugin: HTML, markdown) apps/pi-extension/index.ts (Pi extension: all three) Folder and HTML branches use resolveAtReference(rawFilePath, existsSync- style predicate). Markdown branches use a small inline fallback against resolveMarkdownFile since that resolver has its own fuzzy-match and ambiguous-case handling we want to preserve. Reference-mode priority (strip wins when both exist) is preserved end- to-end — the helper tries stripped first on every call. #488's existing resolver tests pass unchanged. Full suite: 702/702. For provenance purposes, this commit was AI assisted.
Owner
|
We're building Plannotator Workspaces, where agent plans, specs, and reviews can be collaborated on and distilled into standards and rules. Your annotations and reviews compound into a golden ruleset planning and review agents can use, and CI/CD can verify against. Joining the waitlist gets you lifetime free access as an early contributor. https://plannotator.ai/workspaces/. Check the OSS contributor box. The OSS core isn't changing: same free and open source plugin, always. Thanks for #488. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@file.md.not_found, retry after stripping leading@.Problem
In OpenCode,
/plannotator-annotate README.mdworked, but/plannotator-annotate @README.mdfailed to open annotate mode for the file.The shared resolver treated
@README.mdas a literal filename and returnednot_foundwhen onlyREADME.mdexisted.Root Cause
resolveMarkdownFileinpackages/shared/resolve-file.tsdid not support@-prefixed file reference syntax.Changes
resolveMarkdownFileCore).resolveMarkdownFileas a wrapper that now:"..."/'...')not_foundand input starts with@, retries with leading@removednot_found/ambiguousresponses for clearer logs/errorsWhy this is safe
@spec.md(or similar) exists, it is found by the primary lookup and returned directly.@normalization is only applied after the primary lookup fails.@behavior remains unchanged./api/docpaths).Tests
Added coverage in
packages/server/resolve-file.test.ts:@README.mdvia fallback when@README.mddoes not exist@README.mdwhen it exists"@README.md"not_foundfor@nope.mdambiguousfor fallback case like@plan.mdwith multipleplan.mdmatchesValidation run:
bun test packages/server/resolve-file.test.ts(pass)Scope
packages/shared/resolve-file.tspackages/server/resolve-file.test.tsNo command template changes were required.