Skip to content

feat: CLI search command + dogfood session feedback#60

Closed
flyingrobots wants to merge 5 commits intomainfrom
feat/cli-search
Closed

feat: CLI search command + dogfood session feedback#60
flyingrobots wants to merge 5 commits intomainfrom
feat/cli-search

Conversation

@flyingrobots
Copy link
Copy Markdown
Owner

@flyingrobots flyingrobots commented Apr 5, 2026

Summary

  • search CLI command — unified quest search with keyword matching, --status filtering (including GRAVEYARD), and --stats mode. 14 unit tests, 109 LOC.
  • Cycle 0026 design doc, playback witness, and retrospective — full METHOD cycle completed through XYPH's governance pipeline (no GitHub issues/PRs for governance).
  • Comprehensive dogfood feedback doc — full transcript audit of the session: 9 throwaway scripts, 13 command retries, 5 bugs found, 1 invariant violation, 20 new backlog items with priority sort.

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.md for full details and priority sort.

Test plan

  • 14 new unit tests for search command (SearchCommand.test.ts)
  • npm run build clean
  • npm run test:local — 1005 tests passing
  • Lint clean
  • Live smoke tests against real graph

Summary by CodeRabbit

  • New Features

    • Added a unified search CLI command enabling keyword matching across quest ID, title, and description.
    • Support for --status filtering, including graveyard quests, and --stats mode to display quest counts by status.
  • Documentation

    • Added design and retrospective documentation for the CLI search feature.
    • Added feedback session documentation from dogfood testing and observed friction points.
  • Tests

    • Added comprehensive unit tests covering keyword matching, status filtering, stats mode, and output formats.

…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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

📝 Walkthrough

Walkthrough

A new search CLI command was implemented to enable unified quest lookup with keyword matching across quest ID, title, and description, --status filtering including GRAVEYARD, and --stats aggregation mode. The feature includes design documentation, retrospective analysis, implementation code, and comprehensive test coverage.

Changes

Cohort / File(s) Summary
Documentation & Design
CHANGELOG.md, CLAUDE.md, design/cycles/0026-cli-search-command.md, design/retrospectives/0026-cli-search-command.md, docs/feedback/2026-04-05-dogfood-session.md
Added feature specification, implementation notes, retrospective analysis tracking friction points and lessons learned, and dogfood session feedback documenting the development workflow.
CLI Implementation
src/cli/commands/search.ts, xyph-actuator.ts
Implemented registerSearchCommands() function supporting optional keyword argument, --status filtering, --stats mode for per-status counts, case-insensitive substring matching, and dual JSON/human-readable output modes.
Unit Tests
test/unit/SearchCommand.test.ts
Added 259 lines of comprehensive test coverage for keyword matching, status filtering behavior, stats aggregation, output formats, graveyard inclusion with metadata, and edge cases.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A search through the quests so divine,
By keyword, by status—a filter so fine,
The graveyard included, no quest left behind,
Stats counted swift, with results aligned!
The graph remains whole, searchable and true!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: addition of a CLI search command and documentation of dogfood session feedback, which are the primary deliverables across the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-search

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +56 to +59
if (opts.stats) {
const counts: Record<string, number> = {};
for (const q of allQuests) {
counts[q.status] = (counts[q.status] ?? 0) + 1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between b4dc672 and 8f27d5a.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • CLAUDE.md
  • design/cycles/0026-cli-search-command.md
  • design/retrospectives/0026-cli-search-command.md
  • docs/feedback/2026-04-05-dogfood-session.md
  • src/cli/commands/search.ts
  • test/unit/SearchCommand.test.ts
  • xyph-actuator.ts

jsonStart: vi.fn(),
jsonProgress: vi.fn(),
...overrides,
} as unknown as CliContext;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
} 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.

@flyingrobots flyingrobots deleted the feat/cli-search branch April 7, 2026 05:23
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