codebuff 1.0.246 → 1.0.248
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/background-process-manager.d.ts +50 -0
- package/dist/background-process-manager.js +359 -0
- package/dist/background-process-manager.js.map +1 -0
- package/dist/browser-runner.d.ts +35 -0
- package/dist/browser-runner.js +680 -0
- package/dist/browser-runner.js.map +1 -0
- package/dist/chat-storage.d.ts +2 -0
- package/dist/chat-storage.js +93 -0
- package/dist/chat-storage.js.map +1 -0
- package/dist/checkpoints/checkpoint-manager.d.ts +94 -0
- package/dist/checkpoints/checkpoint-manager.js +280 -0
- package/dist/checkpoints/checkpoint-manager.js.map +1 -0
- package/dist/checkpoints/file-manager.d.ts +72 -0
- package/dist/checkpoints/file-manager.js +311 -0
- package/dist/checkpoints/file-manager.js.map +1 -0
- package/dist/cli-handlers/api-key.d.ts +25 -0
- package/dist/cli-handlers/api-key.js +66 -0
- package/dist/cli-handlers/api-key.js.map +1 -0
- package/dist/cli-handlers/checkpoint.d.ts +18 -0
- package/dist/cli-handlers/checkpoint.js +195 -0
- package/dist/cli-handlers/checkpoint.js.map +1 -0
- package/dist/cli-handlers/diff.d.ts +2 -0
- package/dist/cli-handlers/diff.js +31 -0
- package/dist/cli-handlers/diff.js.map +1 -0
- package/dist/cli-handlers/easter-egg.d.ts +1 -0
- package/dist/cli-handlers/easter-egg.js +126 -0
- package/dist/cli-handlers/easter-egg.js.map +1 -0
- package/dist/cli-handlers/inititalization-flow.d.ts +1 -0
- package/dist/cli-handlers/inititalization-flow.js +24 -0
- package/dist/cli-handlers/inititalization-flow.js.map +1 -0
- package/dist/cli.d.ts +44 -0
- package/dist/cli.js +478 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +157 -0
- package/dist/client.js +836 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/create-template-project.d.ts +1 -0
- package/dist/create-template-project.js +107 -0
- package/dist/create-template-project.js.map +1 -0
- package/dist/credentials.d.ts +4 -0
- package/dist/credentials.js +38 -0
- package/dist/credentials.js.map +1 -0
- package/dist/dev-process-manager.d.ts +10 -0
- package/dist/dev-process-manager.js +54 -0
- package/dist/dev-process-manager.js.map +1 -0
- package/dist/fingerprint.d.ts +1 -0
- package/dist/fingerprint.js +48 -0
- package/dist/fingerprint.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -0
- package/dist/menu.d.ts +3 -0
- package/dist/menu.js +126 -0
- package/dist/menu.js.map +1 -0
- package/dist/project-files.d.ts +114 -0
- package/dist/project-files.js +513 -0
- package/dist/project-files.js.map +1 -0
- package/dist/startup-process-handler.d.ts +2 -0
- package/dist/startup-process-handler.js +21 -0
- package/dist/startup-process-handler.js.map +1 -0
- package/dist/tool-handlers.d.ts +28 -0
- package/dist/tool-handlers.js +240 -0
- package/dist/tool-handlers.js.map +1 -0
- package/dist/types.d.ts +15 -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 +160 -0
- package/dist/update-codebuff.js.map +1 -0
- package/dist/utils/__tests__/background-process-manager.test.d.ts +1 -0
- package/dist/utils/__tests__/background-process-manager.test.js +289 -0
- package/dist/utils/__tests__/background-process-manager.test.js.map +1 -0
- package/dist/utils/__tests__/tool-renderers.test.d.ts +1 -0
- package/dist/utils/__tests__/tool-renderers.test.js +51 -0
- package/dist/utils/__tests__/tool-renderers.test.js.map +1 -0
- package/dist/utils/__tests__/xml-stream-parser.test.d.ts +1 -0
- package/dist/utils/__tests__/xml-stream-parser.test.js +229 -0
- package/dist/utils/__tests__/xml-stream-parser.test.js.map +1 -0
- package/dist/utils/analytics.d.ts +6 -0
- package/dist/utils/analytics.js +59 -0
- package/dist/utils/analytics.js.map +1 -0
- package/dist/utils/detect-shell.d.ts +1 -0
- package/dist/utils/detect-shell.js +60 -0
- package/dist/utils/detect-shell.js.map +1 -0
- package/dist/utils/logger.d.ts +21 -0
- package/dist/utils/logger.js +105 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/spinner.d.ts +11 -0
- package/dist/utils/spinner.js +87 -0
- package/dist/utils/spinner.js.map +1 -0
- package/dist/utils/system-info.d.ts +8 -0
- package/dist/utils/system-info.js +22 -0
- package/dist/utils/system-info.js.map +1 -0
- package/dist/utils/terminal.d.ts +41 -0
- package/dist/utils/terminal.js +475 -0
- package/dist/utils/terminal.js.map +1 -0
- package/dist/utils/tool-renderers.d.ts +16 -0
- package/dist/utils/tool-renderers.js +145 -0
- package/dist/utils/tool-renderers.js.map +1 -0
- package/dist/utils/xml-stream-parser.d.ts +9 -0
- package/dist/utils/xml-stream-parser.js +128 -0
- package/dist/utils/xml-stream-parser.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/workers/checkpoint-worker.d.ts +1 -0
- package/dist/workers/checkpoint-worker.js +48 -0
- package/dist/workers/checkpoint-worker.js.map +1 -0
- package/dist/workers/project-context.d.ts +1 -0
- package/dist/workers/project-context.js +17 -0
- package/dist/workers/project-context.js.map +1 -0
- package/package.json +1 -1
package/dist/menu.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
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.displayGreeting = displayGreeting;
|
|
30
|
+
exports.displayMenu = displayMenu;
|
|
31
|
+
const fs = __importStar(require("fs"));
|
|
32
|
+
const os_1 = __importDefault(require("os"));
|
|
33
|
+
const path_1 = __importDefault(require("path"));
|
|
34
|
+
const constants_1 = require("./common/constants");
|
|
35
|
+
const picocolors_1 = __importStar(require("picocolors"));
|
|
36
|
+
const project_files_1 = require("./project-files");
|
|
37
|
+
const getRandomColors = () => {
|
|
38
|
+
const allColors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan'];
|
|
39
|
+
const colors = [];
|
|
40
|
+
while (colors.length < 3) {
|
|
41
|
+
const color = allColors[Math.floor(Math.random() * allColors.length)];
|
|
42
|
+
if (!colors.includes(color)) {
|
|
43
|
+
colors.push(color);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return colors;
|
|
47
|
+
};
|
|
48
|
+
function displayGreeting(costMode, username) {
|
|
49
|
+
// Show extra info only for logged in users
|
|
50
|
+
const costModeDescription = {
|
|
51
|
+
lite: (0, picocolors_1.bold)((0, picocolors_1.yellow)('Lite mode ✨ enabled')),
|
|
52
|
+
normal: '',
|
|
53
|
+
max: (0, picocolors_1.bold)((0, picocolors_1.blueBright)('Max mode️ ⚡ enabled')),
|
|
54
|
+
experimental: (0, picocolors_1.bold)((0, picocolors_1.magenta)('Experimental mode 🧪 enabled')),
|
|
55
|
+
};
|
|
56
|
+
if (costModeDescription[costMode]) {
|
|
57
|
+
console.log(`${costModeDescription[costMode]}`);
|
|
58
|
+
}
|
|
59
|
+
console.log(`Codebuff will read and write files in "${(0, project_files_1.getProjectRoot)()}". Type "help" for a list of commands.`);
|
|
60
|
+
const gitDir = path_1.default.join((0, project_files_1.getProjectRoot)(), '.git');
|
|
61
|
+
if ((0, project_files_1.getProjectRoot)() === os_1.default.homedir()) {
|
|
62
|
+
console.info('\nTo get started:\n- cd into a project\n- ask for a code change');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (!fs.existsSync(gitDir)) {
|
|
66
|
+
console.info((0, picocolors_1.magenta)("Just fyi, this project doesn't contain a .git directory (are you at the top level of your project?). Codebuff works best with a git repo!"));
|
|
67
|
+
}
|
|
68
|
+
console.log(`\nWelcome${username ? ` back ${username}` : ''}! What would you like to do?`);
|
|
69
|
+
}
|
|
70
|
+
function displayMenu() {
|
|
71
|
+
const selectedColors = getRandomColors();
|
|
72
|
+
const getRandomColor = () => {
|
|
73
|
+
return selectedColors[Math.floor(Math.random() * selectedColors.length)];
|
|
74
|
+
};
|
|
75
|
+
const colorizeRandom = (text) => {
|
|
76
|
+
return text
|
|
77
|
+
.split('')
|
|
78
|
+
.map((char) => {
|
|
79
|
+
const color = getRandomColor();
|
|
80
|
+
return picocolors_1.default[color](char);
|
|
81
|
+
})
|
|
82
|
+
.join('');
|
|
83
|
+
};
|
|
84
|
+
process.stdout.clearLine(0);
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(`
|
|
87
|
+
${colorizeRandom(' { AI }')}
|
|
88
|
+
${colorizeRandom(' [CODER]')}
|
|
89
|
+
${colorizeRandom(' ')}
|
|
90
|
+
${colorizeRandom('██████╗')}${colorizeRandom(' ██████╗ ')}${colorizeRandom('██████╗ ')}${colorizeRandom('███████╗')}${colorizeRandom('██████╗ ')}${colorizeRandom('██╗ ██╗')}${colorizeRandom('███████╗')}${colorizeRandom('███████╗')}
|
|
91
|
+
${colorizeRandom('██╔════╝')}${colorizeRandom('██╔═══██╗')}${colorizeRandom('██╔══██╗')}${colorizeRandom('██╔════╝')}${colorizeRandom('██╔══██╗')}${colorizeRandom('██║ ██║')}${colorizeRandom('██╔════╝')}${colorizeRandom('██╔════╝')}
|
|
92
|
+
${colorizeRandom('██║ ')}${colorizeRandom('██║ ██║')}${colorizeRandom('██║ ██║')}${colorizeRandom('█████╗ ')}${colorizeRandom('██████╔╝')}${colorizeRandom('██║ ██║')}${colorizeRandom('█████╗ ')}${colorizeRandom('█████╗ ')}
|
|
93
|
+
${colorizeRandom('██║ ')}${colorizeRandom('██║ ██║')}${colorizeRandom('██║ ██║')}${colorizeRandom('██╔══╝ ')}${colorizeRandom('██╔══██╗')}${colorizeRandom('██║ ██║')}${colorizeRandom('██╔══╝ ')}${colorizeRandom('██╔══╝ ')}
|
|
94
|
+
${colorizeRandom('╚██████╗')}${colorizeRandom('╚██████╔╝')}${colorizeRandom('██████╔╝')}${colorizeRandom('███████╗')}${colorizeRandom('██████╔╝')}${colorizeRandom('╚██████╔╝')}${colorizeRandom('██║ ')}${colorizeRandom('██║ ')}
|
|
95
|
+
${colorizeRandom(' ╚═════╝')}${colorizeRandom(' ╚═════╝ ')}${colorizeRandom('╚═════╝ ')}${colorizeRandom('╚══════╝')}${colorizeRandom('╚═════╝ ')}${colorizeRandom(' ╚═════╝ ')}${colorizeRandom('╚═╝ ')}${colorizeRandom('╚═╝ ')}
|
|
96
|
+
`);
|
|
97
|
+
console.log((0, picocolors_1.bold)((0, picocolors_1.green)("Welcome! I'm your AI coding assistant.")));
|
|
98
|
+
console.log(`\nCodebuff will read and write files within your current directory (${(0, project_files_1.getProjectRoot)()}) and run commands in your terminal.`);
|
|
99
|
+
console.log('\nASK CODEBUFF TO...');
|
|
100
|
+
console.log('- Build a feature. Brain dump what you want first.');
|
|
101
|
+
console.log('- Write unit tests');
|
|
102
|
+
console.log('- Refactor a component into multiple components');
|
|
103
|
+
console.log('- Fix errors from compiling your project or running tests');
|
|
104
|
+
console.log('- Write a script.');
|
|
105
|
+
console.log('- Plan a feature before implementing it. Or, write your own plan in a file and ask Codebuff to implement it step-by-step');
|
|
106
|
+
console.log('- Build an integration after pasting in the URL to relevant documentation');
|
|
107
|
+
console.log('- "Create knowledge files for your codebase" to help Codebuff understand your project');
|
|
108
|
+
console.log('\nCommands:');
|
|
109
|
+
console.log('- Enter terminal commands directly: "cd backend", "npm test"');
|
|
110
|
+
console.log('- Use "!command" to explicitly run a terminal command (e.g. "!ls -la")');
|
|
111
|
+
console.log('- Press ESC to cancel generation');
|
|
112
|
+
console.log('- Type "init" to have Codebuff automatically configure your project for a smoother experience');
|
|
113
|
+
console.log('- Type "undo" or "redo" (abbreviated "u" or "r") to undo or redo the last change');
|
|
114
|
+
console.log('- Type "login" to log into Codebuff');
|
|
115
|
+
console.log('- Type "exit" or press Ctrl+C twice to exit Codebuff');
|
|
116
|
+
console.log('- Type "diff" or "d" to show changes from the last assistant response');
|
|
117
|
+
console.log('- Start Codebuff with --lite for efficient responses, --max for higher quality responses, or --experimental for cutting-edge features');
|
|
118
|
+
console.log('\nCheckpoint Commands:');
|
|
119
|
+
console.log('- Type "checkpoint <id>" to restore a specific checkpoint');
|
|
120
|
+
console.log('- Type "checkpoint list" or "checkpoints" to list all available checkpoints');
|
|
121
|
+
console.log(`\n- Redeem a referral code by simply pasting it here.`);
|
|
122
|
+
console.log('-', (0, picocolors_1.bold)((0, picocolors_1.green)(`Refer new users and each of you will earn ${constants_1.CREDITS_REFERRAL_BONUS} credits per month: ${process.env.NEXT_PUBLIC_APP_URL}/referrals`)));
|
|
123
|
+
console.log("\nAny files in .gitignore are not read by Codebuff. You can ignore further files with .codebuffignore, or choose files Codebuff should not ignore by adding a '!' prefix to the ignore pattern.");
|
|
124
|
+
console.log('\nEmail your feedback to', (0, picocolors_1.bold)((0, picocolors_1.blue)('founders@codebuff.com.')), 'Thanks for using Codebuff!');
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=menu.js.map
|
package/dist/menu.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../src/menu.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,0CAkCC;AAED,kCAiGC;AAjKD,uCAAwB;AACxB,4CAAmB;AACnB,gDAAuB;AAEvB,gDAAmE;AACnE,yDAOmB;AAEnB,mDAAgD;AAEhD,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;IACvE,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;QACrE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,SAAgB,eAAe,CAAC,QAAkB,EAAE,QAAuB;IACzE,2CAA2C;IAC3C,MAAM,mBAAmB,GAAG;QAC1B,IAAI,EAAE,IAAA,iBAAI,EAAC,IAAA,mBAAM,EAAC,qBAAqB,CAAC,CAAC;QACzC,MAAM,EAAE,EAAE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A2E,CAC5E,CAAA;IACD,OAAO,CAAC,GAAG,CACT,uFAAuF,CACxF,CAAA;IAED,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAC1B,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAA;IAC3E,OAAO,CAAC,GAAG,CACT,wEAAwE,CACzE,CAAA;IACD,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;IAC/C,OAAO,CAAC,GAAG,CACT,+FAA+F,CAChG,CAAA;IACD,OAAO,CAAC,GAAG,CACT,kFAAkF,CACnF,CAAA;IACD,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;IAClD,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAA;IACnE,OAAO,CAAC,GAAG,CACT,uEAAuE,CACxE,CAAA;IACD,OAAO,CAAC,GAAG,CACT,uIAAuI,CACxI,CAAA;IAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IACrC,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAA;IACxE,OAAO,CAAC,GAAG,CACT,6EAA6E,CAC9E,CAAA;IAED,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAA;IACpE,OAAO,CAAC,GAAG,CACT,GAAG,EACH,IAAA,iBAAI,EACF,IAAA,kBAAK,EACH,6CAA6C,kCAAsB,uBAAuB,OAAO,CAAC,GAAG,CAAC,mBAAmB,YAAY,CACtI,CACF,CACF,CAAA;IAED,OAAO,CAAC,GAAG,CACT,iMAAiM,CAClM,CAAA;IACD,OAAO,CAAC,GAAG,CACT,0BAA0B,EAC1B,IAAA,iBAAI,EAAC,IAAA,iBAAI,EAAC,wBAAwB,CAAC,CAAC,EACpC,4BAA4B,CAC7B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare const currentChatId: string;
|
|
2
|
+
export declare function isDir(p: string): boolean;
|
|
3
|
+
export declare function getProjectDataDir(): string;
|
|
4
|
+
export declare function getCurrentChatDir(): string;
|
|
5
|
+
export declare function setProjectRoot(dir: string | undefined): string;
|
|
6
|
+
export declare function getProjectRoot(): string;
|
|
7
|
+
export declare function initProjectFileContextWithWorker(dir: string): Promise<{
|
|
8
|
+
currentWorkingDirectory: string;
|
|
9
|
+
fileTree: import("./common/util/file").FileTreeNode[];
|
|
10
|
+
fileTokenScores: Record<string, Record<string, number>>;
|
|
11
|
+
knowledgeFiles: Record<string, string>;
|
|
12
|
+
gitChanges: {
|
|
13
|
+
status: string;
|
|
14
|
+
diff: string;
|
|
15
|
+
diffCached: string;
|
|
16
|
+
lastCommitMessages: string;
|
|
17
|
+
};
|
|
18
|
+
changesSinceLastChat: Record<string, string>;
|
|
19
|
+
shellConfigFiles: Record<string, string>;
|
|
20
|
+
systemInfo: {
|
|
21
|
+
platform: string;
|
|
22
|
+
shell: string;
|
|
23
|
+
nodeVersion: string;
|
|
24
|
+
arch: string;
|
|
25
|
+
homedir: string;
|
|
26
|
+
cpus: number;
|
|
27
|
+
};
|
|
28
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
29
|
+
fileVersions?: {
|
|
30
|
+
path: string;
|
|
31
|
+
content: string;
|
|
32
|
+
}[][] | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves or updates the project file context for a given project.
|
|
36
|
+
*
|
|
37
|
+
* This function gathers comprehensive information about the project's files, structure,
|
|
38
|
+
* and state. It either creates a new context if one doesn't exist for the specified
|
|
39
|
+
* project root, or updates an existing cached context with new information.
|
|
40
|
+
*
|
|
41
|
+
* The context includes:
|
|
42
|
+
* - File tree structure
|
|
43
|
+
* - Token scores for code analysis
|
|
44
|
+
* - Knowledge files (project-specific documentation)
|
|
45
|
+
* - User knowledge files (from home directory)
|
|
46
|
+
* - Git changes and status
|
|
47
|
+
* - Changes since the last file version
|
|
48
|
+
* - Shell configuration files
|
|
49
|
+
* - System information
|
|
50
|
+
*
|
|
51
|
+
* @param {string} projectRoot - The root directory path of the project
|
|
52
|
+
* @param {Record<string, string>} lastFileVersion - Record of the last known file versions
|
|
53
|
+
* @param {FileVersion[][]} newFileVersions - Array of file version arrays, representing the history of file changes
|
|
54
|
+
* @returns {Promise<ProjectFileContext>} A promise that resolves to the project file context object
|
|
55
|
+
*/
|
|
56
|
+
export declare const getProjectFileContext: (projectRoot: string, lastFileVersion: Record<string, string>) => Promise<{
|
|
57
|
+
currentWorkingDirectory: string;
|
|
58
|
+
fileTree: import("./common/util/file").FileTreeNode[];
|
|
59
|
+
fileTokenScores: Record<string, Record<string, number>>;
|
|
60
|
+
knowledgeFiles: Record<string, string>;
|
|
61
|
+
gitChanges: {
|
|
62
|
+
status: string;
|
|
63
|
+
diff: string;
|
|
64
|
+
diffCached: string;
|
|
65
|
+
lastCommitMessages: string;
|
|
66
|
+
};
|
|
67
|
+
changesSinceLastChat: Record<string, string>;
|
|
68
|
+
shellConfigFiles: Record<string, string>;
|
|
69
|
+
systemInfo: {
|
|
70
|
+
platform: string;
|
|
71
|
+
shell: string;
|
|
72
|
+
nodeVersion: string;
|
|
73
|
+
arch: string;
|
|
74
|
+
homedir: string;
|
|
75
|
+
cpus: number;
|
|
76
|
+
};
|
|
77
|
+
userKnowledgeFiles?: Record<string, string> | undefined;
|
|
78
|
+
fileVersions?: {
|
|
79
|
+
path: string;
|
|
80
|
+
content: string;
|
|
81
|
+
}[][] | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Identifies changes between the last known version of files and their current state on disk.
|
|
85
|
+
*
|
|
86
|
+
* This function compares each file in the provided lastFileVersion record with its current
|
|
87
|
+
* content on disk. For files that have changed, it generates a patch using the diff library's
|
|
88
|
+
* createPatch function. Files that haven't changed or can't be read are filtered out from
|
|
89
|
+
* the result.
|
|
90
|
+
*
|
|
91
|
+
* The function is used to track changes made to files since the last interaction or session,
|
|
92
|
+
* which helps maintain context about what has changed in the project over time.
|
|
93
|
+
*
|
|
94
|
+
* @param {Record<string, string>} lastFileVersion - A record mapping file paths to their
|
|
95
|
+
* content as of the last known version
|
|
96
|
+
* @returns {Record<string, string>} A record mapping file paths to patch strings for files
|
|
97
|
+
* that have changed since the last version. Files that haven't changed or couldn't
|
|
98
|
+
* be read are not included in the result.
|
|
99
|
+
*/
|
|
100
|
+
export declare function getChangesSinceLastFileVersion(lastFileVersion: Record<string, string>): {
|
|
101
|
+
[k: string]: string;
|
|
102
|
+
};
|
|
103
|
+
export declare function getFiles(filePaths: string[]): Record<string, string | null>;
|
|
104
|
+
export declare function getFilesOrNull(filePaths: string[]): {
|
|
105
|
+
[k: string]: string | null;
|
|
106
|
+
};
|
|
107
|
+
export declare function getExistingFiles(filePaths: string[]): Record<string, string>;
|
|
108
|
+
export declare function addScrapedContentToFiles(files: Record<string, string>): Promise<{
|
|
109
|
+
[x: string]: string;
|
|
110
|
+
}>;
|
|
111
|
+
export declare function getFilesAbsolutePath(filePaths: string[]): Record<string, string | null>;
|
|
112
|
+
export declare function setFiles(files: Record<string, string>): void;
|
|
113
|
+
export declare function getFileBlocks(filePaths: string[]): string;
|
|
114
|
+
export declare const deleteFile: (fullPath: string) => boolean;
|