opencode-swarm 6.85.1 → 6.85.3

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
@@ -36305,6 +36305,12 @@ async function checkConfigParseability(directory) {
36305
36305
  };
36306
36306
  }
36307
36307
  }
36308
+ function resolveGrammarDir(thisDir) {
36309
+ const normalized = thisDir.replace(/\\/g, "/");
36310
+ const isSource = normalized.endsWith("/src/services");
36311
+ const isCliBundle = normalized.endsWith("/cli");
36312
+ return isSource || isCliBundle ? path17.join(thisDir, "..", "lang", "grammars") : path17.join(thisDir, "lang", "grammars");
36313
+ }
36308
36314
  async function checkGrammarWasmFiles() {
36309
36315
  const grammarFiles = [
36310
36316
  "tree-sitter-javascript.wasm",
@@ -36328,8 +36334,7 @@ async function checkGrammarWasmFiles() {
36328
36334
  "tree-sitter-regex.wasm"
36329
36335
  ];
36330
36336
  const thisDir = path17.dirname(fileURLToPath(import.meta.url));
36331
- const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/services");
36332
- const grammarDir = isSource ? path17.join(thisDir, "..", "lang", "grammars") : path17.join(thisDir, "lang", "grammars");
36337
+ const grammarDir = resolveGrammarDir(thisDir);
36333
36338
  const missing = [];
36334
36339
  if (!existsSync8(path17.join(grammarDir, "tree-sitter.wasm"))) {
36335
36340
  missing.push("tree-sitter.wasm (core runtime)");
@@ -37211,7 +37216,7 @@ LANGUAGE_REGISTRY.register({
37211
37216
  displayName: "C# / .NET",
37212
37217
  tier: 2,
37213
37218
  extensions: [".cs", ".csx"],
37214
- treeSitter: { grammarId: "c_sharp", wasmFile: "tree-sitter-c_sharp.wasm" },
37219
+ treeSitter: { grammarId: "csharp", wasmFile: "tree-sitter-c-sharp.wasm" },
37215
37220
  build: {
37216
37221
  detectFiles: ["*.csproj", "*.sln", "Directory.Build.props"],
37217
37222
  commands: [
package/dist/index.js CHANGED
@@ -15723,6 +15723,14 @@ function warn(message, data) {
15723
15723
  console.warn(`[opencode-swarm ${timestamp}] WARN: ${message}`);
15724
15724
  }
15725
15725
  }
15726
+ function error48(message, data) {
15727
+ const timestamp = new Date().toISOString();
15728
+ if (data !== undefined) {
15729
+ console.error(`[opencode-swarm ${timestamp}] ERROR: ${message}`, data);
15730
+ } else {
15731
+ console.error(`[opencode-swarm ${timestamp}] ERROR: ${message}`);
15732
+ }
15733
+ }
15726
15734
  var DEBUG;
15727
15735
  var init_logger = __esm(() => {
15728
15736
  DEBUG = process.env.OPENCODE_SWARM_DEBUG === "1";
@@ -43939,6 +43947,12 @@ async function checkConfigParseability(directory) {
43939
43947
  };
43940
43948
  }
43941
43949
  }
43950
+ function resolveGrammarDir(thisDir) {
43951
+ const normalized = thisDir.replace(/\\/g, "/");
43952
+ const isSource = normalized.endsWith("/src/services");
43953
+ const isCliBundle = normalized.endsWith("/cli");
43954
+ return isSource || isCliBundle ? path24.join(thisDir, "..", "lang", "grammars") : path24.join(thisDir, "lang", "grammars");
43955
+ }
43942
43956
  async function checkGrammarWasmFiles() {
43943
43957
  const grammarFiles = [
43944
43958
  "tree-sitter-javascript.wasm",
@@ -43962,8 +43976,7 @@ async function checkGrammarWasmFiles() {
43962
43976
  "tree-sitter-regex.wasm"
43963
43977
  ];
43964
43978
  const thisDir = path24.dirname(fileURLToPath(import.meta.url));
43965
- const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/services");
43966
- const grammarDir = isSource ? path24.join(thisDir, "..", "lang", "grammars") : path24.join(thisDir, "lang", "grammars");
43979
+ const grammarDir = resolveGrammarDir(thisDir);
43967
43980
  const missing = [];
43968
43981
  if (!existsSync11(path24.join(grammarDir, "tree-sitter.wasm"))) {
43969
43982
  missing.push("tree-sitter.wasm (core runtime)");
@@ -45483,7 +45496,7 @@ var init_profiles = __esm(() => {
45483
45496
  displayName: "C# / .NET",
45484
45497
  tier: 2,
45485
45498
  extensions: [".cs", ".csx"],
45486
- treeSitter: { grammarId: "c_sharp", wasmFile: "tree-sitter-c_sharp.wasm" },
45499
+ treeSitter: { grammarId: "csharp", wasmFile: "tree-sitter-c-sharp.wasm" },
45487
45500
  build: {
45488
45501
  detectFiles: ["*.csproj", "*.sln", "Directory.Build.props"],
45489
45502
  commands: [
@@ -62033,8 +62046,10 @@ function getWasmFileName(languageId) {
62033
62046
  }
62034
62047
  function getGrammarsDirAbsolute() {
62035
62048
  const thisDir = path57.dirname(fileURLToPath2(import.meta.url));
62036
- const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
62037
- return isSource ? path57.join(thisDir, "grammars") : path57.join(thisDir, "lang", "grammars");
62049
+ const normalized = thisDir.replace(/\\/g, "/");
62050
+ const isSource = normalized.endsWith("/src/lang");
62051
+ const isCliBundle = normalized.endsWith("/cli");
62052
+ return isSource ? path57.join(thisDir, "grammars") : isCliBundle ? path57.join(thisDir, "..", "lang", "grammars") : path57.join(thisDir, "lang", "grammars");
62038
62053
  }
62039
62054
  async function loadGrammar(languageId) {
62040
62055
  if (typeof languageId !== "string" || languageId.length > 100) {
@@ -64832,6 +64847,7 @@ import * as path50 from "path";
64832
64847
 
64833
64848
  // src/tools/repo-graph.ts
64834
64849
  init_utils2();
64850
+ init_logger();
64835
64851
  init_path_security();
64836
64852
  import * as fsSync2 from "fs";
64837
64853
  import { constants as constants3, existsSync as existsSync28, realpathSync as realpathSync6 } from "fs";
@@ -65565,7 +65581,7 @@ async function saveGraph(workspace, graph, options) {
65565
65581
  await fsPromises3.unlink(tempPath);
65566
65582
  } catch (error93) {
65567
65583
  if (error93 instanceof Error && "code" in error93 && error93.code !== "ENOENT") {
65568
- console.error(`Failed to clean up temp file ${tempPath}:`, error93);
65584
+ error48(`Failed to clean up temp file ${tempPath}:`, error93);
65569
65585
  }
65570
65586
  }
65571
65587
  }
@@ -65705,7 +65721,7 @@ function buildWorkspaceGraph(workspaceRoot, options) {
65705
65721
  return normA.localeCompare(normB);
65706
65722
  });
65707
65723
  if (sourceFiles.length > maxFiles) {
65708
- console.warn(`[repo-graph] Truncating scan: ${sourceFiles.length} files found, capping at ${maxFiles}. ` + `${sourceFiles.length - maxFiles} files skipped.`);
65724
+ warn(`[repo-graph] Truncating scan: ${sourceFiles.length} files found, capping at ${maxFiles}. ` + `${sourceFiles.length - maxFiles} files skipped.`);
65709
65725
  sourceFiles.length = maxFiles;
65710
65726
  stats.truncated = true;
65711
65727
  }
@@ -65775,7 +65791,7 @@ function buildWorkspaceGraph(workspaceRoot, options) {
65775
65791
  edgeCount: graph.edges.length
65776
65792
  };
65777
65793
  if (stats.skippedFiles > 0 || stats.skippedDirs > 0 || stats.truncated) {
65778
- console.log(`[repo-graph] Scan stats: ${stats.filesScanned} files scanned, ` + `${stats.skippedFiles} files skipped, ${stats.skippedDirs} dirs skipped` + (stats.truncated ? ", TRUNCATED" : ""));
65794
+ log(`[repo-graph] Scan stats: ${stats.filesScanned} files scanned, ` + `${stats.skippedFiles} files skipped, ${stats.skippedDirs} dirs skipped` + (stats.truncated ? ", TRUNCATED" : ""));
65779
65795
  }
65780
65796
  return graph;
65781
65797
  }
@@ -65881,7 +65897,7 @@ async function updateGraphForFiles(workspaceRoot, filePaths, options) {
65881
65897
  }
65882
65898
  }
65883
65899
  if (validationFailed) {
65884
- console.warn(`[repo-graph] Incremental update failed, falling back to full rebuild`);
65900
+ warn(`[repo-graph] Incremental update failed, falling back to full rebuild`);
65885
65901
  const rebuiltGraph = buildWorkspaceGraph(workspaceRoot);
65886
65902
  await saveGraph(workspaceRoot, rebuiltGraph);
65887
65903
  return rebuiltGraph;
@@ -65892,6 +65908,7 @@ async function updateGraphForFiles(workspaceRoot, filePaths, options) {
65892
65908
  }
65893
65909
 
65894
65910
  // src/hooks/repo-graph-builder.ts
65911
+ init_logger();
65895
65912
  var SUPPORTED_EXTENSIONS2 = [
65896
65913
  ".ts",
65897
65914
  ".tsx",
@@ -65923,13 +65940,13 @@ function createRepoGraphBuilderHook(workspaceRoot, deps) {
65923
65940
  try {
65924
65941
  const graph = _buildWorkspaceGraph(workspaceRoot);
65925
65942
  await _saveGraph(workspaceRoot, graph);
65926
- console.log(`[repo-graph] Built graph: ${graph.metadata.nodeCount} nodes, ${graph.metadata.edgeCount} edges`);
65943
+ log(`[repo-graph] Built graph: ${graph.metadata.nodeCount} nodes, ${graph.metadata.edgeCount} edges`);
65927
65944
  } catch (error93) {
65928
65945
  const message = error93 instanceof Error ? error93.message : String(error93);
65929
65946
  if (message.includes("does not exist")) {
65930
65947
  return;
65931
65948
  }
65932
- console.warn(`[repo-graph] Failed to build graph: ${message}`);
65949
+ error48(`[repo-graph] Failed to build graph: ${message}`);
65933
65950
  }
65934
65951
  },
65935
65952
  async toolAfter(input, _output) {
@@ -65966,10 +65983,10 @@ function createRepoGraphBuilderHook(workspaceRoot, deps) {
65966
65983
  }
65967
65984
  try {
65968
65985
  await _updateGraphForFiles(workspaceRoot, [absoluteFilePath]);
65969
- console.log(`[repo-graph] Incremental update for ${path50.basename(filePath)}`);
65986
+ log(`[repo-graph] Incremental update for ${path50.basename(filePath)}`);
65970
65987
  } catch (error93) {
65971
65988
  const message = error93 instanceof Error ? error93.message : String(error93);
65972
- console.warn(`[repo-graph] Incremental update failed: ${message}`);
65989
+ error48(`[repo-graph] Incremental update failed: ${message}`);
65973
65990
  }
65974
65991
  }
65975
65992
  };
@@ -15,6 +15,16 @@ export interface DiagnoseData {
15
15
  totalCount: number;
16
16
  allPassed: boolean;
17
17
  }
18
+ /**
19
+ * Resolve the grammar WASM directory from an arbitrary module directory.
20
+ * Exported for unit testing — callers should not pass import.meta.url directly.
21
+ *
22
+ * Rules:
23
+ * - Dev source (ends with /src/services): go up one level → src/lang/grammars
24
+ * - CLI bundle (ends with /cli): go up one level → dist/lang/grammars
25
+ * - Main bundle (everything else): stay put → dist/lang/grammars
26
+ */
27
+ export declare function resolveGrammarDir(thisDir: string): string;
18
28
  /**
19
29
  * Get diagnose data from the swarm directory.
20
30
  * Returns structured health checks for GUI, background flows, or commands.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.85.1",
3
+ "version": "6.85.3",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",