opencode-swarm 7.188.7 → 7.188.9

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.
Files changed (81) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/cli/{auto-checkpoint-1z9d2jrk.js → auto-checkpoint-8hn7sczv.js} +4 -4
  4. package/dist/cli/{checkpoint-f8165pv4.js → checkpoint-zagm80g6.js} +8 -8
  5. package/dist/cli/{coder-settlement-gaby6spt.js → coder-settlement-ea9wk0fa.js} +3 -3
  6. package/dist/cli/{config-doctor-4wgw6nak.js → config-doctor-482f83pc.js} +7 -7
  7. package/dist/cli/{core-y89texpp.js → core-jev9px23.js} +1 -1
  8. package/dist/cli/{curator-drift-rpwrx355.js → curator-drift-tzr8cq9d.js} +5 -5
  9. package/dist/cli/{curator-llm-factory-1qbcj7vs.js → curator-llm-factory-vwxengt1.js} +26 -26
  10. package/dist/cli/{curator-tkz65fvw.js → curator-sw5w1yxn.js} +26 -26
  11. package/dist/cli/{dispatch-qvcztbpf.js → dispatch-h8m1jntz.js} +47 -220
  12. package/dist/cli/{doctor-knowledge-receipt-phase-id-11q7en6t.js → doctor-knowledge-receipt-phase-id-78hqh9ds.js} +4 -4
  13. package/dist/cli/{evidence-summary-service-hn7vdm45.js → evidence-summary-service-dpx7844s.js} +9 -9
  14. package/dist/cli/{gate-evidence-sxh3r64f.js → gate-evidence-v5fbpnfe.js} +2 -2
  15. package/dist/cli/{guardrail-explain-e0wbeyk1.js → guardrail-explain-020gkz5c.js} +27 -27
  16. package/dist/cli/{guardrail-log-gzrj46h0.js → guardrail-log-z14b98cn.js} +3 -3
  17. package/dist/cli/{guardrail-reset-7z62s1j5.js → guardrail-reset-cg6kfk8r.js} +26 -26
  18. package/dist/cli/{hive-promoter-88d95wk8.js → hive-promoter-bse7dh34.js} +26 -26
  19. package/dist/cli/{index-7eajwwfg.js → index-0dp2ak7d.js} +1 -1
  20. package/dist/cli/{index-snwj9ptc.js → index-0e49htcs.js} +1 -1
  21. package/dist/cli/{index-61kszszd.js → index-0whh6em0.js} +2 -2
  22. package/dist/cli/{index-7k9hdn0b.js → index-2mmbzyqb.js} +1 -1
  23. package/dist/cli/{index-y3sk68m5.js → index-4xc838p0.js} +1 -1
  24. package/dist/cli/{index-5102w44y.js → index-64e9z08z.js} +2 -2
  25. package/dist/cli/{index-0j5ggeem.js → index-6nx6qf7v.js} +1 -1
  26. package/dist/cli/{index-2wctq2hn.js → index-7jtxt3qp.js} +1 -1
  27. package/dist/cli/{index-m9g7s9ee.js → index-804rs273.js} +1 -1
  28. package/dist/cli/{index-c016phsk.js → index-akkskstq.js} +4 -4
  29. package/dist/cli/{index-yj1cwps4.js → index-b2g020d7.js} +1 -1
  30. package/dist/cli/{index-xj3k6x1h.js → index-b913b1yc.js} +1 -1
  31. package/dist/cli/{index-c937rpbm.js → index-byfk6w9a.js} +3 -3
  32. package/dist/cli/{index-ytms8x1h.js → index-bzeegaem.js} +2 -2
  33. package/dist/cli/{index-vx8a8w3b.js → index-c0tjwb5k.js} +496 -201
  34. package/dist/cli/{index-kap459mr.js → index-cxybg712.js} +2 -2
  35. package/dist/cli/{index-03ad14qc.js → index-d1z2yrwq.js} +2 -2
  36. package/dist/cli/{index-ffmw6af9.js → index-ddgmj923.js} +26 -26
  37. package/dist/cli/{index-g39cmzpj.js → index-dhkgby53.js} +2 -2
  38. package/dist/cli/{index-eh0sg1pz.js → index-g0we5tpv.js} +3 -3
  39. package/dist/cli/{index-ghjg1rxe.js → index-gd602ztc.js} +1 -1
  40. package/dist/cli/{index-9tes309n.js → index-hjyakvcq.js} +1 -1
  41. package/dist/cli/{index-rw0c6qtt.js → index-kjb143pz.js} +3 -3
  42. package/dist/cli/{index-a4s5yrdd.js → index-ng5n8tp0.js} +3 -3
  43. package/dist/cli/{index-2vtrjm19.js → index-peyrzden.js} +28 -28
  44. package/dist/cli/{index-7zyktm9f.js → index-ps6fyxfc.js} +5 -5
  45. package/dist/cli/{index-xsdphmet.js → index-q6y176gs.js} +6 -6
  46. package/dist/cli/{index-pnfd3s7s.js → index-qdp9ny78.js} +1 -1
  47. package/dist/cli/{index-emh69vk9.js → index-sndyex1t.js} +304 -166
  48. package/dist/cli/{index-8sqyx5rh.js → index-t6tew3pf.js} +1 -1
  49. package/dist/cli/{index-y8z9x87e.js → index-v71w06rr.js} +1 -1
  50. package/dist/cli/index.js +27 -27
  51. package/dist/cli/{knowledge-escalator-ejfb2e7c.js → knowledge-escalator-wah5yybk.js} +7 -7
  52. package/dist/cli/{knowledge-events-3fzfehwy.js → knowledge-events-akz8013r.js} +5 -5
  53. package/dist/cli/{knowledge-store-swxk4tr6.js → knowledge-store-hy12373e.js} +1 -1
  54. package/dist/cli/{knowledge-validator-0a1at9gm.js → knowledge-validator-yrqkdt1w.js} +2 -2
  55. package/dist/cli/{mcp-0ah7s1j0.js → mcp-0srnsd05.js} +1 -1
  56. package/dist/cli/{model-preflight-nfvapzyj.js → model-preflight-m3v8hn9k.js} +26 -26
  57. package/dist/cli/{pending-delegations-hynywgkj.js → pending-delegations-40txwk2h.js} +2 -2
  58. package/dist/cli/{pr-subscriptions-k86p5qcn.js → pr-subscriptions-w6n5s9c7.js} +1 -1
  59. package/dist/cli/{pr-workflow-gate-3ett6hjh.js → pr-workflow-gate-mx9t1p5j.js} +26 -26
  60. package/dist/cli/{scan-cursor-9961dhv1.js → scan-cursor-phbwfaya.js} +2 -2
  61. package/dist/cli/{schema-s5zbnzmv.js → schema-t1xwd728.js} +1 -1
  62. package/dist/cli/{scope-persistence-2w562h83.js → scope-persistence-m6qrwt3d.js} +5 -5
  63. package/dist/cli/{server-vrk0k61v.js → server-7pt2zhnc.js} +26 -26
  64. package/dist/cli/{skill-generator-bfcjzp20.js → skill-generator-pnv8efrw.js} +8 -8
  65. package/dist/cli/{snapshot-coordination-init-8ykpp5m6.js → snapshot-coordination-init-514wtctt.js} +26 -26
  66. package/dist/cli/{speckit-checkoff-3x52vw64.js → speckit-checkoff-beh1nw7v.js} +3 -3
  67. package/dist/cli/{worktree-collision-ownership-kjw1pqfc.js → worktree-collision-ownership-f5wca0gg.js} +2 -2
  68. package/dist/cli/{worktree-isolation-xdgm4ekx.js → worktree-isolation-bd6c5x8h.js} +26 -26
  69. package/dist/commands/recover.d.ts +1 -1
  70. package/dist/commands/registry.d.ts +1 -1
  71. package/dist/hooks/knowledge-receipt-ledger.d.ts +23 -0
  72. package/dist/hooks/knowledge-receipt-validator.d.ts +10 -0
  73. package/dist/index.js +213 -213
  74. package/dist/lang/backends/java.d.ts +39 -0
  75. package/dist/lang/default-backend.d.ts +15 -0
  76. package/dist/state.d.ts +48 -0
  77. package/dist/tools/test-runner.d.ts +31 -1
  78. package/dist/utils/windows-batch.d.ts +53 -0
  79. package/dist/workflow/session-view.d.ts +47 -0
  80. package/dist/workflow/stage-a-repair.d.ts +1 -0
  81. package/package.json +1 -1
