Run Command

Execute single tasks non interactively

The run command lets you execute a single Kodezi task without entering interactive mode, making it perfect for automation, CI/CD pipelines, shell scripts, and quick one-off actions.

When to Use kodezi run

Use run when you want:

  • A single AI task (no conversation)
  • Fast execution without loading the full interactive interface
  • Automation inside scripts or dev workflows
  • CI/CD integration (GitHub Actions, GitLab CI, Jenkins, etc.)

Usage

kodezi run [flags] "task description"

Examples:

kodezi run "Run all tests and report failures"
kodezi run "Fix linting errors in src/"
kodezi run "Generate API documentation"

Flags

--quiet, -q (Silent Mode)

Suppresses spinner animations and reduces output, ideal for scripts

kodezi run "run tests" --quiet
kodezi run "run tests" -q

Reading Input from stdin

You can pipe any text into the command:

echo "What is this code doing?" | kodezi run

Or combine stdin + a custom prompt:

cat file.txt | kodezi run "Explain this"

This is useful for piping file contents or logs into the AI.

How It Differs from Interactive Mode

FeatureInteractive ModeRun Command
InterfaceConversationalSingle execution
SessionPersistentEphemeral
Use CaseDevelopmentAutomation
Multiple TasksYesNo (one task)

Common Use Cases

Quick One/Off Tasks

Ideal for fast, single purpose actions that don’t require entering interactive mode:

kodezi run "Find all files with TODO comments"
kodezi run "Update copyright year to 2024"
kodezi run "Remove unused imports"

Use this when you need something done instantly without starting a full session.

CI/CD Pipelines

Integrate AI powered checks directly into automated workflows:

# GitHub Actions example
- name: Analyze Code
  run: kodezi run "Check for security vulnerabilities"

Useful for automated code reviews, security scans, and documentation generation.

Pre-commit Hooks

Automatically enforce quality checks before a commit is allowed:

#!/bin/bash
# .git/hooks/pre-commit
kodezi run "Check code style and fix issues" --yolo

This ensures consistent code quality across your team.

Scripts

Use AI tasks as part of your build, test, or deployment scripts:

#!/bin/bash
# build.sh
kodezi run "Validate all API schemas"
kodezi run "Generate TypeScript definitions"
npm run build

Great for automating repetitive development tasks.

Global Flags

The run command supports all global flags available in Kodezi CLI.

Auto-approve permissions (use with caution)

kodezi run "fix lint errors" --yolo
kodezi run "fix lint errors" -y

Use custom working directory

kodezi run "run tests" --cwd /path/to/project
kodezi run "run tests" -c /path/to/project

Use custom data directory

kodezi run "task" --data-dir /path/to/dir
kodezi run "task" -D /path/to/dir

Enable debug logging

kodezi run "task" --debug
kodezi run "task" -d

See kodezi --help for all flags.

Exit Codes

Understanding Exit Codes

The run command follows standard Unix exit codes so your scripts can detect success or failure automatically.

  • 0 - Success: Task completed successfully
  • 1 - Task failed: The requested task encountered an error
  • Non-zero - Error occurred: A system or configuration error happened

These exit codes allow you to integrate the run command into shell scripts with proper error handling.

Use in scripts:

if kodezi run "run tests"; then
  echo "Tests passed"
  deploy_app
else
  echo "Tests failed"
  exit 1
fi

This allows kodezi run to integrate cleanly with shell scripts, CI pipelines, and automation workflows.