opencode-swarm 7.149.1 → 7.151.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-23ega26j.js} +2 -2
- package/dist/cli/{core-y9d858n6.js → core-3g4krkj8.js} +1 -1
- package/dist/cli/{curation-policy-nck9g765.js → curation-policy-fmvccdrg.js} +6 -6
- package/dist/cli/{curator-llm-factory-mzh9ns5s.js → curator-llm-factory-k0nxn5gt.js} +28 -28
- package/dist/cli/{curator-f5m0hh2p.js → curator-rym2wtn6.js} +28 -28
- package/dist/cli/{evidence-summary-service-601x7ne7.js → evidence-summary-service-f0gvjesf.js} +12 -12
- package/dist/cli/{gate-evidence-kjs9vsx9.js → gate-evidence-cghq17xc.js} +6 -6
- package/dist/cli/{guardrail-explain-j291sss5.js → guardrail-explain-cv52smw2.js} +29 -29
- package/dist/cli/{guardrail-log-1jykfrqc.js → guardrail-log-wgwmh9b7.js} +5 -5
- package/dist/cli/{guardrail-reset-tr07m077.js → guardrail-reset-vx7zsmzd.js} +28 -28
- package/dist/cli/{hive-promoter-162ws6xp.js → hive-promoter-jb2nzv3j.js} +28 -28
- package/dist/cli/{index-yjj3s8af.js → index-02qc4ehj.js} +3 -3
- package/dist/cli/{index-k2sm9677.js → index-0q2mjxp2.js} +1 -1
- package/dist/cli/index-2qte9nr7.js +149 -0
- package/dist/cli/{index-srwp8fs7.js → index-5ep31be7.js} +4 -4
- package/dist/cli/{index-exn0ztsv.js → index-6zkm4p7p.js} +1 -1
- package/dist/cli/{index-cqhf7fkw.js → index-7qbyetsf.js} +1 -1
- package/dist/cli/{index-64d17yd0.js → index-8wy7pb4a.js} +2 -2
- package/dist/cli/{index-prxrmc3b.js → index-9wpr1p2g.js} +2 -2
- package/dist/cli/{index-xggpmtfx.js → index-aw492hpn.js} +57 -40
- package/dist/cli/{index-ekvs3ade.js → index-bfc4bbq4.js} +7 -7
- package/dist/cli/{index-dtmgt2xn.js → index-dvycdkhj.js} +1 -0
- package/dist/cli/{index-fc4x86sy.js → index-e9qh1j19.js} +5 -5
- package/dist/cli/{index-4sdhbxgq.js → index-f73px21b.js} +1 -1
- package/dist/cli/{index-pf22x0dr.js → index-fkqfcv14.js} +2 -1
- package/dist/cli/{index-apwcvfjt.js → index-frp2hwdg.js} +2 -2
- package/dist/cli/{index-7m8rk72d.js → index-fybg880e.js} +1315 -445
- package/dist/cli/{index-n99s022c.js → index-jjpppdvb.js} +1 -1
- package/dist/cli/{index-kgk65rde.js → index-kghpgs47.js} +1 -1
- package/dist/cli/{index-cna8m7my.js → index-qa8bmwav.js} +745 -8
- package/dist/cli/{index-mdwtj4xm.js → index-sdff3rvj.js} +6 -6
- package/dist/cli/{index-hxbrsb40.js → index-sg48w5e4.js} +2 -2
- package/dist/cli/{index-t994f8fp.js → index-tfkc0zf4.js} +1 -1
- package/dist/cli/{index-38ema5k2.js → index-tp1avc8j.js} +2 -2
- package/dist/cli/{index-m8dn0qnm.js → index-txbd25bc.js} +1 -1
- package/dist/cli/{index-jb9tb1sd.js → index-v3gshkpz.js} +1 -1
- package/dist/cli/{index-f53yyerg.js → index-vradyw0x.js} +30 -30
- package/dist/cli/{index-1aztaa2s.js → index-vs8wtavs.js} +3 -3
- package/dist/cli/{index-dkrz1vv5.js → index-wna9f75x.js} +4 -4
- package/dist/cli/{index-xe83cwvn.js → index-wxkgy9gh.js} +7 -7
- package/dist/cli/{index-jg2gwzvq.js → index-xeptzfb6.js} +4 -4
- package/dist/cli/{index-vy6q9d8j.js → index-z4bg1hv8.js} +1 -1
- package/dist/cli/{index-5gntxwxt.js → index-zkxnba57.js} +5 -5
- package/dist/cli/index.js +28 -28
- package/dist/cli/{knowledge-escalator-whkxxgxj.js → knowledge-escalator-a9dwxqz8.js} +11 -11
- package/dist/cli/{knowledge-events-rnqzt87h.js → knowledge-events-0q4sb713.js} +9 -9
- package/dist/cli/{knowledge-link-mzn8x0qd.js → knowledge-link-v7hj1h8m.js} +5 -5
- package/dist/cli/{knowledge-store-7de59rnz.js → knowledge-store-y2nbt9jk.js} +6 -6
- package/dist/cli/{knowledge-validator-bpk17jf4.js → knowledge-validator-4wr1m0xa.js} +8 -8
- package/dist/cli/{pending-delegations-qzy6rnvw.js → pending-delegations-a2nmssr1.js} +3 -3
- package/dist/cli/{pr-subscriptions-q862pvz1.js → pr-subscriptions-7879nq5k.js} +3 -3
- package/dist/cli/{runner-1aygs98c.js → runner-7znestx4.js} +6 -6
- package/dist/cli/{scan-cursor-0p51fh61.js → scan-cursor-bsrfrxm6.js} +7 -7
- package/dist/cli/{schema-8g2nxhjf.js → schema-s6yh3rst.js} +1 -1
- package/dist/cli/{scope-persistence-hhkr0c46.js → scope-persistence-f77w4jrx.js} +8 -8
- package/dist/cli/{skill-generator-pk9gcz7r.js → skill-generator-jr7c8fcg.js} +13 -13
- package/dist/cli/{telemetry-5deacb7w.js → telemetry-52pw5xac.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-9v8e0dz7.js → worktree-collision-ownership-p31zm5k0.js} +3 -3
- package/dist/cli/{worktree-isolation-1hwwfbdw.js → worktree-isolation-ka20b0rm.js} +28 -28
- package/dist/commands/close.d.ts +1 -0
- package/dist/hooks/guardrails/audit-log.d.ts +70 -19
- package/dist/hooks/guardrails/helpers.d.ts +16 -1
- package/dist/hooks/guardrails/shell-audit-store.d.ts +211 -0
- package/dist/hooks/guardrails/tool-before.d.ts +0 -2
- package/dist/index.js +415 -371
- package/dist/lang/symbol-graph.d.ts +15 -0
- package/dist/observability/catalog.d.ts +7 -5
- package/dist/services/guardrail-log-service.d.ts +4 -0
- package/dist/telemetry.d.ts +22 -1
- package/dist/tools/repo-graph/builder.d.ts +27 -1
- package/dist/tools/symbols.d.ts +35 -0
- package/package.json +2 -1
- package/dist/cli/index-eaq9b0qm.js +0 -110
|
@@ -6,17 +6,19 @@ import {
|
|
|
6
6
|
resolveExecutableFromPath,
|
|
7
7
|
runEvaluation,
|
|
8
8
|
runExternalTool
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-jjpppdvb.js";
|
|
10
10
|
import {
|
|
11
|
+
finalizeShellAuditForClose,
|
|
11
12
|
normalizeToolNameLowerCase,
|
|
13
|
+
redactDecisionLineForArchive,
|
|
12
14
|
stableCanonicalStringify
|
|
13
|
-
} from "./index-
|
|
15
|
+
} from "./index-qa8bmwav.js";
|
|
14
16
|
import {
|
|
15
17
|
detectStraySwarmDirs,
|
|
16
18
|
readDoctorArtifact,
|
|
17
19
|
removeStraySwarmDir,
|
|
18
20
|
runConfigDoctor
|
|
19
|
-
} from "./index-
|
|
21
|
+
} from "./index-kghpgs47.js";
|
|
20
22
|
import {
|
|
21
23
|
MAX_TRANSIENT_RETRIES,
|
|
22
24
|
archiveEvidence,
|
|
@@ -62,7 +64,7 @@ import {
|
|
|
62
64
|
updateTaskStatus,
|
|
63
65
|
validateProjectRoot,
|
|
64
66
|
validateSymlinkBoundary
|
|
65
|
-
} from "./index-
|
|
67
|
+
} from "./index-bfc4bbq4.js";
|
|
66
68
|
import {
|
|
67
69
|
EvaluationTaskV1Schema,
|
|
68
70
|
GateAuditManifestV1Schema,
|
|
@@ -79,7 +81,7 @@ import {
|
|
|
79
81
|
saveGateAuditResult,
|
|
80
82
|
savePromotionDecision,
|
|
81
83
|
saveTaskSetSnapshot
|
|
82
|
-
} from "./index-
|
|
84
|
+
} from "./index-9wpr1p2g.js";
|
|
83
85
|
import {
|
|
84
86
|
loadDatabaseCtor
|
|
85
87
|
} from "./index-134d35c1.js";
|
|
@@ -105,12 +107,12 @@ import {
|
|
|
105
107
|
} from "./index-y8552snf.js";
|
|
106
108
|
import {
|
|
107
109
|
readRecentEscalations
|
|
108
|
-
} from "./index-
|
|
110
|
+
} from "./index-zkxnba57.js";
|
|
109
111
|
import {
|
|
110
112
|
alreadyCuratedThisGeneration,
|
|
111
113
|
claimNextScanBatch,
|
|
112
114
|
resolveCohortId
|
|
113
|
-
} from "./index-
|
|
115
|
+
} from "./index-sg48w5e4.js";
|
|
114
116
|
import {
|
|
115
117
|
CURATOR_INIT_PROMPT,
|
|
116
118
|
CURATOR_PHASE_PROMPT,
|
|
@@ -159,7 +161,7 @@ import {
|
|
|
159
161
|
listActive,
|
|
160
162
|
subscribe,
|
|
161
163
|
unsubscribe
|
|
162
|
-
} from "./index-
|
|
164
|
+
} from "./index-0q2mjxp2.js";
|
|
163
165
|
import {
|
|
164
166
|
BUNDLED_PROJECT_SKILL_ROOT,
|
|
165
167
|
DEFAULT_SKILL_MIN_CONFIDENCE,
|
|
@@ -180,7 +182,7 @@ import {
|
|
|
180
182
|
retireSkill,
|
|
181
183
|
selectCandidateEntries,
|
|
182
184
|
syncBundledProjectSkillsIfMissingAsync
|
|
183
|
-
} from "./index-
|
|
185
|
+
} from "./index-wna9f75x.js";
|
|
184
186
|
import {
|
|
185
187
|
appendUnactionable,
|
|
186
188
|
quarantineEntry,
|
|
@@ -191,11 +193,11 @@ import {
|
|
|
191
193
|
validateActionableFields,
|
|
192
194
|
validateLesson,
|
|
193
195
|
validateSkillPath
|
|
194
|
-
} from "./index-
|
|
196
|
+
} from "./index-5ep31be7.js";
|
|
195
197
|
import {
|
|
196
198
|
authorizeCuration,
|
|
197
199
|
buildConfigFingerprintInput
|
|
198
|
-
} from "./index-
|
|
200
|
+
} from "./index-f73px21b.js";
|
|
199
201
|
import {
|
|
200
202
|
cohortConfigFingerprint
|
|
201
203
|
} from "./index-rtry5xyf.js";
|
|
@@ -219,7 +221,7 @@ import {
|
|
|
219
221
|
scanBackgroundCoderReservationsForAdmission,
|
|
220
222
|
scanDelegationsForRecovery,
|
|
221
223
|
sweepStaleDelegations
|
|
222
|
-
} from "./index-
|
|
224
|
+
} from "./index-z4bg1hv8.js";
|
|
223
225
|
import {
|
|
224
226
|
WORKTREE_LIFECYCLE_LOCK_FILE,
|
|
225
227
|
recordWorktreeProvisioningOwner,
|
|
@@ -252,18 +254,18 @@ import {
|
|
|
252
254
|
transitionTaskWorkflowEvidence,
|
|
253
255
|
withTaskEvidenceTransaction,
|
|
254
256
|
writeWorkflowWalFile
|
|
255
|
-
} from "./index-
|
|
257
|
+
} from "./index-xeptzfb6.js";
|
|
256
258
|
import {
|
|
257
259
|
provisionWorktree,
|
|
258
260
|
removeWorktree
|
|
259
|
-
} from "./index-
|
|
261
|
+
} from "./index-tfkc0zf4.js";
|
|
260
262
|
import {
|
|
261
263
|
MAX_PENDING_SCOPE_BINDINGS,
|
|
262
264
|
canonicalWorkspaceIdentity,
|
|
263
265
|
clearAllScopes,
|
|
264
266
|
clearScopeBindingFromDisk,
|
|
265
267
|
clearScopeBindings
|
|
266
|
-
} from "./index-
|
|
268
|
+
} from "./index-e9qh1j19.js";
|
|
267
269
|
import {
|
|
268
270
|
appendLedgerEvent,
|
|
269
271
|
computePlanHash,
|
|
@@ -278,7 +280,7 @@ import {
|
|
|
278
280
|
readPlanEpochIdentity,
|
|
279
281
|
replayFromLedgerWithStatus,
|
|
280
282
|
takeSnapshotEvent
|
|
281
|
-
} from "./index-
|
|
283
|
+
} from "./index-vs8wtavs.js";
|
|
282
284
|
import {
|
|
283
285
|
CORE_EVENT_LOCKED,
|
|
284
286
|
appendCoreEventSync,
|
|
@@ -288,7 +290,7 @@ import {
|
|
|
288
290
|
hasSpecDriftAuditEvent,
|
|
289
291
|
hasTaskRepairAuditEvent,
|
|
290
292
|
readCoreEvents
|
|
291
|
-
} from "./index-
|
|
293
|
+
} from "./index-6zkm4p7p.js";
|
|
292
294
|
import {
|
|
293
295
|
isPathWithinDeclaredScope,
|
|
294
296
|
sanitizeDiagnosticText
|
|
@@ -340,7 +342,7 @@ import {
|
|
|
340
342
|
transactFile,
|
|
341
343
|
transactKnowledge,
|
|
342
344
|
wordBigrams
|
|
343
|
-
} from "./index-
|
|
345
|
+
} from "./index-sdff3rvj.js";
|
|
344
346
|
import {
|
|
345
347
|
MAX_EVENT_LOG_ENTRIES,
|
|
346
348
|
_internals as _internals2,
|
|
@@ -354,10 +356,10 @@ import {
|
|
|
354
356
|
recordKnowledgeEvent,
|
|
355
357
|
recordPhaseCloseIntent,
|
|
356
358
|
resolveKnowledgeEventsPath
|
|
357
|
-
} from "./index-
|
|
359
|
+
} from "./index-wxkgy9gh.js";
|
|
358
360
|
import {
|
|
359
361
|
resolveWorktreeIsolationConfig
|
|
360
|
-
} from "./index-
|
|
362
|
+
} from "./index-tp1avc8j.js";
|
|
361
363
|
import {
|
|
362
364
|
RetrospectiveEvidenceSchema
|
|
363
365
|
} from "./index-gprxjmm7.js";
|
|
@@ -379,7 +381,7 @@ import {
|
|
|
379
381
|
init_loader,
|
|
380
382
|
loadPluginConfig,
|
|
381
383
|
loadPluginConfigWithMeta
|
|
382
|
-
} from "./index-
|
|
384
|
+
} from "./index-7qbyetsf.js";
|
|
383
385
|
import {
|
|
384
386
|
DEFAULT_SKILL_OPT_CONFIG,
|
|
385
387
|
FALLBACK_MODELS_MAX,
|
|
@@ -393,7 +395,7 @@ import {
|
|
|
393
395
|
package_default,
|
|
394
396
|
resolveAutoReviewConfig,
|
|
395
397
|
stripKnownSwarmPrefix
|
|
396
|
-
} from "./index-
|
|
398
|
+
} from "./index-fkqfcv14.js";
|
|
397
399
|
import {
|
|
398
400
|
AGENT_TOOL_MAP,
|
|
399
401
|
ALL_AGENT_NAMES,
|
|
@@ -433,10 +435,10 @@ import {
|
|
|
433
435
|
resolveLinkDir,
|
|
434
436
|
sanitizeLinkId,
|
|
435
437
|
writeLinkPointer
|
|
436
|
-
} from "./index-
|
|
438
|
+
} from "./index-v3gshkpz.js";
|
|
437
439
|
import {
|
|
438
440
|
atomicWriteFile
|
|
439
|
-
} from "./index-
|
|
441
|
+
} from "./index-frp2hwdg.js";
|
|
440
442
|
import {
|
|
441
443
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
442
444
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -448,7 +450,7 @@ import {
|
|
|
448
450
|
atomicWriteSwarmFileSync,
|
|
449
451
|
matchTempGrammar,
|
|
450
452
|
parseTargetBasename
|
|
451
|
-
} from "./index-
|
|
453
|
+
} from "./index-dvycdkhj.js";
|
|
452
454
|
import {
|
|
453
455
|
assertProjectRoot,
|
|
454
456
|
hasExplicitProjectBoundary,
|
|
@@ -456,12 +458,12 @@ import {
|
|
|
456
458
|
listActiveLocks,
|
|
457
459
|
tryAcquireLock,
|
|
458
460
|
withEvidenceLock
|
|
459
|
-
} from "./index-
|
|
461
|
+
} from "./index-txbd25bc.js";
|
|
460
462
|
import {
|
|
461
463
|
emit,
|
|
462
464
|
getLastHeartbeat,
|
|
463
465
|
telemetry
|
|
464
|
-
} from "./index-
|
|
466
|
+
} from "./index-aw492hpn.js";
|
|
465
467
|
import {
|
|
466
468
|
require_proper_lockfile
|
|
467
469
|
} from "./index-7g4c7s5r.js";
|
|
@@ -5599,7 +5601,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
|
|
|
5599
5601
|
awaitingMergeByCallID,
|
|
5600
5602
|
cleanupStandardWorktreeForCallId,
|
|
5601
5603
|
standardWorktreeByCallID
|
|
5602
|
-
} = await import("./worktree-isolation-
|
|
5604
|
+
} = await import("./worktree-isolation-ka20b0rm.js");
|
|
5603
5605
|
standardWorktreeByCallID.delete(descriptor.callID);
|
|
5604
5606
|
if (hasResidue)
|
|
5605
5607
|
awaitingMergeByCallID.set(descriptor.callID, {
|
|
@@ -5701,7 +5703,7 @@ async function recoverCoderSettlement(directory, taskId) {
|
|
|
5701
5703
|
awaitingMergeByCallID,
|
|
5702
5704
|
finishStandardWorktreeDispatch,
|
|
5703
5705
|
standardWorktreeByCallID
|
|
5704
|
-
} = await import("./worktree-isolation-
|
|
5706
|
+
} = await import("./worktree-isolation-ka20b0rm.js");
|
|
5705
5707
|
const descriptor = wal.worktree;
|
|
5706
5708
|
const reconstructedDispatch = {
|
|
5707
5709
|
callID: descriptor.callID,
|
|
@@ -18503,7 +18505,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
18503
18505
|
};
|
|
18504
18506
|
}
|
|
18505
18507
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
18506
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
18508
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-02qc4ehj.js");
|
|
18507
18509
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
18508
18510
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
18509
18511
|
if (sweepConfig?.enabled === false)
|
|
@@ -19633,7 +19635,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19633
19635
|
}
|
|
19634
19636
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
19635
19637
|
try {
|
|
19636
|
-
const skillModule = await import("./skill-generator-
|
|
19638
|
+
const skillModule = await import("./skill-generator-jr7c8fcg.js");
|
|
19637
19639
|
for (const cand of skillCandidates) {
|
|
19638
19640
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
19639
19641
|
continue;
|
|
@@ -20105,7 +20107,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
20105
20107
|
} catch {}
|
|
20106
20108
|
}
|
|
20107
20109
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
20108
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
20110
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-a9dwxqz8.js");
|
|
20109
20111
|
for (const { id } of contradictedEntries) {
|
|
20110
20112
|
try {
|
|
20111
20113
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -20924,7 +20926,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
20924
20926
|
warnings.push("Failed to collect knowledge summary.");
|
|
20925
20927
|
}
|
|
20926
20928
|
try {
|
|
20927
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
20929
|
+
const { getScanStatus } = await import("./scan-cursor-bsrfrxm6.js");
|
|
20928
20930
|
const scanStatus = await getScanStatus(directory);
|
|
20929
20931
|
if (scanStatus.remaining_estimate > 0) {
|
|
20930
20932
|
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 +21098,9 @@ var _internals26 = {
|
|
|
21096
21098
|
verifyPostMortemKnowledgeActions,
|
|
21097
21099
|
repairPostMortemActions,
|
|
21098
21100
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
21099
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
21101
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-s6yh3rst.js");
|
|
21100
21102
|
try {
|
|
21101
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
21103
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-02qc4ehj.js");
|
|
21102
21104
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
21103
21105
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
21104
21106
|
} catch {
|
|
@@ -21106,11 +21108,11 @@ var _internals26 = {
|
|
|
21106
21108
|
}
|
|
21107
21109
|
},
|
|
21108
21110
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
21109
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
21111
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-rym2wtn6.js");
|
|
21110
21112
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
21111
21113
|
},
|
|
21112
21114
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
21113
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
21115
|
+
const { checkHivePromotions } = await import("./hive-promoter-jb2nzv3j.js");
|
|
21114
21116
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
21115
21117
|
},
|
|
21116
21118
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -21119,7 +21121,7 @@ var _internals26 = {
|
|
|
21119
21121
|
activateProposal,
|
|
21120
21122
|
listSkills: listSkills2,
|
|
21121
21123
|
sanitizeSlug
|
|
21122
|
-
} = await import("./skill-generator-
|
|
21124
|
+
} = await import("./skill-generator-jr7c8fcg.js");
|
|
21123
21125
|
const result = {
|
|
21124
21126
|
approved: [],
|
|
21125
21127
|
rejected: [],
|
|
@@ -22449,9 +22451,9 @@ function hashContent(content) {
|
|
|
22449
22451
|
return createHash10("sha1").update(content).digest("hex");
|
|
22450
22452
|
}
|
|
22451
22453
|
async function loadConfigForPolicyCurator(directory) {
|
|
22452
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
22454
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-s6yh3rst.js");
|
|
22453
22455
|
try {
|
|
22454
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
22456
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-02qc4ehj.js");
|
|
22455
22457
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
22456
22458
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
22457
22459
|
} catch {
|
|
@@ -33658,7 +33660,7 @@ async function runFinalizeStage(ctx) {
|
|
|
33658
33660
|
}
|
|
33659
33661
|
}
|
|
33660
33662
|
try {
|
|
33661
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
33663
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-s6yh3rst.js");
|
|
33662
33664
|
const { config: pmLoadedConfig } = _internals41.loadPluginConfigWithMeta(ctx.directory);
|
|
33663
33665
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
33664
33666
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -33703,6 +33705,12 @@ async function runArchiveStage(ctx) {
|
|
|
33703
33705
|
const msg = finalizeErr instanceof Error ? finalizeErr.message : String(finalizeErr);
|
|
33704
33706
|
ctx.warnings.push(`Core events finalize before archive failed: ${msg}`);
|
|
33705
33707
|
}
|
|
33708
|
+
try {
|
|
33709
|
+
_internals41.finalizeShellAudit(ctx.directory);
|
|
33710
|
+
} catch (finalizeErr) {
|
|
33711
|
+
const msg = finalizeErr instanceof Error ? finalizeErr.message : String(finalizeErr);
|
|
33712
|
+
ctx.warnings.push(`Shell audit finalize before archive failed: ${msg}`);
|
|
33713
|
+
}
|
|
33706
33714
|
const linkedKnowledgeShared = isLinked(ctx.directory);
|
|
33707
33715
|
if (linkedKnowledgeShared) {
|
|
33708
33716
|
ctx.warnings.push("Worktree is linked: shared knowledge (knowledge.jsonl, knowledge-rejected.jsonl) lives in the link store and is not archived or cleaned by /swarm close. Manage it via the link.");
|
|
@@ -34528,7 +34536,7 @@ var _internals41 = {
|
|
|
34528
34536
|
closePlanTerminalState: reconcileCloseTerminalStateForPlan,
|
|
34529
34537
|
endAgentSession,
|
|
34530
34538
|
flushAndDrainTelemetry: async () => {
|
|
34531
|
-
const { flushAndDrainTelemetry } = await import("./telemetry-
|
|
34539
|
+
const { flushAndDrainTelemetry } = await import("./telemetry-52pw5xac.js");
|
|
34532
34540
|
return flushAndDrainTelemetry();
|
|
34533
34541
|
},
|
|
34534
34542
|
finalizeContextTelemetry: (directory) => {
|
|
@@ -34536,6 +34544,11 @@ var _internals41 = {
|
|
|
34536
34544
|
},
|
|
34537
34545
|
finalizeCoreEvents: (directory) => {
|
|
34538
34546
|
finalizeCoreEventsForClose(directory);
|
|
34547
|
+
},
|
|
34548
|
+
finalizeShellAudit: (directory) => {
|
|
34549
|
+
finalizeShellAuditForClose(directory, {
|
|
34550
|
+
lineTransform: redactDecisionLineForArchive
|
|
34551
|
+
});
|
|
34539
34552
|
}
|
|
34540
34553
|
};
|
|
34541
34554
|
|
|
@@ -35860,9 +35873,9 @@ var _internals45 = {
|
|
|
35860
35873
|
loadPluginConfigWithMeta,
|
|
35861
35874
|
loadCuratorDeps: async () => {
|
|
35862
35875
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
35863
|
-
import("./schema-
|
|
35864
|
-
import("./curator-
|
|
35865
|
-
import("./curator-llm-factory-
|
|
35876
|
+
import("./schema-s6yh3rst.js"),
|
|
35877
|
+
import("./curator-rym2wtn6.js"),
|
|
35878
|
+
import("./curator-llm-factory-k0nxn5gt.js")
|
|
35866
35879
|
]);
|
|
35867
35880
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
35868
35881
|
}
|
|
@@ -36852,7 +36865,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
36852
36865
|
let scanCompleted = false;
|
|
36853
36866
|
let scanRemaining = 0;
|
|
36854
36867
|
try {
|
|
36855
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
36868
|
+
const { getScanStatus } = await import("./scan-cursor-bsrfrxm6.js");
|
|
36856
36869
|
const status = await getScanStatus(directory);
|
|
36857
36870
|
scanGeneration = status.generation;
|
|
36858
36871
|
scanCompleted = status.completed;
|
|
@@ -36860,19 +36873,19 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
36860
36873
|
} catch {}
|
|
36861
36874
|
let configMatch = null;
|
|
36862
36875
|
try {
|
|
36863
|
-
const { isLinked: isLinked2 } = await import("./knowledge-link-
|
|
36876
|
+
const { isLinked: isLinked2 } = await import("./knowledge-link-v7hj1h8m.js");
|
|
36864
36877
|
if (isLinked2(directory)) {
|
|
36865
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
36878
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-s6yh3rst.js");
|
|
36866
36879
|
let config;
|
|
36867
36880
|
try {
|
|
36868
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
36881
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-02qc4ehj.js");
|
|
36869
36882
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
36870
36883
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
36871
36884
|
} catch {
|
|
36872
36885
|
config = KnowledgeConfigSchema2.parse({});
|
|
36873
36886
|
}
|
|
36874
36887
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
36875
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
36888
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-fmvccdrg.js");
|
|
36876
36889
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
36877
36890
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
36878
36891
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -38176,7 +38189,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
38176
38189
|
const result = runConfigDoctor(config, directory);
|
|
38177
38190
|
let output;
|
|
38178
38191
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
38179
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
38192
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-23ega26j.js");
|
|
38180
38193
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
38181
38194
|
applyLossy: true
|
|
38182
38195
|
});
|
|
@@ -39116,7 +39129,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
39116
39129
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
39117
39130
|
}
|
|
39118
39131
|
async function handleEvidenceSummaryCommand(directory) {
|
|
39119
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
39132
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-f0gvjesf.js");
|
|
39120
39133
|
const artifact = await buildEvidenceSummary(directory);
|
|
39121
39134
|
if (!artifact) {
|
|
39122
39135
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -50321,6 +50334,8 @@ var QUERIES = {
|
|
|
50321
50334
|
) @func.def
|
|
50322
50335
|
(class_declaration name: (name) @class.name) @class.def
|
|
50323
50336
|
(interface_declaration name: (name) @interface.name) @interface.def
|
|
50337
|
+
(trait_declaration name: (name) @trait.name) @trait.def
|
|
50338
|
+
(enum_declaration name: (name) @enum.name) @enum.def
|
|
50324
50339
|
`,
|
|
50325
50340
|
imports: `
|
|
50326
50341
|
(namespace_use_declaration) @import
|
|
@@ -50567,6 +50582,7 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50567
50582
|
defNameKeys.add(nodeKey(nameNode));
|
|
50568
50583
|
}
|
|
50569
50584
|
}
|
|
50585
|
+
augmentNativeDynamicDefs(grammarId, root.text, defs);
|
|
50570
50586
|
const importsWithIndex = [];
|
|
50571
50587
|
const addImport = (entry, node) => {
|
|
50572
50588
|
if (!entry)
|
|
@@ -50648,12 +50664,28 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50648
50664
|
}
|
|
50649
50665
|
}
|
|
50650
50666
|
}
|
|
50651
|
-
if (isEsMGrammar(grammarId)) {
|
|
50667
|
+
if (isEsMGrammar(grammarId) || grammarId === "dart") {
|
|
50652
50668
|
for (const exportNode of exportNodes) {
|
|
50653
50669
|
addImport(parseImport(grammarId, exportNode.text.trim()), exportNode);
|
|
50654
50670
|
}
|
|
50655
50671
|
}
|
|
50656
|
-
const
|
|
50672
|
+
for (const fallback of fallbackImportsForSource(grammarId, root.text)) {
|
|
50673
|
+
importsWithIndex.push(fallback);
|
|
50674
|
+
}
|
|
50675
|
+
const seenImports = new Set;
|
|
50676
|
+
const imports = importsWithIndex.sort((a, b) => a.index - b.index).map((item) => item.entry).filter((entry) => {
|
|
50677
|
+
const key = JSON.stringify([
|
|
50678
|
+
entry.specifier,
|
|
50679
|
+
entry.importType,
|
|
50680
|
+
entry.bindings,
|
|
50681
|
+
entry.reExport ?? false,
|
|
50682
|
+
entry.exportedBindings ?? []
|
|
50683
|
+
]);
|
|
50684
|
+
if (seenImports.has(key))
|
|
50685
|
+
return false;
|
|
50686
|
+
seenImports.add(key);
|
|
50687
|
+
return true;
|
|
50688
|
+
});
|
|
50657
50689
|
const topLevelDefs = defNodes.filter((d) => isTopLevelDef(d.node, root)).map((d) => ({ name: d.name, node: d.node }));
|
|
50658
50690
|
const refs = [];
|
|
50659
50691
|
const refParamTypes = grammarId === "swift" ? SWIFT_REF_PARAM_TYPES : PARAM_TYPES;
|
|
@@ -50698,7 +50730,390 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50698
50730
|
});
|
|
50699
50731
|
}
|
|
50700
50732
|
}
|
|
50701
|
-
|
|
50733
|
+
const normalizedDefs = defs.map((def) => ({
|
|
50734
|
+
...def,
|
|
50735
|
+
endLine: Math.max(def.endLine, def.startLine)
|
|
50736
|
+
}));
|
|
50737
|
+
return { defs: normalizedDefs, imports, refs };
|
|
50738
|
+
}
|
|
50739
|
+
function augmentNativeDynamicDefs(grammarId, source, defs) {
|
|
50740
|
+
switch (grammarId) {
|
|
50741
|
+
case "dart":
|
|
50742
|
+
augmentDartDefs(source, defs);
|
|
50743
|
+
return;
|
|
50744
|
+
case "ruby":
|
|
50745
|
+
augmentRubyDefs(source, defs);
|
|
50746
|
+
return;
|
|
50747
|
+
case "php":
|
|
50748
|
+
augmentPhpDefs(source, defs);
|
|
50749
|
+
return;
|
|
50750
|
+
}
|
|
50751
|
+
}
|
|
50752
|
+
function upsertAugmentedDef(defs, def) {
|
|
50753
|
+
const existing = defs.find((item) => item.name === def.name && item.startLine === def.startLine);
|
|
50754
|
+
if (existing) {
|
|
50755
|
+
existing.kind = def.kind;
|
|
50756
|
+
existing.exported = def.exported;
|
|
50757
|
+
existing.visibilityInfo = def.visibilityInfo;
|
|
50758
|
+
existing.endLine = Math.max(existing.endLine, def.endLine);
|
|
50759
|
+
return;
|
|
50760
|
+
}
|
|
50761
|
+
defs.push(def);
|
|
50762
|
+
}
|
|
50763
|
+
function symbolVisibilityInfo(visibility, exported, exportedReason) {
|
|
50764
|
+
return {
|
|
50765
|
+
exported,
|
|
50766
|
+
visibility,
|
|
50767
|
+
exportedReason,
|
|
50768
|
+
apiSurfaceKind: exported ? "public" : "private"
|
|
50769
|
+
};
|
|
50770
|
+
}
|
|
50771
|
+
function addRegexDef(defs, source, name, kind, start, end, visibility, exported, exportedReason) {
|
|
50772
|
+
upsertAugmentedDef(defs, {
|
|
50773
|
+
name,
|
|
50774
|
+
kind,
|
|
50775
|
+
exported,
|
|
50776
|
+
visibilityInfo: symbolVisibilityInfo(visibility, exported, exportedReason),
|
|
50777
|
+
startLine: lineNumberAt(source, start),
|
|
50778
|
+
endLine: lineNumberAt(source, end)
|
|
50779
|
+
});
|
|
50780
|
+
}
|
|
50781
|
+
function findMatchingBrace(source, openIndex) {
|
|
50782
|
+
if (source[openIndex] !== "{")
|
|
50783
|
+
return null;
|
|
50784
|
+
let depth = 0;
|
|
50785
|
+
for (let i = openIndex;i < source.length; i++) {
|
|
50786
|
+
const ch = source[i];
|
|
50787
|
+
if (ch === "{")
|
|
50788
|
+
depth++;
|
|
50789
|
+
else if (ch === "}") {
|
|
50790
|
+
depth--;
|
|
50791
|
+
if (depth === 0)
|
|
50792
|
+
return i;
|
|
50793
|
+
}
|
|
50794
|
+
}
|
|
50795
|
+
return null;
|
|
50796
|
+
}
|
|
50797
|
+
function lineNumberAt(text, index) {
|
|
50798
|
+
let line = 1;
|
|
50799
|
+
for (let i = 0;i < index && i < text.length; i++) {
|
|
50800
|
+
if (text[i] === `
|
|
50801
|
+
`)
|
|
50802
|
+
line++;
|
|
50803
|
+
}
|
|
50804
|
+
return line;
|
|
50805
|
+
}
|
|
50806
|
+
function advanceLineOffset(source, offset, lineLength) {
|
|
50807
|
+
const after = offset + lineLength;
|
|
50808
|
+
if (source[after] === "\r" && source[after + 1] === `
|
|
50809
|
+
`)
|
|
50810
|
+
return after + 2;
|
|
50811
|
+
if (source[after] === `
|
|
50812
|
+
` || source[after] === "\r")
|
|
50813
|
+
return after + 1;
|
|
50814
|
+
return after;
|
|
50815
|
+
}
|
|
50816
|
+
function declarationEnd(source, start) {
|
|
50817
|
+
const open2 = source.indexOf("{", start);
|
|
50818
|
+
const semi = source.indexOf(";", start);
|
|
50819
|
+
if (open2 !== -1 && (semi === -1 || open2 < semi)) {
|
|
50820
|
+
return findMatchingBrace(source, open2) ?? open2;
|
|
50821
|
+
}
|
|
50822
|
+
return semi === -1 ? start : semi;
|
|
50823
|
+
}
|
|
50824
|
+
var dartTypeRe = /\b(extension\s+type|class|mixin|enum|extension|typedef)\s+(?!on\b)([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
50825
|
+
function maskCommentsForAugment(source) {
|
|
50826
|
+
let out = "";
|
|
50827
|
+
let inBlock = false;
|
|
50828
|
+
let quote = null;
|
|
50829
|
+
for (let i = 0;i < source.length; i++) {
|
|
50830
|
+
const ch = source[i];
|
|
50831
|
+
const two = source.substring(i, i + 2);
|
|
50832
|
+
if (quote !== null) {
|
|
50833
|
+
if (ch === "\\") {
|
|
50834
|
+
out += " ";
|
|
50835
|
+
i++;
|
|
50836
|
+
continue;
|
|
50837
|
+
}
|
|
50838
|
+
if (ch === quote) {
|
|
50839
|
+
quote = null;
|
|
50840
|
+
out += ch;
|
|
50841
|
+
} else {
|
|
50842
|
+
out += ch === `
|
|
50843
|
+
` ? `
|
|
50844
|
+
` : " ";
|
|
50845
|
+
}
|
|
50846
|
+
continue;
|
|
50847
|
+
}
|
|
50848
|
+
if (!inBlock && two === "/*") {
|
|
50849
|
+
inBlock = true;
|
|
50850
|
+
out += " ";
|
|
50851
|
+
i++;
|
|
50852
|
+
continue;
|
|
50853
|
+
}
|
|
50854
|
+
if (inBlock) {
|
|
50855
|
+
if (two === "*/") {
|
|
50856
|
+
inBlock = false;
|
|
50857
|
+
out += " ";
|
|
50858
|
+
i++;
|
|
50859
|
+
} else {
|
|
50860
|
+
out += source[i] === `
|
|
50861
|
+
` ? `
|
|
50862
|
+
` : " ";
|
|
50863
|
+
}
|
|
50864
|
+
continue;
|
|
50865
|
+
}
|
|
50866
|
+
if (two === "//" || source[i] === "#") {
|
|
50867
|
+
out += two === "//" ? " " : " ";
|
|
50868
|
+
if (two === "//")
|
|
50869
|
+
i++;
|
|
50870
|
+
while (i + 1 < source.length && source[i + 1] !== `
|
|
50871
|
+
`) {
|
|
50872
|
+
out += " ";
|
|
50873
|
+
i++;
|
|
50874
|
+
}
|
|
50875
|
+
continue;
|
|
50876
|
+
}
|
|
50877
|
+
if (ch === '"' || ch === "'") {
|
|
50878
|
+
if (source[i + 1] === ch && source[i + 2] === ch) {
|
|
50879
|
+
out += ch + ch + ch;
|
|
50880
|
+
i += 2;
|
|
50881
|
+
while (i + 1 < source.length) {
|
|
50882
|
+
if (source[i + 1] === ch && source[i + 2] === ch && source[i + 3] === ch) {
|
|
50883
|
+
out += ch + ch + ch;
|
|
50884
|
+
i += 3;
|
|
50885
|
+
break;
|
|
50886
|
+
}
|
|
50887
|
+
out += source[i + 1] === `
|
|
50888
|
+
` ? `
|
|
50889
|
+
` : " ";
|
|
50890
|
+
i++;
|
|
50891
|
+
}
|
|
50892
|
+
continue;
|
|
50893
|
+
}
|
|
50894
|
+
quote = ch;
|
|
50895
|
+
out += ch;
|
|
50896
|
+
continue;
|
|
50897
|
+
}
|
|
50898
|
+
out += ch;
|
|
50899
|
+
}
|
|
50900
|
+
return out;
|
|
50901
|
+
}
|
|
50902
|
+
function augmentDartDefs(source, defs) {
|
|
50903
|
+
const masked = maskCommentsForAugment(source);
|
|
50904
|
+
dartTypeRe.lastIndex = 0;
|
|
50905
|
+
for (let m = dartTypeRe.exec(masked);m !== null; m = dartTypeRe.exec(masked)) {
|
|
50906
|
+
const exported = !m[2].startsWith("_");
|
|
50907
|
+
const kindWord = m[1].trim().split(/\s+/).pop() ?? m[1];
|
|
50908
|
+
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");
|
|
50909
|
+
}
|
|
50910
|
+
}
|
|
50911
|
+
var rubyMethodDefNameRe = /^def\s+(?:(self)\.)?([A-Za-z_][A-Za-z0-9_?!]*)/;
|
|
50912
|
+
var rubyTargetedVisibilityRe = /^(private|protected)\s+((?::[A-Za-z_][A-Za-z0-9_?!]*\s*,\s*)*:[A-Za-z_][A-Za-z0-9_?!]*)$/;
|
|
50913
|
+
var rubyEndWordRe = /\bend\b/g;
|
|
50914
|
+
var rubyHeredocOpenRe = /(?:^|[=(,[]\s*|(?:puts|print|raise|return|p)\s+)<<[~-]?['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/;
|
|
50915
|
+
function augmentRubyDefs(source, defs) {
|
|
50916
|
+
const lines = source.split(/\r?\n/);
|
|
50917
|
+
const state = {
|
|
50918
|
+
visibility: "public",
|
|
50919
|
+
stack: [],
|
|
50920
|
+
endLevel: 0,
|
|
50921
|
+
heredocId: null
|
|
50922
|
+
};
|
|
50923
|
+
let offset = 0;
|
|
50924
|
+
for (const line of lines) {
|
|
50925
|
+
const trimmed = line.trim();
|
|
50926
|
+
if (state.heredocId !== null) {
|
|
50927
|
+
if (trimmed === state.heredocId)
|
|
50928
|
+
state.heredocId = null;
|
|
50929
|
+
} else {
|
|
50930
|
+
const open2 = trimmed.match(rubyHeredocOpenRe);
|
|
50931
|
+
if (open2)
|
|
50932
|
+
state.heredocId = open2[1];
|
|
50933
|
+
augmentRubyLine(trimmed, line, offset, source, defs, state);
|
|
50934
|
+
}
|
|
50935
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
50936
|
+
}
|
|
50937
|
+
}
|
|
50938
|
+
function augmentRubyLine(trimmed, line, offset, source, defs, state) {
|
|
50939
|
+
if (trimmed === "private" || trimmed === "protected") {
|
|
50940
|
+
state.visibility = trimmed;
|
|
50941
|
+
}
|
|
50942
|
+
const targeted = trimmed.match(rubyTargetedVisibilityRe);
|
|
50943
|
+
if (targeted) {
|
|
50944
|
+
const visibility = targeted[1];
|
|
50945
|
+
for (const name of targeted[2].split(",").map((part) => part.trim())) {
|
|
50946
|
+
const sym = name.replace(/^:/, "");
|
|
50947
|
+
for (let i = defs.length - 1;i >= 0; i--) {
|
|
50948
|
+
const d = defs[i];
|
|
50949
|
+
if (d.name === sym && d.startLine <= lineNumberAt(source, offset)) {
|
|
50950
|
+
d.exported = false;
|
|
50951
|
+
d.visibilityInfo = symbolVisibilityInfo(visibility, false, "unknown");
|
|
50952
|
+
break;
|
|
50953
|
+
}
|
|
50954
|
+
}
|
|
50955
|
+
}
|
|
50956
|
+
}
|
|
50957
|
+
const moduleMatch = trimmed.match(/^module\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
50958
|
+
const classMatch = trimmed.match(/^class\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
50959
|
+
if (moduleMatch || classMatch) {
|
|
50960
|
+
state.stack.push({
|
|
50961
|
+
visibility: state.visibility,
|
|
50962
|
+
atEndLevel: state.endLevel
|
|
50963
|
+
});
|
|
50964
|
+
state.visibility = "public";
|
|
50965
|
+
state.endLevel++;
|
|
50966
|
+
const name = (moduleMatch ?? classMatch)[1];
|
|
50967
|
+
addRegexDef(defs, source, name, moduleMatch ? "type" : "class", offset + line.indexOf((moduleMatch ?? classMatch)[0]), offset + line.length, "public", true, "module_public");
|
|
50968
|
+
}
|
|
50969
|
+
const constMatch = trimmed.match(/^([A-Z][A-Za-z0-9_]*)\s*=/);
|
|
50970
|
+
if (constMatch) {
|
|
50971
|
+
addRegexDef(defs, source, constMatch[1], "const", offset + line.indexOf(constMatch[1]), offset + line.length, "public", true, "module_public");
|
|
50972
|
+
}
|
|
50973
|
+
const methodMatch = trimmed.match(rubyMethodDefNameRe);
|
|
50974
|
+
if (methodMatch) {
|
|
50975
|
+
state.endLevel++;
|
|
50976
|
+
const isSingleton = Boolean(methodMatch[1]);
|
|
50977
|
+
const shortName = methodMatch[2];
|
|
50978
|
+
const name = isSingleton ? `self.${shortName}` : shortName;
|
|
50979
|
+
const visibility = isSingleton ? "public" : state.visibility;
|
|
50980
|
+
const exported = visibility !== "private" && !shortName.startsWith("_");
|
|
50981
|
+
addRegexDef(defs, source, name, "method", offset + line.indexOf("def"), offset + line.length, visibility, exported, exported ? "module_public" : "unknown");
|
|
50982
|
+
}
|
|
50983
|
+
rubyEndWordRe.lastIndex = 0;
|
|
50984
|
+
const ends = trimmed.match(rubyEndWordRe)?.length ?? 0;
|
|
50985
|
+
if (ends > 0) {
|
|
50986
|
+
state.endLevel -= ends;
|
|
50987
|
+
while (state.stack.length > 0 && state.endLevel <= state.stack[state.stack.length - 1].atEndLevel) {
|
|
50988
|
+
state.visibility = state.stack.pop().visibility;
|
|
50989
|
+
}
|
|
50990
|
+
}
|
|
50991
|
+
}
|
|
50992
|
+
var phpNamespaceRe = /\bnamespace\s+([^;{]+)\s*[;{]/g;
|
|
50993
|
+
var phpTypeRe = /\b(trait|class|interface|enum)\s+([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
50994
|
+
var phpFunctionRe = /\b(?:(public|protected|private|static|final|abstract)\s+){0,6}function\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g;
|
|
50995
|
+
function augmentPhpDefs(source, defs) {
|
|
50996
|
+
const masked = maskCommentsForAugment(source);
|
|
50997
|
+
phpNamespaceRe.lastIndex = 0;
|
|
50998
|
+
for (let m = phpNamespaceRe.exec(masked);m !== null; m = phpNamespaceRe.exec(masked)) {
|
|
50999
|
+
addRegexDef(defs, source, m[1].trim(), "type", m.index, m.index + m[0].length, "public", true, "namespace_public");
|
|
51000
|
+
}
|
|
51001
|
+
const typeRanges = [];
|
|
51002
|
+
phpTypeRe.lastIndex = 0;
|
|
51003
|
+
for (let m = phpTypeRe.exec(masked);m !== null; m = phpTypeRe.exec(masked)) {
|
|
51004
|
+
const bodyStart = masked.indexOf("{", m.index);
|
|
51005
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace(masked, bodyStart);
|
|
51006
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
51007
|
+
typeRanges.push({ start: bodyStart, end: bodyEnd });
|
|
51008
|
+
}
|
|
51009
|
+
addRegexDef(defs, source, m[2], m[1] === "class" ? "class" : m[1] === "enum" ? "enum" : "interface", m.index, declarationEnd(masked, m.index), "public", true, "module_public");
|
|
51010
|
+
}
|
|
51011
|
+
phpFunctionRe.lastIndex = 0;
|
|
51012
|
+
for (let m = phpFunctionRe.exec(masked);m !== null; m = phpFunctionRe.exec(masked)) {
|
|
51013
|
+
const modifiers = m[0].slice(0, m[0].indexOf("function"));
|
|
51014
|
+
const visibility = modifiers.match(/\b(public|protected|private)\b/)?.[1] ?? "public";
|
|
51015
|
+
const exported = visibility !== "private" && !m[2].startsWith("_");
|
|
51016
|
+
const effectiveVisibility = m[2].startsWith("_") ? "private" : visibility;
|
|
51017
|
+
const kind = typeRanges.some((range) => m.index >= range.start && m.index <= range.end) ? "method" : "function";
|
|
51018
|
+
addRegexDef(defs, source, m[2], kind, m.index, declarationEnd(masked, m.index), effectiveVisibility, exported, exported ? "module_public" : "unknown");
|
|
51019
|
+
}
|
|
51020
|
+
}
|
|
51021
|
+
function fallbackImportsForSource(grammarId, source) {
|
|
51022
|
+
const entries = [];
|
|
51023
|
+
if (grammarId !== "dart" && grammarId !== "ruby" && grammarId !== "php") {
|
|
51024
|
+
return entries;
|
|
51025
|
+
}
|
|
51026
|
+
const masked = maskCommentsForAugment(source);
|
|
51027
|
+
const lines = source.split(/\r?\n/);
|
|
51028
|
+
const maskedLines = masked.split(/\r?\n/);
|
|
51029
|
+
let offset = 0;
|
|
51030
|
+
let heredocId = null;
|
|
51031
|
+
let braceDepth = 0;
|
|
51032
|
+
let pending = null;
|
|
51033
|
+
const flushPending = (endLine) => {
|
|
51034
|
+
if (!pending)
|
|
51035
|
+
return;
|
|
51036
|
+
let parsed = null;
|
|
51037
|
+
if (grammarId === "dart")
|
|
51038
|
+
parsed = parseDartImport(pending.text);
|
|
51039
|
+
else if (grammarId === "php")
|
|
51040
|
+
parsed = parsePhpUse(pending.text);
|
|
51041
|
+
for (const entry of parsed ? Array.isArray(parsed) ? parsed : [parsed] : []) {
|
|
51042
|
+
entries.push({
|
|
51043
|
+
index: pending.startOffset,
|
|
51044
|
+
entry: { ...entry, startLine: pending.startLine, endLine }
|
|
51045
|
+
});
|
|
51046
|
+
}
|
|
51047
|
+
pending = null;
|
|
51048
|
+
};
|
|
51049
|
+
for (let li = 0;li < lines.length; li++) {
|
|
51050
|
+
const line = lines[li];
|
|
51051
|
+
const trimmed = line.trim();
|
|
51052
|
+
const maskedTrimmed = maskedLines[li]?.trim() ?? "";
|
|
51053
|
+
const startLine = lineNumberAt(source, offset);
|
|
51054
|
+
if (grammarId === "ruby") {
|
|
51055
|
+
if (heredocId !== null) {
|
|
51056
|
+
if (maskedTrimmed === heredocId)
|
|
51057
|
+
heredocId = null;
|
|
51058
|
+
} else {
|
|
51059
|
+
const open2 = maskedTrimmed.match(rubyHeredocOpenRe);
|
|
51060
|
+
if (open2)
|
|
51061
|
+
heredocId = open2[1];
|
|
51062
|
+
else {
|
|
51063
|
+
const parsed = parseRubyRequire(trimmed);
|
|
51064
|
+
if (parsed) {
|
|
51065
|
+
entries.push({
|
|
51066
|
+
index: offset,
|
|
51067
|
+
entry: { ...parsed, startLine, endLine: startLine }
|
|
51068
|
+
});
|
|
51069
|
+
}
|
|
51070
|
+
}
|
|
51071
|
+
}
|
|
51072
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51073
|
+
continue;
|
|
51074
|
+
}
|
|
51075
|
+
if (grammarId === "php") {
|
|
51076
|
+
for (const ch of maskedLines[li] ?? "") {
|
|
51077
|
+
if (ch === "{")
|
|
51078
|
+
braceDepth++;
|
|
51079
|
+
else if (ch === "}")
|
|
51080
|
+
braceDepth = Math.max(0, braceDepth - 1);
|
|
51081
|
+
}
|
|
51082
|
+
}
|
|
51083
|
+
if (pending) {
|
|
51084
|
+
pending.text += ` ${trimmed}`;
|
|
51085
|
+
pending.lines++;
|
|
51086
|
+
if (trimmed.includes(";") || pending.lines > 10) {
|
|
51087
|
+
flushPending(startLine);
|
|
51088
|
+
} else if (trimmed === "") {
|
|
51089
|
+
pending = null;
|
|
51090
|
+
}
|
|
51091
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51092
|
+
continue;
|
|
51093
|
+
}
|
|
51094
|
+
const startsStatement = grammarId === "dart" ? /^(import|export)\s/.test(maskedTrimmed) : /^use\s/.test(maskedTrimmed);
|
|
51095
|
+
const inClassBody = grammarId === "php" && braceDepth > 0;
|
|
51096
|
+
if (startsStatement && !inClassBody) {
|
|
51097
|
+
if (trimmed.includes(";")) {
|
|
51098
|
+
let parsed = null;
|
|
51099
|
+
if (grammarId === "dart")
|
|
51100
|
+
parsed = parseDartImport(trimmed);
|
|
51101
|
+
else if (grammarId === "php")
|
|
51102
|
+
parsed = parsePhpUse(trimmed);
|
|
51103
|
+
for (const entry of parsed ? Array.isArray(parsed) ? parsed : [parsed] : []) {
|
|
51104
|
+
entries.push({
|
|
51105
|
+
index: offset,
|
|
51106
|
+
entry: { ...entry, startLine, endLine: startLine }
|
|
51107
|
+
});
|
|
51108
|
+
}
|
|
51109
|
+
} else {
|
|
51110
|
+
pending = { startOffset: offset, startLine, text: trimmed, lines: 1 };
|
|
51111
|
+
}
|
|
51112
|
+
}
|
|
51113
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51114
|
+
}
|
|
51115
|
+
flushPending(lineNumberAt(source, offset));
|
|
51116
|
+
return entries;
|
|
50702
51117
|
}
|
|
50703
51118
|
function safeMatches(lang, pattern, root) {
|
|
50704
51119
|
if (!_QueryCtor)
|
|
@@ -51152,28 +51567,52 @@ function parseSwiftImport(text) {
|
|
|
51152
51567
|
}
|
|
51153
51568
|
function parseDartImport(text) {
|
|
51154
51569
|
const t = text.trim();
|
|
51155
|
-
const
|
|
51156
|
-
if (
|
|
51570
|
+
const exportMatch = t.match(/^export\s+['"]([^'"]+)['"](?:\s+show\s+([^;]+))?/);
|
|
51571
|
+
if (exportMatch) {
|
|
51572
|
+
const shown = exportMatch[2]?.split(",").map((part) => part.trim()).filter(Boolean);
|
|
51573
|
+
const bindings = shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : [{ imported: "*", local: "*" }];
|
|
51157
51574
|
return {
|
|
51158
|
-
specifier:
|
|
51159
|
-
importType: "named",
|
|
51160
|
-
bindings
|
|
51575
|
+
specifier: exportMatch[1],
|
|
51576
|
+
importType: shown && shown.length > 0 ? "named" : "namespace",
|
|
51577
|
+
bindings,
|
|
51578
|
+
reExport: true,
|
|
51579
|
+
exportedBindings: bindings.map((binding) => ({
|
|
51580
|
+
imported: binding.imported,
|
|
51581
|
+
exported: binding.local
|
|
51582
|
+
}))
|
|
51161
51583
|
};
|
|
51162
51584
|
}
|
|
51163
|
-
const
|
|
51164
|
-
if (
|
|
51165
|
-
|
|
51585
|
+
const importMatch = t.match(/^import\s+['"]([^'"]+)['"]([^;]*)/);
|
|
51586
|
+
if (importMatch) {
|
|
51587
|
+
const clause = importMatch[2];
|
|
51588
|
+
const alias = clause?.match(/\bas\s+\w+/);
|
|
51589
|
+
const shown = clause?.match(/\bshow\s+([^;]+)/)?.[1].split(",").map((part) => part.trim()).filter(Boolean);
|
|
51590
|
+
const primary = {
|
|
51591
|
+
specifier: importMatch[1],
|
|
51592
|
+
importType: !alias && shown && shown.length > 0 ? "named" : "namespace",
|
|
51593
|
+
bindings: !alias && shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : []
|
|
51594
|
+
};
|
|
51595
|
+
const conditional = clause?.match(/\bif\s*\([^)]*\)\s*['"]([^'"]+)['"]/);
|
|
51596
|
+
if (conditional) {
|
|
51597
|
+
return [
|
|
51598
|
+
primary,
|
|
51599
|
+
{ specifier: conditional[1], importType: "namespace", bindings: [] }
|
|
51600
|
+
];
|
|
51601
|
+
}
|
|
51602
|
+
return primary;
|
|
51166
51603
|
}
|
|
51167
51604
|
return null;
|
|
51168
51605
|
}
|
|
51169
51606
|
function parseRubyRequire(text) {
|
|
51170
51607
|
const t = text.trim();
|
|
51608
|
+
const isRequireRelative = /^require_relative\b/.test(t);
|
|
51171
51609
|
const stripped = t.replace(/^(?:require(?:_relative)?)\s+['"]?/, "").replace(/['"]$/, "");
|
|
51172
51610
|
if (!stripped || stripped === t)
|
|
51173
51611
|
return null;
|
|
51174
|
-
const
|
|
51612
|
+
const specifier = isRequireRelative && !stripped.startsWith(".") ? `./${stripped}` : stripped;
|
|
51613
|
+
const isRelative = specifier.startsWith("./") || specifier.startsWith("../");
|
|
51175
51614
|
return {
|
|
51176
|
-
specifier
|
|
51615
|
+
specifier,
|
|
51177
51616
|
importType: isRelative ? "default" : "namespace",
|
|
51178
51617
|
bindings: []
|
|
51179
51618
|
};
|
|
@@ -51185,7 +51624,7 @@ function parsePhpUse(text) {
|
|
|
51185
51624
|
return {
|
|
51186
51625
|
specifier: m[1],
|
|
51187
51626
|
importType: "named",
|
|
51188
|
-
bindings: [{ imported: m[1], local: m[2] }]
|
|
51627
|
+
bindings: [{ imported: m[1].split("\\").pop() ?? m[1], local: m[2] }]
|
|
51189
51628
|
};
|
|
51190
51629
|
}
|
|
51191
51630
|
const simple = t.match(/^use\s+(?:(?:function|const)\s+)?([^;\s]+)\s*;?\s*$/i);
|
|
@@ -51261,7 +51700,10 @@ var IMPORT_ANCESTOR_TYPES = new Set([
|
|
|
51261
51700
|
"use_declaration",
|
|
51262
51701
|
"using_directive",
|
|
51263
51702
|
"namespace_use_declaration",
|
|
51264
|
-
"
|
|
51703
|
+
"namespace_use_clause",
|
|
51704
|
+
"library_import",
|
|
51705
|
+
"library_export",
|
|
51706
|
+
"export_directive"
|
|
51265
51707
|
]);
|
|
51266
51708
|
function isInsideImportStatement(node) {
|
|
51267
51709
|
return hasAncestorOfType(node, IMPORT_ANCESTOR_TYPES);
|
|
@@ -51308,7 +51750,13 @@ var SYMBOL_EXTENSIONS = new Set([
|
|
|
51308
51750
|
".py",
|
|
51309
51751
|
".pyw",
|
|
51310
51752
|
".rs",
|
|
51311
|
-
".go"
|
|
51753
|
+
".go",
|
|
51754
|
+
".dart",
|
|
51755
|
+
".rb",
|
|
51756
|
+
".rake",
|
|
51757
|
+
".gemspec",
|
|
51758
|
+
".php",
|
|
51759
|
+
".phtml"
|
|
51312
51760
|
]);
|
|
51313
51761
|
var SKIP_DIRECTORIES = new Set([
|
|
51314
51762
|
"node_modules",
|
|
@@ -51735,6 +52183,346 @@ function extractGoSymbols(filePath, cwd) {
|
|
|
51735
52183
|
return a.name.localeCompare(b.name);
|
|
51736
52184
|
});
|
|
51737
52185
|
}
|
|
52186
|
+
var memoSource = null;
|
|
52187
|
+
var memoStarts = [0];
|
|
52188
|
+
function lineStartsOf(content) {
|
|
52189
|
+
if (memoSource !== content) {
|
|
52190
|
+
const starts = [0];
|
|
52191
|
+
for (let i = 0;i < content.length; i++) {
|
|
52192
|
+
if (content[i] === `
|
|
52193
|
+
`)
|
|
52194
|
+
starts.push(i + 1);
|
|
52195
|
+
}
|
|
52196
|
+
memoSource = content;
|
|
52197
|
+
memoStarts = starts;
|
|
52198
|
+
}
|
|
52199
|
+
return memoStarts;
|
|
52200
|
+
}
|
|
52201
|
+
function lineNumberAt2(content, index) {
|
|
52202
|
+
const starts = lineStartsOf(content);
|
|
52203
|
+
let lo = 0;
|
|
52204
|
+
let hi = starts.length - 1;
|
|
52205
|
+
while (lo < hi) {
|
|
52206
|
+
const mid = lo + hi + 1 >> 1;
|
|
52207
|
+
if (starts[mid] <= index)
|
|
52208
|
+
lo = mid;
|
|
52209
|
+
else
|
|
52210
|
+
hi = mid - 1;
|
|
52211
|
+
}
|
|
52212
|
+
return lo + 1;
|
|
52213
|
+
}
|
|
52214
|
+
function advanceLineOffset2(source, offset, lineLength) {
|
|
52215
|
+
const after = offset + lineLength;
|
|
52216
|
+
if (source[after] === "\r" && source[after + 1] === `
|
|
52217
|
+
`)
|
|
52218
|
+
return after + 2;
|
|
52219
|
+
if (source[after] === `
|
|
52220
|
+
` || source[after] === "\r")
|
|
52221
|
+
return after + 1;
|
|
52222
|
+
return after;
|
|
52223
|
+
}
|
|
52224
|
+
function lineTextAt(content, index) {
|
|
52225
|
+
const lineStart = content.lastIndexOf(`
|
|
52226
|
+
`, Math.max(0, index - 1)) + 1;
|
|
52227
|
+
const lineEnd = content.indexOf(`
|
|
52228
|
+
`, lineStart);
|
|
52229
|
+
return content.substring(lineStart, lineEnd === -1 ? content.length : lineEnd).trim().substring(0, 120);
|
|
52230
|
+
}
|
|
52231
|
+
function findMatchingBrace2(content, openIndex) {
|
|
52232
|
+
if (content[openIndex] !== "{")
|
|
52233
|
+
return null;
|
|
52234
|
+
let depth = 0;
|
|
52235
|
+
for (let i = openIndex;i < content.length; i++) {
|
|
52236
|
+
const ch = content[i];
|
|
52237
|
+
if (ch === "{")
|
|
52238
|
+
depth++;
|
|
52239
|
+
else if (ch === "}") {
|
|
52240
|
+
depth--;
|
|
52241
|
+
if (depth === 0)
|
|
52242
|
+
return i;
|
|
52243
|
+
}
|
|
52244
|
+
}
|
|
52245
|
+
return null;
|
|
52246
|
+
}
|
|
52247
|
+
function stripLineCommentsForScan(content) {
|
|
52248
|
+
let out = "";
|
|
52249
|
+
let inBlock = false;
|
|
52250
|
+
let quote = null;
|
|
52251
|
+
for (let i = 0;i < content.length; i++) {
|
|
52252
|
+
const ch = content[i];
|
|
52253
|
+
const two = content.substring(i, i + 2);
|
|
52254
|
+
if (quote !== null) {
|
|
52255
|
+
if (ch === "\\") {
|
|
52256
|
+
out += " ";
|
|
52257
|
+
i++;
|
|
52258
|
+
continue;
|
|
52259
|
+
}
|
|
52260
|
+
if (ch === quote) {
|
|
52261
|
+
quote = null;
|
|
52262
|
+
out += ch;
|
|
52263
|
+
} else {
|
|
52264
|
+
out += ch === `
|
|
52265
|
+
` ? `
|
|
52266
|
+
` : " ";
|
|
52267
|
+
}
|
|
52268
|
+
continue;
|
|
52269
|
+
}
|
|
52270
|
+
if (!inBlock && two === "/*") {
|
|
52271
|
+
inBlock = true;
|
|
52272
|
+
out += " ";
|
|
52273
|
+
i++;
|
|
52274
|
+
continue;
|
|
52275
|
+
}
|
|
52276
|
+
if (inBlock) {
|
|
52277
|
+
if (two === "*/") {
|
|
52278
|
+
inBlock = false;
|
|
52279
|
+
out += " ";
|
|
52280
|
+
i++;
|
|
52281
|
+
} else {
|
|
52282
|
+
out += ch === `
|
|
52283
|
+
` ? `
|
|
52284
|
+
` : " ";
|
|
52285
|
+
}
|
|
52286
|
+
continue;
|
|
52287
|
+
}
|
|
52288
|
+
if (two === "//" || ch === "#") {
|
|
52289
|
+
out += two === "//" ? " " : " ";
|
|
52290
|
+
if (two === "//")
|
|
52291
|
+
i++;
|
|
52292
|
+
while (i + 1 < content.length && content[i + 1] !== `
|
|
52293
|
+
`) {
|
|
52294
|
+
out += " ";
|
|
52295
|
+
i++;
|
|
52296
|
+
}
|
|
52297
|
+
continue;
|
|
52298
|
+
}
|
|
52299
|
+
if (ch === '"' || ch === "'") {
|
|
52300
|
+
if (ch === content[i + 1] && ch === content[i + 2]) {
|
|
52301
|
+
out += ch + ch + ch;
|
|
52302
|
+
i += 2;
|
|
52303
|
+
while (i + 1 < content.length) {
|
|
52304
|
+
if (content[i + 1] === ch && content[i + 2] === ch && content[i + 3] === ch) {
|
|
52305
|
+
out += ch + ch + ch;
|
|
52306
|
+
i += 3;
|
|
52307
|
+
break;
|
|
52308
|
+
}
|
|
52309
|
+
out += content[i + 1] === `
|
|
52310
|
+
` ? `
|
|
52311
|
+
` : " ";
|
|
52312
|
+
i++;
|
|
52313
|
+
}
|
|
52314
|
+
continue;
|
|
52315
|
+
}
|
|
52316
|
+
quote = ch;
|
|
52317
|
+
out += ch;
|
|
52318
|
+
continue;
|
|
52319
|
+
}
|
|
52320
|
+
out += ch;
|
|
52321
|
+
}
|
|
52322
|
+
return out;
|
|
52323
|
+
}
|
|
52324
|
+
function addUniqueSymbol(symbols, seen, candidate) {
|
|
52325
|
+
const key = `${candidate.name}:${candidate.kind}`;
|
|
52326
|
+
if (seen.has(key))
|
|
52327
|
+
return;
|
|
52328
|
+
seen.add(key);
|
|
52329
|
+
symbols.push(candidate);
|
|
52330
|
+
}
|
|
52331
|
+
function sortSymbols(symbols) {
|
|
52332
|
+
return symbols.sort((a, b) => {
|
|
52333
|
+
if (a.line !== b.line)
|
|
52334
|
+
return a.line - b.line;
|
|
52335
|
+
return a.name.localeCompare(b.name);
|
|
52336
|
+
});
|
|
52337
|
+
}
|
|
52338
|
+
function extractDartSymbols(filePath, cwd) {
|
|
52339
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52340
|
+
if (raw === null)
|
|
52341
|
+
return [];
|
|
52342
|
+
const content = stripLineCommentsForScan(raw);
|
|
52343
|
+
const symbols = [];
|
|
52344
|
+
const seen = new Set;
|
|
52345
|
+
const typeBodies = [];
|
|
52346
|
+
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)) {
|
|
52347
|
+
const kindWord = match[1].trim().split(/\s+/).pop() ?? match[1];
|
|
52348
|
+
const kind = kindWord === "enum" ? "enum" : kindWord === "class" ? "class" : "type";
|
|
52349
|
+
const bodyStart = content.indexOf("{", match.index);
|
|
52350
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace2(content, bodyStart);
|
|
52351
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
52352
|
+
typeBodies.push({ start: bodyStart, end: bodyEnd, name: match[2] });
|
|
52353
|
+
}
|
|
52354
|
+
addUniqueSymbol(symbols, seen, {
|
|
52355
|
+
name: match[2],
|
|
52356
|
+
kind,
|
|
52357
|
+
exported: !match[2].startsWith("_"),
|
|
52358
|
+
signature: lineTextAt(raw, match.index),
|
|
52359
|
+
line: lineNumberAt2(raw, match.index)
|
|
52360
|
+
});
|
|
52361
|
+
}
|
|
52362
|
+
const dartFunctionRe = /\b(?:void|[A-Za-z_][A-Za-z0-9_<>,?]*)\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g;
|
|
52363
|
+
const KEYWORD_NAME_SKIP = new Set([
|
|
52364
|
+
"if",
|
|
52365
|
+
"for",
|
|
52366
|
+
"while",
|
|
52367
|
+
"switch",
|
|
52368
|
+
"return",
|
|
52369
|
+
"else",
|
|
52370
|
+
"throw",
|
|
52371
|
+
"new",
|
|
52372
|
+
"await",
|
|
52373
|
+
"yield",
|
|
52374
|
+
"case",
|
|
52375
|
+
"catch",
|
|
52376
|
+
"Function"
|
|
52377
|
+
]);
|
|
52378
|
+
const KEYWORD_TYPE_SKIP = new Set([
|
|
52379
|
+
"return",
|
|
52380
|
+
"else",
|
|
52381
|
+
"throw",
|
|
52382
|
+
"new",
|
|
52383
|
+
"await",
|
|
52384
|
+
"yield",
|
|
52385
|
+
"case",
|
|
52386
|
+
"catch",
|
|
52387
|
+
"final",
|
|
52388
|
+
"const"
|
|
52389
|
+
]);
|
|
52390
|
+
for (const match of content.matchAll(dartFunctionRe)) {
|
|
52391
|
+
if (KEYWORD_NAME_SKIP.has(match[1]))
|
|
52392
|
+
continue;
|
|
52393
|
+
if (KEYWORD_TYPE_SKIP.has(match[0].split(/\s+/)[0]))
|
|
52394
|
+
continue;
|
|
52395
|
+
const enclosing = typeBodies.find((body) => match.index >= body.start && match.index <= body.end);
|
|
52396
|
+
addUniqueSymbol(symbols, seen, {
|
|
52397
|
+
name: enclosing ? `${enclosing.name}.${match[1]}` : match[1],
|
|
52398
|
+
kind: enclosing ? "method" : "function",
|
|
52399
|
+
exported: !match[1].startsWith("_"),
|
|
52400
|
+
signature: lineTextAt(raw, match.index),
|
|
52401
|
+
line: lineNumberAt2(raw, match.index)
|
|
52402
|
+
});
|
|
52403
|
+
}
|
|
52404
|
+
return sortSymbols(symbols);
|
|
52405
|
+
}
|
|
52406
|
+
function extractRubySymbols(filePath, cwd) {
|
|
52407
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52408
|
+
if (raw === null)
|
|
52409
|
+
return [];
|
|
52410
|
+
const symbols = [];
|
|
52411
|
+
const seen = new Set;
|
|
52412
|
+
const byName = new Map;
|
|
52413
|
+
let offset = 0;
|
|
52414
|
+
let currentVisibility = "public";
|
|
52415
|
+
const visibilityStack = [];
|
|
52416
|
+
let endLevel = 0;
|
|
52417
|
+
let heredocId = null;
|
|
52418
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
52419
|
+
const trimmed = line.trim();
|
|
52420
|
+
if (heredocId !== null) {
|
|
52421
|
+
if (trimmed === heredocId)
|
|
52422
|
+
heredocId = null;
|
|
52423
|
+
} else {
|
|
52424
|
+
const open2 = trimmed.match(/(?:^|[=(,[]\s*|(?:puts|print|raise|return|p)\s+)<<[~-]?['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/);
|
|
52425
|
+
if (open2)
|
|
52426
|
+
heredocId = open2[1];
|
|
52427
|
+
if (trimmed === "private" || trimmed === "protected") {
|
|
52428
|
+
currentVisibility = trimmed;
|
|
52429
|
+
}
|
|
52430
|
+
const targeted = trimmed.match(/^(private|protected)\s+((?::[A-Za-z_][A-Za-z0-9_?!]*\s*,\s*)*:[A-Za-z_][A-Za-z0-9_?!]*)$/);
|
|
52431
|
+
if (targeted) {
|
|
52432
|
+
for (const part of targeted[2].split(",")) {
|
|
52433
|
+
const sym = byName.get(part.trim().replace(/^:/, ""));
|
|
52434
|
+
if (sym) {
|
|
52435
|
+
sym.exported = false;
|
|
52436
|
+
}
|
|
52437
|
+
}
|
|
52438
|
+
}
|
|
52439
|
+
const moduleMatch = trimmed.match(/^module\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
52440
|
+
const classMatch = trimmed.match(/^class\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
52441
|
+
if (moduleMatch || classMatch) {
|
|
52442
|
+
visibilityStack.push({
|
|
52443
|
+
visibility: currentVisibility,
|
|
52444
|
+
atEndLevel: endLevel
|
|
52445
|
+
});
|
|
52446
|
+
currentVisibility = "public";
|
|
52447
|
+
endLevel++;
|
|
52448
|
+
}
|
|
52449
|
+
const constMatch = trimmed.match(/^([A-Z][A-Za-z0-9_]*)\s*=/);
|
|
52450
|
+
const methodMatch = trimmed.match(/^def\s+(?:(self)\.)?([A-Za-z_][A-Za-z0-9_?!]*)/);
|
|
52451
|
+
if (methodMatch)
|
|
52452
|
+
endLevel++;
|
|
52453
|
+
const lineIndex = offset + Math.max(0, line.indexOf(trimmed));
|
|
52454
|
+
if (moduleMatch || classMatch || constMatch || methodMatch) {
|
|
52455
|
+
const singleton = Boolean(methodMatch?.[1]);
|
|
52456
|
+
const shortName = methodMatch?.[2];
|
|
52457
|
+
const name = moduleMatch?.[1] ?? classMatch?.[1] ?? constMatch?.[1] ?? (singleton && shortName ? `self.${shortName}` : shortName);
|
|
52458
|
+
const visibility = singleton ? "public" : currentVisibility;
|
|
52459
|
+
const candidate = {
|
|
52460
|
+
name,
|
|
52461
|
+
kind: moduleMatch ? "type" : classMatch ? "class" : constMatch ? "const" : "method",
|
|
52462
|
+
exported: methodMatch ? visibility !== "private" && !(shortName ?? "").startsWith("_") : true,
|
|
52463
|
+
signature: trimmed.substring(0, 100),
|
|
52464
|
+
line: lineNumberAt2(raw, lineIndex)
|
|
52465
|
+
};
|
|
52466
|
+
addUniqueSymbol(symbols, seen, candidate);
|
|
52467
|
+
byName.set(name, candidate);
|
|
52468
|
+
}
|
|
52469
|
+
const ends = trimmed.match(/\bend\b/g)?.length ?? 0;
|
|
52470
|
+
if (ends > 0) {
|
|
52471
|
+
endLevel -= ends;
|
|
52472
|
+
while (visibilityStack.length > 0 && endLevel <= visibilityStack[visibilityStack.length - 1].atEndLevel) {
|
|
52473
|
+
currentVisibility = visibilityStack.pop().visibility;
|
|
52474
|
+
}
|
|
52475
|
+
}
|
|
52476
|
+
}
|
|
52477
|
+
offset = advanceLineOffset2(raw, offset, line.length);
|
|
52478
|
+
}
|
|
52479
|
+
return sortSymbols(symbols);
|
|
52480
|
+
}
|
|
52481
|
+
function extractPhpSymbols(filePath, cwd) {
|
|
52482
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52483
|
+
if (raw === null)
|
|
52484
|
+
return [];
|
|
52485
|
+
const content = stripLineCommentsForScan(raw);
|
|
52486
|
+
const symbols = [];
|
|
52487
|
+
const seen = new Set;
|
|
52488
|
+
const typeRanges = [];
|
|
52489
|
+
for (const match of content.matchAll(/\bnamespace\s+([A-Za-z_\\][A-Za-z0-9_\\]*)\s*[;{]/g)) {
|
|
52490
|
+
addUniqueSymbol(symbols, seen, {
|
|
52491
|
+
name: match[1],
|
|
52492
|
+
kind: "type",
|
|
52493
|
+
exported: true,
|
|
52494
|
+
signature: lineTextAt(raw, match.index),
|
|
52495
|
+
line: lineNumberAt2(raw, match.index)
|
|
52496
|
+
});
|
|
52497
|
+
}
|
|
52498
|
+
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)) {
|
|
52499
|
+
const bodyStart = content.indexOf("{", match.index);
|
|
52500
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace2(content, bodyStart);
|
|
52501
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
52502
|
+
typeRanges.push({ start: bodyStart, end: bodyEnd });
|
|
52503
|
+
}
|
|
52504
|
+
addUniqueSymbol(symbols, seen, {
|
|
52505
|
+
name: match[2],
|
|
52506
|
+
kind: match[1] === "class" ? "class" : match[1] === "enum" ? "enum" : "interface",
|
|
52507
|
+
exported: !match[2].startsWith("_"),
|
|
52508
|
+
signature: lineTextAt(raw, match.index),
|
|
52509
|
+
line: lineNumberAt2(raw, match.index)
|
|
52510
|
+
});
|
|
52511
|
+
}
|
|
52512
|
+
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)) {
|
|
52513
|
+
const insideType = typeRanges.some((range) => match.index >= range.start && match.index <= range.end);
|
|
52514
|
+
const modifiers = match[0].slice(0, match[0].indexOf("function"));
|
|
52515
|
+
const visibility = modifiers.match(/\b(public|protected|private)\b/)?.[1];
|
|
52516
|
+
addUniqueSymbol(symbols, seen, {
|
|
52517
|
+
name: match[2],
|
|
52518
|
+
kind: insideType ? "method" : "function",
|
|
52519
|
+
exported: visibility !== "private" && !match[2].startsWith("_"),
|
|
52520
|
+
signature: lineTextAt(raw, match.index),
|
|
52521
|
+
line: lineNumberAt2(raw, match.index)
|
|
52522
|
+
});
|
|
52523
|
+
}
|
|
52524
|
+
return sortSymbols(symbols);
|
|
52525
|
+
}
|
|
51738
52526
|
function findSourceFiles(cwd, maxFiles) {
|
|
51739
52527
|
const files = [];
|
|
51740
52528
|
walkDir(cwd, cwd, files, maxFiles);
|
|
@@ -51798,6 +52586,18 @@ function searchWorkspaceSymbols(cwd, name, exportedOnly = true) {
|
|
|
51798
52586
|
case ".go":
|
|
51799
52587
|
syms = extractGoSymbols(relFile, cwd);
|
|
51800
52588
|
break;
|
|
52589
|
+
case ".dart":
|
|
52590
|
+
syms = _internals65.extractDartSymbols(relFile, cwd);
|
|
52591
|
+
break;
|
|
52592
|
+
case ".rb":
|
|
52593
|
+
case ".rake":
|
|
52594
|
+
case ".gemspec":
|
|
52595
|
+
syms = _internals65.extractRubySymbols(relFile, cwd);
|
|
52596
|
+
break;
|
|
52597
|
+
case ".php":
|
|
52598
|
+
case ".phtml":
|
|
52599
|
+
syms = _internals65.extractPhpSymbols(relFile, cwd);
|
|
52600
|
+
break;
|
|
51801
52601
|
default:
|
|
51802
52602
|
continue;
|
|
51803
52603
|
}
|
|
@@ -51836,7 +52636,7 @@ function searchWorkspaceSymbols(cwd, name, exportedOnly = true) {
|
|
|
51836
52636
|
};
|
|
51837
52637
|
}
|
|
51838
52638
|
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
|
|
52639
|
+
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
52640
|
args: {
|
|
51841
52641
|
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
52642
|
exported_only: exports_external.boolean().default(true).describe("If true, only return exported/public symbols. If false, include all top-level symbols."),
|
|
@@ -51920,10 +52720,22 @@ var symbols = createSwarmTool({
|
|
|
51920
52720
|
case ".go":
|
|
51921
52721
|
syms = extractGoSymbols(file, cwd);
|
|
51922
52722
|
break;
|
|
52723
|
+
case ".dart":
|
|
52724
|
+
syms = _internals65.extractDartSymbols(file, cwd);
|
|
52725
|
+
break;
|
|
52726
|
+
case ".rb":
|
|
52727
|
+
case ".rake":
|
|
52728
|
+
case ".gemspec":
|
|
52729
|
+
syms = _internals65.extractRubySymbols(file, cwd);
|
|
52730
|
+
break;
|
|
52731
|
+
case ".php":
|
|
52732
|
+
case ".phtml":
|
|
52733
|
+
syms = _internals65.extractPhpSymbols(file, cwd);
|
|
52734
|
+
break;
|
|
51923
52735
|
default:
|
|
51924
52736
|
return JSON.stringify({
|
|
51925
52737
|
file,
|
|
51926
|
-
error: `Unsupported file extension: ${ext}. Supported: .ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .pyw, .rs, .go`,
|
|
52738
|
+
error: `Unsupported file extension: ${ext}. Supported: .ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .pyw, .rs, .go, .dart, .rb, .rake, .gemspec, .php, .phtml`,
|
|
51927
52739
|
symbols: []
|
|
51928
52740
|
}, null, 2);
|
|
51929
52741
|
}
|
|
@@ -51940,6 +52752,11 @@ var symbols = createSwarmTool({
|
|
|
51940
52752
|
}, null, 2);
|
|
51941
52753
|
}
|
|
51942
52754
|
});
|
|
52755
|
+
var _internals65 = {
|
|
52756
|
+
extractDartSymbols,
|
|
52757
|
+
extractRubySymbols,
|
|
52758
|
+
extractPhpSymbols
|
|
52759
|
+
};
|
|
51943
52760
|
|
|
51944
52761
|
// src/tools/repo-graph/ontology.ts
|
|
51945
52762
|
import * as path73 from "path";
|
|
@@ -52541,14 +53358,20 @@ var ONTOLOGY_FINDING_SEVERITY_SET = new Set(ONTOLOGY_FINDING_SEVERITY_VALUES);
|
|
|
52541
53358
|
var IMPORT_TYPE_SET = new Set(IMPORT_TYPE_VALUES);
|
|
52542
53359
|
|
|
52543
53360
|
// src/tools/repo-graph/builder.ts
|
|
52544
|
-
var
|
|
53361
|
+
var _internals66 = {
|
|
52545
53362
|
now: Date.now,
|
|
52546
53363
|
safeRealpathSync,
|
|
52547
53364
|
extractTSSymbols,
|
|
52548
53365
|
extractPythonSymbols,
|
|
52549
53366
|
extractRustSymbols,
|
|
52550
53367
|
extractGoSymbols,
|
|
53368
|
+
extractDartSymbols,
|
|
53369
|
+
extractRubySymbols,
|
|
53370
|
+
extractPhpSymbols,
|
|
52551
53371
|
parseFileImports,
|
|
53372
|
+
parseDartFileImports,
|
|
53373
|
+
parseRubyFileImports,
|
|
53374
|
+
parsePhpFileImports,
|
|
52552
53375
|
extractFileOntology,
|
|
52553
53376
|
stripComments: stripComments2,
|
|
52554
53377
|
computeUsedSymbols,
|
|
@@ -52706,6 +53529,15 @@ function parseFileImports(rawContent, sourceFile, workspaceRoot) {
|
|
|
52706
53529
|
if (ext === ".cs" || ext === ".csx") {
|
|
52707
53530
|
return parseCSharpFileImports(rawContent);
|
|
52708
53531
|
}
|
|
53532
|
+
if (ext === ".dart") {
|
|
53533
|
+
return parseDartFileImports(rawContent);
|
|
53534
|
+
}
|
|
53535
|
+
if (ext === ".rb" || ext === ".rake" || ext === ".gemspec") {
|
|
53536
|
+
return parseRubyFileImports(rawContent);
|
|
53537
|
+
}
|
|
53538
|
+
if (ext === ".php" || ext === ".phtml" || sourceFile?.endsWith(".blade.php")) {
|
|
53539
|
+
return parsePhpFileImports(rawContent);
|
|
53540
|
+
}
|
|
52709
53541
|
const imports = [];
|
|
52710
53542
|
const content = stripComments2(rawContent);
|
|
52711
53543
|
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 +53651,41 @@ function parseCSharpFileImports(rawContent) {
|
|
|
52819
53651
|
}
|
|
52820
53652
|
return imports;
|
|
52821
53653
|
}
|
|
53654
|
+
function parseDartFileImports(rawContent) {
|
|
53655
|
+
const imports = [];
|
|
53656
|
+
for (const match of rawContent.matchAll(/^[ \t]*(import|export)[ \t]+['"]([^'"]+)['"]([^;]*)/gm)) {
|
|
53657
|
+
const clause = match[3];
|
|
53658
|
+
const shown = clause?.match(/\bshow\s+([^;]+)/)?.[1].split(",").map((part) => part.trim()).filter(Boolean);
|
|
53659
|
+
const alias = clause?.match(/\bas\s+\w+/);
|
|
53660
|
+
const bindings = !alias && shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : [];
|
|
53661
|
+
const parsed = makeParsedImport(match[2], bindings.length > 0 ? "named" : "namespace", bindings, match[1] === "export");
|
|
53662
|
+
if (parsed)
|
|
53663
|
+
imports.push(parsed);
|
|
53664
|
+
}
|
|
53665
|
+
return imports;
|
|
53666
|
+
}
|
|
53667
|
+
function parseRubyFileImports(rawContent) {
|
|
53668
|
+
const imports = [];
|
|
53669
|
+
for (const match of rawContent.matchAll(/^[ \t]*(require_relative|require)[ \t]+['"]([^'"]+)['"]/gm)) {
|
|
53670
|
+
const relative10 = match[1] === "require_relative";
|
|
53671
|
+
const specifier = relative10 && !match[2].startsWith(".") ? `./${match[2]}` : match[2];
|
|
53672
|
+
const parsed = makeParsedImport(specifier, relative10 ? "default" : "namespace", []);
|
|
53673
|
+
if (parsed)
|
|
53674
|
+
imports.push(parsed);
|
|
53675
|
+
}
|
|
53676
|
+
return imports;
|
|
53677
|
+
}
|
|
53678
|
+
function parsePhpFileImports(rawContent) {
|
|
53679
|
+
const imports = [];
|
|
53680
|
+
for (const match of rawContent.matchAll(/^[ \t]*use[ \t]+(?:(?:function|const)[ \t]+)?([^;\s]+)(?:[ \t]+as[ \t]+(\w+))?[ \t]*;?[ \t]*\r?$/gim)) {
|
|
53681
|
+
const imported = match[1].split("\\").pop() ?? match[1];
|
|
53682
|
+
const bindings = match[2] ? [{ imported, local: match[2] }] : [];
|
|
53683
|
+
const parsed = makeParsedImport(match[1], bindings.length > 0 ? "named" : "namespace", bindings);
|
|
53684
|
+
if (parsed)
|
|
53685
|
+
imports.push(parsed);
|
|
53686
|
+
}
|
|
53687
|
+
return imports;
|
|
53688
|
+
}
|
|
52822
53689
|
function parsePythonFileImports(rawContent, sourceFile) {
|
|
52823
53690
|
const imports = [];
|
|
52824
53691
|
const isPackageInit = sourceFile ? ["__init__.py", "__init__.pyw"].includes(path74.basename(sourceFile)) : false;
|
|
@@ -53090,7 +53957,7 @@ function recordManifestDir(manifestDirs, absoluteRoot, dir, entryName) {
|
|
|
53090
53957
|
function isWalkBudgetExceeded(ctx) {
|
|
53091
53958
|
if (ctx.abortReason !== undefined)
|
|
53092
53959
|
return true;
|
|
53093
|
-
if (
|
|
53960
|
+
if (_internals66.now() - ctx.startedAt > ctx.walkBudgetMs) {
|
|
53094
53961
|
ctx.abortReason = "budget";
|
|
53095
53962
|
return true;
|
|
53096
53963
|
}
|
|
@@ -53122,7 +53989,7 @@ async function walkRepoGraphInputs(dir, options) {
|
|
|
53122
53989
|
const ctx = {
|
|
53123
53990
|
stats,
|
|
53124
53991
|
seenRealPaths: new Set,
|
|
53125
|
-
startedAt:
|
|
53992
|
+
startedAt: _internals66.now(),
|
|
53126
53993
|
walkBudgetMs: options?.walkBudgetMs ?? DEFAULT_WALK_BUDGET_MS,
|
|
53127
53994
|
maxFiles: options?.maxFiles ?? DEFAULT_WALK_FILE_CAP,
|
|
53128
53995
|
followSymlinks: options?.followSymlinks ?? false,
|
|
@@ -53223,7 +54090,7 @@ async function walkRepoGraphInputs(dir, options) {
|
|
|
53223
54090
|
unreadableDirectories,
|
|
53224
54091
|
unreadableFiles,
|
|
53225
54092
|
probedFiles: metadata.length,
|
|
53226
|
-
elapsedMs: Math.max(0,
|
|
54093
|
+
elapsedMs: Math.max(0, _internals66.now() - ctx.startedAt)
|
|
53227
54094
|
};
|
|
53228
54095
|
}
|
|
53229
54096
|
var RANGE_WIDENED_GRAMMARS = new Set([
|
|
@@ -53231,7 +54098,10 @@ var RANGE_WIDENED_GRAMMARS = new Set([
|
|
|
53231
54098
|
"kotlin",
|
|
53232
54099
|
"csharp",
|
|
53233
54100
|
"cpp",
|
|
53234
|
-
"swift"
|
|
54101
|
+
"swift",
|
|
54102
|
+
"dart",
|
|
54103
|
+
"ruby",
|
|
54104
|
+
"php"
|
|
53235
54105
|
]);
|
|
53236
54106
|
|
|
53237
54107
|
// src/tools/repo-graph/query.ts
|
|
@@ -53265,7 +54135,7 @@ var MAX_RELATIVE_PATH_LENGTH = 4096;
|
|
|
53265
54135
|
var WINDOWS_RENAME_MAX_RETRIES2 = 5;
|
|
53266
54136
|
var WINDOWS_RENAME_RETRY_DELAY_MS = 100;
|
|
53267
54137
|
var probeCache = new Map;
|
|
53268
|
-
var
|
|
54138
|
+
var _internals67 = {
|
|
53269
54139
|
now: Date.now,
|
|
53270
54140
|
walkRepoGraphInputs,
|
|
53271
54141
|
open: fsPromises3.open,
|
|
@@ -53304,11 +54174,11 @@ async function writeFingerprintAtomic(root, data) {
|
|
|
53304
54174
|
const temp = path75.join(path75.dirname(target), `.repo-graph.fingerprint.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 10)}.tmp`);
|
|
53305
54175
|
validateSymlinkBoundary(temp, root);
|
|
53306
54176
|
try {
|
|
53307
|
-
await
|
|
54177
|
+
await _internals67.bunWrite(temp, data);
|
|
53308
54178
|
let lastError;
|
|
53309
54179
|
for (let attempt = 0;attempt < WINDOWS_RENAME_MAX_RETRIES2; attempt++) {
|
|
53310
54180
|
try {
|
|
53311
|
-
await
|
|
54181
|
+
await _internals67.fsRename(temp, target);
|
|
53312
54182
|
lastError = undefined;
|
|
53313
54183
|
break;
|
|
53314
54184
|
} catch (error2) {
|
|
@@ -53317,20 +54187,20 @@ async function writeFingerprintAtomic(root, data) {
|
|
|
53317
54187
|
if (code !== "EEXIST" && code !== "EPERM" && code !== "EBUSY" || attempt === WINDOWS_RENAME_MAX_RETRIES2 - 1) {
|
|
53318
54188
|
break;
|
|
53319
54189
|
}
|
|
53320
|
-
await new Promise((resolve26) => setTimeout(resolve26,
|
|
54190
|
+
await new Promise((resolve26) => setTimeout(resolve26, _internals67.retryDelayMs));
|
|
53321
54191
|
}
|
|
53322
54192
|
}
|
|
53323
54193
|
if (lastError !== undefined)
|
|
53324
54194
|
throw lastError;
|
|
53325
54195
|
} finally {
|
|
53326
54196
|
try {
|
|
53327
|
-
await
|
|
54197
|
+
await _internals67.fsUnlink(temp);
|
|
53328
54198
|
} catch {}
|
|
53329
54199
|
}
|
|
53330
54200
|
}
|
|
53331
54201
|
async function refuseFingerprint(root) {
|
|
53332
54202
|
try {
|
|
53333
|
-
await
|
|
54203
|
+
await _internals67.fsUnlink(fingerprintPath(root));
|
|
53334
54204
|
} catch {}
|
|
53335
54205
|
invalidateFreshnessCache(root);
|
|
53336
54206
|
return false;
|
|
@@ -53397,7 +54267,7 @@ function diagnosticPaths(root, diagnostics) {
|
|
|
53397
54267
|
async function writeFingerprint(root, graph, options) {
|
|
53398
54268
|
invalidateFreshnessCache(root);
|
|
53399
54269
|
try {
|
|
53400
|
-
const walk = await
|
|
54270
|
+
const walk = await _internals67.walkRepoGraphInputs(root, {
|
|
53401
54271
|
walkBudgetMs: options?.walkBudgetMs,
|
|
53402
54272
|
maxFiles: options?.maxFiles,
|
|
53403
54273
|
followSymlinks: options?.followSymlinks,
|
|
@@ -53478,7 +54348,7 @@ async function writeFingerprint(root, graph, options) {
|
|
|
53478
54348
|
|
|
53479
54349
|
// src/tools/repo-graph/storage.ts
|
|
53480
54350
|
var WINDOWS_RENAME_RETRY_DELAY_MS2 = 100;
|
|
53481
|
-
var
|
|
54351
|
+
var _internals68 = {
|
|
53482
54352
|
safeRealpathSync,
|
|
53483
54353
|
fsRename: fsPromises4.rename.bind(fsPromises4),
|
|
53484
54354
|
retryDelayMs: WINDOWS_RENAME_RETRY_DELAY_MS2,
|
|
@@ -54743,15 +55613,15 @@ async function handleMemoryUnlinkCommand(directory, args) {
|
|
|
54743
55613
|
}
|
|
54744
55614
|
|
|
54745
55615
|
// src/services/plan-service.ts
|
|
54746
|
-
var
|
|
55616
|
+
var _internals69 = {
|
|
54747
55617
|
loadPlanJsonOnly,
|
|
54748
55618
|
derivePlanMarkdown,
|
|
54749
55619
|
readSwarmFileAsync
|
|
54750
55620
|
};
|
|
54751
55621
|
async function getPlanData(directory, phaseArg) {
|
|
54752
|
-
const plan = await
|
|
55622
|
+
const plan = await _internals69.loadPlanJsonOnly(directory);
|
|
54753
55623
|
if (plan) {
|
|
54754
|
-
const fullMarkdown =
|
|
55624
|
+
const fullMarkdown = _internals69.derivePlanMarkdown(plan);
|
|
54755
55625
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
54756
55626
|
return {
|
|
54757
55627
|
hasPlan: true,
|
|
@@ -54794,7 +55664,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
54794
55664
|
isLegacy: false
|
|
54795
55665
|
};
|
|
54796
55666
|
}
|
|
54797
|
-
const planContent = await
|
|
55667
|
+
const planContent = await _internals69.readSwarmFileAsync(directory, "plan.md");
|
|
54798
55668
|
if (!planContent) {
|
|
54799
55669
|
return {
|
|
54800
55670
|
hasPlan: false,
|
|
@@ -54891,7 +55761,7 @@ async function handlePlanCommand(directory, args) {
|
|
|
54891
55761
|
return formatPlanMarkdown(planData);
|
|
54892
55762
|
}
|
|
54893
55763
|
// src/commands/post-mortem.ts
|
|
54894
|
-
var
|
|
55764
|
+
var _internals70 = {
|
|
54895
55765
|
createCuratorLLMDelegate,
|
|
54896
55766
|
runCuratorPostMortem
|
|
54897
55767
|
};
|
|
@@ -54939,10 +55809,10 @@ async function handlePostMortemCommand(directory, args, options) {
|
|
|
54939
55809
|
};
|
|
54940
55810
|
if (options?.sessionID) {
|
|
54941
55811
|
try {
|
|
54942
|
-
pmOptions.llmDelegate =
|
|
55812
|
+
pmOptions.llmDelegate = _internals70.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
|
|
54943
55813
|
} catch {}
|
|
54944
55814
|
}
|
|
54945
|
-
const result = await
|
|
55815
|
+
const result = await _internals70.runCuratorPostMortem(directory, pmOptions);
|
|
54946
55816
|
const lines = [];
|
|
54947
55817
|
if (result.success) {
|
|
54948
55818
|
lines.push("## Post-Mortem Report Generated");
|
|
@@ -55231,7 +56101,7 @@ function resolveGhBinaryCandidates(options = {}) {
|
|
|
55231
56101
|
function resolveGhBinary() {
|
|
55232
56102
|
if (ghBinaryTestPin !== undefined)
|
|
55233
56103
|
return ghBinaryTestPin;
|
|
55234
|
-
return
|
|
56104
|
+
return _internals71.resolveExecutableFromPath(resolveGhBinaryCandidates());
|
|
55235
56105
|
}
|
|
55236
56106
|
function normalizeRepo(value) {
|
|
55237
56107
|
if (value === undefined || value === null || value === "")
|
|
@@ -55352,7 +56222,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55352
56222
|
if (!Array.isArray(fields)) {
|
|
55353
56223
|
return JSON.stringify(fields, null, 2);
|
|
55354
56224
|
}
|
|
55355
|
-
const executable =
|
|
56225
|
+
const executable = _internals71.resolveGhBinary();
|
|
55356
56226
|
if (!executable) {
|
|
55357
56227
|
return JSON.stringify({
|
|
55358
56228
|
error: true,
|
|
@@ -55371,7 +56241,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55371
56241
|
if (isLogFailedMode) {
|
|
55372
56242
|
ghArgs.push("--log-failed");
|
|
55373
56243
|
}
|
|
55374
|
-
const run = await
|
|
56244
|
+
const run = await _internals71.runExternalTool({
|
|
55375
56245
|
executable,
|
|
55376
56246
|
args: ghArgs,
|
|
55377
56247
|
cwd: directory,
|
|
@@ -55455,7 +56325,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55455
56325
|
}, null, 2);
|
|
55456
56326
|
}
|
|
55457
56327
|
});
|
|
55458
|
-
var
|
|
56328
|
+
var _internals71 = {
|
|
55459
56329
|
resolveGhBinaryCandidates,
|
|
55460
56330
|
resolveExecutableFromPath,
|
|
55461
56331
|
resolveGhBinary,
|
|
@@ -55562,7 +56432,7 @@ function formatMergeGroupStatus(status, conclusion, htmlUrl) {
|
|
|
55562
56432
|
}
|
|
55563
56433
|
return parts.join(" ");
|
|
55564
56434
|
}
|
|
55565
|
-
var
|
|
56435
|
+
var _internals72 = {
|
|
55566
56436
|
formatRelativeTime,
|
|
55567
56437
|
formatMergeGroupStatus,
|
|
55568
56438
|
listActive,
|
|
@@ -55570,7 +56440,7 @@ var _internals71 = {
|
|
|
55570
56440
|
parseMergeGroupRuns
|
|
55571
56441
|
};
|
|
55572
56442
|
async function handlePrMonitorStatusCommand(directory, _args, sessionID, source) {
|
|
55573
|
-
const allActive = await
|
|
56443
|
+
const allActive = await _internals72.listActive(directory);
|
|
55574
56444
|
const allSessions = source === "cli";
|
|
55575
56445
|
const subs = allSessions ? allActive : allActive.filter((record) => record.sessionID === sessionID);
|
|
55576
56446
|
if (subs.length === 0) {
|
|
@@ -55586,7 +56456,7 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID, source)
|
|
|
55586
56456
|
const index = i + 1;
|
|
55587
56457
|
lines.push(` ${index}. ${sub.repoFullName}#${sub.prNumber}`);
|
|
55588
56458
|
lines.push(` URL: ${sub.prUrl}`);
|
|
55589
|
-
const mergeGroupRuns = await
|
|
56459
|
+
const mergeGroupRuns = await _internals72.listMergeGroupRuns(directory, sub.repoFullName, sub.prNumber);
|
|
55590
56460
|
if (mergeGroupRuns.runs.length > 0) {
|
|
55591
56461
|
lines.push(" Merge-group runs:");
|
|
55592
56462
|
for (const run of mergeGroupRuns.runs) {
|
|
@@ -55727,7 +56597,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55727
56597
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
55728
56598
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
55729
56599
|
try {
|
|
55730
|
-
const config =
|
|
56600
|
+
const config = _internals73.loadPluginConfig(directory);
|
|
55731
56601
|
const prMonitorConfig = config.pr_monitor;
|
|
55732
56602
|
if (!prMonitorConfig?.enabled) {
|
|
55733
56603
|
return [
|
|
@@ -55737,7 +56607,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55737
56607
|
].join(`
|
|
55738
56608
|
`);
|
|
55739
56609
|
}
|
|
55740
|
-
await
|
|
56610
|
+
await _internals73.subscribe(directory, {
|
|
55741
56611
|
sessionID,
|
|
55742
56612
|
prNumber: prInfo.number,
|
|
55743
56613
|
repoFullName,
|
|
@@ -55765,7 +56635,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55765
56635
|
`);
|
|
55766
56636
|
}
|
|
55767
56637
|
}
|
|
55768
|
-
var
|
|
56638
|
+
var _internals73 = {
|
|
55769
56639
|
loadPluginConfig,
|
|
55770
56640
|
subscribe
|
|
55771
56641
|
};
|
|
@@ -55788,9 +56658,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55788
56658
|
`);
|
|
55789
56659
|
}
|
|
55790
56660
|
const refToken = rest[0];
|
|
55791
|
-
const prInfo =
|
|
56661
|
+
const prInfo = _internals74.parsePrRef(refToken, directory);
|
|
55792
56662
|
if (!prInfo) {
|
|
55793
|
-
if (
|
|
56663
|
+
if (_internals74.looksLikePrRef(refToken)) {
|
|
55794
56664
|
return [
|
|
55795
56665
|
`Error: Could not resolve PR reference from "${refToken}".`,
|
|
55796
56666
|
"",
|
|
@@ -55811,8 +56681,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55811
56681
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
55812
56682
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
55813
56683
|
try {
|
|
55814
|
-
const correlationId =
|
|
55815
|
-
const result = await
|
|
56684
|
+
const correlationId = _internals74.buildCorrelationId(sessionID, repoFullName, prInfo.number);
|
|
56685
|
+
const result = await _internals74.unsubscribe(directory, correlationId);
|
|
55816
56686
|
if (!result) {
|
|
55817
56687
|
return [
|
|
55818
56688
|
`Not subscribed to ${prUrl}`,
|
|
@@ -55839,7 +56709,7 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55839
56709
|
`);
|
|
55840
56710
|
}
|
|
55841
56711
|
}
|
|
55842
|
-
var
|
|
56712
|
+
var _internals74 = {
|
|
55843
56713
|
unsubscribe,
|
|
55844
56714
|
buildCorrelationId,
|
|
55845
56715
|
parsePrRef,
|
|
@@ -55889,7 +56759,7 @@ function normalizeRelativePathForPlatform(value, platform) {
|
|
|
55889
56759
|
}
|
|
55890
56760
|
function isRegularFile(candidate) {
|
|
55891
56761
|
try {
|
|
55892
|
-
return
|
|
56762
|
+
return _internals75.statSync(candidate).isFile();
|
|
55893
56763
|
} catch {
|
|
55894
56764
|
return false;
|
|
55895
56765
|
}
|
|
@@ -55897,21 +56767,21 @@ function isRegularFile(candidate) {
|
|
|
55897
56767
|
function readTextFileBounded(filePath, maxBytes) {
|
|
55898
56768
|
let fd;
|
|
55899
56769
|
try {
|
|
55900
|
-
fd =
|
|
55901
|
-
const stats =
|
|
56770
|
+
fd = _internals75.openSync(filePath, "r");
|
|
56771
|
+
const stats = _internals75.fstatSync(fd);
|
|
55902
56772
|
if (!stats.isFile() || !Number.isSafeInteger(stats.size) || stats.size < 0 || stats.size > maxBytes) {
|
|
55903
56773
|
return null;
|
|
55904
56774
|
}
|
|
55905
56775
|
const bytes = Buffer.alloc(stats.size);
|
|
55906
56776
|
let offset = 0;
|
|
55907
56777
|
while (offset < bytes.byteLength) {
|
|
55908
|
-
const bytesRead =
|
|
56778
|
+
const bytesRead = _internals75.readSync(fd, bytes, offset, bytes.byteLength - offset, null);
|
|
55909
56779
|
if (bytesRead === 0)
|
|
55910
56780
|
break;
|
|
55911
56781
|
offset += bytesRead;
|
|
55912
56782
|
}
|
|
55913
56783
|
const overflowProbe = Buffer.alloc(1);
|
|
55914
|
-
if (
|
|
56784
|
+
if (_internals75.readSync(fd, overflowProbe, 0, 1, null) > 0)
|
|
55915
56785
|
return null;
|
|
55916
56786
|
return bytes.subarray(0, offset).toString("utf8");
|
|
55917
56787
|
} catch {
|
|
@@ -55919,7 +56789,7 @@ function readTextFileBounded(filePath, maxBytes) {
|
|
|
55919
56789
|
} finally {
|
|
55920
56790
|
if (fd !== undefined) {
|
|
55921
56791
|
try {
|
|
55922
|
-
|
|
56792
|
+
_internals75.closeSync(fd);
|
|
55923
56793
|
} catch {}
|
|
55924
56794
|
}
|
|
55925
56795
|
}
|
|
@@ -55940,7 +56810,7 @@ function getAncestorDirectories(directory) {
|
|
|
55940
56810
|
}
|
|
55941
56811
|
return roots;
|
|
55942
56812
|
}
|
|
55943
|
-
function getTrustedShimNames(linter, platform =
|
|
56813
|
+
function getTrustedShimNames(linter, platform = _internals75.platform()) {
|
|
55944
56814
|
const isWindows = platform === "win32";
|
|
55945
56815
|
if (linter === "biome") {
|
|
55946
56816
|
return isWindows ? ["biome.exe", "biome.cmd", "biome.ps1"] : ["biome"];
|
|
@@ -55957,7 +56827,7 @@ function getPackageManifestPath(searchRoot, linter) {
|
|
|
55957
56827
|
return path81.join(getPackageRootFromSearchRoot(searchRoot, linter), "package.json");
|
|
55958
56828
|
}
|
|
55959
56829
|
function getPackageDisplayPath(searchRoot, linter) {
|
|
55960
|
-
return path81.join(searchRoot, NODE_MODULES, BIN_DIRECTORY, linter === "biome" ?
|
|
56830
|
+
return path81.join(searchRoot, NODE_MODULES, BIN_DIRECTORY, linter === "biome" ? _internals75.platform() === "win32" ? "biome.exe" : "biome" : _internals75.platform() === "win32" ? "eslint" : "eslint");
|
|
55961
56831
|
}
|
|
55962
56832
|
function getBiomeNativePackage(platform, arch) {
|
|
55963
56833
|
const archMap = platform === "darwin" ? { arm64: "@biomejs/cli-darwin-arm64", x64: "@biomejs/cli-darwin-x64" } : platform === "linux" ? {
|
|
@@ -55972,7 +56842,7 @@ function getBiomeNativePackage(platform, arch) {
|
|
|
55972
56842
|
return null;
|
|
55973
56843
|
return archMap[arch] ?? null;
|
|
55974
56844
|
}
|
|
55975
|
-
function getBiomeNativeExecutable(searchRoot, platform =
|
|
56845
|
+
function getBiomeNativeExecutable(searchRoot, platform = _internals75.platform(), arch = _internals75.arch()) {
|
|
55976
56846
|
const nativePackage = getBiomeNativePackage(platform, arch);
|
|
55977
56847
|
if (!nativePackage)
|
|
55978
56848
|
return null;
|
|
@@ -56008,8 +56878,8 @@ function resolveCanonicalPackageCommand(searchRoot, linter, source) {
|
|
|
56008
56878
|
let canonicalCandidate;
|
|
56009
56879
|
try {
|
|
56010
56880
|
const packageRoot = path81.dirname(manifestPath);
|
|
56011
|
-
canonicalPackageRoot =
|
|
56012
|
-
canonicalCandidate =
|
|
56881
|
+
canonicalPackageRoot = _internals75.realpathSync(packageRoot);
|
|
56882
|
+
canonicalCandidate = _internals75.realpathSync(path81.resolve(packageRoot, relativeBinPath));
|
|
56013
56883
|
} catch {
|
|
56014
56884
|
return null;
|
|
56015
56885
|
}
|
|
@@ -56021,7 +56891,7 @@ function resolveCanonicalPackageCommand(searchRoot, linter, source) {
|
|
|
56021
56891
|
return null;
|
|
56022
56892
|
return {
|
|
56023
56893
|
linter,
|
|
56024
|
-
executable:
|
|
56894
|
+
executable: _internals75.execPath(),
|
|
56025
56895
|
argsPrefix: [canonicalCandidate],
|
|
56026
56896
|
displayPrefix: [getPackageDisplayPath(searchRoot, linter)],
|
|
56027
56897
|
source
|
|
@@ -56062,7 +56932,7 @@ function resolveLocalLinterCommand(linter, directory) {
|
|
|
56062
56932
|
}
|
|
56063
56933
|
return null;
|
|
56064
56934
|
}
|
|
56065
|
-
function findPathShimCandidate(linter, envPath =
|
|
56935
|
+
function findPathShimCandidate(linter, envPath = _internals75.pathEnv(), platform = _internals75.platform()) {
|
|
56066
56936
|
const entries = envPath.split(path81.delimiter).filter(Boolean);
|
|
56067
56937
|
const shimNames = getTrustedShimNames(linter, platform).filter((name) => name.endsWith(".cmd") || name.endsWith(".ps1") || platform !== "win32");
|
|
56068
56938
|
for (const entry of entries) {
|
|
@@ -56092,7 +56962,7 @@ function getExpectedShimSuffixes(linter) {
|
|
|
56092
56962
|
normalizeRelativePathForPlatform(nodeModulesPackageOnlySuffix, "linux")
|
|
56093
56963
|
];
|
|
56094
56964
|
}
|
|
56095
|
-
function resolvePathShimTarget(shimPath, linter, platform =
|
|
56965
|
+
function resolvePathShimTarget(shimPath, linter, platform = _internals75.platform()) {
|
|
56096
56966
|
const contents = readTextFileBounded(shimPath, MAX_PATH_SHIM_BYTES);
|
|
56097
56967
|
if (contents === null)
|
|
56098
56968
|
return null;
|
|
@@ -56139,7 +57009,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56139
57009
|
return null;
|
|
56140
57010
|
let canonicalShimDir;
|
|
56141
57011
|
try {
|
|
56142
|
-
canonicalShimDir =
|
|
57012
|
+
canonicalShimDir = _internals75.realpathSync(path81.dirname(shimPath));
|
|
56143
57013
|
} catch {
|
|
56144
57014
|
return null;
|
|
56145
57015
|
}
|
|
@@ -56148,7 +57018,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56148
57018
|
return null;
|
|
56149
57019
|
let canonicalTarget;
|
|
56150
57020
|
try {
|
|
56151
|
-
canonicalTarget =
|
|
57021
|
+
canonicalTarget = _internals75.realpathSync(resolvedTarget);
|
|
56152
57022
|
} catch {
|
|
56153
57023
|
return null;
|
|
56154
57024
|
}
|
|
@@ -56158,7 +57028,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56158
57028
|
}
|
|
56159
57029
|
let canonicalShimParent;
|
|
56160
57030
|
try {
|
|
56161
|
-
canonicalShimParent =
|
|
57031
|
+
canonicalShimParent = _internals75.realpathSync(path81.dirname(canonicalShimDir));
|
|
56162
57032
|
} catch {
|
|
56163
57033
|
return null;
|
|
56164
57034
|
}
|
|
@@ -56172,8 +57042,8 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
56172
57042
|
return canonicalTarget;
|
|
56173
57043
|
}
|
|
56174
57044
|
function resolvePathLinterCommand(linter, directory) {
|
|
56175
|
-
const platform =
|
|
56176
|
-
const envPath =
|
|
57045
|
+
const platform = _internals75.platform();
|
|
57046
|
+
const envPath = _internals75.pathEnv();
|
|
56177
57047
|
const nativeNames = platform === "win32" ? linter === "biome" ? ["biome.exe"] : ["eslint.exe"] : linter === "biome" ? ["biome"] : ["eslint"];
|
|
56178
57048
|
const nativeExecutable = resolveExecutableFromPath(nativeNames, envPath, platform);
|
|
56179
57049
|
if (nativeExecutable) {
|
|
@@ -56193,7 +57063,7 @@ function resolvePathLinterCommand(linter, directory) {
|
|
|
56193
57063
|
return null;
|
|
56194
57064
|
return {
|
|
56195
57065
|
linter,
|
|
56196
|
-
executable:
|
|
57066
|
+
executable: _internals75.execPath(),
|
|
56197
57067
|
argsPrefix: [shimTarget],
|
|
56198
57068
|
displayPrefix: [path81.join(directory, NODE_MODULES, BIN_DIRECTORY, linter)],
|
|
56199
57069
|
source: "path-shim"
|
|
@@ -56230,7 +57100,7 @@ function buildExecutionError(mode, command, linter, result) {
|
|
|
56230
57100
|
};
|
|
56231
57101
|
}
|
|
56232
57102
|
async function probeResolvedCommand(command, cwd, abortSignal) {
|
|
56233
|
-
const result = await
|
|
57103
|
+
const result = await _internals75.runExternalTool({
|
|
56234
57104
|
executable: command.executable,
|
|
56235
57105
|
args: [...command.argsPrefix, "--version"],
|
|
56236
57106
|
cwd,
|
|
@@ -56248,7 +57118,7 @@ async function resolveLinterCommand(linter, directory) {
|
|
|
56248
57118
|
async function detectResolvedLinter(directory, abortSignal) {
|
|
56249
57119
|
if (!directory)
|
|
56250
57120
|
return null;
|
|
56251
|
-
if (!
|
|
57121
|
+
if (!_internals75.existsSync(directory))
|
|
56252
57122
|
return null;
|
|
56253
57123
|
const cwd = toAbsoluteDirectory(directory);
|
|
56254
57124
|
for (const linter of SUPPORTED_LINTERS) {
|
|
@@ -56262,12 +57132,12 @@ async function detectResolvedLinter(directory, abortSignal) {
|
|
|
56262
57132
|
return null;
|
|
56263
57133
|
}
|
|
56264
57134
|
function detectRuff(cwd) {
|
|
56265
|
-
if (
|
|
57135
|
+
if (_internals75.existsSync(path81.join(cwd, "ruff.toml")))
|
|
56266
57136
|
return hasAdditionalCommand("ruff");
|
|
56267
57137
|
try {
|
|
56268
57138
|
const pyproject = path81.join(cwd, "pyproject.toml");
|
|
56269
|
-
if (
|
|
56270
|
-
const content =
|
|
57139
|
+
if (_internals75.existsSync(pyproject)) {
|
|
57140
|
+
const content = _internals75.readFileSync(pyproject, "utf-8");
|
|
56271
57141
|
if (content.includes("[tool.ruff]"))
|
|
56272
57142
|
return hasAdditionalCommand("ruff");
|
|
56273
57143
|
}
|
|
@@ -56275,32 +57145,32 @@ function detectRuff(cwd) {
|
|
|
56275
57145
|
return false;
|
|
56276
57146
|
}
|
|
56277
57147
|
function detectClippy(cwd) {
|
|
56278
|
-
return
|
|
57148
|
+
return _internals75.existsSync(path81.join(cwd, "Cargo.toml")) && hasAdditionalCommand("cargo");
|
|
56279
57149
|
}
|
|
56280
57150
|
function detectGolangciLint(cwd) {
|
|
56281
|
-
return
|
|
57151
|
+
return _internals75.existsSync(path81.join(cwd, "go.mod")) && hasAdditionalCommand("golangci-lint");
|
|
56282
57152
|
}
|
|
56283
57153
|
function readTextFileSafe(filePath) {
|
|
56284
57154
|
try {
|
|
56285
|
-
return
|
|
57155
|
+
return _internals75.readFileSync(filePath, "utf-8");
|
|
56286
57156
|
} catch {
|
|
56287
57157
|
return "";
|
|
56288
57158
|
}
|
|
56289
57159
|
}
|
|
56290
57160
|
function resolveAdditionalExecutable(name) {
|
|
56291
|
-
const platform =
|
|
57161
|
+
const platform = _internals75.platform();
|
|
56292
57162
|
if (platform !== "win32") {
|
|
56293
|
-
return
|
|
57163
|
+
return _internals75.isCommandAvailable(name) ? name : null;
|
|
56294
57164
|
}
|
|
56295
|
-
return resolveExecutableFromPath([`${name}.exe`],
|
|
57165
|
+
return resolveExecutableFromPath([`${name}.exe`], _internals75.pathEnv(), platform);
|
|
56296
57166
|
}
|
|
56297
57167
|
function resolveWindowsCommandInterpreter() {
|
|
56298
|
-
const candidate =
|
|
57168
|
+
const candidate = _internals75.comSpec();
|
|
56299
57169
|
if (!candidate || !path81.isAbsolute(candidate) || path81.basename(candidate).toLowerCase() !== "cmd.exe" || !isRegularFile(candidate)) {
|
|
56300
57170
|
return null;
|
|
56301
57171
|
}
|
|
56302
57172
|
try {
|
|
56303
|
-
const canonical =
|
|
57173
|
+
const canonical = _internals75.realpathSync(candidate);
|
|
56304
57174
|
return path81.basename(canonical).toLowerCase() === "cmd.exe" ? canonical : null;
|
|
56305
57175
|
} catch {
|
|
56306
57176
|
return null;
|
|
@@ -56312,7 +57182,7 @@ function buildWindowsBatchCommand(wrapperPath, args) {
|
|
|
56312
57182
|
return null;
|
|
56313
57183
|
let canonicalWrapper;
|
|
56314
57184
|
try {
|
|
56315
|
-
canonicalWrapper =
|
|
57185
|
+
canonicalWrapper = _internals75.realpathSync(wrapperPath);
|
|
56316
57186
|
} catch {
|
|
56317
57187
|
return null;
|
|
56318
57188
|
}
|
|
@@ -56326,13 +57196,13 @@ function buildWindowsBatchCommand(wrapperPath, args) {
|
|
|
56326
57196
|
return [interpreter, "/d", "/s", "/v:off", "/c", command];
|
|
56327
57197
|
}
|
|
56328
57198
|
function resolveWindowsBatchCommandFromPath(name, args) {
|
|
56329
|
-
if (
|
|
57199
|
+
if (_internals75.platform() !== "win32")
|
|
56330
57200
|
return null;
|
|
56331
|
-
const wrapper = resolveExecutableFromPath(WINDOWS_BATCH_WRAPPER_EXTENSIONS.map((extension) => `${name}${extension}`),
|
|
57201
|
+
const wrapper = resolveExecutableFromPath(WINDOWS_BATCH_WRAPPER_EXTENSIONS.map((extension) => `${name}${extension}`), _internals75.pathEnv(), "win32");
|
|
56332
57202
|
return wrapper ? buildWindowsBatchCommand(wrapper, args) : null;
|
|
56333
57203
|
}
|
|
56334
57204
|
function resolveContainedWindowsBatchCommand(cwd, fileName, args) {
|
|
56335
|
-
if (
|
|
57205
|
+
if (_internals75.platform() !== "win32")
|
|
56336
57206
|
return null;
|
|
56337
57207
|
const candidate = path81.join(cwd, fileName);
|
|
56338
57208
|
if (!isRegularFile(candidate))
|
|
@@ -56340,8 +57210,8 @@ function resolveContainedWindowsBatchCommand(cwd, fileName, args) {
|
|
|
56340
57210
|
let canonicalCwd;
|
|
56341
57211
|
let canonicalCandidate;
|
|
56342
57212
|
try {
|
|
56343
|
-
canonicalCwd =
|
|
56344
|
-
canonicalCandidate =
|
|
57213
|
+
canonicalCwd = _internals75.realpathSync(cwd);
|
|
57214
|
+
canonicalCandidate = _internals75.realpathSync(candidate);
|
|
56345
57215
|
} catch {
|
|
56346
57216
|
return null;
|
|
56347
57217
|
}
|
|
@@ -56362,22 +57232,22 @@ function hasAdditionalCommand(name) {
|
|
|
56362
57232
|
}
|
|
56363
57233
|
function resolvePhpVendorCommand(cwd, name) {
|
|
56364
57234
|
const relativeProxy = path81.join("vendor", "bin", name);
|
|
56365
|
-
if (!
|
|
57235
|
+
if (!_internals75.existsSync(path81.join(cwd, relativeProxy)))
|
|
56366
57236
|
return null;
|
|
56367
|
-
if (
|
|
57237
|
+
if (_internals75.platform() !== "win32")
|
|
56368
57238
|
return [relativeProxy];
|
|
56369
57239
|
const phpExecutable = resolveAdditionalExecutable("php");
|
|
56370
57240
|
return phpExecutable ? [phpExecutable, relativeProxy] : null;
|
|
56371
57241
|
}
|
|
56372
57242
|
function hasCheckstyleGradleSignal(cwd) {
|
|
56373
|
-
const gradleFiles = ["build.gradle", "build.gradle.kts"].map((file) => path81.join(cwd, file)).filter((file) =>
|
|
56374
|
-
return
|
|
57243
|
+
const gradleFiles = ["build.gradle", "build.gradle.kts"].map((file) => path81.join(cwd, file)).filter((file) => _internals75.existsSync(file));
|
|
57244
|
+
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
57245
|
}
|
|
56376
57246
|
function resolveCheckstyleCommand(cwd) {
|
|
56377
|
-
const hasMavenProject =
|
|
57247
|
+
const hasMavenProject = _internals75.existsSync(path81.join(cwd, "pom.xml"));
|
|
56378
57248
|
const hasGradleSignal = hasCheckstyleGradleSignal(cwd);
|
|
56379
57249
|
if (hasGradleSignal) {
|
|
56380
|
-
if (
|
|
57250
|
+
if (_internals75.platform() === "win32") {
|
|
56381
57251
|
const gradlew = resolveContainedWindowsBatchCommand(cwd, "gradlew.bat", [
|
|
56382
57252
|
"checkstyleMain"
|
|
56383
57253
|
]);
|
|
@@ -56385,7 +57255,7 @@ function resolveCheckstyleCommand(cwd) {
|
|
|
56385
57255
|
return gradlew;
|
|
56386
57256
|
} else {
|
|
56387
57257
|
const gradlew = path81.join(cwd, "gradlew");
|
|
56388
|
-
if (
|
|
57258
|
+
if (_internals75.existsSync(gradlew))
|
|
56389
57259
|
return [gradlew, "checkstyleMain"];
|
|
56390
57260
|
}
|
|
56391
57261
|
const gradle = buildAdditionalCommand("gradle", ["checkstyleMain"]);
|
|
@@ -56399,7 +57269,7 @@ function resolveCheckstyleCommand(cwd) {
|
|
|
56399
57269
|
}
|
|
56400
57270
|
return null;
|
|
56401
57271
|
}
|
|
56402
|
-
function isUnsafeShellWrapperExecutable(executable, platform =
|
|
57272
|
+
function isUnsafeShellWrapperExecutable(executable, platform = _internals75.platform()) {
|
|
56403
57273
|
return platform === "win32" && UNSAFE_SHELL_WRAPPER_EXTENSIONS.has(path81.extname(executable).toLowerCase());
|
|
56404
57274
|
}
|
|
56405
57275
|
function detectCheckstyle(cwd) {
|
|
@@ -56407,7 +57277,7 @@ function detectCheckstyle(cwd) {
|
|
|
56407
57277
|
}
|
|
56408
57278
|
function hasRootKotlinFile(cwd) {
|
|
56409
57279
|
try {
|
|
56410
|
-
return
|
|
57280
|
+
return _internals75.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
|
|
56411
57281
|
} catch {
|
|
56412
57282
|
return false;
|
|
56413
57283
|
}
|
|
@@ -56417,27 +57287,27 @@ function buildGradleHasKotlinSignal(cwd) {
|
|
|
56417
57287
|
return /\b(kotlin|org\.jetbrains\.kotlin|ktlint)\b/i.test(content);
|
|
56418
57288
|
}
|
|
56419
57289
|
function detectKtlint(cwd) {
|
|
56420
|
-
const hasKotlin =
|
|
57290
|
+
const hasKotlin = _internals75.existsSync(path81.join(cwd, "build.gradle.kts")) || _internals75.existsSync(path81.join(cwd, "build.gradle")) && buildGradleHasKotlinSignal(cwd) || hasRootKotlinFile(cwd);
|
|
56421
57291
|
return hasKotlin && hasAdditionalCommand("ktlint");
|
|
56422
57292
|
}
|
|
56423
57293
|
function detectPhpLinter(cwd) {
|
|
56424
|
-
if ((
|
|
57294
|
+
if ((_internals75.existsSync(path81.join(cwd, "phpstan.neon")) || _internals75.existsSync(path81.join(cwd, "phpstan.neon.dist"))) && resolvePhpVendorCommand(cwd, "phpstan") !== null) {
|
|
56425
57295
|
return "phpstan";
|
|
56426
57296
|
}
|
|
56427
|
-
if (
|
|
57297
|
+
if (_internals75.existsSync(path81.join(cwd, "pint.json")) && resolvePhpVendorCommand(cwd, "pint") !== null) {
|
|
56428
57298
|
return "pint";
|
|
56429
57299
|
}
|
|
56430
|
-
if (
|
|
57300
|
+
if (_internals75.existsSync(path81.join(cwd, ".php-cs-fixer.php")) && resolvePhpVendorCommand(cwd, "php-cs-fixer") !== null) {
|
|
56431
57301
|
return "php-cs-fixer";
|
|
56432
57302
|
}
|
|
56433
|
-
if (
|
|
57303
|
+
if (_internals75.existsSync(path81.join(cwd, "phpcs.xml")) && resolvePhpVendorCommand(cwd, "phpcs") !== null) {
|
|
56434
57304
|
return "phpcs";
|
|
56435
57305
|
}
|
|
56436
57306
|
return null;
|
|
56437
57307
|
}
|
|
56438
57308
|
function detectDotnetFormat(cwd) {
|
|
56439
57309
|
try {
|
|
56440
|
-
const files =
|
|
57310
|
+
const files = _internals75.readdirSync(cwd);
|
|
56441
57311
|
const hasCsproj = files.some((f) => f.endsWith(".csproj") || f.endsWith(".sln"));
|
|
56442
57312
|
return hasCsproj && hasAdditionalCommand("dotnet");
|
|
56443
57313
|
} catch {
|
|
@@ -56445,14 +57315,14 @@ function detectDotnetFormat(cwd) {
|
|
|
56445
57315
|
}
|
|
56446
57316
|
}
|
|
56447
57317
|
function detectCppcheck(cwd) {
|
|
56448
|
-
if (
|
|
57318
|
+
if (_internals75.existsSync(path81.join(cwd, "CMakeLists.txt"))) {
|
|
56449
57319
|
return hasAdditionalCommand("cppcheck");
|
|
56450
57320
|
}
|
|
56451
57321
|
try {
|
|
56452
57322
|
const dirsToCheck = [cwd, path81.join(cwd, "src")];
|
|
56453
57323
|
const hasCpp = dirsToCheck.some((dir) => {
|
|
56454
57324
|
try {
|
|
56455
|
-
return
|
|
57325
|
+
return _internals75.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
|
|
56456
57326
|
} catch {
|
|
56457
57327
|
return false;
|
|
56458
57328
|
}
|
|
@@ -56463,13 +57333,13 @@ function detectCppcheck(cwd) {
|
|
|
56463
57333
|
}
|
|
56464
57334
|
}
|
|
56465
57335
|
function detectSwiftlint(cwd) {
|
|
56466
|
-
return
|
|
57336
|
+
return _internals75.existsSync(path81.join(cwd, "Package.swift")) && hasAdditionalCommand("swiftlint");
|
|
56467
57337
|
}
|
|
56468
57338
|
function detectDartAnalyze(cwd) {
|
|
56469
|
-
return
|
|
57339
|
+
return _internals75.existsSync(path81.join(cwd, "pubspec.yaml")) && hasAdditionalCommand("dart");
|
|
56470
57340
|
}
|
|
56471
57341
|
function detectRubocop(cwd) {
|
|
56472
|
-
return (
|
|
57342
|
+
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
57343
|
}
|
|
56474
57344
|
function detectAdditionalLinter(cwd) {
|
|
56475
57345
|
if (detectRuff(cwd))
|
|
@@ -56514,7 +57384,7 @@ async function runResolvedLint(command, mode, directory, abortSignal) {
|
|
|
56514
57384
|
error: "Command exceeds maximum allowed length"
|
|
56515
57385
|
};
|
|
56516
57386
|
}
|
|
56517
|
-
const runResult = await
|
|
57387
|
+
const runResult = await _internals75.runExternalTool({
|
|
56518
57388
|
executable: command.executable,
|
|
56519
57389
|
args: [...command.argsPrefix, ...lintArgs],
|
|
56520
57390
|
cwd: toAbsoluteDirectory(directory),
|
|
@@ -56592,7 +57462,7 @@ function getAdditionalLinterCommand(linter, mode, cwd) {
|
|
|
56592
57462
|
}
|
|
56593
57463
|
}
|
|
56594
57464
|
async function runLint(linter, mode, directory, abortSignal) {
|
|
56595
|
-
const resolved = await
|
|
57465
|
+
const resolved = await _internals75.resolveLinterCommand(linter, directory);
|
|
56596
57466
|
if (!resolved) {
|
|
56597
57467
|
return {
|
|
56598
57468
|
success: false,
|
|
@@ -56633,7 +57503,7 @@ async function runAdditionalLint(linter, mode, cwd, abortSignal) {
|
|
|
56633
57503
|
error: `No safely executable ${linter} command found`
|
|
56634
57504
|
};
|
|
56635
57505
|
}
|
|
56636
|
-
const runResult = await
|
|
57506
|
+
const runResult = await _internals75.runExternalTool({
|
|
56637
57507
|
executable,
|
|
56638
57508
|
args,
|
|
56639
57509
|
cwd: toAbsoluteDirectory(cwd),
|
|
@@ -56641,7 +57511,7 @@ async function runAdditionalLint(linter, mode, cwd, abortSignal) {
|
|
|
56641
57511
|
maxStdoutBytes: MAX_OUTPUT_BYTES2,
|
|
56642
57512
|
maxStderrBytes: MAX_OUTPUT_BYTES2,
|
|
56643
57513
|
abortSignal,
|
|
56644
|
-
windowsVerbatimArguments:
|
|
57514
|
+
windowsVerbatimArguments: _internals75.platform() === "win32" && path81.basename(executable).toLowerCase() === "cmd.exe"
|
|
56645
57515
|
});
|
|
56646
57516
|
if (runResult.status !== "completed") {
|
|
56647
57517
|
return buildExecutionError(mode, command, linter, runResult);
|
|
@@ -56688,15 +57558,15 @@ var lint = createSwarmTool({
|
|
|
56688
57558
|
}
|
|
56689
57559
|
const { mode } = args;
|
|
56690
57560
|
const cwd = directory;
|
|
56691
|
-
const resolvedLinter = await
|
|
57561
|
+
const resolvedLinter = await _internals75.detectResolvedLinter(directory, ctx?.abort);
|
|
56692
57562
|
if (resolvedLinter) {
|
|
56693
|
-
const result = await
|
|
57563
|
+
const result = await _internals75.runResolvedLint(resolvedLinter, mode, directory, ctx?.abort);
|
|
56694
57564
|
return JSON.stringify(result, null, 2);
|
|
56695
57565
|
}
|
|
56696
|
-
const additionalLinter =
|
|
57566
|
+
const additionalLinter = _internals75.detectAdditionalLinter(cwd);
|
|
56697
57567
|
if (additionalLinter) {
|
|
56698
57568
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
56699
|
-
const result = await
|
|
57569
|
+
const result = await _internals75.runAdditionalLint(additionalLinter, mode, cwd, ctx?.abort);
|
|
56700
57570
|
return JSON.stringify(result, null, 2);
|
|
56701
57571
|
}
|
|
56702
57572
|
const errorResult = {
|
|
@@ -56710,7 +57580,7 @@ For Rust: rustup component add clippy`
|
|
|
56710
57580
|
return JSON.stringify(errorResult, null, 2);
|
|
56711
57581
|
}
|
|
56712
57582
|
});
|
|
56713
|
-
var
|
|
57583
|
+
var _internals75 = {
|
|
56714
57584
|
MAX_PACKAGE_MANIFEST_BYTES,
|
|
56715
57585
|
MAX_PATH_SHIM_BYTES,
|
|
56716
57586
|
arch: () => process.arch,
|
|
@@ -57114,14 +57984,14 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57114
57984
|
let fd = null;
|
|
57115
57985
|
try {
|
|
57116
57986
|
const flags = fs33.constants.O_RDONLY | (O_NOFOLLOW !== undefined ? O_NOFOLLOW : 0);
|
|
57117
|
-
fd =
|
|
57987
|
+
fd = _internals76.openFile(filePath, flags);
|
|
57118
57988
|
} catch {
|
|
57119
57989
|
return { status: "incomplete", reason: "read_error" };
|
|
57120
57990
|
}
|
|
57121
57991
|
let outcome;
|
|
57122
57992
|
let closeFailed = false;
|
|
57123
57993
|
try {
|
|
57124
|
-
const stat9 =
|
|
57994
|
+
const stat9 = _internals76.fstatFile(fd);
|
|
57125
57995
|
const descriptorIdentity = getStableFileIdentity(stat9);
|
|
57126
57996
|
const initialSize = stat9.size;
|
|
57127
57997
|
if (!stat9.isFile()) {
|
|
@@ -57133,14 +58003,14 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57133
58003
|
const buffer = Buffer.allocUnsafe(bufferLength);
|
|
57134
58004
|
let bytesRead = 0;
|
|
57135
58005
|
while (bytesRead < buffer.length) {
|
|
57136
|
-
const count =
|
|
58006
|
+
const count = _internals76.readFileChunk(fd, buffer, bytesRead, buffer.length - bytesRead, null);
|
|
57137
58007
|
if (count === 0)
|
|
57138
58008
|
break;
|
|
57139
58009
|
bytesRead += count;
|
|
57140
58010
|
}
|
|
57141
|
-
const postStat =
|
|
58011
|
+
const postStat = _internals76.fstatFile(fd);
|
|
57142
58012
|
const postDescriptorIdentity = getStableFileIdentity(postStat);
|
|
57143
|
-
const postPathStat =
|
|
58013
|
+
const postPathStat = _internals76.lstatFile(filePath);
|
|
57144
58014
|
const postPathIdentity = getStableFileIdentity(postPathStat);
|
|
57145
58015
|
if (!postStat.isFile() || postDescriptorIdentity === null || postDescriptorIdentity !== descriptorIdentity || postPathStat.isSymbolicLink() || !postPathStat.isFile() || postPathIdentity === null || postPathIdentity !== descriptorIdentity) {
|
|
57146
58016
|
outcome = { status: "incomplete", reason: "read_error" };
|
|
@@ -57162,7 +58032,7 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57162
58032
|
} finally {
|
|
57163
58033
|
if (fd !== null) {
|
|
57164
58034
|
try {
|
|
57165
|
-
|
|
58035
|
+
_internals76.closeFile(fd);
|
|
57166
58036
|
} catch {
|
|
57167
58037
|
closeFailed = true;
|
|
57168
58038
|
}
|
|
@@ -57175,7 +58045,7 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
57175
58045
|
function scanFileForSecrets(filePath, mode) {
|
|
57176
58046
|
const findings = [];
|
|
57177
58047
|
try {
|
|
57178
|
-
const lstat3 =
|
|
58048
|
+
const lstat3 = _internals76.lstatFile(filePath);
|
|
57179
58049
|
if (lstat3.isSymbolicLink()) {
|
|
57180
58050
|
return mode === "explicit" ? { status: "incomplete", reason: "symlink" } : { status: "skipped", reason: "symlink" };
|
|
57181
58051
|
}
|
|
@@ -57354,8 +58224,8 @@ async function collectScannableFiles(dir, excludeExact, excludeGlobs, scanDir, v
|
|
|
57354
58224
|
while (true) {
|
|
57355
58225
|
if (state.entriesSinceYield >= DISCOVERY_YIELD_INTERVAL) {
|
|
57356
58226
|
state.entriesSinceYield = 0;
|
|
57357
|
-
await
|
|
57358
|
-
if (
|
|
58227
|
+
await _internals76.yieldToEventLoop();
|
|
58228
|
+
if (_internals76.now() >= state.deadline) {
|
|
57359
58229
|
state.deadlineExceeded = true;
|
|
57360
58230
|
recordIncompletePath(state.incompletePaths, scanDir, currentDir, "deadline");
|
|
57361
58231
|
stoppedEarly = true;
|
|
@@ -57418,7 +58288,7 @@ async function collectScannableFiles(dir, excludeExact, excludeGlobs, scanDir, v
|
|
|
57418
58288
|
}
|
|
57419
58289
|
} finally {
|
|
57420
58290
|
try {
|
|
57421
|
-
|
|
58291
|
+
_internals76.closeDirectory(directory);
|
|
57422
58292
|
} catch (error2) {
|
|
57423
58293
|
if (error2.code !== "ERR_DIR_CLOSED") {
|
|
57424
58294
|
state.cleanupFailed = true;
|
|
@@ -57540,7 +58410,7 @@ var secretscan = createSwarmTool({
|
|
|
57540
58410
|
symlinkSkipped: 0
|
|
57541
58411
|
};
|
|
57542
58412
|
const visited = new Set;
|
|
57543
|
-
const deadline =
|
|
58413
|
+
const deadline = _internals76.now() + SCAN_TIME_BUDGET_MS;
|
|
57544
58414
|
const discovery = {
|
|
57545
58415
|
files: [],
|
|
57546
58416
|
totalCandidates: 0,
|
|
@@ -57552,7 +58422,7 @@ var secretscan = createSwarmTool({
|
|
|
57552
58422
|
directoriesQueued: 1,
|
|
57553
58423
|
unexaminedDirectories: 0
|
|
57554
58424
|
};
|
|
57555
|
-
await
|
|
58425
|
+
await _internals76.yieldToEventLoop();
|
|
57556
58426
|
await collectScannableFiles(scanDir, excludeExact, excludeGlobs, scanDir, visited, stats, discovery);
|
|
57557
58427
|
const files = discovery.files;
|
|
57558
58428
|
files.sort(compareFilePaths);
|
|
@@ -57571,7 +58441,7 @@ var secretscan = createSwarmTool({
|
|
|
57571
58441
|
let skippedFiles = stats.skippedFiles;
|
|
57572
58442
|
let incompleteFiles = stats.fileErrors + Math.max(0, discovery.totalCandidates - filesToScan.length) + (discovery.deadlineExceeded || discovery.cleanupFailed ? 1 : 0) + discovery.unexaminedDirectories;
|
|
57573
58443
|
for (let index = 0;index < filesToScan.length; index++) {
|
|
57574
|
-
if (
|
|
58444
|
+
if (_internals76.now() >= deadline) {
|
|
57575
58445
|
for (const remaining of filesToScan.slice(index)) {
|
|
57576
58446
|
recordIncompletePath(discovery.incompletePaths, scanDir, remaining, "deadline");
|
|
57577
58447
|
}
|
|
@@ -57607,7 +58477,7 @@ var secretscan = createSwarmTool({
|
|
|
57607
58477
|
}
|
|
57608
58478
|
}
|
|
57609
58479
|
if (index + 1 < filesToScan.length) {
|
|
57610
|
-
await
|
|
58480
|
+
await _internals76.yieldToEventLoop();
|
|
57611
58481
|
}
|
|
57612
58482
|
}
|
|
57613
58483
|
allFindings.sort((a, b) => {
|
|
@@ -57670,7 +58540,7 @@ var secretscan = createSwarmTool({
|
|
|
57670
58540
|
});
|
|
57671
58541
|
async function runSecretscan(directory) {
|
|
57672
58542
|
try {
|
|
57673
|
-
const result = await
|
|
58543
|
+
const result = await _internals76.secretscan.execute({ directory }, {});
|
|
57674
58544
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
57675
58545
|
return JSON.parse(jsonStr);
|
|
57676
58546
|
} catch (e) {
|
|
@@ -57721,10 +58591,10 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57721
58591
|
if (files.length > filesToScan.length) {
|
|
57722
58592
|
recordIncompletePath(incompletePaths, canonicalRoot, canonicalRoot, "max_files");
|
|
57723
58593
|
}
|
|
57724
|
-
const deadline =
|
|
57725
|
-
await
|
|
58594
|
+
const deadline = _internals76.now() + SCAN_TIME_BUDGET_MS;
|
|
58595
|
+
await _internals76.yieldToEventLoop();
|
|
57726
58596
|
for (let index = 0;index < filesToScan.length; index++) {
|
|
57727
|
-
if (
|
|
58597
|
+
if (_internals76.now() >= deadline) {
|
|
57728
58598
|
for (const remaining of filesToScan.slice(index)) {
|
|
57729
58599
|
const remainingPath = path82.isAbsolute(remaining) ? path82.resolve(remaining) : path82.resolve(rawRoot, remaining);
|
|
57730
58600
|
recordIncompletePath(incompletePaths, canonicalRoot, remainingPath, "deadline");
|
|
@@ -57751,7 +58621,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57751
58621
|
}
|
|
57752
58622
|
let lstat3;
|
|
57753
58623
|
try {
|
|
57754
|
-
lstat3 =
|
|
58624
|
+
lstat3 = _internals76.lstatFile(resolvedPath);
|
|
57755
58625
|
} catch (error2) {
|
|
57756
58626
|
const err = error2;
|
|
57757
58627
|
if (err.code === "ENOENT") {
|
|
@@ -57820,7 +58690,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57820
58690
|
assertNever(outcome);
|
|
57821
58691
|
}
|
|
57822
58692
|
if (index + 1 < filesToScan.length) {
|
|
57823
|
-
await
|
|
58693
|
+
await _internals76.yieldToEventLoop();
|
|
57824
58694
|
}
|
|
57825
58695
|
}
|
|
57826
58696
|
findings.sort((a, b) => {
|
|
@@ -57850,7 +58720,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57850
58720
|
};
|
|
57851
58721
|
}
|
|
57852
58722
|
}
|
|
57853
|
-
var
|
|
58723
|
+
var _internals76 = {
|
|
57854
58724
|
secretscan,
|
|
57855
58725
|
runSecretscan,
|
|
57856
58726
|
runSecretscanOnFiles,
|
|
@@ -58134,7 +59004,7 @@ async function buildImpactMapInternal(cwd) {
|
|
|
58134
59004
|
}
|
|
58135
59005
|
return impactMap;
|
|
58136
59006
|
}
|
|
58137
|
-
var
|
|
59007
|
+
var _internals77 = {
|
|
58138
59008
|
validateProjectRoot,
|
|
58139
59009
|
normalizePath: normalizePath2,
|
|
58140
59010
|
isCacheStale,
|
|
@@ -58149,8 +59019,8 @@ var _internals76 = {
|
|
|
58149
59019
|
_clearGoModuleCache
|
|
58150
59020
|
};
|
|
58151
59021
|
async function buildImpactMap(cwd) {
|
|
58152
|
-
const impactMap = await
|
|
58153
|
-
await
|
|
59022
|
+
const impactMap = await _internals77.buildImpactMapInternal(cwd);
|
|
59023
|
+
await _internals77.saveImpactMap(cwd, impactMap);
|
|
58154
59024
|
return impactMap;
|
|
58155
59025
|
}
|
|
58156
59026
|
async function loadImpactMap(cwd, options) {
|
|
@@ -58164,7 +59034,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
58164
59034
|
const hasValidValues = Object.values(map).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
58165
59035
|
if (hasValidValues) {
|
|
58166
59036
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
58167
|
-
if (!
|
|
59037
|
+
if (!_internals77.isCacheStale(map, generatedAt)) {
|
|
58168
59038
|
return map;
|
|
58169
59039
|
}
|
|
58170
59040
|
if (options?.skipRebuild) {
|
|
@@ -58184,13 +59054,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
58184
59054
|
if (options?.skipRebuild) {
|
|
58185
59055
|
return {};
|
|
58186
59056
|
}
|
|
58187
|
-
return
|
|
59057
|
+
return _internals77.buildImpactMap(cwd);
|
|
58188
59058
|
}
|
|
58189
59059
|
async function saveImpactMap(cwd, impactMap) {
|
|
58190
59060
|
if (!path83.isAbsolute(cwd)) {
|
|
58191
59061
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
58192
59062
|
}
|
|
58193
|
-
|
|
59063
|
+
_internals77.validateProjectRoot(cwd);
|
|
58194
59064
|
const cacheDir2 = path83.join(cwd, ".swarm", "cache");
|
|
58195
59065
|
const cachePath = path83.join(cacheDir2, "impact-map.json");
|
|
58196
59066
|
if (!fs34.existsSync(cacheDir2)) {
|
|
@@ -58214,7 +59084,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
58214
59084
|
};
|
|
58215
59085
|
}
|
|
58216
59086
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
58217
|
-
const impactMap = await
|
|
59087
|
+
const impactMap = await _internals77.loadImpactMap(cwd);
|
|
58218
59088
|
const impactedTestsSet = new Set;
|
|
58219
59089
|
const untestedFiles = [];
|
|
58220
59090
|
let visitedCount = 0;
|
|
@@ -58491,7 +59361,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
58491
59361
|
}
|
|
58492
59362
|
const historyPath = getHistoryPath(workingDir);
|
|
58493
59363
|
const historyDir = path84.dirname(historyPath);
|
|
58494
|
-
|
|
59364
|
+
_internals78.validateProjectRoot(workingDir);
|
|
58495
59365
|
if (!fs35.existsSync(historyDir)) {
|
|
58496
59366
|
fs35.mkdirSync(historyDir, { recursive: true });
|
|
58497
59367
|
}
|
|
@@ -58614,7 +59484,7 @@ function getAllHistory(workingDir) {
|
|
|
58614
59484
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
58615
59485
|
return records;
|
|
58616
59486
|
}
|
|
58617
|
-
var
|
|
59487
|
+
var _internals78 = {
|
|
58618
59488
|
validateProjectRoot
|
|
58619
59489
|
};
|
|
58620
59490
|
|
|
@@ -58627,7 +59497,7 @@ var MAX_SAFE_TEST_FILES = 50;
|
|
|
58627
59497
|
var MAX_SAFE_SOURCE_FILES = 1;
|
|
58628
59498
|
async function estimateFanOut(sourceFiles, cwd) {
|
|
58629
59499
|
try {
|
|
58630
|
-
const impactMap = await
|
|
59500
|
+
const impactMap = await _internals79.loadImpactMap(cwd, {
|
|
58631
59501
|
skipRebuild: true
|
|
58632
59502
|
});
|
|
58633
59503
|
const uniqueTestFiles = new Set;
|
|
@@ -58798,7 +59668,7 @@ function resolveNativeTarget(target, workingDir) {
|
|
|
58798
59668
|
if (relative14.startsWith("..") || path85.isAbsolute(relative14)) {
|
|
58799
59669
|
return { success: false, error: "Native target path escapes project root" };
|
|
58800
59670
|
}
|
|
58801
|
-
if (!
|
|
59671
|
+
if (!_internals79.isCommandAvailable(target.framework === "go-test" ? "go" : "ctest")) {
|
|
58802
59672
|
return {
|
|
58803
59673
|
success: false,
|
|
58804
59674
|
error: `Native target framework "${target.framework}" is unavailable`
|
|
@@ -58859,45 +59729,45 @@ function hasDevDependency(devDeps, ...patterns) {
|
|
|
58859
59729
|
return hasPackageJsonDependency(devDeps, ...patterns);
|
|
58860
59730
|
}
|
|
58861
59731
|
function detectGoTest(cwd) {
|
|
58862
|
-
return
|
|
59732
|
+
return _internals79.existsSync(path85.join(cwd, "go.mod")) && _internals79.isCommandAvailable("go");
|
|
58863
59733
|
}
|
|
58864
59734
|
function detectJavaMaven(cwd) {
|
|
58865
|
-
return
|
|
59735
|
+
return _internals79.existsSync(path85.join(cwd, "pom.xml")) && _internals79.isCommandAvailable("mvn");
|
|
58866
59736
|
}
|
|
58867
59737
|
function detectGradle(cwd) {
|
|
58868
|
-
const hasBuildFile =
|
|
58869
|
-
const hasGradlew =
|
|
58870
|
-
return hasBuildFile && (hasGradlew ||
|
|
59738
|
+
const hasBuildFile = _internals79.existsSync(path85.join(cwd, "build.gradle")) || _internals79.existsSync(path85.join(cwd, "build.gradle.kts"));
|
|
59739
|
+
const hasGradlew = _internals79.existsSync(path85.join(cwd, "gradlew")) || _internals79.existsSync(path85.join(cwd, "gradlew.bat"));
|
|
59740
|
+
return hasBuildFile && (hasGradlew || _internals79.isCommandAvailable("gradle"));
|
|
58871
59741
|
}
|
|
58872
59742
|
function detectDotnetTest(cwd) {
|
|
58873
59743
|
try {
|
|
58874
|
-
const files =
|
|
59744
|
+
const files = _internals79.readdirSync(cwd);
|
|
58875
59745
|
const hasCsproj = files.some((f) => f.endsWith(".csproj"));
|
|
58876
|
-
return hasCsproj &&
|
|
59746
|
+
return hasCsproj && _internals79.isCommandAvailable("dotnet");
|
|
58877
59747
|
} catch {
|
|
58878
59748
|
return false;
|
|
58879
59749
|
}
|
|
58880
59750
|
}
|
|
58881
59751
|
function detectCTest(cwd) {
|
|
58882
|
-
const hasSource =
|
|
58883
|
-
const hasBuildCache =
|
|
58884
|
-
return (hasSource || hasBuildCache) &&
|
|
59752
|
+
const hasSource = _internals79.existsSync(path85.join(cwd, "CMakeLists.txt"));
|
|
59753
|
+
const hasBuildCache = _internals79.existsSync(path85.join(cwd, "CMakeCache.txt")) || _internals79.existsSync(path85.join(cwd, "build", "CMakeCache.txt"));
|
|
59754
|
+
return (hasSource || hasBuildCache) && _internals79.isCommandAvailable("ctest");
|
|
58885
59755
|
}
|
|
58886
59756
|
function detectSwiftTest(cwd) {
|
|
58887
|
-
return
|
|
59757
|
+
return _internals79.existsSync(path85.join(cwd, "Package.swift")) && _internals79.isCommandAvailable("swift");
|
|
58888
59758
|
}
|
|
58889
59759
|
function detectDartTest(cwd) {
|
|
58890
|
-
return
|
|
59760
|
+
return _internals79.existsSync(path85.join(cwd, "pubspec.yaml")) && (_internals79.isCommandAvailable("dart") || _internals79.isCommandAvailable("flutter"));
|
|
58891
59761
|
}
|
|
58892
59762
|
function detectRSpec(cwd) {
|
|
58893
|
-
const hasRSpecFile =
|
|
58894
|
-
const hasGemfile =
|
|
58895
|
-
const hasSpecDir =
|
|
59763
|
+
const hasRSpecFile = _internals79.existsSync(path85.join(cwd, ".rspec"));
|
|
59764
|
+
const hasGemfile = _internals79.existsSync(path85.join(cwd, "Gemfile"));
|
|
59765
|
+
const hasSpecDir = _internals79.existsSync(path85.join(cwd, "spec"));
|
|
58896
59766
|
const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
|
|
58897
|
-
return hasRSpec && (
|
|
59767
|
+
return hasRSpec && (_internals79.isCommandAvailable("bundle") || _internals79.isCommandAvailable("rspec"));
|
|
58898
59768
|
}
|
|
58899
59769
|
function detectMinitest(cwd) {
|
|
58900
|
-
return
|
|
59770
|
+
return _internals79.existsSync(path85.join(cwd, "test")) && (_internals79.existsSync(path85.join(cwd, "Gemfile")) || _internals79.existsSync(path85.join(cwd, "Rakefile"))) && _internals79.isCommandAvailable("ruby");
|
|
58901
59771
|
}
|
|
58902
59772
|
var DISPATCH_FRAMEWORK_MAP = {
|
|
58903
59773
|
bun: "bun",
|
|
@@ -58990,8 +59860,8 @@ async function detectTestFramework(cwd) {
|
|
|
58990
59860
|
const baseDir = cwd;
|
|
58991
59861
|
try {
|
|
58992
59862
|
const packageJsonPath = path85.join(baseDir, "package.json");
|
|
58993
|
-
if (
|
|
58994
|
-
const content =
|
|
59863
|
+
if (_internals79.existsSync(packageJsonPath)) {
|
|
59864
|
+
const content = _internals79.readFileSync(packageJsonPath, "utf-8");
|
|
58995
59865
|
const pkg = JSON.parse(content);
|
|
58996
59866
|
const _deps = pkg.dependencies || {};
|
|
58997
59867
|
const devDeps = pkg.devDependencies || {};
|
|
@@ -59010,7 +59880,7 @@ async function detectTestFramework(cwd) {
|
|
|
59010
59880
|
return "jest";
|
|
59011
59881
|
if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
|
|
59012
59882
|
return "mocha";
|
|
59013
|
-
if (
|
|
59883
|
+
if (_internals79.existsSync(path85.join(baseDir, "bun.lockb")) || _internals79.existsSync(path85.join(baseDir, "bun.lock"))) {
|
|
59014
59884
|
if (scripts.test?.includes("bun"))
|
|
59015
59885
|
return "bun";
|
|
59016
59886
|
}
|
|
@@ -59020,28 +59890,28 @@ async function detectTestFramework(cwd) {
|
|
|
59020
59890
|
const pyprojectTomlPath = path85.join(baseDir, "pyproject.toml");
|
|
59021
59891
|
const setupCfgPath = path85.join(baseDir, "setup.cfg");
|
|
59022
59892
|
const requirementsTxtPath = path85.join(baseDir, "requirements.txt");
|
|
59023
|
-
if (
|
|
59024
|
-
const content =
|
|
59893
|
+
if (_internals79.existsSync(pyprojectTomlPath)) {
|
|
59894
|
+
const content = _internals79.readFileSync(pyprojectTomlPath, "utf-8");
|
|
59025
59895
|
if (content.includes("[tool.pytest"))
|
|
59026
59896
|
return "pytest";
|
|
59027
59897
|
if (content.includes("pytest"))
|
|
59028
59898
|
return "pytest";
|
|
59029
59899
|
}
|
|
59030
|
-
if (
|
|
59031
|
-
const content =
|
|
59900
|
+
if (_internals79.existsSync(setupCfgPath)) {
|
|
59901
|
+
const content = _internals79.readFileSync(setupCfgPath, "utf-8");
|
|
59032
59902
|
if (content.includes("[pytest]"))
|
|
59033
59903
|
return "pytest";
|
|
59034
59904
|
}
|
|
59035
|
-
if (
|
|
59036
|
-
const content =
|
|
59905
|
+
if (_internals79.existsSync(requirementsTxtPath)) {
|
|
59906
|
+
const content = _internals79.readFileSync(requirementsTxtPath, "utf-8");
|
|
59037
59907
|
if (content.includes("pytest"))
|
|
59038
59908
|
return "pytest";
|
|
59039
59909
|
}
|
|
59040
59910
|
} catch {}
|
|
59041
59911
|
try {
|
|
59042
59912
|
const cargoTomlPath = path85.join(baseDir, "Cargo.toml");
|
|
59043
|
-
if (
|
|
59044
|
-
const content =
|
|
59913
|
+
if (_internals79.existsSync(cargoTomlPath)) {
|
|
59914
|
+
const content = _internals79.readFileSync(cargoTomlPath, "utf-8");
|
|
59045
59915
|
if (content.includes("[dev-dependencies]")) {
|
|
59046
59916
|
if (content.includes("tokio") || content.includes("mockall") || content.includes("pretty_assertions")) {
|
|
59047
59917
|
return "cargo";
|
|
@@ -59053,7 +59923,7 @@ async function detectTestFramework(cwd) {
|
|
|
59053
59923
|
const pesterConfigPath = path85.join(baseDir, "pester.config.ps1");
|
|
59054
59924
|
const pesterConfigJsonPath = path85.join(baseDir, "pester.config.ps1.json");
|
|
59055
59925
|
const pesterPs1Path = path85.join(baseDir, "tests.ps1");
|
|
59056
|
-
if (
|
|
59926
|
+
if (_internals79.existsSync(pesterConfigPath) || _internals79.existsSync(pesterConfigJsonPath) || _internals79.existsSync(pesterPs1Path)) {
|
|
59057
59927
|
return "pester";
|
|
59058
59928
|
}
|
|
59059
59929
|
} catch {}
|
|
@@ -59081,12 +59951,12 @@ async function detectTestFramework(cwd) {
|
|
|
59081
59951
|
return "none";
|
|
59082
59952
|
}
|
|
59083
59953
|
function detectPhpTest(cwd) {
|
|
59084
|
-
if (
|
|
59954
|
+
if (_internals79.existsSync(path85.join(cwd, "artisan")) && _internals79.existsSync(path85.join(cwd, "composer.json"))) {
|
|
59085
59955
|
return "php-artisan";
|
|
59086
59956
|
}
|
|
59087
|
-
if (
|
|
59957
|
+
if (_internals79.existsSync(path85.join(cwd, "Pest.php")))
|
|
59088
59958
|
return "pest";
|
|
59089
|
-
if (
|
|
59959
|
+
if (_internals79.existsSync(path85.join(cwd, "phpunit.xml")) || _internals79.existsSync(path85.join(cwd, "phpunit.xml.dist"))) {
|
|
59090
59960
|
return "phpunit";
|
|
59091
59961
|
}
|
|
59092
59962
|
return null;
|
|
@@ -59509,9 +60379,9 @@ function buildTestCommand(framework, scope, files, coverage, baseDir, bail, targ
|
|
|
59509
60379
|
return args;
|
|
59510
60380
|
}
|
|
59511
60381
|
case "dart-test":
|
|
59512
|
-
return
|
|
60382
|
+
return _internals79.isCommandAvailable("flutter") ? ["flutter", "test", ...files] : ["dart", "test", ...files];
|
|
59513
60383
|
case "rspec": {
|
|
59514
|
-
const args =
|
|
60384
|
+
const args = _internals79.isCommandAvailable("bundle") ? ["bundle", "exec", "rspec"] : ["rspec"];
|
|
59515
60385
|
if (bail)
|
|
59516
60386
|
args.push("--fail-fast");
|
|
59517
60387
|
if (scope !== "all" && files.length > 0) {
|
|
@@ -60058,7 +60928,7 @@ async function runTests(framework, scope, files, coverage, timeout_ms, cwd, bail
|
|
|
60058
60928
|
resolve30({ kind: "timeout" });
|
|
60059
60929
|
}, timeout_ms);
|
|
60060
60930
|
});
|
|
60061
|
-
proc =
|
|
60931
|
+
proc = _internals79.bunSpawn(command, {
|
|
60062
60932
|
stdin: "ignore",
|
|
60063
60933
|
stdout: "pipe",
|
|
60064
60934
|
stderr: "pipe",
|
|
@@ -60653,7 +61523,7 @@ var test_runner = createSwarmTool({
|
|
|
60653
61523
|
return JSON.stringify(errorResult, null, 2);
|
|
60654
61524
|
}
|
|
60655
61525
|
try {
|
|
60656
|
-
const impactResult = await
|
|
61526
|
+
const impactResult = await _internals79.analyzeImpact(sourceFiles, workingDir, MAX_SAFE_TEST_FILES);
|
|
60657
61527
|
if (impactResult.budgetExceeded) {
|
|
60658
61528
|
const errorResult = {
|
|
60659
61529
|
success: false,
|
|
@@ -60744,7 +61614,7 @@ var test_runner = createSwarmTool({
|
|
|
60744
61614
|
return JSON.stringify(result, null, 2);
|
|
60745
61615
|
}
|
|
60746
61616
|
});
|
|
60747
|
-
var
|
|
61617
|
+
var _internals79 = {
|
|
60748
61618
|
analyzeImpact,
|
|
60749
61619
|
loadImpactMap,
|
|
60750
61620
|
isCommandAvailable,
|
|
@@ -60849,9 +61719,9 @@ function getVersionFileVersion(dir) {
|
|
|
60849
61719
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
60850
61720
|
const startTime = Date.now();
|
|
60851
61721
|
try {
|
|
60852
|
-
const packageVersion =
|
|
60853
|
-
const changelogVersion =
|
|
60854
|
-
const versionFileVersion =
|
|
61722
|
+
const packageVersion = _internals80.getPackageVersion(dir);
|
|
61723
|
+
const changelogVersion = _internals80.getChangelogVersion(dir);
|
|
61724
|
+
const versionFileVersion = _internals80.getVersionFileVersion(dir);
|
|
60855
61725
|
const versions = [];
|
|
60856
61726
|
if (packageVersion)
|
|
60857
61727
|
versions.push(`package.json: ${packageVersion}`);
|
|
@@ -61040,7 +61910,7 @@ async function runTestsCheck(_dir, scope, timeoutMs) {
|
|
|
61040
61910
|
async function runSecretsCheck(dir, timeoutMs) {
|
|
61041
61911
|
const startTime = Date.now();
|
|
61042
61912
|
try {
|
|
61043
|
-
const secretsPromise =
|
|
61913
|
+
const secretsPromise = _internals80.runSecretscan(dir);
|
|
61044
61914
|
const timeoutPromise = new Promise((_, reject) => {
|
|
61045
61915
|
setTimeout(() => {
|
|
61046
61916
|
reject(new Error(`Secrets check timed out after ${timeoutMs}ms`));
|
|
@@ -61407,7 +62277,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61407
62277
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
61408
62278
|
let validatedDir;
|
|
61409
62279
|
try {
|
|
61410
|
-
validatedDir =
|
|
62280
|
+
validatedDir = _internals80.validateDirectoryPath(dir);
|
|
61411
62281
|
} catch (error2) {
|
|
61412
62282
|
return {
|
|
61413
62283
|
id: reportId,
|
|
@@ -61427,7 +62297,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61427
62297
|
}
|
|
61428
62298
|
let validatedTimeout;
|
|
61429
62299
|
try {
|
|
61430
|
-
validatedTimeout =
|
|
62300
|
+
validatedTimeout = _internals80.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
61431
62301
|
} catch (error2) {
|
|
61432
62302
|
return {
|
|
61433
62303
|
id: reportId,
|
|
@@ -61468,12 +62338,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
61468
62338
|
});
|
|
61469
62339
|
const checks = [];
|
|
61470
62340
|
log("[Preflight] Running lint check...");
|
|
61471
|
-
const lintResult = await
|
|
62341
|
+
const lintResult = await _internals80.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
61472
62342
|
checks.push(lintResult);
|
|
61473
62343
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
61474
62344
|
if (!cfg.skipTests) {
|
|
61475
62345
|
log("[Preflight] Running tests check...");
|
|
61476
|
-
const testsResult = await
|
|
62346
|
+
const testsResult = await _internals80.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
61477
62347
|
checks.push(testsResult);
|
|
61478
62348
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
61479
62349
|
} else {
|
|
@@ -61485,7 +62355,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61485
62355
|
}
|
|
61486
62356
|
if (!cfg.skipSecrets) {
|
|
61487
62357
|
log("[Preflight] Running secrets check...");
|
|
61488
|
-
const secretsResult = await
|
|
62358
|
+
const secretsResult = await _internals80.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
61489
62359
|
checks.push(secretsResult);
|
|
61490
62360
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
61491
62361
|
} else {
|
|
@@ -61497,7 +62367,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61497
62367
|
}
|
|
61498
62368
|
if (!cfg.skipEvidence) {
|
|
61499
62369
|
log("[Preflight] Running evidence check...");
|
|
61500
|
-
const evidenceResult = await
|
|
62370
|
+
const evidenceResult = await _internals80.runEvidenceCheck(validatedDir);
|
|
61501
62371
|
checks.push(evidenceResult);
|
|
61502
62372
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
61503
62373
|
} else {
|
|
@@ -61508,12 +62378,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
61508
62378
|
});
|
|
61509
62379
|
}
|
|
61510
62380
|
log("[Preflight] Running requirement coverage check...");
|
|
61511
|
-
const reqCoverageResult = await
|
|
62381
|
+
const reqCoverageResult = await _internals80.runRequirementCoverageCheck(validatedDir, phase);
|
|
61512
62382
|
checks.push(reqCoverageResult);
|
|
61513
62383
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
61514
62384
|
if (!cfg.skipVersion) {
|
|
61515
62385
|
log("[Preflight] Running version check...");
|
|
61516
|
-
const versionResult = await
|
|
62386
|
+
const versionResult = await _internals80.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
61517
62387
|
checks.push(versionResult);
|
|
61518
62388
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
61519
62389
|
} else {
|
|
@@ -61576,10 +62446,10 @@ function formatPreflightMarkdown(report) {
|
|
|
61576
62446
|
async function handlePreflightCommand(directory, _args) {
|
|
61577
62447
|
const plan = await loadPlan(directory);
|
|
61578
62448
|
const phase = plan?.current_phase ?? 1;
|
|
61579
|
-
const report = await
|
|
61580
|
-
return
|
|
62449
|
+
const report = await _internals80.runPreflight(directory, phase);
|
|
62450
|
+
return _internals80.formatPreflightMarkdown(report);
|
|
61581
62451
|
}
|
|
61582
|
-
var
|
|
62452
|
+
var _internals80 = {
|
|
61583
62453
|
runPreflight,
|
|
61584
62454
|
formatPreflightMarkdown,
|
|
61585
62455
|
handlePreflightCommand,
|
|
@@ -62863,7 +63733,7 @@ function pruneOldResetBackups(backupsRoot, warnings) {
|
|
|
62863
63733
|
}
|
|
62864
63734
|
|
|
62865
63735
|
// src/commands/reset.ts
|
|
62866
|
-
var
|
|
63736
|
+
var _internals81 = {
|
|
62867
63737
|
backupSwarmStateBeforeReset
|
|
62868
63738
|
};
|
|
62869
63739
|
async function handleResetCommand(directory, args) {
|
|
@@ -62903,7 +63773,7 @@ async function handleResetCommand(directory, args) {
|
|
|
62903
63773
|
];
|
|
62904
63774
|
const results = [];
|
|
62905
63775
|
try {
|
|
62906
|
-
const backup =
|
|
63776
|
+
const backup = _internals81.backupSwarmStateBeforeReset(directory, "reset", [
|
|
62907
63777
|
...filesToReset,
|
|
62908
63778
|
"summaries"
|
|
62909
63779
|
]);
|
|
@@ -63045,7 +63915,7 @@ function clearTrajectoryStep(sessionId) {
|
|
|
63045
63915
|
}
|
|
63046
63916
|
|
|
63047
63917
|
// src/commands/reset-session.ts
|
|
63048
|
-
var
|
|
63918
|
+
var _internals82 = {
|
|
63049
63919
|
cleanupOrphanedBranches,
|
|
63050
63920
|
backupSwarmStateBeforeReset,
|
|
63051
63921
|
recoverStaleCoderSettlements
|
|
@@ -63058,7 +63928,7 @@ function errorMessage(err) {
|
|
|
63058
63928
|
async function handleResetSessionCommand(directory, _args) {
|
|
63059
63929
|
const results = [];
|
|
63060
63930
|
try {
|
|
63061
|
-
const backup =
|
|
63931
|
+
const backup = _internals82.backupSwarmStateBeforeReset(directory, "reset-session", ["session"]);
|
|
63062
63932
|
if (backup.backupDir && backup.copied.length > 0) {
|
|
63063
63933
|
const rel = path89.relative(directory, backup.backupDir);
|
|
63064
63934
|
results.push(`\uD83D\uDCE6 Backed up session state to ${rel}/ (restore by copying files back into .swarm/session/)`);
|
|
@@ -63120,7 +63990,7 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
63120
63990
|
results.push(`\u2705 Cleared ${activeAgentCount} active-agent mapping(s)`);
|
|
63121
63991
|
let preserveWorktrees = false;
|
|
63122
63992
|
try {
|
|
63123
|
-
const { results: settlementResults, truncated } = await
|
|
63993
|
+
const { results: settlementResults, truncated } = await _internals82.recoverStaleCoderSettlements(directory, {
|
|
63124
63994
|
force: true
|
|
63125
63995
|
});
|
|
63126
63996
|
if (settlementResults.length === 0) {
|
|
@@ -63180,7 +64050,7 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
63180
64050
|
results.push(`\u26A0\uFE0F Failed to remove .swarm-worktrees/: ${errorMessage(err)}`);
|
|
63181
64051
|
}
|
|
63182
64052
|
try {
|
|
63183
|
-
const branchResult = await
|
|
64053
|
+
const branchResult = await _internals82.cleanupOrphanedBranches(directory, []);
|
|
63184
64054
|
if (branchResult.removed.length > 0) {
|
|
63185
64055
|
results.push(`\u2705 Removed ${branchResult.removed.length} orphan swarm-lane branch(es)`);
|
|
63186
64056
|
}
|
|
@@ -63575,8 +64445,8 @@ async function runGit2(directory, args, options) {
|
|
|
63575
64445
|
};
|
|
63576
64446
|
let proc;
|
|
63577
64447
|
try {
|
|
63578
|
-
const gitExecutable = await
|
|
63579
|
-
proc =
|
|
64448
|
+
const gitExecutable = await _internals83.resolveGitExecutable();
|
|
64449
|
+
proc = _internals83.bunSpawn([gitExecutable, "-c", "core.quotepath=false", ...args], spawnOptions);
|
|
63580
64450
|
} catch (error2) {
|
|
63581
64451
|
return {
|
|
63582
64452
|
ok: false,
|
|
@@ -63659,8 +64529,8 @@ function sameCanonicalDirectory(left, right) {
|
|
|
63659
64529
|
if (samePath(left, right))
|
|
63660
64530
|
return true;
|
|
63661
64531
|
try {
|
|
63662
|
-
const leftStat =
|
|
63663
|
-
const rightStat =
|
|
64532
|
+
const leftStat = _internals83.lstatBigIntSync(left);
|
|
64533
|
+
const rightStat = _internals83.lstatBigIntSync(right);
|
|
63664
64534
|
return leftStat.isDirectory() && rightStat.isDirectory() && !leftStat.isSymbolicLink() && !rightStat.isSymbolicLink() && (leftStat.dev !== 0n || leftStat.ino !== 0n) && sameFileIdentity(leftStat, rightStat);
|
|
63665
64535
|
} catch {
|
|
63666
64536
|
return false;
|
|
@@ -63765,18 +64635,18 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63765
64635
|
}
|
|
63766
64636
|
});
|
|
63767
64637
|
try {
|
|
63768
|
-
if (
|
|
64638
|
+
if (_internals83.now() > budget.deadlineMs) {
|
|
63769
64639
|
return deadlineExceeded("working-tree content identity deadline expired before file hashing started");
|
|
63770
64640
|
}
|
|
63771
|
-
const pathStat =
|
|
64641
|
+
const pathStat = _internals83.lstatBigIntSync(candidate);
|
|
63772
64642
|
if (!pathStat.isFile() || pathStat.isSymbolicLink())
|
|
63773
64643
|
return { identity: null };
|
|
63774
|
-
const canonicalBeforeOpen =
|
|
64644
|
+
const canonicalBeforeOpen = _internals83.realpathSync(candidate);
|
|
63775
64645
|
if (!isContained(root, canonicalBeforeOpen))
|
|
63776
64646
|
return { identity: null };
|
|
63777
|
-
handle =
|
|
63778
|
-
const openedBeforeRead =
|
|
63779
|
-
const canonicalAfterOpen =
|
|
64647
|
+
handle = _internals83.openSync(canonicalBeforeOpen, "r");
|
|
64648
|
+
const openedBeforeRead = _internals83.fstatBigIntSync(handle);
|
|
64649
|
+
const canonicalAfterOpen = _internals83.realpathSync(candidate);
|
|
63780
64650
|
if (!openedBeforeRead.isFile() || !compareStats(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
63781
64651
|
return { identity: null };
|
|
63782
64652
|
}
|
|
@@ -63794,17 +64664,17 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63794
64664
|
const buffer = Buffer.alloc(64 * 1024);
|
|
63795
64665
|
let offset = 0;
|
|
63796
64666
|
while (offset < fileBytes) {
|
|
63797
|
-
if (
|
|
64667
|
+
if (_internals83.now() > budget.deadlineMs) {
|
|
63798
64668
|
return deadlineExceeded("working-tree content identity deadline expired while hashing file content");
|
|
63799
64669
|
}
|
|
63800
|
-
const read =
|
|
64670
|
+
const read = _internals83.readSync(handle, buffer, 0, Math.min(buffer.byteLength, fileBytes - offset), offset);
|
|
63801
64671
|
if (read === 0)
|
|
63802
64672
|
break;
|
|
63803
64673
|
hash2.update(buffer.subarray(0, read));
|
|
63804
64674
|
offset += read;
|
|
63805
64675
|
}
|
|
63806
|
-
const openedAfterRead =
|
|
63807
|
-
const canonicalAfterRead =
|
|
64676
|
+
const openedAfterRead = _internals83.fstatBigIntSync(handle);
|
|
64677
|
+
const canonicalAfterRead = _internals83.realpathSync(candidate);
|
|
63808
64678
|
if (!compareStats(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || offset !== fileBytes) {
|
|
63809
64679
|
return { identity: null };
|
|
63810
64680
|
}
|
|
@@ -63821,7 +64691,7 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63821
64691
|
} finally {
|
|
63822
64692
|
if (handle !== undefined) {
|
|
63823
64693
|
try {
|
|
63824
|
-
|
|
64694
|
+
_internals83.closeSync(handle);
|
|
63825
64695
|
} catch {}
|
|
63826
64696
|
}
|
|
63827
64697
|
}
|
|
@@ -63833,7 +64703,7 @@ async function buildReviewManifest(root, selector, files, completeness, timeoutM
|
|
|
63833
64703
|
const missingIdentityBindings = new Set;
|
|
63834
64704
|
const workingTreeBudget = selector.kind === "range" ? undefined : {
|
|
63835
64705
|
remainingBytes: WORKTREE_IDENTITY_TOTAL_BYTES,
|
|
63836
|
-
deadlineMs:
|
|
64706
|
+
deadlineMs: _internals83.now() + Math.min(timeoutMs, WORKTREE_IDENTITY_MAX_DURATION_MS)
|
|
63837
64707
|
};
|
|
63838
64708
|
const orderedScopes = [...files.values()].sort((left, right) => compareUtf8Bytes(left.newPath ?? left.oldPath ?? "", right.newPath ?? right.oldPath ?? ""));
|
|
63839
64709
|
const oldTreeForSelector = selector.kind === "working-tree" ? revisionContext.headSha : selector.kind === "range" ? selector.operator === "..." ? revisionContext.mergeBase : revisionContext.baseSha : revisionContext.mergeBase;
|
|
@@ -63973,7 +64843,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63973
64843
|
}
|
|
63974
64844
|
let handle;
|
|
63975
64845
|
try {
|
|
63976
|
-
const pathStat =
|
|
64846
|
+
const pathStat = _internals83.lstatBigIntSync(candidate);
|
|
63977
64847
|
if (pathStat.isSymbolicLink()) {
|
|
63978
64848
|
return {
|
|
63979
64849
|
truncated: false,
|
|
@@ -63994,7 +64864,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63994
64864
|
}
|
|
63995
64865
|
};
|
|
63996
64866
|
}
|
|
63997
|
-
const canonicalBeforeOpen =
|
|
64867
|
+
const canonicalBeforeOpen = _internals83.realpathSync(candidate);
|
|
63998
64868
|
if (!isContained(root, canonicalBeforeOpen)) {
|
|
63999
64869
|
return {
|
|
64000
64870
|
truncated: false,
|
|
@@ -64005,9 +64875,9 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
64005
64875
|
}
|
|
64006
64876
|
};
|
|
64007
64877
|
}
|
|
64008
|
-
handle =
|
|
64009
|
-
const openedBeforeRead =
|
|
64010
|
-
const canonicalAfterOpen =
|
|
64878
|
+
handle = _internals83.openSync(canonicalBeforeOpen, "r");
|
|
64879
|
+
const openedBeforeRead = _internals83.fstatBigIntSync(handle);
|
|
64880
|
+
const canonicalAfterOpen = _internals83.realpathSync(candidate);
|
|
64011
64881
|
if (!openedBeforeRead.isFile() || !sameFileSnapshot(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
64012
64882
|
return {
|
|
64013
64883
|
truncated: false,
|
|
@@ -64022,13 +64892,13 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
64022
64892
|
const bytes = Buffer.alloc(requested);
|
|
64023
64893
|
let count = 0;
|
|
64024
64894
|
while (count < requested) {
|
|
64025
|
-
const read =
|
|
64895
|
+
const read = _internals83.readSync(handle, bytes, count, requested - count, count);
|
|
64026
64896
|
if (read === 0)
|
|
64027
64897
|
break;
|
|
64028
64898
|
count += read;
|
|
64029
64899
|
}
|
|
64030
|
-
const openedAfterRead =
|
|
64031
|
-
const canonicalAfterRead =
|
|
64900
|
+
const openedAfterRead = _internals83.fstatBigIntSync(handle);
|
|
64901
|
+
const canonicalAfterRead = _internals83.realpathSync(candidate);
|
|
64032
64902
|
if (!sameFileSnapshot(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || openedBeforeRead.size <= BigInt(maxFileBytes) && BigInt(count) !== openedBeforeRead.size) {
|
|
64033
64903
|
return {
|
|
64034
64904
|
truncated: false,
|
|
@@ -64080,7 +64950,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
64080
64950
|
} finally {
|
|
64081
64951
|
if (handle !== undefined) {
|
|
64082
64952
|
try {
|
|
64083
|
-
|
|
64953
|
+
_internals83.closeSync(handle);
|
|
64084
64954
|
} catch {}
|
|
64085
64955
|
}
|
|
64086
64956
|
}
|
|
@@ -64118,7 +64988,7 @@ async function collectReviewDiff(options) {
|
|
|
64118
64988
|
const maxUntrackedFileBytes = boundedPositiveInteger(options.maxUntrackedFileBytes, DEFAULT_MAX_UNTRACKED_FILE_BYTES, MAX_UNTRACKED_FILE_BYTES);
|
|
64119
64989
|
let root;
|
|
64120
64990
|
try {
|
|
64121
|
-
root =
|
|
64991
|
+
root = _internals83.realpathSync(options.directory);
|
|
64122
64992
|
} catch (error2) {
|
|
64123
64993
|
return {
|
|
64124
64994
|
status: "error",
|
|
@@ -64141,7 +65011,7 @@ async function collectReviewDiff(options) {
|
|
|
64141
65011
|
}
|
|
64142
65012
|
let gitRoot;
|
|
64143
65013
|
try {
|
|
64144
|
-
gitRoot =
|
|
65014
|
+
gitRoot = _internals83.realpathSync(topLevel.stdout.trim());
|
|
64145
65015
|
} catch {
|
|
64146
65016
|
return {
|
|
64147
65017
|
status: "error",
|
|
@@ -64442,7 +65312,7 @@ async function collectReviewDiff(options) {
|
|
|
64442
65312
|
const clean = canonicalText.trim().length === 0 && untrackedCount === 0 && skipReasons.length === 0;
|
|
64443
65313
|
return { status: clean ? "clean" : "ok", ...scope };
|
|
64444
65314
|
}
|
|
64445
|
-
var
|
|
65315
|
+
var _internals83 = {
|
|
64446
65316
|
bunSpawn,
|
|
64447
65317
|
realpathSync: fs41.realpathSync,
|
|
64448
65318
|
lstatBigIntSync: (path92) => fs41.lstatSync(path92, { bigint: true }),
|
|
@@ -64504,7 +65374,7 @@ function resolveReceiptsDir(directory) {
|
|
|
64504
65374
|
function resolveReceiptIndexPath(directory) {
|
|
64505
65375
|
return path92.join(resolveReceiptsDir(directory), "index.json");
|
|
64506
65376
|
}
|
|
64507
|
-
var
|
|
65377
|
+
var _internals84 = {
|
|
64508
65378
|
openSync: fs42.openSync,
|
|
64509
65379
|
lstatBigIntSync: (path93) => fs42.lstatSync(path93, { bigint: true }),
|
|
64510
65380
|
fstatBigIntSync: (fd) => fs42.fstatSync(fd, { bigint: true })
|
|
@@ -64516,7 +65386,7 @@ function pathsEqual(left, right) {
|
|
|
64516
65386
|
}
|
|
64517
65387
|
function captureCanonicalDirectory(directory, label, expected) {
|
|
64518
65388
|
const resolved = path92.resolve(directory);
|
|
64519
|
-
const stat9 =
|
|
65389
|
+
const stat9 = _internals84.lstatBigIntSync(resolved);
|
|
64520
65390
|
if (!stat9.isDirectory() || stat9.isSymbolicLink()) {
|
|
64521
65391
|
throw new Error(`${label} must be a real directory`);
|
|
64522
65392
|
}
|
|
@@ -64602,7 +65472,7 @@ function assertDirectReceiptFile(context, filePath, mustExist) {
|
|
|
64602
65472
|
throw new Error("review receipt file escapes its expected directory");
|
|
64603
65473
|
}
|
|
64604
65474
|
try {
|
|
64605
|
-
const stat9 =
|
|
65475
|
+
const stat9 = _internals84.lstatBigIntSync(resolved);
|
|
64606
65476
|
if (!stat9.isFile() || stat9.isSymbolicLink()) {
|
|
64607
65477
|
throw new Error("review receipt path must be a real file");
|
|
64608
65478
|
}
|
|
@@ -64626,7 +65496,7 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64626
65496
|
const resolved = assertDirectReceiptFile(context, receiptPath, true);
|
|
64627
65497
|
if (path92.extname(resolved) !== ".json")
|
|
64628
65498
|
return null;
|
|
64629
|
-
const pathBeforeOpen =
|
|
65499
|
+
const pathBeforeOpen = _internals84.lstatBigIntSync(resolved);
|
|
64630
65500
|
if (!pathBeforeOpen.isFile() || pathBeforeOpen.isSymbolicLink() || pathBeforeOpen.size < 0n || pathBeforeOpen.size > BigInt(maxBytes)) {
|
|
64631
65501
|
return null;
|
|
64632
65502
|
}
|
|
@@ -64634,10 +65504,10 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64634
65504
|
if (!pathsEqual(canonicalBeforeOpen, resolved))
|
|
64635
65505
|
return null;
|
|
64636
65506
|
assertReceiptContextCurrent(context);
|
|
64637
|
-
descriptor =
|
|
64638
|
-
const openedBeforeRead =
|
|
65507
|
+
descriptor = _internals84.openSync(canonicalBeforeOpen, "r");
|
|
65508
|
+
const openedBeforeRead = _internals84.fstatBigIntSync(descriptor);
|
|
64639
65509
|
assertReceiptContextCurrent(context);
|
|
64640
|
-
const pathAfterOpen =
|
|
65510
|
+
const pathAfterOpen = _internals84.lstatBigIntSync(resolved);
|
|
64641
65511
|
const canonicalAfterOpen = fs42.realpathSync(resolved);
|
|
64642
65512
|
if (!openedBeforeRead.isFile() || openedBeforeRead.size < 0n || openedBeforeRead.size > BigInt(maxBytes) || !sameFileSnapshot2(pathBeforeOpen, openedBeforeRead) || !sameFileSnapshot2(openedBeforeRead, pathAfterOpen) || !pathsEqual(canonicalBeforeOpen, canonicalAfterOpen)) {
|
|
64643
65513
|
return null;
|
|
@@ -64650,9 +65520,9 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64650
65520
|
break;
|
|
64651
65521
|
bytesRead += count;
|
|
64652
65522
|
}
|
|
64653
|
-
const openedAfterRead =
|
|
65523
|
+
const openedAfterRead = _internals84.fstatBigIntSync(descriptor);
|
|
64654
65524
|
assertReceiptContextCurrent(context);
|
|
64655
|
-
const pathAfterRead =
|
|
65525
|
+
const pathAfterRead = _internals84.lstatBigIntSync(resolved);
|
|
64656
65526
|
const canonicalAfterRead = fs42.realpathSync(resolved);
|
|
64657
65527
|
if (bytesRead !== buffer.length || !sameFileSnapshot2(openedBeforeRead, openedAfterRead) || !sameFileSnapshot2(openedAfterRead, pathAfterRead) || !pathsEqual(canonicalBeforeOpen, canonicalAfterRead)) {
|
|
64658
65528
|
return null;
|
|
@@ -65205,7 +66075,7 @@ var RETRYABLE_CAPTURE_FAILURE_CODES = new Set([
|
|
|
65205
66075
|
]);
|
|
65206
66076
|
var REVIEWER_SCOPE_CAPTURE_CHUNK_BYTES = 262144;
|
|
65207
66077
|
var REVIEWER_SCOPE_CAPTURE_BATCH_DEADLINE_MS = 1e4;
|
|
65208
|
-
var
|
|
66078
|
+
var _internals85 = {
|
|
65209
66079
|
open: fs43.openSync,
|
|
65210
66080
|
fstat: (fd, options) => fs43.fstatSync(fd, options),
|
|
65211
66081
|
read: fs43.readSync,
|
|
@@ -65242,7 +66112,7 @@ function deletedPathIsContained(canonicalRoot, absolute) {
|
|
|
65242
66112
|
let current = path93.dirname(absolute);
|
|
65243
66113
|
for (;; ) {
|
|
65244
66114
|
try {
|
|
65245
|
-
const canonical =
|
|
66115
|
+
const canonical = _internals85.realpathSync(current);
|
|
65246
66116
|
return canonicalRoot === canonical || isWithinRoot2(canonicalRoot, canonical);
|
|
65247
66117
|
} catch (error2) {
|
|
65248
66118
|
if (error2.code !== "ENOENT")
|
|
@@ -65288,7 +66158,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65288
66158
|
let canonicalParent;
|
|
65289
66159
|
const absolute = path93.resolve(directory, normalized);
|
|
65290
66160
|
try {
|
|
65291
|
-
canonicalRoot =
|
|
66161
|
+
canonicalRoot = _internals85.realpathSync(path93.resolve(directory));
|
|
65292
66162
|
} catch {
|
|
65293
66163
|
return {
|
|
65294
66164
|
kind: "capture_failed",
|
|
@@ -65298,13 +66168,13 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65298
66168
|
};
|
|
65299
66169
|
}
|
|
65300
66170
|
try {
|
|
65301
|
-
canonicalParent =
|
|
66171
|
+
canonicalParent = _internals85.realpathSync(path93.dirname(absolute));
|
|
65302
66172
|
} catch (error2) {
|
|
65303
66173
|
if (error2.code === "ENOENT") {
|
|
65304
66174
|
let secondObservation = null;
|
|
65305
66175
|
let secondFailed = false;
|
|
65306
66176
|
try {
|
|
65307
|
-
secondObservation =
|
|
66177
|
+
secondObservation = _internals85.realpathSync(path93.dirname(absolute));
|
|
65308
66178
|
} catch (secondError) {
|
|
65309
66179
|
if (secondError.code !== "ENOENT") {
|
|
65310
66180
|
return {
|
|
@@ -65321,7 +66191,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65321
66191
|
canonicalParent = secondObservation;
|
|
65322
66192
|
} else {
|
|
65323
66193
|
try {
|
|
65324
|
-
|
|
66194
|
+
_internals85.lstat(absolute);
|
|
65325
66195
|
return {
|
|
65326
66196
|
kind: "capture_failed",
|
|
65327
66197
|
file: normalized,
|
|
@@ -65367,7 +66237,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65367
66237
|
}
|
|
65368
66238
|
let before;
|
|
65369
66239
|
try {
|
|
65370
|
-
before =
|
|
66240
|
+
before = _internals85.lstat(absolute);
|
|
65371
66241
|
} catch (error2) {
|
|
65372
66242
|
if (error2.code === "ENOENT") {
|
|
65373
66243
|
return deletedPathIsContained(canonicalRoot, absolute) ? { kind: "captured_deleted", file: normalized } : {
|
|
@@ -65394,7 +66264,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65394
66264
|
};
|
|
65395
66265
|
}
|
|
65396
66266
|
try {
|
|
65397
|
-
const canonicalTarget =
|
|
66267
|
+
const canonicalTarget = _internals85.realpathSync(absolute);
|
|
65398
66268
|
if (!isWithinRoot2(canonicalRoot, canonicalTarget) || path93.dirname(canonicalTarget) !== canonicalParent) {
|
|
65399
66269
|
return {
|
|
65400
66270
|
kind: "capture_failed",
|
|
@@ -65422,7 +66292,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65422
66292
|
const openFlags = fs43.constants.O_RDONLY | (process.platform === "win32" ? 0 : fs43.constants.O_NOFOLLOW);
|
|
65423
66293
|
let beforeBigInt;
|
|
65424
66294
|
try {
|
|
65425
|
-
beforeBigInt =
|
|
66295
|
+
beforeBigInt = _internals85.lstat(absolute, {
|
|
65426
66296
|
bigint: true
|
|
65427
66297
|
});
|
|
65428
66298
|
} catch {
|
|
@@ -65435,7 +66305,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65435
66305
|
}
|
|
65436
66306
|
let fd;
|
|
65437
66307
|
try {
|
|
65438
|
-
fd =
|
|
66308
|
+
fd = _internals85.open(absolute, openFlags);
|
|
65439
66309
|
} catch (error2) {
|
|
65440
66310
|
const code = error2.code;
|
|
65441
66311
|
if (code === "ENOENT" || code === "ELOOP") {
|
|
@@ -65465,7 +66335,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65465
66335
|
};
|
|
65466
66336
|
}
|
|
65467
66337
|
try {
|
|
65468
|
-
const openedBefore =
|
|
66338
|
+
const openedBefore = _internals85.fstat(fd, { bigint: true });
|
|
65469
66339
|
if (!openedBefore.isFile()) {
|
|
65470
66340
|
return {
|
|
65471
66341
|
kind: "capture_failed",
|
|
@@ -65486,7 +66356,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65486
66356
|
const chunk = Buffer.alloc(REVIEWER_SCOPE_CAPTURE_CHUNK_BYTES);
|
|
65487
66357
|
let totalBytes = 0;
|
|
65488
66358
|
for (;; ) {
|
|
65489
|
-
if (options.deadlineAt !== undefined &&
|
|
66359
|
+
if (options.deadlineAt !== undefined && _internals85.now() > options.deadlineAt) {
|
|
65490
66360
|
return {
|
|
65491
66361
|
kind: "capture_failed",
|
|
65492
66362
|
file: normalized,
|
|
@@ -65496,7 +66366,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65496
66366
|
}
|
|
65497
66367
|
let bytesRead;
|
|
65498
66368
|
try {
|
|
65499
|
-
bytesRead =
|
|
66369
|
+
bytesRead = _internals85.read(fd, chunk, 0, chunk.byteLength, null);
|
|
65500
66370
|
} catch (error2) {
|
|
65501
66371
|
const code = error2.code;
|
|
65502
66372
|
return {
|
|
@@ -65512,7 +66382,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65512
66382
|
totalBytes += bytesRead;
|
|
65513
66383
|
hash2.update(bytesRead === chunk.byteLength ? chunk : chunk.subarray(0, bytesRead));
|
|
65514
66384
|
}
|
|
65515
|
-
const openedAfter =
|
|
66385
|
+
const openedAfter = _internals85.fstat(fd, { bigint: true });
|
|
65516
66386
|
if (!sameSnapshot(openedBefore, openedAfter)) {
|
|
65517
66387
|
return {
|
|
65518
66388
|
kind: "capture_failed",
|
|
@@ -65531,7 +66401,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65531
66401
|
}
|
|
65532
66402
|
let pathAfter;
|
|
65533
66403
|
try {
|
|
65534
|
-
pathAfter =
|
|
66404
|
+
pathAfter = _internals85.stat(absolute, { bigint: true });
|
|
65535
66405
|
} catch {
|
|
65536
66406
|
return {
|
|
65537
66407
|
kind: "capture_failed",
|
|
@@ -65550,7 +66420,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65550
66420
|
}
|
|
65551
66421
|
let canonicalAfterRead;
|
|
65552
66422
|
try {
|
|
65553
|
-
canonicalAfterRead =
|
|
66423
|
+
canonicalAfterRead = _internals85.realpathSync(absolute);
|
|
65554
66424
|
} catch {
|
|
65555
66425
|
return {
|
|
65556
66426
|
kind: "capture_failed",
|
|
@@ -65576,7 +66446,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65576
66446
|
} finally {
|
|
65577
66447
|
if (fd !== undefined) {
|
|
65578
66448
|
try {
|
|
65579
|
-
|
|
66449
|
+
_internals85.close(fd);
|
|
65580
66450
|
} catch {}
|
|
65581
66451
|
}
|
|
65582
66452
|
}
|
|
@@ -65608,7 +66478,7 @@ var HEAD_OUTPUT_BYTES = 256;
|
|
|
65608
66478
|
var HEAD_SHA_PATTERN = /^[0-9a-f]{40,64}$/i;
|
|
65609
66479
|
var REVIEWER_TASK_SCOPE_DESCRIPTION = "reviewer-task-files-v2";
|
|
65610
66480
|
var REVIEWER_TASK_SCOPE_HEADER = "opencode-swarm-reviewer-task-scope-v2";
|
|
65611
|
-
var
|
|
66481
|
+
var _internals86 = {
|
|
65612
66482
|
spawn: child_process6.spawn,
|
|
65613
66483
|
realpath: fs44.promises.realpath,
|
|
65614
66484
|
resolveGitExecutable
|
|
@@ -65635,7 +66505,7 @@ async function resolveHeadSha(directory) {
|
|
|
65635
66505
|
let child;
|
|
65636
66506
|
let timeoutHandle;
|
|
65637
66507
|
try {
|
|
65638
|
-
child =
|
|
66508
|
+
child = _internals86.spawn(_internals86.resolveGitExecutable(), ["rev-parse", "--verify", "HEAD"], {
|
|
65639
66509
|
cwd: directory,
|
|
65640
66510
|
stdio: ["ignore", "pipe", "ignore"],
|
|
65641
66511
|
timeout: HEAD_TIMEOUT_MS,
|
|
@@ -65719,7 +66589,7 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
65719
66589
|
let realRoot;
|
|
65720
66590
|
try {
|
|
65721
66591
|
lexicalRoot = path94.resolve(directory);
|
|
65722
|
-
realRoot = await
|
|
66592
|
+
realRoot = await _internals86.realpath(lexicalRoot);
|
|
65723
66593
|
} catch {
|
|
65724
66594
|
return { ok: false, code: "workspace_unresolvable", retryable: false };
|
|
65725
66595
|
}
|
|
@@ -65992,7 +66862,7 @@ function parseReviewerOutput(text, options = {}) {
|
|
|
65992
66862
|
outputMode: "legacy"
|
|
65993
66863
|
};
|
|
65994
66864
|
}
|
|
65995
|
-
var
|
|
66865
|
+
var _internals87 = {
|
|
65996
66866
|
delegationBegin: telemetry.delegationBegin,
|
|
65997
66867
|
delegationEnd: telemetry.delegationEnd,
|
|
65998
66868
|
resolveReviewerTaskScope,
|
|
@@ -66292,7 +67162,7 @@ function scopeFreshnessMismatches(reviewed, current) {
|
|
|
66292
67162
|
}
|
|
66293
67163
|
function createScopeVerifier(input, reviewed, maxBytes) {
|
|
66294
67164
|
return async () => {
|
|
66295
|
-
const current = await
|
|
67165
|
+
const current = await _internals88.collectReviewDiff({
|
|
66296
67166
|
directory: input.directory,
|
|
66297
67167
|
selector: input.selector,
|
|
66298
67168
|
maxBytes
|
|
@@ -66301,7 +67171,7 @@ function createScopeVerifier(input, reviewed, maxBytes) {
|
|
|
66301
67171
|
};
|
|
66302
67172
|
}
|
|
66303
67173
|
async function stalePersistenceResult(input, maxBytes, message, modelCalls) {
|
|
66304
|
-
const current = await
|
|
67174
|
+
const current = await _internals88.collectReviewDiff({
|
|
66305
67175
|
directory: input.directory,
|
|
66306
67176
|
selector: input.selector,
|
|
66307
67177
|
maxBytes
|
|
@@ -66689,7 +67559,7 @@ async function persistErrorResult(input, diff, result, error2, dispatches, promp
|
|
|
66689
67559
|
evidence2.review.error = error2;
|
|
66690
67560
|
addCost(evidence2, dispatches);
|
|
66691
67561
|
try {
|
|
66692
|
-
result.evidencePath = await
|
|
67562
|
+
result.evidencePath = await _internals88.persistEvidence(input.directory, evidence2);
|
|
66693
67563
|
} catch {
|
|
66694
67564
|
if (input.config.final_review.mode === "gate") {
|
|
66695
67565
|
result.blocked = true;
|
|
@@ -66706,7 +67576,7 @@ async function runReviewEngine(input) {
|
|
|
66706
67576
|
const gateMode = input.config.final_review.mode === "gate";
|
|
66707
67577
|
const maxBytes = input.trigger === "task_completion" ? input.config.max_diff_kb * 1024 : input.config.final_review.max_diff_bytes;
|
|
66708
67578
|
const timeoutMs = input.trigger === "task_completion" ? input.config.timeout_ms : input.config.final_review.timeout_ms;
|
|
66709
|
-
const diff = await
|
|
67579
|
+
const diff = await _internals88.collectReviewDiff({
|
|
66710
67580
|
directory: input.directory,
|
|
66711
67581
|
selector: input.selector,
|
|
66712
67582
|
maxBytes
|
|
@@ -66722,7 +67592,7 @@ async function runReviewEngine(input) {
|
|
|
66722
67592
|
evidence3.policy.digest = evidence3.scope.manifest.review_policy_digest;
|
|
66723
67593
|
let evidencePath2;
|
|
66724
67594
|
try {
|
|
66725
|
-
evidencePath2 = await
|
|
67595
|
+
evidencePath2 = await _internals88.persistEvidence(input.directory, evidence3, { verifyCurrent: createScopeVerifier(input, diff, maxBytes) });
|
|
66726
67596
|
} catch (error2) {
|
|
66727
67597
|
if (error2 instanceof ReviewScopeStaleError) {
|
|
66728
67598
|
return stalePersistenceResult(input, maxBytes, "Review scope changed before clean evidence could be committed.", 0);
|
|
@@ -66746,7 +67616,7 @@ async function runReviewEngine(input) {
|
|
|
66746
67616
|
});
|
|
66747
67617
|
const reviewManifest = await materializeAutoReviewManifest(input.directory, diff.manifest, input.config);
|
|
66748
67618
|
if (input.phase !== undefined && (input.trigger === "phase_completion" || input.trigger === "plan_completion")) {
|
|
66749
|
-
const existing =
|
|
67619
|
+
const existing = _internals88.readPhaseEvidence(input.directory, input.phase);
|
|
66750
67620
|
const integrity = existing ? validateAutoReviewEvidenceIntegrity(input.directory, existing, {
|
|
66751
67621
|
scopeHash: diff.scopeHash,
|
|
66752
67622
|
phase: input.phase,
|
|
@@ -66874,7 +67744,7 @@ async function runReviewEngine(input) {
|
|
|
66874
67744
|
validation: byId.get(finding.finding_id)
|
|
66875
67745
|
}));
|
|
66876
67746
|
}
|
|
66877
|
-
const currentScope = await
|
|
67747
|
+
const currentScope = await _internals88.collectReviewDiff({
|
|
66878
67748
|
directory: input.directory,
|
|
66879
67749
|
selector: input.selector,
|
|
66880
67750
|
maxBytes
|
|
@@ -66955,7 +67825,7 @@ async function runReviewEngine(input) {
|
|
|
66955
67825
|
findingValidations: findings.map((finding) => finding.validation).filter((item) => Boolean(item))
|
|
66956
67826
|
});
|
|
66957
67827
|
receiptId = receipt.id;
|
|
66958
|
-
receiptPath = await
|
|
67828
|
+
receiptPath = await _internals88.persistReceipt(input.directory, receipt, {
|
|
66959
67829
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
66960
67830
|
});
|
|
66961
67831
|
evidence2.receipt_path = receiptPath;
|
|
@@ -66985,7 +67855,7 @@ async function runReviewEngine(input) {
|
|
|
66985
67855
|
}
|
|
66986
67856
|
let evidencePath;
|
|
66987
67857
|
try {
|
|
66988
|
-
evidencePath = await
|
|
67858
|
+
evidencePath = await _internals88.persistEvidence(input.directory, evidence2, {
|
|
66989
67859
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
66990
67860
|
});
|
|
66991
67861
|
} catch (error2) {
|
|
@@ -67023,7 +67893,7 @@ async function runReviewEngine(input) {
|
|
|
67023
67893
|
input.injectAdvisory?.(input.sessionID, advisoryMessage(input, result));
|
|
67024
67894
|
return result;
|
|
67025
67895
|
}
|
|
67026
|
-
var
|
|
67896
|
+
var _internals88 = {
|
|
67027
67897
|
collectReviewDiff,
|
|
67028
67898
|
persistEvidence: persistAutoReviewEvidence,
|
|
67029
67899
|
persistReceipt: persistReviewReceipt,
|
|
@@ -67294,7 +68164,7 @@ async function handleReviewCommand(ctx) {
|
|
|
67294
68164
|
} catch (error2) {
|
|
67295
68165
|
return `Review configuration error: ${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
67296
68166
|
}
|
|
67297
|
-
const result = await
|
|
68167
|
+
const result = await _internals89.runReviewEngine({
|
|
67298
68168
|
directory: ctx.directory,
|
|
67299
68169
|
sessionID: ctx.sessionID,
|
|
67300
68170
|
trigger: "manual",
|
|
@@ -67308,10 +68178,10 @@ async function handleReviewCommand(ctx) {
|
|
|
67308
68178
|
validatorModel,
|
|
67309
68179
|
validatorFallbackModels
|
|
67310
68180
|
});
|
|
67311
|
-
const evidence2 =
|
|
68181
|
+
const evidence2 = _internals89.readEvidence(result.evidencePath, ctx.directory);
|
|
67312
68182
|
return parsed.json ? renderJson(result, evidence2, parsed.selector) : renderHuman(result, evidence2, parsed.selector);
|
|
67313
68183
|
}
|
|
67314
|
-
var
|
|
68184
|
+
var _internals89 = {
|
|
67315
68185
|
runReviewEngine,
|
|
67316
68186
|
readEvidence
|
|
67317
68187
|
};
|
|
@@ -67553,7 +68423,7 @@ async function handleRollbackCommand(directory, args) {
|
|
|
67553
68423
|
// src/commands/sdd.ts
|
|
67554
68424
|
import * as fs49 from "fs";
|
|
67555
68425
|
import * as path99 from "path";
|
|
67556
|
-
var
|
|
68426
|
+
var _internals90 = {
|
|
67557
68427
|
writeProjectedSpecSync
|
|
67558
68428
|
};
|
|
67559
68429
|
var SWARM_SPEC_REL = path99.join(".swarm", "spec.md");
|
|
@@ -67953,7 +68823,7 @@ ${USAGE13}`;
|
|
|
67953
68823
|
|
|
67954
68824
|
${USAGE13}`;
|
|
67955
68825
|
}
|
|
67956
|
-
const result2 =
|
|
68826
|
+
const result2 = _internals90.writeProjectedSpecSync(directory, {
|
|
67957
68827
|
source: "speckit",
|
|
67958
68828
|
feature: resolution.feature,
|
|
67959
68829
|
dryRun: parsed.dryRun,
|
|
@@ -68011,7 +68881,7 @@ ${formatList(result2.projection.warnings)}` : ""
|
|
|
68011
68881
|
].join(`
|
|
68012
68882
|
`);
|
|
68013
68883
|
}
|
|
68014
|
-
const result =
|
|
68884
|
+
const result = _internals90.writeProjectedSpecSync(directory, {
|
|
68015
68885
|
changeId: parsed.changeId,
|
|
68016
68886
|
dryRun: parsed.dryRun,
|
|
68017
68887
|
overwrite: parsed.overwrite
|
|
@@ -68238,7 +69108,7 @@ function writeFileFsyncedThenRename(tempPath, targetPath, data) {
|
|
|
68238
69108
|
throw err;
|
|
68239
69109
|
}
|
|
68240
69110
|
}
|
|
68241
|
-
var
|
|
69111
|
+
var _internals91 = {
|
|
68242
69112
|
withEvidenceLock,
|
|
68243
69113
|
writeFileFsyncedThenRename,
|
|
68244
69114
|
writeFileSync: writeFileSyncAsync,
|
|
@@ -68257,7 +69127,7 @@ async function appendEvent2(directory, eventInput) {
|
|
|
68257
69127
|
throw new Error(`invalid candidate id: ${eventInput.candidateId}`);
|
|
68258
69128
|
}
|
|
68259
69129
|
const filePath = ledgerPath(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
68260
|
-
return
|
|
69130
|
+
return _internals91.withEvidenceLock(directory, path100.join(".swarm", "evolution", "skills", eventInput.skillSlug, eventInput.candidateId, "lifecycle.jsonl"), "skill-opt-ledger", "append-skill-opt-event", async () => {
|
|
68261
69131
|
ensureCandidateDir(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
68262
69132
|
const existing = existsSync56(filePath) ? readFileSync42(filePath, "utf8") : "";
|
|
68263
69133
|
const events = parseEventsFromText(existing);
|
|
@@ -68289,8 +69159,8 @@ async function appendEvent2(directory, eventInput) {
|
|
|
68289
69159
|
const validContent = events.map((e) => JSON.stringify(e)).join(`
|
|
68290
69160
|
`) + (events.length > 0 ? `
|
|
68291
69161
|
` : "");
|
|
68292
|
-
|
|
68293
|
-
const verify = parseEventsFromText(
|
|
69162
|
+
_internals91.writeFileFsyncedThenRename(tempPath, filePath, validContent + line);
|
|
69163
|
+
const verify = parseEventsFromText(_internals91.readFileSync(filePath, "utf8"));
|
|
68294
69164
|
const last = verify.length > 0 ? verify[verify.length - 1] : null;
|
|
68295
69165
|
if (!last || last.seq !== event.seq || last.hashAfter !== event.hashAfter) {
|
|
68296
69166
|
throw new Error(`skill-opt ledger append verification failed for candidate ${event.candidateId} seq ${event.seq}`);
|
|
@@ -68394,7 +69264,7 @@ function writeStateProjection(directory, skillSlug, candidateId2, replay) {
|
|
|
68394
69264
|
updatedAt: new Date().toISOString()
|
|
68395
69265
|
};
|
|
68396
69266
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68397
|
-
|
|
69267
|
+
_internals91.writeFileFsyncedThenRename(tempPath, target, `${JSON.stringify(projection, null, 2)}
|
|
68398
69268
|
`);
|
|
68399
69269
|
}
|
|
68400
69270
|
function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
@@ -68402,7 +69272,7 @@ function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
|
68402
69272
|
const dir = ensureCandidateDir(directory, skillSlug, candidateId2);
|
|
68403
69273
|
const target = path100.join(dir, fileName);
|
|
68404
69274
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68405
|
-
|
|
69275
|
+
_internals91.writeFileFsyncedThenRename(tempPath, target, content);
|
|
68406
69276
|
return target;
|
|
68407
69277
|
}
|
|
68408
69278
|
function readArtifact(directory, skillSlug, candidateId2, fileName) {
|
|
@@ -68495,16 +69365,16 @@ function currentCandidateState(directory, skillSlug, candidateId2) {
|
|
|
68495
69365
|
function writeSkillFileAtomic(targetPath, content) {
|
|
68496
69366
|
const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68497
69367
|
try {
|
|
68498
|
-
|
|
68499
|
-
|
|
69368
|
+
_internals92.writeFileSync(tempPath, content, "utf8");
|
|
69369
|
+
_internals92.renameSync(tempPath, targetPath);
|
|
68500
69370
|
} finally {
|
|
68501
69371
|
try {
|
|
68502
69372
|
if (existsSync57(tempPath))
|
|
68503
|
-
|
|
69373
|
+
_internals92.unlinkSync(tempPath);
|
|
68504
69374
|
} catch {}
|
|
68505
69375
|
}
|
|
68506
69376
|
}
|
|
68507
|
-
var
|
|
69377
|
+
var _internals92 = {
|
|
68508
69378
|
writeFileSync: writeFileSync18,
|
|
68509
69379
|
renameSync: renameSync16,
|
|
68510
69380
|
unlinkSync: unlinkSync21
|
|
@@ -68961,7 +69831,7 @@ function buildGeneratorInputs(args) {
|
|
|
68961
69831
|
}
|
|
68962
69832
|
};
|
|
68963
69833
|
}
|
|
68964
|
-
var
|
|
69834
|
+
var _internals93 = {
|
|
68965
69835
|
draftDeterministic: defaultDeterministicDraft
|
|
68966
69836
|
};
|
|
68967
69837
|
function defaultDeterministicDraft(inputs) {
|
|
@@ -69031,7 +69901,7 @@ function countChangedLines(a, b) {
|
|
|
69031
69901
|
return changed;
|
|
69032
69902
|
}
|
|
69033
69903
|
function draftCandidate(inputs) {
|
|
69034
|
-
const candidate2 =
|
|
69904
|
+
const candidate2 = _internals93.draftDeterministic(inputs);
|
|
69035
69905
|
enforceTrustRegion(candidate2, inputs.budget);
|
|
69036
69906
|
return candidate2;
|
|
69037
69907
|
}
|
|
@@ -69074,7 +69944,7 @@ import * as path103 from "path";
|
|
|
69074
69944
|
// src/hooks/spawn-helper.ts
|
|
69075
69945
|
import * as child_process7 from "child_process";
|
|
69076
69946
|
var WIN32_CMD_BINARIES = new Set(["npm", "npx", "pnpm", "yarn"]);
|
|
69077
|
-
var
|
|
69947
|
+
var _internals94 = {
|
|
69078
69948
|
spawn: child_process7.spawn
|
|
69079
69949
|
};
|
|
69080
69950
|
function spawnAsync(command, cwd, timeoutMs) {
|
|
@@ -69082,7 +69952,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
69082
69952
|
try {
|
|
69083
69953
|
const [rawCmd, ...args] = command;
|
|
69084
69954
|
const cmd = process.platform === "win32" && WIN32_CMD_BINARIES.has(rawCmd) && !rawCmd.includes(".") ? `${rawCmd}.cmd` : rawCmd;
|
|
69085
|
-
const proc =
|
|
69955
|
+
const proc = _internals94.spawn(cmd, args, {
|
|
69086
69956
|
cwd,
|
|
69087
69957
|
stdio: ["ignore", "pipe", "pipe"]
|
|
69088
69958
|
});
|
|
@@ -69148,7 +70018,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
69148
70018
|
}
|
|
69149
70019
|
|
|
69150
70020
|
// src/services/skill-optimizer/smoke.ts
|
|
69151
|
-
var
|
|
70021
|
+
var _internals95 = {
|
|
69152
70022
|
validateSkillPath,
|
|
69153
70023
|
isSymbolicLink: (p) => {
|
|
69154
70024
|
try {
|
|
@@ -69169,7 +70039,7 @@ var _internals94 = {
|
|
|
69169
70039
|
async function validateSkillSmoke(input) {
|
|
69170
70040
|
const notes = [];
|
|
69171
70041
|
const repoRel = path103.join(".opencode", "skills", "generated", input.skillSlug, "SKILL.md");
|
|
69172
|
-
if (!
|
|
70042
|
+
if (!_internals95.validateSkillPath(repoRel)) {
|
|
69173
70043
|
return {
|
|
69174
70044
|
ok: false,
|
|
69175
70045
|
verdict: "VIOLATED",
|
|
@@ -69178,16 +70048,16 @@ async function validateSkillSmoke(input) {
|
|
|
69178
70048
|
}
|
|
69179
70049
|
const skillRoot = path103.join(input.directory, ".opencode", "skills", "generated", input.skillSlug);
|
|
69180
70050
|
if (existsSync58(skillRoot)) {
|
|
69181
|
-
if (
|
|
70051
|
+
if (_internals95.isSymbolicLink(skillRoot)) {
|
|
69182
70052
|
return {
|
|
69183
70053
|
ok: false,
|
|
69184
70054
|
verdict: "VIOLATED",
|
|
69185
70055
|
notes: ["skill root is a symlink (reparse denied)"]
|
|
69186
70056
|
};
|
|
69187
70057
|
}
|
|
69188
|
-
const realRoot =
|
|
69189
|
-
const realProjectDir =
|
|
69190
|
-
if (
|
|
70058
|
+
const realRoot = _internals95.realpath(skillRoot);
|
|
70059
|
+
const realProjectDir = _internals95.realpath(input.directory);
|
|
70060
|
+
if (_internals95.escapedRoot(realProjectDir, realRoot)) {
|
|
69191
70061
|
return {
|
|
69192
70062
|
ok: false,
|
|
69193
70063
|
verdict: "VIOLATED",
|
|
@@ -69205,7 +70075,7 @@ async function validateSkillSmoke(input) {
|
|
|
69205
70075
|
notes: [`frontmatter: ${fmError}`]
|
|
69206
70076
|
};
|
|
69207
70077
|
}
|
|
69208
|
-
const rejected = await
|
|
70078
|
+
const rejected = await _internals95.isRejectedSkillContent(input.directory, input.skillSlug, input.candidateContent);
|
|
69209
70079
|
if (rejected) {
|
|
69210
70080
|
return {
|
|
69211
70081
|
ok: false,
|
|
@@ -69215,7 +70085,7 @@ async function validateSkillSmoke(input) {
|
|
|
69215
70085
|
]
|
|
69216
70086
|
};
|
|
69217
70087
|
}
|
|
69218
|
-
const evalResult = await
|
|
70088
|
+
const evalResult = await _internals95.evaluateSkillChange({
|
|
69219
70089
|
directory: input.directory,
|
|
69220
70090
|
slug: input.skillSlug,
|
|
69221
70091
|
candidateContent: input.candidateContent,
|
|
@@ -69234,7 +70104,7 @@ async function validateSkillSmoke(input) {
|
|
|
69234
70104
|
notes.push(`phrase-eval passed (score ${evalResult.candidateScore.toFixed(2)})`);
|
|
69235
70105
|
}
|
|
69236
70106
|
if (input.checkCommand && input.checkCommand.length > 0) {
|
|
69237
|
-
const cmdResult = await
|
|
70107
|
+
const cmdResult = await _internals95.spawnAsync(input.checkCommand, input.directory, input.checkTimeoutMs ?? 60000);
|
|
69238
70108
|
if (!cmdResult || cmdResult.exitCode !== 0) {
|
|
69239
70109
|
return {
|
|
69240
70110
|
ok: false,
|
|
@@ -69304,7 +70174,7 @@ async function prepareCandidatePayloads(inputRoot, candidateId2, skillSlug, base
|
|
|
69304
70174
|
candidate2.contentHash = await computeCandidateInputContentHash2(inputRoot, candidate2);
|
|
69305
70175
|
return { baseline, candidate: candidate2 };
|
|
69306
70176
|
}
|
|
69307
|
-
var
|
|
70177
|
+
var _internals96 = {
|
|
69308
70178
|
tryAcquireLock,
|
|
69309
70179
|
emitTelemetry: emit,
|
|
69310
70180
|
evaluateCandidateV1,
|
|
@@ -69312,7 +70182,7 @@ var _internals95 = {
|
|
|
69312
70182
|
};
|
|
69313
70183
|
async function acquireProjectLock(directory) {
|
|
69314
70184
|
assertProjectRoot(directory);
|
|
69315
|
-
const result = await
|
|
70185
|
+
const result = await _internals96.tryAcquireLock(directory, PROJECT_LOCK_PATH, "skill-opt-controller", "project-run");
|
|
69316
70186
|
if (!result.acquired)
|
|
69317
70187
|
return null;
|
|
69318
70188
|
return async () => {
|
|
@@ -69326,7 +70196,7 @@ async function acquireProjectLock(directory) {
|
|
|
69326
70196
|
async function acquireSkillLock(directory, skillSlug) {
|
|
69327
70197
|
assertProjectRoot(directory);
|
|
69328
70198
|
const lockPath = path104.join(".swarm", "evolution", "skills", skillSlug, ".skill.lock");
|
|
69329
|
-
const result = await
|
|
70199
|
+
const result = await _internals96.tryAcquireLock(directory, lockPath, "skill-opt-controller", `skill-${skillSlug}`);
|
|
69330
70200
|
if (!result.acquired)
|
|
69331
70201
|
return null;
|
|
69332
70202
|
return async () => {
|
|
@@ -69523,13 +70393,13 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
69523
70393
|
while (true) {
|
|
69524
70394
|
try {
|
|
69525
70395
|
const evalInputRoot = input.inputRoot ?? input.directory;
|
|
69526
|
-
const { baseline, candidate: candidate2 } = await
|
|
70396
|
+
const { baseline, candidate: candidate2 } = await _internals96.prepareCandidatePayloads(evalInputRoot, candidateId2, input.skillSlug, input.baselineModel, input.candidateModel, baselineContent, candidateContent);
|
|
69527
70397
|
if (!input.dispatcher) {
|
|
69528
70398
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
69529
70399
|
}
|
|
69530
|
-
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-
|
|
70400
|
+
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-7znestx4.js");
|
|
69531
70401
|
const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
|
|
69532
|
-
const result = await
|
|
70402
|
+
const result = await _internals96.evaluateCandidateV1({
|
|
69533
70403
|
projectRoot: input.directory,
|
|
69534
70404
|
inputRoot: input.inputRoot ?? input.directory,
|
|
69535
70405
|
tasks: input.validationTasks,
|
|
@@ -69587,7 +70457,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
69587
70457
|
deadband: input.config.deadband
|
|
69588
70458
|
};
|
|
69589
70459
|
}
|
|
69590
|
-
|
|
70460
|
+
_internals96.emitTelemetry?.("loop_detected", {
|
|
69591
70461
|
skillSlug: input.skillSlug,
|
|
69592
70462
|
reason: message.slice(0, 160),
|
|
69593
70463
|
source: "skill-opt-controller"
|
|
@@ -70436,7 +71306,7 @@ function getCompactionMetrics(sessionId) {
|
|
|
70436
71306
|
}
|
|
70437
71307
|
|
|
70438
71308
|
// src/services/status-service.ts
|
|
70439
|
-
var
|
|
71309
|
+
var _internals97 = {
|
|
70440
71310
|
loadLeanTurboRunState,
|
|
70441
71311
|
hasActiveLeanTurbo,
|
|
70442
71312
|
hasActiveFullAuto,
|
|
@@ -70710,11 +71580,11 @@ async function getStatusData(directory, agents, sessionId, options) {
|
|
|
70710
71580
|
} catch {
|
|
70711
71581
|
status.memoryCohort = { linked: false };
|
|
70712
71582
|
}
|
|
70713
|
-
status.fullAutoActive =
|
|
71583
|
+
status.fullAutoActive = _internals97.hasActiveFullAuto();
|
|
70714
71584
|
if (status.fullAutoActive) {
|
|
70715
|
-
const sid =
|
|
71585
|
+
const sid = _internals97.getActiveFullAutoSessionID();
|
|
70716
71586
|
if (sid) {
|
|
70717
|
-
const runState =
|
|
71587
|
+
const runState = _internals97.loadFullAutoRunState(directory, sid);
|
|
70718
71588
|
if (runState?.lastEscalation) {
|
|
70719
71589
|
status.fullAutoEscalation = {
|
|
70720
71590
|
reason: runState.lastEscalation.reason,
|
|
@@ -70748,7 +71618,7 @@ async function getStatusData(directory, agents, sessionId, options) {
|
|
|
70748
71618
|
}
|
|
70749
71619
|
function enrichWithLeanTurbo(status, directory) {
|
|
70750
71620
|
const turboMode = hasActiveTurboMode();
|
|
70751
|
-
const leanActive =
|
|
71621
|
+
const leanActive = _internals97.hasActiveLeanTurbo();
|
|
70752
71622
|
let turboStrategy = "off";
|
|
70753
71623
|
if (leanActive) {
|
|
70754
71624
|
turboStrategy = "lean";
|
|
@@ -70779,7 +71649,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
70779
71649
|
}
|
|
70780
71650
|
}
|
|
70781
71651
|
if (leanSessionID) {
|
|
70782
|
-
const runState =
|
|
71652
|
+
const runState = _internals97.loadLeanTurboRunState(directory, leanSessionID);
|
|
70783
71653
|
if (runState) {
|
|
70784
71654
|
status.leanTurboPhase = runState.phase;
|
|
70785
71655
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -71139,7 +72009,7 @@ init_logger();
|
|
|
71139
72009
|
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
72010
|
|
|
71141
72011
|
// src/commands/turbo.ts
|
|
71142
|
-
var
|
|
72012
|
+
var _internals98 = {
|
|
71143
72013
|
loadPluginConfigWithMeta
|
|
71144
72014
|
};
|
|
71145
72015
|
async function handleTurboCommand(directory, args, sessionID) {
|
|
@@ -71199,7 +72069,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
71199
72069
|
if (arg0 === "on") {
|
|
71200
72070
|
let strategy = "standard";
|
|
71201
72071
|
try {
|
|
71202
|
-
const { config } =
|
|
72072
|
+
const { config } = _internals98.loadPluginConfigWithMeta(directory);
|
|
71203
72073
|
if (config.turbo?.strategy === "lean") {
|
|
71204
72074
|
strategy = "lean";
|
|
71205
72075
|
}
|
|
@@ -71296,7 +72166,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
71296
72166
|
let maxParallelCoders = 4;
|
|
71297
72167
|
let conflictPolicy = "serialize";
|
|
71298
72168
|
try {
|
|
71299
|
-
const { config } =
|
|
72169
|
+
const { config } = _internals98.loadPluginConfigWithMeta(directory);
|
|
71300
72170
|
const leanConfig = config.turbo?.lean;
|
|
71301
72171
|
if (leanConfig) {
|
|
71302
72172
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -71504,7 +72374,7 @@ function findSimilarCommands(query) {
|
|
|
71504
72374
|
}
|
|
71505
72375
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
71506
72376
|
const cmdLower = cmd.toLowerCase();
|
|
71507
|
-
const fullScore =
|
|
72377
|
+
const fullScore = _internals99.levenshteinDistance(q, cmdLower);
|
|
71508
72378
|
let tokenScore = Infinity;
|
|
71509
72379
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
71510
72380
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -71517,7 +72387,7 @@ function findSimilarCommands(query) {
|
|
|
71517
72387
|
for (const ct of cmdTokens) {
|
|
71518
72388
|
if (ct.length === 0)
|
|
71519
72389
|
continue;
|
|
71520
|
-
const dist =
|
|
72390
|
+
const dist = _internals99.levenshteinDistance(qt, ct);
|
|
71521
72391
|
if (dist < minDist)
|
|
71522
72392
|
minDist = dist;
|
|
71523
72393
|
}
|
|
@@ -71527,7 +72397,7 @@ function findSimilarCommands(query) {
|
|
|
71527
72397
|
}
|
|
71528
72398
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
71529
72399
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
71530
|
-
const dashScore =
|
|
72400
|
+
const dashScore = _internals99.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
71531
72401
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
71532
72402
|
return { cmd, score };
|
|
71533
72403
|
});
|
|
@@ -71562,16 +72432,16 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
71562
72432
|
async function handleHelpCommand(ctx) {
|
|
71563
72433
|
const targetCommand = ctx.args.join(" ");
|
|
71564
72434
|
if (!targetCommand) {
|
|
71565
|
-
const { buildHelpText } = await import("./index-
|
|
72435
|
+
const { buildHelpText } = await import("./index-vradyw0x.js");
|
|
71566
72436
|
return buildHelpText();
|
|
71567
72437
|
}
|
|
71568
72438
|
const tokens = targetCommand.split(/\s+/);
|
|
71569
|
-
const resolved =
|
|
72439
|
+
const resolved = _internals99.resolveCommand(tokens);
|
|
71570
72440
|
if (resolved) {
|
|
71571
|
-
return
|
|
72441
|
+
return _internals99.buildDetailedHelp(resolved.key, resolved.entry);
|
|
71572
72442
|
}
|
|
71573
|
-
const similar =
|
|
71574
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
72443
|
+
const similar = _internals99.findSimilarCommands(targetCommand);
|
|
72444
|
+
const { buildHelpText: fullHelp } = await import("./index-vradyw0x.js");
|
|
71575
72445
|
if (similar.length > 0) {
|
|
71576
72446
|
return `Command '/swarm ${targetCommand}' not found.
|
|
71577
72447
|
|
|
@@ -71682,7 +72552,7 @@ var COMMAND_REGISTRY = {
|
|
|
71682
72552
|
toolNoArgs: true
|
|
71683
72553
|
},
|
|
71684
72554
|
help: {
|
|
71685
|
-
handler: (ctx) =>
|
|
72555
|
+
handler: (ctx) => _internals99.handleHelpCommand(ctx),
|
|
71686
72556
|
description: "Show help for swarm commands",
|
|
71687
72557
|
category: "core",
|
|
71688
72558
|
args: "[command]",
|
|
@@ -71751,7 +72621,7 @@ var COMMAND_REGISTRY = {
|
|
|
71751
72621
|
},
|
|
71752
72622
|
"guardrail explain": {
|
|
71753
72623
|
handler: async (ctx) => {
|
|
71754
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
72624
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-cv52smw2.js");
|
|
71755
72625
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
71756
72626
|
},
|
|
71757
72627
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -71761,7 +72631,7 @@ var COMMAND_REGISTRY = {
|
|
|
71761
72631
|
},
|
|
71762
72632
|
"guardrail reset": {
|
|
71763
72633
|
handler: async (ctx) => {
|
|
71764
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
72634
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-vx7zsmzd.js");
|
|
71765
72635
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
71766
72636
|
},
|
|
71767
72637
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -71770,7 +72640,7 @@ var COMMAND_REGISTRY = {
|
|
|
71770
72640
|
},
|
|
71771
72641
|
"guardrail-explain": {
|
|
71772
72642
|
handler: async (ctx) => {
|
|
71773
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
72643
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-cv52smw2.js");
|
|
71774
72644
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
71775
72645
|
},
|
|
71776
72646
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -71780,7 +72650,7 @@ var COMMAND_REGISTRY = {
|
|
|
71780
72650
|
},
|
|
71781
72651
|
"guardrail-reset": {
|
|
71782
72652
|
handler: async (ctx) => {
|
|
71783
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
72653
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-vx7zsmzd.js");
|
|
71784
72654
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
71785
72655
|
},
|
|
71786
72656
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -71790,7 +72660,7 @@ var COMMAND_REGISTRY = {
|
|
|
71790
72660
|
},
|
|
71791
72661
|
"guardrail-log": {
|
|
71792
72662
|
handler: async (ctx) => {
|
|
71793
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
72663
|
+
const { handleGuardrailLog } = await import("./guardrail-log-wgwmh9b7.js");
|
|
71794
72664
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
71795
72665
|
},
|
|
71796
72666
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -72796,7 +73666,7 @@ function validateToolPolicy() {
|
|
|
72796
73666
|
}
|
|
72797
73667
|
return { valid: warnings.length === 0, warnings };
|
|
72798
73668
|
}
|
|
72799
|
-
var
|
|
73669
|
+
var _internals99 = {
|
|
72800
73670
|
handleHelpCommand,
|
|
72801
73671
|
validateAliases,
|
|
72802
73672
|
validateToolPolicy,
|
|
@@ -72806,16 +73676,16 @@ var _internals98 = {
|
|
|
72806
73676
|
findSimilarCommands,
|
|
72807
73677
|
buildDetailedHelp
|
|
72808
73678
|
};
|
|
72809
|
-
var validation =
|
|
73679
|
+
var validation = _internals99.validateAliases();
|
|
72810
73680
|
if (!validation.valid) {
|
|
72811
73681
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
72812
73682
|
${validation.errors.join(`
|
|
72813
73683
|
`)}`);
|
|
72814
73684
|
}
|
|
72815
|
-
|
|
73685
|
+
_internals99.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
|
|
72816
73686
|
try {
|
|
72817
|
-
const toolPolicyValidation =
|
|
72818
|
-
|
|
73687
|
+
const toolPolicyValidation = _internals99.validateToolPolicy();
|
|
73688
|
+
_internals99.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
|
|
72819
73689
|
} catch (e) {
|
|
72820
73690
|
warn(`COMMAND_REGISTRY toolPolicy validation failed (non-fatal): ${e.message}`);
|
|
72821
73691
|
}
|
|
@@ -75196,7 +76066,7 @@ function formatCommandNotFound(tokens) {
|
|
|
75196
76066
|
const attemptedCommand = tokens[0] || "";
|
|
75197
76067
|
const MAX_DISPLAY = 100;
|
|
75198
76068
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
75199
|
-
const similar =
|
|
76069
|
+
const similar = _internals99.findSimilarCommands(attemptedCommand);
|
|
75200
76070
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
75201
76071
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
75202
76072
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -78216,7 +79086,7 @@ function getDisplayBudget() {
|
|
|
78216
79086
|
async function rehydratePrSubscriptions(sessionID, directory) {
|
|
78217
79087
|
const map = new Map;
|
|
78218
79088
|
try {
|
|
78219
|
-
const { listActive: listActive2 } = await import("./pr-subscriptions-
|
|
79089
|
+
const { listActive: listActive2 } = await import("./pr-subscriptions-7879nq5k.js");
|
|
78220
79090
|
const records = await listActive2(directory);
|
|
78221
79091
|
for (const record of records) {
|
|
78222
79092
|
if (record.sessionID !== sessionID)
|
|
@@ -78529,8 +79399,8 @@ var WORKTREE_LIST_TIMEOUT_MS = 15000;
|
|
|
78529
79399
|
async function preProvisionCollisionCheck(taskId, directory, _sessionId) {
|
|
78530
79400
|
let proc;
|
|
78531
79401
|
try {
|
|
78532
|
-
proc =
|
|
78533
|
-
|
|
79402
|
+
proc = _internals101.bunSpawn([
|
|
79403
|
+
_internals101.resolveGitExecutable(),
|
|
78534
79404
|
"-C",
|
|
78535
79405
|
directory,
|
|
78536
79406
|
"worktree",
|
|
@@ -78632,7 +79502,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
|
|
|
78632
79502
|
return extracted === expectedSessionId;
|
|
78633
79503
|
}
|
|
78634
79504
|
async function inspectStandardWorktreeCollisionOwnership(identity) {
|
|
78635
|
-
const collisionOwnership = await import("./worktree-collision-ownership-
|
|
79505
|
+
const collisionOwnership = await import("./worktree-collision-ownership-p31zm5k0.js");
|
|
78636
79506
|
return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
|
|
78637
79507
|
}
|
|
78638
79508
|
async function precreateStandardWorktreeSession(args) {
|
|
@@ -78659,12 +79529,12 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78659
79529
|
return;
|
|
78660
79530
|
}
|
|
78661
79531
|
const laneIndex = allocateStandardLaneIndex(args.parentSessionID);
|
|
78662
|
-
const lifecycleLock = await
|
|
79532
|
+
const lifecycleLock = await _internals101.tryAcquireWorktreeLifecycleLock(args.directory, WORKTREE_LIFECYCLE_LOCK_FILE, "worktree-provisioning", args.taskId);
|
|
78663
79533
|
if (!lifecycleLock.acquired) {
|
|
78664
79534
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, "STANDARD_WORKTREE_LIFECYCLE_BUSY: init orphan recovery is active; retry this coder dispatch after recovery completes.");
|
|
78665
79535
|
}
|
|
78666
79536
|
try {
|
|
78667
|
-
const collision = await
|
|
79537
|
+
const collision = await _internals101.preProvisionCollisionCheck(args.taskId, args.directory, args.parentSessionID);
|
|
78668
79538
|
if (collision.uncertainty) {
|
|
78669
79539
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_SCAN_UNCERTAIN: ${collision.uncertainty}. Destructive cleanup and provisioning were blocked.`);
|
|
78670
79540
|
}
|
|
@@ -78673,17 +79543,17 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78673
79543
|
const ownerInfo = collision.ownerSessionId ? ` owned by session ${collision.ownerSessionId}` : " with uncertain ownership";
|
|
78674
79544
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION: task ${args.taskId} already has a lane on branch ${collision.existingBranch ?? "unknown"}${ownerInfo}; cleanup and provisioning were blocked.`);
|
|
78675
79545
|
}
|
|
78676
|
-
for (const dispatch of
|
|
79546
|
+
for (const dispatch of _internals101.standardWorktreeByCallID.values()) {
|
|
78677
79547
|
if (dispatch.handle.branchName === collision.existingBranch) {
|
|
78678
79548
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION_ACTIVE: branch ${collision.existingBranch} is still tracked by an active standard-worktree dispatch.`);
|
|
78679
79549
|
}
|
|
78680
79550
|
}
|
|
78681
|
-
for (const record of
|
|
79551
|
+
for (const record of _internals101.awaitingMergeByCallID.values()) {
|
|
78682
79552
|
if (record.branch === collision.existingBranch) {
|
|
78683
79553
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION_AWAITING_MERGE: branch ${collision.existingBranch} is still awaiting merge-back.`);
|
|
78684
79554
|
}
|
|
78685
79555
|
}
|
|
78686
|
-
const ownership = await
|
|
79556
|
+
const ownership = await _internals101.inspectStandardWorktreeCollisionOwnership({
|
|
78687
79557
|
directory: args.directory,
|
|
78688
79558
|
parentSessionId: args.parentSessionID,
|
|
78689
79559
|
taskId: args.taskId,
|
|
@@ -78708,30 +79578,30 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78708
79578
|
}
|
|
78709
79579
|
}
|
|
78710
79580
|
if (collisionPathExists) {
|
|
78711
|
-
const preserveResult = await
|
|
79581
|
+
const preserveResult = await _internals101.preserveDirtyWorktreeAtPath(collision.worktreePath, collision.existingBranch, "denied", args.directory, worktreeConfig.worktree_dir);
|
|
78712
79582
|
if (preserveResult.outcome === "preserve-failed") {
|
|
78713
79583
|
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
79584
|
}
|
|
78715
|
-
const removeResult = await
|
|
79585
|
+
const removeResult = await _internals101.removeWorktree(collision.worktreePath, args.directory, { force: true, worktreeDir: worktreeConfig.worktree_dir });
|
|
78716
79586
|
if ("error" in removeResult) {
|
|
78717
79587
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_REMOVE_FAILED: ${removeResult.error}. Provisioning was blocked.`);
|
|
78718
79588
|
}
|
|
78719
|
-
const cleanupResult = await
|
|
79589
|
+
const cleanupResult = await _internals101.postMergeCleanup(args.directory, collision.existingBranch);
|
|
78720
79590
|
if ("error" in cleanupResult) {
|
|
78721
79591
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_BRANCH_CLEANUP_FAILED: ${cleanupResult.error}. Provisioning was blocked.`);
|
|
78722
79592
|
}
|
|
78723
79593
|
} else {
|
|
78724
|
-
const pruneResult = await
|
|
79594
|
+
const pruneResult = await _internals101.pruneStaleWorktreeMetadata(args.directory);
|
|
78725
79595
|
if ("error" in pruneResult) {
|
|
78726
79596
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_PRUNE_FAILED: ${pruneResult.error}. Provisioning was blocked without deleting the lane branch.`);
|
|
78727
79597
|
}
|
|
78728
79598
|
}
|
|
78729
|
-
const verification = await
|
|
79599
|
+
const verification = await _internals101.preProvisionCollisionCheck(args.taskId, args.directory, args.parentSessionID);
|
|
78730
79600
|
if (verification.uncertainty || verification.collision) {
|
|
78731
79601
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_CLEANUP_UNVERIFIED: ${verification.uncertainty ?? "git still reports the colliding lane after cleanup"}. Provisioning was blocked.`);
|
|
78732
79602
|
}
|
|
78733
79603
|
}
|
|
78734
|
-
|
|
79604
|
+
_internals101.recordWorktreeProvisioningOwner(args.directory, {
|
|
78735
79605
|
callID: args.callID,
|
|
78736
79606
|
parentSessionId: args.parentSessionID,
|
|
78737
79607
|
worktreeSessionId: args.parentSessionID,
|
|
@@ -78749,7 +79619,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78749
79619
|
}
|
|
78750
79620
|
let provisionResult;
|
|
78751
79621
|
try {
|
|
78752
|
-
provisionResult = await
|
|
79622
|
+
provisionResult = await _internals101.provisionWorktree(args.directory, args.taskId, args.parentSessionID, {
|
|
78753
79623
|
purpose: "lane",
|
|
78754
79624
|
worktreeDir: worktreeConfig.worktree_dir,
|
|
78755
79625
|
mergeStrategy: worktreeConfig.merge_strategy,
|
|
@@ -78757,11 +79627,11 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78757
79627
|
scope: args.scope
|
|
78758
79628
|
});
|
|
78759
79629
|
} catch (error2) {
|
|
78760
|
-
|
|
79630
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78761
79631
|
throw error2;
|
|
78762
79632
|
}
|
|
78763
79633
|
if ("error" in provisionResult) {
|
|
78764
|
-
|
|
79634
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78765
79635
|
const message = `STANDARD_WORKTREE_PROVISION_FAILED: ${provisionResult.error}.`;
|
|
78766
79636
|
handleStandardWorktreeFailure(args.parentSessionID, worktreeConfig.policy, message);
|
|
78767
79637
|
return;
|
|
@@ -78780,7 +79650,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78780
79650
|
const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
|
|
78781
79651
|
if (laneProfile) {
|
|
78782
79652
|
try {
|
|
78783
|
-
const { writeLaneProfileToDiskReal } = await import("./core-
|
|
79653
|
+
const { writeLaneProfileToDiskReal } = await import("./core-3g4krkj8.js");
|
|
78784
79654
|
await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
|
|
78785
79655
|
} catch {}
|
|
78786
79656
|
}
|
|
@@ -78801,13 +79671,13 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78801
79671
|
query: { directory: provisionResult.worktreePath }
|
|
78802
79672
|
});
|
|
78803
79673
|
if (!createResult.data?.id) {
|
|
78804
|
-
await
|
|
79674
|
+
await _internals101.removeWorktree(provisionResult.worktreePath, args.directory, {
|
|
78805
79675
|
force: true,
|
|
78806
79676
|
worktreeDir: worktreeConfig.worktree_dir
|
|
78807
79677
|
}).catch((cleanupError) => {
|
|
78808
79678
|
log(`[worktree-isolation] session-create failure cleanup could not remove lane ${provisionResult.worktreePath}: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
78809
79679
|
});
|
|
78810
|
-
|
|
79680
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78811
79681
|
const createError = createResult.error;
|
|
78812
79682
|
const detail = typeof createError === "string" ? createError : JSON.stringify(createError ?? "missing session id");
|
|
78813
79683
|
const message = `STANDARD_WORKTREE_SESSION_CREATE_FAILED: ${detail}.`;
|
|
@@ -78835,8 +79705,8 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
|
|
|
78835
79705
|
return { outcome: "not-found" };
|
|
78836
79706
|
let refProc;
|
|
78837
79707
|
try {
|
|
78838
|
-
refProc =
|
|
78839
|
-
|
|
79708
|
+
refProc = _internals101.bunSpawn([
|
|
79709
|
+
_internals101.resolveGitExecutable(),
|
|
78840
79710
|
"-C",
|
|
78841
79711
|
dispatch.handle.worktreePath,
|
|
78842
79712
|
"rev-parse",
|
|
@@ -78880,8 +79750,8 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
|
|
|
78880
79750
|
const tag = `swarm-preserved-owner/${session}/${lane}/${callDigest}`;
|
|
78881
79751
|
let tagProc;
|
|
78882
79752
|
try {
|
|
78883
|
-
tagProc =
|
|
78884
|
-
|
|
79753
|
+
tagProc = _internals101.bunSpawn([
|
|
79754
|
+
_internals101.resolveGitExecutable(),
|
|
78885
79755
|
"-C",
|
|
78886
79756
|
dispatch.handle.worktreePath,
|
|
78887
79757
|
"tag",
|
|
@@ -78931,8 +79801,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78931
79801
|
}
|
|
78932
79802
|
let statusProc;
|
|
78933
79803
|
try {
|
|
78934
|
-
statusProc =
|
|
78935
|
-
|
|
79804
|
+
statusProc = _internals101.bunSpawn([
|
|
79805
|
+
_internals101.resolveGitExecutable(),
|
|
78936
79806
|
"-C",
|
|
78937
79807
|
worktreePath,
|
|
78938
79808
|
"status",
|
|
@@ -78974,7 +79844,7 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78974
79844
|
}
|
|
78975
79845
|
let addProc;
|
|
78976
79846
|
try {
|
|
78977
|
-
addProc =
|
|
79847
|
+
addProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "add", "-A"], {
|
|
78978
79848
|
stdin: "ignore",
|
|
78979
79849
|
stdout: "pipe",
|
|
78980
79850
|
stderr: "pipe",
|
|
@@ -79008,8 +79878,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79008
79878
|
const commitMessage = `swarm-preserved: ${reason} for callID ${sanitizedCallID} at ${isoDate}`;
|
|
79009
79879
|
let commitProc;
|
|
79010
79880
|
try {
|
|
79011
|
-
commitProc =
|
|
79012
|
-
|
|
79881
|
+
commitProc = _internals101.bunSpawn([
|
|
79882
|
+
_internals101.resolveGitExecutable(),
|
|
79013
79883
|
"-C",
|
|
79014
79884
|
worktreePath,
|
|
79015
79885
|
"commit",
|
|
@@ -79047,8 +79917,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79047
79917
|
}
|
|
79048
79918
|
let hashProc;
|
|
79049
79919
|
try {
|
|
79050
|
-
hashProc =
|
|
79051
|
-
|
|
79920
|
+
hashProc = _internals101.bunSpawn([
|
|
79921
|
+
_internals101.resolveGitExecutable(),
|
|
79052
79922
|
"-C",
|
|
79053
79923
|
worktreePath,
|
|
79054
79924
|
"rev-parse",
|
|
@@ -79094,7 +79964,7 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79094
79964
|
const tagName = `swarm-preserved-${sanitizedCallID}-${shortHash}`;
|
|
79095
79965
|
let tagProc;
|
|
79096
79966
|
try {
|
|
79097
|
-
tagProc =
|
|
79967
|
+
tagProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "tag", tagName], {
|
|
79098
79968
|
stdin: "ignore",
|
|
79099
79969
|
stdout: "pipe",
|
|
79100
79970
|
stderr: "pipe",
|
|
@@ -79130,8 +80000,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
79130
80000
|
async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _directory, _worktree_dir) {
|
|
79131
80001
|
let statusProc;
|
|
79132
80002
|
try {
|
|
79133
|
-
statusProc =
|
|
79134
|
-
|
|
80003
|
+
statusProc = _internals101.bunSpawn([
|
|
80004
|
+
_internals101.resolveGitExecutable(),
|
|
79135
80005
|
"-C",
|
|
79136
80006
|
worktreePath,
|
|
79137
80007
|
"status",
|
|
@@ -79173,7 +80043,7 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79173
80043
|
}
|
|
79174
80044
|
let addProc;
|
|
79175
80045
|
try {
|
|
79176
|
-
addProc =
|
|
80046
|
+
addProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "add", "-A"], {
|
|
79177
80047
|
stdin: "ignore",
|
|
79178
80048
|
stdout: "pipe",
|
|
79179
80049
|
stderr: "pipe",
|
|
@@ -79208,8 +80078,8 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79208
80078
|
const commitMessage = `swarm-preserved: ${reason} for worktree ${sanitizedPath} at ${isoDate}`;
|
|
79209
80079
|
let commitProc;
|
|
79210
80080
|
try {
|
|
79211
|
-
commitProc =
|
|
79212
|
-
|
|
80081
|
+
commitProc = _internals101.bunSpawn([
|
|
80082
|
+
_internals101.resolveGitExecutable(),
|
|
79213
80083
|
"-C",
|
|
79214
80084
|
worktreePath,
|
|
79215
80085
|
"commit",
|
|
@@ -79247,8 +80117,8 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79247
80117
|
}
|
|
79248
80118
|
let hashProc;
|
|
79249
80119
|
try {
|
|
79250
|
-
hashProc =
|
|
79251
|
-
|
|
80120
|
+
hashProc = _internals101.bunSpawn([
|
|
80121
|
+
_internals101.resolveGitExecutable(),
|
|
79252
80122
|
"-C",
|
|
79253
80123
|
worktreePath,
|
|
79254
80124
|
"rev-parse",
|
|
@@ -79294,7 +80164,7 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79294
80164
|
const tagName = `swarm-preserved-worktree-${sanitizedBranch}-${shortHash}`;
|
|
79295
80165
|
let tagProc;
|
|
79296
80166
|
try {
|
|
79297
|
-
tagProc =
|
|
80167
|
+
tagProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "tag", tagName], {
|
|
79298
80168
|
stdin: "ignore",
|
|
79299
80169
|
stdout: "pipe",
|
|
79300
80170
|
stderr: "pipe",
|
|
@@ -79346,7 +80216,7 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79346
80216
|
let preserveResult;
|
|
79347
80217
|
if (reason === "denied" || reason === "cancelled") {
|
|
79348
80218
|
try {
|
|
79349
|
-
preserveResult = await
|
|
80219
|
+
preserveResult = await _internals101.preserveDirtyWorktreeForCallId(callID, reason, directory, worktree_dir);
|
|
79350
80220
|
} catch (err) {
|
|
79351
80221
|
log(`[swarm] cleanupStandardWorktreeForCallId: preserveDirtyWorktreeForCallId threw for ${callID}: ${err}`);
|
|
79352
80222
|
preserveResult = {
|
|
@@ -79357,7 +80227,7 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79357
80227
|
}
|
|
79358
80228
|
if (preserveResult.outcome === "clean") {
|
|
79359
80229
|
try {
|
|
79360
|
-
preserveResult = await
|
|
80230
|
+
preserveResult = await _internals101.preserveDirtyWorktreeForCallId(callID, reason, directory, worktree_dir);
|
|
79361
80231
|
} catch (err) {
|
|
79362
80232
|
log(`[swarm] cleanupStandardWorktreeForCallId: final preservation check threw for ${callID}: ${err}`);
|
|
79363
80233
|
preserveResult = {
|
|
@@ -79375,11 +80245,11 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79375
80245
|
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
80246
|
return;
|
|
79377
80247
|
}
|
|
79378
|
-
await
|
|
80248
|
+
await _internals101.removeWorktree(worktreePath, directory, {
|
|
79379
80249
|
force: true,
|
|
79380
80250
|
worktreeDir: worktree_dir
|
|
79381
80251
|
}).catch((err) => log(`[swarm] cleanupStandardWorktreeForCallId: removeWorktree failed for ${callID}: ${err}`));
|
|
79382
|
-
await
|
|
80252
|
+
await _internals101.postMergeCleanup(directory, branchName).catch((err) => log(`[swarm] cleanupStandardWorktreeForCallId: postMergeCleanup failed for ${callID}: ${err}`));
|
|
79383
80253
|
standardWorktreeByCallID.delete(callID);
|
|
79384
80254
|
awaitingMergeByCallID.delete(callID);
|
|
79385
80255
|
const session = ensureAgentSession(parentSessionID);
|
|
@@ -79398,7 +80268,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
79398
80268
|
const wtConfig = config ? resolveWorktreeIsolationConfig(config) : DEFAULT_WORKTREE_ISOLATION_CONFIG;
|
|
79399
80269
|
const resolvedCallID = callID ?? dispatch.callID;
|
|
79400
80270
|
const run = async () => {
|
|
79401
|
-
const mergeResult = await
|
|
80271
|
+
const mergeResult = await _internals101.attemptMergeBackFromDirty(dispatch.handle.worktreePath, dispatch.handle.branchName, directory, getMergeStrategy({ merge_strategy: dispatch.mergeStrategy }), {
|
|
79402
80272
|
operationId: settlement.operationId,
|
|
79403
80273
|
resume: settlement.resume,
|
|
79404
80274
|
onBeforeMerge: settlement.onBeforeMerge
|
|
@@ -79438,7 +80308,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
79438
80308
|
}
|
|
79439
80309
|
clearWorktreeMergeStatus(statusKey);
|
|
79440
80310
|
try {
|
|
79441
|
-
const { removeLaneProfileFromDiskReal } = await import("./core-
|
|
80311
|
+
const { removeLaneProfileFromDiskReal } = await import("./core-3g4krkj8.js");
|
|
79442
80312
|
await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
|
|
79443
80313
|
} catch {}
|
|
79444
80314
|
const state = serializationStateBySessionID.get(dispatch.parentSessionID);
|
|
@@ -79556,7 +80426,7 @@ async function readLaneEnvFileFromDisk(worktreePath, laneIndex) {
|
|
|
79556
80426
|
}
|
|
79557
80427
|
return result;
|
|
79558
80428
|
}
|
|
79559
|
-
var
|
|
80429
|
+
var _internals101 = {
|
|
79560
80430
|
provisionWorktree,
|
|
79561
80431
|
removeWorktree,
|
|
79562
80432
|
attemptMergeBackFromDirty,
|
|
@@ -79584,4 +80454,4 @@ var _internals100 = {
|
|
|
79584
80454
|
resolveGitExecutable
|
|
79585
80455
|
};
|
|
79586
80456
|
|
|
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,
|
|
80457
|
+
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 };
|