SpecsCLIIssue 45 Packaged CLI Script Runtime
Implementation Notes: Issue 45 Packaged CLI Script Runtime
Implementation Notes: Issue 45 Packaged CLI Script Runtime
Summary
Added a shared runtime helper for generated JavaScript maintenance scripts so Bun-packaged CLI installs do not use the packaged CLI entrypoint as the child script runtime.
Changes
apps/cli/src/runtime/scripts.tsexposesrunJavaScriptFileSync.apps/cli/src/scaffold/output.tsuses the helper for generated.agents/scripts/sync-subagents.mjs.apps/cli/src/update/run.tsuses the helper for staged wikiscripts/sync-content.mjs.apps/cli/src/update/run.test.tsadds a regression test for packaged Bun CLI entrypoint behavior.docs/README.md,docs/runbooks/dp-cli-scaffolding.md, and routed debt/spec docs record the operator contract.
Validation Evidence
- RED: targeted host-runtime regression failed before the helper because
process.execPathpointed at a fake CLI entrypoint. - GREEN:
bun run --cwd apps/cli test src/update/run.test.ts --testNamePattern "host runtime" - GREEN:
bun run --cwd apps/cli check-types - GREEN:
bun run --cwd apps/cli check - GREEN:
bun run --cwd apps/cli test src/update/run.test.ts - GREEN:
bun run apps/cli/src/index.ts update --check --baseline bundled --json - GREEN:
bun run --cwd apps/cli build - GREEN:
git diff --check - GREEN:
bun run --cwd apps/cli test src/update/run.test.ts src/scaffold/run.test.ts - GREEN:
bun run apps/cli/src/index.ts update --check --baseline stable --refresh-baseline --jsonreaches normal managed scaffold drift and includesreact-doctorexpected changes instead of throwing a missing baseline asset error. - BLOCKED: built executable update checks still fail while executing generated
sync-subagents.mjs.
Manual Review Checklist
| Check | Result | Evidence |
|---|---|---|
| Packaged CLI entrypoint avoided | Pass | Regression test replaces process.execPath and Bun.execPath with a failing fake entry. |
| Real script runtime selected | Pass | Helper defaults to node and supports DP_SCRIPT_RUNTIME. |
| Update and scaffold paths covered | Pass | Both generated subagent sync and wiki content sync use the helper. |
| Operator guidance updated | Pass | Root docs, runbook, debt file, and routed spec describe the behavior. |
| Built executable regression | Open | 2.2.2 proved Bun.execPath can still recurse into the CLI entrypoint. |