p202 shell

Interactive shell with session state and batch execution

All commands

01Run it

Straight from the command's own help.

p202 shell # interactive mode
p202 shell -c "campaign list; health" # batch: run commands and exit
p202 shell --script commands.txt # batch: read from file

02What you get

Pick the shape you need. People get a table. Add --json, --csv or --ndjson for scripts, or -q for ids only. An AI agent gets compact JSON without asking. All output formats

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 shell

Set flags below; the command updates as you type.

04Flags

3 flags, plus the global flags every command takes.

FlagWhat it does
--command, -cstringExecute commands and exit (semicolon-separated)
--scriptstringRead and execute commands from a file
--stop-on-errorboolStop batch execution on first error

05How it works

Start an interactive shell for running multiple commands in a persistent session.

Features: - Session state: command results stored in $_ (last result) - Profile switching: "use <profile>" changes active profile without restarting - Batch mode: -c "cmd1; cmd2" or piped stdin for AI agent integration - Non-fatal errors: errors display but don't exit the session

Requires a valid API key. Access is verified against the server capabilities endpoint.

Examples: p202 shell # interactive mode p202 shell -c "campaign list; health" # batch: run commands and exit echo "health" | p202 shell # batch: read from stdin p202 shell --script commands.txt # batch: read from file

06For agents

Running this from an agent

  • Read the same facts as JSON: p202 commands shell --json.
  • With AI_AGENT, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
p202 commands shell --json
{
  "path": "p202 shell",
  "use": "shell",
  "short": "Interactive shell with session state and batch execution",
  "long": "Start an interactive shell for running multiple commands in a persistent session.\n\nFeatures:\n  - Session state: command results stored in $_ (last result)\n  - Profile switching: \"use <profile>\" changes active profile without restarting\n  - Batch mode: -c \"cmd1; cmd2\" or piped stdin for AI agent integration\n  - Non-fatal errors: errors display but don't exit the session\n\nRequires a valid API key. Access is verified against the server capabilities endpoint.\n\nExamples:\n  p202 shell                              # interactive mode\n  p202 shell -c \"campaign list; health\"   # batch: run commands and exit\n  echo \"health\" | p202 shell              # batch: read from stdin\n  p202 shell --script commands.txt        # batch: read from file",
  "runnable": true,
  "flags": [
    {
      "name": "command",
      "shorthand": "c",
      "type": "string",
      "default": "",
      "usage": "Execute commands and exit (semicolon-separated)",
      "required": false
    },
    {
      "name": "script",
      "type": "string",
      "default": "",
      "usage": "Read and execute commands from a file",
      "required": false
    },
    {
      "name": "stop-on-error",
      "type": "bool",
      "default": "false",
      "usage": "Stop batch execution on first error",
      "required": false
    }
  ]
}