codecane 1.0.123
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/README.md +87 -0
- package/dist/__tests__/tool-handlers.test.d.ts +1 -0
- package/dist/__tests__/tool-handlers.test.js +32 -0
- package/dist/__tests__/tool-handlers.test.js.map +1 -0
- package/dist/chat-storage.d.ts +29 -0
- package/dist/chat-storage.js +125 -0
- package/dist/chat-storage.js.map +1 -0
- package/dist/cli.d.ts +38 -0
- package/dist/cli.js +453 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +71 -0
- package/dist/client.js +458 -0
- package/dist/client.js.map +1 -0
- package/dist/code-map/languages.d.ts +12 -0
- package/dist/code-map/languages.js +129 -0
- package/dist/code-map/languages.js.map +1 -0
- package/dist/code-map/parse.d.ts +11 -0
- package/dist/code-map/parse.js +127 -0
- package/dist/code-map/parse.js.map +1 -0
- package/dist/code-map/test-langs/test.d.ts +11 -0
- package/dist/code-map/test-langs/test.js +23 -0
- package/dist/code-map/test-langs/test.js.map +1 -0
- package/dist/code-map/tree-sitter-queries/readme.md +23 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-c-tags.scm +11 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-c_sharp-tags.scm +13 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-cpp-tags.scm +17 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-go-tags.scm +26 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-java-tags.scm +19 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-javascript-tags.scm +15 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-php-tags.scm +26 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-python-tags.scm +9 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-ruby-tags.scm +58 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-rust-tags.scm +26 -0
- package/dist/code-map/tree-sitter-queries/tree-sitter-typescript-tags.scm +15 -0
- package/dist/code-map/tsconfig.tsbuildinfo +1 -0
- package/dist/common/actions.d.ts +1405 -0
- package/dist/common/actions.js +193 -0
- package/dist/common/actions.js.map +1 -0
- package/dist/common/billing/quota-manager.d.ts +29 -0
- package/dist/common/billing/quota-manager.js +213 -0
- package/dist/common/billing/quota-manager.js.map +1 -0
- package/dist/common/constants.d.ts +41 -0
- package/dist/common/constants.js +126 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/db/drizzle.config.d.ts +2 -0
- package/dist/common/db/drizzle.config.js +17 -0
- package/dist/common/db/drizzle.config.js.map +1 -0
- package/dist/common/db/env.d.mts +1 -0
- package/dist/common/db/env.mjs +26 -0
- package/dist/common/db/env.mjs.map +1 -0
- package/dist/common/db/index.d.ts +6 -0
- package/dist/common/db/index.js +35 -0
- package/dist/common/db/index.js.map +1 -0
- package/dist/common/db/schema.d.ts +1089 -0
- package/dist/common/db/schema.js +114 -0
- package/dist/common/db/schema.js.map +1 -0
- package/dist/common/env.d.mts +1 -0
- package/dist/common/env.mjs +34 -0
- package/dist/common/env.mjs.map +1 -0
- package/dist/common/project-file-tree.d.ts +9 -0
- package/dist/common/project-file-tree.js +166 -0
- package/dist/common/project-file-tree.js.map +1 -0
- package/dist/common/types/referral.d.ts +2 -0
- package/dist/common/types/referral.js +5 -0
- package/dist/common/types/referral.js.map +1 -0
- package/dist/common/types/usage.d.ts +24 -0
- package/dist/common/types/usage.js +13 -0
- package/dist/common/types/usage.js.map +1 -0
- package/dist/common/util/__tests__/string.test.d.ts +1 -0
- package/dist/common/util/__tests__/string.test.js +83 -0
- package/dist/common/util/__tests__/string.test.js.map +1 -0
- package/dist/common/util/array.d.ts +6 -0
- package/dist/common/util/array.js +32 -0
- package/dist/common/util/array.js.map +1 -0
- package/dist/common/util/changes.d.ts +6 -0
- package/dist/common/util/changes.js +72 -0
- package/dist/common/util/changes.js.map +1 -0
- package/dist/common/util/credentials.d.ts +25 -0
- package/dist/common/util/credentials.js +24 -0
- package/dist/common/util/credentials.js.map +1 -0
- package/dist/common/util/dates.d.ts +1 -0
- package/dist/common/util/dates.js +13 -0
- package/dist/common/util/dates.js.map +1 -0
- package/dist/common/util/file.d.ts +151 -0
- package/dist/common/util/file.js +180 -0
- package/dist/common/util/file.js.map +1 -0
- package/dist/common/util/git.d.ts +6 -0
- package/dist/common/util/git.js +81 -0
- package/dist/common/util/git.js.map +1 -0
- package/dist/common/util/helpers.d.ts +1 -0
- package/dist/common/util/helpers.js +6 -0
- package/dist/common/util/helpers.js.map +1 -0
- package/dist/common/util/object.d.ts +18 -0
- package/dist/common/util/object.js +91 -0
- package/dist/common/util/object.js.map +1 -0
- package/dist/common/util/patch.d.ts +1 -0
- package/dist/common/util/patch.js +215 -0
- package/dist/common/util/patch.js.map +1 -0
- package/dist/common/util/promise.d.ts +1 -0
- package/dist/common/util/promise.js +33 -0
- package/dist/common/util/promise.js.map +1 -0
- package/dist/common/util/referral.d.ts +1 -0
- package/dist/common/util/referral.js +6 -0
- package/dist/common/util/referral.js.map +1 -0
- package/dist/common/util/server/referral.d.ts +14 -0
- package/dist/common/util/server/referral.js +85 -0
- package/dist/common/util/server/referral.js.map +1 -0
- package/dist/common/util/string.d.ts +9 -0
- package/dist/common/util/string.js +90 -0
- package/dist/common/util/string.js.map +1 -0
- package/dist/common/util/stripe.d.ts +2 -0
- package/dist/common/util/stripe.js +19 -0
- package/dist/common/util/stripe.js.map +1 -0
- package/dist/common/util/tools.d.ts +2 -0
- package/dist/common/util/tools.js +13 -0
- package/dist/common/util/tools.js.map +1 -0
- package/dist/common/websockets/websocket-client.d.ts +40 -0
- package/dist/common/websockets/websocket-client.js +187 -0
- package/dist/common/websockets/websocket-client.js.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +3058 -0
- package/dist/common/websockets/websocket-schema.js +55 -0
- package/dist/common/websockets/websocket-schema.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -0
- package/dist/credentials.d.ts +3 -0
- package/dist/credentials.js +33 -0
- package/dist/credentials.js.map +1 -0
- package/dist/fingerprint.d.ts +1 -0
- package/dist/fingerprint.js +43 -0
- package/dist/fingerprint.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/dist/menu.d.ts +1 -0
- package/dist/menu.js +94 -0
- package/dist/menu.js.map +1 -0
- package/dist/project-files.d.ts +64 -0
- package/dist/project-files.js +338 -0
- package/dist/project-files.js.map +1 -0
- package/dist/tool-handlers.d.ts +11 -0
- package/dist/tool-handlers.js +215 -0
- package/dist/tool-handlers.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/update-codebuff.d.ts +1 -0
- package/dist/update-codebuff.js +156 -0
- package/dist/update-codebuff.js.map +1 -0
- package/dist/web-scraper.d.ts +3 -0
- package/dist/web-scraper.js +57 -0
- package/dist/web-scraper.js.map +1 -0
- package/dist/worker-script-project-context.d.ts +1 -0
- package/dist/worker-script-project-context.js +13 -0
- package/dist/worker-script-project-context.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deleteFile = exports.getProjectFileContext = void 0;
|
|
7
|
+
exports.setProjectRoot = setProjectRoot;
|
|
8
|
+
exports.getProjectRoot = getProjectRoot;
|
|
9
|
+
exports.initProjectFileContextWithWorker = initProjectFileContextWithWorker;
|
|
10
|
+
exports.getChangesSinceLastFileVersion = getChangesSinceLastFileVersion;
|
|
11
|
+
exports.getFiles = getFiles;
|
|
12
|
+
exports.getExistingFiles = getExistingFiles;
|
|
13
|
+
exports.getFilesAbsolutePath = getFilesAbsolutePath;
|
|
14
|
+
exports.setFiles = setFiles;
|
|
15
|
+
exports.getFileBlocks = getFileBlocks;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const os_1 = __importDefault(require("os"));
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const process_1 = require("process");
|
|
20
|
+
const child_process_1 = require("child_process");
|
|
21
|
+
const util_1 = require("util");
|
|
22
|
+
const diff_1 = require("diff");
|
|
23
|
+
const picocolors_1 = require("picocolors");
|
|
24
|
+
const worker_threads_1 = require("worker_threads");
|
|
25
|
+
const file_1 = require("./common/util/file");
|
|
26
|
+
const object_1 = require("./common/util/object");
|
|
27
|
+
const project_file_tree_1 = require("./common/project-file-tree");
|
|
28
|
+
const parse_1 = require("./code-map/parse");
|
|
29
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
30
|
+
let projectRoot;
|
|
31
|
+
function setProjectRoot(dir) {
|
|
32
|
+
const newDir = path_1.default.resolve(dir || getCurrentDirectory());
|
|
33
|
+
if (fs_1.default.existsSync(newDir)) {
|
|
34
|
+
if (projectRoot) {
|
|
35
|
+
console.log((0, picocolors_1.green)('\nDirectory change:'), `Codebuff will read and write files in "${newDir}".\n`);
|
|
36
|
+
}
|
|
37
|
+
projectRoot = newDir;
|
|
38
|
+
return newDir;
|
|
39
|
+
}
|
|
40
|
+
return projectRoot;
|
|
41
|
+
}
|
|
42
|
+
function getProjectRoot() {
|
|
43
|
+
return projectRoot;
|
|
44
|
+
}
|
|
45
|
+
function getCurrentDirectory() {
|
|
46
|
+
try {
|
|
47
|
+
return process.cwd();
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new Error('Failed to get current working directory. Is this directory deleted?', { cause: error });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
let cachedProjectFileContext;
|
|
54
|
+
function initProjectFileContextWithWorker(dir) {
|
|
55
|
+
// NOTE: Uses the built worker-script-project-context.js within dist.
|
|
56
|
+
// So you need to run `bun run build` before running locally.
|
|
57
|
+
const workerPath = __filename.endsWith('.ts')
|
|
58
|
+
? path_1.default.join(__dirname, '..', 'dist', 'worker-script-project-context.js')
|
|
59
|
+
: path_1.default.join(__dirname, 'worker-script-project-context.js');
|
|
60
|
+
const worker = new worker_threads_1.Worker(workerPath);
|
|
61
|
+
worker.postMessage({ dir });
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
worker.on('message', (initFileContext) => {
|
|
64
|
+
worker.terminate();
|
|
65
|
+
cachedProjectFileContext = initFileContext;
|
|
66
|
+
resolve(initFileContext);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const getProjectFileContext = async (projectRoot, lastFileVersion, fileVersions) => {
|
|
71
|
+
const gitChanges = await getGitChanges();
|
|
72
|
+
const changesSinceLastChat = getChangesSinceLastFileVersion(lastFileVersion);
|
|
73
|
+
const updatedProps = {
|
|
74
|
+
gitChanges,
|
|
75
|
+
changesSinceLastChat,
|
|
76
|
+
fileVersions,
|
|
77
|
+
};
|
|
78
|
+
if (!cachedProjectFileContext ||
|
|
79
|
+
cachedProjectFileContext.currentWorkingDirectory !== projectRoot) {
|
|
80
|
+
const fileTree = (0, project_file_tree_1.getProjectFileTree)(projectRoot);
|
|
81
|
+
const flattenedNodes = (0, project_file_tree_1.flattenTree)(fileTree);
|
|
82
|
+
const allFilePaths = flattenedNodes
|
|
83
|
+
.filter((node) => node.type === 'file')
|
|
84
|
+
.map((node) => node.filePath);
|
|
85
|
+
const knowledgeFilePaths = allFilePaths.filter((filePath) => filePath.endsWith('knowledge.md'));
|
|
86
|
+
const knowledgeFiles = getExistingFiles(knowledgeFilePaths);
|
|
87
|
+
const shellConfigFiles = loadShellConfigFiles();
|
|
88
|
+
const shell = process.env.SHELL || process.env.COMSPEC || 'unknown';
|
|
89
|
+
const fileTokenScores = await (0, parse_1.getFileTokenScores)(projectRoot, allFilePaths);
|
|
90
|
+
cachedProjectFileContext = {
|
|
91
|
+
currentWorkingDirectory: projectRoot,
|
|
92
|
+
fileTree,
|
|
93
|
+
fileTokenScores,
|
|
94
|
+
knowledgeFiles,
|
|
95
|
+
shellConfigFiles,
|
|
96
|
+
systemInfo: {
|
|
97
|
+
platform: process_1.platform,
|
|
98
|
+
shell: path_1.default.basename(shell),
|
|
99
|
+
nodeVersion: process.version,
|
|
100
|
+
arch: process.arch,
|
|
101
|
+
homedir: os_1.default.homedir(),
|
|
102
|
+
cpus: os_1.default.cpus().length,
|
|
103
|
+
},
|
|
104
|
+
...updatedProps,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
cachedProjectFileContext = {
|
|
109
|
+
...cachedProjectFileContext,
|
|
110
|
+
...updatedProps,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return cachedProjectFileContext;
|
|
114
|
+
};
|
|
115
|
+
exports.getProjectFileContext = getProjectFileContext;
|
|
116
|
+
async function getGitChanges() {
|
|
117
|
+
try {
|
|
118
|
+
const { stdout: status } = await execAsync('git status', {
|
|
119
|
+
cwd: projectRoot,
|
|
120
|
+
});
|
|
121
|
+
const { stdout: diff } = await execAsync('git diff', { cwd: projectRoot });
|
|
122
|
+
const { stdout: diffCached } = await execAsync('git diff --cached', {
|
|
123
|
+
cwd: projectRoot,
|
|
124
|
+
});
|
|
125
|
+
const { stdout: shortLogOutput } = await execAsync('git shortlog HEAD~10..HEAD', {
|
|
126
|
+
cwd: projectRoot,
|
|
127
|
+
});
|
|
128
|
+
const shortLogLines = shortLogOutput.trim().split('\n');
|
|
129
|
+
const lastCommitMessages = shortLogLines
|
|
130
|
+
.slice(1)
|
|
131
|
+
.reverse()
|
|
132
|
+
.map((line) => line.trim())
|
|
133
|
+
.join('\n');
|
|
134
|
+
return { status, diff, diffCached, lastCommitMessages };
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
return { status: '', diff: '', diffCached: '', lastCommitMessages: '' };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function getChangesSinceLastFileVersion(lastFileVersion) {
|
|
141
|
+
const changes = Object.entries(lastFileVersion)
|
|
142
|
+
.map(([filePath, file]) => {
|
|
143
|
+
const fullFilePath = path_1.default.join(getProjectRoot(), filePath);
|
|
144
|
+
try {
|
|
145
|
+
const currentContent = fs_1.default.readFileSync(fullFilePath, 'utf8');
|
|
146
|
+
if (currentContent === file) {
|
|
147
|
+
return [filePath, null];
|
|
148
|
+
}
|
|
149
|
+
return [filePath, (0, diff_1.createPatch)(filePath, file, currentContent)];
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
// console.error(`Error reading file ${fullFilePath}:`, error)
|
|
153
|
+
return [filePath, null];
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
.filter(([_, diff]) => diff !== null);
|
|
157
|
+
return Object.fromEntries(changes);
|
|
158
|
+
}
|
|
159
|
+
function getFiles(filePaths) {
|
|
160
|
+
const result = {};
|
|
161
|
+
const MAX_FILE_SIZE = 1024 * 1024; // 1MB in bytes
|
|
162
|
+
const ig = (0, project_file_tree_1.parseGitignore)(projectRoot);
|
|
163
|
+
for (const filePath of filePaths) {
|
|
164
|
+
// Convert absolute paths within project to relative paths
|
|
165
|
+
const relativePath = filePath.startsWith(projectRoot)
|
|
166
|
+
? path_1.default.relative(projectRoot, filePath)
|
|
167
|
+
: filePath;
|
|
168
|
+
const fullPath = path_1.default.join(projectRoot, relativePath);
|
|
169
|
+
if (!fullPath.startsWith(projectRoot)) {
|
|
170
|
+
result[relativePath] = '[FILE_OUTSIDE_PROJECT]';
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (ig.ignores(relativePath)) {
|
|
174
|
+
result[relativePath] = '[FILE_IGNORED]';
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const stats = fs_1.default.statSync(fullPath);
|
|
179
|
+
if (stats.size > MAX_FILE_SIZE) {
|
|
180
|
+
result[relativePath] =
|
|
181
|
+
`[FILE_TOO_LARGE: ${(stats.size / (1024 * 1024)).toFixed(2)}MB]`;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
const content = fs_1.default.readFileSync(fullPath, 'utf8');
|
|
185
|
+
result[relativePath] = content;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
result[relativePath] = null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
function getExistingFiles(filePaths) {
|
|
195
|
+
return (0, object_1.filterObject)(getFiles(filePaths), (value) => value !== null);
|
|
196
|
+
}
|
|
197
|
+
function getFilesAbsolutePath(filePaths) {
|
|
198
|
+
const result = {};
|
|
199
|
+
for (const filePath of filePaths) {
|
|
200
|
+
try {
|
|
201
|
+
const content = fs_1.default.readFileSync(filePath, 'utf8');
|
|
202
|
+
result[filePath] = content;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
result[filePath] = null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
function setFiles(files) {
|
|
211
|
+
for (const [filePath, content] of Object.entries(files)) {
|
|
212
|
+
const fullPath = path_1.default.join(projectRoot, filePath);
|
|
213
|
+
fs_1.default.writeFileSync(fullPath, content, 'utf8');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function getFileBlocks(filePaths) {
|
|
217
|
+
const result = {};
|
|
218
|
+
for (const filePath of filePaths) {
|
|
219
|
+
const fullPath = path_1.default.join(projectRoot, filePath);
|
|
220
|
+
try {
|
|
221
|
+
const content = fs_1.default.readFileSync(fullPath, 'utf8');
|
|
222
|
+
result[filePath] = content;
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
const fileDoesNotExist = error instanceof Error &&
|
|
226
|
+
error.message.includes('no such file or directory');
|
|
227
|
+
result[filePath] = fileDoesNotExist
|
|
228
|
+
? '[FILE_DOES_NOT_EXIST]'
|
|
229
|
+
: '[FILE_READ_ERROR]';
|
|
230
|
+
if (!fileDoesNotExist) {
|
|
231
|
+
console.error(`Error reading file ${fullPath}:`, error instanceof Error ? error.message : error);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const fileBlocks = filePaths.map((filePath) => (0, file_1.createFileBlock)(filePath, result[filePath]));
|
|
236
|
+
return fileBlocks.join('\n');
|
|
237
|
+
}
|
|
238
|
+
const loadShellConfigFiles = () => {
|
|
239
|
+
const homeDir = os_1.default.homedir();
|
|
240
|
+
const configFiles = [
|
|
241
|
+
path_1.default.join(homeDir, '.bashrc'),
|
|
242
|
+
path_1.default.join(homeDir, '.bash_profile'),
|
|
243
|
+
path_1.default.join(homeDir, '.bash_login'),
|
|
244
|
+
path_1.default.join(homeDir, '.profile'),
|
|
245
|
+
path_1.default.join(homeDir, '.zshrc'),
|
|
246
|
+
path_1.default.join(homeDir, '.kshrc'),
|
|
247
|
+
];
|
|
248
|
+
const files = getFilesAbsolutePath(configFiles);
|
|
249
|
+
return (0, object_1.filterObject)(files, (value) => value !== null);
|
|
250
|
+
};
|
|
251
|
+
/*
|
|
252
|
+
function getExportedTokensForFiles(
|
|
253
|
+
filePaths: string[]
|
|
254
|
+
): Record<string, string[]> {
|
|
255
|
+
const result: Record<string, string[]> = {}
|
|
256
|
+
const fullFilePaths = filePaths.map((filePath) =>
|
|
257
|
+
path.join(projectRoot, filePath)
|
|
258
|
+
)
|
|
259
|
+
const program = ts.createProgram(fullFilePaths, {})
|
|
260
|
+
|
|
261
|
+
for (let i = 0; i < filePaths.length; i++) {
|
|
262
|
+
const filePath = filePaths[i]
|
|
263
|
+
const fullFilePath = fullFilePaths[i]
|
|
264
|
+
const sourceFile = program.getSourceFile(fullFilePath)
|
|
265
|
+
if (sourceFile) {
|
|
266
|
+
try {
|
|
267
|
+
const exportedTokens = getExportedTokens(sourceFile)
|
|
268
|
+
result[filePath] = exportedTokens
|
|
269
|
+
} catch (error) {
|
|
270
|
+
console.error(`Error processing file ${fullFilePath}:`, error)
|
|
271
|
+
result[filePath] = []
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
// console.error(`Could not find source file: ${fullFilePath}`)
|
|
275
|
+
result[filePath] = []
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return result
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function getExportedTokens(sourceFile: ts.SourceFile): string[] {
|
|
283
|
+
const exportedTokens: string[] = []
|
|
284
|
+
|
|
285
|
+
function visit(node: ts.Node) {
|
|
286
|
+
if (ts.isExportDeclaration(node)) {
|
|
287
|
+
if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
288
|
+
node.exportClause.elements.forEach((element) => {
|
|
289
|
+
exportedTokens.push(element.name.text)
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
} else if (
|
|
293
|
+
ts.isFunctionDeclaration(node) ||
|
|
294
|
+
ts.isClassDeclaration(node) ||
|
|
295
|
+
ts.isVariableStatement(node)
|
|
296
|
+
) {
|
|
297
|
+
if (
|
|
298
|
+
node.modifiers?.some(
|
|
299
|
+
(modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword
|
|
300
|
+
)
|
|
301
|
+
) {
|
|
302
|
+
if (ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)) {
|
|
303
|
+
if (node.name) {
|
|
304
|
+
exportedTokens.push(node.name.text)
|
|
305
|
+
}
|
|
306
|
+
} else if (ts.isVariableStatement(node)) {
|
|
307
|
+
node.declarationList.declarations.forEach((declaration) => {
|
|
308
|
+
if (ts.isIdentifier(declaration.name)) {
|
|
309
|
+
exportedTokens.push(declaration.name.text)
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
ts.forEachChild(node, visit)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
visit(sourceFile)
|
|
320
|
+
|
|
321
|
+
return exportedTokens
|
|
322
|
+
}
|
|
323
|
+
*/
|
|
324
|
+
const deleteFile = (fullPath) => {
|
|
325
|
+
try {
|
|
326
|
+
if (fs_1.default.existsSync(fullPath)) {
|
|
327
|
+
fs_1.default.unlinkSync(fullPath);
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
console.error(`Error deleting file ${fullPath}:`, error);
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
exports.deleteFile = deleteFile;
|
|
338
|
+
//# sourceMappingURL=project-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-files.js","sourceRoot":"","sources":["../src/project-files.ts"],"names":[],"mappings":";;;;;;AA2BA,wCAaC;AAED,wCAEC;AAeD,4EAiBC;AAuFD,wEAmBC;AAED,4BAiCC;AAED,4CAKC;AACD,oDAWC;AAED,4BAKC;AAED,sCA+BC;AApRD,4CAAmB;AACnB,4CAAmB;AACnB,gDAAuB;AACvB,qCAAkC;AAClC,iDAAoC;AACpC,+BAAgC;AAChC,+BAAkC;AAClC,2CAAkC;AAClC,mDAAuC;AAEvC,2CAIyB;AACzB,+CAAiD;AACjD,gEAIiC;AACjC,0CAAmD;AAEnD,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAA;AAEjC,IAAI,WAAmB,CAAA;AAEvB,SAAgB,cAAc,CAAC,GAAuB;IACpD,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,IAAI,mBAAmB,EAAE,CAAC,CAAA;IACzD,IAAI,YAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CACT,IAAA,kBAAK,EAAC,qBAAqB,CAAC,EAC5B,0CAA0C,MAAM,MAAM,CACvD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C,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAGnD,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEE;AAEK,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAW,EAAE;IACtD,IAAI,CAAC;QACH,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uBAAuB,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAA;QACxD,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAXY,QAAA,UAAU,cAWtB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ToolHandler = (input: any, id: string) => Promise<string>;
|
|
2
|
+
export declare const handleScrapeWebPage: ToolHandler;
|
|
3
|
+
export declare const resetPtyShell: (dir: string) => void;
|
|
4
|
+
export declare const handleRunTerminalCommand: (input: {
|
|
5
|
+
command: string;
|
|
6
|
+
}, id: string, mode: "user" | "assistant") => Promise<{
|
|
7
|
+
result: string;
|
|
8
|
+
stdout: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const handleCodeSearch: ToolHandler;
|
|
11
|
+
export declare const toolHandlers: Record<string, ToolHandler>;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.toolHandlers = exports.handleCodeSearch = exports.handleRunTerminalCommand = exports.resetPtyShell = exports.handleScrapeWebPage = void 0;
|
|
30
|
+
const child_process_1 = require("child_process");
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const picocolors_1 = require("picocolors");
|
|
33
|
+
const ripgrep_1 = require("@vscode/ripgrep");
|
|
34
|
+
const os = __importStar(require("os"));
|
|
35
|
+
const pty = __importStar(require("node-pty"));
|
|
36
|
+
const web_scraper_1 = require("./web-scraper");
|
|
37
|
+
const project_files_1 = require("./project-files");
|
|
38
|
+
const handleScrapeWebPage = async (input, id) => {
|
|
39
|
+
const { url } = input;
|
|
40
|
+
const content = await (0, web_scraper_1.scrapeWebPage)(url);
|
|
41
|
+
if (!content) {
|
|
42
|
+
return `<web_scraping_error url="${url}">Failed to scrape the web page.</web_scraping_error>`;
|
|
43
|
+
}
|
|
44
|
+
return `<web_scraped_content url="${url}">${content}</web_scraped_content>`;
|
|
45
|
+
};
|
|
46
|
+
exports.handleScrapeWebPage = handleScrapeWebPage;
|
|
47
|
+
const createPty = (dir) => {
|
|
48
|
+
const isWindows = os.platform() === 'win32';
|
|
49
|
+
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
|
|
50
|
+
const persistentPty = pty.spawn(shell, [], {
|
|
51
|
+
name: 'xterm-256color',
|
|
52
|
+
cols: process.stdout.columns || 80,
|
|
53
|
+
rows: process.stdout.rows || 24,
|
|
54
|
+
cwd: dir,
|
|
55
|
+
env: {
|
|
56
|
+
...process.env,
|
|
57
|
+
TERM: 'xterm-256color',
|
|
58
|
+
PAGER: 'cat',
|
|
59
|
+
GIT_PAGER: 'cat',
|
|
60
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
61
|
+
...(isWindows ? { TERM: 'cygwin' } : {}),
|
|
62
|
+
LESS: '-FRX',
|
|
63
|
+
TERM_PROGRAM: 'mintty',
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
return persistentPty;
|
|
67
|
+
};
|
|
68
|
+
let persistentPty = null;
|
|
69
|
+
const resetPtyShell = (dir) => {
|
|
70
|
+
if (persistentPty) {
|
|
71
|
+
persistentPty.kill();
|
|
72
|
+
}
|
|
73
|
+
persistentPty = createPty(dir);
|
|
74
|
+
};
|
|
75
|
+
exports.resetPtyShell = resetPtyShell;
|
|
76
|
+
const handleRunTerminalCommand = async (input, id, mode) => {
|
|
77
|
+
// Note: With PTY, all output comes through stdout since it emulates a real terminal
|
|
78
|
+
const { command } = input;
|
|
79
|
+
return new Promise((resolve) => {
|
|
80
|
+
if (!persistentPty) {
|
|
81
|
+
throw new Error('Persistent PTY not initialized');
|
|
82
|
+
}
|
|
83
|
+
const ptyProcess = persistentPty;
|
|
84
|
+
const MAX_EXECUTION_TIME = 10_000;
|
|
85
|
+
let stdout = '';
|
|
86
|
+
if (mode === 'assistant') {
|
|
87
|
+
console.log();
|
|
88
|
+
console.log((0, picocolors_1.green)(`> ${command}`));
|
|
89
|
+
}
|
|
90
|
+
const timer = setTimeout(() => {
|
|
91
|
+
if (mode === 'assistant') {
|
|
92
|
+
// Kill and recreated PTY
|
|
93
|
+
(0, exports.resetPtyShell)((0, project_files_1.getProjectRoot)());
|
|
94
|
+
resolve({
|
|
95
|
+
result: formatResult(stdout, undefined, `Command timed out after ${MAX_EXECUTION_TIME / 1000} seconds and was terminated. Shell has been restarted.`),
|
|
96
|
+
stdout,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, MAX_EXECUTION_TIME);
|
|
100
|
+
let streamedCommand = '';
|
|
101
|
+
let commandOutput = '';
|
|
102
|
+
const dataDisposable = ptyProcess.onData((data) => {
|
|
103
|
+
// Shell prompt means command is complete
|
|
104
|
+
if (data.includes('bash-3.2$ ')) {
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
dataDisposable.dispose();
|
|
107
|
+
if (command.startsWith('cd ') && mode === 'user') {
|
|
108
|
+
const newWorkingDirectory = command.split(' ')[1];
|
|
109
|
+
(0, project_files_1.setProjectRoot)(path_1.default.join((0, project_files_1.getProjectRoot)(), newWorkingDirectory));
|
|
110
|
+
}
|
|
111
|
+
resolve({
|
|
112
|
+
result: formatResult(commandOutput, undefined, 'Command completed'),
|
|
113
|
+
stdout: commandOutput,
|
|
114
|
+
});
|
|
115
|
+
if (mode === 'assistant') {
|
|
116
|
+
console.log((0, picocolors_1.green)(`Command completed\n`));
|
|
117
|
+
}
|
|
118
|
+
// Reset the PTY to the project root
|
|
119
|
+
ptyProcess.write(`cd ${(0, project_files_1.getProjectRoot)()}\r`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const prefix = (streamedCommand + data).trim();
|
|
123
|
+
// Skip command echo and partial command echoes
|
|
124
|
+
if (command.startsWith(prefix)) {
|
|
125
|
+
streamedCommand += data;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
// Check if prefix contains the command and some output
|
|
129
|
+
if (!streamedCommand.startsWith(command) && prefix.startsWith(command)) {
|
|
130
|
+
streamedCommand += data;
|
|
131
|
+
data = prefix.slice(command.length);
|
|
132
|
+
}
|
|
133
|
+
// Try to detect error messages in the output
|
|
134
|
+
if (mode === 'user' &&
|
|
135
|
+
(data.includes('command not found') ||
|
|
136
|
+
data.includes(': not found') ||
|
|
137
|
+
data.includes('syntax error:') ||
|
|
138
|
+
data.includes('Syntax error:') ||
|
|
139
|
+
data.includes('is not recognized as an internal or external command') ||
|
|
140
|
+
data.includes('/bin/sh: -c: line') ||
|
|
141
|
+
data.includes('/bin/sh: line') ||
|
|
142
|
+
data.startsWith('fatal:') ||
|
|
143
|
+
data.startsWith('error:'))) {
|
|
144
|
+
clearTimeout(timer);
|
|
145
|
+
dataDisposable.dispose();
|
|
146
|
+
resolve({
|
|
147
|
+
result: 'command not found',
|
|
148
|
+
stdout: commandOutput,
|
|
149
|
+
});
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
process.stdout.write(data);
|
|
153
|
+
commandOutput += data;
|
|
154
|
+
});
|
|
155
|
+
// Write the command
|
|
156
|
+
ptyProcess.write(command + '\r');
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
exports.handleRunTerminalCommand = handleRunTerminalCommand;
|
|
160
|
+
const truncate = (str, maxLength) => {
|
|
161
|
+
return str.length > maxLength
|
|
162
|
+
? str.slice(0, maxLength) + '\n[...TRUNCATED_DUE_TO_LENGTH]'
|
|
163
|
+
: str;
|
|
164
|
+
};
|
|
165
|
+
function formatResult(stdout, stderr, status, exitCode) {
|
|
166
|
+
let result = '<terminal_command_result>\n';
|
|
167
|
+
result += `<stdout>${truncate(stdout, 10000)}</stdout>\n`;
|
|
168
|
+
if (stderr !== undefined) {
|
|
169
|
+
result += `<stderr>${truncate(stderr, 10000)}</stderr>\n`;
|
|
170
|
+
}
|
|
171
|
+
if (status !== undefined) {
|
|
172
|
+
result += `<status>${status}</status>\n`;
|
|
173
|
+
}
|
|
174
|
+
if (exitCode !== undefined && exitCode !== null) {
|
|
175
|
+
result += `<exit_code>${exitCode}</exit_code>\n`;
|
|
176
|
+
}
|
|
177
|
+
result += '</terminal_command_result>';
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
const handleCodeSearch = async (input, id) => {
|
|
181
|
+
return new Promise((resolve) => {
|
|
182
|
+
let stdout = '';
|
|
183
|
+
let stderr = '';
|
|
184
|
+
const command = `${path_1.default.resolve(ripgrep_1.rgPath)} ${input.pattern} .`;
|
|
185
|
+
console.log();
|
|
186
|
+
console.log((0, picocolors_1.green)(`Searching project for: ${input.pattern}`));
|
|
187
|
+
const childProcess = (0, child_process_1.spawn)(command, {
|
|
188
|
+
cwd: (0, project_files_1.getProjectRoot)(),
|
|
189
|
+
shell: true,
|
|
190
|
+
});
|
|
191
|
+
childProcess.stdout.on('data', (data) => {
|
|
192
|
+
stdout += data.toString();
|
|
193
|
+
});
|
|
194
|
+
childProcess.stderr.on('data', (data) => {
|
|
195
|
+
stderr += data.toString();
|
|
196
|
+
});
|
|
197
|
+
childProcess.on('close', (code) => {
|
|
198
|
+
console.log();
|
|
199
|
+
const truncatedStdout = truncate(stdout, 10000);
|
|
200
|
+
const truncatedStderr = truncate(stderr, 1000);
|
|
201
|
+
resolve(formatResult(truncatedStdout, truncatedStderr, 'Code search completed', code));
|
|
202
|
+
});
|
|
203
|
+
childProcess.on('error', (error) => {
|
|
204
|
+
resolve(`<terminal_command_error>Failed to execute ripgrep: ${error.message}</terminal_command_error>`);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
exports.handleCodeSearch = handleCodeSearch;
|
|
209
|
+
exports.toolHandlers = {
|
|
210
|
+
scrape_web_page: exports.handleScrapeWebPage,
|
|
211
|
+
run_terminal_command: ((input, id) => (0, exports.handleRunTerminalCommand)(input, id, 'assistant').then((result) => result.result)),
|
|
212
|
+
continue: async (input, id) => input.response ?? 'Please continue',
|
|
213
|
+
code_search: exports.handleCodeSearch,
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=tool-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-handlers.js","sourceRoot":"","sources":["../src/tool-handlers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAqC;AACrC,gDAAuB;AACvB,2CAAkC;AAClC,6CAAwC;AACxC,uCAAwB;AACxB,8CAA+B;AAE/B,+CAA6C;AAC7C,mDAAgE;AAIzD,MAAM,mBAAmB,GAAgB,KAAK,EACnD,KAAsB,EACtB,EAAU,EACV,EAAE;IACF,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAA;IACrB,MAAM,OAAO,GAAG,MAAM,IAAA,2BAAa,EAAC,GAAG,CAAC,CAAA;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,4BAA4B,GAAG,uDAAuD,CAAA;IAC/F,CAAC;IACD,OAAO,6BAA6B,GAAG,KAAK,OAAO,wBAAwB,CAAA;AAC7E,CAAC,CAAA;AAVY,QAAA,mBAAmB,uBAU/B;AAED,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE;IAChC,MAAM,SAAS,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAA;IAC3C,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAA;IACnE,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE;QACzC,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE;QAClC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,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AAC,CAAC,CAAA;AACJ,CAAC,CAAA;AA5CY,QAAA,gBAAgB,oBA4C5B;AAEY,QAAA,YAAY,GAAgC;IACvD,eAAe,EAAE,2BAAmB;IACpC,oBAAoB,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CACnC,IAAA,gCAAwB,EAAC,KAAK,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,IAAI,CACnD,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAC1B,CAAgB;IACnB,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,IAAI,iBAAiB;IAClE,WAAW,EAAE,wBAAgB;CAC9B,CAAA"}
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function updateCodebuff(): Promise<void>;
|