@chiway/contextweaver 1.5.0 → 1.5.1

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ensureIndexed,
3
3
  formatTextResponse
4
- } from "./chunk-VWBKZ6QL.js";
4
+ } from "./chunk-H4MGLXXF.js";
5
5
  import {
6
6
  generateProjectId,
7
7
  initDb
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  checkEnvOrRespond,
3
3
  ensureIndexed
4
- } from "./chunk-VWBKZ6QL.js";
4
+ } from "./chunk-H4MGLXXF.js";
5
5
  import {
6
6
  generateProjectId
7
7
  } from "./chunk-PPLFJGO3.js";
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  ensureIndexed,
9
9
  formatTextResponse
10
- } from "./chunk-VWBKZ6QL.js";
10
+ } from "./chunk-H4MGLXXF.js";
11
11
  import {
12
12
  generateProjectId,
13
13
  initDb,
@@ -181,7 +181,13 @@ var GRAMMAR_MODULES = {
181
181
  java: "tree-sitter-java",
182
182
  c: "tree-sitter-c",
183
183
  cpp: "tree-sitter-cpp",
184
- c_sharp: "tree-sitter-c-sharp"
184
+ c_sharp: "tree-sitter-c-sharp",
185
+ ruby: "tree-sitter-ruby",
186
+ php: "tree-sitter-php",
187
+ kotlin: "tree-sitter-kotlin",
188
+ swift: "tree-sitter-swift",
189
+ lua: "@tree-sitter-grammars/tree-sitter-lua",
190
+ shell: "tree-sitter-bash"
185
191
  };
186
192
  var loadedGrammars = /* @__PURE__ */ new Map();
187
193
  var parserCache = /* @__PURE__ */ new Map();
@@ -431,6 +437,89 @@ var LANGUAGE_SPECS = {
431
437
  namespace_declaration: "namespace "
432
438
  },
433
439
  commentTypes: /* @__PURE__ */ new Set(["comment"])
440
+ },
441
+ ruby: {
442
+ hierarchy: /* @__PURE__ */ new Set(["module", "class", "singleton_class", "method", "singleton_method"]),
443
+ nameFields: ["name"],
444
+ nameNodeTypes: /* @__PURE__ */ new Set(["constant", "identifier"]),
445
+ prefixMap: {
446
+ module: "module ",
447
+ class: "class ",
448
+ singleton_class: "class ",
449
+ method: "def ",
450
+ singleton_method: "def "
451
+ },
452
+ commentTypes: /* @__PURE__ */ new Set(["comment"])
453
+ },
454
+ php: {
455
+ hierarchy: /* @__PURE__ */ new Set([
456
+ "namespace_definition",
457
+ "class_declaration",
458
+ "interface_declaration",
459
+ "trait_declaration",
460
+ "enum_declaration",
461
+ "method_declaration",
462
+ "function_definition"
463
+ ]),
464
+ nameFields: ["name"],
465
+ nameNodeTypes: /* @__PURE__ */ new Set(["name"]),
466
+ prefixMap: {
467
+ namespace_definition: "namespace ",
468
+ class_declaration: "class ",
469
+ interface_declaration: "interface ",
470
+ trait_declaration: "trait ",
471
+ enum_declaration: "enum ",
472
+ method_declaration: "",
473
+ function_definition: "function "
474
+ },
475
+ commentTypes: /* @__PURE__ */ new Set(["comment"])
476
+ },
477
+ kotlin: {
478
+ hierarchy: /* @__PURE__ */ new Set(["class_declaration", "object_declaration", "function_declaration"]),
479
+ nameFields: ["name"],
480
+ nameNodeTypes: /* @__PURE__ */ new Set(["type_identifier", "simple_identifier"]),
481
+ prefixMap: {
482
+ class_declaration: "class ",
483
+ object_declaration: "object ",
484
+ function_declaration: "fun "
485
+ },
486
+ commentTypes: /* @__PURE__ */ new Set(["line_comment", "multiline_comment"])
487
+ },
488
+ swift: {
489
+ hierarchy: /* @__PURE__ */ new Set([
490
+ "class_declaration",
491
+ "protocol_declaration",
492
+ "function_declaration",
493
+ "init_declaration"
494
+ ]),
495
+ nameFields: ["name"],
496
+ nameNodeTypes: /* @__PURE__ */ new Set(["type_identifier", "simple_identifier"]),
497
+ prefixMap: {
498
+ class_declaration: "type ",
499
+ protocol_declaration: "protocol ",
500
+ function_declaration: "func ",
501
+ init_declaration: "init "
502
+ },
503
+ commentTypes: /* @__PURE__ */ new Set(["comment", "multiline_comment"])
504
+ },
505
+ lua: {
506
+ hierarchy: /* @__PURE__ */ new Set(["function_declaration", "function_definition"]),
507
+ nameFields: ["name"],
508
+ nameNodeTypes: /* @__PURE__ */ new Set(["identifier", "dot_index_expression", "method_index_expression"]),
509
+ prefixMap: {
510
+ function_declaration: "function ",
511
+ function_definition: "function "
512
+ },
513
+ commentTypes: /* @__PURE__ */ new Set(["comment"])
514
+ },
515
+ shell: {
516
+ hierarchy: /* @__PURE__ */ new Set(["function_definition"]),
517
+ nameFields: ["name"],
518
+ nameNodeTypes: /* @__PURE__ */ new Set(["word"]),
519
+ prefixMap: {
520
+ function_definition: "function "
521
+ },
522
+ commentTypes: /* @__PURE__ */ new Set(["comment"])
434
523
  }
