codebuff 1.0.250 → 1.0.251
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/package.json +1 -1
- package/dist/background-process-manager.js +0 -359
- package/dist/background-process-manager.js.map +0 -1
- package/dist/browser-runner.js +0 -680
- package/dist/browser-runner.js.map +0 -1
- package/dist/chat-storage.js +0 -93
- package/dist/chat-storage.js.map +0 -1
- package/dist/checkpoints/checkpoint-manager.js +0 -280
- package/dist/checkpoints/checkpoint-manager.js.map +0 -1
- package/dist/cli-handlers/api-key.js +0 -66
- package/dist/cli-handlers/api-key.js.map +0 -1
- package/dist/cli-handlers/checkpoint.js +0 -195
- package/dist/cli-handlers/checkpoint.js.map +0 -1
- package/dist/cli-handlers/diff.js +0 -31
- package/dist/cli-handlers/diff.js.map +0 -1
- package/dist/cli-handlers/inititalization-flow.js +0 -24
- package/dist/cli-handlers/inititalization-flow.js.map +0 -1
- package/dist/cli.js +0 -478
- package/dist/cli.js.map +0 -1
- package/dist/client.js +0 -836
- package/dist/client.js.map +0 -1
- package/dist/credentials.js +0 -38
- package/dist/credentials.js.map +0 -1
- package/dist/dev-process-manager.js +0 -54
- package/dist/dev-process-manager.js.map +0 -1
- package/dist/index.js +0 -117
- package/dist/index.js.map +0 -1
- package/dist/menu.js +0 -126
- package/dist/menu.js.map +0 -1
- package/dist/project-files.js +0 -513
- package/dist/project-files.js.map +0 -1
- package/dist/startup-process-handler.js +0 -21
- package/dist/startup-process-handler.js.map +0 -1
- package/dist/tool-handlers.js +0 -240
- package/dist/tool-handlers.js.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/utils/__tests__/tool-renderers.test.js +0 -51
- package/dist/utils/__tests__/tool-renderers.test.js.map +0 -1
- package/dist/utils/__tests__/xml-stream-parser.test.js +0 -229
- package/dist/utils/__tests__/xml-stream-parser.test.js.map +0 -1
- package/dist/utils/analytics.js +0 -59
- package/dist/utils/analytics.js.map +0 -1
- package/dist/utils/logger.js +0 -105
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/terminal.js +0 -474
- package/dist/utils/terminal.js.map +0 -1
- package/dist/utils/tool-renderers.js +0 -145
- package/dist/utils/tool-renderers.js.map +0 -1
- package/dist/utils/xml-stream-parser.js +0 -128
- package/dist/utils/xml-stream-parser.js.map +0 -1
- package/dist/web-scraper.js +0 -57
- package/dist/web-scraper.js.map +0 -1
- package/dist/workers/project-context.js +0 -17
- package/dist/workers/project-context.js.map +0 -1
package/dist/project-files.js
DELETED
|
@@ -1,513 +0,0 @@
|
|
|
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.deleteFile = exports.getProjectFileContext = exports.currentChatId = void 0;
|
|
30
|
-
exports.isDir = isDir;
|
|
31
|
-
exports.getProjectDataDir = getProjectDataDir;
|
|
32
|
-
exports.getCurrentChatDir = getCurrentChatDir;
|
|
33
|
-
exports.setProjectRoot = setProjectRoot;
|
|
34
|
-
exports.getProjectRoot = getProjectRoot;
|
|
35
|
-
exports.initProjectFileContextWithWorker = initProjectFileContextWithWorker;
|
|
36
|
-
exports.getChangesSinceLastFileVersion = getChangesSinceLastFileVersion;
|
|
37
|
-
exports.getFiles = getFiles;
|
|
38
|
-
exports.getFilesOrNull = getFilesOrNull;
|
|
39
|
-
exports.getExistingFiles = getExistingFiles;
|
|
40
|
-
exports.addScrapedContentToFiles = addScrapedContentToFiles;
|
|
41
|
-
exports.getFilesAbsolutePath = getFilesAbsolutePath;
|
|
42
|
-
exports.setFiles = setFiles;
|
|
43
|
-
exports.getFileBlocks = getFileBlocks;
|
|
44
|
-
const child_process_1 = require("child_process");
|
|
45
|
-
const fs_1 = __importStar(require("fs"));
|
|
46
|
-
const os_1 = __importDefault(require("os"));
|
|
47
|
-
const path_1 = __importStar(require("path"));
|
|
48
|
-
const util_1 = require("util");
|
|
49
|
-
const worker_threads_1 = require("worker_threads");
|
|
50
|
-
const parse_1 = require("./code-map/parse");
|
|
51
|
-
const constants_1 = require("./common/constants");
|
|
52
|
-
const project_file_tree_1 = require("./common/project-file-tree");
|
|
53
|
-
const file_1 = require("./common/util/file");
|
|
54
|
-
const object_1 = require("./common/util/object");
|
|
55
|
-
const diff_1 = require("diff");
|
|
56
|
-
const picocolors_1 = require("picocolors");
|
|
57
|
-
const checkpoint_manager_1 = require("./checkpoints/checkpoint-manager");
|
|
58
|
-
const credentials_1 = require("./credentials");
|
|
59
|
-
const system_info_1 = require("./utils/system-info");
|
|
60
|
-
const web_scraper_1 = require("./web-scraper");
|
|
61
|
-
// Global variables for chat management
|
|
62
|
-
// Initialize chat ID on first import
|
|
63
|
-
exports.currentChatId = new Date().toISOString().replace(/:/g, '-');
|
|
64
|
-
function isDir(p) {
|
|
65
|
-
try {
|
|
66
|
-
return (0, fs_1.statSync)(p).isDirectory();
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Get the project-specific data directory
|
|
73
|
-
function getProjectDataDir() {
|
|
74
|
-
const root = getProjectRoot();
|
|
75
|
-
if (!root) {
|
|
76
|
-
throw new Error('Project root not set. Call setProjectRoot() first.');
|
|
77
|
-
}
|
|
78
|
-
const baseName = path_1.default.basename(root);
|
|
79
|
-
const baseDir = path_1.default.join(credentials_1.CONFIG_DIR, 'projects', baseName);
|
|
80
|
-
// TODO: Need to handle duplicate project directories after adding automatic
|
|
81
|
-
// feedback feature
|
|
82
|
-
return baseDir;
|
|
83
|
-
}
|
|
84
|
-
function getCurrentChatDir() {
|
|
85
|
-
const dir = path_1.default.join(getProjectDataDir(), 'chats', exports.currentChatId);
|
|
86
|
-
(0, file_1.ensureDirectoryExists)(dir);
|
|
87
|
-
return dir;
|
|
88
|
-
}
|
|
89
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
90
|
-
let projectRoot;
|
|
91
|
-
function setProjectRoot(dir) {
|
|
92
|
-
const newDir = path_1.default.resolve(dir || getCurrentDirectory());
|
|
93
|
-
if ((0, fs_1.existsSync)(newDir)) {
|
|
94
|
-
if (projectRoot) {
|
|
95
|
-
checkpoint_manager_1.checkpointManager.clearCheckpoints(true);
|
|
96
|
-
console.log((0, picocolors_1.green)('\nDirectory change:'), `Codebuff will read and write files in "${newDir}".\n`);
|
|
97
|
-
}
|
|
98
|
-
projectRoot = newDir;
|
|
99
|
-
return newDir;
|
|
100
|
-
}
|
|
101
|
-
return projectRoot;
|
|
102
|
-
}
|
|
103
|
-
function getProjectRoot() {
|
|
104
|
-
return projectRoot;
|
|
105
|
-
}
|
|
106
|
-
function getCurrentDirectory() {
|
|
107
|
-
try {
|
|
108
|
-
return process.cwd();
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
throw new Error('Failed to get current working directory. Is this directory deleted?', { cause: error });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
let cachedProjectFileContext;
|
|
115
|
-
function initProjectFileContextWithWorker(dir) {
|
|
116
|
-
// NOTE: Uses the built worker-script-project-context.js within dist.
|
|
117
|
-
// So you need to run `bun run build` before running locally.
|
|
118
|
-
const workerPath = __filename.endsWith('.ts')
|
|
119
|
-
? path_1.default.join(__dirname, '..', 'dist', 'workers/project-context.js')
|
|
120
|
-
: path_1.default.join(__dirname, 'workers/project-context.js');
|
|
121
|
-
const worker = new worker_threads_1.Worker(workerPath);
|
|
122
|
-
worker.postMessage({ dir });
|
|
123
|
-
return new Promise((resolve, reject) => {
|
|
124
|
-
worker.on('message', (initFileContext) => {
|
|
125
|
-
worker.terminate();
|
|
126
|
-
cachedProjectFileContext = initFileContext;
|
|
127
|
-
resolve(initFileContext);
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Retrieves or updates the project file context for a given project.
|
|
133
|
-
*
|
|
134
|
-
* This function gathers comprehensive information about the project's files, structure,
|
|
135
|
-
* and state. It either creates a new context if one doesn't exist for the specified
|
|
136
|
-
* project root, or updates an existing cached context with new information.
|
|
137
|
-
*
|
|
138
|
-
* The context includes:
|
|
139
|
-
* - File tree structure
|
|
140
|
-
* - Token scores for code analysis
|
|
141
|
-
* - Knowledge files (project-specific documentation)
|
|
142
|
-
* - User knowledge files (from home directory)
|
|
143
|
-
* - Git changes and status
|
|
144
|
-
* - Changes since the last file version
|
|
145
|
-
* - Shell configuration files
|
|
146
|
-
* - System information
|
|
147
|
-
*
|
|
148
|
-
* @param {string} projectRoot - The root directory path of the project
|
|
149
|
-
* @param {Record<string, string>} lastFileVersion - Record of the last known file versions
|
|
150
|
-
* @param {FileVersion[][]} newFileVersions - Array of file version arrays, representing the history of file changes
|
|
151
|
-
* @returns {Promise<ProjectFileContext>} A promise that resolves to the project file context object
|
|
152
|
-
*/
|
|
153
|
-
const getProjectFileContext = async (projectRoot, lastFileVersion) => {
|
|
154
|
-
const gitChanges = await getGitChanges();
|
|
155
|
-
const changesSinceLastChat = getChangesSinceLastFileVersion(lastFileVersion);
|
|
156
|
-
if (!cachedProjectFileContext ||
|
|
157
|
-
cachedProjectFileContext.currentWorkingDirectory !== projectRoot) {
|
|
158
|
-
const fileTree = (0, project_file_tree_1.getProjectFileTree)(projectRoot);
|
|
159
|
-
const flattenedNodes = (0, project_file_tree_1.flattenTree)(fileTree);
|
|
160
|
-
const allFilePaths = flattenedNodes
|
|
161
|
-
.filter((node) => node.type === 'file')
|
|
162
|
-
.map((node) => node.filePath);
|
|
163
|
-
const knowledgeFilePaths = allFilePaths.filter((filePath) => {
|
|
164
|
-
const lowercaseFilePath = filePath.toLowerCase();
|
|
165
|
-
return (lowercaseFilePath.endsWith('knowledge.md') ||
|
|
166
|
-
lowercaseFilePath.endsWith('claude.md'));
|
|
167
|
-
});
|
|
168
|
-
const knowledgeFiles = getExistingFiles(knowledgeFilePaths);
|
|
169
|
-
const knowledgeFilesWithScrapedContent = await addScrapedContentToFiles(knowledgeFiles);
|
|
170
|
-
// Get knowledge files from user's home directory
|
|
171
|
-
const homeDir = os_1.default.homedir();
|
|
172
|
-
const userKnowledgeFiles = findKnowledgeFilesInDir(homeDir);
|
|
173
|
-
const userKnowledgeFilesWithScrapedContent = await addScrapedContentToFiles(userKnowledgeFiles);
|
|
174
|
-
const shellConfigFiles = loadShellConfigFiles();
|
|
175
|
-
const fileTokenScores = await (0, parse_1.getFileTokenScores)(projectRoot, allFilePaths);
|
|
176
|
-
cachedProjectFileContext = {
|
|
177
|
-
currentWorkingDirectory: projectRoot,
|
|
178
|
-
fileTree,
|
|
179
|
-
fileTokenScores,
|
|
180
|
-
knowledgeFiles: knowledgeFilesWithScrapedContent,
|
|
181
|
-
shellConfigFiles,
|
|
182
|
-
systemInfo: (0, system_info_1.getSystemInfo)(),
|
|
183
|
-
userKnowledgeFiles: userKnowledgeFilesWithScrapedContent,
|
|
184
|
-
gitChanges,
|
|
185
|
-
changesSinceLastChat,
|
|
186
|
-
fileVersions: [],
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
return cachedProjectFileContext;
|
|
190
|
-
};
|
|
191
|
-
exports.getProjectFileContext = getProjectFileContext;
|
|
192
|
-
/**
|
|
193
|
-
* Retrieves information about the current state of the Git repository.
|
|
194
|
-
*
|
|
195
|
-
* This asynchronous function executes several Git commands to gather comprehensive
|
|
196
|
-
* information about the repository's current state, including:
|
|
197
|
-
* - Current status (modified files, untracked files, etc.)
|
|
198
|
-
* - Uncommitted changes (diff)
|
|
199
|
-
* - Staged changes (cached diff)
|
|
200
|
-
* - Recent commit messages (from the last 10 commits)
|
|
201
|
-
*
|
|
202
|
-
* The function uses the global projectRoot variable to determine which repository
|
|
203
|
-
* to query. If any Git command fails (e.g., if the directory is not a Git repository),
|
|
204
|
-
* the function gracefully handles the error and returns empty strings for all properties.
|
|
205
|
-
*
|
|
206
|
-
* @returns {Promise<{status: string, diff: string, diffCached: string, lastCommitMessages: string}>}
|
|
207
|
-
* A promise that resolves to an object containing Git repository information:
|
|
208
|
-
* - status: Output of 'git status' command
|
|
209
|
-
* - diff: Output of 'git diff' command showing uncommitted changes
|
|
210
|
-
* - diffCached: Output of 'git diff --cached' command showing staged changes
|
|
211
|
-
* - lastCommitMessages: Recent commit messages, formatted as a newline-separated string
|
|
212
|
-
*/
|
|
213
|
-
async function getGitChanges() {
|
|
214
|
-
try {
|
|
215
|
-
const { stdout: status } = await execAsync('git status', {
|
|
216
|
-
cwd: projectRoot,
|
|
217
|
-
});
|
|
218
|
-
const { stdout: diff } = await execAsync('git diff', { cwd: projectRoot });
|
|
219
|
-
const { stdout: diffCached } = await execAsync('git diff --cached', {
|
|
220
|
-
cwd: projectRoot,
|
|
221
|
-
});
|
|
222
|
-
const { stdout: shortLogOutput } = await execAsync('git shortlog HEAD~10..HEAD', {
|
|
223
|
-
cwd: projectRoot,
|
|
224
|
-
});
|
|
225
|
-
const shortLogLines = shortLogOutput.trim().split('\n');
|
|
226
|
-
const lastCommitMessages = shortLogLines
|
|
227
|
-
.slice(1)
|
|
228
|
-
.reverse()
|
|
229
|
-
.map((line) => line.trim())
|
|
230
|
-
.join('\n');
|
|
231
|
-
return { status, diff, diffCached, lastCommitMessages };
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
return { status: '', diff: '', diffCached: '', lastCommitMessages: '' };
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Identifies changes between the last known version of files and their current state on disk.
|
|
239
|
-
*
|
|
240
|
-
* This function compares each file in the provided lastFileVersion record with its current
|
|
241
|
-
* content on disk. For files that have changed, it generates a patch using the diff library's
|
|
242
|
-
* createPatch function. Files that haven't changed or can't be read are filtered out from
|
|
243
|
-
* the result.
|
|
244
|
-
*
|
|
245
|
-
* The function is used to track changes made to files since the last interaction or session,
|
|
246
|
-
* which helps maintain context about what has changed in the project over time.
|
|
247
|
-
*
|
|
248
|
-
* @param {Record<string, string>} lastFileVersion - A record mapping file paths to their
|
|
249
|
-
* content as of the last known version
|
|
250
|
-
* @returns {Record<string, string>} A record mapping file paths to patch strings for files
|
|
251
|
-
* that have changed since the last version. Files that haven't changed or couldn't
|
|
252
|
-
* be read are not included in the result.
|
|
253
|
-
*/
|
|
254
|
-
function getChangesSinceLastFileVersion(lastFileVersion) {
|
|
255
|
-
const changes = Object.entries(lastFileVersion)
|
|
256
|
-
.map(([filePath, file]) => {
|
|
257
|
-
const fullFilePath = path_1.default.join(getProjectRoot(), filePath);
|
|
258
|
-
try {
|
|
259
|
-
const currentContent = fs_1.default.readFileSync(fullFilePath, 'utf8');
|
|
260
|
-
if (currentContent === file) {
|
|
261
|
-
return [filePath, null];
|
|
262
|
-
}
|
|
263
|
-
return [filePath, (0, diff_1.createPatch)(filePath, file, currentContent)];
|
|
264
|
-
}
|
|
265
|
-
catch (error) {
|
|
266
|
-
// console.error(`Error reading file ${fullFilePath}:`, error)
|
|
267
|
-
return [filePath, null];
|
|
268
|
-
}
|
|
269
|
-
})
|
|
270
|
-
.filter(([_, diff]) => diff !== null);
|
|
271
|
-
return Object.fromEntries(changes);
|
|
272
|
-
}
|
|
273
|
-
function getFiles(filePaths) {
|
|
274
|
-
const result = {};
|
|
275
|
-
const MAX_FILE_SIZE = 1024 * 1024; // 1MB in bytes
|
|
276
|
-
const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
|
|
277
|
-
for (const filePath of filePaths) {
|
|
278
|
-
if (!filePath) {
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
// Convert absolute paths within project to relative paths
|
|
282
|
-
const relativePath = filePath.startsWith(projectRoot)
|
|
283
|
-
? path_1.default.relative(projectRoot, filePath)
|
|
284
|
-
: filePath;
|
|
285
|
-
const fullPath = path_1.default.join(projectRoot, relativePath);
|
|
286
|
-
if ((0, path_1.isAbsolute)(relativePath) || !fullPath.startsWith(projectRoot)) {
|
|
287
|
-
result[relativePath] = constants_1.FILE_READ_STATUS.OUTSIDE_PROJECT;
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
try {
|
|
291
|
-
if (ig.ignores(relativePath)) {
|
|
292
|
-
result[relativePath] = constants_1.FILE_READ_STATUS.IGNORED;
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
catch (error) {
|
|
297
|
-
result[relativePath] = constants_1.FILE_READ_STATUS.ERROR;
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
try {
|
|
301
|
-
const stats = fs_1.default.statSync(fullPath);
|
|
302
|
-
if (stats.size > MAX_FILE_SIZE) {
|
|
303
|
-
result[relativePath] =
|
|
304
|
-
constants_1.FILE_READ_STATUS.TOO_LARGE +
|
|
305
|
-
` [${(stats.size / (1024 * 1024)).toFixed(2)}MB]`;
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
const content = fs_1.default.readFileSync(fullPath, 'utf8');
|
|
309
|
-
result[relativePath] = content;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
catch (error) {
|
|
313
|
-
if (error &&
|
|
314
|
-
typeof error === 'object' &&
|
|
315
|
-
'code' in error &&
|
|
316
|
-
error.code === 'ENOENT') {
|
|
317
|
-
result[relativePath] = constants_1.FILE_READ_STATUS.DOES_NOT_EXIST;
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
result[relativePath] = constants_1.FILE_READ_STATUS.ERROR;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
return result;
|
|
325
|
-
}
|
|
326
|
-
function getFilesOrNull(filePaths) {
|
|
327
|
-
const result = getFiles(filePaths);
|
|
328
|
-
return Object.fromEntries(Object.entries(result).map(([filePath, content]) => [
|
|
329
|
-
filePath,
|
|
330
|
-
(0, constants_1.toOptionalFile)(content),
|
|
331
|
-
]));
|
|
332
|
-
}
|
|
333
|
-
function getExistingFiles(filePaths) {
|
|
334
|
-
return (0, object_1.filterObject)(getFilesOrNull(filePaths), (value) => value !== null);
|
|
335
|
-
}
|
|
336
|
-
async function addScrapedContentToFiles(files) {
|
|
337
|
-
const newFiles = { ...files };
|
|
338
|
-
await Promise.all(Object.entries(files).map(async ([filePath, content]) => {
|
|
339
|
-
const urls = (0, web_scraper_1.parseUrlsFromContent)(content);
|
|
340
|
-
const scrapedContent = await (0, web_scraper_1.getScrapedContentBlocks)(urls);
|
|
341
|
-
newFiles[filePath] =
|
|
342
|
-
content +
|
|
343
|
-
(scrapedContent.length > 0 ? '\n' : '') +
|
|
344
|
-
scrapedContent.join('\n');
|
|
345
|
-
}));
|
|
346
|
-
return newFiles;
|
|
347
|
-
}
|
|
348
|
-
function findKnowledgeFilesInDir(dir) {
|
|
349
|
-
const result = {};
|
|
350
|
-
try {
|
|
351
|
-
const files = fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
352
|
-
for (const file of files) {
|
|
353
|
-
if (!file.isDirectory() && file.name.endsWith('knowledge.md')) {
|
|
354
|
-
const fullPath = path_1.default.join(dir, file.name);
|
|
355
|
-
try {
|
|
356
|
-
const content = fs_1.default.readFileSync(fullPath, 'utf8');
|
|
357
|
-
result[file.name] = content;
|
|
358
|
-
}
|
|
359
|
-
catch (error) {
|
|
360
|
-
// Skip files we can't read
|
|
361
|
-
console.error(`Error reading knowledge file ${fullPath}:`, error);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
catch (error) {
|
|
367
|
-
// Skip directories we can't read
|
|
368
|
-
console.error(`Error reading directory ${dir}:`, error);
|
|
369
|
-
}
|
|
370
|
-
return result;
|
|
371
|
-
}
|
|
372
|
-
function getFilesAbsolutePath(filePaths) {
|
|
373
|
-
const result = {};
|
|
374
|
-
for (const filePath of filePaths) {
|
|
375
|
-
try {
|
|
376
|
-
const content = fs_1.default.readFileSync(filePath, 'utf8');
|
|
377
|
-
result[filePath] = content;
|
|
378
|
-
}
|
|
379
|
-
catch (error) {
|
|
380
|
-
result[filePath] = null;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return result;
|
|
384
|
-
}
|
|
385
|
-
function setFiles(files) {
|
|
386
|
-
for (const [filePath, content] of Object.entries(files)) {
|
|
387
|
-
const fullPath = path_1.default.join(projectRoot, filePath);
|
|
388
|
-
fs_1.default.writeFileSync(fullPath, content, 'utf8');
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
function getFileBlocks(filePaths) {
|
|
392
|
-
const result = {};
|
|
393
|
-
for (const filePath of filePaths) {
|
|
394
|
-
const fullPath = path_1.default.join(projectRoot, filePath);
|
|
395
|
-
try {
|
|
396
|
-
const content = fs_1.default.readFileSync(fullPath, 'utf8');
|
|
397
|
-
result[filePath] = content;
|
|
398
|
-
}
|
|
399
|
-
catch (error) {
|
|
400
|
-
const fileDoesNotExist = error instanceof Error &&
|
|
401
|
-
error.message.includes('no such file or directory');
|
|
402
|
-
result[filePath] = fileDoesNotExist
|
|
403
|
-
? '[FILE_DOES_NOT_EXIST]'
|
|
404
|
-
: '[FILE_READ_ERROR]';
|
|
405
|
-
if (!fileDoesNotExist) {
|
|
406
|
-
console.error(`Error reading file ${fullPath}:`, error instanceof Error ? error.message : error);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
const fileBlocks = filePaths.map((filePath) => (0, file_1.createWriteFileBlock)(filePath, result[filePath]));
|
|
411
|
-
return fileBlocks.join('\n');
|
|
412
|
-
}
|
|
413
|
-
const loadShellConfigFiles = () => {
|
|
414
|
-
const homeDir = os_1.default.homedir();
|
|
415
|
-
const configFiles = [
|
|
416
|
-
path_1.default.join(homeDir, '.bashrc'),
|
|
417
|
-
path_1.default.join(homeDir, '.bash_profile'),
|
|
418
|
-
path_1.default.join(homeDir, '.bash_login'),
|
|
419
|
-
path_1.default.join(homeDir, '.profile'),
|
|
420
|
-
path_1.default.join(homeDir, '.zshrc'),
|
|
421
|
-
path_1.default.join(homeDir, '.kshrc'),
|
|
422
|
-
];
|
|
423
|
-
const files = getFilesAbsolutePath(configFiles);
|
|
424
|
-
return (0, object_1.filterObject)(files, (value) => value !== null);
|
|
425
|
-
};
|
|
426
|
-
/*
|
|
427
|
-
function getExportedTokensForFiles(
|
|
428
|
-
filePaths: string[]
|
|
429
|
-
): Record<string, string[]> {
|
|
430
|
-
const result: Record<string, string[]> = {}
|
|
431
|
-
const fullFilePaths = filePaths.map((filePath) =>
|
|
432
|
-
path.join(projectRoot, filePath)
|
|
433
|
-
)
|
|
434
|
-
const program = ts.createProgram(fullFilePaths, {})
|
|
435
|
-
|
|
436
|
-
for (let i = 0; i < filePaths.length; i++) {
|
|
437
|
-
const filePath = filePaths[i]
|
|
438
|
-
const fullFilePath = fullFilePaths[i]
|
|
439
|
-
const sourceFile = program.getSourceFile(fullFilePath)
|
|
440
|
-
if (sourceFile) {
|
|
441
|
-
try {
|
|
442
|
-
const exportedTokens = getExportedTokens(sourceFile)
|
|
443
|
-
result[filePath] = exportedTokens
|
|
444
|
-
} catch (error) {
|
|
445
|
-
console.error(`Error processing file ${fullFilePath}:`, error)
|
|
446
|
-
result[filePath] = []
|
|
447
|
-
}
|
|
448
|
-
} else {
|
|
449
|
-
// console.error(`Could not find source file: ${fullFilePath}`)
|
|
450
|
-
result[filePath] = []
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
return result
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
function getExportedTokens(sourceFile: ts.SourceFile): string[] {
|
|
458
|
-
const exportedTokens: string[] = []
|
|
459
|
-
|
|
460
|
-
function visit(node: ts.Node) {
|
|
461
|
-
if (ts.isExportDeclaration(node)) {
|
|
462
|
-
if (node.exportClause && ts.isNamedExports(node.exportClause)) {
|
|
463
|
-
node.exportClause.elements.forEach((element) => {
|
|
464
|
-
exportedTokens.push(element.name.text)
|
|
465
|
-
})
|
|
466
|
-
}
|
|
467
|
-
} else if (
|
|
468
|
-
ts.isFunctionDeclaration(node) ||
|
|
469
|
-
ts.isClassDeclaration(node) ||
|
|
470
|
-
ts.isVariableStatement(node)
|
|
471
|
-
) {
|
|
472
|
-
if (
|
|
473
|
-
node.modifiers?.some(
|
|
474
|
-
(modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword
|
|
475
|
-
)
|
|
476
|
-
) {
|
|
477
|
-
if (ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)) {
|
|
478
|
-
if (node.name) {
|
|
479
|
-
exportedTokens.push(node.name.text)
|
|
480
|
-
}
|
|
481
|
-
} else if (ts.isVariableStatement(node)) {
|
|
482
|
-
node.declarationList.declarations.forEach((declaration) => {
|
|
483
|
-
if (ts.isIdentifier(declaration.name)) {
|
|
484
|
-
exportedTokens.push(declaration.name.text)
|
|
485
|
-
}
|
|
486
|
-
})
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
ts.forEachChild(node, visit)
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
visit(sourceFile)
|
|
495
|
-
|
|
496
|
-
return exportedTokens
|
|
497
|
-
}
|
|
498
|
-
*/
|
|
499
|
-
const deleteFile = (fullPath) => {
|
|
500
|
-
try {
|
|
501
|
-
if (fs_1.default.existsSync(fullPath)) {
|
|
502
|
-
fs_1.default.unlinkSync(fullPath);
|
|
503
|
-
return true;
|
|
504
|
-
}
|
|
505
|
-
return false;
|
|
506
|
-
}
|
|
507
|
-
catch (error) {
|
|
508
|
-
console.error(`Error deleting file ${fullPath}:`, error);
|
|
509
|
-
return false;
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
exports.deleteFile = deleteFile;
|
|
513
|
-
//# sourceMappingURL=project-files.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-files.js","sourceRoot":"","sources":["../src/project-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,sBAMC;AAGD,8CAYC;AAED,8CAIC;AAMD,wCAeC;AAED,wCAEC;AAeD,4EAiBC;AA+ID,wEAmBC;AAED,4BAoDC;AACD,wCAQC;AAED,4CAKC;AACD,4DAcC;AAyBD,oDAWC;AAED,4BAKC;AAED,sCA+BC;AAvbD,iDAAoC;AACpC,yCAA6C;AAC7C,4CAAmB;AACnB,6CAAuC;AACvC,+BAAgC;AAChC,mDAAuC;AAEvC,0CAAmD;AACnD,gDAAmE;AACnE,gEAIiC;AACjC,2CAIyB;AACzB,+CAAiD;AACjD,+BAAkC;AAClC,2CAAkC;AAElC,yEAAoE;AACpE,+CAA0C;AAC1C,qDAAmD;AACnD,+CAA6E;AAE7E,uCAAuC;AACv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AAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC7B,CAAA;IACD,MAAM,KAAK,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAA;IAC/C,OAAO,IAAA,qBAAY,EAAC,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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logAndHandleStartup = logAndHandleStartup;
|
|
4
|
-
const picocolors_1 = require("picocolors");
|
|
5
|
-
const background_process_manager_1 = require("./background-process-manager");
|
|
6
|
-
const dev_process_manager_1 = require("./dev-process-manager");
|
|
7
|
-
function logAndHandleStartup(projectRoot, config) {
|
|
8
|
-
// First clean up any existing processes
|
|
9
|
-
const { separateCodebuffInstanceRunning, cleanUpPromise } = (0, background_process_manager_1.cleanupStoredProcesses)();
|
|
10
|
-
// Start up new processes if necessary
|
|
11
|
-
if (config?.startupProcesses) {
|
|
12
|
-
if (!separateCodebuffInstanceRunning) {
|
|
13
|
-
(0, dev_process_manager_1.startDevProcesses)(config.startupProcesses, projectRoot);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
console.log((0, picocolors_1.gray)('Another instance of codebuff detected. Skipping startup processes.'));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return cleanUpPromise;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=startup-process-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startup-process-handler.js","sourceRoot":"","sources":["../src/startup-process-handler.ts"],"names":[],"mappings":";;AAMA,kDAqBC;AA1BD,2CAAiC;AAEjC,6EAAqE;AACrE,+DAAyD;AAEzD,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,MAA6B;IAE7B,wCAAwC;IACxC,MAAM,EAAE,+BAA+B,EAAE,cAAc,EAAE,GACvD,IAAA,mDAAsB,GAAE,CAAA;IAE1B,sCAAsC;IACtC,IAAI,MAAM,EAAE,gBAAgB,EAAE,CAAC;QAC7B,IAAI,CAAC,+BAA+B,EAAE,CAAC;YACrC,IAAA,uCAAiB,EAAC,MAAM,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA;QACzD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CACT,IAAA,iBAAI,EACF,oEAAoE,CACrE,CACF,CAAA;QACH,CAAC;IACH,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC"}
|