Skip to content

Commit 8dcc371

Browse files
docs: unbloat setup cli guide (#63312)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 356fadb commit 8dcc371

1 file changed

Lines changed: 19 additions & 25 deletions

File tree

  • docs/src/content/docs/setup

‎docs/src/content/docs/setup/cli.md‎

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,9 @@ gh aw list --repo owner/repo --path .github/workflows # List from a remote repo
467467

468468
**Options:** `--json/-j`, `--label`, `--stale`, `--dir/-d`, `--path`, `--repo/-r`
469469

470-
Two flags control the workflow directory location, with different purposes:
471-
- `--dir` (`-d`): overrides the **local** workflow directory. Applies only when `--repo` is not set.
472-
- `--path`: specifies the workflow directory path in a **remote** repository. Use together with `--repo`.
470+
`--dir` (`-d`) overrides the local workflow directory and applies only when `--repo` is not set. `--path` specifies the workflow directory in a remote repository and is used with `--repo`.
473471

474-
Fast enumeration without GitHub API queries. For detailed status including enabled/disabled state and run information, use `status` instead.
472+
`list` enumerates workflows locally without GitHub API queries. For enabled/disabled state and run information, use `status` instead.
475473

476474
For local workflows, `compiled` is `Yes` when the source frontmatter matches the generated `.lock.yml`, `No` when the hashes differ, and `N/A` when the lock file is missing. JSON output is a top-level array with one object per workflow and the same values in each object's `compiled` field. Use `--stale` to inspect only stale or missing lock files:
477475

@@ -521,7 +519,7 @@ To diagnose an actual download failure, enable the logs API and download debug n
521519
DEBUG=cli:logs_github_api,cli:logs_download gh aw logs --verbose --json
522520
```
523521

524-
**Workflow name matching**: The logs command accepts both workflow IDs (kebab-case filename without `.md`, e.g., `ci-failure-doctor`) and display names (from frontmatter, e.g., `CI Failure Doctor`). Matching is case-insensitive for convenience:
522+
`logs` accepts both workflow IDs (kebab-case filename without `.md`, for example `ci-failure-doctor`) and display names from frontmatter (for example `CI Failure Doctor`); matching is case-insensitive.
525523

526524
```bash wrap
527525
gh aw logs ci-failure-doctor # Workflow ID
@@ -530,7 +528,7 @@ gh aw logs "CI Failure Doctor" # Display name
530528
gh aw logs "ci failure doctor" # Case-insensitive display name
531529
```
532530

533-
**`--cache-before` flag (cache cleanup):** Deletes cached run folders in the output directory whose run creation date is older than the specified cutoff. Accepts the same date/time delta formats as `--start-date` and `--end-date` (e.g. `-1d`, `-1w`, `-1mo`) as well as absolute dates (`YYYY-MM-DD`). Cleanup runs before the download step to free disk space first; failures are non-fatal and logged as warnings. The previous `--after` spelling is kept as a hidden, deprecated alias.
531+
`--cache-before` deletes cached `run-{ID}` folders older than a cutoff before downloading. It accepts the same relative and absolute date formats as `--start-date` and `--end-date`; the deprecated hidden alias `--after` still works. The command reads the run creation time from `run_summary.json` when present, otherwise it falls back to the directory modification time.
534532

535533
```bash wrap
536534
gh aw logs --cache-before -1w # Evict local cache older than 1 week, then proceed with normal run download
@@ -539,16 +537,14 @@ gh aw logs --cache-before 2024-01-01 # Evict local cache entries
539537
gh aw logs my-workflow --cache-before -1mo -c 20 # Evict local cache older than 1 month, then download 20 runs of a specific workflow
540538
```
541539

542-
Only directories matching the `run-{ID}` naming pattern inside the output directory are considered. The run's creation timestamp is read from `run_summary.json` inside each folder; if that file is absent (e.g., incomplete download), the directory's modification time is used as a fallback.
543-
544-
**`--train` flag:** Trains log template weights from the downloaded runs and writes `drain3_weights.json` to the logs output directory. The trained weights improve anomaly detection accuracy in subsequent `gh aw audit` and `gh aw logs` runs. To embed weights into the binary as defaults, copy the file to `pkg/agentdrain/data/default_weights.json` and rebuild.
540+
`--train` writes `drain3_weights.json` to the logs output directory using downloaded runs. Those weights improve anomaly detection in later `gh aw audit` and `gh aw logs` runs. To embed them as defaults, copy the file to `pkg/agentdrain/data/default_weights.json` and rebuild.
545541

546542
```bash wrap
547543
gh aw logs --train # Train on last 10 runs
548544
gh aw logs my-workflow --train -c 50 # Train on up to 50 runs of a specific workflow
549545
```
550546

551-
**`--stdin` flag:** Reads run IDs or URLs from stdin (one per line) instead of discovering runs from the GitHub API. Mutually exclusive with the workflow-name positional argument. Date, count, and workflow-name filters are ignored when `--stdin` is set; content filters (`--engine`, `--firewall`, `--safe-output`, etc.) still apply. Blank lines and `#`-prefixed comment lines are ignored. Bare numeric IDs require `--repo owner/repo` because they carry no embedded repo context. Full run URLs are self-contained and do not require `--repo`.
547+
`--stdin` reads run IDs or URLs from standard input, one per line, instead of discovering runs from the GitHub API. It cannot be combined with a workflow-name positional argument. Date, count, and workflow-name filters are ignored in this mode, but content filters such as `--engine`, `--firewall`, and `--safe-output` still apply. Blank lines and `#` comments are ignored. Bare numeric IDs require `--repo owner/repo`; full run URLs do not.
552548

553549
```bash wrap
554550
cat run-ids.txt | gh aw logs --stdin
@@ -825,11 +821,9 @@ gh aw update --org my-org --create-issue --yes # Auto-accept per-repo confirmat
825821

826822
**Options:** `--dir/-d`, `--no-merge`, `--major`, `--force/-f`, `--engine/-e`, `--no-stop-after`, `--stop-after`, `--no-release-bump`, `--no-security-scanner`, `--approve`, `--create-pull-request`, `--create-issue`, `--org`, `--repos`, `--yes/-y`, `--no-compile`, `--no-redirect`, `--cool-down`, `--repo/-r`
827823

828-
Org mode (`--org`) previews or creates workflow update pull requests across every repository in an organization. Use `--repos` to limit org mode to repositories matching one or more glob patterns, `--create-issue` to open an issue in each repository that has pending updates (requires `--org`), and `--yes/-y` to auto-accept per-repository confirmations (required in CI).
829-
830-
The `--no-redirect` flag causes `update` to fail when the source workflow has a [`redirect`](/gh-aw/reference/frontmatter/) field, rather than following the redirect to its new location. Use this when you want explicit control over redirect handling.
824+
Org mode (`--org`) previews or creates workflow update pull requests across every repository in an organization. Use `--repos` to limit matches, `--create-issue` to open an issue in each repository with pending updates, and `--yes/-y` to auto-accept per-repository confirmations in CI.
831825

832-
The `--repo/-r` flag runs the update against a different repository. The target repository is checked out in an isolated shallow clone under `.github/aw/updates/<sanitized-repo-id>`. When combined with `--create-pull-request`, the resulting PR is opened against the target repository instead of the current one.
826+
`--no-redirect` makes `update` fail when the source workflow has a [`redirect`](/gh-aw/reference/frontmatter/) field instead of following it. `--repo/-r` runs the update against a different repository by checking out an isolated shallow clone under `.github/aw/updates/<sanitized-repo-id>`; with `--create-pull-request`, the PR targets that repository instead of the current one.
833827

834828
#### `deploy`
835829

@@ -1077,7 +1071,7 @@ gh aw logs workflow --repo github.enterprise.com/owner/repo # Use with comm
10771071

10781072
For GHE Cloud with data residency (`*.ghe.com`), see the dedicated [Debugging GHE Cloud guide](/gh-aw/troubleshooting/debug-ghe/).
10791073

1080-
Commands that support `--create-pull-request` — including `gh aw add`, `gh aw init`, `gh aw update`, and `gh aw upgrade` — automatically detect the enterprise host from the git remote and route PR creation to the correct GHES instance. `gh aw audit` and `gh aw add-wizard` do the same, so running them inside a GHES repository usually does not require setting `GH_HOST` manually.
1074+
Commands that support `--create-pull-request`, including `gh aw add`, `gh aw init`, `gh aw update`, and `gh aw upgrade`, auto-detect the enterprise host from the git remote and route PR creation to the correct GHES instance. `gh aw audit` and `gh aw add-wizard` do the same, so running them inside a GHES repository usually does not require setting `GH_HOST` manually.
10811075

10821076
#### Configuring `gh` CLI on GHES
10831077

@@ -1108,29 +1102,29 @@ The setup action installs the script at `/opt/gh-aw/actions/configure_gh_for_ghe
11081102

11091103
## Debug Logging
11101104

1111-
Enable detailed debugging with namespace, message, and time diffs.
1105+
Enable detailed debugging with namespace, message, and time diffs:
11121106

11131107
```bash wrap
11141108
DEBUG=* gh aw compile # All logs
11151109
DEBUG=cli:* gh aw compile # CLI only
11161110
DEBUG=*,-tests gh aw compile # All except tests
11171111
```
11181112

1119-
Use `--verbose` flag for user-facing details.
1113+
Use `--verbose` for user-facing detail.
11201114

11211115
## Smart Features
11221116

11231117
### Fuzzy Workflow Name Matching
11241118

1125-
Auto-suggests similar workflow names on typos using Levenshtein distance.
1119+
Typos in workflow names trigger suggestions based on Levenshtein distance.
11261120

11271121
```bash wrap
11281122
gh aw compile audti-workflows
11291123
# ✗ workflow file not found
11301124
# Did you mean: audit-workflows?
11311125
```
11321126

1133-
Works with: compile, enable, disable, logs, mcp commands.
1127+
Supported in `compile`, `enable`, `disable`, `logs`, and `mcp` commands.
11341128

11351129
## Troubleshooting
11361130

@@ -1147,9 +1141,9 @@ See [Common Issues](/gh-aw/troubleshooting/common-issues/) and [Error Reference]
11471141

11481142
## Learn More
11491143

1150-
- [Quick Start](/gh-aw/setup/quick-start/) - Get your first workflow running
1151-
- [Frontmatter](/gh-aw/reference/frontmatter/) - Configuration options
1152-
- [Adding Existing Workflows](/gh-aw/guides/working-with-workflows/#adding-existing-workflows) - Adding workflows from other repositories
1153-
- [Security Guide](/gh-aw/introduction/architecture/) - Security best practices
1154-
- [MCP Server Guide](/gh-aw/reference/gh-aw-as-mcp-server/) - MCP server configuration
1155-
- [Agent Factory](/gh-aw/agent-factory-status/) - Agent factory status
1144+
- [Quick Start](/gh-aw/setup/quick-start/) for your first workflow
1145+
- [Frontmatter](/gh-aw/reference/frontmatter/) for configuration options
1146+
- [Adding Existing Workflows](/gh-aw/guides/working-with-workflows/#adding-existing-workflows) for installing workflows from other repositories
1147+
- [Security Guide](/gh-aw/introduction/architecture/) for security best practices
1148+
- [MCP Server Guide](/gh-aw/reference/gh-aw-as-mcp-server/) for MCP server configuration
1149+
- [Agent Factory](/gh-aw/agent-factory-status/) for agent factory status

0 commit comments

Comments
 (0)