@yemi33/minions 0.1.946 → 0.1.948

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.946 (2026-04-14)
3
+ ## 0.1.948 (2026-04-14)
4
4
 
5
5
  ### Features
6
6
  - make ADO poll frequency configurable and ungate reconcilePrs
@@ -47,6 +47,8 @@
47
47
  - prioritize error_max_turns over permission-blocked in classifyFailure (#1001)
48
48
 
49
49
  ### Other
50
+ - refactor(ado): extract stripRefsHeads helper, deduplicate refs/heads/ stripping
51
+ - refactor(ado): simplify comments, fix declaration order, promote ado import
50
52
  - refactor(ado): move PR enrichment fetch into fetchAdoPrMetadata helper
51
53
  - refactor: Make renderLiveChatMessage a thin wrapper over renderAgentOutput
52
54
  - test(preflight): add unit tests for findClaudeBinary, runPreflight, printPreflight, checkOrExit (#953)
package/dashboard.js CHANGED
@@ -21,6 +21,7 @@ const _dashboardVersion = {
21
21
  const shared = require('./engine/shared');
22
22
  const queries = require('./engine/queries');
23
23
  const teams = require('./engine/teams');
24
+ const ado = require('./engine/ado');
24
25
  const os = require('os');
25
26
 
26
27
  const { safeRead, safeReadDir, safeWrite, safeJson, safeJsonObj, safeJsonArr, safeUnlink, mutateJsonFileLocked, mutateWorkItems, getProjects: _getProjects, DONE_STATUSES, WI_STATUS, reopenWorkItem } = shared;
@@ -4228,8 +4229,7 @@ What would you like to discuss or change? When you're happy, say "approve" and I
4228
4229
  } else if (adoMatch) {
4229
4230
  const [, adoOrg, adoProj, adoRepo] = adoMatch;
4230
4231
  try {
4231
- const { fetchAdoPrMetadata } = require('./engine/ado');
4232
- prData = await fetchAdoPrMetadata(prNum, adoOrg, adoProj, adoRepo);
4232
+ prData = await ado.fetchAdoPrMetadata(prNum, adoOrg, adoProj, adoRepo);
4233
4233
  } catch { /* ADO token may not be available */ }
4234
4234
  }
4235
4235
  if (!prData) return;
package/engine/ado.js CHANGED
@@ -16,6 +16,8 @@ function engine() {
16
16
  return _engine;
17
17
  }
18
18
 
19
+ const stripRefsHeads = s => (s || '').replace('refs/heads/', '');
20
+
19
21
  // ─── ADO Token Cache ─────────────────────────────────────────────────────────
20
22
 
21
23
  let _adoTokenCache = { token: null, expiresAt: 0 };
@@ -117,7 +119,7 @@ async function fetchAdoBuildErrorLog(orgBase, project, failedStatus, token, pr,
117
119
  if (!buildId) {
118
120
  // Fallback: query recent failed builds for this PR's source branch
119
121
  try {
120
- const branch = pr?.branch || pr?.sourceRefName?.replace('refs/heads/', '');
122
+ const branch = pr?.branch || stripRefsHeads(pr?.sourceRefName);
121
123
  if (branch) {
122
124
  const buildsUrl = `${orgBase}/${project.adoProject}/_apis/build/builds?branchName=refs/heads/${encodeURIComponent(branch)}&statusFilter=completed&resultFilter=failed&$top=3&api-version=7.1`;
123
125
  const builds = await adoFetch(buildsUrl, token);
@@ -371,19 +373,17 @@ async function pollPrStatus(config) {
371
373
 
372
374
  if (newStatus !== PR_STATUS.ACTIVE) return updated;
373
375
 
374
- // Query builds API directly — status checks (/statuses) are unreliable (stale codecoverage postbacks)
375
- // Use refs/pull/{id}/merge the synthetic merge ref ADO creates for each PR — to scope builds exactly
376
+ // Query builds API directly — /statuses is unreliable (stale codecoverage postbacks).
377
+ // refs/pull/{id}/merge scopes server-side to this PR; sourceVersion narrows to the current
378
+ // merge commit (same ref accumulates builds across all prior pushes to the PR).
376
379
  const prNumber = pr.prNumber;
380
+ const mergeCommitId = prData.lastMergeCommit?.commitId;
377
381
  let buildStatus = 'none';
378
382
  let buildFailReason = '';
379
383
  let buildStatuses = []; // for error log fetching
380
384
 
381
- const mergeCommitId = prData.lastMergeCommit?.commitId;
382
385
  if (prNumber && mergeCommitId) {
383
386
  try {
384
- // branchName=refs/pull/{id}/merge scopes server-side to this PR's builds.
385
- // sourceVersion filter then narrows to the current merge commit — a PR updated
386
- // multiple times accumulates builds on the same ref across different commits.
387
387
  const mergeRef = encodeURIComponent(`refs/pull/${prNumber}/merge`);
388
388
  const buildsUrl = `${orgBase}/${project.adoProject}/_apis/build/builds?branchName=${mergeRef}&repositoryId=${project.repositoryId}&repositoryType=TfsGit&$top=25&api-version=7.1`;
389
389
  const buildsData = await adoFetch(buildsUrl, token);
@@ -650,7 +650,7 @@ async function reconcilePrs(config) {
650
650
  let projectUpdated = 0;
651
651
  for (const adoPr of adoPrs) {
652
652
  const prId = `PR-${adoPr.pullRequestId}`;
653
- const branch = (adoPr.sourceRefName || '').replace('refs/heads/', '');
653
+ const branch = stripRefsHeads(adoPr.sourceRefName);
654
654
  const title = adoPr.title || '';
655
655
  // Extract item ID from branch name or PR title (e.g., feat(P-2cafdc2a): ...)
656
656
  const branchMatch = branch.match(/(P-[a-z0-9]{6,})/i) || branch.match(/(W-[a-z0-9]{6,})/i) || branch.match(/(PL-[a-z0-9]{6,})/i);
@@ -768,19 +768,17 @@ async function checkLiveReviewStatus(pr, project) {
768
768
  }
769
769
  }
770
770
 
771
- // Fetch basic PR metadata (title, description, branch, author) for a manually-linked ADO PR.
772
- // Uses adoFetch so retry logic and circuit breaker apply — dashboard.js PR enrichment calls this.
773
771
  async function fetchAdoPrMetadata(prNum, adoOrg, adoProj, adoRepo) {
774
772
  const token = await getAdoToken();
775
773
  if (!token) return null;
776
774
  const url = `https://dev.azure.com/${adoOrg}/${adoProj}/_apis/git/repositories/${adoRepo}/pullrequests/${prNum}?api-version=7.1`;
777
- const d = await adoFetch(url, token);
778
- if (!d) return null;
775
+ const pr = await adoFetch(url, token);
776
+ if (!pr) return null;
779
777
  return {
780
- title: d.title || '',
781
- description: d.description || '',
782
- branch: d.sourceRefName?.replace('refs/heads/', '') || '',
783
- author: d.createdBy?.displayName || '',
778
+ title: pr.title || '',
779
+ description: pr.description || '',
780
+ branch: stripRefsHeads(pr.sourceRefName),
781
+ author: pr.createdBy?.displayName || '',
784
782
  };
785
783
  }
786
784
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.946",
3
+ "version": "0.1.948",
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"