feat: CLI search command + dogfood session feedback#60
feat: CLI search command + dogfood session feedback#60flyingrobots wants to merge 5 commits intomainfrom
Conversation
…nd stats Adds a unified `search` command that replaces ad-hoc JSON parsing scripts agents were writing to query the graph. Supports keyword matching (title, ID, description), --status filtering (all statuses including GRAVEYARD), and --stats mode for counts by status. Always includes graveyard quests so the full graph is searchable without opt-in flags. Usage: xyph search "MCP" xyph search --status GRAVEYARD xyph search --status BACKLOG "auth" xyph search --stats Closes task:cli-search
Retroactive design doc for the search command cycle. Documents sponsors (Working Agent, Operator-Supervisor), outcome hill, invariants, scope, acceptance-test plan (12 checkpoints matching 14 unit tests), playback questions, and exit criteria. The implementation (GREEN) was completed before the design doc — this cycle corrects that process violation going forward.
Playback: all 4 questions answered with live evidence against the real graph (270 quests, 124 graveyard). 14/14 unit tests, 1005 total tests. Retro: process violation caught and corrected — code was written before design doc. Lessons captured in feedback memory for future cycles.
Documents all 8 ad-hoc scripts, 8 command retries, and 13-step governance pipeline from the dogfooding session. Categorizes friction into discoverability, atomicity mismatch, and error-driven discovery.
Full transcript audit of the first end-to-end development session using XYPH's governance pipeline. Documents 9 throwaway scripts, 13 command retries, the 13-step governance pipeline for 109 LOC, 5 bugs found, 1 invariant violation (substrate-boundary), and 20 new backlog items. Includes recommended priority sort for the backlog items discovered.
📝 WalkthroughWalkthroughA new Changes
Sequence Diagram(s)sequenceDiagram
participant User as User/CLI
participant Cmd as Search Command
participant Obs as Observation Session
participant Snap as Snapshot
participant Quest as Quest Data
User->>Cmd: search [keyword] --status STATUS --stats
activate Cmd
Cmd->>Obs: openSession(liveObservation('search'))
Cmd->>Snap: fetch operational snapshot
activate Snap
Snap->>Quest: load quests (including GRAVEYARD)
Quest-->>Snap: return quest collection
deactivate Snap
alt --stats mode
Cmd->>Cmd: aggregate per-status counts
Cmd->>User: output JSON/text with counts & total
else search/filter mode
Cmd->>Cmd: filter by status (if provided)
Cmd->>Cmd: filter by keyword substring (if provided)
Cmd->>Cmd: map QuestNode to result objects
Cmd->>User: output JSON results or formatted list
end
deactivate Cmd
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f27d5a82a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (opts.stats) { | ||
| const counts: Record<string, number> = {}; | ||
| for (const q of allQuests) { | ||
| counts[q.status] = (counts[q.status] ?? 0) + 1; |
There was a problem hiding this comment.
Honor filters when computing --stats output
The search command accepts [keyword] and --status, but --stats is handled before any filtering and counts allQuests directly. In practice, xyph search mcp --status BACKLOG --stats silently ignores both filter inputs and returns global counts, which can produce incorrect conclusions in scripts or operator workflows. Apply the same filters before counting, or fail fast when --stats is combined with filter arguments.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/unit/SearchCommand.test.ts`:
- Line 35: The test fixture is using a prohibited double cast `as unknown as
CliContext`; update the fixture returned by makeCtx() to avoid this by either
casting with `as never` (e.g., replace `as unknown as CliContext` with `as
never`) or change makeCtx() to return a properly typed
Partial/CliContext-compatible object (or define a test-specific interface that
extends CliContext) so the explicit unsafe `as unknown as` cast is removed;
locate the cast site in SearchCommand.test.ts and modify the makeCtx()/fixture
typing or the cast accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6a84ec0d-25e4-4589-99af-b6b199a42595
📒 Files selected for processing (8)
CHANGELOG.mdCLAUDE.mddesign/cycles/0026-cli-search-command.mddesign/retrospectives/0026-cli-search-command.mddocs/feedback/2026-04-05-dogfood-session.mdsrc/cli/commands/search.tstest/unit/SearchCommand.test.tsxyph-actuator.ts
| jsonStart: vi.fn(), | ||
| jsonProgress: vi.fn(), | ||
| ...overrides, | ||
| } as unknown as CliContext; |
There was a problem hiding this comment.
Prohibited as unknown as cast in test fixture.
The double cast as unknown as CliContext is explicitly prohibited by the coding guidelines. Per retrieved learnings, only as never casts are allowed in test fixtures.
Consider using as never instead, or restructuring makeCtx() to return a properly typed partial mock:
- } as unknown as CliContext;
+ } as never;Alternatively, create a test-specific interface that extends CliContext to avoid the cast entirely.
Based on learnings: "In the flyingrobots/xyph repository, allow and expect 'as never' casts in test fixtures... Prohibit only 'as unknown as' and 'as any' casts in tests."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } as unknown as CliContext; | |
| } as never; |
🧰 Tools
🪛 GitHub Actions: ci
[error] Forbidden bypass comments detected by grep using pattern 'eslint-disable|@ts-ignore|@ts-expect-error|@ts-nocheck'. Error: 'Found forbidden bypass comments. Fix the code, don't silence the linter.'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@test/unit/SearchCommand.test.ts` at line 35, The test fixture is using a
prohibited double cast `as unknown as CliContext`; update the fixture returned
by makeCtx() to avoid this by either casting with `as never` (e.g., replace `as
unknown as CliContext` with `as never`) or change makeCtx() to return a properly
typed Partial/CliContext-compatible object (or define a test-specific interface
that extends CliContext) so the explicit unsafe `as unknown as` cast is removed;
locate the cast site in SearchCommand.test.ts and modify the makeCtx()/fixture
typing or the cast accordingly.
Summary
searchCLI command — unified quest search with keyword matching,--statusfiltering (including GRAVEYARD), and--statsmode. 14 unit tests, 109 LOC.What we proved
First full end-to-end development cycle using XYPH's own governance pipeline — design doc → RED → GREEN → playback → retro → seal — entirely through the WARP graph. No GitHub issues, no PRs for governance. The friction IS the roadmap.
Backlog items filed (20)
See
docs/feedback/2026-04-05-dogfood-session.mdfor full details and priority sort.Test plan
npm run buildcleannpm run test:local— 1005 tests passingSummary by CodeRabbit
New Features
searchCLI command enabling keyword matching across quest ID, title, and description.--statusfiltering, including graveyard quests, and--statsmode to display quest counts by status.Documentation
Tests