Repository navigation
feat(scenarios): publish @objectstack/scenarios with an objectstack-scenarios CLI (npx), carrying the open cards only - #31221
Conversation
…cenarios bin Drop private, add the bin (a thin dispatcher over the runner CLI, run from dist/), copy the open card library into dist/library at build time, and let the runner read it when no checkout is around. Pack the package in a test: only the open cards and capability areas ship, and the packed bin runs. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nGqwL3Ag8M8TdoRiC
@objectstack/scenarios is published now, so the workspace publishes one more package than the package-ecosystem section said. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nGqwL3Ag8M8TdoRiC
📓 Docs Drift CheckThis PR changes 2 package(s): 19 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 6 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 171 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 4038ec7671497ba5f367ae96fd7ebe045e94fee5 && git checkout 4038ec7671497ba5f367ae96fd7ebe045e94fee5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 065bba721e4ba180c6bdbbf2c5fb787d49bac596 149e988b3ca2d98395b92638c7143bb3fd9af102 && git checkout -B drift-repro 065bba721e4ba180c6bdbbf2c5fb787d49bac596 && git merge --no-ff 149e988b3ca2d98395b92638c7143bb3fd9af102
node scripts/docs-audit/affected-docs.mjs --json 065bba721e4ba180c6bdbbf2c5fb787d49bac596
|
Metadata-protocol is none, so the launch-window rule grades the entry patch; minor is earned by a metadata-protocol change only. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nGqwL3Ag8M8TdoRiC
…built CLI lazily The bin bundled the runner's whole graph, so help and version paid about a second warm and several cold (CI timed three spawn cases out at 5 s). The bin now imports the runner CLI only for run, pointed by the build at a separate dist/cli.js entry; the run spawn cases get a measured 30 s budget. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nGqwL3Ag8M8TdoRiC
Workspace mode builds and packs a checkout's packages; a package installed from npm has no checkout, so run refuses the mode before it makes anything. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nGqwL3Ag8M8TdoRiC
|
domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7 Contract reviewServed-tier: Face: declaration. The committed tree holds no published spec schema and no governed path; the PR body and the changeset both carry ① Derived judgmentsEach accept-set and public-surface change the diff implies, named right or wrong:
② Semver levelThe changeset ③ Boundary flagsFrom the os-dev-report comments (6711207780 round 1, 6711888045 round 2, newest):
Nothing escalates. Should-fix only (non-blocking, follow-up carriers): the release-time tarball guard above. Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7 席位核对Verdict: ACCEPT · head
Generated by Claude Code |
Requested by Leehom · project thread
Fixes #31172
Clause-②: yes
Metadata-protocol: none
维护者速读
@objectstack/scenarios去掉private,随@objectstack/*发版列车一起发布,带一个命令objectstack-scenarios。npx @objectstack/scenarios run …就是今天的run-scenarios,参数、默认值和拒绝规则完全相同;包里只带开放卡库(docs/qa/scenarios/*.json与能力区清单),构建时拷进dist/library/。os子命令,裁决 D 不变。package.json、与docs/qa/scenarios/逐字节相同的卡片、与能力区逐字节相同的清单,任何 JSON 出现都红。回滚即 revert 本 PR(发版前没有任何东西发布出去)。packages/qa/scenarios/test/build/packed-tarball.test.ts(打包白名单与命令冒烟)、packages/qa/scenarios/src/runner/library.ts(装在 npm 里时去哪读卡库)、packages/qa/scenarios/scripts/pack-library.mjs(只拷两个目录)。pnpm --filter @objectstack/scenarios build && pnpm --filter @objectstack/scenarios exec vitest run test/build/packed-tarball.test.ts,预期 10/10 通过(打包、解包、用纯 Node 跑objectstack-scenarios,读到包内 9 张卡,--packages workspace与 API key 登录都被拒)。What changes
packages/qa/scenarios/package.json):privateremoved,publishConfig.access: public,files: ["dist", "README.md", "CHANGELOG.md"],engines.node >=22, all copied from the nearest published sibling (@objectstack/verify). It joins the changesetsfixedgroup (.changeset/config.json), so it versions with the train; nothing is bumped by hand (it stays0.1.0in the tree until the release'schangeset version). The description now says what it is: published, with the CLI and the open library.bin.objectstack-scenariosisbin/objectstack-scenarios.js(thecreate-objectstackpattern): it imports the BUILTdist/bin.jsand nothing else.src/bin.ts(runCli) dispatchesrunto the runner CLI's ownmainwith every following argument unchanged, plushelpandversion. The runner is imported lazily, forrunonly, and the build keeps it out ofdist/bin.js: a tsup esbuild plugin (binLoadsBuiltCli) turns that import into one of a separate built entry,dist/cli.js(.cjsfor the CJS build), sohelpandversionloaddist/bin.jsalone (1.5 KB; measured 30 ms, against about 1.2 s warm for the runner's graph).runner/cli.tsis not restructured; it changes in two places: where it finds the repository (below), and one refusal (next bullet).scripts/pack-library.mjscopiesdocs/qa/scenarios/*.jsonanddocs/qa/platform-checklist/areas/*.json(one level, regular files, nothing else) intodist/library/, keeping the repository's layout. The package'sturbo.jsonadds both directories to the build's inputs, so a card edit invalidates the cached build the release would otherwise replay ($TURBO_EXTENDS$keeps the root inputs; measured withturbo run build --dry=json: 25docs/qainputs, 9 cards + 16 areas).src/runner/library.ts,locateLibraryRoot): in a checkout it is the repository, as before; installed from npm it isdist/library/. A checkout is recognised by the package sitting atpackages/qa/scenariosof a pnpm workspace holdingdocs/qa/scenarios(compared by real path), so an install inside some other workspace is never read as one.cli.tsuses it instead offindUp(pnpm-workspace.yaml), which from an npm install would have found the user's workspace or thrown. From npm,--outdefaults to./scenario-runs(not into the package), and no framework commit is stamped (the package may sit in someone else's git repository).libraryOfis unchanged: the shipped copy is theopenlibrary, any--cardsdirectory the overlay.--packages workspaceis refused from npm (cli.ts, right after the library root is located): workspace mode (feat(scenarios): run-scenarios --packages published|workspace; the gallery exporter refuses workspace records #31188) builds and packs a checkout's packages, and an installed package has none, so the run stops with that reason before it creates a work directory, builds or packs anything.published(the default) is unchanged.oscommand); the intro and build paragraphs no longer say "private, unpublished"..changeset/31172-publish-scenarios-cli.md,patch, with both declaration lines. Corrected fromminorin9742af04: withMetadata-protocol: nonethe launch-window level rule (ruling A on changeset levels: minor only when the metadata protocol changes (added / narrowed / semantic), patch otherwise; release notes grouped by what the reader must do (maintainer ruling A, 2026-10-21) #25105) grades itpatch, andCheck Changesetrefusedminor.packages/spec/llms.txt: its package-ecosystem section counts the published packages andcheck:llms-txtre-derives the count from the workspace, so it moves 74 → 75. Not the expected surface; named here because the gate makes it this PR's. The file ships in@objectstack/spec, which is in the samefixedgroup, so it goes out with the next release either way.Public surface (Clause-②: yes), measured on the built entry declarations
Read with the TypeScript checker (
getExportsOfModule) overdist/*.d.tsafter a full build of this head:@objectstack/scenarios(dist/index.d.ts)@objectstack/scenarios/score@objectstack/scenarios/score/full@objectstack/scenarios/runner@objectstack/scenarios/exportThese five subpaths existed (private) and are unchanged by this PR except that they are now on npm (
./runnerand./exportcount what #31188 added to them on main). New: theobjectstack-scenarioscommand (run,help,version).dist/bin.js(runCli,USAGE,CliIo) anddist/cli.js(the runner CLI) are notexportskeys, so a consumer cannot resolve them;library.tsis not re-exported from./runner.Tests
test/build/packed-tarball.test.ts(new, 10 cases):pnpm packfrom the package directory (the tarballpnpm publishuploads), then the tarball extracted into a project of its own with each runtime dependency linked to the workspace build.workspace:range left.docs/qa/scenarios/and every area ofdocs/qa/platform-checklist/areas/is indist/library/, byte for byte.package.json, those cards and those areas. A card from anywhere else, wherever it lands, fails this case.origin: generic..d.ts/.d.cts), and nosrc/,test/orscripts/.dist/bin.jsimportsfs,pathandurland nothing else statically, and reaches the runner only throughimport("./cli.js").--help(exit 0),version(the packed version), no command (exit 2);run --only no_such_cardloads the shipped library fromINSTALL/dist/library/docs/qa/scenarioswith no refusal and exits 2 with exactly that one line;run --packages workspaceexits 1 on the refusal and creates no work directory; with a stand-inclaudeon a subscription login andANTHROPIC_API_KEYset,run --only service_deskexits 1 on "ANTHROPIC_API_KEYis set" and scaffolds nothing.runcases each spawn Node over the runner's whole graph once: about 1.1 to 1.5 s each here, 5.7 s and 6.5 s cold on a CI Test Core runner (run 42400730182, where vitest's 5 s default timed them out). Each gets an explicit 30 s (RUN_SPAWN_BUDGET_MS), asbuilt-consumer.test.tsbudgets its own spawn of that graph. The help/version case is three spawns ofdist/bin.jsalone (123 ms here) and keeps the default. The whole file reads 5.1 s here.test/runner/library.test.ts(new, 6 cases):locateLibraryRootreads the checkout from the sources, the packed copy from an installed package, never another workspace that holds adocs/qa/scenariosand apackages/qa/scenarios, and refuses an installed package with no library;runCliprints usage, refuses no/unknown command with exit 2, and handsrun's arguments to the runner CLI unchanged (--bogus,--modes nightlyrefused byparseArgs). The file importssrc/runner/cli.tsitself, so the lazy import's transform is paid in the file's import phase, not inside a case.Ablations (each restored: blob == HEAD, git diff HEAD empty)
All through
scripts/ablation-replace.mjs(anchor x1 → x0, replacement x0 → x1); 1 and 2 on commit2d69cfb4, 3 on2eb91a69, 4 on149e988b.pack-library.mjsDIRSgainsdocs/qa/platform-checklist): the inner script rebuilt the package (pack-libraryran,dist/library/docs/qa/platform-checklist/then heldareasandcoverage.json) and ranpacked-tarball.test.ts→1 failed | 7 passed, the failure being "carries no other JSON: a card from anywhere but docs/qa/scenarios is refused". Restored, and the package rebuilt afterwards (dist/library/docs/qa/platform-checklist/holdsareasonly).library.ts: the real-path comparison ofpackages/qa/scenarioswith the package replaced by an always-trueString("ABL2").length > 0):library.test.ts→1 failed | 5 passed, the failure being "never reads another pnpm workspace holding a docs/qa/scenarios as the checkout". The suite importssrc/, so no dist leg.tsup.config.ts:esbuildPlugins: [binLoadsBuiltCli].slice(0, 0)): rebuilt,dist/bin.jsthen carried 19 static@objectstack/*imports (196 KB);packed-tarball.test.ts→1 failed | 8 passed, the failure being "keeps the runner out of the bin". Restored, rebuilt.cli.ts: its condition ANDed with an always-falseString("ABL4").length < 0): rebuilt,ablation-dist-preflightfound the marker indist/cli.jsanddist/cli.cjs;packed-tarball.test.ts -t 'refuses --packages workspace'→1 failed, the run reaching workspace mode and dying onfatal: not a git repositoryinstead of the reason. Restored, rebuilt, preflight--absent: marker absent from all 81 built files, tree clean.Acceptance notes
pack-library.mjscopies two named directories of this repository, one level deep; and the packaging test refuses any JSON that is not byte-identical to an open card or area. It runs in Test Core on every PR and in the merge queue, so a leak is red before it can merge, rather than at publish. The triage audit'srelease.yml(the release pipeline is outside the claimed surface): the release publishes from a commit whose Test Core ran this test.runpasses its arguments through;helpnames the flags and points at the README instead of copying the flag table, so Scenario runner: --model / --author-model / --ask-model, with the served model recorded per turn #31160's--modelflags (and any later flag) appear inrunwithout touchingbin.ts.--packages, merged as86e9ef0a). Merged into this branch (no rebase), as the order's serial note asked.published(its default) works from npm unchanged;workspaceis refused there (What changes). Its exporter rule (refusingworkspacerecords) is in./exportand needs nothing here. Its workspace mode packs every non-private@objectstack/*package, so it packs this one too (76).dist/bin.jshas no top-level effect (it only exportsrunCli);bin/objectstack-scenarios.jsis the published entry.dist/cli.jskeepscli.ts's own self-run guard, which comparesargv[1]with its module URL, so it never fires under the bin.dist/bin.cjsanddist/cli.cjsare emitted because the package's build emits both formats for every entry; nothing reads them.frameworkrecord field readsunknownfor a run from npm; the packages a run used are stated by feat(scenarios): run-scenarios --packages published|workspace; the gallery exporter refuses workspace records #31188'spackagesfield.ossubcommand (ruling D on Scenario library T2b: capability-tag checks in the ported scorer +os lint --evalreads scenario cards #30291 stands), any release action.Verification
All on head
149e988b(after mergingorigin/main065bba72, which carries #31188 as86e9ef0a), worktreeobjectstack-issue-31172;git merge-treeagainstorigin/main733efbd4is clean../packages/**and./examples/**under the verify lock (turbo run build --concurrency=2):Tasks: 82 successful, 82 total,VERDICT command-exit 0.pnpm --filter '@objectstack/scenarios...' build:pnpm --filter @objectstack/scenarios typecheck && pnpm --filter @objectstack/scenarios test→Test Files 27 passed (27),Tests 527 passed (527),VERDICT command-exit 0(tsc --noEmit, whoseincludecoverstest/**).node --stack-size=4000 node_modules/eslint/bin/eslint.js packages/qa/scenarios --no-inline-config→ exit 0.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack→ 77 commands, all 77 exit 0, includingcheck-changeset-no-major,check:changeset-fixed,check:published-files,check:manifest-repository-directory,check:turbo-task-graph,check:llms-txtandcheck:dual-build-cjs-loads(after the full build).--ran:77 derived famil(ies) accounted for — 77 run, 0 NOT-MEASURED. Run beyond the derivation, exit 0 each:check:published-readme-exports,check:published-readme-links,check:package-naming,check-published-list-mirrors.mjs.Check Changesetlocally, with this body as the event (GITHUB_EVENT_PATH): exit 1 onminor, exit 0 onpatch("a non-protocol change atpatch").2d69cfb4,check:llms-txtred on the count (fixed inc8b7eaf2); on9742af04, CI Test Core timed out three spawn cases (fixed in2eb91a69, see Tests).!in the title, no(narrowing)arm).The 77 derived gates, as run
Human Minimum
packages/specholds no runtime logic. (Onlyllms.txtprose in spec.)pnpm lintpasses (scoped to the package; the repo-wide run is CI's).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (llms.txtis hand-kept; nothing generated reads it.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code