Skip to content

ALOps AI CLI

Invoke a pre-installed AI coding CLI (Claude Code, OpenAI Codex, or GitHub Copilot CLI) headlessly from a pipeline, with uniform input/output contract.

Property Value
Task name (Azure DevOps) ALOpsAICli@3
Action name (GitHub) alops-aicli
Version 3.0.0
Category Utility
OS requirement Both
Preview yes

Runs one of three AI coding CLIs (Claude Code, OpenAI Codex, GitHub Copilot CLI) in headless mode with a uniform input and output contract. Authentication follows an OpenAI-compatible shape (api_key + base_url) with a narrow mapping to each tool's native auth. Cross-platform (Windows + Linux). The selected CLI must be pre-installed on the agent; a missing CLI fails the step with a clear error.

Inputs

selection

Name Type Required Default Platform Description
ai_tool PickList yes claude Both Which pre-installed AI coding CLI to invoke. Options: claude, codex, copilot.
model Text no (empty) Both Pass-through model name (--model / -m). Leave empty to use the CLI's built-in default.

prompt

Name Type Required Default Platform Description
user_prompt MultiLine yes (empty) Both The user turn. Delivered to Claude and Codex via stdin, and to Copilot via the -p argument. Must be non-empty. If the value is a single-line existing file path (relative paths resolve against the working directory) the file content is used. If it is a single-line http(s) URL the body is downloaded. Otherwise the value is treated as inline text. Multi-line values are always inline.
system_prompt MultiLine no (empty) Both Optional system/instructions layer. Native on Claude (--system-prompt); polyfilled via a fenced three-section wrapper for Codex and Copilot. If the value is a single-line existing file path (relative paths resolve against the working directory) the file content is used. If it is a single-line http(s) URL the body is downloaded. Otherwise the value is treated as inline text. Multi-line values are always inline.

auth

Name Type Required Default Platform Description
api_key Secret no (empty) Both The credential. Maps to the tool- and mode-appropriate env var (ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN / OPENAI_API_KEY / GITHUB_TOKEN / ANTHROPIC_FOUNDRY_KEY).
base_url Text no (empty) Both OpenAI-compatible endpoint URL. When non-empty (and foundry_resource empty), switches the step into 'openai_compat' auth mode. Must be an http(s) URL.
foundry_resource Text no (empty) Both Azure AI Foundry resource name (plain name only, e.g. 'ALOpsAI' — no URL, no slashes). When non-empty, switches the step into 'foundry' auth mode. Not supported for Copilot in MVP.

runtime

Name Type Required Default Platform Description
working_directory Text no (empty) Both Directory to run the CLI in. Leave empty to use the platform's workspace directory. The step restores the previous location on exit (try/finally).
show_raw_output Boolean no false Both When enabled, the step prints the full raw CLI stdout inside an "AI Raw Output" log group on success. Defaults to off to keep logs compact — the parsed ai_response is still logged, and the raw transcript is always available via the ai_raw_output_path output. The group is also shown automatically when pipeline debug logging is enabled (System.Debug on Azure DevOps, RUNNER_DEBUG on GitHub Actions). On non-zero exit the raw output is always printed.
enable_ai_cli_stream Boolean no false Both When enabled, the step echoes every CLI stdout line live inside an "AI CLI stream" log group, with each event formatted by the per-tool stream formatter. Defaults to off to keep logs compact — the parsed ai_response is always logged, and the full raw transcript can be shown via show_raw_output or retrieved from ai_raw_output_path. The CLI still runs and stdout is still captured when this is off; only the live echo is suppressed.

Outputs

Name Description
ai_response The model's final answer as plain prose (everything before the <<>> marker, trimmed).
ai_notes Value of the meta-block's 'notes' field (may be empty).
ai_tool Which CLI ran: 'claude', 'codex' or 'copilot'.
ai_model Resolved model string the step passed on the CLI; empty when the CLI's built-in default was used.
ai_auth_mode 'native', 'openai_compat' or 'foundry' — resolved from inputs.
ai_exit_code Underlying CLI exit code as string.
ai_format 'envelope' when a valid meta block was found and parsed; 'fallback' when it was missing or malformed.
ai_raw_output_path Path to the temp file containing the raw CLI stdout. Always populated — escape hatch for callers who want the unprocessed form.

Usage

- task: ALOpsAICli@3
  displayName: 'ALOps AI CLI'
  inputs:
    ai_tool: claude                       # Which pre-installed AI coding CLI to invoke. $(ai_tool)
    model:                                # Pass-through model name (--model / -m). Leave empty to use the CLI's built-in default. $(model)
    user_prompt:                          # The user turn. Delivered to Claude and Codex via stdin, and to Copilot via the -p argument. Must be non-empty. If the value is a single-line existing file path (relative paths resolve against the working directory) the file content is used. If it is a single-line http(s) URL the body is downloaded. Otherwise the value is treated as inline text. Multi-line values are always inline. $(user_prompt)
    system_prompt:                        # Optional system/instructions layer. Native on Claude (--system-prompt); polyfilled via a fenced three-section wrapper for Codex and Copilot. If the value is a single-line existing file path (relative paths resolve against the working directory) the file content is used. If it is a single-line http(s) URL the body is downloaded. Otherwise the value is treated as inline text. Multi-line values are always inline. $(system_prompt)
    api_key:                              # The credential. Maps to the tool- and mode-appropriate env var (ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN / OPENAI_API_KEY / GITHUB_TOKEN / ANTHROPIC_FOUNDRY_KEY). $(api_key)
    base_url:                             # OpenAI-compatible endpoint URL. When non-empty (and foundry_resource empty), switches the step into 'openai_compat' auth mode. Must be an http(s) URL. $(base_url)
    foundry_resource:                     # Azure AI Foundry resource name (plain name only, e.g. 'ALOpsAI' — no URL, no slashes). When non-empty, switches the step into 'foundry' auth mode. Not supported for Copilot in MVP. $(foundry_resource)
    working_directory:                    # Directory to run the CLI in. Leave empty to use the platform's workspace directory. The step restores the previous location on exit (try/finally). $(working_directory)
    show_raw_output: False                # When enabled, the step prints the full raw CLI stdout inside an "AI Raw Output" log group on success. Defaults to off to keep logs compact — the parsed ai_response is still logged, and the raw transcript is always available via the ai_raw_output_path output. The group is also shown automatically when pipeline debug logging is enabled (System.Debug on Azure DevOps, RUNNER_DEBUG on GitHub Actions). On non-zero exit the raw output is always printed. $(show_raw_output)
    enable_ai_cli_stream: False           # When enabled, the step echoes every CLI stdout line live inside an "AI CLI stream" log group, with each event formatted by the per-tool stream formatter. Defaults to off to keep logs compact — the parsed ai_response is always logged, and the full raw transcript can be shown via show_raw_output or retrieved from ai_raw_output_path. The CLI still runs and stdout is still captured when this is off; only the live echo is suppressed. $(enable_ai_cli_stream)
- name: ALOps AI CLI
  uses: HodorNV/ALOps-V3/alops-aicli@v3   <!-- TODO: confirm action repo path -->
  with:
    ai_tool: 'claude'
    model: ''
    user_prompt: ''
    system_prompt: ''
    api_key: ''
    base_url: ''
    foundry_resource: ''
    working_directory: ''
    show_raw_output: 'false'
    enable_ai_cli_stream: 'false'