CLI Commands
The gh aw CLI extension enables developers to create, manage, and execute AI-powered workflows directly from the command line. It transforms natural language markdown files into GitHub Actions.
Quick Start
Section titled “Quick Start”Get started in seconds:
gh aw init # Initialize repositorygh aw add githubnext/agentics/ci-doctor # Add a workflowgh aw trial ci-doctor # Test safelyCommon Tasks:
| Task | Command |
|---|---|
| Add workflow | gh aw add githubnext/agentics/ci-doctor |
| Create custom workflow | gh aw new my-workflow |
| Compile to YAML | gh aw compile |
| Test safely | gh aw trial ./workflow.md |
| Run immediately | gh aw run workflow-name |
| Check status | gh aw status |
| View logs | gh aw logs workflow-name |
| Debug run | gh aw audit 12345678 |
Installation
Section titled “Installation”Install the GitHub CLI extension:
gh extension install githubnext/gh-awAlternative: If authentication fails, use the standalone installer:
curl -O https://raw.githubusercontent.com/githubnext/gh-aw/main/install-gh-aw.shchmod +x install-gh-aw.sh./install-gh-aw.shGitHub Enterprise Server: Set GITHUB_SERVER_URL or GH_HOST environment variables to use your GitHub instance.
Global Options
Section titled “Global Options”| Flag | Description |
|---|---|
-h, --help | Show help information |
-v, --verbose | Enable verbose output with debugging details |
Help Commands:
gh aw --help # Show all commandsgh aw help [command] # Command-specific helpgh aw help all # Comprehensive documentationCommands
Section titled “Commands”Commands are organized by workflow lifecycle: creating, building, testing, monitoring, and managing workflows.
Getting Workflows
Section titled “Getting Workflows”Initialize your repository for agentic workflows.
gh aw init # Configure .gitattributes, Copilot instructions, custom agentgh aw init --mcp # Also setup MCP server integration for Copilot AgentWhat it does:
- Configures
.gitattributesto mark.lock.ymlfiles as generated - Adds Copilot instructions for better AI assistance
- Sets up custom agent configuration
With --mcp flag:
- Creates GitHub Actions workflow for MCP server setup
- Configures
.vscode/mcp.jsonfor VS Code integration - Enables gh-aw MCP tools in Copilot Agent
Add workflows from The Agentics collection or other repositories.
gh aw add githubnext/agentics/ci-doctor # Add single workflowgh aw add "githubnext/agentics/ci-*" # Add multiple with wildcardsgh aw add ci-doctor --dir shared --number 3 # Organize and create copiesgh aw add ci-doctor --pr # Create PR instead of direct commitOptions:
--dir: Organize workflows in subdirectories--number: Create multiple numbered copies--pr: Create pull request instead of committing directly--no-gitattributes: Skip.gitattributesupdate
Create a new custom workflow from scratch.
gh aw new my-custom-workflowCreates a markdown workflow file in .github/workflows/ with template frontmatter and automatically opens it for editing.
Building
Section titled “Building”compile
Section titled “compile”Compile markdown workflows to GitHub Actions YAML.
gh aw compile # Compile all workflowsgh aw compile my-workflow # Compile specific workflowgh aw compile --watch # Auto-recompile on changesgh aw compile --validate --strict # Schema + strict mode validationgh aw compile --zizmor # Security scan (warnings)gh aw compile --strict --zizmor # Security scan (fails on findings)gh aw compile --dependabot # Generate dependency manifestsgh aw compile --purge # Remove orphaned .lock.yml filesKey Options:
| Option | Description |
|---|---|
--validate | Schema validation and container checks |
--strict | Requires timeouts, explicit network config, blocks write permissions |
--zizmor | Security scanning with zizmor |
--dependabot | Generate npm/pip/Go manifests and update dependabot.yml |
--watch | Auto-recompile on file changes |
--purge | Remove orphaned .lock.yml files |
Testing
Section titled “Testing”Test workflows safely in temporary private repositories.
gh aw trial githubnext/agentics/ci-doctor # Test remote workflowgh aw trial ./workflow.md # Test local workflowgh aw trial ./workflow.md --use-local-secrets # Test with local API keysgh aw trial ./workflow.md --logical-repo owner/repo # Act as different repogh aw trial ./issue-workflow.md --trigger-context "#123" # With issue contextKey Options:
| Option | Description |
|---|---|
--engine | Override AI engine for testing |
--auto-merge-prs | Automatically merge created PRs |
--repeat N | Repeat execution N times |
--delete-host-repo-after | Delete trial repository after execution |
--use-local-secrets | Use local API keys instead of repository secrets |
--logical-repo owner/repo | Access issues/PRs from specific repository |
--clone-repo owner/repo | Use different codebase for testing |
--trigger-context "#123" | Provide issue/PR context |
Creates temporary private repository, executes workflow in isolated environment, and saves results to trials/ directory.
Execute workflows immediately in GitHub Actions.
gh aw run WorkflowName # Run workflowgh aw run workflow1 workflow2 # Run multiple workflowsgh aw run workflow --repeat 3 # Repeat execution 3 timesgh aw run workflow --use-local-secrets # Use local API keysOptions:
--repeat N: Execute the workflow N times--use-local-secrets: Temporarily push AI engine secrets from environment variables, then clean up
Monitoring
Section titled “Monitoring”status
Section titled “status”Show status of all workflows in the repository.
gh aw status # Show all workflow statusLists all agentic workflows with their current state, enabled/disabled status, schedules, and configurations.
Download and analyze workflow execution logs.
gh aw logs # Download logs for all workflowsgh aw logs workflow-name # Download logs for specific workflowgh aw logs -c 10 --start-date -1w # Filter by count and dategh aw logs --parse --json # Generate markdown + JSON outputKey Options:
| Option | Description | Example |
|---|---|---|
-c, --count N | Limit number of runs | -c 10 |
--start-date | Filter runs from date | --start-date -1w |
--end-date | Filter runs until date | --end-date -1d |
--parse | Generate log.md and firewall.md | --parse |
--json | Output structured metrics | --json |
Downloads workflow execution logs, analyzes tool usage and network patterns, and caches results for faster subsequent runs (~10-100x speedup).
Investigate and analyze specific workflow runs.
gh aw audit 12345678 # By run IDgh aw audit https://github.com/owner/repo/actions/runs/123 # By URLgh aw audit 12345678 --parse # Parse logs to markdownProvides detailed analysis including overview, execution metrics, tool usage patterns, MCP server failures, firewall analysis, and artifact information. Accepts run IDs or URLs from any repository and GitHub instance.
Management
Section titled “Management”enable
Section titled “enable”Enable workflows for execution.
gh aw enable # Enable all workflowsgh aw enable prefix # Enable workflows matching prefixgh aw enable ci-* # Enable workflows with patternEnables workflows for automatic and manual execution with pattern matching support for bulk operations.
disable
Section titled “disable”Disable workflows and cancel running jobs.
gh aw disable # Disable all workflowsgh aw disable prefix # Disable workflows matching prefixgh aw disable ci-* # Disable workflows with patternDisables workflows to prevent execution and cancels any currently running workflow jobs.
remove
Section titled “remove”Remove workflows from the repository.
gh aw remove WorkflowNameRemoves both .md and .lock.yml files and updates repository configuration.
update
Section titled “update”Update workflows to their latest versions.
gh aw update # Update all workflows with source fieldgh aw update ci-doctor # Update specific workflowgh aw update ci-doctor --major --force # Allow major version updatesWhat it does:
- Updates workflows based on
sourcefield formatowner/repo/path@ref - Performs 3-way merge preserving local changes
- Semantic version tags update within the same major version
Options:
--major: Allow major version updates (breaking changes)--force: Force update even with conflicts
Conflict handling: When conflicts occur, diff3 markers are added and recompilation is skipped until resolved.
Advanced
Section titled “Advanced”Manage MCP (Model Context Protocol) servers.
gh aw mcp list # List all MCP serversgh aw mcp list workflow-name # List servers for specific workflowgh aw mcp inspect workflow-name # Inspect and test serversgh aw mcp add # Add servers from registryLists MCP servers configured in workflows, inspects server configuration, tests connectivity, and adds new servers from the registry. See MCPs Guide for complete documentation.
pr transfer
Section titled “pr transfer”Transfer pull requests between repositories.
gh aw pr transfer https://github.com/source/repo/pull/234gh aw pr transfer <pr-url> --repo target-owner/target-repoTransfers PR from source repository to target repository, preserving code changes, title, and description.
Options:
--repo target-owner/target-repo: Specify target repository (defaults to current repository)
mcp-server
Section titled “mcp-server”Start MCP server exposing CLI commands as tools.
gh aw mcp-server # stdio transport (local)gh aw mcp-server --port 3000 # HTTP/SSE transport (workflows)Exposes CLI commands (status, compile, logs, audit) as MCP tools, enabling AI assistants to interact with gh-aw programmatically. Supports both local (stdio) and remote (HTTP) transports.
Options:
--port N: Start HTTP server on specified port (defaults to stdio transport)
See MCP Server Guide for integration details.
Examples
Section titled “Examples”Basic Workflow Lifecycle
Section titled “Basic Workflow Lifecycle”gh aw init # Initialize repositorygh aw add githubnext/agentics/ci-doctor # Add a workflowgh aw compile # Compile to GitHub Actionsgh aw trial ci-doctor # Test safelyCompile with Security Scanning
Section titled “Compile with Security Scanning”gh aw compile --verbose # Detailed outputgh aw compile --strict --zizmor # Strict mode + security scanAnalyze Workflow Runs
Section titled “Analyze Workflow Runs”gh aw logs ci-doctor -c 5 --parse --json # Download, parse, and exportgh aw audit 12345678 --parse # Deep dive into specific runDebug Logging
Section titled “Debug Logging”Enable detailed debugging output for troubleshooting:
DEBUG=* gh aw compile # All debug logsDEBUG=cli:* gh aw compile # CLI operations onlyDEBUG=cli:*,workflow:* gh aw compile # Multiple packagesDEBUG=*,-tests gh aw compile # All except testsFeatures:
- Shows namespace, message, and time diff (e.g.,
+50ms) - Zero overhead when disabled
- Supports pattern matching with wildcards
Tip: Use --verbose flag for user-facing details instead of DEBUG environment variable.
Troubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
command not found: gh | Install from cli.github.com |
extension not found: aw | Run gh extension install githubnext/gh-aw |
| Compilation fails with YAML errors | Check indentation, colons, and array syntax in frontmatter |
| Workflow not found | Run gh aw status to list available workflows |
| Permission denied | Check file permissions or repository access |
| Trial creation fails | Check GitHub rate limits and authentication |
See Common Issues and Error Reference for detailed troubleshooting.
Related Documentation
Section titled “Related Documentation”- Quick Start - Get your first workflow running
- Frontmatter - Configuration options
- Packaging & Distribution - Adding and updating workflows
- Security Guide - Security best practices
- VS Code Setup - Editor integration and watch mode
- MCP Server Guide - MCP server configuration
- Workflow Status - Live workflow dashboard