@yemi33/minions 0.1.898 → 0.1.899
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 +5 -0
- package/engine/lifecycle.js +48 -1
- package/engine.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/engine/lifecycle.js
CHANGED
|
@@ -8,7 +8,7 @@ const path = require('path');
|
|
|
8
8
|
const os = require('os');
|
|
9
9
|
const shared = require('./shared');
|
|
10
10
|
const { safeRead, safeJson, safeWrite, mutateJsonFileLocked, mutateWorkItems, execSilent, execAsync, projectPrPath, getPrLinks, addPrLink,
|
|
11
|
-
log, ts, dateStamp, WI_STATUS, DONE_STATUSES, PLAN_TERMINAL_STATUSES, WORK_TYPE, PLAN_STATUS, PR_STATUS, DISPATCH_RESULT,
|
|
11
|
+
log, ts, dateStamp, WI_STATUS, DONE_STATUSES, PLAN_TERMINAL_STATUSES, WORK_TYPE, PLAN_STATUS, PRD_ITEM_STATUS, PR_STATUS, DISPATCH_RESULT,
|
|
12
12
|
ENGINE_DEFAULTS, DEFAULT_AGENT_METRICS, FAILURE_CLASS } = shared;
|
|
13
13
|
const { trackEngineUsage } = require('./llm');
|
|
14
14
|
const queries = require('./queries');
|
|
@@ -637,6 +637,52 @@ function syncPrdItemStatus(itemId, status, sourcePlan) {
|
|
|
637
637
|
} catch (err) { log('warn', `PRD status sync: ${err.message}`); }
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
+
// ─── PRD Backward-Scan Reconciliation (#929) ────────────────────────────────
|
|
641
|
+
// Proactive counterpart to syncPrdItemStatus. Scans all active PRDs and promotes
|
|
642
|
+
// "missing" items to "updated" when a done work item already exists for that ID.
|
|
643
|
+
// This catches cases where a PRD regeneration incorrectly sets items to "missing"
|
|
644
|
+
// and no subsequent work item state change triggers the reactive sync.
|
|
645
|
+
|
|
646
|
+
function reconcilePrdStatuses(config) {
|
|
647
|
+
if (!fs.existsSync(PRD_DIR)) return;
|
|
648
|
+
let prdFiles;
|
|
649
|
+
try { prdFiles = fs.readdirSync(PRD_DIR).filter(f => f.endsWith('.json')); } catch { return; }
|
|
650
|
+
if (prdFiles.length === 0) return;
|
|
651
|
+
|
|
652
|
+
const allWorkItems = queries.getWorkItems(config);
|
|
653
|
+
if (allWorkItems.length === 0) return;
|
|
654
|
+
|
|
655
|
+
// Index done work items by ID for O(1) lookup
|
|
656
|
+
const doneWiById = new Map();
|
|
657
|
+
for (const wi of allWorkItems) {
|
|
658
|
+
if (wi.id && DONE_STATUSES.has(wi.status)) doneWiById.set(wi.id, wi);
|
|
659
|
+
}
|
|
660
|
+
if (doneWiById.size === 0) return;
|
|
661
|
+
|
|
662
|
+
for (const file of prdFiles) {
|
|
663
|
+
try {
|
|
664
|
+
const fpath = path.join(PRD_DIR, file);
|
|
665
|
+
const plan = safeJson(fpath);
|
|
666
|
+
if (!plan?.missing_features) continue;
|
|
667
|
+
// Skip completed/archived PRDs — no reconciliation needed
|
|
668
|
+
if (plan.status === PLAN_STATUS.COMPLETED) continue;
|
|
669
|
+
|
|
670
|
+
let modified = false;
|
|
671
|
+
for (const feature of plan.missing_features) {
|
|
672
|
+
if (feature.status === PRD_ITEM_STATUS.MISSING && doneWiById.has(feature.id)) {
|
|
673
|
+
feature.status = PRD_ITEM_STATUS.UPDATED;
|
|
674
|
+
modified = true;
|
|
675
|
+
log('info', `PRD backward-scan: promoted ${feature.id} from missing→updated in ${file} (done work item exists)`);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if (modified) {
|
|
680
|
+
safeWrite(fpath, plan);
|
|
681
|
+
}
|
|
682
|
+
} catch (err) { log('warn', `PRD backward-scan for ${file}: ${err.message}`); }
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
640
686
|
// ─── PR Sync from Output ─────────────────────────────────────────────────────
|
|
641
687
|
|
|
642
688
|
function syncPrsFromOutput(output, agentId, meta, config) {
|
|
@@ -1876,6 +1922,7 @@ module.exports = {
|
|
|
1876
1922
|
cleanupPlanWorktrees,
|
|
1877
1923
|
updateWorkItemStatus,
|
|
1878
1924
|
syncPrdItemStatus,
|
|
1925
|
+
reconcilePrdStatuses,
|
|
1879
1926
|
syncPrsFromOutput,
|
|
1880
1927
|
updatePrAfterReview,
|
|
1881
1928
|
updatePrAfterFix,
|
package/engine.js
CHANGED
|
@@ -135,7 +135,7 @@ const { renderPlaybook, validatePlaybookVars, PLAYBOOK_REQUIRED_VARS,
|
|
|
135
135
|
|
|
136
136
|
// ─── Lifecycle (extracted to engine/lifecycle.js) ────────────────────────────
|
|
137
137
|
|
|
138
|
-
const { runPostCompletionHooks, updateWorkItemStatus, syncPrdItemStatus, handlePostMerge, checkPlanCompletion,
|
|
138
|
+
const { runPostCompletionHooks, updateWorkItemStatus, syncPrdItemStatus, reconcilePrdStatuses, handlePostMerge, checkPlanCompletion,
|
|
139
139
|
syncPrsFromOutput, updatePrAfterReview, updatePrAfterFix, checkForLearnings, extractSkillsFromOutput,
|
|
140
140
|
updateAgentHistory, updateMetrics, createReviewFeedbackForAuthor, parseAgentOutput, syncPrdFromPrs,
|
|
141
141
|
isItemCompleted, classifyFailure, processPendingRebases } = require('./engine/lifecycle');
|
|
@@ -2692,6 +2692,7 @@ async function discoverWork(config) {
|
|
|
2692
2692
|
|
|
2693
2693
|
// Side-effect passes: materialize plans and design docs into work-items.json
|
|
2694
2694
|
// These write to project work queues — picked up by discoverFromWorkItems below.
|
|
2695
|
+
reconcilePrdStatuses(config); // Backward-scan: correct "missing" PRD items that have done work items (#929)
|
|
2695
2696
|
materializePlansAsWorkItems(config);
|
|
2696
2697
|
|
|
2697
2698
|
for (const project of projects) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.899",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|