test: command — hints parser and altimate builtin registration#436
test: command — hints parser and altimate builtin registration#436anandgupta42 wants to merge 1 commit intomainfrom
Conversation
Cover Command.hints() template placeholder extraction (7 tests) and verify altimate-specific builtin commands (configure-claude, configure-codex, discover-and-add-mcps) are properly registered with correct metadata. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> https://claude.ai/code/session_01LBpRnh2zYViskgkbqiTG8v
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review.
Tip: disable this comment in your organization's Code Review settings.
📝 WalkthroughWalkthroughTest coverage has been added for Altimate's built-in commands, including verification that Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/opencode/test/command/command-resilience.test.ts (1)
128-135: Consider adding similar metadata test forconfigure-codex.The
configure-claudemetadata test is good. For completeness, you may want to add a similar test forconfigure-codexto verify itssourceanddescription. This would ensure all three Altimate commands have equivalent coverage.📝 Optional test addition
test("configure-codex has correct metadata", async () => { await withInstance(async () => { const cmd = await Command.get("configure-codex") expect(cmd).toBeDefined() expect(cmd.source).toBe("command") expect(cmd.description).toBe("configure altimate skill in Codex CLI") }) })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/opencode/test/command/command-resilience.test.ts` around lines 128 - 135, Add a parallel metadata test for the "configure-codex" command similar to the existing "configure-claude" test: inside the same test suite use withInstance and call Command.get("configure-codex"), assert the returned cmd is defined, cmd.source equals "command", and cmd.description equals "configure altimate skill in Codex CLI" so that configure-codex metadata is verified; place this new test alongside the existing configure-claude test and name it "configure-codex has correct metadata".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/opencode/test/command/command-resilience.test.ts`:
- Around line 128-135: Add a parallel metadata test for the "configure-codex"
command similar to the existing "configure-claude" test: inside the same test
suite use withInstance and call Command.get("configure-codex"), assert the
returned cmd is defined, cmd.source equals "command", and cmd.description equals
"configure altimate skill in Codex CLI" so that configure-codex metadata is
verified; place this new test alongside the existing configure-claude test and
name it "configure-codex has correct metadata".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: bf24ed8b-e097-4d62-9454-e8e6b5f755ce
📒 Files selected for processing (2)
packages/opencode/test/command/command-resilience.test.tspackages/opencode/test/command/hints.test.ts
|
Superseded by #439 which consolidates all 12 test PRs into one, deduplicates overlapping tests, and fixes bugs found during review. |
What does this PR do?
1.
Command.hints—src/command/index.ts:53-61(7 new tests)This pure function extracts template placeholders (
$1,$2,$ARGUMENTS) from command templates and is used by every command registration (default, user-defined, MCP, and skill commands) to determine what TUI hints to display. Zero tests existed. New coverage includes:$ARGUMENTSdetection (separate from numbered regex)$ARGUMENTStemplates$10sorts before$2— documents current behavior)2. Altimate builtin commands registration —
src/command/index.ts:63-144(5 new tests)Commit 528af75 shipped
discover-and-add-mcpsas a builtin command to fix a phantom command issue where the toast suggestion sent users to a non-existent command. The three altimate-specific builtin commands (configure-claude,configure-codex,discover-and-add-mcps) had zero test coverage. New coverage includes:Command.list()discover-and-add-mcpshas correct source, description, template referencingmcp_discover, and$ARGUMENTShintconfigure-claudehas correct source and exact description stringType of change
Issue for this PR
N/A — proactive test coverage
How did you verify your code works?
Checklist
https://claude.ai/code/session_01LBpRnh2zYViskgkbqiTG8v
Summary by CodeRabbit
configure-claude,configure-codex,discover-and-add-mcps) and their configurations.