@@ -1231,8 +1231,8 @@ async function detectProjectLanguages(projectDir) {
1231
1231
  }
1232
1232
 
1233
1233
  // src/lang/default-backend.ts
1234
- import * as fs3 from "fs";
1235
- import * as path3 from "path";
1234
+ import * as fs4 from "fs";
1235
+ import * as path4 from "path";
1236
1236
 
1237
1237
  // src/build/command-resolution.ts
1238
1238
  import * as fs from "fs";
@@ -1824,11 +1824,84 @@ var build_discovery = tool({
1824
1824
  }
1825
1825
  });
1826
1826
 
1827
+ // src/utils/windows-batch.ts
1828
+ import * as fs3 from "fs";
1829
+ import * as path3 from "path";
1830
+ var WINDOWS_BATCH_WRAPPER_EXTENSIONS = [".cmd", ".bat"];
1831
+ var WINDOWS_CMD_UNSAFE_TOKEN = /["%!^&|<>\r\n]/;
1832
+ function isRegularFile(candidate, deps) {
1833
+ try {
1834
+ return deps.statSync(candidate).isFile();
1835
+ } catch {
1836
+ return false;
1837
+ }
1838
+ }
1839
+ function resolveWindowsCommandInterpreter(deps) {
1840
+ const candidate = deps.comSpec();
1841
+ if (!candidate || !path3.isAbsolute(candidate) || path3.basename(candidate).toLowerCase() !== "cmd.exe" || !isRegularFile(candidate, deps)) {
1842
+ return null;
1843
+ }
1844
+ try {
1845
+ const canonical = deps.realpathSync(candidate);
1846
+ return path3.basename(canonical).toLowerCase() === "cmd.exe" ? canonical : null;
1847
+ } catch {
1848
+ return null;
1849
+ }
1850
+ }
1851
+ function buildWindowsBatchCommand(wrapperPath, args, deps = _internals2) {
1852
+ const interpreter = resolveWindowsCommandInterpreter(deps);
1853
+ if (!interpreter)
1854
+ return null;
1855
+ let canonicalWrapper;
1856
+ try {
1857
+ canonicalWrapper = deps.realpathSync(wrapperPath);
1858
+ } catch {
1859
+ return null;
1860
+ }
1861
+ if (!isRegularFile(canonicalWrapper, deps) || !WINDOWS_BATCH_WRAPPER_EXTENSIONS.includes(path3.extname(canonicalWrapper).toLowerCase())) {
1862
+ return null;
1863
+ }
1864
+ const tokens = [canonicalWrapper, ...args];
1865
+ if (tokens.some((token) => WINDOWS_CMD_UNSAFE_TOKEN.test(token)))
1866
+ return null;
1867
+ const command = `call ${tokens.map((token) => `"${token}"`).join(" ")}`;
1868
+ return [interpreter, "/d", "/s", "/v:off", "/c", command];
1869
+ }
1870
+ function resolveContainedWindowsBatchCommand(cwd, fileName, args, deps = _internals2) {
1871
+ if (deps.platform() !== "win32")
1872
+ return null;
1873
+ const candidate = path3.join(cwd, fileName);
1874
+ if (!isRegularFile(candidate, deps))
1875
+ return null;
1876
+ let canonicalCwd;
1877
+ let canonicalCandidate;
1878
+ try {
1879
+ canonicalCwd = deps.realpathSync(cwd);
1880
+ canonicalCandidate = deps.realpathSync(candidate);
1881
+ } catch {
1882
+ return null;
1883
+ }
1884
+ const relative2 = path3.relative(canonicalCwd, canonicalCandidate);
1885
+ if (relative2 === "" || relative2.startsWith("..") || path3.isAbsolute(relative2)) {
1886
+ return null;
1887
+ }
1888
+ return buildWindowsBatchCommand(canonicalCandidate, args, deps);
1889
+ }
1890
+ function isWindowsCommandInterpreterLaunch(command, platform = _internals2.platform()) {
1891
+ return platform === "win32" && command.length > 0 && path3.win32.basename(command[0]).toLowerCase() === "cmd.exe";
1892
+ }
1893
+ var _internals2 = {
1894
+ platform: () => process.platform,
1895
+ comSpec: () => process.env.ComSpec,
1896
+ realpathSync: (candidate) => fs3.realpathSync(candidate),
1897
+ statSync: (candidate) => fs3.statSync(candidate)
1898
+ };
1899
+
1827
1900
  // src/lang/default-backend.ts
1828
1901
  function detectFileExists(dir, pattern) {
1829
1902
  if (pattern.includes("*") || pattern.includes("?")) {
1830
1903
  try {
1831
- const files = fs3.readdirSync(dir);
1904
+ const files = fs4.readdirSync(dir);
1832
1905
  const regex = new RegExp(`^${pattern.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".")}$`);
1833
1906
  return files.some((f) => regex.test(f));
1834
1907
  } catch {
@@ -1836,7 +1909,7 @@ function detectFileExists(dir, pattern) {
1836
1909
  }
1837
1910
  }
1838
1911
  try {
1839
- fs3.accessSync(path3.join(dir, pattern));
1912
+ fs4.accessSync(path4.join(dir, pattern));
1840
1913
  return true;
1841
1914
  } catch {
1842
1915
  return false;
@@ -1862,6 +1935,28 @@ async function defaultSelectTestFramework(profile, dir) {
1862
1935
  }
1863
1936
  return null;
1864
1937
  }
1938
+ function buildGradleTestCommand(dir, targets) {
1939
+ const args = ["test"];
1940
+ if (targets && targets.length > 0) {
1941
+ for (const target of targets) {
1942
+ args.push("--tests", target);
1943
+ }
1944
+ }
1945
+ if (process.platform === "win32") {
1946
+ const hasGradlewBat = fs4.existsSync(path4.join(dir, "gradlew.bat"));
1947
+ if (hasGradlewBat) {
1948
+ if (args.some((arg) => arg.endsWith("\\"))) {
1949
+ return ["gradle", ...args];
1950
+ }
1951
+ return resolveContainedWindowsBatchCommand(dir, "gradlew.bat", args) ?? [
1952
+ "gradle",
1953
+ ...args
1954
+ ];
1955
+ }
1956
+ }
1957
+ const hasGradlew = fs4.existsSync(path4.join(dir, "gradlew"));
1958
+ return hasGradlew ? ["./gradlew", ...args] : ["gradle", ...args];
1959
+ }
1865
1960
  function defaultBuildTestCommand(profile, framework, files, dir = ".", opts = {}) {
1866
1961
  const scope = opts.scope ?? "all";
1867
1962
  const coverage = opts.coverage ?? false;
@@ -1969,23 +2064,7 @@ function defaultBuildTestCommand(profile, framework, files, dir = ".", opts = {}
1969
2064
  return args;
1970
2065
  }
1971
2066
  case "gradle": {
1972
- const isWindows = process.platform === "win32";
1973
- const hasGradlewBat = fs3.existsSync(path3.join(dir, "gradlew.bat"));
1974
- const hasGradlew = fs3.existsSync(path3.join(dir, "gradlew"));
1975
- const args = [];
1976
- if (hasGradlewBat && isWindows)
1977
- args.push("gradlew.bat");
1978
- else if (hasGradlew)
1979
- args.push("./gradlew");
1980
- else
1981
- args.push("gradle");
1982
- args.push("test");
1983
- if (targets && targets.length > 0) {
1984
- for (const target of targets) {
1985
- args.push("--tests", target);
1986
- }
1987
- }
1988
- return args;
2067
+ return buildGradleTestCommand(dir, targets);
1989
2068
  }
1990
2069
  case "dotnet-test": {
1991
2070
  const args = ["dotnet", "test"];
@@ -2002,7 +2081,7 @@ function defaultBuildTestCommand(profile, framework, files, dir = ".", opts = {}
2002
2081
  "cmake-build-release",
2003
2082
  "out"
2004
2083
  ];
2005
- const actualBuildDir = buildDirCandidates.find((d) => fs3.existsSync(path3.join(dir, d, "CMakeCache.txt"))) ?? "build";
2084
+ const actualBuildDir = buildDirCandidates.find((d) => fs4.existsSync(path4.join(dir, d, "CMakeCache.txt"))) ?? "build";
2006
2085
  const args = ["ctest", "--test-dir", actualBuildDir];
2007
2086
  if (targets && targets.length > 0) {
2008
2087
  args.push("-R", targets.join("|"));
@@ -2088,7 +2167,7 @@ function buildNativeTargetCommand(target) {
2088
2167
  return ["go", "test", "-v", "-run", selector, packagePath];
2089
2168
  }
2090
2169
  function phpVendorBin(name) {
2091
- return path3.join("vendor", "bin", process.platform === "win32" ? `${name}.bat` : name);
2170
+ return path4.join("vendor", "bin", process.platform === "win32" ? `${name}.bat` : name);
2092
2171
  }
2093
2172
  function defaultParseTestOutput(framework, stdout, stderr, exitCode) {
2094
2173
  const output = stdout && stderr ? `${stdout}
@@ -2364,23 +2443,23 @@ async function defaultSelectBuildCommand(profile, dir) {
2364
2443
  return null;
2365
2444
  }
2366
2445
  async function defaultTestFilesFor(profile, sourceFile, dir) {
2367
- const ext = path3.extname(sourceFile);
2446
+ const ext = path4.extname(sourceFile);
2368
2447
  if (!profile.extensions.includes(ext))
2369
2448
  return [];
2370
- const base = path3.basename(sourceFile, ext);
2371
- const rel = path3.relative(dir, sourceFile);
2372
- const relDir = path3.dirname(rel);
2449
+ const base = path4.basename(sourceFile, ext);
2450
+ const rel = path4.relative(dir, sourceFile);
2451
+ const relDir = path4.dirname(rel);
2373
2452
  const stripSrc = relDir.replace(/^src(\/|\\)/, "");
2374
2453
  const candidates = new Set;
2375
2454
  for (const tDir of ["tests", "test", "__tests__", "spec"]) {
2376
2455
  for (const suffix of ["", "_test", ".test", "_spec", ".spec"]) {
2377
- candidates.add(path3.join(dir, tDir, stripSrc, `${base}${suffix}${ext}`));
2456
+ candidates.add(path4.join(dir, tDir, stripSrc, `${base}${suffix}${ext}`));
2378
2457
  }
2379
2458
  }
2380
2459
  const existing = [];
2381
2460
  for (const c of candidates) {
2382
2461
  try {
2383
- fs3.accessSync(c);
2462
+ fs4.accessSync(c);
2384
2463
  existing.push(c);
2385
2464
  } catch {}
2386
2465
  }
@@ -2410,10 +2489,366 @@ function defaultBackendFor(profile) {
2410
2489
  };
2411
2490
  }
2412
2491
 
2492
+ // src/lang/backends/java.ts
2493
+ import * as fs5 from "fs";
2494
+ import * as path5 from "path";
2495
+
2496
+ // src/lang/java-extraction.ts
2497
+ function parseJavaImports(rawContent) {
2498
+ const imports = [];
2499
+ const content = maskCommentsAndLiterals(rawContent);
2500
+ const re = /^[ \t]*import[ \t]+(static[ \t]+)?([A-Za-z_][\w.]*(?:\.\*)?)[ \t]*;?[ \t]*\r?$/gm;
2501
+ for (let m = re.exec(content);m !== null; m = re.exec(content)) {
2502
+ const isStatic = Boolean(m[1]);
2503
+ const raw = m[2];
2504
+ if (raw.endsWith(".*")) {
2505
+ imports.push({ specifier: raw, importType: "namespace", bindings: [] });
2506
+ continue;
2507
+ }
2508
+ const imported = finalDottedSegment(raw);
2509
+ const specifier = isStatic ? raw.split(".").slice(0, -1).join(".") : raw;
2510
+ imports.push({
2511
+ specifier,
2512
+ importType: "named",
2513
+ bindings: [{ imported, local: imported }]
2514
+ });
2515
+ }
2516
+ return imports;
2517
+ }
2518
+ function maskCommentsAndLiterals(content) {
2519
+ let out = "";
2520
+ let i = 0;
2521
+ const n = content.length;
2522
+ while (i < n) {
2523
+ const ch = content[i];
2524
+ const next = i + 1 < n ? content[i + 1] : "";
2525
+ const next2 = i + 2 < n ? content[i + 2] : "";
2526
+ if (ch === '"' && next === '"' && next2 === '"') {
2527
+ out += " ";
2528
+ i += 3;
2529
+ while (i < n) {
2530
+ if (content[i] === '"' && content[i + 1] === '"' && content[i + 2] === '"') {
2531
+ out += " ";
2532
+ i += 3;
2533
+ break;
2534
+ }
2535
+ out += content[i] === `
2536
+ ` ? `
2537
+ ` : " ";
2538
+ i++;
2539
+ }
2540
+ continue;
2541
+ }
2542
+ if (ch === "/" && next === "/") {
2543
+ while (i < n && content[i] !== `
2544
+ `) {
2545
+ out += " ";
2546
+ i++;
2547
+ }
2548
+ continue;
2549
+ }
2550
+ if (ch === "/" && next === "*") {
2551
+ out += " ";
2552
+ i += 2;
2553
+ while (i < n) {
2554
+ if (content[i] === "*" && content[i + 1] === "/") {
2555
+ out += " ";
2556
+ i += 2;
2557
+ break;
2558
+ }
2559
+ out += content[i] === `
2560
+ ` ? `
2561
+ ` : " ";
2562
+ i++;
2563
+ }
2564
+ continue;
2565
+ }
2566
+ if (ch === '"' || ch === "'") {
2567
+ const quote = ch;
2568
+ out += ch;
2569
+ i++;
2570
+ while (i < n) {
2571
+ const c = content[i];
2572
+ if (c === "\\") {
2573
+ out += " ";
2574
+ i++;
2575
+ if (i < n) {
2576
+ out += content[i] === `
2577
+ ` ? content[i] : " ";
2578
+ i++;
2579
+ }
2580
+ continue;
2581
+ }
2582
+ if (c === `
2583
+ `) {
2584
+ break;
2585
+ }
2586
+ if (c === quote) {
2587
+ out += c;
2588
+ i++;
2589
+ break;
2590
+ }
2591
+ out += " ";
2592
+ i++;
2593
+ }
2594
+ continue;
2595
+ }
2596
+ out += ch;
2597
+ i++;
2598
+ }
2599
+ return out;
2600
+ }
2601
+ function finalDottedSegment(path5) {
2602
+ const lastDot = path5.lastIndexOf(".");
2603
+ return lastDot === -1 ? path5 : path5.slice(lastDot + 1);
2604
+ }
2605
+ var JAVA_SYMBOL_GRAMMAR = {
2606
+ defs: `
2607
+ (method_declaration
2608
+ (identifier) @func.name
2609
+ ) @func.def
2610
+ (constructor_declaration
2611
+ (identifier) @ctor.name
2612
+ ) @ctor.def
2613
+ (class_declaration
2614
+ (identifier) @class.name
2615
+ ) @class.def
2616
+ (interface_declaration
2617
+ (identifier) @interface.name
2618
+ ) @interface.def
2619
+ (enum_declaration
2620
+ (identifier) @enum.name
2621
+ ) @enum.def
2622
+ (record_declaration
2623
+ (identifier) @record.name
2624
+ ) @record.def
2625
+ `,
2626
+ imports: `
2627
+ (import_declaration) @import
2628
+ `,
2629
+ refs: `
2630
+ (identifier) @ref.identifier
2631
+ (type_identifier) @ref.identifier
2632
+ `,
2633
+ exports: ``
2634
+ };
2635
+
2636
+ // src/lang/backends/java.ts
2637
+ var PROFILE_ID = "java";
2638
+ var MAX_ENTRY_POINT_DEPTH = 8;
2639
+ var MAX_ENTRY_POINT_ENTRIES = 5000;
2640
+ var MAX_ENTRY_POINT_FILE_BYTES = 256 * 1024;
2641
+ var MAX_ENTRY_POINT_TOTAL_BYTES = 512 * 1024;
2642
+ var IGNORED_ENTRY_POINT_DIRS = new Set([
2643
+ ".git",
2644
+ ".gradle",
2645
+ "target",
2646
+ "build",
2647
+ "node_modules",
2648
+ ".idea",
2649
+ "out",
2650
+ "bin",
2651
+ ".venv",
2652
+ "venv",
2653
+ "dist"
2654
+ ]);
2655
+ var DEFERRED_ENTRY_POINT_DIRS = new Set([
2656
+ "test",
2657
+ "tests",
2658
+ "androidTest",
2659
+ "integrationTest",
2660
+ "testFixtures"
2661
+ ]);
2662
+ function isMainClass(source) {
2663
+ const masked = maskCommentsAndLiterals(source);
2664
+ return /\b(?:public\s+static|static\s+public)\s+void\s+main\s*\(/.test(masked);
2665
+ }
2666
+ function scanForMainClasses(dir) {
2667
+ const results = [];
2668
+ const stack = [{ dir, depth: 0 }];
2669
+ let entriesVisited = 0;
2670
+ let totalBytes = 0;
2671
+ while (stack.length > 0) {
2672
+ const current = stack.pop();
2673
+ if (!current || current.depth > MAX_ENTRY_POINT_DEPTH)
2674
+ continue;
2675
+ let entries;
2676
+ try {
2677
+ entries = fs5.readdirSync(current.dir, { withFileTypes: true });
2678
+ } catch {
2679
+ continue;
2680
+ }
2681
+ const deferredDirs = [];
2682
+ const preferredDirs = [];
2683
+ for (const entry of entries) {
2684
+ entriesVisited++;
2685
+ if (entriesVisited > MAX_ENTRY_POINT_ENTRIES)
2686
+ return results;
2687
+ const full = path5.join(current.dir, entry.name);
2688
+ if (entry.isDirectory()) {
2689
+ if (IGNORED_ENTRY_POINT_DIRS.has(entry.name))
2690
+ continue;
2691
+ if (DEFERRED_ENTRY_POINT_DIRS.has(entry.name)) {
2692
+ deferredDirs.push(full);
2693
+ } else {
2694
+ preferredDirs.push(full);
2695
+ }
2696
+ } else if (entry.isFile() && entry.name.endsWith(".java")) {
2697
+ let size;
2698
+ try {
2699
+ size = fs5.statSync(full).size;
2700
+ } catch {
2701
+ continue;
2702
+ }
2703
+ if (size > MAX_ENTRY_POINT_FILE_BYTES)
2704
+ continue;
2705
+ if (totalBytes + size > MAX_ENTRY_POINT_TOTAL_BYTES)
2706
+ return results;
2707
+ try {
2708
+ const source = fs5.readFileSync(full, "utf-8");
2709
+ totalBytes += size;
2710
+ if (isMainClass(source)) {
2711
+ results.push(path5.relative(dir, full));
2712
+ }
2713
+ } catch {}
2714
+ }
2715
+ }
2716
+ for (const d of deferredDirs)
2717
+ stack.push({ dir: d, depth: current.depth + 1 });
2718
+ for (const d of preferredDirs)
2719
+ stack.push({ dir: d, depth: current.depth + 1 });
2720
+ }
2721
+ return results;
2722
+ }
2723
+ function detectFramework(content) {
2724
+ if (content.length === 0)
2725
+ return null;
2726
+ if (/\bspring-boot-starter-web\b|\bspring-boot\b|\bspring-web\b|\bspring-context\b/.test(content)) {
2727
+ return { name: "spring", detectedVia: "spring-boot/spring dependency" };
2728
+ }
2729
+ if (/\bjakarta\.servlet\b|\bjavax\.servlet\b/.test(content)) {
2730
+ return { name: "servlet", detectedVia: "jakarta/javax servlet dependency" };
2731
+ }
2732
+ return null;
2733
+ }
2734
+ function extractImports(_sourceFile, source) {
2735
+ const seen = new Set;
2736
+ for (const imp of parseJavaImports(source)) {
2737
+ seen.add(imp.specifier);
2738
+ }
2739
+ return [...seen];
2740
+ }
2741
+ function wrapperExists(dir, name) {
2742
+ return fs5.existsSync(path5.join(dir, name));
2743
+ }
2744
+ function resolveMvnwCommand(dir) {
2745
+ const isWindows = process.platform === "win32";
2746
+ const hasMvnwCmd = wrapperExists(dir, "mvnw.cmd");
2747
+ return isWindows && hasMvnwCmd ? "mvnw.cmd" : "./mvnw";
2748
+ }
2749
+ function resolveGradlewCommand(dir) {
2750
+ const isWindows = process.platform === "win32";
2751
+ const hasGradlewBat = wrapperExists(dir, "gradlew.bat");
2752
+ return isWindows && hasGradlewBat ? "gradlew.bat" : "./gradlew";
2753
+ }
2754
+ async function selectTestFramework(dir) {
2755
+ if (wrapperExists(dir, "gradlew")) {
2756
+ return {
2757
+ name: "gradle",
2758
+ cmd: [resolveGradlewCommand(dir), "test", "-q"],
2759
+ cwd: dir,
2760
+ detectedVia: "./gradlew",
2761
+ filesIgnored: false
2762
+ };
2763
+ }
2764
+ if (wrapperExists(dir, "mvnw")) {
2765
+ return {
2766
+ name: "maven",
2767
+ cmd: [resolveMvnwCommand(dir), "test", "-q"],
2768
+ cwd: dir,
2769
+ detectedVia: "./mvnw",
2770
+ filesIgnored: false
2771
+ };
2772
+ }
2773
+ const profile = LANGUAGE_REGISTRY.get(PROFILE_ID);
2774
+ if (!profile)
2775
+ return null;
2776
+ return defaultSelectTestFramework(profile, dir);
2777
+ }
2778
+ async function selectEntryPoints(dir) {
2779
+ await new Promise((resolve) => setImmediate(resolve));
2780
+ return scanForMainClasses(dir);
2781
+ }
2782
+ async function selectFramework(dir) {
2783
+ let content = "";
2784
+ for (const file of ["pom.xml", "build.gradle", "build.gradle.kts"]) {
2785
+ try {
2786
+ content += `
2787
+ ${fs5.readFileSync(path5.join(dir, file), "utf-8")}`;
2788
+ } catch {}
2789
+ }
2790
+ return detectFramework(content);
2791
+ }
2792
+ function isExecutableFile(filePath) {
2793
+ try {
2794
+ const stats = fs5.statSync(filePath, { throwIfNoEntry: false });
2795
+ return stats?.isFile() === true && (stats.mode & 73) !== 0;
2796
+ } catch {
2797
+ return false;
2798
+ }
2799
+ }
2800
+ function resolveMavenWrapperCommand(dir, args) {
2801
+ if (process.platform === "win32") {
2802
+ return resolveContainedWindowsBatchCommand(dir, "mvnw.cmd", args);
2803
+ }
2804
+ return _internals3.isExecutableFile(path5.join(dir, "mvnw")) ? ["./mvnw", ...args] : null;
2805
+ }
2806
+ function buildMavenTestCommand(dir, targets) {
2807
+ const args = ["test"];
2808
+ if (targets && targets.length > 0) {
2809
+ args.push(`-Dtest=${targets.join(",")}`);
2810
+ }
2811
+ if (process.platform === "win32" && args.some((a) => a.endsWith("\\"))) {
2812
+ return ["mvn", ...args];
2813
+ }
2814
+ return resolveMavenWrapperCommand(dir, args) ?? ["mvn", ...args];
2815
+ }
2816
+ function buildTestCommand(framework, _files, dir, opts) {
2817
+ if (framework !== "maven")
2818
+ return null;
2819
+ if (opts?.nativeTarget)
2820
+ return null;
2821
+ return buildMavenTestCommand(dir, opts?.targets);
2822
+ }
2823
+ function buildJavaBackend() {
2824
+ const profile = LANGUAGE_REGISTRY.get(PROFILE_ID);
2825
+ if (!profile) {
2826
+ throw new Error("buildJavaBackend: java profile not in LANGUAGE_REGISTRY. " + "profiles.ts must be imported before this backend.");
2827
+ }
2828
+ return {
2829
+ ...defaultBackendFor(profile),
2830
+ extractImports,
2831
+ selectTestFramework,
2832
+ selectEntryPoints,
2833
+ selectFramework,
2834
+ buildTestCommand
2835
+ };
2836
+ }
2837
+ var _internals3 = {
2838
+ extractImports,
2839
+ isMainClass,
2840
+ detectFramework,
2841
+ wrapperExists,
2842
+ isExecutableFile,
2843
+ resolveMvnwCommand,
2844
+ resolveGradlewCommand,
2845
+ MAX_ENTRY_POINT_ENTRIES
2846
+ };
2847
+
2413
2848
  // src/lang/backends/go.ts
2414
- import * as fs4 from "fs";
2415
- import * as path4 from "path";
2416
- var PROFILE_ID = "go";
2849
+ import * as fs6 from "fs";
2850
+ import * as path6 from "path";
2851
+ var PROFILE_ID2 = "go";
2417
2852
  var IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
2418
2853
  var IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
2419
2854
  var IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
@@ -2480,7 +2915,7 @@ function stripGoComments(source) {
2480
2915
  }
2481
2916
  return out;
2482
2917
  }
2483
- function extractImports(_sourceFile, source) {
2918
+ function extractImports2(_sourceFile, source) {
2484
2919
  if (Buffer.byteLength(source, "utf8") > MAX_IMPORT_SOURCE_BYTES)
2485
2920
  return [];
2486
2921
  const out = new Set;
@@ -2505,10 +2940,10 @@ function extractImports(_sourceFile, source) {
2505
2940
  }
2506
2941
  return [...out];
2507
2942
  }
2508
- async function selectFramework(dir) {
2943
+ async function selectFramework2(dir) {
2509
2944
  let content;
2510
2945
  try {
2511
- content = fs4.readFileSync(path4.join(dir, "go.mod"), "utf-8");
2946
+ content = fs6.readFileSync(path6.join(dir, "go.mod"), "utf-8");
2512
2947
  } catch {
2513
2948
  return null;
2514
2949
  }
@@ -2526,19 +2961,19 @@ async function selectFramework(dir) {
2526
2961
  }
2527
2962
  return null;
2528
2963
  }
2529
- async function selectEntryPoints(dir) {
2964
+ async function selectEntryPoints2(dir) {
2530
2965
  const points = [];
2531
2966
  try {
2532
- fs4.accessSync(path4.join(dir, "main.go"));
2967
+ fs6.accessSync(path6.join(dir, "main.go"));
2533
2968
  points.push("main.go");
2534
2969
  } catch {}
2535
2970
  try {
2536
- const cmdDir = path4.join(dir, "cmd");
2537
- const subdirs = fs4.readdirSync(cmdDir, { withFileTypes: true }).filter((d) => d.isDirectory());
2971
+ const cmdDir = path6.join(dir, "cmd");
2972
+ const subdirs = fs6.readdirSync(cmdDir, { withFileTypes: true }).filter((d) => d.isDirectory());
2538
2973
  for (const sub of subdirs) {
2539
- const main = path4.join("cmd", sub.name, "main.go");
2974
+ const main = path6.join("cmd", sub.name, "main.go");
2540
2975
  try {
2541
- fs4.accessSync(path4.join(dir, main));
2976
+ fs6.accessSync(path6.join(dir, main));
2542
2977
  points.push(main);
2543
2978
  } catch {}
2544
2979
  }
@@ -2546,23 +2981,23 @@ async function selectEntryPoints(dir) {
2546
2981
  return points;
2547
2982
  }
2548
2983
  function buildGoBackend() {
2549
- const profile = LANGUAGE_REGISTRY.get(PROFILE_ID);
2984
+ const profile = LANGUAGE_REGISTRY.get(PROFILE_ID2);
2550
2985
  if (!profile) {
2551
2986
  throw new Error("buildGoBackend: go profile not in LANGUAGE_REGISTRY. " + "profiles.ts must be imported before this backend.");
2552
2987
  }
2553
2988
  return {
2554
2989
  ...defaultBackendFor(profile),
2555
- extractImports,
2556
- selectFramework,
2557
- selectEntryPoints
2990
+ extractImports: extractImports2,
2991
+ selectFramework: selectFramework2,
2992
+ selectEntryPoints: selectEntryPoints2
2558
2993
  };
2559
2994
  }
2560
- var _internals2 = { extractImports };
2995
+ var _internals4 = { extractImports: extractImports2 };
2561
2996
 
2562
2997
  // src/lang/backends/python.ts
2563
- import * as fs5 from "fs";
2564
- import * as path5 from "path";
2565
- var PROFILE_ID2 = "python";
2998
+ import * as fs7 from "fs";
2999
+ import * as path7 from "path";
3000
+ var PROFILE_ID3 = "python";
2566
3001
  var IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
2567
3002
  var IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
2568
3003
  function parseImportTargets(rawTargets) {
@@ -2579,7 +3014,7 @@ function parseImportTargets(rawTargets) {
2579
3014
  }
2580
3015
  return out;
2581
3016
  }
2582
- function extractImports2(_sourceFile, source) {
3017
+ function extractImports3(_sourceFile, source) {
2583
3018
  const out = new Set;
2584
3019
  source = source.replace(/\\\r?\n[ \t]*/g, " ");
2585
3020
  IMPORT_REGEX_FROM_WITH_TARGETS.lastIndex = 0;
@@ -2612,7 +3047,7 @@ function extractImports2(_sourceFile, source) {
2612
3047
  }
2613
3048
  return [...out];
2614
3049
  }
2615
- async function selectFramework2(dir) {
3050
+ async function selectFramework3(dir) {
2616
3051
  const candidates = [
2617
3052
  ["django", "django"],
2618
3053
  ["flask", "flask"],
@@ -2624,7 +3059,7 @@ async function selectFramework2(dir) {
2624
3059
  ];
2625
3060
  for (const candidate of ["pyproject.toml", "requirements.txt", "setup.py"]) {
2626
3061
  try {
2627
- const content = fs5.readFileSync(path5.join(dir, candidate), "utf-8");
3062
+ const content = fs7.readFileSync(path7.join(dir, candidate), "utf-8");
2628
3063
  const lower = content.toLowerCase();
2629
3064
  for (const [pkg, name] of candidates) {
2630
3065
  if (lower.includes(pkg)) {
@@ -2635,10 +3070,10 @@ async function selectFramework2(dir) {
2635
3070
  }
2636
3071
  return null;
2637
3072
  }
2638
- async function selectEntryPoints2(dir) {
3073
+ async function selectEntryPoints3(dir) {
2639
3074
  const points = new Set;
2640
3075
  try {
2641
- const content = fs5.readFileSync(path5.join(dir, "pyproject.toml"), "utf-8");
3076
+ const content = fs7.readFileSync(path7.join(dir, "pyproject.toml"), "utf-8");
2642
3077
  const scriptsBlock = content.match(/\[project\.scripts\][\s\S]*?(?=\n\[|$)/);
2643
3078
  if (scriptsBlock) {
2644
3079
  for (const line of scriptsBlock[0].split(`
@@ -2653,164 +3088,24 @@ async function selectEntryPoints2(dir) {
2653
3088
  } catch {}
2654
3089
  for (const name of ["manage.py", "main.py", "app.py", "__main__.py"]) {
2655
3090
  try {
2656
- fs5.accessSync(path5.join(dir, name));
3091
+ fs7.accessSync(path7.join(dir, name));
2657
3092
  points.add(name);
2658
3093
  } catch {}
2659
3094
  }
2660
3095
  return [...points];
2661
3096
  }
2662
3097
  function buildPythonBackend() {
2663
- const profile = LANGUAGE_REGISTRY.get(PROFILE_ID2);
3098
+ const profile = LANGUAGE_REGISTRY.get(PROFILE_ID3);
2664
3099
  if (!profile) {
2665
3100
  throw new Error("buildPythonBackend: python profile not in LANGUAGE_REGISTRY. " + "profiles.ts must be imported before this backend.");
2666
3101
  }
2667
3102
  return {
2668
3103
  ...defaultBackendFor(profile),
2669
- extractImports: extractImports2,
2670
- selectFramework: selectFramework2,
2671
- selectEntryPoints: selectEntryPoints2
3104
+ extractImports: extractImports3,
3105
+ selectFramework: selectFramework3,
3106
+ selectEntryPoints: selectEntryPoints3
2672
3107
  };
2673
3108
  }
2674
- var _internals3 = { extractImports: extractImports2 };
2675
-
2676
- // src/lang/java-extraction.ts
2677
- function parseJavaImports(rawContent) {
2678
- const imports = [];
2679
- const content = maskCommentsAndLiterals(rawContent);
2680
- const re = /^[ \t]*import[ \t]+(static[ \t]+)?([A-Za-z_][\w.]*(?:\.\*)?)[ \t]*;?[ \t]*\r?$/gm;
2681
- for (let m = re.exec(content);m !== null; m = re.exec(content)) {
2682
- const isStatic = Boolean(m[1]);
2683
- const raw = m[2];
2684
- if (raw.endsWith(".*")) {
2685
- imports.push({ specifier: raw, importType: "namespace", bindings: [] });
2686
- continue;
2687
- }
2688
- const imported = finalDottedSegment(raw);
2689
- const specifier = isStatic ? raw.split(".").slice(0, -1).join(".") : raw;
2690
- imports.push({
2691
- specifier,
2692
- importType: "named",
2693
- bindings: [{ imported, local: imported }]
2694
- });
2695
- }
2696
- return imports;
2697
- }
2698
- function maskCommentsAndLiterals(content) {
2699
- let out = "";
2700
- let i = 0;
2701
- const n = content.length;
2702
- while (i < n) {
2703
- const ch = content[i];
2704
- const next = i + 1 < n ? content[i + 1] : "";
2705
- const next2 = i + 2 < n ? content[i + 2] : "";
2706
- if (ch === '"' && next === '"' && next2 === '"') {
2707
- out += " ";
2708
- i += 3;
2709
- while (i < n) {
2710
- if (content[i] === '"' && content[i + 1] === '"' && content[i + 2] === '"') {
2711
- out += " ";
2712
- i += 3;
2713
- break;
2714
- }
2715
- out += content[i] === `
2716
- ` ? `
2717
- ` : " ";
2718
- i++;
2719
- }
2720
- continue;
2721
- }
2722
- if (ch === "/" && next === "/") {
2723
- while (i < n && content[i] !== `
2724
- `) {
2725
- out += " ";
2726
- i++;
2727
- }
2728
- continue;
2729
- }
2730
- if (ch === "/" && next === "*") {
2731
- out += " ";
2732
- i += 2;
2733
- while (i < n) {
2734
- if (content[i] === "*" && content[i + 1] === "/") {
2735
- out += " ";
2736
- i += 2;
2737
- break;
2738
- }
2739
- out += content[i] === `
2740
- ` ? `
2741
- ` : " ";
2742
- i++;
2743
- }
2744
- continue;
2745
- }
2746
- if (ch === '"' || ch === "'") {
2747
- const quote = ch;
2748
- out += ch;
2749
- i++;
2750
- while (i < n) {
2751
- const c = content[i];
2752
- if (c === "\\") {
2753
- out += " ";
2754
- i++;
2755
- if (i < n) {
2756
- out += content[i] === `
2757
- ` ? content[i] : " ";
2758
- i++;
2759
- }
2760
- continue;
2761
- }
2762
- if (c === `
2763
- `) {
2764
- break;
2765
- }
2766
- if (c === quote) {
2767
- out += c;
2768
- i++;
2769
- break;
2770
- }
2771
- out += " ";
2772
- i++;
2773
- }
2774
- continue;
2775
- }
2776
- out += ch;
2777
- i++;
2778
- }
2779
- return out;
2780
- }
2781
- function finalDottedSegment(path6) {
2782
- const lastDot = path6.lastIndexOf(".");
2783
- return lastDot === -1 ? path6 : path6.slice(lastDot + 1);
2784
- }
2785
- var JAVA_SYMBOL_GRAMMAR = {
2786
- defs: `
2787
- (method_declaration
2788
- (identifier) @func.name
2789
- ) @func.def
2790
- (constructor_declaration
2791
- (identifier) @ctor.name
2792
- ) @ctor.def
2793
- (class_declaration
2794
- (identifier) @class.name
2795
- ) @class.def
2796
- (interface_declaration
2797
- (identifier) @interface.name
2798
- ) @interface.def
2799
- (enum_declaration
2800
- (identifier) @enum.name
2801
- ) @enum.def
2802
- (record_declaration
2803
- (identifier) @record.name
2804
- ) @record.def
2805
- `,
2806
- imports: `
2807
- (import_declaration) @import
2808
- `,
2809
- refs: `
2810
- (identifier) @ref.identifier
2811
- (type_identifier) @ref.identifier
2812
- `,
2813
- exports: ``
2814
- };
3109
+ var _internals5 = { extractImports: extractImports3 };
2815
3110
 
2816
- export { LANGUAGE_REGISTRY, getProfileForFile, detectProjectLanguages, tokenizeCommand, resolveLocalNodeTool, isCommandAvailable, parseJavaImports, maskCommentsAndLiterals, JAVA_SYMBOL_GRAMMAR, defaultSelectTestFramework, defaultBuildTestCommand, buildNativeTargetCommand, defaultParseTestOutput, defaultSelectBuildCommand, defaultTestFilesFor, defaultBackendFor, buildGoBackend, _internals2 as _internals, buildPythonBackend, _internals3 as _internals1 };
3111
+ export { LANGUAGE_REGISTRY, getProfileForFile, detectProjectLanguages, tokenizeCommand, resolveLocalNodeTool, isCommandAvailable, parseJavaImports, maskCommentsAndLiterals, JAVA_SYMBOL_GRAMMAR, WINDOWS_BATCH_WRAPPER_EXTENSIONS, buildWindowsBatchCommand, resolveContainedWindowsBatchCommand, isWindowsCommandInterpreterLaunch, defaultSelectTestFramework, buildGradleTestCommand, defaultBuildTestCommand, buildNativeTargetCommand, defaultParseTestOutput, defaultSelectBuildCommand, defaultTestFilesFor, defaultBackendFor, resolveMavenWrapperCommand, buildMavenTestCommand, buildJavaBackend, buildGoBackend, _internals4 as _internals, buildPythonBackend, _internals5 as _internals1 };