Scripting & CI/CD

Use the AskVerdict CLI in scripts, CI/CD pipelines, and automated workflows with JSON output.

1 min read
Share

The CLI is designed for automation. Use --json output mode for machine-readable results.

JSON Output

Add --json to any command for structured output:

bash
askverdict debate "Should we ship this PR?" --mode fast --json

Output:

json
{
  "debate": {
    "id": "dbt_abc123",
    "status": "completed",
    "verdict": {
      "recommendation": "Ship it",
      "confidence": 78
    }
  }
}

Piping

Combine with standard Unix tools:

bash
# Get verdict confidence score
askverdict view dbt_abc123 --json | jq '.debate.verdict.confidence'
 
# List completed debates as CSV
askverdict list --status completed --json | \
  jq -r '.debates[] | [.id, .question, .verdict.confidence] | @csv'

CI/CD Integration

GitHub Actions

yaml
name: Decision Review
on:
  pull_request:
    types: [opened]
 
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - name: Install CLI
        run: npm install -g @askverdict/cli
 
      - name: Run analysis
        env:
          ASKVERDICT_API_KEY: ${{ secrets.ASKVERDICT_API_KEY }}
        run: |
          RESULT=$(askverdict debate \
            "Should we merge this PR? Context: ${{ github.event.pull_request.title }}" \
            --mode fast --json)
 
          CONFIDENCE=$(echo $RESULT | jq '.debate.verdict.confidence')
          echo "Confidence: $CONFIDENCE"

Shell Scripts

bash
#!/bin/bash
# Run a batch of decisions
 
QUESTIONS=(
  "Should we use PostgreSQL or MySQL?"
  "Should we deploy on AWS or GCP?"
  "Should we use monorepo or polyrepo?"
)
 
for question in "${QUESTIONS[@]}"; do
  echo "Analyzing: $question"
  askverdict debate "$question" --mode fast --json >> results.jsonl
done
 
echo "All analyses saved to results.jsonl"

Environment Variables

VariableDescription
ASKVERDICT_API_KEYAPI key (overrides config file)
ASKVERDICT_BASE_URLAPI base URL
NO_COLORDisable colored output

Exit Codes

CodeMeaning
0Success
1General error
2Authentication error
3API error (rate limit, server error)

Use exit codes in scripts to handle errors: askverdict debate "..." || echo "Failed"

Was this page helpful?