refactor(examples/audiobook-curator): feature-module composition and deslop - #51
Conversation
…o feature modules application.tsx was an 808-line monolith mixing the argv toolkit, shared zod fragments, sixteen operation declarations, their default executors, and the bundle tree. Move the catalog into src/operations/ feature modules (evidence, media-mutation, audible, discovery, output) plus shared cli-arguments.ts and schemas.ts, leaving application.tsx as composition only. Code is moved verbatim; operation order, schemas, and behavior are unchanged.
…e dead code
Consolidate the copy-paste helpers that had drifted across domain modules
into foundation.ts: asRecord (4 copies), sha256File (3), the ffmetadata
escaper (2), the fsync publish dance (4), the bounded worker pool (2), and
contributor-name extraction (3). evidence.ts now reuses audible's bounded
retry request instead of its own duplicate.
Remove dead code: mcp-tools.tsx (an unused hand-rolled bridge duplicating
createRscMcpServer), renderCuratorResult, and curator-core's auditAudiobook
(superseded by integrity-audit's audit operation). The MCP render coverage
moves into application.test.tsx against the real operation catalog.
Collapse the double-lookup `...(optionValue(...) === undefined ? {} : ...)`
argv spreads behind optionalField/numberOption, hoist the one inline test
import, and give the receipt summary switch a never-checked default.
…nfig build gap Add a source-layout section and maintainer notes to the README explaining why both agent-bundle.config.ts and rslib.config.ts exist (agent-bundle build emits host artifacts but no node-consumable dist for bin/exports), and leave a pointed comment in rslib.config.ts marking it for deletion once the framework owns the package build.
|
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. |
commit: |
Summary
Answers the owner's "the application file is massive and the example looks unorganized" for
examples/audiobook-curator, using only current public framework APIs. Behavior is unchanged.src/application.tsxmonolith is split intosrc/operations/feature modules grouped by workflow stage —discovery,audible,evidence,media-mutation,output— plus sharedcli-arguments.tsandschemas.ts.application.tsxis now 91 lines of pure composition (merge defaults, declare the<AgentBundle>tree). Operation order, ids, schemas, and CLI/MCP projections are identical;AudiobookCuratorOperationsis preserved as the intersection of the feature slices.foundation.ts:asRecord(4 copies),sha256File(3), ffmetadata escaping (2), the fsync publish dance (4), the bounded worker pool (2), contributor-name extraction (3);evidence.tsreuses audible's bounded retry request.src/mcp-tools.tsx(unused hand-rolled bridge duplicatingcreateRscMcpServer),renderCuratorResult, and curator-core'sauditAudiobook(superseded by the integrity-auditauditoperation). The MCP render coverage moved intoapplication.test.tsxagainst the real operation catalog....(optionValue(...) === undefined ? {} : { ... })argv spreads behindoptionalField/numberOption, hoisted an inline test import, added anever-checked default to the receipt summary switch.rslib.config.tscarries a pointed comment marking it for deletion once agent-bundle owns the package build (it exists only to produce the npmdist/forbin/exports, whichagent-bundle builddoes not emit).Net: −250 lines in the example, no public-surface change other than removing the dead
auditAudiobook/AuditInput/AuditReceiptexports.Test plan
pnpm --filter @agent-bundle-example/audiobook-curator checkgreen before and after (tests 35/35 with ffmpeg-absent skips preserved, typecheck,build:cli,build:bundle)pnpm typecheck,pnpm lint(0/0),pnpm test:unit(1664/1664), examples-contract integration file (3/3)application.test.tsxstill asserts the exact 15-command CLI order and 15-tool MCP order