Repository navigation
Closed
Description
Context
The third surface for the trigger primitive is the CLI, which is also the simplest integration for the user's own cron or a GitHub Actions step (npx propr-cli automation run <id> --idempotency-key "$GITHUB_RUN_ID"). The CLI talks to the REST API from issue 5.
Naming: propr agent already manages coding-agent configurations (Claude, Codex, …). Reusing it would mix two different concepts, so the Agents feature uses a new group propr automation (alias propr automations), and help text explains "Agents (saved automations)". The UI label stays "Agents".
Requirements
packages/cli/src/api/automations.ts: typed client functionslistAutomations,getAutomation,triggerAutomationRun(id, { idempotencyKey, source }),listAutomationRuns,getAutomationRun,approveAutomationRun,rejectAutomationRun,cancelAutomationRun, built onApiClientlikeapi/goals.ts. The trigger sendsIdempotency-Keyand{ trigger: 'cli', source }, and retries transient failures with the same key (reuse themutatepattern fromgoals.ts).packages/cli/src/commands/automationCommands.ts(createAutomationCommand()):list [--json]show <id> [--json]run <id> [--idempotency-key <key>] [--source <label>] [--wait] [--timeout <s>] [--json]— prints run id and state; with--wait, pollsGET /api/agent-runs/:idevery 5 s until a terminal state orawaiting_approval, then prints the report. Exit codes: 0 completed, 2 timed out, 3 skipped/deferred, 4 awaiting approval, 1 failed/error.runs <id> [--limit] [--json]report <runId> [--json]— prints the report Markdown to stdout (pipe-friendly; metadata to stderr).approve <runId> [--note <text>],reject <runId>,cancel <runId>.
- Register in
packages/cli/src/commands/index.tsandpackages/cli/src/index.ts; add to the "Command Groups" help. - Generated idempotency key when omitted:
cli-<uuid>, printed so a failed command can be retried safely (same UX aspropr goal create). --jsonoutputs{ version: 1, kind: 'automation-run', ... }documents.- Tests:
packages/cli/src/api/automations.test.ts(headers, key reuse on retry) andpackages/cli/src/commands/automationCommands.test.ts(exit codes, report to stdout).
Implementation Specification
- Use
presentApiError/classifyApiErrorfor errors; 404 prints "Agent not found". - The
runcommand documents a GitHub Actions example in its help text.
Acceptance Criteria
-
propr automation run <id> --idempotency-key abc12345twice creates one run (server dedupes; CLI printscreated: falsethe second time). -
--waitexits 0 with the report on stdout for a dry-run agent. - A cost-gated scheduled-style trigger that is deferred exits 3 with the reason on stderr.
-
propr --helplists the new group;propr agentis unchanged.
Created by ProPR AI Planner
Activity
propr-dev commentedon Oct 6, 2026
Suggested Implementation:
Implementation Approach
The CLI is a client of the REST trigger endpoint — no logic of its own beyond retries and waiting. We copy the proven
goals.tsmutation pattern (one idempotency key per logical request, transient retries reuse it, uncertain outcomes print the key) because "trigger from my own cron" is exactly the environment where network blips and retries happen.A new command group avoids overloading
propr agent(coding-agent configuration). Distinct exit codes make the CLI usable as a CI step: a deferred/skipped run (cost gate) is distinguishable from a failure.File:
packages/cli/src/api/automations.ts(new file)Why this file: Typed REST client for Agents, shared by all automation subcommands.
File:
packages/cli/src/commands/automationCommands.ts(new file)Why this file: The
propr automationcommand group, includingrun --waitdesigned for CI usage.File:
packages/cli/src/commands/index.tsandpackages/cli/src/index.tsWhy these files: Register the group and advertise it in the root help.
File:
packages/cli/src/api/automations.test.ts(new file)Why this file: The idempotency contract of the CLI trigger.
automationCommands.test.tsfollows the harness ingoalCommands.test.ts(fakefetch, captured stdout/stderr, interceptedprocess.exit) and asserts:run --waiton a completed run prints the report to stdout and exits 0; adeferredresponse exits 3 with the reason on stderr;awaiting_approvalexits 4.propr-dev commentedon Oct 7, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-52813/claude-opus-5-5-agents-v1-14-17-cli-propr-20261007-0921-etz2800-epic-agents-v1-y7tissue-2813-20261007-0921-claude-opus-5-5-etz🔍 Track Task Execution
I've added the `propr automation` command group (alias `propr automat…
I've added the `propr automation` command group (alias `propr automat…