@compilr-dev/agents-coding 0.0.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.
Files changed (60) hide show
  1. package/README.md +788 -0
  2. package/dist/index.d.ts +39 -0
  3. package/dist/index.js +75 -0
  4. package/dist/skills/index.d.ts +39 -0
  5. package/dist/skills/index.js +322 -0
  6. package/dist/tools/git/branch.d.ts +17 -0
  7. package/dist/tools/git/branch.js +264 -0
  8. package/dist/tools/git/commit.d.ts +23 -0
  9. package/dist/tools/git/commit.js +280 -0
  10. package/dist/tools/git/diff.d.ts +19 -0
  11. package/dist/tools/git/diff.js +221 -0
  12. package/dist/tools/git/index.d.ts +10 -0
  13. package/dist/tools/git/index.js +11 -0
  14. package/dist/tools/git/log.d.ts +19 -0
  15. package/dist/tools/git/log.js +235 -0
  16. package/dist/tools/git/stash.d.ts +17 -0
  17. package/dist/tools/git/stash.js +294 -0
  18. package/dist/tools/git/status.d.ts +19 -0
  19. package/dist/tools/git/status.js +160 -0
  20. package/dist/tools/git/types.d.ts +293 -0
  21. package/dist/tools/git/types.js +4 -0
  22. package/dist/tools/git/utils.d.ts +58 -0
  23. package/dist/tools/git/utils.js +197 -0
  24. package/dist/tools/index.d.ts +5 -0
  25. package/dist/tools/index.js +5 -0
  26. package/dist/tools/project/detect.d.ts +19 -0
  27. package/dist/tools/project/detect.js +341 -0
  28. package/dist/tools/project/find-root.d.ts +21 -0
  29. package/dist/tools/project/find-root.js +239 -0
  30. package/dist/tools/project/index.d.ts +6 -0
  31. package/dist/tools/project/index.js +5 -0
  32. package/dist/tools/project/types.d.ts +83 -0
  33. package/dist/tools/project/types.js +4 -0
  34. package/dist/tools/runners/build.d.ts +19 -0
  35. package/dist/tools/runners/build.js +306 -0
  36. package/dist/tools/runners/format.d.ts +19 -0
  37. package/dist/tools/runners/format.js +376 -0
  38. package/dist/tools/runners/index.d.ts +9 -0
  39. package/dist/tools/runners/index.js +9 -0
  40. package/dist/tools/runners/lint.d.ts +19 -0
  41. package/dist/tools/runners/lint.js +356 -0
  42. package/dist/tools/runners/test.d.ts +19 -0
  43. package/dist/tools/runners/test.js +386 -0
  44. package/dist/tools/runners/types.d.ts +97 -0
  45. package/dist/tools/runners/types.js +4 -0
  46. package/dist/tools/runners/utils.d.ts +69 -0
  47. package/dist/tools/runners/utils.js +179 -0
  48. package/dist/tools/search/definition.d.ts +19 -0
  49. package/dist/tools/search/definition.js +305 -0
  50. package/dist/tools/search/index.d.ts +8 -0
  51. package/dist/tools/search/index.js +8 -0
  52. package/dist/tools/search/references.d.ts +19 -0
  53. package/dist/tools/search/references.js +179 -0
  54. package/dist/tools/search/todos.d.ts +19 -0
  55. package/dist/tools/search/todos.js +269 -0
  56. package/dist/tools/search/types.d.ts +132 -0
  57. package/dist/tools/search/types.js +4 -0
  58. package/dist/tools/search/utils.d.ts +45 -0
  59. package/dist/tools/search/utils.js +152 -0
  60. package/package.json +88 -0
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Find References Tool
3
+ * Find usages of a symbol using grep with word boundary matching
4
+ */
5
+ import { defineTool, createSuccessResult, createErrorResult } from '@compilr-dev/agents';
6
+ import { escapeRegex, isDirectory, runGrep, getGlobPattern } from './utils.js';
7
+ /**
8
+ * Definition patterns to exclude when excludeDefinitions is true
9
+ */
10
+ const DEFINITION_PATTERNS = [
11
+ // TypeScript/JavaScript
12
+ /^\s*(export\s+)?(async\s+)?function\s+/,
13
+ /^\s*(export\s+)?(abstract\s+)?class\s+/,
14
+ /^\s*(export\s+)?interface\s+/,
15
+ /^\s*(export\s+)?type\s+\w+\s*[=<]/,
16
+ /^\s*(export\s+)?(const|let|var)\s+\w+\s*[=:]/,
17
+ /^\s*(export\s+)?(const\s+)?enum\s+/,
18
+ // Python
19
+ /^\s*(async\s+)?def\s+/,
20
+ /^\s*class\s+\w+\s*[:(]/,
21
+ // Rust
22
+ /^\s*(pub\s+)?(async\s+)?fn\s+/,
23
+ /^\s*(pub\s+)?struct\s+/,
24
+ /^\s*(pub\s+)?enum\s+/,
25
+ /^\s*(pub\s+)?trait\s+/,
26
+ /^\s*(pub\s+)?type\s+/,
27
+ // Go
28
+ /^\s*func\s+(\([^)]+\)\s+)?\w+\s*\(/,
29
+ /^\s*type\s+\w+\s+(struct|interface)/,
30
+ // Java/Kotlin
31
+ /^\s*(public|private|protected)?\s*(abstract|final)?\s*class\s+/,
32
+ /^\s*(public|private)?\s*interface\s+/,
33
+ ];
34
+ /**
35
+ * Check if a line is a definition
36
+ */
37
+ function isDefinitionLine(line, symbol) {
38
+ // Must contain the symbol as a word
39
+ const symbolRegex = new RegExp(`\\b${escapeRegex(symbol)}\\b`);
40
+ if (!symbolRegex.test(line))
41
+ return false;
42
+ // Check against definition patterns
43
+ for (const pattern of DEFINITION_PATTERNS) {
44
+ if (pattern.test(line)) {
45
+ return true;
46
+ }
47
+ }
48
+ return false;
49
+ }
50
+ /**
51
+ * Execute find references
52
+ */
53
+ async function executeFindReferences(input) {
54
+ const targetPath = input.path ?? process.cwd();
55
+ const limit = input.limit ?? 50;
56
+ const excludeDefinitions = input.excludeDefinitions ?? false;
57
+ if (!input.symbol || input.symbol.trim().length === 0) {
58
+ return createErrorResult('Symbol is required');
59
+ }
60
+ if (!(await isDirectory(targetPath))) {
61
+ return createErrorResult(`Directory not found: ${targetPath}`);
62
+ }
63
+ try {
64
+ const glob = getGlobPattern(input.fileType);
65
+ const symbol = input.symbol.trim();
66
+ // Use word boundary matching
67
+ const pattern = `\\b${escapeRegex(symbol)}\\b`;
68
+ // Get more results than needed if filtering definitions
69
+ const searchLimit = excludeDefinitions ? limit * 2 : limit;
70
+ const args = ['-n', '--column', '-w', '--glob', glob, '-e', pattern, '.'];
71
+ const rawResults = await runGrep(args, targetPath, searchLimit, true);
72
+ // Filter results
73
+ let references = rawResults.map((r) => ({
74
+ file: r.file,
75
+ line: r.line,
76
+ column: r.column ?? 1,
77
+ context: r.context.trim(),
78
+ }));
79
+ // Exclude definitions if requested
80
+ if (excludeDefinitions) {
81
+ references = references.filter((ref) => !isDefinitionLine(ref.context, symbol));
82
+ }
83
+ // Apply limit
84
+ const limitedReferences = references.slice(0, limit);
85
+ const result = {
86
+ references: limitedReferences,
87
+ totalFound: references.length,
88
+ symbol,
89
+ };
90
+ return createSuccessResult(result);
91
+ }
92
+ catch (error) {
93
+ return createErrorResult(error instanceof Error ? error.message : String(error));
94
+ }
95
+ }
96
+ /**
97
+ * Find References Tool
98
+ */
99
+ export const findReferencesTool = defineTool({
100
+ name: 'find_references',
101
+ description: 'Find all usages/references of a symbol in the codebase. ' +
102
+ 'Uses word boundary matching for accurate results. ' +
103
+ 'Can exclude definition lines to show only usages.',
104
+ inputSchema: {
105
+ type: 'object',
106
+ properties: {
107
+ symbol: {
108
+ type: 'string',
109
+ description: 'Symbol name to find references for',
110
+ },
111
+ path: {
112
+ type: 'string',
113
+ description: 'Working directory (default: current directory)',
114
+ },
115
+ fileType: {
116
+ type: 'string',
117
+ description: 'File type filter (e.g., ts, py, rs, go)',
118
+ },
119
+ excludeDefinitions: {
120
+ type: 'boolean',
121
+ description: 'Exclude definition lines, show only usages (default: false)',
122
+ },
123
+ limit: {
124
+ type: 'number',
125
+ description: 'Max results (default: 50)',
126
+ },
127
+ },
128
+ required: ['symbol'],
129
+ },
130
+ execute: executeFindReferences,
131
+ });
132
+ /**
133
+ * Factory function to create find references tool with custom options
134
+ */
135
+ export function createFindReferencesTool(options) {
136
+ return defineTool({
137
+ name: 'find_references',
138
+ description: 'Find all usages/references of a symbol in the codebase. ' +
139
+ 'Uses word boundary matching for accurate results.',
140
+ inputSchema: {
141
+ type: 'object',
142
+ properties: {
143
+ symbol: {
144
+ type: 'string',
145
+ description: 'Symbol name to find',
146
+ },
147
+ path: {
148
+ type: 'string',
149
+ description: 'Working directory',
150
+ },
151
+ fileType: {
152
+ type: 'string',
153
+ description: 'File type filter',
154
+ },
155
+ excludeDefinitions: {
156
+ type: 'boolean',
157
+ description: 'Exclude definition lines',
158
+ },
159
+ limit: {
160
+ type: 'number',
161
+ description: 'Max results',
162
+ },
163
+ },
164
+ required: ['symbol'],
165
+ },
166
+ execute: async (input) => {
167
+ let targetPath = input.path ?? '.';
168
+ if (options?.baseDir && !targetPath.startsWith('/')) {
169
+ const nodePath = await import('node:path');
170
+ targetPath = nodePath.join(options.baseDir, targetPath);
171
+ }
172
+ return executeFindReferences({
173
+ ...input,
174
+ path: targetPath,
175
+ limit: input.limit ?? options?.defaultLimit,
176
+ });
177
+ },
178
+ });
179
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Find TODOs Tool
3
+ * Find TODO, FIXME, HACK, XXX, NOTE, BUG, WARN comments in code
4
+ */
5
+ import type { Tool } from '@compilr-dev/agents';
6
+ import type { FindTodosInput } from './types.js';
7
+ /**
8
+ * Find TODOs Tool
9
+ */
10
+ export declare const findTodosTool: Tool<FindTodosInput>;
11
+ /**
12
+ * Factory function to create find todos tool with custom options
13
+ */
14
+ export declare function createFindTodosTool(options?: {
15
+ /** Base directory for relative paths */
16
+ baseDir?: string;
17
+ /** Default limit */
18
+ defaultLimit?: number;
19
+ }): Tool<FindTodosInput>;
@@ -0,0 +1,269 @@
1
+ /**
2
+ * Find TODOs Tool
3
+ * Find TODO, FIXME, HACK, XXX, NOTE, BUG, WARN comments in code
4
+ */
5
+ import { defineTool, createSuccessResult, createErrorResult } from '@compilr-dev/agents';
6
+ import { spawn } from 'node:child_process';
7
+ import { isDirectory, getGlobPattern, SEARCH_TIMEOUT } from './utils.js';
8
+ /**
9
+ * All supported TODO types
10
+ */
11
+ const ALL_TODO_TYPES = ['TODO', 'FIXME', 'HACK', 'XXX', 'NOTE', 'BUG', 'WARN'];
12
+ /**
13
+ * Build regex pattern for TODO types
14
+ */
15
+ function buildTodoPattern(types) {
16
+ // Match: // TODO: text, # TODO text, /* TODO */, etc.
17
+ // Pattern: (TODO|FIXME|...)[:\s](.*)
18
+ const typePattern = types.join('|');
19
+ return `(${typePattern})[:\\s]`;
20
+ }
21
+ /**
22
+ * Parse TODO type from matched line
23
+ */
24
+ function parseTodoType(line, types) {
25
+ const upperLine = line.toUpperCase();
26
+ for (const type of types) {
27
+ if (upperLine.includes(type)) {
28
+ return type;
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+ /**
34
+ * Extract TODO text from line
35
+ */
36
+ function extractTodoText(line, todoType) {
37
+ // Find the TODO keyword and extract everything after it
38
+ const upperLine = line.toUpperCase();
39
+ const idx = upperLine.indexOf(todoType);
40
+ if (idx === -1)
41
+ return line.trim();
42
+ let text = line.slice(idx + todoType.length);
43
+ // Remove common prefix characters: :, -, (, [
44
+ text = text.replace(/^[\s:*\-([]+/, '');
45
+ // Remove trailing comment closers
46
+ text = text.replace(/\s*\*\/\s*$/, '');
47
+ text = text.replace(/\s*-->\s*$/, '');
48
+ return text.trim();
49
+ }
50
+ /**
51
+ * Run grep to find TODOs (case-insensitive search)
52
+ */
53
+ function runTodoGrep(pattern, cwd, glob, limit) {
54
+ return new Promise((resolve) => {
55
+ const results = [];
56
+ const args = [
57
+ '-n', // line numbers
58
+ '-i', // case insensitive for TODOs
59
+ '--glob',
60
+ glob,
61
+ '-e',
62
+ pattern,
63
+ '.',
64
+ ];
65
+ const proc = spawn('rg', args, { cwd });
66
+ let stdout = '';
67
+ let timedOut = false;
68
+ const timeout = setTimeout(() => {
69
+ timedOut = true;
70
+ proc.kill();
71
+ }, SEARCH_TIMEOUT);
72
+ proc.stdout.on('data', (data) => {
73
+ stdout += data.toString();
74
+ });
75
+ proc.on('close', () => {
76
+ clearTimeout(timeout);
77
+ if (timedOut) {
78
+ resolve(results);
79
+ return;
80
+ }
81
+ // Parse ripgrep output: file:line:content
82
+ const lines = stdout.split('\n').filter(Boolean);
83
+ for (const line of lines) {
84
+ if (results.length >= limit)
85
+ break;
86
+ const match = line.match(/^([^:]+):(\d+):(.*)$/);
87
+ if (match) {
88
+ results.push({
89
+ file: match[1],
90
+ line: parseInt(match[2], 10),
91
+ context: match[3],
92
+ });
93
+ }
94
+ }
95
+ resolve(results);
96
+ });
97
+ proc.on('error', () => {
98
+ clearTimeout(timeout);
99
+ resolve(results);
100
+ });
101
+ });
102
+ }
103
+ /**
104
+ * Get git blame author for a line (optional)
105
+ */
106
+ async function getGitBlameAuthor(file, line, cwd) {
107
+ return new Promise((resolve) => {
108
+ const args = ['-L', `${String(line)},${String(line)}`, '--porcelain', file];
109
+ const proc = spawn('git', ['blame', ...args], {
110
+ cwd,
111
+ shell: true,
112
+ });
113
+ let stdout = '';
114
+ const timeout = setTimeout(() => {
115
+ proc.kill();
116
+ resolve(undefined);
117
+ }, 5000);
118
+ proc.stdout.on('data', (data) => {
119
+ stdout += data.toString();
120
+ });
121
+ proc.on('close', () => {
122
+ clearTimeout(timeout);
123
+ // Parse porcelain format for author
124
+ const authorMatch = stdout.match(/^author (.+)$/m);
125
+ resolve(authorMatch ? authorMatch[1] : undefined);
126
+ });
127
+ proc.on('error', () => {
128
+ clearTimeout(timeout);
129
+ resolve(undefined);
130
+ });
131
+ });
132
+ }
133
+ /**
134
+ * Execute find todos
135
+ */
136
+ async function executeFindTodos(input) {
137
+ const targetPath = input.path ?? process.cwd();
138
+ const limit = input.limit ?? 100;
139
+ const types = input.types ?? ALL_TODO_TYPES;
140
+ const includeAuthor = input.includeAuthor ?? false;
141
+ if (!(await isDirectory(targetPath))) {
142
+ return createErrorResult(`Directory not found: ${targetPath}`);
143
+ }
144
+ try {
145
+ const glob = getGlobPattern(input.fileType);
146
+ const pattern = buildTodoPattern(types);
147
+ const rawResults = await runTodoGrep(pattern, targetPath, glob, limit);
148
+ // Process results
149
+ const todos = [];
150
+ const summary = {};
151
+ for (const raw of rawResults) {
152
+ const todoType = parseTodoType(raw.context, types);
153
+ if (!todoType)
154
+ continue;
155
+ const text = extractTodoText(raw.context, todoType);
156
+ const todo = {
157
+ type: todoType,
158
+ file: raw.file,
159
+ line: raw.line,
160
+ text,
161
+ };
162
+ // Get author if requested (slow, so only for small result sets)
163
+ if (includeAuthor && todos.length < 20) {
164
+ todo.author = await getGitBlameAuthor(raw.file, raw.line, targetPath);
165
+ }
166
+ todos.push(todo);
167
+ // Update summary
168
+ summary[todoType] = (summary[todoType] ?? 0) + 1;
169
+ }
170
+ const result = {
171
+ todos,
172
+ summary,
173
+ totalFound: todos.length,
174
+ };
175
+ return createSuccessResult(result);
176
+ }
177
+ catch (error) {
178
+ return createErrorResult(error instanceof Error ? error.message : String(error));
179
+ }
180
+ }
181
+ /**
182
+ * Find TODOs Tool
183
+ */
184
+ export const findTodosTool = defineTool({
185
+ name: 'find_todos',
186
+ description: 'Find TODO, FIXME, HACK, XXX, NOTE, BUG, WARN comments in code. ' +
187
+ 'Returns a summary count by type and individual locations. ' +
188
+ 'Can optionally include git blame author info.',
189
+ inputSchema: {
190
+ type: 'object',
191
+ properties: {
192
+ path: {
193
+ type: 'string',
194
+ description: 'Working directory (default: current directory)',
195
+ },
196
+ types: {
197
+ type: 'array',
198
+ items: {
199
+ type: 'string',
200
+ enum: ['TODO', 'FIXME', 'HACK', 'XXX', 'NOTE', 'BUG', 'WARN'],
201
+ },
202
+ description: 'Comment types to find (default: all)',
203
+ },
204
+ fileType: {
205
+ type: 'string',
206
+ description: 'File type filter (e.g., ts, py, rs, go)',
207
+ },
208
+ includeAuthor: {
209
+ type: 'boolean',
210
+ description: 'Include git blame author info (slower)',
211
+ },
212
+ limit: {
213
+ type: 'number',
214
+ description: 'Max results (default: 100)',
215
+ },
216
+ },
217
+ required: [],
218
+ },
219
+ execute: executeFindTodos,
220
+ });
221
+ /**
222
+ * Factory function to create find todos tool with custom options
223
+ */
224
+ export function createFindTodosTool(options) {
225
+ return defineTool({
226
+ name: 'find_todos',
227
+ description: 'Find TODO, FIXME, HACK, XXX, NOTE, BUG, WARN comments in code. ' +
228
+ 'Returns a summary count by type and individual locations.',
229
+ inputSchema: {
230
+ type: 'object',
231
+ properties: {
232
+ path: {
233
+ type: 'string',
234
+ description: 'Working directory',
235
+ },
236
+ types: {
237
+ type: 'array',
238
+ items: { type: 'string' },
239
+ description: 'Comment types to find',
240
+ },
241
+ fileType: {
242
+ type: 'string',
243
+ description: 'File type filter',
244
+ },
245
+ includeAuthor: {
246
+ type: 'boolean',
247
+ description: 'Include git blame author',
248
+ },
249
+ limit: {
250
+ type: 'number',
251
+ description: 'Max results',
252
+ },
253
+ },
254
+ required: [],
255
+ },
256
+ execute: async (input) => {
257
+ let targetPath = input.path ?? '.';
258
+ if (options?.baseDir && !targetPath.startsWith('/')) {
259
+ const nodePath = await import('node:path');
260
+ targetPath = nodePath.join(options.baseDir, targetPath);
261
+ }
262
+ return executeFindTodos({
263
+ ...input,
264
+ path: targetPath,
265
+ limit: input.limit ?? options?.defaultLimit,
266
+ });
267
+ },
268
+ });
269
+ }
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Types for Code Search Tools
3
+ */
4
+ /**
5
+ * Definition type detected from code pattern
6
+ */
7
+ export type DefinitionType = 'function' | 'class' | 'variable' | 'const' | 'let' | 'type' | 'interface' | 'enum' | 'method' | 'property' | 'unknown';
8
+ /**
9
+ * A found definition location
10
+ */
11
+ export interface Definition {
12
+ /** File path */
13
+ file: string;
14
+ /** Line number (1-indexed) */
15
+ line: number;
16
+ /** Column number (1-indexed) */
17
+ column: number;
18
+ /** Line content */
19
+ context: string;
20
+ /** Type of definition */
21
+ type: DefinitionType;
22
+ /** Export status */
23
+ isExported?: boolean;
24
+ }
25
+ /**
26
+ * Input for findDefinitionTool
27
+ */
28
+ export interface FindDefinitionInput {
29
+ /** Symbol to find */
30
+ symbol: string;
31
+ /** Working directory (default: cwd) */
32
+ path?: string;
33
+ /** File type filter (e.g., 'ts', 'py', 'rs') */
34
+ fileType?: string;
35
+ /** Max results (default: 20) */
36
+ limit?: number;
37
+ }
38
+ /**
39
+ * Result from findDefinitionTool
40
+ */
41
+ export interface FindDefinitionResult {
42
+ /** Found definitions */
43
+ definitions: Definition[];
44
+ /** Total matches found (may be more than returned) */
45
+ totalFound: number;
46
+ /** Symbol searched for */
47
+ symbol: string;
48
+ }
49
+ /**
50
+ * A found reference location
51
+ */
52
+ export interface Reference {
53
+ /** File path */
54
+ file: string;
55
+ /** Line number (1-indexed) */
56
+ line: number;
57
+ /** Column number (1-indexed) */
58
+ column: number;
59
+ /** Line content */
60
+ context: string;
61
+ }
62
+ /**
63
+ * Input for findReferencesTool
64
+ */
65
+ export interface FindReferencesInput {
66
+ /** Symbol to find */
67
+ symbol: string;
68
+ /** Working directory (default: cwd) */
69
+ path?: string;
70
+ /** File type filter (e.g., 'ts', 'py', 'rs') */
71
+ fileType?: string;
72
+ /** Exclude definition lines (default: false) */
73
+ excludeDefinitions?: boolean;
74
+ /** Max results (default: 50) */
75
+ limit?: number;
76
+ }
77
+ /**
78
+ * Result from findReferencesTool
79
+ */
80
+ export interface FindReferencesResult {
81
+ /** Found references */
82
+ references: Reference[];
83
+ /** Total matches found (may be more than returned) */
84
+ totalFound: number;
85
+ /** Symbol searched for */
86
+ symbol: string;
87
+ }
88
+ /**
89
+ * TODO comment type
90
+ */
91
+ export type TodoType = 'TODO' | 'FIXME' | 'HACK' | 'XXX' | 'NOTE' | 'BUG' | 'WARN';
92
+ /**
93
+ * A found TODO comment
94
+ */
95
+ export interface TodoComment {
96
+ /** TODO type */
97
+ type: TodoType;
98
+ /** File path */
99
+ file: string;
100
+ /** Line number (1-indexed) */
101
+ line: number;
102
+ /** TODO text content */
103
+ text: string;
104
+ /** Author (from git blame, if requested) */
105
+ author?: string;
106
+ }
107
+ /**
108
+ * Input for findTodosTool
109
+ */
110
+ export interface FindTodosInput {
111
+ /** Working directory (default: cwd) */
112
+ path?: string;
113
+ /** Comment types to find (default: all) */
114
+ types?: TodoType[];
115
+ /** File type filter (e.g., 'ts', 'py', 'rs') */
116
+ fileType?: string;
117
+ /** Include author info via git blame (slower) */
118
+ includeAuthor?: boolean;
119
+ /** Max results (default: 100) */
120
+ limit?: number;
121
+ }
122
+ /**
123
+ * Result from findTodosTool
124
+ */
125
+ export interface FindTodosResult {
126
+ /** Found TODO comments */
127
+ todos: TodoComment[];
128
+ /** Summary count by type */
129
+ summary: Partial<Record<TodoType, number>>;
130
+ /** Total found */
131
+ totalFound: number;
132
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Types for Code Search Tools
3
+ */
4
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Shared utilities for Code Search tools
3
+ */
4
+ /**
5
+ * File extensions by language type (canonical source)
6
+ */
7
+ export declare const FILE_TYPE_EXTENSIONS: Record<string, string[]>;
8
+ /**
9
+ * All source file extensions (for default glob patterns)
10
+ */
11
+ export declare const ALL_SOURCE_EXTENSIONS: string[];
12
+ /**
13
+ * Default timeout for search operations (30 seconds)
14
+ */
15
+ export declare const SEARCH_TIMEOUT = 30000;
16
+ /**
17
+ * Escape special regex characters
18
+ */
19
+ export declare function escapeRegex(str: string): string;
20
+ /**
21
+ * Get glob pattern for file type filtering
22
+ */
23
+ export declare function getGlobPattern(fileType?: string, extensions?: string[]): string;
24
+ /**
25
+ * Check if path is a directory
26
+ */
27
+ export declare function isDirectory(path: string): Promise<boolean>;
28
+ /**
29
+ * Ripgrep result with file, line, column, and context
30
+ */
31
+ export interface GrepResult {
32
+ file: string;
33
+ line: number;
34
+ column?: number;
35
+ context: string;
36
+ }
37
+ /**
38
+ * Run ripgrep and parse results
39
+ *
40
+ * @param args - ripgrep arguments (without the command itself)
41
+ * @param cwd - working directory
42
+ * @param limit - maximum results to return
43
+ * @param includeColumn - whether to parse column from output
44
+ */
45
+ export declare function runGrep(args: string[], cwd: string, limit: number, includeColumn?: boolean): Promise<GrepResult[]>;