Plan: only @gadhs/pi is published; its ten sibling packages become private and move in step with it
Closes: #836. Relates to: #801, #701, #641. Branch: chore/publish-distribution-only. Status: Done (2026-12-04) — only @gadhs/pi is published; siblings private and lockstep (#836)
Context
What the tree says, by reading:
-
packages/pi/package.jsonhas nodependencies; itsdevDependenciesname the ten siblings asworkspace:*, and itsprepack(tools/bundle.mjs) builds them intodist/.tools/consumer-sim.mjsalready asserts "an install is one package: the distribution". -
All eleven manifests carry a
publishConfig, sotools/ci-publish.mjs(publishList: every package with apublishConfig,@gadhs/pilast) publishes all eleven on av*tag. -
The bundler copies each sibling’s non-TypeScript files into
dist/assets/<package name>/from whatnpm pack --dry-runlists for it (packedFilesandassetListintools/lib/bundle.mjs). So a sibling’sfileslist decides what the bundle carries.packages/pi/dist/assets/@gadhs/pi-modes/bus-rules.jsonis one such file. -
Sibling versions are read at run time.
packages/pi-remote/hub.tsreadsPI_REMOTE_VERSIONfrom thepackage.jsonbeside it, andelectionOrderputs the member with the newest pi-remote first (packages/pi-remote/version.ts).packages/pi-modes/diagnostics.tsstampsSTREAM_VERSIONthe same way. -
packages/pi-modes/package.jsonandpackages/pi-ssh/package.jsonname@gadhs/pi-guidanceas a peer,>=0.1.0 <1, beside aworkspace:*devDependency. -
The release tooling is built for many published packages:
parseTargets,targetManifest,staleDependents,pinProblems,comparableManifestanddriftProblemsintools/lib/release.mjs;tools/lib/registry-drift.mjs;WORKSPACE_PACKAGES,packWorkspaceanddistributionTarballintools/lib/stage.mjs. -
laterChangesintools/lib/ship-run.mjscounts only commits that touch a package whose manifest is not private (publishedDirs). -
pivot-msg pins
bus-rules.jsonas a copied fixture, described there as@gadhs/pi-modes/bus-rules.jsonas published with a pi version. pivot’s end-to-end harness already loads@gadhs/pi/dist/10-modes.tsand60-remote.tsfirst, and finds them as files under the agent directory’snpm/node_modules/(itsPiece.installedpaths inxtask/src/cmd/e2e_pi.rs), not by resolving a package subpath. -
pi loads a package’s extensions from the paths in its manifest’s
pi.extensions.node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.jscontains noexports,require.resolveorimport.meta.resolve, so anexportsmap on@gadhs/pidoes not change how pi loads it.
Decisions taken with the operator (2026-12-04)
-
Only
@gadhs/piis published. The ten siblings becomeprivate: true;@gadhs/piexports the bus-rules fixture for pivot-msg. -
Lockstep versions. Every workspace manifest carries
@gadhs/pi’s version, and `release preparetakes one version and moves all eleven.
Design
D1. Manifests
-
The ten siblings (
pi-agents,pi-bash,pi-guidance,pi-modes,pi-remote,pi-shellcheck,pi-ssh,pi-vertex,pi-workflow,pi-workspace): add"private": true, deletepublishConfig, set"version"to0.193.0, which ispackages/pi’s today. `files,exports,piand the peers on upstream pi stay: the bundler andpackages/pi/test/shipped-imports.test.tsreadfiles, and siblings resolve each other throughexports. -
pi-modesandpi-ssh:@gadhs/pi-guidanceleavespeerDependenciesanddevDependenciesand becomes"dependencies": { "@gadhs/pi-guidance": "workspace:*" }. A lockstep 1.0.0 would break the<1range.pnpm installrefreshespnpm-lock.yaml. -
packages/pi/package.jsongains:"exports": { "./bus-rules.json": "./dist/assets/@gadhs/pi-modes/bus-rules.json", "./package.json": "./package.json" }The alias keeps a reader of the fixture independent of the bundle’s layout.
-
The header comment of
packages/pi-guidance/index.tssays pi-modes consumes it "as a peer (range, not exact)" so a content release ships without touching the policy package. That stops being true; the sentence is rewritten to say the package is built into@gadhs/piwith the others.
D2. One version: release prepare <version>
In tools/lib/release.mjs and tools/lib/ship-run.mjs:
-
parseVersion(args)replacesparseTargets: exactly one argument of the formX.Y.Z, elserelease prepare: one version, X.Y.Z (every package moves with @gadhs/pi). Thepi@X.Y.Zspelling is not kept. -
lockstepProblems(manifests): given each package directory’s{ name, version }, one line per package whose version is notpackages/pi’s. `releasePreparerefuses on any, writing nothing:release prepare: nothing written: not at @gadhs/pi’s <from>: <name> <version>; …. -
releasePrepare(root, args)then computesbumpedManifest(text, from, version)for every manifest underpackages/(the existing function, which refuses a version that is not newer), cuts the changelog, and writes all twelve files only after every text is computed. -
cutChangelog(text, version, date): the summary line under the release heading is.@gadhs/pi<version>.releaseSummaryreads it for the tag’s message as before. -
Deleted:
parseTargets,targetManifest,staleDependents,BUNDLING_PACKAGE,pinProblems,comparableManifest,driftProblems;tools/lib/registry-drift.mjsandtools/lib/test/registry-drift.test.mjs. Each guarded a package published at a version the registry already held, or a pin between two published packages. Neither exists once one package is published and its version moves at every release.
D3. Tag and verify
-
laterChanges:publishedDirsbecomespackageDirs(root, ref), every directory underpackages/that has a manifest atref, private or not, since each is built into the tarball. Without this, a fix to a sibling landed after the release merge would no longer refuse the tag (T3).laterProblemsays "change a package the distribution is built from". -
releaseVerify(root, version): the remote tag peels to the tagged commit (unchanged);@gadhs/pi@<version>is on the registry, waited for as today; andverifyProblems(dependencies)names any published dependency whose name starts@gadhs/pi-, because the registry still holds the siblings' old versions and such a line would install one.workspaceVersionsis deleted. The success line readsv<version> verified: @gadhs/pi published, no sibling dependency.
D4. Publish, stage, rehearsal
-
tools/ci-publish.mjs:publishListkeeps deriving frompublishConfig, which now yields@gadhs/pialone; the meta-last sort and its comments go.publishAllis unchanged. -
tools/lib/stage.mjs:WORKSPACE_PACKAGES,packWorkspaceanddistributionTarballare replaced byDISTRIBUTION_DIR = "packages/pi"andpackDistribution(stage, log), which runspnpm packthere and returns the tarball’s path.workspaceFingerprint().versionsis["@gadhs/pi@<version>"]; its hash is computed as before. -
Callers:
tools/consumer-sim.mjs(the pack step) andtools/model-battery/lib/stack.mjs(stageShipped) callpackDistribution. -
tools/consumer-sim.mjsgains one check, on the installed package: every path its manifest’sexportsnames exists under the install. A packed tree with noexportsfails it; an older published version under--registryskips it by name, as the bundle checks do. -
.gitlab-ci.yml: the release stage’s comments are reworded for one package. No job changes.
D5. The fixture’s readers
-
packages/pi-modes/test/bus-rules.test.ts: its third case keeps asserting the fixture is in pi-modes'files, retitled to say why (the bundle carries whatfileslists). -
packages/pi-remote/test/bus-rules.test.ts: the comment "as pivot-msg reads it" is corrected; the read through@gadhs/pi-modes/bus-rules.jsonstays, as a workspace import.
D6. Docs
-
packages.adoc(canonical): only@gadhs/piis published, the rest are workspace packages built into it; pi-modes "depends on" pi-guidance; "this repo’s eleven" under the group endpoint; the Publishing section. -
local-dev.adoc: the threereleaserows of the task table and the Rehearsals bullet about what is packed. -
public-surface.adoc: a row for@gadhs/pi/bus-rules.jsonand@gadhs/pi/package.json(the page test fails without it); each sibling row’s tier becomes internal, a workspace package that is not published; the stable tier names@gadhs/pi/bus-rules.jsonin place of pi-modes' subpath and of the siblings' default exports. -
project-conventions.adoc(Stability from 1.0): the same two corrections, and the siblings are private and versioned with@gadhs/pi. -
remote.adoc(the rules as a fixture): the published name is@gadhs/pi/bus-rules.json. -
security.adoc: the table row that namesregistry-drift.test.mjs. -
adrs/adr-004-package-boundaries.adoc: one dated amendment line: the packages remain as boundaries in the workspace; one package is published. -
tools/task.mjs: the usage line forrelease prepare.
Scope
One MR. Files: the eleven packages/*/package.json; pnpm-lock.yaml; packages/pi-guidance/index.ts; tools/lib/release.mjs, tools/lib/ship-run.mjs, tools/lib/stage.mjs, tools/ci-publish.mjs, tools/consumer-sim.mjs, tools/model-battery/lib/stack.mjs, tools/task.mjs; deleted tools/lib/registry-drift.mjs and its test; tests tools/lib/test/release.test.mjs, tools/lib/test/later-changes.test.mjs, tools/lib/test/stage.test.mjs, packages/pi/test/distribution.test.ts, packages/pi-modes/test/bus-rules.test.ts, packages/pi-remote/test/bus-rules.test.ts; .gitlab-ci.yml; the docs of D6; CHANGELOG.adoc.
Tests
Regression (the case that would have caught it):
-
T1,
tools/lib/test/stage.test.mjs, on the real tree, replacing the #510 case: exactly one package underpackages/has apublishConfigand it is@gadhs/pi; every other manifest isprivate: true; every manifest’s version equals@gadhs/pi’s; no sibling names another `@gadhs/pi-*package underpeerDependencies. -
T2,
tools/lib/test/release.test.mjs, in a scratch workspace of three manifests and a changelog:releasePrepare(root, ["1.0.0"])moves all three and cuts the heading with the one-line summary; a manifest at another version refuses and leaves every file as it was; a version not newer refuses;["pi@1.0.0"]and two arguments refuse. The cases for the deleted functions go with them. -
T3,
tools/lib/test/later-changes.test.mjs: a commit that changes a private package’s own files after the release is named; its tests, docs and tools are still not counted. The existing case that a private package is not counted is replaced by this one. -
T4,
tools/lib/test/release.test.mjs:verifyProblemsnames@gadhs/pi-modesin a publisheddependenciesand says nothing for@gadhs/pivot-wireor a third-party name. -
T5,
packages/pi/test/distribution.test.ts:publishListis@gadhs/pialone; a failed publish is reported as failed. These replace "meta last" and "a sibling’s failure halts".
Contract:
-
T6,
packages/pi/test/distribution.test.ts,contract: @gadhs/pi/bus-rules.json: the manifest’s export names./dist/assets/@gadhs/pi-modes/bus-rules.json; the packed file list has it; its bytes equalpackages/pi-modes/bus-rules.json; andcreateRequirefrom inside the package resolves@gadhs/pi/bus-rules.jsonto it. -
T7,
tools/consumer-sim.mjs: the newexportscheck, run by therehearsejob on the packed tree and bypublishedon the registry’s copy.
Existing tests that hold the rest: packages/pi/test/shipped-imports.test.ts packs every package with npm pack and fails on an empty file list, so it fails if a private package stopped packing; "pi loads every shim" in distribution.test.ts and consumer-sim’s boot hold that the exports map leaves loading as it was.
No concurrency test: nothing here changes ordering or a shared resource.
Risks
-
A sibling reappears in
@gadhs/pi’s `dependencies, and an install fetches the registry’s old copy: silent. Mitigation:distribution.test.tsalready asserts nodependencies; consumer-sim already asserts one package installed;release verifynow names it (T4). -
A fix to a sibling lands after the release merge and the tag misses it: silent without D3. Mitigation: every package directory counts; the tag refuses, naming the commit (T3). Fail-closed.
-
One manifest’s version is edited away from the rest: fail-closed.
release preparerefuses naming it, and T1 failsvalidate. -
The
exportsmap breaks a reader that resolves a subpath of@gadhs/piby name: fail-closed, a load or resolve error. With the map,@gadhs/pi/dist/…no longer resolves by name; only the two exported paths do. Mitigation: pi and pivot’s harness both opendist/files by path (Context); the rehearsal boots the packed package under real pi; T6 and T7; the message to pivot says so. -
pivot-msg’s next refresh of its fixture looks for
@gadhs/pi-modeson the registry and finds no new version: fail-closed on its side. Mitigation: a message onpi-feedback/feedbackat delivery with the new name; the git tag’spackages/pi-modes/bus-rules.jsonis unchanged. -
pi-remote’s reported version jumps from 0.34.0 to the distribution’s: silent. The election prefers the higher version, which is the newer code, and a build of main reads 0.193.0 against the release’s 0.34.0. Mitigation:
versionOldercompares numeric parts, so any later version orders above every earlier one; pivot is told in the same message. -
The siblings' old versions stay installable from the registry: silent for anyone who installs one by name. Mitigation: none in this change; deprecating them needs a registry owner and is named in the close note.
Out of scope
-
The context trim (#1043) and the mid-conversation tool-change probe.
-
Deprecating or removing the siblings' published versions.
-
The siblings' README stubs, keywords and their peer floors on upstream pi.
Delivery
-
Canonical doc page:
packages.adoc; the other pages of D6 are corrections of statements this change makes false. -
CHANGELOG.adoc== Unreleased, Changed: only@gadhs/piis published;@gadhs/pi/bus-rules.json; every package carries the distribution’s version;release preparetakes one version. -
node tools/task.mjs checkbefore the push, then the merge train, squash off. Because this changes what a release packs,node tools/task.mjs validateandnode tools/consumer-sim.mjsrun here before the MR is added to the train. -
The close: the MR closes #836; one note with the merge SHA, the registry-deprecation item for a human, and the message sent to pivot.
-
Status moves to
In progresswhen the branch starts and toDone (date)at the merge.