Skip to content

CLI reference

The agent-detective npm package is the operator entry point. Install globally (npm i -g agent-detective) or run with npx.

Typical flow: initdoctor → start server → smoke (mock webhook).

For terminal help at any time:

Terminal window
agent-detective --help
agent-detective help doctor
agent-detective doctor --help
Flag / envPurpose
--config-root <dir>Install directory containing config/, or the config/ dir itself
AGENT_DETECTIVE_CONFIG_ROOTSame as --config-root
--versionPrint CLI version
-h, --helpOverview help, or command help when placed after a subcommand

Default server command (no subcommand):

Terminal window
agent-detective --config-root ~/agent-detective

OpenAPI docs: http://127.0.0.1:3001/docs by default (or your configured port).


Scaffold config/local.json (and copy config/default.json from the package template when missing).

ModeBehavior
TTY, no --yesSix-section guided wizard with review screen
--yes / -yNon-interactive; use flags or defaults

Common flags: --repo-path, --repo-name, --repo name:path, --port, --agent, --default-model, --tracker jira|linear|mock-only, --jira-mock / --no-jira-mock, --force, --json.

See get started for a full quickstart example.


Preflight before you run the server or expose webhooks. Exit code 0 when all checks pass, 1 otherwise.

Terminal window
agent-detective doctor --config-root ~/agent-detective
agent-detective doctor --config-root ~/agent-detective --verbose
agent-detective doctor --json
FlagPurpose
--config-root <dir>Install directory (default: cwd)
--verboseExtra detail lines under each check (paths, plugin specs)
--jsonMachine-readable report: { ok, configRootUsed, checks[] }

Human output is grouped into sections. Each check shows ok or FAIL, a short title, and a one-line summary.

SectionChecks
ConfigurationConfig directory/files present; default.json + local.json load and pass Zod validation (includes env whitelist merge)
AgentConfigured agent CLI (OpenCode, Cursor, Claude, …) is on PATH
PluginsEach configured plugin package imports, schema validates, and options validate
RepositoriesEach repos[].path exists, resolves relative to install root, and is a git checkout (.git present)
Issue trackersWhen Jira/Linear are enabled and not in mock mode: required API credentials (Basic or OAuth) are present via config or env — see configuration.md
ServerConfigured listen port is free, or agent-detective is already responding on /api/health

Example (success):

agent-detective doctor: OK (11/11 checks)
Config root: ~/agent-detective/config
Configuration
ok Config files
default.json and/or local.json present
ok Schema validation
valid
Agent
ok Agent CLI
opencode on PATH
Plugins (4/4)
ok @agent-detective/jira-adapter@0.1.0
...
Repositories
ok symfony
/path/to/checkout
Issue trackers
ok Jira
mock mode
Server
ok Listen port
in use (this app)

Port note: If the server is already running on the configured port, doctor passes with in use (this app). If another process holds the port, doctor fails.

Fix FAIL lines before production cutover. Re-run after changing config, env, or repo paths.


POST the bundled jira:issue_created fixture to the local Jira webhook. Requires the server running and Jira mock mode (default after init).

Terminal window
agent-detective smoke --config-root ~/agent-detective

Fixture labels: probando, symfony — must match a repos[].name in config.

Flag / envPurpose
--config-root <dir>Read port from config; POST to local Jira webhook on that port
--url <webhook-url>Full URL override
JIRA_WEBHOOK_URLSame as --url
--host <host>Host when building URL from config port
AGENT_DETECTIVE_SMOKE_HOSTDefault host (127.0.0.1)
--jsonMachine-readable result

Success: HTTP 200, body like {"status":"queued","taskId":"..."}; server logs show task queue + agent run + [MOCK] Added comment.

From a monorepo clone: pnpm run jira:webhook-smoke (same fixture under fixtures/).

Details: get started — mock webhook smoke.


Config files only — loads and validates default.json + local.json with Zod. Does not check agent CLI, plugin imports, repo paths, or listen port.

Use when you only need to verify JSON shape (e.g. CI config lint). For operator preflight, prefer doctor.

Terminal window
agent-detective validate-config --config-root ~/agent-detective

Supports --json and --verbose.

CommandConfig schemaAgent on PATHPlugins importRepos on diskPort / credentials
validate-configyesnononono
doctoryesyesyesyesyes