@yemi33/minions 0.1.55 → 0.1.57
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/CHANGELOG.md +10 -0
- package/bin/minions.js +63 -0
- package/engine.js +15 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/bin/minions.js
CHANGED
|
@@ -472,6 +472,7 @@ if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
|
|
|
472
472
|
minions spawn <agent> <prompt> Manually spawn an agent
|
|
473
473
|
minions plan <file|text> [proj] Run a plan
|
|
474
474
|
minions cleanup Clean temp files, worktrees, zombies
|
|
475
|
+
minions reset --confirm Factory reset (delete all state, keep config)
|
|
475
476
|
|
|
476
477
|
Dashboard:
|
|
477
478
|
minions dash Start web dashboard (default :7331)
|
|
@@ -500,6 +501,68 @@ if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
|
|
|
500
501
|
dashProc.unref();
|
|
501
502
|
console.log(` Dashboard started (PID: ${dashProc.pid})`);
|
|
502
503
|
console.log(' Dashboard: http://localhost:7331\n');
|
|
504
|
+
} else if (cmd === 'reset') {
|
|
505
|
+
ensureInstalled();
|
|
506
|
+
if (!rest.includes('--confirm')) {
|
|
507
|
+
console.log(`
|
|
508
|
+
This will DELETE all runtime state:
|
|
509
|
+
- Work items, dispatch queue, PRDs, plans
|
|
510
|
+
- Agent history, sessions, output logs
|
|
511
|
+
- Notes, knowledge base, pinned notes
|
|
512
|
+
- Metrics, cooldowns, schedules
|
|
513
|
+
|
|
514
|
+
Config.json and agent charters are PRESERVED.
|
|
515
|
+
|
|
516
|
+
Run: minions reset --confirm
|
|
517
|
+
`);
|
|
518
|
+
process.exit(0);
|
|
519
|
+
}
|
|
520
|
+
// Stop engine + dashboard
|
|
521
|
+
try { execSync(`node "${path.join(MINIONS_HOME, 'engine.js')}" stop`, { stdio: 'ignore', cwd: MINIONS_HOME }); } catch {}
|
|
522
|
+
const glob = (dir, pattern) => { try { return fs.readdirSync(dir).filter(f => pattern.test(f)).map(f => path.join(dir, f)); } catch { return []; } };
|
|
523
|
+
const rm = (f) => { try { fs.unlinkSync(f); } catch {} };
|
|
524
|
+
const rmDir = (d) => { try { fs.rmSync(d, { recursive: true, force: true }); } catch {} };
|
|
525
|
+
const engineDir = path.join(MINIONS_HOME, 'engine');
|
|
526
|
+
// Engine state
|
|
527
|
+
for (const f of ['dispatch.json', 'control.json', 'log.json', 'metrics.json', 'cooldowns.json', 'schedule-runs.json', 'kb-checkpoint.json', 'cc-session.json', 'doc-sessions.json']) rm(path.join(engineDir, f));
|
|
528
|
+
glob(engineDir, /^pid-.*\.pid$/).forEach(rm);
|
|
529
|
+
rmDir(path.join(engineDir, 'tmp'));
|
|
530
|
+
// Work items + PRs
|
|
531
|
+
rm(path.join(MINIONS_HOME, 'work-items.json'));
|
|
532
|
+
rm(path.join(MINIONS_HOME, 'work-items-archive.json'));
|
|
533
|
+
rm(path.join(MINIONS_HOME, 'pull-requests.json'));
|
|
534
|
+
// Plans + PRDs
|
|
535
|
+
glob(path.join(MINIONS_HOME, 'plans'), /\.md$/).forEach(rm);
|
|
536
|
+
glob(path.join(MINIONS_HOME, 'prd'), /\.json$/).forEach(rm);
|
|
537
|
+
rmDir(path.join(MINIONS_HOME, 'prd', 'archive'));
|
|
538
|
+
rmDir(path.join(MINIONS_HOME, 'prd', 'guides'));
|
|
539
|
+
// Notes + KB
|
|
540
|
+
rm(path.join(MINIONS_HOME, 'notes.md'));
|
|
541
|
+
rm(path.join(MINIONS_HOME, 'pinned.md'));
|
|
542
|
+
rmDir(path.join(MINIONS_HOME, 'notes', 'inbox'));
|
|
543
|
+
rmDir(path.join(MINIONS_HOME, 'notes', 'archive'));
|
|
544
|
+
fs.mkdirSync(path.join(MINIONS_HOME, 'notes', 'inbox'), { recursive: true });
|
|
545
|
+
fs.mkdirSync(path.join(MINIONS_HOME, 'notes', 'archive'), { recursive: true });
|
|
546
|
+
for (const cat of ['architecture', 'conventions', 'project-notes', 'build-reports', 'reviews']) {
|
|
547
|
+
const catDir = path.join(MINIONS_HOME, 'knowledge', cat);
|
|
548
|
+
glob(catDir, /\.md$/).forEach(rm);
|
|
549
|
+
}
|
|
550
|
+
// Agent state (preserve charters)
|
|
551
|
+
const agentsDir = path.join(MINIONS_HOME, 'agents');
|
|
552
|
+
try {
|
|
553
|
+
for (const agent of fs.readdirSync(agentsDir)) {
|
|
554
|
+
const agentDir = path.join(agentsDir, agent);
|
|
555
|
+
if (!fs.statSync(agentDir).isDirectory()) continue;
|
|
556
|
+
for (const f of ['live-output.log', 'session.json', 'history.md', 'steer.md', 'status.json']) rm(path.join(agentDir, f));
|
|
557
|
+
glob(agentDir, /^output.*\.log$/).forEach(rm);
|
|
558
|
+
}
|
|
559
|
+
} catch {}
|
|
560
|
+
// Projects state
|
|
561
|
+
rmDir(path.join(MINIONS_HOME, 'projects'));
|
|
562
|
+
fs.mkdirSync(path.join(MINIONS_HOME, 'projects'), { recursive: true });
|
|
563
|
+
|
|
564
|
+
console.log('\n Reset complete. Config and charters preserved.');
|
|
565
|
+
console.log(' Run: minions up\n');
|
|
503
566
|
} else if (cmd === 'doctor') {
|
|
504
567
|
ensureInstalled();
|
|
505
568
|
const { doctor } = require(path.join(MINIONS_HOME, 'engine', 'preflight'));
|
package/engine.js
CHANGED
|
@@ -356,16 +356,23 @@ function renderPlaybook(type, vars) {
|
|
|
356
356
|
return null;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
// Inject pinned context (always visible to agents)
|
|
359
|
+
// Inject pinned context (always visible to agents) — capped at 4KB
|
|
360
360
|
let pinnedContent = '';
|
|
361
361
|
try { pinnedContent = fs.readFileSync(path.join(MINIONS_DIR, 'pinned.md'), 'utf8'); } catch {}
|
|
362
362
|
if (pinnedContent) {
|
|
363
|
+
if (pinnedContent.length > 4096) pinnedContent = pinnedContent.slice(0, 4096) + '\n\n_...pinned.md truncated (read full file if needed)_';
|
|
363
364
|
content += '\n\n---\n\n## Pinned Context (CRITICAL — READ FIRST)\n\n' + pinnedContent;
|
|
364
365
|
}
|
|
365
366
|
|
|
366
|
-
// Inject team notes
|
|
367
|
-
|
|
367
|
+
// Inject team notes (single injection point — not in buildAgentContext) — capped at 8KB
|
|
368
|
+
let notes = getNotes();
|
|
368
369
|
if (notes) {
|
|
370
|
+
if (notes.length > 8192) {
|
|
371
|
+
const sections = notes.split(/(?=^### )/m);
|
|
372
|
+
const recent = sections.slice(-10).join('');
|
|
373
|
+
notes = recent.length > 8192 ? recent.slice(0, 8192) + '\n\n_...notes truncated_' : recent;
|
|
374
|
+
notes += '\n\n_' + Math.max(0, sections.length - 10) + ' older entries in `notes.md` — Read if needed._';
|
|
375
|
+
}
|
|
369
376
|
content += '\n\n---\n\n## Team Notes (MUST READ)\n\n' + notes;
|
|
370
377
|
}
|
|
371
378
|
|
|
@@ -621,18 +628,8 @@ function buildAgentContext(agentId, config, project) {
|
|
|
621
628
|
context += `## Pending Work Queue (${(dispatch.pending || []).length} items)\n\n${pendingItems.join('\n')}${(dispatch.pending || []).length > 10 ? '\n- ... and ' + ((dispatch.pending || []).length - 10) + ' more' : ''}\n\n`;
|
|
622
629
|
}
|
|
623
630
|
|
|
624
|
-
// Team notes
|
|
625
|
-
|
|
626
|
-
if (notes) {
|
|
627
|
-
const sections = notes.split(/(?=^### )/m);
|
|
628
|
-
const header = sections[0] && !sections[0].startsWith('### ') ? sections.shift() : '';
|
|
629
|
-
if (sections.length > 5) {
|
|
630
|
-
const recent = sections.slice(-5).join('');
|
|
631
|
-
context += `## Team Notes (last 5 of ${sections.length})\n\n${recent}\n\n_${sections.length - 5} older entries in \`notes.md\` — Read if needed._\n\n`;
|
|
632
|
-
} else {
|
|
633
|
-
context += `## Team Notes\n\n${notes}\n\n`;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
631
|
+
// Team notes injected via renderPlaybook (single injection point, with truncation)
|
|
632
|
+
// Not duplicated here to avoid double-injection and token waste
|
|
636
633
|
|
|
637
634
|
return context;
|
|
638
635
|
}
|
|
@@ -2815,7 +2812,7 @@ function discoverFromWorkItems(config, project) {
|
|
|
2815
2812
|
try { vars.notes_content = fs.readFileSync(path.join(MINIONS_DIR, 'notes.md'), 'utf8'); } catch {}
|
|
2816
2813
|
|
|
2817
2814
|
// Inject references and acceptance criteria
|
|
2818
|
-
const refs = (item.references || []).map(r =>
|
|
2815
|
+
const refs = (item.references || []).filter(r => r && r.url).map(r =>
|
|
2819
2816
|
'- [' + (r.title || r.url) + '](' + r.url + ')' + (r.type ? ' (' + r.type + ')' : '')
|
|
2820
2817
|
).join('\n');
|
|
2821
2818
|
vars.references = refs ? '## References\n\n' + refs : '';
|
|
@@ -3110,7 +3107,7 @@ function discoverCentralWorkItems(config) {
|
|
|
3110
3107
|
};
|
|
3111
3108
|
|
|
3112
3109
|
// Inject references and acceptance criteria
|
|
3113
|
-
const fanRefs = (item.references || []).map(r =>
|
|
3110
|
+
const fanRefs = (item.references || []).filter(r => r && r.url).map(r =>
|
|
3114
3111
|
'- [' + (r.title || r.url) + '](' + r.url + ')' + (r.type ? ' (' + r.type + ')' : '')
|
|
3115
3112
|
).join('\n');
|
|
3116
3113
|
vars.references = fanRefs ? '## References\n\n' + fanRefs : '';
|
|
@@ -3185,7 +3182,7 @@ function discoverCentralWorkItems(config) {
|
|
|
3185
3182
|
try { vars.notes_content = fs.readFileSync(path.join(MINIONS_DIR, 'notes.md'), 'utf8'); } catch {}
|
|
3186
3183
|
|
|
3187
3184
|
// Inject references and acceptance criteria
|
|
3188
|
-
const normRefs = (item.references || []).map(r =>
|
|
3185
|
+
const normRefs = (item.references || []).filter(r => r && r.url).map(r =>
|
|
3189
3186
|
'- [' + (r.title || r.url) + '](' + r.url + ')' + (r.type ? ' (' + r.type + ')' : '')
|
|
3190
3187
|
).join('\n');
|
|
3191
3188
|
vars.references = normRefs ? '## References\n\n' + normRefs : '';
|
package/package.json
CHANGED