switchman-dev 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -495
- package/package.json +3 -3
- package/src/cli/index.js +728 -204
- package/src/core/db.js +252 -2
- package/src/core/git.js +74 -1
- package/src/core/ignore.js +2 -0
- package/src/core/mcp.js +39 -10
- package/src/core/outcome.js +48 -11
- package/src/core/policy.js +49 -0
- package/src/core/queue.js +225 -0
package/README.md
CHANGED
|
@@ -1,554 +1,150 @@
|
|
|
1
1
|
# Switchman
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Run 10+ agents on one codebase. Safely.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Switchman acts like a project manager for your AI coding assistants. It hands out tasks, stops agents from editing the same file at the same time, and double-checks their work before saving.
|
|
6
6
|
|
|
7
|
-
Switchman gives them
|
|
7
|
+
When you run multiple agents on the same repo, they need shared coordination or they collide, duplicate work, and create risky merges. Switchman gives them leases, scoped ownership, merge gates, and landing workflows so they can move in parallel without stepping on each other.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
In the docs, `workspace` means the folder each agent works in. Some commands still use the Git term `worktree`, because that is the underlying Git feature.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Questions, feedback, or testing Switchman with your team? Join the [Discord](https://discord.gg/pnT8BEC4D)
|
|
12
12
|
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Requirements:
|
|
13
16
|
- Node.js 22.5+
|
|
14
17
|
- Git 2.5+
|
|
15
18
|
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Install
|
|
19
|
-
|
|
20
19
|
```bash
|
|
21
20
|
npm install -g @switchman-dev
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
## Why Switchman?
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
Git worktrees, branches, and raw coding agents are useful, but they do not coordinate themselves.
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
What it adds that plain Git does not:
|
|
28
|
+
- task assignment, so agents do not duplicate work
|
|
29
|
+
- file locking, so parallel edits do not quietly collide
|
|
30
|
+
- live status, so you can see what is running, blocked, or stale
|
|
31
|
+
- stale-work recovery, so abandoned work does not clog the repo
|
|
32
|
+
- governed landing, so finished work reaches `main` one item at a time with retries and checks
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
In short:
|
|
35
|
+
- Git gives you branches
|
|
36
|
+
- Switchman gives you coordination
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
cd my-project
|
|
34
|
-
switchman setup --agents 3
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
This gives you:
|
|
38
|
-
- one shared Switchman database in `.switchman/`
|
|
39
|
-
- three linked worktrees
|
|
40
|
-
- local `.mcp.json` files so Claude Code can discover Switchman automatically
|
|
38
|
+
## Quickstart
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
Recommended first run:
|
|
41
|
+
- editor: Cursor
|
|
42
|
+
- goal: feel safe parallel agent work in under 10 minutes
|
|
43
|
+
- proof: status stays clear, agents stay separated, and the repo gate passes
|
|
43
44
|
|
|
44
45
|
```bash
|
|
46
|
+
cd my-project
|
|
47
|
+
switchman setup --agents 5
|
|
48
|
+
|
|
45
49
|
switchman task add "Implement auth helper" --priority 9
|
|
46
50
|
switchman task add "Add auth tests" --priority 8
|
|
47
51
|
switchman task add "Update auth docs" --priority 7
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Use real tasks from your repo. If a task looks broad enough to fan out across many files or shared areas, Switchman will warn and suggest using `switchman pipeline start` instead.
|
|
51
|
-
|
|
52
|
-
### 3. Open one Claude Code window per worktree
|
|
53
|
-
|
|
54
|
-
Open each generated worktree folder in its own Claude Code window.
|
|
55
|
-
|
|
56
|
-
If Claude Code sees the local `.mcp.json`, each agent can use Switchman without extra setup.
|
|
57
|
-
|
|
58
|
-
### 4. Tell each agent to work through Switchman
|
|
59
|
-
|
|
60
|
-
Use this exact instruction:
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
Use Switchman for all task coordination in this repo.
|
|
64
|
-
|
|
65
|
-
1. Run `switchman lease next --json` to get your task and lease.
|
|
66
|
-
2. Before editing anything, run `switchman claim <taskId> <worktree> <files...>`.
|
|
67
|
-
3. Only edit files you have claimed.
|
|
68
|
-
4. If a claim is blocked, do not use --force. Pick a different file or different approach.
|
|
69
|
-
5. When finished, run `switchman task done <taskId>`.
|
|
70
|
-
|
|
71
|
-
Do not read or write `.switchman/switchman.db` directly.
|
|
72
|
-
Do not bypass Switchman for file coordination.
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### 5. Watch the run
|
|
76
|
-
|
|
77
|
-
In the repo root:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
switchman status
|
|
81
|
-
switchman scan
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
What a good first run looks like:
|
|
85
|
-
- all three tasks end in `done`
|
|
86
|
-
- `switchman scan` reports no conflicts
|
|
87
|
-
- `switchman gate ci` passes
|
|
88
|
-
|
|
89
|
-
### 6. If you want a built-in local demo instead
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
bash examples/setup.sh
|
|
93
|
-
bash examples/walkthrough.sh
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
That runs the included 3-agent demo against the example API in [examples/README.md](/Users/ned/Documents/GitHub/switchman/examples/README.md).
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Pick your setup
|
|
101
|
-
|
|
102
|
-
### Option A — Claude Code (recommended)
|
|
103
|
-
|
|
104
|
-
Claude Code has a native Switchman integration via MCP. Your agents coordinate automatically — no manual CLI calls, no extra prompting.
|
|
105
|
-
|
|
106
|
-
**Step 1 — Create your agent workspaces**
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
cd my-project
|
|
110
|
-
switchman setup --agents 3
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
That's it. Switchman creates three isolated workspaces, one per agent, and initialises the database. You'll see the folder paths printed — you'll need them in step 4.
|
|
114
|
-
|
|
115
|
-
**Step 2 — Add Switchman to Claude Code**
|
|
116
|
-
|
|
117
|
-
`switchman setup` now writes a project-local `.mcp.json` into the repo root and each generated worktree, so Claude Code can discover Switchman automatically when you open those folders.
|
|
118
|
-
|
|
119
|
-
If you prefer a global fallback, add this to `~/.claude/claude_desktop_config.json`:
|
|
120
|
-
|
|
121
|
-
```json
|
|
122
|
-
{
|
|
123
|
-
"mcpServers": {
|
|
124
|
-
"switchman": {
|
|
125
|
-
"command": "switchman-mcp",
|
|
126
|
-
"args": []
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Then restart Claude Code. The project-local `.mcp.json` is the preferred path because it travels with the repo and the generated worktrees.
|
|
133
|
-
|
|
134
|
-
**Step 3 — Copy CLAUDE.md into your repo root**
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
curl -O https://raw.githubusercontent.com/switchman-dev/switchman/main/CLAUDE.md
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
This tells your agents how to use Switchman. Without it they may bypass Switchman entirely, so keep it in the repo root and do not let agents talk to `.switchman/switchman.db` directly.
|
|
141
|
-
|
|
142
|
-
**Step 4 — Add your tasks**
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
switchman task add "Fix the login bug" --priority 8
|
|
146
|
-
switchman task add "Add rate limiting" --priority 6
|
|
147
|
-
switchman task add "Update README" --priority 2
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**Step 5 — Open Claude Code in each workspace**
|
|
151
|
-
|
|
152
|
-
Open a separate Claude Code window in each folder that `switchman setup` created. Each agent should automatically see the local MCP config, pick up a task, lock the files it needs, and release them when it's done.
|
|
153
|
-
|
|
154
|
-
**Step 6 — Check before merging**
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
switchman scan
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
### Option B — Any other agent (Cursor, Windsurf, Aider, etc.)
|
|
163
|
-
|
|
164
|
-
Switchman works as a CLI tool with any agent that can run terminal commands. The coordination isn't automatic — you'll need to prompt your agents to use Switchman commands.
|
|
165
|
-
|
|
166
|
-
**Step 1 — Create your agent workspaces**
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
cd my-project
|
|
170
|
-
switchman setup --agents 3
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**Step 2 — Add your tasks**
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
switchman task add "Fix the login bug" --priority 8
|
|
177
|
-
switchman task add "Add rate limiting" --priority 6
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**Step 3 — Give each agent this prompt**
|
|
181
|
-
|
|
182
|
-
Paste this into your agent at the start of each session:
|
|
183
52
|
|
|
184
|
-
```
|
|
185
|
-
Before starting any work:
|
|
186
|
-
1. Run `switchman lease next --json` to get your assigned task and lease
|
|
187
|
-
2. Run `switchman claim <taskId> <worktreeName> <files...>` to lock the files you'll edit
|
|
188
|
-
- If a file is already claimed, pick a different approach or different files
|
|
189
|
-
3. If the task runs for a while, refresh the lease with `switchman lease heartbeat <leaseId>`
|
|
190
|
-
4. When finished, run `switchman task done <taskId>`
|
|
191
|
-
|
|
192
|
-
Never edit a file you haven't claimed. If a claim fails, do not use --force.
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
**Step 4 — Check before merging**
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
switchman scan
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
## What your agents will see
|
|
204
|
-
|
|
205
|
-
Here's what a normal session looks like with Switchman running:
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
# Agent 1 picks up a task
|
|
209
|
-
switchman lease next
|
|
210
|
-
✓ Lease acquired: "Add rate limiting to all routes" [task-abc-123 / lease-xyz-123]
|
|
211
|
-
|
|
212
|
-
# Agent 1 locks its files
|
|
213
|
-
switchman claim task-abc-123 agent1 src/middleware/auth.js src/server.js
|
|
214
|
-
✓ 2 files locked — no conflicts
|
|
215
|
-
|
|
216
|
-
# Agent 2 picks up a different task
|
|
217
|
-
switchman lease next
|
|
218
|
-
✓ Lease acquired: "Add validation to POST /tasks" [task-def-456 / lease-xyz-456]
|
|
219
|
-
|
|
220
|
-
# Agent 2 tries to claim a file already locked by Agent 1
|
|
221
|
-
switchman claim task-def-456 agent2 src/middleware/auth.js
|
|
222
|
-
⚠ Conflict: auth.js is locked by agent1
|
|
223
|
-
|
|
224
|
-
# Agent 2 claims different files instead
|
|
225
|
-
switchman claim task-def-456 agent2 src/middleware/validate.js src/routes/tasks.js
|
|
226
|
-
✓ 2 files locked — no conflicts
|
|
227
|
-
|
|
228
|
-
# Both agents working, zero collisions
|
|
229
53
|
switchman status
|
|
230
|
-
|
|
231
|
-
agent2 → "Add validation" editing validate.js, tasks.js
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
## If something goes wrong
|
|
237
|
-
|
|
238
|
-
Start here before digging into the internals.
|
|
239
|
-
|
|
240
|
-
### `switchman status`
|
|
241
|
-
|
|
242
|
-
Use this first when a run feels stuck.
|
|
243
|
-
|
|
244
|
-
It answers:
|
|
245
|
-
- what is running
|
|
246
|
-
- what is blocked
|
|
247
|
-
- what failed
|
|
248
|
-
- what needs attention next
|
|
249
|
-
|
|
250
|
-
### `switchman scan`
|
|
251
|
-
|
|
252
|
-
Use this before merge, or any time you suspect agents overlapped.
|
|
253
|
-
|
|
254
|
-
It tells you:
|
|
255
|
-
- changed files per worktree
|
|
256
|
-
- unclaimed or unmanaged changes
|
|
257
|
-
- conflict signals across worktrees
|
|
258
|
-
|
|
259
|
-
### `switchman gate ci`
|
|
260
|
-
|
|
261
|
-
Use this as the final repo-level check.
|
|
262
|
-
|
|
263
|
-
```bash
|
|
54
|
+
switchman status --watch
|
|
264
55
|
switchman gate ci
|
|
265
56
|
```
|
|
266
57
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
`A file claim is blocked`
|
|
272
|
-
- another task already owns that file
|
|
273
|
-
- do not use `--force`
|
|
274
|
-
- choose a different file or let the other task finish first
|
|
275
|
-
|
|
276
|
-
`A task is still in progress but the agent is gone`
|
|
277
|
-
- inspect with `switchman status`
|
|
278
|
-
- if the lease is stale, run:
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
switchman lease reap
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
`A pipeline task failed`
|
|
285
|
-
- run:
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
switchman pipeline status <pipelineId>
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
Switchman now prints:
|
|
292
|
-
- `why:` what failed
|
|
293
|
-
- `next:` what to do next
|
|
294
|
-
|
|
295
|
-
---
|
|
296
|
-
|
|
297
|
-
## Commands
|
|
298
|
-
|
|
299
|
-
### `switchman setup`
|
|
300
|
-
One-command setup — creates agent workspaces and initialises the database.
|
|
301
|
-
- `--agents 3` — number of workspaces to create (default: 3, max: 10)
|
|
302
|
-
- `--prefix switchman` — branch name prefix (default: switchman)
|
|
303
|
-
- Writes `.mcp.json` to the repo root and each generated worktree so Claude Code can attach the Switchman MCP server automatically
|
|
304
|
-
|
|
305
|
-
### `switchman init`
|
|
306
|
-
Initialise in the current git repo without creating worktrees. Creates `.switchman/switchman.db` and auto-detects existing worktrees.
|
|
307
|
-
|
|
308
|
-
### `switchman task add <title>`
|
|
309
|
-
Add a task to the queue.
|
|
310
|
-
- `--priority 1-10` (default: 5)
|
|
311
|
-
- `--description "..."`
|
|
312
|
-
|
|
313
|
-
### `switchman task list`
|
|
314
|
-
List all tasks. Filter with `--status pending|in_progress|done|failed`.
|
|
315
|
-
|
|
316
|
-
### `switchman task next`
|
|
317
|
-
Get and assign the next pending task. This is a compatibility shim over the lease workflow. Use `--json` for agent automation.
|
|
318
|
-
- `--worktree <name>` — worktree to assign to (defaults to current folder name)
|
|
319
|
-
- `--agent <name>` — agent identifier for logging
|
|
320
|
-
|
|
321
|
-
### `switchman lease next`
|
|
322
|
-
Acquire the next pending task as a first-class lease. Use `--json` for agent automation.
|
|
323
|
-
- `--worktree <name>` — worktree to assign to (defaults to current folder name)
|
|
324
|
-
- `--agent <name>` — agent identifier for logging
|
|
325
|
-
|
|
326
|
-
### `switchman lease list`
|
|
327
|
-
List active and historical leases. Filter with `--status active|completed|failed|expired`.
|
|
328
|
-
|
|
329
|
-
### `switchman lease heartbeat <leaseId>`
|
|
330
|
-
Refresh the heartbeat timestamp for a long-running lease so it does not get treated as stale.
|
|
331
|
-
|
|
332
|
-
### `switchman lease reap`
|
|
333
|
-
Expire stale leases, release their claims, and return their tasks to `pending`.
|
|
334
|
-
- `--stale-after-minutes <n>` — staleness threshold (default: 15)
|
|
335
|
-
|
|
336
|
-
### `switchman task done <taskId>`
|
|
337
|
-
Mark a task complete and automatically release all file claims.
|
|
338
|
-
When the task has an active lease, Switchman finalises the execution through that lease so provenance stays tied to the live session.
|
|
339
|
-
|
|
340
|
-
### `switchman task fail <taskId>`
|
|
341
|
-
Mark a task failed and automatically release all file claims.
|
|
342
|
-
When the task has an active lease, Switchman records the failure against that lease so execution history stays lease-first.
|
|
343
|
-
|
|
344
|
-
### `switchman claim <taskId> <worktree> [files...]`
|
|
345
|
-
Lock files before editing. Warns immediately if any file is already claimed by another agent.
|
|
346
|
-
|
|
347
|
-
### `switchman release <taskId>`
|
|
348
|
-
Release all file claims for a task.
|
|
349
|
-
|
|
350
|
-
### `switchman scan`
|
|
351
|
-
Check all worktrees for conflicts — both uncommitted file overlaps and branch-level merge conflicts. Run this before merging.
|
|
352
|
-
By default, common generated paths such as `node_modules/`, `dist/`, `build/`, and `coverage/` are ignored.
|
|
353
|
-
|
|
354
|
-
### `switchman status`
|
|
355
|
-
Full overview: task counts, active leases, stale leases, locked files, a quick conflict scan, and readable failure explanations.
|
|
356
|
-
|
|
357
|
-
### `switchman worktree list`
|
|
358
|
-
List all git worktrees with their registered agents and status.
|
|
359
|
-
|
|
360
|
-
### `switchman worktree sync`
|
|
361
|
-
Re-sync git worktrees into the Switchman database (useful if you add worktrees after init).
|
|
362
|
-
|
|
363
|
-
---
|
|
364
|
-
|
|
365
|
-
## Pipelines and PRs
|
|
366
|
-
|
|
367
|
-
Switchman can now take a backlog item through planning, governed execution, review, and PR handoff.
|
|
368
|
-
|
|
369
|
-
### Happy-path pipeline flow
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
switchman pipeline start "Harden auth API permissions" \
|
|
373
|
-
--description "Update login permissions for the public API and add migration checks"
|
|
374
|
-
|
|
375
|
-
switchman pipeline exec pipe-123 "/path/to/your-agent-command"
|
|
376
|
-
switchman pipeline status pipe-123
|
|
377
|
-
switchman pipeline pr pipe-123
|
|
378
|
-
switchman pipeline publish pipe-123 --base main --draft
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
The intended operator loop is:
|
|
382
|
-
1. start the pipeline
|
|
383
|
-
2. run it
|
|
384
|
-
3. inspect `pipeline status` if anything blocks
|
|
385
|
-
4. review the PR artifact or publish the PR
|
|
58
|
+
What `switchman setup` gives you:
|
|
59
|
+
- one shared Switchman database in `.switchman/`
|
|
60
|
+
- linked workspaces for each agent
|
|
61
|
+
- local MCP config for Claude Code and Cursor
|
|
386
62
|
|
|
387
|
-
|
|
63
|
+
Fastest path to success:
|
|
64
|
+
1. Use Cursor for the first run.
|
|
65
|
+
2. Open one Cursor window per generated workspace.
|
|
66
|
+
3. Let each agent pick up one clearly separate task.
|
|
67
|
+
4. Keep `switchman status --watch` open in another terminal.
|
|
68
|
+
5. Run `switchman gate ci` when the tasks finish.
|
|
388
69
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
--description "Update login permissions for the public API and add migration checks"
|
|
392
|
-
```
|
|
70
|
+
If you want the recommended editor setup guide, start here:
|
|
71
|
+
- [Cursor setup](docs/setup-cursor.md)
|
|
393
72
|
|
|
394
|
-
|
|
73
|
+
If you want a guided demo, see [examples/README.md](examples/README.md).
|
|
395
74
|
|
|
396
|
-
|
|
75
|
+
## What good looks like
|
|
397
76
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
77
|
+
You know the first run is working when:
|
|
78
|
+
- agents claim different files instead of stepping on each other
|
|
79
|
+
- `switchman status` stays calm and readable instead of filling with blocked work
|
|
80
|
+
- the landing queue moves finished work safely back toward `main`
|
|
81
|
+
- `switchman gate ci` passes cleanly
|
|
401
82
|
|
|
402
|
-
|
|
83
|
+
That is the moment Switchman should feel different from “just using a few branches.”
|
|
403
84
|
|
|
404
|
-
|
|
85
|
+
## Why not just use branches or worktrees?
|
|
405
86
|
|
|
406
|
-
|
|
407
|
-
switchman pipeline pr pipe-123
|
|
408
|
-
switchman pipeline pr pipe-123 --json
|
|
409
|
-
```
|
|
87
|
+
Because branches and worktrees solve isolation, not coordination.
|
|
410
88
|
|
|
411
|
-
|
|
412
|
-
|
|
89
|
+
They do not tell you:
|
|
90
|
+
- which task each agent should take next
|
|
91
|
+
- who already owns a file
|
|
92
|
+
- whether a session is stale
|
|
93
|
+
- whether finished work is still safe to land
|
|
413
94
|
|
|
414
|
-
|
|
95
|
+
Switchman is for the point where “we can manage this by hand” stops being true.
|
|
415
96
|
|
|
416
|
-
|
|
417
|
-
switchman pipeline bundle pipe-123 .switchman/pr-bundles/auth-hardening
|
|
418
|
-
```
|
|
97
|
+
## Choose your setup
|
|
419
98
|
|
|
420
|
-
|
|
99
|
+
Pick the guide that matches how you work:
|
|
421
100
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
101
|
+
| Setup | Guide |
|
|
102
|
+
|------|------|
|
|
103
|
+
| Claude Code | [Claude Code setup](docs/setup-claude-code.md) |
|
|
104
|
+
| Cursor | [Cursor setup](docs/setup-cursor.md) |
|
|
105
|
+
| Windsurf | [Windsurf setup](docs/setup-windsurf.md) |
|
|
106
|
+
| Any CLI-driven agent | [CLI agent setup](docs/setup-cli-agents.md) |
|
|
425
107
|
|
|
426
|
-
|
|
108
|
+
## If something feels stuck
|
|
427
109
|
|
|
428
|
-
|
|
110
|
+
Use `switchman status` first.
|
|
429
111
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
112
|
+
It is the main terminal dashboard for the repo:
|
|
113
|
+
- top health banner and compact counts
|
|
114
|
+
- boxed sections for `Running`, `Blocked`, `Warnings`, `Queue`, and `Next action`
|
|
115
|
+
- exact follow-up commands when something needs attention
|
|
116
|
+
- `--watch` mode for a live terminal view
|
|
433
117
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
- GitHub CLI (`gh`) installed
|
|
437
|
-
- `gh auth login` already completed
|
|
438
|
-
- the pipeline worktree branch pushed or otherwise available as the PR head branch
|
|
439
|
-
|
|
440
|
-
---
|
|
441
|
-
|
|
442
|
-
## CI and GitHub Actions
|
|
443
|
-
|
|
444
|
-
Switchman can publish CI-friendly gate output and install a ready-to-run GitHub Actions workflow.
|
|
445
|
-
|
|
446
|
-
### Run the repo gate in CI
|
|
118
|
+
Useful commands:
|
|
447
119
|
|
|
448
120
|
```bash
|
|
121
|
+
switchman status
|
|
122
|
+
switchman status --watch
|
|
123
|
+
switchman status --json
|
|
124
|
+
switchman scan
|
|
449
125
|
switchman gate ci
|
|
450
|
-
switchman gate ci --json
|
|
451
|
-
switchman gate ci --github
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
`switchman gate ci` fails non-zero when the repo contains unmanaged changes, stale compliance problems, or merge-governance issues.
|
|
455
|
-
|
|
456
|
-
When run under GitHub Actions with `--github`, Switchman writes:
|
|
457
|
-
|
|
458
|
-
- a step summary markdown report
|
|
459
|
-
- `GITHUB_OUTPUT` values such as `switchman_ok=true|false`
|
|
460
|
-
|
|
461
|
-
You can also point these explicitly:
|
|
462
|
-
|
|
463
|
-
```bash
|
|
464
|
-
switchman gate ci \
|
|
465
|
-
--github-step-summary /path/to/summary.md \
|
|
466
|
-
--github-output /path/to/output.txt
|
|
467
126
|
```
|
|
468
127
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
This writes `.github/workflows/switchman-gate.yml`, which runs the Switchman CI gate on pushes and pull requests.
|
|
476
|
-
|
|
477
|
-
---
|
|
478
|
-
|
|
479
|
-
## Tamper-evident audit trail
|
|
480
|
-
|
|
481
|
-
Switchman now keeps a signed audit trail for governed work.
|
|
482
|
-
|
|
483
|
-
Every audit event is:
|
|
484
|
-
- appended with a monotonic sequence number
|
|
485
|
-
- chained to the previous event with `prev_hash`
|
|
486
|
-
- hashed into its own `entry_hash`
|
|
487
|
-
- signed with a per-project audit key stored at `.switchman/audit.key`
|
|
488
|
-
|
|
489
|
-
That means Switchman can detect if someone edits stored audit history after the fact.
|
|
490
|
-
|
|
491
|
-
### Verify the audit trail
|
|
492
|
-
|
|
493
|
-
```bash
|
|
494
|
-
switchman audit verify
|
|
495
|
-
switchman audit verify --json
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
Use this when you want proof that the recorded history still matches the project audit key and the stored event chain.
|
|
499
|
-
|
|
500
|
-
What a successful verification means:
|
|
501
|
-
- every event is still in the expected sequence
|
|
502
|
-
- every `prev_hash` still matches the prior event
|
|
503
|
-
- every event payload still matches its stored `entry_hash`
|
|
504
|
-
- every signature still matches the project audit key
|
|
505
|
-
|
|
506
|
-
If verification fails, Switchman exits non-zero and reports the reason, for example:
|
|
507
|
-
- `sequence_gap`
|
|
508
|
-
- `prev_hash_mismatch`
|
|
509
|
-
- `entry_hash_mismatch`
|
|
510
|
-
- `signature_mismatch`
|
|
511
|
-
|
|
512
|
-
This is different from normal CI:
|
|
513
|
-
- `switchman gate ci` answers whether the repo is safe and governed right now
|
|
514
|
-
- `switchman audit verify` answers whether the recorded audit history has been tampered with
|
|
515
|
-
|
|
516
|
-
---
|
|
517
|
-
|
|
518
|
-
## MCP tools (Claude Code)
|
|
519
|
-
|
|
520
|
-
| Tool | What it does |
|
|
521
|
-
|------|-------------|
|
|
522
|
-
| `switchman_task_next` | Get + assign the next pending task |
|
|
523
|
-
| `switchman_task_add` | Add a new task to the queue |
|
|
524
|
-
| `switchman_task_claim` | Claim files before editing (conflict check) |
|
|
525
|
-
| `switchman_task_done` | Mark task complete, release file claims |
|
|
526
|
-
| `switchman_task_fail` | Mark task failed, release file claims |
|
|
527
|
-
| `switchman_lease_heartbeat` | Refresh a long-running lease heartbeat |
|
|
528
|
-
| `switchman_scan` | Scan all worktrees for conflicts |
|
|
529
|
-
| `switchman_status` | Full system overview |
|
|
530
|
-
|
|
531
|
-
---
|
|
532
|
-
|
|
533
|
-
## Roadmap
|
|
534
|
-
|
|
535
|
-
- [ ] Merge queue — serialize worktree→main merges with auto-retry
|
|
536
|
-
- [ ] Automatic stale-lease policies — configurable heartbeat/reap behaviour
|
|
537
|
-
- [ ] Cursor and Windsurf native MCP integration
|
|
538
|
-
- [ ] Web dashboard
|
|
539
|
-
- [ ] `brew install switchman`
|
|
128
|
+
More help:
|
|
129
|
+
- [Status and recovery](docs/status-and-recovery.md)
|
|
130
|
+
- [Merge queue](docs/merge-queue.md)
|
|
131
|
+
- [Stale lease policy](docs/stale-lease-policy.md)
|
|
540
132
|
|
|
541
|
-
|
|
133
|
+
## More docs
|
|
542
134
|
|
|
543
|
-
|
|
135
|
+
- [Merge queue](docs/merge-queue.md)
|
|
136
|
+
- [Pipelines and PRs](docs/pipelines.md)
|
|
137
|
+
- [Stale lease policy](docs/stale-lease-policy.md)
|
|
138
|
+
- [MCP tools](docs/mcp-tools.md)
|
|
139
|
+
- [Command reference](docs/command-reference.md)
|
|
544
140
|
|
|
545
|
-
|
|
141
|
+
## Feedback
|
|
546
142
|
|
|
547
|
-
|
|
548
|
-
- **Email** — [hello@switchman.dev](mailto:hello@switchman.dev)
|
|
143
|
+
Building this in public. If you're running parallel agents and hit something broken or missing, I’d love to hear about it.
|
|
549
144
|
|
|
550
|
-
|
|
145
|
+
- GitHub Issues: [github.com/switchman-dev/switchman/issues](https://github.com/switchman-dev/switchman/issues)
|
|
146
|
+
- Email: [hello@switchman.dev](mailto:hello@switchman.dev)
|
|
551
147
|
|
|
552
148
|
## License
|
|
553
149
|
|
|
554
|
-
MIT
|
|
150
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "switchman-dev",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Project manager for AI coding assistants running safely on one codebase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "node src/cli/index.js",
|
|
17
17
|
"mcp": "node src/mcp/server.js",
|
|
18
|
-
"test": "node tests/test.js"
|
|
18
|
+
"test": "NODE_NO_WARNINGS=1 node tests/test.js"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.27.1",
|