Skip to content

fix(mod, opencode): name a review by what the CLI opened, not the typed words - #1737

Merged
backnotprop merged 1 commit into
mainfrom
fix/mod-subject-from-cli
Oct 6, 2026
Merged

backnotprop merged 1 commit into
mainfrom
fix/mod-subject-from-cli

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Problem

/plannotator-annotate . a.md opens only a.md (the CLI's shared selection drops the stray .), but the Claude Code mod built the subject from the typed words, so the command reply, status line and decision heading said "2 files: ., a.md". The Target line was already right.

Fix

  • Shared contract (packages/shared/plannotator-tool.ts, pasted into apps/hook/hooks/mod/tool.ts): plannotatorTargetSubject(kind, target) names annotate and review sessions from the target the CLI reports. It gives the basename for one file, a URL's host, "N files: a, b" for a bundle, PR #N / MR !N, or changes in <dir>.
  • Mod: when the ready line carries the target (fix: decisions name their full target; refuse stale-tab decisions on a reused port #1729), the launch's base subject is derived from it. Same-named reviews are still told apart by plannotatorDistinctSubjects. An older CLI that reports no target keeps the typed-words subject. A review typed with no words stays "local changes". Plan and last keep their subjects.
  • OpenCode 2: OpenCodeLaunchRegistry applies the same rule in onServer. A tool bundle's Files: line now uses the CLI's resolved absolute paths, as the slash command's already did. Subjects carry names; full paths appear only in Target and Files lines.
  • Pi: no change. It already names sessions from its own resolved paths (absolutePath, bundleFiles, the resolved review directory).

Tests

  • Mod (targets.test.ts): . a.md gives subject a.md in the reply, status line and heading. A bundle typed with prose words lists only the real files. Review prose is named by the reviewed directory, and no words gives "local changes". The tool bundle carries names in the subject and paths in Targets. An older CLI falls back to the typed words. The first three fail without the fix.
  • OpenCode (plannotator-tool.test.ts, stub CLI): the slash command . notes.md is named notes.md with a full Target line. The tool bundle's Files line carries full paths. Both fail without the fix.
  • Shared: unit cases for plannotatorTargetSubject.

Ran: mod bun tests (140 pass), OpenCode plugin + shared tool tests, Pi extension tests (436 pass), bun run typecheck, and the mod engine harness (scripts/test-claude-code-mod.sh, 17 pass) with a temp CLAUDE_CONFIG_DIR.

…ed words

/plannotator-annotate . a.md opens a.md alone (the CLI's shared selection
drops the stray '.'), but the mod named the session from the typed words:
the command reply, status line and decision heading said '2 files: ., a.md'
while the Target line was right.

- Shared contract (copied into the mod): plannotatorTargetSubject(kind,
  target) names annotate/review from the target the CLI reports (file name,
  URL host, bundle file names, PR #N / MR !N, changes in <dir>).
- Mod: when the ready line carries the target, the launch's base subject is
  derived from it; an older CLI that reports nothing keeps the typed-words
  subject. A review typed with no words stays 'local changes'.
- OpenCode 2: the launch registry does the same on onServer, and a tool
  bundle's Files: line uses the CLI's resolved paths, like the slash
  command's (names in subjects, full paths in Target/Files lines).
- Pi already names sessions from its own resolved paths; unchanged.
@backnotprop
backnotprop merged commit e44ae1c into main Oct 6, 2026
28 checks passed
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