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
Copy file name to clipboardExpand all lines: USAGE.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,26 @@ cd rust
52
52
53
53
**Note:** Diagnostic verbs (`doctor`, `status`, `sandbox`, `version`) support `--output-format json` for machine-readable output. Invalid suffix arguments (e.g., `--json`) are now rejected at parse time rather than falling through to prompt dispatch.
54
54
55
+
### Initialize a repository
56
+
57
+
Set up a new repository with `.claw` config, `.claw.json`, `.gitignore` entries, and a `CLAUDE.md` guidance file:
58
+
59
+
```bash
60
+
cd /path/to/your/repo
61
+
./target/debug/claw init
62
+
```
63
+
64
+
Text mode (human-readable) shows artifact creation summary with project path and next steps. Idempotent — running multiple times in the same repo marks already-created files as "skipped".
65
+
66
+
JSON mode for scripting:
67
+
```bash
68
+
./target/debug/claw init --output-format json
69
+
```
70
+
71
+
Returns structured output with `project_path`, `created[]`, `updated[]`, `skipped[]` arrays (one per artifact), and `artifacts[]` carrying each file's `name` and machine-stable `status` tag. The legacy `message` field preserves backward compatibility.
72
+
73
+
**Why structured fields matter:** Claws can detect per-artifact state (`created` vs `updated` vs `skipped`) without substring-matching human prose. Use the `created[]`, `updated[]`, and `skipped[]` arrays for conditional follow-up logic (e.g., only commit if files were actually created, not just updated).
The `claw state` command reads `.claw/worker-state.json`, which is written by the interactive REPL or a one-shot prompt when a worker executes a task. This file contains the worker ID, session reference, model, and permission mode.
106
+
107
+
Prerequisite: You must run `claw` (interactive REPL) or `claw prompt <text>` at least once in the repository to produce the worker state file.
108
+
109
+
```bash
110
+
cd rust
111
+
./target/debug/claw state
112
+
```
113
+
114
+
JSON mode:
115
+
```bash
116
+
./target/debug/claw state --output-format json
117
+
```
118
+
119
+
If you run `claw state` before any worker has executed, you will see a helpful error:
120
+
```
121
+
error: no worker state file found at .claw/worker-state.json
122
+
Hint: worker state is written by the interactive REPL or a non-interactive prompt.
123
+
Run: claw # start the REPL (writes state on first turn)
124
+
Or: claw prompt <text> # run one non-interactive turn
"Config load error\n Status fail\n Summary runtime config failed to load; reporting partial MCP view\n Details {err}\n Hint `claw doctor` classifies config parse errors; fix the listed field and rerun\n\n{}",
"Config load error\n Status fail\n Summary runtime config failed to load; cannot resolve `{server_name}`\n Details {err}\n Hint `claw doctor` classifies config parse errors; fix the listed field and rerun"
0 commit comments