Scripting with TaskForceAI CLI

Last updated: 2025-01-15
1 min read

Scripting with TaskForceAI CLI

Integrate TaskForceAI into your automation workflows.

Non-Interactive Mode

For scripts, use non-interactive mode:

taskforceai --non-interactive "Your prompt"

JSON Output

Get structured output for parsing:

taskforceai --json "List 3 colors"

Output:

{
  "response": "1. Red\n2. Blue\n3. Green",
  "model": "gpt-4",
  "usage": {"tokens": 42}
}

Example Scripts

Code Review Script

#!/bin/bash
for file in *.py; do
  echo "Reviewing $file..."
  taskforceai "Review this Python code for bugs:" < "$file"
done

Git Commit Message

#!/bin/bash
git diff --staged | taskforceai "Write a commit message for these changes"

Environment Variables

  • TASKFORCEAI_API_KEY: Authentication
  • TASKFORCEAI_MODEL: Default model
  • TASKFORCEAI_CONFIG: Config file path

Still need help?

Our support team is available to assist you.

Contact Support