opencode-swarm 6.86.8 → 6.86.10
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/index.js +282 -218
- package/dist/config/cache-paths.d.ts +11 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +741 -686
- package/dist/services/diagnose-service.d.ts +1 -1
- package/package.json +1 -1
- package/dist/tools/check-gate-status.prefix.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var package_default;
|
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "opencode-swarm",
|
|
36
|
-
version: "6.86.
|
|
36
|
+
version: "6.86.10",
|
|
37
37
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
38
38
|
main: "dist/index.js",
|
|
39
39
|
types: "dist/index.d.ts",
|
|
@@ -23300,7 +23300,7 @@ function redactShellCommand(cmd) {
|
|
|
23300
23300
|
function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityConfig) {
|
|
23301
23301
|
let guardrailsConfig;
|
|
23302
23302
|
if (directory && typeof directory === "object" && "enabled" in directory) {
|
|
23303
|
-
|
|
23303
|
+
warn("[guardrails] Legacy call without directory, falling back to process.cwd()");
|
|
23304
23304
|
guardrailsConfig = directory;
|
|
23305
23305
|
} else if (directoryOrConfig && typeof directoryOrConfig === "object" && "enabled" in directoryOrConfig) {
|
|
23306
23306
|
guardrailsConfig = directoryOrConfig;
|
|
@@ -23311,7 +23311,7 @@ function createGuardrailsHooks(directory, directoryOrConfig, config2, authorityC
|
|
|
23311
23311
|
if (typeof directory === "string")
|
|
23312
23312
|
return directory;
|
|
23313
23313
|
const cwd = process.cwd();
|
|
23314
|
-
|
|
23314
|
+
warn(`[guardrails] effectiveDirectory resolved to process.cwd() "${cwd}" — ` + "pass an explicit directory string to createGuardrailsHooks to avoid .swarm artifacts in wrong locations");
|
|
23315
23315
|
return cwd;
|
|
23316
23316
|
})();
|
|
23317
23317
|
if (guardrailsConfig?.enabled === false) {
|
|
@@ -24719,6 +24719,7 @@ var init_guardrails = __esm(() => {
|
|
|
24719
24719
|
init_state();
|
|
24720
24720
|
init_telemetry();
|
|
24721
24721
|
init_utils();
|
|
24722
|
+
init_logger();
|
|
24722
24723
|
init_conflict_resolution();
|
|
24723
24724
|
init_delegation_gate();
|
|
24724
24725
|
init_loop_detector();
|
|
@@ -25064,7 +25065,7 @@ async function getEvidenceTaskId(session, directory) {
|
|
|
25064
25065
|
}
|
|
25065
25066
|
} catch (err2) {
|
|
25066
25067
|
if (process.env.DEBUG_SWARM && err2 instanceof Error) {
|
|
25067
|
-
|
|
25068
|
+
warn(`[delegation-gate] getEvidenceTaskId error: ${err2.message} (code=${err2.code ?? "none"})`);
|
|
25068
25069
|
}
|
|
25069
25070
|
return null;
|
|
25070
25071
|
}
|
|
@@ -25121,7 +25122,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25121
25122
|
const hasCurrentSessionCoderDelegation = delegationChains.some((d) => stripKnownSwarmPrefix(d.to) === "coder" && d.timestamp > freshnessThreshold);
|
|
25122
25123
|
if (!hasCurrentSessionCoderDelegation) {
|
|
25123
25124
|
session.taskWorkflowStates.set(taskId, "idle");
|
|
25124
|
-
|
|
25125
|
+
warn(`[delegation-gate] Reset stale coder_delegated state for task ${taskId} — ` + `no coder delegation found in current session.`);
|
|
25125
25126
|
continue;
|
|
25126
25127
|
}
|
|
25127
25128
|
const turbo = hasActiveTurboMode(input.sessionID);
|
|
@@ -25162,7 +25163,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25162
25163
|
try {
|
|
25163
25164
|
await advanceTaskStateAndPersist(session, taskId, "complete", directory, config2.council);
|
|
25164
25165
|
} catch (err2) {
|
|
25165
|
-
|
|
25166
|
+
warn(`[delegation-gate] toolAfter submit_council_verdicts: could not advance ${taskId} → complete: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25166
25167
|
}
|
|
25167
25168
|
}
|
|
25168
25169
|
}
|
|
@@ -25205,7 +25206,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25205
25206
|
}
|
|
25206
25207
|
advanceTaskState(session, taskId, "tests_run");
|
|
25207
25208
|
} catch (err2) {
|
|
25208
|
-
|
|
25209
|
+
warn(`[delegation-gate] toolAfter stage-b-parallel: could not advance ${taskId} (${eligibleState}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25209
25210
|
}
|
|
25210
25211
|
}
|
|
25211
25212
|
}
|
|
@@ -25232,7 +25233,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25232
25233
|
}
|
|
25233
25234
|
advanceTaskState(otherSession, seedTaskId, "tests_run");
|
|
25234
25235
|
} catch (err2) {
|
|
25235
|
-
|
|
25236
|
+
warn(`[delegation-gate] toolAfter cross-session stage-b-parallel: could not advance ${seedTaskId} (${seedEligibleState}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25236
25237
|
}
|
|
25237
25238
|
}
|
|
25238
25239
|
}
|
|
@@ -25245,7 +25246,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25245
25246
|
try {
|
|
25246
25247
|
advanceTaskState(session, taskId, "reviewer_run");
|
|
25247
25248
|
} catch (err2) {
|
|
25248
|
-
|
|
25249
|
+
warn(`[delegation-gate] toolAfter: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25249
25250
|
}
|
|
25250
25251
|
}
|
|
25251
25252
|
}
|
|
@@ -25256,7 +25257,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25256
25257
|
try {
|
|
25257
25258
|
advanceTaskState(session, taskId, "tests_run");
|
|
25258
25259
|
} catch (err2) {
|
|
25259
|
-
|
|
25260
|
+
warn(`[delegation-gate] toolAfter: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25260
25261
|
}
|
|
25261
25262
|
}
|
|
25262
25263
|
}
|
|
@@ -25280,7 +25281,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25280
25281
|
try {
|
|
25281
25282
|
advanceTaskState(otherSession, taskId, "reviewer_run");
|
|
25282
25283
|
} catch (err2) {
|
|
25283
|
-
|
|
25284
|
+
warn(`[delegation-gate] toolAfter cross-session: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25284
25285
|
}
|
|
25285
25286
|
}
|
|
25286
25287
|
}
|
|
@@ -25298,7 +25299,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25298
25299
|
try {
|
|
25299
25300
|
advanceTaskState(otherSession, taskId, "tests_run");
|
|
25300
25301
|
} catch (err2) {
|
|
25301
|
-
|
|
25302
|
+
warn(`[delegation-gate] toolAfter cross-session: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25302
25303
|
}
|
|
25303
25304
|
}
|
|
25304
25305
|
}
|
|
@@ -25370,7 +25371,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25370
25371
|
try {
|
|
25371
25372
|
advanceTaskState(session, taskId, "reviewer_run");
|
|
25372
25373
|
} catch (err2) {
|
|
25373
|
-
|
|
25374
|
+
warn(`[delegation-gate] fallback: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25374
25375
|
}
|
|
25375
25376
|
}
|
|
25376
25377
|
}
|
|
@@ -25381,7 +25382,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25381
25382
|
try {
|
|
25382
25383
|
advanceTaskState(session, taskId, "tests_run");
|
|
25383
25384
|
} catch (err2) {
|
|
25384
|
-
|
|
25385
|
+
warn(`[delegation-gate] fallback: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25385
25386
|
}
|
|
25386
25387
|
}
|
|
25387
25388
|
}
|
|
@@ -25401,7 +25402,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25401
25402
|
try {
|
|
25402
25403
|
advanceTaskState(otherSession, taskId, "reviewer_run");
|
|
25403
25404
|
} catch (err2) {
|
|
25404
|
-
|
|
25405
|
+
warn(`[delegation-gate] fallback cross-session: could not advance ${taskId} (${state}) → reviewer_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25405
25406
|
}
|
|
25406
25407
|
}
|
|
25407
25408
|
}
|
|
@@ -25422,7 +25423,7 @@ function createDelegationGateHook(config2, directory) {
|
|
|
25422
25423
|
try {
|
|
25423
25424
|
advanceTaskState(otherSession, taskId, "tests_run");
|
|
25424
25425
|
} catch (err2) {
|
|
25425
|
-
|
|
25426
|
+
warn(`[delegation-gate] fallback cross-session: could not advance ${taskId} (${state}) → tests_run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25426
25427
|
}
|
|
25427
25428
|
}
|
|
25428
25429
|
}
|
|
@@ -25549,7 +25550,7 @@ ${trimComment}${after}`;
|
|
|
25549
25550
|
try {
|
|
25550
25551
|
await advanceTaskStateAndPersist(session, currentTaskId, "coder_delegated", directory);
|
|
25551
25552
|
} catch (err2) {
|
|
25552
|
-
|
|
25553
|
+
warn(`[delegation-gate] state machine warn: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
25553
25554
|
}
|
|
25554
25555
|
}
|
|
25555
25556
|
if (sessionID && !isCoderDelegation && currentTaskId) {
|
|
@@ -25677,6 +25678,7 @@ var init_delegation_gate = __esm(() => {
|
|
|
25677
25678
|
init_schema();
|
|
25678
25679
|
init_state();
|
|
25679
25680
|
init_telemetry();
|
|
25681
|
+
init_logger();
|
|
25680
25682
|
init_guardrails();
|
|
25681
25683
|
init_normalize_tool_name();
|
|
25682
25684
|
init_utils2();
|
|
@@ -42601,7 +42603,7 @@ async function readCuratorSummary(directory) {
|
|
|
42601
42603
|
try {
|
|
42602
42604
|
const parsed = JSON.parse(content);
|
|
42603
42605
|
if (parsed.schema_version !== 1) {
|
|
42604
|
-
|
|
42606
|
+
warn(`Curator summary has unsupported schema version: ${parsed.schema_version}. Expected 1.`);
|
|
42605
42607
|
return null;
|
|
42606
42608
|
}
|
|
42607
42609
|
return parsed;
|
|
@@ -42838,7 +42840,7 @@ ${llmOutput.trim()}`;
|
|
|
42838
42840
|
enhanced: true
|
|
42839
42841
|
});
|
|
42840
42842
|
} catch (err2) {
|
|
42841
|
-
|
|
42843
|
+
warn(`[curator] LLM delegation failed during CURATOR_INIT, using data-only mode: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
42842
42844
|
getGlobalEventBus().publish("curator.init.llm_fallback", {
|
|
42843
42845
|
error: String(err2)
|
|
42844
42846
|
});
|
|
@@ -42962,7 +42964,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config3, _kno
|
|
|
42962
42964
|
recommendations: knowledgeRecommendations.length
|
|
42963
42965
|
});
|
|
42964
42966
|
} catch (err2) {
|
|
42965
|
-
|
|
42967
|
+
warn(`[curator] LLM delegation failed during CURATOR_PHASE ${phase}, using data-only mode: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
42966
42968
|
getGlobalEventBus().publish("curator.phase.llm_fallback", {
|
|
42967
42969
|
phase,
|
|
42968
42970
|
error: String(err2)
|
|
@@ -43123,7 +43125,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
43123
43125
|
if (rec.entry_id !== undefined && !appliedIds.has(rec.entry_id)) {
|
|
43124
43126
|
const found = entries.some((e) => e.id === rec.entry_id);
|
|
43125
43127
|
if (!found) {
|
|
43126
|
-
|
|
43128
|
+
warn(`[curator] applyCuratorKnowledgeUpdates: entry_id '${rec.entry_id}' not found — skipping`);
|
|
43127
43129
|
}
|
|
43128
43130
|
skipped++;
|
|
43129
43131
|
}
|
|
@@ -43191,6 +43193,7 @@ var DEFAULT_CURATOR_LLM_TIMEOUT_MS = 300000;
|
|
|
43191
43193
|
var init_curator = __esm(() => {
|
|
43192
43194
|
init_event_bus();
|
|
43193
43195
|
init_manager();
|
|
43196
|
+
init_logger();
|
|
43194
43197
|
init_knowledge_store();
|
|
43195
43198
|
init_knowledge_validator();
|
|
43196
43199
|
init_utils2();
|
|
@@ -43890,24 +43893,41 @@ var init_dark_matter = __esm(() => {
|
|
|
43890
43893
|
init_co_change_analyzer();
|
|
43891
43894
|
});
|
|
43892
43895
|
|
|
43896
|
+
// src/config/cache-paths.ts
|
|
43897
|
+
import * as os5 from "node:os";
|
|
43898
|
+
import * as path24 from "node:path";
|
|
43899
|
+
function getPluginConfigDir() {
|
|
43900
|
+
return path24.join(process.env.XDG_CONFIG_HOME || path24.join(os5.homedir(), ".config"), "opencode");
|
|
43901
|
+
}
|
|
43902
|
+
function getPluginCachePaths() {
|
|
43903
|
+
const cacheBase = process.env.XDG_CACHE_HOME || path24.join(os5.homedir(), ".cache");
|
|
43904
|
+
const configDir = getPluginConfigDir();
|
|
43905
|
+
return [
|
|
43906
|
+
path24.join(cacheBase, "opencode", "packages", "opencode-swarm@latest"),
|
|
43907
|
+
path24.join(configDir, "node_modules", "opencode-swarm"),
|
|
43908
|
+
path24.join(cacheBase, "opencode", "node_modules", "opencode-swarm")
|
|
43909
|
+
];
|
|
43910
|
+
}
|
|
43911
|
+
var init_cache_paths = () => {};
|
|
43912
|
+
|
|
43893
43913
|
// src/services/version-check.ts
|
|
43894
43914
|
import { existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
|
|
43895
|
-
import { homedir as
|
|
43896
|
-
import { join as
|
|
43915
|
+
import { homedir as homedir5 } from "node:os";
|
|
43916
|
+
import { join as join22 } from "node:path";
|
|
43897
43917
|
function cacheDir() {
|
|
43898
43918
|
const xdg = process.env.XDG_CACHE_HOME;
|
|
43899
|
-
const base = xdg && xdg.length > 0 ? xdg :
|
|
43900
|
-
return
|
|
43919
|
+
const base = xdg && xdg.length > 0 ? xdg : join22(homedir5(), ".cache");
|
|
43920
|
+
return join22(base, "opencode-swarm");
|
|
43901
43921
|
}
|
|
43902
43922
|
function cacheFile() {
|
|
43903
|
-
return
|
|
43923
|
+
return join22(cacheDir(), "version-check.json");
|
|
43904
43924
|
}
|
|
43905
43925
|
function readVersionCache() {
|
|
43906
43926
|
try {
|
|
43907
|
-
const
|
|
43908
|
-
if (!existsSync11(
|
|
43927
|
+
const path25 = cacheFile();
|
|
43928
|
+
if (!existsSync11(path25))
|
|
43909
43929
|
return null;
|
|
43910
|
-
const raw = readFileSync6(
|
|
43930
|
+
const raw = readFileSync6(path25, "utf-8");
|
|
43911
43931
|
const parsed = JSON.parse(raw);
|
|
43912
43932
|
if (typeof parsed?.checkedAt !== "number")
|
|
43913
43933
|
return null;
|
|
@@ -44005,7 +44025,7 @@ var init_version_check = __esm(() => {
|
|
|
44005
44025
|
// src/services/diagnose-service.ts
|
|
44006
44026
|
import * as child_process4 from "node:child_process";
|
|
44007
44027
|
import { existsSync as existsSync12, readdirSync as readdirSync4, readFileSync as readFileSync7, statSync as statSync6 } from "node:fs";
|
|
44008
|
-
import
|
|
44028
|
+
import path25 from "node:path";
|
|
44009
44029
|
import { fileURLToPath } from "node:url";
|
|
44010
44030
|
function validateTaskDag(plan) {
|
|
44011
44031
|
const allTaskIds = new Set;
|
|
@@ -44302,7 +44322,7 @@ async function checkSpecStaleness(directory, plan) {
|
|
|
44302
44322
|
};
|
|
44303
44323
|
}
|
|
44304
44324
|
async function checkConfigParseability(directory) {
|
|
44305
|
-
const configPath =
|
|
44325
|
+
const configPath = path25.join(directory, ".opencode/opencode-swarm.json");
|
|
44306
44326
|
if (!existsSync12(configPath)) {
|
|
44307
44327
|
return {
|
|
44308
44328
|
name: "Config Parseability",
|
|
@@ -44331,7 +44351,7 @@ function resolveGrammarDir(thisDir) {
|
|
|
44331
44351
|
const normalized = thisDir.replace(/\\/g, "/");
|
|
44332
44352
|
const isSource = normalized.endsWith("/src/services");
|
|
44333
44353
|
const isCliBundle = normalized.endsWith("/cli");
|
|
44334
|
-
return isSource || isCliBundle ?
|
|
44354
|
+
return isSource || isCliBundle ? path25.join(thisDir, "..", "lang", "grammars") : path25.join(thisDir, "lang", "grammars");
|
|
44335
44355
|
}
|
|
44336
44356
|
async function checkGrammarWasmFiles() {
|
|
44337
44357
|
const grammarFiles = [
|
|
@@ -44355,14 +44375,14 @@ async function checkGrammarWasmFiles() {
|
|
|
44355
44375
|
"tree-sitter-ini.wasm",
|
|
44356
44376
|
"tree-sitter-regex.wasm"
|
|
44357
44377
|
];
|
|
44358
|
-
const thisDir =
|
|
44378
|
+
const thisDir = path25.dirname(fileURLToPath(import.meta.url));
|
|
44359
44379
|
const grammarDir = resolveGrammarDir(thisDir);
|
|
44360
44380
|
const missing = [];
|
|
44361
|
-
if (!existsSync12(
|
|
44381
|
+
if (!existsSync12(path25.join(grammarDir, "tree-sitter.wasm"))) {
|
|
44362
44382
|
missing.push("tree-sitter.wasm (core runtime)");
|
|
44363
44383
|
}
|
|
44364
44384
|
for (const file3 of grammarFiles) {
|
|
44365
|
-
if (!existsSync12(
|
|
44385
|
+
if (!existsSync12(path25.join(grammarDir, file3))) {
|
|
44366
44386
|
missing.push(file3);
|
|
44367
44387
|
}
|
|
44368
44388
|
}
|
|
@@ -44380,7 +44400,7 @@ async function checkGrammarWasmFiles() {
|
|
|
44380
44400
|
};
|
|
44381
44401
|
}
|
|
44382
44402
|
async function checkCheckpointManifest(directory) {
|
|
44383
|
-
const manifestPath =
|
|
44403
|
+
const manifestPath = path25.join(directory, ".swarm/checkpoints.json");
|
|
44384
44404
|
if (!existsSync12(manifestPath)) {
|
|
44385
44405
|
return {
|
|
44386
44406
|
name: "Checkpoint Manifest",
|
|
@@ -44432,7 +44452,7 @@ async function checkCheckpointManifest(directory) {
|
|
|
44432
44452
|
}
|
|
44433
44453
|
}
|
|
44434
44454
|
async function checkEventStreamIntegrity(directory) {
|
|
44435
|
-
const eventsPath =
|
|
44455
|
+
const eventsPath = path25.join(directory, ".swarm/events.jsonl");
|
|
44436
44456
|
if (!existsSync12(eventsPath)) {
|
|
44437
44457
|
return {
|
|
44438
44458
|
name: "Event Stream",
|
|
@@ -44473,7 +44493,7 @@ async function checkEventStreamIntegrity(directory) {
|
|
|
44473
44493
|
}
|
|
44474
44494
|
}
|
|
44475
44495
|
async function checkSteeringDirectives(directory) {
|
|
44476
|
-
const eventsPath =
|
|
44496
|
+
const eventsPath = path25.join(directory, ".swarm/events.jsonl");
|
|
44477
44497
|
if (!existsSync12(eventsPath)) {
|
|
44478
44498
|
return {
|
|
44479
44499
|
name: "Steering Directives",
|
|
@@ -44529,7 +44549,7 @@ async function checkCurator(directory) {
|
|
|
44529
44549
|
detail: "Disabled (enable via curator.enabled)"
|
|
44530
44550
|
};
|
|
44531
44551
|
}
|
|
44532
|
-
const summaryPath =
|
|
44552
|
+
const summaryPath = path25.join(directory, ".swarm/curator-summary.json");
|
|
44533
44553
|
if (!existsSync12(summaryPath)) {
|
|
44534
44554
|
return {
|
|
44535
44555
|
name: "Curator",
|
|
@@ -44695,7 +44715,7 @@ async function getDiagnoseData(directory) {
|
|
|
44695
44715
|
checks5.push(await checkSteeringDirectives(directory));
|
|
44696
44716
|
checks5.push(await checkCurator(directory));
|
|
44697
44717
|
try {
|
|
44698
|
-
const evidenceDir =
|
|
44718
|
+
const evidenceDir = path25.join(directory, ".swarm", "evidence");
|
|
44699
44719
|
const snapshotFiles = existsSync12(evidenceDir) ? readdirSync4(evidenceDir).filter((f) => f.startsWith("agent-tools-") && f.endsWith(".json")) : [];
|
|
44700
44720
|
if (snapshotFiles.length > 0) {
|
|
44701
44721
|
const latest = snapshotFiles.sort().pop();
|
|
@@ -44725,7 +44745,36 @@ async function getDiagnoseData(directory) {
|
|
|
44725
44745
|
detail: `${deferredWarnings.length} warning(s) deferred from init (run with verbose logs for details)`
|
|
44726
44746
|
});
|
|
44727
44747
|
}
|
|
44728
|
-
const
|
|
44748
|
+
const cachePaths = getPluginCachePaths();
|
|
44749
|
+
const cacheRows = [];
|
|
44750
|
+
for (const cachePath of cachePaths) {
|
|
44751
|
+
try {
|
|
44752
|
+
if (!existsSync12(cachePath)) {
|
|
44753
|
+
cacheRows.push(`⬜ ${cachePath} — absent`);
|
|
44754
|
+
continue;
|
|
44755
|
+
}
|
|
44756
|
+
const pkgJsonPath = path25.join(cachePath, "package.json");
|
|
44757
|
+
try {
|
|
44758
|
+
const raw = readFileSync7(pkgJsonPath, "utf-8");
|
|
44759
|
+
const parsed = JSON.parse(raw);
|
|
44760
|
+
const installedVersion = typeof parsed.version === "string" ? parsed.version : "?";
|
|
44761
|
+
cacheRows.push(`✅ ${cachePath} — v${installedVersion}`);
|
|
44762
|
+
} catch {
|
|
44763
|
+
cacheRows.push(`⚠️ ${cachePath} — present (package.json unreadable)`);
|
|
44764
|
+
}
|
|
44765
|
+
} catch {
|
|
44766
|
+
cacheRows.push(`⚠️ ${cachePath} — status unknown (read error)`);
|
|
44767
|
+
}
|
|
44768
|
+
}
|
|
44769
|
+
const hasCacheEntry = cacheRows.some((r) => r.startsWith("✅"));
|
|
44770
|
+
const hasCacheWarning = cacheRows.some((r) => r.startsWith("⚠️"));
|
|
44771
|
+
const cacheStatus = hasCacheWarning ? "⚠️" : hasCacheEntry ? "✅" : "⬜";
|
|
44772
|
+
checks5.push({
|
|
44773
|
+
name: "Plugin Caches",
|
|
44774
|
+
status: cacheStatus,
|
|
44775
|
+
detail: cacheRows.join(" | ")
|
|
44776
|
+
});
|
|
44777
|
+
const passCount = checks5.filter((c) => c.status === "✅" || c.status === "⬜").length;
|
|
44729
44778
|
const totalCount = checks5.length;
|
|
44730
44779
|
const allPassed = passCount === totalCount;
|
|
44731
44780
|
return {
|
|
@@ -44761,6 +44810,7 @@ async function handleDiagnoseCommand(directory, _args) {
|
|
|
44761
44810
|
var version3;
|
|
44762
44811
|
var init_diagnose_service = __esm(() => {
|
|
44763
44812
|
init_package();
|
|
44813
|
+
init_cache_paths();
|
|
44764
44814
|
init_loader();
|
|
44765
44815
|
init_manager2();
|
|
44766
44816
|
init_utils2();
|
|
@@ -44790,14 +44840,14 @@ __export(exports_config_doctor, {
|
|
|
44790
44840
|
});
|
|
44791
44841
|
import * as crypto3 from "node:crypto";
|
|
44792
44842
|
import * as fs14 from "node:fs";
|
|
44793
|
-
import * as
|
|
44794
|
-
import * as
|
|
44843
|
+
import * as os6 from "node:os";
|
|
44844
|
+
import * as path26 from "node:path";
|
|
44795
44845
|
function getUserConfigDir3() {
|
|
44796
|
-
return process.env.XDG_CONFIG_HOME ||
|
|
44846
|
+
return process.env.XDG_CONFIG_HOME || path26.join(os6.homedir(), ".config");
|
|
44797
44847
|
}
|
|
44798
44848
|
function getConfigPaths(directory) {
|
|
44799
|
-
const userConfigPath =
|
|
44800
|
-
const projectConfigPath =
|
|
44849
|
+
const userConfigPath = path26.join(getUserConfigDir3(), "opencode", "opencode-swarm.json");
|
|
44850
|
+
const projectConfigPath = path26.join(directory, ".opencode", "opencode-swarm.json");
|
|
44801
44851
|
return { userConfigPath, projectConfigPath };
|
|
44802
44852
|
}
|
|
44803
44853
|
function computeHash(content) {
|
|
@@ -44822,9 +44872,9 @@ function isValidConfigPath(configPath, directory) {
|
|
|
44822
44872
|
const normalizedUser = userConfigPath.replace(/\\/g, "/");
|
|
44823
44873
|
const normalizedProject = projectConfigPath.replace(/\\/g, "/");
|
|
44824
44874
|
try {
|
|
44825
|
-
const resolvedConfig =
|
|
44826
|
-
const resolvedUser =
|
|
44827
|
-
const resolvedProject =
|
|
44875
|
+
const resolvedConfig = path26.resolve(configPath);
|
|
44876
|
+
const resolvedUser = path26.resolve(normalizedUser);
|
|
44877
|
+
const resolvedProject = path26.resolve(normalizedProject);
|
|
44828
44878
|
return resolvedConfig === resolvedUser || resolvedConfig === resolvedProject;
|
|
44829
44879
|
} catch {
|
|
44830
44880
|
return false;
|
|
@@ -44864,12 +44914,12 @@ function createConfigBackup(directory) {
|
|
|
44864
44914
|
};
|
|
44865
44915
|
}
|
|
44866
44916
|
function writeBackupArtifact(directory, backup) {
|
|
44867
|
-
const swarmDir =
|
|
44917
|
+
const swarmDir = path26.join(directory, ".swarm");
|
|
44868
44918
|
if (!fs14.existsSync(swarmDir)) {
|
|
44869
44919
|
fs14.mkdirSync(swarmDir, { recursive: true });
|
|
44870
44920
|
}
|
|
44871
44921
|
const backupFilename = `config-backup-${backup.createdAt}.json`;
|
|
44872
|
-
const backupPath =
|
|
44922
|
+
const backupPath = path26.join(swarmDir, backupFilename);
|
|
44873
44923
|
const artifact = {
|
|
44874
44924
|
createdAt: backup.createdAt,
|
|
44875
44925
|
configPath: backup.configPath,
|
|
@@ -44899,7 +44949,7 @@ function restoreFromBackup(backupPath, directory) {
|
|
|
44899
44949
|
return null;
|
|
44900
44950
|
}
|
|
44901
44951
|
const targetPath = artifact.configPath;
|
|
44902
|
-
const targetDir =
|
|
44952
|
+
const targetDir = path26.dirname(targetPath);
|
|
44903
44953
|
if (!fs14.existsSync(targetDir)) {
|
|
44904
44954
|
fs14.mkdirSync(targetDir, { recursive: true });
|
|
44905
44955
|
}
|
|
@@ -44930,9 +44980,9 @@ function readConfigFromFile(directory) {
|
|
|
44930
44980
|
return null;
|
|
44931
44981
|
}
|
|
44932
44982
|
}
|
|
44933
|
-
function validateConfigKey(
|
|
44983
|
+
function validateConfigKey(path27, value, _config) {
|
|
44934
44984
|
const findings = [];
|
|
44935
|
-
switch (
|
|
44985
|
+
switch (path27) {
|
|
44936
44986
|
case "agents": {
|
|
44937
44987
|
if (value !== undefined) {
|
|
44938
44988
|
findings.push({
|
|
@@ -45179,27 +45229,27 @@ function validateConfigKey(path26, value, _config) {
|
|
|
45179
45229
|
}
|
|
45180
45230
|
return findings;
|
|
45181
45231
|
}
|
|
45182
|
-
function walkConfigAndValidate(obj,
|
|
45232
|
+
function walkConfigAndValidate(obj, path27, config3, findings) {
|
|
45183
45233
|
if (obj === null || obj === undefined) {
|
|
45184
45234
|
return;
|
|
45185
45235
|
}
|
|
45186
|
-
if (
|
|
45187
|
-
const keyFindings = validateConfigKey(
|
|
45236
|
+
if (path27 && typeof obj === "object" && !Array.isArray(obj)) {
|
|
45237
|
+
const keyFindings = validateConfigKey(path27, obj, config3);
|
|
45188
45238
|
findings.push(...keyFindings);
|
|
45189
45239
|
}
|
|
45190
45240
|
if (typeof obj !== "object") {
|
|
45191
|
-
const keyFindings = validateConfigKey(
|
|
45241
|
+
const keyFindings = validateConfigKey(path27, obj, config3);
|
|
45192
45242
|
findings.push(...keyFindings);
|
|
45193
45243
|
return;
|
|
45194
45244
|
}
|
|
45195
45245
|
if (Array.isArray(obj)) {
|
|
45196
45246
|
obj.forEach((item, index) => {
|
|
45197
|
-
walkConfigAndValidate(item, `${
|
|
45247
|
+
walkConfigAndValidate(item, `${path27}[${index}]`, config3, findings);
|
|
45198
45248
|
});
|
|
45199
45249
|
return;
|
|
45200
45250
|
}
|
|
45201
45251
|
for (const [key, value] of Object.entries(obj)) {
|
|
45202
|
-
const newPath =
|
|
45252
|
+
const newPath = path27 ? `${path27}.${key}` : key;
|
|
45203
45253
|
walkConfigAndValidate(value, newPath, config3, findings);
|
|
45204
45254
|
}
|
|
45205
45255
|
}
|
|
@@ -45319,7 +45369,7 @@ function applySafeAutoFixes(directory, result) {
|
|
|
45319
45369
|
}
|
|
45320
45370
|
}
|
|
45321
45371
|
if (appliedFixes.length > 0) {
|
|
45322
|
-
const configDir =
|
|
45372
|
+
const configDir = path26.dirname(configPath);
|
|
45323
45373
|
if (!fs14.existsSync(configDir)) {
|
|
45324
45374
|
fs14.mkdirSync(configDir, { recursive: true });
|
|
45325
45375
|
}
|
|
@@ -45329,12 +45379,12 @@ function applySafeAutoFixes(directory, result) {
|
|
|
45329
45379
|
return { appliedFixes, updatedConfigPath };
|
|
45330
45380
|
}
|
|
45331
45381
|
function writeDoctorArtifact(directory, result) {
|
|
45332
|
-
const swarmDir =
|
|
45382
|
+
const swarmDir = path26.join(directory, ".swarm");
|
|
45333
45383
|
if (!fs14.existsSync(swarmDir)) {
|
|
45334
45384
|
fs14.mkdirSync(swarmDir, { recursive: true });
|
|
45335
45385
|
}
|
|
45336
45386
|
const artifactFilename = "config-doctor.json";
|
|
45337
|
-
const artifactPath =
|
|
45387
|
+
const artifactPath = path26.join(swarmDir, artifactFilename);
|
|
45338
45388
|
const guiOutput = {
|
|
45339
45389
|
timestamp: result.timestamp,
|
|
45340
45390
|
summary: result.summary,
|
|
@@ -46381,7 +46431,7 @@ var init_profiles = __esm(() => {
|
|
|
46381
46431
|
|
|
46382
46432
|
// src/lang/detector.ts
|
|
46383
46433
|
import { access as access2, readdir as readdir3 } from "node:fs/promises";
|
|
46384
|
-
import { extname as extname2, join as
|
|
46434
|
+
import { extname as extname2, join as join24 } from "node:path";
|
|
46385
46435
|
function getProfileForFile(filePath) {
|
|
46386
46436
|
const ext = extname2(filePath);
|
|
46387
46437
|
if (!ext)
|
|
@@ -46403,7 +46453,7 @@ async function detectProjectLanguages(projectDir) {
|
|
|
46403
46453
|
if (detectFile.includes("*") || detectFile.includes("?"))
|
|
46404
46454
|
continue;
|
|
46405
46455
|
try {
|
|
46406
|
-
await access2(
|
|
46456
|
+
await access2(join24(dir, detectFile));
|
|
46407
46457
|
detected.add(profile.id);
|
|
46408
46458
|
break;
|
|
46409
46459
|
} catch {}
|
|
@@ -46424,7 +46474,7 @@ async function detectProjectLanguages(projectDir) {
|
|
|
46424
46474
|
const topEntries = await readdir3(projectDir, { withFileTypes: true });
|
|
46425
46475
|
for (const entry of topEntries) {
|
|
46426
46476
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
46427
|
-
await scanDir(
|
|
46477
|
+
await scanDir(join24(projectDir, entry.name));
|
|
46428
46478
|
}
|
|
46429
46479
|
}
|
|
46430
46480
|
} catch {}
|
|
@@ -46443,7 +46493,7 @@ var init_detector = __esm(() => {
|
|
|
46443
46493
|
|
|
46444
46494
|
// src/build/discovery.ts
|
|
46445
46495
|
import * as fs15 from "node:fs";
|
|
46446
|
-
import * as
|
|
46496
|
+
import * as path27 from "node:path";
|
|
46447
46497
|
function isCommandAvailable(command) {
|
|
46448
46498
|
if (toolchainCache.has(command)) {
|
|
46449
46499
|
return toolchainCache.get(command);
|
|
@@ -46476,11 +46526,11 @@ function findBuildFiles(workingDir, patterns) {
|
|
|
46476
46526
|
const regex = simpleGlobToRegex(pattern);
|
|
46477
46527
|
const matches = files.filter((f) => regex.test(f));
|
|
46478
46528
|
if (matches.length > 0) {
|
|
46479
|
-
return
|
|
46529
|
+
return path27.join(dir, matches[0]);
|
|
46480
46530
|
}
|
|
46481
46531
|
} catch {}
|
|
46482
46532
|
} else {
|
|
46483
|
-
const filePath =
|
|
46533
|
+
const filePath = path27.join(workingDir, pattern);
|
|
46484
46534
|
if (fs15.existsSync(filePath)) {
|
|
46485
46535
|
return filePath;
|
|
46486
46536
|
}
|
|
@@ -46489,7 +46539,7 @@ function findBuildFiles(workingDir, patterns) {
|
|
|
46489
46539
|
return null;
|
|
46490
46540
|
}
|
|
46491
46541
|
function getRepoDefinedScripts(workingDir, scripts) {
|
|
46492
|
-
const packageJsonPath =
|
|
46542
|
+
const packageJsonPath = path27.join(workingDir, "package.json");
|
|
46493
46543
|
if (!fs15.existsSync(packageJsonPath)) {
|
|
46494
46544
|
return [];
|
|
46495
46545
|
}
|
|
@@ -46530,7 +46580,7 @@ function findAllBuildFiles(workingDir) {
|
|
|
46530
46580
|
const regex = simpleGlobToRegex(pattern);
|
|
46531
46581
|
findFilesRecursive(workingDir, regex, allBuildFiles);
|
|
46532
46582
|
} else {
|
|
46533
|
-
const filePath =
|
|
46583
|
+
const filePath = path27.join(workingDir, pattern);
|
|
46534
46584
|
if (fs15.existsSync(filePath)) {
|
|
46535
46585
|
allBuildFiles.add(filePath);
|
|
46536
46586
|
}
|
|
@@ -46543,7 +46593,7 @@ function findFilesRecursive(dir, regex, results) {
|
|
|
46543
46593
|
try {
|
|
46544
46594
|
const entries = fs15.readdirSync(dir, { withFileTypes: true });
|
|
46545
46595
|
for (const entry of entries) {
|
|
46546
|
-
const fullPath =
|
|
46596
|
+
const fullPath = path27.join(dir, entry.name);
|
|
46547
46597
|
if (entry.isDirectory() && !["node_modules", ".git", "dist", "build", "target"].includes(entry.name)) {
|
|
46548
46598
|
findFilesRecursive(fullPath, regex, results);
|
|
46549
46599
|
} else if (entry.isFile() && regex.test(entry.name)) {
|
|
@@ -46566,7 +46616,7 @@ async function discoverBuildCommandsFromProfiles(workingDir) {
|
|
|
46566
46616
|
let foundCommand = false;
|
|
46567
46617
|
for (const cmd of sortedCommands) {
|
|
46568
46618
|
if (cmd.detectFile) {
|
|
46569
|
-
const detectFilePath =
|
|
46619
|
+
const detectFilePath = path27.join(workingDir, cmd.detectFile);
|
|
46570
46620
|
if (!fs15.existsSync(detectFilePath)) {
|
|
46571
46621
|
continue;
|
|
46572
46622
|
}
|
|
@@ -46797,7 +46847,7 @@ __export(exports_tool_doctor, {
|
|
|
46797
46847
|
getBinaryReadinessAdvisory: () => getBinaryReadinessAdvisory
|
|
46798
46848
|
});
|
|
46799
46849
|
import * as fs16 from "node:fs";
|
|
46800
|
-
import * as
|
|
46850
|
+
import * as path28 from "node:path";
|
|
46801
46851
|
function extractRegisteredToolKeys(indexPath) {
|
|
46802
46852
|
const registeredKeys = new Set;
|
|
46803
46853
|
try {
|
|
@@ -46864,8 +46914,8 @@ function getBinaryReadinessAdvisory() {
|
|
|
46864
46914
|
}
|
|
46865
46915
|
function runToolDoctor(_directory, pluginRoot) {
|
|
46866
46916
|
const findings = [];
|
|
46867
|
-
const resolvedPluginRoot = pluginRoot ??
|
|
46868
|
-
const indexPath =
|
|
46917
|
+
const resolvedPluginRoot = pluginRoot ?? path28.resolve(import.meta.dir, "..", "..");
|
|
46918
|
+
const indexPath = path28.join(resolvedPluginRoot, "src", "index.ts");
|
|
46869
46919
|
if (!fs16.existsSync(indexPath)) {
|
|
46870
46920
|
return {
|
|
46871
46921
|
findings: [
|
|
@@ -48123,10 +48173,10 @@ var init_history = __esm(() => {
|
|
|
48123
48173
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
48124
48174
|
import { existsSync as existsSync16, readFileSync as readFileSync11 } from "node:fs";
|
|
48125
48175
|
import { mkdir as mkdir5, readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
|
|
48126
|
-
import * as
|
|
48176
|
+
import * as path29 from "node:path";
|
|
48127
48177
|
async function migrateContextToKnowledge(directory, config3) {
|
|
48128
|
-
const sentinelPath =
|
|
48129
|
-
const contextPath =
|
|
48178
|
+
const sentinelPath = path29.join(directory, ".swarm", ".knowledge-migrated");
|
|
48179
|
+
const contextPath = path29.join(directory, ".swarm", "context.md");
|
|
48130
48180
|
const knowledgePath = resolveSwarmKnowledgePath(directory);
|
|
48131
48181
|
if (existsSync16(sentinelPath)) {
|
|
48132
48182
|
return {
|
|
@@ -48217,7 +48267,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
48217
48267
|
await rewriteKnowledge(knowledgePath, existing);
|
|
48218
48268
|
}
|
|
48219
48269
|
await writeSentinel(sentinelPath, migrated, dropped);
|
|
48220
|
-
|
|
48270
|
+
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
48221
48271
|
return {
|
|
48222
48272
|
migrated: true,
|
|
48223
48273
|
entriesMigrated: migrated,
|
|
@@ -48322,7 +48372,7 @@ function truncateLesson(text) {
|
|
|
48322
48372
|
return `${text.slice(0, 277)}...`;
|
|
48323
48373
|
}
|
|
48324
48374
|
function inferProjectName(directory) {
|
|
48325
|
-
const packageJsonPath =
|
|
48375
|
+
const packageJsonPath = path29.join(directory, "package.json");
|
|
48326
48376
|
if (existsSync16(packageJsonPath)) {
|
|
48327
48377
|
try {
|
|
48328
48378
|
const pkg = JSON.parse(readFileSync11(packageJsonPath, "utf-8"));
|
|
@@ -48331,7 +48381,7 @@ function inferProjectName(directory) {
|
|
|
48331
48381
|
}
|
|
48332
48382
|
} catch {}
|
|
48333
48383
|
}
|
|
48334
|
-
return
|
|
48384
|
+
return path29.basename(directory);
|
|
48335
48385
|
}
|
|
48336
48386
|
async function writeSentinel(sentinelPath, migrated, dropped) {
|
|
48337
48387
|
const sentinel = {
|
|
@@ -48343,10 +48393,11 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
|
|
|
48343
48393
|
schema_version: 1,
|
|
48344
48394
|
migration_tool: "knowledge-migrator.ts"
|
|
48345
48395
|
};
|
|
48346
|
-
await mkdir5(
|
|
48396
|
+
await mkdir5(path29.dirname(sentinelPath), { recursive: true });
|
|
48347
48397
|
await writeFile5(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
|
|
48348
48398
|
}
|
|
48349
48399
|
var init_knowledge_migrator = __esm(() => {
|
|
48400
|
+
init_logger();
|
|
48350
48401
|
init_knowledge_store();
|
|
48351
48402
|
init_knowledge_validator();
|
|
48352
48403
|
});
|
|
@@ -48596,7 +48647,7 @@ var init_plan = __esm(() => {
|
|
|
48596
48647
|
|
|
48597
48648
|
// src/utils/path-security.ts
|
|
48598
48649
|
import * as fs17 from "node:fs";
|
|
48599
|
-
import * as
|
|
48650
|
+
import * as path30 from "node:path";
|
|
48600
48651
|
function containsPathTraversal(str) {
|
|
48601
48652
|
if (/\.\.[/\\]/.test(str))
|
|
48602
48653
|
return true;
|
|
@@ -48647,17 +48698,17 @@ function validateSymlinkBoundary(targetPath, rootPath) {
|
|
|
48647
48698
|
try {
|
|
48648
48699
|
realTarget = fs17.realpathSync(targetPath);
|
|
48649
48700
|
} catch {
|
|
48650
|
-
realTarget =
|
|
48701
|
+
realTarget = path30.normalize(targetPath);
|
|
48651
48702
|
}
|
|
48652
48703
|
let realRoot;
|
|
48653
48704
|
try {
|
|
48654
48705
|
realRoot = fs17.realpathSync(rootPath);
|
|
48655
48706
|
} catch {
|
|
48656
|
-
realRoot =
|
|
48707
|
+
realRoot = path30.normalize(rootPath);
|
|
48657
48708
|
}
|
|
48658
|
-
const normalizedTarget =
|
|
48659
|
-
const normalizedRoot =
|
|
48660
|
-
if (!normalizedTarget.startsWith(normalizedRoot +
|
|
48709
|
+
const normalizedTarget = path30.normalize(realTarget);
|
|
48710
|
+
const normalizedRoot = path30.normalize(realRoot);
|
|
48711
|
+
if (!normalizedTarget.startsWith(normalizedRoot + path30.sep) && normalizedTarget !== normalizedRoot) {
|
|
48661
48712
|
throw new Error(`Symlink resolution escaped boundary: ${realTarget} is not within ${realRoot}`);
|
|
48662
48713
|
}
|
|
48663
48714
|
}
|
|
@@ -48665,7 +48716,7 @@ var init_path_security = () => {};
|
|
|
48665
48716
|
|
|
48666
48717
|
// src/tools/lint.ts
|
|
48667
48718
|
import * as fs18 from "node:fs";
|
|
48668
|
-
import * as
|
|
48719
|
+
import * as path31 from "node:path";
|
|
48669
48720
|
function validateArgs(args2) {
|
|
48670
48721
|
if (typeof args2 !== "object" || args2 === null)
|
|
48671
48722
|
return false;
|
|
@@ -48676,9 +48727,9 @@ function validateArgs(args2) {
|
|
|
48676
48727
|
}
|
|
48677
48728
|
function getLinterCommand(linter, mode, projectDir) {
|
|
48678
48729
|
const isWindows = process.platform === "win32";
|
|
48679
|
-
const binDir =
|
|
48680
|
-
const biomeBin = isWindows ?
|
|
48681
|
-
const eslintBin = isWindows ?
|
|
48730
|
+
const binDir = path31.join(projectDir, "node_modules", ".bin");
|
|
48731
|
+
const biomeBin = isWindows ? path31.join(binDir, "biome.EXE") : path31.join(binDir, "biome");
|
|
48732
|
+
const eslintBin = isWindows ? path31.join(binDir, "eslint.cmd") : path31.join(binDir, "eslint");
|
|
48682
48733
|
switch (linter) {
|
|
48683
48734
|
case "biome":
|
|
48684
48735
|
if (mode === "fix") {
|
|
@@ -48694,7 +48745,7 @@ function getLinterCommand(linter, mode, projectDir) {
|
|
|
48694
48745
|
}
|
|
48695
48746
|
function getAdditionalLinterCommand(linter, mode, cwd) {
|
|
48696
48747
|
const gradlewName = process.platform === "win32" ? "gradlew.bat" : "gradlew";
|
|
48697
|
-
const gradlew = fs18.existsSync(
|
|
48748
|
+
const gradlew = fs18.existsSync(path31.join(cwd, gradlewName)) ? path31.join(cwd, gradlewName) : null;
|
|
48698
48749
|
switch (linter) {
|
|
48699
48750
|
case "ruff":
|
|
48700
48751
|
return mode === "fix" ? ["ruff", "check", "--fix", "."] : ["ruff", "check", "."];
|
|
@@ -48728,10 +48779,10 @@ function getAdditionalLinterCommand(linter, mode, cwd) {
|
|
|
48728
48779
|
}
|
|
48729
48780
|
}
|
|
48730
48781
|
function detectRuff(cwd) {
|
|
48731
|
-
if (fs18.existsSync(
|
|
48782
|
+
if (fs18.existsSync(path31.join(cwd, "ruff.toml")))
|
|
48732
48783
|
return isCommandAvailable("ruff");
|
|
48733
48784
|
try {
|
|
48734
|
-
const pyproject =
|
|
48785
|
+
const pyproject = path31.join(cwd, "pyproject.toml");
|
|
48735
48786
|
if (fs18.existsSync(pyproject)) {
|
|
48736
48787
|
const content = fs18.readFileSync(pyproject, "utf-8");
|
|
48737
48788
|
if (content.includes("[tool.ruff]"))
|
|
@@ -48741,19 +48792,19 @@ function detectRuff(cwd) {
|
|
|
48741
48792
|
return false;
|
|
48742
48793
|
}
|
|
48743
48794
|
function detectClippy(cwd) {
|
|
48744
|
-
return fs18.existsSync(
|
|
48795
|
+
return fs18.existsSync(path31.join(cwd, "Cargo.toml")) && isCommandAvailable("cargo");
|
|
48745
48796
|
}
|
|
48746
48797
|
function detectGolangciLint(cwd) {
|
|
48747
|
-
return fs18.existsSync(
|
|
48798
|
+
return fs18.existsSync(path31.join(cwd, "go.mod")) && isCommandAvailable("golangci-lint");
|
|
48748
48799
|
}
|
|
48749
48800
|
function detectCheckstyle(cwd) {
|
|
48750
|
-
const hasMaven = fs18.existsSync(
|
|
48751
|
-
const hasGradle = fs18.existsSync(
|
|
48752
|
-
const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (fs18.existsSync(
|
|
48801
|
+
const hasMaven = fs18.existsSync(path31.join(cwd, "pom.xml"));
|
|
48802
|
+
const hasGradle = fs18.existsSync(path31.join(cwd, "build.gradle")) || fs18.existsSync(path31.join(cwd, "build.gradle.kts"));
|
|
48803
|
+
const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (fs18.existsSync(path31.join(cwd, "gradlew")) || isCommandAvailable("gradle"));
|
|
48753
48804
|
return (hasMaven || hasGradle) && hasBinary;
|
|
48754
48805
|
}
|
|
48755
48806
|
function detectKtlint(cwd) {
|
|
48756
|
-
const hasKotlin = fs18.existsSync(
|
|
48807
|
+
const hasKotlin = fs18.existsSync(path31.join(cwd, "build.gradle.kts")) || fs18.existsSync(path31.join(cwd, "build.gradle")) || (() => {
|
|
48757
48808
|
try {
|
|
48758
48809
|
return fs18.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
|
|
48759
48810
|
} catch {
|
|
@@ -48772,11 +48823,11 @@ function detectDotnetFormat(cwd) {
|
|
|
48772
48823
|
}
|
|
48773
48824
|
}
|
|
48774
48825
|
function detectCppcheck(cwd) {
|
|
48775
|
-
if (fs18.existsSync(
|
|
48826
|
+
if (fs18.existsSync(path31.join(cwd, "CMakeLists.txt"))) {
|
|
48776
48827
|
return isCommandAvailable("cppcheck");
|
|
48777
48828
|
}
|
|
48778
48829
|
try {
|
|
48779
|
-
const dirsToCheck = [cwd,
|
|
48830
|
+
const dirsToCheck = [cwd, path31.join(cwd, "src")];
|
|
48780
48831
|
const hasCpp = dirsToCheck.some((dir) => {
|
|
48781
48832
|
try {
|
|
48782
48833
|
return fs18.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
|
|
@@ -48790,13 +48841,13 @@ function detectCppcheck(cwd) {
|
|
|
48790
48841
|
}
|
|
48791
48842
|
}
|
|
48792
48843
|
function detectSwiftlint(cwd) {
|
|
48793
|
-
return fs18.existsSync(
|
|
48844
|
+
return fs18.existsSync(path31.join(cwd, "Package.swift")) && isCommandAvailable("swiftlint");
|
|
48794
48845
|
}
|
|
48795
48846
|
function detectDartAnalyze(cwd) {
|
|
48796
|
-
return fs18.existsSync(
|
|
48847
|
+
return fs18.existsSync(path31.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
|
|
48797
48848
|
}
|
|
48798
48849
|
function detectRubocop(cwd) {
|
|
48799
|
-
return (fs18.existsSync(
|
|
48850
|
+
return (fs18.existsSync(path31.join(cwd, "Gemfile")) || fs18.existsSync(path31.join(cwd, "gems.rb")) || fs18.existsSync(path31.join(cwd, ".rubocop.yml"))) && (isCommandAvailable("rubocop") || isCommandAvailable("bundle"));
|
|
48800
48851
|
}
|
|
48801
48852
|
function detectAdditionalLinter(cwd) {
|
|
48802
48853
|
if (detectRuff(cwd))
|
|
@@ -48824,10 +48875,10 @@ function detectAdditionalLinter(cwd) {
|
|
|
48824
48875
|
function resolveLinterBinPath(linter, projectDir) {
|
|
48825
48876
|
const isWindows = process.platform === "win32";
|
|
48826
48877
|
const binName = linter === "biome" ? isWindows ? "biome.EXE" : "biome" : isWindows ? "eslint.cmd" : "eslint";
|
|
48827
|
-
const localBin =
|
|
48878
|
+
const localBin = path31.join(projectDir, "node_modules", ".bin", binName);
|
|
48828
48879
|
if (fs18.existsSync(localBin))
|
|
48829
48880
|
return localBin;
|
|
48830
|
-
const ancestor = findBinInAncestors(
|
|
48881
|
+
const ancestor = findBinInAncestors(path31.dirname(projectDir), binName);
|
|
48831
48882
|
if (ancestor)
|
|
48832
48883
|
return ancestor;
|
|
48833
48884
|
const fromPath = findBinInEnvPath(binName);
|
|
@@ -48838,10 +48889,10 @@ function resolveLinterBinPath(linter, projectDir) {
|
|
|
48838
48889
|
function findBinInAncestors(startDir, binName) {
|
|
48839
48890
|
let dir = startDir;
|
|
48840
48891
|
while (true) {
|
|
48841
|
-
const candidate =
|
|
48892
|
+
const candidate = path31.join(dir, "node_modules", ".bin", binName);
|
|
48842
48893
|
if (fs18.existsSync(candidate))
|
|
48843
48894
|
return candidate;
|
|
48844
|
-
const parent =
|
|
48895
|
+
const parent = path31.dirname(dir);
|
|
48845
48896
|
if (parent === dir)
|
|
48846
48897
|
break;
|
|
48847
48898
|
dir = parent;
|
|
@@ -48850,10 +48901,10 @@ function findBinInAncestors(startDir, binName) {
|
|
|
48850
48901
|
}
|
|
48851
48902
|
function findBinInEnvPath(binName) {
|
|
48852
48903
|
const searchPath = process.env.PATH ?? "";
|
|
48853
|
-
for (const dir of searchPath.split(
|
|
48904
|
+
for (const dir of searchPath.split(path31.delimiter)) {
|
|
48854
48905
|
if (!dir)
|
|
48855
48906
|
continue;
|
|
48856
|
-
const candidate =
|
|
48907
|
+
const candidate = path31.join(dir, binName);
|
|
48857
48908
|
if (fs18.existsSync(candidate))
|
|
48858
48909
|
return candidate;
|
|
48859
48910
|
}
|
|
@@ -48866,13 +48917,13 @@ async function detectAvailableLinter(directory) {
|
|
|
48866
48917
|
return null;
|
|
48867
48918
|
const projectDir = directory;
|
|
48868
48919
|
const isWindows = process.platform === "win32";
|
|
48869
|
-
const biomeBin = isWindows ?
|
|
48870
|
-
const eslintBin = isWindows ?
|
|
48920
|
+
const biomeBin = isWindows ? path31.join(projectDir, "node_modules", ".bin", "biome.EXE") : path31.join(projectDir, "node_modules", ".bin", "biome");
|
|
48921
|
+
const eslintBin = isWindows ? path31.join(projectDir, "node_modules", ".bin", "eslint.cmd") : path31.join(projectDir, "node_modules", ".bin", "eslint");
|
|
48871
48922
|
const localResult = await _detectAvailableLinter(projectDir, biomeBin, eslintBin);
|
|
48872
48923
|
if (localResult)
|
|
48873
48924
|
return localResult;
|
|
48874
|
-
const biomeAncestor = findBinInAncestors(
|
|
48875
|
-
const eslintAncestor = findBinInAncestors(
|
|
48925
|
+
const biomeAncestor = findBinInAncestors(path31.dirname(projectDir), isWindows ? "biome.EXE" : "biome");
|
|
48926
|
+
const eslintAncestor = findBinInAncestors(path31.dirname(projectDir), isWindows ? "eslint.cmd" : "eslint");
|
|
48876
48927
|
if (biomeAncestor || eslintAncestor) {
|
|
48877
48928
|
return _detectAvailableLinter(projectDir, biomeAncestor ?? biomeBin, eslintAncestor ?? eslintBin);
|
|
48878
48929
|
}
|
|
@@ -49088,7 +49139,7 @@ For Rust: rustup component add clippy`
|
|
|
49088
49139
|
|
|
49089
49140
|
// src/tools/secretscan.ts
|
|
49090
49141
|
import * as fs19 from "node:fs";
|
|
49091
|
-
import * as
|
|
49142
|
+
import * as path32 from "node:path";
|
|
49092
49143
|
function calculateShannonEntropy(str) {
|
|
49093
49144
|
if (str.length === 0)
|
|
49094
49145
|
return 0;
|
|
@@ -49136,7 +49187,7 @@ function isGlobOrPathPattern(pattern) {
|
|
|
49136
49187
|
return pattern.includes("/") || pattern.includes("\\") || /[*?[\]{}]/.test(pattern);
|
|
49137
49188
|
}
|
|
49138
49189
|
function loadSecretScanIgnore(scanDir) {
|
|
49139
|
-
const ignorePath =
|
|
49190
|
+
const ignorePath = path32.join(scanDir, ".secretscanignore");
|
|
49140
49191
|
try {
|
|
49141
49192
|
if (!fs19.existsSync(ignorePath))
|
|
49142
49193
|
return [];
|
|
@@ -49159,7 +49210,7 @@ function isExcluded(entry, relPath, exactNames, globPatterns) {
|
|
|
49159
49210
|
if (exactNames.has(entry))
|
|
49160
49211
|
return true;
|
|
49161
49212
|
for (const pattern of globPatterns) {
|
|
49162
|
-
if (
|
|
49213
|
+
if (path32.matchesGlob(relPath, pattern))
|
|
49163
49214
|
return true;
|
|
49164
49215
|
}
|
|
49165
49216
|
return false;
|
|
@@ -49180,7 +49231,7 @@ function validateDirectoryInput(dir) {
|
|
|
49180
49231
|
return null;
|
|
49181
49232
|
}
|
|
49182
49233
|
function isBinaryFile(filePath, buffer) {
|
|
49183
|
-
const ext =
|
|
49234
|
+
const ext = path32.extname(filePath).toLowerCase();
|
|
49184
49235
|
if (DEFAULT_EXCLUDE_EXTENSIONS.has(ext)) {
|
|
49185
49236
|
return true;
|
|
49186
49237
|
}
|
|
@@ -49316,9 +49367,9 @@ function isSymlinkLoop(realPath, visited) {
|
|
|
49316
49367
|
return false;
|
|
49317
49368
|
}
|
|
49318
49369
|
function isPathWithinScope(realPath, scanDir) {
|
|
49319
|
-
const resolvedScanDir =
|
|
49320
|
-
const resolvedRealPath =
|
|
49321
|
-
return resolvedRealPath === resolvedScanDir || resolvedRealPath.startsWith(resolvedScanDir +
|
|
49370
|
+
const resolvedScanDir = path32.resolve(scanDir);
|
|
49371
|
+
const resolvedRealPath = path32.resolve(realPath);
|
|
49372
|
+
return resolvedRealPath === resolvedScanDir || resolvedRealPath.startsWith(resolvedScanDir + path32.sep) || resolvedRealPath.startsWith(`${resolvedScanDir}/`) || resolvedRealPath.startsWith(`${resolvedScanDir}\\`);
|
|
49322
49373
|
}
|
|
49323
49374
|
function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, stats = {
|
|
49324
49375
|
skippedDirs: 0,
|
|
@@ -49344,8 +49395,8 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
49344
49395
|
return a.localeCompare(b);
|
|
49345
49396
|
});
|
|
49346
49397
|
for (const entry of entries) {
|
|
49347
|
-
const fullPath =
|
|
49348
|
-
const relPath =
|
|
49398
|
+
const fullPath = path32.join(dir, entry);
|
|
49399
|
+
const relPath = path32.relative(scanDir, fullPath).replace(/\\/g, "/");
|
|
49349
49400
|
if (isExcluded(entry, relPath, excludeExact, excludeGlobs)) {
|
|
49350
49401
|
stats.skippedDirs++;
|
|
49351
49402
|
continue;
|
|
@@ -49380,7 +49431,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
49380
49431
|
const subFiles = findScannableFiles(fullPath, excludeExact, excludeGlobs, scanDir, visited, stats);
|
|
49381
49432
|
files.push(...subFiles);
|
|
49382
49433
|
} else if (lstat.isFile()) {
|
|
49383
|
-
const ext =
|
|
49434
|
+
const ext = path32.extname(fullPath).toLowerCase();
|
|
49384
49435
|
if (!DEFAULT_EXCLUDE_EXTENSIONS.has(ext)) {
|
|
49385
49436
|
files.push(fullPath);
|
|
49386
49437
|
} else {
|
|
@@ -49640,7 +49691,7 @@ var init_secretscan = __esm(() => {
|
|
|
49640
49691
|
}
|
|
49641
49692
|
}
|
|
49642
49693
|
try {
|
|
49643
|
-
const _scanDirRaw =
|
|
49694
|
+
const _scanDirRaw = path32.resolve(directory);
|
|
49644
49695
|
const scanDir = (() => {
|
|
49645
49696
|
try {
|
|
49646
49697
|
return fs19.realpathSync(_scanDirRaw);
|
|
@@ -49783,7 +49834,7 @@ var init_secretscan = __esm(() => {
|
|
|
49783
49834
|
|
|
49784
49835
|
// src/test-impact/analyzer.ts
|
|
49785
49836
|
import fs20 from "node:fs";
|
|
49786
|
-
import
|
|
49837
|
+
import path33 from "node:path";
|
|
49787
49838
|
function normalizePath(p) {
|
|
49788
49839
|
return p.replace(/\\/g, "/");
|
|
49789
49840
|
}
|
|
@@ -49804,8 +49855,8 @@ function resolveRelativeImport(fromDir, importPath) {
|
|
|
49804
49855
|
if (!importPath.startsWith(".")) {
|
|
49805
49856
|
return null;
|
|
49806
49857
|
}
|
|
49807
|
-
const resolved =
|
|
49808
|
-
if (
|
|
49858
|
+
const resolved = path33.resolve(fromDir, importPath);
|
|
49859
|
+
if (path33.extname(resolved)) {
|
|
49809
49860
|
if (fs20.existsSync(resolved) && fs20.statSync(resolved).isFile()) {
|
|
49810
49861
|
return normalizePath(resolved);
|
|
49811
49862
|
}
|
|
@@ -49850,12 +49901,12 @@ function findTestFilesSync(cwd) {
|
|
|
49850
49901
|
for (const entry of entries) {
|
|
49851
49902
|
if (entry.isDirectory()) {
|
|
49852
49903
|
if (!skipDirs.has(entry.name)) {
|
|
49853
|
-
walk(
|
|
49904
|
+
walk(path33.join(dir, entry.name), visitedInodes);
|
|
49854
49905
|
}
|
|
49855
49906
|
} else if (entry.isFile()) {
|
|
49856
49907
|
const name2 = entry.name;
|
|
49857
49908
|
if (/\.(test|spec)\.(ts|tsx|js|jsx)$/.test(name2) || dir.includes("__tests__") && /\.(ts|tsx|js|jsx)$/.test(name2)) {
|
|
49858
|
-
testFiles.push(normalizePath(
|
|
49909
|
+
testFiles.push(normalizePath(path33.join(dir, entry.name)));
|
|
49859
49910
|
}
|
|
49860
49911
|
}
|
|
49861
49912
|
}
|
|
@@ -49893,7 +49944,7 @@ async function buildImpactMapInternal(cwd) {
|
|
|
49893
49944
|
continue;
|
|
49894
49945
|
}
|
|
49895
49946
|
const imports = extractImports(content);
|
|
49896
|
-
const testDir =
|
|
49947
|
+
const testDir = path33.dirname(testFile);
|
|
49897
49948
|
for (const importPath of imports) {
|
|
49898
49949
|
const resolvedSource = resolveRelativeImport(testDir, importPath);
|
|
49899
49950
|
if (resolvedSource === null) {
|
|
@@ -49915,7 +49966,7 @@ async function buildImpactMap(cwd) {
|
|
|
49915
49966
|
return impactMap;
|
|
49916
49967
|
}
|
|
49917
49968
|
async function loadImpactMap(cwd) {
|
|
49918
|
-
const cachePath =
|
|
49969
|
+
const cachePath = path33.join(cwd, ".swarm", "cache", "impact-map.json");
|
|
49919
49970
|
if (fs20.existsSync(cachePath)) {
|
|
49920
49971
|
try {
|
|
49921
49972
|
const content = fs20.readFileSync(cachePath, "utf-8");
|
|
@@ -49930,8 +49981,8 @@ async function loadImpactMap(cwd) {
|
|
|
49930
49981
|
return buildImpactMap(cwd);
|
|
49931
49982
|
}
|
|
49932
49983
|
async function saveImpactMap(cwd, impactMap) {
|
|
49933
|
-
const cacheDir2 =
|
|
49934
|
-
const cachePath =
|
|
49984
|
+
const cacheDir2 = path33.join(cwd, ".swarm", "cache");
|
|
49985
|
+
const cachePath = path33.join(cacheDir2, "impact-map.json");
|
|
49935
49986
|
if (!fs20.existsSync(cacheDir2)) {
|
|
49936
49987
|
fs20.mkdirSync(cacheDir2, { recursive: true });
|
|
49937
49988
|
}
|
|
@@ -49957,7 +50008,7 @@ async function analyzeImpact(changedFiles, cwd) {
|
|
|
49957
50008
|
const impactedTestsSet = new Set;
|
|
49958
50009
|
const untestedFiles = [];
|
|
49959
50010
|
for (const changedFile of validFiles) {
|
|
49960
|
-
const normalizedChanged = normalizePath(
|
|
50011
|
+
const normalizedChanged = normalizePath(path33.resolve(changedFile));
|
|
49961
50012
|
const tests = impactMap[normalizedChanged];
|
|
49962
50013
|
if (tests && tests.length > 0) {
|
|
49963
50014
|
for (const test of tests) {
|
|
@@ -50209,9 +50260,9 @@ var FLAKY_THRESHOLD = 0.3, MIN_RUNS_FOR_QUARANTINE = 5, MAX_HISTORY_RUNS = 20;
|
|
|
50209
50260
|
|
|
50210
50261
|
// src/test-impact/history-store.ts
|
|
50211
50262
|
import fs21 from "node:fs";
|
|
50212
|
-
import
|
|
50263
|
+
import path34 from "node:path";
|
|
50213
50264
|
function getHistoryPath(workingDir) {
|
|
50214
|
-
return
|
|
50265
|
+
return path34.join(workingDir || process.cwd(), ".swarm", "cache", "test-history.jsonl");
|
|
50215
50266
|
}
|
|
50216
50267
|
function sanitizeErrorMessage(errorMessage) {
|
|
50217
50268
|
if (errorMessage === undefined) {
|
|
@@ -50266,7 +50317,7 @@ function appendTestRun(record3, workingDir) {
|
|
|
50266
50317
|
changedFiles: sanitizeChangedFiles(record3.changedFiles || [])
|
|
50267
50318
|
};
|
|
50268
50319
|
const historyPath = getHistoryPath(workingDir);
|
|
50269
|
-
const historyDir =
|
|
50320
|
+
const historyDir = path34.dirname(historyPath);
|
|
50270
50321
|
if (!fs21.existsSync(historyDir)) {
|
|
50271
50322
|
fs21.mkdirSync(historyDir, { recursive: true });
|
|
50272
50323
|
}
|
|
@@ -50348,7 +50399,7 @@ var init_history_store = __esm(() => {
|
|
|
50348
50399
|
|
|
50349
50400
|
// src/tools/resolve-working-directory.ts
|
|
50350
50401
|
import * as fs22 from "node:fs";
|
|
50351
|
-
import * as
|
|
50402
|
+
import * as path35 from "node:path";
|
|
50352
50403
|
function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
|
|
50353
50404
|
if (workingDirectory == null || workingDirectory === "") {
|
|
50354
50405
|
return { success: true, directory: fallbackDirectory };
|
|
@@ -50368,15 +50419,15 @@ function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
|
|
|
50368
50419
|
};
|
|
50369
50420
|
}
|
|
50370
50421
|
}
|
|
50371
|
-
const normalizedDir =
|
|
50372
|
-
const pathParts = normalizedDir.split(
|
|
50422
|
+
const normalizedDir = path35.normalize(workingDirectory);
|
|
50423
|
+
const pathParts = normalizedDir.split(path35.sep);
|
|
50373
50424
|
if (pathParts.includes("..")) {
|
|
50374
50425
|
return {
|
|
50375
50426
|
success: false,
|
|
50376
50427
|
message: "Invalid working_directory: path traversal sequences (..) are not allowed"
|
|
50377
50428
|
};
|
|
50378
50429
|
}
|
|
50379
|
-
const resolvedDir =
|
|
50430
|
+
const resolvedDir = path35.resolve(normalizedDir);
|
|
50380
50431
|
let statResult;
|
|
50381
50432
|
try {
|
|
50382
50433
|
statResult = fs22.statSync(resolvedDir);
|
|
@@ -50392,7 +50443,7 @@ function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
|
|
|
50392
50443
|
message: `Invalid working_directory: path "${resolvedDir}" is not a directory`
|
|
50393
50444
|
};
|
|
50394
50445
|
}
|
|
50395
|
-
const resolvedFallback =
|
|
50446
|
+
const resolvedFallback = path35.resolve(fallbackDirectory);
|
|
50396
50447
|
let fallbackExists = false;
|
|
50397
50448
|
try {
|
|
50398
50449
|
fs22.statSync(resolvedFallback);
|
|
@@ -50402,7 +50453,7 @@ function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
|
|
|
50402
50453
|
}
|
|
50403
50454
|
if (workingDirectory != null && workingDirectory !== "") {
|
|
50404
50455
|
if (fallbackExists) {
|
|
50405
|
-
const isSubdirectory = resolvedDir.startsWith(resolvedFallback +
|
|
50456
|
+
const isSubdirectory = resolvedDir.startsWith(resolvedFallback + path35.sep);
|
|
50406
50457
|
if (isSubdirectory) {
|
|
50407
50458
|
return {
|
|
50408
50459
|
success: false,
|
|
@@ -50424,7 +50475,7 @@ var init_resolve_working_directory = () => {};
|
|
|
50424
50475
|
|
|
50425
50476
|
// src/tools/test-runner.ts
|
|
50426
50477
|
import * as fs23 from "node:fs";
|
|
50427
|
-
import * as
|
|
50478
|
+
import * as path36 from "node:path";
|
|
50428
50479
|
function isAbsolutePath(str) {
|
|
50429
50480
|
if (str.startsWith("/"))
|
|
50430
50481
|
return true;
|
|
@@ -50489,14 +50540,14 @@ function hasDevDependency(devDeps, ...patterns) {
|
|
|
50489
50540
|
return hasPackageJsonDependency(devDeps, ...patterns);
|
|
50490
50541
|
}
|
|
50491
50542
|
function detectGoTest(cwd) {
|
|
50492
|
-
return fs23.existsSync(
|
|
50543
|
+
return fs23.existsSync(path36.join(cwd, "go.mod")) && isCommandAvailable("go");
|
|
50493
50544
|
}
|
|
50494
50545
|
function detectJavaMaven(cwd) {
|
|
50495
|
-
return fs23.existsSync(
|
|
50546
|
+
return fs23.existsSync(path36.join(cwd, "pom.xml")) && isCommandAvailable("mvn");
|
|
50496
50547
|
}
|
|
50497
50548
|
function detectGradle(cwd) {
|
|
50498
|
-
const hasBuildFile = fs23.existsSync(
|
|
50499
|
-
const hasGradlew = fs23.existsSync(
|
|
50549
|
+
const hasBuildFile = fs23.existsSync(path36.join(cwd, "build.gradle")) || fs23.existsSync(path36.join(cwd, "build.gradle.kts"));
|
|
50550
|
+
const hasGradlew = fs23.existsSync(path36.join(cwd, "gradlew")) || fs23.existsSync(path36.join(cwd, "gradlew.bat"));
|
|
50500
50551
|
return hasBuildFile && (hasGradlew || isCommandAvailable("gradle"));
|
|
50501
50552
|
}
|
|
50502
50553
|
function detectDotnetTest(cwd) {
|
|
@@ -50509,30 +50560,30 @@ function detectDotnetTest(cwd) {
|
|
|
50509
50560
|
}
|
|
50510
50561
|
}
|
|
50511
50562
|
function detectCTest(cwd) {
|
|
50512
|
-
const hasSource = fs23.existsSync(
|
|
50513
|
-
const hasBuildCache = fs23.existsSync(
|
|
50563
|
+
const hasSource = fs23.existsSync(path36.join(cwd, "CMakeLists.txt"));
|
|
50564
|
+
const hasBuildCache = fs23.existsSync(path36.join(cwd, "CMakeCache.txt")) || fs23.existsSync(path36.join(cwd, "build", "CMakeCache.txt"));
|
|
50514
50565
|
return (hasSource || hasBuildCache) && isCommandAvailable("ctest");
|
|
50515
50566
|
}
|
|
50516
50567
|
function detectSwiftTest(cwd) {
|
|
50517
|
-
return fs23.existsSync(
|
|
50568
|
+
return fs23.existsSync(path36.join(cwd, "Package.swift")) && isCommandAvailable("swift");
|
|
50518
50569
|
}
|
|
50519
50570
|
function detectDartTest(cwd) {
|
|
50520
|
-
return fs23.existsSync(
|
|
50571
|
+
return fs23.existsSync(path36.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
|
|
50521
50572
|
}
|
|
50522
50573
|
function detectRSpec(cwd) {
|
|
50523
|
-
const hasRSpecFile = fs23.existsSync(
|
|
50524
|
-
const hasGemfile = fs23.existsSync(
|
|
50525
|
-
const hasSpecDir = fs23.existsSync(
|
|
50574
|
+
const hasRSpecFile = fs23.existsSync(path36.join(cwd, ".rspec"));
|
|
50575
|
+
const hasGemfile = fs23.existsSync(path36.join(cwd, "Gemfile"));
|
|
50576
|
+
const hasSpecDir = fs23.existsSync(path36.join(cwd, "spec"));
|
|
50526
50577
|
const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
|
|
50527
50578
|
return hasRSpec && (isCommandAvailable("bundle") || isCommandAvailable("rspec"));
|
|
50528
50579
|
}
|
|
50529
50580
|
function detectMinitest(cwd) {
|
|
50530
|
-
return fs23.existsSync(
|
|
50581
|
+
return fs23.existsSync(path36.join(cwd, "test")) && (fs23.existsSync(path36.join(cwd, "Gemfile")) || fs23.existsSync(path36.join(cwd, "Rakefile"))) && isCommandAvailable("ruby");
|
|
50531
50582
|
}
|
|
50532
50583
|
async function detectTestFramework(cwd) {
|
|
50533
50584
|
const baseDir = cwd;
|
|
50534
50585
|
try {
|
|
50535
|
-
const packageJsonPath =
|
|
50586
|
+
const packageJsonPath = path36.join(baseDir, "package.json");
|
|
50536
50587
|
if (fs23.existsSync(packageJsonPath)) {
|
|
50537
50588
|
const content = fs23.readFileSync(packageJsonPath, "utf-8");
|
|
50538
50589
|
const pkg = JSON.parse(content);
|
|
@@ -50553,16 +50604,16 @@ async function detectTestFramework(cwd) {
|
|
|
50553
50604
|
return "jest";
|
|
50554
50605
|
if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
|
|
50555
50606
|
return "mocha";
|
|
50556
|
-
if (fs23.existsSync(
|
|
50607
|
+
if (fs23.existsSync(path36.join(baseDir, "bun.lockb")) || fs23.existsSync(path36.join(baseDir, "bun.lock"))) {
|
|
50557
50608
|
if (scripts.test?.includes("bun"))
|
|
50558
50609
|
return "bun";
|
|
50559
50610
|
}
|
|
50560
50611
|
}
|
|
50561
50612
|
} catch {}
|
|
50562
50613
|
try {
|
|
50563
|
-
const pyprojectTomlPath =
|
|
50564
|
-
const setupCfgPath =
|
|
50565
|
-
const requirementsTxtPath =
|
|
50614
|
+
const pyprojectTomlPath = path36.join(baseDir, "pyproject.toml");
|
|
50615
|
+
const setupCfgPath = path36.join(baseDir, "setup.cfg");
|
|
50616
|
+
const requirementsTxtPath = path36.join(baseDir, "requirements.txt");
|
|
50566
50617
|
if (fs23.existsSync(pyprojectTomlPath)) {
|
|
50567
50618
|
const content = fs23.readFileSync(pyprojectTomlPath, "utf-8");
|
|
50568
50619
|
if (content.includes("[tool.pytest"))
|
|
@@ -50582,7 +50633,7 @@ async function detectTestFramework(cwd) {
|
|
|
50582
50633
|
}
|
|
50583
50634
|
} catch {}
|
|
50584
50635
|
try {
|
|
50585
|
-
const cargoTomlPath =
|
|
50636
|
+
const cargoTomlPath = path36.join(baseDir, "Cargo.toml");
|
|
50586
50637
|
if (fs23.existsSync(cargoTomlPath)) {
|
|
50587
50638
|
const content = fs23.readFileSync(cargoTomlPath, "utf-8");
|
|
50588
50639
|
if (content.includes("[dev-dependencies]")) {
|
|
@@ -50593,9 +50644,9 @@ async function detectTestFramework(cwd) {
|
|
|
50593
50644
|
}
|
|
50594
50645
|
} catch {}
|
|
50595
50646
|
try {
|
|
50596
|
-
const pesterConfigPath =
|
|
50597
|
-
const pesterConfigJsonPath =
|
|
50598
|
-
const pesterPs1Path =
|
|
50647
|
+
const pesterConfigPath = path36.join(baseDir, "pester.config.ps1");
|
|
50648
|
+
const pesterConfigJsonPath = path36.join(baseDir, "pester.config.ps1.json");
|
|
50649
|
+
const pesterPs1Path = path36.join(baseDir, "tests.ps1");
|
|
50599
50650
|
if (fs23.existsSync(pesterConfigPath) || fs23.existsSync(pesterConfigJsonPath) || fs23.existsSync(pesterPs1Path)) {
|
|
50600
50651
|
return "pester";
|
|
50601
50652
|
}
|
|
@@ -50624,12 +50675,12 @@ function isTestDirectoryPath(normalizedPath) {
|
|
|
50624
50675
|
return normalizedPath.split("/").some((segment) => TEST_DIRECTORY_NAMES.includes(segment));
|
|
50625
50676
|
}
|
|
50626
50677
|
function resolveWorkspacePath(file3, workingDir) {
|
|
50627
|
-
return
|
|
50678
|
+
return path36.isAbsolute(file3) ? path36.resolve(file3) : path36.resolve(workingDir, file3);
|
|
50628
50679
|
}
|
|
50629
50680
|
function toWorkspaceOutputPath(absolutePath, workingDir, preferRelative) {
|
|
50630
50681
|
if (!preferRelative)
|
|
50631
50682
|
return absolutePath;
|
|
50632
|
-
return
|
|
50683
|
+
return path36.relative(workingDir, absolutePath);
|
|
50633
50684
|
}
|
|
50634
50685
|
function dedupePush(target, value) {
|
|
50635
50686
|
if (!target.includes(value)) {
|
|
@@ -50666,18 +50717,18 @@ function buildLanguageSpecificTestNames(nameWithoutExt, ext) {
|
|
|
50666
50717
|
}
|
|
50667
50718
|
}
|
|
50668
50719
|
function getRepoLevelCandidateDirectories(workingDir, relativePath, ext) {
|
|
50669
|
-
const relativeDir =
|
|
50720
|
+
const relativeDir = path36.dirname(relativePath);
|
|
50670
50721
|
const nestedRelativeDir = relativeDir === "." ? "" : relativeDir;
|
|
50671
50722
|
const directories = TEST_DIRECTORY_NAMES.flatMap((dirName) => {
|
|
50672
|
-
const rootDir =
|
|
50673
|
-
return nestedRelativeDir ? [rootDir,
|
|
50723
|
+
const rootDir = path36.join(workingDir, dirName);
|
|
50724
|
+
return nestedRelativeDir ? [rootDir, path36.join(rootDir, nestedRelativeDir)] : [rootDir];
|
|
50674
50725
|
});
|
|
50675
50726
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
50676
50727
|
if (ext === ".java" && normalizedRelativePath.startsWith("src/main/java/")) {
|
|
50677
|
-
directories.push(
|
|
50728
|
+
directories.push(path36.join(workingDir, "src/test/java", path36.dirname(normalizedRelativePath.slice("src/main/java/".length))));
|
|
50678
50729
|
}
|
|
50679
50730
|
if ((ext === ".kt" || ext === ".java") && normalizedRelativePath.startsWith("src/main/kotlin/")) {
|
|
50680
|
-
directories.push(
|
|
50731
|
+
directories.push(path36.join(workingDir, "src/test/kotlin", path36.dirname(normalizedRelativePath.slice("src/main/kotlin/".length))));
|
|
50681
50732
|
}
|
|
50682
50733
|
return [...new Set(directories)];
|
|
50683
50734
|
}
|
|
@@ -50705,23 +50756,23 @@ function isLanguageSpecificTestFile(basename6) {
|
|
|
50705
50756
|
}
|
|
50706
50757
|
function isConventionTestFilePath(filePath) {
|
|
50707
50758
|
const normalizedPath = filePath.replace(/\\/g, "/");
|
|
50708
|
-
const basename6 =
|
|
50759
|
+
const basename6 = path36.basename(filePath);
|
|
50709
50760
|
return hasCompoundTestExtension(basename6) || basename6.includes(".spec.") || basename6.includes(".test.") || isLanguageSpecificTestFile(basename6) || isTestDirectoryPath(normalizedPath);
|
|
50710
50761
|
}
|
|
50711
50762
|
function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
|
|
50712
50763
|
const testFiles = [];
|
|
50713
50764
|
for (const file3 of sourceFiles) {
|
|
50714
50765
|
const absoluteFile = resolveWorkspacePath(file3, workingDir);
|
|
50715
|
-
const relativeFile =
|
|
50716
|
-
const basename6 =
|
|
50717
|
-
const dirname14 =
|
|
50718
|
-
const preferRelativeOutput = !
|
|
50766
|
+
const relativeFile = path36.relative(workingDir, absoluteFile);
|
|
50767
|
+
const basename6 = path36.basename(absoluteFile);
|
|
50768
|
+
const dirname14 = path36.dirname(absoluteFile);
|
|
50769
|
+
const preferRelativeOutput = !path36.isAbsolute(file3);
|
|
50719
50770
|
if (isConventionTestFilePath(relativeFile) || isConventionTestFilePath(file3)) {
|
|
50720
50771
|
dedupePush(testFiles, toWorkspaceOutputPath(absoluteFile, workingDir, preferRelativeOutput));
|
|
50721
50772
|
continue;
|
|
50722
50773
|
}
|
|
50723
50774
|
const nameWithoutExt = basename6.replace(/\.[^.]+$/, "");
|
|
50724
|
-
const ext =
|
|
50775
|
+
const ext = path36.extname(basename6);
|
|
50725
50776
|
const genericTestNames = [
|
|
50726
50777
|
`${nameWithoutExt}.spec${ext}`,
|
|
50727
50778
|
`${nameWithoutExt}.test${ext}`
|
|
@@ -50730,7 +50781,7 @@ function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
|
|
|
50730
50781
|
const colocatedCandidates = [
|
|
50731
50782
|
...genericTestNames,
|
|
50732
50783
|
...languageSpecificTestNames
|
|
50733
|
-
].map((candidateName) =>
|
|
50784
|
+
].map((candidateName) => path36.join(dirname14, candidateName));
|
|
50734
50785
|
const testDirectoryNames = [
|
|
50735
50786
|
basename6,
|
|
50736
50787
|
...genericTestNames,
|
|
@@ -50739,8 +50790,8 @@ function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
|
|
|
50739
50790
|
const repoLevelDirectories = getRepoLevelCandidateDirectories(workingDir, relativeFile, ext);
|
|
50740
50791
|
const possibleTestFiles = [
|
|
50741
50792
|
...colocatedCandidates,
|
|
50742
|
-
...TEST_DIRECTORY_NAMES.flatMap((dirName) => testDirectoryNames.map((candidateName) =>
|
|
50743
|
-
...repoLevelDirectories.flatMap((candidateDir) => testDirectoryNames.map((candidateName) =>
|
|
50793
|
+
...TEST_DIRECTORY_NAMES.flatMap((dirName) => testDirectoryNames.map((candidateName) => path36.join(dirname14, dirName, candidateName))),
|
|
50794
|
+
...repoLevelDirectories.flatMap((candidateDir) => testDirectoryNames.map((candidateName) => path36.join(candidateDir, candidateName)))
|
|
50744
50795
|
];
|
|
50745
50796
|
for (const testFile of possibleTestFiles) {
|
|
50746
50797
|
if (fs23.existsSync(testFile)) {
|
|
@@ -50761,7 +50812,7 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
|
|
|
50761
50812
|
try {
|
|
50762
50813
|
const absoluteTestFile = resolveWorkspacePath(testFile, workingDir);
|
|
50763
50814
|
const content = fs23.readFileSync(absoluteTestFile, "utf-8");
|
|
50764
|
-
const testDir =
|
|
50815
|
+
const testDir = path36.dirname(absoluteTestFile);
|
|
50765
50816
|
const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
|
|
50766
50817
|
let match;
|
|
50767
50818
|
match = importRegex.exec(content);
|
|
@@ -50769,8 +50820,8 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
|
|
|
50769
50820
|
const importPath = match[1];
|
|
50770
50821
|
let resolvedImport;
|
|
50771
50822
|
if (importPath.startsWith(".")) {
|
|
50772
|
-
resolvedImport =
|
|
50773
|
-
const existingExt =
|
|
50823
|
+
resolvedImport = path36.resolve(testDir, importPath);
|
|
50824
|
+
const existingExt = path36.extname(resolvedImport);
|
|
50774
50825
|
if (!existingExt) {
|
|
50775
50826
|
for (const extToTry of [
|
|
50776
50827
|
".ts",
|
|
@@ -50790,12 +50841,12 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
|
|
|
50790
50841
|
} else {
|
|
50791
50842
|
continue;
|
|
50792
50843
|
}
|
|
50793
|
-
const importBasename =
|
|
50794
|
-
const importDir =
|
|
50844
|
+
const importBasename = path36.basename(resolvedImport, path36.extname(resolvedImport));
|
|
50845
|
+
const importDir = path36.dirname(resolvedImport);
|
|
50795
50846
|
for (const sourceFile of absoluteSourceFiles) {
|
|
50796
|
-
const sourceDir =
|
|
50797
|
-
const sourceBasename =
|
|
50798
|
-
const isRelatedDir = importDir === sourceDir || importDir ===
|
|
50847
|
+
const sourceDir = path36.dirname(sourceFile);
|
|
50848
|
+
const sourceBasename = path36.basename(sourceFile, path36.extname(sourceFile));
|
|
50849
|
+
const isRelatedDir = importDir === sourceDir || importDir === path36.join(sourceDir, "__tests__") || importDir === path36.join(sourceDir, "tests") || importDir === path36.join(sourceDir, "test") || importDir === path36.join(sourceDir, "spec");
|
|
50799
50850
|
if (resolvedImport === sourceFile || importBasename === sourceBasename && isRelatedDir) {
|
|
50800
50851
|
dedupePush(testFiles, testFile);
|
|
50801
50852
|
break;
|
|
@@ -50808,8 +50859,8 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
|
|
|
50808
50859
|
while (match !== null) {
|
|
50809
50860
|
const importPath = match[1];
|
|
50810
50861
|
if (importPath.startsWith(".")) {
|
|
50811
|
-
let resolvedImport =
|
|
50812
|
-
const existingExt =
|
|
50862
|
+
let resolvedImport = path36.resolve(testDir, importPath);
|
|
50863
|
+
const existingExt = path36.extname(resolvedImport);
|
|
50813
50864
|
if (!existingExt) {
|
|
50814
50865
|
for (const extToTry of [
|
|
50815
50866
|
".ts",
|
|
@@ -50826,12 +50877,12 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
|
|
|
50826
50877
|
}
|
|
50827
50878
|
}
|
|
50828
50879
|
}
|
|
50829
|
-
const importDir =
|
|
50830
|
-
const importBasename =
|
|
50880
|
+
const importDir = path36.dirname(resolvedImport);
|
|
50881
|
+
const importBasename = path36.basename(resolvedImport, path36.extname(resolvedImport));
|
|
50831
50882
|
for (const sourceFile of absoluteSourceFiles) {
|
|
50832
|
-
const sourceDir =
|
|
50833
|
-
const sourceBasename =
|
|
50834
|
-
const isRelatedDir = importDir === sourceDir || importDir ===
|
|
50883
|
+
const sourceDir = path36.dirname(sourceFile);
|
|
50884
|
+
const sourceBasename = path36.basename(sourceFile, path36.extname(sourceFile));
|
|
50885
|
+
const isRelatedDir = importDir === sourceDir || importDir === path36.join(sourceDir, "__tests__") || importDir === path36.join(sourceDir, "tests") || importDir === path36.join(sourceDir, "test") || importDir === path36.join(sourceDir, "spec");
|
|
50835
50886
|
if (resolvedImport === sourceFile || importBasename === sourceBasename && isRelatedDir) {
|
|
50836
50887
|
dedupePush(testFiles, testFile);
|
|
50837
50888
|
break;
|
|
@@ -50934,8 +50985,8 @@ function buildTestCommand(framework, scope, files, coverage, baseDir) {
|
|
|
50934
50985
|
return ["mvn", "test"];
|
|
50935
50986
|
case "gradle": {
|
|
50936
50987
|
const isWindows = process.platform === "win32";
|
|
50937
|
-
const hasGradlewBat = fs23.existsSync(
|
|
50938
|
-
const hasGradlew = fs23.existsSync(
|
|
50988
|
+
const hasGradlewBat = fs23.existsSync(path36.join(baseDir, "gradlew.bat"));
|
|
50989
|
+
const hasGradlew = fs23.existsSync(path36.join(baseDir, "gradlew"));
|
|
50939
50990
|
if (hasGradlewBat && isWindows)
|
|
50940
50991
|
return ["gradlew.bat", "test"];
|
|
50941
50992
|
if (hasGradlew)
|
|
@@ -50952,7 +51003,7 @@ function buildTestCommand(framework, scope, files, coverage, baseDir) {
|
|
|
50952
51003
|
"cmake-build-release",
|
|
50953
51004
|
"out"
|
|
50954
51005
|
];
|
|
50955
|
-
const actualBuildDir = buildDirCandidates.find((d) => fs23.existsSync(
|
|
51006
|
+
const actualBuildDir = buildDirCandidates.find((d) => fs23.existsSync(path36.join(baseDir, d, "CMakeCache.txt"))) ?? "build";
|
|
50956
51007
|
return ["ctest", "--test-dir", actualBuildDir];
|
|
50957
51008
|
}
|
|
50958
51009
|
case "swift-test":
|
|
@@ -51604,7 +51655,7 @@ var init_test_runner = __esm(() => {
|
|
|
51604
51655
|
const sourceFiles = args2.files.filter((file3) => {
|
|
51605
51656
|
if (directTestFiles.includes(file3))
|
|
51606
51657
|
return false;
|
|
51607
|
-
const ext =
|
|
51658
|
+
const ext = path36.extname(file3).toLowerCase();
|
|
51608
51659
|
return SOURCE_EXTENSIONS.has(ext);
|
|
51609
51660
|
});
|
|
51610
51661
|
const invalidFiles = args2.files.filter((file3) => !directTestFiles.includes(file3) && !sourceFiles.includes(file3));
|
|
@@ -51639,7 +51690,7 @@ var init_test_runner = __esm(() => {
|
|
|
51639
51690
|
if (isConventionTestFilePath(f)) {
|
|
51640
51691
|
return false;
|
|
51641
51692
|
}
|
|
51642
|
-
const ext =
|
|
51693
|
+
const ext = path36.extname(f).toLowerCase();
|
|
51643
51694
|
return SOURCE_EXTENSIONS.has(ext);
|
|
51644
51695
|
});
|
|
51645
51696
|
if (sourceFiles.length === 0) {
|
|
@@ -51666,7 +51717,7 @@ var init_test_runner = __esm(() => {
|
|
|
51666
51717
|
if (isConventionTestFilePath(f)) {
|
|
51667
51718
|
return false;
|
|
51668
51719
|
}
|
|
51669
|
-
const ext =
|
|
51720
|
+
const ext = path36.extname(f).toLowerCase();
|
|
51670
51721
|
return SOURCE_EXTENSIONS.has(ext);
|
|
51671
51722
|
});
|
|
51672
51723
|
if (sourceFiles.length === 0) {
|
|
@@ -51684,8 +51735,8 @@ var init_test_runner = __esm(() => {
|
|
|
51684
51735
|
const impactResult = await analyzeImpact(sourceFiles, workingDir);
|
|
51685
51736
|
if (impactResult.impactedTests.length > 0) {
|
|
51686
51737
|
testFiles = impactResult.impactedTests.map((absPath) => {
|
|
51687
|
-
const relativePath =
|
|
51688
|
-
return
|
|
51738
|
+
const relativePath = path36.relative(workingDir, absPath);
|
|
51739
|
+
return path36.isAbsolute(relativePath) ? absPath : relativePath;
|
|
51689
51740
|
});
|
|
51690
51741
|
} else {
|
|
51691
51742
|
graphFallbackReason = "no impacted tests found via impact analysis, falling back to graph";
|
|
@@ -51761,7 +51812,7 @@ var init_test_runner = __esm(() => {
|
|
|
51761
51812
|
|
|
51762
51813
|
// src/services/preflight-service.ts
|
|
51763
51814
|
import * as fs24 from "node:fs";
|
|
51764
|
-
import * as
|
|
51815
|
+
import * as path37 from "node:path";
|
|
51765
51816
|
function validateDirectoryPath(dir) {
|
|
51766
51817
|
if (!dir || typeof dir !== "string") {
|
|
51767
51818
|
throw new Error("Directory path is required");
|
|
@@ -51769,8 +51820,8 @@ function validateDirectoryPath(dir) {
|
|
|
51769
51820
|
if (dir.includes("..")) {
|
|
51770
51821
|
throw new Error("Directory path must not contain path traversal sequences");
|
|
51771
51822
|
}
|
|
51772
|
-
const normalized =
|
|
51773
|
-
const absolutePath =
|
|
51823
|
+
const normalized = path37.normalize(dir);
|
|
51824
|
+
const absolutePath = path37.isAbsolute(normalized) ? normalized : path37.resolve(normalized);
|
|
51774
51825
|
return absolutePath;
|
|
51775
51826
|
}
|
|
51776
51827
|
function validateTimeout(timeoutMs, defaultValue) {
|
|
@@ -51793,7 +51844,7 @@ function validateTimeout(timeoutMs, defaultValue) {
|
|
|
51793
51844
|
}
|
|
51794
51845
|
function getPackageVersion(dir) {
|
|
51795
51846
|
try {
|
|
51796
|
-
const packagePath =
|
|
51847
|
+
const packagePath = path37.join(dir, "package.json");
|
|
51797
51848
|
if (fs24.existsSync(packagePath)) {
|
|
51798
51849
|
const content = fs24.readFileSync(packagePath, "utf-8");
|
|
51799
51850
|
const pkg = JSON.parse(content);
|
|
@@ -51804,7 +51855,7 @@ function getPackageVersion(dir) {
|
|
|
51804
51855
|
}
|
|
51805
51856
|
function getChangelogVersion(dir) {
|
|
51806
51857
|
try {
|
|
51807
|
-
const changelogPath =
|
|
51858
|
+
const changelogPath = path37.join(dir, "CHANGELOG.md");
|
|
51808
51859
|
if (fs24.existsSync(changelogPath)) {
|
|
51809
51860
|
const content = fs24.readFileSync(changelogPath, "utf-8");
|
|
51810
51861
|
const match = content.match(/^##\s*\[?(\d+\.\d+\.\d+)\]?/m);
|
|
@@ -51818,7 +51869,7 @@ function getChangelogVersion(dir) {
|
|
|
51818
51869
|
function getVersionFileVersion(dir) {
|
|
51819
51870
|
const possibleFiles = ["VERSION.txt", "version.txt", "VERSION", "version"];
|
|
51820
51871
|
for (const file3 of possibleFiles) {
|
|
51821
|
-
const filePath =
|
|
51872
|
+
const filePath = path37.join(dir, file3);
|
|
51822
51873
|
if (fs24.existsSync(filePath)) {
|
|
51823
51874
|
try {
|
|
51824
51875
|
const content = fs24.readFileSync(filePath, "utf-8").trim();
|
|
@@ -52145,7 +52196,7 @@ async function runEvidenceCheck(dir) {
|
|
|
52145
52196
|
async function runRequirementCoverageCheck(dir, currentPhase) {
|
|
52146
52197
|
const startTime = Date.now();
|
|
52147
52198
|
try {
|
|
52148
|
-
const specPath =
|
|
52199
|
+
const specPath = path37.join(dir, ".swarm", "spec.md");
|
|
52149
52200
|
if (!fs24.existsSync(specPath)) {
|
|
52150
52201
|
return {
|
|
52151
52202
|
type: "req_coverage",
|
|
@@ -53330,7 +53381,7 @@ var init_reset = __esm(() => {
|
|
|
53330
53381
|
|
|
53331
53382
|
// src/commands/reset-session.ts
|
|
53332
53383
|
import * as fs26 from "node:fs";
|
|
53333
|
-
import * as
|
|
53384
|
+
import * as path38 from "node:path";
|
|
53334
53385
|
async function handleResetSessionCommand(directory, _args) {
|
|
53335
53386
|
const results = [];
|
|
53336
53387
|
try {
|
|
@@ -53345,13 +53396,13 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
53345
53396
|
results.push("❌ Failed to delete state.json");
|
|
53346
53397
|
}
|
|
53347
53398
|
try {
|
|
53348
|
-
const sessionDir =
|
|
53399
|
+
const sessionDir = path38.dirname(validateSwarmPath(directory, "session/state.json"));
|
|
53349
53400
|
if (fs26.existsSync(sessionDir)) {
|
|
53350
53401
|
const files = fs26.readdirSync(sessionDir);
|
|
53351
53402
|
const otherFiles = files.filter((f) => f !== "state.json");
|
|
53352
53403
|
let deletedCount = 0;
|
|
53353
53404
|
for (const file3 of otherFiles) {
|
|
53354
|
-
const filePath =
|
|
53405
|
+
const filePath = path38.join(sessionDir, file3);
|
|
53355
53406
|
if (fs26.lstatSync(filePath).isFile()) {
|
|
53356
53407
|
fs26.unlinkSync(filePath);
|
|
53357
53408
|
deletedCount++;
|
|
@@ -53384,7 +53435,7 @@ var init_reset_session = __esm(() => {
|
|
|
53384
53435
|
|
|
53385
53436
|
// src/summaries/manager.ts
|
|
53386
53437
|
import { mkdirSync as mkdirSync13, readdirSync as readdirSync10, renameSync as renameSync10, rmSync as rmSync4, statSync as statSync10 } from "node:fs";
|
|
53387
|
-
import * as
|
|
53438
|
+
import * as path39 from "node:path";
|
|
53388
53439
|
function sanitizeSummaryId(id) {
|
|
53389
53440
|
if (!id || id.length === 0) {
|
|
53390
53441
|
throw new Error("Invalid summary ID: empty string");
|
|
@@ -53418,9 +53469,9 @@ async function storeSummary(directory, id, fullOutput, summaryText, maxStoredByt
|
|
|
53418
53469
|
if (serializedSize > maxStoredBytes) {
|
|
53419
53470
|
throw new Error(`Summary entry size (${serializedSize} bytes) exceeds maximum (${maxStoredBytes} bytes)`);
|
|
53420
53471
|
}
|
|
53421
|
-
const relativePath =
|
|
53472
|
+
const relativePath = path39.join("summaries", `${sanitizedId}.json`);
|
|
53422
53473
|
const summaryPath = validateSwarmPath(directory, relativePath);
|
|
53423
|
-
const summaryDir =
|
|
53474
|
+
const summaryDir = path39.dirname(summaryPath);
|
|
53424
53475
|
const entry = {
|
|
53425
53476
|
id: sanitizedId,
|
|
53426
53477
|
summaryText,
|
|
@@ -53430,7 +53481,7 @@ async function storeSummary(directory, id, fullOutput, summaryText, maxStoredByt
|
|
|
53430
53481
|
};
|
|
53431
53482
|
const entryJson = JSON.stringify(entry);
|
|
53432
53483
|
mkdirSync13(summaryDir, { recursive: true });
|
|
53433
|
-
const tempPath =
|
|
53484
|
+
const tempPath = path39.join(summaryDir, `${sanitizedId}.json.tmp.${Date.now()}.${process.pid}`);
|
|
53434
53485
|
try {
|
|
53435
53486
|
await Bun.write(tempPath, entryJson);
|
|
53436
53487
|
renameSync10(tempPath, summaryPath);
|
|
@@ -53443,7 +53494,7 @@ async function storeSummary(directory, id, fullOutput, summaryText, maxStoredByt
|
|
|
53443
53494
|
}
|
|
53444
53495
|
async function loadFullOutput(directory, id) {
|
|
53445
53496
|
const sanitizedId = sanitizeSummaryId(id);
|
|
53446
|
-
const relativePath =
|
|
53497
|
+
const relativePath = path39.join("summaries", `${sanitizedId}.json`);
|
|
53447
53498
|
validateSwarmPath(directory, relativePath);
|
|
53448
53499
|
const content = await readSwarmFileAsync(directory, relativePath);
|
|
53449
53500
|
if (content === null) {
|
|
@@ -53505,7 +53556,7 @@ var init_retrieve = __esm(() => {
|
|
|
53505
53556
|
|
|
53506
53557
|
// src/commands/rollback.ts
|
|
53507
53558
|
import * as fs27 from "node:fs";
|
|
53508
|
-
import * as
|
|
53559
|
+
import * as path40 from "node:path";
|
|
53509
53560
|
async function handleRollbackCommand(directory, args2) {
|
|
53510
53561
|
const phaseArg = args2[0];
|
|
53511
53562
|
if (!phaseArg) {
|
|
@@ -53570,8 +53621,8 @@ async function handleRollbackCommand(directory, args2) {
|
|
|
53570
53621
|
if (EXCLUDE_FILES.has(file3) || file3.startsWith("plan-ledger.archived-")) {
|
|
53571
53622
|
continue;
|
|
53572
53623
|
}
|
|
53573
|
-
const src =
|
|
53574
|
-
const dest =
|
|
53624
|
+
const src = path40.join(checkpointDir, file3);
|
|
53625
|
+
const dest = path40.join(swarmDir, file3);
|
|
53575
53626
|
try {
|
|
53576
53627
|
fs27.cpSync(src, dest, { recursive: true, force: true });
|
|
53577
53628
|
successes.push(file3);
|
|
@@ -53590,12 +53641,12 @@ async function handleRollbackCommand(directory, args2) {
|
|
|
53590
53641
|
].join(`
|
|
53591
53642
|
`);
|
|
53592
53643
|
}
|
|
53593
|
-
const existingLedgerPath =
|
|
53644
|
+
const existingLedgerPath = path40.join(swarmDir, "plan-ledger.jsonl");
|
|
53594
53645
|
if (fs27.existsSync(existingLedgerPath)) {
|
|
53595
53646
|
fs27.unlinkSync(existingLedgerPath);
|
|
53596
53647
|
}
|
|
53597
53648
|
try {
|
|
53598
|
-
const planJsonPath =
|
|
53649
|
+
const planJsonPath = path40.join(swarmDir, "plan.json");
|
|
53599
53650
|
if (fs27.existsSync(planJsonPath)) {
|
|
53600
53651
|
const planRaw = fs27.readFileSync(planJsonPath, "utf-8");
|
|
53601
53652
|
const plan = PlanSchema.parse(JSON.parse(planRaw));
|
|
@@ -53673,9 +53724,9 @@ async function handleSimulateCommand(directory, args2) {
|
|
|
53673
53724
|
const report = reportLines.filter(Boolean).join(`
|
|
53674
53725
|
`);
|
|
53675
53726
|
const fs28 = await import("node:fs/promises");
|
|
53676
|
-
const
|
|
53677
|
-
const reportPath =
|
|
53678
|
-
await fs28.mkdir(
|
|
53727
|
+
const path41 = await import("node:path");
|
|
53728
|
+
const reportPath = path41.join(directory, ".swarm", "simulate-report.md");
|
|
53729
|
+
await fs28.mkdir(path41.dirname(reportPath), { recursive: true });
|
|
53679
53730
|
await fs28.writeFile(reportPath, report, "utf-8");
|
|
53680
53731
|
return `${darkMatterPairs.length} hidden coupling pairs detected`;
|
|
53681
53732
|
}
|
|
@@ -53694,7 +53745,7 @@ async function handleSpecifyCommand(_directory, args2) {
|
|
|
53694
53745
|
|
|
53695
53746
|
// src/services/compaction-service.ts
|
|
53696
53747
|
import * as fs28 from "node:fs";
|
|
53697
|
-
import * as
|
|
53748
|
+
import * as path41 from "node:path";
|
|
53698
53749
|
function makeInitialState() {
|
|
53699
53750
|
return {
|
|
53700
53751
|
lastObservationAt: 0,
|
|
@@ -53716,7 +53767,7 @@ function getSessionState(sessionId) {
|
|
|
53716
53767
|
}
|
|
53717
53768
|
function appendSnapshot(directory, tier, budgetPct, message) {
|
|
53718
53769
|
try {
|
|
53719
|
-
const snapshotPath =
|
|
53770
|
+
const snapshotPath = path41.join(directory, ".swarm", "context-snapshot.md");
|
|
53720
53771
|
const timestamp = new Date().toISOString();
|
|
53721
53772
|
const entry = `
|
|
53722
53773
|
## [${tier.toUpperCase()}] ${timestamp} — ${budgetPct.toFixed(1)}% used
|
|
@@ -58025,7 +58076,7 @@ COVERAGE REPORTING:
|
|
|
58025
58076
|
|
|
58026
58077
|
// src/agents/index.ts
|
|
58027
58078
|
import { mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
58028
|
-
import * as
|
|
58079
|
+
import * as path42 from "node:path";
|
|
58029
58080
|
function stripSwarmPrefix(agentName, swarmPrefix) {
|
|
58030
58081
|
if (!swarmPrefix || !agentName)
|
|
58031
58082
|
return agentName;
|
|
@@ -58336,14 +58387,14 @@ function getAgentConfigs(config3, directory, sessionId) {
|
|
|
58336
58387
|
}));
|
|
58337
58388
|
if (directory) {
|
|
58338
58389
|
const sid = sessionId ?? `init-${Date.now()}`;
|
|
58339
|
-
const evidenceDir =
|
|
58390
|
+
const evidenceDir = path42.join(directory, ".swarm", "evidence");
|
|
58340
58391
|
const filename = `agent-tools-${sid}.json`;
|
|
58341
58392
|
const snapshotData = JSON.stringify({
|
|
58342
58393
|
sessionId: sid,
|
|
58343
58394
|
generatedAt: new Date().toISOString(),
|
|
58344
58395
|
agents: agentToolSnapshot
|
|
58345
58396
|
}, null, 2);
|
|
58346
|
-
mkdir6(evidenceDir, { recursive: true }).then(() => writeFile6(
|
|
58397
|
+
mkdir6(evidenceDir, { recursive: true }).then(() => writeFile6(path42.join(evidenceDir, filename), snapshotData)).catch(() => {});
|
|
58347
58398
|
}
|
|
58348
58399
|
return result;
|
|
58349
58400
|
}
|
|
@@ -58369,13 +58420,13 @@ __export(exports_evidence_summary_integration, {
|
|
|
58369
58420
|
EvidenceSummaryIntegration: () => EvidenceSummaryIntegration
|
|
58370
58421
|
});
|
|
58371
58422
|
import { existsSync as existsSync24, mkdirSync as mkdirSync14, writeFileSync as writeFileSync6 } from "node:fs";
|
|
58372
|
-
import * as
|
|
58423
|
+
import * as path43 from "node:path";
|
|
58373
58424
|
function persistSummary(projectDir, artifact, filename) {
|
|
58374
|
-
const swarmPath =
|
|
58425
|
+
const swarmPath = path43.join(projectDir, ".swarm");
|
|
58375
58426
|
if (!existsSync24(swarmPath)) {
|
|
58376
58427
|
mkdirSync14(swarmPath, { recursive: true });
|
|
58377
58428
|
}
|
|
58378
|
-
const artifactPath =
|
|
58429
|
+
const artifactPath = path43.join(swarmPath, filename);
|
|
58379
58430
|
const content = JSON.stringify(artifact, null, 2);
|
|
58380
58431
|
writeFileSync6(artifactPath, content, "utf-8");
|
|
58381
58432
|
log("[EvidenceSummaryIntegration] Summary persisted", {
|
|
@@ -58494,7 +58545,7 @@ __export(exports_status_artifact, {
|
|
|
58494
58545
|
AutomationStatusArtifact: () => AutomationStatusArtifact
|
|
58495
58546
|
});
|
|
58496
58547
|
import * as fs30 from "node:fs";
|
|
58497
|
-
import * as
|
|
58548
|
+
import * as path45 from "node:path";
|
|
58498
58549
|
function createEmptySnapshot(mode, capabilities) {
|
|
58499
58550
|
return {
|
|
58500
58551
|
timestamp: Date.now(),
|
|
@@ -58553,7 +58604,7 @@ class AutomationStatusArtifact {
|
|
|
58553
58604
|
});
|
|
58554
58605
|
}
|
|
58555
58606
|
getFilePath() {
|
|
58556
|
-
return
|
|
58607
|
+
return path45.join(this.swarmDir, this.filename);
|
|
58557
58608
|
}
|
|
58558
58609
|
load() {
|
|
58559
58610
|
const filePath = this.getFilePath();
|
|
@@ -58966,12 +59017,12 @@ __export(exports_review_receipt, {
|
|
|
58966
59017
|
});
|
|
58967
59018
|
import * as crypto5 from "node:crypto";
|
|
58968
59019
|
import * as fs34 from "node:fs";
|
|
58969
|
-
import * as
|
|
59020
|
+
import * as path46 from "node:path";
|
|
58970
59021
|
function resolveReceiptsDir(directory) {
|
|
58971
|
-
return
|
|
59022
|
+
return path46.join(directory, ".swarm", "review-receipts");
|
|
58972
59023
|
}
|
|
58973
59024
|
function resolveReceiptIndexPath(directory) {
|
|
58974
|
-
return
|
|
59025
|
+
return path46.join(resolveReceiptsDir(directory), "index.json");
|
|
58975
59026
|
}
|
|
58976
59027
|
function buildReceiptFilename(id, date9) {
|
|
58977
59028
|
const dateStr = date9.toISOString().slice(0, 10);
|
|
@@ -59010,7 +59061,7 @@ async function readReceiptIndex(directory) {
|
|
|
59010
59061
|
}
|
|
59011
59062
|
async function writeReceiptIndex(directory, index) {
|
|
59012
59063
|
const indexPath = resolveReceiptIndexPath(directory);
|
|
59013
|
-
const dir =
|
|
59064
|
+
const dir = path46.dirname(indexPath);
|
|
59014
59065
|
await fs34.promises.mkdir(dir, { recursive: true });
|
|
59015
59066
|
const tmpPath = `${indexPath}.tmp.${Date.now()}.${Math.random().toString(36).slice(2)}`;
|
|
59016
59067
|
await fs34.promises.writeFile(tmpPath, JSON.stringify(index, null, 2), "utf-8");
|
|
@@ -59021,7 +59072,7 @@ async function persistReviewReceipt(directory, receipt) {
|
|
|
59021
59072
|
await fs34.promises.mkdir(receiptsDir, { recursive: true });
|
|
59022
59073
|
const now = new Date(receipt.reviewed_at);
|
|
59023
59074
|
const filename = buildReceiptFilename(receipt.id, now);
|
|
59024
|
-
const receiptPath =
|
|
59075
|
+
const receiptPath = path46.join(receiptsDir, filename);
|
|
59025
59076
|
const tmpPath = `${receiptPath}.tmp.${Date.now()}.${Math.random().toString(36).slice(2)}`;
|
|
59026
59077
|
await fs34.promises.writeFile(tmpPath, JSON.stringify(receipt, null, 2), "utf-8");
|
|
59027
59078
|
fs34.renameSync(tmpPath, receiptPath);
|
|
@@ -59043,7 +59094,7 @@ async function readReceiptById(directory, receiptId) {
|
|
|
59043
59094
|
const entry = index.entries.find((e) => e.id === receiptId);
|
|
59044
59095
|
if (!entry)
|
|
59045
59096
|
return null;
|
|
59046
|
-
const receiptPath =
|
|
59097
|
+
const receiptPath = path46.join(resolveReceiptsDir(directory), entry.filename);
|
|
59047
59098
|
try {
|
|
59048
59099
|
const content = await fs34.promises.readFile(receiptPath, "utf-8");
|
|
59049
59100
|
return JSON.parse(content);
|
|
@@ -59056,7 +59107,7 @@ async function readReceiptsByScopeHash(directory, scopeHash) {
|
|
|
59056
59107
|
const matching = index.entries.filter((e) => e.scope_hash === scopeHash).sort((a, b) => b.reviewed_at.localeCompare(a.reviewed_at));
|
|
59057
59108
|
const receipts = [];
|
|
59058
59109
|
for (const entry of matching) {
|
|
59059
|
-
const receiptPath =
|
|
59110
|
+
const receiptPath = path46.join(resolveReceiptsDir(directory), entry.filename);
|
|
59060
59111
|
try {
|
|
59061
59112
|
const content = await fs34.promises.readFile(receiptPath, "utf-8");
|
|
59062
59113
|
receipts.push(JSON.parse(content));
|
|
@@ -59069,7 +59120,7 @@ async function readAllReceipts(directory) {
|
|
|
59069
59120
|
const sorted = [...index.entries].sort((a, b) => b.reviewed_at.localeCompare(a.reviewed_at));
|
|
59070
59121
|
const receipts = [];
|
|
59071
59122
|
for (const entry of sorted) {
|
|
59072
|
-
const receiptPath =
|
|
59123
|
+
const receiptPath = path46.join(resolveReceiptsDir(directory), entry.filename);
|
|
59073
59124
|
try {
|
|
59074
59125
|
const content = await fs34.promises.readFile(receiptPath, "utf-8");
|
|
59075
59126
|
receipts.push(JSON.parse(content));
|
|
@@ -59154,7 +59205,7 @@ function createPreflightIntegration(config3) {
|
|
|
59154
59205
|
statusArtifact = new AutomationStatusArtifact(swarmDir);
|
|
59155
59206
|
}
|
|
59156
59207
|
const preflightHandler = async (request) => {
|
|
59157
|
-
|
|
59208
|
+
log("[PreflightIntegration] Handling preflight request", {
|
|
59158
59209
|
requestId: request.id,
|
|
59159
59210
|
phase: request.currentPhase,
|
|
59160
59211
|
source: request.source
|
|
@@ -59163,13 +59214,13 @@ function createPreflightIntegration(config3) {
|
|
|
59163
59214
|
if (statusArtifact) {
|
|
59164
59215
|
const state = report.overall === "pass" ? "success" : "failure";
|
|
59165
59216
|
statusArtifact.recordOutcome(state, request.currentPhase, report.message);
|
|
59166
|
-
|
|
59217
|
+
log("[PreflightIntegration] Status artifact updated", {
|
|
59167
59218
|
state,
|
|
59168
59219
|
phase: request.currentPhase,
|
|
59169
59220
|
message: report.message
|
|
59170
59221
|
});
|
|
59171
59222
|
}
|
|
59172
|
-
|
|
59223
|
+
log("[PreflightIntegration] Preflight complete", {
|
|
59173
59224
|
requestId: request.id,
|
|
59174
59225
|
overall: report.overall,
|
|
59175
59226
|
message: report.message,
|
|
@@ -59192,6 +59243,7 @@ var init_preflight_integration = __esm(() => {
|
|
|
59192
59243
|
init_status_artifact();
|
|
59193
59244
|
init_trigger();
|
|
59194
59245
|
init_preflight_service();
|
|
59246
|
+
init_logger();
|
|
59195
59247
|
});
|
|
59196
59248
|
|
|
59197
59249
|
// node_modules/web-tree-sitter/tree-sitter.js
|
|
@@ -60656,11 +60708,11 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
60656
60708
|
throw toThrow;
|
|
60657
60709
|
}, "quit_");
|
|
60658
60710
|
var scriptDirectory = "";
|
|
60659
|
-
function locateFile(
|
|
60711
|
+
function locateFile(path57) {
|
|
60660
60712
|
if (Module["locateFile"]) {
|
|
60661
|
-
return Module["locateFile"](
|
|
60713
|
+
return Module["locateFile"](path57, scriptDirectory);
|
|
60662
60714
|
}
|
|
60663
|
-
return scriptDirectory +
|
|
60715
|
+
return scriptDirectory + path57;
|
|
60664
60716
|
}
|
|
60665
60717
|
__name(locateFile, "locateFile");
|
|
60666
60718
|
var readAsync, readBinary;
|
|
@@ -62409,13 +62461,13 @@ __export(exports_runtime, {
|
|
|
62409
62461
|
getInitializedLanguages: () => getInitializedLanguages,
|
|
62410
62462
|
clearParserCache: () => clearParserCache
|
|
62411
62463
|
});
|
|
62412
|
-
import * as
|
|
62464
|
+
import * as path57 from "node:path";
|
|
62413
62465
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
62414
62466
|
async function initTreeSitter() {
|
|
62415
62467
|
if (treeSitterInitialized) {
|
|
62416
62468
|
return;
|
|
62417
62469
|
}
|
|
62418
|
-
const thisDir =
|
|
62470
|
+
const thisDir = path57.dirname(fileURLToPath2(import.meta.url));
|
|
62419
62471
|
const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
|
|
62420
62472
|
if (isSource) {
|
|
62421
62473
|
await Parser.init();
|
|
@@ -62423,7 +62475,7 @@ async function initTreeSitter() {
|
|
|
62423
62475
|
const grammarsDir = getGrammarsDirAbsolute();
|
|
62424
62476
|
await Parser.init({
|
|
62425
62477
|
locateFile(scriptName) {
|
|
62426
|
-
return
|
|
62478
|
+
return path57.join(grammarsDir, scriptName);
|
|
62427
62479
|
}
|
|
62428
62480
|
});
|
|
62429
62481
|
}
|
|
@@ -62444,11 +62496,11 @@ function getWasmFileName(languageId) {
|
|
|
62444
62496
|
return `tree-sitter-${sanitized}.wasm`;
|
|
62445
62497
|
}
|
|
62446
62498
|
function getGrammarsDirAbsolute() {
|
|
62447
|
-
const thisDir =
|
|
62499
|
+
const thisDir = path57.dirname(fileURLToPath2(import.meta.url));
|
|
62448
62500
|
const normalized = thisDir.replace(/\\/g, "/");
|
|
62449
62501
|
const isSource = normalized.endsWith("/src/lang");
|
|
62450
62502
|
const isCliBundle = normalized.endsWith("/cli");
|
|
62451
|
-
return isSource ?
|
|
62503
|
+
return isSource ? path57.join(thisDir, "grammars") : isCliBundle ? path57.join(thisDir, "..", "lang", "grammars") : path57.join(thisDir, "lang", "grammars");
|
|
62452
62504
|
}
|
|
62453
62505
|
async function loadGrammar(languageId) {
|
|
62454
62506
|
if (typeof languageId !== "string" || languageId.length > 100) {
|
|
@@ -62464,7 +62516,7 @@ async function loadGrammar(languageId) {
|
|
|
62464
62516
|
await initTreeSitter();
|
|
62465
62517
|
const parser = new Parser;
|
|
62466
62518
|
const wasmFileName = getWasmFileName(normalizedId);
|
|
62467
|
-
const wasmPath =
|
|
62519
|
+
const wasmPath = path57.join(getGrammarsDirAbsolute(), wasmFileName);
|
|
62468
62520
|
const { existsSync: existsSync30 } = await import("node:fs");
|
|
62469
62521
|
if (!existsSync30(wasmPath)) {
|
|
62470
62522
|
throw new Error(`Grammar file not found for ${languageId}: ${wasmPath}
|
|
@@ -62499,7 +62551,7 @@ async function isGrammarAvailable(languageId) {
|
|
|
62499
62551
|
}
|
|
62500
62552
|
try {
|
|
62501
62553
|
const wasmFileName = getWasmFileName(normalizedId);
|
|
62502
|
-
const wasmPath =
|
|
62554
|
+
const wasmPath = path57.join(getGrammarsDirAbsolute(), wasmFileName);
|
|
62503
62555
|
const { statSync: statSync18 } = await import("node:fs");
|
|
62504
62556
|
statSync18(wasmPath);
|
|
62505
62557
|
return true;
|
|
@@ -62558,13 +62610,13 @@ __export(exports_doc_scan, {
|
|
|
62558
62610
|
import * as crypto7 from "node:crypto";
|
|
62559
62611
|
import * as fs43 from "node:fs";
|
|
62560
62612
|
import { mkdir as mkdir9, readFile as readFile8, writeFile as writeFile8 } from "node:fs/promises";
|
|
62561
|
-
import * as
|
|
62613
|
+
import * as path59 from "node:path";
|
|
62562
62614
|
function normalizeSeparators(filePath) {
|
|
62563
62615
|
return filePath.replace(/\\/g, "/");
|
|
62564
62616
|
}
|
|
62565
62617
|
function matchesDocPattern(filePath, patterns) {
|
|
62566
62618
|
const normalizedPath = normalizeSeparators(filePath);
|
|
62567
|
-
const basename8 =
|
|
62619
|
+
const basename8 = path59.basename(filePath);
|
|
62568
62620
|
for (const pattern of patterns) {
|
|
62569
62621
|
if (!pattern.includes("/") && !pattern.includes("\\")) {
|
|
62570
62622
|
if (basename8 === pattern) {
|
|
@@ -62620,7 +62672,7 @@ function stripMarkdown(text) {
|
|
|
62620
62672
|
return text.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/^\s*[-*•]\s+/gm, "").replace(/^\s*\d+\.\s+/gm, "").trim();
|
|
62621
62673
|
}
|
|
62622
62674
|
async function scanDocIndex(directory) {
|
|
62623
|
-
const manifestPath =
|
|
62675
|
+
const manifestPath = path59.join(directory, ".swarm", "doc-manifest.json");
|
|
62624
62676
|
const defaultPatterns = DocsConfigSchema.parse({}).doc_patterns;
|
|
62625
62677
|
const extraPatterns = [
|
|
62626
62678
|
"ARCHITECTURE.md",
|
|
@@ -62637,7 +62689,7 @@ async function scanDocIndex(directory) {
|
|
|
62637
62689
|
let cacheValid = true;
|
|
62638
62690
|
for (const file3 of existingManifest.files) {
|
|
62639
62691
|
try {
|
|
62640
|
-
const fullPath =
|
|
62692
|
+
const fullPath = path59.join(directory, file3.path);
|
|
62641
62693
|
const stat3 = fs43.statSync(fullPath);
|
|
62642
62694
|
if (stat3.mtimeMs > file3.mtime) {
|
|
62643
62695
|
cacheValid = false;
|
|
@@ -62667,7 +62719,7 @@ async function scanDocIndex(directory) {
|
|
|
62667
62719
|
}
|
|
62668
62720
|
const entries = rawEntries.filter((e) => typeof e === "string");
|
|
62669
62721
|
for (const entry of entries) {
|
|
62670
|
-
const fullPath =
|
|
62722
|
+
const fullPath = path59.join(directory, entry);
|
|
62671
62723
|
let stat3;
|
|
62672
62724
|
try {
|
|
62673
62725
|
stat3 = fs43.statSync(fullPath);
|
|
@@ -62703,7 +62755,7 @@ async function scanDocIndex(directory) {
|
|
|
62703
62755
|
} catch {
|
|
62704
62756
|
continue;
|
|
62705
62757
|
}
|
|
62706
|
-
const { title, summary } = extractTitleAndSummary(content,
|
|
62758
|
+
const { title, summary } = extractTitleAndSummary(content, path59.basename(entry));
|
|
62707
62759
|
const lineCount = content.split(`
|
|
62708
62760
|
`).length;
|
|
62709
62761
|
discoveredFiles.push({
|
|
@@ -62729,7 +62781,7 @@ async function scanDocIndex(directory) {
|
|
|
62729
62781
|
files: discoveredFiles
|
|
62730
62782
|
};
|
|
62731
62783
|
try {
|
|
62732
|
-
await mkdir9(
|
|
62784
|
+
await mkdir9(path59.dirname(manifestPath), { recursive: true });
|
|
62733
62785
|
await writeFile8(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
62734
62786
|
} catch {}
|
|
62735
62787
|
return { manifest, cached: false };
|
|
@@ -62768,7 +62820,7 @@ function extractConstraintsFromContent(content) {
|
|
|
62768
62820
|
return constraints;
|
|
62769
62821
|
}
|
|
62770
62822
|
async function extractDocConstraints(directory, taskFiles, taskDescription) {
|
|
62771
|
-
const manifestPath =
|
|
62823
|
+
const manifestPath = path59.join(directory, ".swarm", "doc-manifest.json");
|
|
62772
62824
|
let manifest;
|
|
62773
62825
|
try {
|
|
62774
62826
|
const content = await readFile8(manifestPath, "utf-8");
|
|
@@ -62794,7 +62846,7 @@ async function extractDocConstraints(directory, taskFiles, taskDescription) {
|
|
|
62794
62846
|
}
|
|
62795
62847
|
let fullContent;
|
|
62796
62848
|
try {
|
|
62797
|
-
fullContent = await readFile8(
|
|
62849
|
+
fullContent = await readFile8(path59.join(directory, docFile.path), "utf-8");
|
|
62798
62850
|
} catch {
|
|
62799
62851
|
skippedCount++;
|
|
62800
62852
|
continue;
|
|
@@ -62817,7 +62869,7 @@ async function extractDocConstraints(directory, taskFiles, taskDescription) {
|
|
|
62817
62869
|
tier: "swarm",
|
|
62818
62870
|
lesson: constraint,
|
|
62819
62871
|
category: "architecture",
|
|
62820
|
-
tags: ["doc-scan",
|
|
62872
|
+
tags: ["doc-scan", path59.basename(docFile.path)],
|
|
62821
62873
|
scope: "global",
|
|
62822
62874
|
confidence: 0.5,
|
|
62823
62875
|
status: "candidate",
|
|
@@ -62890,7 +62942,7 @@ var init_doc_scan = __esm(() => {
|
|
|
62890
62942
|
}
|
|
62891
62943
|
} catch {}
|
|
62892
62944
|
if (force) {
|
|
62893
|
-
const manifestPath =
|
|
62945
|
+
const manifestPath = path59.join(directory, ".swarm", "doc-manifest.json");
|
|
62894
62946
|
try {
|
|
62895
62947
|
fs43.unlinkSync(manifestPath);
|
|
62896
62948
|
} catch {}
|
|
@@ -63081,9 +63133,9 @@ __export(exports_curator_drift, {
|
|
|
63081
63133
|
buildDriftInjectionText: () => buildDriftInjectionText
|
|
63082
63134
|
});
|
|
63083
63135
|
import * as fs46 from "node:fs";
|
|
63084
|
-
import * as
|
|
63136
|
+
import * as path62 from "node:path";
|
|
63085
63137
|
async function readPriorDriftReports(directory) {
|
|
63086
|
-
const swarmDir =
|
|
63138
|
+
const swarmDir = path62.join(directory, ".swarm");
|
|
63087
63139
|
const entries = await fs46.promises.readdir(swarmDir).catch(() => null);
|
|
63088
63140
|
if (entries === null)
|
|
63089
63141
|
return [];
|
|
@@ -63096,12 +63148,12 @@ async function readPriorDriftReports(directory) {
|
|
|
63096
63148
|
try {
|
|
63097
63149
|
const report = JSON.parse(content);
|
|
63098
63150
|
if (typeof report.phase !== "number" || typeof report.alignment !== "string" || typeof report.timestamp !== "string" || typeof report.drift_score !== "number" || typeof report.schema_version !== "number" || !Array.isArray(report.compounding_effects)) {
|
|
63099
|
-
|
|
63151
|
+
warn(`[curator-drift] Skipping corrupt drift report: ${filename}`);
|
|
63100
63152
|
continue;
|
|
63101
63153
|
}
|
|
63102
63154
|
reports.push(report);
|
|
63103
63155
|
} catch {
|
|
63104
|
-
|
|
63156
|
+
warn(`[curator-drift] Skipping unreadable drift report: ${filename}`);
|
|
63105
63157
|
}
|
|
63106
63158
|
}
|
|
63107
63159
|
reports.sort((a, b) => a.phase - b.phase);
|
|
@@ -63110,7 +63162,7 @@ async function readPriorDriftReports(directory) {
|
|
|
63110
63162
|
async function writeDriftReport(directory, report) {
|
|
63111
63163
|
const filename = `${DRIFT_REPORT_PREFIX}${report.phase}.json`;
|
|
63112
63164
|
const filePath = validateSwarmPath(directory, filename);
|
|
63113
|
-
const swarmDir =
|
|
63165
|
+
const swarmDir = path62.dirname(filePath);
|
|
63114
63166
|
await fs46.promises.mkdir(swarmDir, { recursive: true });
|
|
63115
63167
|
try {
|
|
63116
63168
|
await fs46.promises.writeFile(filePath, JSON.stringify(report, null, 2), "utf-8");
|
|
@@ -63238,6 +63290,7 @@ function buildDriftInjectionText(report, maxChars) {
|
|
|
63238
63290
|
var DRIFT_REPORT_PREFIX = "drift-report-phase-";
|
|
63239
63291
|
var init_curator_drift = __esm(() => {
|
|
63240
63292
|
init_event_bus();
|
|
63293
|
+
init_logger();
|
|
63241
63294
|
init_utils2();
|
|
63242
63295
|
});
|
|
63243
63296
|
|
|
@@ -63245,7 +63298,7 @@ var init_curator_drift = __esm(() => {
|
|
|
63245
63298
|
init_package();
|
|
63246
63299
|
init_agents2();
|
|
63247
63300
|
import * as fs87 from "node:fs";
|
|
63248
|
-
import * as
|
|
63301
|
+
import * as path105 from "node:path";
|
|
63249
63302
|
|
|
63250
63303
|
// src/background/index.ts
|
|
63251
63304
|
init_event_bus();
|
|
@@ -63256,7 +63309,7 @@ init_manager3();
|
|
|
63256
63309
|
init_manager();
|
|
63257
63310
|
init_utils();
|
|
63258
63311
|
import * as fs29 from "node:fs";
|
|
63259
|
-
import * as
|
|
63312
|
+
import * as path44 from "node:path";
|
|
63260
63313
|
|
|
63261
63314
|
class PlanSyncWorker {
|
|
63262
63315
|
directory;
|
|
@@ -63280,10 +63333,10 @@ class PlanSyncWorker {
|
|
|
63280
63333
|
this.onSyncComplete = options.onSyncComplete;
|
|
63281
63334
|
}
|
|
63282
63335
|
getSwarmDir() {
|
|
63283
|
-
return
|
|
63336
|
+
return path44.resolve(this.directory, ".swarm");
|
|
63284
63337
|
}
|
|
63285
63338
|
getPlanJsonPath() {
|
|
63286
|
-
return
|
|
63339
|
+
return path44.join(this.getSwarmDir(), "plan.json");
|
|
63287
63340
|
}
|
|
63288
63341
|
start() {
|
|
63289
63342
|
if (this.disposed) {
|
|
@@ -63502,8 +63555,8 @@ class PlanSyncWorker {
|
|
|
63502
63555
|
checkForUnauthorizedWrite() {
|
|
63503
63556
|
try {
|
|
63504
63557
|
const swarmDir = this.getSwarmDir();
|
|
63505
|
-
const planJsonPath =
|
|
63506
|
-
const markerPath =
|
|
63558
|
+
const planJsonPath = path44.join(swarmDir, "plan.json");
|
|
63559
|
+
const markerPath = path44.join(swarmDir, ".plan-write-marker");
|
|
63507
63560
|
const planStats = fs29.statSync(planJsonPath);
|
|
63508
63561
|
const planMtimeMs = Math.floor(planStats.mtimeMs);
|
|
63509
63562
|
const markerContent = fs29.readFileSync(markerPath, "utf8");
|
|
@@ -63740,11 +63793,11 @@ async function doFlush(directory) {
|
|
|
63740
63793
|
const activitySection = renderActivitySection();
|
|
63741
63794
|
const updated = replaceOrAppendSection(existing, "## Agent Activity", activitySection);
|
|
63742
63795
|
const flushedCount = swarmState.pendingEvents;
|
|
63743
|
-
const
|
|
63744
|
-
const tempPath = `${
|
|
63796
|
+
const path46 = nodePath2.join(directory, ".swarm", "context.md");
|
|
63797
|
+
const tempPath = `${path46}.tmp`;
|
|
63745
63798
|
try {
|
|
63746
63799
|
await Bun.write(tempPath, updated);
|
|
63747
|
-
renameSync11(tempPath,
|
|
63800
|
+
renameSync11(tempPath, path46);
|
|
63748
63801
|
} catch (writeError) {
|
|
63749
63802
|
try {
|
|
63750
63803
|
unlinkSync8(tempPath);
|
|
@@ -63795,7 +63848,7 @@ ${content.substring(endIndex + 1)}`;
|
|
|
63795
63848
|
init_manager();
|
|
63796
63849
|
init_utils2();
|
|
63797
63850
|
import * as fs31 from "node:fs";
|
|
63798
|
-
import { join as
|
|
63851
|
+
import { join as join41 } from "node:path";
|
|
63799
63852
|
function createCompactionCustomizerHook(config3, directory) {
|
|
63800
63853
|
const enabled = config3.hooks?.compaction !== false;
|
|
63801
63854
|
if (!enabled) {
|
|
@@ -63840,7 +63893,7 @@ function createCompactionCustomizerHook(config3, directory) {
|
|
|
63840
63893
|
}
|
|
63841
63894
|
}
|
|
63842
63895
|
try {
|
|
63843
|
-
const summariesDir =
|
|
63896
|
+
const summariesDir = join41(directory, ".swarm", "summaries");
|
|
63844
63897
|
const files = await fs31.promises.readdir(summariesDir);
|
|
63845
63898
|
if (files.length > 0) {
|
|
63846
63899
|
const count = files.length;
|
|
@@ -64464,6 +64517,7 @@ init_schema();
|
|
|
64464
64517
|
init_file_locks();
|
|
64465
64518
|
init_state();
|
|
64466
64519
|
init_telemetry();
|
|
64520
|
+
init_logger();
|
|
64467
64521
|
init_utils2();
|
|
64468
64522
|
import * as fs33 from "node:fs";
|
|
64469
64523
|
var END_OF_SENTENCE_QUESTION_PATTERN = /\?\s*$/;
|
|
@@ -64575,7 +64629,7 @@ function parseCriticResponse(rawResponse) {
|
|
|
64575
64629
|
if (validVerdicts.includes(normalized)) {
|
|
64576
64630
|
res.verdict = normalized;
|
|
64577
64631
|
} else {
|
|
64578
|
-
|
|
64632
|
+
warn(`[full-auto-intercept] Unknown verdict '${value}' — defaulting to NEEDS_REVISION`);
|
|
64579
64633
|
res.verdict = "NEEDS_REVISION";
|
|
64580
64634
|
}
|
|
64581
64635
|
break;
|
|
@@ -64652,23 +64706,23 @@ async function writeAutoOversightEvent(directory, architectOutput, criticVerdict
|
|
|
64652
64706
|
try {
|
|
64653
64707
|
lockResult = await tryAcquireLock(dir, eventsFilePath, "auto-oversight", lockTaskId);
|
|
64654
64708
|
} catch (error93) {
|
|
64655
|
-
|
|
64709
|
+
warn(`[full-auto-intercept] Warning: failed to acquire lock for auto_oversight event: ${error93 instanceof Error ? error93.message : String(error93)}`);
|
|
64656
64710
|
}
|
|
64657
64711
|
if (!lockResult?.acquired) {
|
|
64658
|
-
|
|
64712
|
+
warn(`[full-auto-intercept] Warning: could not acquire lock for events.jsonl write — proceeding without lock`);
|
|
64659
64713
|
}
|
|
64660
64714
|
try {
|
|
64661
64715
|
const eventsPath = validateSwarmPath(dir, "events.jsonl");
|
|
64662
64716
|
fs33.appendFileSync(eventsPath, `${JSON.stringify(event)}
|
|
64663
64717
|
`, "utf-8");
|
|
64664
64718
|
} catch (writeError) {
|
|
64665
|
-
|
|
64719
|
+
error48(`[full-auto-intercept] Warning: failed to write auto_oversight event: ${writeError instanceof Error ? writeError.message : String(writeError)}`);
|
|
64666
64720
|
} finally {
|
|
64667
64721
|
if (lockResult?.acquired && lockResult.lock._release) {
|
|
64668
64722
|
try {
|
|
64669
64723
|
await lockResult.lock._release();
|
|
64670
64724
|
} catch (releaseError) {
|
|
64671
|
-
|
|
64725
|
+
error48(`[full-auto-intercept] Lock release failed:`, releaseError);
|
|
64672
64726
|
}
|
|
64673
64727
|
}
|
|
64674
64728
|
}
|
|
@@ -64774,7 +64828,7 @@ Critic reasoning: ${criticResult.reasoning}`
|
|
|
64774
64828
|
async function dispatchCriticAndWriteEvent(directory, architectOutput, criticContext, criticModel, escalationType, interactionCount, deadlockCount, oversightAgentName) {
|
|
64775
64829
|
const client = swarmState.opencodeClient;
|
|
64776
64830
|
if (!client) {
|
|
64777
|
-
|
|
64831
|
+
warn("[full-auto-intercept] No opencodeClient — critic dispatch skipped (fallback to PENDING)");
|
|
64778
64832
|
const result = {
|
|
64779
64833
|
verdict: "PENDING",
|
|
64780
64834
|
reasoning: "No opencodeClient available — critic dispatch not possible",
|
|
@@ -64787,7 +64841,7 @@ async function dispatchCriticAndWriteEvent(directory, architectOutput, criticCon
|
|
|
64787
64841
|
return result;
|
|
64788
64842
|
}
|
|
64789
64843
|
const oversightAgent = createCriticAutonomousOversightAgent(criticModel, criticContext);
|
|
64790
|
-
|
|
64844
|
+
log(`[full-auto-intercept] Dispatching critic: ${oversightAgent.name} using model ${criticModel}`);
|
|
64791
64845
|
let ephemeralSessionId;
|
|
64792
64846
|
const cleanup = () => {
|
|
64793
64847
|
if (ephemeralSessionId) {
|
|
@@ -64805,7 +64859,7 @@ async function dispatchCriticAndWriteEvent(directory, architectOutput, criticCon
|
|
|
64805
64859
|
throw new Error(`Failed to create critic session: ${JSON.stringify(createResult.error)}`);
|
|
64806
64860
|
}
|
|
64807
64861
|
ephemeralSessionId = createResult.data.id;
|
|
64808
|
-
|
|
64862
|
+
log(`[full-auto-intercept] Created ephemeral session: ${ephemeralSessionId}`);
|
|
64809
64863
|
const promptResult = await client.session.prompt({
|
|
64810
64864
|
path: { id: ephemeralSessionId },
|
|
64811
64865
|
body: {
|
|
@@ -64820,9 +64874,9 @@ async function dispatchCriticAndWriteEvent(directory, architectOutput, criticCon
|
|
|
64820
64874
|
const textParts = promptResult.data.parts.filter((p) => p.type === "text");
|
|
64821
64875
|
criticResponse = textParts.map((p) => p.text).join(`
|
|
64822
64876
|
`);
|
|
64823
|
-
|
|
64877
|
+
log(`[full-auto-intercept] Critic response received (${criticResponse.length} chars)`);
|
|
64824
64878
|
if (!criticResponse.trim()) {
|
|
64825
|
-
|
|
64879
|
+
warn("[full-auto-intercept] Critic returned empty response — using fallback verdict");
|
|
64826
64880
|
criticResponse = `VERDICT: NEEDS_REVISION
|
|
64827
64881
|
REASONING: Critic returned empty response
|
|
64828
64882
|
EVIDENCE_CHECKED: none
|
|
@@ -64835,9 +64889,9 @@ ESCALATION_NEEDED: NO`;
|
|
|
64835
64889
|
let parsed;
|
|
64836
64890
|
try {
|
|
64837
64891
|
parsed = parseCriticResponse(criticResponse);
|
|
64838
|
-
|
|
64892
|
+
log(`[full-auto-intercept] Critic verdict: ${parsed.verdict} | escalation: ${parsed.escalationNeeded}`);
|
|
64839
64893
|
} catch (parseError) {
|
|
64840
|
-
|
|
64894
|
+
error48(`[full-auto-intercept] Failed to parse critic response: ${parseError instanceof Error ? parseError.message : String(parseError)}`);
|
|
64841
64895
|
parsed = {
|
|
64842
64896
|
verdict: "NEEDS_REVISION",
|
|
64843
64897
|
reasoning: "Critic response parsing failed — defaulting to NEEDS_REVISION",
|
|
@@ -64850,7 +64904,7 @@ ESCALATION_NEEDED: NO`;
|
|
|
64850
64904
|
try {
|
|
64851
64905
|
await writeAutoOversightEvent(directory, architectOutput, parsed.verdict, parsed.reasoning, parsed.evidenceChecked, interactionCount, deadlockCount, escalationType);
|
|
64852
64906
|
} catch (writeError) {
|
|
64853
|
-
|
|
64907
|
+
error48(`[full-auto-intercept] Failed to write auto_oversight event: ${writeError instanceof Error ? writeError.message : String(writeError)}`);
|
|
64854
64908
|
}
|
|
64855
64909
|
return parsed;
|
|
64856
64910
|
}
|
|
@@ -64919,7 +64973,7 @@ function createFullAutoInterceptHook(config3, directory) {
|
|
|
64919
64973
|
const lastQuestionHash = session.fullAutoLastQuestionHash;
|
|
64920
64974
|
if (lastQuestionHash === questionHash) {
|
|
64921
64975
|
session.fullAutoDeadlockCount = (session.fullAutoDeadlockCount ?? 0) + 1;
|
|
64922
|
-
|
|
64976
|
+
warn(`[full-auto-intercept] Potential deadlock detected (count: ${session.fullAutoDeadlockCount}/${deadlockThreshold}) — identical question repeated`);
|
|
64923
64977
|
if (session.fullAutoDeadlockCount >= deadlockThreshold) {
|
|
64924
64978
|
const escalated = await handleEscalation(directory, "deadlock", sessionID, architectText, session.fullAutoInteractionCount ?? 0, session.fullAutoDeadlockCount, escalationMode);
|
|
64925
64979
|
if (escalated)
|
|
@@ -64931,14 +64985,14 @@ function createFullAutoInterceptHook(config3, directory) {
|
|
|
64931
64985
|
session.fullAutoLastQuestionHash = questionHash;
|
|
64932
64986
|
}
|
|
64933
64987
|
}
|
|
64934
|
-
|
|
64988
|
+
log(`[full-auto-intercept] Escalation detected (${escalationType}) — triggering autonomous oversight`);
|
|
64935
64989
|
const criticContext = buildCriticContext(architectText, escalationType);
|
|
64936
64990
|
const criticModel = fullAutoConfig.critic_model ?? "claude-sonnet-4-20250514";
|
|
64937
64991
|
const oversightAgent = createCriticAutonomousOversightAgent(criticModel, criticContext);
|
|
64938
64992
|
const architectAgent = architectMessage.info?.agent;
|
|
64939
64993
|
const resolvedOversightAgentName = resolveOversightAgentName(architectAgent);
|
|
64940
64994
|
const dispatchAgentName = resolvedOversightAgentName && resolvedOversightAgentName.length > 0 ? resolvedOversightAgentName : "critic_oversight";
|
|
64941
|
-
|
|
64995
|
+
log(`[full-auto-intercept] Created autonomous oversight agent: ${oversightAgent.name} using model ${criticModel} (dispatch as: ${dispatchAgentName})`);
|
|
64942
64996
|
const criticResult = await dispatchCriticAndWriteEvent(directory, architectText, criticContext, criticModel, escalationType, session?.fullAutoInteractionCount ?? 0, session?.fullAutoDeadlockCount ?? 0, dispatchAgentName);
|
|
64943
64997
|
injectVerdictIntoMessages(messages, lastArchitectMessageIndex, criticResult, escalationType, dispatchAgentName);
|
|
64944
64998
|
};
|
|
@@ -65011,19 +65065,19 @@ This escalation requires human intervention. The swarm has been paused.
|
|
|
65011
65065
|
Please review the architect's output above and provide guidance.
|
|
65012
65066
|
`;
|
|
65013
65067
|
fs33.writeFileSync(reportPath, reportContent, "utf-8");
|
|
65014
|
-
|
|
65068
|
+
log(`[full-auto-intercept] Escalation report written to: ${reportPath}`);
|
|
65015
65069
|
} catch (error93) {
|
|
65016
|
-
|
|
65070
|
+
error48(`[full-auto-intercept] Failed to write escalation report:`, error93 instanceof Error ? error93.message : String(error93));
|
|
65017
65071
|
}
|
|
65018
65072
|
}
|
|
65019
65073
|
async function handleEscalation(directory, reason, sessionID, architectOutput, interactionCount, deadlockCount, escalationMode, phase) {
|
|
65020
65074
|
telemetry.autoOversightEscalation(sessionID ?? "unknown", reason, interactionCount, deadlockCount, phase);
|
|
65021
65075
|
await writeEscalationReport(directory, reason, architectOutput, interactionCount, deadlockCount, phase);
|
|
65022
65076
|
if (escalationMode === "terminate") {
|
|
65023
|
-
|
|
65077
|
+
error48(`[full-auto-intercept] ESCALATION (terminate mode) — reason: ${reason}, session: ${sessionID}`);
|
|
65024
65078
|
process.exit(1);
|
|
65025
65079
|
}
|
|
65026
|
-
|
|
65080
|
+
warn(`[full-auto-intercept] ESCALATION (pause mode) — reason: ${reason}, session: ${sessionID}`);
|
|
65027
65081
|
return true;
|
|
65028
65082
|
}
|
|
65029
65083
|
|
|
@@ -65104,7 +65158,7 @@ init_schema();
|
|
|
65104
65158
|
init_manager();
|
|
65105
65159
|
init_curator();
|
|
65106
65160
|
init_utils2();
|
|
65107
|
-
import * as
|
|
65161
|
+
import * as path47 from "node:path";
|
|
65108
65162
|
function createPhaseMonitorHook(directory, preflightManager, curatorRunner, delegateFactory) {
|
|
65109
65163
|
let lastKnownPhase = null;
|
|
65110
65164
|
const handler = async (input, _output) => {
|
|
@@ -65124,9 +65178,9 @@ function createPhaseMonitorHook(directory, preflightManager, curatorRunner, dele
|
|
|
65124
65178
|
const llmDelegate = delegateFactory?.(sessionId);
|
|
65125
65179
|
const initResult = await runner(directory, curatorConfig, llmDelegate);
|
|
65126
65180
|
if (initResult.briefing) {
|
|
65127
|
-
const briefingPath =
|
|
65181
|
+
const briefingPath = path47.join(directory, ".swarm", "curator-briefing.md");
|
|
65128
65182
|
const { mkdir: mkdir7, writeFile: writeFile7 } = await import("node:fs/promises");
|
|
65129
|
-
await mkdir7(
|
|
65183
|
+
await mkdir7(path47.dirname(briefingPath), { recursive: true });
|
|
65130
65184
|
await writeFile7(briefingPath, initResult.briefing, "utf-8");
|
|
65131
65185
|
const { buildApprovedReceipt: buildApprovedReceipt2, persistReviewReceipt: persistReviewReceipt2 } = await Promise.resolve().then(() => (init_review_receipt(), exports_review_receipt));
|
|
65132
65186
|
const initReceipt = buildApprovedReceipt2({
|
|
@@ -65251,7 +65305,7 @@ ${originalText}`;
|
|
|
65251
65305
|
}
|
|
65252
65306
|
// src/hooks/repo-graph-builder.ts
|
|
65253
65307
|
init_constants();
|
|
65254
|
-
import * as
|
|
65308
|
+
import * as path50 from "node:path";
|
|
65255
65309
|
|
|
65256
65310
|
// src/tools/repo-graph.ts
|
|
65257
65311
|
init_utils2();
|
|
@@ -65260,14 +65314,14 @@ init_path_security();
|
|
|
65260
65314
|
import * as fsSync2 from "node:fs";
|
|
65261
65315
|
import { constants as constants3, existsSync as existsSync28, realpathSync as realpathSync6 } from "node:fs";
|
|
65262
65316
|
import * as fsPromises3 from "node:fs/promises";
|
|
65263
|
-
import * as
|
|
65317
|
+
import * as path49 from "node:path";
|
|
65264
65318
|
|
|
65265
65319
|
// src/tools/symbols.ts
|
|
65266
65320
|
init_zod();
|
|
65267
65321
|
init_create_tool();
|
|
65268
65322
|
init_path_security();
|
|
65269
65323
|
import * as fs35 from "node:fs";
|
|
65270
|
-
import * as
|
|
65324
|
+
import * as path48 from "node:path";
|
|
65271
65325
|
var MAX_FILE_SIZE_BYTES2 = 1024 * 1024;
|
|
65272
65326
|
var WINDOWS_RESERVED_NAMES = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|:|$)/i;
|
|
65273
65327
|
function containsWindowsAttacks(str) {
|
|
@@ -65284,11 +65338,11 @@ function containsWindowsAttacks(str) {
|
|
|
65284
65338
|
}
|
|
65285
65339
|
function isPathInWorkspace(filePath, workspace) {
|
|
65286
65340
|
try {
|
|
65287
|
-
const resolvedPath =
|
|
65341
|
+
const resolvedPath = path48.resolve(workspace, filePath);
|
|
65288
65342
|
const realWorkspace = fs35.realpathSync(workspace);
|
|
65289
65343
|
const realResolvedPath = fs35.realpathSync(resolvedPath);
|
|
65290
|
-
const relativePath =
|
|
65291
|
-
if (relativePath.startsWith("..") ||
|
|
65344
|
+
const relativePath = path48.relative(realWorkspace, realResolvedPath);
|
|
65345
|
+
if (relativePath.startsWith("..") || path48.isAbsolute(relativePath)) {
|
|
65292
65346
|
return false;
|
|
65293
65347
|
}
|
|
65294
65348
|
return true;
|
|
@@ -65300,7 +65354,7 @@ function validatePathForRead(filePath, workspace) {
|
|
|
65300
65354
|
return isPathInWorkspace(filePath, workspace);
|
|
65301
65355
|
}
|
|
65302
65356
|
function extractTSSymbols(filePath, cwd) {
|
|
65303
|
-
const fullPath =
|
|
65357
|
+
const fullPath = path48.join(cwd, filePath);
|
|
65304
65358
|
if (!validatePathForRead(fullPath, cwd)) {
|
|
65305
65359
|
return [];
|
|
65306
65360
|
}
|
|
@@ -65452,7 +65506,7 @@ function extractTSSymbols(filePath, cwd) {
|
|
|
65452
65506
|
});
|
|
65453
65507
|
}
|
|
65454
65508
|
function extractPythonSymbols(filePath, cwd) {
|
|
65455
|
-
const fullPath =
|
|
65509
|
+
const fullPath = path48.join(cwd, filePath);
|
|
65456
65510
|
if (!validatePathForRead(fullPath, cwd)) {
|
|
65457
65511
|
return [];
|
|
65458
65512
|
}
|
|
@@ -65535,7 +65589,7 @@ var symbols = createSwarmTool({
|
|
|
65535
65589
|
}, null, 2);
|
|
65536
65590
|
}
|
|
65537
65591
|
const cwd = directory;
|
|
65538
|
-
const ext =
|
|
65592
|
+
const ext = path48.extname(file3);
|
|
65539
65593
|
if (containsControlChars(file3)) {
|
|
65540
65594
|
return JSON.stringify({
|
|
65541
65595
|
file: file3,
|
|
@@ -65599,7 +65653,7 @@ var symbols = createSwarmTool({
|
|
|
65599
65653
|
var WINDOWS_RENAME_MAX_RETRIES = 3;
|
|
65600
65654
|
var WINDOWS_RENAME_RETRY_DELAY_MS = 50;
|
|
65601
65655
|
function normalizeGraphPath(filePath) {
|
|
65602
|
-
return
|
|
65656
|
+
return path49.normalize(filePath).replace(/\\/g, "/");
|
|
65603
65657
|
}
|
|
65604
65658
|
var REPO_GRAPH_FILENAME = "repo-graph.json";
|
|
65605
65659
|
var GRAPH_SCHEMA_VERSION = "1.0.0";
|
|
@@ -65708,8 +65762,8 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
65708
65762
|
}
|
|
65709
65763
|
try {
|
|
65710
65764
|
if (specifier.startsWith(".")) {
|
|
65711
|
-
const sourceDir =
|
|
65712
|
-
let resolved =
|
|
65765
|
+
const sourceDir = path49.dirname(sourceFile);
|
|
65766
|
+
let resolved = path49.resolve(sourceDir, specifier);
|
|
65713
65767
|
let realResolved;
|
|
65714
65768
|
try {
|
|
65715
65769
|
realResolved = realpathSync6(resolved);
|
|
@@ -65720,7 +65774,7 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
65720
65774
|
try {
|
|
65721
65775
|
realRoot = realpathSync6(workspaceRoot);
|
|
65722
65776
|
} catch {
|
|
65723
|
-
realRoot =
|
|
65777
|
+
realRoot = path49.normalize(workspaceRoot);
|
|
65724
65778
|
}
|
|
65725
65779
|
if (!existsSync28(resolved)) {
|
|
65726
65780
|
const EXTENSIONS = [
|
|
@@ -65752,9 +65806,9 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
65752
65806
|
return null;
|
|
65753
65807
|
}
|
|
65754
65808
|
}
|
|
65755
|
-
const normalizedResolved =
|
|
65756
|
-
const normalizedRoot =
|
|
65757
|
-
if (!normalizedResolved.startsWith(normalizedRoot +
|
|
65809
|
+
const normalizedResolved = path49.normalize(realResolved);
|
|
65810
|
+
const normalizedRoot = path49.normalize(realRoot);
|
|
65811
|
+
if (!normalizedResolved.startsWith(normalizedRoot + path49.sep) && normalizedResolved !== normalizedRoot) {
|
|
65758
65812
|
return null;
|
|
65759
65813
|
}
|
|
65760
65814
|
return resolved;
|
|
@@ -65767,7 +65821,7 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
65767
65821
|
function createEmptyGraph(workspaceRoot) {
|
|
65768
65822
|
return {
|
|
65769
65823
|
schema_version: GRAPH_SCHEMA_VERSION,
|
|
65770
|
-
workspaceRoot:
|
|
65824
|
+
workspaceRoot: path49.normalize(workspaceRoot),
|
|
65771
65825
|
nodes: {},
|
|
65772
65826
|
edges: [],
|
|
65773
65827
|
metadata: {
|
|
@@ -65801,10 +65855,10 @@ function addEdge(graph, edge) {
|
|
|
65801
65855
|
}
|
|
65802
65856
|
}
|
|
65803
65857
|
function getCachedGraph(workspace) {
|
|
65804
|
-
return graphCache.get(
|
|
65858
|
+
return graphCache.get(path49.normalize(workspace));
|
|
65805
65859
|
}
|
|
65806
65860
|
function setCachedGraph(workspace, graph, mtime) {
|
|
65807
|
-
const normalized =
|
|
65861
|
+
const normalized = path49.normalize(workspace);
|
|
65808
65862
|
graphCache.set(normalized, graph);
|
|
65809
65863
|
dirtyFlags.set(normalized, false);
|
|
65810
65864
|
if (mtime !== undefined) {
|
|
@@ -65812,10 +65866,10 @@ function setCachedGraph(workspace, graph, mtime) {
|
|
|
65812
65866
|
}
|
|
65813
65867
|
}
|
|
65814
65868
|
function isDirty(workspace) {
|
|
65815
|
-
return dirtyFlags.get(
|
|
65869
|
+
return dirtyFlags.get(path49.normalize(workspace)) ?? false;
|
|
65816
65870
|
}
|
|
65817
65871
|
function clearCache(workspace) {
|
|
65818
|
-
const normalized =
|
|
65872
|
+
const normalized = path49.normalize(workspace);
|
|
65819
65873
|
graphCache.delete(normalized);
|
|
65820
65874
|
dirtyFlags.delete(normalized);
|
|
65821
65875
|
mtimeCache.delete(normalized);
|
|
@@ -65828,7 +65882,7 @@ function getGraphPath(workspace) {
|
|
|
65828
65882
|
}
|
|
65829
65883
|
async function loadGraph(workspace) {
|
|
65830
65884
|
validateWorkspace(workspace);
|
|
65831
|
-
const normalized =
|
|
65885
|
+
const normalized = path49.normalize(workspace);
|
|
65832
65886
|
const cached3 = getCachedGraph(normalized);
|
|
65833
65887
|
if (cached3 && !isDirty(normalized)) {
|
|
65834
65888
|
try {
|
|
@@ -65922,28 +65976,28 @@ async function saveGraph(workspace, graph, options) {
|
|
|
65922
65976
|
if (!Array.isArray(graph.edges)) {
|
|
65923
65977
|
throw new Error("Graph must have edges array");
|
|
65924
65978
|
}
|
|
65925
|
-
const normalizedWorkspace =
|
|
65979
|
+
const normalizedWorkspace = path49.normalize(workspace);
|
|
65926
65980
|
let realWorkspace;
|
|
65927
65981
|
try {
|
|
65928
65982
|
realWorkspace = realpathSync6(workspace);
|
|
65929
65983
|
} catch {
|
|
65930
65984
|
realWorkspace = normalizedWorkspace;
|
|
65931
65985
|
}
|
|
65932
|
-
const normalizedGraphRoot =
|
|
65986
|
+
const normalizedGraphRoot = path49.normalize(graph.workspaceRoot);
|
|
65933
65987
|
let realGraphRoot;
|
|
65934
65988
|
try {
|
|
65935
65989
|
realGraphRoot = realpathSync6(graph.workspaceRoot);
|
|
65936
65990
|
} catch {
|
|
65937
65991
|
realGraphRoot = normalizedGraphRoot;
|
|
65938
65992
|
}
|
|
65939
|
-
if (
|
|
65993
|
+
if (path49.normalize(realWorkspace) !== path49.normalize(realGraphRoot)) {
|
|
65940
65994
|
throw new Error(`Graph workspaceRoot mismatch: graph was built for "${graph.workspaceRoot}" but save was called for "${workspace}"`);
|
|
65941
65995
|
}
|
|
65942
65996
|
const normalized = normalizedWorkspace;
|
|
65943
65997
|
const graphPath = getGraphPath(workspace);
|
|
65944
65998
|
updateGraphMetadata(graph);
|
|
65945
65999
|
const tempPath = `${graphPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
65946
|
-
await fsPromises3.mkdir(
|
|
66000
|
+
await fsPromises3.mkdir(path49.dirname(tempPath), { recursive: true });
|
|
65947
66001
|
let lastError = null;
|
|
65948
66002
|
try {
|
|
65949
66003
|
if (options?.createAtomic) {
|
|
@@ -66074,7 +66128,7 @@ function findSourceFiles(dir, stats) {
|
|
|
66074
66128
|
stats.skippedDirs++;
|
|
66075
66129
|
continue;
|
|
66076
66130
|
}
|
|
66077
|
-
const fullPath =
|
|
66131
|
+
const fullPath = path49.join(dir, entry);
|
|
66078
66132
|
let stat3;
|
|
66079
66133
|
try {
|
|
66080
66134
|
stat3 = fsSync2.statSync(fullPath);
|
|
@@ -66085,7 +66139,7 @@ function findSourceFiles(dir, stats) {
|
|
|
66085
66139
|
const subFiles = findSourceFiles(fullPath, stats);
|
|
66086
66140
|
files.push(...subFiles);
|
|
66087
66141
|
} else if (stat3.isFile()) {
|
|
66088
|
-
const ext =
|
|
66142
|
+
const ext = path49.extname(fullPath).toLowerCase();
|
|
66089
66143
|
if (SUPPORTED_EXTENSIONS.includes(ext)) {
|
|
66090
66144
|
files.push(fullPath);
|
|
66091
66145
|
}
|
|
@@ -66094,11 +66148,11 @@ function findSourceFiles(dir, stats) {
|
|
|
66094
66148
|
return files;
|
|
66095
66149
|
}
|
|
66096
66150
|
function toModuleName(filePath, workspaceRoot) {
|
|
66097
|
-
const relative9 =
|
|
66098
|
-
return relative9.split(
|
|
66151
|
+
const relative9 = path49.relative(workspaceRoot, filePath);
|
|
66152
|
+
return relative9.split(path49.sep).join("/");
|
|
66099
66153
|
}
|
|
66100
66154
|
function getLanguage(filePath) {
|
|
66101
|
-
const ext =
|
|
66155
|
+
const ext = path49.extname(filePath).toLowerCase();
|
|
66102
66156
|
return EXTENSION_TO_LANGUAGE[ext] ?? "unknown";
|
|
66103
66157
|
}
|
|
66104
66158
|
function isBinaryContent(content) {
|
|
@@ -66111,7 +66165,7 @@ function buildWorkspaceGraph(workspaceRoot, options) {
|
|
|
66111
66165
|
validateWorkspace(workspaceRoot);
|
|
66112
66166
|
const maxFileSize = options?.maxFileSizeBytes ?? 1024 * 1024;
|
|
66113
66167
|
const maxFiles = options?.maxFiles ?? 1e4;
|
|
66114
|
-
const absoluteRoot =
|
|
66168
|
+
const absoluteRoot = path49.resolve(workspaceRoot);
|
|
66115
66169
|
if (!existsSync28(absoluteRoot)) {
|
|
66116
66170
|
throw new Error(`Workspace directory does not exist: ${workspaceRoot}`);
|
|
66117
66171
|
}
|
|
@@ -66152,16 +66206,16 @@ function buildWorkspaceGraph(workspaceRoot, options) {
|
|
|
66152
66206
|
continue;
|
|
66153
66207
|
}
|
|
66154
66208
|
stats.filesScanned++;
|
|
66155
|
-
const ext =
|
|
66209
|
+
const ext = path49.extname(filePath).toLowerCase();
|
|
66156
66210
|
let exports = [];
|
|
66157
66211
|
let parsedImports = [];
|
|
66158
66212
|
try {
|
|
66159
66213
|
if ([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"].includes(ext)) {
|
|
66160
|
-
const relativePath =
|
|
66214
|
+
const relativePath = path49.relative(absoluteRoot, filePath);
|
|
66161
66215
|
const symbols2 = extractTSSymbols(relativePath, absoluteRoot);
|
|
66162
66216
|
exports = symbols2.filter((s) => s.exported).map((s) => s.name);
|
|
66163
66217
|
} else if (ext === ".py") {
|
|
66164
|
-
const relativePath =
|
|
66218
|
+
const relativePath = path49.relative(absoluteRoot, filePath);
|
|
66165
66219
|
const symbols2 = extractPythonSymbols(relativePath, absoluteRoot);
|
|
66166
66220
|
exports = symbols2.filter((s) => s.exported).map((s) => s.name);
|
|
66167
66221
|
}
|
|
@@ -66218,15 +66272,15 @@ function scanFile(filePath, absoluteRoot, maxFileSize) {
|
|
|
66218
66272
|
if (isBinaryContent(content)) {
|
|
66219
66273
|
return { node: null, edges: [] };
|
|
66220
66274
|
}
|
|
66221
|
-
const ext =
|
|
66275
|
+
const ext = path49.extname(filePath).toLowerCase();
|
|
66222
66276
|
let exports = [];
|
|
66223
66277
|
try {
|
|
66224
66278
|
if ([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"].includes(ext)) {
|
|
66225
|
-
const relativePath =
|
|
66279
|
+
const relativePath = path49.relative(absoluteRoot, filePath);
|
|
66226
66280
|
const symbols2 = extractTSSymbols(relativePath, absoluteRoot);
|
|
66227
66281
|
exports = symbols2.filter((s) => s.exported).map((s) => s.name);
|
|
66228
66282
|
} else if (ext === ".py") {
|
|
66229
|
-
const relativePath =
|
|
66283
|
+
const relativePath = path49.relative(absoluteRoot, filePath);
|
|
66230
66284
|
const symbols2 = extractPythonSymbols(relativePath, absoluteRoot);
|
|
66231
66285
|
exports = symbols2.filter((s) => s.exported).map((s) => s.name);
|
|
66232
66286
|
}
|
|
@@ -66270,7 +66324,7 @@ async function updateGraphForFiles(workspaceRoot, filePaths, options) {
|
|
|
66270
66324
|
return graph2;
|
|
66271
66325
|
}
|
|
66272
66326
|
const graph = existingGraph;
|
|
66273
|
-
const absoluteRoot =
|
|
66327
|
+
const absoluteRoot = path49.resolve(workspaceRoot);
|
|
66274
66328
|
const maxFileSize = 1024 * 1024;
|
|
66275
66329
|
const updatedPaths = new Set;
|
|
66276
66330
|
for (const rawFilePath of filePaths) {
|
|
@@ -66383,7 +66437,7 @@ function createRepoGraphBuilderHook(workspaceRoot, deps) {
|
|
|
66383
66437
|
if (!isSupportedSourceFile(filePath)) {
|
|
66384
66438
|
return;
|
|
66385
66439
|
}
|
|
66386
|
-
const absoluteFilePath =
|
|
66440
|
+
const absoluteFilePath = path50.isAbsolute(filePath) ? filePath : path50.resolve(workspaceRoot, filePath);
|
|
66387
66441
|
const normalizedAbsolute = absoluteFilePath.replace(/\\/g, "/");
|
|
66388
66442
|
const normalizedWorkspace = workspaceRoot.replace(/\\/g, "/");
|
|
66389
66443
|
if (!normalizedAbsolute.startsWith(`${normalizedWorkspace}/`) && normalizedAbsolute !== normalizedWorkspace) {
|
|
@@ -66391,7 +66445,7 @@ function createRepoGraphBuilderHook(workspaceRoot, deps) {
|
|
|
66391
66445
|
}
|
|
66392
66446
|
try {
|
|
66393
66447
|
await _updateGraphForFiles(workspaceRoot, [absoluteFilePath]);
|
|
66394
|
-
log(`[repo-graph] Incremental update for ${
|
|
66448
|
+
log(`[repo-graph] Incremental update for ${path50.basename(filePath)}`);
|
|
66395
66449
|
} catch (error93) {
|
|
66396
66450
|
const message = error93 instanceof Error ? error93.message : String(error93);
|
|
66397
66451
|
error48(`[repo-graph] Incremental update failed: ${message}`);
|
|
@@ -66410,14 +66464,14 @@ init_manager2();
|
|
|
66410
66464
|
init_detector();
|
|
66411
66465
|
init_manager();
|
|
66412
66466
|
import * as fs44 from "node:fs";
|
|
66413
|
-
import * as
|
|
66467
|
+
import * as path60 from "node:path";
|
|
66414
66468
|
|
|
66415
66469
|
// src/services/decision-drift-analyzer.ts
|
|
66416
66470
|
init_utils2();
|
|
66417
66471
|
init_manager();
|
|
66418
66472
|
init_utils();
|
|
66419
66473
|
import * as fs36 from "node:fs";
|
|
66420
|
-
import * as
|
|
66474
|
+
import * as path51 from "node:path";
|
|
66421
66475
|
var DEFAULT_DRIFT_CONFIG = {
|
|
66422
66476
|
staleThresholdPhases: 1,
|
|
66423
66477
|
detectContradictions: true,
|
|
@@ -66571,7 +66625,7 @@ async function analyzeDecisionDrift(directory, config3 = {}) {
|
|
|
66571
66625
|
currentPhase = legacyPhase;
|
|
66572
66626
|
}
|
|
66573
66627
|
}
|
|
66574
|
-
const contextPath =
|
|
66628
|
+
const contextPath = path51.join(directory, ".swarm", "context.md");
|
|
66575
66629
|
let contextContent = "";
|
|
66576
66630
|
try {
|
|
66577
66631
|
if (fs36.existsSync(contextPath)) {
|
|
@@ -66710,7 +66764,7 @@ init_utils();
|
|
|
66710
66764
|
init_constants();
|
|
66711
66765
|
init_schema();
|
|
66712
66766
|
import * as fs37 from "node:fs/promises";
|
|
66713
|
-
import * as
|
|
66767
|
+
import * as path52 from "node:path";
|
|
66714
66768
|
function safeGet(obj, key) {
|
|
66715
66769
|
if (!obj || !Object.hasOwn(obj, key))
|
|
66716
66770
|
return;
|
|
@@ -66942,9 +66996,9 @@ async function handleDebuggingSpiral(match, taskId, directory) {
|
|
|
66942
66996
|
let eventLogged = false;
|
|
66943
66997
|
let checkpointCreated = false;
|
|
66944
66998
|
try {
|
|
66945
|
-
const swarmDir =
|
|
66999
|
+
const swarmDir = path52.join(directory, ".swarm");
|
|
66946
67000
|
await fs37.mkdir(swarmDir, { recursive: true });
|
|
66947
|
-
const eventsPath =
|
|
67001
|
+
const eventsPath = path52.join(swarmDir, "events.jsonl");
|
|
66948
67002
|
await fs37.appendFile(eventsPath, `${formatDebuggingSpiralEvent(match, taskId)}
|
|
66949
67003
|
`);
|
|
66950
67004
|
eventLogged = true;
|
|
@@ -67084,7 +67138,7 @@ import * as fs41 from "node:fs";
|
|
|
67084
67138
|
|
|
67085
67139
|
// src/graph/graph-builder.ts
|
|
67086
67140
|
import * as fs39 from "node:fs";
|
|
67087
|
-
import * as
|
|
67141
|
+
import * as path55 from "node:path";
|
|
67088
67142
|
|
|
67089
67143
|
// node_modules/yocto-queue/index.js
|
|
67090
67144
|
class Node {
|
|
@@ -67245,7 +67299,7 @@ function validateConcurrency(concurrency) {
|
|
|
67245
67299
|
// src/graph/import-extractor.ts
|
|
67246
67300
|
init_path_security();
|
|
67247
67301
|
import * as fs38 from "node:fs";
|
|
67248
|
-
import * as
|
|
67302
|
+
import * as path53 from "node:path";
|
|
67249
67303
|
var SOURCE_EXTENSIONS2 = [
|
|
67250
67304
|
".ts",
|
|
67251
67305
|
".tsx",
|
|
@@ -67290,14 +67344,14 @@ function getLanguageFromExtension(ext) {
|
|
|
67290
67344
|
return null;
|
|
67291
67345
|
}
|
|
67292
67346
|
function toRelForwardSlash(absPath, root) {
|
|
67293
|
-
return
|
|
67347
|
+
return path53.relative(root, absPath).replace(/\\/g, "/");
|
|
67294
67348
|
}
|
|
67295
67349
|
function tryResolveTSJS(rawModule, sourceFileAbs) {
|
|
67296
67350
|
if (!rawModule.startsWith(".") && !rawModule.startsWith("/")) {
|
|
67297
67351
|
return null;
|
|
67298
67352
|
}
|
|
67299
|
-
const sourceDir =
|
|
67300
|
-
const baseAbs =
|
|
67353
|
+
const sourceDir = path53.dirname(sourceFileAbs);
|
|
67354
|
+
const baseAbs = path53.resolve(sourceDir, rawModule);
|
|
67301
67355
|
const probe = (basePath) => {
|
|
67302
67356
|
for (const ext of RESOLVE_EXTENSION_CANDIDATES) {
|
|
67303
67357
|
const test = basePath + ext;
|
|
@@ -67308,7 +67362,7 @@ function tryResolveTSJS(rawModule, sourceFileAbs) {
|
|
|
67308
67362
|
} catch {}
|
|
67309
67363
|
}
|
|
67310
67364
|
for (const indexFile of RESOLVE_INDEX_CANDIDATES) {
|
|
67311
|
-
const test =
|
|
67365
|
+
const test = path53.join(basePath, indexFile);
|
|
67312
67366
|
try {
|
|
67313
67367
|
const stat3 = fs38.statSync(test);
|
|
67314
67368
|
if (stat3.isFile())
|
|
@@ -67338,13 +67392,13 @@ function tryResolvePython(rawModule, sourceFileAbs, workspaceRoot) {
|
|
|
67338
67392
|
}
|
|
67339
67393
|
const remainder = rawModule.slice(leadingDots).replace(/\./g, "/");
|
|
67340
67394
|
const upDirs = "../".repeat(Math.max(0, leadingDots - 1));
|
|
67341
|
-
const sourceDir =
|
|
67342
|
-
const baseAbs =
|
|
67395
|
+
const sourceDir = path53.dirname(sourceFileAbs);
|
|
67396
|
+
const baseAbs = path53.resolve(sourceDir, upDirs + remainder);
|
|
67343
67397
|
const accept = (test) => {
|
|
67344
67398
|
try {
|
|
67345
67399
|
const stat3 = fs38.statSync(test);
|
|
67346
67400
|
if (stat3.isFile()) {
|
|
67347
|
-
const rel =
|
|
67401
|
+
const rel = path53.relative(workspaceRoot, test).replace(/\\/g, "/");
|
|
67348
67402
|
if (rel.startsWith(".."))
|
|
67349
67403
|
return null;
|
|
67350
67404
|
return test;
|
|
@@ -67358,7 +67412,7 @@ function tryResolvePython(rawModule, sourceFileAbs, workspaceRoot) {
|
|
|
67358
67412
|
return hit;
|
|
67359
67413
|
}
|
|
67360
67414
|
for (const indexFile of PY_INDEX_CANDIDATES) {
|
|
67361
|
-
const hit = accept(
|
|
67415
|
+
const hit = accept(path53.join(baseAbs, indexFile));
|
|
67362
67416
|
if (hit)
|
|
67363
67417
|
return hit;
|
|
67364
67418
|
}
|
|
@@ -67729,7 +67783,7 @@ function parseRustUses(content) {
|
|
|
67729
67783
|
}
|
|
67730
67784
|
function extractImports2(opts) {
|
|
67731
67785
|
const { absoluteFilePath, workspaceRoot } = opts;
|
|
67732
|
-
const ext =
|
|
67786
|
+
const ext = path53.extname(absoluteFilePath).toLowerCase();
|
|
67733
67787
|
const language = getLanguageFromExtension(ext);
|
|
67734
67788
|
if (!language)
|
|
67735
67789
|
return [];
|
|
@@ -67780,9 +67834,9 @@ function extractImports2(opts) {
|
|
|
67780
67834
|
}
|
|
67781
67835
|
|
|
67782
67836
|
// src/graph/symbol-extractor.ts
|
|
67783
|
-
import * as
|
|
67837
|
+
import * as path54 from "node:path";
|
|
67784
67838
|
function extractExportedSymbols(relativeFilePath, workspaceRoot) {
|
|
67785
|
-
const ext =
|
|
67839
|
+
const ext = path54.extname(relativeFilePath).toLowerCase();
|
|
67786
67840
|
const language = getLanguageFromExtension(ext);
|
|
67787
67841
|
if (!language)
|
|
67788
67842
|
return [];
|
|
@@ -67871,15 +67925,15 @@ function findSourceFiles2(workspaceRoot, skipDirs = DEFAULT_SKIP_DIRS) {
|
|
|
67871
67925
|
if (entry.isDirectory()) {
|
|
67872
67926
|
if (skipDirs.has(entry.name))
|
|
67873
67927
|
continue;
|
|
67874
|
-
stack.push(
|
|
67928
|
+
stack.push(path55.join(dir, entry.name));
|
|
67875
67929
|
continue;
|
|
67876
67930
|
}
|
|
67877
67931
|
if (!entry.isFile())
|
|
67878
67932
|
continue;
|
|
67879
|
-
const ext =
|
|
67933
|
+
const ext = path55.extname(entry.name).toLowerCase();
|
|
67880
67934
|
if (!SOURCE_EXT_SET.has(ext))
|
|
67881
67935
|
continue;
|
|
67882
|
-
out2.push(
|
|
67936
|
+
out2.push(path55.join(dir, entry.name));
|
|
67883
67937
|
}
|
|
67884
67938
|
}
|
|
67885
67939
|
return out2;
|
|
@@ -67907,7 +67961,7 @@ async function buildRepoGraph(workspaceRoot, options = {}) {
|
|
|
67907
67961
|
};
|
|
67908
67962
|
}
|
|
67909
67963
|
async function processFile(absoluteFilePath, workspaceRoot) {
|
|
67910
|
-
const ext =
|
|
67964
|
+
const ext = path55.extname(absoluteFilePath).toLowerCase();
|
|
67911
67965
|
const language = getLanguageFromExtension(ext);
|
|
67912
67966
|
if (!language)
|
|
67913
67967
|
return null;
|
|
@@ -67927,7 +67981,7 @@ async function processFile(absoluteFilePath, workspaceRoot) {
|
|
|
67927
67981
|
} catch {
|
|
67928
67982
|
return null;
|
|
67929
67983
|
}
|
|
67930
|
-
const relPath =
|
|
67984
|
+
const relPath = path55.relative(workspaceRoot, absoluteFilePath).replace(/\\/g, "/");
|
|
67931
67985
|
const imports = extractImports2({
|
|
67932
67986
|
absoluteFilePath,
|
|
67933
67987
|
workspaceRoot,
|
|
@@ -68169,10 +68223,10 @@ function formatSummary(opts) {
|
|
|
68169
68223
|
// src/graph/graph-store.ts
|
|
68170
68224
|
import * as crypto6 from "node:crypto";
|
|
68171
68225
|
import * as fs40 from "node:fs";
|
|
68172
|
-
import * as
|
|
68226
|
+
import * as path56 from "node:path";
|
|
68173
68227
|
var SWARM_DIR = ".swarm";
|
|
68174
68228
|
function getGraphPath2(workspaceRoot) {
|
|
68175
|
-
return
|
|
68229
|
+
return path56.join(workspaceRoot, SWARM_DIR, REPO_GRAPH_FILENAME2);
|
|
68176
68230
|
}
|
|
68177
68231
|
function loadGraph2(workspaceRoot) {
|
|
68178
68232
|
const file3 = getGraphPath2(workspaceRoot);
|
|
@@ -68194,7 +68248,7 @@ function loadGraph2(workspaceRoot) {
|
|
|
68194
68248
|
}
|
|
68195
68249
|
function saveGraph2(workspaceRoot, graph) {
|
|
68196
68250
|
const file3 = getGraphPath2(workspaceRoot);
|
|
68197
|
-
const dir =
|
|
68251
|
+
const dir = path56.dirname(file3);
|
|
68198
68252
|
try {
|
|
68199
68253
|
const stat3 = fs40.lstatSync(dir);
|
|
68200
68254
|
if (stat3.isSymbolicLink()) {
|
|
@@ -68300,7 +68354,7 @@ function buildReviewerBlastRadiusBlock(directory, changedFiles) {
|
|
|
68300
68354
|
// src/hooks/semantic-diff-injection.ts
|
|
68301
68355
|
import * as child_process5 from "node:child_process";
|
|
68302
68356
|
import * as fs42 from "node:fs";
|
|
68303
|
-
import * as
|
|
68357
|
+
import * as path58 from "node:path";
|
|
68304
68358
|
|
|
68305
68359
|
// src/diff/ast-diff.ts
|
|
68306
68360
|
init_tree_sitter();
|
|
@@ -69047,17 +69101,17 @@ async function buildSemanticDiffBlock(directory, changedFiles, maxFiles = 10) {
|
|
|
69047
69101
|
const fileConsumers = {};
|
|
69048
69102
|
if (graph) {
|
|
69049
69103
|
for (const f of filesToProcess) {
|
|
69050
|
-
const relativePath =
|
|
69104
|
+
const relativePath = path58.isAbsolute(f) ? path58.relative(directory, f) : f;
|
|
69051
69105
|
const normalized = normalizeGraphPath2(relativePath);
|
|
69052
69106
|
fileConsumers[normalized] = getImporters(graph, normalized).length;
|
|
69053
69107
|
fileConsumers[f] = fileConsumers[normalized];
|
|
69054
69108
|
}
|
|
69055
69109
|
}
|
|
69056
69110
|
for (const filePath of filesToProcess) {
|
|
69057
|
-
const normalizedPath =
|
|
69058
|
-
const resolvedPath =
|
|
69059
|
-
const relativeToDir =
|
|
69060
|
-
if (relativeToDir.startsWith("..") ||
|
|
69111
|
+
const normalizedPath = path58.normalize(filePath);
|
|
69112
|
+
const resolvedPath = path58.resolve(directory, normalizedPath);
|
|
69113
|
+
const relativeToDir = path58.relative(directory, resolvedPath);
|
|
69114
|
+
if (relativeToDir.startsWith("..") || path58.isAbsolute(relativeToDir)) {
|
|
69061
69115
|
continue;
|
|
69062
69116
|
}
|
|
69063
69117
|
try {
|
|
@@ -69084,7 +69138,7 @@ async function buildSemanticDiffBlock(directory, changedFiles, maxFiles = 10) {
|
|
|
69084
69138
|
stdio: "pipe",
|
|
69085
69139
|
maxBuffer: 5 * 1024 * 1024
|
|
69086
69140
|
}) : "";
|
|
69087
|
-
const newContent = fs42.readFileSync(
|
|
69141
|
+
const newContent = fs42.readFileSync(path58.join(directory, filePath), "utf-8");
|
|
69088
69142
|
const astResult = await computeASTDiff(filePath, oldContent, newContent);
|
|
69089
69143
|
if (astResult && (astResult.changes.length > 0 || astResult.error !== undefined)) {
|
|
69090
69144
|
astDiffs.push(astResult);
|
|
@@ -69426,7 +69480,7 @@ function createSystemEnhancerHook(config3, directory) {
|
|
|
69426
69480
|
await fs44.promises.writeFile(darkMatterPath, darkMatterReport, "utf-8");
|
|
69427
69481
|
warn(`[system-enhancer] Dark matter scan complete: ${darkMatter.length} co-change patterns found`);
|
|
69428
69482
|
try {
|
|
69429
|
-
const projectName =
|
|
69483
|
+
const projectName = path60.basename(path60.resolve(directory));
|
|
69430
69484
|
const knowledgeEntries = darkMatterToKnowledgeEntries2(darkMatter, projectName);
|
|
69431
69485
|
const knowledgePath = resolveSwarmKnowledgePath(directory);
|
|
69432
69486
|
const existingEntries = await readKnowledge(knowledgePath);
|
|
@@ -69625,7 +69679,7 @@ ${lines.join(`
|
|
|
69625
69679
|
try {
|
|
69626
69680
|
const taskId_ccp = ccpSession?.currentTaskId;
|
|
69627
69681
|
if (taskId_ccp && !taskId_ccp.includes("..") && !taskId_ccp.includes("/") && !taskId_ccp.includes("\\") && !taskId_ccp.includes("\x00")) {
|
|
69628
|
-
const evidencePath =
|
|
69682
|
+
const evidencePath = path60.join(directory, ".swarm", "evidence", `${taskId_ccp}.json`);
|
|
69629
69683
|
if (fs44.existsSync(evidencePath)) {
|
|
69630
69684
|
const evidenceContent = fs44.readFileSync(evidencePath, "utf-8");
|
|
69631
69685
|
const evidenceData = JSON.parse(evidenceContent);
|
|
@@ -70771,7 +70825,7 @@ init_hive_promoter();
|
|
|
70771
70825
|
|
|
70772
70826
|
// src/hooks/incremental-verify.ts
|
|
70773
70827
|
import * as fs45 from "node:fs";
|
|
70774
|
-
import * as
|
|
70828
|
+
import * as path61 from "node:path";
|
|
70775
70829
|
|
|
70776
70830
|
// src/hooks/spawn-helper.ts
|
|
70777
70831
|
import * as child_process6 from "node:child_process";
|
|
@@ -70849,18 +70903,18 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
70849
70903
|
// src/hooks/incremental-verify.ts
|
|
70850
70904
|
var emittedSkipAdvisories = new Set;
|
|
70851
70905
|
function detectPackageManager(projectDir) {
|
|
70852
|
-
if (fs45.existsSync(
|
|
70906
|
+
if (fs45.existsSync(path61.join(projectDir, "bun.lockb")))
|
|
70853
70907
|
return "bun";
|
|
70854
|
-
if (fs45.existsSync(
|
|
70908
|
+
if (fs45.existsSync(path61.join(projectDir, "pnpm-lock.yaml")))
|
|
70855
70909
|
return "pnpm";
|
|
70856
|
-
if (fs45.existsSync(
|
|
70910
|
+
if (fs45.existsSync(path61.join(projectDir, "yarn.lock")))
|
|
70857
70911
|
return "yarn";
|
|
70858
|
-
if (fs45.existsSync(
|
|
70912
|
+
if (fs45.existsSync(path61.join(projectDir, "package-lock.json")))
|
|
70859
70913
|
return "npm";
|
|
70860
70914
|
return "bun";
|
|
70861
70915
|
}
|
|
70862
70916
|
function detectTypecheckCommand(projectDir) {
|
|
70863
|
-
const pkgPath =
|
|
70917
|
+
const pkgPath = path61.join(projectDir, "package.json");
|
|
70864
70918
|
if (fs45.existsSync(pkgPath)) {
|
|
70865
70919
|
try {
|
|
70866
70920
|
const pkg = JSON.parse(fs45.readFileSync(pkgPath, "utf8"));
|
|
@@ -70877,8 +70931,8 @@ function detectTypecheckCommand(projectDir) {
|
|
|
70877
70931
|
...pkg.dependencies,
|
|
70878
70932
|
...pkg.devDependencies
|
|
70879
70933
|
};
|
|
70880
|
-
if (!deps?.typescript && !fs45.existsSync(
|
|
70881
|
-
const hasTSMarkers = deps?.typescript || fs45.existsSync(
|
|
70934
|
+
if (!deps?.typescript && !fs45.existsSync(path61.join(projectDir, "tsconfig.json"))) {}
|
|
70935
|
+
const hasTSMarkers = deps?.typescript || fs45.existsSync(path61.join(projectDir, "tsconfig.json"));
|
|
70882
70936
|
if (hasTSMarkers) {
|
|
70883
70937
|
return { command: ["npx", "tsc", "--noEmit"], language: "typescript" };
|
|
70884
70938
|
}
|
|
@@ -70886,13 +70940,13 @@ function detectTypecheckCommand(projectDir) {
|
|
|
70886
70940
|
return null;
|
|
70887
70941
|
}
|
|
70888
70942
|
}
|
|
70889
|
-
if (fs45.existsSync(
|
|
70943
|
+
if (fs45.existsSync(path61.join(projectDir, "go.mod"))) {
|
|
70890
70944
|
return { command: ["go", "vet", "./..."], language: "go" };
|
|
70891
70945
|
}
|
|
70892
|
-
if (fs45.existsSync(
|
|
70946
|
+
if (fs45.existsSync(path61.join(projectDir, "Cargo.toml"))) {
|
|
70893
70947
|
return { command: ["cargo", "check"], language: "rust" };
|
|
70894
70948
|
}
|
|
70895
|
-
if (fs45.existsSync(
|
|
70949
|
+
if (fs45.existsSync(path61.join(projectDir, "pyproject.toml")) || fs45.existsSync(path61.join(projectDir, "requirements.txt")) || fs45.existsSync(path61.join(projectDir, "setup.py"))) {
|
|
70896
70950
|
return { command: null, language: "python" };
|
|
70897
70951
|
}
|
|
70898
70952
|
try {
|
|
@@ -71242,7 +71296,7 @@ init_scope_persistence();
|
|
|
71242
71296
|
init_state();
|
|
71243
71297
|
init_delegation_gate();
|
|
71244
71298
|
init_normalize_tool_name();
|
|
71245
|
-
import * as
|
|
71299
|
+
import * as path63 from "node:path";
|
|
71246
71300
|
var WRITE_TOOLS = new Set(WRITE_TOOL_NAMES);
|
|
71247
71301
|
function createScopeGuardHook(config3, directory, injectAdvisory) {
|
|
71248
71302
|
const enabled = config3.enabled ?? true;
|
|
@@ -71300,13 +71354,13 @@ function createScopeGuardHook(config3, directory, injectAdvisory) {
|
|
|
71300
71354
|
}
|
|
71301
71355
|
function isFileInScope(filePath, scopeEntries, directory) {
|
|
71302
71356
|
const dir = directory ?? process.cwd();
|
|
71303
|
-
const resolvedFile =
|
|
71357
|
+
const resolvedFile = path63.resolve(dir, filePath);
|
|
71304
71358
|
return scopeEntries.some((scope) => {
|
|
71305
|
-
const resolvedScope =
|
|
71359
|
+
const resolvedScope = path63.resolve(dir, scope);
|
|
71306
71360
|
if (resolvedFile === resolvedScope)
|
|
71307
71361
|
return true;
|
|
71308
|
-
const rel =
|
|
71309
|
-
return rel.length > 0 && !rel.startsWith("..") && !
|
|
71362
|
+
const rel = path63.relative(resolvedScope, resolvedFile);
|
|
71363
|
+
return rel.length > 0 && !rel.startsWith("..") && !path63.isAbsolute(rel);
|
|
71310
71364
|
});
|
|
71311
71365
|
}
|
|
71312
71366
|
|
|
@@ -71358,7 +71412,7 @@ function createSelfReviewHook(config3, injectAdvisory) {
|
|
|
71358
71412
|
|
|
71359
71413
|
// src/hooks/slop-detector.ts
|
|
71360
71414
|
import * as fs47 from "node:fs";
|
|
71361
|
-
import * as
|
|
71415
|
+
import * as path64 from "node:path";
|
|
71362
71416
|
var WRITE_EDIT_TOOLS = new Set([
|
|
71363
71417
|
"write",
|
|
71364
71418
|
"edit",
|
|
@@ -71408,7 +71462,7 @@ function walkFiles(dir, exts, deadline) {
|
|
|
71408
71462
|
break;
|
|
71409
71463
|
if (entry.isSymbolicLink())
|
|
71410
71464
|
continue;
|
|
71411
|
-
const full =
|
|
71465
|
+
const full = path64.join(dir, entry.name);
|
|
71412
71466
|
if (entry.isDirectory()) {
|
|
71413
71467
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
71414
71468
|
continue;
|
|
@@ -71423,7 +71477,7 @@ function walkFiles(dir, exts, deadline) {
|
|
|
71423
71477
|
return results;
|
|
71424
71478
|
}
|
|
71425
71479
|
function checkDeadExports(content, projectDir, startTime) {
|
|
71426
|
-
const hasPackageJson = fs47.existsSync(
|
|
71480
|
+
const hasPackageJson = fs47.existsSync(path64.join(projectDir, "package.json"));
|
|
71427
71481
|
if (!hasPackageJson)
|
|
71428
71482
|
return null;
|
|
71429
71483
|
const exportMatches = content.matchAll(/^\+(?:export)\s+(?:function|class|const|type|interface)\s+(\w{3,})/gm);
|
|
@@ -71631,14 +71685,14 @@ function createSteeringConsumedHook(directory) {
|
|
|
71631
71685
|
// src/hooks/trajectory-logger.ts
|
|
71632
71686
|
init_manager2();
|
|
71633
71687
|
import * as fs50 from "node:fs/promises";
|
|
71634
|
-
import * as
|
|
71688
|
+
import * as path66 from "node:path";
|
|
71635
71689
|
|
|
71636
71690
|
// src/prm/trajectory-store.ts
|
|
71637
71691
|
init_utils2();
|
|
71638
71692
|
import * as fs49 from "node:fs/promises";
|
|
71639
|
-
import * as
|
|
71693
|
+
import * as path65 from "node:path";
|
|
71640
71694
|
function getTrajectoryPath(sessionId, directory) {
|
|
71641
|
-
const relativePath =
|
|
71695
|
+
const relativePath = path65.join("trajectories", `${sessionId}.jsonl`);
|
|
71642
71696
|
return validateSwarmPath(directory, relativePath);
|
|
71643
71697
|
}
|
|
71644
71698
|
var _inMemoryTrajectoryCache = new Map;
|
|
@@ -71657,7 +71711,7 @@ async function appendTrajectoryEntry(sessionId, entry, directory, maxLines = 100
|
|
|
71657
71711
|
_inMemoryTrajectoryCache.set(sessionId, cached3);
|
|
71658
71712
|
}
|
|
71659
71713
|
const trajectoryPath = getTrajectoryPath(sessionId, directory);
|
|
71660
|
-
await fs49.mkdir(
|
|
71714
|
+
await fs49.mkdir(path65.dirname(trajectoryPath), { recursive: true });
|
|
71661
71715
|
const line = `${JSON.stringify(entry)}
|
|
71662
71716
|
`;
|
|
71663
71717
|
await fs49.appendFile(trajectoryPath, line, "utf-8");
|
|
@@ -71696,7 +71750,7 @@ async function cleanupOldTrajectoryFiles(directory, maxAgeDays = 7) {
|
|
|
71696
71750
|
for (const entry of entries) {
|
|
71697
71751
|
if (!entry.isFile())
|
|
71698
71752
|
continue;
|
|
71699
|
-
const filePath =
|
|
71753
|
+
const filePath = path65.join(dirPath, entry.name);
|
|
71700
71754
|
try {
|
|
71701
71755
|
const stat4 = await fs49.stat(filePath);
|
|
71702
71756
|
if (now - stat4.mtimeMs > cutoffMs) {
|
|
@@ -71888,10 +71942,10 @@ function createTrajectoryLoggerHook(config3, _directory) {
|
|
|
71888
71942
|
elapsed_ms
|
|
71889
71943
|
};
|
|
71890
71944
|
const sanitized = sanitizeTaskId2(taskId);
|
|
71891
|
-
const relativePath =
|
|
71945
|
+
const relativePath = path66.join("evidence", sanitized, "trajectory.jsonl");
|
|
71892
71946
|
const trajectoryPath = validateSwarmPath(_directory, relativePath);
|
|
71893
71947
|
try {
|
|
71894
|
-
await fs50.mkdir(
|
|
71948
|
+
await fs50.mkdir(path66.dirname(trajectoryPath), { recursive: true });
|
|
71895
71949
|
const line = `${JSON.stringify(entry)}
|
|
71896
71950
|
`;
|
|
71897
71951
|
await fs50.appendFile(trajectoryPath, line, "utf-8");
|
|
@@ -72442,16 +72496,16 @@ init_telemetry();
|
|
|
72442
72496
|
|
|
72443
72497
|
// src/prm/replay.ts
|
|
72444
72498
|
import { promises as fs51 } from "node:fs";
|
|
72445
|
-
import
|
|
72499
|
+
import path67 from "node:path";
|
|
72446
72500
|
function isPathSafe2(targetPath, basePath) {
|
|
72447
|
-
const resolvedTarget =
|
|
72448
|
-
const resolvedBase =
|
|
72449
|
-
const rel =
|
|
72450
|
-
return !rel.startsWith("..") && !
|
|
72501
|
+
const resolvedTarget = path67.resolve(targetPath);
|
|
72502
|
+
const resolvedBase = path67.resolve(basePath);
|
|
72503
|
+
const rel = path67.relative(resolvedBase, resolvedTarget);
|
|
72504
|
+
return !rel.startsWith("..") && !path67.isAbsolute(rel);
|
|
72451
72505
|
}
|
|
72452
72506
|
function isWithinReplaysDir(targetPath) {
|
|
72453
|
-
const resolved =
|
|
72454
|
-
const parts2 = resolved.split(
|
|
72507
|
+
const resolved = path67.resolve(targetPath);
|
|
72508
|
+
const parts2 = resolved.split(path67.sep);
|
|
72455
72509
|
for (let i2 = 0;i2 < parts2.length - 1; i2++) {
|
|
72456
72510
|
if (parts2[i2] === ".swarm" && parts2[i2 + 1] === "replays") {
|
|
72457
72511
|
return true;
|
|
@@ -72464,10 +72518,10 @@ function sanitizeFilename(input) {
|
|
|
72464
72518
|
}
|
|
72465
72519
|
async function startReplayRecording(sessionID, directory) {
|
|
72466
72520
|
try {
|
|
72467
|
-
const replayDir =
|
|
72521
|
+
const replayDir = path67.join(directory, ".swarm", "replays");
|
|
72468
72522
|
const safeSessionID = sanitizeFilename(sessionID);
|
|
72469
72523
|
const filename = `${safeSessionID}-${Date.now()}.jsonl`;
|
|
72470
|
-
const filepath =
|
|
72524
|
+
const filepath = path67.join(replayDir, filename);
|
|
72471
72525
|
if (!isPathSafe2(filepath, replayDir)) {
|
|
72472
72526
|
console.warn(`[replay] Invalid path detected - path traversal attempt blocked for session ${sessionID}`);
|
|
72473
72527
|
return null;
|
|
@@ -72833,7 +72887,7 @@ init_telemetry();
|
|
|
72833
72887
|
init_dist();
|
|
72834
72888
|
init_create_tool();
|
|
72835
72889
|
import * as fs52 from "node:fs";
|
|
72836
|
-
import * as
|
|
72890
|
+
import * as path68 from "node:path";
|
|
72837
72891
|
init_path_security();
|
|
72838
72892
|
var WINDOWS_RESERVED_NAMES2 = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|:|$)/i;
|
|
72839
72893
|
function containsWindowsAttacks2(str) {
|
|
@@ -72850,14 +72904,14 @@ function containsWindowsAttacks2(str) {
|
|
|
72850
72904
|
}
|
|
72851
72905
|
function isPathInWorkspace2(filePath, workspace) {
|
|
72852
72906
|
try {
|
|
72853
|
-
const resolvedPath =
|
|
72907
|
+
const resolvedPath = path68.resolve(workspace, filePath);
|
|
72854
72908
|
if (!fs52.existsSync(resolvedPath)) {
|
|
72855
72909
|
return true;
|
|
72856
72910
|
}
|
|
72857
72911
|
const realWorkspace = fs52.realpathSync(workspace);
|
|
72858
72912
|
const realResolvedPath = fs52.realpathSync(resolvedPath);
|
|
72859
|
-
const relativePath =
|
|
72860
|
-
if (relativePath.startsWith("..") ||
|
|
72913
|
+
const relativePath = path68.relative(realWorkspace, realResolvedPath);
|
|
72914
|
+
if (relativePath.startsWith("..") || path68.isAbsolute(relativePath)) {
|
|
72861
72915
|
return false;
|
|
72862
72916
|
}
|
|
72863
72917
|
return true;
|
|
@@ -72866,7 +72920,7 @@ function isPathInWorkspace2(filePath, workspace) {
|
|
|
72866
72920
|
}
|
|
72867
72921
|
}
|
|
72868
72922
|
function processFile2(file3, cwd, exportedOnly) {
|
|
72869
|
-
const ext =
|
|
72923
|
+
const ext = path68.extname(file3);
|
|
72870
72924
|
if (containsControlChars(file3)) {
|
|
72871
72925
|
return {
|
|
72872
72926
|
file: file3,
|
|
@@ -72899,7 +72953,7 @@ function processFile2(file3, cwd, exportedOnly) {
|
|
|
72899
72953
|
errorType: "path-outside-workspace"
|
|
72900
72954
|
};
|
|
72901
72955
|
}
|
|
72902
|
-
const fullPath =
|
|
72956
|
+
const fullPath = path68.join(cwd, file3);
|
|
72903
72957
|
if (!fs52.existsSync(fullPath)) {
|
|
72904
72958
|
return {
|
|
72905
72959
|
file: file3,
|
|
@@ -73191,15 +73245,15 @@ init_task_id();
|
|
|
73191
73245
|
init_create_tool();
|
|
73192
73246
|
init_resolve_working_directory();
|
|
73193
73247
|
import * as fs53 from "node:fs";
|
|
73194
|
-
import * as
|
|
73248
|
+
import * as path69 from "node:path";
|
|
73195
73249
|
var EVIDENCE_DIR = ".swarm/evidence";
|
|
73196
73250
|
function isValidTaskId3(taskId) {
|
|
73197
73251
|
return isStrictTaskId(taskId);
|
|
73198
73252
|
}
|
|
73199
73253
|
function isPathWithinSwarm(filePath, workspaceRoot) {
|
|
73200
|
-
const normalizedWorkspace =
|
|
73201
|
-
const swarmPath =
|
|
73202
|
-
const normalizedPath =
|
|
73254
|
+
const normalizedWorkspace = path69.resolve(workspaceRoot);
|
|
73255
|
+
const swarmPath = path69.join(normalizedWorkspace, ".swarm", "evidence");
|
|
73256
|
+
const normalizedPath = path69.resolve(filePath);
|
|
73203
73257
|
return normalizedPath.startsWith(swarmPath);
|
|
73204
73258
|
}
|
|
73205
73259
|
function readEvidenceFile(evidencePath) {
|
|
@@ -73280,7 +73334,7 @@ var check_gate_status = createSwarmTool({
|
|
|
73280
73334
|
};
|
|
73281
73335
|
return JSON.stringify(errorResult, null, 2);
|
|
73282
73336
|
}
|
|
73283
|
-
const evidencePath =
|
|
73337
|
+
const evidencePath = path69.join(directory, EVIDENCE_DIR, `${taskIdInput}.json`);
|
|
73284
73338
|
if (!isPathWithinSwarm(evidencePath, directory)) {
|
|
73285
73339
|
const errorResult = {
|
|
73286
73340
|
taskId: taskIdInput,
|
|
@@ -73377,7 +73431,7 @@ init_state();
|
|
|
73377
73431
|
init_create_tool();
|
|
73378
73432
|
init_resolve_working_directory();
|
|
73379
73433
|
import * as fs54 from "node:fs";
|
|
73380
|
-
import * as
|
|
73434
|
+
import * as path70 from "node:path";
|
|
73381
73435
|
function extractMatches(regex, text) {
|
|
73382
73436
|
return Array.from(text.matchAll(regex));
|
|
73383
73437
|
}
|
|
@@ -73529,10 +73583,10 @@ async function executeCompletionVerify(args2, directory) {
|
|
|
73529
73583
|
let hasFileReadFailure = false;
|
|
73530
73584
|
for (const filePath of fileTargets) {
|
|
73531
73585
|
const normalizedPath = filePath.replace(/\\/g, "/");
|
|
73532
|
-
const resolvedPath =
|
|
73533
|
-
const projectRoot =
|
|
73534
|
-
const relative16 =
|
|
73535
|
-
const withinProject = relative16 === "" || !relative16.startsWith("..") && !
|
|
73586
|
+
const resolvedPath = path70.resolve(directory, normalizedPath);
|
|
73587
|
+
const projectRoot = path70.resolve(directory);
|
|
73588
|
+
const relative16 = path70.relative(projectRoot, resolvedPath);
|
|
73589
|
+
const withinProject = relative16 === "" || !relative16.startsWith("..") && !path70.isAbsolute(relative16);
|
|
73536
73590
|
if (!withinProject) {
|
|
73537
73591
|
blockedTasks.push({
|
|
73538
73592
|
task_id: task.id,
|
|
@@ -73587,8 +73641,8 @@ async function executeCompletionVerify(args2, directory) {
|
|
|
73587
73641
|
blockedTasks
|
|
73588
73642
|
};
|
|
73589
73643
|
try {
|
|
73590
|
-
const evidenceDir =
|
|
73591
|
-
const evidencePath =
|
|
73644
|
+
const evidenceDir = path70.join(directory, ".swarm", "evidence", `${phase}`);
|
|
73645
|
+
const evidencePath = path70.join(evidenceDir, "completion-verify.json");
|
|
73592
73646
|
fs54.mkdirSync(evidenceDir, { recursive: true });
|
|
73593
73647
|
const evidenceBundle = {
|
|
73594
73648
|
schema_version: "1.0.0",
|
|
@@ -73665,11 +73719,11 @@ var completion_verify = createSwarmTool({
|
|
|
73665
73719
|
// src/tools/complexity-hotspots.ts
|
|
73666
73720
|
init_zod();
|
|
73667
73721
|
import * as fs56 from "node:fs";
|
|
73668
|
-
import * as
|
|
73722
|
+
import * as path72 from "node:path";
|
|
73669
73723
|
|
|
73670
73724
|
// src/quality/metrics.ts
|
|
73671
73725
|
import * as fs55 from "node:fs";
|
|
73672
|
-
import * as
|
|
73726
|
+
import * as path71 from "node:path";
|
|
73673
73727
|
var MAX_FILE_SIZE_BYTES4 = 256 * 1024;
|
|
73674
73728
|
var MIN_DUPLICATION_LINES = 10;
|
|
73675
73729
|
function estimateCyclomaticComplexity(content) {
|
|
@@ -73721,7 +73775,7 @@ async function computeComplexityDelta(files, workingDir) {
|
|
|
73721
73775
|
let totalComplexity = 0;
|
|
73722
73776
|
const analyzedFiles = [];
|
|
73723
73777
|
for (const file3 of files) {
|
|
73724
|
-
const fullPath =
|
|
73778
|
+
const fullPath = path71.isAbsolute(file3) ? file3 : path71.join(workingDir, file3);
|
|
73725
73779
|
if (!fs55.existsSync(fullPath)) {
|
|
73726
73780
|
continue;
|
|
73727
73781
|
}
|
|
@@ -73844,7 +73898,7 @@ function countGoExports(content) {
|
|
|
73844
73898
|
function getExportCountForFile(filePath) {
|
|
73845
73899
|
try {
|
|
73846
73900
|
const content = fs55.readFileSync(filePath, "utf-8");
|
|
73847
|
-
const ext =
|
|
73901
|
+
const ext = path71.extname(filePath).toLowerCase();
|
|
73848
73902
|
switch (ext) {
|
|
73849
73903
|
case ".ts":
|
|
73850
73904
|
case ".tsx":
|
|
@@ -73870,7 +73924,7 @@ async function computePublicApiDelta(files, workingDir) {
|
|
|
73870
73924
|
let totalExports = 0;
|
|
73871
73925
|
const analyzedFiles = [];
|
|
73872
73926
|
for (const file3 of files) {
|
|
73873
|
-
const fullPath =
|
|
73927
|
+
const fullPath = path71.isAbsolute(file3) ? file3 : path71.join(workingDir, file3);
|
|
73874
73928
|
if (!fs55.existsSync(fullPath)) {
|
|
73875
73929
|
continue;
|
|
73876
73930
|
}
|
|
@@ -73904,7 +73958,7 @@ async function computeDuplicationRatio(files, workingDir) {
|
|
|
73904
73958
|
let duplicateLines = 0;
|
|
73905
73959
|
const analyzedFiles = [];
|
|
73906
73960
|
for (const file3 of files) {
|
|
73907
|
-
const fullPath =
|
|
73961
|
+
const fullPath = path71.isAbsolute(file3) ? file3 : path71.join(workingDir, file3);
|
|
73908
73962
|
if (!fs55.existsSync(fullPath)) {
|
|
73909
73963
|
continue;
|
|
73910
73964
|
}
|
|
@@ -73937,8 +73991,8 @@ function countCodeLines(content) {
|
|
|
73937
73991
|
return lines.length;
|
|
73938
73992
|
}
|
|
73939
73993
|
function isTestFile(filePath) {
|
|
73940
|
-
const basename10 =
|
|
73941
|
-
const _ext =
|
|
73994
|
+
const basename10 = path71.basename(filePath);
|
|
73995
|
+
const _ext = path71.extname(filePath).toLowerCase();
|
|
73942
73996
|
const testPatterns = [
|
|
73943
73997
|
".test.",
|
|
73944
73998
|
".spec.",
|
|
@@ -74019,8 +74073,8 @@ function matchGlobSegment(globSegments, pathSegments) {
|
|
|
74019
74073
|
}
|
|
74020
74074
|
return gIndex === globSegments.length && pIndex === pathSegments.length;
|
|
74021
74075
|
}
|
|
74022
|
-
function matchesGlobSegment(
|
|
74023
|
-
const normalizedPath =
|
|
74076
|
+
function matchesGlobSegment(path72, glob) {
|
|
74077
|
+
const normalizedPath = path72.replace(/\\/g, "/");
|
|
74024
74078
|
const normalizedGlob = glob.replace(/\\/g, "/");
|
|
74025
74079
|
if (normalizedPath.includes("//")) {
|
|
74026
74080
|
return false;
|
|
@@ -74051,8 +74105,8 @@ function simpleGlobToRegex2(glob) {
|
|
|
74051
74105
|
function hasGlobstar(glob) {
|
|
74052
74106
|
return glob.includes("**");
|
|
74053
74107
|
}
|
|
74054
|
-
function globMatches(
|
|
74055
|
-
const normalizedPath =
|
|
74108
|
+
function globMatches(path72, glob) {
|
|
74109
|
+
const normalizedPath = path72.replace(/\\/g, "/");
|
|
74056
74110
|
if (!glob || glob === "") {
|
|
74057
74111
|
if (normalizedPath.includes("//")) {
|
|
74058
74112
|
return false;
|
|
@@ -74088,7 +74142,7 @@ function shouldExcludeFile(filePath, excludeGlobs) {
|
|
|
74088
74142
|
async function computeTestToCodeRatio(workingDir, enforceGlobs, excludeGlobs) {
|
|
74089
74143
|
let testLines = 0;
|
|
74090
74144
|
let codeLines = 0;
|
|
74091
|
-
const srcDir =
|
|
74145
|
+
const srcDir = path71.join(workingDir, "src");
|
|
74092
74146
|
if (fs55.existsSync(srcDir)) {
|
|
74093
74147
|
await scanDirectoryForLines(srcDir, enforceGlobs, excludeGlobs, false, (lines) => {
|
|
74094
74148
|
codeLines += lines;
|
|
@@ -74096,14 +74150,14 @@ async function computeTestToCodeRatio(workingDir, enforceGlobs, excludeGlobs) {
|
|
|
74096
74150
|
}
|
|
74097
74151
|
const possibleSrcDirs = ["lib", "app", "source", "core"];
|
|
74098
74152
|
for (const dir of possibleSrcDirs) {
|
|
74099
|
-
const dirPath =
|
|
74153
|
+
const dirPath = path71.join(workingDir, dir);
|
|
74100
74154
|
if (fs55.existsSync(dirPath)) {
|
|
74101
74155
|
await scanDirectoryForLines(dirPath, enforceGlobs, excludeGlobs, false, (lines) => {
|
|
74102
74156
|
codeLines += lines;
|
|
74103
74157
|
});
|
|
74104
74158
|
}
|
|
74105
74159
|
}
|
|
74106
|
-
const testsDir =
|
|
74160
|
+
const testsDir = path71.join(workingDir, "tests");
|
|
74107
74161
|
if (fs55.existsSync(testsDir)) {
|
|
74108
74162
|
await scanDirectoryForLines(testsDir, ["**"], ["node_modules", "dist"], true, (lines) => {
|
|
74109
74163
|
testLines += lines;
|
|
@@ -74111,7 +74165,7 @@ async function computeTestToCodeRatio(workingDir, enforceGlobs, excludeGlobs) {
|
|
|
74111
74165
|
}
|
|
74112
74166
|
const possibleTestDirs = ["test", "__tests__", "specs"];
|
|
74113
74167
|
for (const dir of possibleTestDirs) {
|
|
74114
|
-
const dirPath =
|
|
74168
|
+
const dirPath = path71.join(workingDir, dir);
|
|
74115
74169
|
if (fs55.existsSync(dirPath) && dirPath !== testsDir) {
|
|
74116
74170
|
await scanDirectoryForLines(dirPath, ["**"], ["node_modules", "dist"], true, (lines) => {
|
|
74117
74171
|
testLines += lines;
|
|
@@ -74126,7 +74180,7 @@ async function scanDirectoryForLines(dirPath, includeGlobs, excludeGlobs, isTest
|
|
|
74126
74180
|
try {
|
|
74127
74181
|
const entries = fs55.readdirSync(dirPath, { withFileTypes: true });
|
|
74128
74182
|
for (const entry of entries) {
|
|
74129
|
-
const fullPath =
|
|
74183
|
+
const fullPath = path71.join(dirPath, entry.name);
|
|
74130
74184
|
if (entry.isDirectory()) {
|
|
74131
74185
|
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === "build" || entry.name === ".git") {
|
|
74132
74186
|
continue;
|
|
@@ -74134,7 +74188,7 @@ async function scanDirectoryForLines(dirPath, includeGlobs, excludeGlobs, isTest
|
|
|
74134
74188
|
await scanDirectoryForLines(fullPath, includeGlobs, excludeGlobs, isTestScan, callback);
|
|
74135
74189
|
} else if (entry.isFile()) {
|
|
74136
74190
|
const relativePath = fullPath.replace(`${dirPath}/`, "");
|
|
74137
|
-
const ext =
|
|
74191
|
+
const ext = path71.extname(entry.name).toLowerCase();
|
|
74138
74192
|
const validExts = [
|
|
74139
74193
|
".ts",
|
|
74140
74194
|
".tsx",
|
|
@@ -74387,7 +74441,7 @@ async function analyzeHotspots(days, topN, extensions, directory) {
|
|
|
74387
74441
|
const extSet = new Set(extensions.map((e) => e.startsWith(".") ? e : `.${e}`));
|
|
74388
74442
|
const filteredChurn = new Map;
|
|
74389
74443
|
for (const [file3, count] of churnMap) {
|
|
74390
|
-
const ext =
|
|
74444
|
+
const ext = path72.extname(file3).toLowerCase();
|
|
74391
74445
|
if (extSet.has(ext)) {
|
|
74392
74446
|
filteredChurn.set(file3, count);
|
|
74393
74447
|
}
|
|
@@ -74398,7 +74452,7 @@ async function analyzeHotspots(days, topN, extensions, directory) {
|
|
|
74398
74452
|
for (const [file3, churnCount] of filteredChurn) {
|
|
74399
74453
|
let fullPath = file3;
|
|
74400
74454
|
if (!fs56.existsSync(fullPath)) {
|
|
74401
|
-
fullPath =
|
|
74455
|
+
fullPath = path72.join(cwd, file3);
|
|
74402
74456
|
}
|
|
74403
74457
|
const complexity = getComplexityForFile2(fullPath);
|
|
74404
74458
|
if (complexity !== null) {
|
|
@@ -74572,7 +74626,7 @@ import {
|
|
|
74572
74626
|
readFileSync as readFileSync36,
|
|
74573
74627
|
writeFileSync as writeFileSync11
|
|
74574
74628
|
} from "node:fs";
|
|
74575
|
-
import { join as
|
|
74629
|
+
import { join as join65 } from "node:path";
|
|
74576
74630
|
var EVIDENCE_DIR2 = ".swarm/evidence";
|
|
74577
74631
|
var VALID_TASK_ID = /^\d+\.\d+(\.\d+)*$/;
|
|
74578
74632
|
var COUNCIL_GATE_NAME = "council";
|
|
@@ -74606,9 +74660,9 @@ function writeCouncilEvidence(workingDir, synthesis) {
|
|
|
74606
74660
|
if (!VALID_TASK_ID.test(synthesis.taskId)) {
|
|
74607
74661
|
throw new Error(`writeCouncilEvidence: invalid taskId "${synthesis.taskId}" — must match N.M or N.M.P format`);
|
|
74608
74662
|
}
|
|
74609
|
-
const dir =
|
|
74663
|
+
const dir = join65(workingDir, EVIDENCE_DIR2);
|
|
74610
74664
|
mkdirSync18(dir, { recursive: true });
|
|
74611
|
-
const filePath =
|
|
74665
|
+
const filePath = join65(dir, `${synthesis.taskId}.json`);
|
|
74612
74666
|
const existingRoot = Object.create(null);
|
|
74613
74667
|
if (existsSync37(filePath)) {
|
|
74614
74668
|
try {
|
|
@@ -74642,7 +74696,7 @@ function writeCouncilEvidence(workingDir, synthesis) {
|
|
|
74642
74696
|
updated.required_gates = [];
|
|
74643
74697
|
writeFileSync11(filePath, JSON.stringify(updated, null, 2));
|
|
74644
74698
|
try {
|
|
74645
|
-
const councilDir =
|
|
74699
|
+
const councilDir = join65(workingDir, ".swarm", "council");
|
|
74646
74700
|
mkdirSync18(councilDir, { recursive: true });
|
|
74647
74701
|
const auditLine = JSON.stringify({
|
|
74648
74702
|
round: synthesis.roundNumber,
|
|
@@ -74650,7 +74704,7 @@ function writeCouncilEvidence(workingDir, synthesis) {
|
|
|
74650
74704
|
timestamp: synthesis.timestamp,
|
|
74651
74705
|
vetoedBy: synthesis.vetoedBy
|
|
74652
74706
|
});
|
|
74653
|
-
appendFileSync6(
|
|
74707
|
+
appendFileSync6(join65(councilDir, `${synthesis.taskId}.rounds.jsonl`), `${auditLine}
|
|
74654
74708
|
`);
|
|
74655
74709
|
} catch (auditError) {
|
|
74656
74710
|
console.warn(`writeCouncilEvidence: failed to append round-history audit log: ${auditError instanceof Error ? auditError.message : String(auditError)}`);
|
|
@@ -74783,20 +74837,20 @@ function buildUnifiedFeedback(taskId, verdict, vetoedBy, requiredFixes, advisory
|
|
|
74783
74837
|
|
|
74784
74838
|
// src/council/criteria-store.ts
|
|
74785
74839
|
import { existsSync as existsSync38, mkdirSync as mkdirSync19, readFileSync as readFileSync37, writeFileSync as writeFileSync12 } from "node:fs";
|
|
74786
|
-
import { join as
|
|
74840
|
+
import { join as join66 } from "node:path";
|
|
74787
74841
|
var COUNCIL_DIR = ".swarm/council";
|
|
74788
74842
|
function writeCriteria(workingDir, taskId, criteria) {
|
|
74789
|
-
const dir =
|
|
74843
|
+
const dir = join66(workingDir, COUNCIL_DIR);
|
|
74790
74844
|
mkdirSync19(dir, { recursive: true });
|
|
74791
74845
|
const payload = {
|
|
74792
74846
|
taskId,
|
|
74793
74847
|
criteria,
|
|
74794
74848
|
declaredAt: new Date().toISOString()
|
|
74795
74849
|
};
|
|
74796
|
-
writeFileSync12(
|
|
74850
|
+
writeFileSync12(join66(dir, `${safeId(taskId)}.json`), JSON.stringify(payload, null, 2));
|
|
74797
74851
|
}
|
|
74798
74852
|
function readCriteria(workingDir, taskId) {
|
|
74799
|
-
const filePath =
|
|
74853
|
+
const filePath = join66(workingDir, COUNCIL_DIR, `${safeId(taskId)}.json`);
|
|
74800
74854
|
if (!existsSync38(filePath))
|
|
74801
74855
|
return null;
|
|
74802
74856
|
try {
|
|
@@ -74949,7 +75003,7 @@ var submit_council_verdicts = createSwarmTool({
|
|
|
74949
75003
|
init_zod();
|
|
74950
75004
|
init_loader();
|
|
74951
75005
|
import * as fs57 from "node:fs";
|
|
74952
|
-
import * as
|
|
75006
|
+
import * as path73 from "node:path";
|
|
74953
75007
|
|
|
74954
75008
|
// src/council/general-council-advisory.ts
|
|
74955
75009
|
var ADVISORY_HEADER = "[general_council] (advisory; not blocking)";
|
|
@@ -75397,10 +75451,10 @@ var convene_general_council = createSwarmTool({
|
|
|
75397
75451
|
const round1 = input.round1Responses;
|
|
75398
75452
|
const round2 = input.round2Responses ?? [];
|
|
75399
75453
|
const result = synthesizeGeneralCouncil(input.question, input.mode, round1, round2);
|
|
75400
|
-
const evidenceDir =
|
|
75454
|
+
const evidenceDir = path73.join(workingDir, ".swarm", "council", "general");
|
|
75401
75455
|
const safeTimestamp = result.timestamp.replace(/[:.]/g, "-");
|
|
75402
75456
|
const evidenceFile = `${safeTimestamp}-${input.mode}.json`;
|
|
75403
|
-
const evidencePath =
|
|
75457
|
+
const evidencePath = path73.join(evidenceDir, evidenceFile);
|
|
75404
75458
|
try {
|
|
75405
75459
|
await fs57.promises.mkdir(evidenceDir, { recursive: true });
|
|
75406
75460
|
await fs57.promises.writeFile(evidencePath, JSON.stringify(result, null, 2));
|
|
@@ -75637,7 +75691,7 @@ init_state();
|
|
|
75637
75691
|
init_task_id();
|
|
75638
75692
|
init_create_tool();
|
|
75639
75693
|
import * as fs58 from "node:fs";
|
|
75640
|
-
import * as
|
|
75694
|
+
import * as path74 from "node:path";
|
|
75641
75695
|
function validateTaskIdFormat2(taskId) {
|
|
75642
75696
|
return validateTaskIdFormat(taskId);
|
|
75643
75697
|
}
|
|
@@ -75711,8 +75765,8 @@ async function executeDeclareScope(args2, fallbackDir) {
|
|
|
75711
75765
|
};
|
|
75712
75766
|
}
|
|
75713
75767
|
}
|
|
75714
|
-
normalizedDir =
|
|
75715
|
-
const pathParts = normalizedDir.split(
|
|
75768
|
+
normalizedDir = path74.normalize(args2.working_directory);
|
|
75769
|
+
const pathParts = normalizedDir.split(path74.sep);
|
|
75716
75770
|
if (pathParts.includes("..")) {
|
|
75717
75771
|
return {
|
|
75718
75772
|
success: false,
|
|
@@ -75722,10 +75776,10 @@ async function executeDeclareScope(args2, fallbackDir) {
|
|
|
75722
75776
|
]
|
|
75723
75777
|
};
|
|
75724
75778
|
}
|
|
75725
|
-
const resolvedDir =
|
|
75779
|
+
const resolvedDir = path74.resolve(normalizedDir);
|
|
75726
75780
|
try {
|
|
75727
75781
|
const realPath = fs58.realpathSync(resolvedDir);
|
|
75728
|
-
const planPath2 =
|
|
75782
|
+
const planPath2 = path74.join(realPath, ".swarm", "plan.json");
|
|
75729
75783
|
if (!fs58.existsSync(planPath2)) {
|
|
75730
75784
|
return {
|
|
75731
75785
|
success: false,
|
|
@@ -75749,7 +75803,7 @@ async function executeDeclareScope(args2, fallbackDir) {
|
|
|
75749
75803
|
console.warn("[declare-scope] fallbackDir is undefined, falling back to process.cwd()");
|
|
75750
75804
|
}
|
|
75751
75805
|
const directory = normalizedDir || fallbackDir;
|
|
75752
|
-
const planPath =
|
|
75806
|
+
const planPath = path74.resolve(directory, ".swarm", "plan.json");
|
|
75753
75807
|
if (!fs58.existsSync(planPath)) {
|
|
75754
75808
|
return {
|
|
75755
75809
|
success: false,
|
|
@@ -75789,8 +75843,8 @@ async function executeDeclareScope(args2, fallbackDir) {
|
|
|
75789
75843
|
const normalizeErrors = [];
|
|
75790
75844
|
const dir = normalizedDir || fallbackDir || process.cwd();
|
|
75791
75845
|
const mergedFiles = rawMergedFiles.map((file3) => {
|
|
75792
|
-
if (
|
|
75793
|
-
const relativePath =
|
|
75846
|
+
if (path74.isAbsolute(file3)) {
|
|
75847
|
+
const relativePath = path74.relative(dir, file3).replace(/\\/g, "/");
|
|
75794
75848
|
if (relativePath.startsWith("..")) {
|
|
75795
75849
|
normalizeErrors.push(`Path '${file3}' resolves outside the project directory`);
|
|
75796
75850
|
return file3;
|
|
@@ -75851,7 +75905,7 @@ var declare_scope = createSwarmTool({
|
|
|
75851
75905
|
init_zod();
|
|
75852
75906
|
import * as child_process7 from "node:child_process";
|
|
75853
75907
|
import * as fs59 from "node:fs";
|
|
75854
|
-
import * as
|
|
75908
|
+
import * as path75 from "node:path";
|
|
75855
75909
|
init_create_tool();
|
|
75856
75910
|
var MAX_DIFF_LINES = 500;
|
|
75857
75911
|
var DIFF_TIMEOUT_MS = 30000;
|
|
@@ -75880,20 +75934,20 @@ function validateBase(base) {
|
|
|
75880
75934
|
function validatePaths(paths) {
|
|
75881
75935
|
if (!paths)
|
|
75882
75936
|
return null;
|
|
75883
|
-
for (const
|
|
75884
|
-
if (!
|
|
75937
|
+
for (const path76 of paths) {
|
|
75938
|
+
if (!path76 || path76.length === 0) {
|
|
75885
75939
|
return "empty path not allowed";
|
|
75886
75940
|
}
|
|
75887
|
-
if (
|
|
75941
|
+
if (path76.length > MAX_PATH_LENGTH) {
|
|
75888
75942
|
return `path exceeds maximum length of ${MAX_PATH_LENGTH}`;
|
|
75889
75943
|
}
|
|
75890
|
-
if (SHELL_METACHARACTERS2.test(
|
|
75944
|
+
if (SHELL_METACHARACTERS2.test(path76)) {
|
|
75891
75945
|
return "path contains shell metacharacters";
|
|
75892
75946
|
}
|
|
75893
|
-
if (
|
|
75947
|
+
if (path76.startsWith("-")) {
|
|
75894
75948
|
return 'path cannot start with "-" (option-like arguments not allowed)';
|
|
75895
75949
|
}
|
|
75896
|
-
if (CONTROL_CHAR_PATTERN2.test(
|
|
75950
|
+
if (CONTROL_CHAR_PATTERN2.test(path76)) {
|
|
75897
75951
|
return "path contains control characters";
|
|
75898
75952
|
}
|
|
75899
75953
|
}
|
|
@@ -75999,8 +76053,8 @@ var diff = createSwarmTool({
|
|
|
75999
76053
|
if (parts2.length >= 3) {
|
|
76000
76054
|
const additions = parseInt(parts2[0], 10) || 0;
|
|
76001
76055
|
const deletions = parseInt(parts2[1], 10) || 0;
|
|
76002
|
-
const
|
|
76003
|
-
files.push({ path:
|
|
76056
|
+
const path76 = parts2[2];
|
|
76057
|
+
files.push({ path: path76, additions, deletions });
|
|
76004
76058
|
}
|
|
76005
76059
|
}
|
|
76006
76060
|
const contractChanges = [];
|
|
@@ -76040,7 +76094,7 @@ var diff = createSwarmTool({
|
|
|
76040
76094
|
} else if (base === "unstaged") {
|
|
76041
76095
|
const oldRef = `:${file3.path}`;
|
|
76042
76096
|
oldContent = fileExistsInRef(oldRef) ? getContentFromRef(oldRef) : "";
|
|
76043
|
-
newContent = fs59.readFileSync(
|
|
76097
|
+
newContent = fs59.readFileSync(path75.join(directory, file3.path), "utf-8");
|
|
76044
76098
|
} else {
|
|
76045
76099
|
const oldRef = `${base}:${file3.path}`;
|
|
76046
76100
|
oldContent = fileExistsInRef(oldRef) ? getContentFromRef(oldRef) : "";
|
|
@@ -76115,7 +76169,7 @@ var diff = createSwarmTool({
|
|
|
76115
76169
|
init_zod();
|
|
76116
76170
|
import * as child_process8 from "node:child_process";
|
|
76117
76171
|
import * as fs60 from "node:fs";
|
|
76118
|
-
import * as
|
|
76172
|
+
import * as path76 from "node:path";
|
|
76119
76173
|
init_create_tool();
|
|
76120
76174
|
var diff_summary = createSwarmTool({
|
|
76121
76175
|
description: "Generate a filtered semantic diff summary from AST analysis. Returns SemanticDiffSummary with optional filtering by classification or riskLevel.",
|
|
@@ -76163,7 +76217,7 @@ var diff_summary = createSwarmTool({
|
|
|
76163
76217
|
}
|
|
76164
76218
|
try {
|
|
76165
76219
|
let oldContent;
|
|
76166
|
-
const newContent = fs60.readFileSync(
|
|
76220
|
+
const newContent = fs60.readFileSync(path76.join(workingDir, filePath), "utf-8");
|
|
76167
76221
|
if (fileExistsInHead) {
|
|
76168
76222
|
oldContent = child_process8.execFileSync("git", ["show", `HEAD:${filePath}`], {
|
|
76169
76223
|
encoding: "utf-8",
|
|
@@ -76392,7 +76446,7 @@ init_zod();
|
|
|
76392
76446
|
init_create_tool();
|
|
76393
76447
|
init_path_security();
|
|
76394
76448
|
import * as fs61 from "node:fs";
|
|
76395
|
-
import * as
|
|
76449
|
+
import * as path77 from "node:path";
|
|
76396
76450
|
var MAX_FILE_SIZE_BYTES6 = 1024 * 1024;
|
|
76397
76451
|
var MAX_EVIDENCE_FILES = 1000;
|
|
76398
76452
|
var EVIDENCE_DIR3 = ".swarm/evidence";
|
|
@@ -76419,9 +76473,9 @@ function validateRequiredTypes(input) {
|
|
|
76419
76473
|
return null;
|
|
76420
76474
|
}
|
|
76421
76475
|
function isPathWithinSwarm2(filePath, cwd) {
|
|
76422
|
-
const normalizedCwd =
|
|
76423
|
-
const swarmPath =
|
|
76424
|
-
const normalizedPath =
|
|
76476
|
+
const normalizedCwd = path77.resolve(cwd);
|
|
76477
|
+
const swarmPath = path77.join(normalizedCwd, ".swarm");
|
|
76478
|
+
const normalizedPath = path77.resolve(filePath);
|
|
76425
76479
|
return normalizedPath.startsWith(swarmPath);
|
|
76426
76480
|
}
|
|
76427
76481
|
function parseCompletedTasks(planContent) {
|
|
@@ -76451,10 +76505,10 @@ function readEvidenceFiles(evidenceDir, _cwd) {
|
|
|
76451
76505
|
if (!VALID_EVIDENCE_FILENAME_REGEX.test(filename)) {
|
|
76452
76506
|
continue;
|
|
76453
76507
|
}
|
|
76454
|
-
const filePath =
|
|
76508
|
+
const filePath = path77.join(evidenceDir, filename);
|
|
76455
76509
|
try {
|
|
76456
|
-
const resolvedPath =
|
|
76457
|
-
const evidenceDirResolved =
|
|
76510
|
+
const resolvedPath = path77.resolve(filePath);
|
|
76511
|
+
const evidenceDirResolved = path77.resolve(evidenceDir);
|
|
76458
76512
|
if (!resolvedPath.startsWith(evidenceDirResolved)) {
|
|
76459
76513
|
continue;
|
|
76460
76514
|
}
|
|
@@ -76572,7 +76626,7 @@ var evidence_check = createSwarmTool({
|
|
|
76572
76626
|
return JSON.stringify(errorResult, null, 2);
|
|
76573
76627
|
}
|
|
76574
76628
|
const requiredTypes = requiredTypesValue.split(",").map((t) => t.trim()).filter((t) => t.length > 0).map(normalizeEvidenceType);
|
|
76575
|
-
const planPath =
|
|
76629
|
+
const planPath = path77.join(cwd, PLAN_FILE);
|
|
76576
76630
|
if (!isPathWithinSwarm2(planPath, cwd)) {
|
|
76577
76631
|
const errorResult = {
|
|
76578
76632
|
error: "plan file path validation failed",
|
|
@@ -76604,7 +76658,7 @@ var evidence_check = createSwarmTool({
|
|
|
76604
76658
|
};
|
|
76605
76659
|
return JSON.stringify(result2, null, 2);
|
|
76606
76660
|
}
|
|
76607
|
-
const evidenceDir =
|
|
76661
|
+
const evidenceDir = path77.join(cwd, EVIDENCE_DIR3);
|
|
76608
76662
|
const evidence = readEvidenceFiles(evidenceDir, cwd);
|
|
76609
76663
|
const { tasksWithFullEvidence, gaps } = analyzeGaps(completedTasks, evidence, requiredTypes);
|
|
76610
76664
|
const completeness = completedTasks.length > 0 ? Math.round(tasksWithFullEvidence.length / completedTasks.length * 100) / 100 : 1;
|
|
@@ -76622,7 +76676,7 @@ var evidence_check = createSwarmTool({
|
|
|
76622
76676
|
init_zod();
|
|
76623
76677
|
init_create_tool();
|
|
76624
76678
|
import * as fs62 from "node:fs";
|
|
76625
|
-
import * as
|
|
76679
|
+
import * as path78 from "node:path";
|
|
76626
76680
|
var EXT_MAP = {
|
|
76627
76681
|
python: ".py",
|
|
76628
76682
|
py: ".py",
|
|
@@ -76703,12 +76757,12 @@ var extract_code_blocks = createSwarmTool({
|
|
|
76703
76757
|
if (prefix) {
|
|
76704
76758
|
filename = `${prefix}_${filename}`;
|
|
76705
76759
|
}
|
|
76706
|
-
let filepath =
|
|
76707
|
-
const base =
|
|
76708
|
-
const ext =
|
|
76760
|
+
let filepath = path78.join(targetDir, filename);
|
|
76761
|
+
const base = path78.basename(filepath, path78.extname(filepath));
|
|
76762
|
+
const ext = path78.extname(filepath);
|
|
76709
76763
|
let counter = 1;
|
|
76710
76764
|
while (fs62.existsSync(filepath)) {
|
|
76711
|
-
filepath =
|
|
76765
|
+
filepath = path78.join(targetDir, `${base}_${counter}${ext}`);
|
|
76712
76766
|
counter++;
|
|
76713
76767
|
}
|
|
76714
76768
|
try {
|
|
@@ -76972,7 +77026,7 @@ init_zod();
|
|
|
76972
77026
|
init_create_tool();
|
|
76973
77027
|
init_path_security();
|
|
76974
77028
|
import * as fs63 from "node:fs";
|
|
76975
|
-
import * as
|
|
77029
|
+
import * as path79 from "node:path";
|
|
76976
77030
|
var MAX_FILE_PATH_LENGTH2 = 500;
|
|
76977
77031
|
var MAX_SYMBOL_LENGTH = 256;
|
|
76978
77032
|
var MAX_FILE_SIZE_BYTES7 = 1024 * 1024;
|
|
@@ -77020,7 +77074,7 @@ function validateSymbolInput(symbol3) {
|
|
|
77020
77074
|
return null;
|
|
77021
77075
|
}
|
|
77022
77076
|
function isBinaryFile2(filePath, buffer) {
|
|
77023
|
-
const ext =
|
|
77077
|
+
const ext = path79.extname(filePath).toLowerCase();
|
|
77024
77078
|
if (ext === ".json" || ext === ".md" || ext === ".txt") {
|
|
77025
77079
|
return false;
|
|
77026
77080
|
}
|
|
@@ -77044,15 +77098,15 @@ function parseImports(content, targetFile, targetSymbol) {
|
|
|
77044
77098
|
const imports = [];
|
|
77045
77099
|
let _resolvedTarget;
|
|
77046
77100
|
try {
|
|
77047
|
-
_resolvedTarget =
|
|
77101
|
+
_resolvedTarget = path79.resolve(targetFile);
|
|
77048
77102
|
} catch {
|
|
77049
77103
|
_resolvedTarget = targetFile;
|
|
77050
77104
|
}
|
|
77051
|
-
const targetBasename =
|
|
77105
|
+
const targetBasename = path79.basename(targetFile, path79.extname(targetFile));
|
|
77052
77106
|
const targetWithExt = targetFile;
|
|
77053
77107
|
const targetWithoutExt = targetFile.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/i, "");
|
|
77054
|
-
const normalizedTargetWithExt =
|
|
77055
|
-
const normalizedTargetWithoutExt =
|
|
77108
|
+
const normalizedTargetWithExt = path79.normalize(targetWithExt).replace(/\\/g, "/");
|
|
77109
|
+
const normalizedTargetWithoutExt = path79.normalize(targetWithoutExt).replace(/\\/g, "/");
|
|
77056
77110
|
const importRegex = /import\s+(?:\{[\s\S]*?\}|(?:\*\s+as\s+\w+)|\w+)\s+from\s+['"`]([^'"`]+)['"`]|import\s+['"`]([^'"`]+)['"`]|require\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g;
|
|
77057
77111
|
for (let match = importRegex.exec(content);match !== null; match = importRegex.exec(content)) {
|
|
77058
77112
|
const modulePath = match[1] || match[2] || match[3];
|
|
@@ -77075,9 +77129,9 @@ function parseImports(content, targetFile, targetSymbol) {
|
|
|
77075
77129
|
}
|
|
77076
77130
|
const _normalizedModule = modulePath.replace(/^\.\//, "").replace(/^\.\.\\/, "../");
|
|
77077
77131
|
let isMatch = false;
|
|
77078
|
-
const _targetDir =
|
|
77079
|
-
const targetExt =
|
|
77080
|
-
const targetBasenameNoExt =
|
|
77132
|
+
const _targetDir = path79.dirname(targetFile);
|
|
77133
|
+
const targetExt = path79.extname(targetFile);
|
|
77134
|
+
const targetBasenameNoExt = path79.basename(targetFile, targetExt);
|
|
77081
77135
|
const moduleNormalized = modulePath.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
77082
77136
|
const moduleName = modulePath.split(/[/\\]/).pop() || "";
|
|
77083
77137
|
const moduleNameNoExt = moduleName.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/i, "");
|
|
@@ -77145,10 +77199,10 @@ function findSourceFiles3(dir, files = [], stats = { skippedDirs: [], skippedFil
|
|
|
77145
77199
|
entries.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
77146
77200
|
for (const entry of entries) {
|
|
77147
77201
|
if (SKIP_DIRECTORIES4.has(entry)) {
|
|
77148
|
-
stats.skippedDirs.push(
|
|
77202
|
+
stats.skippedDirs.push(path79.join(dir, entry));
|
|
77149
77203
|
continue;
|
|
77150
77204
|
}
|
|
77151
|
-
const fullPath =
|
|
77205
|
+
const fullPath = path79.join(dir, entry);
|
|
77152
77206
|
let stat4;
|
|
77153
77207
|
try {
|
|
77154
77208
|
stat4 = fs63.statSync(fullPath);
|
|
@@ -77162,7 +77216,7 @@ function findSourceFiles3(dir, files = [], stats = { skippedDirs: [], skippedFil
|
|
|
77162
77216
|
if (stat4.isDirectory()) {
|
|
77163
77217
|
findSourceFiles3(fullPath, files, stats);
|
|
77164
77218
|
} else if (stat4.isFile()) {
|
|
77165
|
-
const ext =
|
|
77219
|
+
const ext = path79.extname(fullPath).toLowerCase();
|
|
77166
77220
|
if (SUPPORTED_EXTENSIONS3.includes(ext)) {
|
|
77167
77221
|
files.push(fullPath);
|
|
77168
77222
|
}
|
|
@@ -77219,7 +77273,7 @@ var imports = createSwarmTool({
|
|
|
77219
77273
|
return JSON.stringify(errorResult, null, 2);
|
|
77220
77274
|
}
|
|
77221
77275
|
try {
|
|
77222
|
-
const targetFile =
|
|
77276
|
+
const targetFile = path79.resolve(file3);
|
|
77223
77277
|
if (!fs63.existsSync(targetFile)) {
|
|
77224
77278
|
const errorResult = {
|
|
77225
77279
|
error: `target file not found: ${file3}`,
|
|
@@ -77241,7 +77295,7 @@ var imports = createSwarmTool({
|
|
|
77241
77295
|
};
|
|
77242
77296
|
return JSON.stringify(errorResult, null, 2);
|
|
77243
77297
|
}
|
|
77244
|
-
const baseDir =
|
|
77298
|
+
const baseDir = path79.dirname(targetFile);
|
|
77245
77299
|
const scanStats = {
|
|
77246
77300
|
skippedDirs: [],
|
|
77247
77301
|
skippedFiles: 0,
|
|
@@ -77785,7 +77839,7 @@ init_qa_gate_profile();
|
|
|
77785
77839
|
init_manager2();
|
|
77786
77840
|
init_curator();
|
|
77787
77841
|
import * as fs65 from "node:fs";
|
|
77788
|
-
import * as
|
|
77842
|
+
import * as path81 from "node:path";
|
|
77789
77843
|
init_knowledge_curator();
|
|
77790
77844
|
init_knowledge_reader();
|
|
77791
77845
|
init_knowledge_store();
|
|
@@ -77798,14 +77852,14 @@ init_plan_schema();
|
|
|
77798
77852
|
init_ledger();
|
|
77799
77853
|
init_manager();
|
|
77800
77854
|
import * as fs64 from "node:fs";
|
|
77801
|
-
import * as
|
|
77855
|
+
import * as path80 from "node:path";
|
|
77802
77856
|
async function writeCheckpoint(directory) {
|
|
77803
77857
|
try {
|
|
77804
77858
|
const plan = await loadPlan(directory);
|
|
77805
77859
|
if (!plan)
|
|
77806
77860
|
return;
|
|
77807
|
-
const jsonPath =
|
|
77808
|
-
const mdPath =
|
|
77861
|
+
const jsonPath = path80.join(directory, "SWARM_PLAN.json");
|
|
77862
|
+
const mdPath = path80.join(directory, "SWARM_PLAN.md");
|
|
77809
77863
|
fs64.writeFileSync(jsonPath, JSON.stringify(plan, null, 2), "utf8");
|
|
77810
77864
|
const md = derivePlanMarkdown(plan);
|
|
77811
77865
|
fs64.writeFileSync(mdPath, md, "utf8");
|
|
@@ -78038,7 +78092,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
|
|
|
78038
78092
|
safeWarn(`[phase_complete] Completion verify error (non-blocking):`, completionError);
|
|
78039
78093
|
}
|
|
78040
78094
|
try {
|
|
78041
|
-
const driftEvidencePath =
|
|
78095
|
+
const driftEvidencePath = path81.join(dir, ".swarm", "evidence", String(phase), "drift-verifier.json");
|
|
78042
78096
|
let driftVerdictFound = false;
|
|
78043
78097
|
let driftVerdictApproved = false;
|
|
78044
78098
|
try {
|
|
@@ -78072,7 +78126,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
|
|
|
78072
78126
|
driftVerdictFound = false;
|
|
78073
78127
|
}
|
|
78074
78128
|
if (!driftVerdictFound) {
|
|
78075
|
-
const specPath =
|
|
78129
|
+
const specPath = path81.join(dir, ".swarm", "spec.md");
|
|
78076
78130
|
const specExists = fs65.existsSync(specPath);
|
|
78077
78131
|
if (!specExists) {
|
|
78078
78132
|
let incompleteTaskCount = 0;
|
|
@@ -78130,7 +78184,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
|
|
|
78130
78184
|
const overrides = session2?.qaGateSessionOverrides ?? {};
|
|
78131
78185
|
const effective = getEffectiveGates(profile, overrides);
|
|
78132
78186
|
if (effective.hallucination_guard === true) {
|
|
78133
|
-
const hgPath =
|
|
78187
|
+
const hgPath = path81.join(dir, ".swarm", "evidence", String(phase), "hallucination-guard.json");
|
|
78134
78188
|
let hgVerdictFound = false;
|
|
78135
78189
|
let hgVerdictApproved = false;
|
|
78136
78190
|
try {
|
|
@@ -78202,7 +78256,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
|
|
|
78202
78256
|
const overrides = session2?.qaGateSessionOverrides ?? {};
|
|
78203
78257
|
const effective = getEffectiveGates(profile, overrides);
|
|
78204
78258
|
if (effective.mutation_test === true) {
|
|
78205
|
-
const mgPath =
|
|
78259
|
+
const mgPath = path81.join(dir, ".swarm", "evidence", String(phase), "mutation-gate.json");
|
|
78206
78260
|
let mgVerdictFound = false;
|
|
78207
78261
|
let mgVerdict;
|
|
78208
78262
|
try {
|
|
@@ -78274,7 +78328,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
|
|
|
78274
78328
|
}
|
|
78275
78329
|
if (retroFound && retroEntry?.lessons_learned && retroEntry.lessons_learned.length > 0) {
|
|
78276
78330
|
try {
|
|
78277
|
-
const projectName =
|
|
78331
|
+
const projectName = path81.basename(dir);
|
|
78278
78332
|
const curationResult = await curateAndStoreSwarm(retroEntry.lessons_learned, projectName, { phase_number: phase }, dir, knowledgeConfig);
|
|
78279
78333
|
if (curationResult) {
|
|
78280
78334
|
const sessionState = swarmState.agentSessions.get(sessionID);
|
|
@@ -78643,7 +78697,7 @@ init_discovery();
|
|
|
78643
78697
|
init_utils();
|
|
78644
78698
|
init_create_tool();
|
|
78645
78699
|
import * as fs66 from "node:fs";
|
|
78646
|
-
import * as
|
|
78700
|
+
import * as path82 from "node:path";
|
|
78647
78701
|
var MAX_OUTPUT_BYTES5 = 52428800;
|
|
78648
78702
|
var AUDIT_TIMEOUT_MS = 120000;
|
|
78649
78703
|
function isValidEcosystem(value) {
|
|
@@ -78671,16 +78725,16 @@ function validateArgs3(args2) {
|
|
|
78671
78725
|
function detectEcosystems(directory) {
|
|
78672
78726
|
const ecosystems = [];
|
|
78673
78727
|
const cwd = directory;
|
|
78674
|
-
if (fs66.existsSync(
|
|
78728
|
+
if (fs66.existsSync(path82.join(cwd, "package.json"))) {
|
|
78675
78729
|
ecosystems.push("npm");
|
|
78676
78730
|
}
|
|
78677
|
-
if (fs66.existsSync(
|
|
78731
|
+
if (fs66.existsSync(path82.join(cwd, "pyproject.toml")) || fs66.existsSync(path82.join(cwd, "requirements.txt"))) {
|
|
78678
78732
|
ecosystems.push("pip");
|
|
78679
78733
|
}
|
|
78680
|
-
if (fs66.existsSync(
|
|
78734
|
+
if (fs66.existsSync(path82.join(cwd, "Cargo.toml"))) {
|
|
78681
78735
|
ecosystems.push("cargo");
|
|
78682
78736
|
}
|
|
78683
|
-
if (fs66.existsSync(
|
|
78737
|
+
if (fs66.existsSync(path82.join(cwd, "go.mod"))) {
|
|
78684
78738
|
ecosystems.push("go");
|
|
78685
78739
|
}
|
|
78686
78740
|
try {
|
|
@@ -78689,13 +78743,13 @@ function detectEcosystems(directory) {
|
|
|
78689
78743
|
ecosystems.push("dotnet");
|
|
78690
78744
|
}
|
|
78691
78745
|
} catch {}
|
|
78692
|
-
if (fs66.existsSync(
|
|
78746
|
+
if (fs66.existsSync(path82.join(cwd, "Gemfile")) || fs66.existsSync(path82.join(cwd, "Gemfile.lock"))) {
|
|
78693
78747
|
ecosystems.push("ruby");
|
|
78694
78748
|
}
|
|
78695
|
-
if (fs66.existsSync(
|
|
78749
|
+
if (fs66.existsSync(path82.join(cwd, "pubspec.yaml"))) {
|
|
78696
78750
|
ecosystems.push("dart");
|
|
78697
78751
|
}
|
|
78698
|
-
if (fs66.existsSync(
|
|
78752
|
+
if (fs66.existsSync(path82.join(cwd, "composer.lock"))) {
|
|
78699
78753
|
ecosystems.push("composer");
|
|
78700
78754
|
}
|
|
78701
78755
|
return ecosystems;
|
|
@@ -79855,7 +79909,7 @@ var pkg_audit = createSwarmTool({
|
|
|
79855
79909
|
init_zod();
|
|
79856
79910
|
init_manager2();
|
|
79857
79911
|
import * as fs67 from "node:fs";
|
|
79858
|
-
import * as
|
|
79912
|
+
import * as path83 from "node:path";
|
|
79859
79913
|
init_utils();
|
|
79860
79914
|
init_create_tool();
|
|
79861
79915
|
var MAX_FILE_SIZE = 1024 * 1024;
|
|
@@ -79978,7 +80032,7 @@ function isScaffoldFile(filePath) {
|
|
|
79978
80032
|
if (SCAFFOLD_PATH_PATTERNS.some((pattern) => pattern.test(normalizedPath))) {
|
|
79979
80033
|
return true;
|
|
79980
80034
|
}
|
|
79981
|
-
const filename =
|
|
80035
|
+
const filename = path83.basename(filePath);
|
|
79982
80036
|
if (SCAFFOLD_FILENAME_PATTERNS.some((pattern) => pattern.test(filename))) {
|
|
79983
80037
|
return true;
|
|
79984
80038
|
}
|
|
@@ -79995,7 +80049,7 @@ function isAllowedByGlobs(filePath, allowGlobs) {
|
|
|
79995
80049
|
if (regex.test(normalizedPath)) {
|
|
79996
80050
|
return true;
|
|
79997
80051
|
}
|
|
79998
|
-
const filename =
|
|
80052
|
+
const filename = path83.basename(filePath);
|
|
79999
80053
|
const filenameRegex = new RegExp(`^${regexPattern}$`, "i");
|
|
80000
80054
|
if (filenameRegex.test(filename)) {
|
|
80001
80055
|
return true;
|
|
@@ -80004,7 +80058,7 @@ function isAllowedByGlobs(filePath, allowGlobs) {
|
|
|
80004
80058
|
return false;
|
|
80005
80059
|
}
|
|
80006
80060
|
function isParserSupported(filePath) {
|
|
80007
|
-
const ext =
|
|
80061
|
+
const ext = path83.extname(filePath).toLowerCase();
|
|
80008
80062
|
return SUPPORTED_PARSER_EXTENSIONS.has(ext);
|
|
80009
80063
|
}
|
|
80010
80064
|
function isPlanFile(filePath) {
|
|
@@ -80251,9 +80305,9 @@ async function placeholderScan(input, directory) {
|
|
|
80251
80305
|
let filesScanned = 0;
|
|
80252
80306
|
const filesWithFindings = new Set;
|
|
80253
80307
|
for (const filePath of changed_files) {
|
|
80254
|
-
const fullPath =
|
|
80255
|
-
const resolvedDirectory =
|
|
80256
|
-
if (!fullPath.startsWith(resolvedDirectory +
|
|
80308
|
+
const fullPath = path83.isAbsolute(filePath) ? filePath : path83.resolve(directory, filePath);
|
|
80309
|
+
const resolvedDirectory = path83.resolve(directory);
|
|
80310
|
+
if (!fullPath.startsWith(resolvedDirectory + path83.sep) && fullPath !== resolvedDirectory) {
|
|
80257
80311
|
continue;
|
|
80258
80312
|
}
|
|
80259
80313
|
if (!fs67.existsSync(fullPath)) {
|
|
@@ -80262,7 +80316,7 @@ async function placeholderScan(input, directory) {
|
|
|
80262
80316
|
if (isAllowedByGlobs(filePath, allow_globs)) {
|
|
80263
80317
|
continue;
|
|
80264
80318
|
}
|
|
80265
|
-
const relativeFilePath =
|
|
80319
|
+
const relativeFilePath = path83.relative(directory, fullPath).replace(/\\/g, "/");
|
|
80266
80320
|
if (FILE_ALLOWLIST.some((allowed) => relativeFilePath.endsWith(allowed))) {
|
|
80267
80321
|
continue;
|
|
80268
80322
|
}
|
|
@@ -80334,7 +80388,7 @@ var placeholder_scan = createSwarmTool({
|
|
|
80334
80388
|
});
|
|
80335
80389
|
// src/tools/pre-check-batch.ts
|
|
80336
80390
|
import * as fs70 from "node:fs";
|
|
80337
|
-
import * as
|
|
80391
|
+
import * as path86 from "node:path";
|
|
80338
80392
|
init_zod();
|
|
80339
80393
|
init_manager2();
|
|
80340
80394
|
init_utils();
|
|
@@ -80471,7 +80525,7 @@ init_zod();
|
|
|
80471
80525
|
init_manager2();
|
|
80472
80526
|
init_detector();
|
|
80473
80527
|
import * as fs69 from "node:fs";
|
|
80474
|
-
import * as
|
|
80528
|
+
import * as path85 from "node:path";
|
|
80475
80529
|
import { extname as extname18 } from "node:path";
|
|
80476
80530
|
|
|
80477
80531
|
// src/sast/rules/c.ts
|
|
@@ -81365,24 +81419,24 @@ init_create_tool();
|
|
|
81365
81419
|
init_utils2();
|
|
81366
81420
|
import * as crypto8 from "node:crypto";
|
|
81367
81421
|
import * as fs68 from "node:fs";
|
|
81368
|
-
import * as
|
|
81422
|
+
import * as path84 from "node:path";
|
|
81369
81423
|
var BASELINE_SCHEMA_VERSION = "1.0.0";
|
|
81370
81424
|
var MAX_BASELINE_FINDINGS = 2000;
|
|
81371
81425
|
var MAX_BASELINE_BYTES = 2 * 1048576;
|
|
81372
81426
|
var LOCK_RETRY_DELAYS_MS = [50, 100, 200, 400, 800];
|
|
81373
81427
|
function normalizeFindingPath(directory, file3) {
|
|
81374
|
-
const resolved =
|
|
81375
|
-
const rel =
|
|
81428
|
+
const resolved = path84.isAbsolute(file3) ? file3 : path84.resolve(directory, file3);
|
|
81429
|
+
const rel = path84.relative(path84.resolve(directory), resolved);
|
|
81376
81430
|
return rel.replace(/\\/g, "/");
|
|
81377
81431
|
}
|
|
81378
81432
|
function baselineRelPath(phase) {
|
|
81379
|
-
return
|
|
81433
|
+
return path84.join("evidence", String(phase), "sast-baseline.json");
|
|
81380
81434
|
}
|
|
81381
81435
|
function tempRelPath(phase) {
|
|
81382
|
-
return
|
|
81436
|
+
return path84.join("evidence", String(phase), `sast-baseline.json.tmp.${Date.now()}.${process.pid}`);
|
|
81383
81437
|
}
|
|
81384
81438
|
function lockRelPath(phase) {
|
|
81385
|
-
return
|
|
81439
|
+
return path84.join("evidence", String(phase), "sast-baseline.json.lock");
|
|
81386
81440
|
}
|
|
81387
81441
|
function getLine(lines, idx) {
|
|
81388
81442
|
if (idx < 0 || idx >= lines.length)
|
|
@@ -81503,8 +81557,8 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
81503
81557
|
message: e instanceof Error ? e.message : "Path validation failed"
|
|
81504
81558
|
};
|
|
81505
81559
|
}
|
|
81506
|
-
fs68.mkdirSync(
|
|
81507
|
-
fs68.mkdirSync(
|
|
81560
|
+
fs68.mkdirSync(path84.dirname(baselinePath), { recursive: true });
|
|
81561
|
+
fs68.mkdirSync(path84.dirname(tempPath), { recursive: true });
|
|
81508
81562
|
const releaseLock = await acquireLock(lockPath);
|
|
81509
81563
|
try {
|
|
81510
81564
|
let existing = null;
|
|
@@ -81771,9 +81825,9 @@ async function sastScan(input, directory, config3) {
|
|
|
81771
81825
|
_filesSkipped++;
|
|
81772
81826
|
continue;
|
|
81773
81827
|
}
|
|
81774
|
-
const resolvedPath =
|
|
81775
|
-
const resolvedDirectory =
|
|
81776
|
-
if (!resolvedPath.startsWith(resolvedDirectory +
|
|
81828
|
+
const resolvedPath = path85.isAbsolute(filePath) ? filePath : path85.resolve(directory, filePath);
|
|
81829
|
+
const resolvedDirectory = path85.resolve(directory);
|
|
81830
|
+
if (!resolvedPath.startsWith(resolvedDirectory + path85.sep) && resolvedPath !== resolvedDirectory) {
|
|
81777
81831
|
_filesSkipped++;
|
|
81778
81832
|
continue;
|
|
81779
81833
|
}
|
|
@@ -82084,18 +82138,18 @@ function validatePath(inputPath, baseDir, workspaceDir) {
|
|
|
82084
82138
|
let resolved;
|
|
82085
82139
|
const isWinAbs = isWindowsAbsolutePath(inputPath);
|
|
82086
82140
|
if (isWinAbs) {
|
|
82087
|
-
resolved =
|
|
82088
|
-
} else if (
|
|
82089
|
-
resolved =
|
|
82141
|
+
resolved = path86.win32.resolve(inputPath);
|
|
82142
|
+
} else if (path86.isAbsolute(inputPath)) {
|
|
82143
|
+
resolved = path86.resolve(inputPath);
|
|
82090
82144
|
} else {
|
|
82091
|
-
resolved =
|
|
82145
|
+
resolved = path86.resolve(baseDir, inputPath);
|
|
82092
82146
|
}
|
|
82093
|
-
const workspaceResolved =
|
|
82147
|
+
const workspaceResolved = path86.resolve(workspaceDir);
|
|
82094
82148
|
let relative20;
|
|
82095
82149
|
if (isWinAbs) {
|
|
82096
|
-
relative20 =
|
|
82150
|
+
relative20 = path86.win32.relative(workspaceResolved, resolved);
|
|
82097
82151
|
} else {
|
|
82098
|
-
relative20 =
|
|
82152
|
+
relative20 = path86.relative(workspaceResolved, resolved);
|
|
82099
82153
|
}
|
|
82100
82154
|
if (relative20.startsWith("..")) {
|
|
82101
82155
|
return "path traversal detected";
|
|
@@ -82160,7 +82214,7 @@ async function runLintOnFiles(linter, files, workspaceDir) {
|
|
|
82160
82214
|
if (typeof file3 !== "string") {
|
|
82161
82215
|
continue;
|
|
82162
82216
|
}
|
|
82163
|
-
const resolvedPath =
|
|
82217
|
+
const resolvedPath = path86.resolve(file3);
|
|
82164
82218
|
const validationError = validatePath(resolvedPath, workspaceDir, workspaceDir);
|
|
82165
82219
|
if (validationError) {
|
|
82166
82220
|
continue;
|
|
@@ -82317,7 +82371,7 @@ async function runSecretscanWithFiles(files, directory) {
|
|
|
82317
82371
|
skippedFiles++;
|
|
82318
82372
|
continue;
|
|
82319
82373
|
}
|
|
82320
|
-
const resolvedPath =
|
|
82374
|
+
const resolvedPath = path86.resolve(file3);
|
|
82321
82375
|
const validationError = validatePath(resolvedPath, directory, directory);
|
|
82322
82376
|
if (validationError) {
|
|
82323
82377
|
skippedFiles++;
|
|
@@ -82335,7 +82389,7 @@ async function runSecretscanWithFiles(files, directory) {
|
|
|
82335
82389
|
};
|
|
82336
82390
|
}
|
|
82337
82391
|
for (const file3 of validatedFiles) {
|
|
82338
|
-
const ext =
|
|
82392
|
+
const ext = path86.extname(file3).toLowerCase();
|
|
82339
82393
|
if (DEFAULT_EXCLUDE_EXTENSIONS2.has(ext)) {
|
|
82340
82394
|
skippedFiles++;
|
|
82341
82395
|
continue;
|
|
@@ -82554,7 +82608,7 @@ function classifySastFindings(findings, changedLineRanges, directory) {
|
|
|
82554
82608
|
const preexistingFindings = [];
|
|
82555
82609
|
for (const finding of findings) {
|
|
82556
82610
|
const filePath = finding.location.file;
|
|
82557
|
-
const normalised =
|
|
82611
|
+
const normalised = path86.relative(directory, filePath).replace(/\\/g, "/");
|
|
82558
82612
|
const changedLines = changedLineRanges.get(normalised);
|
|
82559
82613
|
if (changedLines?.has(finding.location.line)) {
|
|
82560
82614
|
newFindings.push(finding);
|
|
@@ -82605,7 +82659,7 @@ async function runPreCheckBatch(input, workspaceDir, contextDir) {
|
|
|
82605
82659
|
warn(`pre_check_batch: Invalid file path: ${file3}`);
|
|
82606
82660
|
continue;
|
|
82607
82661
|
}
|
|
82608
|
-
changedFiles.push(
|
|
82662
|
+
changedFiles.push(path86.resolve(directory, file3));
|
|
82609
82663
|
}
|
|
82610
82664
|
if (changedFiles.length === 0) {
|
|
82611
82665
|
warn("pre_check_batch: No valid files after validation, skipping all tools (fail-closed)");
|
|
@@ -82806,7 +82860,7 @@ var pre_check_batch = createSwarmTool({
|
|
|
82806
82860
|
};
|
|
82807
82861
|
return JSON.stringify(errorResult, null, 2);
|
|
82808
82862
|
}
|
|
82809
|
-
const resolvedDirectory =
|
|
82863
|
+
const resolvedDirectory = path86.resolve(typedArgs.directory);
|
|
82810
82864
|
const workspaceAnchor = resolvedDirectory;
|
|
82811
82865
|
const dirError = validateDirectory2(resolvedDirectory, workspaceAnchor);
|
|
82812
82866
|
if (dirError) {
|
|
@@ -82847,7 +82901,7 @@ var pre_check_batch = createSwarmTool({
|
|
|
82847
82901
|
});
|
|
82848
82902
|
// src/tools/repo-map.ts
|
|
82849
82903
|
init_zod();
|
|
82850
|
-
import * as
|
|
82904
|
+
import * as path87 from "node:path";
|
|
82851
82905
|
init_path_security();
|
|
82852
82906
|
init_create_tool();
|
|
82853
82907
|
var VALID_ACTIONS = [
|
|
@@ -82872,7 +82926,7 @@ function validateFile(p) {
|
|
|
82872
82926
|
return "file contains control characters";
|
|
82873
82927
|
if (containsPathTraversal(p))
|
|
82874
82928
|
return "file contains path traversal";
|
|
82875
|
-
if (
|
|
82929
|
+
if (path87.isAbsolute(p) || /^[a-zA-Z]:[\\/]/.test(p)) {
|
|
82876
82930
|
return "file must be a workspace-relative path, not absolute";
|
|
82877
82931
|
}
|
|
82878
82932
|
return null;
|
|
@@ -82895,8 +82949,8 @@ function ok(action, payload) {
|
|
|
82895
82949
|
}
|
|
82896
82950
|
function toRelativeGraphPath(input, workspaceRoot) {
|
|
82897
82951
|
const normalized = input.replace(/\\/g, "/");
|
|
82898
|
-
if (
|
|
82899
|
-
const rel =
|
|
82952
|
+
if (path87.isAbsolute(normalized)) {
|
|
82953
|
+
const rel = path87.relative(workspaceRoot, normalized).replace(/\\/g, "/");
|
|
82900
82954
|
return normalizeGraphPath2(rel);
|
|
82901
82955
|
}
|
|
82902
82956
|
return normalizeGraphPath2(normalized);
|
|
@@ -83041,7 +83095,7 @@ var repo_map = createSwarmTool({
|
|
|
83041
83095
|
init_zod();
|
|
83042
83096
|
init_create_tool();
|
|
83043
83097
|
import * as fs71 from "node:fs";
|
|
83044
|
-
import * as
|
|
83098
|
+
import * as path88 from "node:path";
|
|
83045
83099
|
var SPEC_FILE = ".swarm/spec.md";
|
|
83046
83100
|
var EVIDENCE_DIR4 = ".swarm/evidence";
|
|
83047
83101
|
var OBLIGATION_KEYWORDS = ["MUST", "SHOULD", "SHALL"];
|
|
@@ -83110,7 +83164,7 @@ function readTouchedFiles(evidenceDir, phase, cwd) {
|
|
|
83110
83164
|
return [];
|
|
83111
83165
|
}
|
|
83112
83166
|
for (const entry of entries) {
|
|
83113
|
-
const entryPath =
|
|
83167
|
+
const entryPath = path88.join(evidenceDir, entry);
|
|
83114
83168
|
try {
|
|
83115
83169
|
const stat4 = fs71.statSync(entryPath);
|
|
83116
83170
|
if (!stat4.isDirectory()) {
|
|
@@ -83126,11 +83180,11 @@ function readTouchedFiles(evidenceDir, phase, cwd) {
|
|
|
83126
83180
|
if (entryPhase !== String(phase)) {
|
|
83127
83181
|
continue;
|
|
83128
83182
|
}
|
|
83129
|
-
const evidenceFilePath =
|
|
83183
|
+
const evidenceFilePath = path88.join(entryPath, "evidence.json");
|
|
83130
83184
|
try {
|
|
83131
|
-
const resolvedPath =
|
|
83132
|
-
const evidenceDirResolved =
|
|
83133
|
-
if (!resolvedPath.startsWith(evidenceDirResolved +
|
|
83185
|
+
const resolvedPath = path88.resolve(evidenceFilePath);
|
|
83186
|
+
const evidenceDirResolved = path88.resolve(evidenceDir);
|
|
83187
|
+
if (!resolvedPath.startsWith(evidenceDirResolved + path88.sep)) {
|
|
83134
83188
|
continue;
|
|
83135
83189
|
}
|
|
83136
83190
|
const stat4 = fs71.lstatSync(evidenceFilePath);
|
|
@@ -83164,7 +83218,7 @@ function readTouchedFiles(evidenceDir, phase, cwd) {
|
|
|
83164
83218
|
if (Array.isArray(diffEntry.files_changed)) {
|
|
83165
83219
|
for (const file3 of diffEntry.files_changed) {
|
|
83166
83220
|
if (typeof file3 === "string") {
|
|
83167
|
-
touchedFiles.add(
|
|
83221
|
+
touchedFiles.add(path88.resolve(cwd, file3));
|
|
83168
83222
|
}
|
|
83169
83223
|
}
|
|
83170
83224
|
}
|
|
@@ -83177,8 +83231,8 @@ function readTouchedFiles(evidenceDir, phase, cwd) {
|
|
|
83177
83231
|
}
|
|
83178
83232
|
function searchFileForKeywords(filePath, keywords, cwd) {
|
|
83179
83233
|
try {
|
|
83180
|
-
const resolvedPath =
|
|
83181
|
-
const cwdResolved =
|
|
83234
|
+
const resolvedPath = path88.resolve(filePath);
|
|
83235
|
+
const cwdResolved = path88.resolve(cwd);
|
|
83182
83236
|
if (!resolvedPath.startsWith(cwdResolved)) {
|
|
83183
83237
|
return false;
|
|
83184
83238
|
}
|
|
@@ -83312,7 +83366,7 @@ var req_coverage = createSwarmTool({
|
|
|
83312
83366
|
}, null, 2);
|
|
83313
83367
|
}
|
|
83314
83368
|
const cwd = inputDirectory || directory;
|
|
83315
|
-
const specPath =
|
|
83369
|
+
const specPath = path88.join(cwd, SPEC_FILE);
|
|
83316
83370
|
let specContent;
|
|
83317
83371
|
try {
|
|
83318
83372
|
specContent = fs71.readFileSync(specPath, "utf-8");
|
|
@@ -83339,7 +83393,7 @@ var req_coverage = createSwarmTool({
|
|
|
83339
83393
|
message: "No FR requirements found in spec.md"
|
|
83340
83394
|
}, null, 2);
|
|
83341
83395
|
}
|
|
83342
|
-
const evidenceDir =
|
|
83396
|
+
const evidenceDir = path88.join(cwd, EVIDENCE_DIR4);
|
|
83343
83397
|
const touchedFiles = readTouchedFiles(evidenceDir, phase, cwd);
|
|
83344
83398
|
const analyzedRequirements = [];
|
|
83345
83399
|
let coveredCount = 0;
|
|
@@ -83365,7 +83419,7 @@ var req_coverage = createSwarmTool({
|
|
|
83365
83419
|
requirements: analyzedRequirements
|
|
83366
83420
|
};
|
|
83367
83421
|
const reportFilename = `req-coverage-phase-${phase}.json`;
|
|
83368
|
-
const reportPath =
|
|
83422
|
+
const reportPath = path88.join(evidenceDir, reportFilename);
|
|
83369
83423
|
try {
|
|
83370
83424
|
if (!fs71.existsSync(evidenceDir)) {
|
|
83371
83425
|
fs71.mkdirSync(evidenceDir, { recursive: true });
|
|
@@ -83453,7 +83507,7 @@ init_qa_gate_profile();
|
|
|
83453
83507
|
init_file_locks();
|
|
83454
83508
|
import * as crypto9 from "node:crypto";
|
|
83455
83509
|
import * as fs72 from "node:fs";
|
|
83456
|
-
import * as
|
|
83510
|
+
import * as path89 from "node:path";
|
|
83457
83511
|
init_ledger();
|
|
83458
83512
|
init_manager();
|
|
83459
83513
|
init_state();
|
|
@@ -83531,8 +83585,8 @@ async function executeSavePlan(args2, fallbackDir) {
|
|
|
83531
83585
|
};
|
|
83532
83586
|
}
|
|
83533
83587
|
if (args2.working_directory && fallbackDir) {
|
|
83534
|
-
const resolvedTarget =
|
|
83535
|
-
const resolvedRoot =
|
|
83588
|
+
const resolvedTarget = path89.resolve(args2.working_directory);
|
|
83589
|
+
const resolvedRoot = path89.resolve(fallbackDir);
|
|
83536
83590
|
let fallbackExists = false;
|
|
83537
83591
|
try {
|
|
83538
83592
|
fs72.accessSync(resolvedRoot, fs72.constants.F_OK);
|
|
@@ -83541,7 +83595,7 @@ async function executeSavePlan(args2, fallbackDir) {
|
|
|
83541
83595
|
fallbackExists = false;
|
|
83542
83596
|
}
|
|
83543
83597
|
if (fallbackExists) {
|
|
83544
|
-
const isSubdirectory = resolvedTarget.startsWith(resolvedRoot +
|
|
83598
|
+
const isSubdirectory = resolvedTarget.startsWith(resolvedRoot + path89.sep);
|
|
83545
83599
|
if (isSubdirectory) {
|
|
83546
83600
|
return {
|
|
83547
83601
|
success: false,
|
|
@@ -83557,7 +83611,7 @@ async function executeSavePlan(args2, fallbackDir) {
|
|
|
83557
83611
|
let specMtime;
|
|
83558
83612
|
let specHash;
|
|
83559
83613
|
if (process.env.SWARM_SKIP_SPEC_GATE !== "1") {
|
|
83560
|
-
const specPath =
|
|
83614
|
+
const specPath = path89.join(targetWorkspace, ".swarm", "spec.md");
|
|
83561
83615
|
try {
|
|
83562
83616
|
const stat4 = await fs72.promises.stat(specPath);
|
|
83563
83617
|
specMtime = stat4.mtime.toISOString();
|
|
@@ -83573,7 +83627,7 @@ async function executeSavePlan(args2, fallbackDir) {
|
|
|
83573
83627
|
}
|
|
83574
83628
|
}
|
|
83575
83629
|
if (process.env.SWARM_SKIP_GATE_SELECTION !== "1") {
|
|
83576
|
-
const contextPath =
|
|
83630
|
+
const contextPath = path89.join(targetWorkspace, ".swarm", "context.md");
|
|
83577
83631
|
let contextContent = "";
|
|
83578
83632
|
try {
|
|
83579
83633
|
contextContent = await fs72.promises.readFile(contextPath, "utf8");
|
|
@@ -83723,7 +83777,7 @@ async function executeSavePlan(args2, fallbackDir) {
|
|
|
83723
83777
|
}
|
|
83724
83778
|
await writeCheckpoint(dir).catch(() => {});
|
|
83725
83779
|
try {
|
|
83726
|
-
const markerPath =
|
|
83780
|
+
const markerPath = path89.join(dir, ".swarm", ".plan-write-marker");
|
|
83727
83781
|
const marker = JSON.stringify({
|
|
83728
83782
|
source: "save_plan",
|
|
83729
83783
|
timestamp: new Date().toISOString(),
|
|
@@ -83746,7 +83800,7 @@ async function executeSavePlan(args2, fallbackDir) {
|
|
|
83746
83800
|
return {
|
|
83747
83801
|
success: true,
|
|
83748
83802
|
message: "Plan saved successfully",
|
|
83749
|
-
plan_path:
|
|
83803
|
+
plan_path: path89.join(dir, ".swarm", "plan.json"),
|
|
83750
83804
|
phases_count: plan.phases.length,
|
|
83751
83805
|
tasks_count: tasksCount,
|
|
83752
83806
|
...resolvedProfile !== undefined ? { execution_profile: resolvedProfile } : {},
|
|
@@ -83799,7 +83853,7 @@ var save_plan = createSwarmTool({
|
|
|
83799
83853
|
init_zod();
|
|
83800
83854
|
init_manager2();
|
|
83801
83855
|
import * as fs73 from "node:fs";
|
|
83802
|
-
import * as
|
|
83856
|
+
import * as path90 from "node:path";
|
|
83803
83857
|
|
|
83804
83858
|
// src/sbom/detectors/index.ts
|
|
83805
83859
|
init_utils();
|
|
@@ -84649,7 +84703,7 @@ function findManifestFiles(rootDir) {
|
|
|
84649
84703
|
try {
|
|
84650
84704
|
const entries = fs73.readdirSync(dir, { withFileTypes: true });
|
|
84651
84705
|
for (const entry of entries) {
|
|
84652
|
-
const fullPath =
|
|
84706
|
+
const fullPath = path90.join(dir, entry.name);
|
|
84653
84707
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === "dist" || entry.name === "build" || entry.name === "target") {
|
|
84654
84708
|
continue;
|
|
84655
84709
|
}
|
|
@@ -84658,7 +84712,7 @@ function findManifestFiles(rootDir) {
|
|
|
84658
84712
|
} else if (entry.isFile()) {
|
|
84659
84713
|
for (const pattern of patterns) {
|
|
84660
84714
|
if (simpleGlobToRegex(pattern).test(entry.name)) {
|
|
84661
|
-
manifestFiles.push(
|
|
84715
|
+
manifestFiles.push(path90.relative(rootDir, fullPath));
|
|
84662
84716
|
break;
|
|
84663
84717
|
}
|
|
84664
84718
|
}
|
|
@@ -84676,11 +84730,11 @@ function findManifestFilesInDirs(directories, workingDir) {
|
|
|
84676
84730
|
try {
|
|
84677
84731
|
const entries = fs73.readdirSync(dir, { withFileTypes: true });
|
|
84678
84732
|
for (const entry of entries) {
|
|
84679
|
-
const fullPath =
|
|
84733
|
+
const fullPath = path90.join(dir, entry.name);
|
|
84680
84734
|
if (entry.isFile()) {
|
|
84681
84735
|
for (const pattern of patterns) {
|
|
84682
84736
|
if (simpleGlobToRegex(pattern).test(entry.name)) {
|
|
84683
|
-
found.push(
|
|
84737
|
+
found.push(path90.relative(workingDir, fullPath));
|
|
84684
84738
|
break;
|
|
84685
84739
|
}
|
|
84686
84740
|
}
|
|
@@ -84693,11 +84747,11 @@ function findManifestFilesInDirs(directories, workingDir) {
|
|
|
84693
84747
|
function getDirectoriesFromChangedFiles(changedFiles, workingDir) {
|
|
84694
84748
|
const dirs = new Set;
|
|
84695
84749
|
for (const file3 of changedFiles) {
|
|
84696
|
-
let currentDir =
|
|
84750
|
+
let currentDir = path90.dirname(file3);
|
|
84697
84751
|
while (true) {
|
|
84698
|
-
if (currentDir && currentDir !== "." && currentDir !==
|
|
84699
|
-
dirs.add(
|
|
84700
|
-
const parent =
|
|
84752
|
+
if (currentDir && currentDir !== "." && currentDir !== path90.sep) {
|
|
84753
|
+
dirs.add(path90.join(workingDir, currentDir));
|
|
84754
|
+
const parent = path90.dirname(currentDir);
|
|
84701
84755
|
if (parent === currentDir)
|
|
84702
84756
|
break;
|
|
84703
84757
|
currentDir = parent;
|
|
@@ -84781,7 +84835,7 @@ var sbom_generate = createSwarmTool({
|
|
|
84781
84835
|
const changedFiles = obj.changed_files;
|
|
84782
84836
|
const relativeOutputDir = obj.output_dir || DEFAULT_OUTPUT_DIR;
|
|
84783
84837
|
const workingDir = directory;
|
|
84784
|
-
const outputDir =
|
|
84838
|
+
const outputDir = path90.isAbsolute(relativeOutputDir) ? relativeOutputDir : path90.join(workingDir, relativeOutputDir);
|
|
84785
84839
|
let manifestFiles = [];
|
|
84786
84840
|
if (scope === "all") {
|
|
84787
84841
|
manifestFiles = findManifestFiles(workingDir);
|
|
@@ -84804,7 +84858,7 @@ var sbom_generate = createSwarmTool({
|
|
|
84804
84858
|
const processedFiles = [];
|
|
84805
84859
|
for (const manifestFile of manifestFiles) {
|
|
84806
84860
|
try {
|
|
84807
|
-
const fullPath =
|
|
84861
|
+
const fullPath = path90.isAbsolute(manifestFile) ? manifestFile : path90.join(workingDir, manifestFile);
|
|
84808
84862
|
if (!fs73.existsSync(fullPath)) {
|
|
84809
84863
|
continue;
|
|
84810
84864
|
}
|
|
@@ -84821,7 +84875,7 @@ var sbom_generate = createSwarmTool({
|
|
|
84821
84875
|
const bom = generateCycloneDX(allComponents);
|
|
84822
84876
|
const bomJson = serializeCycloneDX(bom);
|
|
84823
84877
|
const filename = generateSbomFilename();
|
|
84824
|
-
const outputPath =
|
|
84878
|
+
const outputPath = path90.join(outputDir, filename);
|
|
84825
84879
|
fs73.writeFileSync(outputPath, bomJson, "utf-8");
|
|
84826
84880
|
const verdict = processedFiles.length > 0 ? "pass" : "pass";
|
|
84827
84881
|
try {
|
|
@@ -84865,7 +84919,7 @@ var sbom_generate = createSwarmTool({
|
|
|
84865
84919
|
init_zod();
|
|
84866
84920
|
init_create_tool();
|
|
84867
84921
|
import * as fs74 from "node:fs";
|
|
84868
|
-
import * as
|
|
84922
|
+
import * as path91 from "node:path";
|
|
84869
84923
|
var SPEC_CANDIDATES = [
|
|
84870
84924
|
"openapi.json",
|
|
84871
84925
|
"openapi.yaml",
|
|
@@ -84897,12 +84951,12 @@ function normalizePath3(p) {
|
|
|
84897
84951
|
}
|
|
84898
84952
|
function discoverSpecFile(cwd, specFileArg) {
|
|
84899
84953
|
if (specFileArg) {
|
|
84900
|
-
const resolvedPath =
|
|
84901
|
-
const normalizedCwd = cwd.endsWith(
|
|
84954
|
+
const resolvedPath = path91.resolve(cwd, specFileArg);
|
|
84955
|
+
const normalizedCwd = cwd.endsWith(path91.sep) ? cwd : cwd + path91.sep;
|
|
84902
84956
|
if (!resolvedPath.startsWith(normalizedCwd) && resolvedPath !== cwd) {
|
|
84903
84957
|
throw new Error("Invalid spec_file: path traversal detected");
|
|
84904
84958
|
}
|
|
84905
|
-
const ext =
|
|
84959
|
+
const ext = path91.extname(resolvedPath).toLowerCase();
|
|
84906
84960
|
if (!ALLOWED_EXTENSIONS.includes(ext)) {
|
|
84907
84961
|
throw new Error(`Invalid spec_file: must end in .json, .yaml, or .yml, got ${ext}`);
|
|
84908
84962
|
}
|
|
@@ -84916,7 +84970,7 @@ function discoverSpecFile(cwd, specFileArg) {
|
|
|
84916
84970
|
return resolvedPath;
|
|
84917
84971
|
}
|
|
84918
84972
|
for (const candidate of SPEC_CANDIDATES) {
|
|
84919
|
-
const candidatePath =
|
|
84973
|
+
const candidatePath = path91.resolve(cwd, candidate);
|
|
84920
84974
|
if (fs74.existsSync(candidatePath)) {
|
|
84921
84975
|
const stats = fs74.statSync(candidatePath);
|
|
84922
84976
|
if (stats.size <= MAX_SPEC_SIZE) {
|
|
@@ -84928,7 +84982,7 @@ function discoverSpecFile(cwd, specFileArg) {
|
|
|
84928
84982
|
}
|
|
84929
84983
|
function parseSpec(specFile) {
|
|
84930
84984
|
const content = fs74.readFileSync(specFile, "utf-8");
|
|
84931
|
-
const ext =
|
|
84985
|
+
const ext = path91.extname(specFile).toLowerCase();
|
|
84932
84986
|
if (ext === ".json") {
|
|
84933
84987
|
return parseJsonSpec(content);
|
|
84934
84988
|
}
|
|
@@ -85004,7 +85058,7 @@ function extractRoutes(cwd) {
|
|
|
85004
85058
|
return;
|
|
85005
85059
|
}
|
|
85006
85060
|
for (const entry of entries) {
|
|
85007
|
-
const fullPath =
|
|
85061
|
+
const fullPath = path91.join(dir, entry.name);
|
|
85008
85062
|
if (entry.isSymbolicLink()) {
|
|
85009
85063
|
continue;
|
|
85010
85064
|
}
|
|
@@ -85014,7 +85068,7 @@ function extractRoutes(cwd) {
|
|
|
85014
85068
|
}
|
|
85015
85069
|
walkDir(fullPath);
|
|
85016
85070
|
} else if (entry.isFile()) {
|
|
85017
|
-
const ext =
|
|
85071
|
+
const ext = path91.extname(entry.name).toLowerCase();
|
|
85018
85072
|
const baseName = entry.name.toLowerCase();
|
|
85019
85073
|
if (![".ts", ".js", ".mjs"].includes(ext)) {
|
|
85020
85074
|
continue;
|
|
@@ -85181,7 +85235,7 @@ init_zod();
|
|
|
85181
85235
|
init_path_security();
|
|
85182
85236
|
init_create_tool();
|
|
85183
85237
|
import * as fs75 from "node:fs";
|
|
85184
|
-
import * as
|
|
85238
|
+
import * as path92 from "node:path";
|
|
85185
85239
|
var DEFAULT_MAX_RESULTS = 100;
|
|
85186
85240
|
var DEFAULT_MAX_LINES = 200;
|
|
85187
85241
|
var REGEX_TIMEOUT_MS = 5000;
|
|
@@ -85217,11 +85271,11 @@ function containsWindowsAttacks3(str) {
|
|
|
85217
85271
|
}
|
|
85218
85272
|
function isPathInWorkspace3(filePath, workspace) {
|
|
85219
85273
|
try {
|
|
85220
|
-
const resolvedPath =
|
|
85274
|
+
const resolvedPath = path92.resolve(workspace, filePath);
|
|
85221
85275
|
const realWorkspace = fs75.realpathSync(workspace);
|
|
85222
85276
|
const realResolvedPath = fs75.realpathSync(resolvedPath);
|
|
85223
|
-
const relativePath =
|
|
85224
|
-
if (relativePath.startsWith("..") ||
|
|
85277
|
+
const relativePath = path92.relative(realWorkspace, realResolvedPath);
|
|
85278
|
+
if (relativePath.startsWith("..") || path92.isAbsolute(relativePath)) {
|
|
85225
85279
|
return false;
|
|
85226
85280
|
}
|
|
85227
85281
|
return true;
|
|
@@ -85234,11 +85288,11 @@ function validatePathForRead2(filePath, workspace) {
|
|
|
85234
85288
|
}
|
|
85235
85289
|
function findRgInEnvPath() {
|
|
85236
85290
|
const searchPath = process.env.PATH ?? "";
|
|
85237
|
-
for (const dir of searchPath.split(
|
|
85291
|
+
for (const dir of searchPath.split(path92.delimiter)) {
|
|
85238
85292
|
if (!dir)
|
|
85239
85293
|
continue;
|
|
85240
85294
|
const isWindows = process.platform === "win32";
|
|
85241
|
-
const candidate =
|
|
85295
|
+
const candidate = path92.join(dir, isWindows ? "rg.exe" : "rg");
|
|
85242
85296
|
if (fs75.existsSync(candidate))
|
|
85243
85297
|
return candidate;
|
|
85244
85298
|
}
|
|
@@ -85368,8 +85422,8 @@ function collectFiles(dir, workspace, includeGlobs, excludeGlobs) {
|
|
|
85368
85422
|
try {
|
|
85369
85423
|
const entries = fs75.readdirSync(dir, { withFileTypes: true });
|
|
85370
85424
|
for (const entry of entries) {
|
|
85371
|
-
const fullPath =
|
|
85372
|
-
const relativePath =
|
|
85425
|
+
const fullPath = path92.join(dir, entry.name);
|
|
85426
|
+
const relativePath = path92.relative(workspace, fullPath);
|
|
85373
85427
|
if (!validatePathForRead2(fullPath, workspace)) {
|
|
85374
85428
|
continue;
|
|
85375
85429
|
}
|
|
@@ -85410,7 +85464,7 @@ async function fallbackSearch(opts) {
|
|
|
85410
85464
|
const matches = [];
|
|
85411
85465
|
let total = 0;
|
|
85412
85466
|
for (const file3 of files) {
|
|
85413
|
-
const fullPath =
|
|
85467
|
+
const fullPath = path92.join(opts.workspace, file3);
|
|
85414
85468
|
if (!validatePathForRead2(fullPath, opts.workspace)) {
|
|
85415
85469
|
continue;
|
|
85416
85470
|
}
|
|
@@ -85665,7 +85719,7 @@ init_zod();
|
|
|
85665
85719
|
init_path_security();
|
|
85666
85720
|
init_create_tool();
|
|
85667
85721
|
import * as fs76 from "node:fs";
|
|
85668
|
-
import * as
|
|
85722
|
+
import * as path93 from "node:path";
|
|
85669
85723
|
var WINDOWS_RESERVED_NAMES4 = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|:|$)/i;
|
|
85670
85724
|
function containsWindowsAttacks4(str) {
|
|
85671
85725
|
if (/:[^\\/]/.test(str))
|
|
@@ -85679,14 +85733,14 @@ function containsWindowsAttacks4(str) {
|
|
|
85679
85733
|
}
|
|
85680
85734
|
function isPathInWorkspace4(filePath, workspace) {
|
|
85681
85735
|
try {
|
|
85682
|
-
const resolvedPath =
|
|
85736
|
+
const resolvedPath = path93.resolve(workspace, filePath);
|
|
85683
85737
|
if (!fs76.existsSync(resolvedPath)) {
|
|
85684
85738
|
return true;
|
|
85685
85739
|
}
|
|
85686
85740
|
const realWorkspace = fs76.realpathSync(workspace);
|
|
85687
85741
|
const realResolvedPath = fs76.realpathSync(resolvedPath);
|
|
85688
|
-
const relativePath =
|
|
85689
|
-
if (relativePath.startsWith("..") ||
|
|
85742
|
+
const relativePath = path93.relative(realWorkspace, realResolvedPath);
|
|
85743
|
+
if (relativePath.startsWith("..") || path93.isAbsolute(relativePath)) {
|
|
85690
85744
|
return false;
|
|
85691
85745
|
}
|
|
85692
85746
|
return true;
|
|
@@ -85894,7 +85948,7 @@ var suggestPatch = createSwarmTool({
|
|
|
85894
85948
|
});
|
|
85895
85949
|
continue;
|
|
85896
85950
|
}
|
|
85897
|
-
const fullPath =
|
|
85951
|
+
const fullPath = path93.resolve(directory, change.file);
|
|
85898
85952
|
if (!fs76.existsSync(fullPath)) {
|
|
85899
85953
|
errors5.push({
|
|
85900
85954
|
success: false,
|
|
@@ -86157,7 +86211,7 @@ var generate_mutants = createSwarmTool({
|
|
|
86157
86211
|
init_spec_schema();
|
|
86158
86212
|
init_create_tool();
|
|
86159
86213
|
import * as fs77 from "node:fs";
|
|
86160
|
-
import * as
|
|
86214
|
+
import * as path94 from "node:path";
|
|
86161
86215
|
var SPEC_FILE_NAME = "spec.md";
|
|
86162
86216
|
var SWARM_DIR2 = ".swarm";
|
|
86163
86217
|
var OBLIGATION_KEYWORDS2 = ["MUST", "SHALL", "SHOULD", "MAY"];
|
|
@@ -86210,7 +86264,7 @@ var lint_spec = createSwarmTool({
|
|
|
86210
86264
|
async execute(_args, directory) {
|
|
86211
86265
|
const errors5 = [];
|
|
86212
86266
|
const warnings = [];
|
|
86213
|
-
const specPath =
|
|
86267
|
+
const specPath = path94.join(directory, SWARM_DIR2, SPEC_FILE_NAME);
|
|
86214
86268
|
if (!fs77.existsSync(specPath)) {
|
|
86215
86269
|
const result2 = {
|
|
86216
86270
|
valid: false,
|
|
@@ -86281,12 +86335,12 @@ var lint_spec = createSwarmTool({
|
|
|
86281
86335
|
// src/tools/mutation-test.ts
|
|
86282
86336
|
init_zod();
|
|
86283
86337
|
import * as fs78 from "node:fs";
|
|
86284
|
-
import * as
|
|
86338
|
+
import * as path96 from "node:path";
|
|
86285
86339
|
|
|
86286
86340
|
// src/mutation/engine.ts
|
|
86287
86341
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
86288
86342
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync19 } from "node:fs";
|
|
86289
|
-
import * as
|
|
86343
|
+
import * as path95 from "node:path";
|
|
86290
86344
|
|
|
86291
86345
|
// src/mutation/equivalence.ts
|
|
86292
86346
|
function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
@@ -86421,7 +86475,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
|
|
|
86421
86475
|
let patchFile;
|
|
86422
86476
|
try {
|
|
86423
86477
|
const safeId2 = patch.id.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
86424
|
-
patchFile =
|
|
86478
|
+
patchFile = path95.join(workingDir, `.mutation_patch_${safeId2}.diff`);
|
|
86425
86479
|
try {
|
|
86426
86480
|
writeFileSync19(patchFile, patch.patch);
|
|
86427
86481
|
} catch (writeErr) {
|
|
@@ -86815,7 +86869,7 @@ var mutation_test = createSwarmTool({
|
|
|
86815
86869
|
];
|
|
86816
86870
|
for (const filePath of uniquePaths) {
|
|
86817
86871
|
try {
|
|
86818
|
-
const resolvedPath =
|
|
86872
|
+
const resolvedPath = path96.resolve(cwd, filePath);
|
|
86819
86873
|
sourceFiles.set(filePath, fs78.readFileSync(resolvedPath, "utf-8"));
|
|
86820
86874
|
} catch {}
|
|
86821
86875
|
}
|
|
@@ -86835,7 +86889,7 @@ init_zod();
|
|
|
86835
86889
|
init_manager2();
|
|
86836
86890
|
init_detector();
|
|
86837
86891
|
import * as fs79 from "node:fs";
|
|
86838
|
-
import * as
|
|
86892
|
+
import * as path97 from "node:path";
|
|
86839
86893
|
init_create_tool();
|
|
86840
86894
|
var MAX_FILE_SIZE2 = 2 * 1024 * 1024;
|
|
86841
86895
|
var BINARY_CHECK_BYTES = 8192;
|
|
@@ -86901,7 +86955,7 @@ async function syntaxCheck(input, directory, config3) {
|
|
|
86901
86955
|
if (languages?.length) {
|
|
86902
86956
|
const lowerLangs = languages.map((l) => l.toLowerCase());
|
|
86903
86957
|
filesToCheck = filesToCheck.filter((file3) => {
|
|
86904
|
-
const ext =
|
|
86958
|
+
const ext = path97.extname(file3.path).toLowerCase();
|
|
86905
86959
|
const langDef = getLanguageForExtension(ext);
|
|
86906
86960
|
const fileProfile = getProfileForFile(file3.path);
|
|
86907
86961
|
const langId = fileProfile?.id || langDef?.id;
|
|
@@ -86914,7 +86968,7 @@ async function syntaxCheck(input, directory, config3) {
|
|
|
86914
86968
|
let skippedCount = 0;
|
|
86915
86969
|
for (const fileInfo of filesToCheck) {
|
|
86916
86970
|
const { path: filePath } = fileInfo;
|
|
86917
|
-
const fullPath =
|
|
86971
|
+
const fullPath = path97.isAbsolute(filePath) ? filePath : path97.join(directory, filePath);
|
|
86918
86972
|
const result = {
|
|
86919
86973
|
path: filePath,
|
|
86920
86974
|
language: "",
|
|
@@ -86963,7 +87017,7 @@ async function syntaxCheck(input, directory, config3) {
|
|
|
86963
87017
|
results.push(result);
|
|
86964
87018
|
continue;
|
|
86965
87019
|
}
|
|
86966
|
-
const ext =
|
|
87020
|
+
const ext = path97.extname(filePath).toLowerCase();
|
|
86967
87021
|
const langDef = getLanguageForExtension(ext);
|
|
86968
87022
|
result.language = profile?.id || langDef?.id || "unknown";
|
|
86969
87023
|
const errors5 = extractSyntaxErrors(parser, content);
|
|
@@ -87056,7 +87110,7 @@ init_utils();
|
|
|
87056
87110
|
init_create_tool();
|
|
87057
87111
|
init_path_security();
|
|
87058
87112
|
import * as fs80 from "node:fs";
|
|
87059
|
-
import * as
|
|
87113
|
+
import * as path98 from "node:path";
|
|
87060
87114
|
var MAX_TEXT_LENGTH = 200;
|
|
87061
87115
|
var MAX_FILE_SIZE_BYTES11 = 1024 * 1024;
|
|
87062
87116
|
var SUPPORTED_EXTENSIONS4 = new Set([
|
|
@@ -87122,9 +87176,9 @@ function validatePathsInput(paths, cwd) {
|
|
|
87122
87176
|
return { error: "paths contains path traversal", resolvedPath: null };
|
|
87123
87177
|
}
|
|
87124
87178
|
try {
|
|
87125
|
-
const resolvedPath =
|
|
87126
|
-
const normalizedCwd =
|
|
87127
|
-
const normalizedResolved =
|
|
87179
|
+
const resolvedPath = path98.resolve(paths);
|
|
87180
|
+
const normalizedCwd = path98.resolve(cwd);
|
|
87181
|
+
const normalizedResolved = path98.resolve(resolvedPath);
|
|
87128
87182
|
if (!normalizedResolved.startsWith(normalizedCwd)) {
|
|
87129
87183
|
return {
|
|
87130
87184
|
error: "paths must be within the current working directory",
|
|
@@ -87140,7 +87194,7 @@ function validatePathsInput(paths, cwd) {
|
|
|
87140
87194
|
}
|
|
87141
87195
|
}
|
|
87142
87196
|
function isSupportedExtension(filePath) {
|
|
87143
|
-
const ext =
|
|
87197
|
+
const ext = path98.extname(filePath).toLowerCase();
|
|
87144
87198
|
return SUPPORTED_EXTENSIONS4.has(ext);
|
|
87145
87199
|
}
|
|
87146
87200
|
function findSourceFiles4(dir, files = []) {
|
|
@@ -87155,7 +87209,7 @@ function findSourceFiles4(dir, files = []) {
|
|
|
87155
87209
|
if (SKIP_DIRECTORIES5.has(entry)) {
|
|
87156
87210
|
continue;
|
|
87157
87211
|
}
|
|
87158
|
-
const fullPath =
|
|
87212
|
+
const fullPath = path98.join(dir, entry);
|
|
87159
87213
|
let stat4;
|
|
87160
87214
|
try {
|
|
87161
87215
|
stat4 = fs80.statSync(fullPath);
|
|
@@ -87267,7 +87321,7 @@ var todo_extract = createSwarmTool({
|
|
|
87267
87321
|
filesToScan.push(scanPath);
|
|
87268
87322
|
} else {
|
|
87269
87323
|
const errorResult = {
|
|
87270
|
-
error: `unsupported file extension: ${
|
|
87324
|
+
error: `unsupported file extension: ${path98.extname(scanPath)}`,
|
|
87271
87325
|
total: 0,
|
|
87272
87326
|
byPriority: { high: 0, medium: 0, low: 0 },
|
|
87273
87327
|
entries: []
|
|
@@ -87316,14 +87370,14 @@ init_schema();
|
|
|
87316
87370
|
init_qa_gate_profile();
|
|
87317
87371
|
init_gate_evidence();
|
|
87318
87372
|
import * as fs82 from "node:fs";
|
|
87319
|
-
import * as
|
|
87373
|
+
import * as path100 from "node:path";
|
|
87320
87374
|
|
|
87321
87375
|
// src/hooks/diff-scope.ts
|
|
87322
87376
|
import * as fs81 from "node:fs";
|
|
87323
|
-
import * as
|
|
87377
|
+
import * as path99 from "node:path";
|
|
87324
87378
|
function getDeclaredScope(taskId, directory) {
|
|
87325
87379
|
try {
|
|
87326
|
-
const planPath =
|
|
87380
|
+
const planPath = path99.join(directory, ".swarm", "plan.json");
|
|
87327
87381
|
if (!fs81.existsSync(planPath))
|
|
87328
87382
|
return null;
|
|
87329
87383
|
const raw = fs81.readFileSync(planPath, "utf-8");
|
|
@@ -87442,7 +87496,7 @@ var TIER_3_PATTERNS = [
|
|
|
87442
87496
|
];
|
|
87443
87497
|
function matchesTier3Pattern(files) {
|
|
87444
87498
|
for (const file3 of files) {
|
|
87445
|
-
const fileName =
|
|
87499
|
+
const fileName = path100.basename(file3);
|
|
87446
87500
|
for (const pattern of TIER_3_PATTERNS) {
|
|
87447
87501
|
if (pattern.test(fileName)) {
|
|
87448
87502
|
return true;
|
|
@@ -87456,7 +87510,7 @@ function checkReviewerGate(taskId, workingDirectory, stageBParallelEnabled = fal
|
|
|
87456
87510
|
if (hasActiveTurboMode()) {
|
|
87457
87511
|
const resolvedDir2 = workingDirectory;
|
|
87458
87512
|
try {
|
|
87459
|
-
const planPath =
|
|
87513
|
+
const planPath = path100.join(resolvedDir2, ".swarm", "plan.json");
|
|
87460
87514
|
const planRaw = fs82.readFileSync(planPath, "utf-8");
|
|
87461
87515
|
const plan = JSON.parse(planRaw);
|
|
87462
87516
|
for (const planPhase of plan.phases ?? []) {
|
|
@@ -87526,7 +87580,7 @@ function checkReviewerGate(taskId, workingDirectory, stageBParallelEnabled = fal
|
|
|
87526
87580
|
}
|
|
87527
87581
|
try {
|
|
87528
87582
|
const resolvedDir2 = workingDirectory;
|
|
87529
|
-
const planPath =
|
|
87583
|
+
const planPath = path100.join(resolvedDir2, ".swarm", "plan.json");
|
|
87530
87584
|
const planRaw = fs82.readFileSync(planPath, "utf-8");
|
|
87531
87585
|
const plan = JSON.parse(planRaw);
|
|
87532
87586
|
for (const planPhase of plan.phases ?? []) {
|
|
@@ -87684,7 +87738,7 @@ function checkCouncilGate(workingDirectory, taskId) {
|
|
|
87684
87738
|
return { blocked: false, reason: "" };
|
|
87685
87739
|
}
|
|
87686
87740
|
try {
|
|
87687
|
-
const planPath =
|
|
87741
|
+
const planPath = path100.join(workingDirectory, ".swarm", "plan.json");
|
|
87688
87742
|
const planRaw = fs82.readFileSync(planPath, "utf-8");
|
|
87689
87743
|
const planObj = JSON.parse(planRaw);
|
|
87690
87744
|
if (planObj.swarm && planObj.title) {
|
|
@@ -87775,8 +87829,8 @@ async function executeUpdateTaskStatus(args2, fallbackDir) {
|
|
|
87775
87829
|
};
|
|
87776
87830
|
}
|
|
87777
87831
|
}
|
|
87778
|
-
normalizedDir =
|
|
87779
|
-
const pathParts = normalizedDir.split(
|
|
87832
|
+
normalizedDir = path100.normalize(args2.working_directory);
|
|
87833
|
+
const pathParts = normalizedDir.split(path100.sep);
|
|
87780
87834
|
if (pathParts.includes("..")) {
|
|
87781
87835
|
return {
|
|
87782
87836
|
success: false,
|
|
@@ -87786,10 +87840,10 @@ async function executeUpdateTaskStatus(args2, fallbackDir) {
|
|
|
87786
87840
|
]
|
|
87787
87841
|
};
|
|
87788
87842
|
}
|
|
87789
|
-
const resolvedDir =
|
|
87843
|
+
const resolvedDir = path100.resolve(normalizedDir);
|
|
87790
87844
|
try {
|
|
87791
87845
|
const realPath = fs82.realpathSync(resolvedDir);
|
|
87792
|
-
const planPath =
|
|
87846
|
+
const planPath = path100.join(realPath, ".swarm", "plan.json");
|
|
87793
87847
|
if (!fs82.existsSync(planPath)) {
|
|
87794
87848
|
return {
|
|
87795
87849
|
success: false,
|
|
@@ -87821,8 +87875,8 @@ async function executeUpdateTaskStatus(args2, fallbackDir) {
|
|
|
87821
87875
|
}
|
|
87822
87876
|
if (args2.status === "in_progress") {
|
|
87823
87877
|
try {
|
|
87824
|
-
const evidencePath =
|
|
87825
|
-
fs82.mkdirSync(
|
|
87878
|
+
const evidencePath = path100.join(directory, ".swarm", "evidence", `${args2.task_id}.json`);
|
|
87879
|
+
fs82.mkdirSync(path100.dirname(evidencePath), { recursive: true });
|
|
87826
87880
|
const fd = fs82.openSync(evidencePath, "wx");
|
|
87827
87881
|
let writeOk = false;
|
|
87828
87882
|
try {
|
|
@@ -87846,7 +87900,7 @@ async function executeUpdateTaskStatus(args2, fallbackDir) {
|
|
|
87846
87900
|
recoverTaskStateFromDelegations(args2.task_id);
|
|
87847
87901
|
let phaseRequiresReviewer = true;
|
|
87848
87902
|
try {
|
|
87849
|
-
const planPath =
|
|
87903
|
+
const planPath = path100.join(directory, ".swarm", "plan.json");
|
|
87850
87904
|
const planRaw = fs82.readFileSync(planPath, "utf-8");
|
|
87851
87905
|
const plan = JSON.parse(planRaw);
|
|
87852
87906
|
const taskPhase = plan.phases.find((p) => p.tasks.some((t) => t.id === args2.task_id));
|
|
@@ -88166,7 +88220,7 @@ init_ledger();
|
|
|
88166
88220
|
init_manager();
|
|
88167
88221
|
init_create_tool();
|
|
88168
88222
|
import fs83 from "node:fs";
|
|
88169
|
-
import
|
|
88223
|
+
import path101 from "node:path";
|
|
88170
88224
|
function derivePlanId5(plan) {
|
|
88171
88225
|
return `${plan.swarm}-${plan.title}`.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
88172
88226
|
}
|
|
@@ -88217,7 +88271,7 @@ async function executeWriteDriftEvidence(args2, directory) {
|
|
|
88217
88271
|
entries: [evidenceEntry]
|
|
88218
88272
|
};
|
|
88219
88273
|
const filename = "drift-verifier.json";
|
|
88220
|
-
const relativePath =
|
|
88274
|
+
const relativePath = path101.join("evidence", String(phase), filename);
|
|
88221
88275
|
let validatedPath;
|
|
88222
88276
|
try {
|
|
88223
88277
|
validatedPath = validateSwarmPath(directory, relativePath);
|
|
@@ -88228,10 +88282,10 @@ async function executeWriteDriftEvidence(args2, directory) {
|
|
|
88228
88282
|
message: error93 instanceof Error ? error93.message : "Failed to validate path"
|
|
88229
88283
|
}, null, 2);
|
|
88230
88284
|
}
|
|
88231
|
-
const evidenceDir =
|
|
88285
|
+
const evidenceDir = path101.dirname(validatedPath);
|
|
88232
88286
|
try {
|
|
88233
88287
|
await fs83.promises.mkdir(evidenceDir, { recursive: true });
|
|
88234
|
-
const tempPath =
|
|
88288
|
+
const tempPath = path101.join(evidenceDir, `.${filename}.tmp`);
|
|
88235
88289
|
await fs83.promises.writeFile(tempPath, JSON.stringify(evidenceContent, null, 2), "utf-8");
|
|
88236
88290
|
await fs83.promises.rename(tempPath, validatedPath);
|
|
88237
88291
|
let snapshotInfo;
|
|
@@ -88328,7 +88382,7 @@ init_zod();
|
|
|
88328
88382
|
init_utils2();
|
|
88329
88383
|
init_create_tool();
|
|
88330
88384
|
import fs84 from "node:fs";
|
|
88331
|
-
import
|
|
88385
|
+
import path102 from "node:path";
|
|
88332
88386
|
function normalizeVerdict2(verdict) {
|
|
88333
88387
|
switch (verdict) {
|
|
88334
88388
|
case "APPROVED":
|
|
@@ -88376,7 +88430,7 @@ async function executeWriteHallucinationEvidence(args2, directory) {
|
|
|
88376
88430
|
entries: [evidenceEntry]
|
|
88377
88431
|
};
|
|
88378
88432
|
const filename = "hallucination-guard.json";
|
|
88379
|
-
const relativePath =
|
|
88433
|
+
const relativePath = path102.join("evidence", String(phase), filename);
|
|
88380
88434
|
let validatedPath;
|
|
88381
88435
|
try {
|
|
88382
88436
|
validatedPath = validateSwarmPath(directory, relativePath);
|
|
@@ -88387,10 +88441,10 @@ async function executeWriteHallucinationEvidence(args2, directory) {
|
|
|
88387
88441
|
message: error93 instanceof Error ? error93.message : "Failed to validate path"
|
|
88388
88442
|
}, null, 2);
|
|
88389
88443
|
}
|
|
88390
|
-
const evidenceDir =
|
|
88444
|
+
const evidenceDir = path102.dirname(validatedPath);
|
|
88391
88445
|
try {
|
|
88392
88446
|
await fs84.promises.mkdir(evidenceDir, { recursive: true });
|
|
88393
|
-
const tempPath =
|
|
88447
|
+
const tempPath = path102.join(evidenceDir, `.${filename}.tmp`);
|
|
88394
88448
|
await fs84.promises.writeFile(tempPath, JSON.stringify(evidenceContent, null, 2), "utf-8");
|
|
88395
88449
|
await fs84.promises.rename(tempPath, validatedPath);
|
|
88396
88450
|
return JSON.stringify({
|
|
@@ -88439,7 +88493,7 @@ init_zod();
|
|
|
88439
88493
|
init_utils2();
|
|
88440
88494
|
init_create_tool();
|
|
88441
88495
|
import fs85 from "node:fs";
|
|
88442
|
-
import
|
|
88496
|
+
import path103 from "node:path";
|
|
88443
88497
|
function normalizeVerdict3(verdict) {
|
|
88444
88498
|
switch (verdict) {
|
|
88445
88499
|
case "PASS":
|
|
@@ -88513,7 +88567,7 @@ async function executeWriteMutationEvidence(args2, directory) {
|
|
|
88513
88567
|
entries: [evidenceEntry]
|
|
88514
88568
|
};
|
|
88515
88569
|
const filename = "mutation-gate.json";
|
|
88516
|
-
const relativePath =
|
|
88570
|
+
const relativePath = path103.join("evidence", String(phase), filename);
|
|
88517
88571
|
let validatedPath;
|
|
88518
88572
|
try {
|
|
88519
88573
|
validatedPath = validateSwarmPath(directory, relativePath);
|
|
@@ -88524,10 +88578,10 @@ async function executeWriteMutationEvidence(args2, directory) {
|
|
|
88524
88578
|
message: error93 instanceof Error ? error93.message : "Failed to validate path"
|
|
88525
88579
|
}, null, 2);
|
|
88526
88580
|
}
|
|
88527
|
-
const evidenceDir =
|
|
88581
|
+
const evidenceDir = path103.dirname(validatedPath);
|
|
88528
88582
|
try {
|
|
88529
88583
|
await fs85.promises.mkdir(evidenceDir, { recursive: true });
|
|
88530
|
-
const tempPath =
|
|
88584
|
+
const tempPath = path103.join(evidenceDir, `.${filename}.tmp`);
|
|
88531
88585
|
await fs85.promises.writeFile(tempPath, JSON.stringify(evidenceContent, null, 2), "utf-8");
|
|
88532
88586
|
await fs85.promises.rename(tempPath, validatedPath);
|
|
88533
88587
|
return JSON.stringify({
|
|
@@ -88584,19 +88638,19 @@ init_utils();
|
|
|
88584
88638
|
|
|
88585
88639
|
// src/utils/gitignore-warning.ts
|
|
88586
88640
|
import * as fs86 from "node:fs";
|
|
88587
|
-
import * as
|
|
88641
|
+
import * as path104 from "node:path";
|
|
88588
88642
|
var _gitignoreWarningEmitted = false;
|
|
88589
88643
|
function findGitRoot(startDir) {
|
|
88590
88644
|
let current = startDir;
|
|
88591
88645
|
while (true) {
|
|
88592
88646
|
try {
|
|
88593
|
-
const gitPath =
|
|
88647
|
+
const gitPath = path104.join(current, ".git");
|
|
88594
88648
|
const stat4 = fs86.statSync(gitPath);
|
|
88595
88649
|
if (stat4.isDirectory()) {
|
|
88596
88650
|
return current;
|
|
88597
88651
|
}
|
|
88598
88652
|
} catch {}
|
|
88599
|
-
const parent =
|
|
88653
|
+
const parent = path104.dirname(current);
|
|
88600
88654
|
if (parent === current) {
|
|
88601
88655
|
return null;
|
|
88602
88656
|
}
|
|
@@ -88628,12 +88682,12 @@ function warnIfSwarmNotGitignored(directory) {
|
|
|
88628
88682
|
const gitRoot = findGitRoot(directory);
|
|
88629
88683
|
if (!gitRoot)
|
|
88630
88684
|
return;
|
|
88631
|
-
const gitignoreContent = readFileSafe(
|
|
88685
|
+
const gitignoreContent = readFileSafe(path104.join(gitRoot, ".gitignore"));
|
|
88632
88686
|
if (gitignoreContent !== null && fileCoversSwarm(gitignoreContent)) {
|
|
88633
88687
|
_gitignoreWarningEmitted = true;
|
|
88634
88688
|
return;
|
|
88635
88689
|
}
|
|
88636
|
-
const excludeContent = readFileSafe(
|
|
88690
|
+
const excludeContent = readFileSafe(path104.join(gitRoot, ".git", "info", "exclude"));
|
|
88637
88691
|
if (excludeContent !== null && fileCoversSwarm(excludeContent)) {
|
|
88638
88692
|
_gitignoreWarningEmitted = true;
|
|
88639
88693
|
return;
|
|
@@ -88679,8 +88733,8 @@ init_warning_buffer();
|
|
|
88679
88733
|
var _heartbeatTimers = new Map;
|
|
88680
88734
|
function writeSwarmConfigExampleIfNew(projectDirectory) {
|
|
88681
88735
|
try {
|
|
88682
|
-
const swarmDir =
|
|
88683
|
-
const dest =
|
|
88736
|
+
const swarmDir = path105.join(projectDirectory, ".swarm");
|
|
88737
|
+
const dest = path105.join(swarmDir, "config.example.json");
|
|
88684
88738
|
if (fs87.existsSync(dest))
|
|
88685
88739
|
return;
|
|
88686
88740
|
const example = {
|
|
@@ -88856,7 +88910,7 @@ async function initializeOpenCodeSwarm(ctx) {
|
|
|
88856
88910
|
const { PreflightTriggerManager: PTM } = await Promise.resolve().then(() => (init_trigger(), exports_trigger));
|
|
88857
88911
|
preflightTriggerManager = new PTM(automationConfig);
|
|
88858
88912
|
const { AutomationStatusArtifact: ASA } = await Promise.resolve().then(() => (init_status_artifact(), exports_status_artifact));
|
|
88859
|
-
const swarmDir =
|
|
88913
|
+
const swarmDir = path105.resolve(ctx.directory, ".swarm");
|
|
88860
88914
|
statusArtifact = new ASA(swarmDir);
|
|
88861
88915
|
statusArtifact.updateConfig(automationConfig.mode, automationConfig.capabilities);
|
|
88862
88916
|
if (automationConfig.capabilities?.evidence_auto_summaries === true) {
|
|
@@ -89449,9 +89503,10 @@ async function initializeOpenCodeSwarm(ctx) {
|
|
|
89449
89503
|
automation: automationManager
|
|
89450
89504
|
};
|
|
89451
89505
|
}
|
|
89452
|
-
var src_default =
|
|
89506
|
+
var src_default = {
|
|
89507
|
+
id: "opencode-swarm",
|
|
89508
|
+
server: OpenCodeSwarm
|
|
89509
|
+
};
|
|
89453
89510
|
export {
|
|
89454
|
-
|
|
89455
|
-
src_default as default,
|
|
89456
|
-
addDeferredWarning
|
|
89511
|
+
src_default as default
|
|
89457
89512
|
};
|