Harness Intelligence Wiki
SpecsCLICli Tool Validation

Spec: CLI Tool Ensure Command

Spec: CLI Tool Ensure Command

User Input

add a dp -v to output version and a dp "validate" (dont rembmer the proper technical term. ensure or smth) that checks external tools and their presence and that installs them.

also on this matter: when we enforce agent-browser we ALWAYS end up with cli installing chrome. even if its already present. please fix this.

$goalify conduct $parallel-research on this and then jump into $delivery-phase in full parallel

Context

Harness operators need a direct way to verify and repair the external toolchain that scaffolded agent workflows expect. Today required-tool installation happens as a side effect of scaffold setup/update, while the CLI does not expose an explicit tool ensure command. Operators also expect the short version flag dp -v to behave like dp --version.

The affected roles are local Harness operators and generated agents running dp in consumer repositories. They need a command that checks the same required tools described by scaffold metadata, installs missing tools when possible, and avoids redundant browser setup when an existing Chrome or Chromium installation can satisfy agent-browser.

Non-Goals

  • Renaming the CLI package or executable aliases.
  • Replacing scaffold setup/update required-tool bootstrap behavior.
  • Installing or managing browser extensions, authenticated browser profiles, or non-Harness browser state.
  • Making agent-browser optional when selected packs require it.
  • Publishing the npm release.

Acceptance Criteria

  • dp -v prints the same version as dp --version.
  • A dp tools ensure command exists under the tools command group and is discoverable from help.
  • dp tools ensure checks Harness required external tools using the same tool registry and install behavior as scaffold setup/update.
  • dp tools ensure can run outside a scaffolded repo and validates the default required toolchain.
  • dp tools ensure can run inside a scaffolded repo and uses .devpunks/settings.json.
  • Missing installable tools are installed or reported with the same recovery-quality error messages as existing setup/update bootstrap.
  • Already-present tools are reported as present and are not reinstalled.
  • agent-browser validation does not trigger Chrome installation when a usable Chrome or Chromium executable already exists on the machine.
  • Existing setup/update required-tool checks also benefit from the agent-browser Chrome-presence fix.
  • Focused CLI tests cover -v, tools ensure, already-present tools, missing-tool install calls, and the agent-browser existing-Chrome path.
  • Operator docs and runbooks explain when to use dp tools ensure.

Constraints

  • Keep app/package boundaries: apps/cli owns executable behavior and local tool bootstrap.
  • Reuse existing required-tool registry and runtime abstraction instead of creating a parallel installer.
  • Preserve current scaffold setup/update behavior except for avoiding redundant Chrome installation.
  • Keep command behavior deterministic in tests by injecting or stubbing command presence/install execution.
  • Root scripts remain Turborepo delegators; no root workflow changes.

Technical Notes

  • Existing required-tool metadata and bootstrap behavior live in apps/cli/src/core/tools.ts and the catalog under apps/cli/src/data/catalog/tools.ts.
  • Existing command registration lives in apps/cli/src/index.ts.
  • agent-browser Chrome installation appears to be coupled to package installation or postinstall behavior, so the fix may require marking the tool as satisfied when both the CLI command and an existing browser executable are present.

Decision Log

DecisionRationale
Use tools ensure as the command pathThe user clarified the command should live under the tools path as dp tools ensure.
Include scaffolded and non-scaffolded modesOperators need both first-run repair and repo-specific required-tool verification.

On this page