opencode-swarm 7.110.2 → 7.112.0
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/.opencode/skills/ci-failure-batching/SKILL.md +6 -9
- package/.opencode/skills/gate-attribution/SKILL.md +24 -7
- package/.opencode/skills/merge-queue-readiness/SKILL.md +21 -7
- package/.opencode/skills/skill-edit-validation/SKILL.md +10 -3
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -0
- package/.opencode/skills/worktree-retry-cleanup/SKILL.md +7 -11
- package/dist/background/pr-event-subscribers.d.ts +28 -0
- package/dist/background/pr-monitor-worker.d.ts +8 -1
- package/dist/background/pr-subscriptions.d.ts +6 -0
- package/dist/cli/{config-doctor-q5e9yzn6.js → config-doctor-mmw4c50z.js} +2 -2
- package/dist/cli/{core-gjac7vd9.js → core-f4cbabe7.js} +2 -2
- package/dist/cli/{curator-drift-169wgaxn.js → curator-drift-jvs1v6em.js} +2 -2
- package/dist/cli/{curator-qpgdv0fp.js → curator-j7ty8k6t.js} +19 -19
- package/dist/cli/curator-llm-factory-8rnk2083.js +40 -0
- package/dist/cli/{dispatch-zr1xja4t.js → dispatch-wst7bypk.js} +2 -2
- package/dist/cli/{evidence-summary-service-8tasw2tt.js → evidence-summary-service-j6fnsfeq.js} +5 -5
- package/dist/cli/{gate-evidence-v6ds8rcp.js → gate-evidence-mk0ss1re.js} +3 -3
- package/dist/cli/guardrail-explain-2j0gw8f0.js +41 -0
- package/dist/cli/{guardrail-log-973nan7m.js → guardrail-log-xjgr00eq.js} +4 -4
- package/dist/cli/{hive-promoter-rs5dr4pf.js → hive-promoter-y179n7wx.js} +19 -19
- package/dist/cli/{index-1cn967sa.js → index-0dab9w37.js} +1 -1
- package/dist/cli/{index-r3j3458j.js → index-1rga1vvb.js} +1 -1
- package/dist/cli/{index-mvg66d9n.js → index-2aqs6daa.js} +3 -3
- package/dist/cli/{index-yw8qpf51.js → index-9fxs0rm1.js} +1 -1
- package/dist/cli/{index-cmjq1kg7.js → index-b83y9a7r.js} +3 -3
- package/dist/cli/{index-rm8b4959.js → index-c3h3d8kh.js} +23 -21
- package/dist/cli/{index-0g5xsrp4.js → index-cq2hgvd2.js} +13 -5
- package/dist/cli/{index-yhmt3dw3.js → index-cye4g7zj.js} +3 -3
- package/dist/cli/{index-j2v3w1ds.js → index-d0w40jm3.js} +4 -4
- package/dist/cli/{index-40h0yp9e.js → index-db1fh1fv.js} +1 -1
- package/dist/cli/{index-dm35e55e.js → index-fhmw7evd.js} +36 -15
- package/dist/cli/{index-vzzt3ygr.js → index-g55nzpwn.js} +1 -1
- package/dist/cli/{index-c483hnn4.js → index-hg0pamsa.js} +3 -3
- package/dist/cli/{index-smk3st51.js → index-j5c98bd9.js} +1799 -1249
- package/dist/cli/{index-53z1afgh.js → index-npxmfj48.js} +1 -1
- package/dist/cli/{index-6jng9c8t.js → index-pm992z24.js} +1 -1
- package/dist/cli/{index-85bacexr.js → index-q1jaeynn.js} +4 -1
- package/dist/cli/{index-v8pk35h7.js → index-t7efm8vz.js} +4 -4
- package/dist/cli/{index-5rfxzgmt.js → index-w84stmkx.js} +1 -1
- package/dist/cli/{index-4k3gh2nz.js → index-x4bghdyv.js} +2 -2
- package/dist/cli/{index-xddysq89.js → index-xehrmy76.js} +1 -1
- package/dist/cli/index.js +19 -19
- package/dist/cli/{knowledge-escalator-0dkkenp2.js → knowledge-escalator-t1e2211j.js} +6 -6
- package/dist/cli/{knowledge-events-bckbj6ah.js → knowledge-events-2h3gvtfa.js} +4 -4
- package/dist/cli/{knowledge-store-dvjbdn00.js → knowledge-store-gpta9gzh.js} +4 -4
- package/dist/cli/{knowledge-validator-bqr936sg.js → knowledge-validator-03f0hm0p.js} +5 -5
- package/dist/cli/{pending-delegations-yyz3fcfn.js → pending-delegations-gc3a2hfx.js} +2 -2
- package/dist/cli/{pr-subscriptions-vv8byxe6.js → pr-subscriptions-p8g2rzxd.js} +3 -3
- package/dist/cli/{schema-s48je8zt.js → schema-2p15yrvn.js} +1 -1
- package/dist/cli/{scope-persistence-tgp00wtd.js → scope-persistence-5ccgtebg.js} +2 -2
- package/dist/cli/{skill-generator-5rsjmmfq.js → skill-generator-2tsqqaa2.js} +7 -7
- package/dist/commands/ci-simulate.d.ts +40 -0
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/pr-monitor-status.d.ts +24 -0
- package/dist/commands/registry.d.ts +8 -0
- package/dist/config/bundled-skills.d.ts +1 -1
- package/dist/config/schema.d.ts +5 -0
- package/dist/full-auto/oversight.d.ts +4 -0
- package/dist/full-auto/state.d.ts +12 -0
- package/dist/git/pr.d.ts +23 -0
- package/dist/hooks/delegation-gate/worktree-isolation.d.ts +110 -0
- package/dist/hooks/delegation-gate.d.ts +17 -0
- package/dist/hooks/full-auto-intercept.d.ts +1 -1
- package/dist/index.js +399 -364
- package/dist/tools/placeholder-scan.d.ts +15 -0
- package/dist/utils/bun-compat.d.ts +6 -0
- package/dist/worktree/merge.d.ts +12 -0
- package/package.json +9 -5
- package/dist/cli/curator-llm-factory-3x89ddtd.js +0 -40
- package/dist/cli/guardrail-explain-jdwp6h9c.js +0 -41
- /package/dist/cli/{index-7xgqky26.js → index-h91bv3hy.js} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
countEntryViolationsInWindow,
|
|
5
5
|
readKnowledgeEvents,
|
|
6
6
|
recordKnowledgeEvent
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-cye4g7zj.js";
|
|
8
8
|
import {
|
|
9
9
|
jaccardBigram,
|
|
10
10
|
readKnowledge,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveSwarmKnowledgePath,
|
|
13
13
|
transactKnowledge,
|
|
14
14
|
wordBigrams
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-t7efm8vz.js";
|
|
16
16
|
import {
|
|
17
17
|
isActiveStatus
|
|
18
18
|
} from "./index-bfwt3abw.js";
|
|
@@ -188,7 +188,7 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
188
188
|
alreadyInactive: true
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
191
|
+
const { quarantineEntry } = await import("./knowledge-validator-03f0hm0p.js");
|
|
192
192
|
await quarantineEntry(directory, entryId, `repeat_contradiction: ${count} contradicted events in ${windowDays}d`, "auto");
|
|
193
193
|
return { quarantined: true, entryId, contradictionsInWindow: count };
|
|
194
194
|
} catch {
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ALLOWED_SKILL_PATH_PREFIXES,
|
|
4
4
|
validateSkillPath
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-hg0pamsa.js";
|
|
6
6
|
import {
|
|
7
7
|
effectiveRetrievalOutcomes,
|
|
8
8
|
readKnowledgeCounterRollups
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-cye4g7zj.js";
|
|
10
10
|
import {
|
|
11
11
|
computeOutcomeSignal,
|
|
12
12
|
readKnowledge,
|
|
13
13
|
resolveHiveKnowledgePath,
|
|
14
14
|
resolveSwarmKnowledgePath,
|
|
15
15
|
transactKnowledge
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-t7efm8vz.js";
|
|
17
17
|
import {
|
|
18
18
|
isActiveStatus
|
|
19
19
|
} from "./index-bfwt3abw.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-x4bghdyv.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-w84stmkx.js";
|
|
8
8
|
import {
|
|
9
9
|
COMMAND_REGISTRY,
|
|
10
10
|
SWARM_COMMAND_TOOL_ALLOWLIST,
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
handleBenchmarkCommand,
|
|
25
25
|
handleBrainstormCommand,
|
|
26
26
|
handleCheckpointCommand,
|
|
27
|
+
handleCiSimulateCommand,
|
|
27
28
|
handleClarifyCommand,
|
|
28
29
|
handleCloseCommand,
|
|
29
30
|
handleCodebaseReviewCommand,
|
|
@@ -80,43 +81,43 @@ import {
|
|
|
80
81
|
handleWriteRetroCommand,
|
|
81
82
|
normalizeSwarmCommandInput,
|
|
82
83
|
resolveCommand
|
|
83
|
-
} from "./index-
|
|
84
|
-
import"./index-
|
|
84
|
+
} from "./index-j5c98bd9.js";
|
|
85
|
+
import"./index-npxmfj48.js";
|
|
85
86
|
import"./index-c8s9a3zh.js";
|
|
86
|
-
import"./index-
|
|
87
|
+
import"./index-xehrmy76.js";
|
|
87
88
|
import {
|
|
88
89
|
AGENT_TOOL_MAP,
|
|
89
90
|
ORCHESTRATOR_NAME,
|
|
90
91
|
stripKnownSwarmPrefix
|
|
91
|
-
} from "./index-
|
|
92
|
-
import"./index-
|
|
92
|
+
} from "./index-cq2hgvd2.js";
|
|
93
|
+
import"./index-d0w40jm3.js";
|
|
93
94
|
import"./index-scww5b77.js";
|
|
94
|
-
import"./index-
|
|
95
|
-
import"./index-
|
|
96
|
-
import"./index-
|
|
97
|
-
import"./index-
|
|
98
|
-
import"./index-
|
|
99
|
-
import"./index-
|
|
100
|
-
import"./index-
|
|
95
|
+
import"./index-9fxs0rm1.js";
|
|
96
|
+
import"./index-q1jaeynn.js";
|
|
97
|
+
import"./index-b83y9a7r.js";
|
|
98
|
+
import"./index-hg0pamsa.js";
|
|
99
|
+
import"./index-2aqs6daa.js";
|
|
100
|
+
import"./index-cye4g7zj.js";
|
|
101
|
+
import"./index-t7efm8vz.js";
|
|
101
102
|
import"./index-bfwt3abw.js";
|
|
102
|
-
import"./index-
|
|
103
|
+
import"./index-db1fh1fv.js";
|
|
103
104
|
import"./index-jt58s751.js";
|
|
104
105
|
import"./index-wvrj16f0.js";
|
|
105
106
|
import"./index-q1exe2b3.js";
|
|
106
|
-
import"./index-
|
|
107
|
-
import"./index-
|
|
108
|
-
import"./index-
|
|
107
|
+
import"./index-g55nzpwn.js";
|
|
108
|
+
import"./index-fhmw7evd.js";
|
|
109
|
+
import"./index-1rga1vvb.js";
|
|
109
110
|
import"./index-jtqkh8jf.js";
|
|
110
111
|
import"./index-5e4e2hvv.js";
|
|
111
112
|
import"./index-p0arc26j.js";
|
|
112
113
|
import"./index-zgwm4ryv.js";
|
|
113
|
-
import"./index-
|
|
114
|
-
import"./index-
|
|
114
|
+
import"./index-pm992z24.js";
|
|
115
|
+
import"./index-0dab9w37.js";
|
|
115
116
|
import"./index-293f68mj.js";
|
|
116
117
|
import"./index-5mkc2f9z.js";
|
|
117
118
|
import"./index-vn263hqt.js";
|
|
118
119
|
import"./index-vvk2g744.js";
|
|
119
|
-
import"./index-
|
|
120
|
+
import"./index-h91bv3hy.js";
|
|
120
121
|
import"./index-a76rekgs.js";
|
|
121
122
|
// src/commands/command-names.ts
|
|
122
123
|
var COMMAND_NAMES = Object.freeze(Object.keys(COMMAND_REGISTRY));
|
|
@@ -407,6 +408,7 @@ export {
|
|
|
407
408
|
handleCodebaseReviewCommand,
|
|
408
409
|
handleCloseCommand,
|
|
409
410
|
handleClarifyCommand,
|
|
411
|
+
handleCiSimulateCommand,
|
|
410
412
|
handleCheckpointCommand,
|
|
411
413
|
handleBrainstormCommand,
|
|
412
414
|
handleBenchmarkCommand,
|
|
@@ -1128,7 +1128,8 @@ var PlaceholderScanConfigSchema = GateFeatureSchema.extend({
|
|
|
1128
1128
|
"**/mocks/**",
|
|
1129
1129
|
"**/__tests__/**"
|
|
1130
1130
|
]),
|
|
1131
|
-
max_allowed_findings: exports_external.number().min(0).default(0)
|
|
1131
|
+
max_allowed_findings: exports_external.number().min(0).default(0),
|
|
1132
|
+
sentinel_allowlist: exports_external.array(exports_external.string()).default([])
|
|
1132
1133
|
});
|
|
1133
1134
|
var QualityBudgetConfigSchema = GateFeatureSchema.extend({
|
|
1134
1135
|
max_complexity_delta: exports_external.number().default(5),
|
|
@@ -1182,7 +1183,8 @@ var GateConfigSchema = exports_external.object({
|
|
|
1182
1183
|
"**/mocks/**",
|
|
1183
1184
|
"**/__tests__/**"
|
|
1184
1185
|
],
|
|
1185
|
-
max_allowed_findings: 0
|
|
1186
|
+
max_allowed_findings: 0,
|
|
1187
|
+
sentinel_allowlist: []
|
|
1186
1188
|
}),
|
|
1187
1189
|
sast_scan: GateFeatureSchema.default({ enabled: true }),
|
|
1188
1190
|
sbom_generate: GateFeatureSchema.default({ enabled: true }),
|
|
@@ -2326,7 +2328,9 @@ var PluginConfigSchema = exports_external.object({
|
|
|
2326
2328
|
on_subagent_return_warning: exports_external.boolean().default(true),
|
|
2327
2329
|
every_tool_calls: exports_external.number().int().min(0).max(1e4).default(25),
|
|
2328
2330
|
every_architect_turns: exports_external.number().int().min(0).max(1000).default(5),
|
|
2329
|
-
every_minutes: exports_external.number().int().min(0).max(1440).default(20)
|
|
2331
|
+
every_minutes: exports_external.number().int().min(0).max(1440).default(20),
|
|
2332
|
+
max_dispatch_retries: exports_external.number().int().min(0).max(10).default(2),
|
|
2333
|
+
max_consecutive_dispatch_failures: exports_external.number().int().min(0).max(50).default(3)
|
|
2330
2334
|
}).default(() => ({
|
|
2331
2335
|
on_plan_change: true,
|
|
2332
2336
|
on_task_completion: false,
|
|
@@ -2335,7 +2339,9 @@ var PluginConfigSchema = exports_external.object({
|
|
|
2335
2339
|
on_subagent_return_warning: true,
|
|
2336
2340
|
every_tool_calls: 25,
|
|
2337
2341
|
every_architect_turns: 5,
|
|
2338
|
-
every_minutes: 20
|
|
2342
|
+
every_minutes: 20,
|
|
2343
|
+
max_dispatch_retries: 2,
|
|
2344
|
+
max_consecutive_dispatch_failures: 3
|
|
2339
2345
|
}))
|
|
2340
2346
|
}).optional().default(() => ({
|
|
2341
2347
|
enabled: false,
|
|
@@ -2387,7 +2393,9 @@ var PluginConfigSchema = exports_external.object({
|
|
|
2387
2393
|
on_subagent_return_warning: true,
|
|
2388
2394
|
every_tool_calls: 25,
|
|
2389
2395
|
every_architect_turns: 5,
|
|
2390
|
-
every_minutes: 20
|
|
2396
|
+
every_minutes: 20,
|
|
2397
|
+
max_dispatch_retries: 2,
|
|
2398
|
+
max_consecutive_dispatch_failures: 3
|
|
2391
2399
|
}
|
|
2392
2400
|
})),
|
|
2393
2401
|
pr_monitor: PrMonitorConfigSchema.optional(),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
resolveKnowledgeStoreDir
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-db1fh1fv.js";
|
|
5
5
|
import {
|
|
6
6
|
init_logger,
|
|
7
7
|
warn
|
|
8
8
|
} from "./index-zgwm4ryv.js";
|
|
9
9
|
import {
|
|
10
10
|
atomicWriteFile
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-0dab9w37.js";
|
|
12
12
|
import {
|
|
13
13
|
require_proper_lockfile
|
|
14
14
|
} from "./index-vvk2g744.js";
|
|
@@ -594,7 +594,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
594
594
|
deltas.push({ id, delta });
|
|
595
595
|
}
|
|
596
596
|
if (deltas.length > 0) {
|
|
597
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
597
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-gpta9gzh.js");
|
|
598
598
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
599
599
|
}
|
|
600
600
|
return {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
readSwarmFileAsync,
|
|
14
14
|
validateSwarmPath
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-1rga1vvb.js";
|
|
16
16
|
import {
|
|
17
17
|
readCachedParsedFile
|
|
18
18
|
} from "./index-jtqkh8jf.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
readTaskEvidence,
|
|
28
28
|
readTaskEvidenceRaw,
|
|
29
29
|
sanitizeTaskId
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-pm992z24.js";
|
|
31
31
|
import {
|
|
32
32
|
ZodError,
|
|
33
33
|
exports_external
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
bunHash,
|
|
43
43
|
bunWrite,
|
|
44
44
|
mergeEnvForChild
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-h91bv3hy.js";
|
|
46
46
|
import {
|
|
47
47
|
__esm,
|
|
48
48
|
__export,
|
|
@@ -4555,4 +4555,4 @@ function mergeDurableGateEntriesFromEvidence(taskId, entries, evidence) {
|
|
|
4555
4555
|
return merged;
|
|
4556
4556
|
}
|
|
4557
4557
|
|
|
4558
|
-
export { PlanSchema, getExecutor, init_executor, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, getGitRepositoryStatus, isGitRepo, resetToRemoteBranch, resetToMainAfterMerge, initDurableStatusPath, getAllWorktreeMergeFailures, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes, computeSpecHash, derivePlanId, computePlanHash, initLedger, appendLedgerEvent, loadPlanJsonOnly, loadPlan, savePlan, closePlanTerminalState, derivePlanMarkdown, RetrospectiveEvidenceSchema, isValidEvidenceType, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|
|
4558
|
+
export { PlanSchema, getExecutor, init_executor, MAX_TRANSIENT_RETRIES, isTransientSpawnError, transientBackoff, getGitRepositoryStatus, isGitRepo, getDefaultBaseBranch, resetToRemoteBranch, resetToMainAfterMerge, initDurableStatusPath, getAllWorktreeMergeFailures, isStateUnreadable, loadEpicSessionState, isEpicModeActive, enableEpicMode, disableEpicMode, normalizePath, pathsConflict, isGlobalFile, isProtectedPath, readTaskScopes, computeSpecHash, derivePlanId, computePlanHash, initLedger, appendLedgerEvent, loadPlanJsonOnly, loadPlan, savePlan, closePlanTerminalState, derivePlanMarkdown, RetrospectiveEvidenceSchema, isValidEvidenceType, sanitizeTaskId2 as sanitizeTaskId, validateProjectRoot, saveEvidence, loadEvidence, listEvidenceTaskIds, checkRequirementCoverage, archiveEvidence, readDurableGateEvidence, getDurableGateEvidenceStatus, getDurableGateEvidenceStatusForTask, mergeDurableGateEntriesFromEvidence };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./index-zgwm4ryv.js";
|
|
5
5
|
import {
|
|
6
6
|
bunSpawn
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-h91bv3hy.js";
|
|
8
8
|
import {
|
|
9
9
|
__require
|
|
10
10
|
} from "./index-a76rekgs.js";
|
|
@@ -34,7 +34,7 @@ var _internals = {
|
|
|
34
34
|
symlinkSync: fs.symlinkSync
|
|
35
35
|
},
|
|
36
36
|
writeScopeToDisk: async (directory, taskId, files) => {
|
|
37
|
-
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-
|
|
37
|
+
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-5ccgtebg.js");
|
|
38
38
|
return realWrite(directory, taskId, files);
|
|
39
39
|
},
|
|
40
40
|
writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
|
|
@@ -245,27 +245,48 @@ async function provisionWorktree(directory, id, sessionId, options) {
|
|
|
245
245
|
}
|
|
246
246
|
if (current.path)
|
|
247
247
|
entries.push(current);
|
|
248
|
-
const branchIsActiveSomewhere = entries.some((e) => e.branch === `refs/heads/${branchName}`);
|
|
249
248
|
const expectedPathIsRegistered = entries.some((e) => e.path === expectedPath);
|
|
250
|
-
|
|
249
|
+
const branchIsActiveAtExpectedPath = entries.some((e) => e.branch === `refs/heads/${branchName}` && e.path === expectedPath);
|
|
250
|
+
const branchIsActiveElsewhere = entries.some((e) => e.branch === `refs/heads/${branchName}` && e.path !== expectedPath);
|
|
251
|
+
if (branchIsActiveElsewhere || expectedPathIsRegistered && !branchIsActiveAtExpectedPath) {
|
|
251
252
|
return {
|
|
252
253
|
error: `Branch already exists and worktree is active: ${branchName} (owned by another session)`
|
|
253
254
|
};
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (adoptResult.exitCode !== 0) {
|
|
256
|
+
const aheadResult = await runGit(["rev-list", "--count", `HEAD..${branchName}`], directory);
|
|
257
|
+
if (aheadResult.exitCode !== 0) {
|
|
258
258
|
return {
|
|
259
|
-
error: `Failed to
|
|
259
|
+
error: `Failed to inspect stale worktree branch: ${aheadResult.stderr.trim() || aheadResult.stdout.trim()}`
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
262
|
+
const aheadCount = Number.parseInt(aheadResult.stdout.trim(), 10);
|
|
263
|
+
if (!Number.isFinite(aheadCount) || aheadCount > 0) {
|
|
264
|
+
return {
|
|
265
|
+
error: `Branch already exists and has unmerged commits: ${branchName}`
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
if (branchIsActiveAtExpectedPath) {
|
|
269
|
+
const clean = await isCleanWorktree(worktreePath);
|
|
270
|
+
if (!clean) {
|
|
271
|
+
return {
|
|
272
|
+
error: `Branch already exists and expected worktree is dirty: ${branchName}`
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const removeResult = await removeWorktree(worktreePath, directory, {
|
|
276
|
+
force: true,
|
|
277
|
+
worktreeDir: options.worktreeDir
|
|
278
|
+
});
|
|
279
|
+
if (!("success" in removeResult)) {
|
|
280
|
+
return { error: removeResult.error };
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const deleteResult = await runGit(["branch", "-d", branchName], directory);
|
|
284
|
+
if (deleteResult.exitCode !== 0) {
|
|
285
|
+
return {
|
|
286
|
+
error: `Failed to delete stale worktree branch: ${deleteResult.stderr.trim() || deleteResult.stdout.trim()}`
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
await runGit(["worktree", "prune"], directory);
|
|
269
290
|
}
|
|
270
291
|
const addResult = await runGit(["worktree", "add", "-b", branchName, worktreePath, "HEAD"], directory);
|
|
271
292
|
if (addResult.exitCode !== 0) {
|
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
resolveSwarmKnowledgePath,
|
|
7
7
|
resolveSwarmRejectedPath,
|
|
8
8
|
transactKnowledge
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-t7efm8vz.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveKnowledgeStoreDir
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-db1fh1fv.js";
|
|
13
13
|
import {
|
|
14
14
|
init_logger,
|
|
15
15
|
warn
|
|
16
16
|
} from "./index-zgwm4ryv.js";
|
|
17
17
|
import {
|
|
18
18
|
atomicWriteFile
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-0dab9w37.js";
|
|
20
20
|
import {
|
|
21
21
|
require_proper_lockfile
|
|
22
22
|
} from "./index-vvk2g744.js";
|