opencode-swarm 7.129.1 → 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.
@@ -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-gczs3jy7.js";
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-40zn444p.js";
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-gczs3jy7.js";
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-40zn444p.js";
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-ty0xttaz.js";
5
- import"./index-gczs3jy7.js";
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-40zn444p.js";
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-gczs3jy7.js";
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-40zn444p.js";
50
+ import"./index-f2y46pda.js";
51
51
  import"./index-3x761jqv.js";
52
52
  import"./index-7mkpsw6g.js";
53
53
  import"./index-fsrp8wp3.js";
@@ -12,7 +12,7 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-gczs3jy7.js";
15
+ } from "./index-9vbpy8f9.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
@@ -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
- } from "./index-40zn444p.js";
286
+ resolveRemoteRefsContainingHead,
287
+ resolveRemoteRefsContainingHeadAsync
288
+ } from "./index-f2y46pda.js";
281
289
  import {
282
290
  atomicWriteFile
283
291
  } from "./index-7mkpsw6g.js";
@@ -361,11 +369,29 @@ var PR_REVIEW_BASE_DIMENSION_IDS = [
361
369
  "reliability-performance",
362
370
  "compatibility-delivery"
363
371
  ];
372
+ var PR_REVIEW_REQUIRED_MICRO_LANE_IDS = [
373
+ "auth-identity-secrets",
374
+ "untrusted-input-boundaries",
375
+ "subprocess-platform",
376
+ "concurrency-state",
377
+ "dependencies-build-release",
378
+ "api-schema-migrations",
379
+ "test-infrastructure",
380
+ "ui-accessibility-i18n",
381
+ "privacy-observability",
382
+ "generated-provenance",
383
+ "unclassified-risk"
384
+ ];
364
385
  var PR_REVIEW_BASE_LANE_FLOORS = {
365
386
  S: 1,
366
387
  M: 3,
367
388
  L: PR_REVIEW_BASE_DIMENSION_IDS.length
368
389
  };
390
+ var PR_REVIEW_MICRO_LANE_FLOORS = {
391
+ S: 1,
392
+ M: 6,
393
+ L: PR_REVIEW_REQUIRED_MICRO_LANE_IDS.length
394
+ };
369
395
  var GATE_SCHEMA_VERSION = 1;
370
396
  var MAX_TRACKED_SESSIONS = 200;
371
397
  var MAX_WORKFLOW_BATCHES = 128;
