@bike4mind/cli 0.2.28 → 0.2.29-cache-mcp-tools-schema-and-refactor.18845

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
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-XJRPAAUS.js";
4
+ } from "./chunk-5GSDPBTM.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-XJRPAAUS.js";
4
+ } from "./chunk-5GSDPBTM.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-VGYTNJXN.js";
6
- import "./chunk-UNOJBVD2.js";
7
- import "./chunk-XJRPAAUS.js";
5
+ } from "./chunk-QUV5XB2V.js";
6
+ import "./chunk-H4SPUAKA.js";
7
+ import "./chunk-5GSDPBTM.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  findMostSimilarMemento,
@@ -47,6 +47,7 @@ import {
47
47
  OpenAISoraVideoService,
48
48
  OpenaiModerationsService,
49
49
  Pagination,
50
+ PipelineTimer,
50
51
  QuestMaster,
51
52
  RapidReplyMappingsCache,
52
53
  S3Storage,
@@ -133,8 +134,8 @@ import {
133
134
  validateMermaidSyntax,
134
135
  warmUpSettingsCache,
135
136
  withRetry
136
- } from "./chunk-UNOJBVD2.js";
137
- import "./chunk-XJRPAAUS.js";
137
+ } from "./chunk-H4SPUAKA.js";
138
+ import "./chunk-5GSDPBTM.js";
138
139
  import {
139
140
  Logger,
140
141
  NotificationDeduplicator,
@@ -193,6 +194,7 @@ export {
193
194
  OpenAISoraVideoService,
194
195
  OpenaiModerationsService,
195
196
  Pagination,
197
+ PipelineTimer,
196
198
  QuestMaster,
197
199
  RapidReplyMappingsCache,
198
200
  S3Storage,
@@ -112,6 +112,7 @@ import {
112
112
  JIRA_MAX_ATTACHMENT_SIZE,
113
113
  JiraApi,
114
114
  KnowledgeType,
115
+ LEGACY_IMAGE_MODEL_MAP,
115
116
  LIVEOPS_TRIAGE_VALIDATION_LIMITS,
116
117
  LLMApiRequestBodySchema,
117
118
  LLMEvents,
@@ -339,7 +340,7 @@ import {
339
340
  validateReactArtifactV2,
340
341
  validateSvgArtifactV2,
341
342
  wikiMarkupToAdf
342
- } from "./chunk-XJRPAAUS.js";
343
+ } from "./chunk-5GSDPBTM.js";
343
344
  export {
344
345
  ALL_IMAGE_MODELS,
345
346
  ALL_IMAGE_SIZES,
@@ -454,6 +455,7 @@ export {
454
455
  JIRA_MAX_ATTACHMENT_SIZE,
455
456
  JiraApi,
456
457
  KnowledgeType,
458
+ LEGACY_IMAGE_MODEL_MAP,
457
459
  LIVEOPS_TRIAGE_VALIDATION_LIMITS,
458
460
  LLMApiRequestBodySchema,
459
461
  LLMEvents,
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-JJBDHUGY.js";
6
- import "./chunk-UNOJBVD2.js";
7
- import "./chunk-XJRPAAUS.js";
5
+ } from "./chunk-AQWQ7KZX.js";
6
+ import "./chunk-H4SPUAKA.js";
7
+ import "./chunk-5GSDPBTM.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  SubtractCreditsSchema,
@@ -0,0 +1,330 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/tools/getFileStructure/treeSitterEngine.ts
4
+ import { createRequire } from "module";
5
+ import { readFileSync } from "fs";
6
+
7
+ // src/tools/getFileStructure/types.ts
8
+ var EXTENSION_TO_LANGUAGE = {
9
+ ".ts": "typescript",
10
+ ".tsx": "tsx",
11
+ ".js": "javascript",
12
+ ".jsx": "javascript",
13
+ ".mjs": "javascript",
14
+ ".cjs": "javascript",
15
+ ".py": "python"
16
+ };
17
+
18
+ // src/tools/getFileStructure/queries/typescript.ts
19
+ var typescriptQueries = {
20
+ imports: `
21
+ (import_statement
22
+ source: (string) @source
23
+ ) @import
24
+ `,
25
+ exports: `
26
+ (export_statement
27
+ declaration: (function_declaration
28
+ name: (identifier) @name)
29
+ ) @export
30
+
31
+ (export_statement
32
+ declaration: (class_declaration
33
+ name: (type_identifier) @name)
34
+ ) @export
35
+
36
+ (export_statement
37
+ declaration: (interface_declaration
38
+ name: (type_identifier) @name)
39
+ ) @export
40
+
41
+ (export_statement
42
+ declaration: (type_alias_declaration
43
+ name: (type_identifier) @name)
44
+ ) @export
45
+
46
+ (export_statement
47
+ declaration: (enum_declaration
48
+ name: (identifier) @name)
49
+ ) @export
50
+
51
+ (export_statement
52
+ declaration: (lexical_declaration
53
+ (variable_declarator
54
+ name: (identifier) @name))
55
+ ) @export
56
+
57
+ (export_statement
58
+ (export_clause
59
+ (export_specifier
60
+ name: (identifier) @name))
61
+ ) @export
62
+ `,
63
+ functions: `
64
+ (function_declaration
65
+ name: (identifier) @name
66
+ ) @function
67
+
68
+ (lexical_declaration
69
+ (variable_declarator
70
+ name: (identifier) @name
71
+ value: (arrow_function)
72
+ )
73
+ ) @function
74
+ `,
75
+ classes: `
76
+ (class_declaration
77
+ name: (type_identifier) @name
78
+ ) @class
79
+ `,
80
+ interfaces: `
81
+ (interface_declaration
82
+ name: (type_identifier) @name
83
+ ) @interface
84
+ `,
85
+ types: `
86
+ (type_alias_declaration
87
+ name: (type_identifier) @name
88
+ ) @type
89
+
90
+ (enum_declaration
91
+ name: (identifier) @name
92
+ ) @enum
93
+ `
94
+ };
95
+
96
+ // src/tools/getFileStructure/queries/javascript.ts
97
+ var javascriptQueries = {
98
+ imports: `
99
+ (import_statement
100
+ source: (string) @source
101
+ ) @import
102
+ `,
103
+ exports: `
104
+ (export_statement
105
+ declaration: (function_declaration
106
+ name: (identifier) @name)
107
+ ) @export
108
+
109
+ (export_statement
110
+ declaration: (class_declaration
111
+ name: (identifier) @name)
112
+ ) @export
113
+
114
+ (export_statement
115
+ declaration: (lexical_declaration
116
+ (variable_declarator
117
+ name: (identifier) @name))
118
+ ) @export
119
+
120
+ (export_statement
121
+ (export_clause
122
+ (export_specifier
123
+ name: (identifier) @name))
124
+ ) @export
125
+ `,
126
+ functions: `
127
+ (function_declaration
128
+ name: (identifier) @name
129
+ ) @function
130
+
131
+ (lexical_declaration
132
+ (variable_declarator
133
+ name: (identifier) @name
134
+ value: (arrow_function)
135
+ )
136
+ ) @function
137
+ `,
138
+ classes: `
139
+ (class_declaration
140
+ name: (identifier) @name
141
+ ) @class
142
+ `,
143
+ // JavaScript has no interface keyword
144
+ interfaces: "",
145
+ // JavaScript has no type aliases or enums
146
+ types: ""
147
+ };
148
+
149
+ // src/tools/getFileStructure/queries/python.ts
150
+ var pythonQueries = {
151
+ imports: `
152
+ (import_statement
153
+ name: (dotted_name) @source
154
+ ) @import
155
+
156
+ (import_from_statement
157
+ module_name: (dotted_name) @source
158
+ ) @import_from
159
+ `,
160
+ // Python uses __all__ convention, not language-level exports
161
+ exports: "",
162
+ functions: `
163
+ (function_definition
164
+ name: (identifier) @name
165
+ ) @function
166
+ `,
167
+ classes: `
168
+ (class_definition
169
+ name: (identifier) @name
170
+ ) @class
171
+ `,
172
+ // Python has no interface keyword (Protocol is a runtime construct)
173
+ interfaces: "",
174
+ // Python has no type alias syntax at the grammar level
175
+ types: ""
176
+ };
177
+
178
+ // src/tools/getFileStructure/queries/index.ts
179
+ var LANGUAGE_QUERIES = {
180
+ typescript: typescriptQueries,
181
+ tsx: typescriptQueries,
182
+ javascript: javascriptQueries,
183
+ python: pythonQueries
184
+ };
185
+
186
+ // src/tools/getFileStructure/treeSitterEngine.ts
187
+ var require2 = createRequire(import.meta.url);
188
+ var TreeSitter;
189
+ var parserInitialized = false;
190
+ var languageCache = /* @__PURE__ */ new Map();
191
+ function locateTreeSitterWasm() {
192
+ return require2.resolve("web-tree-sitter/tree-sitter.wasm");
193
+ }
194
+ function locateLanguageWasm(language) {
195
+ return require2.resolve(`tree-sitter-wasms/out/tree-sitter-${language}.wasm`);
196
+ }
197
+ async function ensureInitialized() {
198
+ if (parserInitialized) return;
199
+ try {
200
+ const moduleName = "web-tree-sitter";
201
+ TreeSitter = await import(
202
+ /* webpackIgnore: true */
203
+ moduleName
204
+ );
205
+ } catch {
206
+ throw new Error(
207
+ "web-tree-sitter is not available. Install it with: pnpm add web-tree-sitter tree-sitter-wasms --filter @bike4mind/cli"
208
+ );
209
+ }
210
+ const wasmPath = locateTreeSitterWasm();
211
+ const wasmBinary = readFileSync(wasmPath);
212
+ await TreeSitter.Parser.init({
213
+ locateFile: (scriptName) => {
214
+ if (scriptName === "tree-sitter.wasm") {
215
+ return wasmPath;
216
+ }
217
+ return scriptName;
218
+ },
219
+ wasmBinary
220
+ });
221
+ parserInitialized = true;
222
+ }
223
+ async function loadLanguage(languageId) {
224
+ const cached = languageCache.get(languageId);
225
+ if (cached) return cached;
226
+ const wasmPath = locateLanguageWasm(languageId);
227
+ const language = await TreeSitter.Language.load(wasmPath);
228
+ languageCache.set(languageId, language);
229
+ return language;
230
+ }
231
+ function runQuery(language, rootNode, querySource, kind) {
232
+ if (!querySource.trim()) return [];
233
+ const items = [];
234
+ const query = new TreeSitter.Query(language, querySource);
235
+ try {
236
+ const matches = query.matches(rootNode);
237
+ for (const match of matches) {
238
+ const nameCapture = match.captures.find((c) => c.name === "name");
239
+ const sourceCapture = match.captures.find((c) => c.name === "source");
240
+ if (kind === "import") {
241
+ const importCapture = match.captures.find((c) => c.name === "import" || c.name === "import_from");
242
+ const node = importCapture?.node || sourceCapture?.node;
243
+ if (node) {
244
+ items.push({
245
+ kind: "import",
246
+ name: sourceCapture?.node.text.replace(/['"]/g, "") || "",
247
+ line: node.startPosition.row + 1,
248
+ details: node.text
249
+ });
250
+ }
251
+ } else if (nameCapture) {
252
+ items.push({
253
+ kind,
254
+ name: nameCapture.node.text,
255
+ line: nameCapture.node.startPosition.row + 1,
256
+ ...kind === "export" && { exported: true }
257
+ });
258
+ }
259
+ }
260
+ } finally {
261
+ query.delete();
262
+ }
263
+ return items;
264
+ }
265
+ var QUERY_CATEGORIES = [
266
+ ["imports", "import"],
267
+ ["exports", "export"],
268
+ ["functions", "function"],
269
+ ["classes", "class"],
270
+ ["interfaces", "interface"],
271
+ ["types", "type"]
272
+ ];
273
+ async function parseFileStructure(sourceCode, languageId) {
274
+ await ensureInitialized();
275
+ const queries = LANGUAGE_QUERIES[languageId];
276
+ if (!queries) {
277
+ throw new Error(
278
+ `No query definitions for language: ${languageId}. Supported: ${getSupportedLanguages().join(", ")}`
279
+ );
280
+ }
281
+ const language = await loadLanguage(languageId);
282
+ const parser = new TreeSitter.Parser();
283
+ let tree = null;
284
+ try {
285
+ parser.setLanguage(language);
286
+ tree = parser.parse(sourceCode);
287
+ if (!tree) {
288
+ throw new Error("Failed to parse source code");
289
+ }
290
+ const allItems = [];
291
+ for (const [queryKey, kind] of QUERY_CATEGORIES) {
292
+ allItems.push(...runQuery(language, tree.rootNode, queries[queryKey], kind));
293
+ }
294
+ return deduplicateItems(allItems);
295
+ } finally {
296
+ tree?.delete();
297
+ parser.delete();
298
+ }
299
+ }
300
+ function deduplicateItems(items) {
301
+ const exportNames = /* @__PURE__ */ new Set();
302
+ const definitionNames = /* @__PURE__ */ new Set();
303
+ for (const item of items) {
304
+ if (item.kind === "export") {
305
+ exportNames.add(item.name);
306
+ } else if (item.kind !== "import") {
307
+ definitionNames.add(item.name);
308
+ }
309
+ }
310
+ const result = [];
311
+ for (const item of items) {
312
+ if (item.kind === "export" && definitionNames.has(item.name)) continue;
313
+ if (item.kind !== "export" && item.kind !== "import" && exportNames.has(item.name)) {
314
+ item.exported = true;
315
+ }
316
+ result.push(item);
317
+ }
318
+ return result;
319
+ }
320
+ function getSupportedLanguages() {
321
+ return Object.keys(LANGUAGE_QUERIES);
322
+ }
323
+ function getLanguageForExtension(ext) {
324
+ return EXTENSION_TO_LANGUAGE[ext] || null;
325
+ }
326
+ export {
327
+ getLanguageForExtension,
328
+ getSupportedLanguages,
329
+ parseFileStructure
330
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.28",
3
+ "version": "0.2.29-cache-mcp-tools-schema-and-refactor.18845+131a0f301",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -95,10 +95,12 @@
95
95
  "sharp": "^0.34.5",
96
96
  "speakeasy": "^2.0.0",
97
97
  "tiktoken": "^1.0.16",
98
+ "tree-sitter-wasms": "^0.1.13",
98
99
  "turndown": "^7.2.0",
99
100
  "unpdf": "^0.10.0",
100
101
  "uuid": "^9.0.1",
101
102
  "voyageai": "^0.0.4",
103
+ "web-tree-sitter": "0.25.10",
102
104
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
103
105
  "yargs": "^17.7.2",
104
106
  "yauzl": "^3.1.3",
@@ -108,10 +110,10 @@
108
110
  },
109
111
  "devDependencies": {
110
112
  "@bike4mind/agents": "0.1.0",
111
- "@bike4mind/common": "2.50.0",
112
- "@bike4mind/mcp": "1.29.0",
113
- "@bike4mind/services": "2.48.0",
114
- "@bike4mind/utils": "2.5.0",
113
+ "@bike4mind/common": "2.50.1-cache-mcp-tools-schema-and-refactor.18845+131a0f301",
114
+ "@bike4mind/mcp": "1.29.1-cache-mcp-tools-schema-and-refactor.18845+131a0f301",
115
+ "@bike4mind/services": "2.48.1-cache-mcp-tools-schema-and-refactor.18845+131a0f301",
116
+ "@bike4mind/utils": "2.5.1-cache-mcp-tools-schema-and-refactor.18845+131a0f301",
115
117
  "@types/better-sqlite3": "^7.6.13",
116
118
  "@types/diff": "^5.0.9",
117
119
  "@types/jsonwebtoken": "^9.0.4",
@@ -128,5 +130,5 @@
128
130
  "optionalDependencies": {
129
131
  "@vscode/ripgrep": "^1.17.0"
130
132
  },
131
- "gitHead": "28d4afd2bd097efcd751a14cbda1eee68cae2ad2"
133
+ "gitHead": "131a0f301e2a9170b2d207809ee117065b7bf54d"
132
134
  }