Skip to main content

Cli Agent

@mgreten/cli-agentv2026.05.19.2· 1d agoMODELS
01README

Invoke CLI coding agents (claude, opencode, amp, gemini) with typed inputs and capture structured outputs — tokens, cost, duration, retries, and exit code. Supports slash command resolution and JSON response parsing.

02Release Notes

Add commandSubdirs global arg for configurable slash command search paths.

03Models1
@mgreten/cli-agentv2026.05.19.2cli_agent.ts
fn invoke(prompt: string, model?: string, cwd?: string, tags?: record, wallTimeoutMs?: number)
Run a CLI agent tool (claude, opencode, amp, gemini) with a prompt and record structured results
ArgumentTypeDescription
promptstringThe prompt or slash command to execute
model?stringOverride the default model (e.g. 'opus', 'sonnet', 'ollama/qwen3.6:35b')
cwd?stringWorking directory for the CLI (defaults to Deno.cwd())
tags?recordArbitrary key-value tags for grouping/filtering invocations
wallTimeoutMs?numberOverride wall timeout in milliseconds
fn invokeAndParse(prompt: string, model?: string, cwd?: string, tags?: record, wallTimeoutMs?: number)
Run a CLI agent and parse the JSON response from the output. Returns the parsed data alongside the invocation record.
ArgumentTypeDescription
promptstring
model?string
cwd?string
tags?record
wallTimeoutMs?number

Resources

invocation(30d)— Structured record of a CLI agent invocation with provider, tokens, cost, and output
04Previous Versions1
2026.05.19.1May 19, 2026

Initial release: multi-provider CLI agent invoker with structured output tracking.

05Stats
A
100 / 100
Downloads
7
Archive size
12.1 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms