Skip to content

Commit 3a45a35

Browse files
docs: document --approve flag and protected-files exclude option
- Add --approve flag to compile, run, and upgrade command options in cli.md; explain safe update mode enforcement behavior and when to use it - Document protected-files object form ({ policy, exclude }) in safe-outputs-pull-requests.md; covers how to exempt specific files (e.g. AGENTS.md) from the default protected set without disabling all protection From PRs: #26350 (--approve rename), #26339 (protected-files exclude) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e44f4e7 commit 3a45a35

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

docs/src/content/docs/reference/safe-outputs-pull-requests.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,30 @@ This protects against supply chain attacks where an AI agent could inadvertently
275275

276276
### Policy Options
277277

278-
Configure the `protected-files` field on either safe output:
278+
The `protected-files` field accepts either a string policy value or an object with a `policy` and an `exclude` list.
279+
280+
**String form** — set a single policy for all protected files:
279281

280282
| Value | Behaviour |
281283
|-------|-----------|
282284
| `blocked` (default) | Hard-block: the safe output fails with an error |
283285
| `fallback-to-issue` | Create a review issue with instructions for the human to apply or reject the changes manually |
284286
| `allowed` | No restriction — all protected file changes are permitted. **Use only when the workflow is explicitly designed to manage these files.** |
285287

288+
**Object form** — set a policy and exclude specific files from the protected set:
289+
290+
```yaml wrap
291+
safe-outputs:
292+
create-pull-request:
293+
protected-files:
294+
policy: fallback-to-issue # same values as string form (default: blocked)
295+
exclude:
296+
- AGENTS.md # allow the agent to update its own instruction file
297+
- .agents/ # allow updates to the .agents/ directory
298+
```
299+
300+
The `exclude` list names files by **basename** (e.g., `AGENTS.md`) or **path prefix** (e.g., `.agents/`) to remove from the default protected set. The remaining protected files still enforce the configured policy. This is useful when a workflow is explicitly designed to manage one specific instruction file without disabling all protection.
301+
286302
**`create-pull-request` with `fallback-to-issue`**: the branch is pushed normally, then a review issue is created with a PR creation intent link, a `[!WARNING]` banner explaining why the fallback was triggered, and instructions to review carefully before creating the PR.
287303

288304
**`push-to-pull-request-branch` with `fallback-to-issue`**: instead of pushing to the PR branch, a review issue is created with the target PR link, patch download/apply instructions, and a review warning.

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ gh aw compile --dependabot # Generate dependency manifests
257257
gh aw compile --purge # Remove orphaned .lock.yml files
258258
```
259259

260-
**Options:** `--validate`, `--strict`, `--fix`, `--zizmor`, `--dependabot`, `--json`, `--no-emit`, `--watch`, `--purge`, `--stats`
260+
**Options:** `--validate`, `--strict`, `--fix`, `--zizmor`, `--dependabot`, `--json`, `--no-emit`, `--watch`, `--purge`, `--stats`, `--approve`
261+
262+
**`--approve` flag:** When compiling a workflow that already has a lock file, the compiler enforces *safe update mode* — any newly added secrets or custom actions not present in the previous manifest require explicit approval. Pass `--approve` to accept these changes and regenerate the manifest baseline. On first compile (no existing lock file), enforcement is skipped automatically and `--approve` is not needed.
261263

262264
**Error Reporting:** Displays detailed error messages with file paths, line numbers, column positions, and contextual code snippets.
263265

@@ -318,7 +320,7 @@ gh aw run workflow --push --ref main # Push to specific branch
318320
gh aw run workflow --json # Output triggered workflow results as JSON
319321
```
320322

321-
**Options:** `--repeat`, `--push` (see [--push flag](#the---push-flag)), `--ref`, `--enable-if-needed`, `--json/-j`, `--auto-merge-prs`, `--dry-run`, `--engine/-e`, `--raw-field/-F`, `--repo/-r`
323+
**Options:** `--repeat`, `--push` (see [--push flag](#the---push-flag)), `--ref`, `--enable-if-needed`, `--json/-j`, `--auto-merge-prs`, `--dry-run`, `--engine/-e`, `--raw-field/-F`, `--repo/-r`, `--approve`
322324

323325
When `--json` is set, a JSON array of triggered workflow results is written to stdout.
324326

@@ -564,7 +566,7 @@ gh aw upgrade --audit # Run dependency health audit
564566
gh aw upgrade --audit --json # Dependency audit in JSON format
565567
```
566568

567-
**Options:** `--dir/-d`, `--no-fix`, `--no-actions`, `--no-compile`, `--create-pull-request`, `--audit`, `--json/-j`
569+
**Options:** `--dir/-d`, `--no-fix`, `--no-actions`, `--no-compile`, `--create-pull-request`, `--audit`, `--json/-j`, `--approve`
568570

569571
### Advanced
570572

0 commit comments

Comments
 (0)