Maintainer tools that run with tsx outside the agent-tty CLI. They build and validate dogfood/ proof bundles, record and publish the Hero Demo videos, and run release-please in CI. Each runnable file guards its main with isDirectExecution(import.meta.url) (src/util/isDirectExecution.ts) and sets process.exitCode instead of calling process.exit. The callers are package.json scripts (review-bundle, validate-bundle, validate-bundle:canonical), mise tasks (validate-bundles, demo:agent-uses-agent-tty, demo:agent-uses-agent-tty:upload-assets, demo:agent-uses-agent-tty:apply-video-urls) and .github/workflows/release-please.yml.
index.ts: empty scaffold (export {}). Its comment names this directory as the home for standalone CLI tools. [index.ts]runReviewBundleCli(args, io?):review-bundle <bundle-dir>orreview-bundle --all <parent-dir>. Returns 0 on success, 1 on bad arguments or any failed build. [review-bundle.ts:runReviewBundleCli]buildReviewBundle(bundleRoot): scans a bundle and writes anindex.htmlreview page. The page links images, videos and files by relative path, so it needs the bundle files beside it. Returns the page path. [review-bundle.ts:buildReviewBundle]scanBundleArtifacts,classifyBundlePath,normalizeBundleManifest,renderTinyMarkdown,generateReviewBundleHtml: the review page steps.ArtifactKindis'screenshot' | 'video' | 'recording' | 'json' | 'notes' | 'script' | 'support' | 'other'. [review-bundle.ts:scanBundleArtifacts] [review-bundle.ts:classifyBundlePath] [review-bundle.ts:ArtifactKind]BundleManifestSchema,BundleArtifact,ReviewBundleIo,NormalizedBundleMetadata,ReviewBundlePageModel: the permissive manifest schema for historical bundles and the review page types. [review-bundle.ts:BundleManifestSchema] [review-bundle.ts:ReviewBundlePageModel]runValidateBundleCli(args, io?):validate-bundle <bundle-dir> [--profile <profile>]. Profiles arecontract-reporting(default),interactive-rendererandcanonical. Returns 0 when every check passes, else 1. [validate-bundle.ts:runValidateBundleCli] [validate-bundle.ts:BundleValidationProfile]validateBundle(bundleDir, profile): runs the named checks for a profile and returns{ bundleDir, profile, ok, checks[] }. Thecanonicalprofile checks the manifest, each artifact's presence, byte size and SHA-256, acommands.shorreproduce.sh,command-status.tsvon pass results, and a notes file. [validate-bundle.ts:validateBundle]checkCatalogParity(catalogPath, dogfoodRoot): checks that eachdogfood/<dir>/entry in the catalog is a directory. [validate-bundle.ts:checkCatalogParity]BundleValidationResult,BundleValidationCheck,BundleValidationIo,CatalogParityResult,MAX_JSON_FILE_BYTES: validation types and the JSON size limit. [validate-bundle.ts:BundleValidationResult] [validate-bundle.ts:MAX_JSON_FILE_BYTES]validateCanonicalBundles(): validates the four bundles inCANONICAL_BUNDLESwith thecanonicalprofile, then checksdogfood/CATALOG.mdparity. Returns 0 or 1. [validate-canonical-bundles.ts:validateCanonicalBundles]CanonicalBundleManifestSchema,CanonicalBundleArtifactSchemaand their types: the strict manifest schema for canonical bundles. [bundleManifestSchema.ts:CanonicalBundleManifestSchema] [bundleManifestSchema.ts:CanonicalBundleArtifactSchema]sha256File,canonicalBundleArtifactEntry,readCanonicalBundleManifest,writeCanonicalBundleManifest: hash files, build artifact entries, and read or write a canonical manifest. [canonicalBundleArtifacts.ts:canonicalBundleArtifactEntry] [canonicalBundleArtifacts.ts:writeCanonicalBundleManifest]runHeroDemo(options)andparseHeroDemoArgs(argv): record Codex and Claude using agent-tty in a VHS tape with a tmux split (agent left,agent-tty dashboard --allright), then promote one passing run per agent intodogfood/agent-uses-agent-tty. Flags include--agent,--runs,--promote/--no-promote,--concurrency,--record-seconds,--bundle-dirand--keep-debug. [hero-demo.ts:runHeroDemo] [hero-demo.ts:parseHeroDemoArgs]generateTape,generateRunner,generateDashboardRunner,selectPromotionRuns,promote,buildLeakFindings,sanitizePromotedText,renderReadme,selectedAgents,mapWithConcurrency, and the input types (HeroDemoOptions,GeneratedTapeInput,GeneratedRunnerInput,GeneratedDashboardRunnerInput,PromotionRunInput,PromotionSelection,RunRecord): Hero Demo building blocks. [hero-demo.ts:generateTape] [hero-demo.ts:sanitizePromotedText] [hero-demo.ts:promote] [hero-demo.ts:HeroDemoOptions]prepareHeroVideoUploadAssets(options?): subcommandprepare-upload-assets [--bundle-dir] [--upload-dir]. Converts each agent's WebM and thumbnail into an H.264 MP4 with a poster intro. [hero-video-playback.ts:prepareHeroVideoUploadAssets]applyHeroVideoUrls(options): subcommandapply-video-urls --codex-url URL --claude-url URL [--bundle-dir] [--root-readme]. Writes the uploaded video URLs into the rootREADME.mdand the bundleREADME.md. [hero-video-playback.ts:applyHeroVideoUrls]posterConcatFilter,replaceVideoSrcs,PrepareHeroVideoUploadAssetsOptions,ApplyHeroVideoUrlsOptions: ffmpeg filter and<video src>rewrite helpers. [hero-video-playback.ts:posterConcatFilter] [hero-video-playback.ts:replaceVideoSrcs]maininrelease-please-runner.ts(flag--dry-run): runs release-please as a library with theCommuniqueNodeStrategyrelease type and Communique changelog notes. [release-please-runner.ts:main] [release-please-runner.ts:CommuniqueNodeStrategy] [release-please-runner.ts:createCommuniqueChangelogNotes]UnreleasedAwareChangelog,formatChangelogSection,normalizeCommuniqueBody,buildCommuniqueArgs,describeCommuniqueFailure,assertLlmCredentials,formatReleaseOutputs,formatPullRequestOutputs,todayIsoDate, and the typesCommuniqueInvocation,CommuniqueRunner,RunnerOutputs: changelog and workflow-output helpers. [release-please-runner.ts:UnreleasedAwareChangelog] [release-please-runner.ts:formatChangelogSection] [release-please-runner.ts:RunnerOutputs] [release-please-runner.ts:describeCommuniqueFailure]
CanonicalBundleManifestSchemaandCanonicalBundleArtifactSchemause.strict().sha256must match/^[0-9a-f]{64}$/,bytesis a non-negative integer,commandsandartifactsneed at least one entry, andresultis'pass' | 'fail' | 'partial'. [bundleManifestSchema.ts:CanonicalBundleManifestSchema]BundleManifestSchemauses.passthrough()on purpose. A comment says this keeps legacy dogfood bundles readable. A manifest that fails the schema but is an object falls back to legacy normalization.loadManifestadds a warning for that case. [review-bundle.ts:BundleManifestSchema] [review-bundle.ts:normalizeBundleManifest] [review-bundle.ts:loadManifest]- Manifest artifact paths must be non-empty, relative, and resolve inside the bundle root (
isWithinRoot), orinvariant()throwsbundle artifact path escapes bundle root. Therealpathsymlink check in the same function ignores only a missing path (ENOENT). When the real path leaves the bundle root,invariant()throwsbundle artifact path escapes bundle root via symlink. [review-bundle.ts:validateBundleRelativePath] - The directory scan throws when a directory or a symlink target resolves outside the bundle root, and it skips directories it has already visited. [review-bundle.ts:collectArtifactsFromDirectory]
validate-bundlefails the JSON check for files larger thanMAX_JSON_FILE_BYTES(50 MiB). Canonical artifact paths outside the bundle root failartifacts-present, and so do paths whoserealpathleaves the root through a symlink. [validate-bundle.ts:MAX_JSON_FILE_BYTES] [validate-bundle.ts:runCanonicalChecks]readCanonicalBundleManifestandwriteCanonicalBundleManifestvalidate withCanonicalBundleManifestSchema.parsethroughreadValidatedJsonFileandwriteValidatedJsonFile(src/storage/manifests.ts). [canonicalBundleArtifacts.ts:readCanonicalBundleManifest] [canonicalBundleArtifacts.ts:writeCanonicalBundleManifest]parseHeroDemoArgsrejects unknown flags and requires positive integers. Promotion requires--runs >= 3and--agent both.selectPromotionRunsrequires 3 passing runs per agent. [hero-demo.ts:parseHeroDemoArgs] [hero-demo.ts:selectPromotionRuns]- A Hero Demo run passes only when the proof files are non-empty, the transcript shows the dashboard header
Sessions ·, and the final file equals the expected text. [hero-demo.ts:runOne] - Promotion validates the manifest with
CanonicalBundleManifestSchema.parsethroughwriteCanonicalBundleManifest. It throwsleak check failedwhenbuildLeakFindingsfinds account-sensitive patterns in the promoted text files: home paths, emails, theANTHROPIC_AUTH_TOKEN,ANTHROPIC_API_KEYandOPENAI_API_KEYnames,API Usage Billing,Auth conflictandWelcome backlines, and token-like strings. The check runs on the sanitized texts before promotion clears or writes--bundle-dir, so a failure leaves the bundle unchanged. [hero-demo.ts:promote] [hero-demo.ts:buildLeakFindings] applyHeroVideoUrlsasserts that each URL starts withhttps://github.com/user-attachments/assets/and that exactly two<video src>tags match. [hero-video-playback.ts:applyHeroVideoUrls] [hero-video-playback.ts:replaceVideoSrcs]assertLlmCredentialsrequiresANTHROPIC_API_KEYorOPENAI_API_KEY, plusCOMMUNIQUE_MODELwhen only the OpenAI key is set.mainrequiresGITHUB_TOKENandGITHUB_REPOSITORYthroughrequireEnv. [release-please-runner.ts:assertLlmCredentials] [release-please-runner.ts:requireEnv]describeCommuniqueFailureappends a hint that namesmax_tokenswhen Communique reportscommunique::malformed_submission.communique.tomlsets[defaults].max_tokens = 16384because Communique 1.1.3 cuts each response at 4096 tokens otherwise. [release-please-runner.ts:describeCommuniqueFailure]- A comment on
formatChangelogSectionstates that the heading must not contain avafter[, because release-please then cannot parse the merged PR. [release-please-runner.ts:formatChangelogSection]
buildReviewBundlereads the bundle tree and overwrites<bundle>/index.htmlwithfs/promises.writeFile. [review-bundle.ts:buildReviewBundle]validate-bundle.tsandvalidate-canonical-bundles.tsonly read files (readFile,stat,realpath, hashing withcreateReadStream).runValidateBundleCliprints the JSON result to stdout and a PASS/FAIL summary to stderr.validateCanonicalBundleswrites PASS/FAIL lines to stderr only. [validate-bundle.ts:runValidateBundleCli] [validate-canonical-bundles.ts:validateCanonicalBundles]runHeroDemodeletes and recreates a debug root under<tmpdir>/agent-tty-hero-demo/. After promotion it deletes the debug root again unless--keep-debugis set. [hero-demo.ts:runHeroDemo] [hero-demo.ts:mkDebugRoot]installLocalAgentTtyrunsnpm run buildandnpm packin the repo root, so it writesdist/and a.tgztarball into the checkout. It then runsnpm install -g --prefixinto the debug root and deletes the tarball. [hero-demo.ts:installLocalAgentTty]runHeroDemospawnsgit initin each run workspace,vhs(which startstmux,codexorclaude, andagent-tty dashboard),tmux -L <socket> kill-server,ffmpegandagent-tty doctor --json. It probesvhs,tmux,ttyd,ffmpeg,codexandclaudefor their versions. It reads theAGENT_TTY_HERO_*environment variables. [hero-demo.ts:runHeroDemo] [hero-demo.ts:killTmuxServer] [hero-demo.ts:collectToolVersions] [hero-demo.ts:parseHeroDemoArgs]- After the leak check passes, promotion clears
--bundle-dir(except.gitignoreandVIDEO_PLAYBACK.md), then writes the artifacts,promoted-run-summary.md,README.md,reproduce.sh,.gitignore,manifest.jsonandartifacts/.gitkeep. Onlymanifest.jsongoes through asrc/storage/helper.writeCanonicalBundleManifestwrites it atomically withwriteValidatedJsonFile. It writes sanitized text artifacts withfs/promises.writeFileand copies binary artifacts withcopyFile. [hero-demo.ts:cleanBundle] [hero-demo.ts:promote] [hero-demo.ts:copyPromotedArtifact] [canonicalBundleArtifacts.ts:writeCanonicalBundleManifest] prepareHeroVideoUploadAssetsdeletes and recreates the upload directory (default<bundle>/.debug/video-upload), runsffmpegandffprobewithexecFileSync(overridable withHERO_VIDEO_FFMPEGandHERO_VIDEO_FFPROBE), and writes MP4, ffprobe JSON andSHA256SUMSfiles. [hero-video-playback.ts:prepareHeroVideoUploadAssets]applyHeroVideoUrlsoverwrites the rootREADME.mdand the bundleREADME.mdand rewrites the bundlemanifest.jsonthroughwriteCanonicalBundleManifest. [hero-video-playback.ts:applyHeroVideoUrls]release-please-runner.tscalls the GitHub API through therelease-pleaselibrary (creates releases and the release PR, or only builds them with--dry-run). It runs thecommuniquebinary withexecFilein the inherited working directory. Communique writes its notes file into amkdtempdirectory, which the code removes in afinallyblock. The runner appendsreleases_created,release_tags,prs_createdandpr_branchesto$GITHUB_OUTPUT(stdout when unset). [release-please-runner.ts:main] [release-please-runner.ts:createCommuniqueChangelogNotes] [release-please-runner.ts:runCommuniqueBinary] [release-please-runner.ts:writeGithubOutputs]
- Run:
npx vitest run test/unit/tools - Run:
npm run validate-bundle:canonical - Run:
npm run typecheck