opencode-swarm 7.149.1 → 7.150.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/dist/cli/{config-doctor-d3nsq1nz.js → config-doctor-96qyv31a.js} +2 -2
- package/dist/cli/{core-y9d858n6.js → core-xx0x5tfv.js} +1 -1
- package/dist/cli/{curator-f5m0hh2p.js → curator-frrehxxe.js} +17 -17
- package/dist/cli/{curator-llm-factory-mzh9ns5s.js → curator-llm-factory-b83jsg02.js} +17 -17
- package/dist/cli/{evidence-summary-service-601x7ne7.js → evidence-summary-service-dv4bt2bx.js} +6 -6
- package/dist/cli/{gate-evidence-kjs9vsx9.js → gate-evidence-dkvs7aez.js} +2 -2
- package/dist/cli/{guardrail-explain-j291sss5.js → guardrail-explain-1zbk21fq.js} +18 -18
- package/dist/cli/{guardrail-log-1jykfrqc.js → guardrail-log-d20jewtr.js} +3 -3
- package/dist/cli/{guardrail-reset-tr07m077.js → guardrail-reset-wb3ba243.js} +17 -17
- package/dist/cli/{hive-promoter-162ws6xp.js → hive-promoter-10zv1b45.js} +17 -17
- package/dist/cli/{index-xe83cwvn.js → index-0tn1kxej.js} +3 -3
- package/dist/cli/{index-t994f8fp.js → index-1rpjd5na.js} +1 -1
- package/dist/cli/{index-dkrz1vv5.js → index-1rww5k9e.js} +3 -3
- package/dist/cli/{index-jg2gwzvq.js → index-1wmd5wn1.js} +1 -1
- package/dist/cli/{index-f53yyerg.js → index-8cn6545x.js} +19 -19
- package/dist/cli/{index-ekvs3ade.js → index-an922xj4.js} +3 -3
- package/dist/cli/{index-cna8m7my.js → index-bhg6brtw.js} +1 -1
- package/dist/cli/{index-5gntxwxt.js → index-g75rbw3e.js} +5 -5
- package/dist/cli/{index-eaq9b0qm.js → index-ggs716fj.js} +1 -1
- package/dist/cli/{index-kgk65rde.js → index-htqs4p52.js} +1 -1
- package/dist/cli/{index-mdwtj4xm.js → index-ma1p1w05.js} +4 -4
- package/dist/cli/{index-pf22x0dr.js → index-mef0trex.js} +1 -1
- package/dist/cli/{index-srwp8fs7.js → index-mnhagjvn.js} +1 -1
- package/dist/cli/{index-7m8rk72d.js → index-qqs44wcp.js} +1285 -428
- package/dist/cli/{index-fc4x86sy.js → index-r5djc1cc.js} +2 -2
- package/dist/cli/{index-hxbrsb40.js → index-reknv4f9.js} +1 -1
- package/dist/cli/{index-yjj3s8af.js → index-s0xz2520.js} +3 -3
- package/dist/cli/{index-cqhf7fkw.js → index-t54jt9cs.js} +1 -1
- package/dist/cli/{index-38ema5k2.js → index-w9pb72vg.js} +2 -2
- package/dist/cli/{index-64d17yd0.js → index-x3pt7d0b.js} +2 -2
- package/dist/cli/{index-1aztaa2s.js → index-zyv56em5.js} +1 -1
- package/dist/cli/index.js +17 -17
- package/dist/cli/{knowledge-escalator-whkxxgxj.js → knowledge-escalator-pc7smwrd.js} +6 -6
- package/dist/cli/{knowledge-events-rnqzt87h.js → knowledge-events-jmb3jm84.js} +4 -4
- package/dist/cli/{knowledge-store-7de59rnz.js → knowledge-store-wd6zh05h.js} +1 -1
- package/dist/cli/{knowledge-validator-bpk17jf4.js → knowledge-validator-2v6ar1wk.js} +2 -2
- package/dist/cli/{scan-cursor-0p51fh61.js → scan-cursor-hr8e3jqj.js} +2 -2
- package/dist/cli/{schema-8g2nxhjf.js → schema-g44y7s0w.js} +1 -1
- package/dist/cli/{scope-persistence-hhkr0c46.js → scope-persistence-0n2cv4kn.js} +4 -4
- package/dist/cli/{skill-generator-pk9gcz7r.js → skill-generator-0gmpxwgk.js} +7 -7
- package/dist/cli/{worktree-isolation-1hwwfbdw.js → worktree-isolation-pcr5zv0c.js} +17 -17
- package/dist/index.js +176 -152
- package/dist/lang/symbol-graph.d.ts +15 -0
- package/dist/tools/repo-graph/builder.d.ts +27 -1
- package/dist/tools/symbols.d.ts +35 -0
- package/package.json +1 -1
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
normalizeToolNameLowerCase,
|
|
12
12
|
stableCanonicalStringify
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-bhg6brtw.js";
|
|
14
14
|
import {
|
|
15
15
|
detectStraySwarmDirs,
|
|
16
16
|
readDoctorArtifact,
|
|
17
17
|
removeStraySwarmDir,
|
|
18
18
|
runConfigDoctor
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-htqs4p52.js";
|
|
20
20
|
import {
|
|
21
21
|
MAX_TRANSIENT_RETRIES,
|
|
22
22
|
archiveEvidence,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
updateTaskStatus,
|
|
63
63
|
validateProjectRoot,
|
|
64
64
|
validateSymlinkBoundary
|
|
65
|
-
} from "./index-
|
|
65
|
+
} from "./index-an922xj4.js";
|
|
66
66
|
import {
|
|
67
67
|
EvaluationTaskV1Schema,
|
|
68
68
|
GateAuditManifestV1Schema,
|
|
@@ -105,12 +105,12 @@ import {
|
|
|
105
105
|
} from "./index-y8552snf.js";
|
|
106
106
|
import {
|
|
107
107
|
readRecentEscalations
|
|
108
|
-
} from "./index-
|
|
108
|
+
} from "./index-g75rbw3e.js";
|
|
109
109
|
import {
|
|
110
110
|
alreadyCuratedThisGeneration,
|
|
111
111
|
claimNextScanBatch,
|
|
112
112
|
resolveCohortId
|
|
113
|
-
} from "./index-
|
|
113
|
+
} from "./index-reknv4f9.js";
|
|
114
114
|
import {
|
|
115
115
|
CURATOR_INIT_PROMPT,
|
|
116
116
|
CURATOR_PHASE_PROMPT,
|
|
@@ -180,7 +180,7 @@ import {
|
|
|
180
180
|
retireSkill,
|
|
181
181
|
selectCandidateEntries,
|
|
182
182
|
syncBundledProjectSkillsIfMissingAsync
|
|
183
|
-
} from "./index-
|
|
183
|
+
} from "./index-1rww5k9e.js";
|
|
184
184
|
import {
|
|
185
185
|
appendUnactionable,
|
|
186
186
|
quarantineEntry,
|
|
@@ -191,7 +191,7 @@ import {
|
|
|
191
191
|
validateActionableFields,
|
|
192
192
|
validateLesson,
|
|
193
193
|
validateSkillPath
|
|
194
|
-
} from "./index-
|
|
194
|
+
} from "./index-mnhagjvn.js";
|
|
195
195
|
import {
|
|
196
196
|
authorizeCuration,
|
|
197
197
|
buildConfigFingerprintInput
|
|
@@ -252,18 +252,18 @@ import {
|
|
|
252
252
|
transitionTaskWorkflowEvidence,
|
|
253
253
|
withTaskEvidenceTransaction,
|
|
254
254
|
writeWorkflowWalFile
|
|
255
|
-
} from "./index-
|
|
255
|
+
} from "./index-1wmd5wn1.js";
|
|
256
256
|
import {
|
|
257
257
|
provisionWorktree,
|
|
258
258
|
removeWorktree
|
|
259
|
-
} from "./index-
|
|
259
|
+
} from "./index-1rpjd5na.js";
|
|
260
260
|
import {
|
|
261
261
|
MAX_PENDING_SCOPE_BINDINGS,
|
|
262
262
|
canonicalWorkspaceIdentity,
|
|
263
263
|
clearAllScopes,
|
|
264
264
|
clearScopeBindingFromDisk,
|
|
265
265
|
clearScopeBindings
|
|
266
|
-
} from "./index-
|
|
266
|
+
} from "./index-r5djc1cc.js";
|
|
267
267
|
import {
|
|
268
268
|
appendLedgerEvent,
|
|
269
269
|
computePlanHash,
|
|
@@ -278,7 +278,7 @@ import {
|
|
|
278
278
|
readPlanEpochIdentity,
|
|
279
279
|
replayFromLedgerWithStatus,
|
|
280
280
|
takeSnapshotEvent
|
|
281
|
-
} from "./index-
|
|
281
|
+
} from "./index-zyv56em5.js";
|
|
282
282
|
import {
|
|
283
283
|
CORE_EVENT_LOCKED,
|
|
284
284
|
appendCoreEventSync,
|
|
@@ -340,7 +340,7 @@ import {
|
|
|
340
340
|
transactFile,
|
|
341
341
|
transactKnowledge,
|
|
342
342
|
wordBigrams
|
|
343
|
-
} from "./index-
|
|
343
|
+
} from "./index-ma1p1w05.js";
|
|
344
344
|
import {
|
|
345
345
|
MAX_EVENT_LOG_ENTRIES,
|
|
346
346
|
_internals as _internals2,
|
|
@@ -354,10 +354,10 @@ import {
|
|
|
354
354
|
recordKnowledgeEvent,
|
|
355
355
|
recordPhaseCloseIntent,
|
|
356
356
|
resolveKnowledgeEventsPath
|
|
357
|
-
} from "./index-
|
|
357
|
+
} from "./index-0tn1kxej.js";
|
|
358
358
|
import {
|
|
359
359
|
resolveWorktreeIsolationConfig
|
|
360
|
-
} from "./index-
|
|
360
|
+
} from "./index-w9pb72vg.js";
|
|
361
361
|
import {
|
|
362
362
|
RetrospectiveEvidenceSchema
|
|
363
363
|
} from "./index-gprxjmm7.js";
|
|
@@ -379,7 +379,7 @@ import {
|
|
|
379
379
|
init_loader,
|
|
380
380
|
loadPluginConfig,
|
|
381
381
|
loadPluginConfigWithMeta
|
|
382
|
-
} from "./index-
|
|
382
|
+
} from "./index-t54jt9cs.js";
|
|
383
383
|
import {
|
|
384
384
|
DEFAULT_SKILL_OPT_CONFIG,
|
|
385
385
|
FALLBACK_MODELS_MAX,
|
|
@@ -393,7 +393,7 @@ import {
|
|
|
393
393
|
package_default,
|
|
394
394
|
resolveAutoReviewConfig,
|
|
395
395
|
stripKnownSwarmPrefix
|
|
396
|
-
} from "./index-
|
|
396
|
+
} from "./index-mef0trex.js";
|
|
397
397
|
import {
|
|
398
398
|
AGENT_TOOL_MAP,
|
|
399
399
|
ALL_AGENT_NAMES,
|
|
@@ -5599,7 +5599,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
|
|
|
5599
5599
|
awaitingMergeByCallID,
|
|
5600
5600
|
cleanupStandardWorktreeForCallId,
|
|
5601
5601
|
standardWorktreeByCallID
|
|
5602
|
-
} = await import("./worktree-isolation-
|
|
5602
|
+
} = await import("./worktree-isolation-pcr5zv0c.js");
|
|
5603
5603
|
standardWorktreeByCallID.delete(descriptor.callID);
|
|
5604
5604
|
if (hasResidue)
|
|
5605
5605
|
awaitingMergeByCallID.set(descriptor.callID, {
|
|
@@ -5701,7 +5701,7 @@ async function recoverCoderSettlement(directory, taskId) {
|
|
|
5701
5701
|
awaitingMergeByCallID,
|
|
5702
5702
|
finishStandardWorktreeDispatch,
|
|
5703
5703
|
standardWorktreeByCallID
|
|
5704
|
-
} = await import("./worktree-isolation-
|
|
5704
|
+
} = await import("./worktree-isolation-pcr5zv0c.js");
|
|
5705
5705
|
const descriptor = wal.worktree;
|
|
5706
5706
|
const reconstructedDispatch = {
|
|
5707
5707
|
callID: descriptor.callID,
|
|
@@ -18503,7 +18503,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
18503
18503
|
};
|
|
18504
18504
|
}
|
|
18505
18505
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
18506
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
18506
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
18507
18507
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
18508
18508
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
18509
18509
|
if (sweepConfig?.enabled === false)
|
|
@@ -19633,7 +19633,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19633
19633
|
}
|
|
19634
19634
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
19635
19635
|
try {
|
|
19636
|
-
const skillModule = await import("./skill-generator-
|
|
19636
|
+
const skillModule = await import("./skill-generator-0gmpxwgk.js");
|
|
19637
19637
|
for (const cand of skillCandidates) {
|
|
19638
19638
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
19639
19639
|
continue;
|
|
@@ -20105,7 +20105,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
20105
20105
|
} catch {}
|
|
20106
20106
|
}
|
|
20107
20107
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
20108
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
20108
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-pc7smwrd.js");
|
|
20109
20109
|
for (const { id } of contradictedEntries) {
|
|
20110
20110
|
try {
|
|
20111
20111
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -20924,7 +20924,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
20924
20924
|
warnings.push("Failed to collect knowledge summary.");
|
|
20925
20925
|
}
|
|
20926
20926
|
try {
|
|
20927
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
20927
|
+
const { getScanStatus } = await import("./scan-cursor-hr8e3jqj.js");
|
|
20928
20928
|
const scanStatus = await getScanStatus(directory);
|
|
20929
20929
|
if (scanStatus.remaining_estimate > 0) {
|
|
20930
20930
|
warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
|
|
@@ -21096,9 +21096,9 @@ var _internals26 = {
|
|
|
21096
21096
|
verifyPostMortemKnowledgeActions,
|
|
21097
21097
|
repairPostMortemActions,
|
|
21098
21098
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
21099
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
21099
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-g44y7s0w.js");
|
|
21100
21100
|
try {
|
|
21101
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
21101
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
21102
21102
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
21103
21103
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
21104
21104
|
} catch {
|
|
@@ -21106,11 +21106,11 @@ var _internals26 = {
|
|
|
21106
21106
|
}
|
|
21107
21107
|
},
|
|
21108
21108
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
21109
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
21109
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-frrehxxe.js");
|
|
21110
21110
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
21111
21111
|
},
|
|
21112
21112
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
21113
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
21113
|
+
const { checkHivePromotions } = await import("./hive-promoter-10zv1b45.js");
|
|
21114
21114
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
21115
21115
|
},
|
|
21116
21116
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -21119,7 +21119,7 @@ var _internals26 = {
|
|
|
21119
21119
|
activateProposal,
|
|
21120
21120
|
listSkills: listSkills2,
|
|
21121
21121
|
sanitizeSlug
|
|
21122
|
-
} = await import("./skill-generator-
|
|
21122
|
+
} = await import("./skill-generator-0gmpxwgk.js");
|
|
21123
21123
|
const result = {
|
|
21124
21124
|
approved: [],
|
|
21125
21125
|
rejected: [],
|
|
@@ -22449,9 +22449,9 @@ function hashContent(content) {
|
|
|
22449
22449
|
return createHash10("sha1").update(content).digest("hex");
|
|
22450
22450
|
}
|
|
22451
22451
|
async function loadConfigForPolicyCurator(directory) {
|
|
22452
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
22452
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-g44y7s0w.js");
|
|
22453
22453
|
try {
|
|
22454
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
22454
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
22455
22455
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
22456
22456
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
22457
22457
|
} catch {
|
|
@@ -33658,7 +33658,7 @@ async function runFinalizeStage(ctx) {
|
|
|
33658
33658
|
}
|
|
33659
33659
|
}
|
|
33660
33660
|
try {
|
|
33661
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
33661
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-g44y7s0w.js");
|
|
33662
33662
|
const { config: pmLoadedConfig } = _internals41.loadPluginConfigWithMeta(ctx.directory);
|
|
33663
33663
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
33664
33664
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -35860,9 +35860,9 @@ var _internals45 = {
|
|
|
35860
35860
|
loadPluginConfigWithMeta,
|
|
35861
35861
|
loadCuratorDeps: async () => {
|
|
35862
35862
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
35863
|
-
import("./schema-
|
|
35864
|
-
import("./curator-
|
|
35865
|
-
import("./curator-llm-factory-
|
|
35863
|
+
import("./schema-g44y7s0w.js"),
|
|
35864
|
+
import("./curator-frrehxxe.js"),
|
|
35865
|
+
import("./curator-llm-factory-b83jsg02.js")
|
|
35866
35866
|
]);
|
|
35867
35867
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
35868
35868
|
}
|
|
@@ -36852,7 +36852,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
36852
36852
|
let scanCompleted = false;
|
|
36853
36853
|
let scanRemaining = 0;
|
|
36854
36854
|
try {
|
|
36855
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
36855
|
+
const { getScanStatus } = await import("./scan-cursor-hr8e3jqj.js");
|
|
36856
36856
|
const status = await getScanStatus(directory);
|
|
36857
36857
|
scanGeneration = status.generation;
|
|
36858
36858
|
scanCompleted = status.completed;
|
|
@@ -36862,10 +36862,10 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
36862
36862
|
try {
|
|
36863
36863
|
const { isLinked: isLinked2 } = await import("./knowledge-link-mzn8x0qd.js");
|
|
36864
36864
|
if (isLinked2(directory)) {
|
|
36865
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
36865
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-g44y7s0w.js");
|
|
36866
36866
|
let config;
|
|
36867
36867
|
try {
|
|
36868
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
36868
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
36869
36869
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
36870
36870
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
36871
36871
|
} catch {
|
|
@@ -38176,7 +38176,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
38176
38176
|
const result = runConfigDoctor(config, directory);
|
|
38177
38177
|
let output;
|
|
38178
38178
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
38179
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
38179
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-96qyv31a.js");
|
|
38180
38180
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
38181
38181
|
applyLossy: true
|
|
38182
38182
|
});
|
|
@@ -39116,7 +39116,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
39116
39116
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
39117
39117
|
}
|
|
39118
39118
|
async function handleEvidenceSummaryCommand(directory) {
|
|
39119
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
39119
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-dv4bt2bx.js");
|
|
39120
39120
|
const artifact = await buildEvidenceSummary(directory);
|
|
39121
39121
|
if (!artifact) {
|
|
39122
39122
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -50321,6 +50321,8 @@ var QUERIES = {
|
|
|
50321
50321
|
) @func.def
|
|
50322
50322
|
(class_declaration name: (name) @class.name) @class.def
|
|
50323
50323
|
(interface_declaration name: (name) @interface.name) @interface.def
|
|
50324
|
+
(trait_declaration name: (name) @trait.name) @trait.def
|
|
50325
|
+
(enum_declaration name: (name) @enum.name) @enum.def
|
|
50324
50326
|
`,
|
|
50325
50327
|
imports: `
|
|
50326
50328
|
(namespace_use_declaration) @import
|
|
@@ -50567,6 +50569,7 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50567
50569
|
defNameKeys.add(nodeKey(nameNode));
|
|
50568
50570
|
}
|
|
50569
50571
|
}
|
|
50572
|
+
augmentNativeDynamicDefs(grammarId, root.text, defs);
|
|
50570
50573
|
const importsWithIndex = [];
|
|
50571
50574
|
const addImport = (entry, node) => {
|
|
50572
50575
|
if (!entry)
|
|
@@ -50648,12 +50651,28 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50648
50651
|
}
|
|
50649
50652
|
}
|
|
50650
50653
|
}
|
|
50651
|
-
if (isEsMGrammar(grammarId)) {
|
|
50654
|
+
if (isEsMGrammar(grammarId) || grammarId === "dart") {
|
|
50652
50655
|
for (const exportNode of exportNodes) {
|
|
50653
50656
|
addImport(parseImport(grammarId, exportNode.text.trim()), exportNode);
|
|
50654
50657
|
}
|
|
50655
50658
|
}
|
|
50656
|
-
const
|
|
50659
|
+
for (const fallback of fallbackImportsForSource(grammarId, root.text)) {
|
|
50660
|
+
importsWithIndex.push(fallback);
|
|
50661
|
+
}
|
|
50662
|
+
const seenImports = new Set;
|
|
50663
|
+
const imports = importsWithIndex.sort((a, b) => a.index - b.index).map((item) => item.entry).filter((entry) => {
|
|
50664
|
+
const key = JSON.stringify([
|
|
50665
|
+
entry.specifier,
|
|
50666
|
+
entry.importType,
|
|
50667
|
+
entry.bindings,
|
|
50668
|
+
entry.reExport ?? false,
|
|
50669
|
+
entry.exportedBindings ?? []
|
|
50670
|
+
]);
|
|
50671
|
+
if (seenImports.has(key))
|
|
50672
|
+
return false;
|
|
50673
|
+
seenImports.add(key);
|
|
50674
|
+
return true;
|
|
50675
|
+
});
|
|
50657
50676
|
const topLevelDefs = defNodes.filter((d) => isTopLevelDef(d.node, root)).map((d) => ({ name: d.name, node: d.node }));
|
|
50658
50677
|
const refs = [];
|
|
50659
50678
|
const refParamTypes = grammarId === "swift" ? SWIFT_REF_PARAM_TYPES : PARAM_TYPES;
|
|
@@ -50698,7 +50717,390 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50698
50717
|
});
|
|
50699
50718
|
}
|
|
50700
50719
|
}
|
|
50701
|
-
|
|
50720
|
+
const normalizedDefs = defs.map((def) => ({
|
|
50721
|
+
...def,
|
|
50722
|
+
endLine: Math.max(def.endLine, def.startLine)
|
|
50723
|
+
}));
|
|
50724
|
+
return { defs: normalizedDefs, imports, refs };
|
|
50725
|
+
}
|
|
50726
|
+
function augmentNativeDynamicDefs(grammarId, source, defs) {
|
|
50727
|
+
switch (grammarId) {
|
|
50728
|
+
case "dart":
|
|
50729
|
+
augmentDartDefs(source, defs);
|
|
50730
|
+
return;
|
|
50731
|
+
case "ruby":
|
|
50732
|
+
augmentRubyDefs(source, defs);
|
|
50733
|
+
return;
|
|
50734
|
+
case "php":
|
|
50735
|
+
augmentPhpDefs(source, defs);
|
|
50736
|
+
return;
|
|
50737
|
+
}
|
|
50738
|
+
}
|
|
50739
|
+
function upsertAugmentedDef(defs, def) {
|
|
50740
|
+
const existing = defs.find((item) => item.name === def.name && item.startLine === def.startLine);
|
|
50741
|
+
if (existing) {
|
|
50742
|
+
existing.kind = def.kind;
|
|
50743
|
+
existing.exported = def.exported;
|
|
50744
|
+
existing.visibilityInfo = def.visibilityInfo;
|
|
50745
|
+
existing.endLine = Math.max(existing.endLine, def.endLine);
|
|
50746
|
+
return;
|
|
50747
|
+
}
|
|
50748
|
+
defs.push(def);
|
|
50749
|
+
}
|
|
50750
|
+
function symbolVisibilityInfo(visibility, exported, exportedReason) {
|
|
50751
|
+
return {
|
|
50752
|
+
exported,
|
|
50753
|
+
visibility,
|
|
50754
|
+
exportedReason,
|
|
50755
|
+
apiSurfaceKind: exported ? "public" : "private"
|
|
50756
|
+
};
|
|
50757
|
+
}
|
|
50758
|
+
function addRegexDef(defs, source, name, kind, start, end, visibility, exported, exportedReason) {
|
|
50759
|
+
upsertAugmentedDef(defs, {
|
|
50760
|
+
name,
|
|
50761
|
+
kind,
|
|
50762
|
+
exported,
|
|
50763
|
+
visibilityInfo: symbolVisibilityInfo(visibility, exported, exportedReason),
|
|
50764
|
+
startLine: lineNumberAt(source, start),
|
|
50765
|
+
endLine: lineNumberAt(source, end)
|
|
50766
|
+
});
|
|
50767
|
+
}
|
|
50768
|
+
function findMatchingBrace(source, openIndex) {
|
|
50769
|
+
if (source[openIndex] !== "{")
|
|
50770
|
+
return null;
|
|
50771
|
+
let depth = 0;
|
|
50772
|
+
for (let i = openIndex;i < source.length; i++) {
|
|
50773
|
+
const ch = source[i];
|
|
50774
|
+
if (ch === "{")
|
|
50775
|
+
depth++;
|
|
50776
|
+
else if (ch === "}") {
|
|
50777
|
+
depth--;
|
|
50778
|
+
if (depth === 0)
|
|
50779
|
+
return i;
|
|
50780
|
+
}
|
|
50781
|
+
}
|
|
50782
|
+
return null;
|
|
50783
|
+
}
|
|
50784
|
+
function lineNumberAt(text, index) {
|
|
50785
|
+
let line = 1;
|
|
50786
|
+
for (let i = 0;i < index && i < text.length; i++) {
|
|
50787
|
+
if (text[i] === `
|
|
50788
|
+
`)
|
|
50789
|
+
line++;
|
|
50790
|
+
}
|
|
50791
|
+
return line;
|
|
50792
|
+
}
|
|
50793
|
+
function advanceLineOffset(source, offset, lineLength) {
|
|
50794
|
+
const after = offset + lineLength;
|
|
50795
|
+
if (source[after] === "\r" && source[after + 1] === `
|
|
50796
|
+
`)
|
|
50797
|
+
return after + 2;
|
|
50798
|
+
if (source[after] === `
|
|
50799
|
+
` || source[after] === "\r")
|
|
50800
|
+
return after + 1;
|
|
50801
|
+
return after;
|
|
50802
|
+
}
|
|
50803
|
+
function declarationEnd(source, start) {
|
|
50804
|
+
const open2 = source.indexOf("{", start);
|
|
50805
|
+
const semi = source.indexOf(";", start);
|
|
50806
|
+
if (open2 !== -1 && (semi === -1 || open2 < semi)) {
|
|
50807
|
+
return findMatchingBrace(source, open2) ?? open2;
|
|
50808
|
+
}
|
|
50809
|
+
return semi === -1 ? start : semi;
|
|
50810
|
+
}
|
|
50811
|
+
var dartTypeRe = /\b(extension\s+type|class|mixin|enum|extension|typedef)\s+(?!on\b)([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
50812
|
+
function maskCommentsForAugment(source) {
|
|
50813
|
+
let out = "";
|
|
50814
|
+
let inBlock = false;
|
|
50815
|
+
let quote = null;
|
|
50816
|
+
for (let i = 0;i < source.length; i++) {
|
|
50817
|
+
const ch = source[i];
|
|
50818
|
+
const two = source.substring(i, i + 2);
|
|
50819
|
+
if (quote !== null) {
|
|
50820
|
+
if (ch === "\\") {
|
|
50821
|
+
out += " ";
|
|
50822
|
+
i++;
|
|
50823
|
+
continue;
|
|
50824
|
+
}
|
|
50825
|
+
if (ch === quote) {
|
|
50826
|
+
quote = null;
|
|
50827
|
+
out += ch;
|
|
50828
|
+
} else {
|
|
50829
|
+
out += ch === `
|
|
50830
|
+
` ? `
|
|
50831
|
+
` : " ";
|
|
50832
|
+
}
|
|
50833
|
+
continue;
|
|
50834
|
+
}
|
|
50835
|
+
if (!inBlock && two === "/*") {
|
|
50836
|
+
inBlock = true;
|
|
50837
|
+
out += " ";
|
|
50838
|
+
i++;
|
|
50839
|
+
continue;
|
|
50840
|
+
}
|
|
50841
|
+
if (inBlock) {
|
|
50842
|
+
if (two === "*/") {
|
|
50843
|
+
inBlock = false;
|
|
50844
|
+
out += " ";
|
|
50845
|
+
i++;
|
|
50846
|
+
} else {
|
|
50847
|
+
out += source[i] === `
|
|
50848
|
+
` ? `
|
|
50849
|
+
` : " ";
|
|
50850
|
+
}
|
|
50851
|
+
continue;
|
|
50852
|
+
}
|
|
50853
|
+
if (two === "//" || source[i] === "#") {
|
|
50854
|
+
out += two === "//" ? " " : " ";
|
|
50855
|
+
if (two === "//")
|
|
50856
|
+
i++;
|
|
50857
|
+
while (i + 1 < source.length && source[i + 1] !== `
|
|
50858
|
+
`) {
|
|
50859
|
+
out += " ";
|
|
50860
|
+
i++;
|
|
50861
|
+
}
|
|
50862
|
+
continue;
|
|
50863
|
+
}
|
|
50864
|
+
if (ch === '"' || ch === "'") {
|
|
50865
|
+
if (source[i + 1] === ch && source[i + 2] === ch) {
|
|
50866
|
+
out += ch + ch + ch;
|
|
50867
|
+
i += 2;
|
|
50868
|
+
while (i + 1 < source.length) {
|
|
50869
|
+
if (source[i + 1] === ch && source[i + 2] === ch && source[i + 3] === ch) {
|
|
50870
|
+
out += ch + ch + ch;
|
|
50871
|
+
i += 3;
|
|
50872
|
+
break;
|
|
50873
|
+
}
|
|
50874
|
+
out += source[i + 1] === `
|
|
50875
|
+
` ? `
|
|
50876
|
+
` : " ";
|
|
50877
|
+
i++;
|
|
50878
|
+
}
|
|
50879
|
+
continue;
|
|
50880
|
+
}
|
|
50881
|
+
quote = ch;
|
|
50882
|
+
out += ch;
|
|
50883
|
+
continue;
|
|
50884
|
+
}
|
|
50885
|
+
out += ch;
|
|
50886
|
+
}
|
|
50887
|
+
return out;
|
|
50888
|
+
}
|
|
50889
|
+
function augmentDartDefs(source, defs) {
|
|
50890
|
+
const masked = maskCommentsForAugment(source);
|
|
50891
|
+
dartTypeRe.lastIndex = 0;
|
|
50892
|
+
for (let m = dartTypeRe.exec(masked);m !== null; m = dartTypeRe.exec(masked)) {
|
|
50893
|
+
const exported = !m[2].startsWith("_");
|
|
50894
|
+
const kindWord = m[1].trim().split(/\s+/).pop() ?? m[1];
|
|
50895
|
+
addRegexDef(defs, source, m[2], kindWord === "enum" ? "enum" : kindWord === "class" ? "class" : "type", m.index, declarationEnd(masked, m.index), exported ? "public" : "private", exported, exported ? "naming_convention" : "unknown");
|
|
50896
|
+
}
|
|
50897
|
+
}
|
|
50898
|
+
var rubyMethodDefNameRe = /^def\s+(?:(self)\.)?([A-Za-z_][A-Za-z0-9_?!]*)/;
|
|
50899
|
+
var rubyTargetedVisibilityRe = /^(private|protected)\s+((?::[A-Za-z_][A-Za-z0-9_?!]*\s*,\s*)*:[A-Za-z_][A-Za-z0-9_?!]*)$/;
|
|
50900
|
+
var rubyEndWordRe = /\bend\b/g;
|
|
50901
|
+
var rubyHeredocOpenRe = /(?:^|[=(,[]\s*|(?:puts|print|raise|return|p)\s+)<<[~-]?['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/;
|
|
50902
|
+
function augmentRubyDefs(source, defs) {
|
|
50903
|
+
const lines = source.split(/\r?\n/);
|
|
50904
|
+
const state = {
|
|
50905
|
+
visibility: "public",
|
|
50906
|
+
stack: [],
|
|
50907
|
+
endLevel: 0,
|
|
50908
|
+
heredocId: null
|
|
50909
|
+
};
|
|
50910
|
+
let offset = 0;
|
|
50911
|
+
for (const line of lines) {
|
|
50912
|
+
const trimmed = line.trim();
|
|
50913
|
+
if (state.heredocId !== null) {
|
|
50914
|
+
if (trimmed === state.heredocId)
|
|
50915
|
+
state.heredocId = null;
|
|
50916
|
+
} else {
|
|
50917
|
+
const open2 = trimmed.match(rubyHeredocOpenRe);
|
|
50918
|
+
if (open2)
|
|
50919
|
+
state.heredocId = open2[1];
|
|
50920
|
+
augmentRubyLine(trimmed, line, offset, source, defs, state);
|
|
50921
|
+
}
|
|
50922
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
50923
|
+
}
|
|
50924
|
+
}
|
|
50925
|
+
function augmentRubyLine(trimmed, line, offset, source, defs, state) {
|
|
50926
|
+
if (trimmed === "private" || trimmed === "protected") {
|
|
50927
|
+
state.visibility = trimmed;
|
|
50928
|
+
}
|
|
50929
|
+
const targeted = trimmed.match(rubyTargetedVisibilityRe);
|
|
50930
|
+
if (targeted) {
|
|
50931
|
+
const visibility = targeted[1];
|
|
50932
|
+
for (const name of targeted[2].split(",").map((part) => part.trim())) {
|
|
50933
|
+
const sym = name.replace(/^:/, "");
|
|
50934
|
+
for (let i = defs.length - 1;i >= 0; i--) {
|
|
50935
|
+
const d = defs[i];
|
|
50936
|
+
if (d.name === sym && d.startLine <= lineNumberAt(source, offset)) {
|
|
50937
|
+
d.exported = false;
|
|
50938
|
+
d.visibilityInfo = symbolVisibilityInfo(visibility, false, "unknown");
|
|
50939
|
+
break;
|
|
50940
|
+
}
|
|
50941
|
+
}
|
|
50942
|
+
}
|
|
50943
|
+
}
|
|
50944
|
+
const moduleMatch = trimmed.match(/^module\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
50945
|
+
const classMatch = trimmed.match(/^class\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
50946
|
+
if (moduleMatch || classMatch) {
|
|
50947
|
+
state.stack.push({
|
|
50948
|
+
visibility: state.visibility,
|
|
50949
|
+
atEndLevel: state.endLevel
|
|
50950
|
+
});
|
|
50951
|
+
state.visibility = "public";
|
|
50952
|
+
state.endLevel++;
|
|
50953
|
+
const name = (moduleMatch ?? classMatch)[1];
|
|
50954
|
+
addRegexDef(defs, source, name, moduleMatch ? "type" : "class", offset + line.indexOf((moduleMatch ?? classMatch)[0]), offset + line.length, "public", true, "module_public");
|
|
50955
|
+
}
|
|
50956
|
+
const constMatch = trimmed.match(/^([A-Z][A-Za-z0-9_]*)\s*=/);
|
|
50957
|
+
if (constMatch) {
|
|
50958
|
+
addRegexDef(defs, source, constMatch[1], "const", offset + line.indexOf(constMatch[1]), offset + line.length, "public", true, "module_public");
|
|
50959
|
+
}
|
|
50960
|
+
const methodMatch = trimmed.match(rubyMethodDefNameRe);
|
|
50961
|
+
if (methodMatch) {
|
|
50962
|
+
state.endLevel++;
|
|
50963
|
+
const isSingleton = Boolean(methodMatch[1]);
|
|
50964
|
+
const shortName = methodMatch[2];
|
|
50965
|
+
const name = isSingleton ? `self.${shortName}` : shortName;
|
|
50966
|
+
const visibility = isSingleton ? "public" : state.visibility;
|
|
50967
|
+
const exported = visibility !== "private" && !shortName.startsWith("_");
|
|
50968
|
+
addRegexDef(defs, source, name, "method", offset + line.indexOf("def"), offset + line.length, visibility, exported, exported ? "module_public" : "unknown");
|
|
50969
|
+
}
|
|
50970
|
+
rubyEndWordRe.lastIndex = 0;
|
|
50971
|
+
const ends = trimmed.match(rubyEndWordRe)?.length ?? 0;
|
|
50972
|
+
if (ends > 0) {
|
|
50973
|
+
state.endLevel -= ends;
|
|
50974
|
+
while (state.stack.length > 0 && state.endLevel <= state.stack[state.stack.length - 1].atEndLevel) {
|
|
50975
|
+
state.visibility = state.stack.pop().visibility;
|
|
50976
|
+
}
|
|
50977
|
+
}
|
|
50978
|
+
}
|
|
50979
|
+
var phpNamespaceRe = /\bnamespace\s+([^;{]+)\s*[;{]/g;
|
|
50980
|
+
var phpTypeRe = /\b(trait|class|interface|enum)\s+([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
50981
|
+
var phpFunctionRe = /\b(?:(public|protected|private|static|final|abstract)\s+){0,6}function\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g;
|
|
50982
|
+
function augmentPhpDefs(source, defs) {
|
|
50983
|
+
const masked = maskCommentsForAugment(source);
|
|
50984
|
+
phpNamespaceRe.lastIndex = 0;
|
|
50985
|
+
for (let m = phpNamespaceRe.exec(masked);m !== null; m = phpNamespaceRe.exec(masked)) {
|
|
50986
|
+
addRegexDef(defs, source, m[1].trim(), "type", m.index, m.index + m[0].length, "public", true, "namespace_public");
|
|
50987
|
+
}
|
|
50988
|
+
const typeRanges = [];
|
|
50989
|
+
phpTypeRe.lastIndex = 0;
|
|
50990
|
+
for (let m = phpTypeRe.exec(masked);m !== null; m = phpTypeRe.exec(masked)) {
|
|
50991
|
+
const bodyStart = masked.indexOf("{", m.index);
|
|
50992
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace(masked, bodyStart);
|
|
50993
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
50994
|
+
typeRanges.push({ start: bodyStart, end: bodyEnd });
|
|
50995
|
+
}
|
|
50996
|
+
addRegexDef(defs, source, m[2], m[1] === "class" ? "class" : m[1] === "enum" ? "enum" : "interface", m.index, declarationEnd(masked, m.index), "public", true, "module_public");
|
|
50997
|
+
}
|
|
50998
|
+
phpFunctionRe.lastIndex = 0;
|
|
50999
|
+
for (let m = phpFunctionRe.exec(masked);m !== null; m = phpFunctionRe.exec(masked)) {
|
|
51000
|
+
const modifiers = m[0].slice(0, m[0].indexOf("function"));
|
|
51001
|
+
const visibility = modifiers.match(/\b(public|protected|private)\b/)?.[1] ?? "public";
|
|
51002
|
+
const exported = visibility !== "private" && !m[2].startsWith("_");
|
|
51003
|
+
const effectiveVisibility = m[2].startsWith("_") ? "private" : visibility;
|
|
51004
|
+
const kind = typeRanges.some((range) => m.index >= range.start && m.index <= range.end) ? "method" : "function";
|
|
51005
|
+
addRegexDef(defs, source, m[2], kind, m.index, declarationEnd(masked, m.index), effectiveVisibility, exported, exported ? "module_public" : "unknown");
|
|
51006
|
+
}
|
|
51007
|
+
}
|
|
51008
|
+
function fallbackImportsForSource(grammarId, source) {
|
|
51009
|
+
const entries = [];
|
|
51010
|
+
if (grammarId !== "dart" && grammarId !== "ruby" && grammarId !== "php") {
|
|
51011
|
+
return entries;
|
|
51012
|
+
}
|
|
51013
|
+
const masked = maskCommentsForAugment(source);
|
|
51014
|
+
const lines = source.split(/\r?\n/);
|
|
51015
|
+
const maskedLines = masked.split(/\r?\n/);
|
|
51016
|
+
let offset = 0;
|
|
51017
|
+
let heredocId = null;
|
|
51018
|
+
let braceDepth = 0;
|
|
51019
|
+
let pending = null;
|
|
51020
|
+
const flushPending = (endLine) => {
|
|
51021
|
+
if (!pending)
|
|
51022
|
+
return;
|
|
51023
|
+
let parsed = null;
|
|
51024
|
+
if (grammarId === "dart")
|
|
51025
|
+
parsed = parseDartImport(pending.text);
|
|
51026
|
+
else if (grammarId === "php")
|
|
51027
|
+
parsed = parsePhpUse(pending.text);
|
|
51028
|
+
for (const entry of parsed ? Array.isArray(parsed) ? parsed : [parsed] : []) {
|
|
51029
|
+
entries.push({
|
|
51030
|
+
index: pending.startOffset,
|
|
51031
|
+
entry: { ...entry, startLine: pending.startLine, endLine }
|
|
51032
|
+
});
|
|
51033
|
+
}
|
|
51034
|
+
pending = null;
|
|
51035
|
+
};
|
|
51036
|
+
for (let li = 0;li < lines.length; li++) {
|
|
51037
|
+
const line = lines[li];
|
|
51038
|
+
const trimmed = line.trim();
|
|
51039
|
+
const maskedTrimmed = maskedLines[li]?.trim() ?? "";
|
|
51040
|
+
const startLine = lineNumberAt(source, offset);
|
|
51041
|
+
if (grammarId === "ruby") {
|
|
51042
|
+
if (heredocId !== null) {
|
|
51043
|
+
if (maskedTrimmed === heredocId)
|
|
51044
|
+
heredocId = null;
|
|
51045
|
+
} else {
|
|
51046
|
+
const open2 = maskedTrimmed.match(rubyHeredocOpenRe);
|
|
51047
|
+
if (open2)
|
|
51048
|
+
heredocId = open2[1];
|
|
51049
|
+
else {
|
|
51050
|
+
const parsed = parseRubyRequire(trimmed);
|
|
51051
|
+
if (parsed) {
|
|
51052
|
+
entries.push({
|
|
51053
|
+
index: offset,
|
|
51054
|
+
entry: { ...parsed, startLine, endLine: startLine }
|
|
51055
|
+
});
|
|
51056
|
+
}
|
|
51057
|
+
}
|
|
51058
|
+
}
|
|
51059
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51060
|
+
continue;
|
|
51061
|
+
}
|
|
51062
|
+
if (grammarId === "php") {
|
|
51063
|
+
for (const ch of maskedLines[li] ?? "") {
|
|
51064
|
+
if (ch === "{")
|
|
51065
|
+
braceDepth++;
|
|
51066
|
+
else if (ch === "}")
|
|
51067
|
+
braceDepth = Math.max(0, braceDepth - 1);
|
|
51068
|
+
}
|
|
51069
|
+
}
|
|
51070
|
+
if (pending) {
|
|
51071
|
+
pending.text += ` ${trimmed}`;
|
|
51072
|
+
pending.lines++;
|
|
51073
|
+
if (trimmed.includes(";") || pending.lines > 10) {
|
|
51074
|
+
flushPending(startLine);
|
|
51075
|
+
} else if (trimmed === "") {
|
|
51076
|
+
pending = null;
|
|
51077
|
+
}
|
|
51078
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51079
|
+
continue;
|
|
51080
|
+
}
|
|
51081
|
+
const startsStatement = grammarId === "dart" ? /^(import|export)\s/.test(maskedTrimmed) : /^use\s/.test(maskedTrimmed);
|
|
51082
|
+
const inClassBody = grammarId === "php" && braceDepth > 0;
|
|
51083
|
+
if (startsStatement && !inClassBody) {
|
|
51084
|
+
if (trimmed.includes(";")) {
|
|
51085
|
+
let parsed = null;
|
|
51086
|
+
if (grammarId === "dart")
|
|
51087
|
+
parsed = parseDartImport(trimmed);
|
|
51088
|
+
else if (grammarId === "php")
|
|
51089
|
+
parsed = parsePhpUse(trimmed);
|
|
51090
|
+
for (const entry of parsed ? Array.isArray(parsed) ? parsed : [parsed] : []) {
|
|
51091
|
+
entries.push({
|
|
51092
|
+
index: offset,
|
|
51093
|
+
entry: { ...entry, startLine, endLine: startLine }
|
|
51094
|
+
});
|
|
51095
|
+
}
|
|
51096
|
+
} else {
|
|
51097
|
+
pending = { startOffset: offset, startLine, text: trimmed, lines: 1 };
|
|
51098
|
+
}
|
|
51099
|
+
}
|
|
51100
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51101
|
+
}
|
|
51102
|
+
flushPending(lineNumberAt(source, offset));
|
|
51103
|
+
return entries;
|
|
50702
51104
|
}
|
|
50703
51105
|
function safeMatches(lang, pattern, root) {
|
|
50704
51106
|
if (!_QueryCtor)
|
|
@@ -51152,28 +51554,52 @@ function parseSwiftImport(text) {
|
|
|
51152
51554
|
}
|
|
51153
51555
|
function parseDartImport(text) {
|
|
51154
51556
|
const t = text.trim();
|
|
51155
|
-
const
|
|
51156
|
-
if (
|
|
51557
|
+
const exportMatch = t.match(/^export\s+['"]([^'"]+)['"](?:\s+show\s+([^;]+))?/);
|
|
51558
|
+
if (exportMatch) {
|
|
51559
|
+
const shown = exportMatch[2]?.split(",").map((part) => part.trim()).filter(Boolean);
|
|
51560
|
+
const bindings = shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : [{ imported: "*", local: "*" }];
|
|
51157
51561
|
return {
|
|
51158
|
-
specifier:
|
|
51159
|
-
importType: "named",
|
|
51160
|
-
bindings
|
|
51562
|
+
specifier: exportMatch[1],
|
|
51563
|
+
importType: shown && shown.length > 0 ? "named" : "namespace",
|
|
51564
|
+
bindings,
|
|
51565
|
+
reExport: true,
|
|
51566
|
+
exportedBindings: bindings.map((binding) => ({
|
|
51567
|
+
imported: binding.imported,
|
|
51568
|
+
exported: binding.local
|
|
51569
|
+
}))
|
|
51161
51570
|
};
|
|
51162
51571
|
}
|
|
51163
|
-
const
|
|
51164
|
-
if (
|
|
51165
|
-
|
|
51572
|
+
const importMatch = t.match(/^import\s+['"]([^'"]+)['"]([^;]*)/);
|
|
51573
|
+
if (importMatch) {
|
|
51574
|
+
const clause = importMatch[2];
|
|
51575
|
+
const alias = clause?.match(/\bas\s+\w+/);
|
|
51576
|
+
const shown = clause?.match(/\bshow\s+([^;]+)/)?.[1].split(",").map((part) => part.trim()).filter(Boolean);
|
|
51577
|
+
const primary = {
|
|
51578
|
+
specifier: importMatch[1],
|
|
51579
|
+
importType: !alias && shown && shown.length > 0 ? "named" : "namespace",
|
|
51580
|
+
bindings: !alias && shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : []
|
|
51581
|
+
};
|
|
51582
|
+
const conditional = clause?.match(/\bif\s*\([^)]*\)\s*['"]([^'"]+)['"]/);
|
|
51583
|
+
if (conditional) {
|
|
51584
|
+
return [
|
|
51585
|
+
primary,
|
|
51586
|
+
{ specifier: conditional[1], importType: "namespace", bindings: [] }
|
|
51587
|
+
];
|
|
51588
|
+
}
|
|
51589
|
+
return primary;
|
|
51166
51590
|
}
|
|
51167
51591
|
return null;
|
|
51168
51592
|
}
|
|
51169
51593
|
function parseRubyRequire(text) {
|
|
51170
51594
|
const t = text.trim();
|
|
51595
|
+
const isRequireRelative = /^require_relative\b/.test(t);
|
|
51171
51596
|
const stripped = t.replace(/^(?:require(?:_relative)?)\s+['"]?/, "").replace(/['"]$/, "");
|
|
51172
51597
|
if (!stripped || stripped === t)
|
|
51173
51598
|
return null;
|
|
51174
|
-
const
|
|
51599
|
+
const specifier = isRequireRelative && !stripped.startsWith(".") ? `./${stripped}` : stripped;
|
|
51600
|
+
const isRelative = specifier.startsWith("./") || specifier.startsWith("../");
|
|
51175
51601
|
return {
|
|
51176
|
-
specifier
|
|
51602
|
+
specifier,
|
|
51177
51603
|
importType: isRelative ? "default" : "namespace",
|
|
51178
51604
|
bindings: []
|
|
51179
51605
|
};
|
|
@@ -51185,7 +51611,7 @@ function parsePhpUse(text) {
|
|
|
51185
51611
|
return {
|
|
51186
51612
|
specifier: m[1],
|
|
51187
51613
|
importType: "named",
|
|
51188
|
-
bindings: [{ imported: m[1], local: m[2] }]
|
|
51614
|
+
bindings: [{ imported: m[1].split("\\").pop() ?? m[1], local: m[2] }]
|
|
51189
51615
|
};
|
|
51190
51616
|
}
|
|
51191
51617
|
const simple = t.match(/^use\s+(?:(?:function|const)\s+)?([^;\s]+)\s*;?\s*$/i);
|
|
@@ -51261,7 +51687,10 @@ var IMPORT_ANCESTOR_TYPES = new Set([
|
|
|
51261
51687
|
"use_declaration",
|
|
51262
51688
|
"using_directive",
|
|
51263
51689
|
"namespace_use_declaration",
|
|
51264
|
-
"
|
|
51690
|
+
"namespace_use_clause",
|
|
51691
|
+
"library_import",
|
|
51692
|
+
"library_export",
|
|
51693
|
+
"export_directive"
|
|
51265
51694
|
]);
|
|
51266
51695
|
function isInsideImportStatement(node) {
|
|
51267
51696
|
return hasAncestorOfType(node, IMPORT_ANCESTOR_TYPES);
|
|
@@ -51308,7 +51737,13 @@ var SYMBOL_EXTENSIONS = new Set([
|
|
|
51308
51737
|
".py",
|
|
51309
51738
|
".pyw",
|
|
51310
51739
|
".rs",
|
|
51311
|
-
".go"
|
|
51740
|
+
".go",
|
|
51741
|
+
".dart",
|
|
51742
|
+
".rb",
|
|
51743
|
+
".rake",
|
|
51744
|
+
".gemspec",
|
|
51745
|
+
".php",
|
|
51746
|
+
".phtml"
|
|
51312
51747
|
]);
|
|
51313
51748
|
var SKIP_DIRECTORIES = new Set([
|
|
51314
51749
|
"node_modules",
|
|
@@ -51735,6 +52170,346 @@ function extractGoSymbols(filePath, cwd) {
|
|
|
51735
52170
|
return a.name.localeCompare(b.name);
|
|
51736
52171
|
});
|
|
51737
52172
|
}
|
|
52173
|
+
var memoSource = null;
|
|
52174
|
+
var memoStarts = [0];
|
|
52175
|
+
function lineStartsOf(content) {
|
|
52176
|
+
if (memoSource !== content) {
|
|
52177
|
+
const starts = [0];
|
|
52178
|
+
for (let i = 0;i < content.length; i++) {
|
|
52179
|
+
if (content[i] === `
|
|
52180
|
+
`)
|
|
52181
|
+
starts.push(i + 1);
|
|
52182
|
+
}
|
|
52183
|
+
memoSource = content;
|
|
52184
|
+
memoStarts = starts;
|
|
52185
|
+
}
|
|
52186
|
+
return memoStarts;
|
|
52187
|
+
}
|
|
52188
|
+
function lineNumberAt2(content, index) {
|
|
52189
|
+
const starts = lineStartsOf(content);
|
|
52190
|
+
let lo = 0;
|
|
52191
|
+
let hi = starts.length - 1;
|
|
52192
|
+
while (lo < hi) {
|
|
52193
|
+
const mid = lo + hi + 1 >> 1;
|
|
52194
|
+
if (starts[mid] <= index)
|
|
52195
|
+
lo = mid;
|
|
52196
|
+
else
|
|
52197
|
+
hi = mid - 1;
|
|
52198
|
+
}
|
|
52199
|
+
return lo + 1;
|
|
52200
|
+
}
|
|
52201
|
+
function advanceLineOffset2(source, offset, lineLength) {
|
|
52202
|
+
const after = offset + lineLength;
|
|
52203
|
+
if (source[after] === "\r" && source[after + 1] === `
|
|
52204
|
+
`)
|
|
52205
|
+
return after + 2;
|
|
52206
|
+
if (source[after] === `
|
|
52207
|
+
` || source[after] === "\r")
|
|
52208
|
+
return after + 1;
|
|
52209
|
+
return after;
|
|
52210
|
+
}
|
|
52211
|
+
function lineTextAt(content, index) {
|
|
52212
|
+
const lineStart = content.lastIndexOf(`
|
|
52213
|
+
`, Math.max(0, index - 1)) + 1;
|
|
52214
|
+
const lineEnd = content.indexOf(`
|
|
52215
|
+
`, lineStart);
|
|
52216
|
+
return content.substring(lineStart, lineEnd === -1 ? content.length : lineEnd).trim().substring(0, 120);
|
|
52217
|
+
}
|
|
52218
|
+
function findMatchingBrace2(content, openIndex) {
|
|
52219
|
+
if (content[openIndex] !== "{")
|
|
52220
|
+
return null;
|
|
52221
|
+
let depth = 0;
|
|
52222
|
+
for (let i = openIndex;i < content.length; i++) {
|
|
52223
|
+
const ch = content[i];
|
|
52224
|
+
if (ch === "{")
|
|
52225
|
+
depth++;
|
|
52226
|
+
else if (ch === "}") {
|
|
52227
|
+
depth--;
|
|
52228
|
+
if (depth === 0)
|
|
52229
|
+
return i;
|
|
52230
|
+
}
|
|
52231
|
+
}
|
|
52232
|
+
return null;
|
|
52233
|
+
}
|
|
52234
|
+
function stripLineCommentsForScan(content) {
|
|
52235
|
+
let out = "";
|
|
52236
|
+
let inBlock = false;
|
|
52237
|
+
let quote = null;
|
|
52238
|
+
for (let i = 0;i < content.length; i++) {
|
|
52239
|
+
const ch = content[i];
|
|
52240
|
+
const two = content.substring(i, i + 2);
|
|
52241
|
+
if (quote !== null) {
|
|
52242
|
+
if (ch === "\\") {
|
|
52243
|
+
out += " ";
|
|
52244
|
+
i++;
|
|
52245
|
+
continue;
|
|
52246
|
+
}
|
|
52247
|
+
if (ch === quote) {
|
|
52248
|
+
quote = null;
|
|
52249
|
+
out += ch;
|
|
52250
|
+
} else {
|
|
52251
|
+
out += ch === `
|
|
52252
|
+
` ? `
|
|
52253
|
+
` : " ";
|
|
52254
|
+
}
|
|
52255
|
+
continue;
|
|
52256
|
+
}
|
|
52257
|
+
if (!inBlock && two === "/*") {
|
|
52258
|
+
inBlock = true;
|
|
52259
|
+
out += " ";
|
|
52260
|
+
i++;
|
|
52261
|
+
continue;
|
|
52262
|
+
}
|
|
52263
|
+
if (inBlock) {
|
|
52264
|
+
if (two === "*/") {
|
|
52265
|
+
inBlock = false;
|
|
52266
|
+
out += " ";
|
|
52267
|
+
i++;
|
|
52268
|
+
} else {
|
|
52269
|
+
out += ch === `
|
|
52270
|
+
` ? `
|
|
52271
|
+
` : " ";
|
|
52272
|
+
}
|
|
52273
|
+
continue;
|
|
52274
|
+
}
|
|
52275
|
+
if (two === "//" || ch === "#") {
|
|
52276
|
+
out += two === "//" ? " " : " ";
|
|
52277
|
+
if (two === "//")
|
|
52278
|
+
i++;
|
|
52279
|
+
while (i + 1 < content.length && content[i + 1] !== `
|
|
52280
|
+
`) {
|
|
52281
|
+
out += " ";
|
|
52282
|
+
i++;
|
|
52283
|
+
}
|
|
52284
|
+
continue;
|
|
52285
|
+
}
|
|
52286
|
+
if (ch === '"' || ch === "'") {
|
|
52287
|
+
if (ch === content[i + 1] && ch === content[i + 2]) {
|
|
52288
|
+
out += ch + ch + ch;
|
|
52289
|
+
i += 2;
|
|
52290
|
+
while (i + 1 < content.length) {
|
|
52291
|
+
if (content[i + 1] === ch && content[i + 2] === ch && content[i + 3] === ch) {
|
|
52292
|
+
out += ch + ch + ch;
|
|
52293
|
+
i += 3;
|
|
52294
|
+
break;
|
|
52295
|
+
}
|
|
52296
|
+
out += content[i + 1] === `
|
|
52297
|
+
` ? `
|
|
52298
|
+
` : " ";
|
|
52299
|
+
i++;
|
|
52300
|
+
}
|
|
52301
|
+
continue;
|
|
52302
|
+
}
|
|
52303
|
+
quote = ch;
|
|
52304
|
+
out += ch;
|
|
52305
|
+
continue;
|
|
52306
|
+
}
|
|
52307
|
+
out += ch;
|
|
52308
|
+
}
|
|
52309
|
+
return out;
|
|
52310
|
+
}
|
|
52311
|
+
function addUniqueSymbol(symbols, seen, candidate) {
|
|
52312
|
+
const key = `${candidate.name}:${candidate.kind}`;
|
|
52313
|
+
if (seen.has(key))
|
|
52314
|
+
return;
|
|
52315
|
+
seen.add(key);
|
|
52316
|
+
symbols.push(candidate);
|
|
52317
|
+
}
|
|
52318
|
+
function sortSymbols(symbols) {
|
|
52319
|
+
return symbols.sort((a, b) => {
|
|
52320
|
+
if (a.line !== b.line)
|
|
52321
|
+
return a.line - b.line;
|
|
52322
|
+
return a.name.localeCompare(b.name);
|
|
52323
|
+
});
|
|
52324
|
+
}
|
|
52325
|
+
function extractDartSymbols(filePath, cwd) {
|
|
52326
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52327
|
+
if (raw === null)
|
|
52328
|
+
return [];
|
|
52329
|
+
const content = stripLineCommentsForScan(raw);
|
|
52330
|
+
const symbols = [];
|
|
52331
|
+
const seen = new Set;
|
|
52332
|
+
const typeBodies = [];
|
|
52333
|
+
for (const match of content.matchAll(/\b(extension\s+type|class|mixin|enum|extension|typedef)\s+(?!on\b)([A-Za-z_][A-Za-z0-9_]*)/g)) {
|
|
52334
|
+
const kindWord = match[1].trim().split(/\s+/).pop() ?? match[1];
|
|
52335
|
+
const kind = kindWord === "enum" ? "enum" : kindWord === "class" ? "class" : "type";
|
|
52336
|
+
const bodyStart = content.indexOf("{", match.index);
|
|
52337
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace2(content, bodyStart);
|
|
52338
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
52339
|
+
typeBodies.push({ start: bodyStart, end: bodyEnd, name: match[2] });
|
|
52340
|
+
}
|
|
52341
|
+
addUniqueSymbol(symbols, seen, {
|
|
52342
|
+
name: match[2],
|
|
52343
|
+
kind,
|
|
52344
|
+
exported: !match[2].startsWith("_"),
|
|
52345
|
+
signature: lineTextAt(raw, match.index),
|
|
52346
|
+
line: lineNumberAt2(raw, match.index)
|
|
52347
|
+
});
|
|
52348
|
+
}
|
|
52349
|
+
const dartFunctionRe = /\b(?:void|[A-Za-z_][A-Za-z0-9_<>,?]*)\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g;
|
|
52350
|
+
const KEYWORD_NAME_SKIP = new Set([
|
|
52351
|
+
"if",
|
|
52352
|
+
"for",
|
|
52353
|
+
"while",
|
|
52354
|
+
"switch",
|
|
52355
|
+
"return",
|
|
52356
|
+
"else",
|
|
52357
|
+
"throw",
|
|
52358
|
+
"new",
|
|
52359
|
+
"await",
|
|
52360
|
+
"yield",
|
|
52361
|
+
"case",
|
|
52362
|
+
"catch",
|
|
52363
|
+
"Function"
|
|
52364
|
+
]);
|
|
52365
|
+
const KEYWORD_TYPE_SKIP = new Set([
|
|
52366
|
+
"return",
|
|
52367
|
+
"else",
|
|
52368
|
+
"throw",
|
|
52369
|
+
"new",
|
|
52370
|
+
"await",
|
|
52371
|
+
"yield",
|
|
52372
|
+
"case",
|
|
52373
|
+
"catch",
|
|
52374
|
+
"final",
|
|
52375
|
+
"const"
|
|
52376
|
+
]);
|
|
52377
|
+
for (const match of content.matchAll(dartFunctionRe)) {
|
|
52378
|
+
if (KEYWORD_NAME_SKIP.has(match[1]))
|
|
52379
|
+
continue;
|
|
52380
|
+
if (KEYWORD_TYPE_SKIP.has(match[0].split(/\s+/)[0]))
|
|
52381
|
+
continue;
|
|
52382
|
+
const enclosing = typeBodies.find((body) => match.index >= body.start && match.index <= body.end);
|
|
52383
|
+
addUniqueSymbol(symbols, seen, {
|
|
52384
|
+
name: enclosing ? `${enclosing.name}.${match[1]}` : match[1],
|
|
52385
|
+
kind: enclosing ? "method" : "function",
|
|
52386
|
+
exported: !match[1].startsWith("_"),
|
|
52387
|
+
signature: lineTextAt(raw, match.index),
|
|
52388
|
+
line: lineNumberAt2(raw, match.index)
|
|
52389
|
+
});
|
|
52390
|
+
}
|
|
52391
|
+
return sortSymbols(symbols);
|
|
52392
|
+
}
|
|
52393
|
+
function extractRubySymbols(filePath, cwd) {
|
|
52394
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52395
|
+
if (raw === null)
|
|
52396
|
+
return [];
|
|
52397
|
+
const symbols = [];
|
|
52398
|
+
const seen = new Set;
|
|
52399
|
+
const byName = new Map;
|
|
52400
|
+
let offset = 0;
|
|
52401
|
+
let currentVisibility = "public";
|
|
52402
|
+
const visibilityStack = [];
|
|
52403
|
+
let endLevel = 0;
|
|
52404
|
+
let heredocId = null;
|
|
52405
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
52406
|
+
const trimmed = line.trim();
|
|
52407
|
+
if (heredocId !== null) {
|
|
52408
|
+
if (trimmed === heredocId)
|
|
52409
|
+
heredocId = null;
|
|
52410
|
+
} else {
|
|
52411
|
+
const open2 = trimmed.match(/(?:^|[=(,[]\s*|(?:puts|print|raise|return|p)\s+)<<[~-]?['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/);
|
|
52412
|
+
if (open2)
|
|
52413
|
+
heredocId = open2[1];
|
|
52414
|
+
if (trimmed === "private" || trimmed === "protected") {
|
|
52415
|
+
currentVisibility = trimmed;
|
|
52416
|
+
}
|
|
52417
|
+
const targeted = trimmed.match(/^(private|protected)\s+((?::[A-Za-z_][A-Za-z0-9_?!]*\s*,\s*)*:[A-Za-z_][A-Za-z0-9_?!]*)$/);
|
|
52418
|
+
if (targeted) {
|
|
52419
|
+
for (const part of targeted[2].split(",")) {
|
|
52420
|
+
const sym = byName.get(part.trim().replace(/^:/, ""));
|
|
52421
|
+
if (sym) {
|
|
52422
|
+
sym.exported = false;
|
|
52423
|
+
}
|
|
52424
|
+
}
|
|
52425
|
+
}
|
|
52426
|
+
const moduleMatch = trimmed.match(/^module\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
52427
|
+
const classMatch = trimmed.match(/^class\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
52428
|
+
if (moduleMatch || classMatch) {
|
|
52429
|
+
visibilityStack.push({
|
|
52430
|
+
visibility: currentVisibility,
|
|
52431
|
+
atEndLevel: endLevel
|
|
52432
|
+
});
|
|
52433
|
+
currentVisibility = "public";
|
|
52434
|
+
endLevel++;
|
|
52435
|
+
}
|
|
52436
|
+
const constMatch = trimmed.match(/^([A-Z][A-Za-z0-9_]*)\s*=/);
|
|
52437
|
+
const methodMatch = trimmed.match(/^def\s+(?:(self)\.)?([A-Za-z_][A-Za-z0-9_?!]*)/);
|
|
52438
|
+
if (methodMatch)
|
|
52439
|
+
endLevel++;
|
|
52440
|
+
const lineIndex = offset + Math.max(0, line.indexOf(trimmed));
|
|
52441
|
+
if (moduleMatch || classMatch || constMatch || methodMatch) {
|
|
52442
|
+
const singleton = Boolean(methodMatch?.[1]);
|
|
52443
|
+
const shortName = methodMatch?.[2];
|
|
52444
|
+
const name = moduleMatch?.[1] ?? classMatch?.[1] ?? constMatch?.[1] ?? (singleton && shortName ? `self.${shortName}` : shortName);
|
|
52445
|
+
const visibility = singleton ? "public" : currentVisibility;
|
|
52446
|
+
const candidate = {
|
|
52447
|
+
name,
|
|
52448
|
+
kind: moduleMatch ? "type" : classMatch ? "class" : constMatch ? "const" : "method",
|
|
52449
|
+
exported: methodMatch ? visibility !== "private" && !(shortName ?? "").startsWith("_") : true,
|
|
52450
|
+
signature: trimmed.substring(0, 100),
|
|
52451
|
+
line: lineNumberAt2(raw, lineIndex)
|
|
52452
|
+
};
|
|
52453
|
+
addUniqueSymbol(symbols, seen, candidate);
|
|
52454
|
+
byName.set(name, candidate);
|
|
52455
|
+
}
|
|
52456
|
+
const ends = trimmed.match(/\bend\b/g)?.length ?? 0;
|
|
52457
|
+
if (ends > 0) {
|
|
52458
|
+
endLevel -= ends;
|
|
52459
|
+
while (visibilityStack.length > 0 && endLevel <= visibilityStack[visibilityStack.length - 1].atEndLevel) {
|
|
52460
|
+
currentVisibility = visibilityStack.pop().visibility;
|
|
52461
|
+
}
|
|
52462
|
+
}
|
|
52463
|
+
}
|
|
52464
|
+
offset = advanceLineOffset2(raw, offset, line.length);
|
|
52465
|
+
}
|
|
52466
|
+
return sortSymbols(symbols);
|
|
52467
|
+
}
|
|
52468
|
+
function extractPhpSymbols(filePath, cwd) {
|
|
52469
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52470
|
+
if (raw === null)
|
|
52471
|
+
return [];
|
|
52472
|
+
const content = stripLineCommentsForScan(raw);
|
|
52473
|
+
const symbols = [];
|
|
52474
|
+
const seen = new Set;
|
|
52475
|
+
const typeRanges = [];
|
|
52476
|
+
for (const match of content.matchAll(/\bnamespace\s+([A-Za-z_\\][A-Za-z0-9_\\]*)\s*[;{]/g)) {
|
|
52477
|
+
addUniqueSymbol(symbols, seen, {
|
|
52478
|
+
name: match[1],
|
|
52479
|
+
kind: "type",
|
|
52480
|
+
exported: true,
|
|
52481
|
+
signature: lineTextAt(raw, match.index),
|
|
52482
|
+
line: lineNumberAt2(raw, match.index)
|
|
52483
|
+
});
|
|
52484
|
+
}
|
|
52485
|
+
for (const match of content.matchAll(/\b(?:final\s+|abstract\s+|readonly\s+)?(class|interface|trait|enum)\s+([A-Za-z_][A-Za-z0-9_]*)/g)) {
|
|
52486
|
+
const bodyStart = content.indexOf("{", match.index);
|
|
52487
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace2(content, bodyStart);
|
|
52488
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
52489
|
+
typeRanges.push({ start: bodyStart, end: bodyEnd });
|
|
52490
|
+
}
|
|
52491
|
+
addUniqueSymbol(symbols, seen, {
|
|
52492
|
+
name: match[2],
|
|
52493
|
+
kind: match[1] === "class" ? "class" : match[1] === "enum" ? "enum" : "interface",
|
|
52494
|
+
exported: !match[2].startsWith("_"),
|
|
52495
|
+
signature: lineTextAt(raw, match.index),
|
|
52496
|
+
line: lineNumberAt2(raw, match.index)
|
|
52497
|
+
});
|
|
52498
|
+
}
|
|
52499
|
+
for (const match of content.matchAll(/\b(?:(public|protected|private|static|final|abstract)\s+){0,6}function\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g)) {
|
|
52500
|
+
const insideType = typeRanges.some((range) => match.index >= range.start && match.index <= range.end);
|
|
52501
|
+
const modifiers = match[0].slice(0, match[0].indexOf("function"));
|
|
52502
|
+
const visibility = modifiers.match(/\b(public|protected|private)\b/)?.[1];
|
|
52503
|
+
addUniqueSymbol(symbols, seen, {
|
|
52504
|
+
name: match[2],
|
|
52505
|
+
kind: insideType ? "method" : "function",
|
|
52506
|
+
exported: visibility !== "private" && !match[2].startsWith("_"),
|
|
52507
|
+
signature: lineTextAt(raw, match.index),
|
|
52508
|
+
line: lineNumberAt2(raw, match.index)
|
|
52509
|
+
});
|
|
52510
|
+
}
|
|
52511
|
+
return sortSymbols(symbols);
|
|
52512
|
+
}
|
|
51738
52513
|
function findSourceFiles(cwd, maxFiles) {
|
|
51739
52514
|
const files = [];
|
|
51740
52515
|
walkDir(cwd, cwd, files, maxFiles);
|
|
@@ -51798,6 +52573,18 @@ function searchWorkspaceSymbols(cwd, name, exportedOnly = true) {
|
|
|
51798
52573
|
case ".go":
|
|
51799
52574
|
syms = extractGoSymbols(relFile, cwd);
|
|
51800
52575
|
break;
|
|
52576
|
+
case ".dart":
|
|
52577
|
+
syms = _internals65.extractDartSymbols(relFile, cwd);
|
|
52578
|
+
break;
|
|
52579
|
+
case ".rb":
|
|
52580
|
+
case ".rake":
|
|
52581
|
+
case ".gemspec":
|
|
52582
|
+
syms = _internals65.extractRubySymbols(relFile, cwd);
|
|
52583
|
+
break;
|
|
52584
|
+
case ".php":
|
|
52585
|
+
case ".phtml":
|
|
52586
|
+
syms = _internals65.extractPhpSymbols(relFile, cwd);
|
|
52587
|
+
break;
|
|
51801
52588
|
default:
|
|
51802
52589
|
continue;
|
|
51803
52590
|
}
|
|
@@ -51836,7 +52623,7 @@ function searchWorkspaceSymbols(cwd, name, exportedOnly = true) {
|
|
|
51836
52623
|
};
|
|
51837
52624
|
}
|
|
51838
52625
|
var symbols = createSwarmTool({
|
|
51839
|
-
description: "Extract all exported symbols from a source file: functions with signatures, " + "classes with public members, interfaces, types, enums, constants. " + "Supports TypeScript/JavaScript, Python, Rust, and
|
|
52626
|
+
description: "Extract all exported symbols from a source file: functions with signatures, " + "classes with public members, interfaces, types, enums, constants. " + "Supports TypeScript/JavaScript, Python, Rust, Go, Dart, Ruby, and PHP. " + "Use for architect planning, designer scaffolding, and understanding module " + "public API surface.",
|
|
51840
52627
|
args: {
|
|
51841
52628
|
file: exports_external.string().optional().describe('File path to extract symbols from (e.g., "src/auth/login.ts"). Required when not using workspace mode.'),
|
|
51842
52629
|
exported_only: exports_external.boolean().default(true).describe("If true, only return exported/public symbols. If false, include all top-level symbols."),
|
|
@@ -51920,10 +52707,22 @@ var symbols = createSwarmTool({
|
|
|
51920
52707
|
case ".go":
|
|
51921
52708
|
syms = extractGoSymbols(file, cwd);
|
|
51922
52709
|
break;
|
|
52710
|
+
case ".dart":
|
|
52711
|
+
syms = _internals65.extractDartSymbols(file, cwd);
|
|
52712
|
+
break;
|
|
52713
|
+
case ".rb":
|
|
52714
|
+
case ".rake":
|
|
52715
|
+
case ".gemspec":
|
|
52716
|
+
syms = _internals65.extractRubySymbols(file, cwd);
|
|
52717
|
+
break;
|
|
52718
|
+
case ".php":
|
|
52719
|
+
case ".phtml":
|
|
52720
|
+
syms = _internals65.extractPhpSymbols(file, cwd);
|
|
52721
|
+
break;
|
|
51923
52722
|
default:
|
|
51924
52723
|
return JSON.stringify({
|
|
51925
52724
|
file,
|
|
51926
|
-
error: `Unsupported file extension: ${ext}. Supported: .ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .pyw, .rs, .go`,
|
|
52725
|
+
error: `Unsupported file extension: ${ext}. Supported: .ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .pyw, .rs, .go, .dart, .rb, .rake, .gemspec, .php, .phtml`,
|
|
51927
52726
|
symbols: []
|
|
51928
52727
|
}, null, 2);
|
|
51929
52728
|
}
|
|
@@ -51940,6 +52739,11 @@ var symbols = createSwarmTool({
|
|
|
51940
52739
|
}, null, 2);
|
|
51941
52740
|
}
|
|
51942
52741
|
});
|
|
52742
|
+
var _internals65 = {
|
|
52743
|
+
extractDartSymbols,
|
|
52744
|
+
extractRubySymbols,
|
|
52745
|
+
extractPhpSymbols
|
|
52746
|
+
};
|
|
51943
52747
|
|
|
51944
52748
|
// src/tools/repo-graph/ontology.ts
|
|
51945
52749
|
import * as path73 from "path";
|
|
@@ -52541,14 +53345,20 @@ var ONTOLOGY_FINDING_SEVERITY_SET = new Set(ONTOLOGY_FINDING_SEVERITY_VALUES);
|
|
|
52541
53345
|
var IMPORT_TYPE_SET = new Set(IMPORT_TYPE_VALUES);
|
|
52542
53346
|
|
|
52543
53347
|
// src/tools/repo-graph/builder.ts
|
|
52544
|
-
var
|
|
53348
|
+
var _internals66 = {
|
|
52545
53349
|
now: Date.now,
|
|
52546
53350
|
safeRealpathSync,
|
|
52547
53351
|
extractTSSymbols,
|
|
52548
53352
|
extractPythonSymbols,
|
|
52549
53353
|
extractRustSymbols,
|
|
52550
53354
|
extractGoSymbols,
|
|
53355
|
+
extractDartSymbols,
|
|
53356
|
+
extractRubySymbols,
|
|
53357
|
+
extractPhpSymbols,
|
|
52551
53358
|
parseFileImports,
|
|
53359
|
+
parseDartFileImports,
|
|
53360
|
+
parseRubyFileImports,
|
|
53361
|
+
parsePhpFileImports,
|
|
52552
53362
|
extractFileOntology,
|
|
52553
53363
|
stripComments: stripComments2,
|
|
52554
53364
|
computeUsedSymbols,
|
|
@@ -52706,6 +53516,15 @@ function parseFileImports(rawContent, sourceFile, workspaceRoot) {
|
|
|
52706
53516
|
if (ext === ".cs" || ext === ".csx") {
|
|
52707
53517
|
return parseCSharpFileImports(rawContent);
|
|
52708
53518
|
}
|
|
53519
|
+
if (ext === ".dart") {
|
|
53520
|
+
return parseDartFileImports(rawContent);
|
|
53521
|
+
}
|
|
53522
|
+
if (ext === ".rb" || ext === ".rake" || ext === ".gemspec") {
|
|
53523
|
+
return parseRubyFileImports(rawContent);
|
|
53524
|
+
}
|
|
53525
|
+
if (ext === ".php" || ext === ".phtml" || sourceFile?.endsWith(".blade.php")) {
|
|
53526
|
+
return parsePhpFileImports(rawContent);
|
|
53527
|
+
}
|
|
52709
53528
|
const imports = [];
|
|
52710
53529
|
const content = stripComments2(rawContent);
|
|
52711
53530
|
const importRegex = /import\s+(?:\{[\s\S]*?\}|(?:\*\s+as\s+\w+)|\w+)\s+from\s+['"`]([^'"`\0\t\r\n]+)['"`]|import\s+['"`]([^'"`\0\t\r\n]+)['"`]|require\s*\(\s*['"`]([^'"`\0\t\r\n]+)['"`]\s*\)|export\s*\{[^}]*\}\s*from\s+['"`]([^'"`\0\t\r\n]+)['"`]|export\s+\*(?:\s+as\s+\w+)?\s+from\s+['"`]([^'"`\0\t\r\n]+)['"`]|import\s*\(\s*['"`]([^'"`\0\t\r\n]+)['"`]\s*\)/g;
|
|
@@ -52819,6 +53638,41 @@ function parseCSharpFileImports(rawContent) {
|
|
|
52819
53638
|
}
|
|
52820
53639
|
return imports;
|
|
52821
53640
|
}
|
|
53641
|
+
function parseDartFileImports(rawContent) {
|
|
53642
|
+
const imports = [];
|
|
53643
|
+
for (const match of rawContent.matchAll(/^[ \t]*(import|export)[ \t]+['"]([^'"]+)['"]([^;]*)/gm)) {
|
|
53644
|
+
const clause = match[3];
|
|
53645
|
+
const shown = clause?.match(/\bshow\s+([^;]+)/)?.[1].split(",").map((part) => part.trim()).filter(Boolean);
|
|
53646
|
+
const alias = clause?.match(/\bas\s+\w+/);
|
|
53647
|
+
const bindings = !alias && shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : [];
|
|
53648
|
+
const parsed = makeParsedImport(match[2], bindings.length > 0 ? "named" : "namespace", bindings, match[1] === "export");
|
|
53649
|
+
if (parsed)
|
|
53650
|
+
imports.push(parsed);
|
|
53651
|
+
}
|
|
53652
|
+
return imports;
|
|
53653
|
+
}
|
|
53654
|
+
function parseRubyFileImports(rawContent) {
|
|
53655
|
+
const imports = [];
|
|
53656
|
+
for (const match of rawContent.matchAll(/^[ \t]*(require_relative|require)[ \t]+['"]([^'"]+)['"]/gm)) {
|
|
53657
|
+
const relative10 = match[1] === "require_relative";
|
|
53658
|
+
const specifier = relative10 && !match[2].startsWith(".") ? `./${match[2]}` : match[2];
|
|
53659
|
+
const parsed = makeParsedImport(specifier, relative10 ? "default" : "namespace", []);
|
|
53660
|
+
if (parsed)
|
|
53661
|
+
imports.push(parsed);
|
|
53662
|
+
}
|
|
53663
|
+
return imports;
|
|
53664
|
+
}
|
|
53665
|
+
function parsePhpFileImports(rawContent) {
|
|
53666
|
+
const imports = [];
|
|
53667
|
+
for (const match of rawContent.matchAll(/^[ \t]*use[ \t]+(?:(?:function|const)[ \t]+)?([^;\s]+)(?:[ \t]+as[ \t]+(\w+))?[ \t]*;?[ \t]*\r?$/gim)) {
|
|
53668
|
+
const imported = match[1].split("\\").pop() ?? match[1];
|
|
53669
|
+
const bindings = match[2] ? [{ imported, local: match[2] }] : [];
|
|
53670
|
+
const parsed = makeParsedImport(match[1], bindings.length > 0 ? "named" : "namespace", bindings);
|
|
53671
|
+
if (parsed)
|
|
53672
|
+
imports.push(parsed);
|
|
53673
|
+
}
|
|
53674
|
+
return imports;
|
|
53675
|
+
}
|
|
52822
53676
|
function parsePythonFileImports(rawContent, sourceFile) {
|
|
52823
53677
|
const imports = [];
|
|
52824
53678
|
const isPackageInit = sourceFile ? ["__init__.py", "__init__.pyw"].includes(path74.basename(sourceFile)) : false;
|
|
@@ -53090,7 +53944,7 @@ function recordManifestDir(manifestDirs, absoluteRoot, dir, entryName) {
|
|
|
53090
53944
|
function isWalkBudgetExceeded(ctx) {
|
|
53091
53945
|
if (ctx.abortReason !== undefined)
|
|
53092
53946
|
return true;
|
|
53093
|
-
if (
|
|
53947
|
+
if (_internals66.now() - ctx.startedAt > ctx.walkBudgetMs) {
|
|
53094
53948
|
ctx.abortReason = "budget";
|
|
53095
53949
|
return true;
|
|
53096
53950
|
}
|
|
@@ -53122,7 +53976,7 @@ async function walkRepoGraphInputs(dir, options) {
|
|
|
53122
53976
|
const ctx = {
|
|
53123
53977
|
stats,
|
|
53124
53978
|
seenRealPaths: new Set,
|
|
53125
|
-
startedAt:
|
|
53979
|
+
startedAt: _internals66.now(),
|
|
53126
53980
|
walkBudgetMs: options?.walkBudgetMs ?? DEFAULT_WALK_BUDGET_MS,
|
|
53127
53981
|
maxFiles: options?.maxFiles ?? DEFAULT_WALK_FILE_CAP,
|
|
53128
53982
|
followSymlinks: options?.followSymlinks ?? false,
|
|
@@ -53223,7 +54077,7 @@ async function walkRepoGraphInputs(dir, options) {
|
|
|
53223
54077
|
unreadableDirectories,
|
|
53224
54078
|
unreadableFiles,
|
|
53225
54079
|
probedFiles: metadata.length,
|
|
53226
|
-
elapsedMs: Math.max(0,
|
|
54080
|
+
elapsedMs: Math.max(0, _internals66.now() - ctx.startedAt)
|
|
53227
54081
|
};
|
|
53228
54082
|
}
|
|
53229
54083
|
var RANGE_WIDENED_GRAMMARS = new Set([
|
|
@@ -53231,7 +54085,10 @@ var RANGE_WIDENED_GRAMMARS = new Set([
|
|
|
53231
54085
|
"kotlin",
|
|
53232
54086
|
"csharp",
|
|
53233
54087
|
"cpp",
|
|
53234
|
-
"swift"
|
|
54088
|
+
"swift",
|
|
54089
|
+
"dart",
|
|
54090
|
+
"ruby",
|
|
54091
|
+
"php"
|
|
53235
54092
|
]);
|
|
53236
54093
|
|
|
53237
54094
|
// src/tools/repo-graph/query.ts
|
|
@@ -53265,7 +54122,7 @@ var MAX_RELATIVE_PATH_LENGTH = 4096;
|
|
|
53265
54122
|
var WINDOWS_RENAME_MAX_RETRIES2 = 5;
|
|
53266
54123
|
var WINDOWS_RENAME_RETRY_DELAY_MS = 100;
|
|
53267
54124
|
var probeCache = new Map;
|
|
53268
|
-
var
|
|
54125
|
+
var _internals67 = {
|
|
53269
54126
|
now: Date.now,
|
|
53270
54127
|
walkRepoGraphInputs,
|
|
53271
54128
|
open: fsPromises3.open,
|
|
@@ -53304,11 +54161,11 @@ async function writeFingerprintAtomic(root, data) {
|
|
|
53304
54161
|
const temp = path75.join(path75.dirname(target), `.repo-graph.fingerprint.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 10)}.tmp`);
|
|
53305
54162
|
validateSymlinkBoundary(temp, root);
|
|
53306
54163
|
try {
|
|
53307
|
-
await
|
|
54164
|
+
await _internals67.bunWrite(temp, data);
|
|
53308
54165
|
let lastError;
|
|
53309
54166
|
for (let attempt = 0;attempt < WINDOWS_RENAME_MAX_RETRIES2; attempt++) {
|
|
53310
54167
|
try {
|
|
53311
|
-
await
|
|
54168
|
+
await _internals67.fsRename(temp, target);
|
|
53312
54169
|
lastError = undefined;
|
|
53313
54170
|
break;
|
|
53314
54171
|
} catch (error2) {
|
|
@@ -53317,20 +54174,20 @@ async function writeFingerprintAtomic(root, data) {
|
|
|
53317
54174
|
if (code !== "EEXIST" && code !== "EPERM" && code !== "EBUSY" || attempt === WINDOWS_RENAME_MAX_RETRIES2 - 1) {
|
|
53318
54175
|
break;
|
|
53319
54176
|
}
|
|
53320
|
-
await new Promise((resolve26) => setTimeout(resolve26,
|
|
54177
|
+
await new Promise((resolve26) => setTimeout(resolve26, _internals67.retryDelayMs));
|
|
53321
54178
|
}
|
|
53322
54179
|
}
|
|
53323
54180
|
if (lastError !== undefined)
|
|
53324
54181
|
throw lastError;
|
|
53325
54182
|
} finally {
|
|
53326
54183
|
try {
|
|
53327
|
-
await
|
|
54184
|
+
await _internals67.fsUnlink(temp);
|
|
53328
54185
|
} catch {}
|
|
53329
54186
|
}
|
|
53330
54187
|
}
|
|
53331
54188
|
async function refuseFingerprint(root) {
|
|
53332
54189
|
try {
|
|
53333
|
-
await
|
|
54190
|
+
await _internals67.fsUnlink(fingerprintPath(root));
|
|
53334
54191
|
} catch {}
|
|
53335
54192
|
invalidateFreshnessCache(root);
|
|
53336
54193
|
return false;
|
|
@@ -53397,7 +54254,7 @@ function diagnosticPaths(root, diagnostics) {
|
|
|
53397
54254
|
async function writeFingerprint(root, graph, options) {
|
|
53398
54255
|
invalidateFreshnessCache(root);
|
|
53399
54256
|
try {
|
|
53400
|
-
const walk = await
|
|
54257
|
+
const walk = await _internals67.walkRepoGraphInputs(root, {
|
|
53401
54258
|
walkBudgetMs: options?.walkBudgetMs,
|
|
53402
54259
|
maxFiles: options?.maxFiles,
|
|
53403
54260
|
followSymlinks: options?.followSymlinks,
|
|
@@ -53478,7 +54335,7 @@ async function writeFingerprint(root, graph, options) {
|
|
|
53478
54335
|
|
|
53479
54336
|
// src/tools/repo-graph/storage.ts
|
|
53480
54337
|
var WINDOWS_RENAME_RETRY_DELAY_MS2 = 100;
|
|
53481
|
-
var
|
|
54338
|
+
var _internals68 = {
|
|
53482
54339
|
safeRealpathSync,
|
|
53483
54340
|
fsRename: fsPromises4.rename.bind(fsPromises4),
|
|
53484
54341
|
retryDelayMs: WINDOWS_RENAME_RETRY_DELAY_MS2,
|
|
@@ -54743,15 +55600,15 @@ async function handleMemoryUnlinkCommand(directory, args) {
|
|
|
54743
55600
|
}
|
|
54744
55601
|
|
|
54745
55602
|
// src/services/plan-service.ts
|
|
54746
|
-
var
|
|
55603
|
+
var _internals69 = {
|
|
54747
55604
|
loadPlanJsonOnly,
|
|
54748
55605
|
derivePlanMarkdown,
|
|
54749
55606
|
readSwarmFileAsync
|
|
54750
55607
|
};
|
|
54751
55608
|
async function getPlanData(directory, phaseArg) {
|
|
54752
|
-
const plan = await
|
|
55609
|
+
const plan = await _internals69.loadPlanJsonOnly(directory);
|
|
54753
55610
|
if (plan) {
|
|
54754
|
-
const fullMarkdown =
|
|
55611
|
+
const fullMarkdown = _internals69.derivePlanMarkdown(plan);
|
|
54755
55612
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
54756
55613
|
return {
|
|
54757
55614
|
hasPlan: true,
|
|
@@ -54794,7 +55651,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
54794
55651
|
isLegacy: false
|
|
54795
55652
|
};
|
|
54796
55653
|
}
|
|
54797
|
-
const planContent = await
|
|
55654
|
+
const planContent = await _internals69.readSwarmFileAsync(directory, "plan.md");
|
|
54798
55655
|
if (!planContent) {
|
|
54799
55656
|
return {
|
|
54800
55657
|
hasPlan: false,
|
|
@@ -54891,7 +55748,7 @@ async function handlePlanCommand(directory, args) {
|
|
|
54891
55748
|
return formatPlanMarkdown(planData);
|
|
54892
55749
|
}
|
|
54893
55750
|
// src/commands/post-mortem.ts
|
|
54894
|
-
var
|
|
55751
|
+
var _internals70 = {
|
|
54895
55752
|
createCuratorLLMDelegate,
|
|
54896
55753
|
runCuratorPostMortem
|
|
54897
55754
|
};
|
|
@@ -54939,10 +55796,10 @@ async function handlePostMortemCommand(directory, args, options) {
|
|
|
54939
55796
|
};
|
|
54940
55797
|
if (options?.sessionID) {
|
|
54941
55798
|
try {
|
|
54942
|
-
pmOptions.llmDelegate =
|
|
55799
|
+
pmOptions.llmDelegate = _internals70.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
|
|
54943
55800
|
} catch {}
|
|
54944
55801
|
}
|
|
54945
|
-
const result = await
|
|
55802
|
+
const result = await _internals70.runCuratorPostMortem(directory, pmOptions);
|
|
54946
55803
|
const lines = [];
|
|
54947
55804
|
if (result.success) {
|
|
54948
55805
|
lines.push("## Post-Mortem Report Generated");
|
|
@@ -55231,7 +56088,7 @@ function resolveGhBinaryCandidates(options = {}) {
|
|
|
55231
56088
|
function resolveGhBinary() {
|
|
55232
56089
|
if (ghBinaryTestPin !== undefined)
|
|
55233
56090
|
return ghBinaryTestPin;
|
|
55234
|
-
return
|
|
56091
|
+
return _internals71.resolveExecutableFromPath(resolveGhBinaryCandidates());
|
|
55235
56092
|
}
|
|
55236
56093
|
function normalizeRepo(value) {
|
|
55237
56094
|
if (value === undefined || value === null || value === "")
|
|
@@ -55352,7 +56209,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55352
56209
|
if (!Array.isArray(fields)) {
|
|
55353
56210
|
return JSON.stringify(fields, null, 2);
|
|
55354
56211
|
}
|
|
55355
|
-
const executable =
|
|
56212
|
+
const executable = _internals71.resolveGhBinary();
|
|
55356
56213
|
if (!executable) {
|
|
55357
56214
|
return JSON.stringify({
|
|
55358
56215
|
error: true,
|
|
@@ -55371,7 +56228,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55371
56228
|
if (isLogFailedMode) {
|
|
55372
56229
|
ghArgs.push("--log-failed");
|
|
55373
56230
|
}
|
|
55374
|
-
const run = await
|
|
56231
|
+
const run = await _internals71.runExternalTool({
|
|
55375
56232
|
executable,
|
|
55376
56233
|
args: ghArgs,
|
|
55377
56234
|
cwd: directory,
|
|
@@ -55455,7 +56312,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55455
56312
|
}, null, 2);
|
|
55456
56313
|
}
|
|
55457
56314
|
});
|
|
55458
|
-
var
|
|
56315
|
+
var _internals71 = {
|
|
55459
56316
|
resolveGhBinaryCandidates,
|
|
55460
56317
|
resolveExecutableFromPath,
|
|
55461
56318
|
resolveGhBinary,
|
|
@@ -55562,7 +56419,7 @@ function formatMergeGroupStatus(status, conclusion, htmlUrl) {
|
|
|
55562
56419
|
}
|
|
55563
56420
|
return parts.join(" ");
|
|
55564
56421
|
}
|
|
55565
|
-
var
|
|
56422
|
+
var _internals72 = {
|
|
55566
56423
|
formatRelativeTime,
|
|
55567
56424
|
formatMergeGroupStatus,
|
|
55568
56425
|
listActive,
|
|
@@ -55570,7 +56427,7 @@ var _internals71 = {
|
|
|
55570
56427
|
parseMergeGroupRuns
|
|
55571
56428
|
};
|
|
55572
56429
|
async function handlePrMonitorStatusCommand(directory, _args, sessionID, source) {
|
|
55573
|
-
const allActive = await
|
|
56430
|
+
const allActive = await _internals72.listActive(directory);
|
|
55574
56431
|
const allSessions = source === "cli";
|
|
55575
56432
|
const subs = allSessions ? allActive : allActive.filter((record) => record.sessionID === sessionID);
|
|
55576
56433
|
if (subs.length === 0) {
|
|
@@ -55586,7 +56443,7 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID, source)
|
|
|
55586
56443
|
const index = i + 1;
|
|
55587
56444
|
lines.push(` ${index}. ${sub.repoFullName}#${sub.prNumber}`);
|
|
55588
56445
|
lines.push(` URL: ${sub.prUrl}`);
|
|
55589
|
-
const mergeGroupRuns = await
|
|
56446
|
+
const mergeGroupRuns = await _internals72.listMergeGroupRuns(directory, sub.repoFullName, sub.prNumber);
|
|
55590
56447
|
if (mergeGroupRuns.runs.length > 0) {
|
|
55591
56448
|
lines.push(" Merge-group runs:");
|
|
55592
56449
|
for (const run of mergeGroupRuns.runs) {
|
|
@@ -55727,7 +56584,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55727
56584
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
55728
56585
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
55729
56586
|
try {
|
|
55730
|
-
const config =
|
|
56587
|
+
const config = _internals73.loadPluginConfig(directory);
|
|
55731
56588
|
const prMonitorConfig = config.pr_monitor;
|
|
55732
56589
|
if (!prMonitorConfig?.enabled) {
|
|
55733
56590
|
return [
|
|
@@ -55737,7 +56594,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55737
56594
|
].join(`
|
|
55738
56595
|
`);
|
|
55739
56596
|
}
|
|
55740
|
-
await
|
|
56597
|
+
await _internals73.subscribe(directory, {
|
|
55741
56598
|
sessionID,
|
|
55742
56599
|
prNumber: prInfo.number,
|
|
55743
56600
|
repoFullName,
|
|
@@ -55765,7 +56622,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55765
56622
|
`);
|
|
55766
56623
|
}
|
|
55767
56624
|
}
|
|
55768
|
-
var
|
|
56625
|
+
var _internals73 = {
|
|
55769
56626
|
loadPluginConfig,
|
|
55770
56627
|
subscribe
|
|
55771
56628
|
};
|
|
@@ -55788,9 +56645,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55788
56645
|
`);
|
|
55789
56646
|
}
|
|
55790
56647
|
const refToken = rest[0];
|
|
55791
|
-
const prInfo =
|
|
56648
|
+
const prInfo = _internals74.parsePrRef(refToken, directory);
|
|
55792
56649
|
if (!prInfo) {
|
|
55793
|
-
if (
|
|
56650
|
+
if (_internals74.looksLikePrRef(refToken)) {
|
|
55794
56651
|
return [
|
|
55795
56652
|
`Error: Could not resolve PR reference from "${refToken}".`,
|
|
55796
56653
|
"",
|
|
@@ -55811,8 +56668,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55811
56668
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
55812
56669
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
55813
56670
|
try {
|
|
55814
|
-
const correlationId =
|
|
55815
|
-
const result = await
|
|
56671
|
+
const correlationId = _internals74.buildCorrelationId(sessionID, repoFullName, prInfo.number);
|
|
56672
|
+
const result = await _internals74.unsubscribe(directory, correlationId);
|
|
55816
56673
|
if (!result) {
|
|
55817
56674
|
return [
|
|
55818
56675
|
`Not subscribed to ${prUrl}`,
|
|
@@ -55839,7 +56696,7 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55839
56696
|
`);
|
|
55840
56697
|
}
|
|
55841
56698
|
}
|
|
55842
|
-
var
|
|
56699
|
+
var _internals74 = {
|
|
55843
56700
|
unsubscribe,
|
|
55844
56701
|
buildCorrelationId,
|
|
55845
56702
|
parsePrRef,
|
|
@@ -55889,7 +56746,7 @@ function normalizeRelativePathForPlatform(value, platform) {
|
|
|
55889
56746
|
}
|
|
55890
56747
|
function isRegularFile(candidate) {
|
|
55891
56748
|
try {
|
|
55892
|
-
return
|
|
56749
|
+
return _internals75.statSync(candidate).isFile();
|
|
55893
56750
|
} catch {
|
|
55894
56751
|
return false;
|
|
55895
56752
|
}
|
|
@@ -55897,21 +56754,21 @@ function isRegularFile(candidate) {
|
|
|
55897
56754
|
function readTextFileBounded(filePath, maxBytes) {
|
|
55898
56755
|
let fd;
|
|
55899
56756
|
try {
|
|
55900
|
-
fd =
|
|
55901
|
-
const stats =
|
|
56757
|
+
fd = _internals75.openSync(filePath, "r");
|
|
56758
|
+
const stats = _internals75.fstatSync(fd);
|
|
55902
56759
|
if (!stats.isFile() || !Number.isSafeInteger(stats.size) || stats.size < 0 || stats.size > maxBytes) {
|
|
55903
56760
|
return null;
|
|
55904
56761
|
}
|
|
55905
56762
|
const bytes = Buffer.alloc(stats.size);
|
|
55906
56763
|
let offset = 0;
|
|
55907
56764
|
while (offset < bytes.byteLength) {
|
|
55908
|
-
const bytesRead =
|
|
56765
|
+
const bytesRead = _internals75.readSync(fd, bytes, offset, bytes.byteLength - offset, null);
|
|
55909
56766
|
if (bytesRead === 0)
|
|
55910
56767
|
break;
|
|
55911
56768
|
offset += bytesRead;
|
|
55912
56769
|
}
|
|
55913
56770
|
const overflowProbe = Buffer.alloc(1);
|
|
55914
|
-
if (
|
|
56771
|
+
if (_internals75.readSync(fd, overflowProbe, 0, 1, null) > 0)
|
|
55915
56772
|
return null;
|
|
55916
56773
|
return bytes.subarray(0, offset).toString("utf8");
|
|
55917
56774
|
} catch {
|
|
@@ -55919,7 +56776,7 @@ function readTextFileBounded(filePath, maxBytes) {
|
|
|
55919
56776
|
} finally {
|
|
55920
56777
|
if (fd !== undefined) {
|
|
55921
56778
|
try {
|
|
55922
|
-
|
|
56779
|
+
_internals75.closeSync(fd);
|
|
55923
56780
|
} catch {}
|
|
55924
56781
|
}
|
|
55925
56782
|
}
|
|
@@ -55940,7 +56797,7 @@ function getAncestorDirectories(directory) {
|
|
|
55940
56797
|
}
|
|
55941
56798
|
return roots;
|
|
55942
56799
|
}
|
|
55943
|
-
function getTrustedShimNames(linter, platform =
|
|
56800
|
+
function getTrustedShimNames(linter, platform = _internals75.platform()) {
|
|
55944
56801
|
const isWindows = platform === "win32";
|
|
55945
56802
|
if (linter === "biome") {
|
|
55946
56803
|
return isWindows ? ["biome.exe", "biome.cmd", "biome.ps1"] : ["biome"];
|
|
@@ -55957,7 +56814,7 @@ function getPackageManifestPath(searchRoot, linter) {
|
|
|
55957
56814
|
return path81.join(getPackageRootFromSearchRoot(searchRoot, linter), "package.json");
|
|
55958
56815
|
}
|
|
55959
56816
|
function getPackageDisplayPath(searchRoot, linter) {
|
|
55960
|
-
return path81.join(searchRoot, NODE_MODULES, BIN_DIRECTORY, linter === "biome" ?
|
|
56817
|
+
return path81.join(searchRoot, NODE_MODULES, BIN_DIRECTORY, linter === "biome" ? _internals75.platform() === "win32" ? "biome.exe" : "biome" : _internals75.platform() === "win32" ? "eslint" : "eslint");
|
|
55961
56818
|
}
|
|
55962
56819
|
function getBiomeNativePackage(platform, arch) {
|
|
55963
56820
|
const archMap = platform === "darwin" ? { arm64: "@biomejs/cli-darwin-arm64", x64: "@biomejs/cli-darwin-x64" } : platform === "linux" ? {
|
|
@@ -55972,7 +56829,7 @@ function getBiomeNativePackage(platform, arch) {
|
|
|
55972
56829
|
return null;
|
|
55973
56830
|
return archMap[arch] ?? null;
|
|
55974
56831
|
}
|
|
55975
|
-
function getBiomeNativeExecutable(searchRoot, platform =
|
|
56832
|
+
function getBiomeNativeExecutable(searchRoot, platform = _internals75.platform(), arch = _internals75.arch()) {
|
|
55976
56833
|
const nativePackage = getBiomeNativePackage(platform, arch);
|
|
55977
56834
|
if (!nativePackage)
|
|
55978
56835
|
return null;
|
|
@@ -56008,8 +56865,8 @@ function resolveCanonicalPackageCommand(searchRoot, linter, source) {
|
|
|
56008
56865
|
let canonicalCandidate;
|
|
56009
56866
|
try {
|
|
56010
56867
|
const packageRoot = path81.dirname(manifestPath);
|
|
56011
|
-
canonicalPackageRoot =
|
|
56012
|
-
canonicalCandidate =
|
|
56868
|
+
canonicalPackageRoot = _internals75.realpathSync(packageRoot);
|
|
56869
|
+
canonicalCandidate = _internals75.realpathSync(path81.resolve(packageRoot, relativeBinPath));
|
|
56013
56870
|
} catch {
|
|
56014
56871
|
return null;
|
|
56015
56872
|
}
|
|
@@ -56021,7 +56878,7 @@ function resolveCanonicalPackageCommand(searchRoot, linter, source) {
|
|
|
56021
56878
|
return null;
|
|
56022
56879
|
return {
|
|
56023
56880
|
linter,
|
|
56024
|
-
executable:
|
|
56881
|
+
executable: _internals75.execPath(),
|
|
56025
56882
|
argsPrefix: [canonicalCandidate],
|
|
56026
56883
|
displayPrefix: [getPackageDisplayPath(searchRoot, linter)],
|
|
56027
56884
|
source
|
|
@@ -56062,7 +56919,7 @@ function resolveLocalLinterCommand(linter, directory) {
|
|
|
56062
56919
|
}
|
|
56063
56920
|
return null;
|
|
56064
56921
|
}
|
|
56065
|
-
function findPathShimCandidate(linter, envPath =
|
|
56922
|
+
function findPathShimCandidate(linter, envPath = _internals75.pathEnv(), platform = _internals75.platform()) {
|
|
56066
56923
|
const entries = envPath.split(path81.delimiter).filter(Boolean);
|
|
56067
56924
|
const shimNames = getTrustedShimNames(linter, platform).filter((name) => name.endsWith(".cmd") || name.endsWith(".ps1") || platform !== "win32");
|
|
56068
56925
|
for (const entry of entries) {
|
|
@@ -56092,7 +56949,7 @@ function getExpectedShimSuffixes(linter) {
|
|
|
56092
56949
|
normalizeRelativePathForPlatform(nodeModulesPackageOnlySuffix, "linux")
|
|
56093
56950
|
];
|
|
56094
56951
|
}
|
|
56095
|
-
function resolvePathShimTarget(shimPath, linter, platform =
|
|
56952
|
+
function resolvePathShimTarget(shimPath, linter, platform = _internals75.platform()) {
|
|
56096
56953
|
const contents = readTextFileBounded(shimPath, MAX_PATH_SHIM_BYTES);
|
|
56097
56954
|
if (contents === null)
|
|
56098
56955
|
return null;
|
|
@@ -56139,7 +56996,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56139
56996
|
return null;
|
|
56140
56997
|
let canonicalShimDir;
|
|
56141
56998
|
try {
|
|
56142
|
-
canonicalShimDir =
|
|
56999
|
+
canonicalShimDir = _internals75.realpathSync(path81.dirname(shimPath));
|
|
56143
57000
|
} catch {
|
|
56144
57001
|
return null;
|
|
56145
57002
|
}
|
|
@@ -56148,7 +57005,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56148
57005
|
return null;
|
|
56149
57006
|
let canonicalTarget;
|
|
56150
57007
|
try {
|
|
56151
|
-
canonicalTarget =
|
|
57008
|
+
canonicalTarget = _internals75.realpathSync(resolvedTarget);
|
|
56152
57009
|
} catch {
|
|
56153
57010
|
return null;
|
|
56154
57011
|
}
|
|
@@ -56158,7 +57015,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56158
57015
|
}
|
|
56159
57016
|
let canonicalShimParent;
|
|
56160
57017
|
try {
|
|
56161
|
-
canonicalShimParent =
|
|
57018
|
+
canonicalShimParent = _internals75.realpathSync(path81.dirname(canonicalShimDir));
|
|
56162
57019
|
} catch {
|
|
56163
57020
|
return null;
|
|
56164
57021
|
}
|
|
@@ -56172,8 +57029,8 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56172
57029
|
return canonicalTarget;
|
|
56173
57030
|
}
|
|
56174
57031
|
function resolvePathLinterCommand(linter, directory) {
|
|
56175
|
-
const platform =
|
|
56176
|
-
const envPath =
|
|
57032
|
+
const platform = _internals75.platform();
|
|
57033
|
+
const envPath = _internals75.pathEnv();
|
|
56177
57034
|
const nativeNames = platform === "win32" ? linter === "biome" ? ["biome.exe"] : ["eslint.exe"] : linter === "biome" ? ["biome"] : ["eslint"];
|
|
56178
57035
|
const nativeExecutable = resolveExecutableFromPath(nativeNames, envPath, platform);
|
|
56179
57036
|
if (nativeExecutable) {
|
|
@@ -56193,7 +57050,7 @@ function resolvePathLinterCommand(linter, directory) {
|
|
|
56193
57050
|
return null;
|
|
56194
57051
|
return {
|
|
56195
57052
|
linter,
|
|
56196
|
-
executable:
|
|
57053
|
+
executable: _internals75.execPath(),
|
|
56197
57054
|
argsPrefix: [shimTarget],
|
|
56198
57055
|
displayPrefix: [path81.join(directory, NODE_MODULES, BIN_DIRECTORY, linter)],
|
|
56199
57056
|
source: "path-shim"
|
|
@@ -56230,7 +57087,7 @@ function buildExecutionError(mode, command, linter, result) {
|
|
|
56230
57087
|
};
|
|
56231
57088
|
}
|
|
56232
57089
|
async function probeResolvedCommand(command, cwd, abortSignal) {
|
|
56233
|
-
const result = await
|
|
57090
|
+
const result = await _internals75.runExternalTool({
|
|
56234
57091
|
executable: command.executable,
|
|
56235
57092
|
args: [...command.argsPrefix, "--version"],
|
|
56236
57093
|
cwd,
|
|
@@ -56248,7 +57105,7 @@ async function resolveLinterCommand(linter, directory) {
|
|
|
56248
57105
|
async function detectResolvedLinter(directory, abortSignal) {
|
|
56249
57106
|
if (!directory)
|
|
56250
57107
|
return null;
|
|
56251
|
-
if (!
|
|
57108
|
+
if (!_internals75.existsSync(directory))
|
|
56252
57109
|
return null;
|
|
56253
57110
|
const cwd = toAbsoluteDirectory(directory);
|
|
56254
57111
|
for (const linter of SUPPORTED_LINTERS) {
|
|
@@ -56262,12 +57119,12 @@ async function detectResolvedLinter(directory, abortSignal) {
|
|
|
56262
57119
|
return null;
|
|
56263
57120
|
}
|
|
56264
57121
|
function detectRuff(cwd) {
|
|
56265
|
-
if (
|
|
57122
|
+
if (_internals75.existsSync(path81.join(cwd, "ruff.toml")))
|
|
56266
57123
|
return hasAdditionalCommand("ruff");
|
|
56267
57124
|
try {
|
|
56268
57125
|
const pyproject = path81.join(cwd, "pyproject.toml");
|
|
56269
|
-
if (
|
|
56270
|
-
const content =
|
|
57126
|
+
if (_internals75.existsSync(pyproject)) {
|
|
57127
|
+
const content = _internals75.readFileSync(pyproject, "utf-8");
|
|
56271
57128
|
if (content.includes("[tool.ruff]"))
|
|
56272
57129
|
return hasAdditionalCommand("ruff");
|
|
56273
57130
|
}
|
|
@@ -56275,32 +57132,32 @@ function detectRuff(cwd) {
|
|
|
56275
57132
|
return false;
|
|
56276
57133
|
}
|
|
56277
57134
|
function detectClippy(cwd) {
|
|
56278
|
-
return
|
|
57135
|
+
return _internals75.existsSync(path81.join(cwd, "Cargo.toml")) && hasAdditionalCommand("cargo");
|
|
56279
57136
|
}
|
|
56280
57137
|
function detectGolangciLint(cwd) {
|
|
56281
|
-
return
|
|
57138
|
+
return _internals75.existsSync(path81.join(cwd, "go.mod")) && hasAdditionalCommand("golangci-lint");
|
|
56282
57139
|
}
|
|
56283
57140
|
function readTextFileSafe(filePath) {
|
|
56284
57141
|
try {
|
|
56285
|
-
return
|
|
57142
|
+
return _internals75.readFileSync(filePath, "utf-8");
|
|
56286
57143
|
} catch {
|
|
56287
57144
|
return "";
|
|
56288
57145
|
}
|
|
56289
57146
|
}
|
|
56290
57147
|
function resolveAdditionalExecutable(name) {
|
|
56291
|
-
const platform =
|
|
57148
|
+
const platform = _internals75.platform();
|
|
56292
57149
|
if (platform !== "win32") {
|
|
56293
|
-
return
|
|
57150
|
+
return _internals75.isCommandAvailable(name) ? name : null;
|
|
56294
57151
|
}
|
|
56295
|
-
return resolveExecutableFromPath([`${name}.exe`],
|
|
57152
|
+
return resolveExecutableFromPath([`${name}.exe`], _internals75.pathEnv(), platform);
|
|
56296
57153
|
}
|
|
56297
57154
|
function resolveWindowsCommandInterpreter() {
|
|
56298
|
-
const candidate =
|
|
57155
|
+
const candidate = _internals75.comSpec();
|
|
56299
57156
|
if (!candidate || !path81.isAbsolute(candidate) || path81.basename(candidate).toLowerCase() !== "cmd.exe" || !isRegularFile(candidate)) {
|
|
56300
57157
|
return null;
|
|
56301
57158
|
}
|
|
56302
57159
|
try {
|
|
56303
|
-
const canonical =
|
|
57160
|
+
const canonical = _internals75.realpathSync(candidate);
|
|
56304
57161
|
return path81.basename(canonical).toLowerCase() === "cmd.exe" ? canonical : null;
|
|
56305
57162
|
} catch {
|
|
56306
57163
|
return null;
|
|
@@ -56312,7 +57169,7 @@ function buildWindowsBatchCommand(wrapperPath, args) {
|
|
|
56312
57169
|
return null;
|
|
56313
57170
|
let canonicalWrapper;
|
|
56314
57171
|
try {
|
|
56315
|
-
canonicalWrapper =
|
|
57172
|
+
canonicalWrapper = _internals75.realpathSync(wrapperPath);
|
|
56316
57173
|
} catch {
|
|
56317
57174
|
return null;
|
|
56318
57175
|
}
|
|
@@ -56326,13 +57183,13 @@ function buildWindowsBatchCommand(wrapperPath, args) {
|
|
|
56326
57183
|
return [interpreter, "/d", "/s", "/v:off", "/c", command];
|
|
56327
57184
|
}
|
|
56328
57185
|
function resolveWindowsBatchCommandFromPath(name, args) {
|
|
56329
|
-
if (
|
|
57186
|
+
if (_internals75.platform() !== "win32")
|
|
56330
57187
|
return null;
|
|
56331
|
-
const wrapper = resolveExecutableFromPath(WINDOWS_BATCH_WRAPPER_EXTENSIONS.map((extension) => `${name}${extension}`),
|
|
57188
|
+
const wrapper = resolveExecutableFromPath(WINDOWS_BATCH_WRAPPER_EXTENSIONS.map((extension) => `${name}${extension}`), _internals75.pathEnv(), "win32");
|
|
56332
57189
|
return wrapper ? buildWindowsBatchCommand(wrapper, args) : null;
|
|
56333
57190
|
}
|
|
56334
57191
|
function resolveContainedWindowsBatchCommand(cwd, fileName, args) {
|
|
56335
|
-
if (
|
|
57192
|
+
if (_internals75.platform() !== "win32")
|
|
56336
57193
|
return null;
|
|
56337
57194
|
const candidate = path81.join(cwd, fileName);
|
|
56338
57195
|
if (!isRegularFile(candidate))
|
|
@@ -56340,8 +57197,8 @@ function resolveContainedWindowsBatchCommand(cwd, fileName, args) {
|
|
|
56340
57197
|
let canonicalCwd;
|
|
56341
57198
|
let canonicalCandidate;
|
|
56342
57199
|
try {
|
|
56343
|
-
canonicalCwd =
|
|
56344
|
-
canonicalCandidate =
|
|
57200
|
+
canonicalCwd = _internals75.realpathSync(cwd);
|
|
57201
|
+
canonicalCandidate = _internals75.realpathSync(candidate);
|
|
56345
57202
|
} catch {
|
|
56346
57203
|
return null;
|
|
56347
57204
|
}
|
|
@@ -56362,22 +57219,22 @@ function hasAdditionalCommand(name) {
|
|
|
56362
57219
|
}
|
|
56363
57220
|
function resolvePhpVendorCommand(cwd, name) {
|
|
56364
57221
|
const relativeProxy = path81.join("vendor", "bin", name);
|
|
56365
|
-
if (!
|
|
57222
|
+
if (!_internals75.existsSync(path81.join(cwd, relativeProxy)))
|
|
56366
57223
|
return null;
|
|
56367
|
-
if (
|
|
57224
|
+
if (_internals75.platform() !== "win32")
|
|
56368
57225
|
return [relativeProxy];
|
|
56369
57226
|
const phpExecutable = resolveAdditionalExecutable("php");
|
|
56370
57227
|
return phpExecutable ? [phpExecutable, relativeProxy] : null;
|
|
56371
57228
|
}
|
|
56372
57229
|
function hasCheckstyleGradleSignal(cwd) {
|
|
56373
|
-
const gradleFiles = ["build.gradle", "build.gradle.kts"].map((file) => path81.join(cwd, file)).filter((file) =>
|
|
56374
|
-
return
|
|
57230
|
+
const gradleFiles = ["build.gradle", "build.gradle.kts"].map((file) => path81.join(cwd, file)).filter((file) => _internals75.existsSync(file));
|
|
57231
|
+
return _internals75.existsSync(path81.join(cwd, "checkstyle.xml")) || _internals75.existsSync(path81.join(cwd, "config", "checkstyle", "checkstyle.xml")) || gradleFiles.some((file) => /\bcheckstyle\b/i.test(readTextFileSafe(file)));
|
|
56375
57232
|
}
|
|
56376
57233
|
function resolveCheckstyleCommand(cwd) {
|
|
56377
|
-
const hasMavenProject =
|
|
57234
|
+
const hasMavenProject = _internals75.existsSync(path81.join(cwd, "pom.xml"));
|
|
56378
57235
|
const hasGradleSignal = hasCheckstyleGradleSignal(cwd);
|
|
56379
57236
|
if (hasGradleSignal) {
|
|
56380
|
-
if (
|
|
57237
|
+
if (_internals75.platform() === "win32") {
|
|
56381
57238
|
const gradlew = resolveContainedWindowsBatchCommand(cwd, "gradlew.bat", [
|
|
56382
57239
|
"checkstyleMain"
|
|
56383
57240
|
]);
|
|
@@ -56385,7 +57242,7 @@ function resolveCheckstyleCommand(cwd) {
|
|
|
56385
57242
|
return gradlew;
|
|
56386
57243
|
} else {
|
|
56387
57244
|
const gradlew = path81.join(cwd, "gradlew");
|
|
56388
|
-
if (
|
|
57245
|
+
if (_internals75.existsSync(gradlew))
|
|
56389
57246
|
return [gradlew, "checkstyleMain"];
|
|
56390
57247
|
}
|
|
56391
57248
|
const gradle = buildAdditionalCommand("gradle", ["checkstyleMain"]);
|
|
@@ -56399,7 +57256,7 @@ function resolveCheckstyleCommand(cwd) {
|
|
|
56399
57256
|
}
|
|
56400
57257
|
return null;
|
|
56401
57258
|
}
|
|
56402
|
-
function isUnsafeShellWrapperExecutable(executable, platform =
|
|
57259
|
+
function isUnsafeShellWrapperExecutable(executable, platform = _internals75.platform()) {
|
|
56403
57260
|
return platform === "win32" && UNSAFE_SHELL_WRAPPER_EXTENSIONS.has(path81.extname(executable).toLowerCase());
|
|
56404
57261
|
}
|
|
56405
57262
|
function detectCheckstyle(cwd) {
|
|
@@ -56407,7 +57264,7 @@ function detectCheckstyle(cwd) {
|
|
|
56407
57264
|
}
|
|
56408
57265
|
function hasRootKotlinFile(cwd) {
|
|
56409
57266
|
try {
|
|
56410
|
-
return
|
|
57267
|
+
return _internals75.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
|
|
56411
57268
|
} catch {
|
|
56412
57269
|
return false;
|
|
56413
57270
|
}
|
|
@@ -56417,27 +57274,27 @@ function buildGradleHasKotlinSignal(cwd) {
|
|
|
56417
57274
|
return /\b(kotlin|org\.jetbrains\.kotlin|ktlint)\b/i.test(content);
|
|
56418
57275
|
}
|
|
56419
57276
|
function detectKtlint(cwd) {
|
|
56420
|
-
const hasKotlin =
|
|
57277
|
+
const hasKotlin = _internals75.existsSync(path81.join(cwd, "build.gradle.kts")) || _internals75.existsSync(path81.join(cwd, "build.gradle")) && buildGradleHasKotlinSignal(cwd) || hasRootKotlinFile(cwd);
|
|
56421
57278
|
return hasKotlin && hasAdditionalCommand("ktlint");
|
|
56422
57279
|
}
|
|
56423
57280
|
function detectPhpLinter(cwd) {
|
|
56424
|
-
if ((
|
|
57281
|
+
if ((_internals75.existsSync(path81.join(cwd, "phpstan.neon")) || _internals75.existsSync(path81.join(cwd, "phpstan.neon.dist"))) && resolvePhpVendorCommand(cwd, "phpstan") !== null) {
|
|
56425
57282
|
return "phpstan";
|
|
56426
57283
|
}
|
|
56427
|
-
if (
|
|
57284
|
+
if (_internals75.existsSync(path81.join(cwd, "pint.json")) && resolvePhpVendorCommand(cwd, "pint") !== null) {
|
|
56428
57285
|
return "pint";
|
|
56429
57286
|
}
|
|
56430
|
-
if (
|
|
57287
|
+
if (_internals75.existsSync(path81.join(cwd, ".php-cs-fixer.php")) && resolvePhpVendorCommand(cwd, "php-cs-fixer") !== null) {
|
|
56431
57288
|
return "php-cs-fixer";
|
|
56432
57289
|
}
|
|
56433
|
-
if (
|
|
57290
|
+
if (_internals75.existsSync(path81.join(cwd, "phpcs.xml")) && resolvePhpVendorCommand(cwd, "phpcs") !== null) {
|
|
56434
57291
|
return "phpcs";
|
|
56435
57292
|
}
|
|
56436
57293
|
return null;
|
|
56437
57294
|
}
|
|
56438
57295
|
function detectDotnetFormat(cwd) {
|
|
56439
57296
|
try {
|
|
56440
|
-
const files =
|
|
57297
|
+
const files = _internals75.readdirSync(cwd);
|
|
56441
57298
|
const hasCsproj = files.some((f) => f.endsWith(".csproj") || f.endsWith(".sln"));
|
|
56442
57299
|
return hasCsproj && hasAdditionalCommand("dotnet");
|
|
56443
57300
|
} catch {
|
|
@@ -56445,14 +57302,14 @@ function detectDotnetFormat(cwd) {
|
|
|
56445
57302
|
}
|
|
56446
57303
|
}
|
|
56447
57304
|
function detectCppcheck(cwd) {
|
|
56448
|
-
if (
|
|
57305
|
+
if (_internals75.existsSync(path81.join(cwd, "CMakeLists.txt"))) {
|
|
56449
57306
|
return hasAdditionalCommand("cppcheck");
|
|
56450
57307
|
}
|
|
56451
57308
|
try {
|
|
56452
57309
|
const dirsToCheck = [cwd, path81.join(cwd, "src")];
|
|
56453
57310
|
const hasCpp = dirsToCheck.some((dir) => {
|
|
56454
57311
|
try {
|
|
56455
|
-
return
|
|
57312
|
+
return _internals75.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
|
|
56456
57313
|
} catch {
|
|
56457
57314
|
return false;
|
|
56458
57315
|
}
|
|
@@ -56463,13 +57320,13 @@ function detectCppcheck(cwd) {
|
|
|
56463
57320
|
}
|
|
56464
57321
|
}
|
|
56465
57322
|
function detectSwiftlint(cwd) {
|
|
56466
|
-
return
|
|
57323
|
+
return _internals75.existsSync(path81.join(cwd, "Package.swift")) && hasAdditionalCommand("swiftlint");
|
|
56467
57324
|
}
|
|
56468
57325
|
function detectDartAnalyze(cwd) {
|
|
56469
|
-
return
|
|
57326
|
+
return _internals75.existsSync(path81.join(cwd, "pubspec.yaml")) && hasAdditionalCommand("dart");
|
|
56470
57327
|
}
|
|
56471
57328
|
function detectRubocop(cwd) {
|
|
56472
|
-
return (
|
|
57329
|
+
return (_internals75.existsSync(path81.join(cwd, "Gemfile")) || _internals75.existsSync(path81.join(cwd, "gems.rb")) || _internals75.existsSync(path81.join(cwd, ".rubocop.yml"))) && (hasAdditionalCommand("rubocop") || hasAdditionalCommand("bundle"));
|
|
56473
57330
|
}
|
|
56474
57331
|
function detectAdditionalLinter(cwd) {
|
|
56475
57332
|
if (detectRuff(cwd))
|
|
@@ -56514,7 +57371,7 @@ async function runResolvedLint(command, mode, directory, abortSignal) {
|
|
|
56514
57371
|
error: "Command exceeds maximum allowed length"
|
|
56515
57372
|
};
|
|
56516
57373
|
}
|
|
56517
|
-
const runResult = await
|
|
57374
|
+
const runResult = await _internals75.runExternalTool({
|
|
56518
57375
|
executable: command.executable,
|
|
56519
57376
|
args: [...command.argsPrefix, ...lintArgs],
|
|
56520
57377
|
cwd: toAbsoluteDirectory(directory),
|
|
@@ -56592,7 +57449,7 @@ function getAdditionalLinterCommand(linter, mode, cwd) {
|
|
|
56592
57449
|
}
|
|
56593
57450
|
}
|
|
56594
57451
|
async function runLint(linter, mode, directory, abortSignal) {
|
|
56595
|
-
const resolved = await
|
|
57452
|
+
const resolved = await _internals75.resolveLinterCommand(linter, directory);
|
|
56596
57453
|
if (!resolved) {
|
|
56597
57454
|
return {
|
|
56598
57455
|
success: false,
|
|
@@ -56633,7 +57490,7 @@ async function runAdditionalLint(linter, mode, cwd, abortSignal) {
|
|
|
56633
57490
|
error: `No safely executable ${linter} command found`
|
|
56634
57491
|
};
|
|
56635
57492
|
}
|
|
56636
|
-
const runResult = await
|
|
57493
|
+
const runResult = await _internals75.runExternalTool({
|
|
56637
57494
|
executable,
|
|
56638
57495
|
args,
|
|
56639
57496
|
cwd: toAbsoluteDirectory(cwd),
|
|
@@ -56641,7 +57498,7 @@ async function runAdditionalLint(linter, mode, cwd, abortSignal) {
|
|
|
56641
57498
|
maxStdoutBytes: MAX_OUTPUT_BYTES2,
|
|
56642
57499
|
maxStderrBytes: MAX_OUTPUT_BYTES2,
|
|
56643
57500
|
abortSignal,
|
|
56644
|
-
windowsVerbatimArguments:
|
|
57501
|
+
windowsVerbatimArguments: _internals75.platform() === "win32" && path81.basename(executable).toLowerCase() === "cmd.exe"
|
|
56645
57502
|
});
|
|
56646
57503
|
if (runResult.status !== "completed") {
|
|
56647
57504
|
return buildExecutionError(mode, command, linter, runResult);
|
|
@@ -56688,15 +57545,15 @@ var lint = createSwarmTool({
|
|
|
56688
57545
|
}
|
|
56689
57546
|
const { mode } = args;
|
|
56690
57547
|
const cwd = directory;
|
|
56691
|
-
const resolvedLinter = await
|
|
57548
|
+
const resolvedLinter = await _internals75.detectResolvedLinter(directory, ctx?.abort);
|
|
56692
57549
|
if (resolvedLinter) {
|
|
56693
|
-
const result = await
|
|
57550
|
+
const result = await _internals75.runResolvedLint(resolvedLinter, mode, directory, ctx?.abort);
|
|
56694
57551
|
return JSON.stringify(result, null, 2);
|
|
56695
57552
|
}
|
|
56696
|
-
const additionalLinter =
|
|
57553
|
+
const additionalLinter = _internals75.detectAdditionalLinter(cwd);
|
|
56697
57554
|
if (additionalLinter) {
|
|
56698
57555
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
56699
|
-
const result = await
|
|
57556
|
+
const result = await _internals75.runAdditionalLint(additionalLinter, mode, cwd, ctx?.abort);
|
|
56700
57557
|
return JSON.stringify(result, null, 2);
|
|
56701
57558
|
}
|
|
56702
57559
|
const errorResult = {
|
|
@@ -56710,7 +57567,7 @@ For Rust: rustup component add clippy`
|
|
|
56710
57567
|
return JSON.stringify(errorResult, null, 2);
|
|
56711
57568
|
}
|
|
56712
57569
|
});
|
|
56713
|
-
var
|
|
57570
|
+
var _internals75 = {
|
|
56714
57571
|
MAX_PACKAGE_MANIFEST_BYTES,
|
|
56715
57572
|
MAX_PATH_SHIM_BYTES,
|
|
56716
57573
|
arch: () => process.arch,
|
|
@@ -57114,14 +57971,14 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57114
57971
|
let fd = null;
|
|
57115
57972
|
try {
|
|
57116
57973
|
const flags = fs33.constants.O_RDONLY | (O_NOFOLLOW !== undefined ? O_NOFOLLOW : 0);
|
|
57117
|
-
fd =
|
|
57974
|
+
fd = _internals76.openFile(filePath, flags);
|
|
57118
57975
|
} catch {
|
|
57119
57976
|
return { status: "incomplete", reason: "read_error" };
|
|
57120
57977
|
}
|
|
57121
57978
|
let outcome;
|
|
57122
57979
|
let closeFailed = false;
|
|
57123
57980
|
try {
|
|
57124
|
-
const stat9 =
|
|
57981
|
+
const stat9 = _internals76.fstatFile(fd);
|
|
57125
57982
|
const descriptorIdentity = getStableFileIdentity(stat9);
|
|
57126
57983
|
const initialSize = stat9.size;
|
|
57127
57984
|
if (!stat9.isFile()) {
|
|
@@ -57133,14 +57990,14 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57133
57990
|
const buffer = Buffer.allocUnsafe(bufferLength);
|
|
57134
57991
|
let bytesRead = 0;
|
|
57135
57992
|
while (bytesRead < buffer.length) {
|
|
57136
|
-
const count =
|
|
57993
|
+
const count = _internals76.readFileChunk(fd, buffer, bytesRead, buffer.length - bytesRead, null);
|
|
57137
57994
|
if (count === 0)
|
|
57138
57995
|
break;
|
|
57139
57996
|
bytesRead += count;
|
|
57140
57997
|
}
|
|
57141
|
-
const postStat =
|
|
57998
|
+
const postStat = _internals76.fstatFile(fd);
|
|
57142
57999
|
const postDescriptorIdentity = getStableFileIdentity(postStat);
|
|
57143
|
-
const postPathStat =
|
|
58000
|
+
const postPathStat = _internals76.lstatFile(filePath);
|
|
57144
58001
|
const postPathIdentity = getStableFileIdentity(postPathStat);
|
|
57145
58002
|
if (!postStat.isFile() || postDescriptorIdentity === null || postDescriptorIdentity !== descriptorIdentity || postPathStat.isSymbolicLink() || !postPathStat.isFile() || postPathIdentity === null || postPathIdentity !== descriptorIdentity) {
|
|
57146
58003
|
outcome = { status: "incomplete", reason: "read_error" };
|
|
@@ -57162,7 +58019,7 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57162
58019
|
} finally {
|
|
57163
58020
|
if (fd !== null) {
|
|
57164
58021
|
try {
|
|
57165
|
-
|
|
58022
|
+
_internals76.closeFile(fd);
|
|
57166
58023
|
} catch {
|
|
57167
58024
|
closeFailed = true;
|
|
57168
58025
|
}
|
|
@@ -57175,7 +58032,7 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57175
58032
|
function scanFileForSecrets(filePath, mode) {
|
|
57176
58033
|
const findings = [];
|
|
57177
58034
|
try {
|
|
57178
|
-
const lstat3 =
|
|
58035
|
+
const lstat3 = _internals76.lstatFile(filePath);
|
|
57179
58036
|
if (lstat3.isSymbolicLink()) {
|
|
57180
58037
|
return mode === "explicit" ? { status: "incomplete", reason: "symlink" } : { status: "skipped", reason: "symlink" };
|
|
57181
58038
|
}
|
|
@@ -57354,8 +58211,8 @@ async function collectScannableFiles(dir, excludeExact, excludeGlobs, scanDir, v
|
|
|
57354
58211
|
while (true) {
|
|
57355
58212
|
if (state.entriesSinceYield >= DISCOVERY_YIELD_INTERVAL) {
|
|
57356
58213
|
state.entriesSinceYield = 0;
|
|
57357
|
-
await
|
|
57358
|
-
if (
|
|
58214
|
+
await _internals76.yieldToEventLoop();
|
|
58215
|
+
if (_internals76.now() >= state.deadline) {
|
|
57359
58216
|
state.deadlineExceeded = true;
|
|
57360
58217
|
recordIncompletePath(state.incompletePaths, scanDir, currentDir, "deadline");
|
|
57361
58218
|
stoppedEarly = true;
|
|
@@ -57418,7 +58275,7 @@ async function collectScannableFiles(dir, excludeExact, excludeGlobs, scanDir, v
|
|
|
57418
58275
|
}
|
|
57419
58276
|
} finally {
|
|
57420
58277
|
try {
|
|
57421
|
-
|
|
58278
|
+
_internals76.closeDirectory(directory);
|
|
57422
58279
|
} catch (error2) {
|
|
57423
58280
|
if (error2.code !== "ERR_DIR_CLOSED") {
|
|
57424
58281
|
state.cleanupFailed = true;
|
|
@@ -57540,7 +58397,7 @@ var secretscan = createSwarmTool({
|
|
|
57540
58397
|
symlinkSkipped: 0
|
|
57541
58398
|
};
|
|
57542
58399
|
const visited = new Set;
|
|
57543
|
-
const deadline =
|
|
58400
|
+
const deadline = _internals76.now() + SCAN_TIME_BUDGET_MS;
|
|
57544
58401
|
const discovery = {
|
|
57545
58402
|
files: [],
|
|
57546
58403
|
totalCandidates: 0,
|
|
@@ -57552,7 +58409,7 @@ var secretscan = createSwarmTool({
|
|
|
57552
58409
|
directoriesQueued: 1,
|
|
57553
58410
|
unexaminedDirectories: 0
|
|
57554
58411
|
};
|
|
57555
|
-
await
|
|
58412
|
+
await _internals76.yieldToEventLoop();
|
|
57556
58413
|
await collectScannableFiles(scanDir, excludeExact, excludeGlobs, scanDir, visited, stats, discovery);
|
|
57557
58414
|
const files = discovery.files;
|
|
57558
58415
|
files.sort(compareFilePaths);
|
|
@@ -57571,7 +58428,7 @@ var secretscan = createSwarmTool({
|
|
|
57571
58428
|
let skippedFiles = stats.skippedFiles;
|
|
57572
58429
|
let incompleteFiles = stats.fileErrors + Math.max(0, discovery.totalCandidates - filesToScan.length) + (discovery.deadlineExceeded || discovery.cleanupFailed ? 1 : 0) + discovery.unexaminedDirectories;
|
|
57573
58430
|
for (let index = 0;index < filesToScan.length; index++) {
|
|
57574
|
-
if (
|
|
58431
|
+
if (_internals76.now() >= deadline) {
|
|
57575
58432
|
for (const remaining of filesToScan.slice(index)) {
|
|
57576
58433
|
recordIncompletePath(discovery.incompletePaths, scanDir, remaining, "deadline");
|
|
57577
58434
|
}
|
|
@@ -57607,7 +58464,7 @@ var secretscan = createSwarmTool({
|
|
|
57607
58464
|
}
|
|
57608
58465
|
}
|
|
57609
58466
|
if (index + 1 < filesToScan.length) {
|
|
57610
|
-
await
|
|
58467
|
+
await _internals76.yieldToEventLoop();
|
|
57611
58468
|
}
|
|
57612
58469
|
}
|
|
57613
58470
|
allFindings.sort((a, b) => {
|
|
@@ -57670,7 +58527,7 @@ var secretscan = createSwarmTool({
|
|
|
57670
58527
|
});
|
|
57671
58528
|
async function runSecretscan(directory) {
|
|
57672
58529
|
try {
|
|
57673
|
-
const result = await
|
|
58530
|
+
const result = await _internals76.secretscan.execute({ directory }, {});
|
|
57674
58531
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
57675
58532
|
return JSON.parse(jsonStr);
|
|
57676
58533
|
} catch (e) {
|
|
@@ -57721,10 +58578,10 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57721
58578
|
if (files.length > filesToScan.length) {
|
|
57722
58579
|
recordIncompletePath(incompletePaths, canonicalRoot, canonicalRoot, "max_files");
|
|
57723
58580
|
}
|
|
57724
|
-
const deadline =
|
|
57725
|
-
await
|
|
58581
|
+
const deadline = _internals76.now() + SCAN_TIME_BUDGET_MS;
|
|
58582
|
+
await _internals76.yieldToEventLoop();
|
|
57726
58583
|
for (let index = 0;index < filesToScan.length; index++) {
|
|
57727
|
-
if (
|
|
58584
|
+
if (_internals76.now() >= deadline) {
|
|
57728
58585
|
for (const remaining of filesToScan.slice(index)) {
|
|
57729
58586
|
const remainingPath = path82.isAbsolute(remaining) ? path82.resolve(remaining) : path82.resolve(rawRoot, remaining);
|
|
57730
58587
|
recordIncompletePath(incompletePaths, canonicalRoot, remainingPath, "deadline");
|
|
@@ -57751,7 +58608,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57751
58608
|
}
|
|
57752
58609
|
let lstat3;
|
|
57753
58610
|
try {
|
|
57754
|
-
lstat3 =
|
|
58611
|
+
lstat3 = _internals76.lstatFile(resolvedPath);
|
|
57755
58612
|
} catch (error2) {
|
|
57756
58613
|
const err = error2;
|
|
57757
58614
|
if (err.code === "ENOENT") {
|
|
@@ -57820,7 +58677,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57820
58677
|
assertNever(outcome);
|
|
57821
58678
|
}
|
|
57822
58679
|
if (index + 1 < filesToScan.length) {
|
|
57823
|
-
await
|
|
58680
|
+
await _internals76.yieldToEventLoop();
|
|
57824
58681
|
}
|
|
57825
58682
|
}
|
|
57826
58683
|
findings.sort((a, b) => {
|
|
@@ -57850,7 +58707,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57850
58707
|
};
|
|
57851
58708
|
}
|
|
57852
58709
|
}
|
|
57853
|
-
var
|
|
58710
|
+
var _internals76 = {
|
|
57854
58711
|
secretscan,
|
|
57855
58712
|
runSecretscan,
|
|
57856
58713
|
runSecretscanOnFiles,
|
|
@@ -58134,7 +58991,7 @@ async function buildImpactMapInternal(cwd) {
|
|
|
58134
58991
|
}
|
|
58135
58992
|
return impactMap;
|
|
58136
58993
|
}
|
|
58137
|
-
var
|
|
58994
|
+
var _internals77 = {
|
|
58138
58995
|
validateProjectRoot,
|
|
58139
58996
|
normalizePath: normalizePath2,
|
|
58140
58997
|
isCacheStale,
|
|
@@ -58149,8 +59006,8 @@ var _internals76 = {
|
|
|
58149
59006
|
_clearGoModuleCache
|
|
58150
59007
|
};
|
|
58151
59008
|
async function buildImpactMap(cwd) {
|
|
58152
|
-
const impactMap = await
|
|
58153
|
-
await
|
|
59009
|
+
const impactMap = await _internals77.buildImpactMapInternal(cwd);
|
|
59010
|
+
await _internals77.saveImpactMap(cwd, impactMap);
|
|
58154
59011
|
return impactMap;
|
|
58155
59012
|
}
|
|
58156
59013
|
async function loadImpactMap(cwd, options) {
|
|
@@ -58164,7 +59021,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
58164
59021
|
const hasValidValues = Object.values(map).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
58165
59022
|
if (hasValidValues) {
|
|
58166
59023
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
58167
|
-
if (!
|
|
59024
|
+
if (!_internals77.isCacheStale(map, generatedAt)) {
|
|
58168
59025
|
return map;
|
|
58169
59026
|
}
|
|
58170
59027
|
if (options?.skipRebuild) {
|
|
@@ -58184,13 +59041,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
58184
59041
|
if (options?.skipRebuild) {
|
|
58185
59042
|
return {};
|
|
58186
59043
|
}
|
|
58187
|
-
return
|
|
59044
|
+
return _internals77.buildImpactMap(cwd);
|
|
58188
59045
|
}
|
|
58189
59046
|
async function saveImpactMap(cwd, impactMap) {
|
|
58190
59047
|
if (!path83.isAbsolute(cwd)) {
|
|
58191
59048
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
58192
59049
|
}
|
|
58193
|
-
|
|
59050
|
+
_internals77.validateProjectRoot(cwd);
|
|
58194
59051
|
const cacheDir2 = path83.join(cwd, ".swarm", "cache");
|
|
58195
59052
|
const cachePath = path83.join(cacheDir2, "impact-map.json");
|
|
58196
59053
|
if (!fs34.existsSync(cacheDir2)) {
|
|
@@ -58214,7 +59071,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
58214
59071
|
};
|
|
58215
59072
|
}
|
|
58216
59073
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
58217
|
-
const impactMap = await
|
|
59074
|
+
const impactMap = await _internals77.loadImpactMap(cwd);
|
|
58218
59075
|
const impactedTestsSet = new Set;
|
|
58219
59076
|
const untestedFiles = [];
|
|
58220
59077
|
let visitedCount = 0;
|
|
@@ -58491,7 +59348,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
58491
59348
|
}
|
|
58492
59349
|
const historyPath = getHistoryPath(workingDir);
|
|
58493
59350
|
const historyDir = path84.dirname(historyPath);
|
|
58494
|
-
|
|
59351
|
+
_internals78.validateProjectRoot(workingDir);
|
|
58495
59352
|
if (!fs35.existsSync(historyDir)) {
|
|
58496
59353
|
fs35.mkdirSync(historyDir, { recursive: true });
|
|
58497
59354
|
}
|
|
@@ -58614,7 +59471,7 @@ function getAllHistory(workingDir) {
|
|
|
58614
59471
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
58615
59472
|
return records;
|
|
58616
59473
|
}
|
|
58617
|
-
var
|
|
59474
|
+
var _internals78 = {
|
|
58618
59475
|
validateProjectRoot
|
|
58619
59476
|
};
|
|
58620
59477
|
|
|
@@ -58627,7 +59484,7 @@ var MAX_SAFE_TEST_FILES = 50;
|
|
|
58627
59484
|
var MAX_SAFE_SOURCE_FILES = 1;
|
|
58628
59485
|
async function estimateFanOut(sourceFiles, cwd) {
|
|
58629
59486
|
try {
|
|
58630
|
-
const impactMap = await
|
|
59487
|
+
const impactMap = await _internals79.loadImpactMap(cwd, {
|
|
58631
59488
|
skipRebuild: true
|
|
58632
59489
|
});
|
|
58633
59490
|
const uniqueTestFiles = new Set;
|
|
@@ -58798,7 +59655,7 @@ function resolveNativeTarget(target, workingDir) {
|
|
|
58798
59655
|
if (relative14.startsWith("..") || path85.isAbsolute(relative14)) {
|
|
58799
59656
|
return { success: false, error: "Native target path escapes project root" };
|
|
58800
59657
|
}
|
|
58801
|
-
if (!
|
|
59658
|
+
if (!_internals79.isCommandAvailable(target.framework === "go-test" ? "go" : "ctest")) {
|
|
58802
59659
|
return {
|
|
58803
59660
|
success: false,
|
|
58804
59661
|
error: `Native target framework "${target.framework}" is unavailable`
|
|
@@ -58859,45 +59716,45 @@ function hasDevDependency(devDeps, ...patterns) {
|
|
|
58859
59716
|
return hasPackageJsonDependency(devDeps, ...patterns);
|
|
58860
59717
|
}
|
|
58861
59718
|
function detectGoTest(cwd) {
|
|
58862
|
-
return
|
|
59719
|
+
return _internals79.existsSync(path85.join(cwd, "go.mod")) && _internals79.isCommandAvailable("go");
|
|
58863
59720
|
}
|
|
58864
59721
|
function detectJavaMaven(cwd) {
|
|
58865
|
-
return
|
|
59722
|
+
return _internals79.existsSync(path85.join(cwd, "pom.xml")) && _internals79.isCommandAvailable("mvn");
|
|
58866
59723
|
}
|
|
58867
59724
|
function detectGradle(cwd) {
|
|
58868
|
-
const hasBuildFile =
|
|
58869
|
-
const hasGradlew =
|
|
58870
|
-
return hasBuildFile && (hasGradlew ||
|
|
59725
|
+
const hasBuildFile = _internals79.existsSync(path85.join(cwd, "build.gradle")) || _internals79.existsSync(path85.join(cwd, "build.gradle.kts"));
|
|
59726
|
+
const hasGradlew = _internals79.existsSync(path85.join(cwd, "gradlew")) || _internals79.existsSync(path85.join(cwd, "gradlew.bat"));
|
|
59727
|
+
return hasBuildFile && (hasGradlew || _internals79.isCommandAvailable("gradle"));
|
|
58871
59728
|
}
|
|
58872
59729
|
function detectDotnetTest(cwd) {
|
|
58873
59730
|
try {
|
|
58874
|
-
const files =
|
|
59731
|
+
const files = _internals79.readdirSync(cwd);
|
|
58875
59732
|
const hasCsproj = files.some((f) => f.endsWith(".csproj"));
|
|
58876
|
-
return hasCsproj &&
|
|
59733
|
+
return hasCsproj && _internals79.isCommandAvailable("dotnet");
|
|
58877
59734
|
} catch {
|
|
58878
59735
|
return false;
|
|
58879
59736
|
}
|
|
58880
59737
|
}
|
|
58881
59738
|
function detectCTest(cwd) {
|
|
58882
|
-
const hasSource =
|
|
58883
|
-
const hasBuildCache =
|
|
58884
|
-
return (hasSource || hasBuildCache) &&
|
|
59739
|
+
const hasSource = _internals79.existsSync(path85.join(cwd, "CMakeLists.txt"));
|
|
59740
|
+
const hasBuildCache = _internals79.existsSync(path85.join(cwd, "CMakeCache.txt")) || _internals79.existsSync(path85.join(cwd, "build", "CMakeCache.txt"));
|
|
59741
|
+
return (hasSource || hasBuildCache) && _internals79.isCommandAvailable("ctest");
|
|
58885
59742
|
}
|
|
58886
59743
|
function detectSwiftTest(cwd) {
|
|
58887
|
-
return
|
|
59744
|
+
return _internals79.existsSync(path85.join(cwd, "Package.swift")) && _internals79.isCommandAvailable("swift");
|
|
58888
59745
|
}
|
|
58889
59746
|
function detectDartTest(cwd) {
|
|
58890
|
-
return
|
|
59747
|
+
return _internals79.existsSync(path85.join(cwd, "pubspec.yaml")) && (_internals79.isCommandAvailable("dart") || _internals79.isCommandAvailable("flutter"));
|
|
58891
59748
|
}
|
|
58892
59749
|
function detectRSpec(cwd) {
|
|
58893
|
-
const hasRSpecFile =
|
|
58894
|
-
const hasGemfile =
|
|
58895
|
-
const hasSpecDir =
|
|
59750
|
+
const hasRSpecFile = _internals79.existsSync(path85.join(cwd, ".rspec"));
|
|
59751
|
+
const hasGemfile = _internals79.existsSync(path85.join(cwd, "Gemfile"));
|
|
59752
|
+
const hasSpecDir = _internals79.existsSync(path85.join(cwd, "spec"));
|
|
58896
59753
|
const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
|
|
58897
|
-
return hasRSpec && (
|
|
59754
|
+
return hasRSpec && (_internals79.isCommandAvailable("bundle") || _internals79.isCommandAvailable("rspec"));
|
|
58898
59755
|
}
|
|
58899
59756
|
function detectMinitest(cwd) {
|
|
58900
|
-
return
|
|
59757
|
+
return _internals79.existsSync(path85.join(cwd, "test")) && (_internals79.existsSync(path85.join(cwd, "Gemfile")) || _internals79.existsSync(path85.join(cwd, "Rakefile"))) && _internals79.isCommandAvailable("ruby");
|
|
58901
59758
|
}
|
|
58902
59759
|
var DISPATCH_FRAMEWORK_MAP = {
|
|
58903
59760
|
bun: "bun",
|
|
@@ -58990,8 +59847,8 @@ async function detectTestFramework(cwd) {
|
|
|
58990
59847
|
const baseDir = cwd;
|
|
58991
59848
|
try {
|
|
58992
59849
|
const packageJsonPath = path85.join(baseDir, "package.json");
|
|
58993
|
-
if (
|
|
58994
|
-
const content =
|
|
59850
|
+
if (_internals79.existsSync(packageJsonPath)) {
|
|
59851
|
+
const content = _internals79.readFileSync(packageJsonPath, "utf-8");
|
|
58995
59852
|
const pkg = JSON.parse(content);
|
|
58996
59853
|
const _deps = pkg.dependencies || {};
|
|
58997
59854
|
const devDeps = pkg.devDependencies || {};
|
|
@@ -59010,7 +59867,7 @@ async function detectTestFramework(cwd) {
|
|
|
59010
59867
|
return "jest";
|
|
59011
59868
|
if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
|
|
59012
59869
|
return "mocha";
|
|
59013
|
-
if (
|
|
59870
|
+
if (_internals79.existsSync(path85.join(baseDir, "bun.lockb")) || _internals79.existsSync(path85.join(baseDir, "bun.lock"))) {
|
|
59014
59871
|
if (scripts.test?.includes("bun"))
|
|
59015
59872
|
return "bun";
|
|
59016
59873
|
}
|
|
@@ -59020,28 +59877,28 @@ async function detectTestFramework(cwd) {
|
|
|
59020
59877
|
const pyprojectTomlPath = path85.join(baseDir, "pyproject.toml");
|
|
59021
59878
|
const setupCfgPath = path85.join(baseDir, "setup.cfg");
|
|
59022
59879
|
const requirementsTxtPath = path85.join(baseDir, "requirements.txt");
|
|
59023
|
-
if (
|
|
59024
|
-
const content =
|
|
59880
|
+
if (_internals79.existsSync(pyprojectTomlPath)) {
|
|
59881
|
+
const content = _internals79.readFileSync(pyprojectTomlPath, "utf-8");
|
|
59025
59882
|
if (content.includes("[tool.pytest"))
|
|
59026
59883
|
return "pytest";
|
|
59027
59884
|
if (content.includes("pytest"))
|
|
59028
59885
|
return "pytest";
|
|
59029
59886
|
}
|
|
59030
|
-
if (
|
|
59031
|
-
const content =
|
|
59887
|
+
if (_internals79.existsSync(setupCfgPath)) {
|
|
59888
|
+
const content = _internals79.readFileSync(setupCfgPath, "utf-8");
|
|
59032
59889
|
if (content.includes("[pytest]"))
|
|
59033
59890
|
return "pytest";
|
|
59034
59891
|
}
|
|
59035
|
-
if (
|
|
59036
|
-
const content =
|
|
59892
|
+
if (_internals79.existsSync(requirementsTxtPath)) {
|
|
59893
|
+
const content = _internals79.readFileSync(requirementsTxtPath, "utf-8");
|
|
59037
59894
|
if (content.includes("pytest"))
|
|
59038
59895
|
return "pytest";
|
|
59039
59896
|
}
|
|
59040
59897
|
} catch {}
|
|
59041
59898
|
try {
|
|
59042
59899
|
const cargoTomlPath = path85.join(baseDir, "Cargo.toml");
|
|
59043
|
-
if (
|
|
59044
|
-
const content =
|
|
59900
|
+
if (_internals79.existsSync(cargoTomlPath)) {
|
|
59901
|
+
const content = _internals79.readFileSync(cargoTomlPath, "utf-8");
|
|
59045
59902
|
if (content.includes("[dev-dependencies]")) {
|
|
59046
59903
|
if (content.includes("tokio") || content.includes("mockall") || content.includes("pretty_assertions")) {
|
|
59047
59904
|
return "cargo";
|
|
@@ -59053,7 +59910,7 @@ async function detectTestFramework(cwd) {
|
|
|
59053
59910
|
const pesterConfigPath = path85.join(baseDir, "pester.config.ps1");
|
|
59054
59911
|
const pesterConfigJsonPath = path85.join(baseDir, "pester.config.ps1.json");
|
|
59055
59912
|
const pesterPs1Path = path85.join(baseDir, "tests.ps1");
|
|
59056
|
-
if (
|
|
59913
|
+
if (_internals79.existsSync(pesterConfigPath) || _internals79.existsSync(pesterConfigJsonPath) || _internals79.existsSync(pesterPs1Path)) {
|
|
59057
59914
|
return "pester";
|
|
59058
59915
|
}
|
|
59059
59916
|
} catch {}
|
|
@@ -59081,12 +59938,12 @@ async function detectTestFramework(cwd) {
|
|
|
59081
59938
|
return "none";
|
|
59082
59939
|
}
|
|
59083
59940
|
function detectPhpTest(cwd) {
|
|
59084
|
-
if (
|
|
59941
|
+
if (_internals79.existsSync(path85.join(cwd, "artisan")) && _internals79.existsSync(path85.join(cwd, "composer.json"))) {
|
|
59085
59942
|
return "php-artisan";
|
|
59086
59943
|
}
|
|
59087
|
-
if (
|
|
59944
|
+
if (_internals79.existsSync(path85.join(cwd, "Pest.php")))
|
|
59088
59945
|
return "pest";
|
|
59089
|
-
if (
|
|
59946
|
+
if (_internals79.existsSync(path85.join(cwd, "phpunit.xml")) || _internals79.existsSync(path85.join(cwd, "phpunit.xml.dist"))) {
|
|
59090
59947
|
return "phpunit";
|
|
59091
59948
|
}
|
|
59092
59949
|
return null;
|
|
@@ -59509,9 +60366,9 @@ function buildTestCommand(framework, scope, files, coverage, baseDir, bail, targ
|
|
|
59509
60366
|
return args;
|
|
59510
60367
|
}
|
|
59511
60368
|
case "dart-test":
|
|
59512
|
-
return
|
|
60369
|
+
return _internals79.isCommandAvailable("flutter") ? ["flutter", "test", ...files] : ["dart", "test", ...files];
|
|
59513
60370
|
case "rspec": {
|
|
59514
|
-
const args =
|
|
60371
|
+
const args = _internals79.isCommandAvailable("bundle") ? ["bundle", "exec", "rspec"] : ["rspec"];
|
|
59515
60372
|
if (bail)
|
|
59516
60373
|
args.push("--fail-fast");
|
|
59517
60374
|
if (scope !== "all" && files.length > 0) {
|
|
@@ -60058,7 +60915,7 @@ async function runTests(framework, scope, files, coverage, timeout_ms, cwd, bail
|
|
|
60058
60915
|
resolve30({ kind: "timeout" });
|
|
60059
60916
|
}, timeout_ms);
|
|
60060
60917
|
});
|
|
60061
|
-
proc =
|
|
60918
|
+
proc = _internals79.bunSpawn(command, {
|
|
60062
60919
|
stdin: "ignore",
|
|
60063
60920
|
stdout: "pipe",
|
|
60064
60921
|
stderr: "pipe",
|
|
@@ -60653,7 +61510,7 @@ var test_runner = createSwarmTool({
|
|
|
60653
61510
|
return JSON.stringify(errorResult, null, 2);
|
|
60654
61511
|
}
|
|
60655
61512
|
try {
|
|
60656
|
-
const impactResult = await
|
|
61513
|
+
const impactResult = await _internals79.analyzeImpact(sourceFiles, workingDir, MAX_SAFE_TEST_FILES);
|
|
60657
61514
|
if (impactResult.budgetExceeded) {
|
|
60658
61515
|
const errorResult = {
|
|
60659
61516
|
success: false,
|
|
@@ -60744,7 +61601,7 @@ var test_runner = createSwarmTool({
|
|
|
60744
61601
|
return JSON.stringify(result, null, 2);
|
|
60745
61602
|
}
|
|
60746
61603
|
});
|
|
60747
|
-
var
|
|
61604
|
+
var _internals79 = {
|
|
60748
61605
|
analyzeImpact,
|
|
60749
61606
|
loadImpactMap,
|
|
60750
61607
|
isCommandAvailable,
|
|
@@ -60849,9 +61706,9 @@ function getVersionFileVersion(dir) {
|
|
|
60849
61706
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
60850
61707
|
const startTime = Date.now();
|
|
60851
61708
|
try {
|
|
60852
|
-
const packageVersion =
|
|
60853
|
-
const changelogVersion =
|
|
60854
|
-
const versionFileVersion =
|
|
61709
|
+
const packageVersion = _internals80.getPackageVersion(dir);
|
|
61710
|
+
const changelogVersion = _internals80.getChangelogVersion(dir);
|
|
61711
|
+
const versionFileVersion = _internals80.getVersionFileVersion(dir);
|
|
60855
61712
|
const versions = [];
|
|
60856
61713
|
if (packageVersion)
|
|
60857
61714
|
versions.push(`package.json: ${packageVersion}`);
|
|
@@ -61040,7 +61897,7 @@ async function runTestsCheck(_dir, scope, timeoutMs) {
|
|
|
61040
61897
|
async function runSecretsCheck(dir, timeoutMs) {
|
|
61041
61898
|
const startTime = Date.now();
|
|
61042
61899
|
try {
|
|
61043
|
-
const secretsPromise =
|
|
61900
|
+
const secretsPromise = _internals80.runSecretscan(dir);
|
|
61044
61901
|
const timeoutPromise = new Promise((_, reject) => {
|
|
61045
61902
|
setTimeout(() => {
|
|
61046
61903
|
reject(new Error(`Secrets check timed out after ${timeoutMs}ms`));
|
|
@@ -61407,7 +62264,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61407
62264
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
61408
62265
|
let validatedDir;
|
|
61409
62266
|
try {
|
|
61410
|
-
validatedDir =
|
|
62267
|
+
validatedDir = _internals80.validateDirectoryPath(dir);
|
|
61411
62268
|
} catch (error2) {
|
|
61412
62269
|
return {
|
|
61413
62270
|
id: reportId,
|
|
@@ -61427,7 +62284,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61427
62284
|
}
|
|
61428
62285
|
let validatedTimeout;
|
|
61429
62286
|
try {
|
|
61430
|
-
validatedTimeout =
|
|
62287
|
+
validatedTimeout = _internals80.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
61431
62288
|
} catch (error2) {
|
|
61432
62289
|
return {
|
|
61433
62290
|
id: reportId,
|
|
@@ -61468,12 +62325,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
61468
62325
|
});
|
|
61469
62326
|
const checks = [];
|
|
61470
62327
|
log("[Preflight] Running lint check...");
|
|
61471
|
-
const lintResult = await
|
|
62328
|
+
const lintResult = await _internals80.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
61472
62329
|
checks.push(lintResult);
|
|
61473
62330
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
61474
62331
|
if (!cfg.skipTests) {
|
|
61475
62332
|
log("[Preflight] Running tests check...");
|
|
61476
|
-
const testsResult = await
|
|
62333
|
+
const testsResult = await _internals80.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
61477
62334
|
checks.push(testsResult);
|
|
61478
62335
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
61479
62336
|
} else {
|
|
@@ -61485,7 +62342,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61485
62342
|
}
|
|
61486
62343
|
if (!cfg.skipSecrets) {
|
|
61487
62344
|
log("[Preflight] Running secrets check...");
|
|
61488
|
-
const secretsResult = await
|
|
62345
|
+
const secretsResult = await _internals80.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
61489
62346
|
checks.push(secretsResult);
|
|
61490
62347
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
61491
62348
|
} else {
|
|
@@ -61497,7 +62354,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61497
62354
|
}
|
|
61498
62355
|
if (!cfg.skipEvidence) {
|
|
61499
62356
|
log("[Preflight] Running evidence check...");
|
|
61500
|
-
const evidenceResult = await
|
|
62357
|
+
const evidenceResult = await _internals80.runEvidenceCheck(validatedDir);
|
|
61501
62358
|
checks.push(evidenceResult);
|
|
61502
62359
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
61503
62360
|
} else {
|
|
@@ -61508,12 +62365,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
61508
62365
|
});
|
|
61509
62366
|
}
|
|
61510
62367
|
log("[Preflight] Running requirement coverage check...");
|
|
61511
|
-
const reqCoverageResult = await
|
|
62368
|
+
const reqCoverageResult = await _internals80.runRequirementCoverageCheck(validatedDir, phase);
|
|
61512
62369
|
checks.push(reqCoverageResult);
|
|
61513
62370
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
61514
62371
|
if (!cfg.skipVersion) {
|
|
61515
62372
|
log("[Preflight] Running version check...");
|
|
61516
|
-
const versionResult = await
|
|
62373
|
+
const versionResult = await _internals80.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
61517
62374
|
checks.push(versionResult);
|
|
61518
62375
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
61519
62376
|
} else {
|
|
@@ -61576,10 +62433,10 @@ function formatPreflightMarkdown(report) {
|
|
|
61576
62433
|
async function handlePreflightCommand(directory, _args) {
|
|
61577
62434
|
const plan = await loadPlan(directory);
|
|
61578
62435
|
const phase = plan?.current_phase ?? 1;
|
|
61579
|
-
const report = await
|
|
61580
|
-
return
|
|
62436
|
+
const report = await _internals80.runPreflight(directory, phase);
|
|
62437
|
+
return _internals80.formatPreflightMarkdown(report);
|
|
61581
62438
|
}
|
|
61582
|
-
var
|
|
62439
|
+
var _internals80 = {
|
|
61583
62440
|
runPreflight,
|
|
61584
62441
|
formatPreflightMarkdown,
|
|
61585
62442
|
handlePreflightCommand,
|
|
@@ -62863,7 +63720,7 @@ function pruneOldResetBackups(backupsRoot, warnings) {
|
|
|
62863
63720
|
}
|
|
62864
63721
|
|
|
62865
63722
|
// src/commands/reset.ts
|
|
62866
|
-
var
|
|
63723
|
+
var _internals81 = {
|
|
62867
63724
|
backupSwarmStateBeforeReset
|
|
62868
63725
|
};
|
|
62869
63726
|
async function handleResetCommand(directory, args) {
|
|
@@ -62903,7 +63760,7 @@ async function handleResetCommand(directory, args) {
|
|
|
62903
63760
|
];
|
|
62904
63761
|
const results = [];
|
|
62905
63762
|
try {
|
|
62906
|
-
const backup =
|
|
63763
|
+
const backup = _internals81.backupSwarmStateBeforeReset(directory, "reset", [
|
|
62907
63764
|
...filesToReset,
|
|
62908
63765
|
"summaries"
|
|
62909
63766
|
]);
|
|
@@ -63045,7 +63902,7 @@ function clearTrajectoryStep(sessionId) {
|
|
|
63045
63902
|
}
|
|
63046
63903
|
|
|
63047
63904
|
// src/commands/reset-session.ts
|
|
63048
|
-
var
|
|
63905
|
+
var _internals82 = {
|
|
63049
63906
|
cleanupOrphanedBranches,
|
|
63050
63907
|
backupSwarmStateBeforeReset,
|
|
63051
63908
|
recoverStaleCoderSettlements
|
|
@@ -63058,7 +63915,7 @@ function errorMessage(err) {
|
|
|
63058
63915
|
async function handleResetSessionCommand(directory, _args) {
|
|
63059
63916
|
const results = [];
|
|
63060
63917
|
try {
|
|
63061
|
-
const backup =
|
|
63918
|
+
const backup = _internals82.backupSwarmStateBeforeReset(directory, "reset-session", ["session"]);
|
|
63062
63919
|
if (backup.backupDir && backup.copied.length > 0) {
|
|
63063
63920
|
const rel = path89.relative(directory, backup.backupDir);
|
|
63064
63921
|
results.push(`\uD83D\uDCE6 Backed up session state to ${rel}/ (restore by copying files back into .swarm/session/)`);
|
|
@@ -63120,7 +63977,7 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
63120
63977
|
results.push(`\u2705 Cleared ${activeAgentCount} active-agent mapping(s)`);
|
|
63121
63978
|
let preserveWorktrees = false;
|
|
63122
63979
|
try {
|
|
63123
|
-
const { results: settlementResults, truncated } = await
|
|
63980
|
+
const { results: settlementResults, truncated } = await _internals82.recoverStaleCoderSettlements(directory, {
|
|
63124
63981
|
force: true
|
|
63125
63982
|
});
|
|
63126
63983
|
if (settlementResults.length === 0) {
|
|
@@ -63180,7 +64037,7 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
63180
64037
|
results.push(`\u26A0\uFE0F Failed to remove .swarm-worktrees/: ${errorMessage(err)}`);
|
|
63181
64038
|
}
|
|
63182
64039
|
try {
|
|
63183
|
-
const branchResult = await
|
|
64040
|
+
const branchResult = await _internals82.cleanupOrphanedBranches(directory, []);
|
|
63184
64041
|
if (branchResult.removed.length > 0) {
|
|
63185
64042
|
results.push(`\u2705 Removed ${branchResult.removed.length} orphan swarm-lane branch(es)`);
|
|
63186
64043
|
}
|
|
@@ -63575,8 +64432,8 @@ async function runGit2(directory, args, options) {
|
|
|
63575
64432
|
};
|
|
63576
64433
|
let proc;
|
|
63577
64434
|
try {
|
|
63578
|
-
const gitExecutable = await
|
|
63579
|
-
proc =
|
|
64435
|
+
const gitExecutable = await _internals83.resolveGitExecutable();
|
|
64436
|
+
proc = _internals83.bunSpawn([gitExecutable, "-c", "core.quotepath=false", ...args], spawnOptions);
|
|
63580
64437
|
} catch (error2) {
|
|
63581
64438
|
return {
|
|
63582
64439
|
ok: false,
|
|
@@ -63659,8 +64516,8 @@ function sameCanonicalDirectory(left, right) {
|
|
|
63659
64516
|
if (samePath(left, right))
|
|
63660
64517
|
return true;
|
|
63661
64518
|
try {
|
|
63662
|
-
const leftStat =
|
|
63663
|
-
const rightStat =
|
|
64519
|
+
const leftStat = _internals83.lstatBigIntSync(left);
|
|
64520
|
+
const rightStat = _internals83.lstatBigIntSync(right);
|
|
63664
64521
|
return leftStat.isDirectory() && rightStat.isDirectory() && !leftStat.isSymbolicLink() && !rightStat.isSymbolicLink() && (leftStat.dev !== 0n || leftStat.ino !== 0n) && sameFileIdentity(leftStat, rightStat);
|
|
63665
64522
|
} catch {
|
|
63666
64523
|
return false;
|
|
@@ -63765,18 +64622,18 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63765
64622
|
}
|
|
63766
64623
|
});
|
|
63767
64624
|
try {
|
|
63768
|
-
if (
|
|
64625
|
+
if (_internals83.now() > budget.deadlineMs) {
|
|
63769
64626
|
return deadlineExceeded("working-tree content identity deadline expired before file hashing started");
|
|
63770
64627
|
}
|
|
63771
|
-
const pathStat =
|
|
64628
|
+
const pathStat = _internals83.lstatBigIntSync(candidate);
|
|
63772
64629
|
if (!pathStat.isFile() || pathStat.isSymbolicLink())
|
|
63773
64630
|
return { identity: null };
|
|
63774
|
-
const canonicalBeforeOpen =
|
|
64631
|
+
const canonicalBeforeOpen = _internals83.realpathSync(candidate);
|
|
63775
64632
|
if (!isContained(root, canonicalBeforeOpen))
|
|
63776
64633
|
return { identity: null };
|
|
63777
|
-
handle =
|
|
63778
|
-
const openedBeforeRead =
|
|
63779
|
-
const canonicalAfterOpen =
|
|
64634
|
+
handle = _internals83.openSync(canonicalBeforeOpen, "r");
|
|
64635
|
+
const openedBeforeRead = _internals83.fstatBigIntSync(handle);
|
|
64636
|
+
const canonicalAfterOpen = _internals83.realpathSync(candidate);
|
|
63780
64637
|
if (!openedBeforeRead.isFile() || !compareStats(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
63781
64638
|
return { identity: null };
|
|
63782
64639
|
}
|
|
@@ -63794,17 +64651,17 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63794
64651
|
const buffer = Buffer.alloc(64 * 1024);
|
|
63795
64652
|
let offset = 0;
|
|
63796
64653
|
while (offset < fileBytes) {
|
|
63797
|
-
if (
|
|
64654
|
+
if (_internals83.now() > budget.deadlineMs) {
|
|
63798
64655
|
return deadlineExceeded("working-tree content identity deadline expired while hashing file content");
|
|
63799
64656
|
}
|
|
63800
|
-
const read =
|
|
64657
|
+
const read = _internals83.readSync(handle, buffer, 0, Math.min(buffer.byteLength, fileBytes - offset), offset);
|
|
63801
64658
|
if (read === 0)
|
|
63802
64659
|
break;
|
|
63803
64660
|
hash2.update(buffer.subarray(0, read));
|
|
63804
64661
|
offset += read;
|
|
63805
64662
|
}
|
|
63806
|
-
const openedAfterRead =
|
|
63807
|
-
const canonicalAfterRead =
|
|
64663
|
+
const openedAfterRead = _internals83.fstatBigIntSync(handle);
|
|
64664
|
+
const canonicalAfterRead = _internals83.realpathSync(candidate);
|
|
63808
64665
|
if (!compareStats(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || offset !== fileBytes) {
|
|
63809
64666
|
return { identity: null };
|
|
63810
64667
|
}
|
|
@@ -63821,7 +64678,7 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63821
64678
|
} finally {
|
|
63822
64679
|
if (handle !== undefined) {
|
|
63823
64680
|
try {
|
|
63824
|
-
|
|
64681
|
+
_internals83.closeSync(handle);
|
|
63825
64682
|
} catch {}
|
|
63826
64683
|
}
|
|
63827
64684
|
}
|
|
@@ -63833,7 +64690,7 @@ async function buildReviewManifest(root, selector, files, completeness, timeoutM
|
|
|
63833
64690
|
const missingIdentityBindings = new Set;
|
|
63834
64691
|
const workingTreeBudget = selector.kind === "range" ? undefined : {
|
|
63835
64692
|
remainingBytes: WORKTREE_IDENTITY_TOTAL_BYTES,
|
|
63836
|
-
deadlineMs:
|
|
64693
|
+
deadlineMs: _internals83.now() + Math.min(timeoutMs, WORKTREE_IDENTITY_MAX_DURATION_MS)
|
|
63837
64694
|
};
|
|
63838
64695
|
const orderedScopes = [...files.values()].sort((left, right) => compareUtf8Bytes(left.newPath ?? left.oldPath ?? "", right.newPath ?? right.oldPath ?? ""));
|
|
63839
64696
|
const oldTreeForSelector = selector.kind === "working-tree" ? revisionContext.headSha : selector.kind === "range" ? selector.operator === "..." ? revisionContext.mergeBase : revisionContext.baseSha : revisionContext.mergeBase;
|
|
@@ -63973,7 +64830,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63973
64830
|
}
|
|
63974
64831
|
let handle;
|
|
63975
64832
|
try {
|
|
63976
|
-
const pathStat =
|
|
64833
|
+
const pathStat = _internals83.lstatBigIntSync(candidate);
|
|
63977
64834
|
if (pathStat.isSymbolicLink()) {
|
|
63978
64835
|
return {
|
|
63979
64836
|
truncated: false,
|
|
@@ -63994,7 +64851,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63994
64851
|
}
|
|
63995
64852
|
};
|
|
63996
64853
|
}
|
|
63997
|
-
const canonicalBeforeOpen =
|
|
64854
|
+
const canonicalBeforeOpen = _internals83.realpathSync(candidate);
|
|
63998
64855
|
if (!isContained(root, canonicalBeforeOpen)) {
|
|
63999
64856
|
return {
|
|
64000
64857
|
truncated: false,
|
|
@@ -64005,9 +64862,9 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
64005
64862
|
}
|
|
64006
64863
|
};
|
|
64007
64864
|
}
|
|
64008
|
-
handle =
|
|
64009
|
-
const openedBeforeRead =
|
|
64010
|
-
const canonicalAfterOpen =
|
|
64865
|
+
handle = _internals83.openSync(canonicalBeforeOpen, "r");
|
|
64866
|
+
const openedBeforeRead = _internals83.fstatBigIntSync(handle);
|
|
64867
|
+
const canonicalAfterOpen = _internals83.realpathSync(candidate);
|
|
64011
64868
|
if (!openedBeforeRead.isFile() || !sameFileSnapshot(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
64012
64869
|
return {
|
|
64013
64870
|
truncated: false,
|
|
@@ -64022,13 +64879,13 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
64022
64879
|
const bytes = Buffer.alloc(requested);
|
|
64023
64880
|
let count = 0;
|
|
64024
64881
|
while (count < requested) {
|
|
64025
|
-
const read =
|
|
64882
|
+
const read = _internals83.readSync(handle, bytes, count, requested - count, count);
|
|
64026
64883
|
if (read === 0)
|
|
64027
64884
|
break;
|
|
64028
64885
|
count += read;
|
|
64029
64886
|
}
|
|
64030
|
-
const openedAfterRead =
|
|
64031
|
-
const canonicalAfterRead =
|
|
64887
|
+
const openedAfterRead = _internals83.fstatBigIntSync(handle);
|
|
64888
|
+
const canonicalAfterRead = _internals83.realpathSync(candidate);
|
|
64032
64889
|
if (!sameFileSnapshot(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || openedBeforeRead.size <= BigInt(maxFileBytes) && BigInt(count) !== openedBeforeRead.size) {
|
|
64033
64890
|
return {
|
|
64034
64891
|
truncated: false,
|
|
@@ -64080,7 +64937,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
64080
64937
|
} finally {
|
|
64081
64938
|
if (handle !== undefined) {
|
|
64082
64939
|
try {
|
|
64083
|
-
|
|
64940
|
+
_internals83.closeSync(handle);
|
|
64084
64941
|
} catch {}
|
|
64085
64942
|
}
|
|
64086
64943
|
}
|
|
@@ -64118,7 +64975,7 @@ async function collectReviewDiff(options) {
|
|
|
64118
64975
|
const maxUntrackedFileBytes = boundedPositiveInteger(options.maxUntrackedFileBytes, DEFAULT_MAX_UNTRACKED_FILE_BYTES, MAX_UNTRACKED_FILE_BYTES);
|
|
64119
64976
|
let root;
|
|
64120
64977
|
try {
|
|
64121
|
-
root =
|
|
64978
|
+
root = _internals83.realpathSync(options.directory);
|
|
64122
64979
|
} catch (error2) {
|
|
64123
64980
|
return {
|
|
64124
64981
|
status: "error",
|
|
@@ -64141,7 +64998,7 @@ async function collectReviewDiff(options) {
|
|
|
64141
64998
|
}
|
|
64142
64999
|
let gitRoot;
|
|
64143
65000
|
try {
|
|
64144
|
-
gitRoot =
|
|
65001
|
+
gitRoot = _internals83.realpathSync(topLevel.stdout.trim());
|
|
64145
65002
|
} catch {
|
|
64146
65003
|
return {
|
|
64147
65004
|
status: "error",
|
|
@@ -64442,7 +65299,7 @@ async function collectReviewDiff(options) {
|
|
|
64442
65299
|
const clean = canonicalText.trim().length === 0 && untrackedCount === 0 && skipReasons.length === 0;
|
|
64443
65300
|
return { status: clean ? "clean" : "ok", ...scope };
|
|
64444
65301
|
}
|
|
64445
|
-
var
|
|
65302
|
+
var _internals83 = {
|
|
64446
65303
|
bunSpawn,
|
|
64447
65304
|
realpathSync: fs41.realpathSync,
|
|
64448
65305
|
lstatBigIntSync: (path92) => fs41.lstatSync(path92, { bigint: true }),
|
|
@@ -64504,7 +65361,7 @@ function resolveReceiptsDir(directory) {
|
|
|
64504
65361
|
function resolveReceiptIndexPath(directory) {
|
|
64505
65362
|
return path92.join(resolveReceiptsDir(directory), "index.json");
|
|
64506
65363
|
}
|
|
64507
|
-
var
|
|
65364
|
+
var _internals84 = {
|
|
64508
65365
|
openSync: fs42.openSync,
|
|
64509
65366
|
lstatBigIntSync: (path93) => fs42.lstatSync(path93, { bigint: true }),
|
|
64510
65367
|
fstatBigIntSync: (fd) => fs42.fstatSync(fd, { bigint: true })
|
|
@@ -64516,7 +65373,7 @@ function pathsEqual(left, right) {
|
|
|
64516
65373
|
}
|
|
64517
65374
|
function captureCanonicalDirectory(directory, label, expected) {
|
|
64518
65375
|
const resolved = path92.resolve(directory);
|
|
64519
|
-
const stat9 =
|
|
65376
|
+
const stat9 = _internals84.lstatBigIntSync(resolved);
|
|
64520
65377
|
if (!stat9.isDirectory() || stat9.isSymbolicLink()) {
|
|
64521
65378
|
throw new Error(`${label} must be a real directory`);
|
|
64522
65379
|
}
|
|
@@ -64602,7 +65459,7 @@ function assertDirectReceiptFile(context, filePath, mustExist) {
|
|
|
64602
65459
|
throw new Error("review receipt file escapes its expected directory");
|
|
64603
65460
|
}
|
|
64604
65461
|
try {
|
|
64605
|
-
const stat9 =
|
|
65462
|
+
const stat9 = _internals84.lstatBigIntSync(resolved);
|
|
64606
65463
|
if (!stat9.isFile() || stat9.isSymbolicLink()) {
|
|
64607
65464
|
throw new Error("review receipt path must be a real file");
|
|
64608
65465
|
}
|
|
@@ -64626,7 +65483,7 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64626
65483
|
const resolved = assertDirectReceiptFile(context, receiptPath, true);
|
|
64627
65484
|
if (path92.extname(resolved) !== ".json")
|
|
64628
65485
|
return null;
|
|
64629
|
-
const pathBeforeOpen =
|
|
65486
|
+
const pathBeforeOpen = _internals84.lstatBigIntSync(resolved);
|
|
64630
65487
|
if (!pathBeforeOpen.isFile() || pathBeforeOpen.isSymbolicLink() || pathBeforeOpen.size < 0n || pathBeforeOpen.size > BigInt(maxBytes)) {
|
|
64631
65488
|
return null;
|
|
64632
65489
|
}
|
|
@@ -64634,10 +65491,10 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64634
65491
|
if (!pathsEqual(canonicalBeforeOpen, resolved))
|
|
64635
65492
|
return null;
|
|
64636
65493
|
assertReceiptContextCurrent(context);
|
|
64637
|
-
descriptor =
|
|
64638
|
-
const openedBeforeRead =
|
|
65494
|
+
descriptor = _internals84.openSync(canonicalBeforeOpen, "r");
|
|
65495
|
+
const openedBeforeRead = _internals84.fstatBigIntSync(descriptor);
|
|
64639
65496
|
assertReceiptContextCurrent(context);
|
|
64640
|
-
const pathAfterOpen =
|
|
65497
|
+
const pathAfterOpen = _internals84.lstatBigIntSync(resolved);
|
|
64641
65498
|
const canonicalAfterOpen = fs42.realpathSync(resolved);
|
|
64642
65499
|
if (!openedBeforeRead.isFile() || openedBeforeRead.size < 0n || openedBeforeRead.size > BigInt(maxBytes) || !sameFileSnapshot2(pathBeforeOpen, openedBeforeRead) || !sameFileSnapshot2(openedBeforeRead, pathAfterOpen) || !pathsEqual(canonicalBeforeOpen, canonicalAfterOpen)) {
|
|
64643
65500
|
return null;
|
|
@@ -64650,9 +65507,9 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64650
65507
|
break;
|
|
64651
65508
|
bytesRead += count;
|
|
64652
65509
|
}
|
|
64653
|
-
const openedAfterRead =
|
|
65510
|
+
const openedAfterRead = _internals84.fstatBigIntSync(descriptor);
|
|
64654
65511
|
assertReceiptContextCurrent(context);
|
|
64655
|
-
const pathAfterRead =
|
|
65512
|
+
const pathAfterRead = _internals84.lstatBigIntSync(resolved);
|
|
64656
65513
|
const canonicalAfterRead = fs42.realpathSync(resolved);
|
|
64657
65514
|
if (bytesRead !== buffer.length || !sameFileSnapshot2(openedBeforeRead, openedAfterRead) || !sameFileSnapshot2(openedAfterRead, pathAfterRead) || !pathsEqual(canonicalBeforeOpen, canonicalAfterRead)) {
|
|
64658
65515
|
return null;
|
|
@@ -65205,7 +66062,7 @@ var RETRYABLE_CAPTURE_FAILURE_CODES = new Set([
|
|
|
65205
66062
|
]);
|
|
65206
66063
|
var REVIEWER_SCOPE_CAPTURE_CHUNK_BYTES = 262144;
|
|
65207
66064
|
var REVIEWER_SCOPE_CAPTURE_BATCH_DEADLINE_MS = 1e4;
|
|
65208
|
-
var
|
|
66065
|
+
var _internals85 = {
|
|
65209
66066
|
open: fs43.openSync,
|
|
65210
66067
|
fstat: (fd, options) => fs43.fstatSync(fd, options),
|
|
65211
66068
|
read: fs43.readSync,
|
|
@@ -65242,7 +66099,7 @@ function deletedPathIsContained(canonicalRoot, absolute) {
|
|
|
65242
66099
|
let current = path93.dirname(absolute);
|
|
65243
66100
|
for (;; ) {
|
|
65244
66101
|
try {
|
|
65245
|
-
const canonical =
|
|
66102
|
+
const canonical = _internals85.realpathSync(current);
|
|
65246
66103
|
return canonicalRoot === canonical || isWithinRoot2(canonicalRoot, canonical);
|
|
65247
66104
|
} catch (error2) {
|
|
65248
66105
|
if (error2.code !== "ENOENT")
|
|
@@ -65288,7 +66145,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65288
66145
|
let canonicalParent;
|
|
65289
66146
|
const absolute = path93.resolve(directory, normalized);
|
|
65290
66147
|
try {
|
|
65291
|
-
canonicalRoot =
|
|
66148
|
+
canonicalRoot = _internals85.realpathSync(path93.resolve(directory));
|
|
65292
66149
|
} catch {
|
|
65293
66150
|
return {
|
|
65294
66151
|
kind: "capture_failed",
|
|
@@ -65298,13 +66155,13 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65298
66155
|
};
|
|
65299
66156
|
}
|
|
65300
66157
|
try {
|
|
65301
|
-
canonicalParent =
|
|
66158
|
+
canonicalParent = _internals85.realpathSync(path93.dirname(absolute));
|
|
65302
66159
|
} catch (error2) {
|
|
65303
66160
|
if (error2.code === "ENOENT") {
|
|
65304
66161
|
let secondObservation = null;
|
|
65305
66162
|
let secondFailed = false;
|
|
65306
66163
|
try {
|
|
65307
|
-
secondObservation =
|
|
66164
|
+
secondObservation = _internals85.realpathSync(path93.dirname(absolute));
|
|
65308
66165
|
} catch (secondError) {
|
|
65309
66166
|
if (secondError.code !== "ENOENT") {
|
|
65310
66167
|
return {
|
|
@@ -65321,7 +66178,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65321
66178
|
canonicalParent = secondObservation;
|
|
65322
66179
|
} else {
|
|
65323
66180
|
try {
|
|
65324
|
-
|
|
66181
|
+
_internals85.lstat(absolute);
|
|
65325
66182
|
return {
|
|
65326
66183
|
kind: "capture_failed",
|
|
65327
66184
|
file: normalized,
|
|
@@ -65367,7 +66224,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65367
66224
|
}
|
|
65368
66225
|
let before;
|
|
65369
66226
|
try {
|
|
65370
|
-
before =
|
|
66227
|
+
before = _internals85.lstat(absolute);
|
|
65371
66228
|
} catch (error2) {
|
|
65372
66229
|
if (error2.code === "ENOENT") {
|
|
65373
66230
|
return deletedPathIsContained(canonicalRoot, absolute) ? { kind: "captured_deleted", file: normalized } : {
|
|
@@ -65394,7 +66251,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65394
66251
|
};
|
|
65395
66252
|
}
|
|
65396
66253
|
try {
|
|
65397
|
-
const canonicalTarget =
|
|
66254
|
+
const canonicalTarget = _internals85.realpathSync(absolute);
|
|
65398
66255
|
if (!isWithinRoot2(canonicalRoot, canonicalTarget) || path93.dirname(canonicalTarget) !== canonicalParent) {
|
|
65399
66256
|
return {
|
|
65400
66257
|
kind: "capture_failed",
|
|
@@ -65422,7 +66279,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65422
66279
|
const openFlags = fs43.constants.O_RDONLY | (process.platform === "win32" ? 0 : fs43.constants.O_NOFOLLOW);
|
|
65423
66280
|
let beforeBigInt;
|
|
65424
66281
|
try {
|
|
65425
|
-
beforeBigInt =
|
|
66282
|
+
beforeBigInt = _internals85.lstat(absolute, {
|
|
65426
66283
|
bigint: true
|
|
65427
66284
|
});
|
|
65428
66285
|
} catch {
|
|
@@ -65435,7 +66292,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65435
66292
|
}
|
|
65436
66293
|
let fd;
|
|
65437
66294
|
try {
|
|
65438
|
-
fd =
|
|
66295
|
+
fd = _internals85.open(absolute, openFlags);
|
|
65439
66296
|
} catch (error2) {
|
|
65440
66297
|
const code = error2.code;
|
|
65441
66298
|
if (code === "ENOENT" || code === "ELOOP") {
|
|
@@ -65465,7 +66322,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65465
66322
|
};
|
|
65466
66323
|
}
|
|
65467
66324
|
try {
|
|
65468
|
-
const openedBefore =
|
|
66325
|
+
const openedBefore = _internals85.fstat(fd, { bigint: true });
|
|
65469
66326
|
if (!openedBefore.isFile()) {
|
|
65470
66327
|
return {
|
|
65471
66328
|
kind: "capture_failed",
|
|
@@ -65486,7 +66343,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65486
66343
|
const chunk = Buffer.alloc(REVIEWER_SCOPE_CAPTURE_CHUNK_BYTES);
|
|
65487
66344
|
let totalBytes = 0;
|
|
65488
66345
|
for (;; ) {
|
|
65489
|
-
if (options.deadlineAt !== undefined &&
|
|
66346
|
+
if (options.deadlineAt !== undefined && _internals85.now() > options.deadlineAt) {
|
|
65490
66347
|
return {
|
|
65491
66348
|
kind: "capture_failed",
|
|
65492
66349
|
file: normalized,
|
|
@@ -65496,7 +66353,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65496
66353
|
}
|
|
65497
66354
|
let bytesRead;
|
|
65498
66355
|
try {
|
|
65499
|
-
bytesRead =
|
|
66356
|
+
bytesRead = _internals85.read(fd, chunk, 0, chunk.byteLength, null);
|
|
65500
66357
|
} catch (error2) {
|
|
65501
66358
|
const code = error2.code;
|
|
65502
66359
|
return {
|
|
@@ -65512,7 +66369,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65512
66369
|
totalBytes += bytesRead;
|
|
65513
66370
|
hash2.update(bytesRead === chunk.byteLength ? chunk : chunk.subarray(0, bytesRead));
|
|
65514
66371
|
}
|
|
65515
|
-
const openedAfter =
|
|
66372
|
+
const openedAfter = _internals85.fstat(fd, { bigint: true });
|
|
65516
66373
|
if (!sameSnapshot(openedBefore, openedAfter)) {
|
|
65517
66374
|
return {
|
|
65518
66375
|
kind: "capture_failed",
|
|
@@ -65531,7 +66388,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65531
66388
|
}
|
|
65532
66389
|
let pathAfter;
|
|
65533
66390
|
try {
|
|
65534
|
-
pathAfter =
|
|
66391
|
+
pathAfter = _internals85.stat(absolute, { bigint: true });
|
|
65535
66392
|
} catch {
|
|
65536
66393
|
return {
|
|
65537
66394
|
kind: "capture_failed",
|
|
@@ -65550,7 +66407,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65550
66407
|
}
|
|
65551
66408
|
let canonicalAfterRead;
|
|
65552
66409
|
try {
|
|
65553
|
-
canonicalAfterRead =
|
|
66410
|
+
canonicalAfterRead = _internals85.realpathSync(absolute);
|
|
65554
66411
|
} catch {
|
|
65555
66412
|
return {
|
|
65556
66413
|
kind: "capture_failed",
|
|
@@ -65576,7 +66433,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65576
66433
|
} finally {
|
|
65577
66434
|
if (fd !== undefined) {
|
|
65578
66435
|
try {
|
|
65579
|
-
|
|
66436
|
+
_internals85.close(fd);
|
|
65580
66437
|
} catch {}
|
|
65581
66438
|
}
|
|
65582
66439
|
}
|
|
@@ -65608,7 +66465,7 @@ var HEAD_OUTPUT_BYTES = 256;
|
|
|
65608
66465
|
var HEAD_SHA_PATTERN = /^[0-9a-f]{40,64}$/i;
|
|
65609
66466
|
var REVIEWER_TASK_SCOPE_DESCRIPTION = "reviewer-task-files-v2";
|
|
65610
66467
|
var REVIEWER_TASK_SCOPE_HEADER = "opencode-swarm-reviewer-task-scope-v2";
|
|
65611
|
-
var
|
|
66468
|
+
var _internals86 = {
|
|
65612
66469
|
spawn: child_process6.spawn,
|
|
65613
66470
|
realpath: fs44.promises.realpath,
|
|
65614
66471
|
resolveGitExecutable
|
|
@@ -65635,7 +66492,7 @@ async function resolveHeadSha(directory) {
|
|
|
65635
66492
|
let child;
|
|
65636
66493
|
let timeoutHandle;
|
|
65637
66494
|
try {
|
|
65638
|
-
child =
|
|
66495
|
+
child = _internals86.spawn(_internals86.resolveGitExecutable(), ["rev-parse", "--verify", "HEAD"], {
|
|
65639
66496
|
cwd: directory,
|
|
65640
66497
|
stdio: ["ignore", "pipe", "ignore"],
|
|
65641
66498
|
timeout: HEAD_TIMEOUT_MS,
|
|
@@ -65719,7 +66576,7 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
65719
66576
|
let realRoot;
|
|
65720
66577
|
try {
|
|
65721
66578
|
lexicalRoot = path94.resolve(directory);
|
|
65722
|
-
realRoot = await
|
|
66579
|
+
realRoot = await _internals86.realpath(lexicalRoot);
|
|
65723
66580
|
} catch {
|
|
65724
66581
|
return { ok: false, code: "workspace_unresolvable", retryable: false };
|
|
65725
66582
|
}
|
|
@@ -65992,7 +66849,7 @@ function parseReviewerOutput(text, options = {}) {
|
|
|
65992
66849
|
outputMode: "legacy"
|
|
65993
66850
|
};
|
|
65994
66851
|
}
|
|
65995
|
-
var
|
|
66852
|
+
var _internals87 = {
|
|
65996
66853
|
delegationBegin: telemetry.delegationBegin,
|
|
65997
66854
|
delegationEnd: telemetry.delegationEnd,
|
|
65998
66855
|
resolveReviewerTaskScope,
|
|
@@ -66292,7 +67149,7 @@ function scopeFreshnessMismatches(reviewed, current) {
|
|
|
66292
67149
|
}
|
|
66293
67150
|
function createScopeVerifier(input, reviewed, maxBytes) {
|
|
66294
67151
|
return async () => {
|
|
66295
|
-
const current = await
|
|
67152
|
+
const current = await _internals88.collectReviewDiff({
|
|
66296
67153
|
directory: input.directory,
|
|
66297
67154
|
selector: input.selector,
|
|
66298
67155
|
maxBytes
|
|
@@ -66301,7 +67158,7 @@ function createScopeVerifier(input, reviewed, maxBytes) {
|
|
|
66301
67158
|
};
|
|
66302
67159
|
}
|
|
66303
67160
|
async function stalePersistenceResult(input, maxBytes, message, modelCalls) {
|
|
66304
|
-
const current = await
|
|
67161
|
+
const current = await _internals88.collectReviewDiff({
|
|
66305
67162
|
directory: input.directory,
|
|
66306
67163
|
selector: input.selector,
|
|
66307
67164
|
maxBytes
|
|
@@ -66689,7 +67546,7 @@ async function persistErrorResult(input, diff, result, error2, dispatches, promp
|
|
|
66689
67546
|
evidence2.review.error = error2;
|
|
66690
67547
|
addCost(evidence2, dispatches);
|
|
66691
67548
|
try {
|
|
66692
|
-
result.evidencePath = await
|
|
67549
|
+
result.evidencePath = await _internals88.persistEvidence(input.directory, evidence2);
|
|
66693
67550
|
} catch {
|
|
66694
67551
|
if (input.config.final_review.mode === "gate") {
|
|
66695
67552
|
result.blocked = true;
|
|
@@ -66706,7 +67563,7 @@ async function runReviewEngine(input) {
|
|
|
66706
67563
|
const gateMode = input.config.final_review.mode === "gate";
|
|
66707
67564
|
const maxBytes = input.trigger === "task_completion" ? input.config.max_diff_kb * 1024 : input.config.final_review.max_diff_bytes;
|
|
66708
67565
|
const timeoutMs = input.trigger === "task_completion" ? input.config.timeout_ms : input.config.final_review.timeout_ms;
|
|
66709
|
-
const diff = await
|
|
67566
|
+
const diff = await _internals88.collectReviewDiff({
|
|
66710
67567
|
directory: input.directory,
|
|
66711
67568
|
selector: input.selector,
|
|
66712
67569
|
maxBytes
|
|
@@ -66722,7 +67579,7 @@ async function runReviewEngine(input) {
|
|
|
66722
67579
|
evidence3.policy.digest = evidence3.scope.manifest.review_policy_digest;
|
|
66723
67580
|
let evidencePath2;
|
|
66724
67581
|
try {
|
|
66725
|
-
evidencePath2 = await
|
|
67582
|
+
evidencePath2 = await _internals88.persistEvidence(input.directory, evidence3, { verifyCurrent: createScopeVerifier(input, diff, maxBytes) });
|
|
66726
67583
|
} catch (error2) {
|
|
66727
67584
|
if (error2 instanceof ReviewScopeStaleError) {
|
|
66728
67585
|
return stalePersistenceResult(input, maxBytes, "Review scope changed before clean evidence could be committed.", 0);
|
|
@@ -66746,7 +67603,7 @@ async function runReviewEngine(input) {
|
|
|
66746
67603
|
});
|
|
66747
67604
|
const reviewManifest = await materializeAutoReviewManifest(input.directory, diff.manifest, input.config);
|
|
66748
67605
|
if (input.phase !== undefined && (input.trigger === "phase_completion" || input.trigger === "plan_completion")) {
|
|
66749
|
-
const existing =
|
|
67606
|
+
const existing = _internals88.readPhaseEvidence(input.directory, input.phase);
|
|
66750
67607
|
const integrity = existing ? validateAutoReviewEvidenceIntegrity(input.directory, existing, {
|
|
66751
67608
|
scopeHash: diff.scopeHash,
|
|
66752
67609
|
phase: input.phase,
|
|
@@ -66874,7 +67731,7 @@ async function runReviewEngine(input) {
|
|
|
66874
67731
|
validation: byId.get(finding.finding_id)
|
|
66875
67732
|
}));
|
|
66876
67733
|
}
|
|
66877
|
-
const currentScope = await
|
|
67734
|
+
const currentScope = await _internals88.collectReviewDiff({
|
|
66878
67735
|
directory: input.directory,
|
|
66879
67736
|
selector: input.selector,
|
|
66880
67737
|
maxBytes
|
|
@@ -66955,7 +67812,7 @@ async function runReviewEngine(input) {
|
|
|
66955
67812
|
findingValidations: findings.map((finding) => finding.validation).filter((item) => Boolean(item))
|
|
66956
67813
|
});
|
|
66957
67814
|
receiptId = receipt.id;
|
|
66958
|
-
receiptPath = await
|
|
67815
|
+
receiptPath = await _internals88.persistReceipt(input.directory, receipt, {
|
|
66959
67816
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
66960
67817
|
});
|
|
66961
67818
|
evidence2.receipt_path = receiptPath;
|
|
@@ -66985,7 +67842,7 @@ async function runReviewEngine(input) {
|
|
|
66985
67842
|
}
|
|
66986
67843
|
let evidencePath;
|
|
66987
67844
|
try {
|
|
66988
|
-
evidencePath = await
|
|
67845
|
+
evidencePath = await _internals88.persistEvidence(input.directory, evidence2, {
|
|
66989
67846
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
66990
67847
|
});
|
|
66991
67848
|
} catch (error2) {
|
|
@@ -67023,7 +67880,7 @@ async function runReviewEngine(input) {
|
|
|
67023
67880
|
input.injectAdvisory?.(input.sessionID, advisoryMessage(input, result));
|
|
67024
67881
|
return result;
|
|
67025
67882
|
}
|
|
67026
|
-
var
|
|
67883
|
+
var _internals88 = {
|
|
67027
67884
|
collectReviewDiff,
|
|
67028
67885
|
persistEvidence: persistAutoReviewEvidence,
|
|
67029
67886
|
persistReceipt: persistReviewReceipt,
|
|
@@ -67294,7 +68151,7 @@ async function handleReviewCommand(ctx) {
|
|
|
67294
68151
|
} catch (error2) {
|
|
67295
68152
|
return `Review configuration error: ${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
67296
68153
|
}
|
|
67297
|
-
const result = await
|
|
68154
|
+
const result = await _internals89.runReviewEngine({
|
|
67298
68155
|
directory: ctx.directory,
|
|
67299
68156
|
sessionID: ctx.sessionID,
|
|
67300
68157
|
trigger: "manual",
|
|
@@ -67308,10 +68165,10 @@ async function handleReviewCommand(ctx) {
|
|
|
67308
68165
|
validatorModel,
|
|
67309
68166
|
validatorFallbackModels
|
|
67310
68167
|
});
|
|
67311
|
-
const evidence2 =
|
|
68168
|
+
const evidence2 = _internals89.readEvidence(result.evidencePath, ctx.directory);
|
|
67312
68169
|
return parsed.json ? renderJson(result, evidence2, parsed.selector) : renderHuman(result, evidence2, parsed.selector);
|
|
67313
68170
|
}
|
|
67314
|
-
var
|
|
68171
|
+
var _internals89 = {
|
|
67315
68172
|
runReviewEngine,
|
|
67316
68173
|
readEvidence
|
|
67317
68174
|
};
|
|
@@ -67553,7 +68410,7 @@ async function handleRollbackCommand(directory, args) {
|
|
|
67553
68410
|
// src/commands/sdd.ts
|
|
67554
68411
|
import * as fs49 from "fs";
|
|
67555
68412
|
import * as path99 from "path";
|
|
67556
|
-
var
|
|
68413
|
+
var _internals90 = {
|
|
67557
68414
|
writeProjectedSpecSync
|
|
67558
68415
|
};
|
|
67559
68416
|
var SWARM_SPEC_REL = path99.join(".swarm", "spec.md");
|
|
@@ -67953,7 +68810,7 @@ ${USAGE13}`;
|
|
|
67953
68810
|
|
|
67954
68811
|
${USAGE13}`;
|
|
67955
68812
|
}
|
|
67956
|
-
const result2 =
|
|
68813
|
+
const result2 = _internals90.writeProjectedSpecSync(directory, {
|
|
67957
68814
|
source: "speckit",
|
|
67958
68815
|
feature: resolution.feature,
|
|
67959
68816
|
dryRun: parsed.dryRun,
|
|
@@ -68011,7 +68868,7 @@ ${formatList(result2.projection.warnings)}` : ""
|
|
|
68011
68868
|
].join(`
|
|
68012
68869
|
`);
|
|
68013
68870
|
}
|
|
68014
|
-
const result =
|
|
68871
|
+
const result = _internals90.writeProjectedSpecSync(directory, {
|
|
68015
68872
|
changeId: parsed.changeId,
|
|
68016
68873
|
dryRun: parsed.dryRun,
|
|
68017
68874
|
overwrite: parsed.overwrite
|
|
@@ -68238,7 +69095,7 @@ function writeFileFsyncedThenRename(tempPath, targetPath, data) {
|
|
|
68238
69095
|
throw err;
|
|
68239
69096
|
}
|
|
68240
69097
|
}
|
|
68241
|
-
var
|
|
69098
|
+
var _internals91 = {
|
|
68242
69099
|
withEvidenceLock,
|
|
68243
69100
|
writeFileFsyncedThenRename,
|
|
68244
69101
|
writeFileSync: writeFileSyncAsync,
|
|
@@ -68257,7 +69114,7 @@ async function appendEvent2(directory, eventInput) {
|
|
|
68257
69114
|
throw new Error(`invalid candidate id: ${eventInput.candidateId}`);
|
|
68258
69115
|
}
|
|
68259
69116
|
const filePath = ledgerPath(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
68260
|
-
return
|
|
69117
|
+
return _internals91.withEvidenceLock(directory, path100.join(".swarm", "evolution", "skills", eventInput.skillSlug, eventInput.candidateId, "lifecycle.jsonl"), "skill-opt-ledger", "append-skill-opt-event", async () => {
|
|
68261
69118
|
ensureCandidateDir(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
68262
69119
|
const existing = existsSync56(filePath) ? readFileSync42(filePath, "utf8") : "";
|
|
68263
69120
|
const events = parseEventsFromText(existing);
|
|
@@ -68289,8 +69146,8 @@ async function appendEvent2(directory, eventInput) {
|
|
|
68289
69146
|
const validContent = events.map((e) => JSON.stringify(e)).join(`
|
|
68290
69147
|
`) + (events.length > 0 ? `
|
|
68291
69148
|
` : "");
|
|
68292
|
-
|
|
68293
|
-
const verify = parseEventsFromText(
|
|
69149
|
+
_internals91.writeFileFsyncedThenRename(tempPath, filePath, validContent + line);
|
|
69150
|
+
const verify = parseEventsFromText(_internals91.readFileSync(filePath, "utf8"));
|
|
68294
69151
|
const last = verify.length > 0 ? verify[verify.length - 1] : null;
|
|
68295
69152
|
if (!last || last.seq !== event.seq || last.hashAfter !== event.hashAfter) {
|
|
68296
69153
|
throw new Error(`skill-opt ledger append verification failed for candidate ${event.candidateId} seq ${event.seq}`);
|
|
@@ -68394,7 +69251,7 @@ function writeStateProjection(directory, skillSlug, candidateId2, replay) {
|
|
|
68394
69251
|
updatedAt: new Date().toISOString()
|
|
68395
69252
|
};
|
|
68396
69253
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68397
|
-
|
|
69254
|
+
_internals91.writeFileFsyncedThenRename(tempPath, target, `${JSON.stringify(projection, null, 2)}
|
|
68398
69255
|
`);
|
|
68399
69256
|
}
|
|
68400
69257
|
function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
@@ -68402,7 +69259,7 @@ function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
|
68402
69259
|
const dir = ensureCandidateDir(directory, skillSlug, candidateId2);
|
|
68403
69260
|
const target = path100.join(dir, fileName);
|
|
68404
69261
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68405
|
-
|
|
69262
|
+
_internals91.writeFileFsyncedThenRename(tempPath, target, content);
|
|
68406
69263
|
return target;
|
|
68407
69264
|
}
|
|
68408
69265
|
function readArtifact(directory, skillSlug, candidateId2, fileName) {
|
|
@@ -68495,16 +69352,16 @@ function currentCandidateState(directory, skillSlug, candidateId2) {
|
|
|
68495
69352
|
function writeSkillFileAtomic(targetPath, content) {
|
|
68496
69353
|
const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68497
69354
|
try {
|
|
68498
|
-
|
|
68499
|
-
|
|
69355
|
+
_internals92.writeFileSync(tempPath, content, "utf8");
|
|
69356
|
+
_internals92.renameSync(tempPath, targetPath);
|
|
68500
69357
|
} finally {
|
|
68501
69358
|
try {
|
|
68502
69359
|
if (existsSync57(tempPath))
|
|
68503
|
-
|
|
69360
|
+
_internals92.unlinkSync(tempPath);
|
|
68504
69361
|
} catch {}
|
|
68505
69362
|
}
|
|
68506
69363
|
}
|
|
68507
|
-
var
|
|
69364
|
+
var _internals92 = {
|
|
68508
69365
|
writeFileSync: writeFileSync18,
|
|
68509
69366
|
renameSync: renameSync16,
|
|
68510
69367
|
unlinkSync: unlinkSync21
|
|
@@ -68961,7 +69818,7 @@ function buildGeneratorInputs(args) {
|
|
|
68961
69818
|
}
|
|
68962
69819
|
};
|
|
68963
69820
|
}
|
|
68964
|
-
var
|
|
69821
|
+
var _internals93 = {
|
|
68965
69822
|
draftDeterministic: defaultDeterministicDraft
|
|
68966
69823
|
};
|
|
68967
69824
|
function defaultDeterministicDraft(inputs) {
|
|
@@ -69031,7 +69888,7 @@ function countChangedLines(a, b) {
|
|
|
69031
69888
|
return changed;
|
|
69032
69889
|
}
|
|
69033
69890
|
function draftCandidate(inputs) {
|
|
69034
|
-
const candidate2 =
|
|
69891
|
+
const candidate2 = _internals93.draftDeterministic(inputs);
|
|
69035
69892
|
enforceTrustRegion(candidate2, inputs.budget);
|
|
69036
69893
|
return candidate2;
|
|
69037
69894
|
}
|
|
@@ -69074,7 +69931,7 @@ import * as path103 from "path";
|
|
|
69074
69931
|
// src/hooks/spawn-helper.ts
|
|
69075
69932
|
import * as child_process7 from "child_process";
|
|
69076
69933
|
var WIN32_CMD_BINARIES = new Set(["npm", "npx", "pnpm", "yarn"]);
|
|
69077
|
-
var
|
|
69934
|
+
var _internals94 = {
|
|
69078
69935
|
spawn: child_process7.spawn
|
|
69079
69936
|
};
|
|
69080
69937
|
function spawnAsync(command, cwd, timeoutMs) {
|
|
@@ -69082,7 +69939,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
69082
69939
|
try {
|
|
69083
69940
|
const [rawCmd, ...args] = command;
|
|
69084
69941
|
const cmd = process.platform === "win32" && WIN32_CMD_BINARIES.has(rawCmd) && !rawCmd.includes(".") ? `${rawCmd}.cmd` : rawCmd;
|
|
69085
|
-
const proc =
|
|
69942
|
+
const proc = _internals94.spawn(cmd, args, {
|
|
69086
69943
|
cwd,
|
|
69087
69944
|
stdio: ["ignore", "pipe", "pipe"]
|
|
69088
69945
|
});
|
|
@@ -69148,7 +70005,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
69148
70005
|
}
|
|
69149
70006
|
|
|
69150
70007
|
// src/services/skill-optimizer/smoke.ts
|
|
69151
|
-
var
|
|
70008
|
+
var _internals95 = {
|
|
69152
70009
|
validateSkillPath,
|
|
69153
70010
|
isSymbolicLink: (p) => {
|
|
69154
70011
|
try {
|
|
@@ -69169,7 +70026,7 @@ var _internals94 = {
|
|
|
69169
70026
|
async function validateSkillSmoke(input) {
|
|
69170
70027
|
const notes = [];
|
|
69171
70028
|
const repoRel = path103.join(".opencode", "skills", "generated", input.skillSlug, "SKILL.md");
|
|
69172
|
-
if (!
|
|
70029
|
+
if (!_internals95.validateSkillPath(repoRel)) {
|
|
69173
70030
|
return {
|
|
69174
70031
|
ok: false,
|
|
69175
70032
|
verdict: "VIOLATED",
|
|
@@ -69178,16 +70035,16 @@ async function validateSkillSmoke(input) {
|
|
|
69178
70035
|
}
|
|
69179
70036
|
const skillRoot = path103.join(input.directory, ".opencode", "skills", "generated", input.skillSlug);
|
|
69180
70037
|
if (existsSync58(skillRoot)) {
|
|
69181
|
-
if (
|
|
70038
|
+
if (_internals95.isSymbolicLink(skillRoot)) {
|
|
69182
70039
|
return {
|
|
69183
70040
|
ok: false,
|
|
69184
70041
|
verdict: "VIOLATED",
|
|
69185
70042
|
notes: ["skill root is a symlink (reparse denied)"]
|
|
69186
70043
|
};
|
|
69187
70044
|
}
|
|
69188
|
-
const realRoot =
|
|
69189
|
-
const realProjectDir =
|
|
69190
|
-
if (
|
|
70045
|
+
const realRoot = _internals95.realpath(skillRoot);
|
|
70046
|
+
const realProjectDir = _internals95.realpath(input.directory);
|
|
70047
|
+
if (_internals95.escapedRoot(realProjectDir, realRoot)) {
|
|
69191
70048
|
return {
|
|
69192
70049
|
ok: false,
|
|
69193
70050
|
verdict: "VIOLATED",
|
|
@@ -69205,7 +70062,7 @@ async function validateSkillSmoke(input) {
|
|
|
69205
70062
|
notes: [`frontmatter: ${fmError}`]
|
|
69206
70063
|
};
|
|
69207
70064
|
}
|
|
69208
|
-
const rejected = await
|
|
70065
|
+
const rejected = await _internals95.isRejectedSkillContent(input.directory, input.skillSlug, input.candidateContent);
|
|
69209
70066
|
if (rejected) {
|
|
69210
70067
|
return {
|
|
69211
70068
|
ok: false,
|
|
@@ -69215,7 +70072,7 @@ async function validateSkillSmoke(input) {
|
|
|
69215
70072
|
]
|
|
69216
70073
|
};
|
|
69217
70074
|
}
|
|
69218
|
-
const evalResult = await
|
|
70075
|
+
const evalResult = await _internals95.evaluateSkillChange({
|
|
69219
70076
|
directory: input.directory,
|
|
69220
70077
|
slug: input.skillSlug,
|
|
69221
70078
|
candidateContent: input.candidateContent,
|
|
@@ -69234,7 +70091,7 @@ async function validateSkillSmoke(input) {
|
|
|
69234
70091
|
notes.push(`phrase-eval passed (score ${evalResult.candidateScore.toFixed(2)})`);
|
|
69235
70092
|
}
|
|
69236
70093
|
if (input.checkCommand && input.checkCommand.length > 0) {
|
|
69237
|
-
const cmdResult = await
|
|
70094
|
+
const cmdResult = await _internals95.spawnAsync(input.checkCommand, input.directory, input.checkTimeoutMs ?? 60000);
|
|
69238
70095
|
if (!cmdResult || cmdResult.exitCode !== 0) {
|
|
69239
70096
|
return {
|
|
69240
70097
|
ok: false,
|
|
@@ -69304,7 +70161,7 @@ async function prepareCandidatePayloads(inputRoot, candidateId2, skillSlug, base
|
|
|
69304
70161
|
candidate2.contentHash = await computeCandidateInputContentHash2(inputRoot, candidate2);
|
|
69305
70162
|
return { baseline, candidate: candidate2 };
|
|
69306
70163
|
}
|
|
69307
|
-
var
|
|
70164
|
+
var _internals96 = {
|
|
69308
70165
|
tryAcquireLock,
|
|
69309
70166
|
emitTelemetry: emit,
|
|
69310
70167
|
evaluateCandidateV1,
|
|
@@ -69312,7 +70169,7 @@ var _internals95 = {
|
|
|
69312
70169
|
};
|
|
69313
70170
|
async function acquireProjectLock(directory) {
|
|
69314
70171
|
assertProjectRoot(directory);
|
|
69315
|
-
const result = await
|
|
70172
|
+
const result = await _internals96.tryAcquireLock(directory, PROJECT_LOCK_PATH, "skill-opt-controller", "project-run");
|
|
69316
70173
|
if (!result.acquired)
|
|
69317
70174
|
return null;
|
|
69318
70175
|
return async () => {
|
|
@@ -69326,7 +70183,7 @@ async function acquireProjectLock(directory) {
|
|
|
69326
70183
|
async function acquireSkillLock(directory, skillSlug) {
|
|
69327
70184
|
assertProjectRoot(directory);
|
|
69328
70185
|
const lockPath = path104.join(".swarm", "evolution", "skills", skillSlug, ".skill.lock");
|
|
69329
|
-
const result = await
|
|
70186
|
+
const result = await _internals96.tryAcquireLock(directory, lockPath, "skill-opt-controller", `skill-${skillSlug}`);
|
|
69330
70187
|
if (!result.acquired)
|
|
69331
70188
|
return null;
|
|
69332
70189
|
return async () => {
|
|
@@ -69523,13 +70380,13 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
69523
70380
|
while (true) {
|
|
69524
70381
|
try {
|
|
69525
70382
|
const evalInputRoot = input.inputRoot ?? input.directory;
|
|
69526
|
-
const { baseline, candidate: candidate2 } = await
|
|
70383
|
+
const { baseline, candidate: candidate2 } = await _internals96.prepareCandidatePayloads(evalInputRoot, candidateId2, input.skillSlug, input.baselineModel, input.candidateModel, baselineContent, candidateContent);
|
|
69527
70384
|
if (!input.dispatcher) {
|
|
69528
70385
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
69529
70386
|
}
|
|
69530
70387
|
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-1aygs98c.js");
|
|
69531
70388
|
const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
|
|
69532
|
-
const result = await
|
|
70389
|
+
const result = await _internals96.evaluateCandidateV1({
|
|
69533
70390
|
projectRoot: input.directory,
|
|
69534
70391
|
inputRoot: input.inputRoot ?? input.directory,
|
|
69535
70392
|
tasks: input.validationTasks,
|
|
@@ -69587,7 +70444,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
69587
70444
|
deadband: input.config.deadband
|
|
69588
70445
|
};
|
|
69589
70446
|
}
|
|
69590
|
-
|
|
70447
|
+
_internals96.emitTelemetry?.("loop_detected", {
|
|
69591
70448
|
skillSlug: input.skillSlug,
|
|
69592
70449
|
reason: message.slice(0, 160),
|
|
69593
70450
|
source: "skill-opt-controller"
|
|
@@ -70436,7 +71293,7 @@ function getCompactionMetrics(sessionId) {
|
|
|
70436
71293
|
}
|
|
70437
71294
|
|
|
70438
71295
|
// src/services/status-service.ts
|
|
70439
|
-
var
|
|
71296
|
+
var _internals97 = {
|
|
70440
71297
|
loadLeanTurboRunState,
|
|
70441
71298
|
hasActiveLeanTurbo,
|
|
70442
71299
|
hasActiveFullAuto,
|
|
@@ -70710,11 +71567,11 @@ async function getStatusData(directory, agents, sessionId, options) {
|
|
|
70710
71567
|
} catch {
|
|
70711
71568
|
status.memoryCohort = { linked: false };
|
|
70712
71569
|
}
|
|
70713
|
-
status.fullAutoActive =
|
|
71570
|
+
status.fullAutoActive = _internals97.hasActiveFullAuto();
|
|
70714
71571
|
if (status.fullAutoActive) {
|
|
70715
|
-
const sid =
|
|
71572
|
+
const sid = _internals97.getActiveFullAutoSessionID();
|
|
70716
71573
|
if (sid) {
|
|
70717
|
-
const runState =
|
|
71574
|
+
const runState = _internals97.loadFullAutoRunState(directory, sid);
|
|
70718
71575
|
if (runState?.lastEscalation) {
|
|
70719
71576
|
status.fullAutoEscalation = {
|
|
70720
71577
|
reason: runState.lastEscalation.reason,
|
|
@@ -70748,7 +71605,7 @@ async function getStatusData(directory, agents, sessionId, options) {
|
|
|
70748
71605
|
}
|
|
70749
71606
|
function enrichWithLeanTurbo(status, directory) {
|
|
70750
71607
|
const turboMode = hasActiveTurboMode();
|
|
70751
|
-
const leanActive =
|
|
71608
|
+
const leanActive = _internals97.hasActiveLeanTurbo();
|
|
70752
71609
|
let turboStrategy = "off";
|
|
70753
71610
|
if (leanActive) {
|
|
70754
71611
|
turboStrategy = "lean";
|
|
@@ -70779,7 +71636,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
70779
71636
|
}
|
|
70780
71637
|
}
|
|
70781
71638
|
if (leanSessionID) {
|
|
70782
|
-
const runState =
|
|
71639
|
+
const runState = _internals97.loadLeanTurboRunState(directory, leanSessionID);
|
|
70783
71640
|
if (runState) {
|
|
70784
71641
|
status.leanTurboPhase = runState.phase;
|
|
70785
71642
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -71139,7 +71996,7 @@ init_logger();
|
|
|
71139
71996
|
var TURBO_BYPASS_DISCLOSURE = "Bypassed: Stage B (reviewer + test_engineer) for Tier 0-2 tasks; phase_complete Gates 1-5 " + "(completion-verify, drift-verifier, hallucination-guard, mutation-gate, phase-council). " + "Still enforced: Stage A (lint, imports, pre_check_batch); Tier 3 Stage B; Gate 5b " + "(architecture-supervisor); Gate 6 (final-council); Gate 7 (full-auto).";
|
|
71140
71997
|
|
|
71141
71998
|
// src/commands/turbo.ts
|
|
71142
|
-
var
|
|
71999
|
+
var _internals98 = {
|
|
71143
72000
|
loadPluginConfigWithMeta
|
|
71144
72001
|
};
|
|
71145
72002
|
async function handleTurboCommand(directory, args, sessionID) {
|
|
@@ -71199,7 +72056,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
71199
72056
|
if (arg0 === "on") {
|
|
71200
72057
|
let strategy = "standard";
|
|
71201
72058
|
try {
|
|
71202
|
-
const { config } =
|
|
72059
|
+
const { config } = _internals98.loadPluginConfigWithMeta(directory);
|
|
71203
72060
|
if (config.turbo?.strategy === "lean") {
|
|
71204
72061
|
strategy = "lean";
|
|
71205
72062
|
}
|
|
@@ -71296,7 +72153,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
71296
72153
|
let maxParallelCoders = 4;
|
|
71297
72154
|
let conflictPolicy = "serialize";
|
|
71298
72155
|
try {
|
|
71299
|
-
const { config } =
|
|
72156
|
+
const { config } = _internals98.loadPluginConfigWithMeta(directory);
|
|
71300
72157
|
const leanConfig = config.turbo?.lean;
|
|
71301
72158
|
if (leanConfig) {
|
|
71302
72159
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -71504,7 +72361,7 @@ function findSimilarCommands(query) {
|
|
|
71504
72361
|
}
|
|
71505
72362
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
71506
72363
|
const cmdLower = cmd.toLowerCase();
|
|
71507
|
-
const fullScore =
|
|
72364
|
+
const fullScore = _internals99.levenshteinDistance(q, cmdLower);
|
|
71508
72365
|
let tokenScore = Infinity;
|
|
71509
72366
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
71510
72367
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -71517,7 +72374,7 @@ function findSimilarCommands(query) {
|
|
|
71517
72374
|
for (const ct of cmdTokens) {
|
|
71518
72375
|
if (ct.length === 0)
|
|
71519
72376
|
continue;
|
|
71520
|
-
const dist =
|
|
72377
|
+
const dist = _internals99.levenshteinDistance(qt, ct);
|
|
71521
72378
|
if (dist < minDist)
|
|
71522
72379
|
minDist = dist;
|
|
71523
72380
|
}
|
|
@@ -71527,7 +72384,7 @@ function findSimilarCommands(query) {
|
|
|
71527
72384
|
}
|
|
71528
72385
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
71529
72386
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
71530
|
-
const dashScore =
|
|
72387
|
+
const dashScore = _internals99.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
71531
72388
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
71532
72389
|
return { cmd, score };
|
|
71533
72390
|
});
|
|
@@ -71562,16 +72419,16 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
71562
72419
|
async function handleHelpCommand(ctx) {
|
|
71563
72420
|
const targetCommand = ctx.args.join(" ");
|
|
71564
72421
|
if (!targetCommand) {
|
|
71565
|
-
const { buildHelpText } = await import("./index-
|
|
72422
|
+
const { buildHelpText } = await import("./index-8cn6545x.js");
|
|
71566
72423
|
return buildHelpText();
|
|
71567
72424
|
}
|
|
71568
72425
|
const tokens = targetCommand.split(/\s+/);
|
|
71569
|
-
const resolved =
|
|
72426
|
+
const resolved = _internals99.resolveCommand(tokens);
|
|
71570
72427
|
if (resolved) {
|
|
71571
|
-
return
|
|
72428
|
+
return _internals99.buildDetailedHelp(resolved.key, resolved.entry);
|
|
71572
72429
|
}
|
|
71573
|
-
const similar =
|
|
71574
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
72430
|
+
const similar = _internals99.findSimilarCommands(targetCommand);
|
|
72431
|
+
const { buildHelpText: fullHelp } = await import("./index-8cn6545x.js");
|
|
71575
72432
|
if (similar.length > 0) {
|
|
71576
72433
|
return `Command '/swarm ${targetCommand}' not found.
|
|
71577
72434
|
|
|
@@ -71682,7 +72539,7 @@ var COMMAND_REGISTRY = {
|
|
|
71682
72539
|
toolNoArgs: true
|
|
71683
72540
|
},
|
|
71684
72541
|
help: {
|
|
71685
|
-
handler: (ctx) =>
|
|
72542
|
+
handler: (ctx) => _internals99.handleHelpCommand(ctx),
|
|
71686
72543
|
description: "Show help for swarm commands",
|
|
71687
72544
|
category: "core",
|
|
71688
72545
|
args: "[command]",
|
|
@@ -71751,7 +72608,7 @@ var COMMAND_REGISTRY = {
|
|
|
71751
72608
|
},
|
|
71752
72609
|
"guardrail explain": {
|
|
71753
72610
|
handler: async (ctx) => {
|
|
71754
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
72611
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-1zbk21fq.js");
|
|
71755
72612
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
71756
72613
|
},
|
|
71757
72614
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -71761,7 +72618,7 @@ var COMMAND_REGISTRY = {
|
|
|
71761
72618
|
},
|
|
71762
72619
|
"guardrail reset": {
|
|
71763
72620
|
handler: async (ctx) => {
|
|
71764
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
72621
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-wb3ba243.js");
|
|
71765
72622
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
71766
72623
|
},
|
|
71767
72624
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -71770,7 +72627,7 @@ var COMMAND_REGISTRY = {
|
|
|
71770
72627
|
},
|
|
71771
72628
|
"guardrail-explain": {
|
|
71772
72629
|
handler: async (ctx) => {
|
|
71773
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
72630
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-1zbk21fq.js");
|
|
71774
72631
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
71775
72632
|
},
|
|
71776
72633
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -71780,7 +72637,7 @@ var COMMAND_REGISTRY = {
|
|
|
71780
72637
|
},
|
|
71781
72638
|
"guardrail-reset": {
|
|
71782
72639
|
handler: async (ctx) => {
|
|
71783
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
72640
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-wb3ba243.js");
|
|
71784
72641
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
71785
72642
|
},
|
|
71786
72643
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -71790,7 +72647,7 @@ var COMMAND_REGISTRY = {
|
|
|
71790
72647
|
},
|
|
71791
72648
|
"guardrail-log": {
|
|
71792
72649
|
handler: async (ctx) => {
|
|
71793
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
72650
|
+
const { handleGuardrailLog } = await import("./guardrail-log-d20jewtr.js");
|
|
71794
72651
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
71795
72652
|
},
|
|
71796
72653
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -72796,7 +73653,7 @@ function validateToolPolicy() {
|
|
|
72796
73653
|
}
|
|
72797
73654
|
return { valid: warnings.length === 0, warnings };
|
|
72798
73655
|
}
|
|
72799
|
-
var
|
|
73656
|
+
var _internals99 = {
|
|
72800
73657
|
handleHelpCommand,
|
|
72801
73658
|
validateAliases,
|
|
72802
73659
|
validateToolPolicy,
|
|
@@ -72806,16 +73663,16 @@ var _internals98 = {
|
|
|
72806
73663
|
findSimilarCommands,
|
|
72807
73664
|
buildDetailedHelp
|
|
72808
73665
|
};
|
|
72809
|
-
var validation =
|
|
73666
|
+
var validation = _internals99.validateAliases();
|
|
72810
73667
|
if (!validation.valid) {
|
|
72811
73668
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
72812
73669
|
${validation.errors.join(`
|
|
72813
73670
|
`)}`);
|
|
72814
73671
|
}
|
|
72815
|
-
|
|
73672
|
+
_internals99.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
|
|
72816
73673
|
try {
|
|
72817
|
-
const toolPolicyValidation =
|
|
72818
|
-
|
|
73674
|
+
const toolPolicyValidation = _internals99.validateToolPolicy();
|
|
73675
|
+
_internals99.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
|
|
72819
73676
|
} catch (e) {
|
|
72820
73677
|
warn(`COMMAND_REGISTRY toolPolicy validation failed (non-fatal): ${e.message}`);
|
|
72821
73678
|
}
|
|
@@ -75196,7 +76053,7 @@ function formatCommandNotFound(tokens) {
|
|
|
75196
76053
|
const attemptedCommand = tokens[0] || "";
|
|
75197
76054
|
const MAX_DISPLAY = 100;
|
|
75198
76055
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
75199
|
-
const similar =
|
|
76056
|
+
const similar = _internals99.findSimilarCommands(attemptedCommand);
|
|
75200
76057
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
75201
76058
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
75202
76059
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -78529,8 +79386,8 @@ var WORKTREE_LIST_TIMEOUT_MS = 15000;
|
|
|
78529
79386
|
async function preProvisionCollisionCheck(taskId, directory, _sessionId) {
|
|
78530
79387
|
let proc;
|
|
78531
79388
|
try {
|
|
78532
|
-
proc =
|
|
78533
|
-
|
|
79389
|
+
proc = _internals101.bunSpawn([
|
|
79390
|
+
_internals101.resolveGitExecutable(),
|
|
78534
79391
|
"-C",
|
|
78535
79392
|
directory,
|
|
78536
79393
|
"worktree",
|
|
@@ -78659,12 +79516,12 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78659
79516
|
return;
|
|
78660
79517
|
}
|
|
78661
79518
|
const laneIndex = allocateStandardLaneIndex(args.parentSessionID);
|
|
78662
|
-
const lifecycleLock = await
|
|
79519
|
+
const lifecycleLock = await _internals101.tryAcquireWorktreeLifecycleLock(args.directory, WORKTREE_LIFECYCLE_LOCK_FILE, "worktree-provisioning", args.taskId);
|
|
78663
79520
|
if (!lifecycleLock.acquired) {
|
|
78664
79521
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, "STANDARD_WORKTREE_LIFECYCLE_BUSY: init orphan recovery is active; retry this coder dispatch after recovery completes.");
|
|
78665
79522
|
}
|
|
78666
79523
|
try {
|
|
78667
|
-
const collision = await
|
|
79524
|
+
const collision = await _internals101.preProvisionCollisionCheck(args.taskId, args.directory, args.parentSessionID);
|
|
78668
79525
|
if (collision.uncertainty) {
|
|
78669
79526
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_SCAN_UNCERTAIN: ${collision.uncertainty}. Destructive cleanup and provisioning were blocked.`);
|
|
78670
79527
|
}
|
|
@@ -78673,17 +79530,17 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78673
79530
|
const ownerInfo = collision.ownerSessionId ? ` owned by session ${collision.ownerSessionId}` : " with uncertain ownership";
|
|
78674
79531
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION: task ${args.taskId} already has a lane on branch ${collision.existingBranch ?? "unknown"}${ownerInfo}; cleanup and provisioning were blocked.`);
|
|
78675
79532
|
}
|
|
78676
|
-
for (const dispatch of
|
|
79533
|
+
for (const dispatch of _internals101.standardWorktreeByCallID.values()) {
|
|
78677
79534
|
if (dispatch.handle.branchName === collision.existingBranch) {
|
|
78678
79535
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION_ACTIVE: branch ${collision.existingBranch} is still tracked by an active standard-worktree dispatch.`);
|
|
78679
79536
|
}
|
|
78680
79537
|
}
|
|
78681
|
-
for (const record of
|
|
79538
|
+
for (const record of _internals101.awaitingMergeByCallID.values()) {
|
|
78682
79539
|
if (record.branch === collision.existingBranch) {
|
|
78683
79540
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION_AWAITING_MERGE: branch ${collision.existingBranch} is still awaiting merge-back.`);
|
|
78684
79541
|
}
|
|
78685
79542
|
}
|
|
78686
|
-
const ownership = await
|
|
79543
|
+
const ownership = await _internals101.inspectStandardWorktreeCollisionOwnership({
|
|
78687
79544
|
directory: args.directory,
|
|
78688
79545
|
parentSessionId: args.parentSessionID,
|
|
78689
79546
|
taskId: args.taskId,
|
|
@@ -78708,30 +79565,30 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78708
79565
|
}
|
|
78709
79566
|
}
|
|
78710
79567
|
if (collisionPathExists) {
|
|
78711
|
-
const preserveResult = await
|
|
79568
|
+
const preserveResult = await _internals101.preserveDirtyWorktreeAtPath(collision.worktreePath, collision.existingBranch, "denied", args.directory, worktreeConfig.worktree_dir);
|
|
78712
79569
|
if (preserveResult.outcome === "preserve-failed") {
|
|
78713
79570
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_PRESERVATION_FAILED_ABORT_CLEANUP: pre-provision collision for task ${args.taskId} could not be preserved (${preserveResult.error}). Cleanup and provisioning were blocked.`);
|
|
78714
79571
|
}
|
|
78715
|
-
const removeResult = await
|
|
79572
|
+
const removeResult = await _internals101.removeWorktree(collision.worktreePath, args.directory, { force: true, worktreeDir: worktreeConfig.worktree_dir });
|
|
78716
79573
|
if ("error" in removeResult) {
|
|
78717
79574
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_REMOVE_FAILED: ${removeResult.error}. Provisioning was blocked.`);
|
|
78718
79575
|
}
|
|
78719
|
-
const cleanupResult = await
|
|
79576
|
+
const cleanupResult = await _internals101.postMergeCleanup(args.directory, collision.existingBranch);
|
|
78720
79577
|
if ("error" in cleanupResult) {
|
|
78721
79578
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_BRANCH_CLEANUP_FAILED: ${cleanupResult.error}. Provisioning was blocked.`);
|
|
78722
79579
|
}
|
|
78723
79580
|
} else {
|
|
78724
|
-
const pruneResult = await
|
|
79581
|
+
const pruneResult = await _internals101.pruneStaleWorktreeMetadata(args.directory);
|
|
78725
79582
|
if ("error" in pruneResult) {
|
|
78726
79583
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_PRUNE_FAILED: ${pruneResult.error}. Provisioning was blocked without deleting the lane branch.`);
|
|
78727
79584
|
}
|
|
78728
79585
|
}
|
|
78729
|
-
const verification = await
|
|
79586
|
+
const verification = await _internals101.preProvisionCollisionCheck(args.taskId, args.directory, args.parentSessionID);
|
|
78730
79587
|
if (verification.uncertainty || verification.collision) {
|
|
78731
79588
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_CLEANUP_UNVERIFIED: ${verification.uncertainty ?? "git still reports the colliding lane after cleanup"}. Provisioning was blocked.`);
|
|
78732
79589
|
}
|
|
78733
79590
|
}
|
|
78734
|
-
|
|
79591
|
+
_internals101.recordWorktreeProvisioningOwner(args.directory, {
|
|
78735
79592
|
callID: args.callID,
|
|
78736
79593
|
parentSessionId: args.parentSessionID,
|
|
78737
79594
|
worktreeSessionId: args.parentSessionID,
|
|
@@ -78749,7 +79606,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78749
79606
|
}
|
|
78750
79607
|
let provisionResult;
|
|
78751
79608
|
try {
|
|
78752
|
-
provisionResult = await
|
|
79609
|
+
provisionResult = await _internals101.provisionWorktree(args.directory, args.taskId, args.parentSessionID, {
|
|
78753
79610
|
purpose: "lane",
|
|
78754
79611
|
worktreeDir: worktreeConfig.worktree_dir,
|
|
78755
79612
|
mergeStrategy: worktreeConfig.merge_strategy,
|
|
@@ -78757,11 +79614,11 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78757
79614
|
scope: args.scope
|
|
78758
79615
|
});
|
|
78759
79616
|
} catch (error2) {
|
|
78760
|
-
|
|
79617
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78761
79618
|
throw error2;
|
|
78762
79619
|
}
|
|
78763
79620
|
if ("error" in provisionResult) {
|
|
78764
|
-
|
|
79621
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78765
79622
|
const message = `STANDARD_WORKTREE_PROVISION_FAILED: ${provisionResult.error}.`;
|
|
78766
79623
|
handleStandardWorktreeFailure(args.parentSessionID, worktreeConfig.policy, message);
|
|
78767
79624
|
return;
|
|
@@ -78780,7 +79637,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78780
79637
|
const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
|
|
78781
79638
|
if (laneProfile) {
|
|
78782
79639
|
try {
|
|
78783
|
-
const { writeLaneProfileToDiskReal } = await import("./core-
|
|
79640
|
+
const { writeLaneProfileToDiskReal } = await import("./core-xx0x5tfv.js");
|
|
78784
79641
|
await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
|
|
78785
79642
|
} catch {}
|
|
78786
79643
|
}
|
|
@@ -78801,13 +79658,13 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78801
79658
|
query: { directory: provisionResult.worktreePath }
|
|
78802
79659
|
});
|
|
78803
79660
|
if (!createResult.data?.id) {
|
|
78804
|
-
await
|
|
79661
|
+
await _internals101.removeWorktree(provisionResult.worktreePath, args.directory, {
|
|
78805
79662
|
force: true,
|
|
78806
79663
|
worktreeDir: worktreeConfig.worktree_dir
|
|
78807
79664
|
}).catch((cleanupError) => {
|
|
78808
79665
|
log(`[worktree-isolation] session-create failure cleanup could not remove lane ${provisionResult.worktreePath}: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
78809
79666
|
});
|
|
78810
|
-
|
|
79667
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78811
79668
|
const createError = createResult.error;
|
|
78812
79669
|
const detail = typeof createError === "string" ? createError : JSON.stringify(createError ?? "missing session id");
|
|
78813
79670
|
const message = `STANDARD_WORKTREE_SESSION_CREATE_FAILED: ${detail}.`;
|
|
@@ -78835,8 +79692,8 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
|
|
|
78835
79692
|
return { outcome: "not-found" };
|
|
78836
79693
|
let refProc;
|
|
78837
79694
|
try {
|
|
78838
|
-
refProc =
|
|
78839
|
-
|
|
79695
|
+
refProc = _internals101.bunSpawn([
|
|
79696
|
+
_internals101.resolveGitExecutable(),
|
|
78840
79697
|
"-C",
|
|
78841
79698
|
dispatch.handle.worktreePath,
|
|
78842
79699
|
"rev-parse",
|
|
@@ -78880,8 +79737,8 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
|
|
|
78880
79737
|
const tag = `swarm-preserved-owner/${session}/${lane}/${callDigest}`;
|
|
78881
79738
|
let tagProc;
|
|
78882
79739
|
try {
|
|
78883
|
-
tagProc =
|
|
78884
|
-
|
|
79740
|
+
tagProc = _internals101.bunSpawn([
|
|
79741
|
+
_internals101.resolveGitExecutable(),
|
|
78885
79742
|
"-C",
|
|
78886
79743
|
dispatch.handle.worktreePath,
|
|
78887
79744
|
"tag",
|
|
@@ -78931,8 +79788,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78931
79788
|
}
|
|
78932
79789
|
let statusProc;
|
|
78933
79790
|
try {
|
|
78934
|
-
statusProc =
|
|
78935
|
-
|
|
79791
|
+
statusProc = _internals101.bunSpawn([
|
|
79792
|
+
_internals101.resolveGitExecutable(),
|
|
78936
79793
|
"-C",
|
|
78937
79794
|
worktreePath,
|
|
78938
79795
|
"status",
|
|
@@ -78974,7 +79831,7 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78974
79831
|
}
|
|
78975
79832
|
let addProc;
|
|
78976
79833
|
try {
|
|
78977
|
-
addProc =
|
|
79834
|
+
addProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "add", "-A"], {
|
|
78978
79835
|
stdin: "ignore",
|
|
78979
79836
|
stdout: "pipe",
|
|
78980
79837
|
stderr: "pipe",
|
|
@@ -79008,8 +79865,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79008
79865
|
const commitMessage = `swarm-preserved: ${reason} for callID ${sanitizedCallID} at ${isoDate}`;
|
|
79009
79866
|
let commitProc;
|
|
79010
79867
|
try {
|
|
79011
|
-
commitProc =
|
|
79012
|
-
|
|
79868
|
+
commitProc = _internals101.bunSpawn([
|
|
79869
|
+
_internals101.resolveGitExecutable(),
|
|
79013
79870
|
"-C",
|
|
79014
79871
|
worktreePath,
|
|
79015
79872
|
"commit",
|
|
@@ -79047,8 +79904,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79047
79904
|
}
|
|
79048
79905
|
let hashProc;
|
|
79049
79906
|
try {
|
|
79050
|
-
hashProc =
|
|
79051
|
-
|
|
79907
|
+
hashProc = _internals101.bunSpawn([
|
|
79908
|
+
_internals101.resolveGitExecutable(),
|
|
79052
79909
|
"-C",
|
|
79053
79910
|
worktreePath,
|
|
79054
79911
|
"rev-parse",
|
|
@@ -79094,7 +79951,7 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79094
79951
|
const tagName = `swarm-preserved-${sanitizedCallID}-${shortHash}`;
|
|
79095
79952
|
let tagProc;
|
|
79096
79953
|
try {
|
|
79097
|
-
tagProc =
|
|
79954
|
+
tagProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "tag", tagName], {
|
|
79098
79955
|
stdin: "ignore",
|
|
79099
79956
|
stdout: "pipe",
|
|
79100
79957
|
stderr: "pipe",
|
|
@@ -79130,8 +79987,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79130
79987
|
async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _directory, _worktree_dir) {
|
|
79131
79988
|
let statusProc;
|
|
79132
79989
|
try {
|
|
79133
|
-
statusProc =
|
|
79134
|
-
|
|
79990
|
+
statusProc = _internals101.bunSpawn([
|
|
79991
|
+
_internals101.resolveGitExecutable(),
|
|
79135
79992
|
"-C",
|
|
79136
79993
|
worktreePath,
|
|
79137
79994
|
"status",
|
|
@@ -79173,7 +80030,7 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79173
80030
|
}
|
|
79174
80031
|
let addProc;
|
|
79175
80032
|
try {
|
|
79176
|
-
addProc =
|
|
80033
|
+
addProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "add", "-A"], {
|
|
79177
80034
|
stdin: "ignore",
|
|
79178
80035
|
stdout: "pipe",
|
|
79179
80036
|
stderr: "pipe",
|
|
@@ -79208,8 +80065,8 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79208
80065
|
const commitMessage = `swarm-preserved: ${reason} for worktree ${sanitizedPath} at ${isoDate}`;
|
|
79209
80066
|
let commitProc;
|
|
79210
80067
|
try {
|
|
79211
|
-
commitProc =
|
|
79212
|
-
|
|
80068
|
+
commitProc = _internals101.bunSpawn([
|
|
80069
|
+
_internals101.resolveGitExecutable(),
|
|
79213
80070
|
"-C",
|
|
79214
80071
|
worktreePath,
|
|
79215
80072
|
"commit",
|
|
@@ -79247,8 +80104,8 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79247
80104
|
}
|
|
79248
80105
|
let hashProc;
|
|
79249
80106
|
try {
|
|
79250
|
-
hashProc =
|
|
79251
|
-
|
|
80107
|
+
hashProc = _internals101.bunSpawn([
|
|
80108
|
+
_internals101.resolveGitExecutable(),
|
|
79252
80109
|
"-C",
|
|
79253
80110
|
worktreePath,
|
|
79254
80111
|
"rev-parse",
|
|
@@ -79294,7 +80151,7 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79294
80151
|
const tagName = `swarm-preserved-worktree-${sanitizedBranch}-${shortHash}`;
|
|
79295
80152
|
let tagProc;
|
|
79296
80153
|
try {
|
|
79297
|
-
tagProc =
|
|
80154
|
+
tagProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "tag", tagName], {
|
|
79298
80155
|
stdin: "ignore",
|
|
79299
80156
|
stdout: "pipe",
|
|
79300
80157
|
stderr: "pipe",
|
|
@@ -79346,7 +80203,7 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79346
80203
|
let preserveResult;
|
|
79347
80204
|
if (reason === "denied" || reason === "cancelled") {
|
|
79348
80205
|
try {
|
|
79349
|
-
preserveResult = await
|
|
80206
|
+
preserveResult = await _internals101.preserveDirtyWorktreeForCallId(callID, reason, directory, worktree_dir);
|
|
79350
80207
|
} catch (err) {
|
|
79351
80208
|
log(`[swarm] cleanupStandardWorktreeForCallId: preserveDirtyWorktreeForCallId threw for ${callID}: ${err}`);
|
|
79352
80209
|
preserveResult = {
|
|
@@ -79357,7 +80214,7 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79357
80214
|
}
|
|
79358
80215
|
if (preserveResult.outcome === "clean") {
|
|
79359
80216
|
try {
|
|
79360
|
-
preserveResult = await
|
|
80217
|
+
preserveResult = await _internals101.preserveDirtyWorktreeForCallId(callID, reason, directory, worktree_dir);
|
|
79361
80218
|
} catch (err) {
|
|
79362
80219
|
log(`[swarm] cleanupStandardWorktreeForCallId: final preservation check threw for ${callID}: ${err}`);
|
|
79363
80220
|
preserveResult = {
|
|
@@ -79375,11 +80232,11 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79375
80232
|
pushAdvisory(session2, `STANDARD_WORKTREE_PRESERVATION_FAILED_ABORT_CLEANUP: dispatch ${callID} has dirty uncommitted work but preservation failed (${preserveResult.error}). Cleanup aborted to protect uncommitted work. Investigate and resolve manually. Worktree=${worktreePath}; branch=${branchName}.`);
|
|
79376
80233
|
return;
|
|
79377
80234
|
}
|
|
79378
|
-
await
|
|
80235
|
+
await _internals101.removeWorktree(worktreePath, directory, {
|
|
79379
80236
|
force: true,
|
|
79380
80237
|
worktreeDir: worktree_dir
|
|
79381
80238
|
}).catch((err) => log(`[swarm] cleanupStandardWorktreeForCallId: removeWorktree failed for ${callID}: ${err}`));
|
|
79382
|
-
await
|
|
80239
|
+
await _internals101.postMergeCleanup(directory, branchName).catch((err) => log(`[swarm] cleanupStandardWorktreeForCallId: postMergeCleanup failed for ${callID}: ${err}`));
|
|
79383
80240
|
standardWorktreeByCallID.delete(callID);
|
|
79384
80241
|
awaitingMergeByCallID.delete(callID);
|
|
79385
80242
|
const session = ensureAgentSession(parentSessionID);
|
|
@@ -79398,7 +80255,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
79398
80255
|
const wtConfig = config ? resolveWorktreeIsolationConfig(config) : DEFAULT_WORKTREE_ISOLATION_CONFIG;
|
|
79399
80256
|
const resolvedCallID = callID ?? dispatch.callID;
|
|
79400
80257
|
const run = async () => {
|
|
79401
|
-
const mergeResult = await
|
|
80258
|
+
const mergeResult = await _internals101.attemptMergeBackFromDirty(dispatch.handle.worktreePath, dispatch.handle.branchName, directory, getMergeStrategy({ merge_strategy: dispatch.mergeStrategy }), {
|
|
79402
80259
|
operationId: settlement.operationId,
|
|
79403
80260
|
resume: settlement.resume,
|
|
79404
80261
|
onBeforeMerge: settlement.onBeforeMerge
|
|
@@ -79438,7 +80295,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
79438
80295
|
}
|
|
79439
80296
|
clearWorktreeMergeStatus(statusKey);
|
|
79440
80297
|
try {
|
|
79441
|
-
const { removeLaneProfileFromDiskReal } = await import("./core-
|
|
80298
|
+
const { removeLaneProfileFromDiskReal } = await import("./core-xx0x5tfv.js");
|
|
79442
80299
|
await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
|
|
79443
80300
|
} catch {}
|
|
79444
80301
|
const state = serializationStateBySessionID.get(dispatch.parentSessionID);
|
|
@@ -79556,7 +80413,7 @@ async function readLaneEnvFileFromDisk(worktreePath, laneIndex) {
|
|
|
79556
80413
|
}
|
|
79557
80414
|
return result;
|
|
79558
80415
|
}
|
|
79559
|
-
var
|
|
80416
|
+
var _internals101 = {
|
|
79560
80417
|
provisionWorktree,
|
|
79561
80418
|
removeWorktree,
|
|
79562
80419
|
attemptMergeBackFromDirty,
|
|
@@ -79584,4 +80441,4 @@ var _internals100 = {
|
|
|
79584
80441
|
resolveGitExecutable
|
|
79585
80442
|
};
|
|
79586
80443
|
|
|
79587
|
-
export { resetActionCircuitExternally, getBlockingActionCircuit, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk,
|
|
80444
|
+
export { resetActionCircuitExternally, getBlockingActionCircuit, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals101 as _internals, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals25 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals29 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, safeRealpathSync, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals99 as _internals3, resolveCommand };
|