Harness Intelligence Wiki
SpecsCLIIssue 45 Packaged CLI Script Runtime

Spec: Packaged CLI Script Runtime

Spec: Packaged CLI Script Runtime

Initial Situation

Harness update flows generate temporary scaffold output and execute generated JavaScript maintenance scripts inside that output. The first failing script in issue 45 was .agents/scripts/sync-subagents.mjs.

The npm CLI is packaged as a Bun standalone executable. In that environment, process.execPath and Bun.execPath can identify the packaged CLI entrypoint instead of a general JavaScript runtime.

Issue

dp update used process.execPath to run generated scripts. When the packaged CLI entrypoint was used as the child executable, the command re-entered the CLI with the temp script path as an argument and failed before the update summary or JSON payload could be emitted.

Solution

Add a shared synchronous JavaScript script runner for CLI internals:

  • default to node, because generated maintenance scripts are plain .mjs files
  • allow DP_SCRIPT_RUNTIME as an override for unusual installations
  • use the helper for scaffold subagent sync and staged wiki content sync
  • preserve existing stdio: "ignore" behavior for generated maintenance scripts

Non-Goals

  • Changing update drift detection.
  • Changing baseline selection or bundled fallback behavior.
  • Rewriting generated scripts.
  • Adding a new external runtime dependency for installed CLI users.

Acceptance Criteria

  • A regression test simulates packaged CLI process.execPath and Bun.execPath both pointing at a CLI entrypoint and proves scaffold script execution still succeeds.
  • dp update --check --json can reach its structured update result instead of failing in temp subagent sync.
  • Existing update and scaffold tests continue to pass.
  • Operator docs state that packaged CLI script execution must use the host runtime, not the CLI entrypoint.

On this page