Skip to main content

Cli Agent

@mgreten/cli-agentv2026.06.27.2· 9d agoMODELS
01README

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

02Models1
@mgreten/cli-agentv2026.06.27.2cli_agent.ts

Global Arguments

ArgumentTypeDescription
defaultModelstring
commandsDirstring
commandSubdirsarrayAdditional subdirectories under commandsDir to search for slash commands
claudePathstring
opencodePathstring
ampPathstring
geminiPathstring
codexPathstring
idleTimeoutMsnumber
wallTimeoutMsnumber
maxRetriesnumber
fn invoke(prompt: string, model?: string, cwd?: string, tags?: record, wallTimeoutMs?: number)
Run a CLI agent tool (claude, opencode, amp, gemini, codex) 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
fn listModels()
List the model identifiers available to a provider's CLI (currently opencode only)

Resources

invocation(30d)— Structured record of a CLI agent invocation with provider, tokens, cost, and output
transcript(30d)— Full untruncated prompt and output for an invocation (companion to the invocation record)
modelList(7d)— Models available to a provider's CLI
03Previous Versions10
2026.06.27.1Jun 27, 2026
2026.06.25.1Jun 25, 2026
2026.06.24.1Jun 24, 2026

Added 1, removed 1 models

2026.06.17.1Jun 17, 2026
2026.06.14.1Jun 14, 2026
2026.06.09.2Jun 10, 2026

Restores outputTokensPerSecond (dropped from unpushed 2026.06.03.1 source); supersedes 2026.06.09.1 which added transcripts, listModels, and claude permission bypass

2026.06.09.1Jun 10, 2026

Full transcript persistence (untruncated prompt+output per invocation), listModels method for provider model enumeration, claude provider now passes --dangerously-skip-permissions for unattended runs

Modified 1 models

2026.06.03.1Jun 3, 2026
2026.05.19.2May 19, 2026

Add commandSubdirs global arg for configurable slash command search paths.

2026.05.19.1May 19, 2026

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

04Stats
A
100 / 100
Downloads
188
Archive size
26.1 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
05Platforms