opencode-swarm 7.78.4 → 7.78.6

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 CHANGED
@@ -52,7 +52,7 @@ var package_default;
52
52
  var init_package = __esm(() => {
53
53
  package_default = {
54
54
  name: "opencode-swarm",
55
- version: "7.78.4",
55
+ version: "7.78.6",
56
56
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
57
57
  main: "dist/index.js",
58
58
  types: "dist/index.d.ts",
@@ -37399,26 +37399,90 @@ async function handleClarifyCommand(_directory, args) {
37399
37399
  return "[MODE: CLARIFY-SPEC] Please enter MODE: CLARIFY-SPEC and clarify the existing spec.";
37400
37400
  }
37401
37401
 
37402
+ // src/utils/git-binary-missing-error.ts
37403
+ function isGitBinaryMissing(err) {
37404
+ return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
37405
+ }
37406
+ var GitBinaryMissingError;
37407
+ var init_git_binary_missing_error = __esm(() => {
37408
+ GitBinaryMissingError = class GitBinaryMissingError extends Error {
37409
+ name = "GitBinaryMissingError";
37410
+ constructor(message = "git binary is not available", options) {
37411
+ super(message, options);
37412
+ }
37413
+ };
37414
+ });
37415
+
37402
37416
  // src/git/branch.ts
37403
37417
  import * as child_process2 from "child_process";
37418
+ import path13 from "path";
37419
+ function unique(values) {
37420
+ return [...new Set(values.filter(Boolean))];
37421
+ }
37422
+ function windowsGitCandidates() {
37423
+ if (process.platform !== "win32")
37424
+ return ["git"];
37425
+ const roots = unique([
37426
+ process.env.ProgramFiles ?? "",
37427
+ process.env["ProgramFiles(x86)"] ?? "",
37428
+ process.env.LOCALAPPDATA ? path13.join(process.env.LOCALAPPDATA, "Programs") : ""
37429
+ ]);
37430
+ const installed = roots.flatMap((root) => [
37431
+ path13.join(root, "Git", "cmd", "git.exe"),
37432
+ path13.join(root, "Git", "bin", "git.exe")
37433
+ ]);
37434
+ return unique(["git", ...installed]);
37435
+ }
37436
+ function errorMessage(err) {
37437
+ return err instanceof Error ? err.message : String(err);
37438
+ }
37439
+ function isNotGitRepositoryMessage(message) {
37440
+ const lower = message.toLowerCase();
37441
+ return lower.includes("not a git repository") || lower.includes("not a git repo");
37442
+ }
37404
37443
  function gitExec2(args, cwd) {
37405
- const result = child_process2.spawnSync("git", args, {
37406
- cwd,
37407
- encoding: "utf-8",
37408
- timeout: GIT_TIMEOUT_MS2,
37409
- stdio: ["pipe", "pipe", "pipe"]
37410
- });
37411
- if (result.status !== 0) {
37412
- throw new Error(result.stderr || `git exited with ${result.status}`);
37444
+ let missingGitError;
37445
+ for (const command of windowsGitCandidates()) {
37446
+ const result = child_process2.spawnSync(command, args, {
37447
+ cwd,
37448
+ encoding: "utf-8",
37449
+ timeout: GIT_TIMEOUT_MS2,
37450
+ windowsHide: true,
37451
+ maxBuffer: GIT_MAX_BUFFER_BYTES,
37452
+ stdio: ["ignore", "pipe", "pipe"]
37453
+ });
37454
+ if (result.error) {
37455
+ if (isGitBinaryMissing(result.error)) {
37456
+ missingGitError ??= result.error;
37457
+ continue;
37458
+ }
37459
+ throw new Error(errorMessage(result.error));
37460
+ }
37461
+ if (result.status !== 0) {
37462
+ throw new Error(result.stderr || result.stdout || `git exited with ${result.status}`);
37463
+ }
37464
+ return result.stdout;
37413
37465
  }
37414
- return result.stdout;
37466
+ throw new GitBinaryMissingError(process.platform === "win32" ? "git executable is not available on PATH or common Windows install locations" : "git executable is not available on PATH", { cause: missingGitError });
37415
37467
  }
37416
- function isGitRepo2(cwd) {
37468
+ function getGitRepositoryStatus(cwd) {
37417
37469
  try {
37418
37470
  gitExec2(["rev-parse", "--git-dir"], cwd);
37419
- return true;
37420
- } catch {
37421
- return false;
37471
+ return { isRepo: true };
37472
+ } catch (err) {
37473
+ if (err instanceof GitBinaryMissingError) {
37474
+ return {
37475
+ isRepo: false,
37476
+ reason: "git_unavailable",
37477
+ message: err.message
37478
+ };
37479
+ }
37480
+ const message = errorMessage(err);
37481
+ return {
37482
+ isRepo: false,
37483
+ reason: isNotGitRepositoryMessage(message) ? "not_git_repo" : "git_error",
37484
+ message
37485
+ };
37422
37486
  }
37423
37487
  }
37424
37488
  function getCurrentBranch(cwd) {
@@ -37851,13 +37915,16 @@ function resetToMainAfterMerge(cwd, options) {
37851
37915
  };
37852
37916
  }
37853
37917
  }
37854
- var GIT_TIMEOUT_MS2 = 30000, _internals14;
37918
+ var GIT_TIMEOUT_MS2 = 30000, GIT_MAX_BUFFER_BYTES, _internals14;
37855
37919
  var init_branch = __esm(() => {
37920
+ init_git_binary_missing_error();
37856
37921
  init_logger();
37922
+ GIT_MAX_BUFFER_BYTES = 5 * 1024 * 1024;
37857
37923
  _internals14 = {
37858
37924
  gitExec: gitExec2,
37859
37925
  detectDefaultRemoteBranch,
37860
37926
  getDefaultBaseBranch,
37927
+ getGitRepositoryStatus,
37861
37928
  resetToRemoteBranch,
37862
37929
  resetToMainAfterMerge
37863
37930
  };
@@ -38062,12 +38129,12 @@ var init_event_bus = __esm(() => {
38062
38129
 
38063
38130
  // src/evidence/task-file.ts
38064
38131
  import { renameSync as renameSync6, unlinkSync as unlinkSync4 } from "fs";
38065
- import * as path13 from "path";
38132
+ import * as path14 from "path";
38066
38133
  function taskEvidenceRelPath(taskId) {
38067
- return path13.join("evidence", `${taskId}.json`);
38134
+ return path14.join("evidence", `${taskId}.json`);
38068
38135
  }
38069
38136
  function taskEvidencePath(directory, taskId) {
38070
- return path13.join(directory, ".swarm", taskEvidenceRelPath(taskId));
38137
+ return path14.join(directory, ".swarm", taskEvidenceRelPath(taskId));
38071
38138
  }
38072
38139
  async function atomicWriteFile(targetPath, content) {
38073
38140
  const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
@@ -38093,15 +38160,15 @@ var init_task_file = __esm(() => {
38093
38160
  // src/hooks/knowledge-events.ts
38094
38161
  import { existsSync as existsSync8 } from "fs";
38095
38162
  import { appendFile as appendFile2, mkdir as mkdir3, readFile as readFile2, stat as stat4 } from "fs/promises";
38096
- import * as path14 from "path";
38163
+ import * as path15 from "path";
38097
38164
  function resolveKnowledgeEventsPath(directory) {
38098
- return path14.join(directory, ".swarm", "knowledge-events.jsonl");
38165
+ return path15.join(directory, ".swarm", "knowledge-events.jsonl");
38099
38166
  }
38100
38167
  function resolveKnowledgeCounterBaselinePath(directory) {
38101
- return path14.join(directory, ".swarm", "knowledge-counter-baseline.json");
38168
+ return path15.join(directory, ".swarm", "knowledge-counter-baseline.json");
38102
38169
  }
38103
38170
  function resolveLegacyApplicationLogPath(directory) {
38104
- return path14.join(directory, ".swarm", "knowledge-application.jsonl");
38171
+ return path15.join(directory, ".swarm", "knowledge-application.jsonl");
38105
38172
  }
38106
38173
  async function readKnowledgeEvents(directory) {
38107
38174
  const filePath = resolveKnowledgeEventsPath(directory);
@@ -38382,35 +38449,35 @@ var init_knowledge_events = __esm(() => {
38382
38449
  import { existsSync as existsSync9 } from "fs";
38383
38450
  import { appendFile as appendFile3, mkdir as mkdir4, readFile as readFile3 } from "fs/promises";
38384
38451
  import * as os4 from "os";
38385
- import * as path15 from "path";
38452
+ import * as path16 from "path";
38386
38453
  function resolveSwarmKnowledgePath(directory) {
38387
- return path15.join(directory, ".swarm", "knowledge.jsonl");
38454
+ return path16.join(directory, ".swarm", "knowledge.jsonl");
38388
38455
  }
38389
38456
  function resolveSwarmRejectedPath(directory) {
38390
- return path15.join(directory, ".swarm", "knowledge-rejected.jsonl");
38457
+ return path16.join(directory, ".swarm", "knowledge-rejected.jsonl");
38391
38458
  }
38392
38459
  function resolveSwarmRetractionsPath(directory) {
38393
- return path15.join(directory, ".swarm", "knowledge-retractions.jsonl");
38460
+ return path16.join(directory, ".swarm", "knowledge-retractions.jsonl");
38394
38461
  }
38395
38462
  function resolveHiveKnowledgePath() {
38396
38463
  const platform = process.platform;
38397
38464
  const home = process.env.HOME || os4.homedir();
38398
38465
  let dataDir;
38399
38466
  if (platform === "win32") {
38400
- dataDir = path15.join(process.env.LOCALAPPDATA || path15.join(home, "AppData", "Local"), "opencode-swarm", "Data");
38467
+ dataDir = path16.join(process.env.LOCALAPPDATA || path16.join(home, "AppData", "Local"), "opencode-swarm", "Data");
38401
38468
  } else if (platform === "darwin") {
38402
- dataDir = path15.join(home, "Library", "Application Support", "opencode-swarm");
38469
+ dataDir = path16.join(home, "Library", "Application Support", "opencode-swarm");
38403
38470
  } else {
38404
- dataDir = path15.join(process.env.XDG_DATA_HOME || path15.join(home, ".local", "share"), "opencode-swarm");
38471
+ dataDir = path16.join(process.env.XDG_DATA_HOME || path16.join(home, ".local", "share"), "opencode-swarm");
38405
38472
  }
38406
- return path15.join(dataDir, "shared-learnings.jsonl");
38473
+ return path16.join(dataDir, "shared-learnings.jsonl");
38407
38474
  }
38408
38475
  function resolveHiveRejectedPath() {
38409
38476
  const hivePath = resolveHiveKnowledgePath();
38410
- return path15.join(path15.dirname(hivePath), "shared-learnings-rejected.jsonl");
38477
+ return path16.join(path16.dirname(hivePath), "shared-learnings-rejected.jsonl");
38411
38478
  }
38412
38479
  async function readKnowledge(filePath) {
38413
- const resolvedPath = path15.resolve(filePath);
38480
+ const resolvedPath = path16.resolve(filePath);
38414
38481
  const entries = await readCachedParsedFile(resolvedPath, KNOWLEDGE_JSONL_CACHE_NAMESPACE, async () => {
38415
38482
  if (!existsSync9(resolvedPath))
38416
38483
  return null;
@@ -38509,7 +38576,7 @@ async function appendRetractionRecord(directory, record3) {
38509
38576
  await appendKnowledge(resolveSwarmRetractionsPath(directory), record3);
38510
38577
  }
38511
38578
  async function appendKnowledge(filePath, entry) {
38512
- const dir = path15.dirname(filePath);
38579
+ const dir = path16.dirname(filePath);
38513
38580
  await mkdir4(dir, { recursive: true });
38514
38581
  let release = null;
38515
38582
  try {
@@ -38528,7 +38595,7 @@ async function appendKnowledge(filePath, entry) {
38528
38595
  }
38529
38596
  }
38530
38597
  async function rewriteKnowledge(filePath, entries) {
38531
- const dir = path15.dirname(filePath);
38598
+ const dir = path16.dirname(filePath);
38532
38599
  await mkdir4(dir, { recursive: true });
38533
38600
  let release = null;
38534
38601
  try {
@@ -38549,7 +38616,7 @@ async function rewriteKnowledge(filePath, entries) {
38549
38616
  }
38550
38617
  }
38551
38618
  async function transactFile(filePath, read, write, mutate) {
38552
- const dir = path15.dirname(filePath);
38619
+ const dir = path16.dirname(filePath);
38553
38620
  try {
38554
38621
  await mkdir4(dir, { recursive: true });
38555
38622
  } catch {
@@ -38741,7 +38808,7 @@ async function applyConfidenceDeltas(filePath, deltas) {
38741
38808
  }
38742
38809
  let release = null;
38743
38810
  try {
38744
- const dir = path15.dirname(filePath);
38811
+ const dir = path16.dirname(filePath);
38745
38812
  await mkdir4(dir, { recursive: true });
38746
38813
  release = await import_proper_lockfile4.default.lock(dir, {
38747
38814
  retries: { retries: 5, minTimeout: 100, maxTimeout: 500 },
@@ -39202,7 +39269,7 @@ var init_learning_metrics = __esm(() => {
39202
39269
 
39203
39270
  // src/hooks/knowledge-validator.ts
39204
39271
  import { appendFile as appendFile4, mkdir as mkdir5 } from "fs/promises";
39205
- import * as path16 from "path";
39272
+ import * as path17 from "path";
39206
39273
  function normalizeText(text) {
39207
39274
  return text.normalize("NFKC").toLowerCase().replace(/[^\w\s]/g, " ").replace(/\s+/g, " ").trim();
39208
39275
  }
@@ -39365,7 +39432,7 @@ function validateSkillPath(p) {
39365
39432
  return false;
39366
39433
  if (p.includes("\x00"))
39367
39434
  return false;
39368
- if (path16.isAbsolute(p))
39435
+ if (path17.isAbsolute(p))
39369
39436
  return false;
39370
39437
  if (p.includes(".."))
39371
39438
  return false;
@@ -39467,11 +39534,11 @@ function validateActionability(entry) {
39467
39534
  return { actionable: false, reason };
39468
39535
  }
39469
39536
  function resolveUnactionablePath(directory) {
39470
- return path16.join(directory, ".swarm", "knowledge-unactionable.jsonl");
39537
+ return path17.join(directory, ".swarm", "knowledge-unactionable.jsonl");
39471
39538
  }
39472
39539
  async function appendUnactionable(directory, entry, reason) {
39473
39540
  const filePath = resolveUnactionablePath(directory);
39474
- const dirPath = path16.dirname(filePath);
39541
+ const dirPath = path17.dirname(filePath);
39475
39542
  await mkdir5(dirPath, { recursive: true });
39476
39543
  await transactKnowledge(filePath, (existing) => {
39477
39544
  const record3 = {
@@ -39505,10 +39572,10 @@ async function quarantineEntry(directory, entryId, reason, reportedBy) {
39505
39572
  return;
39506
39573
  }
39507
39574
  const sanitizedReason = reason.slice(0, 500).replace(/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\x0d]/g, "");
39508
- const knowledgePath = path16.join(directory, ".swarm", "knowledge.jsonl");
39509
- const quarantinePath = path16.join(directory, ".swarm", "knowledge-quarantined.jsonl");
39510
- const rejectedPath = path16.join(directory, ".swarm", "knowledge-rejected.jsonl");
39511
- const swarmDir = path16.join(directory, ".swarm");
39575
+ const knowledgePath = path17.join(directory, ".swarm", "knowledge.jsonl");
39576
+ const quarantinePath = path17.join(directory, ".swarm", "knowledge-quarantined.jsonl");
39577
+ const rejectedPath = path17.join(directory, ".swarm", "knowledge-rejected.jsonl");
39578
+ const swarmDir = path17.join(directory, ".swarm");
39512
39579
  await mkdir5(swarmDir, { recursive: true });
39513
39580
  let release;
39514
39581
  try {
@@ -39569,10 +39636,10 @@ async function restoreEntry(directory, entryId) {
39569
39636
  warn("[knowledge-validator] restoreEntry: invalid entryId rejected");
39570
39637
  return;
39571
39638
  }
39572
- const knowledgePath = path16.join(directory, ".swarm", "knowledge.jsonl");
39573
- const quarantinePath = path16.join(directory, ".swarm", "knowledge-quarantined.jsonl");
39574
- const rejectedPath = path16.join(directory, ".swarm", "knowledge-rejected.jsonl");
39575
- const swarmDir = path16.join(directory, ".swarm");
39639
+ const knowledgePath = path17.join(directory, ".swarm", "knowledge.jsonl");
39640
+ const quarantinePath = path17.join(directory, ".swarm", "knowledge-quarantined.jsonl");
39641
+ const rejectedPath = path17.join(directory, ".swarm", "knowledge-rejected.jsonl");
39642
+ const swarmDir = path17.join(directory, ".swarm");
39576
39643
  await mkdir5(swarmDir, { recursive: true });
39577
39644
  let release;
39578
39645
  try {
@@ -39752,16 +39819,16 @@ var init_knowledge_validator = __esm(() => {
39752
39819
 
39753
39820
  // src/services/skill-changelog.ts
39754
39821
  import { appendFile as appendFile5, mkdir as mkdir6, readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
39755
- import * as path17 from "path";
39822
+ import * as path18 from "path";
39756
39823
  function resolveSkillChangelogPath(directory, slug) {
39757
39824
  if (slug.includes("..") || slug.includes("/") || slug.includes("\\")) {
39758
39825
  throw new Error(`Invalid skill slug: ${slug} \u2014 must not contain "..", "/" or "\\"`);
39759
39826
  }
39760
- return path17.join(directory, ".swarm", "skill-changelogs", `${slug}.jsonl`);
39827
+ return path18.join(directory, ".swarm", "skill-changelogs", `${slug}.jsonl`);
39761
39828
  }
39762
39829
  async function appendSkillChangelog(directory, slug, entry) {
39763
39830
  const filePath = resolveSkillChangelogPath(directory, slug);
39764
- const dirPath = path17.dirname(filePath);
39831
+ const dirPath = path18.dirname(filePath);
39765
39832
  await mkdir6(dirPath, { recursive: true });
39766
39833
  await appendFile5(filePath, `${JSON.stringify(entry)}
39767
39834
  `, "utf-8");
@@ -39797,7 +39864,7 @@ import {
39797
39864
  stat as stat5,
39798
39865
  writeFile as writeFile4
39799
39866
  } from "fs/promises";
39800
- import * as path18 from "path";
39867
+ import * as path19 from "path";
39801
39868
  function isValidSlug(slug) {
39802
39869
  return SLUG_PATTERN.test(slug);
39803
39870
  }
@@ -39855,15 +39922,15 @@ function casesFromParsedJson(parsed, fileLabel) {
39855
39922
  return cases;
39856
39923
  }
39857
39924
  function evalRoot(directory, slug) {
39858
- return path18.join(directory, ".swarm", "skills", "evals", slug);
39925
+ return path19.join(directory, ".swarm", "skills", "evals", slug);
39859
39926
  }
39860
39927
  function isInsidePath(root, target) {
39861
- const resolvedRoot = path18.resolve(root);
39862
- const resolvedTarget = path18.resolve(target);
39863
- return resolvedTarget === resolvedRoot || resolvedTarget.startsWith(resolvedRoot + path18.sep);
39928
+ const resolvedRoot = path19.resolve(root);
39929
+ const resolvedTarget = path19.resolve(target);
39930
+ return resolvedTarget === resolvedRoot || resolvedTarget.startsWith(resolvedRoot + path19.sep);
39864
39931
  }
39865
39932
  function rejectedEditsPath(directory) {
39866
- return path18.join(directory, ".swarm", "skills", "rejected-edits.jsonl");
39933
+ return path19.join(directory, ".swarm", "skills", "rejected-edits.jsonl");
39867
39934
  }
39868
39935
  async function loadEvalSet(directory, slug) {
39869
39936
  if (!isValidSlug(slug)) {
@@ -39916,9 +39983,9 @@ async function loadEvalSet(directory, slug) {
39916
39983
  const cases = [];
39917
39984
  const fileLabels = [];
39918
39985
  for (const file3 of files) {
39919
- const fullPath = path18.join(root, file3);
39920
- const resolved = path18.resolve(fullPath);
39921
- const resolvedRoot = path18.resolve(root);
39986
+ const fullPath = path19.join(root, file3);
39987
+ const resolved = path19.resolve(fullPath);
39988
+ const resolvedRoot = path19.resolve(root);
39922
39989
  if (!isInsidePath(resolvedRoot, resolved)) {
39923
39990
  return {
39924
39991
  status: "invalid",
@@ -39977,7 +40044,7 @@ async function loadEvalSet(directory, slug) {
39977
40044
  reason: `eval file invalid JSON: ${file3}: ${err instanceof Error ? err.message : String(err)}`
39978
40045
  };
39979
40046
  }
39980
- fileLabels.push(path18.relative(directory, fullPath).replace(/\\/g, "/"));
40047
+ fileLabels.push(path19.relative(directory, fullPath).replace(/\\/g, "/"));
39981
40048
  cases.push(...casesFromParsedJson(parsed, file3));
39982
40049
  if (cases.length >= MAX_EVAL_CASES)
39983
40050
  break;
@@ -40095,7 +40162,7 @@ async function evaluateSkillChange(req) {
40095
40162
  };
40096
40163
  }
40097
40164
  async function atomicWrite(filePath, content) {
40098
- await mkdir7(path18.dirname(filePath), { recursive: true });
40165
+ await mkdir7(path19.dirname(filePath), { recursive: true });
40099
40166
  const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
40100
40167
  await writeFile4(tmp, content, "utf-8");
40101
40168
  await rename3(tmp, filePath);
@@ -40168,7 +40235,7 @@ var init_skill_evaluator = __esm(() => {
40168
40235
  // src/services/skill-generator.ts
40169
40236
  import { existsSync as existsSync11, unlinkSync as unlinkSync5 } from "fs";
40170
40237
  import { mkdir as mkdir8, readFile as readFile6, rename as rename4, writeFile as writeFile5 } from "fs/promises";
40171
- import * as path19 from "path";
40238
+ import * as path20 from "path";
40172
40239
  function sanitizeSlug(input) {
40173
40240
  const lc = input.toLowerCase().trim();
40174
40241
  const mapped = lc.replace(/[^a-z0-9-]+/g, "-").replace(/-+/g, "-");
@@ -40179,10 +40246,10 @@ function isValidSlug2(slug) {
40179
40246
  return SLUG_PATTERN2.test(slug);
40180
40247
  }
40181
40248
  function proposalPath(directory, slug) {
40182
- return path19.join(directory, ".swarm", "skills", "proposals", `${slug}.md`);
40249
+ return path20.join(directory, ".swarm", "skills", "proposals", `${slug}.md`);
40183
40250
  }
40184
40251
  function activePath(directory, slug) {
40185
- return path19.join(directory, ".opencode", "skills", "generated", slug, "SKILL.md");
40252
+ return path20.join(directory, ".opencode", "skills", "generated", slug, "SKILL.md");
40186
40253
  }
40187
40254
  function activeRepoRelativePath(slug) {
40188
40255
  return `.opencode/skills/generated/${slug}/SKILL.md`;
@@ -40397,7 +40464,7 @@ function escapeMarkdown(s) {
40397
40464
  return s.replace(/[\r\n]+/g, " ").slice(0, 280);
40398
40465
  }
40399
40466
  async function atomicWrite2(p, content) {
40400
- await mkdir8(path19.dirname(p), { recursive: true });
40467
+ await mkdir8(path20.dirname(p), { recursive: true });
40401
40468
  const tmp = `${p}.tmp-${process.pid}-${Date.now()}`;
40402
40469
  await writeFile5(tmp, content, "utf-8");
40403
40470
  await rename4(tmp, p);
@@ -40442,7 +40509,7 @@ async function generateSkills(req) {
40442
40509
  continue;
40443
40510
  }
40444
40511
  const targetPath = req.mode === "active" ? activePath(req.directory, cluster.slug) : proposalPath(req.directory, cluster.slug);
40445
- const repoRel = path19.relative(req.directory, targetPath).replace(/\\/g, "/");
40512
+ const repoRel = path20.relative(req.directory, targetPath).replace(/\\/g, "/");
40446
40513
  if (!validateSkillPath(repoRel)) {
40447
40514
  result.skipped.push({
40448
40515
  slug: cluster.slug,
@@ -40777,8 +40844,8 @@ async function listSkills(directory) {
40777
40844
  proposals: [],
40778
40845
  active: []
40779
40846
  };
40780
- const proposalsDir = path19.join(directory, ".swarm", "skills", "proposals");
40781
- const activeDir = path19.join(directory, ".opencode", "skills", "generated");
40847
+ const proposalsDir = path20.join(directory, ".swarm", "skills", "proposals");
40848
+ const activeDir = path20.join(directory, ".opencode", "skills", "generated");
40782
40849
  const fs10 = await import("fs/promises");
40783
40850
  if (existsSync11(proposalsDir)) {
40784
40851
  const entries = await fs10.readdir(proposalsDir);
@@ -40788,7 +40855,7 @@ async function listSkills(directory) {
40788
40855
  const slug = f.replace(/\.md$/, "");
40789
40856
  result.proposals.push({
40790
40857
  slug,
40791
- path: path19.join(proposalsDir, f)
40858
+ path: path20.join(proposalsDir, f)
40792
40859
  });
40793
40860
  }
40794
40861
  }
@@ -40797,10 +40864,10 @@ async function listSkills(directory) {
40797
40864
  for (const e of entries) {
40798
40865
  if (!e.isDirectory())
40799
40866
  continue;
40800
- const retiredMarker = path19.join(activeDir, e.name, "retired.marker");
40867
+ const retiredMarker = path20.join(activeDir, e.name, "retired.marker");
40801
40868
  if (existsSync11(retiredMarker))
40802
40869
  continue;
40803
- const skillPath = path19.join(activeDir, e.name, "SKILL.md");
40870
+ const skillPath = path20.join(activeDir, e.name, "SKILL.md");
40804
40871
  if (existsSync11(skillPath)) {
40805
40872
  result.active.push({
40806
40873
  slug: e.name,
@@ -40896,7 +40963,7 @@ async function retireSkill(directory, slug, reason) {
40896
40963
  return {
40897
40964
  retired: false,
40898
40965
  path: activePath(directory, cleanSlug),
40899
- markerPath: path19.join(directory, ".opencode", "skills", "generated", cleanSlug, "retired.marker"),
40966
+ markerPath: path20.join(directory, ".opencode", "skills", "generated", cleanSlug, "retired.marker"),
40900
40967
  reason: "invalid slug"
40901
40968
  };
40902
40969
  }
@@ -40905,12 +40972,12 @@ async function retireSkill(directory, slug, reason) {
40905
40972
  return {
40906
40973
  retired: false,
40907
40974
  path: skillPath,
40908
- markerPath: path19.join(directory, ".opencode", "skills", "generated", cleanSlug, "retired.marker"),
40975
+ markerPath: path20.join(directory, ".opencode", "skills", "generated", cleanSlug, "retired.marker"),
40909
40976
  reason: "active skill not found"
40910
40977
  };
40911
40978
  }
40912
- const markerDir = path19.join(directory, ".opencode", "skills", "generated", cleanSlug);
40913
- const markerPath = path19.join(markerDir, "retired.marker");
40979
+ const markerDir = path20.join(directory, ".opencode", "skills", "generated", cleanSlug);
40980
+ const markerPath = path20.join(markerDir, "retired.marker");
40914
40981
  const markerContent = JSON.stringify({
40915
40982
  retiredAt: new Date().toISOString(),
40916
40983
  reason: reason ?? "manual_retire"
@@ -41139,7 +41206,7 @@ var init_skill_generator = __esm(() => {
41139
41206
  // src/services/skill-improver-quota.ts
41140
41207
  import { existsSync as existsSync12 } from "fs";
41141
41208
  import { mkdir as mkdir9, readFile as readFile7, rename as rename5, writeFile as writeFile6 } from "fs/promises";
41142
- import * as path20 from "path";
41209
+ import * as path21 from "path";
41143
41210
  async function acquireLock(dir) {
41144
41211
  const acquire = import_proper_lockfile6.default.lock(dir, LOCK_RETRY_OPTS);
41145
41212
  let timer;
@@ -41158,7 +41225,7 @@ async function acquireLock(dir) {
41158
41225
  }
41159
41226
  function resolveQuotaPath(directory, scope = "skill-improver") {
41160
41227
  const fileName = scope === "knowledge-enrichment" ? "knowledge-enrichment-quota.json" : "skill-improver-quota.json";
41161
- return path20.join(directory, ".swarm", fileName);
41228
+ return path21.join(directory, ".swarm", fileName);
41162
41229
  }
41163
41230
  function todayKey(window, now = new Date) {
41164
41231
  if (window === "utc") {
@@ -41184,7 +41251,7 @@ async function readState(filePath) {
41184
41251
  }
41185
41252
  }
41186
41253
  async function writeState(filePath, state) {
41187
- await mkdir9(path20.dirname(filePath), { recursive: true });
41254
+ await mkdir9(path21.dirname(filePath), { recursive: true });
41188
41255
  const tmp = `${filePath}.tmp-${process.pid}`;
41189
41256
  await writeFile6(tmp, JSON.stringify(state, null, 2), "utf-8");
41190
41257
  await rename5(tmp, filePath);
@@ -41207,10 +41274,10 @@ async function getQuotaState(directory, opts) {
41207
41274
  }
41208
41275
  async function reserveQuota(directory, opts) {
41209
41276
  const filePath = resolveQuotaPath(directory, opts.scope);
41210
- await mkdir9(path20.dirname(filePath), { recursive: true });
41277
+ await mkdir9(path21.dirname(filePath), { recursive: true });
41211
41278
  let release = null;
41212
41279
  try {
41213
- release = await acquireLock(path20.dirname(filePath));
41280
+ release = await acquireLock(path21.dirname(filePath));
41214
41281
  const state = await getQuotaState(directory, opts);
41215
41282
  if (state.calls_used + opts.nCalls > opts.maxCalls) {
41216
41283
  return {
@@ -41237,10 +41304,10 @@ async function reserveQuota(directory, opts) {
41237
41304
  }
41238
41305
  async function releaseQuota(directory, opts) {
41239
41306
  const filePath = resolveQuotaPath(directory, opts.scope);
41240
- await mkdir9(path20.dirname(filePath), { recursive: true });
41307
+ await mkdir9(path21.dirname(filePath), { recursive: true });
41241
41308
  let release = null;
41242
41309
  try {
41243
- release = await acquireLock(path20.dirname(filePath));
41310
+ release = await acquireLock(path21.dirname(filePath));
41244
41311
  const state = await getQuotaState(directory, opts);
41245
41312
  const next = {
41246
41313
  ...state,
@@ -41282,7 +41349,7 @@ var init_skill_reviser = __esm(() => {
41282
41349
  // src/hooks/skill-usage-log.ts
41283
41350
  import * as crypto3 from "crypto";
41284
41351
  import * as fs10 from "fs";
41285
- import * as path21 from "path";
41352
+ import * as path22 from "path";
41286
41353
  function resolveLogPath(directory) {
41287
41354
  return validateSwarmPath(directory, "skill-usage.jsonl");
41288
41355
  }
@@ -41360,7 +41427,7 @@ function appendFeedbackAppliedMarker(directory, processedEntryIds) {
41360
41427
  if (processedEntryIds.length === 0)
41361
41428
  return;
41362
41429
  const resolved = resolveLogPath(directory);
41363
- const dir = path21.dirname(resolved);
41430
+ const dir = path22.dirname(resolved);
41364
41431
  if (!_internals17.existsSync(dir)) {
41365
41432
  _internals17.mkdirSync(dir, { recursive: true });
41366
41433
  }
@@ -41405,7 +41472,7 @@ function appendSkillUsageEntry(directory, entry) {
41405
41472
  throw new Error("sessionID is required and must be a non-empty string");
41406
41473
  }
41407
41474
  const resolved = validateSwarmPath(directory, "skill-usage.jsonl");
41408
- const dir = path21.dirname(resolved);
41475
+ const dir = path22.dirname(resolved);
41409
41476
  if (!_internals17.existsSync(dir)) {
41410
41477
  _internals17.mkdirSync(dir, { recursive: true });
41411
41478
  }
@@ -41580,8 +41647,8 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
41580
41647
  if (pruned === 0) {
41581
41648
  return { pruned: 0, remaining: allEntries.length };
41582
41649
  }
41583
- const dir = path21.dirname(resolved);
41584
- const tmpPath = path21.join(dir, `skill-usage-${Date.now()}.tmp`);
41650
+ const dir = path22.dirname(resolved);
41651
+ const tmpPath = path22.join(dir, `skill-usage-${Date.now()}.tmp`);
41585
41652
  const content = surviving.map((e) => JSON.stringify(e)).join(`
41586
41653
  `).concat(`
41587
41654
  `);
@@ -41608,9 +41675,9 @@ async function resolveSourceKnowledgeIds(directory, skillPath) {
41608
41675
  if (/\.\.[/\\]/.test(cleanPath)) {
41609
41676
  return [];
41610
41677
  }
41611
- const absolute = path21.normalize(path21.isAbsolute(cleanPath) ? cleanPath : path21.resolve(directory, cleanPath));
41612
- const baseDir = path21.normalize(path21.resolve(directory));
41613
- const isContained = process.platform === "win32" ? absolute.toLowerCase().startsWith((baseDir + path21.sep).toLowerCase()) : absolute.startsWith(baseDir + path21.sep);
41678
+ const absolute = path22.normalize(path22.isAbsolute(cleanPath) ? cleanPath : path22.resolve(directory, cleanPath));
41679
+ const baseDir = path22.normalize(path22.resolve(directory));
41680
+ const isContained = process.platform === "win32" ? absolute.toLowerCase().startsWith((baseDir + path22.sep).toLowerCase()) : absolute.startsWith(baseDir + path22.sep);
41614
41681
  if (!isContained) {
41615
41682
  return [];
41616
41683
  }
@@ -41765,7 +41832,7 @@ var init_curator = __esm(() => {
41765
41832
  });
41766
41833
 
41767
41834
  // src/hooks/hive-promoter.ts
41768
- import path22 from "path";
41835
+ import path23 from "path";
41769
41836
  function carryActionableFields(source) {
41770
41837
  const out = {};
41771
41838
  if (source.triggers?.length)
@@ -41967,7 +42034,7 @@ async function promoteToHive(directory, lesson, category) {
41967
42034
  schema_version: 1,
41968
42035
  created_at: new Date().toISOString(),
41969
42036
  updated_at: new Date().toISOString(),
41970
- source_project: path22.basename(directory) || "unknown",
42037
+ source_project: path23.basename(directory) || "unknown",
41971
42038
  encounter_score: 1
41972
42039
  };
41973
42040
  await appendKnowledge(resolveHiveKnowledgePath(), newHiveEntry);
@@ -42032,7 +42099,7 @@ import {
42032
42099
  unlink as unlink2,
42033
42100
  writeFile as writeFile7
42034
42101
  } from "fs/promises";
42035
- import * as path23 from "path";
42102
+ import * as path24 from "path";
42036
42103
  function emptySynonymMap() {
42037
42104
  return { version: 1, cursor: 0, pairs: {} };
42038
42105
  }
@@ -42181,7 +42248,7 @@ async function readSynonymMap(directory, maxPairs = DEFAULT_MAX_PAIRS) {
42181
42248
  }
42182
42249
  }
42183
42250
  async function writeSynonymMapAtomic(filePath, map3) {
42184
- await mkdir10(path23.dirname(filePath), { recursive: true });
42251
+ await mkdir10(path24.dirname(filePath), { recursive: true });
42185
42252
  const tmp = `${filePath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
42186
42253
  try {
42187
42254
  await writeFile7(tmp, JSON.stringify(map3, null, 2), "utf-8");
@@ -42194,7 +42261,7 @@ async function writeSynonymMapAtomic(filePath, map3) {
42194
42261
  }
42195
42262
  async function rebuildSynonymMap(directory, entries, maxPairs = DEFAULT_MAX_PAIRS) {
42196
42263
  const filePath = resolveSynonymMapPath(directory);
42197
- const dir = path23.dirname(filePath);
42264
+ const dir = path24.dirname(filePath);
42198
42265
  await mkdir10(dir, { recursive: true });
42199
42266
  let release = null;
42200
42267
  try {
@@ -42266,12 +42333,12 @@ var init_knowledge_reinforcement = __esm(() => {
42266
42333
 
42267
42334
  // src/hooks/skill-scoring.ts
42268
42335
  import * as fs11 from "fs";
42269
- import * as path24 from "path";
42336
+ import * as path25 from "path";
42270
42337
  function extractSkillName(skillPath) {
42271
- const base = path24.basename(skillPath, path24.extname(skillPath));
42338
+ const base = path25.basename(skillPath, path25.extname(skillPath));
42272
42339
  if (base !== "SKILL")
42273
42340
  return base;
42274
- const parent = path24.basename(path24.dirname(skillPath));
42341
+ const parent = path25.basename(path25.dirname(skillPath));
42275
42342
  return parent;
42276
42343
  }
42277
42344
  function stripQuotes(value) {
@@ -42426,12 +42493,12 @@ function readSkillMetadata(skillPath, directory) {
42426
42493
  const normalizedPath = skillPath.replace(/^file:/, "").replace(/\\/g, "/");
42427
42494
  const fallback = parseSkillFrontmatter("", normalizedPath);
42428
42495
  try {
42429
- if (path24.isAbsolute(normalizedPath) || normalizedPath.split("/").includes("..")) {
42496
+ if (path25.isAbsolute(normalizedPath) || normalizedPath.split("/").includes("..")) {
42430
42497
  return fallback;
42431
42498
  }
42432
- const root = path24.resolve(directory);
42433
- const absolutePath = path24.resolve(directory, normalizedPath);
42434
- if (absolutePath !== root && !absolutePath.startsWith(root + path24.sep)) {
42499
+ const root = path25.resolve(directory);
42500
+ const absolutePath = path25.resolve(directory, normalizedPath);
42501
+ if (absolutePath !== root && !absolutePath.startsWith(root + path25.sep)) {
42435
42502
  return fallback;
42436
42503
  }
42437
42504
  const content = readFilePrefix(absolutePath);
@@ -42564,7 +42631,7 @@ function getSkillStats(skillPath, directory) {
42564
42631
  };
42565
42632
  }
42566
42633
  function formatSkillIndexWithContext(skills, directory) {
42567
- const usageLogPath = path24.join(directory, ".swarm", "skill-usage.jsonl");
42634
+ const usageLogPath = path25.join(directory, ".swarm", "skill-usage.jsonl");
42568
42635
  let hasHistory = false;
42569
42636
  try {
42570
42637
  const stat7 = fs11.statSync(usageLogPath);
@@ -42619,7 +42686,7 @@ var init_skill_scoring = __esm(() => {
42619
42686
 
42620
42687
  // src/hooks/skill-propagation-gate.ts
42621
42688
  import * as fs12 from "fs";
42622
- import * as path25 from "path";
42689
+ import * as path26 from "path";
42623
42690
  function parseSimpleYaml(content) {
42624
42691
  const lines = content.split(`
42625
42692
  `);
@@ -42718,7 +42785,7 @@ function parseYamlValue(value) {
42718
42785
  return trimmed;
42719
42786
  }
42720
42787
  function loadRoutingSkills(directory, targetAgent) {
42721
- const routingPath = path25.join(directory, ".opencode", "skill-routing.yaml");
42788
+ const routingPath = path26.join(directory, ".opencode", "skill-routing.yaml");
42722
42789
  if (!_internals19.existsSync(routingPath))
42723
42790
  return [];
42724
42791
  try {
@@ -42738,7 +42805,7 @@ function loadRoutingSkills(directory, targetAgent) {
42738
42805
  function discoverAvailableSkills(directory) {
42739
42806
  const results = [];
42740
42807
  for (const root of SKILL_SEARCH_ROOTS) {
42741
- const rootPath = path25.join(directory, root);
42808
+ const rootPath = path26.join(directory, root);
42742
42809
  if (!_internals19.existsSync(rootPath))
42743
42810
  continue;
42744
42811
  let entries;
@@ -42750,13 +42817,13 @@ function discoverAvailableSkills(directory) {
42750
42817
  for (const entry of entries) {
42751
42818
  if (entry.startsWith("."))
42752
42819
  continue;
42753
- const skillDir = path25.join(rootPath, entry);
42754
- if (_internals19.existsSync(path25.join(skillDir, "retired.marker")))
42820
+ const skillDir = path26.join(rootPath, entry);
42821
+ if (_internals19.existsSync(path26.join(skillDir, "retired.marker")))
42755
42822
  continue;
42756
- const skillFile = path25.join(skillDir, "SKILL.md");
42823
+ const skillFile = path26.join(skillDir, "SKILL.md");
42757
42824
  try {
42758
42825
  if (_internals19.statSync(skillDir).isDirectory() && _internals19.existsSync(skillFile)) {
42759
- results.push(path25.join(root, entry, "SKILL.md").replace(/\\/g, "/"));
42826
+ results.push(path26.join(root, entry, "SKILL.md").replace(/\\/g, "/"));
42760
42827
  }
42761
42828
  } catch (err) {
42762
42829
  warn(`[skill-propagation-gate] failed to stat skill directory ${entry}: ${err instanceof Error ? err.message : String(err)}`);
@@ -42825,9 +42892,9 @@ function extractSkillsFieldFromPrompt(prompt) {
42825
42892
  return "";
42826
42893
  }
42827
42894
  function writeWarnEvent(directory, record3) {
42828
- const filePath = path25.join(directory, ".swarm", "events.jsonl");
42895
+ const filePath = path26.join(directory, ".swarm", "events.jsonl");
42829
42896
  try {
42830
- const dir = path25.dirname(filePath);
42897
+ const dir = path26.dirname(filePath);
42831
42898
  if (!_internals19.existsSync(dir)) {
42832
42899
  _internals19.mkdirSync(dir, { recursive: true });
42833
42900
  }
@@ -42956,8 +43023,8 @@ async function skillPropagationGateBefore(directory, input, config3) {
42956
43023
  if (routingPaths.length > 0) {
42957
43024
  const existingPaths = new Set(scored.map((s) => s.skillPath));
42958
43025
  for (const routingPath of routingPaths) {
42959
- const routedSkillDir = path25.dirname(path25.join(directory, routingPath));
42960
- if (_internals19.existsSync(path25.join(routedSkillDir, "retired.marker")))
43026
+ const routedSkillDir = path26.dirname(path26.join(directory, routingPath));
43027
+ if (_internals19.existsSync(path26.join(routedSkillDir, "retired.marker")))
42961
43028
  continue;
42962
43029
  if (!existingPaths.has(routingPath)) {
42963
43030
  scored.push({
@@ -42976,8 +43043,8 @@ async function skillPropagationGateBefore(directory, input, config3) {
42976
43043
  let skillsForIndex = availableSkills;
42977
43044
  if (scoringSkipped) {
42978
43045
  skillsForIndex = [...availableSkills].sort((a, b) => {
42979
- const nameA = path25.basename(path25.dirname(a));
42980
- const nameB = path25.basename(path25.dirname(b));
43046
+ const nameA = path26.basename(path26.dirname(a));
43047
+ const nameB = path26.basename(path26.dirname(b));
42981
43048
  return nameA.localeCompare(nameB);
42982
43049
  });
42983
43050
  } else if (typeof scored !== "undefined" && scored.length > 0) {
@@ -42985,7 +43052,7 @@ async function skillPropagationGateBefore(directory, input, config3) {
42985
43052
  }
42986
43053
  const formattedIndex = _internals19.formatSkillIndexWithContext(skillsForIndex, directory);
42987
43054
  if (formattedIndex.length > 0) {
42988
- const contextPath = path25.join(directory, ".swarm", "context.md");
43055
+ const contextPath = path26.join(directory, ".swarm", "context.md");
42989
43056
  let existingContent = "";
42990
43057
  if (_internals19.existsSync(contextPath)) {
42991
43058
  existingContent = _internals19.readFileSync(contextPath, "utf-8");
@@ -43007,7 +43074,7 @@ ${newSection}`;
43007
43074
  updatedContent = existingContent + newSection;
43008
43075
  }
43009
43076
  }
43010
- const swarmDir = path25.dirname(contextPath);
43077
+ const swarmDir = path26.dirname(contextPath);
43011
43078
  if (!_internals19.existsSync(swarmDir)) {
43012
43079
  _internals19.mkdirSync(swarmDir, { recursive: true });
43013
43080
  }
@@ -43270,13 +43337,13 @@ var init_skill_propagation_gate = __esm(() => {
43270
43337
  // src/hooks/micro-reflector.ts
43271
43338
  import { existsSync as existsSync15 } from "fs";
43272
43339
  import { readFile as readFile9, writeFile as writeFile8 } from "fs/promises";
43273
- import * as path26 from "path";
43340
+ import * as path27 from "path";
43274
43341
  function resolveInsightCandidatesPath(directory) {
43275
43342
  return validateSwarmPath(directory, "insight-candidates.jsonl");
43276
43343
  }
43277
43344
  async function readTaskTrajectory(directory, taskId) {
43278
43345
  try {
43279
- const rel = path26.join("evidence", sanitizeTaskId2(taskId), "trajectory.jsonl");
43346
+ const rel = path27.join("evidence", sanitizeTaskId2(taskId), "trajectory.jsonl");
43280
43347
  const filePath = validateSwarmPath(directory, rel);
43281
43348
  if (!existsSync15(filePath))
43282
43349
  return [];
@@ -43317,7 +43384,7 @@ var init_micro_reflector = __esm(() => {
43317
43384
  // src/hooks/knowledge-curator.ts
43318
43385
  import { existsSync as existsSync16 } from "fs";
43319
43386
  import { appendFile as appendFile6, mkdir as mkdir11, readFile as readFile10, writeFile as writeFile9 } from "fs/promises";
43320
- import * as path27 from "path";
43387
+ import * as path28 from "path";
43321
43388
  function pruneSeenRetroSections() {
43322
43389
  const cutoff = Date.now() - 86400000;
43323
43390
  for (const [key, entry] of seenRetroSections) {
@@ -43577,8 +43644,8 @@ RETRY: your last output was missing ${result.missing.join("; ")}; produce valid
43577
43644
  }
43578
43645
  async function appendCuratorSkippedEvent(directory, record3) {
43579
43646
  try {
43580
- const filePath = path27.join(directory, ".swarm", "events.jsonl");
43581
- await mkdir11(path27.dirname(filePath), { recursive: true });
43647
+ const filePath = path28.join(directory, ".swarm", "events.jsonl");
43648
+ await mkdir11(path28.dirname(filePath), { recursive: true });
43582
43649
  await appendFile6(filePath, `${JSON.stringify({
43583
43650
  timestamp: new Date().toISOString(),
43584
43651
  event: "curator_skipped",
@@ -44136,7 +44203,7 @@ var init_skill_improver_llm_factory = __esm(() => {
44136
44203
 
44137
44204
  // src/services/trajectory-cluster.ts
44138
44205
  import { mkdir as mkdir12, writeFile as writeFile10 } from "fs/promises";
44139
- import * as path28 from "path";
44206
+ import * as path29 from "path";
44140
44207
  function failureKind(e) {
44141
44208
  const tool3 = (e.tool ?? "").toLowerCase();
44142
44209
  const ctx = `${e.action ?? ""} ${e.verdict ?? ""}`.toLowerCase();
@@ -44265,11 +44332,11 @@ async function writeMotifProposals(directory, opts = {}) {
44265
44332
  if (motifs.length === 0)
44266
44333
  return result;
44267
44334
  const max = opts.maxProposals ?? 10;
44268
- const proposalsDir = validateSwarmPath(directory, path28.join("skills", "proposals"));
44335
+ const proposalsDir = validateSwarmPath(directory, path29.join("skills", "proposals"));
44269
44336
  await mkdir12(proposalsDir, { recursive: true });
44270
44337
  for (const motif of motifs.slice(0, max)) {
44271
44338
  const slug = `motif-${slugify2(motif.signature)}`;
44272
- const filePath = path28.join(proposalsDir, `${slug}.md`);
44339
+ const filePath = path29.join(proposalsDir, `${slug}.md`);
44273
44340
  await writeFile10(filePath, buildMotifProposal(motif), "utf-8");
44274
44341
  result.proposalsWritten.push(filePath);
44275
44342
  }
@@ -44409,11 +44476,11 @@ async function writeSuccessMotifProposals(directory, opts = {}) {
44409
44476
  if (motifs.length === 0)
44410
44477
  return result;
44411
44478
  const max = opts.maxProposals ?? 10;
44412
- const proposalsDir = validateSwarmPath(directory, path28.join("skills", "proposals"));
44479
+ const proposalsDir = validateSwarmPath(directory, path29.join("skills", "proposals"));
44413
44480
  await mkdir12(proposalsDir, { recursive: true });
44414
44481
  for (const motif of motifs.slice(0, max)) {
44415
44482
  const slug = workflowSlug(motif.signature);
44416
- const filePath = path28.join(proposalsDir, `${slug}.md`);
44483
+ const filePath = path29.join(proposalsDir, `${slug}.md`);
44417
44484
  await writeFile10(filePath, buildWorkflowProposal(motif), "utf-8");
44418
44485
  result.proposalsWritten.push(filePath);
44419
44486
  }
@@ -44546,12 +44613,12 @@ var init_unactionable_hardening = __esm(() => {
44546
44613
  // src/services/skill-improver.ts
44547
44614
  import { existsSync as existsSync18 } from "fs";
44548
44615
  import { mkdir as mkdir13, readFile as readFile11, rename as rename7, writeFile as writeFile11 } from "fs/promises";
44549
- import * as path29 from "path";
44616
+ import * as path30 from "path";
44550
44617
  function timestampSlug(d) {
44551
44618
  return d.toISOString().replace(/[:.]/g, "-");
44552
44619
  }
44553
44620
  async function atomicWrite3(p, content) {
44554
- await mkdir13(path29.dirname(p), { recursive: true });
44621
+ await mkdir13(path30.dirname(p), { recursive: true });
44555
44622
  const tmp = `${p}.tmp-${process.pid}-${Date.now()}`;
44556
44623
  await writeFile11(tmp, content, "utf-8");
44557
44624
  await rename7(tmp, p);
@@ -44894,8 +44961,8 @@ async function runSkillImprover(req) {
44894
44961
  }
44895
44962
  throw err;
44896
44963
  }
44897
- const proposalDir = path29.join(req.directory, ".swarm", "skill-improver", "proposals");
44898
- const proposalFile = path29.join(proposalDir, `${timestampSlug(now)}.md`);
44964
+ const proposalDir = path30.join(req.directory, ".swarm", "skill-improver", "proposals");
44965
+ const proposalFile = path30.join(proposalDir, `${timestampSlug(now)}.md`);
44899
44966
  const finalBody = source === "llm" ? buildLLMProposalFrame({
44900
44967
  body,
44901
44968
  targets,
@@ -45327,7 +45394,7 @@ __export(exports_curator_postmortem, {
45327
45394
  _internals: () => _internals22
45328
45395
  });
45329
45396
  import { existsSync as existsSync19, readdirSync as readdirSync6, readFileSync as readFileSync9 } from "fs";
45330
- import * as path30 from "path";
45397
+ import * as path31 from "path";
45331
45398
  async function collectKnowledgeSummary(directory) {
45332
45399
  const entries = await readKnowledge(resolveSwarmKnowledgePath(directory));
45333
45400
  const events = await readKnowledgeEvents(directory);
@@ -45385,13 +45452,13 @@ function readJsonlFile(filePath) {
45385
45452
  }
45386
45453
  function collectRetrospectives(directory) {
45387
45454
  const results = [];
45388
- const evidenceDir = path30.join(directory, ".swarm", "evidence");
45455
+ const evidenceDir = path31.join(directory, ".swarm", "evidence");
45389
45456
  try {
45390
45457
  if (!existsSync19(evidenceDir))
45391
45458
  return results;
45392
45459
  for (const entry of readdirSync6(evidenceDir, { withFileTypes: true })) {
45393
45460
  if (entry.isDirectory() && entry.name.startsWith("retro-")) {
45394
- const retroPath = path30.join(evidenceDir, entry.name, "evidence.json");
45461
+ const retroPath = path31.join(evidenceDir, entry.name, "evidence.json");
45395
45462
  if (existsSync19(retroPath)) {
45396
45463
  try {
45397
45464
  results.push(readFileSync9(retroPath, "utf-8"));
@@ -45404,14 +45471,14 @@ function collectRetrospectives(directory) {
45404
45471
  }
45405
45472
  function collectDriftReports(directory) {
45406
45473
  const results = [];
45407
- const swarmDir = path30.join(directory, ".swarm");
45474
+ const swarmDir = path31.join(directory, ".swarm");
45408
45475
  try {
45409
45476
  if (!existsSync19(swarmDir))
45410
45477
  return results;
45411
45478
  for (const entry of readdirSync6(swarmDir)) {
45412
45479
  if (entry.startsWith("drift-report-phase-") && entry.endsWith(".json")) {
45413
45480
  try {
45414
- results.push(readFileSync9(path30.join(swarmDir, entry), "utf-8"));
45481
+ results.push(readFileSync9(path31.join(swarmDir, entry), "utf-8"));
45415
45482
  } catch {}
45416
45483
  }
45417
45484
  }
@@ -45420,7 +45487,7 @@ function collectDriftReports(directory) {
45420
45487
  }
45421
45488
  function collectPendingProposals(directory) {
45422
45489
  const results = [];
45423
- const insightPath = path30.join(directory, ".swarm", "insight-candidates.jsonl");
45490
+ const insightPath = path31.join(directory, ".swarm", "insight-candidates.jsonl");
45424
45491
  if (existsSync19(insightPath)) {
45425
45492
  try {
45426
45493
  results.push({
@@ -45429,7 +45496,7 @@ function collectPendingProposals(directory) {
45429
45496
  });
45430
45497
  } catch {}
45431
45498
  }
45432
- const proposalsDir = path30.join(directory, ".swarm", "skills", "proposals");
45499
+ const proposalsDir = path31.join(directory, ".swarm", "skills", "proposals");
45433
45500
  try {
45434
45501
  if (existsSync19(proposalsDir)) {
45435
45502
  for (const entry of readdirSync6(proposalsDir)) {
@@ -45437,7 +45504,7 @@ function collectPendingProposals(directory) {
45437
45504
  try {
45438
45505
  results.push({
45439
45506
  source: `proposals/${entry}`,
45440
- content: readFileSync9(path30.join(proposalsDir, entry), "utf-8")
45507
+ content: readFileSync9(path31.join(proposalsDir, entry), "utf-8")
45441
45508
  });
45442
45509
  } catch {}
45443
45510
  }
@@ -45612,7 +45679,7 @@ async function runCuratorPostMortem(directory, options = {}) {
45612
45679
  warnings.push("Failed to read curator digest.");
45613
45680
  }
45614
45681
  const proposals = collectPendingProposals(directory);
45615
- const unactionablePath = path30.join(directory, ".swarm", "knowledge-unactionable.jsonl");
45682
+ const unactionablePath = path31.join(directory, ".swarm", "knowledge-unactionable.jsonl");
45616
45683
  const unactionable = readJsonlFile(unactionablePath);
45617
45684
  const retrospectives = collectRetrospectives(directory);
45618
45685
  const driftReports = collectDriftReports(directory);
@@ -45650,7 +45717,7 @@ ${llmOutput}`;
45650
45717
  }
45651
45718
  try {
45652
45719
  const { mkdirSync: mkdirSync10, writeFileSync: writeFileSync7 } = await import("fs");
45653
- mkdirSync10(path30.dirname(reportPath), { recursive: true });
45720
+ mkdirSync10(path31.dirname(reportPath), { recursive: true });
45654
45721
  writeFileSync7(reportPath, reportContent, "utf-8");
45655
45722
  } catch (err) {
45656
45723
  const msg = err instanceof Error ? err.message : String(err);
@@ -45698,7 +45765,7 @@ var init_curator_postmortem = __esm(() => {
45698
45765
  // src/commands/close.ts
45699
45766
  import * as fsSync2 from "fs";
45700
45767
  import { promises as fs13 } from "fs";
45701
- import path31 from "path";
45768
+ import path32 from "path";
45702
45769
  async function runAbortableSkillReview(req, timeoutMs) {
45703
45770
  const controller = new AbortController;
45704
45771
  let timeout;
@@ -45737,8 +45804,8 @@ async function copyDirRecursive(src, dest) {
45737
45804
  const entries = await fs13.readdir(src);
45738
45805
  await fs13.mkdir(dest, { recursive: true });
45739
45806
  for (const entry of entries) {
45740
- const srcEntry = path31.join(src, entry);
45741
- const destEntry = path31.join(dest, entry);
45807
+ const srcEntry = path32.join(src, entry);
45808
+ const destEntry = path32.join(dest, entry);
45742
45809
  try {
45743
45810
  const stat7 = await fs13.stat(srcEntry);
45744
45811
  if (stat7.isDirectory()) {
@@ -45775,7 +45842,7 @@ function guaranteeAllPlansComplete(planData) {
45775
45842
  return { closedPhaseIds, closedTaskIds };
45776
45843
  }
45777
45844
  async function handleCloseCommand(directory, args, options = {}) {
45778
- const swarmDir = path31.join(directory, ".swarm");
45845
+ const swarmDir = path32.join(directory, ".swarm");
45779
45846
  try {
45780
45847
  const stat7 = fsSync2.lstatSync(swarmDir);
45781
45848
  if (stat7.isSymbolicLink()) {
@@ -45789,7 +45856,7 @@ async function handleCloseCommand(directory, args, options = {}) {
45789
45856
  const planPath = validateSwarmPath(directory, "plan.json");
45790
45857
  let planExists = false;
45791
45858
  let planData = {
45792
- title: path31.basename(directory) || "Ad-hoc session",
45859
+ title: path32.basename(directory) || "Ad-hoc session",
45793
45860
  phases: []
45794
45861
  };
45795
45862
  try {
@@ -45898,7 +45965,7 @@ async function handleCloseCommand(directory, args, options = {}) {
45898
45965
  warnings.push(`Session retrospective write threw: ${retroError instanceof Error ? retroError.message : String(retroError)}`);
45899
45966
  }
45900
45967
  }
45901
- const lessonsFilePath = path31.join(swarmDir, "close-lessons.md");
45968
+ const lessonsFilePath = path32.join(swarmDir, "close-lessons.md");
45902
45969
  let explicitLessons = [];
45903
45970
  try {
45904
45971
  const lessonsText = await fs13.readFile(lessonsFilePath, "utf-8");
@@ -45907,11 +45974,11 @@ async function handleCloseCommand(directory, args, options = {}) {
45907
45974
  } catch {}
45908
45975
  const retroLessons = [];
45909
45976
  try {
45910
- const evidenceDir = path31.join(swarmDir, "evidence");
45977
+ const evidenceDir = path32.join(swarmDir, "evidence");
45911
45978
  const evidenceEntries = await fs13.readdir(evidenceDir);
45912
45979
  const retroDirs = evidenceEntries.filter((e) => e.startsWith("retro-")).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
45913
45980
  for (const retroDir of retroDirs) {
45914
- const evidencePath = path31.join(evidenceDir, retroDir, "evidence.json");
45981
+ const evidencePath = path32.join(evidenceDir, retroDir, "evidence.json");
45915
45982
  try {
45916
45983
  const content = await fs13.readFile(evidencePath, "utf-8");
45917
45984
  const parsed = JSON.parse(content);
@@ -46074,7 +46141,7 @@ async function handleCloseCommand(directory, args, options = {}) {
46074
46141
  } catch {}
46075
46142
  const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
46076
46143
  const suffix = Math.random().toString(36).slice(2, 8);
46077
- const archiveDir = path31.join(swarmDir, "archive", `swarm-${timestamp}-${suffix}`);
46144
+ const archiveDir = path32.join(swarmDir, "archive", `swarm-${timestamp}-${suffix}`);
46078
46145
  let archiveResult = "";
46079
46146
  let archivedFileCount = 0;
46080
46147
  const archivedActiveStateFiles = new Set;
@@ -46082,8 +46149,8 @@ async function handleCloseCommand(directory, args, options = {}) {
46082
46149
  try {
46083
46150
  await fs13.mkdir(archiveDir, { recursive: true });
46084
46151
  for (const artifact of ARCHIVE_ARTIFACTS) {
46085
- const srcPath = path31.join(swarmDir, artifact);
46086
- const destPath = path31.join(archiveDir, artifact);
46152
+ const srcPath = path32.join(swarmDir, artifact);
46153
+ const destPath = path32.join(archiveDir, artifact);
46087
46154
  try {
46088
46155
  await fs13.copyFile(srcPath, destPath);
46089
46156
  archivedFileCount++;
@@ -46093,8 +46160,8 @@ async function handleCloseCommand(directory, args, options = {}) {
46093
46160
  } catch {}
46094
46161
  }
46095
46162
  for (const dirName of ACTIVE_STATE_DIRS_TO_CLEAN) {
46096
- const srcDir = path31.join(swarmDir, dirName);
46097
- const destDir = path31.join(archiveDir, dirName);
46163
+ const srcDir = path32.join(swarmDir, dirName);
46164
+ const destDir = path32.join(archiveDir, dirName);
46098
46165
  try {
46099
46166
  const copied = await copyDirRecursive(srcDir, destDir);
46100
46167
  archivedFileCount += copied;
@@ -46121,7 +46188,7 @@ async function handleCloseCommand(directory, args, options = {}) {
46121
46188
  warnings.push(`Preserved ${artifact} because it was not successfully archived.`);
46122
46189
  continue;
46123
46190
  }
46124
- const filePath = path31.join(swarmDir, artifact);
46191
+ const filePath = path32.join(swarmDir, artifact);
46125
46192
  try {
46126
46193
  await fs13.unlink(filePath);
46127
46194
  cleanedFiles.push(artifact);
@@ -46134,7 +46201,7 @@ async function handleCloseCommand(directory, args, options = {}) {
46134
46201
  if (!archivedActiveStateDirs.has(dirName)) {
46135
46202
  continue;
46136
46203
  }
46137
- const dirPath = path31.join(swarmDir, dirName);
46204
+ const dirPath = path32.join(swarmDir, dirName);
46138
46205
  try {
46139
46206
  await fs13.rm(dirPath, { recursive: true, force: true });
46140
46207
  cleanedFiles.push(`${dirName}/`);
@@ -46145,23 +46212,23 @@ async function handleCloseCommand(directory, args, options = {}) {
46145
46212
  const configBackups = swarmFiles.filter((f) => f.startsWith("config-backup-") && f.endsWith(".json"));
46146
46213
  for (const backup of configBackups) {
46147
46214
  try {
46148
- await fs13.unlink(path31.join(swarmDir, backup));
46215
+ await fs13.unlink(path32.join(swarmDir, backup));
46149
46216
  configBackupsRemoved++;
46150
46217
  } catch {}
46151
46218
  }
46152
46219
  const ledgerSiblings = swarmFiles.filter((f) => (f.startsWith("plan-ledger.archived-") || f.startsWith("plan-ledger.backup-")) && f.endsWith(".jsonl"));
46153
46220
  for (const sibling of ledgerSiblings) {
46154
46221
  try {
46155
- await fs13.unlink(path31.join(swarmDir, sibling));
46222
+ await fs13.unlink(path32.join(swarmDir, sibling));
46156
46223
  } catch {}
46157
46224
  }
46158
46225
  } catch {}
46159
46226
  let swarmPlanFilesRemoved = 0;
46160
46227
  const candidates = [
46161
- path31.join(directory, ".swarm", "SWARM_PLAN.json"),
46162
- path31.join(directory, ".swarm", "SWARM_PLAN.md"),
46163
- path31.join(directory, "SWARM_PLAN.json"),
46164
- path31.join(directory, "SWARM_PLAN.md")
46228
+ path32.join(directory, ".swarm", "SWARM_PLAN.json"),
46229
+ path32.join(directory, ".swarm", "SWARM_PLAN.md"),
46230
+ path32.join(directory, "SWARM_PLAN.json"),
46231
+ path32.join(directory, "SWARM_PLAN.md")
46165
46232
  ];
46166
46233
  for (const candidate of candidates) {
46167
46234
  try {
@@ -46179,7 +46246,7 @@ async function handleCloseCommand(directory, args, options = {}) {
46179
46246
  const tmpFiles = swarmFiles.filter((f) => f.startsWith(".tmp."));
46180
46247
  for (const tmp of tmpFiles) {
46181
46248
  try {
46182
- await fs13.unlink(path31.join(swarmDir, tmp));
46249
+ await fs13.unlink(path32.join(swarmDir, tmp));
46183
46250
  tmpFilesRemoved++;
46184
46251
  } catch {}
46185
46252
  }
@@ -46188,7 +46255,7 @@ async function handleCloseCommand(directory, args, options = {}) {
46188
46255
  cleanedFiles.push(`${tmpFilesRemoved} .tmp.* file(s)`);
46189
46256
  }
46190
46257
  clearAllScopes(directory);
46191
- const contextPath = path31.join(swarmDir, "context.md");
46258
+ const contextPath = path32.join(swarmDir, "context.md");
46192
46259
  const contextContent = [
46193
46260
  "# Context",
46194
46261
  "",
@@ -46210,9 +46277,9 @@ async function handleCloseCommand(directory, args, options = {}) {
46210
46277
  const pruneBranches = args.includes("--prune-branches");
46211
46278
  let gitAlignResult = "";
46212
46279
  const prunedBranches = [];
46213
- const isGit = isGitRepo2(directory);
46214
- if (isGit) {
46215
- const aggressiveResult = resetToMainAfterMerge(directory, {
46280
+ const gitStatus = _internals23.getGitRepositoryStatus(directory);
46281
+ if (gitStatus.isRepo) {
46282
+ const aggressiveResult = _internals23.resetToMainAfterMerge(directory, {
46216
46283
  pruneBranches
46217
46284
  });
46218
46285
  if (aggressiveResult.success) {
@@ -46224,7 +46291,9 @@ async function handleCloseCommand(directory, args, options = {}) {
46224
46291
  warnings.push("Uncommitted changes were discarded during git alignment");
46225
46292
  }
46226
46293
  } else {
46227
- const alignResult = resetToRemoteBranch(directory, { pruneBranches });
46294
+ const alignResult = _internals23.resetToRemoteBranch(directory, {
46295
+ pruneBranches
46296
+ });
46228
46297
  gitAlignResult = alignResult.message;
46229
46298
  prunedBranches.push(...alignResult.prunedBranches);
46230
46299
  if (!alignResult.success) {
@@ -46237,6 +46306,12 @@ async function handleCloseCommand(directory, args, options = {}) {
46237
46306
  warnings.push(w);
46238
46307
  }
46239
46308
  }
46309
+ } else if (gitStatus.reason === "git_unavailable") {
46310
+ gitAlignResult = `Git executable unavailable \u2014 skipped git alignment: ${gitStatus.message}`;
46311
+ warnings.push(gitAlignResult);
46312
+ } else if (gitStatus.reason === "git_error") {
46313
+ gitAlignResult = `Git repository check failed \u2014 skipped git alignment: ${gitStatus.message}`;
46314
+ warnings.push(gitAlignResult);
46240
46315
  } else {
46241
46316
  gitAlignResult = "Not a git repository \u2014 skipped git alignment";
46242
46317
  }
@@ -46334,7 +46409,7 @@ ${otherWarnings.map((w) => `- ${w}`).join(`
46334
46409
  **Archive:** ${archiveResult}
46335
46410
  **Git:** ${gitAlignResult}${lessonSummary}${knowledgeHintSummary}${skillReviewOutput}${postMortemOutput}${warningMsg}`;
46336
46411
  }
46337
- var CLOSE_SKILL_REVIEW_TIMEOUT_MS = 120000, ARCHIVE_ARTIFACTS, ACTIVE_STATE_TO_CLEAN, ACTIVE_STATE_DIRS_TO_CLEAN;
46412
+ var CLOSE_SKILL_REVIEW_TIMEOUT_MS = 120000, ARCHIVE_ARTIFACTS, ACTIVE_STATE_TO_CLEAN, ACTIVE_STATE_DIRS_TO_CLEAN, _internals23;
46338
46413
  var init_close = __esm(() => {
46339
46414
  init_config();
46340
46415
  init_schema();
@@ -46398,6 +46473,15 @@ var init_close = __esm(() => {
46398
46473
  "locks",
46399
46474
  "spec-archive"
46400
46475
  ];
46476
+ _internals23 = {
46477
+ countSessionKnowledgeEntries,
46478
+ CLOSE_SKILL_REVIEW_TIMEOUT_MS,
46479
+ guaranteeAllPlansComplete,
46480
+ getGitRepositoryStatus,
46481
+ resetToMainAfterMerge,
46482
+ resetToRemoteBranch,
46483
+ copyDirRecursive
46484
+ };
46401
46485
  });
46402
46486
 
46403
46487
  // src/commands/codebase-review.ts
@@ -46630,14 +46714,14 @@ var init_concurrency = __esm(() => {
46630
46714
 
46631
46715
  // src/commands/config.ts
46632
46716
  import * as os5 from "os";
46633
- import * as path32 from "path";
46717
+ import * as path33 from "path";
46634
46718
  function getUserConfigDir2() {
46635
- return process.env.XDG_CONFIG_HOME || path32.join(os5.homedir(), ".config");
46719
+ return process.env.XDG_CONFIG_HOME || path33.join(os5.homedir(), ".config");
46636
46720
  }
46637
46721
  async function handleConfigCommand(directory, _args) {
46638
46722
  const config3 = loadPluginConfig(directory);
46639
- const userConfigPath = path32.join(getUserConfigDir2(), "opencode", "opencode-swarm.json");
46640
- const projectConfigPath = path32.join(directory, ".opencode", "opencode-swarm.json");
46723
+ const userConfigPath = path33.join(getUserConfigDir2(), "opencode", "opencode-swarm.json");
46724
+ const projectConfigPath = path33.join(directory, ".opencode", "opencode-swarm.json");
46641
46725
  const lines = [
46642
46726
  "## Swarm Configuration",
46643
46727
  "",
@@ -46677,9 +46761,9 @@ async function withTimeout(promise3, ms, timeoutError) {
46677
46761
  // src/services/skill-consolidation.ts
46678
46762
  import { existsSync as existsSync20 } from "fs";
46679
46763
  import { mkdir as mkdir14, readFile as readFile12, rename as rename8, writeFile as writeFile12 } from "fs/promises";
46680
- import * as path33 from "path";
46764
+ import * as path34 from "path";
46681
46765
  function consolidationStatePath(directory) {
46682
- return path33.join(directory, ".swarm", "skill-improver", "consolidation-state.json");
46766
+ return path34.join(directory, ".swarm", "skill-improver", "consolidation-state.json");
46683
46767
  }
46684
46768
  async function readState2(directory) {
46685
46769
  const filePath = consolidationStatePath(directory);
@@ -46695,7 +46779,7 @@ async function readState2(directory) {
46695
46779
  }
46696
46780
  }
46697
46781
  async function atomicWrite4(filePath, content) {
46698
- await mkdir14(path33.dirname(filePath), { recursive: true });
46782
+ await mkdir14(path34.dirname(filePath), { recursive: true });
46699
46783
  const tmp = `${filePath}.tmp-${process.pid}-${Date.now()}`;
46700
46784
  await writeFile12(tmp, content, "utf-8");
46701
46785
  await rename8(tmp, filePath);
@@ -46775,7 +46859,7 @@ async function runSkillConsolidationInner(req) {
46775
46859
  };
46776
46860
  }
46777
46861
  async function runSkillConsolidation(req) {
46778
- const key = path33.resolve(req.directory);
46862
+ const key = path34.resolve(req.directory);
46779
46863
  const existing = runningByDirectory.get(key);
46780
46864
  if (existing) {
46781
46865
  return {
@@ -46975,7 +47059,7 @@ var init_curate = __esm(() => {
46975
47059
  import * as child_process3 from "child_process";
46976
47060
  import { randomUUID as randomUUID2 } from "crypto";
46977
47061
  import { readdir as readdir3, readFile as readFile13, stat as stat7 } from "fs/promises";
46978
- import * as path34 from "path";
47062
+ import * as path35 from "path";
46979
47063
  import { promisify } from "util";
46980
47064
  function getExecFileAsync() {
46981
47065
  return promisify(child_process3.execFile);
@@ -47079,7 +47163,7 @@ async function scanSourceFiles(dir) {
47079
47163
  try {
47080
47164
  const entries = await readdir3(dir, { withFileTypes: true });
47081
47165
  for (const entry of entries) {
47082
- const fullPath = path34.join(dir, entry.name);
47166
+ const fullPath = path35.join(dir, entry.name);
47083
47167
  if (entry.isDirectory()) {
47084
47168
  if (skipDirs.has(entry.name)) {
47085
47169
  continue;
@@ -47087,7 +47171,7 @@ async function scanSourceFiles(dir) {
47087
47171
  const subFiles = await scanSourceFiles(fullPath);
47088
47172
  results.push(...subFiles);
47089
47173
  } else if (entry.isFile()) {
47090
- const ext = path34.extname(entry.name);
47174
+ const ext = path35.extname(entry.name);
47091
47175
  if ([".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(ext)) {
47092
47176
  results.push(fullPath);
47093
47177
  }
@@ -47109,8 +47193,8 @@ async function getStaticEdges(directory) {
47109
47193
  continue;
47110
47194
  }
47111
47195
  try {
47112
- const sourceDir = path34.dirname(sourceFile);
47113
- const resolvedPath = path34.resolve(sourceDir, importPath);
47196
+ const sourceDir = path35.dirname(sourceFile);
47197
+ const resolvedPath = path35.resolve(sourceDir, importPath);
47114
47198
  const extensions = [
47115
47199
  "",
47116
47200
  ".ts",
@@ -47135,8 +47219,8 @@ async function getStaticEdges(directory) {
47135
47219
  if (!targetFile) {
47136
47220
  continue;
47137
47221
  }
47138
- const relSource = path34.relative(directory, sourceFile).replace(/\\/g, "/");
47139
- const relTarget = path34.relative(directory, targetFile).replace(/\\/g, "/");
47222
+ const relSource = path35.relative(directory, sourceFile).replace(/\\/g, "/");
47223
+ const relTarget = path35.relative(directory, targetFile).replace(/\\/g, "/");
47140
47224
  const [key] = relSource < relTarget ? [`${relSource}::${relTarget}`, relSource, relTarget] : [`${relTarget}::${relSource}`, relTarget, relSource];
47141
47225
  edges.add(key);
47142
47226
  } catch {}
@@ -47148,7 +47232,7 @@ async function getStaticEdges(directory) {
47148
47232
  function isTestImplementationPair(fileA, fileB) {
47149
47233
  const testPatterns = [".test.ts", ".test.js", ".spec.ts", ".spec.js"];
47150
47234
  const getBaseName = (filePath) => {
47151
- const base = path34.basename(filePath);
47235
+ const base = path35.basename(filePath);
47152
47236
  for (const pattern of testPatterns) {
47153
47237
  if (base.endsWith(pattern)) {
47154
47238
  return base.slice(0, -pattern.length);
@@ -47158,16 +47242,16 @@ function isTestImplementationPair(fileA, fileB) {
47158
47242
  };
47159
47243
  const baseA = getBaseName(fileA);
47160
47244
  const baseB = getBaseName(fileB);
47161
- return baseA === baseB && baseA !== path34.basename(fileA) && baseA !== path34.basename(fileB);
47245
+ return baseA === baseB && baseA !== path35.basename(fileA) && baseA !== path35.basename(fileB);
47162
47246
  }
47163
47247
  function hasSharedPrefix(fileA, fileB) {
47164
- const dirA = path34.dirname(fileA);
47165
- const dirB = path34.dirname(fileB);
47248
+ const dirA = path35.dirname(fileA);
47249
+ const dirB = path35.dirname(fileB);
47166
47250
  if (dirA !== dirB) {
47167
47251
  return false;
47168
47252
  }
47169
- const baseA = path34.basename(fileA).replace(/\.(ts|js|tsx|jsx|mjs)$/, "");
47170
- const baseB = path34.basename(fileB).replace(/\.(ts|js|tsx|jsx|mjs)$/, "");
47253
+ const baseA = path35.basename(fileA).replace(/\.(ts|js|tsx|jsx|mjs)$/, "");
47254
+ const baseB = path35.basename(fileB).replace(/\.(ts|js|tsx|jsx|mjs)$/, "");
47171
47255
  if (baseA.startsWith(baseB) || baseB.startsWith(baseA)) {
47172
47256
  return true;
47173
47257
  }
@@ -47196,9 +47280,9 @@ async function detectDarkMatter(directory, options) {
47196
47280
  } catch {
47197
47281
  return [];
47198
47282
  }
47199
- const commitMap = await _internals23.parseGitLog(directory, maxCommitsToAnalyze);
47200
- const matrix = _internals23.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
47201
- const staticEdges = await _internals23.getStaticEdges(directory);
47283
+ const commitMap = await _internals24.parseGitLog(directory, maxCommitsToAnalyze);
47284
+ const matrix = _internals24.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
47285
+ const staticEdges = await _internals24.getStaticEdges(directory);
47202
47286
  const results = [];
47203
47287
  for (const entry of matrix.values()) {
47204
47288
  const key = `${entry.fileA}::${entry.fileB}`;
@@ -47222,8 +47306,8 @@ function darkMatterToKnowledgeEntries(pairs, projectName) {
47222
47306
  const entries = [];
47223
47307
  const now = new Date().toISOString();
47224
47308
  for (const pair of pairs.slice(0, 10)) {
47225
- const baseA = path34.basename(pair.fileA);
47226
- const baseB = path34.basename(pair.fileB);
47309
+ const baseA = path35.basename(pair.fileA);
47310
+ const baseB = path35.basename(pair.fileB);
47227
47311
  let lesson = `Files ${pair.fileA} and ${pair.fileB} co-change with NPMI=${pair.npmi.toFixed(3)} but have no import relationship. This hidden coupling suggests a shared architectural concern \u2014 changes to one likely require changes to the other.`;
47228
47312
  if (lesson.length > 280) {
47229
47313
  lesson = `Files ${baseA} and ${baseB} co-change with NPMI=${pair.npmi.toFixed(3)} but have no import relationship. This hidden coupling suggests a shared architectural concern \u2014 changes to one likely require changes to the other.`;
@@ -47286,7 +47370,7 @@ ${rows}
47286
47370
  These pairs likely share an architectural concern invisible to static analysis.
47287
47371
  Consider adding explicit documentation or extracting the shared concern.`;
47288
47372
  }
47289
- var co_change_analyzer, _internals23;
47373
+ var co_change_analyzer, _internals24;
47290
47374
  var init_co_change_analyzer = __esm(() => {
47291
47375
  init_zod();
47292
47376
  init_create_tool();
@@ -47318,11 +47402,11 @@ var init_co_change_analyzer = __esm(() => {
47318
47402
  npmiThreshold,
47319
47403
  maxCommitsToAnalyze
47320
47404
  };
47321
- const pairs = await _internals23.detectDarkMatter(directory, options);
47322
- return _internals23.formatDarkMatterOutput(pairs);
47405
+ const pairs = await _internals24.detectDarkMatter(directory, options);
47406
+ return _internals24.formatDarkMatterOutput(pairs);
47323
47407
  }
47324
47408
  });
47325
- _internals23 = {
47409
+ _internals24 = {
47326
47410
  parseGitLog,
47327
47411
  buildCoChangeMatrix,
47328
47412
  getStaticEdges,
@@ -47333,7 +47417,7 @@ var init_co_change_analyzer = __esm(() => {
47333
47417
  });
47334
47418
 
47335
47419
  // src/commands/dark-matter.ts
47336
- import path35 from "path";
47420
+ import path36 from "path";
47337
47421
  async function handleDarkMatterCommand(directory, args) {
47338
47422
  const options = {};
47339
47423
  for (let i = 0;i < args.length; i++) {
@@ -47353,7 +47437,7 @@ async function handleDarkMatterCommand(directory, args) {
47353
47437
  }
47354
47438
  let pairs;
47355
47439
  try {
47356
- pairs = await _internals23.detectDarkMatter(directory, options);
47440
+ pairs = await _internals24.detectDarkMatter(directory, options);
47357
47441
  } catch (err) {
47358
47442
  const errMsg = err instanceof Error ? err.message : String(err);
47359
47443
  return `## Dark Matter Analysis Failed
@@ -47365,7 +47449,7 @@ Ensure this is a git repository with commit history.`;
47365
47449
  const output = formatDarkMatterOutput(pairs);
47366
47450
  if (pairs.length > 0) {
47367
47451
  try {
47368
- const projectName = path35.basename(path35.resolve(directory));
47452
+ const projectName = path36.basename(path36.resolve(directory));
47369
47453
  const entries = darkMatterToKnowledgeEntries(pairs, projectName);
47370
47454
  if (entries.length > 0) {
47371
47455
  const knowledgePath = resolveSwarmKnowledgePath(directory);
@@ -47731,44 +47815,44 @@ var init_design_docs = __esm(() => {
47731
47815
 
47732
47816
  // src/config/cache-paths.ts
47733
47817
  import * as os6 from "os";
47734
- import * as path36 from "path";
47818
+ import * as path37 from "path";
47735
47819
  function getPluginConfigDir() {
47736
- return path36.join(process.env.XDG_CONFIG_HOME || path36.join(os6.homedir(), ".config"), "opencode");
47820
+ return path37.join(process.env.XDG_CONFIG_HOME || path37.join(os6.homedir(), ".config"), "opencode");
47737
47821
  }
47738
47822
  function getPluginCachePaths() {
47739
- const cacheBase = process.env.XDG_CACHE_HOME || path36.join(os6.homedir(), ".cache");
47823
+ const cacheBase = process.env.XDG_CACHE_HOME || path37.join(os6.homedir(), ".cache");
47740
47824
  const configDir = getPluginConfigDir();
47741
47825
  const paths = [
47742
- path36.join(cacheBase, "opencode", "node_modules", "opencode-swarm"),
47743
- path36.join(cacheBase, "opencode", "packages", "opencode-swarm@latest"),
47744
- path36.join(configDir, "node_modules", "opencode-swarm")
47826
+ path37.join(cacheBase, "opencode", "node_modules", "opencode-swarm"),
47827
+ path37.join(cacheBase, "opencode", "packages", "opencode-swarm@latest"),
47828
+ path37.join(configDir, "node_modules", "opencode-swarm")
47745
47829
  ];
47746
47830
  if (process.platform === "darwin") {
47747
- const libCaches = path36.join(os6.homedir(), "Library", "Caches");
47748
- paths.push(path36.join(libCaches, "opencode", "node_modules", "opencode-swarm"), path36.join(libCaches, "opencode", "packages", "opencode-swarm@latest"));
47831
+ const libCaches = path37.join(os6.homedir(), "Library", "Caches");
47832
+ paths.push(path37.join(libCaches, "opencode", "node_modules", "opencode-swarm"), path37.join(libCaches, "opencode", "packages", "opencode-swarm@latest"));
47749
47833
  }
47750
47834
  if (process.platform === "win32") {
47751
- const localAppData = process.env.LOCALAPPDATA || path36.join(os6.homedir(), "AppData", "Local");
47752
- const appData = process.env.APPDATA || path36.join(os6.homedir(), "AppData", "Roaming");
47753
- paths.push(path36.join(localAppData, "opencode", "node_modules", "opencode-swarm"), path36.join(localAppData, "opencode", "packages", "opencode-swarm@latest"), path36.join(appData, "opencode", "node_modules", "opencode-swarm"));
47835
+ const localAppData = process.env.LOCALAPPDATA || path37.join(os6.homedir(), "AppData", "Local");
47836
+ const appData = process.env.APPDATA || path37.join(os6.homedir(), "AppData", "Roaming");
47837
+ paths.push(path37.join(localAppData, "opencode", "node_modules", "opencode-swarm"), path37.join(localAppData, "opencode", "packages", "opencode-swarm@latest"), path37.join(appData, "opencode", "node_modules", "opencode-swarm"));
47754
47838
  }
47755
47839
  return paths;
47756
47840
  }
47757
47841
  function getPluginLockFilePaths() {
47758
- const cacheBase = process.env.XDG_CACHE_HOME || path36.join(os6.homedir(), ".cache");
47842
+ const cacheBase = process.env.XDG_CACHE_HOME || path37.join(os6.homedir(), ".cache");
47759
47843
  const configDir = getPluginConfigDir();
47760
47844
  const paths = [
47761
- path36.join(cacheBase, "opencode", "bun.lock"),
47762
- path36.join(cacheBase, "opencode", "bun.lockb"),
47763
- path36.join(configDir, "package-lock.json")
47845
+ path37.join(cacheBase, "opencode", "bun.lock"),
47846
+ path37.join(cacheBase, "opencode", "bun.lockb"),
47847
+ path37.join(configDir, "package-lock.json")
47764
47848
  ];
47765
47849
  if (process.platform === "darwin") {
47766
- const libCaches = path36.join(os6.homedir(), "Library", "Caches");
47767
- paths.push(path36.join(libCaches, "opencode", "bun.lock"), path36.join(libCaches, "opencode", "bun.lockb"));
47850
+ const libCaches = path37.join(os6.homedir(), "Library", "Caches");
47851
+ paths.push(path37.join(libCaches, "opencode", "bun.lock"), path37.join(libCaches, "opencode", "bun.lockb"));
47768
47852
  }
47769
47853
  if (process.platform === "win32") {
47770
- const localAppData = process.env.LOCALAPPDATA || path36.join(os6.homedir(), "AppData", "Local");
47771
- paths.push(path36.join(localAppData, "opencode", "bun.lock"), path36.join(localAppData, "opencode", "bun.lockb"));
47854
+ const localAppData = process.env.LOCALAPPDATA || path37.join(os6.homedir(), "AppData", "Local");
47855
+ paths.push(path37.join(localAppData, "opencode", "bun.lock"), path37.join(localAppData, "opencode", "bun.lockb"));
47772
47856
  }
47773
47857
  return paths;
47774
47858
  }
@@ -47964,10 +48048,10 @@ function cacheFile() {
47964
48048
  }
47965
48049
  function readVersionCache() {
47966
48050
  try {
47967
- const path37 = cacheFile();
47968
- if (!existsSync21(path37))
48051
+ const path38 = cacheFile();
48052
+ if (!existsSync21(path38))
47969
48053
  return null;
47970
- const raw = readFileSync11(path37, "utf-8");
48054
+ const raw = readFileSync11(path38, "utf-8");
47971
48055
  const parsed = JSON.parse(raw);
47972
48056
  if (typeof parsed?.checkedAt !== "number")
47973
48057
  return null;
@@ -48217,7 +48301,7 @@ var init_knowledge_diagnostics = __esm(() => {
48217
48301
  // src/services/diagnose-service.ts
48218
48302
  import * as child_process4 from "child_process";
48219
48303
  import { existsSync as existsSync23, readdirSync as readdirSync7, readFileSync as readFileSync12, statSync as statSync9 } from "fs";
48220
- import path37 from "path";
48304
+ import path38 from "path";
48221
48305
  import { fileURLToPath } from "url";
48222
48306
  function validateTaskDag(plan) {
48223
48307
  const allTaskIds = new Set;
@@ -48528,7 +48612,7 @@ async function checkSpecStaleness(directory, plan) {
48528
48612
  };
48529
48613
  }
48530
48614
  async function checkConfigParseability(directory) {
48531
- const configPath = path37.join(directory, ".opencode/opencode-swarm.json");
48615
+ const configPath = path38.join(directory, ".opencode/opencode-swarm.json");
48532
48616
  if (!existsSync23(configPath)) {
48533
48617
  return {
48534
48618
  name: "Config Parseability",
@@ -48557,7 +48641,7 @@ function resolveGrammarDir(thisDir) {
48557
48641
  const normalized = thisDir.replace(/\\/g, "/");
48558
48642
  const isSource = normalized.endsWith("/src/services");
48559
48643
  const isCliBundle = normalized.endsWith("/cli");
48560
- return isSource || isCliBundle ? path37.join(thisDir, "..", "lang", "grammars") : path37.join(thisDir, "lang", "grammars");
48644
+ return isSource || isCliBundle ? path38.join(thisDir, "..", "lang", "grammars") : path38.join(thisDir, "lang", "grammars");
48561
48645
  }
48562
48646
  async function checkGrammarWasmFiles() {
48563
48647
  const grammarFiles = [
@@ -48581,14 +48665,14 @@ async function checkGrammarWasmFiles() {
48581
48665
  "tree-sitter-ini.wasm",
48582
48666
  "tree-sitter-regex.wasm"
48583
48667
  ];
48584
- const thisDir = path37.dirname(fileURLToPath(import.meta.url));
48668
+ const thisDir = path38.dirname(fileURLToPath(import.meta.url));
48585
48669
  const grammarDir = resolveGrammarDir(thisDir);
48586
48670
  const missing = [];
48587
- if (!existsSync23(path37.join(grammarDir, "tree-sitter.wasm"))) {
48671
+ if (!existsSync23(path38.join(grammarDir, "tree-sitter.wasm"))) {
48588
48672
  missing.push("tree-sitter.wasm (core runtime)");
48589
48673
  }
48590
48674
  for (const file3 of grammarFiles) {
48591
- if (!existsSync23(path37.join(grammarDir, file3))) {
48675
+ if (!existsSync23(path38.join(grammarDir, file3))) {
48592
48676
  missing.push(file3);
48593
48677
  }
48594
48678
  }
@@ -48606,7 +48690,7 @@ async function checkGrammarWasmFiles() {
48606
48690
  };
48607
48691
  }
48608
48692
  async function checkCheckpointManifest(directory) {
48609
- const manifestPath = path37.join(directory, ".swarm/checkpoints.json");
48693
+ const manifestPath = path38.join(directory, ".swarm/checkpoints.json");
48610
48694
  if (!existsSync23(manifestPath)) {
48611
48695
  return {
48612
48696
  name: "Checkpoint Manifest",
@@ -48658,7 +48742,7 @@ async function checkCheckpointManifest(directory) {
48658
48742
  }
48659
48743
  }
48660
48744
  async function checkEventStreamIntegrity(directory) {
48661
- const eventsPath = path37.join(directory, ".swarm/events.jsonl");
48745
+ const eventsPath = path38.join(directory, ".swarm/events.jsonl");
48662
48746
  if (!existsSync23(eventsPath)) {
48663
48747
  return {
48664
48748
  name: "Event Stream",
@@ -48699,7 +48783,7 @@ async function checkEventStreamIntegrity(directory) {
48699
48783
  }
48700
48784
  }
48701
48785
  async function checkSteeringDirectives(directory) {
48702
- const eventsPath = path37.join(directory, ".swarm/events.jsonl");
48786
+ const eventsPath = path38.join(directory, ".swarm/events.jsonl");
48703
48787
  if (!existsSync23(eventsPath)) {
48704
48788
  return {
48705
48789
  name: "Steering Directives",
@@ -48755,7 +48839,7 @@ async function checkCurator(directory) {
48755
48839
  detail: "Disabled (enable via curator.enabled)"
48756
48840
  };
48757
48841
  }
48758
- const summaryPath = path37.join(directory, ".swarm/curator-summary.json");
48842
+ const summaryPath = path38.join(directory, ".swarm/curator-summary.json");
48759
48843
  if (!existsSync23(summaryPath)) {
48760
48844
  return {
48761
48845
  name: "Curator",
@@ -48922,7 +49006,7 @@ async function getDiagnoseData(directory) {
48922
49006
  checks5.push(await checkCurator(directory));
48923
49007
  checks5.push(await checkKnowledgeHealth(directory));
48924
49008
  try {
48925
- const evidenceDir = path37.join(directory, ".swarm", "evidence");
49009
+ const evidenceDir = path38.join(directory, ".swarm", "evidence");
48926
49010
  const snapshotFiles = existsSync23(evidenceDir) ? readdirSync7(evidenceDir).filter((f) => f.startsWith("agent-tools-") && f.endsWith(".json")) : [];
48927
49011
  if (snapshotFiles.length > 0) {
48928
49012
  const latest = snapshotFiles.sort().pop();
@@ -48960,7 +49044,7 @@ async function getDiagnoseData(directory) {
48960
49044
  cacheRows.push(`\u2B1C ${cachePath} \u2014 absent`);
48961
49045
  continue;
48962
49046
  }
48963
- const pkgJsonPath = path37.join(cachePath, "package.json");
49047
+ const pkgJsonPath = path38.join(cachePath, "package.json");
48964
49048
  try {
48965
49049
  const raw = readFileSync12(pkgJsonPath, "utf-8");
48966
49050
  const parsed = JSON.parse(raw);
@@ -49055,7 +49139,7 @@ __export(exports_config_doctor, {
49055
49139
  import * as crypto4 from "crypto";
49056
49140
  import * as fs14 from "fs";
49057
49141
  import * as os7 from "os";
49058
- import * as path38 from "path";
49142
+ import * as path39 from "path";
49059
49143
  function levenshteinDistance(a, b) {
49060
49144
  const al = a.length;
49061
49145
  const bl = b.length;
@@ -49088,11 +49172,11 @@ function emitObjectTypeMismatch(key, value, findings) {
49088
49172
  }
49089
49173
  }
49090
49174
  function getUserConfigDir3() {
49091
- return process.env.XDG_CONFIG_HOME || path38.join(os7.homedir(), ".config");
49175
+ return process.env.XDG_CONFIG_HOME || path39.join(os7.homedir(), ".config");
49092
49176
  }
49093
49177
  function getConfigPaths(directory) {
49094
- const userConfigPath = path38.join(getUserConfigDir3(), "opencode", "opencode-swarm.json");
49095
- const projectConfigPath = path38.join(directory, ".opencode", "opencode-swarm.json");
49178
+ const userConfigPath = path39.join(getUserConfigDir3(), "opencode", "opencode-swarm.json");
49179
+ const projectConfigPath = path39.join(directory, ".opencode", "opencode-swarm.json");
49096
49180
  return { userConfigPath, projectConfigPath };
49097
49181
  }
49098
49182
  function computeHash(content) {
@@ -49110,9 +49194,9 @@ function isValidConfigPath(configPath, directory) {
49110
49194
  }
49111
49195
  const { userConfigPath, projectConfigPath } = getConfigPaths(directory);
49112
49196
  try {
49113
- const resolvedConfig = path38.resolve(configPath);
49114
- const resolvedUser = path38.resolve(userConfigPath);
49115
- const resolvedProject = path38.resolve(projectConfigPath);
49197
+ const resolvedConfig = path39.resolve(configPath);
49198
+ const resolvedUser = path39.resolve(userConfigPath);
49199
+ const resolvedProject = path39.resolve(projectConfigPath);
49116
49200
  if (resolvedConfig !== resolvedUser && resolvedConfig !== resolvedProject) {
49117
49201
  return false;
49118
49202
  }
@@ -49175,12 +49259,12 @@ function createConfigBackup(directory) {
49175
49259
  };
49176
49260
  }
49177
49261
  function writeBackupArtifact(directory, backup) {
49178
- const swarmDir = path38.join(directory, ".swarm");
49262
+ const swarmDir = path39.join(directory, ".swarm");
49179
49263
  if (!fs14.existsSync(swarmDir)) {
49180
49264
  fs14.mkdirSync(swarmDir, { recursive: true });
49181
49265
  }
49182
49266
  const backupFilename = `config-backup-${backup.createdAt}.json`;
49183
- const backupPath = path38.join(swarmDir, backupFilename);
49267
+ const backupPath = path39.join(swarmDir, backupFilename);
49184
49268
  const artifact = {
49185
49269
  createdAt: backup.createdAt,
49186
49270
  configPath: backup.configPath,
@@ -49195,9 +49279,9 @@ function restoreFromBackup(backupPath, directory) {
49195
49279
  if (!fs14.existsSync(backupPath)) {
49196
49280
  return null;
49197
49281
  }
49198
- const swarmDir = path38.resolve(path38.join(directory, ".swarm"));
49199
- const resolvedBackup = path38.resolve(backupPath);
49200
- if (!resolvedBackup.startsWith(swarmDir + path38.sep) && resolvedBackup !== swarmDir) {
49282
+ const swarmDir = path39.resolve(path39.join(directory, ".swarm"));
49283
+ const resolvedBackup = path39.resolve(backupPath);
49284
+ if (!resolvedBackup.startsWith(swarmDir + path39.sep) && resolvedBackup !== swarmDir) {
49201
49285
  return null;
49202
49286
  }
49203
49287
  try {
@@ -49216,7 +49300,7 @@ function restoreFromBackup(backupPath, directory) {
49216
49300
  }
49217
49301
  log("[ConfigDoctor] Warning: restoring from backup with legacy numeric hash (pre-SHA-256). Consider re-backing up.", {});
49218
49302
  const targetPath = artifact.configPath;
49219
- const targetDir = path38.dirname(targetPath);
49303
+ const targetDir = path39.dirname(targetPath);
49220
49304
  if (!fs14.existsSync(targetDir)) {
49221
49305
  fs14.mkdirSync(targetDir, { recursive: true });
49222
49306
  }
@@ -49250,10 +49334,10 @@ function readConfigFromFile(directory) {
49250
49334
  return null;
49251
49335
  }
49252
49336
  }
49253
- function validateConfigKey(path39, value) {
49337
+ function validateConfigKey(path40, value) {
49254
49338
  const findings = [];
49255
49339
  for (const [depPath, depInfo] of DEPRECATED_FIELDS) {
49256
- if (path39 === depPath && !depInfo.isDefaultValue(value)) {
49340
+ if (path40 === depPath && !depInfo.isDefaultValue(value)) {
49257
49341
  findings.push({
49258
49342
  id: "deprecated-field",
49259
49343
  title: `Deprecated config field: ${depPath}`,
@@ -49265,7 +49349,7 @@ function validateConfigKey(path39, value) {
49265
49349
  });
49266
49350
  }
49267
49351
  }
49268
- switch (path39) {
49352
+ switch (path40) {
49269
49353
  case "agents": {
49270
49354
  if (value !== undefined) {
49271
49355
  findings.push({
@@ -49818,7 +49902,7 @@ function validateConfigKey(path39, value) {
49818
49902
  break;
49819
49903
  }
49820
49904
  default: {
49821
- const topLevel = path39.split(".")[0];
49905
+ const topLevel = path40.split(".")[0];
49822
49906
  if (KNOWN_TOP_LEVEL_KEYS.has(topLevel)) {
49823
49907
  break;
49824
49908
  }
@@ -49840,9 +49924,9 @@ function validateConfigKey(path39, value) {
49840
49924
  findings.push({
49841
49925
  id: "unknown-config-key",
49842
49926
  title: `Unknown config key: ${topLevel}`,
49843
- description: `Unknown config key "${path39}" is not in the schema. Did you mean "${suggestion}"?`,
49927
+ description: `Unknown config key "${path40}" is not in the schema. Did you mean "${suggestion}"?`,
49844
49928
  severity: "warn",
49845
- path: path39,
49929
+ path: path40,
49846
49930
  currentValue: value,
49847
49931
  autoFixable: false
49848
49932
  });
@@ -49850,9 +49934,9 @@ function validateConfigKey(path39, value) {
49850
49934
  findings.push({
49851
49935
  id: "unknown-config-key",
49852
49936
  title: `Unknown config key: ${topLevel}`,
49853
- description: `Unknown config key "${path39}" is not in the schema.`,
49937
+ description: `Unknown config key "${path40}" is not in the schema.`,
49854
49938
  severity: "warn",
49855
- path: path39,
49939
+ path: path40,
49856
49940
  currentValue: value,
49857
49941
  autoFixable: false
49858
49942
  });
@@ -49862,26 +49946,26 @@ function validateConfigKey(path39, value) {
49862
49946
  }
49863
49947
  return findings;
49864
49948
  }
49865
- function walkConfigAndValidate(obj, path39, findings, visited = new WeakSet) {
49949
+ function walkConfigAndValidate(obj, path40, findings, visited = new WeakSet) {
49866
49950
  if (obj === null || obj === undefined) {
49867
49951
  return;
49868
49952
  }
49869
- if (path39 && typeof obj === "object" && !Array.isArray(obj)) {
49870
- const keyFindings = validateConfigKey(path39, obj);
49953
+ if (path40 && typeof obj === "object" && !Array.isArray(obj)) {
49954
+ const keyFindings = validateConfigKey(path40, obj);
49871
49955
  findings.push(...keyFindings);
49872
49956
  }
49873
49957
  if (typeof obj !== "object") {
49874
- const keyFindings = validateConfigKey(path39, obj);
49958
+ const keyFindings = validateConfigKey(path40, obj);
49875
49959
  findings.push(...keyFindings);
49876
49960
  return;
49877
49961
  }
49878
49962
  if (visited.has(obj)) {
49879
49963
  findings.push({
49880
49964
  id: "circular-reference",
49881
- title: `Circular reference detected at ${path39}`,
49882
- description: `Config value at "${path39}" contains a circular reference. Validation stopped at this path to prevent stack overflow.`,
49965
+ title: `Circular reference detected at ${path40}`,
49966
+ description: `Config value at "${path40}" contains a circular reference. Validation stopped at this path to prevent stack overflow.`,
49883
49967
  severity: "error",
49884
- path: path39,
49968
+ path: path40,
49885
49969
  currentValue: "[circular]",
49886
49970
  autoFixable: false
49887
49971
  });
@@ -49889,15 +49973,15 @@ function walkConfigAndValidate(obj, path39, findings, visited = new WeakSet) {
49889
49973
  }
49890
49974
  visited.add(obj);
49891
49975
  if (Array.isArray(obj)) {
49892
- const arrayFindings = validateConfigKey(path39, obj);
49976
+ const arrayFindings = validateConfigKey(path40, obj);
49893
49977
  findings.push(...arrayFindings);
49894
49978
  obj.forEach((item, index) => {
49895
- walkConfigAndValidate(item, `${path39}[${index}]`, findings, visited);
49979
+ walkConfigAndValidate(item, `${path40}[${index}]`, findings, visited);
49896
49980
  });
49897
49981
  return;
49898
49982
  }
49899
49983
  for (const [key, value] of Object.entries(obj)) {
49900
- const newPath = path39 ? `${path39}.${key}` : key;
49984
+ const newPath = path40 ? `${path40}.${key}` : key;
49901
49985
  walkConfigAndValidate(value, newPath, findings, visited);
49902
49986
  }
49903
49987
  }
@@ -50017,7 +50101,7 @@ function applySafeAutoFixes(directory, result) {
50017
50101
  }
50018
50102
  }
50019
50103
  if (appliedFixes.length > 0) {
50020
- const configDir = path38.dirname(configPath);
50104
+ const configDir = path39.dirname(configPath);
50021
50105
  if (!fs14.existsSync(configDir)) {
50022
50106
  fs14.mkdirSync(configDir, { recursive: true });
50023
50107
  }
@@ -50028,7 +50112,7 @@ function applySafeAutoFixes(directory, result) {
50028
50112
  }
50029
50113
  function readDoctorArtifact(directory) {
50030
50114
  try {
50031
- const artifactPath = path38.join(directory, ".swarm", "config-doctor.json");
50115
+ const artifactPath = path39.join(directory, ".swarm", "config-doctor.json");
50032
50116
  if (!fs14.existsSync(artifactPath)) {
50033
50117
  return null;
50034
50118
  }
@@ -50061,12 +50145,12 @@ function readDoctorArtifact(directory) {
50061
50145
  }
50062
50146
  }
50063
50147
  function writeDoctorArtifact(directory, result) {
50064
- const swarmDir = path38.join(directory, ".swarm");
50148
+ const swarmDir = path39.join(directory, ".swarm");
50065
50149
  if (!fs14.existsSync(swarmDir)) {
50066
50150
  fs14.mkdirSync(swarmDir, { recursive: true });
50067
50151
  }
50068
50152
  const artifactFilename = "config-doctor.json";
50069
- const artifactPath = path38.join(swarmDir, artifactFilename);
50153
+ const artifactPath = path39.join(swarmDir, artifactFilename);
50070
50154
  const guiOutput = {
50071
50155
  timestamp: result.timestamp,
50072
50156
  summary: result.summary,
@@ -50162,17 +50246,17 @@ function detectStraySwarmDirs(projectRoot) {
50162
50246
  if (!entry.isDirectory())
50163
50247
  continue;
50164
50248
  const name = entry.name;
50165
- const fullPath = path38.join(dir, name);
50249
+ const fullPath = path39.join(dir, name);
50166
50250
  if (SKIP_DIRS.has(name))
50167
50251
  continue;
50168
- const gitPath = path38.join(fullPath, ".git");
50252
+ const gitPath = path39.join(fullPath, ".git");
50169
50253
  try {
50170
50254
  const gitStat = fs14.statSync(gitPath);
50171
50255
  if (gitStat.isFile() || gitStat.isDirectory())
50172
50256
  continue;
50173
50257
  } catch {}
50174
50258
  if (name === ".swarm") {
50175
- const parentDir = path38.dirname(fullPath);
50259
+ const parentDir = path39.dirname(fullPath);
50176
50260
  if (parentDir === projectRoot)
50177
50261
  continue;
50178
50262
  let contents = [];
@@ -50182,7 +50266,7 @@ function detectStraySwarmDirs(projectRoot) {
50182
50266
  contents = ["<unreadable>"];
50183
50267
  }
50184
50268
  findings.push({
50185
- path: path38.relative(projectRoot, fullPath).replace(/\\/g, "/"),
50269
+ path: path39.relative(projectRoot, fullPath).replace(/\\/g, "/"),
50186
50270
  absolutePath: fullPath,
50187
50271
  contents: contents.slice(0, MAX_CONTENTS_ENTRIES),
50188
50272
  totalEntries: contents.length
@@ -50200,21 +50284,21 @@ function removeStraySwarmDir(projectRoot, strayPath) {
50200
50284
  let canonicalStray;
50201
50285
  try {
50202
50286
  canonicalRoot = fs14.realpathSync(projectRoot);
50203
- canonicalStray = fs14.realpathSync(path38.isAbsolute(strayPath) ? strayPath : path38.resolve(projectRoot, strayPath));
50287
+ canonicalStray = fs14.realpathSync(path39.isAbsolute(strayPath) ? strayPath : path39.resolve(projectRoot, strayPath));
50204
50288
  } catch (err) {
50205
50289
  return {
50206
50290
  success: false,
50207
50291
  message: `Failed to resolve paths: ${err instanceof Error ? err.message : String(err)}`
50208
50292
  };
50209
50293
  }
50210
- const rootSwarm = path38.join(canonicalRoot, ".swarm");
50294
+ const rootSwarm = path39.join(canonicalRoot, ".swarm");
50211
50295
  if (canonicalStray === rootSwarm || canonicalStray === canonicalRoot) {
50212
50296
  return {
50213
50297
  success: false,
50214
50298
  message: "Refusing to remove root .swarm/ directory"
50215
50299
  };
50216
50300
  }
50217
- if (!canonicalStray.startsWith(canonicalRoot + path38.sep)) {
50301
+ if (!canonicalStray.startsWith(canonicalRoot + path39.sep)) {
50218
50302
  return {
50219
50303
  success: false,
50220
50304
  message: "Path is outside project root \u2014 refusing to remove"
@@ -51397,7 +51481,7 @@ var init_detector = __esm(() => {
51397
51481
 
51398
51482
  // src/build/discovery.ts
51399
51483
  import * as fs15 from "fs";
51400
- import * as path39 from "path";
51484
+ import * as path40 from "path";
51401
51485
  function isCommandAvailable(command) {
51402
51486
  if (toolchainCache.has(command)) {
51403
51487
  return toolchainCache.get(command);
@@ -51405,7 +51489,7 @@ function isCommandAvailable(command) {
51405
51489
  const isWindows = process.platform === "win32";
51406
51490
  const cmd = isWindows ? `${command}.exe` : command;
51407
51491
  try {
51408
- const result = _internals24.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
51492
+ const result = _internals25.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
51409
51493
  cwd: process.cwd(),
51410
51494
  stdin: "ignore",
51411
51495
  stdout: "ignore",
@@ -51432,11 +51516,11 @@ function findBuildFiles(workingDir, patterns) {
51432
51516
  const regex = simpleGlobToRegex(pattern);
51433
51517
  const matches = files.filter((f) => regex.test(f));
51434
51518
  if (matches.length > 0) {
51435
- return path39.join(dir, matches[0]);
51519
+ return path40.join(dir, matches[0]);
51436
51520
  }
51437
51521
  } catch {}
51438
51522
  } else {
51439
- const filePath = path39.join(workingDir, pattern);
51523
+ const filePath = path40.join(workingDir, pattern);
51440
51524
  if (fs15.existsSync(filePath)) {
51441
51525
  return filePath;
51442
51526
  }
@@ -51445,7 +51529,7 @@ function findBuildFiles(workingDir, patterns) {
51445
51529
  return null;
51446
51530
  }
51447
51531
  function getRepoDefinedScripts(workingDir, scripts) {
51448
- const packageJsonPath = path39.join(workingDir, "package.json");
51532
+ const packageJsonPath = path40.join(workingDir, "package.json");
51449
51533
  if (!fs15.existsSync(packageJsonPath)) {
51450
51534
  return [];
51451
51535
  }
@@ -51486,7 +51570,7 @@ function findAllBuildFiles(workingDir) {
51486
51570
  const regex = simpleGlobToRegex(pattern);
51487
51571
  findFilesRecursive(workingDir, regex, allBuildFiles);
51488
51572
  } else {
51489
- const filePath = path39.join(workingDir, pattern);
51573
+ const filePath = path40.join(workingDir, pattern);
51490
51574
  if (fs15.existsSync(filePath)) {
51491
51575
  allBuildFiles.add(filePath);
51492
51576
  }
@@ -51499,7 +51583,7 @@ function findFilesRecursive(dir, regex, results) {
51499
51583
  try {
51500
51584
  const entries = fs15.readdirSync(dir, { withFileTypes: true });
51501
51585
  for (const entry of entries) {
51502
- const fullPath = path39.join(dir, entry.name);
51586
+ const fullPath = path40.join(dir, entry.name);
51503
51587
  if (entry.isDirectory() && !["node_modules", ".git", "dist", "build", "target"].includes(entry.name)) {
51504
51588
  findFilesRecursive(fullPath, regex, results);
51505
51589
  } else if (entry.isFile() && regex.test(entry.name)) {
@@ -51522,7 +51606,7 @@ async function discoverBuildCommandsFromProfiles(workingDir) {
51522
51606
  let foundCommand = false;
51523
51607
  for (const cmd of sortedCommands) {
51524
51608
  if (cmd.detectFile) {
51525
- const detectFilePath = path39.join(workingDir, cmd.detectFile);
51609
+ const detectFilePath = path40.join(workingDir, cmd.detectFile);
51526
51610
  if (!fs15.existsSync(detectFilePath)) {
51527
51611
  continue;
51528
51612
  }
@@ -51555,7 +51639,7 @@ async function discoverBuildCommands(workingDir, options) {
51555
51639
  const scope = options?.scope ?? "all";
51556
51640
  const changedFiles = options?.changedFiles ?? [];
51557
51641
  const _filesToCheck = filterByScope(workingDir, scope, changedFiles);
51558
- const profileResult = await _internals24.discoverBuildCommandsFromProfiles(workingDir);
51642
+ const profileResult = await _internals25.discoverBuildCommandsFromProfiles(workingDir);
51559
51643
  const profileCommands = profileResult.commands;
51560
51644
  const profileSkipped = profileResult.skipped;
51561
51645
  const coveredEcosystems = new Set;
@@ -51618,7 +51702,7 @@ function clearToolchainCache() {
51618
51702
  function getEcosystems() {
51619
51703
  return ECOSYSTEMS.map((e) => e.ecosystem);
51620
51704
  }
51621
- var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals24, build_discovery;
51705
+ var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals25, build_discovery;
51622
51706
  var init_discovery = __esm(() => {
51623
51707
  init_dist();
51624
51708
  init_detector();
@@ -51736,7 +51820,7 @@ var init_discovery = __esm(() => {
51736
51820
  php: ["php-composer"]
51737
51821
  };
51738
51822
  toolchainCache = new Map;
51739
- _internals24 = {
51823
+ _internals25 = {
51740
51824
  isCommandAvailable,
51741
51825
  discoverBuildCommandsFromProfiles,
51742
51826
  discoverBuildCommands,
@@ -52015,7 +52099,7 @@ var exports_evidence_summary_service = {};
52015
52099
  __export(exports_evidence_summary_service, {
52016
52100
  isAutoSummaryEnabled: () => isAutoSummaryEnabled,
52017
52101
  buildEvidenceSummary: () => buildEvidenceSummary,
52018
- _internals: () => _internals25,
52102
+ _internals: () => _internals26,
52019
52103
  REQUIRED_EVIDENCE_TYPES: () => REQUIRED_EVIDENCE_TYPES,
52020
52104
  EVIDENCE_SUMMARY_VERSION: () => EVIDENCE_SUMMARY_VERSION
52021
52105
  });
@@ -52053,7 +52137,7 @@ function getTaskStatus(task, bundle) {
52053
52137
  if (task?.status) {
52054
52138
  return task.status;
52055
52139
  }
52056
- const entries = _internals25.normalizeBundleEntries(bundle);
52140
+ const entries = _internals26.normalizeBundleEntries(bundle);
52057
52141
  if (entries.length > 0) {
52058
52142
  return "completed";
52059
52143
  }
@@ -52079,7 +52163,7 @@ function evidenceCompleteFromEntries(entries) {
52079
52163
  };
52080
52164
  }
52081
52165
  function isEvidenceComplete(bundle) {
52082
- return evidenceCompleteFromEntries(_internals25.normalizeBundleEntries(bundle));
52166
+ return evidenceCompleteFromEntries(_internals26.normalizeBundleEntries(bundle));
52083
52167
  }
52084
52168
  function getTaskBlockers(task, summary, status) {
52085
52169
  const blockers = [];
@@ -52099,9 +52183,9 @@ async function buildTaskSummary(directory, task, taskId) {
52099
52183
  const bundle = result.status === "found" ? result.bundle : null;
52100
52184
  const gateEvidence = await readDurableGateEvidence(directory, taskId);
52101
52185
  const phase = task?.phase ?? 0;
52102
- const status = _internals25.getTaskStatus(task, bundle);
52103
- const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals25.normalizeBundleEntries(bundle), gateEvidence);
52104
- let evidenceCheck = _internals25.evidenceCompleteFromEntries(entries);
52186
+ const status = _internals26.getTaskStatus(task, bundle);
52187
+ const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals26.normalizeBundleEntries(bundle), gateEvidence);
52188
+ let evidenceCheck = _internals26.evidenceCompleteFromEntries(entries);
52105
52189
  if (gateEvidence) {
52106
52190
  const gateStatus = getDurableGateEvidenceStatus(gateEvidence);
52107
52191
  evidenceCheck = gateStatus.isComplete ? { isComplete: true, missingEvidence: [] } : {
@@ -52109,7 +52193,7 @@ async function buildTaskSummary(directory, task, taskId) {
52109
52193
  missingEvidence: gateStatus.missingGates.map((gate) => `gate:${gate}`)
52110
52194
  };
52111
52195
  }
52112
- const blockers = _internals25.getTaskBlockers(task, evidenceCheck, status);
52196
+ const blockers = _internals26.getTaskBlockers(task, evidenceCheck, status);
52113
52197
  const hasReview = entries.some((e) => e.type === "review");
52114
52198
  const hasTest = entries.some((e) => e.type === "test");
52115
52199
  const hasApproval = entries.some((e) => e.type === "approval");
@@ -52138,12 +52222,12 @@ async function buildPhaseSummary(directory, phase) {
52138
52222
  const taskSummaries = [];
52139
52223
  const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
52140
52224
  for (const task of phase.tasks) {
52141
- const summary = await _internals25.buildTaskSummary(directory, task, task.id);
52225
+ const summary = await _internals26.buildTaskSummary(directory, task, task.id);
52142
52226
  taskSummaries.push(summary);
52143
52227
  }
52144
52228
  const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
52145
52229
  for (const taskId of extraTaskIds) {
52146
- const summary = await _internals25.buildTaskSummary(directory, undefined, taskId);
52230
+ const summary = await _internals26.buildTaskSummary(directory, undefined, taskId);
52147
52231
  if (summary.phase === phase.id) {
52148
52232
  taskSummaries.push(summary);
52149
52233
  }
@@ -52244,7 +52328,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
52244
52328
  let totalTasks = 0;
52245
52329
  let completedTasks = 0;
52246
52330
  for (const phase of phasesToProcess) {
52247
- const summary = await _internals25.buildPhaseSummary(directory, phase);
52331
+ const summary = await _internals26.buildPhaseSummary(directory, phase);
52248
52332
  phaseSummaries.push(summary);
52249
52333
  totalTasks += summary.totalTasks;
52250
52334
  completedTasks += summary.completedTasks;
@@ -52266,7 +52350,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
52266
52350
  overallBlockers,
52267
52351
  summaryText: ""
52268
52352
  };
52269
- artifact.summaryText = _internals25.generateSummaryText(artifact);
52353
+ artifact.summaryText = _internals26.generateSummaryText(artifact);
52270
52354
  log("[EvidenceSummary] Summary built", {
52271
52355
  phases: phaseSummaries.length,
52272
52356
  totalTasks,
@@ -52285,7 +52369,7 @@ function isAutoSummaryEnabled(automationConfig) {
52285
52369
  }
52286
52370
  return automationConfig.capabilities?.evidence_auto_summaries === true;
52287
52371
  }
52288
- var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals25;
52372
+ var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals26;
52289
52373
  var init_evidence_summary_service = __esm(() => {
52290
52374
  init_gate_bridge();
52291
52375
  init_manager2();
@@ -52300,7 +52384,7 @@ var init_evidence_summary_service = __esm(() => {
52300
52384
  "retrospective"
52301
52385
  ]);
52302
52386
  REQUIRED_EVIDENCE_TYPES = ["review", "test"];
52303
- _internals25 = {
52387
+ _internals26 = {
52304
52388
  buildEvidenceSummary,
52305
52389
  isAutoSummaryEnabled,
52306
52390
  normalizeBundleEntries,
@@ -52356,7 +52440,7 @@ function getVerdictEmoji(verdict) {
52356
52440
  return getVerdictIcon(verdict);
52357
52441
  }
52358
52442
  async function getTaskEvidenceData(directory, taskId) {
52359
- const result = await _internals26.loadEvidence(directory, taskId);
52443
+ const result = await _internals27.loadEvidence(directory, taskId);
52360
52444
  if (result.status !== "found") {
52361
52445
  return {
52362
52446
  hasEvidence: false,
@@ -52379,13 +52463,13 @@ async function getTaskEvidenceData(directory, taskId) {
52379
52463
  };
52380
52464
  }
52381
52465
  async function getEvidenceListData(directory) {
52382
- const taskIds = await _internals26.listEvidenceTaskIds(directory);
52466
+ const taskIds = await _internals27.listEvidenceTaskIds(directory);
52383
52467
  if (taskIds.length === 0) {
52384
52468
  return { hasEvidence: false, tasks: [] };
52385
52469
  }
52386
52470
  const tasks = [];
52387
52471
  for (const taskId of taskIds) {
52388
- const result = await _internals26.loadEvidence(directory, taskId);
52472
+ const result = await _internals27.loadEvidence(directory, taskId);
52389
52473
  if (result.status === "found") {
52390
52474
  tasks.push({
52391
52475
  taskId,
@@ -52499,10 +52583,10 @@ async function handleEvidenceSummaryCommand(directory) {
52499
52583
  return lines.join(`
52500
52584
  `);
52501
52585
  }
52502
- var _internals26;
52586
+ var _internals27;
52503
52587
  var init_evidence_service = __esm(() => {
52504
52588
  init_manager2();
52505
- _internals26 = {
52589
+ _internals27 = {
52506
52590
  loadEvidence,
52507
52591
  listEvidenceTaskIds
52508
52592
  };
@@ -52553,12 +52637,12 @@ var init_export = __esm(() => {
52553
52637
 
52554
52638
  // src/full-auto/state.ts
52555
52639
  import * as fs16 from "fs";
52556
- import * as path40 from "path";
52640
+ import * as path41 from "path";
52557
52641
  function nowISO() {
52558
52642
  return new Date().toISOString();
52559
52643
  }
52560
52644
  function ensureSwarmDir(directory) {
52561
- const swarmDir = path40.resolve(directory, ".swarm");
52645
+ const swarmDir = path41.resolve(directory, ".swarm");
52562
52646
  if (!fs16.existsSync(swarmDir)) {
52563
52647
  fs16.mkdirSync(swarmDir, { recursive: true });
52564
52648
  }
@@ -53030,7 +53114,7 @@ function extractCurrentPhaseFromPlan2(plan) {
53030
53114
  if (!plan) {
53031
53115
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
53032
53116
  }
53033
- if (!_internals27.validatePlanPhases(plan)) {
53117
+ if (!_internals28.validatePlanPhases(plan)) {
53034
53118
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
53035
53119
  }
53036
53120
  let currentPhase = null;
@@ -53172,9 +53256,9 @@ function extractPhaseMetrics(content) {
53172
53256
  async function getHandoffData(directory) {
53173
53257
  const now = new Date().toISOString();
53174
53258
  const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
53175
- const sessionState = _internals27.parseSessionState(sessionContent);
53259
+ const sessionState = _internals28.parseSessionState(sessionContent);
53176
53260
  const plan = await loadPlanJsonOnly(directory);
53177
- const planInfo = _internals27.extractCurrentPhaseFromPlan(plan);
53261
+ const planInfo = _internals28.extractCurrentPhaseFromPlan(plan);
53178
53262
  if (!plan) {
53179
53263
  const planMdContent = await readSwarmFileAsync(directory, "plan.md");
53180
53264
  if (planMdContent) {
@@ -53193,8 +53277,8 @@ async function getHandoffData(directory) {
53193
53277
  }
53194
53278
  }
53195
53279
  const contextContent = await readSwarmFileAsync(directory, "context.md");
53196
- const recentDecisions = _internals27.extractDecisions(contextContent);
53197
- const rawPhaseMetrics = _internals27.extractPhaseMetrics(contextContent);
53280
+ const recentDecisions = _internals28.extractDecisions(contextContent);
53281
+ const rawPhaseMetrics = _internals28.extractPhaseMetrics(contextContent);
53198
53282
  const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
53199
53283
  let delegationState = null;
53200
53284
  if (sessionState?.delegationState) {
@@ -53358,13 +53442,13 @@ ${lines.join(`
53358
53442
  `)}
53359
53443
  \`\`\``;
53360
53444
  }
53361
- var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals27;
53445
+ var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals28;
53362
53446
  var init_handoff_service = __esm(() => {
53363
53447
  init_utils2();
53364
53448
  init_manager();
53365
53449
  init_utils();
53366
53450
  RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
53367
- _internals27 = {
53451
+ _internals28 = {
53368
53452
  getHandoffData,
53369
53453
  formatHandoffMarkdown,
53370
53454
  formatContinuationPrompt,
@@ -53380,7 +53464,7 @@ var init_handoff_service = __esm(() => {
53380
53464
 
53381
53465
  // src/session/snapshot-writer.ts
53382
53466
  import { closeSync as closeSync5, fsyncSync as fsyncSync2, mkdirSync as mkdirSync14, openSync as openSync5, renameSync as renameSync10 } from "fs";
53383
- import * as path41 from "path";
53467
+ import * as path42 from "path";
53384
53468
  function serializeAgentSession(s) {
53385
53469
  const gateLog = {};
53386
53470
  const rawGateLog = s.gateLog ?? new Map;
@@ -53486,7 +53570,7 @@ async function writeSnapshot(directory, state) {
53486
53570
  }
53487
53571
  const content = JSON.stringify(snapshot, null, 2);
53488
53572
  const resolvedPath = validateSwarmPath(directory, "session/state.json");
53489
- const dir = path41.dirname(resolvedPath);
53573
+ const dir = path42.dirname(resolvedPath);
53490
53574
  mkdirSync14(dir, { recursive: true });
53491
53575
  const tempPath = `${resolvedPath}.tmp.${Date.now()}.${Math.random().toString(36).slice(2)}`;
53492
53576
  await bunWrite(tempPath, content);
@@ -53507,22 +53591,22 @@ async function writeSnapshot(directory, state) {
53507
53591
  }
53508
53592
  function createSnapshotWriterHook(directory) {
53509
53593
  return (_input, _output) => {
53510
- _writeInFlight = _writeInFlight.then(() => _internals28.writeSnapshot(directory, swarmState), () => _internals28.writeSnapshot(directory, swarmState));
53594
+ _writeInFlight = _writeInFlight.then(() => _internals29.writeSnapshot(directory, swarmState), () => _internals29.writeSnapshot(directory, swarmState));
53511
53595
  return _writeInFlight;
53512
53596
  };
53513
53597
  }
53514
53598
  async function flushPendingSnapshot(directory) {
53515
- _writeInFlight = _writeInFlight.then(() => _internals28.writeSnapshot(directory, swarmState), () => _internals28.writeSnapshot(directory, swarmState));
53599
+ _writeInFlight = _writeInFlight.then(() => _internals29.writeSnapshot(directory, swarmState), () => _internals29.writeSnapshot(directory, swarmState));
53516
53600
  await _writeInFlight;
53517
53601
  }
53518
- var _writeInFlight, _internals28;
53602
+ var _writeInFlight, _internals29;
53519
53603
  var init_snapshot_writer = __esm(() => {
53520
53604
  init_utils2();
53521
53605
  init_state();
53522
53606
  init_utils();
53523
53607
  init_bun_compat();
53524
53608
  _writeInFlight = Promise.resolve();
53525
- _internals28 = {
53609
+ _internals29 = {
53526
53610
  writeSnapshot,
53527
53611
  createSnapshotWriterHook,
53528
53612
  flushPendingSnapshot
@@ -53842,7 +53926,7 @@ function validateAndSanitizeGithubUrl(rawUrl, resource) {
53842
53926
  }
53843
53927
  function detectGitRemote(cwd) {
53844
53928
  try {
53845
- const result = _internals29.spawnSync("git", ["remote", "get-url", "origin"], {
53929
+ const result = _internals30.spawnSync("git", ["remote", "get-url", "origin"], {
53846
53930
  encoding: "utf-8",
53847
53931
  stdio: ["ignore", "pipe", "pipe"],
53848
53932
  timeout: 5000,
@@ -53887,7 +53971,7 @@ function parseGitRemoteUrl(remoteUrl) {
53887
53971
  }
53888
53972
  return null;
53889
53973
  }
53890
- var MAX_URL_LEN = 2048, IPV4_PRIVATE, IPV4_LOOPBACK, IPV4_LINK_LOCAL, IPV4_PRIVATE_172, IPV4_PRIVATE_192, IPV4_ZERO_NETWORK, IPV6_LINK_LOCAL, IPV6_UNIQUE_LOCAL, _internals29;
53974
+ var MAX_URL_LEN = 2048, IPV4_PRIVATE, IPV4_LOOPBACK, IPV4_LINK_LOCAL, IPV4_PRIVATE_172, IPV4_PRIVATE_192, IPV4_ZERO_NETWORK, IPV6_LINK_LOCAL, IPV6_UNIQUE_LOCAL, _internals30;
53891
53975
  var init_url_security = __esm(() => {
53892
53976
  IPV4_PRIVATE = /^10\./;
53893
53977
  IPV4_LOOPBACK = /^127\./;
@@ -53897,7 +53981,7 @@ var init_url_security = __esm(() => {
53897
53981
  IPV4_ZERO_NETWORK = /^0\./;
53898
53982
  IPV6_LINK_LOCAL = /^fe80:/i;
53899
53983
  IPV6_UNIQUE_LOCAL = /^f[cd][0-9a-f]{2}:/i;
53900
- _internals29 = { spawnSync: spawnSync3 };
53984
+ _internals30 = { spawnSync: spawnSync3 };
53901
53985
  });
53902
53986
 
53903
53987
  // src/commands/issue.ts
@@ -54029,7 +54113,7 @@ import { randomUUID as randomUUID3 } from "crypto";
54029
54113
  import { existsSync as existsSync27, readFileSync as readFileSync16 } from "fs";
54030
54114
  import { mkdir as mkdir15, readFile as readFile15, writeFile as writeFile13 } from "fs/promises";
54031
54115
  import * as os8 from "os";
54032
- import * as path42 from "path";
54116
+ import * as path43 from "path";
54033
54117
  async function migrateKnowledgeToExternal(_directory, _config) {
54034
54118
  return {
54035
54119
  migrated: false,
@@ -54040,8 +54124,8 @@ async function migrateKnowledgeToExternal(_directory, _config) {
54040
54124
  };
54041
54125
  }
54042
54126
  async function migrateContextToKnowledge(directory, config3) {
54043
- const sentinelPath = path42.join(directory, ".swarm", ".knowledge-migrated");
54044
- const contextPath = path42.join(directory, ".swarm", "context.md");
54127
+ const sentinelPath = path43.join(directory, ".swarm", ".knowledge-migrated");
54128
+ const contextPath = path43.join(directory, ".swarm", "context.md");
54045
54129
  const knowledgePath = resolveSwarmKnowledgePath(directory);
54046
54130
  if (existsSync27(sentinelPath)) {
54047
54131
  return {
@@ -54071,9 +54155,9 @@ async function migrateContextToKnowledge(directory, config3) {
54071
54155
  skippedReason: "empty-context"
54072
54156
  };
54073
54157
  }
54074
- const rawEntries = _internals30.parseContextMd(contextContent);
54158
+ const rawEntries = _internals31.parseContextMd(contextContent);
54075
54159
  if (rawEntries.length === 0) {
54076
- await _internals30.writeSentinel(sentinelPath, 0, 0);
54160
+ await _internals31.writeSentinel(sentinelPath, 0, 0);
54077
54161
  return {
54078
54162
  migrated: true,
54079
54163
  entriesMigrated: 0,
@@ -54084,10 +54168,10 @@ async function migrateContextToKnowledge(directory, config3) {
54084
54168
  const existing = await readKnowledge(knowledgePath);
54085
54169
  let migrated = 0;
54086
54170
  let dropped = 0;
54087
- const projectName = _internals30.inferProjectName(directory);
54171
+ const projectName = _internals31.inferProjectName(directory);
54088
54172
  for (const raw of rawEntries) {
54089
54173
  if (config3.validation_enabled !== false) {
54090
- const category = raw.categoryHint ?? _internals30.inferCategoryFromText(raw.text);
54174
+ const category = raw.categoryHint ?? _internals31.inferCategoryFromText(raw.text);
54091
54175
  const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
54092
54176
  category,
54093
54177
  scope: "global",
@@ -54107,8 +54191,8 @@ async function migrateContextToKnowledge(directory, config3) {
54107
54191
  const entry = {
54108
54192
  id: randomUUID3(),
54109
54193
  tier: "swarm",
54110
- lesson: _internals30.truncateLesson(raw.text),
54111
- category: raw.categoryHint ?? _internals30.inferCategoryFromText(raw.text),
54194
+ lesson: _internals31.truncateLesson(raw.text),
54195
+ category: raw.categoryHint ?? _internals31.inferCategoryFromText(raw.text),
54112
54196
  tags: [...inferredTags, `migration:${raw.sourceSection}`],
54113
54197
  scope: "global",
54114
54198
  confidence: 0.3,
@@ -54131,7 +54215,7 @@ async function migrateContextToKnowledge(directory, config3) {
54131
54215
  if (migrated > 0) {
54132
54216
  await rewriteKnowledge(knowledgePath, existing);
54133
54217
  }
54134
- await _internals30.writeSentinel(sentinelPath, migrated, dropped);
54218
+ await _internals31.writeSentinel(sentinelPath, migrated, dropped);
54135
54219
  log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
54136
54220
  return {
54137
54221
  migrated: true,
@@ -54141,9 +54225,9 @@ async function migrateContextToKnowledge(directory, config3) {
54141
54225
  };
54142
54226
  }
54143
54227
  async function migrateHiveKnowledgeLegacy(config3) {
54144
- const legacyHivePath = _internals30.resolveLegacyHiveKnowledgePath();
54228
+ const legacyHivePath = _internals31.resolveLegacyHiveKnowledgePath();
54145
54229
  const canonicalHivePath = resolveHiveKnowledgePath();
54146
- const sentinelPath = path42.join(path42.dirname(canonicalHivePath), ".hive-knowledge-migrated");
54230
+ const sentinelPath = path43.join(path43.dirname(canonicalHivePath), ".hive-knowledge-migrated");
54147
54231
  if (existsSync27(sentinelPath)) {
54148
54232
  return {
54149
54233
  migrated: false,
@@ -54164,7 +54248,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
54164
54248
  }
54165
54249
  const legacyEntries = await readKnowledge(legacyHivePath);
54166
54250
  if (legacyEntries.length === 0) {
54167
- await _internals30.writeSentinel(sentinelPath, 0, 0);
54251
+ await _internals31.writeSentinel(sentinelPath, 0, 0);
54168
54252
  return {
54169
54253
  migrated: true,
54170
54254
  entriesMigrated: 0,
@@ -54212,7 +54296,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
54212
54296
  const newHiveEntry = {
54213
54297
  id: resolvedId,
54214
54298
  tier: "hive",
54215
- lesson: _internals30.truncateLesson(lesson),
54299
+ lesson: _internals31.truncateLesson(lesson),
54216
54300
  category,
54217
54301
  tags: ["migration:legacy-hive"],
54218
54302
  scope: scopeTag,
@@ -54231,7 +54315,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
54231
54315
  encounter_score: 1
54232
54316
  };
54233
54317
  try {
54234
- await _internals30.appendKnowledge(canonicalHivePath, newHiveEntry);
54318
+ await _internals31.appendKnowledge(canonicalHivePath, newHiveEntry);
54235
54319
  existingHiveEntries.push(newHiveEntry);
54236
54320
  migrated++;
54237
54321
  } catch (appendError) {
@@ -54247,7 +54331,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
54247
54331
  dropped++;
54248
54332
  }
54249
54333
  }
54250
- await _internals30.writeSentinel(sentinelPath, migrated, dropped);
54334
+ await _internals31.writeSentinel(sentinelPath, migrated, dropped);
54251
54335
  log(`[knowledge-migrator] Migrated ${migrated} legacy hive entries, dropped ${dropped}`);
54252
54336
  return {
54253
54337
  migrated: true,
@@ -54258,7 +54342,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
54258
54342
  };
54259
54343
  }
54260
54344
  function parseContextMd(content) {
54261
- const sections = _internals30.splitIntoSections(content);
54345
+ const sections = _internals31.splitIntoSections(content);
54262
54346
  const entries = [];
54263
54347
  const seen = new Set;
54264
54348
  const sectionPatterns = [
@@ -54274,7 +54358,7 @@ function parseContextMd(content) {
54274
54358
  const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
54275
54359
  if (!match)
54276
54360
  continue;
54277
- const bullets = _internals30.extractBullets(section.body);
54361
+ const bullets = _internals31.extractBullets(section.body);
54278
54362
  for (const bullet of bullets) {
54279
54363
  if (bullet.length < 15)
54280
54364
  continue;
@@ -54283,9 +54367,9 @@ function parseContextMd(content) {
54283
54367
  continue;
54284
54368
  seen.add(normalized);
54285
54369
  entries.push({
54286
- text: _internals30.truncateLesson(bullet),
54370
+ text: _internals31.truncateLesson(bullet),
54287
54371
  sourceSection: match.sourceSection,
54288
- categoryHint: _internals30.inferCategoryFromText(bullet)
54372
+ categoryHint: _internals31.inferCategoryFromText(bullet)
54289
54373
  });
54290
54374
  }
54291
54375
  }
@@ -54354,7 +54438,7 @@ function truncateLesson2(text) {
54354
54438
  return `${text.slice(0, 277)}...`;
54355
54439
  }
54356
54440
  function inferProjectName(directory) {
54357
- const packageJsonPath = path42.join(directory, "package.json");
54441
+ const packageJsonPath = path43.join(directory, "package.json");
54358
54442
  if (existsSync27(packageJsonPath)) {
54359
54443
  try {
54360
54444
  const pkg = JSON.parse(readFileSync16(packageJsonPath, "utf-8"));
@@ -54363,7 +54447,7 @@ function inferProjectName(directory) {
54363
54447
  }
54364
54448
  } catch {}
54365
54449
  }
54366
- return path42.basename(directory);
54450
+ return path43.basename(directory);
54367
54451
  }
54368
54452
  async function writeSentinel(sentinelPath, migrated, dropped) {
54369
54453
  const sentinel = {
@@ -54375,7 +54459,7 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
54375
54459
  schema_version: 1,
54376
54460
  migration_tool: "knowledge-migrator.ts"
54377
54461
  };
54378
- await mkdir15(path42.dirname(sentinelPath), { recursive: true });
54462
+ await mkdir15(path43.dirname(sentinelPath), { recursive: true });
54379
54463
  await writeFile13(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
54380
54464
  }
54381
54465
  function resolveLegacyHiveKnowledgePath() {
@@ -54383,20 +54467,20 @@ function resolveLegacyHiveKnowledgePath() {
54383
54467
  const home = process.env.HOME || os8.homedir();
54384
54468
  let dataDir;
54385
54469
  if (platform === "win32") {
54386
- dataDir = path42.join(process.env.LOCALAPPDATA || path42.join(home, "AppData", "Local"), "opencode-swarm", "Data");
54470
+ dataDir = path43.join(process.env.LOCALAPPDATA || path43.join(home, "AppData", "Local"), "opencode-swarm", "Data");
54387
54471
  } else if (platform === "darwin") {
54388
- dataDir = path42.join(home, "Library", "Application Support", "opencode-swarm");
54472
+ dataDir = path43.join(home, "Library", "Application Support", "opencode-swarm");
54389
54473
  } else {
54390
- dataDir = path42.join(process.env.XDG_DATA_HOME || path42.join(home, ".local", "share"), "opencode-swarm");
54474
+ dataDir = path43.join(process.env.XDG_DATA_HOME || path43.join(home, ".local", "share"), "opencode-swarm");
54391
54475
  }
54392
- return path42.join(dataDir, "hive-knowledge.jsonl");
54476
+ return path43.join(dataDir, "hive-knowledge.jsonl");
54393
54477
  }
54394
- var _internals30;
54478
+ var _internals31;
54395
54479
  var init_knowledge_migrator = __esm(() => {
54396
54480
  init_logger();
54397
54481
  init_knowledge_store();
54398
54482
  init_knowledge_validator();
54399
- _internals30 = {
54483
+ _internals31 = {
54400
54484
  appendKnowledge,
54401
54485
  migrateContextToKnowledge,
54402
54486
  migrateKnowledgeToExternal,
@@ -55571,7 +55655,7 @@ import {
55571
55655
  rename as rename9,
55572
55656
  writeFile as writeFile14
55573
55657
  } from "fs/promises";
55574
- import * as path43 from "path";
55658
+ import * as path44 from "path";
55575
55659
 
55576
55660
  class LocalJsonlMemoryProvider {
55577
55661
  name = "local-jsonl";
@@ -55587,7 +55671,7 @@ class LocalJsonlMemoryProvider {
55587
55671
  pathFor(file3) {
55588
55672
  const storageDir = this.config.storageDir.replace(/^\.swarm[/\\]?/, "");
55589
55673
  const filename = file3 === "memories" ? "memories.jsonl" : file3 === "proposals" ? "proposals.jsonl" : "audit.jsonl";
55590
- return validateSwarmPath(this.rootDirectory, path43.join(storageDir, filename));
55674
+ return validateSwarmPath(this.rootDirectory, path44.join(storageDir, filename));
55591
55675
  }
55592
55676
  async initialize() {
55593
55677
  if (this.initialized)
@@ -55970,12 +56054,12 @@ function parseRecallUsageEvent(event) {
55970
56054
  }
55971
56055
  }
55972
56056
  async function appendJsonl(filePath, value) {
55973
- await mkdir16(path43.dirname(filePath), { recursive: true });
56057
+ await mkdir16(path44.dirname(filePath), { recursive: true });
55974
56058
  await appendFile7(filePath, `${JSON.stringify(value)}
55975
56059
  `, "utf-8");
55976
56060
  }
55977
56061
  async function writeJsonlAtomic(filePath, values) {
55978
- await mkdir16(path43.dirname(filePath), { recursive: true });
56062
+ await mkdir16(path44.dirname(filePath), { recursive: true });
55979
56063
  const tmp = `${filePath}.tmp.${randomUUID4()}`;
55980
56064
  const content = values.map((value) => JSON.stringify(value)).join(`
55981
56065
  `) + (values.length > 0 ? `
@@ -56002,7 +56086,7 @@ var init_prompt_block = __esm(() => {
56002
56086
  // src/memory/jsonl-migration.ts
56003
56087
  import { existsSync as existsSync29 } from "fs";
56004
56088
  import { copyFile as copyFile2, mkdir as mkdir17, readFile as readFile17, stat as stat8, writeFile as writeFile15 } from "fs/promises";
56005
- import * as path44 from "path";
56089
+ import * as path45 from "path";
56006
56090
  function resolveMemoryStorageDir(rootDirectory, config3 = {}) {
56007
56091
  const resolved = resolveConfig(config3);
56008
56092
  const storageDir = resolved.storageDir.replace(/^\.swarm[/\\]?/, "");
@@ -56016,8 +56100,8 @@ function resolveSqliteDatabasePath(rootDirectory, config3 = {}) {
56016
56100
  async function readLegacyJsonl(rootDirectory, config3 = {}) {
56017
56101
  const resolved = resolveConfig(config3);
56018
56102
  const storageDir = resolveMemoryStorageDir(rootDirectory, resolved);
56019
- const memoryLoad = await readMemoryJsonl(path44.join(storageDir, "memories.jsonl"), resolved);
56020
- const proposalLoad = await readProposalJsonl(path44.join(storageDir, "proposals.jsonl"), resolved);
56103
+ const memoryLoad = await readMemoryJsonl(path45.join(storageDir, "memories.jsonl"), resolved);
56104
+ const proposalLoad = await readProposalJsonl(path45.join(storageDir, "proposals.jsonl"), resolved);
56021
56105
  return {
56022
56106
  memories: memoryLoad.records,
56023
56107
  proposals: proposalLoad.records,
@@ -56027,14 +56111,14 @@ async function readLegacyJsonl(rootDirectory, config3 = {}) {
56027
56111
  }
56028
56112
  async function backupLegacyJsonl(rootDirectory, config3 = {}) {
56029
56113
  const storageDir = resolveMemoryStorageDir(rootDirectory, config3);
56030
- const backupDir = path44.join(storageDir, "backups");
56114
+ const backupDir = path45.join(storageDir, "backups");
56031
56115
  await mkdir17(backupDir, { recursive: true });
56032
56116
  const results = [];
56033
56117
  for (const filename of ["memories.jsonl", "proposals.jsonl"]) {
56034
- const source = path44.join(storageDir, filename);
56118
+ const source = path45.join(storageDir, filename);
56035
56119
  if (!existsSync29(source))
56036
56120
  continue;
56037
- const backup = path44.join(backupDir, `${filename}.pre-sqlite-migration`);
56121
+ const backup = path45.join(backupDir, `${filename}.pre-sqlite-migration`);
56038
56122
  if (existsSync29(backup)) {
56039
56123
  results.push({ source, backup, created: false });
56040
56124
  continue;
@@ -56045,23 +56129,23 @@ async function backupLegacyJsonl(rootDirectory, config3 = {}) {
56045
56129
  return results;
56046
56130
  }
56047
56131
  async function writeJsonlExport(rootDirectory, config3, memories, proposals) {
56048
- const exportDir = path44.join(resolveMemoryStorageDir(rootDirectory, config3), "export");
56132
+ const exportDir = path45.join(resolveMemoryStorageDir(rootDirectory, config3), "export");
56049
56133
  await mkdir17(exportDir, { recursive: true });
56050
- const memoriesPath = path44.join(exportDir, "memories.jsonl");
56051
- const proposalsPath = path44.join(exportDir, "proposals.jsonl");
56134
+ const memoriesPath = path45.join(exportDir, "memories.jsonl");
56135
+ const proposalsPath = path45.join(exportDir, "proposals.jsonl");
56052
56136
  await writeFile15(memoriesPath, toJsonl(memories), "utf-8");
56053
56137
  await writeFile15(proposalsPath, toJsonl(proposals), "utf-8");
56054
56138
  return { directory: exportDir, memoriesPath, proposalsPath };
56055
56139
  }
56056
56140
  async function writeMigrationReport(rootDirectory, report, config3 = {}) {
56057
- const reportPath = path44.join(resolveMemoryStorageDir(rootDirectory, config3), "migration-report.json");
56058
- await mkdir17(path44.dirname(reportPath), { recursive: true });
56141
+ const reportPath = path45.join(resolveMemoryStorageDir(rootDirectory, config3), "migration-report.json");
56142
+ await mkdir17(path45.dirname(reportPath), { recursive: true });
56059
56143
  await writeFile15(reportPath, `${JSON.stringify(report, null, 2)}
56060
56144
  `, "utf-8");
56061
56145
  return reportPath;
56062
56146
  }
56063
56147
  async function readMigrationReport(rootDirectory, config3 = {}) {
56064
- const reportPath = path44.join(resolveMemoryStorageDir(rootDirectory, config3), "migration-report.json");
56148
+ const reportPath = path45.join(resolveMemoryStorageDir(rootDirectory, config3), "migration-report.json");
56065
56149
  if (!existsSync29(reportPath))
56066
56150
  return null;
56067
56151
  try {
@@ -56074,7 +56158,7 @@ async function getLegacyJsonlFileStatus(rootDirectory, config3 = {}) {
56074
56158
  const storageDir = resolveMemoryStorageDir(rootDirectory, config3);
56075
56159
  const statuses = [];
56076
56160
  for (const file3 of ["memories.jsonl", "proposals.jsonl"]) {
56077
- const filePath = path44.join(storageDir, file3);
56161
+ const filePath = path45.join(storageDir, file3);
56078
56162
  let sizeBytes = 0;
56079
56163
  if (existsSync29(filePath)) {
56080
56164
  sizeBytes = (await stat8(filePath)).size;
@@ -56203,7 +56287,7 @@ var init_jsonl_migration = __esm(() => {
56203
56287
  import { randomUUID as randomUUID5 } from "crypto";
56204
56288
  import { mkdirSync as mkdirSync15 } from "fs";
56205
56289
  import { createRequire as createRequire2 } from "module";
56206
- import * as path45 from "path";
56290
+ import * as path46 from "path";
56207
56291
  function loadDatabaseCtor2() {
56208
56292
  if (_DatabaseCtor2)
56209
56293
  return _DatabaseCtor2;
@@ -56261,7 +56345,7 @@ class SQLiteMemoryProvider {
56261
56345
  if (this.initialized)
56262
56346
  return;
56263
56347
  const dbPath = this.databasePath();
56264
- mkdirSync15(path45.dirname(dbPath), { recursive: true });
56348
+ mkdirSync15(path46.dirname(dbPath), { recursive: true });
56265
56349
  const Db = loadDatabaseCtor2();
56266
56350
  this.db = new Db(dbPath);
56267
56351
  this.db.run("PRAGMA journal_mode = WAL;");
@@ -57147,9 +57231,9 @@ var init_gateway = __esm(() => {
57147
57231
  // src/memory/evaluation.ts
57148
57232
  import * as fs17 from "fs/promises";
57149
57233
  import * as os9 from "os";
57150
- import * as path46 from "path";
57234
+ import * as path47 from "path";
57151
57235
  async function evaluateMemoryRecallFixtures(options) {
57152
- const fixtureDirectory = path46.resolve(options.fixtureDirectory);
57236
+ const fixtureDirectory = path47.resolve(options.fixtureDirectory);
57153
57237
  const providers = options.providers ?? DEFAULT_PROVIDERS;
57154
57238
  const modes = options.modes ?? DEFAULT_MODES;
57155
57239
  const generatedAt = new Date().toISOString();
@@ -57158,7 +57242,7 @@ async function evaluateMemoryRecallFixtures(options) {
57158
57242
  for (const fixture of fixtures) {
57159
57243
  const materialized = materializeFixture(fixture);
57160
57244
  for (const providerName of providers) {
57161
- const tempRoot = await fs17.realpath(await fs17.mkdtemp(path46.join(os9.tmpdir(), "swarm-memory-eval-")));
57245
+ const tempRoot = await fs17.realpath(await fs17.mkdtemp(path47.join(os9.tmpdir(), "swarm-memory-eval-")));
57162
57246
  const provider = createEvaluationProvider(providerName, tempRoot);
57163
57247
  try {
57164
57248
  await provider.initialize?.();
@@ -57202,7 +57286,7 @@ async function loadRecallEvaluationFixtures(fixtureDirectory) {
57202
57286
  const files = entries.filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name).sort((a, b) => a.localeCompare(b));
57203
57287
  const fixtures = [];
57204
57288
  for (const file3 of files) {
57205
- const raw = await fs17.readFile(path46.join(fixtureDirectory, file3), "utf-8");
57289
+ const raw = await fs17.readFile(path47.join(fixtureDirectory, file3), "utf-8");
57206
57290
  fixtures.push(validateFixture(JSON.parse(raw), file3));
57207
57291
  }
57208
57292
  return fixtures;
@@ -57541,7 +57625,7 @@ var init_memory = __esm(() => {
57541
57625
 
57542
57626
  // src/commands/memory.ts
57543
57627
  import { existsSync as existsSync30 } from "fs";
57544
- import * as path47 from "path";
57628
+ import * as path48 from "path";
57545
57629
  import { fileURLToPath as fileURLToPath2 } from "url";
57546
57630
  async function handleMemoryCommand(_directory, _args) {
57547
57631
  return [
@@ -57811,7 +57895,7 @@ function resolveCommandMemoryConfig(directory) {
57811
57895
  }
57812
57896
  function parseEvaluateArgs(directory, args) {
57813
57897
  let json3 = false;
57814
- let fixtureDirectory = path47.join(PACKAGE_ROOT, "tests", "fixtures", "memory-recall");
57898
+ let fixtureDirectory = path48.join(PACKAGE_ROOT, "tests", "fixtures", "memory-recall");
57815
57899
  for (let i = 0;i < args.length; i++) {
57816
57900
  const arg = args[i];
57817
57901
  if (arg === "--json") {
@@ -57825,7 +57909,7 @@ function parseEvaluateArgs(directory, args) {
57825
57909
  error: "Usage: /swarm memory evaluate [--json] [--fixtures <directory>]"
57826
57910
  };
57827
57911
  }
57828
- fixtureDirectory = path47.resolve(directory, next);
57912
+ fixtureDirectory = path48.resolve(directory, next);
57829
57913
  i++;
57830
57914
  continue;
57831
57915
  }
@@ -57858,15 +57942,15 @@ function parseMaintenanceArgs(args, options) {
57858
57942
  return { limit, confirm };
57859
57943
  }
57860
57944
  function resolvePackageRootFromModule(modulePath) {
57861
- const moduleDir = path47.dirname(modulePath);
57862
- const leaf = path47.basename(moduleDir);
57945
+ const moduleDir = path48.dirname(modulePath);
57946
+ const leaf = path48.basename(moduleDir);
57863
57947
  if (leaf === "commands" || leaf === "cli") {
57864
- return path47.resolve(moduleDir, "..", "..");
57948
+ return path48.resolve(moduleDir, "..", "..");
57865
57949
  }
57866
57950
  if (leaf === "dist") {
57867
- return path47.resolve(moduleDir, "..");
57951
+ return path48.resolve(moduleDir, "..");
57868
57952
  }
57869
- return path47.resolve(moduleDir, "..");
57953
+ return path48.resolve(moduleDir, "..");
57870
57954
  }
57871
57955
  function formatMigrationResult(label, report) {
57872
57956
  if (!report) {
@@ -57985,14 +58069,14 @@ var PACKAGE_ROOT;
57985
58069
  var init_memory2 = __esm(() => {
57986
58070
  init_loader();
57987
58071
  init_memory();
57988
- PACKAGE_ROOT = path47.resolve(resolvePackageRootFromModule(fileURLToPath2(import.meta.url)));
58072
+ PACKAGE_ROOT = path48.resolve(resolvePackageRootFromModule(fileURLToPath2(import.meta.url)));
57989
58073
  });
57990
58074
 
57991
58075
  // src/services/plan-service.ts
57992
58076
  async function getPlanData(directory, phaseArg) {
57993
- const plan = await _internals31.loadPlanJsonOnly(directory);
58077
+ const plan = await _internals32.loadPlanJsonOnly(directory);
57994
58078
  if (plan) {
57995
- const fullMarkdown = _internals31.derivePlanMarkdown(plan);
58079
+ const fullMarkdown = _internals32.derivePlanMarkdown(plan);
57996
58080
  if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
57997
58081
  return {
57998
58082
  hasPlan: true,
@@ -58035,7 +58119,7 @@ async function getPlanData(directory, phaseArg) {
58035
58119
  isLegacy: false
58036
58120
  };
58037
58121
  }
58038
- const planContent = await _internals31.readSwarmFileAsync(directory, "plan.md");
58122
+ const planContent = await _internals32.readSwarmFileAsync(directory, "plan.md");
58039
58123
  if (!planContent) {
58040
58124
  return {
58041
58125
  hasPlan: false,
@@ -58131,11 +58215,11 @@ async function handlePlanCommand(directory, args) {
58131
58215
  const planData = await getPlanData(directory, phaseArg);
58132
58216
  return formatPlanMarkdown(planData);
58133
58217
  }
58134
- var _internals31;
58218
+ var _internals32;
58135
58219
  var init_plan_service = __esm(() => {
58136
58220
  init_utils2();
58137
58221
  init_manager();
58138
- _internals31 = {
58222
+ _internals32 = {
58139
58223
  loadPlanJsonOnly,
58140
58224
  derivePlanMarkdown,
58141
58225
  readSwarmFileAsync
@@ -58307,12 +58391,12 @@ var init_pr_feedback = __esm(() => {
58307
58391
 
58308
58392
  // src/background/pr-subscriptions.ts
58309
58393
  import * as fs18 from "fs";
58310
- import * as path48 from "path";
58394
+ import * as path49 from "path";
58311
58395
  function storePath(directory) {
58312
58396
  return validateSwarmPath(directory, PR_SUBSCRIPTIONS_FILE);
58313
58397
  }
58314
58398
  function ensureSwarmDir2(directory) {
58315
- fs18.mkdirSync(path48.resolve(directory, ".swarm", "pr-monitor"), {
58399
+ fs18.mkdirSync(path49.resolve(directory, ".swarm", "pr-monitor"), {
58316
58400
  recursive: true
58317
58401
  });
58318
58402
  }
@@ -58478,7 +58562,7 @@ function formatRelativeTime(epochMs) {
58478
58562
  return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
58479
58563
  }
58480
58564
  async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
58481
- const allActive = await _internals32.listActive(directory);
58565
+ const allActive = await _internals33.listActive(directory);
58482
58566
  const sessionSubs = allActive.filter((record3) => record3.sessionID === sessionID);
58483
58567
  if (sessionSubs.length === 0) {
58484
58568
  return "No active PR subscriptions for this session.";
@@ -58507,10 +58591,10 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
58507
58591
  return lines.join(`
58508
58592
  `);
58509
58593
  }
58510
- var _internals32;
58594
+ var _internals33;
58511
58595
  var init_pr_monitor_status = __esm(() => {
58512
58596
  init_pr_subscriptions();
58513
- _internals32 = {
58597
+ _internals33 = {
58514
58598
  formatRelativeTime,
58515
58599
  listActive
58516
58600
  };
@@ -58615,7 +58699,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
58615
58699
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
58616
58700
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
58617
58701
  try {
58618
- const config3 = _internals33.loadPluginConfig(directory);
58702
+ const config3 = _internals34.loadPluginConfig(directory);
58619
58703
  const prMonitorConfig = config3.pr_monitor;
58620
58704
  if (!prMonitorConfig?.enabled) {
58621
58705
  return [
@@ -58625,7 +58709,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
58625
58709
  ].join(`
58626
58710
  `);
58627
58711
  }
58628
- await _internals33.subscribe(directory, {
58712
+ await _internals34.subscribe(directory, {
58629
58713
  sessionID,
58630
58714
  prNumber: prInfo.number,
58631
58715
  repoFullName,
@@ -58649,12 +58733,12 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
58649
58733
  `);
58650
58734
  }
58651
58735
  }
58652
- var _internals33;
58736
+ var _internals34;
58653
58737
  var init_pr_subscribe = __esm(() => {
58654
58738
  init_pr_subscriptions();
58655
58739
  init_loader();
58656
58740
  init_pr_ref();
58657
- _internals33 = {
58741
+ _internals34 = {
58658
58742
  loadPluginConfig,
58659
58743
  subscribe
58660
58744
  };
@@ -58678,9 +58762,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
58678
58762
  `);
58679
58763
  }
58680
58764
  const refToken = rest[0];
58681
- const prInfo = _internals34.parsePrRef(refToken, directory);
58765
+ const prInfo = _internals35.parsePrRef(refToken, directory);
58682
58766
  if (!prInfo) {
58683
- if (_internals34.looksLikePrRef(refToken)) {
58767
+ if (_internals35.looksLikePrRef(refToken)) {
58684
58768
  return [
58685
58769
  `Error: Could not resolve PR reference from "${refToken}".`,
58686
58770
  "",
@@ -58701,8 +58785,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
58701
58785
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
58702
58786
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
58703
58787
  try {
58704
- const correlationId = _internals34.buildCorrelationId(sessionID, repoFullName, prInfo.number);
58705
- const result = await _internals34.unsubscribe(directory, correlationId);
58788
+ const correlationId = _internals35.buildCorrelationId(sessionID, repoFullName, prInfo.number);
58789
+ const result = await _internals35.unsubscribe(directory, correlationId);
58706
58790
  if (!result) {
58707
58791
  return [
58708
58792
  `Not subscribed to ${prUrl}`,
@@ -58729,11 +58813,11 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
58729
58813
  `);
58730
58814
  }
58731
58815
  }
58732
- var _internals34;
58816
+ var _internals35;
58733
58817
  var init_pr_unsubscribe = __esm(() => {
58734
58818
  init_pr_subscriptions();
58735
58819
  init_pr_ref();
58736
- _internals34 = {
58820
+ _internals35 = {
58737
58821
  unsubscribe,
58738
58822
  buildCorrelationId,
58739
58823
  parsePrRef,
@@ -58785,7 +58869,7 @@ var init_path_security = () => {};
58785
58869
 
58786
58870
  // src/tools/lint.ts
58787
58871
  import * as fs19 from "fs";
58788
- import * as path49 from "path";
58872
+ import * as path50 from "path";
58789
58873
  function validateArgs(args) {
58790
58874
  if (typeof args !== "object" || args === null)
58791
58875
  return false;
@@ -58796,9 +58880,9 @@ function validateArgs(args) {
58796
58880
  }
58797
58881
  function getLinterCommand(linter, mode, projectDir) {
58798
58882
  const isWindows = process.platform === "win32";
58799
- const binDir = path49.join(projectDir, "node_modules", ".bin");
58800
- const biomeBin = isWindows ? path49.join(binDir, "biome.EXE") : path49.join(binDir, "biome");
58801
- const eslintBin = isWindows ? path49.join(binDir, "eslint.cmd") : path49.join(binDir, "eslint");
58883
+ const binDir = path50.join(projectDir, "node_modules", ".bin");
58884
+ const biomeBin = isWindows ? path50.join(binDir, "biome.EXE") : path50.join(binDir, "biome");
58885
+ const eslintBin = isWindows ? path50.join(binDir, "eslint.cmd") : path50.join(binDir, "eslint");
58802
58886
  switch (linter) {
58803
58887
  case "biome":
58804
58888
  if (mode === "fix") {
@@ -58814,7 +58898,7 @@ function getLinterCommand(linter, mode, projectDir) {
58814
58898
  }
58815
58899
  function getAdditionalLinterCommand(linter, mode, cwd) {
58816
58900
  const gradlewName = process.platform === "win32" ? "gradlew.bat" : "gradlew";
58817
- const gradlew = fs19.existsSync(path49.join(cwd, gradlewName)) ? path49.join(cwd, gradlewName) : null;
58901
+ const gradlew = fs19.existsSync(path50.join(cwd, gradlewName)) ? path50.join(cwd, gradlewName) : null;
58818
58902
  switch (linter) {
58819
58903
  case "ruff":
58820
58904
  return mode === "fix" ? ["ruff", "check", "--fix", "."] : ["ruff", "check", "."];
@@ -58848,10 +58932,10 @@ function getAdditionalLinterCommand(linter, mode, cwd) {
58848
58932
  }
58849
58933
  }
58850
58934
  function detectRuff(cwd) {
58851
- if (fs19.existsSync(path49.join(cwd, "ruff.toml")))
58935
+ if (fs19.existsSync(path50.join(cwd, "ruff.toml")))
58852
58936
  return isCommandAvailable("ruff");
58853
58937
  try {
58854
- const pyproject = path49.join(cwd, "pyproject.toml");
58938
+ const pyproject = path50.join(cwd, "pyproject.toml");
58855
58939
  if (fs19.existsSync(pyproject)) {
58856
58940
  const content = fs19.readFileSync(pyproject, "utf-8");
58857
58941
  if (content.includes("[tool.ruff]"))
@@ -58861,19 +58945,19 @@ function detectRuff(cwd) {
58861
58945
  return false;
58862
58946
  }
58863
58947
  function detectClippy(cwd) {
58864
- return fs19.existsSync(path49.join(cwd, "Cargo.toml")) && isCommandAvailable("cargo");
58948
+ return fs19.existsSync(path50.join(cwd, "Cargo.toml")) && isCommandAvailable("cargo");
58865
58949
  }
58866
58950
  function detectGolangciLint(cwd) {
58867
- return fs19.existsSync(path49.join(cwd, "go.mod")) && isCommandAvailable("golangci-lint");
58951
+ return fs19.existsSync(path50.join(cwd, "go.mod")) && isCommandAvailable("golangci-lint");
58868
58952
  }
58869
58953
  function detectCheckstyle(cwd) {
58870
- const hasMaven = fs19.existsSync(path49.join(cwd, "pom.xml"));
58871
- const hasGradle = fs19.existsSync(path49.join(cwd, "build.gradle")) || fs19.existsSync(path49.join(cwd, "build.gradle.kts"));
58872
- const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (fs19.existsSync(path49.join(cwd, "gradlew")) || isCommandAvailable("gradle"));
58954
+ const hasMaven = fs19.existsSync(path50.join(cwd, "pom.xml"));
58955
+ const hasGradle = fs19.existsSync(path50.join(cwd, "build.gradle")) || fs19.existsSync(path50.join(cwd, "build.gradle.kts"));
58956
+ const hasBinary = hasMaven && isCommandAvailable("mvn") || hasGradle && (fs19.existsSync(path50.join(cwd, "gradlew")) || isCommandAvailable("gradle"));
58873
58957
  return (hasMaven || hasGradle) && hasBinary;
58874
58958
  }
58875
58959
  function detectKtlint(cwd) {
58876
- const hasKotlin = fs19.existsSync(path49.join(cwd, "build.gradle.kts")) || fs19.existsSync(path49.join(cwd, "build.gradle")) || (() => {
58960
+ const hasKotlin = fs19.existsSync(path50.join(cwd, "build.gradle.kts")) || fs19.existsSync(path50.join(cwd, "build.gradle")) || (() => {
58877
58961
  try {
58878
58962
  return fs19.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
58879
58963
  } catch {
@@ -58892,11 +58976,11 @@ function detectDotnetFormat(cwd) {
58892
58976
  }
58893
58977
  }
58894
58978
  function detectCppcheck(cwd) {
58895
- if (fs19.existsSync(path49.join(cwd, "CMakeLists.txt"))) {
58979
+ if (fs19.existsSync(path50.join(cwd, "CMakeLists.txt"))) {
58896
58980
  return isCommandAvailable("cppcheck");
58897
58981
  }
58898
58982
  try {
58899
- const dirsToCheck = [cwd, path49.join(cwd, "src")];
58983
+ const dirsToCheck = [cwd, path50.join(cwd, "src")];
58900
58984
  const hasCpp = dirsToCheck.some((dir) => {
58901
58985
  try {
58902
58986
  return fs19.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
@@ -58910,13 +58994,13 @@ function detectCppcheck(cwd) {
58910
58994
  }
58911
58995
  }
58912
58996
  function detectSwiftlint(cwd) {
58913
- return fs19.existsSync(path49.join(cwd, "Package.swift")) && isCommandAvailable("swiftlint");
58997
+ return fs19.existsSync(path50.join(cwd, "Package.swift")) && isCommandAvailable("swiftlint");
58914
58998
  }
58915
58999
  function detectDartAnalyze(cwd) {
58916
- return fs19.existsSync(path49.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
59000
+ return fs19.existsSync(path50.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
58917
59001
  }
58918
59002
  function detectRubocop(cwd) {
58919
- return (fs19.existsSync(path49.join(cwd, "Gemfile")) || fs19.existsSync(path49.join(cwd, "gems.rb")) || fs19.existsSync(path49.join(cwd, ".rubocop.yml"))) && (isCommandAvailable("rubocop") || isCommandAvailable("bundle"));
59003
+ return (fs19.existsSync(path50.join(cwd, "Gemfile")) || fs19.existsSync(path50.join(cwd, "gems.rb")) || fs19.existsSync(path50.join(cwd, ".rubocop.yml"))) && (isCommandAvailable("rubocop") || isCommandAvailable("bundle"));
58920
59004
  }
58921
59005
  function detectAdditionalLinter(cwd) {
58922
59006
  if (detectRuff(cwd))
@@ -58944,10 +59028,10 @@ function detectAdditionalLinter(cwd) {
58944
59028
  function findBinInAncestors(startDir, binName) {
58945
59029
  let dir = startDir;
58946
59030
  while (true) {
58947
- const candidate = path49.join(dir, "node_modules", ".bin", binName);
59031
+ const candidate = path50.join(dir, "node_modules", ".bin", binName);
58948
59032
  if (fs19.existsSync(candidate))
58949
59033
  return candidate;
58950
- const parent = path49.dirname(dir);
59034
+ const parent = path50.dirname(dir);
58951
59035
  if (parent === dir)
58952
59036
  break;
58953
59037
  dir = parent;
@@ -58956,10 +59040,10 @@ function findBinInAncestors(startDir, binName) {
58956
59040
  }
58957
59041
  function findBinInEnvPath(binName) {
58958
59042
  const searchPath = process.env.PATH ?? "";
58959
- for (const dir of searchPath.split(path49.delimiter)) {
59043
+ for (const dir of searchPath.split(path50.delimiter)) {
58960
59044
  if (!dir)
58961
59045
  continue;
58962
- const candidate = path49.join(dir, binName);
59046
+ const candidate = path50.join(dir, binName);
58963
59047
  if (fs19.existsSync(candidate))
58964
59048
  return candidate;
58965
59049
  }
@@ -58972,13 +59056,13 @@ async function detectAvailableLinter(directory) {
58972
59056
  return null;
58973
59057
  const projectDir = directory;
58974
59058
  const isWindows = process.platform === "win32";
58975
- const biomeBin = isWindows ? path49.join(projectDir, "node_modules", ".bin", "biome.EXE") : path49.join(projectDir, "node_modules", ".bin", "biome");
58976
- const eslintBin = isWindows ? path49.join(projectDir, "node_modules", ".bin", "eslint.cmd") : path49.join(projectDir, "node_modules", ".bin", "eslint");
59059
+ const biomeBin = isWindows ? path50.join(projectDir, "node_modules", ".bin", "biome.EXE") : path50.join(projectDir, "node_modules", ".bin", "biome");
59060
+ const eslintBin = isWindows ? path50.join(projectDir, "node_modules", ".bin", "eslint.cmd") : path50.join(projectDir, "node_modules", ".bin", "eslint");
58977
59061
  const localResult = await _detectAvailableLinter(projectDir, biomeBin, eslintBin);
58978
59062
  if (localResult)
58979
59063
  return localResult;
58980
- const biomeAncestor = findBinInAncestors(path49.dirname(projectDir), isWindows ? "biome.EXE" : "biome");
58981
- const eslintAncestor = findBinInAncestors(path49.dirname(projectDir), isWindows ? "eslint.cmd" : "eslint");
59064
+ const biomeAncestor = findBinInAncestors(path50.dirname(projectDir), isWindows ? "biome.EXE" : "biome");
59065
+ const eslintAncestor = findBinInAncestors(path50.dirname(projectDir), isWindows ? "eslint.cmd" : "eslint");
58982
59066
  if (biomeAncestor || eslintAncestor) {
58983
59067
  return _detectAvailableLinter(projectDir, biomeAncestor ?? biomeBin, eslintAncestor ?? eslintBin);
58984
59068
  }
@@ -59137,7 +59221,7 @@ async function runAdditionalLint(linter, mode, cwd) {
59137
59221
  };
59138
59222
  }
59139
59223
  }
59140
- var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals35;
59224
+ var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals36;
59141
59225
  var init_lint = __esm(() => {
59142
59226
  init_zod();
59143
59227
  init_discovery();
@@ -59169,15 +59253,15 @@ var init_lint = __esm(() => {
59169
59253
  }
59170
59254
  const { mode } = args;
59171
59255
  const cwd = directory;
59172
- const linter = await _internals35.detectAvailableLinter(directory);
59256
+ const linter = await _internals36.detectAvailableLinter(directory);
59173
59257
  if (linter) {
59174
- const result = await _internals35.runLint(linter, mode, directory);
59258
+ const result = await _internals36.runLint(linter, mode, directory);
59175
59259
  return JSON.stringify(result, null, 2);
59176
59260
  }
59177
- const additionalLinter = _internals35.detectAdditionalLinter(cwd);
59261
+ const additionalLinter = _internals36.detectAdditionalLinter(cwd);
59178
59262
  if (additionalLinter) {
59179
59263
  warn(`[lint] Using ${additionalLinter} linter for this project`);
59180
- const result = await _internals35.runAdditionalLint(additionalLinter, mode, cwd);
59264
+ const result = await _internals36.runAdditionalLint(additionalLinter, mode, cwd);
59181
59265
  return JSON.stringify(result, null, 2);
59182
59266
  }
59183
59267
  const errorResult = {
@@ -59191,7 +59275,7 @@ For Rust: rustup component add clippy`
59191
59275
  return JSON.stringify(errorResult, null, 2);
59192
59276
  }
59193
59277
  });
59194
- _internals35 = {
59278
+ _internals36 = {
59195
59279
  detectAvailableLinter,
59196
59280
  runLint,
59197
59281
  detectAdditionalLinter,
@@ -59201,7 +59285,7 @@ For Rust: rustup component add clippy`
59201
59285
 
59202
59286
  // src/tools/secretscan.ts
59203
59287
  import * as fs20 from "fs";
59204
- import * as path50 from "path";
59288
+ import * as path51 from "path";
59205
59289
  function calculateShannonEntropy(str) {
59206
59290
  if (str.length === 0)
59207
59291
  return 0;
@@ -59249,7 +59333,7 @@ function isGlobOrPathPattern(pattern) {
59249
59333
  return pattern.includes("/") || pattern.includes("\\") || /[*?[\]{}]/.test(pattern);
59250
59334
  }
59251
59335
  function loadSecretScanIgnore(scanDir) {
59252
- const ignorePath = path50.join(scanDir, ".secretscanignore");
59336
+ const ignorePath = path51.join(scanDir, ".secretscanignore");
59253
59337
  try {
59254
59338
  if (!fs20.existsSync(ignorePath))
59255
59339
  return [];
@@ -59272,7 +59356,7 @@ function isExcluded(entry, relPath, exactNames, globPatterns) {
59272
59356
  if (exactNames.has(entry))
59273
59357
  return true;
59274
59358
  for (const pattern of globPatterns) {
59275
- if (path50.matchesGlob(relPath, pattern))
59359
+ if (path51.matchesGlob(relPath, pattern))
59276
59360
  return true;
59277
59361
  }
59278
59362
  return false;
@@ -59293,7 +59377,7 @@ function validateDirectoryInput(dir) {
59293
59377
  return null;
59294
59378
  }
59295
59379
  function isBinaryFile(filePath, buffer) {
59296
- const ext = path50.extname(filePath).toLowerCase();
59380
+ const ext = path51.extname(filePath).toLowerCase();
59297
59381
  if (DEFAULT_EXCLUDE_EXTENSIONS.has(ext)) {
59298
59382
  return true;
59299
59383
  }
@@ -59429,9 +59513,9 @@ function isSymlinkLoop(realPath, visited) {
59429
59513
  return false;
59430
59514
  }
59431
59515
  function isPathWithinScope(realPath, scanDir) {
59432
- const resolvedScanDir = path50.resolve(scanDir);
59433
- const resolvedRealPath = path50.resolve(realPath);
59434
- return resolvedRealPath === resolvedScanDir || resolvedRealPath.startsWith(resolvedScanDir + path50.sep) || resolvedRealPath.startsWith(`${resolvedScanDir}/`) || resolvedRealPath.startsWith(`${resolvedScanDir}\\`);
59516
+ const resolvedScanDir = path51.resolve(scanDir);
59517
+ const resolvedRealPath = path51.resolve(realPath);
59518
+ return resolvedRealPath === resolvedScanDir || resolvedRealPath.startsWith(resolvedScanDir + path51.sep) || resolvedRealPath.startsWith(`${resolvedScanDir}/`) || resolvedRealPath.startsWith(`${resolvedScanDir}\\`);
59435
59519
  }
59436
59520
  function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, stats2 = {
59437
59521
  skippedDirs: 0,
@@ -59457,8 +59541,8 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
59457
59541
  return a.localeCompare(b);
59458
59542
  });
59459
59543
  for (const entry of entries) {
59460
- const fullPath = path50.join(dir, entry);
59461
- const relPath = path50.relative(scanDir, fullPath).replace(/\\/g, "/");
59544
+ const fullPath = path51.join(dir, entry);
59545
+ const relPath = path51.relative(scanDir, fullPath).replace(/\\/g, "/");
59462
59546
  if (isExcluded(entry, relPath, excludeExact, excludeGlobs)) {
59463
59547
  stats2.skippedDirs++;
59464
59548
  continue;
@@ -59493,7 +59577,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
59493
59577
  const subFiles = findScannableFiles(fullPath, excludeExact, excludeGlobs, scanDir, visited, stats2);
59494
59578
  files.push(...subFiles);
59495
59579
  } else if (lstat3.isFile()) {
59496
- const ext = path50.extname(fullPath).toLowerCase();
59580
+ const ext = path51.extname(fullPath).toLowerCase();
59497
59581
  if (!DEFAULT_EXCLUDE_EXTENSIONS.has(ext)) {
59498
59582
  files.push(fullPath);
59499
59583
  } else {
@@ -59505,7 +59589,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
59505
59589
  }
59506
59590
  async function runSecretscan(directory) {
59507
59591
  try {
59508
- const result = await _internals36.secretscan.execute({ directory }, {});
59592
+ const result = await _internals37.secretscan.execute({ directory }, {});
59509
59593
  const jsonStr = typeof result === "string" ? result : result.output;
59510
59594
  return JSON.parse(jsonStr);
59511
59595
  } catch (e) {
@@ -59520,7 +59604,7 @@ async function runSecretscan(directory) {
59520
59604
  return errorResult;
59521
59605
  }
59522
59606
  }
59523
- var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan, _internals36;
59607
+ var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan, _internals37;
59524
59608
  var init_secretscan = __esm(() => {
59525
59609
  init_zod();
59526
59610
  init_path_security();
@@ -59753,7 +59837,7 @@ var init_secretscan = __esm(() => {
59753
59837
  }
59754
59838
  }
59755
59839
  try {
59756
- const _scanDirRaw = path50.resolve(directory);
59840
+ const _scanDirRaw = path51.resolve(directory);
59757
59841
  const scanDir = (() => {
59758
59842
  try {
59759
59843
  return fs20.realpathSync(_scanDirRaw);
@@ -59892,7 +59976,7 @@ var init_secretscan = __esm(() => {
59892
59976
  }
59893
59977
  }
59894
59978
  });
59895
- _internals36 = {
59979
+ _internals37 = {
59896
59980
  secretscan,
59897
59981
  runSecretscan
59898
59982
  };
@@ -59900,7 +59984,7 @@ var init_secretscan = __esm(() => {
59900
59984
 
59901
59985
  // src/lang/default-backend.ts
59902
59986
  import * as fs21 from "fs";
59903
- import * as path51 from "path";
59987
+ import * as path52 from "path";
59904
59988
  function detectFileExists(dir, pattern) {
59905
59989
  if (pattern.includes("*") || pattern.includes("?")) {
59906
59990
  try {
@@ -59912,7 +59996,7 @@ function detectFileExists(dir, pattern) {
59912
59996
  }
59913
59997
  }
59914
59998
  try {
59915
- fs21.accessSync(path51.join(dir, pattern));
59999
+ fs21.accessSync(path52.join(dir, pattern));
59916
60000
  return true;
59917
60001
  } catch {
59918
60002
  return false;
@@ -60051,8 +60135,8 @@ function defaultBuildTestCommand(profile, framework, files, dir = ".", opts = {}
60051
60135
  return ["mvn", "test"];
60052
60136
  case "gradle": {
60053
60137
  const isWindows = process.platform === "win32";
60054
- const hasGradlewBat = fs21.existsSync(path51.join(dir, "gradlew.bat"));
60055
- const hasGradlew = fs21.existsSync(path51.join(dir, "gradlew"));
60138
+ const hasGradlewBat = fs21.existsSync(path52.join(dir, "gradlew.bat"));
60139
+ const hasGradlew = fs21.existsSync(path52.join(dir, "gradlew"));
60056
60140
  if (hasGradlewBat && isWindows)
60057
60141
  return ["gradlew.bat", "test"];
60058
60142
  if (hasGradlew)
@@ -60069,7 +60153,7 @@ function defaultBuildTestCommand(profile, framework, files, dir = ".", opts = {}
60069
60153
  "cmake-build-release",
60070
60154
  "out"
60071
60155
  ];
60072
- const actualBuildDir = buildDirCandidates.find((d) => fs21.existsSync(path51.join(dir, d, "CMakeCache.txt"))) ?? "build";
60156
+ const actualBuildDir = buildDirCandidates.find((d) => fs21.existsSync(path52.join(dir, d, "CMakeCache.txt"))) ?? "build";
60073
60157
  return ["ctest", "--test-dir", actualBuildDir];
60074
60158
  }
60075
60159
  case "swift-test":
@@ -60358,17 +60442,17 @@ async function defaultSelectBuildCommand(profile, dir) {
60358
60442
  return null;
60359
60443
  }
60360
60444
  async function defaultTestFilesFor(profile, sourceFile, dir) {
60361
- const ext = path51.extname(sourceFile);
60445
+ const ext = path52.extname(sourceFile);
60362
60446
  if (!profile.extensions.includes(ext))
60363
60447
  return [];
60364
- const base = path51.basename(sourceFile, ext);
60365
- const rel = path51.relative(dir, sourceFile);
60366
- const relDir = path51.dirname(rel);
60448
+ const base = path52.basename(sourceFile, ext);
60449
+ const rel = path52.relative(dir, sourceFile);
60450
+ const relDir = path52.dirname(rel);
60367
60451
  const stripSrc = relDir.replace(/^src(\/|\\)/, "");
60368
60452
  const candidates = new Set;
60369
60453
  for (const tDir of ["tests", "test", "__tests__", "spec"]) {
60370
60454
  for (const suffix of ["", "_test", ".test", "_spec", ".spec"]) {
60371
- candidates.add(path51.join(dir, tDir, stripSrc, `${base}${suffix}${ext}`));
60455
+ candidates.add(path52.join(dir, tDir, stripSrc, `${base}${suffix}${ext}`));
60372
60456
  }
60373
60457
  }
60374
60458
  const existing = [];
@@ -60409,7 +60493,7 @@ var init_default_backend = __esm(() => {
60409
60493
 
60410
60494
  // src/lang/backends/go.ts
60411
60495
  import * as fs22 from "fs";
60412
- import * as path52 from "path";
60496
+ import * as path53 from "path";
60413
60497
  function extractImports(_sourceFile, source) {
60414
60498
  const out = new Set;
60415
60499
  IMPORT_REGEX_SINGLE.lastIndex = 0;
@@ -60435,7 +60519,7 @@ function extractImports(_sourceFile, source) {
60435
60519
  async function selectFramework(dir) {
60436
60520
  let content;
60437
60521
  try {
60438
- content = fs22.readFileSync(path52.join(dir, "go.mod"), "utf-8");
60522
+ content = fs22.readFileSync(path53.join(dir, "go.mod"), "utf-8");
60439
60523
  } catch {
60440
60524
  return null;
60441
60525
  }
@@ -60456,16 +60540,16 @@ async function selectFramework(dir) {
60456
60540
  async function selectEntryPoints(dir) {
60457
60541
  const points = [];
60458
60542
  try {
60459
- fs22.accessSync(path52.join(dir, "main.go"));
60543
+ fs22.accessSync(path53.join(dir, "main.go"));
60460
60544
  points.push("main.go");
60461
60545
  } catch {}
60462
60546
  try {
60463
- const cmdDir = path52.join(dir, "cmd");
60547
+ const cmdDir = path53.join(dir, "cmd");
60464
60548
  const subdirs = fs22.readdirSync(cmdDir, { withFileTypes: true }).filter((d) => d.isDirectory());
60465
60549
  for (const sub of subdirs) {
60466
- const main = path52.join("cmd", sub.name, "main.go");
60550
+ const main = path53.join("cmd", sub.name, "main.go");
60467
60551
  try {
60468
- fs22.accessSync(path52.join(dir, main));
60552
+ fs22.accessSync(path53.join(dir, main));
60469
60553
  points.push(main);
60470
60554
  } catch {}
60471
60555
  }
@@ -60484,19 +60568,19 @@ function buildGoBackend() {
60484
60568
  selectEntryPoints
60485
60569
  };
60486
60570
  }
60487
- var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals37;
60571
+ var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals38;
60488
60572
  var init_go = __esm(() => {
60489
60573
  init_default_backend();
60490
60574
  init_profiles();
60491
60575
  IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
60492
60576
  IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
60493
60577
  IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
60494
- _internals37 = { extractImports };
60578
+ _internals38 = { extractImports };
60495
60579
  });
60496
60580
 
60497
60581
  // src/lang/backends/python.ts
60498
60582
  import * as fs23 from "fs";
60499
- import * as path53 from "path";
60583
+ import * as path54 from "path";
60500
60584
  function parseImportTargets(rawTargets) {
60501
60585
  const cleaned = rawTargets.replace(/[()]/g, "").split(`
60502
60586
  `).map((line) => line.replace(/#.*$/, "").replace(/\\\s*$/, "")).join(" ");
@@ -60556,7 +60640,7 @@ async function selectFramework2(dir) {
60556
60640
  ];
60557
60641
  for (const candidate of ["pyproject.toml", "requirements.txt", "setup.py"]) {
60558
60642
  try {
60559
- const content = fs23.readFileSync(path53.join(dir, candidate), "utf-8");
60643
+ const content = fs23.readFileSync(path54.join(dir, candidate), "utf-8");
60560
60644
  const lower = content.toLowerCase();
60561
60645
  for (const [pkg, name] of candidates) {
60562
60646
  if (lower.includes(pkg)) {
@@ -60570,7 +60654,7 @@ async function selectFramework2(dir) {
60570
60654
  async function selectEntryPoints2(dir) {
60571
60655
  const points = new Set;
60572
60656
  try {
60573
- const content = fs23.readFileSync(path53.join(dir, "pyproject.toml"), "utf-8");
60657
+ const content = fs23.readFileSync(path54.join(dir, "pyproject.toml"), "utf-8");
60574
60658
  const scriptsBlock = content.match(/\[project\.scripts\][\s\S]*?(?=\n\[|$)/);
60575
60659
  if (scriptsBlock) {
60576
60660
  for (const line of scriptsBlock[0].split(`
@@ -60585,7 +60669,7 @@ async function selectEntryPoints2(dir) {
60585
60669
  } catch {}
60586
60670
  for (const name of ["manage.py", "main.py", "app.py", "__main__.py"]) {
60587
60671
  try {
60588
- fs23.accessSync(path53.join(dir, name));
60672
+ fs23.accessSync(path54.join(dir, name));
60589
60673
  points.add(name);
60590
60674
  } catch {}
60591
60675
  }
@@ -60603,18 +60687,18 @@ function buildPythonBackend() {
60603
60687
  selectEntryPoints: selectEntryPoints2
60604
60688
  };
60605
60689
  }
60606
- var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals38;
60690
+ var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals39;
60607
60691
  var init_python = __esm(() => {
60608
60692
  init_default_backend();
60609
60693
  init_profiles();
60610
60694
  IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
60611
60695
  IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
60612
- _internals38 = { extractImports: extractImports2 };
60696
+ _internals39 = { extractImports: extractImports2 };
60613
60697
  });
60614
60698
 
60615
60699
  // src/test-impact/analyzer.ts
60616
60700
  import fs24 from "fs";
60617
- import path54 from "path";
60701
+ import path55 from "path";
60618
60702
  function normalizePath(p) {
60619
60703
  return p.replace(/\\/g, "/");
60620
60704
  }
@@ -60648,8 +60732,8 @@ function resolveRelativeImport(fromDir, importPath) {
60648
60732
  if (!importPath.startsWith(".")) {
60649
60733
  return null;
60650
60734
  }
60651
- const resolved = path54.resolve(fromDir, importPath);
60652
- if (path54.extname(resolved)) {
60735
+ const resolved = path55.resolve(fromDir, importPath);
60736
+ if (path55.extname(resolved)) {
60653
60737
  if (fs24.existsSync(resolved) && fs24.statSync(resolved).isFile()) {
60654
60738
  return normalizePath(resolved);
60655
60739
  }
@@ -60669,20 +60753,20 @@ function resolvePythonImport(fromDir, module) {
60669
60753
  const leadingDots = module.match(/^\.+/)?.[0].length ?? 0;
60670
60754
  let baseDir = fromDir;
60671
60755
  for (let i = 1;i < leadingDots; i++) {
60672
- baseDir = path54.dirname(baseDir);
60756
+ baseDir = path55.dirname(baseDir);
60673
60757
  }
60674
60758
  const rest = module.slice(leadingDots);
60675
60759
  if (rest.length === 0) {
60676
- const initPath = path54.join(baseDir, "__init__.py");
60760
+ const initPath = path55.join(baseDir, "__init__.py");
60677
60761
  if (fs24.existsSync(initPath) && fs24.statSync(initPath).isFile()) {
60678
60762
  return normalizePath(initPath);
60679
60763
  }
60680
60764
  return null;
60681
60765
  }
60682
- const subpath = rest.replace(/\./g, path54.sep);
60766
+ const subpath = rest.replace(/\./g, path55.sep);
60683
60767
  const candidates = [
60684
- `${path54.join(baseDir, subpath)}.py`,
60685
- path54.join(baseDir, subpath, "__init__.py")
60768
+ `${path55.join(baseDir, subpath)}.py`,
60769
+ path55.join(baseDir, subpath, "__init__.py")
60686
60770
  ];
60687
60771
  for (const c of candidates) {
60688
60772
  if (fs24.existsSync(c) && fs24.statSync(c).isFile())
@@ -60691,7 +60775,7 @@ function resolvePythonImport(fromDir, module) {
60691
60775
  return null;
60692
60776
  }
60693
60777
  function findGoModule(fromDir) {
60694
- const resolved = path54.resolve(fromDir);
60778
+ const resolved = path55.resolve(fromDir);
60695
60779
  let cur = resolved;
60696
60780
  const walked = [];
60697
60781
  for (let i = 0;i < 16; i++) {
@@ -60703,7 +60787,7 @@ function findGoModule(fromDir) {
60703
60787
  }
60704
60788
  walked.push(cur);
60705
60789
  try {
60706
- const goMod = path54.join(cur, "go.mod");
60790
+ const goMod = path55.join(cur, "go.mod");
60707
60791
  const content = fs24.readFileSync(goMod, "utf-8");
60708
60792
  const moduleMatch = content.match(/^\s*module\s+"?([^"\s/]+(?:\/[^"\s]+)*)"?/m);
60709
60793
  if (moduleMatch) {
@@ -60714,10 +60798,10 @@ function findGoModule(fromDir) {
60714
60798
  }
60715
60799
  } catch {}
60716
60800
  try {
60717
- fs24.accessSync(path54.join(cur, ".git"));
60801
+ fs24.accessSync(path55.join(cur, ".git"));
60718
60802
  break;
60719
60803
  } catch {}
60720
- const parent = path54.dirname(cur);
60804
+ const parent = path55.dirname(cur);
60721
60805
  if (parent === cur)
60722
60806
  break;
60723
60807
  cur = parent;
@@ -60729,12 +60813,12 @@ function findGoModule(fromDir) {
60729
60813
  function resolveGoImport(fromDir, importPath) {
60730
60814
  let dir = null;
60731
60815
  if (importPath.startsWith(".")) {
60732
- dir = path54.resolve(fromDir, importPath);
60816
+ dir = path55.resolve(fromDir, importPath);
60733
60817
  } else {
60734
60818
  const mod = findGoModule(fromDir);
60735
60819
  if (mod && (importPath === mod.modulePath || importPath.startsWith(`${mod.modulePath}/`))) {
60736
60820
  const subpath = importPath.slice(mod.modulePath.length);
60737
- dir = path54.join(mod.moduleRoot, subpath);
60821
+ dir = path55.join(mod.moduleRoot, subpath);
60738
60822
  }
60739
60823
  }
60740
60824
  if (dir === null)
@@ -60742,7 +60826,7 @@ function resolveGoImport(fromDir, importPath) {
60742
60826
  if (!fs24.existsSync(dir) || !fs24.statSync(dir).isDirectory())
60743
60827
  return [];
60744
60828
  try {
60745
- return fs24.readdirSync(dir).filter((f) => f.endsWith(".go") && !f.endsWith("_test.go")).map((f) => normalizePath(path54.join(dir, f)));
60829
+ return fs24.readdirSync(dir).filter((f) => f.endsWith(".go") && !f.endsWith("_test.go")).map((f) => normalizePath(path55.join(dir, f)));
60746
60830
  } catch {
60747
60831
  return [];
60748
60832
  }
@@ -60781,15 +60865,15 @@ function findTestFilesSync(cwd) {
60781
60865
  for (const entry of entries) {
60782
60866
  if (entry.isDirectory()) {
60783
60867
  if (!skipDirs.has(entry.name)) {
60784
- walk(path54.join(dir, entry.name), visitedInodes);
60868
+ walk(path55.join(dir, entry.name), visitedInodes);
60785
60869
  }
60786
60870
  } else if (entry.isFile()) {
60787
60871
  const name = entry.name;
60788
60872
  const isTsTest = /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(name) || dir.includes("__tests__") && /\.(ts|tsx|js|jsx)$/.test(name);
60789
- const isPyTest = /^test_.+\.py$/.test(name) || /.+_test\.py$/.test(name) || dir.includes(`${path54.sep}tests${path54.sep}`) && name.endsWith(".py");
60873
+ const isPyTest = /^test_.+\.py$/.test(name) || /.+_test\.py$/.test(name) || dir.includes(`${path55.sep}tests${path55.sep}`) && name.endsWith(".py");
60790
60874
  const isGoTest = /.+_test\.go$/.test(name);
60791
60875
  if (isTsTest || isPyTest || isGoTest) {
60792
- testFiles.push(normalizePath(path54.join(dir, entry.name)));
60876
+ testFiles.push(normalizePath(path55.join(dir, entry.name)));
60793
60877
  }
60794
60878
  }
60795
60879
  }
@@ -60814,8 +60898,8 @@ function extractImports3(content) {
60814
60898
  ];
60815
60899
  }
60816
60900
  function addImpactEdgesForTestFile(testFile, content, impactMap) {
60817
- const ext = path54.extname(testFile).toLowerCase();
60818
- const testDir = path54.dirname(testFile);
60901
+ const ext = path55.extname(testFile).toLowerCase();
60902
+ const testDir = path55.dirname(testFile);
60819
60903
  function addEdge(source) {
60820
60904
  if (!impactMap[source])
60821
60905
  impactMap[source] = [];
@@ -60833,7 +60917,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
60833
60917
  return;
60834
60918
  }
60835
60919
  if (PYTHON_EXTENSIONS.has(ext)) {
60836
- const modules = _internals38.extractImports(testFile, content);
60920
+ const modules = _internals39.extractImports(testFile, content);
60837
60921
  for (const mod of modules) {
60838
60922
  const resolved = resolvePythonImport(testDir, mod);
60839
60923
  if (resolved !== null)
@@ -60842,7 +60926,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
60842
60926
  return;
60843
60927
  }
60844
60928
  if (GO_EXTENSIONS.has(ext)) {
60845
- const imports = _internals37.extractImports(testFile, content);
60929
+ const imports = _internals38.extractImports(testFile, content);
60846
60930
  for (const importPath of imports) {
60847
60931
  const sourceFiles = resolveGoImport(testDir, importPath);
60848
60932
  for (const source of sourceFiles)
@@ -60869,12 +60953,12 @@ async function buildImpactMapInternal(cwd) {
60869
60953
  return impactMap;
60870
60954
  }
60871
60955
  async function buildImpactMap(cwd) {
60872
- const impactMap = await _internals39.buildImpactMapInternal(cwd);
60873
- await _internals39.saveImpactMap(cwd, impactMap);
60956
+ const impactMap = await _internals40.buildImpactMapInternal(cwd);
60957
+ await _internals40.saveImpactMap(cwd, impactMap);
60874
60958
  return impactMap;
60875
60959
  }
60876
60960
  async function loadImpactMap(cwd, options) {
60877
- const cachePath = path54.join(cwd, ".swarm", "cache", "impact-map.json");
60961
+ const cachePath = path55.join(cwd, ".swarm", "cache", "impact-map.json");
60878
60962
  if (fs24.existsSync(cachePath)) {
60879
60963
  try {
60880
60964
  const content = fs24.readFileSync(cachePath, "utf-8");
@@ -60884,7 +60968,7 @@ async function loadImpactMap(cwd, options) {
60884
60968
  const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
60885
60969
  if (hasValidValues) {
60886
60970
  const generatedAt = new Date(data.generatedAt).getTime();
60887
- if (!_internals39.isCacheStale(map3, generatedAt)) {
60971
+ if (!_internals40.isCacheStale(map3, generatedAt)) {
60888
60972
  return map3;
60889
60973
  }
60890
60974
  if (options?.skipRebuild) {
@@ -60904,15 +60988,15 @@ async function loadImpactMap(cwd, options) {
60904
60988
  if (options?.skipRebuild) {
60905
60989
  return {};
60906
60990
  }
60907
- return _internals39.buildImpactMap(cwd);
60991
+ return _internals40.buildImpactMap(cwd);
60908
60992
  }
60909
60993
  async function saveImpactMap(cwd, impactMap) {
60910
- if (!path54.isAbsolute(cwd)) {
60994
+ if (!path55.isAbsolute(cwd)) {
60911
60995
  throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
60912
60996
  }
60913
- _internals39.validateProjectRoot(cwd);
60914
- const cacheDir2 = path54.join(cwd, ".swarm", "cache");
60915
- const cachePath = path54.join(cacheDir2, "impact-map.json");
60997
+ _internals40.validateProjectRoot(cwd);
60998
+ const cacheDir2 = path55.join(cwd, ".swarm", "cache");
60999
+ const cachePath = path55.join(cacheDir2, "impact-map.json");
60916
61000
  if (!fs24.existsSync(cacheDir2)) {
60917
61001
  fs24.mkdirSync(cacheDir2, { recursive: true });
60918
61002
  }
@@ -60934,7 +61018,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
60934
61018
  };
60935
61019
  }
60936
61020
  const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
60937
- const impactMap = await _internals39.loadImpactMap(cwd);
61021
+ const impactMap = await _internals40.loadImpactMap(cwd);
60938
61022
  const impactedTestsSet = new Set;
60939
61023
  const untestedFiles = [];
60940
61024
  let visitedCount = 0;
@@ -60944,7 +61028,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
60944
61028
  budgetExceeded = true;
60945
61029
  break;
60946
61030
  }
60947
- const normalizedChanged = normalizePath(path54.resolve(changedFile));
61031
+ const normalizedChanged = normalizePath(path55.resolve(changedFile));
60948
61032
  const tests = impactMap[normalizedChanged];
60949
61033
  if (tests && tests.length > 0) {
60950
61034
  for (const test of tests) {
@@ -60958,13 +61042,13 @@ async function analyzeImpact(changedFiles, cwd, budget) {
60958
61042
  if (budgetExceeded)
60959
61043
  break;
60960
61044
  } else {
60961
- const changedDir = normalizePath(path54.dirname(normalizedChanged));
60962
- const changedInputDir = normalizePath(path54.dirname(changedFile));
61045
+ const changedDir = normalizePath(path55.dirname(normalizedChanged));
61046
+ const changedInputDir = normalizePath(path55.dirname(changedFile));
60963
61047
  const suffixMatches = Object.entries(impactMap).filter(([sourcePath]) => {
60964
61048
  return sourcePath.endsWith(changedFile) || changedFile.endsWith(sourcePath) || sourcePath.endsWith(normalizedChanged) || normalizedChanged.endsWith(sourcePath);
60965
61049
  }).sort(([sourceA], [sourceB]) => {
60966
- const sourceDirA = normalizePath(path54.dirname(sourceA));
60967
- const sourceDirB = normalizePath(path54.dirname(sourceB));
61050
+ const sourceDirA = normalizePath(path55.dirname(sourceA));
61051
+ const sourceDirB = normalizePath(path55.dirname(sourceB));
60968
61052
  const exactA = sourceDirA === changedDir || changedInputDir !== "." && (sourceDirA === changedInputDir || sourceDirA.endsWith(`/${changedInputDir}`));
60969
61053
  const exactB = sourceDirB === changedDir || changedInputDir !== "." && (sourceDirB === changedInputDir || sourceDirB.endsWith(`/${changedInputDir}`));
60970
61054
  if (exactA !== exactB)
@@ -61019,7 +61103,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
61019
61103
  budgetExceeded
61020
61104
  };
61021
61105
  }
61022
- var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals39;
61106
+ var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals40;
61023
61107
  var init_analyzer = __esm(() => {
61024
61108
  init_manager2();
61025
61109
  init_go();
@@ -61032,7 +61116,7 @@ var init_analyzer = __esm(() => {
61032
61116
  GO_EXTENSIONS = new Set([".go"]);
61033
61117
  EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
61034
61118
  goModuleCache = new Map;
61035
- _internals39 = {
61119
+ _internals40 = {
61036
61120
  validateProjectRoot,
61037
61121
  normalizePath,
61038
61122
  isCacheStale,
@@ -61094,12 +61178,12 @@ function buildErrnoPatternPair(errno, contextPattern) {
61094
61178
  ];
61095
61179
  }
61096
61180
  function isInfrastructureFailure(currentResult) {
61097
- const errorMessage = currentResult.errorMessage || "";
61181
+ const errorMessage2 = currentResult.errorMessage || "";
61098
61182
  const stackPrefix = currentResult.stackPrefix || "";
61099
- if (/\bassertionerror\b/i.test(errorMessage)) {
61183
+ if (/\bassertionerror\b/i.test(errorMessage2)) {
61100
61184
  return false;
61101
61185
  }
61102
- const combinedText = `${errorMessage}
61186
+ const combinedText = `${errorMessage2}
61103
61187
  ${stackPrefix}`;
61104
61188
  return INFRASTRUCTURE_FAILURE_PATTERNS.some((pattern) => pattern.test(combinedText));
61105
61189
  }
@@ -61319,24 +61403,24 @@ var FLAKY_THRESHOLD = 0.3, MIN_RUNS_FOR_QUARANTINE = 5, MAX_HISTORY_RUNS = 20;
61319
61403
 
61320
61404
  // src/test-impact/history-store.ts
61321
61405
  import fs25 from "fs";
61322
- import path55 from "path";
61406
+ import path56 from "path";
61323
61407
  function getHistoryPath(workingDir) {
61324
61408
  if (!workingDir) {
61325
61409
  throw new Error("getHistoryPath requires a working directory \u2014 project root must be provided by the caller");
61326
61410
  }
61327
- if (!path55.isAbsolute(workingDir)) {
61411
+ if (!path56.isAbsolute(workingDir)) {
61328
61412
  throw new Error(`getHistoryPath requires an absolute project root path, got: "${workingDir}"`);
61329
61413
  }
61330
- return path55.join(workingDir, ".swarm", "cache", "test-history.jsonl");
61414
+ return path56.join(workingDir, ".swarm", "cache", "test-history.jsonl");
61331
61415
  }
61332
- function sanitizeErrorMessage(errorMessage) {
61333
- if (errorMessage === undefined) {
61416
+ function sanitizeErrorMessage(errorMessage2) {
61417
+ if (errorMessage2 === undefined) {
61334
61418
  return;
61335
61419
  }
61336
- if (errorMessage.length > MAX_ERROR_LENGTH) {
61337
- return errorMessage.substring(0, MAX_ERROR_LENGTH);
61420
+ if (errorMessage2.length > MAX_ERROR_LENGTH) {
61421
+ return errorMessage2.substring(0, MAX_ERROR_LENGTH);
61338
61422
  }
61339
- return errorMessage;
61423
+ return errorMessage2;
61340
61424
  }
61341
61425
  function sanitizeStackPrefix(stackPrefix) {
61342
61426
  if (stackPrefix === undefined) {
@@ -61414,8 +61498,8 @@ function batchAppendTestRuns(records, workingDir) {
61414
61498
  }
61415
61499
  }
61416
61500
  const historyPath = getHistoryPath(workingDir);
61417
- const historyDir = path55.dirname(historyPath);
61418
- _internals40.validateProjectRoot(workingDir);
61501
+ const historyDir = path56.dirname(historyPath);
61502
+ _internals41.validateProjectRoot(workingDir);
61419
61503
  if (!fs25.existsSync(historyDir)) {
61420
61504
  fs25.mkdirSync(historyDir, { recursive: true });
61421
61505
  }
@@ -61538,7 +61622,7 @@ function getAllHistory(workingDir) {
61538
61622
  records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
61539
61623
  return records;
61540
61624
  }
61541
- var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals40;
61625
+ var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals41;
61542
61626
  var init_history_store = __esm(() => {
61543
61627
  init_manager2();
61544
61628
  DANGEROUS_PROPERTY_NAMES = new Set([
@@ -61546,14 +61630,14 @@ var init_history_store = __esm(() => {
61546
61630
  "constructor",
61547
61631
  "prototype"
61548
61632
  ]);
61549
- _internals40 = {
61633
+ _internals41 = {
61550
61634
  validateProjectRoot
61551
61635
  };
61552
61636
  });
61553
61637
 
61554
61638
  // src/tools/resolve-working-directory.ts
61555
61639
  import * as fs26 from "fs";
61556
- import * as path56 from "path";
61640
+ import * as path57 from "path";
61557
61641
  function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
61558
61642
  if (workingDirectory == null || workingDirectory === "") {
61559
61643
  if (typeof fallbackDirectory !== "string" || fallbackDirectory === "") {
@@ -61585,15 +61669,15 @@ function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
61585
61669
  };
61586
61670
  }
61587
61671
  }
61588
- const rawPathParts = workingDirectory.split(path56.sep);
61672
+ const rawPathParts = workingDirectory.split(path57.sep);
61589
61673
  if (rawPathParts.includes("..")) {
61590
61674
  return {
61591
61675
  success: false,
61592
61676
  message: "Invalid working_directory: path traversal sequences (..) are not allowed"
61593
61677
  };
61594
61678
  }
61595
- const normalizedDir = path56.normalize(workingDirectory);
61596
- const resolvedDir = path56.resolve(normalizedDir);
61679
+ const normalizedDir = path57.normalize(workingDirectory);
61680
+ const resolvedDir = path57.resolve(normalizedDir);
61597
61681
  let statResult;
61598
61682
  try {
61599
61683
  statResult = fs26.statSync(resolvedDir);
@@ -61612,7 +61696,7 @@ function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
61612
61696
  if (typeof fallbackDirectory !== "string" || fallbackDirectory === "") {
61613
61697
  return { success: true, directory: resolvedDir };
61614
61698
  }
61615
- const resolvedFallback = path56.resolve(fallbackDirectory);
61699
+ const resolvedFallback = path57.resolve(fallbackDirectory);
61616
61700
  let fallbackExists = false;
61617
61701
  try {
61618
61702
  fs26.statSync(resolvedFallback);
@@ -61621,7 +61705,7 @@ function resolveWorkingDirectory(workingDirectory, fallbackDirectory) {
61621
61705
  fallbackExists = false;
61622
61706
  }
61623
61707
  if (fallbackExists) {
61624
- const isSubdirectory = resolvedDir.startsWith(resolvedFallback + path56.sep);
61708
+ const isSubdirectory = resolvedDir.startsWith(resolvedFallback + path57.sep);
61625
61709
  if (isSubdirectory) {
61626
61710
  return {
61627
61711
  success: false,
@@ -61668,7 +61752,7 @@ var init_registry_backend = __esm(() => {
61668
61752
 
61669
61753
  // src/lang/framework-detector.ts
61670
61754
  import * as fs27 from "fs";
61671
- import * as path57 from "path";
61755
+ import * as path58 from "path";
61672
61756
  function detectLaravelProject(directory) {
61673
61757
  const signals = getLaravelSignals(directory);
61674
61758
  const signalCount = [
@@ -61685,7 +61769,7 @@ function getLaravelSignals(directory) {
61685
61769
  return { hasArtisanFile, hasLaravelFrameworkDep, hasConfigApp };
61686
61770
  }
61687
61771
  function checkArtisanFile(directory) {
61688
- const artisanPath = path57.join(directory, "artisan");
61772
+ const artisanPath = path58.join(directory, "artisan");
61689
61773
  if (!fs27.existsSync(artisanPath))
61690
61774
  return false;
61691
61775
  try {
@@ -61695,7 +61779,7 @@ function checkArtisanFile(directory) {
61695
61779
  }
61696
61780
  }
61697
61781
  function checkLaravelFrameworkDep(directory) {
61698
- const composerPath = path57.join(directory, "composer.json");
61782
+ const composerPath = path58.join(directory, "composer.json");
61699
61783
  if (!fs27.existsSync(composerPath))
61700
61784
  return false;
61701
61785
  try {
@@ -61708,7 +61792,7 @@ function checkLaravelFrameworkDep(directory) {
61708
61792
  }
61709
61793
  }
61710
61794
  function checkConfigApp(directory) {
61711
- return fs27.existsSync(path57.join(directory, "config", "app.php"));
61795
+ return fs27.existsSync(path58.join(directory, "config", "app.php"));
61712
61796
  }
61713
61797
  var init_framework_detector = () => {};
61714
61798
 
@@ -61741,17 +61825,17 @@ var init_php = __esm(() => {
61741
61825
 
61742
61826
  // src/lang/backends/typescript.ts
61743
61827
  import * as fs28 from "fs";
61744
- import * as path58 from "path";
61828
+ import * as path59 from "path";
61745
61829
  function readPackageJsonRaw(dir) {
61746
61830
  try {
61747
- const content = fs28.readFileSync(path58.join(dir, "package.json"), "utf-8");
61831
+ const content = fs28.readFileSync(path59.join(dir, "package.json"), "utf-8");
61748
61832
  return JSON.parse(content);
61749
61833
  } catch {
61750
61834
  return null;
61751
61835
  }
61752
61836
  }
61753
61837
  function readPackageJson(dir) {
61754
- return _internals41.readPackageJsonRaw(dir);
61838
+ return _internals42.readPackageJsonRaw(dir);
61755
61839
  }
61756
61840
  function readPackageJsonTestScript(dir) {
61757
61841
  return readPackageJson(dir)?.scripts?.test ?? null;
@@ -61921,7 +62005,7 @@ function buildTypescriptBackend() {
61921
62005
  selectEntryPoints: selectEntryPoints3
61922
62006
  };
61923
62007
  }
61924
- var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals41;
62008
+ var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals42;
61925
62009
  var init_typescript = __esm(() => {
61926
62010
  init_default_backend();
61927
62011
  init_profiles();
@@ -61930,7 +62014,7 @@ var init_typescript = __esm(() => {
61930
62014
  IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
61931
62015
  IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
61932
62016
  IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
61933
- _internals41 = {
62017
+ _internals42 = {
61934
62018
  readPackageJsonRaw,
61935
62019
  readPackageJsonTestScript,
61936
62020
  frameworkFromScriptsTest
@@ -61963,10 +62047,10 @@ __export(exports_dispatch, {
61963
62047
  pickedProfiles: () => pickedProfiles,
61964
62048
  pickBackend: () => pickBackend,
61965
62049
  clearDispatchCache: () => clearDispatchCache,
61966
- _internals: () => _internals42
62050
+ _internals: () => _internals43
61967
62051
  });
61968
62052
  import * as fs29 from "fs";
61969
- import * as path59 from "path";
62053
+ import * as path60 from "path";
61970
62054
  function safeReaddirSet(dir) {
61971
62055
  try {
61972
62056
  return new Set(fs29.readdirSync(dir));
@@ -61983,14 +62067,14 @@ function manifestHash(dir) {
61983
62067
  if (!entries.has(name))
61984
62068
  continue;
61985
62069
  try {
61986
- const stat9 = fs29.statSync(path59.join(dir, name));
62070
+ const stat9 = fs29.statSync(path60.join(dir, name));
61987
62071
  parts.push(`${name}:${stat9.size}:${stat9.mtimeMs}:${stat9.ino}`);
61988
62072
  } catch {}
61989
62073
  }
61990
62074
  return parts.join("|");
61991
62075
  }
61992
62076
  function findManifestRoot(start) {
61993
- const resolved = path59.resolve(start);
62077
+ const resolved = path60.resolve(start);
61994
62078
  const cached3 = manifestRootCache.get(resolved);
61995
62079
  if (cached3 !== undefined)
61996
62080
  return cached3;
@@ -62009,7 +62093,7 @@ function findManifestRoot(start) {
62009
62093
  return cur;
62010
62094
  }
62011
62095
  }
62012
- const parent = path59.dirname(cur);
62096
+ const parent = path60.dirname(cur);
62013
62097
  if (parent === cur)
62014
62098
  break;
62015
62099
  cur = parent;
@@ -62018,7 +62102,7 @@ function findManifestRoot(start) {
62018
62102
  return start;
62019
62103
  }
62020
62104
  function evictIfNeeded() {
62021
- if (cache.size <= _internals42.cacheCapacity)
62105
+ if (cache.size <= _internals43.cacheCapacity)
62022
62106
  return;
62023
62107
  let oldestKey;
62024
62108
  let oldestOrder = Infinity;
@@ -62049,7 +62133,7 @@ async function pickBackend(dir) {
62049
62133
  evictIfNeeded();
62050
62134
  return null;
62051
62135
  }
62052
- const profiles = await _internals42.detectProjectLanguages(root);
62136
+ const profiles = await _internals43.detectProjectLanguages(root);
62053
62137
  if (profiles.length === 0) {
62054
62138
  cache.set(cacheKey, {
62055
62139
  hash: hash4,
@@ -62081,12 +62165,12 @@ function clearDispatchCache() {
62081
62165
  manifestRootCache.clear();
62082
62166
  insertCounter = 0;
62083
62167
  }
62084
- var _internals42, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
62168
+ var _internals43, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
62085
62169
  var init_dispatch = __esm(() => {
62086
62170
  init_backends();
62087
62171
  init_detector();
62088
62172
  init_registry_backend();
62089
- _internals42 = {
62173
+ _internals43 = {
62090
62174
  detectProjectLanguages,
62091
62175
  cacheCapacity: 64
62092
62176
  };
@@ -62119,13 +62203,13 @@ var init_dispatch = __esm(() => {
62119
62203
 
62120
62204
  // src/tools/test-runner.ts
62121
62205
  import * as fs30 from "fs";
62122
- import * as path60 from "path";
62206
+ import * as path61 from "path";
62123
62207
  async function estimateFanOut(sourceFiles, cwd) {
62124
62208
  try {
62125
62209
  const impactMap = await loadImpactMap(cwd, { skipRebuild: true });
62126
62210
  const uniqueTestFiles = new Set;
62127
62211
  for (const sourceFile of sourceFiles) {
62128
- const resolvedPath = path60.resolve(cwd, sourceFile);
62212
+ const resolvedPath = path61.resolve(cwd, sourceFile);
62129
62213
  const normalizedPath = resolvedPath.replace(/\\/g, "/");
62130
62214
  const testFiles = impactMap[normalizedPath];
62131
62215
  if (testFiles) {
@@ -62207,14 +62291,14 @@ function hasDevDependency(devDeps, ...patterns) {
62207
62291
  return hasPackageJsonDependency(devDeps, ...patterns);
62208
62292
  }
62209
62293
  function detectGoTest(cwd) {
62210
- return fs30.existsSync(path60.join(cwd, "go.mod")) && isCommandAvailable("go");
62294
+ return fs30.existsSync(path61.join(cwd, "go.mod")) && isCommandAvailable("go");
62211
62295
  }
62212
62296
  function detectJavaMaven(cwd) {
62213
- return fs30.existsSync(path60.join(cwd, "pom.xml")) && isCommandAvailable("mvn");
62297
+ return fs30.existsSync(path61.join(cwd, "pom.xml")) && isCommandAvailable("mvn");
62214
62298
  }
62215
62299
  function detectGradle(cwd) {
62216
- const hasBuildFile = fs30.existsSync(path60.join(cwd, "build.gradle")) || fs30.existsSync(path60.join(cwd, "build.gradle.kts"));
62217
- const hasGradlew = fs30.existsSync(path60.join(cwd, "gradlew")) || fs30.existsSync(path60.join(cwd, "gradlew.bat"));
62300
+ const hasBuildFile = fs30.existsSync(path61.join(cwd, "build.gradle")) || fs30.existsSync(path61.join(cwd, "build.gradle.kts"));
62301
+ const hasGradlew = fs30.existsSync(path61.join(cwd, "gradlew")) || fs30.existsSync(path61.join(cwd, "gradlew.bat"));
62218
62302
  return hasBuildFile && (hasGradlew || isCommandAvailable("gradle"));
62219
62303
  }
62220
62304
  function detectDotnetTest(cwd) {
@@ -62227,25 +62311,25 @@ function detectDotnetTest(cwd) {
62227
62311
  }
62228
62312
  }
62229
62313
  function detectCTest(cwd) {
62230
- const hasSource = fs30.existsSync(path60.join(cwd, "CMakeLists.txt"));
62231
- const hasBuildCache = fs30.existsSync(path60.join(cwd, "CMakeCache.txt")) || fs30.existsSync(path60.join(cwd, "build", "CMakeCache.txt"));
62314
+ const hasSource = fs30.existsSync(path61.join(cwd, "CMakeLists.txt"));
62315
+ const hasBuildCache = fs30.existsSync(path61.join(cwd, "CMakeCache.txt")) || fs30.existsSync(path61.join(cwd, "build", "CMakeCache.txt"));
62232
62316
  return (hasSource || hasBuildCache) && isCommandAvailable("ctest");
62233
62317
  }
62234
62318
  function detectSwiftTest(cwd) {
62235
- return fs30.existsSync(path60.join(cwd, "Package.swift")) && isCommandAvailable("swift");
62319
+ return fs30.existsSync(path61.join(cwd, "Package.swift")) && isCommandAvailable("swift");
62236
62320
  }
62237
62321
  function detectDartTest(cwd) {
62238
- return fs30.existsSync(path60.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
62322
+ return fs30.existsSync(path61.join(cwd, "pubspec.yaml")) && (isCommandAvailable("dart") || isCommandAvailable("flutter"));
62239
62323
  }
62240
62324
  function detectRSpec(cwd) {
62241
- const hasRSpecFile = fs30.existsSync(path60.join(cwd, ".rspec"));
62242
- const hasGemfile = fs30.existsSync(path60.join(cwd, "Gemfile"));
62243
- const hasSpecDir = fs30.existsSync(path60.join(cwd, "spec"));
62325
+ const hasRSpecFile = fs30.existsSync(path61.join(cwd, ".rspec"));
62326
+ const hasGemfile = fs30.existsSync(path61.join(cwd, "Gemfile"));
62327
+ const hasSpecDir = fs30.existsSync(path61.join(cwd, "spec"));
62244
62328
  const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
62245
62329
  return hasRSpec && (isCommandAvailable("bundle") || isCommandAvailable("rspec"));
62246
62330
  }
62247
62331
  function detectMinitest(cwd) {
62248
- return fs30.existsSync(path60.join(cwd, "test")) && (fs30.existsSync(path60.join(cwd, "Gemfile")) || fs30.existsSync(path60.join(cwd, "Rakefile"))) && isCommandAvailable("ruby");
62332
+ return fs30.existsSync(path61.join(cwd, "test")) && (fs30.existsSync(path61.join(cwd, "Gemfile")) || fs30.existsSync(path61.join(cwd, "Rakefile"))) && isCommandAvailable("ruby");
62249
62333
  }
62250
62334
  async function detectTestFrameworkViaDispatch(cwd) {
62251
62335
  try {
@@ -62308,7 +62392,7 @@ async function parseTestOutputViaDispatch(framework, output, baseDir) {
62308
62392
  async function detectTestFramework(cwd) {
62309
62393
  const baseDir = cwd;
62310
62394
  try {
62311
- const packageJsonPath = path60.join(baseDir, "package.json");
62395
+ const packageJsonPath = path61.join(baseDir, "package.json");
62312
62396
  if (fs30.existsSync(packageJsonPath)) {
62313
62397
  const content = fs30.readFileSync(packageJsonPath, "utf-8");
62314
62398
  const pkg = JSON.parse(content);
@@ -62329,16 +62413,16 @@ async function detectTestFramework(cwd) {
62329
62413
  return "jest";
62330
62414
  if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
62331
62415
  return "mocha";
62332
- if (fs30.existsSync(path60.join(baseDir, "bun.lockb")) || fs30.existsSync(path60.join(baseDir, "bun.lock"))) {
62416
+ if (fs30.existsSync(path61.join(baseDir, "bun.lockb")) || fs30.existsSync(path61.join(baseDir, "bun.lock"))) {
62333
62417
  if (scripts.test?.includes("bun"))
62334
62418
  return "bun";
62335
62419
  }
62336
62420
  }
62337
62421
  } catch {}
62338
62422
  try {
62339
- const pyprojectTomlPath = path60.join(baseDir, "pyproject.toml");
62340
- const setupCfgPath = path60.join(baseDir, "setup.cfg");
62341
- const requirementsTxtPath = path60.join(baseDir, "requirements.txt");
62423
+ const pyprojectTomlPath = path61.join(baseDir, "pyproject.toml");
62424
+ const setupCfgPath = path61.join(baseDir, "setup.cfg");
62425
+ const requirementsTxtPath = path61.join(baseDir, "requirements.txt");
62342
62426
  if (fs30.existsSync(pyprojectTomlPath)) {
62343
62427
  const content = fs30.readFileSync(pyprojectTomlPath, "utf-8");
62344
62428
  if (content.includes("[tool.pytest"))
@@ -62358,7 +62442,7 @@ async function detectTestFramework(cwd) {
62358
62442
  }
62359
62443
  } catch {}
62360
62444
  try {
62361
- const cargoTomlPath = path60.join(baseDir, "Cargo.toml");
62445
+ const cargoTomlPath = path61.join(baseDir, "Cargo.toml");
62362
62446
  if (fs30.existsSync(cargoTomlPath)) {
62363
62447
  const content = fs30.readFileSync(cargoTomlPath, "utf-8");
62364
62448
  if (content.includes("[dev-dependencies]")) {
@@ -62369,9 +62453,9 @@ async function detectTestFramework(cwd) {
62369
62453
  }
62370
62454
  } catch {}
62371
62455
  try {
62372
- const pesterConfigPath = path60.join(baseDir, "pester.config.ps1");
62373
- const pesterConfigJsonPath = path60.join(baseDir, "pester.config.ps1.json");
62374
- const pesterPs1Path = path60.join(baseDir, "tests.ps1");
62456
+ const pesterConfigPath = path61.join(baseDir, "pester.config.ps1");
62457
+ const pesterConfigJsonPath = path61.join(baseDir, "pester.config.ps1.json");
62458
+ const pesterPs1Path = path61.join(baseDir, "tests.ps1");
62375
62459
  if (fs30.existsSync(pesterConfigPath) || fs30.existsSync(pesterConfigJsonPath) || fs30.existsSync(pesterPs1Path)) {
62376
62460
  return "pester";
62377
62461
  }
@@ -62400,12 +62484,12 @@ function isTestDirectoryPath(normalizedPath) {
62400
62484
  return normalizedPath.split("/").some((segment) => TEST_DIRECTORY_NAMES.includes(segment));
62401
62485
  }
62402
62486
  function resolveWorkspacePath(file3, workingDir) {
62403
- return path60.isAbsolute(file3) ? path60.resolve(file3) : path60.resolve(workingDir, file3);
62487
+ return path61.isAbsolute(file3) ? path61.resolve(file3) : path61.resolve(workingDir, file3);
62404
62488
  }
62405
62489
  function toWorkspaceOutputPath(absolutePath, workingDir, preferRelative) {
62406
62490
  if (!preferRelative)
62407
62491
  return absolutePath;
62408
- return path60.relative(workingDir, absolutePath);
62492
+ return path61.relative(workingDir, absolutePath);
62409
62493
  }
62410
62494
  function dedupePush(target, value) {
62411
62495
  if (!target.includes(value)) {
@@ -62442,18 +62526,18 @@ function buildLanguageSpecificTestNames(nameWithoutExt, ext) {
62442
62526
  }
62443
62527
  }
62444
62528
  function getRepoLevelCandidateDirectories(workingDir, relativePath, ext) {
62445
- const relativeDir = path60.dirname(relativePath);
62529
+ const relativeDir = path61.dirname(relativePath);
62446
62530
  const nestedRelativeDir = relativeDir === "." ? "" : relativeDir;
62447
62531
  const directories = TEST_DIRECTORY_NAMES.flatMap((dirName) => {
62448
- const rootDir = path60.join(workingDir, dirName);
62449
- return nestedRelativeDir ? [rootDir, path60.join(rootDir, nestedRelativeDir)] : [rootDir];
62532
+ const rootDir = path61.join(workingDir, dirName);
62533
+ return nestedRelativeDir ? [rootDir, path61.join(rootDir, nestedRelativeDir)] : [rootDir];
62450
62534
  });
62451
62535
  const normalizedRelativePath = relativePath.replace(/\\/g, "/");
62452
62536
  if (ext === ".java" && normalizedRelativePath.startsWith("src/main/java/")) {
62453
- directories.push(path60.join(workingDir, "src/test/java", path60.dirname(normalizedRelativePath.slice("src/main/java/".length))));
62537
+ directories.push(path61.join(workingDir, "src/test/java", path61.dirname(normalizedRelativePath.slice("src/main/java/".length))));
62454
62538
  }
62455
62539
  if ((ext === ".kt" || ext === ".java") && normalizedRelativePath.startsWith("src/main/kotlin/")) {
62456
- directories.push(path60.join(workingDir, "src/test/kotlin", path60.dirname(normalizedRelativePath.slice("src/main/kotlin/".length))));
62540
+ directories.push(path61.join(workingDir, "src/test/kotlin", path61.dirname(normalizedRelativePath.slice("src/main/kotlin/".length))));
62457
62541
  }
62458
62542
  return [...new Set(directories)];
62459
62543
  }
@@ -62481,23 +62565,23 @@ function isLanguageSpecificTestFile(basename9) {
62481
62565
  }
62482
62566
  function isConventionTestFilePath(filePath) {
62483
62567
  const normalizedPath = filePath.replace(/\\/g, "/");
62484
- const basename9 = path60.basename(filePath);
62568
+ const basename9 = path61.basename(filePath);
62485
62569
  return hasCompoundTestExtension(basename9) || basename9.includes(".spec.") || basename9.includes(".test.") || isLanguageSpecificTestFile(basename9) || isTestDirectoryPath(normalizedPath);
62486
62570
  }
62487
62571
  function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
62488
62572
  const testFiles = [];
62489
62573
  for (const file3 of sourceFiles) {
62490
62574
  const absoluteFile = resolveWorkspacePath(file3, workingDir);
62491
- const relativeFile = path60.relative(workingDir, absoluteFile);
62492
- const basename9 = path60.basename(absoluteFile);
62493
- const dirname34 = path60.dirname(absoluteFile);
62494
- const preferRelativeOutput = !path60.isAbsolute(file3);
62575
+ const relativeFile = path61.relative(workingDir, absoluteFile);
62576
+ const basename9 = path61.basename(absoluteFile);
62577
+ const dirname34 = path61.dirname(absoluteFile);
62578
+ const preferRelativeOutput = !path61.isAbsolute(file3);
62495
62579
  if (isConventionTestFilePath(relativeFile) || isConventionTestFilePath(file3)) {
62496
62580
  dedupePush(testFiles, toWorkspaceOutputPath(absoluteFile, workingDir, preferRelativeOutput));
62497
62581
  continue;
62498
62582
  }
62499
62583
  const nameWithoutExt = basename9.replace(/\.[^.]+$/, "");
62500
- const ext = path60.extname(basename9);
62584
+ const ext = path61.extname(basename9);
62501
62585
  const genericTestNames = [
62502
62586
  `${nameWithoutExt}.spec${ext}`,
62503
62587
  `${nameWithoutExt}.test${ext}`
@@ -62506,7 +62590,7 @@ function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
62506
62590
  const colocatedCandidates = [
62507
62591
  ...genericTestNames,
62508
62592
  ...languageSpecificTestNames
62509
- ].map((candidateName) => path60.join(dirname34, candidateName));
62593
+ ].map((candidateName) => path61.join(dirname34, candidateName));
62510
62594
  const testDirectoryNames = [
62511
62595
  basename9,
62512
62596
  ...genericTestNames,
@@ -62515,8 +62599,8 @@ function getTestFilesFromConvention(sourceFiles, workingDir = process.cwd()) {
62515
62599
  const repoLevelDirectories = getRepoLevelCandidateDirectories(workingDir, relativeFile, ext);
62516
62600
  const possibleTestFiles = [
62517
62601
  ...colocatedCandidates,
62518
- ...TEST_DIRECTORY_NAMES.flatMap((dirName) => testDirectoryNames.map((candidateName) => path60.join(dirname34, dirName, candidateName))),
62519
- ...repoLevelDirectories.flatMap((candidateDir) => testDirectoryNames.map((candidateName) => path60.join(candidateDir, candidateName)))
62602
+ ...TEST_DIRECTORY_NAMES.flatMap((dirName) => testDirectoryNames.map((candidateName) => path61.join(dirname34, dirName, candidateName))),
62603
+ ...repoLevelDirectories.flatMap((candidateDir) => testDirectoryNames.map((candidateName) => path61.join(candidateDir, candidateName)))
62520
62604
  ];
62521
62605
  for (const testFile of possibleTestFiles) {
62522
62606
  if (fs30.existsSync(testFile)) {
@@ -62537,7 +62621,7 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
62537
62621
  try {
62538
62622
  const absoluteTestFile = resolveWorkspacePath(testFile, workingDir);
62539
62623
  const content = fs30.readFileSync(absoluteTestFile, "utf-8");
62540
- const testDir = path60.dirname(absoluteTestFile);
62624
+ const testDir = path61.dirname(absoluteTestFile);
62541
62625
  const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
62542
62626
  let match;
62543
62627
  match = importRegex.exec(content);
@@ -62545,8 +62629,8 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
62545
62629
  const importPath = match[1];
62546
62630
  let resolvedImport;
62547
62631
  if (importPath.startsWith(".")) {
62548
- resolvedImport = path60.resolve(testDir, importPath);
62549
- const existingExt = path60.extname(resolvedImport);
62632
+ resolvedImport = path61.resolve(testDir, importPath);
62633
+ const existingExt = path61.extname(resolvedImport);
62550
62634
  if (!existingExt) {
62551
62635
  for (const extToTry of [
62552
62636
  ".ts",
@@ -62566,12 +62650,12 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
62566
62650
  } else {
62567
62651
  continue;
62568
62652
  }
62569
- const importBasename = path60.basename(resolvedImport, path60.extname(resolvedImport));
62570
- const importDir = path60.dirname(resolvedImport);
62653
+ const importBasename = path61.basename(resolvedImport, path61.extname(resolvedImport));
62654
+ const importDir = path61.dirname(resolvedImport);
62571
62655
  for (const sourceFile of absoluteSourceFiles) {
62572
- const sourceDir = path60.dirname(sourceFile);
62573
- const sourceBasename = path60.basename(sourceFile, path60.extname(sourceFile));
62574
- const isRelatedDir = importDir === sourceDir || importDir === path60.join(sourceDir, "__tests__") || importDir === path60.join(sourceDir, "tests") || importDir === path60.join(sourceDir, "test") || importDir === path60.join(sourceDir, "spec");
62656
+ const sourceDir = path61.dirname(sourceFile);
62657
+ const sourceBasename = path61.basename(sourceFile, path61.extname(sourceFile));
62658
+ const isRelatedDir = importDir === sourceDir || importDir === path61.join(sourceDir, "__tests__") || importDir === path61.join(sourceDir, "tests") || importDir === path61.join(sourceDir, "test") || importDir === path61.join(sourceDir, "spec");
62575
62659
  if (resolvedImport === sourceFile || importBasename === sourceBasename && isRelatedDir) {
62576
62660
  dedupePush(testFiles, testFile);
62577
62661
  break;
@@ -62584,8 +62668,8 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
62584
62668
  while (match !== null) {
62585
62669
  const importPath = match[1];
62586
62670
  if (importPath.startsWith(".")) {
62587
- let resolvedImport = path60.resolve(testDir, importPath);
62588
- const existingExt = path60.extname(resolvedImport);
62671
+ let resolvedImport = path61.resolve(testDir, importPath);
62672
+ const existingExt = path61.extname(resolvedImport);
62589
62673
  if (!existingExt) {
62590
62674
  for (const extToTry of [
62591
62675
  ".ts",
@@ -62602,12 +62686,12 @@ async function getTestFilesFromGraph(sourceFiles, workingDir) {
62602
62686
  }
62603
62687
  }
62604
62688
  }
62605
- const importDir = path60.dirname(resolvedImport);
62606
- const importBasename = path60.basename(resolvedImport, path60.extname(resolvedImport));
62689
+ const importDir = path61.dirname(resolvedImport);
62690
+ const importBasename = path61.basename(resolvedImport, path61.extname(resolvedImport));
62607
62691
  for (const sourceFile of absoluteSourceFiles) {
62608
- const sourceDir = path60.dirname(sourceFile);
62609
- const sourceBasename = path60.basename(sourceFile, path60.extname(sourceFile));
62610
- const isRelatedDir = importDir === sourceDir || importDir === path60.join(sourceDir, "__tests__") || importDir === path60.join(sourceDir, "tests") || importDir === path60.join(sourceDir, "test") || importDir === path60.join(sourceDir, "spec");
62692
+ const sourceDir = path61.dirname(sourceFile);
62693
+ const sourceBasename = path61.basename(sourceFile, path61.extname(sourceFile));
62694
+ const isRelatedDir = importDir === sourceDir || importDir === path61.join(sourceDir, "__tests__") || importDir === path61.join(sourceDir, "tests") || importDir === path61.join(sourceDir, "test") || importDir === path61.join(sourceDir, "spec");
62611
62695
  if (resolvedImport === sourceFile || importBasename === sourceBasename && isRelatedDir) {
62612
62696
  dedupePush(testFiles, testFile);
62613
62697
  break;
@@ -62727,8 +62811,8 @@ function buildTestCommand2(framework, scope, files, coverage, baseDir, bail) {
62727
62811
  return ["mvn", "test"];
62728
62812
  case "gradle": {
62729
62813
  const isWindows = process.platform === "win32";
62730
- const hasGradlewBat = fs30.existsSync(path60.join(baseDir, "gradlew.bat"));
62731
- const hasGradlew = fs30.existsSync(path60.join(baseDir, "gradlew"));
62814
+ const hasGradlewBat = fs30.existsSync(path61.join(baseDir, "gradlew.bat"));
62815
+ const hasGradlew = fs30.existsSync(path61.join(baseDir, "gradlew"));
62732
62816
  if (hasGradlewBat && isWindows)
62733
62817
  return ["gradlew.bat", "test"];
62734
62818
  if (hasGradlew)
@@ -62745,7 +62829,7 @@ function buildTestCommand2(framework, scope, files, coverage, baseDir, bail) {
62745
62829
  "cmake-build-release",
62746
62830
  "out"
62747
62831
  ];
62748
- const actualBuildDir = buildDirCandidates.find((d) => fs30.existsSync(path60.join(baseDir, d, "CMakeCache.txt"))) ?? "build";
62832
+ const actualBuildDir = buildDirCandidates.find((d) => fs30.existsSync(path61.join(baseDir, d, "CMakeCache.txt"))) ?? "build";
62749
62833
  return ["ctest", "--test-dir", actualBuildDir];
62750
62834
  }
62751
62835
  case "swift-test":
@@ -63179,11 +63263,11 @@ async function runTests(framework, scope, files, coverage, timeout_ms, cwd, bail
63179
63263
  };
63180
63264
  }
63181
63265
  const startTime = Date.now();
63182
- const vitestJsonOutputPath = framework === "vitest" ? path60.join(cwd, ".swarm", "cache", "test-runner-vitest.json") : undefined;
63266
+ const vitestJsonOutputPath = framework === "vitest" ? path61.join(cwd, ".swarm", "cache", "test-runner-vitest.json") : undefined;
63183
63267
  try {
63184
63268
  if (vitestJsonOutputPath) {
63185
63269
  try {
63186
- fs30.mkdirSync(path60.dirname(vitestJsonOutputPath), { recursive: true });
63270
+ fs30.mkdirSync(path61.dirname(vitestJsonOutputPath), { recursive: true });
63187
63271
  if (fs30.existsSync(vitestJsonOutputPath)) {
63188
63272
  fs30.unlinkSync(vitestJsonOutputPath);
63189
63273
  }
@@ -63299,10 +63383,10 @@ async function runTests(framework, scope, files, coverage, timeout_ms, cwd, bail
63299
63383
  }
63300
63384
  function normalizeHistoryTestFile(testFile, workingDir) {
63301
63385
  const normalized = testFile.replace(/\\/g, "/");
63302
- if (!path60.isAbsolute(testFile))
63386
+ if (!path61.isAbsolute(testFile))
63303
63387
  return normalized;
63304
- const relative12 = path60.relative(workingDir, testFile);
63305
- if (relative12.startsWith("..") || path60.isAbsolute(relative12)) {
63388
+ const relative12 = path61.relative(workingDir, testFile);
63389
+ if (relative12.startsWith("..") || path61.isAbsolute(relative12)) {
63306
63390
  return normalized;
63307
63391
  }
63308
63392
  return relative12.replace(/\\/g, "/");
@@ -63641,7 +63725,7 @@ var init_test_runner = __esm(() => {
63641
63725
  const sourceFiles = args.files.filter((file3) => {
63642
63726
  if (directTestFiles.includes(file3))
63643
63727
  return false;
63644
- const ext = path60.extname(file3).toLowerCase();
63728
+ const ext = path61.extname(file3).toLowerCase();
63645
63729
  return SOURCE_EXTENSIONS.has(ext);
63646
63730
  });
63647
63731
  const invalidFiles = args.files.filter((file3) => !directTestFiles.includes(file3) && !sourceFiles.includes(file3));
@@ -63687,7 +63771,7 @@ var init_test_runner = __esm(() => {
63687
63771
  if (isConventionTestFilePath(f)) {
63688
63772
  return false;
63689
63773
  }
63690
- const ext = path60.extname(f).toLowerCase();
63774
+ const ext = path61.extname(f).toLowerCase();
63691
63775
  return SOURCE_EXTENSIONS.has(ext);
63692
63776
  });
63693
63777
  if (sourceFiles.length === 0) {
@@ -63737,7 +63821,7 @@ var init_test_runner = __esm(() => {
63737
63821
  if (isConventionTestFilePath(f)) {
63738
63822
  return false;
63739
63823
  }
63740
- const ext = path60.extname(f).toLowerCase();
63824
+ const ext = path61.extname(f).toLowerCase();
63741
63825
  return SOURCE_EXTENSIONS.has(ext);
63742
63826
  });
63743
63827
  if (sourceFiles.length === 0) {
@@ -63789,8 +63873,8 @@ var init_test_runner = __esm(() => {
63789
63873
  }
63790
63874
  if (impactResult.impactedTests.length > 0) {
63791
63875
  testFiles = impactResult.impactedTests.map((absPath) => {
63792
- const relativePath = path60.relative(workingDir, absPath);
63793
- return path60.isAbsolute(relativePath) ? absPath : relativePath;
63876
+ const relativePath = path61.relative(workingDir, absPath);
63877
+ return path61.isAbsolute(relativePath) ? absPath : relativePath;
63794
63878
  });
63795
63879
  } else {
63796
63880
  graphFallbackReason = "no impacted tests found via impact analysis, falling back to graph";
@@ -63869,7 +63953,7 @@ var init_test_runner = __esm(() => {
63869
63953
 
63870
63954
  // src/services/preflight-service.ts
63871
63955
  import * as fs31 from "fs";
63872
- import * as path61 from "path";
63956
+ import * as path62 from "path";
63873
63957
  function validateDirectoryPath(dir) {
63874
63958
  if (!dir || typeof dir !== "string") {
63875
63959
  throw new Error("Directory path is required");
@@ -63877,8 +63961,8 @@ function validateDirectoryPath(dir) {
63877
63961
  if (dir.includes("..")) {
63878
63962
  throw new Error("Directory path must not contain path traversal sequences");
63879
63963
  }
63880
- const normalized = path61.normalize(dir);
63881
- const absolutePath = path61.isAbsolute(normalized) ? normalized : path61.resolve(normalized);
63964
+ const normalized = path62.normalize(dir);
63965
+ const absolutePath = path62.isAbsolute(normalized) ? normalized : path62.resolve(normalized);
63882
63966
  return absolutePath;
63883
63967
  }
63884
63968
  function validateTimeout(timeoutMs, defaultValue) {
@@ -63901,7 +63985,7 @@ function validateTimeout(timeoutMs, defaultValue) {
63901
63985
  }
63902
63986
  function getPackageVersion(dir) {
63903
63987
  try {
63904
- const packagePath = path61.join(dir, "package.json");
63988
+ const packagePath = path62.join(dir, "package.json");
63905
63989
  if (fs31.existsSync(packagePath)) {
63906
63990
  const content = fs31.readFileSync(packagePath, "utf-8");
63907
63991
  const pkg = JSON.parse(content);
@@ -63912,7 +63996,7 @@ function getPackageVersion(dir) {
63912
63996
  }
63913
63997
  function getChangelogVersion(dir) {
63914
63998
  try {
63915
- const changelogPath = path61.join(dir, "CHANGELOG.md");
63999
+ const changelogPath = path62.join(dir, "CHANGELOG.md");
63916
64000
  if (fs31.existsSync(changelogPath)) {
63917
64001
  const content = fs31.readFileSync(changelogPath, "utf-8");
63918
64002
  const match = content.match(/^##\s*\[?(\d+\.\d+\.\d+)\]?/m);
@@ -63926,7 +64010,7 @@ function getChangelogVersion(dir) {
63926
64010
  function getVersionFileVersion(dir) {
63927
64011
  const possibleFiles = ["VERSION.txt", "version.txt", "VERSION", "version"];
63928
64012
  for (const file3 of possibleFiles) {
63929
- const filePath = path61.join(dir, file3);
64013
+ const filePath = path62.join(dir, file3);
63930
64014
  if (fs31.existsSync(filePath)) {
63931
64015
  try {
63932
64016
  const content = fs31.readFileSync(filePath, "utf-8").trim();
@@ -63942,9 +64026,9 @@ function getVersionFileVersion(dir) {
63942
64026
  async function runVersionCheck(dir, _timeoutMs) {
63943
64027
  const startTime = Date.now();
63944
64028
  try {
63945
- const packageVersion = _internals43.getPackageVersion(dir);
63946
- const changelogVersion = _internals43.getChangelogVersion(dir);
63947
- const versionFileVersion = _internals43.getVersionFileVersion(dir);
64029
+ const packageVersion = _internals44.getPackageVersion(dir);
64030
+ const changelogVersion = _internals44.getChangelogVersion(dir);
64031
+ const versionFileVersion = _internals44.getVersionFileVersion(dir);
63948
64032
  const versions3 = [];
63949
64033
  if (packageVersion)
63950
64034
  versions3.push(`package.json: ${packageVersion}`);
@@ -64308,7 +64392,7 @@ async function runPreflight(dir, phase, config3) {
64308
64392
  const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
64309
64393
  let validatedDir;
64310
64394
  try {
64311
- validatedDir = _internals43.validateDirectoryPath(dir);
64395
+ validatedDir = _internals44.validateDirectoryPath(dir);
64312
64396
  } catch (error93) {
64313
64397
  return {
64314
64398
  id: reportId,
@@ -64328,7 +64412,7 @@ async function runPreflight(dir, phase, config3) {
64328
64412
  }
64329
64413
  let validatedTimeout;
64330
64414
  try {
64331
- validatedTimeout = _internals43.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
64415
+ validatedTimeout = _internals44.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
64332
64416
  } catch (error93) {
64333
64417
  return {
64334
64418
  id: reportId,
@@ -64369,12 +64453,12 @@ async function runPreflight(dir, phase, config3) {
64369
64453
  });
64370
64454
  const checks5 = [];
64371
64455
  log("[Preflight] Running lint check...");
64372
- const lintResult = await _internals43.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
64456
+ const lintResult = await _internals44.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
64373
64457
  checks5.push(lintResult);
64374
64458
  log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
64375
64459
  if (!cfg.skipTests) {
64376
64460
  log("[Preflight] Running tests check...");
64377
- const testsResult = await _internals43.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
64461
+ const testsResult = await _internals44.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
64378
64462
  checks5.push(testsResult);
64379
64463
  log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
64380
64464
  } else {
@@ -64386,7 +64470,7 @@ async function runPreflight(dir, phase, config3) {
64386
64470
  }
64387
64471
  if (!cfg.skipSecrets) {
64388
64472
  log("[Preflight] Running secrets check...");
64389
- const secretsResult = await _internals43.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
64473
+ const secretsResult = await _internals44.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
64390
64474
  checks5.push(secretsResult);
64391
64475
  log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
64392
64476
  } else {
@@ -64398,7 +64482,7 @@ async function runPreflight(dir, phase, config3) {
64398
64482
  }
64399
64483
  if (!cfg.skipEvidence) {
64400
64484
  log("[Preflight] Running evidence check...");
64401
- const evidenceResult = await _internals43.runEvidenceCheck(validatedDir);
64485
+ const evidenceResult = await _internals44.runEvidenceCheck(validatedDir);
64402
64486
  checks5.push(evidenceResult);
64403
64487
  log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
64404
64488
  } else {
@@ -64409,12 +64493,12 @@ async function runPreflight(dir, phase, config3) {
64409
64493
  });
64410
64494
  }
64411
64495
  log("[Preflight] Running requirement coverage check...");
64412
- const reqCoverageResult = await _internals43.runRequirementCoverageCheck(validatedDir, phase);
64496
+ const reqCoverageResult = await _internals44.runRequirementCoverageCheck(validatedDir, phase);
64413
64497
  checks5.push(reqCoverageResult);
64414
64498
  log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
64415
64499
  if (!cfg.skipVersion) {
64416
64500
  log("[Preflight] Running version check...");
64417
- const versionResult = await _internals43.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
64501
+ const versionResult = await _internals44.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
64418
64502
  checks5.push(versionResult);
64419
64503
  log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
64420
64504
  } else {
@@ -64477,10 +64561,10 @@ function formatPreflightMarkdown(report) {
64477
64561
  async function handlePreflightCommand(directory, _args) {
64478
64562
  const plan = await loadPlan(directory);
64479
64563
  const phase = plan?.current_phase ?? 1;
64480
- const report = await _internals43.runPreflight(directory, phase);
64481
- return _internals43.formatPreflightMarkdown(report);
64564
+ const report = await _internals44.runPreflight(directory, phase);
64565
+ return _internals44.formatPreflightMarkdown(report);
64482
64566
  }
64483
- var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals43;
64567
+ var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals44;
64484
64568
  var init_preflight_service = __esm(() => {
64485
64569
  init_gate_bridge();
64486
64570
  init_manager2();
@@ -64499,7 +64583,7 @@ var init_preflight_service = __esm(() => {
64499
64583
  testScope: "convention",
64500
64584
  linter: "biome"
64501
64585
  };
64502
- _internals43 = {
64586
+ _internals44 = {
64503
64587
  runPreflight,
64504
64588
  formatPreflightMarkdown,
64505
64589
  handlePreflightCommand,
@@ -65386,7 +65470,7 @@ var init_manager3 = __esm(() => {
65386
65470
 
65387
65471
  // src/commands/reset.ts
65388
65472
  import * as fs32 from "fs";
65389
- import * as path62 from "path";
65473
+ import * as path63 from "path";
65390
65474
  async function handleResetCommand(directory, args) {
65391
65475
  const hasConfirm = args.includes("--confirm");
65392
65476
  if (!hasConfirm) {
@@ -65426,7 +65510,7 @@ async function handleResetCommand(directory, args) {
65426
65510
  }
65427
65511
  for (const filename of ["SWARM_PLAN.md", "SWARM_PLAN.json"]) {
65428
65512
  try {
65429
- const rootPath = path62.join(directory, filename);
65513
+ const rootPath = path63.join(directory, filename);
65430
65514
  if (fs32.existsSync(rootPath)) {
65431
65515
  fs32.unlinkSync(rootPath);
65432
65516
  results.push(`- \u2705 Deleted ${filename} (root)`);
@@ -65466,7 +65550,7 @@ var init_reset = __esm(() => {
65466
65550
 
65467
65551
  // src/commands/reset-session.ts
65468
65552
  import * as fs33 from "fs";
65469
- import * as path63 from "path";
65553
+ import * as path64 from "path";
65470
65554
  async function handleResetSessionCommand(directory, _args) {
65471
65555
  const results = [];
65472
65556
  try {
@@ -65481,13 +65565,13 @@ async function handleResetSessionCommand(directory, _args) {
65481
65565
  results.push("\u274C Failed to delete state.json");
65482
65566
  }
65483
65567
  try {
65484
- const sessionDir = path63.dirname(validateSwarmPath(directory, "session/state.json"));
65568
+ const sessionDir = path64.dirname(validateSwarmPath(directory, "session/state.json"));
65485
65569
  if (fs33.existsSync(sessionDir)) {
65486
65570
  const files = fs33.readdirSync(sessionDir);
65487
65571
  const otherFiles = files.filter((f) => f !== "state.json");
65488
65572
  let deletedCount = 0;
65489
65573
  for (const file3 of otherFiles) {
65490
- const filePath = path63.join(sessionDir, file3);
65574
+ const filePath = path64.join(sessionDir, file3);
65491
65575
  if (fs33.lstatSync(filePath).isFile()) {
65492
65576
  fs33.unlinkSync(filePath);
65493
65577
  deletedCount++;
@@ -65519,7 +65603,7 @@ var init_reset_session = __esm(() => {
65519
65603
  });
65520
65604
 
65521
65605
  // src/summaries/manager.ts
65522
- import * as path64 from "path";
65606
+ import * as path65 from "path";
65523
65607
  function sanitizeSummaryId(id) {
65524
65608
  if (!id || id.length === 0) {
65525
65609
  throw new Error("Invalid summary ID: empty string");
@@ -65542,7 +65626,7 @@ function sanitizeSummaryId(id) {
65542
65626
  }
65543
65627
  async function loadFullOutput(directory, id) {
65544
65628
  const sanitizedId = sanitizeSummaryId(id);
65545
- const relativePath = path64.join("summaries", `${sanitizedId}.json`);
65629
+ const relativePath = path65.join("summaries", `${sanitizedId}.json`);
65546
65630
  validateSwarmPath(directory, relativePath);
65547
65631
  const content = await readSwarmFileAsync(directory, relativePath);
65548
65632
  if (content === null) {
@@ -65605,7 +65689,7 @@ var init_retrieve = __esm(() => {
65605
65689
 
65606
65690
  // src/commands/rollback.ts
65607
65691
  import * as fs34 from "fs";
65608
- import * as path65 from "path";
65692
+ import * as path66 from "path";
65609
65693
  async function handleRollbackCommand(directory, args) {
65610
65694
  const phaseArg = args[0];
65611
65695
  if (!phaseArg) {
@@ -65670,8 +65754,8 @@ async function handleRollbackCommand(directory, args) {
65670
65754
  if (EXCLUDE_FILES.has(file3) || file3.startsWith("plan-ledger.archived-")) {
65671
65755
  continue;
65672
65756
  }
65673
- const src = path65.join(checkpointDir, file3);
65674
- const dest = path65.join(swarmDir, file3);
65757
+ const src = path66.join(checkpointDir, file3);
65758
+ const dest = path66.join(swarmDir, file3);
65675
65759
  try {
65676
65760
  fs34.cpSync(src, dest, { recursive: true, force: true });
65677
65761
  successes.push(file3);
@@ -65690,12 +65774,12 @@ async function handleRollbackCommand(directory, args) {
65690
65774
  ].join(`
65691
65775
  `);
65692
65776
  }
65693
- const existingLedgerPath = path65.join(swarmDir, "plan-ledger.jsonl");
65777
+ const existingLedgerPath = path66.join(swarmDir, "plan-ledger.jsonl");
65694
65778
  if (fs34.existsSync(existingLedgerPath)) {
65695
65779
  fs34.unlinkSync(existingLedgerPath);
65696
65780
  }
65697
65781
  try {
65698
- const planJsonPath = path65.join(swarmDir, "plan.json");
65782
+ const planJsonPath = path66.join(swarmDir, "plan.json");
65699
65783
  if (fs34.existsSync(planJsonPath)) {
65700
65784
  const planRaw = fs34.readFileSync(planJsonPath, "utf-8");
65701
65785
  const plan = PlanSchema.parse(JSON.parse(planRaw));
@@ -65924,7 +66008,7 @@ async function handleSimulateCommand(directory, args) {
65924
66008
  }
65925
66009
  let darkMatterPairs;
65926
66010
  try {
65927
- darkMatterPairs = await _internals23.detectDarkMatter(directory, options);
66011
+ darkMatterPairs = await _internals24.detectDarkMatter(directory, options);
65928
66012
  } catch (err) {
65929
66013
  const errMsg = err instanceof Error ? err.message : String(err);
65930
66014
  return `## Simulate Report
@@ -65954,9 +66038,9 @@ Ensure this is a git repository with commit history.`;
65954
66038
  `);
65955
66039
  try {
65956
66040
  const fs35 = await import("fs/promises");
65957
- const path66 = await import("path");
65958
- const reportPath = path66.join(directory, ".swarm", "simulate-report.md");
65959
- await fs35.mkdir(path66.dirname(reportPath), { recursive: true });
66041
+ const path67 = await import("path");
66042
+ const reportPath = path67.join(directory, ".swarm", "simulate-report.md");
66043
+ await fs35.mkdir(path67.dirname(reportPath), { recursive: true });
65960
66044
  await fs35.writeFile(reportPath, report, "utf-8");
65961
66045
  } catch (err) {
65962
66046
  const writeErr = err instanceof Error ? err.message : String(err);
@@ -65980,12 +66064,12 @@ async function handleSpecifyCommand(_directory, args) {
65980
66064
 
65981
66065
  // src/turbo/lean/state.ts
65982
66066
  import * as fs35 from "fs";
65983
- import * as path66 from "path";
66067
+ import * as path67 from "path";
65984
66068
  function nowISO2() {
65985
66069
  return new Date().toISOString();
65986
66070
  }
65987
66071
  function ensureSwarmDir3(directory) {
65988
- const swarmDir = path66.resolve(directory, ".swarm");
66072
+ const swarmDir = path67.resolve(directory, ".swarm");
65989
66073
  if (!fs35.existsSync(swarmDir)) {
65990
66074
  fs35.mkdirSync(swarmDir, { recursive: true });
65991
66075
  }
@@ -66029,7 +66113,7 @@ function markStateUnreadable2(directory, reason) {
66029
66113
  }
66030
66114
  function readPersisted2(directory) {
66031
66115
  try {
66032
- const filePath = path66.join(directory, ".swarm", STATE_FILE2);
66116
+ const filePath = path67.join(directory, ".swarm", STATE_FILE2);
66033
66117
  if (!fs35.existsSync(filePath)) {
66034
66118
  const seed = emptyPersisted2();
66035
66119
  try {
@@ -66065,7 +66149,7 @@ function writePersisted2(directory, persisted) {
66065
66149
  let payload;
66066
66150
  try {
66067
66151
  ensureSwarmDir3(directory);
66068
- filePath = path66.join(directory, ".swarm", STATE_FILE2);
66152
+ filePath = path67.join(directory, ".swarm", STATE_FILE2);
66069
66153
  tmpPath = `${filePath}.tmp.${Date.now()}`;
66070
66154
  persisted.updatedAt = nowISO2();
66071
66155
  payload = `${JSON.stringify(persisted, null, 2)}
@@ -66193,10 +66277,10 @@ var init_context_budget_service = __esm(() => {
66193
66277
  // src/services/status-service.ts
66194
66278
  import * as fsSync3 from "fs";
66195
66279
  import { readFile as readFile19 } from "fs/promises";
66196
- import * as path67 from "path";
66280
+ import * as path68 from "path";
66197
66281
  function readSpecStalenessSnapshot(directory) {
66198
66282
  try {
66199
- const p = path67.join(directory, ".swarm", "spec-staleness.json");
66283
+ const p = path68.join(directory, ".swarm", "spec-staleness.json");
66200
66284
  if (!fsSync3.existsSync(p))
66201
66285
  return { stale: false };
66202
66286
  const raw = fsSync3.readFileSync(p, "utf-8");
@@ -66294,7 +66378,7 @@ async function getStatusData(directory, agents) {
66294
66378
  }
66295
66379
  function enrichWithLeanTurbo(status, directory) {
66296
66380
  const turboMode = hasActiveTurboMode();
66297
- const leanActive = _internals44.hasActiveLeanTurbo();
66381
+ const leanActive = _internals45.hasActiveLeanTurbo();
66298
66382
  let turboStrategy = "off";
66299
66383
  if (leanActive) {
66300
66384
  turboStrategy = "lean";
@@ -66313,7 +66397,7 @@ function enrichWithLeanTurbo(status, directory) {
66313
66397
  }
66314
66398
  }
66315
66399
  if (leanSessionID) {
66316
- const runState = _internals44.loadLeanTurboRunState(directory, leanSessionID);
66400
+ const runState = _internals45.loadLeanTurboRunState(directory, leanSessionID);
66317
66401
  if (runState) {
66318
66402
  status.leanTurboPhase = runState.phase;
66319
66403
  status.leanMaxParallelCoders = runState.maxParallelCoders;
@@ -66345,7 +66429,7 @@ function enrichWithLeanTurbo(status, directory) {
66345
66429
  }
66346
66430
  }
66347
66431
  }
66348
- status.fullAutoActive = _internals44.hasActiveFullAuto();
66432
+ status.fullAutoActive = _internals45.hasActiveFullAuto();
66349
66433
  return status;
66350
66434
  }
66351
66435
  function formatStatusMarkdown(status) {
@@ -66473,7 +66557,7 @@ async function countProposals(directory) {
66473
66557
  return 0;
66474
66558
  }
66475
66559
  }
66476
- var _internals44;
66560
+ var _internals45;
66477
66561
  var init_status_service = __esm(() => {
66478
66562
  init_extractors();
66479
66563
  init_knowledge_escalator();
@@ -66483,7 +66567,7 @@ var init_status_service = __esm(() => {
66483
66567
  init_state3();
66484
66568
  init_compaction_service();
66485
66569
  init_context_budget_service();
66486
- _internals44 = {
66570
+ _internals45 = {
66487
66571
  loadLeanTurboRunState,
66488
66572
  hasActiveLeanTurbo,
66489
66573
  hasActiveFullAuto
@@ -66574,7 +66658,7 @@ async function handleTurboCommand(directory, args, sessionID) {
66574
66658
  if (arg0 === "on") {
66575
66659
  let strategy = "standard";
66576
66660
  try {
66577
- const { config: config3 } = _internals45.loadPluginConfigWithMeta(directory);
66661
+ const { config: config3 } = _internals46.loadPluginConfigWithMeta(directory);
66578
66662
  if (config3.turbo?.strategy === "lean") {
66579
66663
  strategy = "lean";
66580
66664
  }
@@ -66629,7 +66713,7 @@ function enableLeanTurbo(session, directory, sessionID) {
66629
66713
  let maxParallelCoders = 4;
66630
66714
  let conflictPolicy = "serialize";
66631
66715
  try {
66632
- const { config: config3 } = _internals45.loadPluginConfigWithMeta(directory);
66716
+ const { config: config3 } = _internals46.loadPluginConfigWithMeta(directory);
66633
66717
  const leanConfig = config3.turbo?.lean;
66634
66718
  if (leanConfig) {
66635
66719
  maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
@@ -66699,13 +66783,13 @@ function buildStatusMessage2(session, directory, sessionID) {
66699
66783
  ].join(`
66700
66784
  `);
66701
66785
  }
66702
- var _internals45;
66786
+ var _internals46;
66703
66787
  var init_turbo = __esm(() => {
66704
66788
  init_config();
66705
66789
  init_state();
66706
66790
  init_state3();
66707
66791
  init_logger();
66708
- _internals45 = {
66792
+ _internals46 = {
66709
66793
  loadPluginConfigWithMeta
66710
66794
  };
66711
66795
  });
@@ -67262,24 +67346,24 @@ function validateAliases() {
67262
67346
  }
67263
67347
  aliasTargets.get(target).push(name);
67264
67348
  const visited = new Set;
67265
- const path68 = [];
67349
+ const path69 = [];
67266
67350
  let current = target;
67267
67351
  while (current) {
67268
67352
  const currentEntry = COMMAND_REGISTRY[current];
67269
67353
  if (!currentEntry)
67270
67354
  break;
67271
67355
  if (visited.has(current)) {
67272
- const cycleStart = path68.indexOf(current);
67356
+ const cycleStart = path69.indexOf(current);
67273
67357
  const fullChain = [
67274
67358
  name,
67275
- ...path68.slice(0, cycleStart > 0 ? cycleStart : path68.length),
67359
+ ...path69.slice(0, cycleStart > 0 ? cycleStart : path69.length),
67276
67360
  current
67277
67361
  ].join(" \u2192 ");
67278
67362
  errors5.push(`Circular alias detected: ${fullChain}`);
67279
67363
  break;
67280
67364
  }
67281
67365
  visited.add(current);
67282
- path68.push(current);
67366
+ path69.push(current);
67283
67367
  current = currentEntry.aliasOf || "";
67284
67368
  }
67285
67369
  }
@@ -68147,57 +68231,57 @@ init_cache_paths();
68147
68231
  init_constants();
68148
68232
  import * as fs36 from "fs";
68149
68233
  import * as os10 from "os";
68150
- import * as path68 from "path";
68234
+ import * as path69 from "path";
68151
68235
  var { version: version5 } = package_default;
68152
68236
  var CONFIG_DIR = getPluginConfigDir();
68153
- var OPENCODE_CONFIG_PATH = path68.join(CONFIG_DIR, "opencode.json");
68154
- var PLUGIN_CONFIG_PATH = path68.join(CONFIG_DIR, "opencode-swarm.json");
68155
- var PROMPTS_DIR = path68.join(CONFIG_DIR, "opencode-swarm");
68237
+ var OPENCODE_CONFIG_PATH = path69.join(CONFIG_DIR, "opencode.json");
68238
+ var PLUGIN_CONFIG_PATH = path69.join(CONFIG_DIR, "opencode-swarm.json");
68239
+ var PROMPTS_DIR = path69.join(CONFIG_DIR, "opencode-swarm");
68156
68240
  var OPENCODE_PLUGIN_CACHE_PATHS = getPluginCachePaths();
68157
68241
  var OPENCODE_PLUGIN_LOCK_FILE_PATHS = getPluginLockFilePaths();
68158
68242
  function isSafeCachePath(p) {
68159
- const resolved = path68.resolve(p);
68160
- const home = path68.resolve(os10.homedir());
68243
+ const resolved = path69.resolve(p);
68244
+ const home = path69.resolve(os10.homedir());
68161
68245
  if (resolved === "/" || resolved === home || resolved.length <= home.length) {
68162
68246
  return false;
68163
68247
  }
68164
- const segments = resolved.split(path68.sep).filter((s) => s.length > 0);
68248
+ const segments = resolved.split(path69.sep).filter((s) => s.length > 0);
68165
68249
  if (segments.length < 4) {
68166
68250
  return false;
68167
68251
  }
68168
- const leaf = path68.basename(resolved);
68252
+ const leaf = path69.basename(resolved);
68169
68253
  if (leaf !== "opencode-swarm@latest" && leaf !== "opencode-swarm") {
68170
68254
  return false;
68171
68255
  }
68172
- const parent = path68.basename(path68.dirname(resolved));
68256
+ const parent = path69.basename(path69.dirname(resolved));
68173
68257
  if (parent !== "packages" && parent !== "node_modules") {
68174
68258
  return false;
68175
68259
  }
68176
- const grandparent = path68.basename(path68.dirname(path68.dirname(resolved)));
68260
+ const grandparent = path69.basename(path69.dirname(path69.dirname(resolved)));
68177
68261
  if (grandparent !== "opencode") {
68178
68262
  return false;
68179
68263
  }
68180
68264
  return true;
68181
68265
  }
68182
68266
  function isSafeLockFilePath(p) {
68183
- const resolved = path68.resolve(p);
68184
- const home = path68.resolve(os10.homedir());
68267
+ const resolved = path69.resolve(p);
68268
+ const home = path69.resolve(os10.homedir());
68185
68269
  if (resolved === "/" || resolved === home || resolved.length <= home.length) {
68186
68270
  return false;
68187
68271
  }
68188
- const segments = resolved.split(path68.sep).filter((s) => s.length > 0);
68272
+ const segments = resolved.split(path69.sep).filter((s) => s.length > 0);
68189
68273
  if (segments.length < 4) {
68190
68274
  return false;
68191
68275
  }
68192
- const leaf = path68.basename(resolved);
68276
+ const leaf = path69.basename(resolved);
68193
68277
  if (leaf !== "bun.lock" && leaf !== "bun.lockb" && leaf !== "package-lock.json") {
68194
68278
  return false;
68195
68279
  }
68196
- const parent = path68.basename(path68.dirname(resolved));
68280
+ const parent = path69.basename(path69.dirname(resolved));
68197
68281
  if (parent !== "opencode") {
68198
68282
  return false;
68199
68283
  }
68200
- const grandparent = path68.basename(path68.dirname(path68.dirname(resolved)));
68284
+ const grandparent = path69.basename(path69.dirname(path69.dirname(resolved)));
68201
68285
  if (grandparent === "opencode") {
68202
68286
  return false;
68203
68287
  }
@@ -68223,8 +68307,8 @@ function saveJson(filepath, data) {
68223
68307
  }
68224
68308
  function writeProjectConfigIfMissing(cwd) {
68225
68309
  try {
68226
- const opencodeDir = path68.join(cwd, ".opencode");
68227
- const projectConfigPath = path68.join(opencodeDir, "opencode-swarm.json");
68310
+ const opencodeDir = path69.join(cwd, ".opencode");
68311
+ const projectConfigPath = path69.join(opencodeDir, "opencode-swarm.json");
68228
68312
  if (fs36.existsSync(projectConfigPath)) {
68229
68313
  return;
68230
68314
  }
@@ -68241,7 +68325,7 @@ async function install() {
68241
68325
  `);
68242
68326
  ensureDir(CONFIG_DIR);
68243
68327
  ensureDir(PROMPTS_DIR);
68244
- const LEGACY_CONFIG_PATH = path68.join(CONFIG_DIR, "config.json");
68328
+ const LEGACY_CONFIG_PATH = path69.join(CONFIG_DIR, "config.json");
68245
68329
  let opencodeConfig = loadJson(OPENCODE_CONFIG_PATH);
68246
68330
  if (!opencodeConfig) {
68247
68331
  const legacyConfig = loadJson(LEGACY_CONFIG_PATH);