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.json has no dependencies; its devDependencies name the ten siblings as workspace:*, and its prepack (tools/bundle.mjs) builds them into dist/. tools/consumer-sim.mjs already asserts "an install is one package: the distribution".

  • All eleven manifests carry a publishConfig, so tools/ci-publish.mjs (publishList: every package with a publishConfig, @gadhs/pi last) publishes all eleven on a v* tag.

  • The bundler copies each sibling’s non-TypeScript files into dist/assets/<package name>/ from what npm pack --dry-run lists for it (packedFiles and assetList in tools/lib/bundle.mjs). So a sibling’s files list decides what the bundle carries. packages/pi/dist/assets/@gadhs/pi-modes/bus-rules.json is one such file.

  • Sibling versions are read at run time. packages/pi-remote/hub.ts reads PI_REMOTE_VERSION from the package.json beside it, and electionOrder puts the member with the newest pi-remote first (packages/pi-remote/version.ts). packages/pi-modes/diagnostics.ts stamps STREAM_VERSION the same way.

  • packages/pi-modes/package.json and packages/pi-ssh/package.json name @gadhs/pi-guidance as a peer, >=0.1.0 <1, beside a workspace:* devDependency.

  • The release tooling is built for many published packages: parseTargets, targetManifest, staleDependents, pinProblems, comparableManifest and driftProblems in tools/lib/release.mjs; tools/lib/registry-drift.mjs; WORKSPACE_PACKAGES, packWorkspace and distributionTarball in tools/lib/stage.mjs.

  • laterChanges in tools/lib/ship-run.mjs counts only commits that touch a package whose manifest is not private (publishedDirs).

  • pivot-msg pins bus-rules.json as a copied fixture, described there as @gadhs/pi-modes/bus-rules.json as published with a pi version. pivot’s end-to-end harness already loads @gadhs/pi/dist/10-modes.ts and 60-remote.ts first, and finds them as files under the agent directory’s npm/node_modules/ (its Piece.installed paths in xtask/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.js contains no exports, require.resolve or import.meta.resolve, so an exports map on @gadhs/pi does not change how pi loads it.

Decisions taken with the operator (2026-12-04)

  1. Only @gadhs/pi is published. The ten siblings become private: true; @gadhs/pi exports the bus-rules fixture for pivot-msg.

  2. Lockstep versions. Every workspace manifest carries @gadhs/pi’s version, and `release prepare takes 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, delete publishConfig, set "version" to 0.193.0, which is packages/pi’s today. `files, exports, pi and the peers on upstream pi stay: the bundler and packages/pi/test/shipped-imports.test.ts read files, and siblings resolve each other through exports.

  • pi-modes and pi-ssh: @gadhs/pi-guidance leaves peerDependencies and devDependencies and becomes "dependencies": { "@gadhs/pi-guidance": "workspace:*" }. A lockstep 1.0.0 would break the <1 range. pnpm install refreshes pnpm-lock.yaml.

  • packages/pi/package.json gains:

    "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.ts says 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/pi with the others.

D2. One version: release prepare <version>

In tools/lib/release.mjs and tools/lib/ship-run.mjs:

  • parseVersion(args) replaces parseTargets: exactly one argument of the form X.Y.Z, else release prepare: one version, X.Y.Z (every package moves with @gadhs/pi). The pi@X.Y.Z spelling is not kept.

  • lockstepProblems(manifests): given each package directory’s { name, version }, one line per package whose version is not packages/pi’s. `releasePrepare refuses on any, writing nothing: release prepare: nothing written: not at @gadhs/pi’s <from>: <name> <version>; …​.

  • releasePrepare(root, args) then computes bumpedManifest(text, from, version) for every manifest under packages/ (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>. . releaseSummary reads it for the tag’s message as before.

  • Deleted: parseTargets, targetManifest, staleDependents, BUNDLING_PACKAGE, pinProblems, comparableManifest, driftProblems; tools/lib/registry-drift.mjs and tools/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: publishedDirs becomes packageDirs(root, ref), every directory under packages/ that has a manifest at ref, 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). laterProblem says "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; and verifyProblems(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. workspaceVersions is deleted. The success line reads v<version> verified: @gadhs/pi published, no sibling dependency.

D4. Publish, stage, rehearsal

  • tools/ci-publish.mjs: publishList keeps deriving from publishConfig, which now yields @gadhs/pi alone; the meta-last sort and its comments go. publishAll is unchanged.

  • tools/lib/stage.mjs: WORKSPACE_PACKAGES, packWorkspace and distributionTarball are replaced by DISTRIBUTION_DIR = "packages/pi" and packDistribution(stage, log), which runs pnpm pack there and returns the tarball’s path. workspaceFingerprint().versions is ["@gadhs/pi@<version>"]; its hash is computed as before.

  • Callers: tools/consumer-sim.mjs (the pack step) and tools/model-battery/lib/stack.mjs (stageShipped) call packDistribution.

  • tools/consumer-sim.mjs gains one check, on the installed package: every path its manifest’s exports names exists under the install. A packed tree with no exports fails it; an older published version under --registry skips 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 what files lists).

  • 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.json stays, as a workspace import.

D6. Docs

  • packages.adoc (canonical): only @gadhs/pi is 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 three release rows of the task table and the Rehearsals bullet about what is packed.

  • public-surface.adoc: a row for @gadhs/pi/bus-rules.json and @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.json in 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 names registry-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 for release 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 under packages/ has a publishConfig and it is @gadhs/pi; every other manifest is private: true; every manifest’s version equals @gadhs/pi’s; no sibling names another `@gadhs/pi-* package under peerDependencies.

  • 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: verifyProblems names @gadhs/pi-modes in a published dependencies and says nothing for @gadhs/pivot-wire or a third-party name.

  • T5, packages/pi/test/distribution.test.ts: publishList is @gadhs/pi alone; 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 equal packages/pi-modes/bus-rules.json; and createRequire from inside the package resolves @gadhs/pi/bus-rules.json to it.

  • T7, tools/consumer-sim.mjs: the new exports check, run by the rehearse job on the packed tree and by published on 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.ts already asserts no dependencies; consumer-sim already asserts one package installed; release verify now 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 prepare refuses naming it, and T1 fails validate.

  • The exports map breaks a reader that resolves a subpath of @gadhs/pi by 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 open dist/ 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-modes on the registry and finds no new version: fail-closed on its side. Mitigation: a message on pi-feedback/feedback at delivery with the new name; the git tag’s packages/pi-modes/bus-rules.json is 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: versionOlder compares 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/pi is published; @gadhs/pi/bus-rules.json; every package carries the distribution’s version; release prepare takes one version.

  • node tools/task.mjs check before the push, then the merge train, squash off. Because this changes what a release packs, node tools/task.mjs validate and node tools/consumer-sim.mjs run 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 progress when the branch starts and to Done (date) at the merge.

Edit this page · latest