@nanocollective/nanocoder 1.16.2 → 1.16.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/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +35 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/components/assistant-message.d.ts +1 -4
- package/dist/components/assistant-message.d.ts.map +1 -1
- package/dist/components/assistant-message.js +1 -199
- package/dist/components/assistant-message.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +13 -5
- package/dist/config/index.js.map +1 -1
- package/dist/config/paths.d.ts.map +1 -1
- package/dist/config/paths.js +23 -2
- package/dist/config/paths.js.map +1 -1
- package/dist/hooks/useAppState.d.ts.map +1 -1
- package/dist/hooks/useAppState.js +8 -15
- package/dist/hooks/useAppState.js.map +1 -1
- package/dist/hooks/useTerminalWidth.d.ts.map +1 -1
- package/dist/hooks/useTerminalWidth.js +6 -0
- package/dist/hooks/useTerminalWidth.js.map +1 -1
- package/dist/markdown-parser/html-entities.d.ts +2 -0
- package/dist/markdown-parser/html-entities.d.ts.map +1 -0
- package/dist/markdown-parser/html-entities.js +41 -0
- package/dist/markdown-parser/html-entities.js.map +1 -0
- package/dist/markdown-parser/html-entities.spec.d.ts +2 -0
- package/dist/markdown-parser/html-entities.spec.d.ts.map +1 -0
- package/dist/markdown-parser/html-entities.spec.js +73 -0
- package/dist/markdown-parser/html-entities.spec.js.map +1 -0
- package/dist/markdown-parser/index.d.ts +6 -0
- package/dist/markdown-parser/index.d.ts.map +1 -0
- package/dist/markdown-parser/index.js +97 -0
- package/dist/markdown-parser/index.js.map +1 -0
- package/dist/markdown-parser/index.spec.d.ts +2 -0
- package/dist/markdown-parser/index.spec.d.ts.map +1 -0
- package/dist/markdown-parser/index.spec.js +245 -0
- package/dist/markdown-parser/index.spec.js.map +1 -0
- package/dist/markdown-parser/table-parser.d.ts +3 -0
- package/dist/markdown-parser/table-parser.d.ts.map +1 -0
- package/dist/markdown-parser/table-parser.js +92 -0
- package/dist/markdown-parser/table-parser.js.map +1 -0
- package/dist/markdown-parser/table-parser.spec.d.ts +2 -0
- package/dist/markdown-parser/table-parser.spec.d.ts.map +1 -0
- package/dist/markdown-parser/table-parser.spec.js +120 -0
- package/dist/markdown-parser/table-parser.spec.js.map +1 -0
- package/dist/markdown-parser/utils.d.ts +2 -0
- package/dist/markdown-parser/utils.d.ts.map +1 -0
- package/dist/markdown-parser/utils.js +14 -0
- package/dist/markdown-parser/utils.js.map +1 -0
- package/dist/markdown-parser/utils.spec.d.ts +2 -0
- package/dist/markdown-parser/utils.spec.d.ts.map +1 -0
- package/dist/markdown-parser/utils.spec.js +59 -0
- package/dist/markdown-parser/utils.spec.js.map +1 -0
- package/dist/tools/find-files.d.ts +3 -0
- package/dist/tools/find-files.d.ts.map +1 -0
- package/dist/tools/find-files.js +186 -0
- package/dist/tools/find-files.js.map +1 -0
- package/dist/tools/index.js +4 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +143 -9
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/search-file-contents.d.ts +3 -0
- package/dist/tools/search-file-contents.d.ts.map +1 -0
- package/dist/tools/search-file-contents.js +164 -0
- package/dist/tools/search-file-contents.js.map +1 -0
- package/dist/types/markdown-parser.d.ts +11 -0
- package/dist/types/markdown-parser.d.ts.map +1 -0
- package/dist/types/markdown-parser.js +2 -0
- package/dist/types/markdown-parser.js.map +1 -0
- package/dist/utils/update-checker.spec.d.ts +2 -0
- package/dist/utils/update-checker.spec.d.ts.map +1 -0
- package/dist/utils/update-checker.spec.js +230 -0
- package/dist/utils/update-checker.spec.js.map +1 -0
- package/package.json +1 -1
- package/source/app/prompts/main-prompt.md +67 -23
- package/dist/components/update-message.d.ts +0 -7
- package/dist/components/update-message.d.ts.map +0 -1
- package/dist/components/update-message.js +0 -93
- package/dist/components/update-message.js.map +0 -1
- package/dist/tools/read-many-files.d.ts +0 -3
- package/dist/tools/read-many-files.d.ts.map +0 -1
- package/dist/tools/read-many-files.js +0 -169
- package/dist/tools/read-many-files.js.map +0 -1
- package/dist/tools/search-files.d.ts +0 -3
- package/dist/tools/search-files.d.ts.map +0 -1
- package/dist/tools/search-files.js +0 -251
- package/dist/tools/search-files.js.map +0 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { parseMarkdownTable } from './table-parser.js';
|
|
3
|
+
console.log(`\ntable-parser.spec.ts`);
|
|
4
|
+
const mockColors = {
|
|
5
|
+
primary: '#3b82f6',
|
|
6
|
+
secondary: '#6b7280',
|
|
7
|
+
success: '#10b981',
|
|
8
|
+
error: '#ef4444',
|
|
9
|
+
warning: '#f59e0b',
|
|
10
|
+
info: '#3b82f6',
|
|
11
|
+
white: '#ffffff',
|
|
12
|
+
tool: '#8b5cf6',
|
|
13
|
+
};
|
|
14
|
+
test('parseMarkdownTable handles simple two-column table', t => {
|
|
15
|
+
const table = `| Name | Age |
|
|
16
|
+
|------|-----|
|
|
17
|
+
| John | 25 |
|
|
18
|
+
| Jane | 30 |`;
|
|
19
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
20
|
+
t.true(result.includes('Name'));
|
|
21
|
+
t.true(result.includes('Age'));
|
|
22
|
+
t.true(result.includes('John'));
|
|
23
|
+
t.true(result.includes('Jane'));
|
|
24
|
+
t.true(result.includes('25'));
|
|
25
|
+
t.true(result.includes('30'));
|
|
26
|
+
});
|
|
27
|
+
test('parseMarkdownTable handles table with varying cell lengths', t => {
|
|
28
|
+
const table = `| Short | Very Long Column Name |
|
|
29
|
+
|-------|----------------------|
|
|
30
|
+
| A | This is a much longer text |
|
|
31
|
+
| B | Short |`;
|
|
32
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
33
|
+
t.true(result.includes('Short'));
|
|
34
|
+
t.true(result.includes('Very Long Column Name'));
|
|
35
|
+
t.true(result.includes('This is a much longer text'));
|
|
36
|
+
});
|
|
37
|
+
test('parseMarkdownTable returns original text for invalid table', t => {
|
|
38
|
+
const table = `Not a table at all`;
|
|
39
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
40
|
+
t.is(result, table);
|
|
41
|
+
});
|
|
42
|
+
test('parseMarkdownTable returns original text for table without data rows', t => {
|
|
43
|
+
const table = `| Name | Age |
|
|
44
|
+
|------|-----|`;
|
|
45
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
46
|
+
t.is(result, table);
|
|
47
|
+
});
|
|
48
|
+
test('parseMarkdownTable handles table with empty cells', t => {
|
|
49
|
+
const table = `| Name | Age |
|
|
50
|
+
|------|-----|
|
|
51
|
+
| John | |
|
|
52
|
+
| | 30 |`;
|
|
53
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
54
|
+
t.true(result.includes('John'));
|
|
55
|
+
t.true(result.includes('30'));
|
|
56
|
+
});
|
|
57
|
+
test('parseMarkdownTable normalizes column count', t => {
|
|
58
|
+
const table = `| A | B | C |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| 1 | 2 |
|
|
61
|
+
| 3 | 4 | 5 | 6 |`;
|
|
62
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
63
|
+
// Should handle mismatched columns gracefully
|
|
64
|
+
t.true(typeof result === 'string');
|
|
65
|
+
t.true(result.length > 0);
|
|
66
|
+
});
|
|
67
|
+
test('parseMarkdownTable strips markdown from cells', t => {
|
|
68
|
+
const table = `| Command | Description |
|
|
69
|
+
|---------|-------------|
|
|
70
|
+
| \`npm install\` | Install **dependencies** |
|
|
71
|
+
| \`npm start\` | Start the *application* |`;
|
|
72
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
73
|
+
// Should have plain text (backticks and formatting removed)
|
|
74
|
+
t.true(result.includes('npm install'));
|
|
75
|
+
t.true(result.includes('npm start'));
|
|
76
|
+
t.true(result.includes('dependencies'));
|
|
77
|
+
t.true(result.includes('application'));
|
|
78
|
+
// Should NOT have markdown syntax
|
|
79
|
+
t.false(result.includes('`npm install`'));
|
|
80
|
+
t.false(result.includes('**dependencies**'));
|
|
81
|
+
t.false(result.includes('*application*'));
|
|
82
|
+
});
|
|
83
|
+
test('parseMarkdownTable strips HTML from cells', t => {
|
|
84
|
+
const table = `| Name | Description |
|
|
85
|
+
|------|-------------|
|
|
86
|
+
| Test | Text with <br> tag |
|
|
87
|
+
| Another | Text with <b>bold</b> |`;
|
|
88
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
89
|
+
t.true(result.includes('Text with tag')); // HTML tag removed
|
|
90
|
+
t.true(result.includes('Text with bold')); // HTML tags removed
|
|
91
|
+
t.false(result.includes('<br>'));
|
|
92
|
+
t.false(result.includes('<b>'));
|
|
93
|
+
});
|
|
94
|
+
test('parseMarkdownTable handles links in cells', t => {
|
|
95
|
+
const table = `| Name | Link |
|
|
96
|
+
|------|------|
|
|
97
|
+
| Google | [Visit](https://google.com) |`;
|
|
98
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
99
|
+
t.true(result.includes('Visit'));
|
|
100
|
+
t.false(result.includes('[Visit]'));
|
|
101
|
+
t.false(result.includes('(https://google.com)'));
|
|
102
|
+
});
|
|
103
|
+
test('parseMarkdownTable handles alignment markers', t => {
|
|
104
|
+
const table = `| Left | Center | Right |
|
|
105
|
+
|:-----|:------:|------:|
|
|
106
|
+
| A | B | C |`;
|
|
107
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
108
|
+
t.true(result.includes('Left'));
|
|
109
|
+
t.true(result.includes('Center'));
|
|
110
|
+
t.true(result.includes('Right'));
|
|
111
|
+
});
|
|
112
|
+
test('parseMarkdownTable creates table with borders', t => {
|
|
113
|
+
const table = `| A | B |
|
|
114
|
+
|---|---|
|
|
115
|
+
| 1 | 2 |`;
|
|
116
|
+
const result = parseMarkdownTable(table, mockColors);
|
|
117
|
+
// Should contain table border characters
|
|
118
|
+
t.true(result.includes('─') || result.includes('│'));
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=table-parser.spec.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AE,CAAC,CAAC,EAAE;IACzD,MAAM,KAAK,GAAG;;UAEL,CAAC;IACV,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACrD,yCAAyC;IACzC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../source/markdown-parser/utils.ts"],"names":[],"mappings":"AACA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWlD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Strip markdown formatting from text (for width calculations)
|
|
2
|
+
export function stripMarkdown(text) {
|
|
3
|
+
let result = text;
|
|
4
|
+
// Remove inline code
|
|
5
|
+
result = result.replace(/`([^`]+)`/g, '$1');
|
|
6
|
+
// Remove bold
|
|
7
|
+
result = result.replace(/\*\*([^*]+)\*\*/g, '$1');
|
|
8
|
+
// Remove italic
|
|
9
|
+
result = result.replace(/\*([^*]+)\*/g, '$1');
|
|
10
|
+
// Remove links
|
|
11
|
+
result = result.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../source/markdown-parser/utils.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,UAAU,aAAa,CAAC,IAAY;IACzC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,qBAAqB;IACrB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC5C,cAAc;IACd,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IAClD,gBAAgB;IAChB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAC9C,eAAe;IACf,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.spec.d.ts","sourceRoot":"","sources":["../../source/markdown-parser/utils.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { stripMarkdown } from './utils.js';
|
|
3
|
+
console.log(`\nutils.spec.ts`);
|
|
4
|
+
test('stripMarkdown removes inline code', t => {
|
|
5
|
+
const text = 'Use `npm install` to install';
|
|
6
|
+
const result = stripMarkdown(text);
|
|
7
|
+
t.is(result, 'Use npm install to install');
|
|
8
|
+
});
|
|
9
|
+
test('stripMarkdown removes bold with double asterisks', t => {
|
|
10
|
+
const text = 'This is **bold** text';
|
|
11
|
+
const result = stripMarkdown(text);
|
|
12
|
+
t.is(result, 'This is bold text');
|
|
13
|
+
});
|
|
14
|
+
test('stripMarkdown removes italic with single asterisks', t => {
|
|
15
|
+
const text = 'This is *italic* text';
|
|
16
|
+
const result = stripMarkdown(text);
|
|
17
|
+
t.is(result, 'This is italic text');
|
|
18
|
+
});
|
|
19
|
+
test('stripMarkdown removes links', t => {
|
|
20
|
+
const text = 'Visit [Google](https://google.com) for search';
|
|
21
|
+
const result = stripMarkdown(text);
|
|
22
|
+
t.is(result, 'Visit Google for search');
|
|
23
|
+
});
|
|
24
|
+
test('stripMarkdown handles multiple formatting types', t => {
|
|
25
|
+
const text = 'Use **bold** and *italic* with `code` and [links](url)';
|
|
26
|
+
const result = stripMarkdown(text);
|
|
27
|
+
t.is(result, 'Use bold and italic with code and links');
|
|
28
|
+
});
|
|
29
|
+
test('stripMarkdown preserves plain text', t => {
|
|
30
|
+
const text = 'This is plain text with no formatting';
|
|
31
|
+
const result = stripMarkdown(text);
|
|
32
|
+
t.is(result, text);
|
|
33
|
+
});
|
|
34
|
+
test('stripMarkdown handles empty string', t => {
|
|
35
|
+
const result = stripMarkdown('');
|
|
36
|
+
t.is(result, '');
|
|
37
|
+
});
|
|
38
|
+
test('stripMarkdown preserves underscores', t => {
|
|
39
|
+
const text = 'snake_case and another_variable';
|
|
40
|
+
const result = stripMarkdown(text);
|
|
41
|
+
t.is(result, text);
|
|
42
|
+
});
|
|
43
|
+
test('stripMarkdown handles nested markdown', t => {
|
|
44
|
+
const text = '**This is `code` in bold**';
|
|
45
|
+
const result = stripMarkdown(text);
|
|
46
|
+
t.is(result, 'This is code in bold');
|
|
47
|
+
});
|
|
48
|
+
test('stripMarkdown handles multiple links', t => {
|
|
49
|
+
const text = '[First](url1) and [Second](url2)';
|
|
50
|
+
const result = stripMarkdown(text);
|
|
51
|
+
t.is(result, 'First and Second');
|
|
52
|
+
});
|
|
53
|
+
test('stripMarkdown handles incomplete markdown gracefully', t => {
|
|
54
|
+
const text = 'This has **incomplete bold and `incomplete code';
|
|
55
|
+
const result = stripMarkdown(text);
|
|
56
|
+
// Should leave incomplete markdown as-is
|
|
57
|
+
t.true(result.includes('**incomplete') || result.includes('incomplete'));
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=utils.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../source/markdown-parser/utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAE/B,IAAI,CAAC,mCAAmC,EAAE,CAAC,CAAC,EAAE;IAC7C,MAAM,IAAI,GAAG,8BAA8B,CAAC;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,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-files.d.ts","sourceRoot":"","sources":["../../source/tools/find-files.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAiPlD,eAAO,MAAM,aAAa,EAAE,cAM3B,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { exec } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import ignore from 'ignore';
|
|
8
|
+
import { Text, Box } from 'ink';
|
|
9
|
+
import { tool, jsonSchema } from '../types/core.js';
|
|
10
|
+
import { ThemeContext } from '../hooks/useTheme.js';
|
|
11
|
+
import ToolMessage from '../components/tool-message.js';
|
|
12
|
+
const execAsync = promisify(exec);
|
|
13
|
+
/**
|
|
14
|
+
* Load and parse .gitignore file, returns an ignore instance
|
|
15
|
+
*/
|
|
16
|
+
function loadGitignore(cwd) {
|
|
17
|
+
const ig = ignore();
|
|
18
|
+
const gitignorePath = join(cwd, '.gitignore');
|
|
19
|
+
// Always ignore common directories
|
|
20
|
+
ig.add([
|
|
21
|
+
'node_modules',
|
|
22
|
+
'.git',
|
|
23
|
+
'dist',
|
|
24
|
+
'build',
|
|
25
|
+
'coverage',
|
|
26
|
+
'.next',
|
|
27
|
+
'.nuxt',
|
|
28
|
+
'out',
|
|
29
|
+
'.cache',
|
|
30
|
+
]);
|
|
31
|
+
// Load .gitignore if it exists
|
|
32
|
+
if (existsSync(gitignorePath)) {
|
|
33
|
+
try {
|
|
34
|
+
const gitignoreContent = readFileSync(gitignorePath, 'utf-8');
|
|
35
|
+
ig.add(gitignoreContent);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Silently fail if we can't read .gitignore
|
|
39
|
+
// The hardcoded ignores above will still apply
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return ig;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Find files matching a glob pattern using find command
|
|
46
|
+
*/
|
|
47
|
+
async function findFilesByPattern(pattern, cwd, maxResults) {
|
|
48
|
+
try {
|
|
49
|
+
const ig = loadGitignore(cwd);
|
|
50
|
+
// Convert glob patterns to find-compatible patterns
|
|
51
|
+
let findCommand = '';
|
|
52
|
+
let pathPrefix = '.';
|
|
53
|
+
if (pattern.includes('{') && pattern.includes('}')) {
|
|
54
|
+
// Handle brace expansion like *.{ts,tsx}
|
|
55
|
+
const braceMatch = pattern.match(/\{([^}]+)\}/);
|
|
56
|
+
if (braceMatch) {
|
|
57
|
+
const extensions = braceMatch[1].split(',');
|
|
58
|
+
const patterns = extensions
|
|
59
|
+
.map(ext => `-name "*.${ext.trim()}"`)
|
|
60
|
+
.join(' -o ');
|
|
61
|
+
findCommand = `find . \\( ${patterns} \\)`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (pattern.startsWith('**/')) {
|
|
65
|
+
// Pattern like **/*.ts - search everywhere
|
|
66
|
+
const namePattern = pattern.replace('**/', '');
|
|
67
|
+
findCommand = `find . -name "${namePattern}"`;
|
|
68
|
+
}
|
|
69
|
+
else if (pattern.includes('/**')) {
|
|
70
|
+
// Pattern like scripts/** or scripts/**/*.ts - search within a directory
|
|
71
|
+
const parts = pattern.split('/**');
|
|
72
|
+
pathPrefix = `./${parts[0]}`;
|
|
73
|
+
const namePattern = parts[1] ? parts[1].replace(/^\//, '') : '*';
|
|
74
|
+
if (namePattern === '*' || namePattern === '') {
|
|
75
|
+
// Just list everything in the directory
|
|
76
|
+
findCommand = `find ${pathPrefix}`;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
findCommand = `find ${pathPrefix} -name "${namePattern}"`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (pattern.includes('*')) {
|
|
83
|
+
// Simple pattern like *.ts
|
|
84
|
+
findCommand = `find . -name "${pattern}"`;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Exact path or directory name
|
|
88
|
+
findCommand = `find . -name "${pattern}"`;
|
|
89
|
+
}
|
|
90
|
+
// Add exclusions and execute
|
|
91
|
+
const { stdout } = await execAsync(`${findCommand} -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" -not -path "*/build/*" -not -path "*/coverage/*" -not -path "*/.next/*" -not -path "*/.nuxt/*" -not -path "*/out/*" -not -path "*/.cache/*" | head -n ${maxResults * 3}`, { cwd, maxBuffer: 1024 * 1024 });
|
|
92
|
+
const allPaths = stdout
|
|
93
|
+
.trim()
|
|
94
|
+
.split('\n')
|
|
95
|
+
.filter(Boolean)
|
|
96
|
+
.map(line => line.replace(/^\.\//, ''))
|
|
97
|
+
.filter(path => path && path !== '.');
|
|
98
|
+
// Filter using gitignore
|
|
99
|
+
const paths = [];
|
|
100
|
+
for (const path of allPaths) {
|
|
101
|
+
if (!ig.ignores(path)) {
|
|
102
|
+
paths.push(path);
|
|
103
|
+
if (paths.length >= maxResults) {
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
files: paths,
|
|
110
|
+
truncated: allPaths.length >= maxResults * 3 || paths.length >= maxResults,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
if (error instanceof Error && 'code' in error && error.code === 1) {
|
|
115
|
+
return { files: [], truncated: false };
|
|
116
|
+
}
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const executeFindFiles = async (args) => {
|
|
121
|
+
const cwd = process.cwd();
|
|
122
|
+
const maxResults = Math.min(args.maxResults || 50, 100);
|
|
123
|
+
try {
|
|
124
|
+
const { files, truncated } = await findFilesByPattern(args.pattern, cwd, maxResults);
|
|
125
|
+
if (files.length === 0) {
|
|
126
|
+
return `No files or directories found matching pattern "${args.pattern}"`;
|
|
127
|
+
}
|
|
128
|
+
let output = `Found ${files.length} match${files.length === 1 ? '' : 'es'}${truncated ? ` (showing first ${maxResults})` : ''}:\n\n`;
|
|
129
|
+
output += files.join('\n');
|
|
130
|
+
return output;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
134
|
+
throw new Error(`File search failed: ${errorMessage}`);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
// AI SDK tool definition
|
|
138
|
+
const findFilesCoreTool = tool({
|
|
139
|
+
description: 'Find files and directories by path pattern or name. Use glob patterns like "*.tsx", "**/*.ts", "src/**/*.js", or "*.{ts,tsx}". Returns a list of matching file and directory paths. Does NOT search file contents - use search_file_contents for that.',
|
|
140
|
+
inputSchema: jsonSchema({
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
pattern: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
description: 'Glob pattern to match file and directory paths. Examples: "*.tsx" (all .tsx files), "src/**/*.ts" (all .ts in src/), "components/**" (all files/dirs in components/), "*.{ts,tsx}" (multiple extensions)',
|
|
146
|
+
},
|
|
147
|
+
maxResults: {
|
|
148
|
+
type: 'number',
|
|
149
|
+
description: 'Maximum number of results to return (default: 50, max: 100)',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
required: ['pattern'],
|
|
153
|
+
}),
|
|
154
|
+
});
|
|
155
|
+
const FindFilesFormatter = React.memo(({ args, result }) => {
|
|
156
|
+
const themeContext = React.useContext(ThemeContext);
|
|
157
|
+
if (!themeContext) {
|
|
158
|
+
throw new Error('ThemeContext not found');
|
|
159
|
+
}
|
|
160
|
+
const { colors } = themeContext;
|
|
161
|
+
// Parse result to get file count
|
|
162
|
+
let fileCount = 0;
|
|
163
|
+
if (result && !result.startsWith('Error:')) {
|
|
164
|
+
const firstLine = result.split('\n')[0];
|
|
165
|
+
const matchFound = firstLine.match(/Found (\d+)/);
|
|
166
|
+
if (matchFound) {
|
|
167
|
+
fileCount = parseInt(matchFound[1], 10);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const messageContent = (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: colors.tool, children: "\u2692 find_files" }), _jsxs(Box, { children: [_jsx(Text, { color: colors.secondary, children: "Pattern: " }), _jsx(Text, { color: colors.white, children: args.pattern })] }), _jsxs(Box, { children: [_jsx(Text, { color: colors.secondary, children: "Results: " }), _jsx(Text, { color: colors.white, children: fileCount })] })] }));
|
|
171
|
+
return _jsx(ToolMessage, { message: messageContent, hideBox: true });
|
|
172
|
+
});
|
|
173
|
+
const formatter = (args, result) => {
|
|
174
|
+
if (result && result.startsWith('Error:')) {
|
|
175
|
+
return _jsx(_Fragment, {});
|
|
176
|
+
}
|
|
177
|
+
return _jsx(FindFilesFormatter, { args: args, result: result });
|
|
178
|
+
};
|
|
179
|
+
export const findFilesTool = {
|
|
180
|
+
name: 'find_files',
|
|
181
|
+
tool: findFilesCoreTool,
|
|
182
|
+
handler: executeFindFiles,
|
|
183
|
+
formatter,
|
|
184
|
+
requiresConfirmation: false,
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=find-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-files.js","sourceRoot":"","sources":["../../source/tools/find-files.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AACjD,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAA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qB,EAE7C,MAAC,GAAG,eACH,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,0BAAkB,EAC/C,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,IAAI,CAAC,OAAO,GAAQ,IAC3C,EAEN,MAAC,GAAG,eACH,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,0BAAkB,EAC/C,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAG,SAAS,GAAQ,IACxC,IACD,CACN,CAAC;IAEF,OAAO,KAAC,WAAW,IAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,GAAI,CAAC;AAChE,CAAC,CACD,CAAC;AAEF,MAAM,SAAS,GAAG,CACjB,IAAqC,EACrC,MAAe,EACM,EAAE;IACvB,IAAI,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3C,OAAO,mBAAK,CAAC;IACd,CAAC;IACD,OAAO,KAAC,kBAAkB,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAI,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC5C,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,gBAAgB;IACzB,SAAS;IACT,oBAAoB,EAAE,KAAK;CAC3B,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -3,22 +3,22 @@ import { createFileTool } from '../tools/create-file.js';
|
|
|
3
3
|
import { insertLinesTool } from '../tools/insert-lines.js';
|
|
4
4
|
import { replaceLinesTool } from '../tools/replace-lines.js';
|
|
5
5
|
import { deleteLinesTool } from '../tools/delete-lines.js';
|
|
6
|
-
import { readManyFilesTool } from '../tools/read-many-files.js';
|
|
7
6
|
import { executeBashTool } from '../tools/execute-bash.js';
|
|
8
7
|
import { webSearchTool } from '../tools/web-search.js';
|
|
9
8
|
import { fetchUrlTool } from '../tools/fetch-url.js';
|
|
10
|
-
import {
|
|
9
|
+
import { findFilesTool } from '../tools/find-files.js';
|
|
10
|
+
import { searchFileContentsTool } from '../tools/search-file-contents.js';
|
|
11
11
|
export const toolDefinitions = [
|
|
12
12
|
readFileTool,
|
|
13
13
|
createFileTool,
|
|
14
14
|
insertLinesTool,
|
|
15
15
|
replaceLinesTool,
|
|
16
16
|
deleteLinesTool,
|
|
17
|
-
readManyFilesTool,
|
|
18
17
|
executeBashTool,
|
|
19
18
|
webSearchTool,
|
|
20
19
|
fetchUrlTool,
|
|
21
|
-
|
|
20
|
+
findFilesTool,
|
|
21
|
+
searchFileContentsTool,
|
|
22
22
|
];
|
|
23
23
|
// Export handlers for manual execution (human-in-the-loop)
|
|
24
24
|
export const toolRegistry = Object.fromEntries(toolDefinitions.map(def => [def.name, def.handler]));
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,E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AAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC9B,CAAC,CAAC,CACH,CAAC;AAEF,4BAA4B;AAC5B,MAAM,CAAC,MAAM,cAAc,GAIvB,MAAM,CAAC,WAAW,CACrB,eAAe;KACb,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;KAC5B,GAAG,CAAC,GAAG,CAAC,EAAE;IACV,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IAChC,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC9B,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../source/tools/read-file.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AA2WlD,eAAO,MAAM,YAAY,EAAE,cAO1B,CAAC"}
|