refactor(audiobook-curator): ship the CLI as <tool>.cli.ts projections of the curator tools - #734
Conversation
🦋 Changeset detectedLatest commit: e9a50b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a12602d92
ℹ️ 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".
…s of the curator tools (#725)
19cecc3 to
35d56c8
Compare
…rop dead imports; explicit confirm
ScriptedAlchemy
left a comment
There was a problem hiding this comment.
Current-head adoption review — e9a50b0bf653d31fd1afb11ccce6271f86fb8359
The duplication removal is the right implementation of #725. One P2 compatibility/claim correction remains before calling this behavior-preserving. Reviewed the changed-path inventory, shared argv change, projection metadata, migrated tool schemas, deleted CLI paths, parity tests and documentation. No repository or installed-process tests were executed by this reviewer; the full local gate in the PR is author-reported evidence.
P2 — Required report/receipt arguments are not preserved
The summary says the old required fields are preserved, but examples/audiobook-curator/tests/cli.test.ts explicitly changes inventory --report from required to optional and removes receipt from convert's required options. The new convert_audiobook.tsx schema likewise makes receipt optional. The test comment explains this was done because projection flags currently only relax requiredness. That is an intentional observable contract change, not demonstrated equivalence.
It can be a valid product decision to make the canonical tool's optional report behavior the CLI default. Record that decision accurately, including which commands changed and what happens to receipt/report persistence when omitted. Add a deterministic applied-mutation case without a receipt path, alongside a supplied-path case, so successful operation is not accidentally presented as proof that an audit file was written. Alternatively preserve the previous CLI requirement through the smallest supported projection check; do not restore duplicate handlers/schemas or make an optional canonical MCP field required everywhere merely for CLI compatibility.
Update the PR summary and migration/change notes to distinguish preserved command names/mapping/exit policy from relaxed required arguments, removed bulk curator <tool> commands, and formerly plain commands now rendering a document. The README already acknowledges optional report/receipt flags; align the other claims with that rather than deleting this useful honesty.
What is now addressed
- Equivalent operations have one tool handler and a small
.cli.tsprojection; domain functions remain ordinary domain code. - The orphaned operation input schemas identified by the first review were deleted; do not repeat that as pending work.
- CSV regions are split by
mapInput, with invalid values left for canonical validation. The shared enum defer is scoped to projections declaringmapInput; it is not a general removal of schema validation. - Canonical tool identity is retained, and the relocated/source-deleted CLI versus MCP test is the correct proof level.
confirm: falsepreserves the authored CLI's existing explicit-apply policy; this review is not asking to add automatic approval or remove the--applyguard.
The recorded full integration/packed/docsite gates and two self-review passes are substantially stronger than a route-count-only test. Refresh evidence if the head changes again and preserve all negative mapper/unknown-option/exit-code tests. No merge, approval, source change or native-host action is performed by this review.
… optional since #734; test both paths (#738) * docs(audiobook-curator): document optional --report/--receipt migration; test both paths (#725 follow-up) * changeset: point at #738 * review: report/receipt wording; assert directory contents and identical stderr * docs: receipt is written when the command succeeds
Closes #725.
What
examples/audiobook-curatorhad two handlers per operation: an MCP tool undersrc/mcp/curator/tools/and a routed CLI command undersrc/cli/, both calling the samesrc/operations/*function with their own input mapping, confirmation, headline, and progress plumbing. This PR deletessrc/cli/(16 modules, 741 lines) and the bulkroutes.mcpCommands: truegroup, and gives every tool a colocated<tool>.cli.tsprojection that owns only what the CLI adds: the command spelling, flag renames (--duration,--cache-dir,--book,--edition,--with-chapters, …), positionals (prepare <plan> <output>), the--regions us,uklist mapping, andconfirm: false(the old commands never asked--yes; a mutating command already gates on--apply).src/cli/route.inputSchemain each tool module is now an inlinez.object(the compiler's static argv grammar cannot followoperation.inputSchema;AB4814).packages/agent-bundle/src/cli-entry.tsdefersz.enumchoice checks to the canonical schema when the projection exportsmapInput, so a mapper can split--regions us,uk; an invalid value still exits 2 asInvalid value for --regions[1]. Fixture + projection test +package-entries.mdx(en/zh) cover it.leaf.command) and the CLI group lists the 16 tool leaves under their command spelling; nocli:*identity remains. Route count 50 → 34.Tests
tests/route-unit/cli-dispatch.test.ts:audible-searchCLI vsinvokeMcpToolparity (one domain call, equal structured result,--duration/--regions us,uk/repeated--regions, invalid region exit 2, unknown option exit 2, defaulted input),convert --applyvs dry run and no--yesprompt,inspect --jsonrouteId,curator <tool>group gone, help output.packages/agent-bundle/tests/examples-contract.test.ts: builtbin/audiobook-curator.mjsrelocated with sources deleted returns the sameinspectresult as the MCP client.Docs
examples/audiobook-curator/README.md,website/docs/{en,zh}/examples/audiobook-curator.mdx,website/docs/{en,zh}/guide/authoring/package-entries.mdx.Deletions
src/cli/16 files / 741 lines;libraryAuditCliHeadline;cli-rendered.test.tsinventory duplicate;routes.mcpCommands. Net −605 lines.Local gate (branch contains
origin/main@ a2a3fbe, after rebase onto #729)After the review fixes (example-only commits):
pnpm build && pnpm typecheck && pnpm lint && pnpm test:unit(4468 passed), route-unit (89),examples/audiobook-curatorpnpm check, integration subsetexamples-contract,audiobook-curator.acceptance.e2e,examples-real.e2e,workbench-surface(11 passed),pnpm docs:site:build(0 broken links).Deslop: Claude, 4 edits (dropped restating
// Inline, not operation.inputSchemacomments ×14, an orphaned JSDoc, a deadzodimport, and theaudibleRegionListhelper that duplicated the schema's enum check).Self-review
Reviewer: GPT-5.6 Sol Max (generalPurpose;
change-risk-reviewerhad no shell/TraceDecay in this session). Two passes.pathSchema/audibleRegionSchema/audibleRegionsimports left after deleting the orphaned operationinputSchemasInvalid value for --<option>[<index>], butsearch_audible.cli.tsthrewUnsupported Audible region…fromaudibleRegionListbefore the schema ranz.enumrejects;audibleRegionListdeleted; test asserts the promised spelling (e123cef).confirm: false" was false forinspectandshelfaudibleOperationsmapInput; exit code/spelling unchanged for existing projections; inline schemas match handler inputsCodex P1s: orphaned operation schemas → deleted (19cecc3); changeset suffix already
(#734).