switchman-dev 0.1.5 → 0.1.7
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/.cursor/mcp.json +8 -0
- package/.mcp.json +8 -0
- package/README.md +173 -4
- package/examples/README.md +28 -0
- package/package.json +1 -1
- package/src/cli/index.js +2941 -314
- package/src/core/ci.js +204 -0
- package/src/core/db.js +822 -26
- package/src/core/enforcement.js +18 -5
- package/src/core/git.js +286 -1
- package/src/core/merge-gate.js +17 -2
- package/src/core/outcome.js +1 -1
- package/src/core/pipeline.js +2399 -59
- package/src/core/planner.js +25 -5
- package/src/core/policy.js +105 -0
- package/src/core/queue.js +643 -27
- package/src/core/semantic.js +71 -5
- package/src/core/telemetry.js +210 -0
package/.cursor/mcp.json
ADDED
package/.mcp.json
ADDED
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
**Run 10+ agents on one codebase. Safely.**
|
|
4
4
|
|
|
5
|
-
Switchman
|
|
5
|
+
Switchman is the coordination and governance layer for AI-native software teams. It helps you plan work, route tasks across agents, prevent overlap, and land changes safely instead of stitching parallel output back together by hand.
|
|
6
6
|
|
|
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,
|
|
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, policy gates, queue planning, and governed 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
|
|
|
@@ -20,20 +20,60 @@ Requirements:
|
|
|
20
20
|
npm install -g @switchman-dev
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
## 2 minute proof
|
|
24
|
+
|
|
25
|
+
If you want the fastest possible “does this actually work?” run:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
switchman demo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That creates a throwaway repo and shows:
|
|
32
|
+
- one agent claiming `src/auth.js`
|
|
33
|
+
- another agent getting blocked from claiming the same file
|
|
34
|
+
- that second agent rerouting to a safe docs file instead
|
|
35
|
+
- both branches landing back through the queue cleanly
|
|
36
|
+
|
|
37
|
+
Typical proof output looks like:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
$ switchman demo
|
|
41
|
+
✓ Created Switchman demo repo
|
|
42
|
+
/tmp/switchman-demo-1234567890
|
|
43
|
+
proof: agent2 was blocked from src/auth.js
|
|
44
|
+
safe reroute: agent2 claimed docs/auth-flow.md instead
|
|
45
|
+
landing: 2 queue item(s) merged safely
|
|
46
|
+
|
|
47
|
+
Try these next:
|
|
48
|
+
cd /tmp/switchman-demo-1234567890
|
|
49
|
+
switchman status
|
|
50
|
+
switchman queue status
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Then inspect it:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cd /tmp/switchman-demo-...
|
|
57
|
+
switchman status
|
|
58
|
+
switchman queue status
|
|
59
|
+
```
|
|
60
|
+
|
|
23
61
|
## Why Switchman?
|
|
24
62
|
|
|
25
63
|
Git worktrees, branches, and raw coding agents are useful, but they do not coordinate themselves.
|
|
26
64
|
|
|
27
65
|
What it adds that plain Git does not:
|
|
66
|
+
- task planning, so incoming goals can be broken into governed parallel work
|
|
28
67
|
- task assignment, so agents do not duplicate work
|
|
29
68
|
- file locking, so parallel edits do not quietly collide
|
|
30
69
|
- live status, so you can see what is running, blocked, or stale
|
|
31
70
|
- stale-work recovery, so abandoned work does not clog the repo
|
|
32
|
-
-
|
|
71
|
+
- queue intelligence, so the clearest work lands first across competing goals
|
|
72
|
+
- governed landing, so finished work reaches `main` one item at a time with retries, checks, and policy enforcement
|
|
33
73
|
|
|
34
74
|
In short:
|
|
35
75
|
- Git gives you branches
|
|
36
|
-
- Switchman gives you coordination
|
|
76
|
+
- Switchman gives you coordination, governance, and a safe path to land
|
|
37
77
|
|
|
38
78
|
## Quickstart
|
|
39
79
|
|
|
@@ -56,11 +96,19 @@ switchman status --watch
|
|
|
56
96
|
switchman gate ci
|
|
57
97
|
```
|
|
58
98
|
|
|
99
|
+
If you only do three things on the first run, do these:
|
|
100
|
+
1. `switchman setup --agents 5`
|
|
101
|
+
2. `switchman task add "Implement auth helper" --priority 9`
|
|
102
|
+
3. `switchman status --watch`
|
|
103
|
+
|
|
59
104
|
What `switchman setup` gives you:
|
|
60
105
|
- one shared Switchman database in `.switchman/`
|
|
61
106
|
- linked workspaces for each agent
|
|
62
107
|
- local MCP config for Claude Code and Cursor
|
|
63
108
|
|
|
109
|
+
Current limit:
|
|
110
|
+
- `switchman setup --agents` currently supports up to `10` agent workspaces in one command
|
|
111
|
+
|
|
64
112
|
Fastest path to success:
|
|
65
113
|
1. Use Claude Code for the first run.
|
|
66
114
|
2. Run `switchman verify-setup` once so editor wiring is confirmed before you start.
|
|
@@ -84,6 +132,79 @@ You know the first run is working when:
|
|
|
84
132
|
|
|
85
133
|
That is the moment Switchman should feel different from “just using a few branches.”
|
|
86
134
|
|
|
135
|
+
## Start Here
|
|
136
|
+
|
|
137
|
+
If you are trying to decide where to start:
|
|
138
|
+
- want the fastest proof: run `switchman demo`
|
|
139
|
+
- want to wire up a real repo: run `switchman setup --agents 5`
|
|
140
|
+
- want to understand blocked or stale work: run `switchman status`
|
|
141
|
+
- want a longer hands-on walkthrough: open [examples/README.md](examples/README.md)
|
|
142
|
+
|
|
143
|
+
## The Workflow
|
|
144
|
+
|
|
145
|
+
Switchman is built for the workflow of turning multiple competing engineering goals into coordinated parallel execution and a trusted, dependency-aware path to merge.
|
|
146
|
+
|
|
147
|
+
In practice, that means it helps teams:
|
|
148
|
+
- break work into parallel tasks
|
|
149
|
+
- assign work across agents and humans
|
|
150
|
+
- stop overlapping edits early
|
|
151
|
+
- detect stale or drifted work before merge chaos
|
|
152
|
+
- route validation and governance follow-ups
|
|
153
|
+
- decide what should land next
|
|
154
|
+
- leave an audit trail of what happened and why
|
|
155
|
+
|
|
156
|
+
## Real-World Walkthrough
|
|
157
|
+
|
|
158
|
+
Here is what a real first team workflow can look like across several goals in one shared repo:
|
|
159
|
+
|
|
160
|
+
1. Product work arrives:
|
|
161
|
+
- harden auth flows
|
|
162
|
+
- ship a schema update
|
|
163
|
+
- refresh related docs
|
|
164
|
+
2. You create parallel work:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
switchman setup --agents 5
|
|
168
|
+
switchman task add "Harden auth middleware" --priority 9
|
|
169
|
+
switchman task add "Ship schema migration" --priority 8
|
|
170
|
+
switchman task add "Update auth and schema docs" --priority 6
|
|
171
|
+
switchman status --watch
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
3. Agents pick up work in separate workspaces:
|
|
175
|
+
- agent1 takes auth
|
|
176
|
+
- agent2 takes the migration
|
|
177
|
+
- agent3 takes docs
|
|
178
|
+
4. If two agents reach for the same file, Switchman blocks the second claim early instead of letting the overlap turn into merge cleanup later.
|
|
179
|
+
5. While work is running, `switchman status` shows:
|
|
180
|
+
- what is active
|
|
181
|
+
- what is blocked
|
|
182
|
+
- what has gone stale
|
|
183
|
+
- what should land next
|
|
184
|
+
6. When branches finish, queue them:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
switchman queue add agent1
|
|
188
|
+
switchman queue add agent2
|
|
189
|
+
switchman queue add agent3
|
|
190
|
+
switchman queue status
|
|
191
|
+
switchman queue run --follow-plan --merge-budget 2
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
7. If a shared change invalidates another task, Switchman marks it stale and points at the exact recovery command instead of leaving the team to guess.
|
|
195
|
+
8. Before merge, run the repo gate:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
switchman gate ci
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
What good looks like:
|
|
202
|
+
- each agent stayed in its own lane
|
|
203
|
+
- overlap was blocked before wasted work spread
|
|
204
|
+
- stale work was visible instead of silently wrong
|
|
205
|
+
- the queue made it obvious what should land now and what should wait
|
|
206
|
+
- the repo reached `main` through a governed path instead of manual merge babysitting
|
|
207
|
+
|
|
87
208
|
## Why not just use branches or worktrees?
|
|
88
209
|
|
|
89
210
|
Because branches and worktrees solve isolation, not coordination.
|
|
@@ -131,6 +252,53 @@ More help:
|
|
|
131
252
|
- [Status and recovery](docs/status-and-recovery.md)
|
|
132
253
|
- [Merge queue](docs/merge-queue.md)
|
|
133
254
|
- [Stale lease policy](docs/stale-lease-policy.md)
|
|
255
|
+
- [Telemetry](docs/telemetry.md)
|
|
256
|
+
|
|
257
|
+
The most useful explain commands when something is unclear:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
switchman explain claim src/auth/login.js
|
|
261
|
+
switchman explain queue <item-id>
|
|
262
|
+
switchman explain stale --pipeline <pipeline-id>
|
|
263
|
+
switchman explain landing <pipeline-id>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Turn On PR Checks
|
|
267
|
+
|
|
268
|
+
If you want GitHub to block risky changes the same way your local terminal does:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
switchman gate install-ci
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
That installs `.github/workflows/switchman-gate.yml`, which:
|
|
275
|
+
- runs `switchman gate ci --github` on pushes and pull requests
|
|
276
|
+
- auto-runs `switchman pipeline sync-pr --pipeline-from-env --skip-missing-pipeline --pr-from-env --github` on pull request updates
|
|
277
|
+
- publishes a readable Switchman summary into the GitHub job output
|
|
278
|
+
- fails the PR check when Switchman detects unmanaged changes, stale work, or risky overlap
|
|
279
|
+
|
|
280
|
+
For pipeline-specific landing state in GitHub job summaries or PR checks, use:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
switchman pipeline bundle pipe-123 --github
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
If you want one command that bundles artifacts, updates the PR comment, and emits GitHub outputs together:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
switchman pipeline sync-pr pipe-123 --pr-from-env --github
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Add Change Policy
|
|
293
|
+
|
|
294
|
+
If you want Switchman to enforce extra review or validation for high-risk areas like auth, schema, or payments:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
switchman policy init-change
|
|
298
|
+
switchman policy show-change
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
That writes `.switchman/change-policy.json`, which planning and follow-up generation use to require the right tests, docs, and governance work before landing.
|
|
134
302
|
|
|
135
303
|
## More docs
|
|
136
304
|
|
|
@@ -138,6 +306,7 @@ More help:
|
|
|
138
306
|
- [Pipelines and PRs](docs/pipelines.md)
|
|
139
307
|
- [Stale lease policy](docs/stale-lease-policy.md)
|
|
140
308
|
- [MCP tools](docs/mcp-tools.md)
|
|
309
|
+
- [Telemetry](docs/telemetry.md)
|
|
141
310
|
- [Command reference](docs/command-reference.md)
|
|
142
311
|
|
|
143
312
|
## Feedback
|
package/examples/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
A real Express REST API used to test Switchman locally.
|
|
4
4
|
|
|
5
|
+
This folder is the best place to go after `switchman demo` if you want to feel the fuller workflow:
|
|
6
|
+
- multiple agents
|
|
7
|
+
- one real repo
|
|
8
|
+
- an intentional claim conflict
|
|
9
|
+
- clean landing back through the queue
|
|
10
|
+
|
|
5
11
|
## What's in here
|
|
6
12
|
|
|
7
13
|
```
|
|
@@ -27,6 +33,18 @@ examples/
|
|
|
27
33
|
|
|
28
34
|
This is the fastest way to understand Switchman as a new user.
|
|
29
35
|
|
|
36
|
+
If you just want the shortest proof run, start with:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
switchman demo
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use the `examples/` scripts when you want a longer walkthrough you can customize or record.
|
|
43
|
+
|
|
44
|
+
Good rule of thumb:
|
|
45
|
+
- want the 2-minute proof: `switchman demo`
|
|
46
|
+
- want the 5-10 minute “how would a team actually use this?” version: use `examples/`
|
|
47
|
+
|
|
30
48
|
Make sure Switchman is installed globally first:
|
|
31
49
|
```bash
|
|
32
50
|
npm install -g . # from the switchman repo root
|
|
@@ -44,6 +62,14 @@ If you want the shortest path:
|
|
|
44
62
|
- `demo.sh` is the 45-90 second recordable version
|
|
45
63
|
- `walkthrough.sh` shows one complete 3-agent happy path, including a real claim conflict
|
|
46
64
|
|
|
65
|
+
If you only want one script after setup, use:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
bash examples/walkthrough.sh
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
That is the clearest “real workflow” version of Switchman in this repo.
|
|
72
|
+
|
|
47
73
|
## Recordable demo
|
|
48
74
|
|
|
49
75
|
If you want the short “wow” version for recording or showing the product quickly:
|
|
@@ -81,6 +107,8 @@ At the end of the walkthrough, you want to see:
|
|
|
81
107
|
- `switchman scan` showing no unclaimed changes
|
|
82
108
|
- `switchman status` giving a clean overview of what happened
|
|
83
109
|
|
|
110
|
+
If that all happens without confusion, the onboarding is doing its job.
|
|
111
|
+
|
|
84
112
|
## The taskapi project
|
|
85
113
|
|
|
86
114
|
A minimal but real Express API with:
|