@@ -517,7 +543,7 @@ async function activatePrWorkflow(directory, sessionID, mode, options = {}) {
517
543
  if (existing) {
518
544
  throw new Error(`BLOCKED: session "${normalizedSessionID}" already has an active ${existing.mode} workflow; complete it before starting ${mode}`);
519
545
  }
520
- const initialHead = options.prHeadSha ? assertCurrentCheckoutHead(directory, options.prHeadSha) : undefined;
546
+ const initialHead = options.prHeadSha ? await assertCurrentCheckoutHead(directory, options.prHeadSha) : undefined;
521
547
  const timestamp = isoNow();
522
548
  const nextState = {
523
549
  schemaVersion: GATE_SCHEMA_VERSION,
@@ -600,11 +626,11 @@ async function abortPrWorkflow(directory, sessionID, options = {}) {
600
626
  async function bindPrWorkflowHead(directory, sessionID, prHeadSha) {
601
627
  const state = await requireAnyActiveState(directory, sessionID);
602
628
  const normalizedHead = normalizePrHeadSha(prHeadSha);
603
- assertCurrentCheckoutHead(directory, normalizedHead);
629
+ await assertCurrentCheckoutHead(directory, normalizedHead);
604
630
  if (!state.prHeadSha)
605
- assertPrReviewCleanCheckout(directory, state.mode);
631
+ await assertPrReviewCleanCheckout(directory, state.mode);
606
632
  if (!state.prHeadSha && state.mode === "PR_FEEDBACK") {
607
- assertPrFeedbackTrackingCheckout(directory, normalizedHead);
633
+ await assertPrFeedbackTrackingCheckout(directory, normalizedHead);
608
634
  }
609
635
  if (state.prHeadSha && state.prHeadSha !== normalizedHead) {
610
636
  throw new Error(`BLOCKED: active ${state.mode} workflow is bound to PR head "${state.prHeadSha}"; received "${normalizedHead}"`);
@@ -619,9 +645,9 @@ async function bindPrWorkflowHead(directory, sessionID, prHeadSha) {
619
645
  await persistState(directory, nextState);
620
646
  return nextState;
621
647
  }
622
- function assertCurrentCheckoutHead(directory, expectedHead) {
648
+ async function assertCurrentCheckoutHead(directory, expectedHead) {
623
649
  const normalizedExpected = normalizePrHeadSha(expectedHead);
624
- const currentHead = _test_exports.resolveCurrentGitHead(directory)?.trim();
650
+ const currentHead = (await _test_exports.resolveCurrentGitHeadAsync(directory))?.trim();
625
651
  if (!currentHead) {
626
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}`);
627
653
  }
@@ -630,17 +656,17 @@ function assertCurrentCheckoutHead(directory, expectedHead) {
630
656
  }
631
657
  return normalizedExpected;
632
658
  }
633
- function assertPrReviewCleanCheckout(directory, mode = "PR_REVIEW") {
634
- if (_test_exports.resolveIsWorkingTreeClean(directory) !== true) {
659
+ async function assertPrReviewCleanCheckout(directory, mode = "PR_REVIEW") {
660
+ if (await _test_exports.resolveIsWorkingTreeCleanAsync(directory) !== true) {
635
661
  throw new Error(`BLOCKED: ${mode} requires a clean index and working tree at the exact PR head`);
636
662
  }
637
663
  }
638
- function assertPrFeedbackTrackingCheckout(directory, prHeadSha) {
639
- const upstream = _test_exports.resolveCurrentUpstreamPushTarget(directory);
664
+ async function assertPrFeedbackTrackingCheckout(directory, prHeadSha) {
665
+ const upstream = await _test_exports.resolveCurrentUpstreamPushTargetAsync(directory);
640
666
  if (!upstream) {
641
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");
642
668
  }
643
- const matchingRemoteRefs = _test_exports.resolveRemoteRefsContainingHead(directory, prHeadSha);
669
+ const matchingRemoteRefs = await _test_exports.resolveRemoteRefsContainingHeadAsync(directory, prHeadSha);
644
670
  if (!matchingRemoteRefs?.includes(upstream.remoteTrackingRef)) {
645
671
  throw new Error(`BLOCKED: PR_FEEDBACK upstream "${upstream.remoteTrackingRef}" must point to the exact intake PR head "${prHeadSha}" before the first head bind`);
646
672
  }
@@ -655,15 +681,23 @@ var _test_exports = {
655
681
  },
656
682
  beforeTerminalClear: undefined,
657
683
  resolveCurrentGitHead,
684
+ resolveCurrentGitHeadAsync,
658
685
  resolveCurrentUpstreamPushTarget,
686
+ resolveCurrentUpstreamPushTargetAsync,
659
687
  resolveCurrentUpstreamRemoteRef,
660
688
  resolveExactRemoteBranchHead,
689
+ resolveExactRemoteBranchHeadAsync,
661
690
  resolveCommitCountSince,
691
+ resolveCommitCountSinceAsync,
662
692
  resolveIsWorkingTreeClean,
693
+ resolveIsWorkingTreeCleanAsync,
663
694
  resolveIsExactSingleChildCommit,
695
+ resolveIsExactSingleChildCommitAsync,
664
696
  resolvePrReviewDiffStats,
697
+ resolvePrReviewDiffStatsAsync,
665
698
  resolvePrWorkflowRevisionDigest,
666
699
  resolveRemoteRefsContainingHead,
700
+ resolveRemoteRefsContainingHeadAsync,
667
701
  parseCriticVerdict,
668
702
  isProcessAlive,
669
703
  rename: fsp.rename,
@@ -15555,11 +15589,11 @@ var _internals19 = {
15555
15589
  }
15556
15590
  },
15557
15591
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
15558
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-2nhjd2mn.js");
15592
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-gay2gz5p.js");
15559
15593
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
15560
15594
  },
15561
15595
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
15562
- const { checkHivePromotions } = await import("./hive-promoter-va29r2p0.js");
15596
+ const { checkHivePromotions } = await import("./hive-promoter-3j6xp8gm.js");
15563
15597
  return checkHivePromotions(entries, knowledgeConfig, directory);
15564
15598
  },
15565
15599
  applyProposalTriage: async (directory, triage) => {
@@ -23464,8 +23498,8 @@ var _internals32 = {
23464
23498
  loadCuratorDeps: async () => {
23465
23499
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
23466
23500
  import("./schema-2x7wsb0n.js"),
23467
- import("./curator-2nhjd2mn.js"),
23468
- import("./curator-llm-factory-xbstvmpx.js")
23501
+ import("./curator-gay2gz5p.js"),
23502
+ import("./curator-llm-factory-90803y01.js")
23469
23503
  ]);
23470
23504
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
23471
23505
  }
@@ -23964,7 +23998,7 @@ import { fileURLToPath } from "url";
23964
23998
  // package.json
23965
23999
  var package_default = {
23966
24000
  name: "opencode-swarm",
23967
- version: "7.129.1",
24001
+ version: "7.129.3",
23968
24002
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
23969
24003
  main: "dist/index.js",
23970
24004
  types: "dist/index.d.ts",
@@ -44356,7 +44390,7 @@ function buildDetailedHelp(commandName, entry) {
44356
44390
  async function handleHelpCommand(ctx) {
44357
44391
  const targetCommand = ctx.args.join(" ");
44358
44392
  if (!targetCommand) {
44359
- const { buildHelpText } = await import("./index-3yd6bbnp.js");
44393
+ const { buildHelpText } = await import("./index-vjmmzhv0.js");
44360
44394
  return buildHelpText();
44361
44395
  }
44362
44396
  const tokens = targetCommand.split(/\s+/);
@@ -44365,7 +44399,7 @@ async function handleHelpCommand(ctx) {
44365
44399
  return _internals9.buildDetailedHelp(resolved.key, resolved.entry);
44366
44400
  }
44367
44401
  const similar = _internals9.findSimilarCommands(targetCommand);
44368
- const { buildHelpText: fullHelp } = await import("./index-3yd6bbnp.js");
44402
+ const { buildHelpText: fullHelp } = await import("./index-vjmmzhv0.js");
44369
44403
  if (similar.length > 0) {
44370
44404
  return `Command '/swarm ${targetCommand}' not found.
44371
44405
 
@@ -44504,7 +44538,7 @@ var COMMAND_REGISTRY = {
44504
44538
  },
44505
44539
  "guardrail explain": {
44506
44540
  handler: async (ctx) => {
44507
- const { handleGuardrailExplain } = await import("./guardrail-explain-87wprr65.js");
44541
+ const { handleGuardrailExplain } = await import("./guardrail-explain-axvx94rx.js");
44508
44542
  return handleGuardrailExplain(ctx.directory, ctx.args);
44509
44543
  },
44510
44544
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -44514,7 +44548,7 @@ var COMMAND_REGISTRY = {
44514
44548
  },
44515
44549
  "guardrail-explain": {
44516
44550
  handler: async (ctx) => {
44517
- const { handleGuardrailExplain } = await import("./guardrail-explain-87wprr65.js");
44551
+ const { handleGuardrailExplain } = await import("./guardrail-explain-axvx94rx.js");
44518
44552
  return handleGuardrailExplain(ctx.directory, ctx.args);
44519
44553
  },
44520
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-ty0xttaz.js";
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-gczs3jy7.js";
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-40zn444p.js";
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-gczs3jy7.js";
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-40zn444p.js";
51
+ import"./index-f2y46pda.js";
52
52
  import"./index-3x761jqv.js";
53
53
  import"./index-7mkpsw6g.js";
54
54
  import"./index-fsrp8wp3.js";