Skip to content

refactor(examples/audiobook-curator): feature-module composition and deslop - #51

Merged
ScriptedAlchemy merged 3 commits into
mainfrom
refactor/audiobook-curator-structure
Aug 30, 2026
Merged

refactor(examples/audiobook-curator): feature-module composition and deslop#51
ScriptedAlchemy merged 3 commits into
mainfrom
refactor/audiobook-curator-structure

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

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.

  • Structure (commit 1): the 808-line src/application.tsx monolith is split into src/operations/ feature modules grouped by workflow stage — discovery, audible, evidence, media-mutation, output — plus shared cli-arguments.ts and schemas.ts. application.tsx is now 91 lines of pure composition (merge defaults, declare the <AgentBundle> tree). Operation order, ids, schemas, and CLI/MCP projections are identical; AudiobookCuratorOperations is preserved as the intersection of the feature slices.
  • Deslop (commit 2):
    • Consolidated copy-paste helpers into 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.ts reuses audible's bounded retry request.
    • Removed dead code: src/mcp-tools.tsx (unused hand-rolled bridge duplicating createRscMcpServer), renderCuratorResult, and curator-core's auditAudiobook (superseded by the integrity-audit audit operation). The MCP render coverage moved into application.test.tsx against the real operation catalog.
    • Collapsed the double-lookup ...(optionValue(...) === undefined ? {} : { ... }) argv spreads behind optionalField/numberOption, hoisted an inline test import, added a never-checked default to the receipt summary switch.
  • Docs (commit 3): README gains a source-layout section and maintainer notes on the dual-config build gap; rslib.config.ts carries a pointed comment marking it for deletion once agent-bundle owns the package build (it exists only to produce the npm dist/ for bin/exports, which agent-bundle build does not emit).

Net: −250 lines in the example, no public-surface change other than removing the dead auditAudiobook/AuditInput/AuditReceipt exports.

Test plan

  • pnpm --filter @agent-bundle-example/audiobook-curator check green before and after (tests 35/35 with ffmpeg-absent skips preserved, typecheck, build:cli, build:bundle)
  • Root gates: pnpm typecheck, pnpm lint (0/0), pnpm test:unit (1664/1664), examples-contract integration file (3/3)
  • application.test.tsx still asserts the exact 15-command CLI order and 15-tool MCP order

…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.
@changeset-bot

changeset-bot Bot commented Aug 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cb78645

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T20:01:30.262914Z cb78645 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Aug 30, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@51
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/rsc-runtime@51

commit: cb78645

@ScriptedAlchemy
ScriptedAlchemy merged commit 6427206 into main Aug 30, 2026
9 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the refactor/audiobook-curator-structure branch September 3, 2026 05:28
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