Skip to content

CLI agent: align pi-tui with other pi-* deps and restore annotation tools - #3336

Merged
youknowriad merged 1 commit into
trunkfrom
claude/magical-meninsky-9f7a3f
May 4, 2026
Merged

CLI agent: align pi-tui with other pi-* deps and restore annotation tools#3336
youknowriad merged 1 commit into
trunkfrom
claude/magical-meninsky-9f7a3f

Conversation

@youknowriad

Copy link
Copy Markdown
Contributor

Related issues

  • Related to #

How AI was used in this PR

Authored end-to-end with Claude in an interactive session. I drove the high-level decisions (pi-tui bump, deciding the patch was obsolete, opting in to prompt history, restoring the annotation tools) and Claude handled discovery, edits, and verification. Reviewer focus areas:

  • The CombinedAutocompleteProvider now receives process.cwd() as a basePath — confirm that's the right scope for @-mention file completion.
  • Verify the new annotation tool definitions in apps/cli/ai/tools/open-annotation-browser.ts and apps/cli/ai/tools/wait-for-annotations.ts match the originals (they're byte-identical copies of the pre-Add GPT 5.5 support without modifying the system prompt #3328 versions from tools.ts, just split per-file).

Proposed Changes

  • Bump @mariozechner/pi-tui from 0.54.00.70.2 so it matches the other @mariozechner/pi-* packages (which were already on 0.70.2). The new CombinedAutocompleteProvider constructor takes a basePath argument, so we pass process.cwd(). This also enables @-mention file autocomplete in the chat prompt for free.
  • Wire up prompt history. pi-tui's Editor exposes addToHistory(); we now call it on every successful submit (covers both the immediate-resolve and queued-mid-turn paths). on an empty editor recalls the most recent prompt. The site-picker shortcut on still wins — pi-tui only navigates history forward once you're already in browse mode.
  • Delete patches/@mariozechner+pi-tui+0.54.0.patch. Its only purpose was dropping chalk from pi-tui's declared deps. With pi-ai and pi-coding-agent 0.70.2 also depending on (and actually using) chalk, patching just pi-tui can no longer keep chalk out of node_modules — the patch became a no-op blocker on npm install.
  • Restore the annotation agent tools. PR Add GPT 5.5 support without modifying the system prompt #3328 split apps/cli/ai/tools.ts into one-file-per-tool under apps/cli/ai/tools/, but open_annotation_browser and wait_for_annotations were never migrated. The /annotate skill calls those tools by name; without them the agent ends up grabbing at unrelated MCP tools. Re-added as apps/cli/ai/tools/open-annotation-browser.ts and apps/cli/ai/tools/wait-for-annotations.ts, registered in tools/index.ts.

Testing Instructions

  1. npm install — should complete with no patch errors and chalk pulled in transitively (expected).
  2. npm run typecheck — passes.
  3. npm test -- apps/cli/ai — 132 tests pass.
  4. Build the CLI and exercise the chat:
    npm run cli:build
    node apps/cli/dist/cli/main.mjs
    
    • Type @ and confirm a fuzzy file picker appears.
    • Submit a prompt, then press in an empty editor — the previous prompt should reappear.
    • Press on an empty editor — site picker still opens.
  5. Inside the chat, run /annotate and confirm the agent calls open_annotation_browser and wait_for_annotations (no "Studio MCP server isn't running" misdiagnosis).

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
  • Tests run and pass locally.

🤖 Generated with Claude Code

…ools

- Bump @mariozechner/pi-tui from 0.54.0 to 0.70.2 to match the rest of the
  @mariozechner/pi-* family. The 0.70.x CombinedAutocompleteProvider
  constructor takes a basePath, which we pass as process.cwd() — this also
  enables @-mention file autocomplete in the prompt for free.
- Wire up prompt history: pi-tui's Editor exposes addToHistory(), so call
  it on every successful submit. ↑/↓ on an empty editor now recall recent
  prompts. The site-picker shortcut on ↓ still wins because pi-tui only
  navigates history forward when already in browse mode.
- Drop patches/@mariozechner+pi-tui+0.54.0.patch. Its sole purpose was
  removing chalk from pi-tui's declared deps, but pi-ai and
  pi-coding-agent at 0.70.2 also depend on (and use) chalk, so patching
  pi-tui can no longer keep chalk out of node_modules.
- Restore the annotation tools that PR #3328 dropped when it split
  apps/cli/ai/tools.ts into one-tool-per-file. The /annotate skill calls
  open_annotation_browser and wait_for_annotations; without them the
  agent grasps at unrelated MCP tools.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
importSiteTool,
exportSiteTool,
openAnnotationBrowserTool,
waitForAnnotationsTool,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These has been forgotten in the previous PR (GPT 5.5) breaking the /annotate

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 3d539eb vs trunk

app-size

Metric trunk 3d539eb Diff Change
App Size (Mac) 1653.22 MB 1651.93 MB 1.29 MB 🟢 -0.1%

site-editor

Metric trunk 3d539eb Diff Change
load 1481 ms 1503 ms +22 ms ⚪ 0.0%

site-startup

Metric trunk 3d539eb Diff Change
siteCreation 8100 ms 8081 ms 19 ms ⚪ 0.0%
siteStartup 4955 ms 4946 ms 9 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@youknowriad
youknowriad merged commit 0e01461 into trunk May 4, 2026
13 checks passed
@youknowriad
youknowriad deleted the claude/magical-meninsky-9f7a3f branch May 4, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants