grok-cli-hurry-mode 1.0.1 → 1.0.2

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.
@@ -0,0 +1,121 @@
1
+ import { ToolResult } from "../../types/index.js";
2
+ import { SymbolInfo } from "./ast-parser.js";
3
+ export interface SymbolReference {
4
+ symbol: SymbolInfo;
5
+ filePath: string;
6
+ usages: SymbolUsage[];
7
+ }
8
+ export interface SymbolUsage {
9
+ line: number;
10
+ column: number;
11
+ context: string;
12
+ type: 'definition' | 'call' | 'reference' | 'import' | 'export';
13
+ }
14
+ export interface SearchResult {
15
+ query: string;
16
+ totalMatches: number;
17
+ symbols: SymbolReference[];
18
+ searchTime: number;
19
+ scope: {
20
+ filesSearched: number;
21
+ symbolsIndexed: number;
22
+ };
23
+ }
24
+ export interface CrossReference {
25
+ symbol: string;
26
+ definitionFile: string;
27
+ usageFiles: string[];
28
+ importedBy: string[];
29
+ exportedTo: string[];
30
+ }
31
+ export declare class SymbolSearchTool {
32
+ name: string;
33
+ description: string;
34
+ private astParser;
35
+ private symbolIndex;
36
+ private lastIndexTime;
37
+ private indexCacheDuration;
38
+ constructor();
39
+ execute(args: any): Promise<ToolResult>;
40
+ private shouldRebuildIndex;
41
+ private buildSymbolIndex;
42
+ private searchSymbols;
43
+ private findSymbolUsages;
44
+ private getUniqueFiles;
45
+ findCrossReferences(symbolName: string, searchPath?: string): Promise<CrossReference[]>;
46
+ findSimilarSymbols(symbolName: string, threshold?: number): Promise<SymbolReference[]>;
47
+ getSymbolsByType(symbolType: string, searchPath?: string): Promise<SymbolReference[]>;
48
+ clearIndex(): void;
49
+ getIndexStats(): {
50
+ symbolCount: number;
51
+ fileCount: number;
52
+ lastUpdated: Date;
53
+ };
54
+ getSchema(): {
55
+ type: string;
56
+ properties: {
57
+ query: {
58
+ type: string;
59
+ description: string;
60
+ };
61
+ searchPath: {
62
+ type: string;
63
+ description: string;
64
+ default: string;
65
+ };
66
+ symbolTypes: {
67
+ type: string;
68
+ items: {
69
+ type: string;
70
+ enum: string[];
71
+ };
72
+ description: string;
73
+ default: string[];
74
+ };
75
+ includeUsages: {
76
+ type: string;
77
+ description: string;
78
+ default: boolean;
79
+ };
80
+ fuzzyMatch: {
81
+ type: string;
82
+ description: string;
83
+ default: boolean;
84
+ };
85
+ caseSensitive: {
86
+ type: string;
87
+ description: string;
88
+ default: boolean;
89
+ };
90
+ maxResults: {
91
+ type: string;
92
+ description: string;
93
+ default: number;
94
+ minimum: number;
95
+ maximum: number;
96
+ };
97
+ filePatterns: {
98
+ type: string;
99
+ items: {
100
+ type: string;
101
+ };
102
+ description: string;
103
+ default: string[];
104
+ };
105
+ excludePatterns: {
106
+ type: string;
107
+ items: {
108
+ type: string;
109
+ };
110
+ description: string;
111
+ default: string[];
112
+ };
113
+ indexCache: {
114
+ type: string;
115
+ description: string;
116
+ default: boolean;
117
+ };
118
+ };
119
+ required: string[];
120
+ };
121
+ }
@@ -0,0 +1,336 @@
1
+ import { ASTParserTool } from "./ast-parser.js";
2
+ import Fuse from "fuse.js";
3
+ import fs from "fs-extra";
4
+ import { glob } from "glob";
5
+ export class SymbolSearchTool {
6
+ constructor() {
7
+ this.name = "symbol_search";
8
+ this.description = "Search for symbols (functions, classes, variables) across the codebase with fuzzy matching and cross-references";
9
+ this.symbolIndex = new Map();
10
+ this.lastIndexTime = 0;
11
+ this.indexCacheDuration = 5 * 60 * 1000; // 5 minutes
12
+ this.astParser = new ASTParserTool();
13
+ }
14
+ async execute(args) {
15
+ try {
16
+ const { query, searchPath = process.cwd(), symbolTypes = ['function', 'class', 'variable', 'interface', 'enum', 'type'], includeUsages = false, fuzzyMatch = true, caseSensitive = false, maxResults = 50, filePatterns = ['**/*.{ts,tsx,js,jsx,py}'], excludePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'], indexCache = true } = args;
17
+ if (!query) {
18
+ throw new Error("Search query is required");
19
+ }
20
+ const startTime = Date.now();
21
+ // Build or refresh symbol index
22
+ if (!indexCache || this.shouldRebuildIndex()) {
23
+ await this.buildSymbolIndex(searchPath, filePatterns, excludePatterns, symbolTypes);
24
+ }
25
+ // Perform search
26
+ const results = await this.searchSymbols(query, symbolTypes, fuzzyMatch, caseSensitive, maxResults, includeUsages);
27
+ const searchTime = Date.now() - startTime;
28
+ return {
29
+ success: true,
30
+ output: JSON.stringify({
31
+ ...results,
32
+ searchTime
33
+ }, null, 2)
34
+ };
35
+ }
36
+ catch (error) {
37
+ return {
38
+ success: false,
39
+ error: error instanceof Error ? error.message : String(error)
40
+ };
41
+ }
42
+ }
43
+ shouldRebuildIndex() {
44
+ return Date.now() - this.lastIndexTime > this.indexCacheDuration;
45
+ }
46
+ async buildSymbolIndex(searchPath, filePatterns, excludePatterns, symbolTypes) {
47
+ this.symbolIndex.clear();
48
+ // Find all source files
49
+ const allFiles = [];
50
+ for (const pattern of filePatterns) {
51
+ const files = await glob(pattern, {
52
+ cwd: searchPath,
53
+ absolute: true,
54
+ ignore: excludePatterns
55
+ });
56
+ allFiles.push(...files);
57
+ }
58
+ // Parse each file and extract symbols
59
+ for (const filePath of allFiles) {
60
+ try {
61
+ const parseResult = await this.astParser.execute({
62
+ filePath,
63
+ includeSymbols: true,
64
+ includeImports: false,
65
+ includeTree: false,
66
+ symbolTypes
67
+ });
68
+ if (!parseResult.success || !parseResult.output)
69
+ continue;
70
+ const parsed = JSON.parse(parseResult.output);
71
+ if (parsed.success && parsed.result.symbols) {
72
+ const symbols = parsed.result.symbols;
73
+ for (const symbol of symbols) {
74
+ const symbolRef = {
75
+ symbol,
76
+ filePath,
77
+ usages: []
78
+ };
79
+ // Index by symbol name
80
+ const existing = this.symbolIndex.get(symbol.name) || [];
81
+ existing.push(symbolRef);
82
+ this.symbolIndex.set(symbol.name, existing);
83
+ // Index by type for broader searches
84
+ const typeKey = `type:${symbol.type}`;
85
+ const typeExisting = this.symbolIndex.get(typeKey) || [];
86
+ typeExisting.push(symbolRef);
87
+ this.symbolIndex.set(typeKey, typeExisting);
88
+ }
89
+ }
90
+ }
91
+ catch (error) {
92
+ // Skip files that can't be parsed
93
+ console.warn(`Failed to parse ${filePath}: ${error}`);
94
+ }
95
+ }
96
+ this.lastIndexTime = Date.now();
97
+ }
98
+ async searchSymbols(query, symbolTypes, fuzzyMatch, caseSensitive, maxResults, includeUsages) {
99
+ const allSymbols = [];
100
+ // Collect all indexed symbols
101
+ for (const refs of this.symbolIndex.values()) {
102
+ allSymbols.push(...refs);
103
+ }
104
+ // Filter by symbol types
105
+ const filteredSymbols = allSymbols.filter(ref => symbolTypes.includes(ref.symbol.type));
106
+ let matches = [];
107
+ if (fuzzyMatch) {
108
+ // Use Fuse.js for fuzzy searching
109
+ const fuse = new Fuse(filteredSymbols, {
110
+ keys: [
111
+ { name: 'symbol.name', weight: 0.7 },
112
+ { name: 'symbol.type', weight: 0.2 },
113
+ { name: 'filePath', weight: 0.1 }
114
+ ],
115
+ threshold: 0.4,
116
+ includeScore: true,
117
+ includeMatches: true,
118
+ isCaseSensitive: caseSensitive
119
+ });
120
+ const fuseResults = fuse.search(query);
121
+ matches = fuseResults.map(result => result.item);
122
+ }
123
+ else {
124
+ // Exact string matching
125
+ const queryLower = caseSensitive ? query : query.toLowerCase();
126
+ matches = filteredSymbols.filter(ref => {
127
+ const symbolName = caseSensitive ? ref.symbol.name : ref.symbol.name.toLowerCase();
128
+ return symbolName.includes(queryLower);
129
+ });
130
+ }
131
+ // Limit results
132
+ matches = matches.slice(0, maxResults);
133
+ // Optionally find usages
134
+ if (includeUsages) {
135
+ for (const match of matches) {
136
+ match.usages = await this.findSymbolUsages(match);
137
+ }
138
+ }
139
+ return {
140
+ query,
141
+ totalMatches: matches.length,
142
+ symbols: matches,
143
+ searchTime: 0, // Will be set by caller
144
+ scope: {
145
+ filesSearched: this.getUniqueFiles(allSymbols).length,
146
+ symbolsIndexed: allSymbols.length
147
+ }
148
+ };
149
+ }
150
+ async findSymbolUsages(symbolRef) {
151
+ const usages = [];
152
+ try {
153
+ const content = await fs.readFile(symbolRef.filePath, 'utf-8');
154
+ const lines = content.split('\n');
155
+ // Simple text-based usage finding
156
+ // TODO: Use AST analysis for more accurate results
157
+ for (let i = 0; i < lines.length; i++) {
158
+ const line = lines[i];
159
+ const symbolName = symbolRef.symbol.name;
160
+ let index = 0;
161
+ while ((index = line.indexOf(symbolName, index)) !== -1) {
162
+ // Skip if this is the definition itself
163
+ if (i === symbolRef.symbol.startPosition.row) {
164
+ index += symbolName.length;
165
+ continue;
166
+ }
167
+ // Determine usage type based on context
168
+ let usageType = 'reference';
169
+ if (line.includes('import') && line.includes(symbolName)) {
170
+ usageType = 'import';
171
+ }
172
+ else if (line.includes('export') && line.includes(symbolName)) {
173
+ usageType = 'export';
174
+ }
175
+ else if (line.includes(symbolName + '(')) {
176
+ usageType = 'call';
177
+ }
178
+ usages.push({
179
+ line: i,
180
+ column: index,
181
+ context: line.trim(),
182
+ type: usageType
183
+ });
184
+ index += symbolName.length;
185
+ }
186
+ }
187
+ }
188
+ catch (error) {
189
+ // Skip if file can't be read
190
+ }
191
+ return usages;
192
+ }
193
+ getUniqueFiles(symbols) {
194
+ const files = new Set(symbols.map(ref => ref.filePath));
195
+ return Array.from(files);
196
+ }
197
+ async findCrossReferences(symbolName, searchPath = process.cwd()) {
198
+ const crossRefs = [];
199
+ // Find all occurrences of the symbol
200
+ const searchResult = await this.execute({
201
+ query: symbolName,
202
+ searchPath,
203
+ includeUsages: true,
204
+ fuzzyMatch: false,
205
+ caseSensitive: true
206
+ });
207
+ if (!searchResult.success || !searchResult.output)
208
+ return [];
209
+ const parsed = JSON.parse(searchResult.output);
210
+ if (parsed.success && parsed.result.symbols) {
211
+ const symbols = parsed.result.symbols;
212
+ for (const symbolRef of symbols) {
213
+ if (symbolRef.symbol.name === symbolName) {
214
+ const definitionFile = symbolRef.filePath;
215
+ const usageFiles = symbolRef.usages
216
+ .filter(usage => usage.type === 'reference' || usage.type === 'call')
217
+ .map(() => symbolRef.filePath); // Simplified - should check other files
218
+ const importedBy = symbolRef.usages
219
+ .filter(usage => usage.type === 'import')
220
+ .map(() => symbolRef.filePath);
221
+ const exportedTo = symbolRef.usages
222
+ .filter(usage => usage.type === 'export')
223
+ .map(() => symbolRef.filePath);
224
+ crossRefs.push({
225
+ symbol: symbolName,
226
+ definitionFile,
227
+ usageFiles: [...new Set(usageFiles)],
228
+ importedBy: [...new Set(importedBy)],
229
+ exportedTo: [...new Set(exportedTo)]
230
+ });
231
+ }
232
+ }
233
+ }
234
+ return crossRefs;
235
+ }
236
+ async findSimilarSymbols(symbolName, threshold = 0.6) {
237
+ const allSymbols = [];
238
+ for (const refs of this.symbolIndex.values()) {
239
+ allSymbols.push(...refs);
240
+ }
241
+ const fuse = new Fuse(allSymbols, {
242
+ keys: ['symbol.name'],
243
+ threshold,
244
+ includeScore: true
245
+ });
246
+ const results = fuse.search(symbolName);
247
+ return results.map(result => result.item);
248
+ }
249
+ async getSymbolsByType(symbolType, searchPath = process.cwd()) {
250
+ if (!this.symbolIndex.has(`type:${symbolType}`)) {
251
+ await this.buildSymbolIndex(searchPath, ['**/*.{ts,tsx,js,jsx,py}'], ['**/node_modules/**', '**/dist/**', '**/.git/**'], [symbolType]);
252
+ }
253
+ return this.symbolIndex.get(`type:${symbolType}`) || [];
254
+ }
255
+ clearIndex() {
256
+ this.symbolIndex.clear();
257
+ this.lastIndexTime = 0;
258
+ }
259
+ getIndexStats() {
260
+ const allSymbols = [];
261
+ for (const refs of this.symbolIndex.values()) {
262
+ allSymbols.push(...refs);
263
+ }
264
+ return {
265
+ symbolCount: allSymbols.length,
266
+ fileCount: this.getUniqueFiles(allSymbols).length,
267
+ lastUpdated: new Date(this.lastIndexTime)
268
+ };
269
+ }
270
+ getSchema() {
271
+ return {
272
+ type: "object",
273
+ properties: {
274
+ query: {
275
+ type: "string",
276
+ description: "Search query for symbol names"
277
+ },
278
+ searchPath: {
279
+ type: "string",
280
+ description: "Root path to search in",
281
+ default: "current working directory"
282
+ },
283
+ symbolTypes: {
284
+ type: "array",
285
+ items: {
286
+ type: "string",
287
+ enum: ["function", "class", "variable", "interface", "enum", "type", "method", "property"]
288
+ },
289
+ description: "Types of symbols to search for",
290
+ default: ["function", "class", "variable", "interface", "enum", "type"]
291
+ },
292
+ includeUsages: {
293
+ type: "boolean",
294
+ description: "Whether to find usages of matched symbols",
295
+ default: false
296
+ },
297
+ fuzzyMatch: {
298
+ type: "boolean",
299
+ description: "Use fuzzy matching for symbol names",
300
+ default: true
301
+ },
302
+ caseSensitive: {
303
+ type: "boolean",
304
+ description: "Case sensitive search",
305
+ default: false
306
+ },
307
+ maxResults: {
308
+ type: "integer",
309
+ description: "Maximum number of results to return",
310
+ default: 50,
311
+ minimum: 1,
312
+ maximum: 1000
313
+ },
314
+ filePatterns: {
315
+ type: "array",
316
+ items: { type: "string" },
317
+ description: "Glob patterns for files to search",
318
+ default: ["**/*.{ts,tsx,js,jsx,py}"]
319
+ },
320
+ excludePatterns: {
321
+ type: "array",
322
+ items: { type: "string" },
323
+ description: "Glob patterns for files to exclude",
324
+ default: ["**/node_modules/**", "**/dist/**", "**/.git/**"]
325
+ },
326
+ indexCache: {
327
+ type: "boolean",
328
+ description: "Use cached symbol index if available",
329
+ default: true
330
+ }
331
+ },
332
+ required: ["query"]
333
+ };
334
+ }
335
+ }
336
+ //# sourceMappingURL=symbol-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-search.js","sourceRoot":"","sources":["../../../src/tools/intelligence/symbol-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAsC,MAAM,iBAAiB,CAAC;AACpF,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAkC5B,MAAM,OAAO,gBAAgB;IAS3B;QARA,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,iHAAiH,CAAC;QAGxH,gBAAW,GAAmC,IAAI,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V,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,sCAAsC;oBACnD,OAAO,EAAE,IAAI;iBACd;aACF;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "grok-cli-hurry-mode",
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "description": "An open-source AI agent that brings the power of Grok directly into your terminal.",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
@@ -35,20 +35,30 @@
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
37
  "@modelcontextprotocol/sdk": "^1.17.0",
38
+ "@types/marked-terminal": "^6.1.1",
39
+ "@typescript-eslint/typescript-estree": "^8.46.0",
38
40
  "axios": "^1.7.0",
39
41
  "cfonts": "^3.3.0",
40
42
  "chalk": "^5.3.0",
43
+ "chokidar": "^4.0.3",
44
+ "cli-highlight": "^2.1.11",
41
45
  "commander": "^12.0.0",
42
46
  "dotenv": "^16.4.0",
43
47
  "enquirer": "^2.4.1",
44
48
  "fs-extra": "^11.2.0",
49
+ "fuse.js": "^7.1.0",
50
+ "glob": "^11.0.3",
45
51
  "ink": "^4.4.1",
46
52
  "marked": "^15.0.12",
47
53
  "marked-terminal": "^7.3.0",
48
54
  "openai": "^5.10.1",
49
55
  "react": "^18.3.1",
50
56
  "ripgrep-node": "^1.0.0",
51
- "tiktoken": "^1.0.21"
57
+ "tiktoken": "^1.0.21",
58
+ "tree-sitter": "^0.25.0",
59
+ "tree-sitter-javascript": "^0.25.0",
60
+ "tree-sitter-python": "^0.25.0",
61
+ "tree-sitter-typescript": "^0.23.2"
52
62
  },
53
63
  "devDependencies": {
54
64
  "@eslint/js": "^9.37.0",
@@ -80,5 +90,9 @@
80
90
  ],
81
91
  "publishConfig": {
82
92
  "access": "public"
83
- }
93
+ },
94
+ "trustedDependencies": [
95
+ "tree-sitter-javascript",
96
+ "tree-sitter-python"
97
+ ]
84
98
  }