Implementation:2aronS Duel Agents runInstall
| Knowledge Sources | |
|---|---|
| Domains | Configuration, Developer_Tools |
| Last Updated | 2026-10-27 14:00 GMT |
Overview
Concrete tool for dispatching the Duel Agents install command to one or all supported targets, handling the all, doctor, and per-target cases, provided by @duel-agents/install.
Description
The runInstall function is the top-level install orchestrator called by the CLI main(). It interprets the target argument and dispatches:
"doctor"→ delegates torunDoctorundefined(omitted) → installs all targets inALL_TARGETSorder, then runsrunDoctor"all"→ same as omitted, installs all targets then doctor- A specific target (e.g.,
"claude-code") → installs that one target viainstallForTarget - Unknown target → prints error with valid targets list, exits 1
The installForTarget function handles per-target install: validates the key, calls installTargetEnv, prints warnings, copies skills (for cursor/openclaw), and prints post-install instructions (restart tool, validate config, etc.).
ALL_TARGETS is the ordered array ["claude-code", "cursor", "codex", "openclaw"].
Usage
Import this function when you need to:
- Run the install flow programmatically
- Add a new target to the install dispatch
- Understand the target argument parsing
Code Reference
Source Location
- Repository: Duel-Agents
- File:
packages/cli/src/install.ts(lines 98-195)
Signature
export const ALL_TARGETS: InstallTarget[] = [
"claude-code", "cursor", "codex", "openclaw",
];
export async function installForTarget(
target: InstallTarget,
apiKey: string,
): Promise<void>;
export async function runInstall(
targetArg: string | undefined,
apiKey: string,
): Promise<number>;
Import
import { runInstall, installForTarget, ALL_TARGETS } from "@duel-agents/install";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| targetArg | undefined | No | CLI positional arg (target, all, doctor, or omitted)
|
| apiKey | string |
Yes | Validated Duel key |
| target (installForTarget) | InstallTarget |
Yes | Specific target to install |
Outputs
| Name | Type | Description |
|---|---|---|
| returns | Promise<number> |
Exit code: 0 (success), 1 (unknown target / key invalid) |
| side effect | console output | Progress messages, warnings, post-install instructions |
| side effect | filesystem | Env files written, skills copied, OpenClaw config patched |
Usage Examples
Install All Targets
import { runInstall } from "@duel-agents/install";
// undefined target = install all + run doctor
const code = await runInstall(undefined, apiKey);
process.exit(code);
Install Single Target
import { runInstall } from "@duel-agents/install";
const code = await runInstall("claude-code", apiKey);
// Installs only Claude Code, no doctor
process.exit(code);
Run Doctor Only
import { runInstall } from "@duel-agents/install";
const code = await runInstall("doctor", apiKey);
process.exit(code);