Skip to content

Commit 4eba167

Browse files
docs(rig): add JSDoc to runLauncherCli (#126)
1 parent fff2deb commit 4eba167

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

skills/rig/rig.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,31 @@ function renderLauncherUsage(scriptName: string): string {
14741474
].join("\n");
14751475
}
14761476

1477+
/**
1478+
* Entry-point CLI that parses `argv`, wires a `copilotEngine`, and runs the
1479+
* agent program. Two modes are supported:
1480+
*
1481+
* - **File mode** (`runLauncherCli(["path/to/prog.ts"])`): reads the agent
1482+
* input from stdin and invokes the root agent exported from the program file.
1483+
* - **Stdin mode** (`runLauncherCli([])`): reads a full rig program from stdin,
1484+
* compiles it in a temp directory, and runs its default export.
1485+
*
1486+
* Recognized flags:
1487+
* - `--server` — use stdio transport instead of the default URI connection.
1488+
* - `--typecheck` — run `tsc --noEmit` before executing the program.
1489+
* - `--help` / `-h` / `help` / `/help` / `/?` — print usage and return.
1490+
*
1491+
* Structured JSONL events (prefixed `rig.*`) are written to stderr; the final
1492+
* agent output is written to stdout as JSON.
1493+
*
1494+
* @example
1495+
* // In the rig.ts shebang entrypoint:
1496+
* await runLauncherCli();
1497+
*
1498+
* @example
1499+
* // With a custom working directory for tests:
1500+
* await runLauncherCli(["src/my-agent.ts"], { cwd: "/repo" }, { stdin: process.stdin, stdout: process.stdout });
1501+
*/
14771502
export async function runLauncherCli(
14781503
argv: string[] = process.argv.slice(2),
14791504
options: LaunchOptions = {},

0 commit comments

Comments
 (0)