Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion docs/src/content/docs/tools/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,17 @@ gh aw logs --engine claude --branch main
gh aw logs --after-run-id 1000 --before-run-id 2000
gh aw logs --no-staged --tool-graph # Exclude staged runs, generate Mermaid graph
gh aw logs --parse --verbose --json # Parse logs to markdown, output JSON
gh aw logs --timeout 60 # Limit execution to 60 seconds
```

**Timeout Option:**

The `--timeout` flag limits log download execution time (in seconds). When the timeout is reached, the command processes already-downloaded runs and returns partial results. Set to `0` for no timeout (default). The MCP server uses a 50-second default timeout automatically.

**Caching and Performance:**

Downloaded runs are cached with a `run_summary.json` file in each run folder. Subsequent `logs` commands reuse cached data for faster reprocessing (~10-100x faster), unless the CLI version changes.

Metrics include execution duration, token consumption, costs, success/failure rates, and resource usage trends.

**Log Parsing and JSON Output:**
Expand All @@ -185,10 +194,24 @@ Generate concise markdown reports for individual workflow runs with smart permis

```bash
gh aw audit 12345678 # By run ID
gh aw audit https://github.com/owner/repo/actions/runs/123 # By URL
gh aw audit https://github.com/owner/repo/actions/runs/123 # By URL from any repo
gh aw audit https://github.example.com/org/repo/runs/456 # GitHub Enterprise URL
gh aw audit 12345678 -o ./audit-reports -v
gh aw audit 12345678 --parse # Parse logs to markdown
```

**URL Support:**

The audit command accepts workflow run URLs from any repository and GitHub instance:
- Standard URLs: `https://github.com/owner/repo/actions/runs/12345`
- Workflow run URLs: `https://github.com/owner/repo/runs/12345`
- Job URLs: `https://github.com/owner/repo/actions/runs/12345/job/98765`
- GitHub Enterprise: `https://github.example.com/org/repo/actions/runs/99999`

**Options:**

- `--parse`: Generates detailed `log.md` files with tool calls and reasoning extracted by engine-specific parsers

The audit command checks local cache first (`logs/run-{id}`), then attempts download. On permission errors, it provides MCP server instructions for artifact downloads. Reports include overview, metrics, tool usage, MCP failures, and available artifacts.

### MCP Server Management
Expand Down
40 changes: 39 additions & 1 deletion docs/src/content/docs/tools/mcp-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,48 @@ The MCP server provides these tools:

- **status** - List workflows with optional pattern filter
- **compile** - Compile workflows to GitHub Actions YAML
- **logs** - Download workflow logs (saved to `/tmp/gh-aw/aw-mcp/logs`)
- **logs** - Download workflow logs with automatic timeout handling and continuation support
- **audit** - Generate detailed workflow run report (saved to `/tmp/gh-aw/aw-mcp/logs`)
- **mcp-inspect** - Inspect MCP servers in workflows and validate secrets

### Logs Tool Features

**Timeout and Continuation:**

The logs tool uses a 50-second default timeout to prevent MCP server timeouts when downloading large workflow runs. When a timeout occurs, the tool returns partial results with a `continuation` field containing parameters to resume fetching:

```json
{
"summary": { "total_runs": 5 },
"runs": [ ... ],
"continuation": {
"message": "Timeout reached. Use these parameters to continue fetching more logs.",
"workflow_name": "weekly-research",
"count": 100,
"before_run_id": 12341,
"timeout": 50
}
}
```

Agents can detect incomplete data by checking for the `continuation` field and make follow-up calls with the provided `before_run_id` to fetch remaining logs.

**Large Output Handling:**

When tool outputs exceed 16,000 tokens (~64KB), the MCP server automatically writes content to `/tmp/gh-aw/safe-outputs/` and returns a JSON response with file location and schema description:

```json
{
"filename": "bb28168fe5604623b804546db0e8c90eaf9e8dcd0f418761787d5159198b4fd8.json",
"description": "[{id, name, data}] (2000 items)"
}
```

Schema descriptions help agents understand data structure:
- JSON arrays: `[{key1, key2}] (N items)`
- JSON objects: `{key1, key2, ...} (N keys)`
- Text content: `text content`

## Example Prompt

```markdown
Expand Down