@yemi33/minions 0.1.2019 → 0.1.2020

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/engine/shared.js CHANGED
@@ -3255,16 +3255,18 @@ function getOperatorLogin(config) {
3255
3255
  }
3256
3256
 
3257
3257
  function deriveWorkItemBranchName(item, config) {
3258
- const login = getOperatorLogin(config) || 'unknown';
3259
- const wid = String(item?.id || '').toLowerCase();
3260
- const src = String(item?.title || item?.description || '').toLowerCase();
3261
- let slug = src.replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
3262
- const prefix = `user/${login}/${wid}-`;
3263
- // Cap total length at 120 chars by trimming the slug, leaving at least 8
3264
- // chars of slug room. Strip any trailing dash exposed by truncation.
3265
- const budget = Math.max(8, 120 - prefix.length);
3266
- if (slug.length > budget) slug = slug.slice(0, budget).replace(/-+$/, '');
3267
- return sanitizeBranch(prefix + (slug || 'work'));
3258
+ // Reverted to the pre-#2698 short form `work/<wi-id>` after the
3259
+ // descriptive-slug convention `user/<loginname>/<wi-id>-<slug>` produced
3260
+ // 80–120-char branch names that polluted derived identifiers (e.g. the
3261
+ // conflict-fix WI id in engine.js#buildDepConflictFixItem) and made the
3262
+ // dashboard unreadable. The function signature is preserved so call sites
3263
+ // and the dashboard pre-compute path stay wired. `getOperatorLogin` /
3264
+ // `config` are intentionally unused here but retained for callers that
3265
+ // may still inspect them.
3266
+ void config;
3267
+ const wid = String(item?.id || '').trim();
3268
+ if (!wid) return null;
3269
+ return sanitizeBranch(`work/${wid}`);
3268
3270
  }
3269
3271
 
3270
3272
  function _worktreeNameSuffix(dispatchId, projectName, branchName) {
package/engine.js CHANGED
@@ -214,6 +214,31 @@ function parseConflictFiles(mergeOutput) {
214
214
  // be spawned in the blocked item's worktree root. That is a PRE-EXISTING
215
215
  // limitation of the dep-conflict-fix path — single-project plans (the common
216
216
  // case, and the trigger scenario P-wi1-bridge-readonly-{a,b,c}) are unaffected.
217
+ // Derive a SHORT, stable conflict-fix WI id from a branch name. The legacy
218
+ // shape `conflict-fix-${branch.replace(/[^a-zA-Z0-9-]/g, '-')}` was fine when
219
+ // branches were `work/<wi-id>` (max ~25 chars), but PR #2698 codified the
220
+ // `user/<loginname>/<wi-id>-<slug>` convention which makes branch names
221
+ // 80-120+ chars and the resulting WI ids unreadable in the dashboard.
222
+ //
223
+ // Strategy:
224
+ // - strip `user/<login>/` prefix (only the WI portion matters)
225
+ // - strip `work/` prefix → keep `work-` for legacy-branch shape parity
226
+ // - sanitize remaining `/` → `-`
227
+ // - cap at 40 chars total; if truncated, suffix with 8-char sha1 of the
228
+ // full branch so different long branches that share a 40-char prefix
229
+ // still get distinct (deterministic) ids
230
+ function deriveConflictFixKey(branch) {
231
+ let s = String(branch || '');
232
+ const userMatch = s.match(/^user\/[^/]+\/(.+)$/);
233
+ if (userMatch) s = userMatch[1];
234
+ const workMatch = s.match(/^work\/(.+)$/);
235
+ if (workMatch) s = `work-${workMatch[1]}`;
236
+ s = s.replace(/[^a-zA-Z0-9-]/g, '-');
237
+ if (s.length <= 40) return s;
238
+ const hash = require('crypto').createHash('sha1').update(String(branch || '')).digest('hex').slice(0, 8);
239
+ return `${s.slice(0, 31)}-${hash}`;
240
+ }
241
+
217
242
  function buildDepConflictFixItem({
218
243
  depConflictBranch,
219
244
  depConflictFiles = [],
@@ -225,7 +250,7 @@ function buildDepConflictFixItem({
225
250
  }) {
226
251
  if (!depConflictBranch) throw new Error('buildDepConflictFixItem: depConflictBranch is required');
227
252
  if (!mainBranch) throw new Error('buildDepConflictFixItem: mainBranch is required');
228
- const conflictFixId = `conflict-fix-${depConflictBranch.replace(/[^a-zA-Z0-9-]/g, '-')}`;
253
+ const conflictFixId = `conflict-fix-${deriveConflictFixKey(depConflictBranch)}`;
229
254
  const filesDesc = depConflictFiles.length > 0
230
255
  ? `\n\nConflicting files:\n${depConflictFiles.map(f => '- ' + f).join('\n')}`
231
256
  : '';
@@ -6758,7 +6783,7 @@ module.exports = {
6758
6783
  reconcileItemsWithPrs, detectDependencyCycles,
6759
6784
  areDependenciesMet, // exported for testing (P-bf04-decompose-zero-children)
6760
6785
  parseConflictFiles, pruneAncestorDeps, preflightMergeSimulation, // exported for testing
6761
- buildDepConflictFixItem, // exported for testing (W-mpcwojgr000a0244)
6786
+ buildDepConflictFixItem, deriveConflictFixKey, // exported for testing (W-mpcwojgr000a0244)
6762
6787
  isWorktreeRetryableError, removeStaleIndexLock, syncReusedWorktree, assertCleanSharedWorktree, // exported for testing
6763
6788
  pruneStaleWorktreeForBranch, // exported for testing
6764
6789
  findExistingWorktree, // exported for testing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2019",
3
+ "version": "0.1.2020",
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"