multi-agents-cli 1.1.6 → 1.1.8

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 (44) hide show
  1. package/README.md +2 -18
  2. package/core/workflow/agent.js +6 -285
  3. package/core/workflow/complete.js +5 -141
  4. package/core/workflow/reset.js +9 -21
  5. package/core/workflow/run.js +0 -3
  6. package/init.js +2 -2
  7. package/lib/questions-flow.js +6 -14
  8. package/lib/steps.js +1 -13
  9. package/lib/ui.js +1 -9
  10. package/package.json +1 -1
  11. package/core/templates/.agents/backend/API.md +0 -270
  12. package/core/templates/.agents/backend/AUTH.md +0 -257
  13. package/core/templates/.agents/backend/DB.md +0 -268
  14. package/core/templates/.agents/backend/EVENTS.md +0 -264
  15. package/core/templates/.agents/backend/INIT.md +0 -250
  16. package/core/templates/.agents/backend/JOBS.md +0 -267
  17. package/core/templates/.agents/backend/LOGIC.md +0 -302
  18. package/core/templates/.agents/backend/TESTING.md +0 -277
  19. package/core/templates/.agents/client/ACCESSIBILITY.md +0 -277
  20. package/core/templates/.agents/client/FORMS.md +0 -245
  21. package/core/templates/.agents/client/LOGIC.md +0 -288
  22. package/core/templates/.agents/client/ROUTING.md +0 -246
  23. package/core/templates/.agents/client/TESTING.md +0 -252
  24. package/core/templates/.agents/client/UI.md +0 -237
  25. package/core/templates/.agents/shared/CLOUD.md +0 -229
  26. package/core/templates/.agents/shared/CLOUD_TEARDOWN.md +0 -158
  27. package/core/templates/.agents/shared/SECURITY.md +0 -297
  28. package/core/templates/.frameworks/backend/django.md +0 -55
  29. package/core/templates/.frameworks/backend/express.md +0 -74
  30. package/core/templates/.frameworks/backend/fastapi.md +0 -107
  31. package/core/templates/.frameworks/backend/fastify.md +0 -74
  32. package/core/templates/.frameworks/backend/laravel.md +0 -79
  33. package/core/templates/.frameworks/backend/nestjs.md +0 -75
  34. package/core/templates/.frameworks/backend/rails.md +0 -84
  35. package/core/templates/.frameworks/client/angular.md +0 -80
  36. package/core/templates/.frameworks/client/nextjs.md +0 -47
  37. package/core/templates/.frameworks/client/nuxt.md +0 -45
  38. package/core/templates/.frameworks/client/remix.md +0 -44
  39. package/core/templates/.frameworks/client/sveltekit.md +0 -44
  40. package/core/templates/.frameworks/client/vite-react.md +0 -45
  41. package/core/templates/CLAUDE.md +0 -562
  42. package/core/templates/CONTRACTS.md +0 -16
  43. package/core/templates/backend/CLAUDE.md +0 -207
  44. package/core/templates/client/CLAUDE.md +0 -213
package/README.md CHANGED
@@ -93,7 +93,7 @@ You and agents co-build - each owning a defined part of the codebase. Agent task
93
93
  Next.js - Angular - Vue/Nuxt - SvelteKit - Vite+React - Remix
94
94
 
95
95
  ### Backend (separate)
96
- Express - NestJS - Fastify - FastAPI - Django - Laravel - Rails
96
+ Express - NestJS - Fastify - FastAPI - Django
97
97
 
98
98
  Each framework has a dedicated scaffold instruction file in `.frameworks/client/` and `.frameworks/backend/` - agents read these before scaffolding to ensure files land in the correct location.
99
99
 
@@ -281,22 +281,6 @@ On completion, scope is validated and work merges into `main`. The final `main`
281
281
  }
