@imdeadpool/guardex 8.4.28 → 8.4.29
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/package.json +2 -2
- package/src/cli/commands/status.js +11 -17
- package/src/cli/shared/scaffolding.js +22 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imdeadpool/guardex",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.29",
|
|
4
4
|
"description": "Guardian T-Rex for your multi-agent repo. Isolated worktrees, file locks, and PR-only merges stop parallel Codex & Claude agents from overwriting each other's work. Auto-wires Oh My Codex, Oh My Claude, OpenSpec, and Caveman.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"preferGlobal": true,
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"prepublishOnly": "node scripts/prepublish-bump-version.js",
|
|
66
66
|
"postinstall": "node -e \"require('./src/heavy').installReport()\""
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "ce79355c645244802ec58a71746d494872c1fea3"
|
|
69
69
|
}
|
|
@@ -23,7 +23,7 @@ const { parseCommonArgs } = require('../args');
|
|
|
23
23
|
const { extractFlag } = require('../dispatch');
|
|
24
24
|
const {
|
|
25
25
|
runScanInternal,
|
|
26
|
-
|
|
26
|
+
summarizeAgentWorktrees,
|
|
27
27
|
deriveNextStepHint,
|
|
28
28
|
printStatusRepairHint
|
|
29
29
|
} = require('../shared/scaffolding');
|
|
@@ -208,6 +208,8 @@ function status(rawArgs) {
|
|
|
208
208
|
const targetPath = path.resolve(options.target);
|
|
209
209
|
const inGitRepo = isGitRepo(targetPath);
|
|
210
210
|
const scanResult = inGitRepo ? runScanInternal({ target: targetPath, json: false }) : null;
|
|
211
|
+
const worktrees = scanResult ? summarizeAgentWorktrees(scanResult.repoRoot) : null;
|
|
212
|
+
const worktreeCount = worktrees ? worktrees.agent + worktrees.detached + worktrees.otherManaged : 0;
|
|
211
213
|
const repoServiceStatus = scanResult
|
|
212
214
|
? scanResult.guardexEnabled === false
|
|
213
215
|
? 'disabled'
|
|
@@ -227,6 +229,7 @@ function status(rawArgs) {
|
|
|
227
229
|
target: targetPath,
|
|
228
230
|
inGitRepo,
|
|
229
231
|
serviceStatus: repoServiceStatus,
|
|
232
|
+
worktrees,
|
|
230
233
|
guardexEnabled: scanResult ? scanResult.guardexEnabled !== false : null,
|
|
231
234
|
guardexToggle: scanResult ? scanResult.guardexToggle || null : null,
|
|
232
235
|
scan: scanResult
|
|
@@ -341,22 +344,19 @@ function status(rawArgs) {
|
|
|
341
344
|
return payload;
|
|
342
345
|
}
|
|
343
346
|
|
|
347
|
+
const worktreeLine = worktreeCount > 0
|
|
348
|
+
? `[${TOOL_NAME}] Worktrees: ${worktrees.agent} agent branch${worktrees.agent === 1 ? '' : 'es'} · ${worktrees.detached} detached`
|
|
349
|
+
+ (worktrees.otherManaged ? ` · ${worktrees.otherManaged} other managed` : '')
|
|
350
|
+
: null;
|
|
344
351
|
if (scanResult.guardexEnabled === false) {
|
|
345
352
|
console.log(
|
|
346
353
|
`[${TOOL_NAME}] Repo safety service: ${statusDot('disabled')} disabled (${describeGuardexRepoToggle(scanResult.guardexToggle)}).`
|
|
347
354
|
);
|
|
348
355
|
console.log(`[${TOOL_NAME}] Repo: ${scanResult.repoRoot}`);
|
|
349
356
|
console.log(`[${TOOL_NAME}] Branch: ${scanResult.branch}`);
|
|
350
|
-
|
|
351
|
-
if (worktreeCountDisabled > 0) {
|
|
352
|
-
const plural = worktreeCountDisabled === 1 ? 'worktree' : 'worktrees';
|
|
353
|
-
console.log(
|
|
354
|
-
`[${TOOL_NAME}] ⚠ ${worktreeCountDisabled} active agent ${plural} under .omc/agent-worktrees or .omx/agent-worktrees.`
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
+
if (worktreeLine) console.log(worktreeLine);
|
|
357
358
|
const disabledHint = deriveNextStepHint({
|
|
358
359
|
scanResult,
|
|
359
|
-
worktreeCount: worktreeCountDisabled,
|
|
360
360
|
invoked: invokedBasename,
|
|
361
361
|
inGitRepo
|
|
362
362
|
});
|
|
@@ -390,16 +390,10 @@ function status(rawArgs) {
|
|
|
390
390
|
`[${TOOL_NAME}] Review watcher: ${statusDot('active')} running (pid ${payload.repo.reviewDaemon.pid})`
|
|
391
391
|
);
|
|
392
392
|
}
|
|
393
|
-
|
|
394
|
-
if (worktreeCountActive > 0) {
|
|
395
|
-
const plural = worktreeCountActive === 1 ? 'worktree' : 'worktrees';
|
|
396
|
-
console.log(
|
|
397
|
-
`[${TOOL_NAME}] ⚠ ${worktreeCountActive} active agent ${plural} → ${invokedBasename} finish --all`
|
|
398
|
-
);
|
|
399
|
-
}
|
|
393
|
+
if (worktreeLine) console.log(worktreeLine);
|
|
400
394
|
const activeHint = deriveNextStepHint({
|
|
401
395
|
scanResult,
|
|
402
|
-
worktreeCount
|
|
396
|
+
worktreeCount,
|
|
403
397
|
invoked: invokedBasename,
|
|
404
398
|
inGitRepo
|
|
405
399
|
});
|
|
@@ -507,19 +507,28 @@ function printStatusRepairHint(scanResult) {
|
|
|
507
507
|
);
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
function
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
510
|
+
function summarizeAgentWorktrees(repoRoot) {
|
|
511
|
+
const result = gitRun(repoRoot, ['worktree', 'list', '--porcelain', '-z'], { allowFailure: true });
|
|
512
|
+
if (result.status !== 0) return null;
|
|
513
|
+
const [primary, ...linked] = String(result.stdout || '').split('\0\0');
|
|
514
|
+
const mainPath = primary.split('\0')[0].slice('worktree '.length);
|
|
515
|
+
const counts = { agent: 0, detached: 0, otherManaged: 0 };
|
|
516
|
+
for (const record of linked) {
|
|
517
|
+
const fields = record.split('\0');
|
|
518
|
+
if (fields.some((field) => field === 'prunable' || field.startsWith('prunable '))) continue;
|
|
519
|
+
if (fields.some((field) => field.startsWith('branch refs/heads/agent/'))) {
|
|
520
|
+
counts.agent++;
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
const worktreePath = fields.find((field) => field.startsWith('worktree '));
|
|
524
|
+
if (!worktreePath) continue;
|
|
525
|
+
const relative = path.relative(mainPath, worktreePath.slice('worktree '.length));
|
|
526
|
+
if (/^\.(omc|omx)\/agent-worktrees\//.test(relative.split(path.sep).join('/'))) {
|
|
527
|
+
if (fields.includes('detached')) counts.detached++;
|
|
528
|
+
else counts.otherManaged++;
|
|
520
529
|
}
|
|
521
530
|
}
|
|
522
|
-
return
|
|
531
|
+
return counts;
|
|
523
532
|
}
|
|
524
533
|
|
|
525
534
|
function deriveNextStepHint({ scanResult, worktreeCount, invoked, inGitRepo }) {
|
|
@@ -537,8 +546,7 @@ function deriveNextStepHint({ scanResult, worktreeCount, invoked, inGitRepo }) {
|
|
|
537
546
|
return `${invoked} branch finish --branch "${branch}" --via-pr --wait-for-merge --cleanup`;
|
|
538
547
|
}
|
|
539
548
|
if (worktreeCount > 0) {
|
|
540
|
-
|
|
541
|
-
return `${invoked} finish --all # ${worktreeCount} active agent ${plural}`;
|
|
549
|
+
return `${invoked} worktree prune --dry-run --keep-clean-unmerged --preserve-open-prs --include-pr-merged --include-merged-linked-worktrees # preview cleanup`;
|
|
542
550
|
}
|
|
543
551
|
if (scanResult.errors > 0 || scanResult.warnings > 0) {
|
|
544
552
|
return `${invoked} doctor # repair drift`;
|
|
@@ -558,6 +566,6 @@ module.exports = {
|
|
|
558
566
|
printScanResult,
|
|
559
567
|
setExitCodeFromScan,
|
|
560
568
|
printStatusRepairHint,
|
|
561
|
-
|
|
569
|
+
summarizeAgentWorktrees,
|
|
562
570
|
deriveNextStepHint,
|
|
563
571
|
};
|