435
524
  };
436
525
  function getLanguageSpec(language) {
@@ -1070,7 +1159,20 @@ function sha256(data) {
1070
1159
 
1071
1160
  // src/scanner/processor.ts
1072
1161
  var MAX_FILE_SIZE = 100 * 1024;
1073
- var FALLBACK_LANGS = /* @__PURE__ */ new Set(["python", "go", "rust", "java", "markdown", "json"]);
1162
+ var FALLBACK_LANGS = /* @__PURE__ */ new Set([
1163
+ "python",
1164
+ "go",
1165
+ "rust",
1166
+ "java",
1167
+ "markdown",
1168
+ "json",
1169
+ "ruby",
1170
+ "php",
1171
+ "kotlin",
1172
+ "swift",
1173
+ "lua",
1174
+ "shell"
1175
+ ]);
1074
1176
  function shouldSkipJson(relPath) {
1075
1177
  if (relPath.endsWith("-lock.json") || relPath.endsWith("package-lock.json")) {
1076
1178
  return true;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  codebaseRetrievalSchema,
3
3
  handleCodebaseRetrieval
4
- } from "./chunk-V3K4YVAR.js";
5
- import "./chunk-VWBKZ6QL.js";
4
+ } from "./chunk-ORYIVY7D.js";
5
+ import "./chunk-H4MGLXXF.js";
6
6
  import "./chunk-TPM6YP43.js";
7
7
  import "./chunk-BFCIZ52F.js";
8
8
  import "./chunk-PPLFJGO3.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  findReferencesSchema,
3
3
  handleFindReferences
4
- } from "./chunk-R6CNZXZ7.js";
4
+ } from "./chunk-YMQWNIQI.js";
5
5
  import "./chunk-XFIM2T6S.js";
6
6
  import "./chunk-3BNHQV5W.js";
7
- import "./chunk-VWBKZ6QL.js";
7
+ import "./chunk-H4MGLXXF.js";
8
8
  import "./chunk-TPM6YP43.js";
9
9
  import "./chunk-BFCIZ52F.js";
10
10
  import "./chunk-PPLFJGO3.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getSymbolDefinitionSchema,
3
3
  handleGetSymbolDefinition
4
- } from "./chunk-ISVCQFB4.js";
4
+ } from "./chunk-2EVCLNYN.js";
5
5
  import "./chunk-LB42CZEB.js";
6
6
  import "./chunk-XFIM2T6S.js";
7
7
  import "./chunk-3BNHQV5W.js";
8
- import "./chunk-VWBKZ6QL.js";
8
+ import "./chunk-H4MGLXXF.js";
9
9
  import "./chunk-TPM6YP43.js";
10
10
  import "./chunk-BFCIZ52F.js";
11
11
  import "./chunk-PPLFJGO3.js";
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  initFilter,
7
7
  isFiltered,
