feat(install): add the agent-bundle/install package-bound lifecycle entry (#724) - #730
Conversation
🦋 Changeset detectedLatest commit: 78b966a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab28ff11d5
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…lazy loading, full type surface
Fixes #724.
What
agent-bundle/install— one public entry so a published plugin ships a package-bound installer bin without bundlingagent-bundle-src/.../src/install/*, probing for its artifact root, or parsing argv itself.runInstallCli(argv, { from, name }): theagent-bundleCLI's owninstall <host>/uninstall <host>/doctorcommands with the bundle root pinned tofrom. Same flags, receipts, replacement rules,--plan, data policy,--json, exit codes (0 / 1 + one diagnostics line on stderr / 2 usage). No--fromis exposed once pinned.installBundle,uninstallBundle,runDoctor,formatInstallResult,formatUninstallResult, newformatDoctorReport, and their option/result types.src/install/commands.tsandsrc/cli.tsis rewired onto it in the same change (no duplicate parser);humanDoctormoved toinstall/format.tsasformatDoctorReport.rslib.config.ts), i.e. re-bundle-safe placement likeweb-host: the consumer's package build inlines it into the bin (AB7014confirmed that inlining during the fixture's first run).The whole consumer installer becomes:
Rung chosen: the public
agent-bundleCLI cannot satisfy an installed consumer (it would needagent-bundleas a runtime dependency, whichAB7014rejects and which drags the compiler into end-user installs), and the generatedinstall.mjsis Cursor-only.install --planis not added:doctor --host <host>is the real read-only preview (current / stale / version-mismatch / foreign / not-installed), so the consumer's approximate plan is deleted rather than reproduced.Proof
tests/install-cli.test.ts(unit): argv →installBundle/uninstallBundle/runDoctormapping with the pinned root,--fromrejected, help/usage/failure exit codes.tests/packed-install-bin.test.ts(packed pool): a consumer withbin: { 'demo-install': './src/install-bin.ts' }importingagent-bundle/install,prepack,npm pack dist, installed into a clean consumer with noagent-bundleon disk, source project deleted; then the bin runsinstall cursor(installed, receipt), again (already-installed), after content drift (replaced),doctor --host cursor(current),uninstall --plan(planned, exact paths, nothing removed),uninstall(uninstalled), and reports not-installed afterwards;--fromexits 2; the bin carries noagent-bundleimport.Docs
website/docs/{en,zh}/guide/distribution/installation.mdx(“A package-bound installer bin”),website/docs/{en,zh}/reference/api.mdxrow, TypeDoc entry point.Exit codes follow the
agent-bundleCLI:doctorwrites its report (human or--json) to stdout and exits 1 when it carries an error finding; a failedinstall/uninstallor any thrown error writes one diagnostics JSON line to stderr and exits 1; usage errors exit 2.tests/install-cli.test.tsasserts the stream for both.Local gate (branch contains current
origin/mainb5cf757; final tree 78b966a)Deslop: Claude Fable 5.1, 3 edits (collapsed the
--fromoption helper; dropped an unused re-exported type; removed a now-unusederrorMessageimport incli.ts).Self-review
Reviewer: GPT-5.6 Sol Max (two passes; the tracedecay-bound
change-risk-reviewerwas unavailable, so a general reviewer read the diff).Pass 1 — six findings, all fixed:
doctorwrites its report to stdout. → JSDoc, en/zh guides, changeset corrected; stream test added. (Same as the Codex P2 thread, resolved.)export type *frominstall.ts/uninstall.ts/doctor.ts.cli.tslifecycle loader imported all three implementations on any lifecycle command. → per-call lazy import, matching the previous behavior.diagnosticsForduplicated betweencli.tsand the entry. → moved tocore/diagnostics.ts, one copy.Pass 2 — one finding, fixed: pinned bins still evaluated
process.cwd()while registering, so a deleted cwd broke--help. →process.cwd()is read only when--fromis actually registered.