Skip to content

Automation and Scripting

Use this page when you want to run aisw safely from scripts, CI, or shell automation.

aisw does not currently provide a global --non-interactive or --quiet flag.

Current automation-safe usage:

  • Use --yes for commands that otherwise prompt for confirmation:
    • aisw init --yes
    • aisw remove ... --yes
    • aisw backup restore ... --yes
  • Use aisw add ... --api-key ... when you need non-interactive profile creation. Without --api-key, aisw add uses an interactive auth flow.
  • Use --json for machine-readable inventory and status output:
    • aisw list --json
    • aisw status --json
    • aisw backup list --json
  • aisw use --emit-env and aisw shell-hook intentionally print raw shell output for scripting and shell integration.

If you need fully non-interactive automation today, prefer API-key-based add, explicit --yes flags, and the JSON output modes above.

aisw uses this output model:

  • Human-oriented command results and status output go to stdout.
  • Errors are printed to stderr and return a non-zero exit code.
  • Interactive prompts appear during prompt-driven flows such as init, remove, and backup restore when you do not pass --yes.
  • --json modes are the supported machine-readable interface for scripting.
  • aisw use --emit-env and aisw shell-hook intentionally emit raw shell text to stdout.

Supported JSON interfaces:

  • aisw list --json
  • aisw status --json
  • aisw backup list --json

JSON output is intended to remain stable for automation within a released major version. Human-readable stdout should be treated as presentation output and may change between releases.

Terminal window
aisw add claude work --api-key "$ANTHROPIC_API_KEY"
Terminal window
aisw remove claude work --yes
Terminal window
aisw list --json

Export shell variables for the selected profile

Section titled “Export shell variables for the selected profile”
Terminal window
eval "$(aisw use codex work --emit-env)"