opencode-swarm 7.129.2 → 7.129.3
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/dist/background/workspace-snapshot.d.ts +30 -0
- package/dist/cli/{curator-rtpbkffc.js → curator-gay2gz5p.js} +2 -2
- package/dist/cli/{curator-llm-factory-5dcetzsz.js → curator-llm-factory-90803y01.js} +2 -2
- package/dist/cli/{guardrail-explain-27xbz1h2.js → guardrail-explain-axvx94rx.js} +3 -3
- package/dist/cli/{hive-promoter-7x33c575.js → hive-promoter-3j6xp8gm.js} +2 -2
- package/dist/cli/{index-vpjvqkdq.js → index-509jpmdd.js} +1 -1
- package/dist/cli/{index-ate4rw9q.js → index-9vbpy8f9.js} +38 -22
- package/dist/cli/{index-40zn444p.js → index-f2y46pda.js} +179 -1
- package/dist/cli/{index-s7tsx4v9.js → index-vjmmzhv0.js} +3 -3
- package/dist/cli/index.js +2 -2
- package/dist/cli/{workspace-snapshot-aa0ggevw.js → workspace-snapshot-jwkjg790.js} +21 -1
- package/dist/hooks/pr-workflow-gate.d.ts +11 -3
- package/dist/index.js +10 -8
- package/dist/tools/dispatch-lanes.d.ts +3 -3
- package/dist/tools/run-pr-feedback-stage-a.d.ts +5 -1
- package/package.json +1 -1
|
@@ -19,8 +19,18 @@ interface CaptureWorkspaceSnapshotOptions {
|
|
|
19
19
|
export declare function readGitTextAtRevision(directory: string, revision: string, relativePath: string): string | null;
|
|
20
20
|
/** Resolve the exact checked-out commit through the bounded Git snapshot path. */
|
|
21
21
|
export declare function resolveCurrentGitHead(directory: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Async twin of {@link resolveCurrentGitHead}. PR-workflow gate/dispatch binding
|
|
24
|
+
* runs on the host tool/hook path, so HEAD verification must resolve Git off the
|
|
25
|
+
* blocking `spawnSync` path — a synchronous spawn on the long-running host (most
|
|
26
|
+
* acutely under Bun on Windows) can hang to its bound instead of returning, which
|
|
27
|
+
* a fail-closed gate would surface as a spurious "cannot resolve HEAD" block.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveCurrentGitHeadAsync(directory: string): Promise<string | null>;
|
|
22
30
|
/** Resolve one exact PR merge base without shell interpolation or unbounded I/O. */
|
|
23
31
|
export declare function resolveExactMergeBase(directory: string, baseRef: string, prHeadSha: string): string | null;
|
|
32
|
+
/** Async twin of {@link resolveExactMergeBase} for the gate/dispatch bind path. */
|
|
33
|
+
export declare function resolveExactMergeBaseAsync(directory: string, baseRef: string, prHeadSha: string): Promise<string | null>;
|
|
24
34
|
export interface PrReviewDiffStats {
|
|
25
35
|
changedLines: number;
|
|
26
36
|
changedFiles: number;
|
|
@@ -41,6 +51,8 @@ export interface PrReviewDiffStats {
|
|
|
41
51
|
* git version/config.
|
|
42
52
|
*/
|
|
43
53
|
export declare function resolvePrReviewDiffStats(directory: string, baseSha: string, prHeadSha: string): PrReviewDiffStats | null;
|
|
54
|
+
/** Async twin of {@link resolvePrReviewDiffStats} used off the blocking spawn on the gate/dispatch bind path. */
|
|
55
|
+
export declare function resolvePrReviewDiffStatsAsync(directory: string, baseSha: string, prHeadSha: string): Promise<PrReviewDiffStats | null>;
|
|
44
56
|
/** Resolve the current branch's exact remote-tracking publication target. */
|
|
45
57
|
export declare function resolveCurrentUpstreamRemoteRef(directory: string): string | null;
|
|
46
58
|
export interface PrUpstreamPushTarget {
|
|
@@ -50,22 +62,40 @@ export interface PrUpstreamPushTarget {
|
|
|
50
62
|
}
|
|
51
63
|
/** Resolve a branch's upstream without guessing where a remote name ends. */
|
|
52
64
|
export declare function resolveCurrentUpstreamPushTarget(directory: string): PrUpstreamPushTarget | null;
|
|
65
|
+
/** Async twin of {@link resolveCurrentUpstreamPushTarget} used off the blocking spawn on the gate/dispatch bind path. */
|
|
66
|
+
export declare function resolveCurrentUpstreamPushTargetAsync(directory: string): Promise<PrUpstreamPushTarget | null>;
|
|
53
67
|
/** Query the actual remote ref; local tracking refs are not publication proof. */
|
|
54
68
|
export declare function resolveExactRemoteBranchHead(directory: string, remoteName: string, remoteBranchRef: string): string | null;
|
|
69
|
+
/** Async twin of {@link resolveExactRemoteBranchHead} for the gate bind/publish path. */
|
|
70
|
+
export declare function resolveExactRemoteBranchHeadAsync(directory: string, remoteName: string, remoteBranchRef: string): Promise<string | null>;
|
|
55
71
|
/** Bind Stage-A execution to Git refs, config, HEAD, and index metadata. */
|
|
56
72
|
export declare function resolveGitControlStateDigest(directory: string): string | null;
|
|
73
|
+
/** Async twin of {@link resolveGitControlStateDigest} used off the blocking spawn on the gate/dispatch bind path. */
|
|
74
|
+
export declare function resolveGitControlStateDigestAsync(directory: string): Promise<string | null>;
|
|
57
75
|
/** Require all independently reviewed content to be captured by the commit. */
|
|
58
76
|
export declare function resolveIsWorkingTreeClean(directory: string): boolean | null;
|
|
77
|
+
/**
|
|
78
|
+
* Async twin of {@link resolveIsWorkingTreeClean} for the gate/dispatch bind path.
|
|
79
|
+
* `git status` emits far more output than `rev-parse`, so it is the most exposed
|
|
80
|
+
* of the bind-path checks to a blocking synchronous spawn stalling the host.
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveIsWorkingTreeCleanAsync(directory: string): Promise<boolean | null>;
|
|
59
83
|
/** Count commits on the ancestry path from the immutable intake head to HEAD. */
|
|
60
84
|
export declare function resolveCommitCountSince(directory: string, baseHeadSha: string, currentHeadSha: string): number | null;
|
|
85
|
+
/** Async twin of {@link resolveCommitCountSince} used off the blocking spawn on the gate/dispatch bind path. */
|
|
86
|
+
export declare function resolveCommitCountSinceAsync(directory: string, baseHeadSha: string, currentHeadSha: string): Promise<number | null>;
|
|
61
87
|
/** Prove the publication commit is a non-merge direct child of intake HEAD. */
|
|
62
88
|
export declare function resolveIsExactSingleChildCommit(directory: string, baseHeadSha: string, currentHeadSha: string): boolean | null;
|
|
89
|
+
/** Async twin of {@link resolveIsExactSingleChildCommit} used off the blocking spawn on the gate/dispatch bind path. */
|
|
90
|
+
export declare function resolveIsExactSingleChildCommitAsync(directory: string, baseHeadSha: string, currentHeadSha: string): Promise<boolean | null>;
|
|
63
91
|
/**
|
|
64
92
|
* Return remote-tracking refs whose tip equals the exact checked-out commit.
|
|
65
93
|
* Publication closeout uses this bounded local observation after a successful
|
|
66
94
|
* push; an empty list is not proof that the approved revision was published.
|
|
67
95
|
*/
|
|
68
96
|
export declare function resolveRemoteRefsContainingHead(directory: string, headSha: string): string[] | null;
|
|
97
|
+
/** Async twin of {@link resolveRemoteRefsContainingHead} used off the blocking spawn on the gate/dispatch bind path. */
|
|
98
|
+
export declare function resolveRemoteRefsContainingHeadAsync(directory: string, headSha: string): Promise<string[] | null>;
|
|
69
99
|
/**
|
|
70
100
|
* Bind a mutable working tree to its actual content, not merely porcelain status.
|
|
71
101
|
* This lets PR-feedback approvals fail closed when a same-path edit occurs after a
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
runCuratorInit,
|
|
15
15
|
runCuratorPhase,
|
|
16
16
|
writeCuratorSummary
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-9vbpy8f9.js";
|
|
18
18
|
import"./index-v4n224r1.js";
|
|
19
19
|
import"./index-cpssctv1.js";
|
|
20
20
|
import"./index-kzvwb2se.js";
|
|
@@ -52,7 +52,7 @@ import"./index-s80bsjkj.js";
|
|
|
52
52
|
import"./index-z6xqpmqg.js";
|
|
53
53
|
import"./index-zjygnfay.js";
|
|
54
54
|
import"./index-zgwm4ryv.js";
|
|
55
|
-
import"./index-
|
|
55
|
+
import"./index-f2y46pda.js";
|
|
56
56
|
import"./index-3x761jqv.js";
|
|
57
57
|
import"./index-7mkpsw6g.js";
|
|
58
58
|
import"./index-fsrp8wp3.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createCuratorLLMDelegate
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-9vbpy8f9.js";
|
|
5
5
|
import"./index-v4n224r1.js";
|
|
6
6
|
import"./index-cpssctv1.js";
|
|
7
7
|
import"./index-kzvwb2se.js";
|
|
@@ -39,7 +39,7 @@ import"./index-s80bsjkj.js";
|
|
|
39
39
|
import"./index-z6xqpmqg.js";
|
|
40
40
|
import"./index-zjygnfay.js";
|
|
41
41
|
import"./index-zgwm4ryv.js";
|
|
42
|
-
import"./index-
|
|
42
|
+
import"./index-f2y46pda.js";
|
|
43
43
|
import"./index-3x761jqv.js";
|
|
44
44
|
import"./index-7mkpsw6g.js";
|
|
45
45
|
import"./index-fsrp8wp3.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-509jpmdd.js";
|
|
5
|
+
import"./index-9vbpy8f9.js";
|
|
6
6
|
import"./index-v4n224r1.js";
|
|
7
7
|
import"./index-cpssctv1.js";
|
|
8
8
|
import"./index-kzvwb2se.js";
|
|
@@ -40,7 +40,7 @@ import"./index-s80bsjkj.js";
|
|
|
40
40
|
import"./index-z6xqpmqg.js";
|
|
41
41
|
import"./index-zjygnfay.js";
|
|
42
42
|
import"./index-zgwm4ryv.js";
|
|
43
|
-
import"./index-
|
|
43
|
+
import"./index-f2y46pda.js";
|
|
44
44
|
import"./index-3x761jqv.js";
|
|
45
45
|
import"./index-7mkpsw6g.js";
|
|
46
46
|
import"./index-fsrp8wp3.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isHiveEligible,
|
|
8
8
|
promoteFromSwarm,
|
|
9
9
|
promoteToHive
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-9vbpy8f9.js";
|
|
11
11
|
import"./index-v4n224r1.js";
|
|
12
12
|
import"./index-cpssctv1.js";
|
|
13
13
|
import"./index-kzvwb2se.js";
|
|
@@ -47,7 +47,7 @@ import"./index-s80bsjkj.js";
|
|
|
47
47
|
import"./index-z6xqpmqg.js";
|
|
48
48
|
import"./index-zjygnfay.js";
|
|
49
49
|
import"./index-zgwm4ryv.js";
|
|
50
|
-
import"./index-
|
|
50
|
+
import"./index-f2y46pda.js";
|
|
51
51
|
import"./index-3x761jqv.js";
|
|
52
52
|
import"./index-7mkpsw6g.js";
|
|
53
53
|
import"./index-fsrp8wp3.js";
|
|
@@ -268,16 +268,24 @@ import {
|
|
|
268
268
|
} from "./index-zgwm4ryv.js";
|
|
269
269
|
import {
|
|
270
270
|
resolveCommitCountSince,
|
|
271
|
+
resolveCommitCountSinceAsync,
|
|
271
272
|
resolveCurrentGitHead,
|
|
273
|
+
resolveCurrentGitHeadAsync,
|
|
272
274
|
resolveCurrentUpstreamPushTarget,
|
|
275
|
+
resolveCurrentUpstreamPushTargetAsync,
|
|
273
276
|
resolveCurrentUpstreamRemoteRef,
|
|
274
277
|
resolveExactRemoteBranchHead,
|
|
278
|
+
resolveExactRemoteBranchHeadAsync,
|
|
275
279
|
resolveIsExactSingleChildCommit,
|
|
280
|
+
resolveIsExactSingleChildCommitAsync,
|
|
276
281
|
resolveIsWorkingTreeClean,
|
|
282
|
+
resolveIsWorkingTreeCleanAsync,
|
|
277
283
|
resolvePrReviewDiffStats,
|
|
284
|
+
resolvePrReviewDiffStatsAsync,
|
|
278
285
|
resolvePrWorkflowRevisionDigest,
|
|
279
|
-
resolveRemoteRefsContainingHead
|
|
280
|
-
|
|
286
|
+
resolveRemoteRefsContainingHead,
|
|
287
|
+
resolveRemoteRefsContainingHeadAsync
|
|
288
|
+
} from "./index-f2y46pda.js";
|
|
281
289
|
import {
|
|
282
290
|
atomicWriteFile
|
|
283
291
|
} from "./index-7mkpsw6g.js";
|
|
@@ -535,7 +543,7 @@ async function activatePrWorkflow(directory, sessionID, mode, options = {}) {
|
|
|
535
543
|
if (existing) {
|
|
536
544
|
throw new Error(`BLOCKED: session "${normalizedSessionID}" already has an active ${existing.mode} workflow; complete it before starting ${mode}`);
|
|
537
545
|
}
|
|
538
|
-
const initialHead = options.prHeadSha ? assertCurrentCheckoutHead(directory, options.prHeadSha) : undefined;
|
|
546
|
+
const initialHead = options.prHeadSha ? await assertCurrentCheckoutHead(directory, options.prHeadSha) : undefined;
|
|
539
547
|
const timestamp = isoNow();
|
|
540
548
|
const nextState = {
|
|
541
549
|
schemaVersion: GATE_SCHEMA_VERSION,
|
|
@@ -618,11 +626,11 @@ async function abortPrWorkflow(directory, sessionID, options = {}) {
|
|
|
618
626
|
async function bindPrWorkflowHead(directory, sessionID, prHeadSha) {
|
|
619
627
|
const state = await requireAnyActiveState(directory, sessionID);
|
|
620
628
|
const normalizedHead = normalizePrHeadSha(prHeadSha);
|
|
621
|
-
assertCurrentCheckoutHead(directory, normalizedHead);
|
|
629
|
+
await assertCurrentCheckoutHead(directory, normalizedHead);
|
|
622
630
|
if (!state.prHeadSha)
|
|
623
|
-
assertPrReviewCleanCheckout(directory, state.mode);
|
|
631
|
+
await assertPrReviewCleanCheckout(directory, state.mode);
|
|
624
632
|
if (!state.prHeadSha && state.mode === "PR_FEEDBACK") {
|
|
625
|
-
assertPrFeedbackTrackingCheckout(directory, normalizedHead);
|
|
633
|
+
await assertPrFeedbackTrackingCheckout(directory, normalizedHead);
|
|
626
634
|
}
|
|
627
635
|
if (state.prHeadSha && state.prHeadSha !== normalizedHead) {
|
|
628
636
|
throw new Error(`BLOCKED: active ${state.mode} workflow is bound to PR head "${state.prHeadSha}"; received "${normalizedHead}"`);
|
|
@@ -637,9 +645,9 @@ async function bindPrWorkflowHead(directory, sessionID, prHeadSha) {
|
|
|
637
645
|
await persistState(directory, nextState);
|
|
638
646
|
return nextState;
|
|
639
647
|
}
|
|
640
|
-
function assertCurrentCheckoutHead(directory, expectedHead) {
|
|
648
|
+
async function assertCurrentCheckoutHead(directory, expectedHead) {
|
|
641
649
|
const normalizedExpected = normalizePrHeadSha(expectedHead);
|
|
642
|
-
const currentHead = _test_exports.
|
|
650
|
+
const currentHead = (await _test_exports.resolveCurrentGitHeadAsync(directory))?.trim();
|
|
643
651
|
if (!currentHead) {
|
|
644
652
|
throw new Error(`BLOCKED: cannot resolve the current Git HEAD in "${directory}" to verify against PR head "${normalizedExpected}". ` + `This means Git could not resolve HEAD (the working directory may not be a Git repository, ` + `HEAD may be unborn, the commit object may be missing in a shallow clone, the Git binary may not be on PATH, ` + `or the bounded Git invocation may have timed out). ` + `Verify with: git -C "${directory}" rev-parse --verify HEAD^{commit}`);
|
|
645
653
|
}
|
|
@@ -648,17 +656,17 @@ function assertCurrentCheckoutHead(directory, expectedHead) {
|
|
|
648
656
|
}
|
|
649
657
|
return normalizedExpected;
|
|
650
658
|
}
|
|
651
|
-
function assertPrReviewCleanCheckout(directory, mode = "PR_REVIEW") {
|
|
652
|
-
if (_test_exports.
|
|
659
|
+
async function assertPrReviewCleanCheckout(directory, mode = "PR_REVIEW") {
|
|
660
|
+
if (await _test_exports.resolveIsWorkingTreeCleanAsync(directory) !== true) {
|
|
653
661
|
throw new Error(`BLOCKED: ${mode} requires a clean index and working tree at the exact PR head`);
|
|
654
662
|
}
|
|
655
663
|
}
|
|
656
|
-
function assertPrFeedbackTrackingCheckout(directory, prHeadSha) {
|
|
657
|
-
const upstream = _test_exports.
|
|
664
|
+
async function assertPrFeedbackTrackingCheckout(directory, prHeadSha) {
|
|
665
|
+
const upstream = await _test_exports.resolveCurrentUpstreamPushTargetAsync(directory);
|
|
658
666
|
if (!upstream) {
|
|
659
667
|
throw new Error("BLOCKED: PR_FEEDBACK requires a current local branch bound to an exact remote name, remote branch ref, and remote-tracking ref before the first head bind; detached or non-tracking checkouts are not allowed");
|
|
660
668
|
}
|
|
661
|
-
const matchingRemoteRefs = _test_exports.
|
|
669
|
+
const matchingRemoteRefs = await _test_exports.resolveRemoteRefsContainingHeadAsync(directory, prHeadSha);
|
|
662
670
|
if (!matchingRemoteRefs?.includes(upstream.remoteTrackingRef)) {
|
|
663
671
|
throw new Error(`BLOCKED: PR_FEEDBACK upstream "${upstream.remoteTrackingRef}" must point to the exact intake PR head "${prHeadSha}" before the first head bind`);
|
|
664
672
|
}
|
|
@@ -673,15 +681,23 @@ var _test_exports = {
|
|
|
673
681
|
},
|
|
674
682
|
beforeTerminalClear: undefined,
|
|
675
683
|
resolveCurrentGitHead,
|
|
684
|
+
resolveCurrentGitHeadAsync,
|
|
676
685
|
resolveCurrentUpstreamPushTarget,
|
|
686
|
+
resolveCurrentUpstreamPushTargetAsync,
|
|
677
687
|
resolveCurrentUpstreamRemoteRef,
|
|
678
688
|
resolveExactRemoteBranchHead,
|
|
689
|
+
resolveExactRemoteBranchHeadAsync,
|
|
679
690
|
resolveCommitCountSince,
|
|
691
|
+
resolveCommitCountSinceAsync,
|
|
680
692
|
resolveIsWorkingTreeClean,
|
|
693
|
+
resolveIsWorkingTreeCleanAsync,
|
|
681
694
|
resolveIsExactSingleChildCommit,
|
|
695
|
+
resolveIsExactSingleChildCommitAsync,
|
|
682
696
|
resolvePrReviewDiffStats,
|
|
697
|
+
resolvePrReviewDiffStatsAsync,
|
|
683
698
|
resolvePrWorkflowRevisionDigest,
|
|
684
699
|
resolveRemoteRefsContainingHead,
|
|
700
|
+
resolveRemoteRefsContainingHeadAsync,
|
|
685
701
|
parseCriticVerdict,
|
|
686
702
|
isProcessAlive,
|
|
687
703
|
rename: fsp.rename,
|
|
@@ -15573,11 +15589,11 @@ var _internals19 = {
|
|
|
15573
15589
|
}
|
|
15574
15590
|
},
|
|
15575
15591
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
15576
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
15592
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-gay2gz5p.js");
|
|
15577
15593
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
15578
15594
|
},
|
|
15579
15595
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
15580
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
15596
|
+
const { checkHivePromotions } = await import("./hive-promoter-3j6xp8gm.js");
|
|
15581
15597
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
15582
15598
|
},
|
|
15583
15599
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -23482,8 +23498,8 @@ var _internals32 = {
|
|
|
23482
23498
|
loadCuratorDeps: async () => {
|
|
23483
23499
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
23484
23500
|
import("./schema-2x7wsb0n.js"),
|
|
23485
|
-
import("./curator-
|
|
23486
|
-
import("./curator-llm-factory-
|
|
23501
|
+
import("./curator-gay2gz5p.js"),
|
|
23502
|
+
import("./curator-llm-factory-90803y01.js")
|
|
23487
23503
|
]);
|
|
23488
23504
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
23489
23505
|
}
|
|
@@ -23982,7 +23998,7 @@ import { fileURLToPath } from "url";
|
|
|
23982
23998
|
// package.json
|
|
23983
23999
|
var package_default = {
|
|
23984
24000
|
name: "opencode-swarm",
|
|
23985
|
-
version: "7.129.
|
|
24001
|
+
version: "7.129.3",
|
|
23986
24002
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
23987
24003
|
main: "dist/index.js",
|
|
23988
24004
|
types: "dist/index.d.ts",
|
|
@@ -44374,7 +44390,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
44374
44390
|
async function handleHelpCommand(ctx) {
|
|
44375
44391
|
const targetCommand = ctx.args.join(" ");
|
|
44376
44392
|
if (!targetCommand) {
|
|
44377
|
-
const { buildHelpText } = await import("./index-
|
|
44393
|
+
const { buildHelpText } = await import("./index-vjmmzhv0.js");
|
|
44378
44394
|
return buildHelpText();
|
|
44379
44395
|
}
|
|
44380
44396
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -44383,7 +44399,7 @@ async function handleHelpCommand(ctx) {
|
|
|
44383
44399
|
return _internals9.buildDetailedHelp(resolved.key, resolved.entry);
|
|
44384
44400
|
}
|
|
44385
44401
|
const similar = _internals9.findSimilarCommands(targetCommand);
|
|
44386
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
44402
|
+
const { buildHelpText: fullHelp } = await import("./index-vjmmzhv0.js");
|
|
44387
44403
|
if (similar.length > 0) {
|
|
44388
44404
|
return `Command '/swarm ${targetCommand}' not found.
|
|
44389
44405
|
|
|
@@ -44522,7 +44538,7 @@ var COMMAND_REGISTRY = {
|
|
|
44522
44538
|
},
|
|
44523
44539
|
"guardrail explain": {
|
|
44524
44540
|
handler: async (ctx) => {
|
|
44525
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
44541
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-axvx94rx.js");
|
|
44526
44542
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
44527
44543
|
},
|
|
44528
44544
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -44532,7 +44548,7 @@ var COMMAND_REGISTRY = {
|
|
|
44532
44548
|
},
|
|
44533
44549
|
"guardrail-explain": {
|
|
44534
44550
|
handler: async (ctx) => {
|
|
44535
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
44551
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-axvx94rx.js");
|
|
44536
44552
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
44537
44553
|
},
|
|
44538
44554
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -86,12 +86,30 @@ function readGitTextAtRevision(directory, revision, relativePath) {
|
|
|
86
86
|
function resolveCurrentGitHead(directory) {
|
|
87
87
|
return runGit(directory, ["rev-parse", "--verify", "HEAD^{commit}"]);
|
|
88
88
|
}
|
|
89
|
+
async function resolveCurrentGitHeadAsync(directory) {
|
|
90
|
+
return await runGitAsync(directory, [
|
|
91
|
+
"rev-parse",
|
|
92
|
+
"--verify",
|
|
93
|
+
"HEAD^{commit}"
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
89
96
|
function resolveExactMergeBase(directory, baseRef, prHeadSha) {
|
|
90
97
|
if (!isSafeGitRevisionToken(baseRef) || !isSafeGitRevisionToken(prHeadSha))
|
|
91
98
|
return null;
|
|
92
99
|
const mergeBase = runGit(directory, ["merge-base", "--", baseRef, prHeadSha]);
|
|
93
100
|
return mergeBase && /^[0-9a-f]{6,64}$/i.test(mergeBase) ? mergeBase : null;
|
|
94
101
|
}
|
|
102
|
+
async function resolveExactMergeBaseAsync(directory, baseRef, prHeadSha) {
|
|
103
|
+
if (!isSafeGitRevisionToken(baseRef) || !isSafeGitRevisionToken(prHeadSha))
|
|
104
|
+
return null;
|
|
105
|
+
const mergeBase = await runGitAsync(directory, [
|
|
106
|
+
"merge-base",
|
|
107
|
+
"--",
|
|
108
|
+
baseRef,
|
|
109
|
+
prHeadSha
|
|
110
|
+
]);
|
|
111
|
+
return mergeBase && /^[0-9a-f]{6,64}$/i.test(mergeBase) ? mergeBase : null;
|
|
112
|
+
}
|
|
95
113
|
var GITLINK_MODE_PATTERN = /^:\d{6} 160000 |^:160000 \d{6} /;
|
|
96
114
|
function resolvePrReviewDiffStats(directory, baseSha, prHeadSha) {
|
|
97
115
|
if (!isSafeGitRevisionToken(baseSha) || !isSafeGitRevisionToken(prHeadSha))
|
|
@@ -129,6 +147,42 @@ function resolvePrReviewDiffStats(directory, baseSha, prHeadSha) {
|
|
|
129
147
|
`).some((line) => GITLINK_MODE_PATTERN.test(line.trim()));
|
|
130
148
|
return { changedLines, changedFiles, hasSubmoduleChange };
|
|
131
149
|
}
|
|
150
|
+
async function resolvePrReviewDiffStatsAsync(directory, baseSha, prHeadSha) {
|
|
151
|
+
if (!isSafeGitRevisionToken(baseSha) || !isSafeGitRevisionToken(prHeadSha))
|
|
152
|
+
return null;
|
|
153
|
+
const range = `${baseSha}...${prHeadSha}`;
|
|
154
|
+
const output = await runGitAsync(directory, [
|
|
155
|
+
"diff",
|
|
156
|
+
"--no-renames",
|
|
157
|
+
"--numstat",
|
|
158
|
+
range
|
|
159
|
+
]);
|
|
160
|
+
if (output === null)
|
|
161
|
+
return null;
|
|
162
|
+
let changedLines = 0;
|
|
163
|
+
let changedFiles = 0;
|
|
164
|
+
for (const line of output.split(`
|
|
165
|
+
`)) {
|
|
166
|
+
const trimmed = line.trim();
|
|
167
|
+
if (trimmed.length === 0)
|
|
168
|
+
continue;
|
|
169
|
+
const fields = trimmed.split("\t");
|
|
170
|
+
if (fields.length < 3)
|
|
171
|
+
return null;
|
|
172
|
+
const added = fields[0] === "-" ? 0 : Number.parseInt(fields[0], 10);
|
|
173
|
+
const deleted = fields[1] === "-" ? 0 : Number.parseInt(fields[1], 10);
|
|
174
|
+
if (Number.isNaN(added) || Number.isNaN(deleted))
|
|
175
|
+
return null;
|
|
176
|
+
changedFiles += 1;
|
|
177
|
+
changedLines += added + deleted;
|
|
178
|
+
}
|
|
179
|
+
const rawOutput = await runGitAsync(directory, ["diff", "--raw", range]);
|
|
180
|
+
if (rawOutput === null)
|
|
181
|
+
return null;
|
|
182
|
+
const hasSubmoduleChange = rawOutput.split(`
|
|
183
|
+
`).some((line) => GITLINK_MODE_PATTERN.test(line.trim()));
|
|
184
|
+
return { changedLines, changedFiles, hasSubmoduleChange };
|
|
185
|
+
}
|
|
132
186
|
function isSafeGitRevisionToken(value) {
|
|
133
187
|
return /^(?!-)[A-Za-z0-9][A-Za-z0-9._/-]{0,255}$/.test(value) && !value.includes("..") && !value.includes("//") && !value.includes("@{");
|
|
134
188
|
}
|
|
@@ -160,6 +214,27 @@ function resolveCurrentUpstreamPushTarget(directory) {
|
|
|
160
214
|
}
|
|
161
215
|
return { remoteName, remoteBranchRef, remoteTrackingRef };
|
|
162
216
|
}
|
|
217
|
+
async function resolveCurrentUpstreamPushTargetAsync(directory) {
|
|
218
|
+
const localBranchRef = await runGitAsync(directory, [
|
|
219
|
+
"symbolic-ref",
|
|
220
|
+
"--quiet",
|
|
221
|
+
"HEAD"
|
|
222
|
+
]);
|
|
223
|
+
if (!localBranchRef?.startsWith("refs/heads/"))
|
|
224
|
+
return null;
|
|
225
|
+
const encoded = await runGitAsync(directory, [
|
|
226
|
+
"for-each-ref",
|
|
227
|
+
"--format=%(upstream:remotename)%00%(upstream:remoteref)%00%(upstream)",
|
|
228
|
+
localBranchRef
|
|
229
|
+
]);
|
|
230
|
+
if (!encoded)
|
|
231
|
+
return null;
|
|
232
|
+
const [remoteName, remoteBranchRef, remoteTrackingRef, ...extras] = encoded.split("\x00");
|
|
233
|
+
if (extras.length > 0 || !remoteName || remoteName.startsWith("-") || /[\s;&|<>`]/.test(remoteName) || !remoteBranchRef?.startsWith("refs/heads/") || remoteBranchRef === "refs/heads/" || /[\s;&|<>`]/.test(remoteBranchRef) || !remoteTrackingRef?.startsWith("refs/remotes/") || remoteTrackingRef.endsWith("/HEAD")) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
return { remoteName, remoteBranchRef, remoteTrackingRef };
|
|
237
|
+
}
|
|
163
238
|
function resolveExactRemoteBranchHead(directory, remoteName, remoteBranchRef) {
|
|
164
239
|
if (!remoteName || remoteName.startsWith("-") || /[\s;&|<>`]/.test(remoteName) || !remoteBranchRef.startsWith("refs/heads/") || remoteBranchRef === "refs/heads/" || /[\s;&|<>`]/.test(remoteBranchRef)) {
|
|
165
240
|
return null;
|
|
@@ -176,6 +251,22 @@ function resolveExactRemoteBranchHead(directory, remoteName, remoteBranchRef) {
|
|
|
176
251
|
}
|
|
177
252
|
return objectName;
|
|
178
253
|
}
|
|
254
|
+
async function resolveExactRemoteBranchHeadAsync(directory, remoteName, remoteBranchRef) {
|
|
255
|
+
if (!remoteName || remoteName.startsWith("-") || /[\s;&|<>`]/.test(remoteName) || !remoteBranchRef.startsWith("refs/heads/") || remoteBranchRef === "refs/heads/" || /[\s;&|<>`]/.test(remoteBranchRef)) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
const output = await runGitAsync(directory, ["ls-remote", "--exit-code", "--heads", remoteName, remoteBranchRef], 20000);
|
|
259
|
+
if (!output)
|
|
260
|
+
return null;
|
|
261
|
+
const rows = output.split(/\r?\n/).filter(Boolean);
|
|
262
|
+
if (rows.length !== 1)
|
|
263
|
+
return null;
|
|
264
|
+
const [objectName, refName, ...extras] = rows[0].split(/\s+/);
|
|
265
|
+
if (extras.length > 0 || refName !== remoteBranchRef || !objectName || !(/^[0-9a-f]{40}$/i.test(objectName) || /^[0-9a-f]{64}$/i.test(objectName))) {
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
return objectName;
|
|
269
|
+
}
|
|
179
270
|
function resolveGitControlStateDigest(directory) {
|
|
180
271
|
const head = runGit(directory, ["rev-parse", "--verify", "HEAD^{commit}"]);
|
|
181
272
|
const symbolicHead = runGit(directory, ["symbolic-ref", "--quiet", "HEAD"]);
|
|
@@ -200,6 +291,38 @@ function resolveGitControlStateDigest(directory) {
|
|
|
200
291
|
}
|
|
201
292
|
return digest(`head\x00${head}\x00symbolic\x00${symbolicHead}\x00upstream\x00${upstream.remoteName}\x00${upstream.remoteBranchRef}\x00${upstream.remoteTrackingRef}\x00refs\x00${refs}\x00config\x00${config}\x00index\x00${index}`);
|
|
202
293
|
}
|
|
294
|
+
async function resolveGitControlStateDigestAsync(directory) {
|
|
295
|
+
const head = await runGitAsync(directory, [
|
|
296
|
+
"rev-parse",
|
|
297
|
+
"--verify",
|
|
298
|
+
"HEAD^{commit}"
|
|
299
|
+
]);
|
|
300
|
+
const symbolicHead = await runGitAsync(directory, [
|
|
301
|
+
"symbolic-ref",
|
|
302
|
+
"--quiet",
|
|
303
|
+
"HEAD"
|
|
304
|
+
]);
|
|
305
|
+
const upstream = await resolveCurrentUpstreamPushTargetAsync(directory);
|
|
306
|
+
const refs = await runGitAsync(directory, [
|
|
307
|
+
"for-each-ref",
|
|
308
|
+
"--format=%(refname)%00%(objectname)",
|
|
309
|
+
"refs/heads",
|
|
310
|
+
"refs/remotes",
|
|
311
|
+
"refs/tags"
|
|
312
|
+
]);
|
|
313
|
+
const config = await runGitAsync(directory, [
|
|
314
|
+
"config",
|
|
315
|
+
"--null",
|
|
316
|
+
"--show-origin",
|
|
317
|
+
"--show-scope",
|
|
318
|
+
"--list"
|
|
319
|
+
]);
|
|
320
|
+
const index = await runGitAsync(directory, ["ls-files", "--stage", "-z"]);
|
|
321
|
+
if (head === null || symbolicHead === null || !upstream || refs === null || config === null || index === null) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
return digest(`head\x00${head}\x00symbolic\x00${symbolicHead}\x00upstream\x00${upstream.remoteName}\x00${upstream.remoteBranchRef}\x00${upstream.remoteTrackingRef}\x00refs\x00${refs}\x00config\x00${config}\x00index\x00${index}`);
|
|
325
|
+
}
|
|
203
326
|
function resolveIsWorkingTreeClean(directory) {
|
|
204
327
|
const status = runGit(directory, [
|
|
205
328
|
"status",
|
|
@@ -208,6 +331,14 @@ function resolveIsWorkingTreeClean(directory) {
|
|
|
208
331
|
]);
|
|
209
332
|
return status === null ? null : status.length === 0;
|
|
210
333
|
}
|
|
334
|
+
async function resolveIsWorkingTreeCleanAsync(directory) {
|
|
335
|
+
const status = await runGitAsync(directory, [
|
|
336
|
+
"status",
|
|
337
|
+
"--porcelain=v1",
|
|
338
|
+
"--untracked-files=all"
|
|
339
|
+
]);
|
|
340
|
+
return status === null ? null : status.length === 0;
|
|
341
|
+
}
|
|
211
342
|
function resolveCommitCountSince(directory, baseHeadSha, currentHeadSha) {
|
|
212
343
|
const output = runGit(directory, [
|
|
213
344
|
"rev-list",
|
|
@@ -220,6 +351,18 @@ function resolveCommitCountSince(directory, baseHeadSha, currentHeadSha) {
|
|
|
220
351
|
const count = Number(output);
|
|
221
352
|
return Number.isSafeInteger(count) ? count : null;
|
|
222
353
|
}
|
|
354
|
+
async function resolveCommitCountSinceAsync(directory, baseHeadSha, currentHeadSha) {
|
|
355
|
+
const output = await runGitAsync(directory, [
|
|
356
|
+
"rev-list",
|
|
357
|
+
"--count",
|
|
358
|
+
"--ancestry-path",
|
|
359
|
+
`${baseHeadSha}..${currentHeadSha}`
|
|
360
|
+
]);
|
|
361
|
+
if (!output || !/^\d+$/.test(output))
|
|
362
|
+
return null;
|
|
363
|
+
const count = Number(output);
|
|
364
|
+
return Number.isSafeInteger(count) ? count : null;
|
|
365
|
+
}
|
|
223
366
|
function resolveIsExactSingleChildCommit(directory, baseHeadSha, currentHeadSha) {
|
|
224
367
|
const base = runGit(directory, [
|
|
225
368
|
"rev-parse",
|
|
@@ -245,6 +388,31 @@ function resolveIsExactSingleChildCommit(directory, baseHeadSha, currentHeadSha)
|
|
|
245
388
|
const fields = commitAndParents.trim().split(/\s+/);
|
|
246
389
|
return fields.length === 2 && fields[0]?.toLowerCase() === current.toLowerCase() && fields[1]?.toLowerCase() === base.toLowerCase();
|
|
247
390
|
}
|
|
391
|
+
async function resolveIsExactSingleChildCommitAsync(directory, baseHeadSha, currentHeadSha) {
|
|
392
|
+
const base = await runGitAsync(directory, [
|
|
393
|
+
"rev-parse",
|
|
394
|
+
"--verify",
|
|
395
|
+
`${baseHeadSha}^{commit}`
|
|
396
|
+
]);
|
|
397
|
+
const current = await runGitAsync(directory, [
|
|
398
|
+
"rev-parse",
|
|
399
|
+
"--verify",
|
|
400
|
+
`${currentHeadSha}^{commit}`
|
|
401
|
+
]);
|
|
402
|
+
if (!base || !current)
|
|
403
|
+
return null;
|
|
404
|
+
const commitAndParents = await runGitAsync(directory, [
|
|
405
|
+
"rev-list",
|
|
406
|
+
"--parents",
|
|
407
|
+
"-n",
|
|
408
|
+
"1",
|
|
409
|
+
current
|
|
410
|
+
]);
|
|
411
|
+
if (commitAndParents === null)
|
|
412
|
+
return null;
|
|
413
|
+
const fields = commitAndParents.trim().split(/\s+/);
|
|
414
|
+
return fields.length === 2 && fields[0]?.toLowerCase() === current.toLowerCase() && fields[1]?.toLowerCase() === base.toLowerCase();
|
|
415
|
+
}
|
|
248
416
|
function resolveRemoteRefsContainingHead(directory, headSha) {
|
|
249
417
|
const output = runGit(directory, [
|
|
250
418
|
"for-each-ref",
|
|
@@ -255,6 +423,16 @@ function resolveRemoteRefsContainingHead(directory, headSha) {
|
|
|
255
423
|
return null;
|
|
256
424
|
return output.split(/\r?\n/).map((line) => line.trim().split("\t")).filter(([ref, objectName]) => ref?.startsWith("refs/remotes/") && !ref.endsWith("/HEAD") && objectName?.toLowerCase() === headSha.toLowerCase()).map(([ref]) => ref);
|
|
257
425
|
}
|
|
426
|
+
async function resolveRemoteRefsContainingHeadAsync(directory, headSha) {
|
|
427
|
+
const output = await runGitAsync(directory, [
|
|
428
|
+
"for-each-ref",
|
|
429
|
+
"--format=%(refname)%09%(objectname)",
|
|
430
|
+
"refs/remotes"
|
|
431
|
+
]);
|
|
432
|
+
if (output === null)
|
|
433
|
+
return null;
|
|
434
|
+
return output.split(/\r?\n/).map((line) => line.trim().split("\t")).filter(([ref, objectName]) => ref?.startsWith("refs/remotes/") && !ref.endsWith("/HEAD") && objectName?.toLowerCase() === headSha.toLowerCase()).map(([ref]) => ref);
|
|
435
|
+
}
|
|
258
436
|
function resolvePrWorkflowRevisionDigest(directory, baseHeadSha) {
|
|
259
437
|
const projectRoot = path.resolve(directory);
|
|
260
438
|
const baseHead = runGit(projectRoot, [
|
|
@@ -598,4 +776,4 @@ var _internals = {
|
|
|
598
776
|
parsePorcelainV2Snapshot
|
|
599
777
|
};
|
|
600
778
|
|
|
601
|
-
export { readGitTextAtRevision, resolveCurrentGitHead, resolveExactMergeBase, resolvePrReviewDiffStats, resolveCurrentUpstreamRemoteRef, resolveCurrentUpstreamPushTarget, resolveExactRemoteBranchHead, resolveGitControlStateDigest, resolveIsWorkingTreeClean, resolveCommitCountSince, resolveIsExactSingleChildCommit, resolveRemoteRefsContainingHead, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestAsync, parsePorcelainPaths, captureWorkspaceSnapshot, changedFilesSinceSnapshot, workspaceSnapshotMatches, compareWorkspaceSnapshot, compareWorkspaceSnapshots, digest, _internals };
|
|
779
|
+
export { readGitTextAtRevision, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveExactMergeBase, resolveExactMergeBaseAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolveCurrentUpstreamRemoteRef, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveGitControlStateDigest, resolveGitControlStateDigestAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolveCommitCountSince, resolveCommitCountSinceAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync, resolvePrWorkflowRevisionDigest, resolvePrWorkflowRevisionDigestAsync, parsePorcelainPaths, captureWorkspaceSnapshot, changedFilesSinceSnapshot, workspaceSnapshotMatches, compareWorkspaceSnapshot, compareWorkspaceSnapshots, digest, _internals };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-509jpmdd.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
7
|
} from "./index-8etcyr9r.js";
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
handleWriteRetroCommand,
|
|
84
84
|
normalizeSwarmCommandInput,
|
|
85
85
|
resolveCommand
|
|
86
|
-
} from "./index-
|
|
86
|
+
} from "./index-9vbpy8f9.js";
|
|
87
87
|
import"./index-v4n224r1.js";
|
|
88
88
|
import"./index-cpssctv1.js";
|
|
89
89
|
import"./index-kzvwb2se.js";
|
|
@@ -127,7 +127,7 @@ import"./index-s80bsjkj.js";
|
|
|
127
127
|
import"./index-z6xqpmqg.js";
|
|
128
128
|
import"./index-zjygnfay.js";
|
|
129
129
|
import"./index-zgwm4ryv.js";
|
|
130
|
-
import"./index-
|
|
130
|
+
import"./index-f2y46pda.js";
|
|
131
131
|
import"./index-3x761jqv.js";
|
|
132
132
|
import"./index-7mkpsw6g.js";
|
|
133
133
|
import"./index-fsrp8wp3.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getPluginLockFilePaths,
|
|
8
8
|
package_default,
|
|
9
9
|
resolveCommand
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-9vbpy8f9.js";
|
|
11
11
|
import"./index-v4n224r1.js";
|
|
12
12
|
import"./index-cpssctv1.js";
|
|
13
13
|
import"./index-kzvwb2se.js";
|
|
@@ -48,7 +48,7 @@ import"./index-s80bsjkj.js";
|
|
|
48
48
|
import"./index-z6xqpmqg.js";
|
|
49
49
|
import"./index-zjygnfay.js";
|
|
50
50
|
import"./index-zgwm4ryv.js";
|
|
51
|
-
import"./index-
|
|
51
|
+
import"./index-f2y46pda.js";
|
|
52
52
|
import"./index-3x761jqv.js";
|
|
53
53
|
import"./index-7mkpsw6g.js";
|
|
54
54
|
import"./index-fsrp8wp3.js";
|