282
282
  ```
283
283
 
284
- **Status values:** `null` (never launched) - `ACTIVE` (running) - `COMPLETED` (merged into main) - `MISSING` (worktree deleted without completing)
284
+ **Status values:** `null` (never launched) - `ACTIVE` (running) - `MISSING` (worktree deleted without completing)
285
285
 
286
286
  Managed entirely by `agent.js` and `complete.js`. Never edit manually.
287
-
288
- ---
289
-
290
- ## What's new in v1.1.0
291
-
292
- **Init flow**
293
- - Step counter (`Step N of 12`) shown throughout the configuration flow
294
- - Back-navigation fully wired — go back to any previous step and resume without re-answering everything
295
-
296
- **After merge**
297
- - `npm run complete` now surfaces the next recommended agent explicitly based on tracking state
298
- - `start:client` script written into `package.json` after `client/UI` merges
299
- - `start:backend` script written into `package.json` after `backend/INIT` merges
300
-
301
- **Agent templates**
302
- - Every agent now includes a `Session Close` block — explicit next-step instructions after Definition of Done
@@ -836,52 +836,6 @@ const main = async () => {
836
836
 
837
837
  // Soft gate - backend selected but missing prerequisites
838
838
  if (project === 'backend') {
839
- // Architectural change warning — no backend/ folder + integrated backend config
840
- const backendFolderExists = fs.existsSync(path.join(ROOT, 'backend'));
841
- const isIntegrated = config.backend?.type === 'integrated';
842
-
843
- if (!backendFolderExists) {
844
- separator();
845
- console.log(`\n ${yellow('⚠ No backend/ folder detected')}
846
- `);
847
- if (isIntegrated) {
848
- console.log(` This project currently uses ${bold('integrated backend')} (${dim(config.frontend?.type || 'client framework')}).`);
849
- console.log(` Adding a separate backend will change your project architecture:
850
- `);
851
- } else {
852
- console.log(` A ${bold('backend/')} directory does not exist yet.`);
853
- console.log(` Proceeding will create it and establish a separate backend:
854
- `);
855
- }
856
- console.log(` ${dim('→')} A new ${bold('backend/')} directory will be created`);
857
- console.log(` ${dim('→')} Client API calls will need redirecting to the new backend`);
858
- console.log(` ${dim('→')} CONTRACTS.md will need updating`);
859
- if (isIntegrated) {
860
- console.log(` ${dim('→')} Project config will update to ${bold('separate')} backend type
861
- `);
862
- }
863
- console.log('');
864
-
865
- const archIdx = await arrowSelect('How would you like to proceed?', [
866
- { label: `${green('→')} Proceed — I want to add a separate backend` },
867
- { label: `${yellow('←')} Go back — keep current setup ${dim('← recommended')}` },
868
- ], rl);
869
-
870
- if (archIdx === 1) continue flowLoop;
871
-
872
- // Update config to separate if was integrated
873
- if (isIntegrated) {
874
- try {
875
- const cfgPath = path.join(ROOT, '.scaffold', '.config.json');
876
- const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf8'));
877
- cfg.backend.type = 'separate';
878
- fs.writeFileSync(cfgPath, JSON.stringify(cfg, null, 2), 'utf8');
879
- console.log(` ${green('✓')} Project config updated to separate backend
880
- `);
881
- } catch {}
882
- }
883
- }
884
-
885
839
  const clientCompleted = buildEntries.filter(e => e.scope === 'client' && e.status === 'COMPLETED');
886
840
  const clientLogicDone = clientCompleted.some(e => e.agent === 'LOGIC');
887
841
  const missing = [];
@@ -909,42 +863,6 @@ const main = async () => {
909
863
  }
910
864
  }
911
865
 
912
-
913
- // Soft gate - shared selected but missing prerequisites
914
- if (project === 'shared') {
915
- const clientCompleted = buildEntries.filter(e => e.scope === 'client' && e.status === 'COMPLETED');
916
- const backendCompleted = buildEntries.filter(e => e.scope === 'backend' && e.status === 'COMPLETED');
917
- const clientUIДone = clientCompleted.some(e => e.agent === 'UI');
918
- const backendINITDone = backendCompleted.some(e => e.agent === 'INIT');
919
- const missing = [];
920
-
921
- if (!clientUIДone) {
922
- missing.push({ item: 'Client scaffold', detail: 'no completed client work found — SECURITY needs to know what auth patterns the client uses' });
923
- }
924
- if (!backendINITDone) {
925
- missing.push({ item: 'Backend INIT', detail: 'backend not scaffolded yet — SECURITY needs to know the backend auth strategy and DB schema' });
926
- }
927
- if (!contracts.hasContent) {
928
- missing.push({ item: 'CONTRACTS.md', detail: 'no shared types defined — auth utilities should align with established contracts' });
929
- }
930
-
931
- if (missing.length > 0) {
932
- console.log(`\n${yellow(' ⚠ Shared prerequisites not fully met:')}
933
- `);
934
- missing.forEach(m => {
935
- console.log(` ${dim('→')} ${bold(m.item)}`);
936
- console.log(` ${m.detail}\n`);
937
- });
938
- console.log(` ${dim('The agent will proceed autonomously and make assumptions about auth patterns.')}`);
939
- console.log(` ${dim('These may need revision once client and backend are fully established.\n')}`);
940
- const proceedIdx = await arrowSelect('Shared prerequisites not met:', [
941
- { label: `${green('→')} Proceed anyway` },
942
- { label: `${yellow('←')} Go back — pick a different scope ${dim('← recommended')}` },
943
- ], rl);
944
- if (proceedIdx === 1) continue flowLoop;
945
- }
946
- }
947
-
948
866
  // ── Select agent (with re-selection loop + back to scope) ────────────────────
949
867
 
950
868
  const agentOptions = AGENTS[project] || [];
@@ -978,14 +896,12 @@ const main = async () => {
978
896
 
979
897
  const agentChoices = [
980
898
  ...agentOptions.map(a => {
981
- const desc = dim(` ${AGENT_DESCRIPTIONS[project]?.[a] || ''}`);
982
- const completed = completedAgents.includes(a);
983
- const isActive = tracking?.[project]?.[a]?.status === 'ACTIVE';
984
- const isNext = a === recommendedAgent && !isActive;
985
- const indicator = completed ? green('[✓]') : isActive ? yellow('[▶]') : isNext ? cyan(' → ') : dim('[ ]');
986
- const label = completed ? dim(a) : isActive ? yellow(bold(a)) : isNext ? bold(a) : a;
987
- const tag = isActive ? yellow(' ← in progress') : isNext ? cyan(completedAgents.length === 0 ? ' ← start here' : ' ← next step') : '';
988
- return { label: `${indicator} ${label}${tag}${desc}` };
899
+ const desc = dim(` ${AGENT_DESCRIPTIONS[project]?.[a] || ''}`);
900
+ const tag = a === recommendedAgent
901
+ ? cyan(completedAgents.length === 0 ? ' start here' : ' ← next step')
902
+ : '';
903
+ const label = a === recommendedAgent ? bold(a) : a;
904
+ return { label: `${label}${tag}${desc}` };
989
905
  }),
990
906
  { label: dim('← back to scope selection') },
991
907
  ];
@@ -995,34 +911,6 @@ const main = async () => {
995
911
  agent = agentOptions[agentIdx];
996
912
  contractsNote = '';
997
913
 
998
- // ── Check for OTHER active agents in same scope ───────────────────────────
999
- const otherActiveInScope = Object.entries(tracking?.[project] || {})
1000
- .filter(([a, data]) => a !== agent && data?.status === 'ACTIVE');
1001
-
1002
- if (otherActiveInScope.length > 0) {
1003
- separator();
1004
- console.log(`\n ${yellow('⚠ Active agent detected in ' + project + ' scope')}
1005
- `);
1006
- for (const [a, data] of otherActiveInScope) {
1007
- console.log(` ${dim('→')} ${bold(a)} is currently ${yellow('ACTIVE')}`);
1008
- console.log(` Branch : ${dim(data.branch)}`);
1009
- console.log(` Launched: ${dim(data.launchedAt ? new Date(data.launchedAt).toLocaleString() : 'unknown')}
1010
- `);
1011
- }
1012
- console.log(` ${yellow('Launching')} ${bold(agent)} ${yellow('alongside an active agent in the same scope means:')}`);
1013
- console.log(` ${dim('→')} Both agents may write to overlapping files`);
1014
- console.log(` ${dim('→')} Scope violations may occur at merge time`);
1015
- console.log(` ${dim('→')} CONTRACTS.md may receive conflicting entries
1016
- `);
1017
-
1018
- const warningIdx = await arrowSelect('How would you like to proceed?', [
1019
- { label: `${yellow('→')} Proceed anyway ${dim('— I understand the risks')}` },
1020
- { label: `${green('←')} Go back — pick a different agent ${dim('← recommended')}` },
1021
- ], rl);
1022
-
1023
- if (warningIdx === 1) continue agentLoop;
1024
- }
1025
-
1026
914
  // Agent already active - decisional block
1027
915
  const { active, slot: activeSlot } = guards.checkAgentActive(tracking, project, agent);
1028
916
  if (active) {
@@ -1170,32 +1058,6 @@ const main = async () => {
1170
1058
  } // end else (argAgent bypass)
1171
1059
  } // end if (project !== 'cloud')
1172
1060
 
1173
- // ── First-run project context question (UI agent only, no completed agents) ──
1174
- let projectContext = '';
1175
- const isFirstRun = project === 'client' && agent === 'UI' && buildEntries.filter(e => e.status === 'COMPLETED').length === 0;
1176
-
1177
- if (isFirstRun) {
1178
- separator();
1179
- console.log(`\n ${bold('Before we begin...')}
1180
- `);
1181
-
1182
- if (prompts && process.stdin.isTTY) {
1183
- const ctxRes = await prompts({
1184
- type: 'text',
1185
- name: 'value',
1186
- message: '* What are you building?',
1187
- initial: 'e.g. A stock market prediction app with AI insights and portfolio tracking',
1188
- }, { onCancel: () => process.exit(0) });
1189
- const rawCtx = (ctxRes.value || '').trim();
1190
- const isPlaceholderCtx = rawCtx.startsWith('e.g. ');
1191
- projectContext = isPlaceholderCtx ? '' : rawCtx;
1192
- } else {
1193
- console.log(dim(' (optional — helps the agent make better decisions)'));
1194
- const input = await ask(`\n${bold('* What are you building?')}: `);
1195
- projectContext = input.trim();
1196
- }
1197
- }
1198
-
1199
1061
  // ── Task description ──────────────────────────────────────────────────────────
1200
1062
 
1201
1063
  separator();
@@ -1243,11 +1105,6 @@ const main = async () => {
1243
1105
  let skipped = [];
1244
1106
  contextSection = '';
1245
1107
 
1246
- // Inject project context if provided on first UI run
1247
- if (projectContext) {
1248
- contextSection += `\n---\n\n## Project Context\n\n${projectContext}\n\nUse this as the primary directive for what you are building. All component names, page structure, and UI decisions should align with this project description.\n`;
1249
- }
1250
-
1251
1108
  if (AGENT_QUESTIONS[agent] && userSeedingContracts) {
1252
1109
  let gathering = true;
1253
1110
  while (gathering) {
@@ -1286,135 +1143,6 @@ const main = async () => {
1286
1143
  }
1287
1144
  }
1288
1145
 
1289
-
1290
- // ── Backend simultaneous flow (client/LOGIC only, separate backend, first run) ──
1291
- let backendLaunchTiming = null;
1292
- const isSimultaneousCandidate =
1293
- project === 'client' &&
1294
- agent === 'LOGIC' &&
1295
- config.backend?.type === 'separate' &&
1296
- !argAgent &&
1297
- !buildEntries.some(e => e.scope === 'backend') &&
1298
- !tracking?.backend?.INIT?.backendPromptShown;
1299
-
1300
- if (isSimultaneousCandidate) {
1301
- separator();
1302
- console.log(`\n ${yellow('⚡ Backend not started yet')}\n`);
1303
- console.log(` Your backend has not been scaffolded yet.`);
1304
- console.log(` Since client/LOGIC establishes integration contracts, this is the ideal moment to plan backend scaffolding.\n`);
1305
-
1306
- const intentIdx = await arrowSelect('Would you like to include backend/INIT?', [
1307
- { label: `${green('→')} Yes — I want to scaffold the backend` },
1308
- { label: `${dim('→')} No — continue with client/LOGIC only` },
1309
- ], rl);
1310
-
1311
- if (intentIdx === 0) {
1312
- console.log('');
1313
- const timingIdx = await arrowSelect('When would you like to scaffold backend/INIT?', [
1314
- { label: `${green('→')} Now — open backend/INIT workspace alongside this LOGIC session\n ${dim('A second IDE window will open. Both agents run in parallel.')}` },
1315
- { label: `${dim('→')} After — launch backend/INIT when LOGIC completes\n ${dim('complete.js will prompt you immediately after merge.')}` },
1316
- { label: `${dim('→')} Skip — changed my mind, continue with client/LOGIC only` },
1317
- ], rl);
1318
-
1319
- if (timingIdx === 0) backendLaunchTiming = 'now';
1320
- else if (timingIdx === 1) backendLaunchTiming = 'after';
1321
- else backendLaunchTiming = 'skip';
1322
- } else {
1323
- backendLaunchTiming = 'skip';
1324
- }
1325
-
1326
- // Write flag to backend/INIT tracking slot — prevents prompt from showing again
1327
- guards.updateTrackingSlot(tracking, 'backend', 'INIT', {
1328
- backendPromptShown: true,
1329
- backendLaunchTiming,
1330
- }, ROOT);
1331
-
1332
- // Inject backend coordination block into TASK.md contextSection
1333
- if (backendLaunchTiming === 'now') {
1334
- contextSection += `\n---\n\n## Backend Coordination\n\nBackend/INIT is running in parallel in a separate workspace.\nEstablish CONTRACTS.md entries early — the backend agent will consume them.\nDo not wait for backend confirmation. Work autonomously on client scope.\n`;
1335
- } else if (backendLaunchTiming === 'after') {
1336
- contextSection += `\n---\n\n## Backend Coordination\n\nBackend/INIT will launch after this LOGIC session completes.\nBe deliberate about API contracts — document all integration points in CONTRACTS.md.\nThe backend agent will use these as its starting reference.\n`;
1337
- }
1338
-
1339
- // If Now — create backend/INIT worktree immediately
1340
- if (backendLaunchTiming === 'now') {
1341
- const beTimestamp = Date.now();
1342
- const beBranchName = `agent/backend/init/${beTimestamp}`;
1343
- const beWorktreeName = `backend-${config.projectName.toLowerCase().replace(/\s+/g, '-')}-init-${beTimestamp}`;
1344
- const beWorktreePath = path.join(ROOT, 'worktrees', beWorktreeName);
1345
-
1346
- console.log(`\n ${dim('Setting up backend/INIT workspace...')}\n`);
1347
-
1348
- try {
1349
- execSync(`git worktree add "${beWorktreePath}" -b ${beBranchName}`, { cwd: ROOT, stdio: 'pipe' });
1350
-
1351
- // Framework files
1352
- const beScope = generateClaudeScope({ project: 'backend', agent: 'INIT', branchName: beBranchName, worktreePath: beWorktreePath });
1353
- fs.writeFileSync(path.join(beWorktreePath, '.claude-scope'), beScope, 'utf8');
1354
-
1355
- const beTask = AGENT_DESCRIPTIONS.backend?.INIT || 'scaffolds backend architecture, folder structure, DB setup, wiring config and contracts';
1356
- const beTaskMd = generateTaskMd({ project: 'backend', agent: 'INIT', task: beTask, branchName: beBranchName, contextSection: '', remoteSetupSection: '' });
1357
- fs.writeFileSync(path.join(beWorktreePath, 'TASK.md'), beTaskMd, 'utf8');
1358
-
1359
- const bePkg = {
1360
- name: `${config.projectName.toLowerCase().replace(/\s+/g, '-')}-worktree`,
1361
- version: '1.0.0', private: true,
1362
- scripts: {
1363
- init: 'multi-agents init',
1364
- agent: `node "${ROOT}/.workflow/run.js"`,
1365
- restart: `node "${ROOT}/.workflow/restart.js"`,
1366
- reset: `node "${ROOT}/.workflow/reset.js"`,
1367
- complete: `node "${ROOT}/.workflow/complete.js"`,
1368
- },
1369
- };
1370
- fs.writeFileSync(path.join(beWorktreePath, 'package.json'), JSON.stringify(bePkg, null, 2), 'utf8');
1371
-
1372
- const beGitignore = ['# Framework files — never commit these to the agent branch', 'package.json', '.claude-scope', 'scope.json', 'TASK.md', '.vscode/', '.idea/', '.zed/', 'node_modules/'].join('\n') + '\n';
1373
- fs.writeFileSync(path.join(beWorktreePath, '.gitignore'), beGitignore, 'utf8');
1374
-
1375
- // Tracking
1376
- guards.updateTrackingSlot(tracking, 'backend', 'INIT', {
1377
- branch: beBranchName,
1378
- timestamp: beTimestamp,
1379
- launchedAt: new Date().toISOString(),
1380
- status: 'ACTIVE',
1381
- worktreePath: beWorktreePath,
1382
- backendPromptShown: true,
1383
- backendLaunchTiming: 'now',
1384
- }, ROOT);
1385
-
1386
- // TASKS_HISTORY
1387
- tasksHistory.ensureHistoryFile(ROOT);
1388
- tasksHistory.writeSessionEntry(ROOT, { scope: 'backend', agent: 'INIT', branch: beBranchName, task: beTask, launchedAt: new Date().toISOString() });
1389
-
1390
- console.log(` ${green('✓')} Backend/INIT worktree created: worktrees/${beWorktreeName}`);
1391
-
1392
- // BUILD_STATE.md entry
1393
- const beBuildStatePath = path.join(ROOT, 'BUILD_STATE.md');
1394
- if (fs.existsSync(beBuildStatePath)) {
1395
- const beDate = new Date().toISOString().split('T')[0];
1396
- const beLogEntry = `| ${beDate} | INIT | backend | ${beTask} | IN PROGRESS | ${beBranchName} |\n`;
1397
- fs.appendFileSync(beBuildStatePath, beLogEntry, 'utf8');
1398
- try {
1399
- execSync('git add BUILD_STATE.md', { cwd: ROOT, stdio: 'pipe' });
1400
- execSync(`git commit --no-verify -m "build: INIT task started on backend [${beBranchName}]"`, { cwd: ROOT, stdio: 'pipe' });
1401
- console.log(` ${green('✓')} BUILD_STATE.md updated`);
1402
- } catch {}
1403
- }
1404
-
1405
- // Open backend IDE window
1406
- const beIdeOpened = openIDE(beWorktreePath);
1407
- if (!beIdeOpened) console.log(` ${yellow('!')} Could not open IDE for backend — open manually at: ${dim(beWorktreePath)}`);
1408
- console.log(` ${green('✓')} Backend/INIT workspace open — start a Claude Code session there when ready\n`);
1409
-
1410
- } catch (e) {
1411
- console.log(` ${yellow('⚠')} Could not create backend/INIT worktree: ${e.message}`);
1412
- }
1413
- }
1414
-
1415
- separator();
1416
- }
1417
-
1418
1146
  separator();
1419
1147
 
1420
1148
  // ── Confirm ───────────────────────────────────────────────────────────────────
@@ -1497,13 +1225,6 @@ Mark each step complete. Only proceed to the task below when all are checked.
1497
1225
  });
