Harness Intelligence Wiki
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.ts exposes runJavaScriptFileSync.
  • apps/cli/src/scaffold/output.ts uses the helper for generated .agents/scripts/sync-subagents.mjs.
  • apps/cli/src/update/run.ts uses the helper for staged wiki scripts/sync-content.mjs.
  • apps/cli/src/update/run.test.ts adds 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.execPath pointed 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 --json reaches normal managed scaffold drift and includes react-doctor expected 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

CheckResultEvidence
Packaged CLI entrypoint avoidedPassRegression test replaces process.execPath and Bun.execPath with a failing fake entry.
Real script runtime selectedPassHelper defaults to node and supports DP_SCRIPT_RUNTIME.
Update and scaffold paths coveredPassBoth generated subagent sync and wiki content sync use the helper.
Operator guidance updatedPassRoot docs, runbook, debt file, and routed spec describe the behavior.
Built executable regressionOpen2.2.2 proved Bun.execPath can still recurse into the CLI entrypoint.

On this page