8
8
  scan
9
- } from "./chunk-GDVB6PJ4.js";
9
+ } from "./chunk-YSQI5IRI.js";
10
10
  import "./chunk-XMZZZKG7.js";
11
11
  import "./chunk-LB42CZEB.js";
12
12
  import "./chunk-XFIM2T6S.js";
@@ -48,7 +48,7 @@ function registerMirrorCommands(cli2) {
48
48
  cli2.command("list-files [path]", "\u5217\u51FA\u5DF2\u7D22\u5F15\u6587\u4EF6\u7ED3\u6784\uFF08\u955C\u50CF MCP list-files\uFF09").option("--glob <pattern>", "\u8DEF\u5F84 glob \u8FC7\u6EE4").option("--language <language>", "\u8BED\u8A00\u8FC7\u6EE4").option("--max-results <n>", "\u6700\u591A\u8FD4\u56DE\u6570\u91CF").action(
49
49
  async (targetPath, options) => {
50
50
  const repoPath = targetPath ? path.resolve(targetPath) : process.cwd();
51
- const { handleListFiles } = await import("./listFiles-4VT2TPJD.js");
51
+ const { handleListFiles } = await import("./listFiles-W7C5UYOP.js");
52
52
  const response = await handleListFiles({
53
53
  repo_path: repoPath,
54
54
  glob: options.glob,
@@ -61,7 +61,7 @@ function registerMirrorCommands(cli2) {
61
61
  cli2.command("definition <symbol>", "\u67E5\u770B\u7B26\u53F7\u5B9A\u4E49\uFF08\u955C\u50CF MCP get-symbol-definition\uFF09").option("-p, --path <path>", "\u9879\u76EE\u8DEF\u5F84\uFF08\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55\uFF09").option("--hint-path <path>", "\u7528\u4E8E\u540C\u540D\u5B9A\u4E49\u6D88\u6B67\u7684\u504F\u597D\u8DEF\u5F84").option("--max-results <n>", "\u6700\u591A\u8FD4\u56DE\u6570\u91CF").action(
62
62
  async (symbol, options) => {
63
63
  const repoPath = options.path ? path.resolve(options.path) : process.cwd();
64
- const { handleGetSymbolDefinition } = await import("./getSymbolDefinition-6KMY4H33.js");
64
+ const { handleGetSymbolDefinition } = await import("./getSymbolDefinition-ZQK65FPN.js");
65
65
  const response = await handleGetSymbolDefinition({
66
66
  repo_path: repoPath,
67
67
  symbol,
@@ -74,7 +74,7 @@ function registerMirrorCommands(cli2) {
74
74
  cli2.command("references <symbol>", "\u67E5\u770B\u7B26\u53F7\u5F15\u7528\uFF08\u955C\u50CF MCP find-references\uFF09").option("-p, --path <path>", "\u9879\u76EE\u8DEF\u5F84\uFF08\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55\uFF09").option("--exclude-definition", "\u6392\u9664\u5B9A\u4E49\u672C\u8EAB").option("--max-results <n>", "\u6700\u591A\u8FD4\u56DE\u6570\u91CF").action(
75
75
  async (symbol, options) => {
76
76
  const repoPath = options.path ? path.resolve(options.path) : process.cwd();
77
- const { handleFindReferences } = await import("./findReferences-N7ML7TUP.js");
77
+ const { handleFindReferences } = await import("./findReferences-EBYR3VNL.js");
78
78
  const response = await handleFindReferences({
79
79
  repo_path: repoPath,
80
80
  symbol,
@@ -310,7 +310,7 @@ cli.command("watch [path]", "\u76D1\u542C\u6587\u4EF6\u53D8\u5316\u5E76\u81EA\u5
310
310
  }
311
311
  });
312
312
  cli.command("mcp", "\u542F\u52A8 MCP \u670D\u52A1\u5668").action(async () => {
313
- const { startMcpServer } = await import("./server-UAI3U7AB.js");
313
+ const { startMcpServer } = await import("./server-ZIJIRVWH.js");
314
314
  try {
315
315
  await startMcpServer();
316
316
  } catch (err) {
@@ -331,7 +331,7 @@ cli.command("search", "\u672C\u5730\u68C0\u7D22\uFF08\u53C2\u6570\u5BF9\u9F50 MC
331
331
  process.exit(1);
332
332
  }
333
333
  const technicalTerms = (options.technicalTerms || "").split(",").map((t) => t.trim()).filter(Boolean);
334
- const { handleCodebaseRetrieval } = await import("./codebaseRetrieval-DIS5RH2C.js");
334
+ const { handleCodebaseRetrieval } = await import("./codebaseRetrieval-4BFIM7PU.js");
335
335
  const response = await handleCodebaseRetrieval({
336
336
  repo_path: repoPath,
337
337
  information_request: informationRequest,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  handleListFiles,
3
3
  listFilesSchema
4
- } from "./chunk-Y6H7C3NA.js";
5
- import "./chunk-VWBKZ6QL.js";
4
+ } from "./chunk-MN6BQJDB.js";
5
+ import "./chunk-H4MGLXXF.js";
6
6
  import "./chunk-TPM6YP43.js";
7
7
  import "./chunk-BFCIZ52F.js";
8
8
  import "./chunk-PPLFJGO3.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  scan
3
- } from "./chunk-GDVB6PJ4.js";
3
+ } from "./chunk-YSQI5IRI.js";
4
4
  import "./chunk-XMZZZKG7.js";
5
5
  import "./chunk-LB42CZEB.js";
6
6
  import "./chunk-XFIM2T6S.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  findReferencesSchema,
3
3
  handleFindReferences
4
- } from "./chunk-R6CNZXZ7.js";
4
+ } from "./chunk-YMQWNIQI.js";
5
5
  import {
6
6
  codebaseRetrievalSchema,
7
7
  handleCodebaseRetrieval
8
- } from "./chunk-V3K4YVAR.js";
8
+ } from "./chunk-ORYIVY7D.js";
9
9
  import {
10
10
  collectStats,
11
11
  renderStatsText
@@ -13,15 +13,15 @@ import {
13
13
  import {
14
14
  handleListFiles,
15
15
  listFilesSchema
16
- } from "./chunk-Y6H7C3NA.js";
16
+ } from "./chunk-MN6BQJDB.js";
17
17
  import {
18
18
  getSymbolDefinitionSchema,
19
19
  handleGetSymbolDefinition
20
- } from "./chunk-ISVCQFB4.js";
20
+ } from "./chunk-2EVCLNYN.js";
21
21
  import "./chunk-LB42CZEB.js";
22
22
  import "./chunk-XFIM2T6S.js";
23
23
  import "./chunk-3BNHQV5W.js";
24
- import "./chunk-VWBKZ6QL.js";
24
+ import "./chunk-H4MGLXXF.js";
25
25
  import "./chunk-TPM6YP43.js";
26
26
  import "./chunk-BFCIZ52F.js";
27
27
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chiway/contextweaver",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "A context weaving tool for LLMs",
5
5
  "license": "MIT",
6
6
  "author": "chiway",
@@ -44,14 +44,20 @@
44
44
  "ignore": "^7.0.5",
45
45
  "p-limit": "^7.2.0",
46
46
  "pino": "^10.1.0",
47
+ "tree-sitter-bash": "^0.25.1",
47
48
  "tree-sitter-c": "^0.24.1",
48
49
  "tree-sitter-c-sharp": "^0.23.1",
49
50
  "tree-sitter-cpp": "^0.23.4",
50
51
  "tree-sitter-go": "0.25.0",
51
52
  "tree-sitter-java": "0.23.5",
52
53
  "tree-sitter-javascript": "0.25.0",
54
+ "tree-sitter-kotlin": "^0.3.8",
55
+ "@tree-sitter-grammars/tree-sitter-lua": "^0.4.1",
56
+ "tree-sitter-php": "^0.24.2",
53
57
  "tree-sitter-python": "0.25.0",
58
+ "tree-sitter-ruby": "^0.23.1",
54
59
  "tree-sitter-rust": "0.24.0",
60
+ "tree-sitter-swift": "^0.7.1",
55
61
  "tree-sitter-typescript": "0.23.2",
56
62
  "zod": "^4.2.1"
57
63
  },