1498
1226
  console.log(` ${green('✓')} Worktree created: worktrees/${worktreeName}`);
1499
1227
  } catch (err) {
1500
- const msg = err.stderr?.toString() || err.message || '';
1501
- if (msg.includes('not a git repository')) {
1502
- console.error(`
1503
- ${red('✖')} Not a git repository. Run git init first, then npm run init.
1504
- `);
1505
- process.exit(1);
1506
- }
1507
1228
  console.log(` ${yellow('!')} Worktree may already exist - continuing.`);
1508
1229
  }
1509
1230
 
@@ -391,59 +391,6 @@ const main = async () => {
391
391
  }
392
392
  } catch { /* best-effort */ }
393
393
 
394
- // ── Write start:client / start:backend into root package.json ───────────────
395
-
396
- try {
397
- const CLIENT_START = {
398
- 'Next.js': 'cd client && npm install && npm run dev',
399
- 'Nuxt': 'cd client && npm install && npm run dev',
400
- 'SvelteKit': 'cd client && npm install && npm run dev',
401
- 'Remix': 'cd client && npm install && npm run dev',
402
- 'Vite+React': 'cd client && npm install && npm run dev',
403
- 'Angular': 'cd client && npm install && npx ng serve',
404
- };
405
- const BACKEND_START = {
406
- 'NestJS': 'cd backend && npm install && npm run start:dev',
407
- 'Express': 'cd backend && npm install && npm run dev',
408
- 'Fastify': 'cd backend && npm install && npm run dev',
409
- 'Django': 'cd backend && pip install -r requirements.txt && python manage.py runserver',
410
- 'FastAPI': 'cd backend && pip install -r requirements.txt && uvicorn main:app --reload',
411
- 'Laravel': 'cd backend && composer install && php artisan serve',
412
- 'Rails': 'cd backend && bundle install && bin/rails server',
413
- };
414
-
415
- const pkgPath = path.join(ROOT, 'package.json');
416
- if (fs.existsSync(pkgPath)) {
417
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
418
- if (!pkg.scripts) pkg.scripts = {};
419
-
420
- const parts = branchName.split('/');
421
- const _t = guards.loadTracking(ROOT, config);
422
- const uiDone = _t?.client?.UI?.status === 'COMPLETED';
423
- const initDone = _t?.backend?.INIT?.status === 'COMPLETED';
424
-
425
- if (uiDone) {
426
- const fw = config.client && config.client.framework;
427
- const cmd = CLIENT_START[fw];
428
- if (cmd && !pkg.scripts['start:client']) {
429
- pkg.scripts['start:client'] = cmd;
430
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
431
- console.log(` ${green('✓')} start:client added to package.json (${cmd})`);
432
- }
433
- }
434
-
435
- if (initDone) {
436
- const fw = config.backend && config.backend.framework;
437
- const cmd = BACKEND_START[fw];
438
- if (cmd && !pkg.scripts['start:backend']) {
439
- pkg.scripts['start:backend'] = cmd;
440
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
441
- console.log(` ${green('✓')} start:backend added to package.json (${cmd})`);
442
- }
443
- }
444
- }
445
- } catch { /* best-effort */ }
446
-
447
394
  // ── Update scaffold flags ──────────────────────────────────────────────────
