@yemi33/minions 0.1.41 → 0.1.43
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 +13 -0
- package/dashboard.js +5 -1
- package/engine/github.js +33 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dashboard.js
CHANGED
|
@@ -2935,9 +2935,13 @@ What would you like to discuss or change? When you're happy, say "approve" and I
|
|
|
2935
2935
|
|
|
2936
2936
|
if (prs.some(p => p.id === prId || p.url === url)) return jsonReply(res, 400, { error: 'PR already tracked' });
|
|
2937
2937
|
|
|
2938
|
+
// Save minimal entry — the existing pollPrStatus (ado.js/github.js) will
|
|
2939
|
+
// fetch title, author, branch, build status, and review status on next poll cycle (~6 min).
|
|
2940
|
+
// For auto-observe PRs, status='active' makes pollPrStatus process them.
|
|
2941
|
+
// For context-only PRs, status='linked' skips polling but shows in agent context.
|
|
2938
2942
|
prs.push({
|
|
2939
2943
|
id: prId,
|
|
2940
|
-
title: (title || '
|
|
2944
|
+
title: (title || 'PR #' + prNum + ' (polling...)').slice(0, 120),
|
|
2941
2945
|
agent: 'human',
|
|
2942
2946
|
branch: '',
|
|
2943
2947
|
reviewStatus: autoObserve ? 'pending' : 'none',
|
package/engine/github.js
CHANGED
|
@@ -76,6 +76,39 @@ async function forEachActiveGhPr(config, callback) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
// Also poll manually-linked PRs from central pull-requests.json (extract slug from URL)
|
|
80
|
+
const centralPath = path.join(MINIONS_DIR, 'pull-requests.json');
|
|
81
|
+
const centralPrs = safeJson(centralPath) || [];
|
|
82
|
+
const activeCentral = centralPrs.filter(pr => pr.status === 'active' && pr.url);
|
|
83
|
+
let centralUpdated = 0;
|
|
84
|
+
for (const pr of activeCentral) {
|
|
85
|
+
const ghMatch = pr.url.match(/github\.com\/([^/]+\/[^/]+)\/pull\/(\d+)/);
|
|
86
|
+
if (!ghMatch) continue;
|
|
87
|
+
const slug = ghMatch[1];
|
|
88
|
+
const prNum = ghMatch[2];
|
|
89
|
+
try {
|
|
90
|
+
const updated = await callback(null, pr, prNum, slug);
|
|
91
|
+
if (updated) {
|
|
92
|
+
// Also update title/author/branch if still placeholder
|
|
93
|
+
if (pr.title.includes('polling...') || pr.agent === 'human') {
|
|
94
|
+
const prData = ghApi(`/pulls/${prNum}`, slug);
|
|
95
|
+
if (prData) {
|
|
96
|
+
if (pr.title.includes('polling...')) pr.title = (prData.title || pr.title).slice(0, 120);
|
|
97
|
+
if (pr.agent === 'human' && prData.user?.login) pr.agent = prData.user.login;
|
|
98
|
+
if (!pr.branch && prData.head?.ref) pr.branch = prData.head.ref;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
centralUpdated++;
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
try { engine().log('warn', `GitHub: failed to poll central PR ${pr.id}: ${err.message}`); } catch {}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (centralUpdated > 0) {
|
|
108
|
+
safeWrite(centralPath, centralPrs);
|
|
109
|
+
totalUpdated += centralUpdated;
|
|
110
|
+
}
|
|
111
|
+
|
|
79
112
|
return totalUpdated;
|
|
80
113
|
}
|
|
81
114
|
|
package/package.json
CHANGED