multi-agents-cli 1.0.0

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +258 -0
  3. package/init.js +1098 -0
  4. package/package.json +32 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jonathan Daniel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,258 @@
1
+ # Multi-Agent Monorepo Template
2
+
3
+ A scaffolding framework for building full-stack applications using multiple
4
+ Claude Code agents working simultaneously in isolated git worktrees — each
5
+ agent owning a specific domain, all coordinating through shared state.
6
+
7
+ ---
8
+
9
+ ## How It Works
10
+
11
+ Three commands drive the entire workflow:
12
+
13
+ ```bash
14
+ npm run init # one-time project setup
15
+ npm run launch # create a new agent workspace
16
+ npm run complete # merge finished work, start next task
17
+ ```
18
+
19
+ No manual worktree management. No manual branch creation. No repeated context.
20
+
21
+ ---
22
+
23
+ ## Quickstart
24
+
25
+ ```bash
26
+ git clone https://github.com/JDev-il/multi-agents-template.git my-project
27
+ cd my-project
28
+ npm run init
29
+ ```
30
+
31
+ `npm run init` will:
32
+ - Ask for your project name, stack, and IDE preference
33
+ - Fetch all templates and workflow scripts from multi-agents-core
34
+ - Generate `BUILD_STATE.md`, `CONTRACTS.md`, `CLAUDE.md`
35
+ - Initialize agent tracking (`.scaffold/.tracking.json`)
36
+ - Set up git remote handling (see [Remote Setup](#remote-setup))
37
+
38
+ ---
39
+
40
+ ## Workflow
41
+
42
+ ### 1. Launch a task
43
+
44
+ ```bash
45
+ npm run launch
46
+ ```
47
+
48
+ Select scope → agent → describe the task (or press Enter for default) →
49
+ workspace opens in your IDE automatically.
50
+
51
+ The agent reads `TASK.md` and executes autonomously.
52
+
53
+ ### 2. Agent completes the task
54
+
55
+ The agent commits its work and runs `npm run complete` autonomously.
56
+ This merges the branch into main, updates `BUILD_STATE.md`, and clears
57
+ the tracking slot.
58
+
59
+ ### 3. Repeat
60
+
61
+ `npm run complete` chains back to `npm run launch`. Pick the next agent
62
+ and continue building.
63
+
64
+ ---
65
+
66
+ ## Agent Roster
67
+
68
+ ### Client
69
+
70
+ | Agent | Default task | Requires |
71
+ |-------|-------------|---------|
72
+ | `UI` | Scaffolds full project structure | — |
73
+ | `LOGIC` | State management, API integration, hooks | UI ✓ |
74
+ | `FORMS` | Form components, validation, submission | UI ✓ |
75
+ | `ROUTING` | Page routing, navigation, URL structure | UI ✓ |
76
+ | `TESTING` | Unit and integration tests | UI ✓ |
77
+ | `ACCESSIBILITY` | a11y compliance, keyboard navigation | UI ✓ |
78
+
79
+ ### Backend (separate only)
80
+
81
+ | Agent | Default task | Requires |
82
+ |-------|-------------|---------|
83
+ | `API` | REST/GraphQL endpoints — start here | — |
84
+ | `LOGIC` | Business logic, services, data processing | API ✓ |
85
+ | `AUTH` | Authentication, authorization, sessions | API ✓ |
86
+ | `DB` | Database schemas, migrations, queries | — |
87
+ | `EVENTS` | Event queues, pub/sub, webhooks | API ✓ |
88
+ | `JOBS` | Background jobs, scheduled tasks | API ✓ |
89
+ | `TESTING` | API and integration tests | API ✓ |
90
+
91
+ ### Shared
92
+
93
+ | Agent | Default task |
94
+ |-------|-------------|
95
+ | `SECURITY` | Shared auth utilities, encryption, validation |
96
+
97
+ > **Start with UI (client) or API (backend).** The launcher recommends
98
+ > the correct next agent dynamically based on what's already completed.
99
+
100
+ ---
101
+
102
+ ## Running the App
103
+
104
+ After agents complete their tasks and merge into main, the app lives
105
+ in `client/` (and `backend/` if configured separately):
106
+
107
+ ```bash
108
+ cd client
109
+ npm install
110
+ npm run dev
111
+ ```
112
+
113
+ For deployment (Vercel, Netlify etc.) set the **root directory** to
114
+ `client/` — not the repo root.
115
+
116
+ ---
117
+
118
+ ## Remote Setup
119
+
120
+ `npm run init` does NOT configure a GitHub remote. It removes the template
121
+ origin and leaves your project local-only.
122
+
123
+ **Your first agent session handles remote setup automatically:**
124
+
125
+ 1. Checks SSH, gh CLI, and HTTPS credentials in order
126
+ 2. If a remote is reachable — uses it
127
+ 3. If not — opens your browser to `github.com/new` with the repo name
128
+ pre-filled, waits for you to create it, then wires everything up
129
+
130
+ No manual `git remote add` needed.
131
+
132
+ ---
133
+
134
+ ## Key Files
135
+
136
+ | File | Purpose |
137
+ |------|---------|
138
+ | `CLAUDE.md` | Global coordination rules — every agent reads this first |
139
+ | `BUILD_STATE.md` | Living project state — what's built, what's next |
140
+ | `CONTRACTS.md` | Shared types and interfaces — single source of truth |
141
+ | `TASK.md` | Per-task instructions — lives in the agent's worktree |
142
+ | `.scaffold/.config.json` | Project config written at init time |
143
+ | `.scaffold/.tracking.json` | Active agent state — managed by workflow scripts |
144
+
145
+ > **Never edit `BUILD_STATE.md` directly.** `npm run complete` owns all
146
+ > updates to it. Editing it in a worktree causes merge conflicts.
147
+
148
+ ---
149
+
150
+ ## CLAUDE.md Waterfall
151
+
152
+ Context loads in this order for every agent:
153
+
154
+ ```
155
+ Root CLAUDE.md ← global rules, protocols, tracking schema
156
+
157
+ client/CLAUDE.md ← stack config, client-specific rules
158
+
159
+ agents/UI.md ← agent-specific behavior and constraints
160
+
161
+ TASK.md ← the specific task to execute
162
+ ```
163
+
164
+ Each layer narrows scope. Agents never need to be told what framework
165
+ or language to use — it's resolved from config automatically.
166
+
167
+ ---
168
+
169
+ ## Guard System
170
+
171
+ The launcher enforces structural rules before any worktree is created:
172
+
173
+ - **Skeleton guard** — LOGIC/FORMS/ROUTING/TESTING require UI completed first
174
+ - **Prerequisite check** — surfaces unmet dependencies, lets you proceed or repick
175
+ - **Active agent gate** — if the same agent is already running, offers Continue / Complete / Abandon / Pick again
176
+ - **MISSING gate** — if a worktree was deleted without completing, mandatory Recover or Reset decision
177
+ - **Coexistence check** — if recovering, surfaces file conflicts and divergence before restoring
178
+
179
+ ---
180
+
181
+ ## Tracking
182
+
183
+ `.scaffold/.tracking.json` is the runtime state ledger. Every agent slot
184
+ is pre-defined at init time:
185
+
186
+ ```json
187
+ {
188
+ "client": {
189
+ "UI": {
190
+ "branch": "agent/client/ui/1780403456467",
191
+ "status": "ACTIVE",
192
+ "launchedAt": "2026-06-04T10:21:00Z",
193
+ "missingCount": 0,
194
+ "worktreePath": "/path/to/worktrees/..."
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ **Status values:** `null` (never launched) · `ACTIVE` (running) · `MISSING` (worktree deleted without completing)
201
+
202
+ Managed entirely by `launch.js` and `complete.js`. Never edit manually.
203
+
204
+ ---
205
+
206
+ ## Running Commands From Anywhere
207
+
208
+ `npm run launch` and `npm run complete` self-relocate to the repo root
209
+ via `git rev-parse --git-common-dir`. Run them from the worktree terminal,
210
+ the repo root, or anywhere inside the git tree — they always work.
211
+
212
+ ---
213
+
214
+ ## Cloning vs Use as Template
215
+
216
+ Both entry points work:
217
+
218
+ **`git clone`** (quickstart, no GitHub account needed upfront)
219
+ ```bash
220
+ git clone https://github.com/JDev-il/multi-agents-template.git my-project
221
+ cd my-project
222
+ npm run init
223
+ ```
224
+ The template remote is automatically removed. Remote setup happens on first agent session.
225
+
226
+ **Use as Template** (recommended for production projects)
227
+ Click "Use this template" on GitHub to create a repo under your own account
228
+ with a clean history. Then clone your new repo and run `npm run init`.
229
+
230
+ ---
231
+
232
+ ## Architecture
233
+
234
+ ```
235
+ my-project/
236
+ ├── client/ ← built by client agents, merges into main
237
+ │ ├── package.json
238
+ │ └── src/
239
+ ├── backend/ ← built by backend agents (if separate)
240
+ ├── shared/ ← shared agent files
241
+ ├── worktrees/ ← local only, gitignored
242
+ │ └── client-my-project-ui-1780403456467/ ← isolated agent workspace
243
+ ├── CLAUDE.md
244
+ ├── BUILD_STATE.md
245
+ ├── CONTRACTS.md
246
+ ├── .scaffold/
247
+ │ ├── .config.json
248
+ │ ├── .tracking.json
249
+ │ └── .initialized
250
+ └── .workflow/
251
+ ├── launch.js
252
+ ├── complete.js
253
+ └── guards.js
254
+ ```
255
+
256
+ Each agent works in its own `worktrees/` folder on a dedicated branch.
257
+ On completion, its work merges into `main`. The final `main` branch is
258
+ a complete, runnable application.