448
395
 
449
396
  try {
@@ -495,94 +442,11 @@ const main = async () => {
495
442
  if (_agent) console.log(` ${dim('Agent')} : ${green(_agent)} ${dim('(' + _scope + ')')}`);
496
443
  if (_task) console.log(` ${dim('Task')} : ${dim(_task)}`);
497
444
  console.log(` ${dim('Branch')} : ${green(branchName)} merged into ${green('main')}\n`);
498
-
499
- // ── Derive next step from tracking ──────────────────────────────────────────
500
- const AGENT_ORDER = {
501
- client: ['UI', 'LOGIC', 'FORMS', 'ROUTING', 'TESTING', 'ACCESSIBILITY'],
502
- backend: ['INIT', 'API', 'LOGIC', 'AUTH', 'DB', 'TESTING', 'EVENTS', 'JOBS'],
503
- shared: ['SECURITY'],
504
- };
505
- const SCOPE_ORDER = ['client', 'backend', 'shared'];
506
-
507
- try {
508
- const _tracking = guards.loadTracking(ROOT, config);
509
-
510
- const findNextInScope = (scope) => {
511
- const order = AGENT_ORDER[scope] || [];
512
- for (const a of order) {
513
- const slot = (_tracking[scope] || {})[a];
514
- if (!slot || (slot.status !== 'COMPLETED' && slot.status !== 'ACTIVE')) return a;
515
- }
516
- return null;
517
- };
518
-
519
- let nextScope = null;
520
- let nextAgent = null;
521
-
522
- const scopesToCheck = [_scope, ...SCOPE_ORDER.filter(s => s !== _scope)];
523
- for (const s of scopesToCheck) {
524
- const n = findNextInScope(s);
525
- if (n) { nextScope = s; nextAgent = n; break; }
526
- }
527
-
528
- separator();
529
- console.log(`\n ${bold('What to do next:')}`);
530
-
531
- if (nextAgent) {
532
- console.log(`\n ${green('→')} ${bold(nextAgent)} ${dim('(' + nextScope + ')')}`);
533
- console.log(`\n ${cyan('npm run agent')}`);
534
- console.log(` ${dim('Select: ' + nextScope + ' → ' + nextAgent)}`);
535
- } else {
536
- console.log(`\n ${cyan('npm run agent')}`);
537
- }
538
- } catch {
539
- separator();
540
- console.log(`\n ${bold('What to do next:')}\n`);
541
- console.log(` ${cyan('npm run agent')}`);
542
- }
543
-
544
- console.log('\n');
545
-
546
-
547
- // ── Backend/INIT launch prompt (if user chose 'after' during LOGIC session) ──
548
- try {
549
- const _tracking = guards.loadTracking(ROOT, config);
550
- const beSlot = _tracking?.backend?.INIT;
551
- if (
552
- _scope === 'logic' &&
553
- _parts[0] === 'agent' && _parts[1] === 'client' &&
554
- beSlot?.backendLaunchTiming === 'after' &&
555
- beSlot?.status !== 'ACTIVE' &&
556
- beSlot?.status !== 'COMPLETED'
557
- ) {
558
- separator();
559
- console.log(`\n ${yellow('⚡ Ready to scaffold your backend?')}\n`);
560
- console.log(` client/LOGIC is merged. This is the ideal moment to launch backend/INIT.\n`);
561
-
562
- const { spawn: _spawn } = require('child_process');
563
- const launchIdx = await new Promise(resolve => {
564
- rl2 = readline.createInterface({ input: process.stdin, output: process.stdout });
565
- const choices = [
566
- '1. Launch backend/INIT now ← recommended',
567
- '2. Skip — I will handle it manually',
568
- ];
569
- choices.forEach(c => console.log(` ${c}`));
570
- rl2.question('\n Select (1-2): ', ans => {
571
- rl2.close();
572
- resolve(parseInt(ans));
573
- });
574
- });
575
-
576
- if (launchIdx === 1) {
577
- console.log(`\n ${green('✓')} Launching backend/INIT...\n`);
578
- rl.close();
579
- _spawn('node', [path.join(ROOT, '.workflow', 'agent.js'), '--scope=backend', '--agent=INIT'], {
580
- cwd: ROOT, stdio: 'inherit',
581
- });
582
- return;
583
- }
584
- }
585
- } catch { /* best-effort */ }
445
+ console.log(` ${bold('What to do next:')}\n`);
446
+ console.log(` Start a new task:`);
447
+ console.log(` ${cyan('npm run agent')}\n`);
448
+ separator();
449
+ console.log('');
586
450
 
587
451
  rl.close();
588
452
  };
@@ -69,7 +69,6 @@ const main = async () => {
69
69
 
70
70
  // ── Load config and tracking ─────────────────────────────────────────────────
71
71
 
72
- const confirmed = process.argv.includes('--confirmed');
73
72
  const config = fs.existsSync(CONFIG_PATH) ? JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8')) : {};
74
73
  const tracking = fs.existsSync(TRACKING_PATH) ? JSON.parse(fs.readFileSync(TRACKING_PATH, 'utf8')) : {};
75
74
  const projectName = config.projectName || path.basename(ROOT);
@@ -80,7 +79,7 @@ const main = async () => {
80
79
  for (const scope of ['client', 'backend', 'shared']) {
81
80
  const agents = tracking[scope] || {};
82
81
  for (const [agent, data] of Object.entries(agents)) {
83
- if (data && data.branch && data.status !== 'COMPLETED') {
82
+ if (data && data.branch) {
84
83
  activeAgents.push({ scope, agent, data });
85
84
  }
86
85
  }
@@ -90,12 +89,11 @@ const main = async () => {
90
89
 
91
90
  let remoteUrl = null;
92
91
  try {
93
- remoteUrl = execSync('git remote get-url origin', { cwd: ROOT, encoding: 'utf8', stdio: 'pipe' }).trim();
92
+ remoteUrl = execSync('git remote get-url origin', { cwd: ROOT, encoding: 'utf8' }).trim();
94
93
  } catch {}
95
94
 
96
95
  // ── Display warning ───────────────────────────────────────────────────────────
97
96
 
98
- if (!confirmed) {
99
97
  separator();
100
98
  console.log(`${red(bold(' ⚠ FULL PROJECT RESET'))}\n`);
101
99
  console.log(` ${bold('This will permanently delete:')}\n`);
@@ -171,8 +169,6 @@ const main = async () => {
171
169
  process.exit(1);
172
170
  }
173
171
 
174
- } // end if (!confirmed)
175
-
176
172
  // ── Execute wipe ──────────────────────────────────────────────────────────────
177
173
 
178
174
  separator();
@@ -216,7 +212,7 @@ const main = async () => {
216
212
  }
217
213
  }
218
214
 
219
- // Wipe project files (keep .git git repo is infrastructure, not framework state)
215
+ // Wipe project files (keep .git temporarily for branch ops above)
220
216
  const keepList = ['.git'];
221
217
  const entries = fs.readdirSync(ROOT);
222
218
  for (const entry of entries) {
@@ -227,26 +223,18 @@ const main = async () => {
227
223
  }
228
224
  console.log(` ${green('✓')} Project files removed`);
229
225
 
230
-
231
- // ── Re-plant package.json ────────────────────────────────────────────
232
-
226
+ // Remove .git
233
227
  try {
234
- const freshPkg = {
235
- name: projectName.toLowerCase().replace(/\s+/g, '-'),
236
- version: '1.0.0',
237
- scripts: { init: 'multi-agents init' },
238
- };
239
- fs.writeFileSync(path.join(ROOT, 'package.json'), JSON.stringify(freshPkg, null, 2) + '\n', 'utf8');
240
- console.log(' ' + green('\u2713') + ' package.json re-planted');
241
- } catch { /* best-effort */ }
228
+ fs.rmSync(path.join(ROOT, '.git'), { recursive: true, force: true });
229
+ console.log(` ${green('')} Git history removed`);
230
+ } catch {}
242
231
 
243
232
  // ── Post-wipe instructions ────────────────────────────────────────────────────
244
233
 
245
234
  separator();
246
235
  console.log(`${green(bold(' Project wiped successfully.'))}\n`);
247
- console.log(` Run to start fresh:\n`);
248
- console.log(` ${cyan('npm run init')}
249
- `);
236
+ console.log(` To start fresh:\n`);
237
+ console.log(` ${cyan(`cd .. && multi-agents init ${projectName}`)}\n`);
250
238
  separator();
251
239
 
252
240
  process.exit(0);
@@ -56,9 +56,6 @@ const copyWorkflow = (cliRoot) => {
56
56
  };
57
57
 
58
58
  const findCliRoot = () => {
59
- // Local node_modules first (npx or local install)
60
- const localPkg = path.join(__dirname, '..', 'node_modules', 'multi-agents-cli');
61
- if (fs.existsSync(localPkg)) return localPkg;
62
59
  try {
63
60
  const globalPkg = execSync('npm root -g', { stdio: 'pipe', encoding: 'utf8' }).trim();
64
61
  const p = path.join(globalPkg, 'multi-agents-cli');
package/init.js CHANGED
@@ -78,7 +78,7 @@ const projectArg = isGlobalCLI ? args[1] : null;
78
78
 
79
79
  if (isReInit) {
80
80
  try {
81
- const gitCommonDir = execSync('git rev-parse --git-common-dir', { encoding: 'utf8', stdio: 'pipe' }).trim();
81
+ const gitCommonDir = execSync('git rev-parse --git-common-dir', { encoding: 'utf8' }).trim();
82
82
  const repoRoot = path.resolve(gitCommonDir, '..');
83
83
  process.chdir(repoRoot);
84
84
  } catch { /* stay in current directory */ }
@@ -275,7 +275,7 @@ const main = async () => {
275
275
  ],
276
276
  }, { onCancel: () => process.exit(0) });
277
277
  if (confirm.value !== 'yes') { console.log(dim('\n Cancelled.\n')); process.exit(0); }
278
- const resetChild = spawn('node', [path.join(ROOT, '.workflow', 'reset.js'), '--confirmed'], { stdio: 'inherit', cwd: ROOT });
278
+ const resetChild = spawn('node', [path.join(ROOT, '.workflow', 'reset.js')], { stdio: 'inherit', cwd: ROOT });
279
279
  resetChild.on('exit', code => process.exit(code ?? 0));
280
280
  return;
281
281
  } else {