Skip to content

feat: lakebase-feature-status bin + MCP tool (FEIP-7215)#47

Open
kevin-hartman wants to merge 2 commits into
mainfrom
kevin.hartman/feip-7215-feature-status
Open

feat: lakebase-feature-status bin + MCP tool (FEIP-7215)#47
kevin-hartman wants to merge 2 commits into
mainfrom
kevin.hartman/feip-7215-feature-status

Conversation

@kevin-hartman
Copy link
Copy Markdown
Collaborator

Summary

  • New lakebase-feature-status substrate primitive: one-screen snapshot of a feature's TDD workflow state (phase, plan, test-list completion, experiment table, recent decisions, open smells). Both human-readable (default) and machine-readable (--json) modes, plus an MCP tool wrapper.
  • New stable JSON payload schema documented at skills/lakebase-tdd-workflows/references/feature-status-schema.md. Shape stability is asserted by BDD tests so any future field rename/removal is a deliberate review gate.
  • Collateral kit-hygiene fix: extracted the inline require.main === module CLI shims from scripts/tdd/test-list.ts and spec-sync.ts into proper .cli.ts wrappers (matching the existing get-connection.cli.ts convention). The inline shims crashed when tsup bundled them into an ESM output; surfaced as soon as a new CLI imported those modules.

What's new

  • scripts/tdd/feature-status.ts — aggregator module reading plan.json, test-list.json, per-experiment outcomes.json + timeline.json, workflow-state.json, selection-log.md, smells.json.
  • scripts/tdd/feature-status.cli.tslakebase-feature-status bin.
  • apps/mcp-server/tools.tslakebase_feature_status MCP tool. Schema requires featureId, accepts optional tddDir (defaults ./.tdd).
  • tests/bdd/tdd-feature-status.test.ts — 14 tests covering N=1 behavior, partial-state fallbacks, JSON schema shape stability, and N≥2 race rendering.
  • tests/mcp-server/tools-feature-status.test.ts — 4 real-filesystem MCP handler tests (no mocks; the underlying primitive is pure-filesystem and benefits from end-to-end exercise).
  • skills/lakebase-tdd-workflows/references/feature-status-schema.md — stable payload contract.
  • README + SKILL cheat sheets gain a lakebase-feature-status row; pre-existing rows repointed at the new .cli.js paths.

Test plan

  • npm run typecheck clean
  • npx vitest run tests/bdd/tdd-feature-status.test.ts — 14/14
  • npx vitest run tests/mcp-server/tools-feature-status.test.ts — 4/4
  • npx vitest run tests/mcp-server/tools.test.ts — 13/13 (regression: registry assertion grew by one)
  • npx vitest run tests/mcp-server/handshake.test.ts — 1/1 (wire-protocol expected list updated)
  • npm test (full suite) — 366 passed, 44 pre-existing skipped, 0 failed
  • npm run build — clean
  • Manual: lakebase-feature-status F1-checkout --tdd <synthetic-fixture> renders the one-screen snapshot
  • Manual: same with --json emits the documented payload
  • Manual: N≥2 fixture (2 experiments) renders both rows correctly

Slice breakdown (FEIP-7215)

Slice Surface Status
1 feature-status module + CLI bin + N=1 BDD + collateral shim extraction done (c16b664)
2 --json mode + stable schema doc + schema-shape BDD done (c16b664)
3 MCP tool exposure + handshake test update done (fd58016)
4 N≥2 race rendering + BDD fixture done (fd58016)

This pull request and its description were written by Isaac.

New substrate primitive that renders a one-screen snapshot of a feature's
TDD workflow state: phase, gate approvals, plan summary, test-list
completion, experiment table, recent decisions, and open smells. Both
human-readable (default) and machine-readable (`--json`) modes.

What's new
- `scripts/tdd/feature-status.ts`: aggregator module that reads
  `plan.json`, `test-list.json`, each `experiments/*/outcomes.json` +
  `timeline.json`, `workflow-state.json`, `selection-log.md`, and
  `smells.json`, and returns a `FeatureStatusSnapshot`.
- `scripts/tdd/feature-status.cli.ts`: thin CLI wrapper. Registered as
  the `lakebase-feature-status` bin in package.json.
- `tests/bdd/tdd-feature-status.test.ts`: 11 tests covering behavior on
  N=1 fixtures, partial-state fallbacks, and the stable JSON schema
  shape (top-level + nested key sets).
- `skills/lakebase-tdd-workflows/references/feature-status-schema.md`:
  the schema contract. Append-only key sets, no field-type changes
  without a deliberate review (enforced by the BDD shape assertions).
- README + SKILL cheat sheets gain a `lakebase-feature-status` row.

Collateral fix
The kit's `scripts/tdd/test-list.ts` and `scripts/tdd/spec-sync.ts`
carried inline `require.main === module` entrypoint shims that worked
under tsx but crashed when tsup bundled them into an ESM CLI output
(`module is not defined in ES module scope`). Surfaced as soon as
feature-status.cli.ts imported the same module chain.

Fixed by extracting both shims into proper `.cli.ts` wrappers, matching
the existing `get-connection.cli.ts` pattern. Module files now export
functions only; entry points live in dedicated files. tsup config gains
two entries; README + SKILL cheat sheets repointed at the new
`.cli.js` paths.

Tests
- 11/11 tests in tests/bdd/tdd-feature-status.test.ts
- 85/85 in the tdd BDD subset (12 files), no regressions
- 351/351 in the full vitest suite, 44 pre-existing skipped, 0 failures

Co-authored-by: Isaac
…5 slices 3 + 4)

Exposes the feature-status primitive over the MCP wire protocol, and
proves the existing module + renderer handle parallel-experiment races
without special casing.

Slice 3 — MCP tool exposure
- apps/mcp-server/tools.ts: new `lakebase_feature_status` tool. Schema
  requires `featureId`, accepts optional `tddDir` (defaults `./.tdd`).
  Handler delegates to the real `getFeatureStatus()` module (filesystem
  read; no network calls).
- tests/mcp-server/tools.test.ts: name added to the registry expectation;
  schema-shape assertion mirrors the existing per-tool pattern.
- tests/mcp-server/handshake.test.ts: wire-protocol expected list updated.
- tests/mcp-server/tools-feature-status.test.ts (new): 4 real-fs handler
  tests staging an actual .tdd/ tree via mkdtempSync. No mocks — the
  underlying primitive is pure-filesystem and benefits from the
  end-to-end exercise.

Slice 4 — N>=2 race coverage
- tests/bdd/tdd-feature-status.test.ts: 3 new tests staging an N=2
  fixture with `exp-postgres-arrays` (succeeded, 3 cycles) and
  `exp-json-blob` (running, 2 cycles). Asserts the snapshot returns
  one entry per experiment, renderer lists both rows with status +
  branch + tests + cycles, and JSON payload keeps the documented
  shape under the multi-experiment case.
- references/feature-status-schema.md: short paragraph clarifying
  that the payload shape doesn't branch on `plan.mode`. Cross-
  experiment comparison rendering (promote-vs-synthesize decision aid)
  is intentionally out of scope here — that lives in FEIP-7208.

Tests
- 14/14 in tests/bdd/tdd-feature-status.test.ts
- 4/4 in tests/mcp-server/tools-feature-status.test.ts
- 13/13 in tests/mcp-server/tools.test.ts (regression check)
- 1/1 in tests/mcp-server/handshake.test.ts (wire protocol)
- 366/366 across the full vitest suite, 44 pre-existing skipped, 0 failures

Co-authored-by: Isaac
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