You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: align init agent JSON docs with settlement envelopes (#1776)
init --agent/--json on v1 emits settlement envelopes (ok, dotted CLI.*
codes, nextActions), matching check --json. reference/init.mdx and
skills/arkenv/SKILL.md still taught status/retryWith.
This PR updates both to the ErroredEnvelope shape (CLI.GIT_TREE_DIRTY +
nextActions run-command) and the ok:true success path. Leaves dev/main
machine-readable-output.mdx alone (v1 focus). Docs/skill only, no
changeset.
Copy file name to clipboardExpand all lines: apps/www/content/docs/guides/ai.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ public prefixes, and skip a `runtimeEnv` map.
82
82
**Greenfield setup**
83
83
84
84
```text
85
-
Add ArkEnv to this repo. Run `npx arkenv init --agent`, parse the JSON on stdout, and only retry with flags from `retryWith` if a refusal is safe to bypass. Do not hand-write next.config or env.ts unless init fails.
85
+
Add ArkEnv to this repo. Run `npx arkenv init --agent`, parse the JSON on stdout, and only retry with `--force` if the refusal's `nextActions` include a `run-command` with `--force`. Do not hand-write next.config or env.ts unless init fails.
Copy file name to clipboardExpand all lines: skills/arkenv/SKILL.md
+29-10Lines changed: 29 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,25 +49,44 @@ AI agents SHOULD always use the CLI for project initialization to ensure consist
49
49
-**`--yes`**: Bypasses all interactive prompts and uses recommended defaults.
50
50
-**`--quiet`**: Suppresses spinners and ANSI formatting for cleaner terminal logs.
51
51
-**`--json`**: Emits a structured JSON summary to `stdout` upon completion (all other output is sent to `stderr`).
52
-
-**Success Verification**: Parse the JSON output to verify `status: "success"` and retrieve details like the scaffolded file path.
52
+
-**Success Verification**: Parse the JSON settlement envelope on `stdout`. Success is `ok: true` with `commandId: "init"`; details (e.g. scaffolded paths) live under `result`.
53
53
54
-
#### Handling refusals (`status: "error"`)
54
+
#### Handling refusals (`ok: false`)
55
55
56
-
`--agent`**never** implies `--force`. When a safety check trips, the CLI refuses and emits a machine-actionable JSON payload to `stdout`:
56
+
`--agent`**never** implies `--force`. When a safety check trips, the CLI refuses and emits an errored settlement envelope to `stdout`:
57
57
58
58
```json
59
59
{
60
-
"status": "error",
61
-
"code": "GIT_TREE_DIRTY",
62
-
"message": "Git working tree is not clean.",
63
-
"retryWith": ["--force"]
60
+
"ok": false,
61
+
"commandId": "init",
62
+
"error": {
63
+
"code": "CLI.GIT_TREE_DIRTY",
64
+
"severity": "error",
65
+
"summary": "Git working tree is not clean.",
66
+
"why": "Commit or stash your changes before running arkenv init.",
67
+
"nextActions": [
68
+
{
69
+
"kind": "run-command",
70
+
"label": "Re-run with --force to bypass git working tree check",
71
+
"command": "arkenv init --force"
72
+
}
73
+
]
74
+
},
75
+
"diagnostics": [],
76
+
"nextActions": [
77
+
{
78
+
"kind": "run-command",
79
+
"label": "Re-run with --force to bypass git working tree check",
80
+
"command": "arkenv init --force"
81
+
}
82
+
]
64
83
}
65
84
```
66
85
67
-
-**`code`**: a stable identifier you can branch on. Refusal codes: `REQUIREMENTS_NOT_MET`, `GIT_TREE_DIRTY`, `NON_EMPTY_DIR`. A `code` of `INTERNAL`means the CLI *broke* rather than *refused*- retrying with flags will not help.
68
-
-**`retryWith`**: the flag(s) that would bypass the check (e.g. `["--force"]`). Empty (`[]`) means the refusal is not bypassable.
86
+
-**`error.code`**: a stable dotted identifier you can branch on (`CLI.REQUIREMENTS_NOT_MET`, `CLI.GIT_TREE_DIRTY`, `CLI.NON_EMPTY_DIR`, …). `CLI.INTERNAL_ERROR`means the CLI *broke* rather than *refused*— retrying with flags will not help.
87
+
-**`nextActions`**: remediation steps. A `run-command` action that includes `--force` means the refusal is bypassable; empty `nextActions` means it is not. Prefer `nextActions` over any legacy `retryWith` field.
69
88
70
-
**Escalation pattern**: always run `init --agent`**without**`--force` first. If you get `status: "error"`, inspect `code` and `retryWith`. Only re-run with the flag(s) from `retryWith` (e.g. append `--force`) once you have deliberately decided the refusal is safe to bypass - do not add `--force` pre-emptively.
89
+
**Escalation pattern**: always run `init --agent`**without**`--force` first. If you get `ok: false`, inspect `error.code` and `nextActions`. Only re-run with `--force` (or the command from a `run-command` action) once you have deliberately decided the refusal is safe to bypass — do not add `--force` pre-emptively.
0 commit comments