codebuff 1.0.248 → 1.0.250

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/code-map/tsconfig.tsbuildinfo +1 -1
  2. package/dist/utils/terminal.js +0 -1
  3. package/dist/utils/terminal.js.map +1 -1
  4. package/package.json +1 -1
  5. package/dist/background-process-manager.d.ts +0 -50
  6. package/dist/browser-runner.d.ts +0 -35
  7. package/dist/chat-storage.d.ts +0 -2
  8. package/dist/checkpoints/checkpoint-manager.d.ts +0 -94
  9. package/dist/checkpoints/file-manager.d.ts +0 -72
  10. package/dist/checkpoints/file-manager.js +0 -311
  11. package/dist/checkpoints/file-manager.js.map +0 -1
  12. package/dist/cli-handlers/api-key.d.ts +0 -25
  13. package/dist/cli-handlers/checkpoint.d.ts +0 -18
  14. package/dist/cli-handlers/diff.d.ts +0 -2
  15. package/dist/cli-handlers/easter-egg.d.ts +0 -1
  16. package/dist/cli-handlers/easter-egg.js +0 -126
  17. package/dist/cli-handlers/easter-egg.js.map +0 -1
  18. package/dist/cli-handlers/inititalization-flow.d.ts +0 -1
  19. package/dist/cli.d.ts +0 -44
  20. package/dist/client.d.ts +0 -157
  21. package/dist/config.d.ts +0 -4
  22. package/dist/config.js +0 -12
  23. package/dist/config.js.map +0 -1
  24. package/dist/create-template-project.d.ts +0 -1
  25. package/dist/create-template-project.js +0 -107
  26. package/dist/create-template-project.js.map +0 -1
  27. package/dist/credentials.d.ts +0 -4
  28. package/dist/dev-process-manager.d.ts +0 -10
  29. package/dist/fingerprint.d.ts +0 -1
  30. package/dist/fingerprint.js +0 -48
  31. package/dist/fingerprint.js.map +0 -1
  32. package/dist/index.d.ts +0 -2
  33. package/dist/menu.d.ts +0 -3
  34. package/dist/project-files.d.ts +0 -114
  35. package/dist/startup-process-handler.d.ts +0 -2
  36. package/dist/tool-handlers.d.ts +0 -28
  37. package/dist/types.d.ts +0 -15
  38. package/dist/update-codebuff.d.ts +0 -1
  39. package/dist/update-codebuff.js +0 -160
  40. package/dist/update-codebuff.js.map +0 -1
  41. package/dist/utils/__tests__/background-process-manager.test.d.ts +0 -1
  42. package/dist/utils/__tests__/background-process-manager.test.js +0 -289
  43. package/dist/utils/__tests__/background-process-manager.test.js.map +0 -1
  44. package/dist/utils/__tests__/tool-renderers.test.d.ts +0 -1
  45. package/dist/utils/__tests__/xml-stream-parser.test.d.ts +0 -1
  46. package/dist/utils/analytics.d.ts +0 -6
  47. package/dist/utils/detect-shell.d.ts +0 -1
  48. package/dist/utils/detect-shell.js +0 -60
  49. package/dist/utils/detect-shell.js.map +0 -1
  50. package/dist/utils/logger.d.ts +0 -21
  51. package/dist/utils/spinner.d.ts +0 -11
  52. package/dist/utils/spinner.js +0 -87
  53. package/dist/utils/spinner.js.map +0 -1
  54. package/dist/utils/system-info.d.ts +0 -8
  55. package/dist/utils/system-info.js +0 -22
  56. package/dist/utils/system-info.js.map +0 -1
  57. package/dist/utils/terminal.d.ts +0 -41
  58. package/dist/utils/tool-renderers.d.ts +0 -16
  59. package/dist/utils/xml-stream-parser.d.ts +0 -9
  60. package/dist/web-scraper.d.ts +0 -3
  61. package/dist/workers/checkpoint-worker.d.ts +0 -1
  62. package/dist/workers/checkpoint-worker.js +0 -48
  63. package/dist/workers/checkpoint-worker.js.map +0 -1
  64. package/dist/workers/project-context.d.ts +0 -1
package/dist/client.d.ts DELETED
@@ -1,157 +0,0 @@
1
- import { Interface } from 'readline';
2
- import { FileChanges, UsageResponse } from './common/actions';
3
- import { ApiKeyType } from './common/api-keys/constants';
4
- import { CostMode } from './common/constants';
5
- import { AgentState, ToolResult } from './common/types/agent-state';
6
- import { User } from './common/util/credentials';
7
- import { ProjectFileContext } from './common/util/file';
8
- import { GitCommand, MakeNullable } from './types';
9
- type UsageData = Omit<MakeNullable<UsageResponse, 'remainingBalance'>, 'type'>;
10
- export declare class Client {
11
- private webSocket;
12
- private freshPrompt;
13
- private reconnectWhenNextIdle;
14
- private fingerprintId;
15
- private costMode;
16
- private hadFileChanges;
17
- private git;
18
- private rl;
19
- private responseComplete;
20
- private responseBuffer;
21
- private oneTimeFlags;
22
- usageData: UsageData;
23
- pendingTopUpMessageAmount: number;
24
- fileContext: ProjectFileContext | undefined;
25
- lastChanges: FileChanges;
26
- agentState: AgentState | undefined;
27
- originalFileVersions: Record<string, string | null>;
28
- creditsByPromptId: Record<string, number[]>;
29
- user: User | undefined;
30
- lastWarnedPct: number;
31
- storedApiKeyTypes: ApiKeyType[];
32
- lastToolResults: ToolResult[];
33
- model: string | undefined;
34
- constructor({ websocketUrl, onWebSocketError, onWebSocketReconnect, freshPrompt, reconnectWhenNextIdle, costMode, git, rl, model, }: {
35
- websocketUrl: string;
36
- onWebSocketError: () => void;
37
- onWebSocketReconnect: () => void;
38
- freshPrompt: () => void;
39
- reconnectWhenNextIdle: () => void;
40
- costMode: CostMode;
41
- git: GitCommand;
42
- rl: Interface;
43
- model: string | undefined;
44
- });
45
- exit(): Promise<void>;
46
- initAgentState(projectFileContext: ProjectFileContext): void;
47
- private initFingerprintId;
48
- private getUser;
49
- connect(): Promise<void>;
50
- fetchStoredApiKeyTypes(): Promise<void>;
51
- handleAddApiKey(keyType: ApiKeyType, apiKey: string): Promise<void>;
52
- handleReferralCode(referralCode: string): Promise<void>;
53
- logout(): Promise<void>;
54
- login(referralCode?: string): Promise<void>;
55
- setUsage(usageData: Omit<UsageResponse, 'type'>): void;
56
- reconnect(): void;
57
- private setupSubscriptions;
58
- private showUsageWarning;
59
- generateCommitMessage(stagedChanges: string): Promise<string>;
60
- sendUserInput(prompt: string): Promise<{
61
- responsePromise: Promise<{
62
- type: "prompt-response";
63
- promptId: string;
64
- agentState: {
65
- agentContext: string;
66
- fileContext: {
67
- currentWorkingDirectory: string;
68
- fileTree: import("./common/util/file").FileTreeNode[];
69
- fileTokenScores: Record<string, Record<string, number>>;
70
- knowledgeFiles: Record<string, string>;
71
- gitChanges: {
72
- status: string;
73
- diff: string;
74
- diffCached: string;
75
- lastCommitMessages: string;
76
- };
77
- changesSinceLastChat: Record<string, string>;
78
- shellConfigFiles: Record<string, string>;
79
- systemInfo: {
80
- platform: string;
81
- shell: string;
82
- nodeVersion: string;
83
- arch: string;
84
- homedir: string;
85
- cpus: number;
86
- };
87
- userKnowledgeFiles?: Record<string, string> | undefined;
88
- fileVersions?: {
89
- path: string;
90
- content: string;
91
- }[][] | undefined;
92
- };
93
- messageHistory: {
94
- content: string | ({
95
- type: "text";
96
- text: string;
97
- cache_control?: {
98
- type: "ephemeral";
99
- } | undefined;
100
- } | {
101
- type: "tool_use";
102
- name: string;
103
- id: string;
104
- input: Record<string, any>;
105
- cache_control?: {
106
- type: "ephemeral";
107
- } | undefined;
108
- } | {
109
- type: "tool_result";
110
- content: string;
111
- tool_use_id: string;
112
- cache_control?: {
113
- type: "ephemeral";
114
- } | undefined;
115
- } | {
116
- type: "image";
117
- source: {
118
- type: "base64";
119
- media_type: "image/jpeg";
120
- data: string;
121
- };
122
- cache_control?: {
123
- type: "ephemeral";
124
- } | undefined;
125
- })[];
126
- role: "user" | "assistant";
127
- }[];
128
- consecutiveAssistantMessages?: number | undefined;
129
- };
130
- toolResults: {
131
- name: string;
132
- id: string;
133
- result: string;
134
- }[];
135
- toolCalls: {
136
- name: string;
137
- id: string;
138
- parameters: Record<string, string>;
139
- }[];
140
- } & {
141
- type: "prompt-response";
142
- } & {
143
- wasStoppedByUser: boolean;
144
- }>;
145
- stopResponse: () => void;
146
- }>;
147
- /**
148
- * Shrinks all instances of more than 2 newlines in a row.
149
- * Note: don't start or end colored text with newlines
150
- * @param chunk chunk to display
151
- */
152
- displayChunk(chunk: string): void;
153
- private subscribeToResponse;
154
- getUsage(): Promise<void>;
155
- warmContextCache(): Promise<void>;
156
- }
157
- export {};
package/dist/config.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare const isProduction: boolean;
2
- export declare const websocketUrl: string;
3
- export declare const websiteUrl: string | undefined;
4
- export declare const backendUrl: string;
package/dist/config.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.backendUrl = exports.websiteUrl = exports.websocketUrl = exports.isProduction = void 0;
4
- exports.isProduction = process.env.NEXT_PUBLIC_CB_ENVIRONMENT === 'production';
5
- exports.websocketUrl = exports.isProduction
6
- ? `wss://${process.env.NEXT_PUBLIC_BACKEND_URL}/ws`
7
- : `ws://${process.env.NEXT_PUBLIC_BACKEND_URL}/ws`;
8
- exports.websiteUrl = process.env.NEXT_PUBLIC_APP_URL;
9
- exports.backendUrl = exports.isProduction
10
- ? `https://${process.env.NEXT_PUBLIC_BACKEND_URL}`
11
- : `http://${process.env.NEXT_PUBLIC_BACKEND_URL}`;
12
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GACvB,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,YAAY,CAAA;AAE5C,QAAA,YAAY,GAAG,oBAAY;IACtC,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK;IACnD,CAAC,CAAC,QAAQ,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK,CAAA;AAEvC,QAAA,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAA;AAC5C,QAAA,UAAU,GAAG,oBAAY;IACpC,CAAC,CAAC,WAAW,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;IAClD,CAAC,CAAC,UAAU,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAA"}
@@ -1 +0,0 @@
1
- export declare function createTemplateProject(template: string, projectDir: string, projectName?: string): Promise<void>;
@@ -1,107 +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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createTemplateProject = createTemplateProject;
27
- const child_process_1 = require("child_process");
28
- const path_1 = require("path");
29
- const fs = __importStar(require("fs"));
30
- const os = __importStar(require("os"));
31
- const picocolors_1 = require("picocolors");
32
- async function createTemplateProject(template, projectDir, projectName = template) {
33
- console.log(`Creating project from ${template} template in ${projectDir}/${projectName}`);
34
- // Validate template name contains only alphanumeric chars, dash and underscore
35
- if (!/^[a-zA-Z0-9-_]+$/.test(template)) {
36
- console.error('Template name can only contain letters, numbers, dash and underscore');
37
- process.exit(1);
38
- }
39
- // Validate project name
40
- if (!/^[a-zA-Z0-9-_]+$/.test(projectName)) {
41
- console.error('Project name can only contain letters, numbers, dash and underscore');
42
- process.exit(1);
43
- }
44
- const projectPath = (0, path_1.join)(projectDir, projectName);
45
- // Check if directory already exists
46
- if (fs.existsSync(projectPath)) {
47
- console.error(`Directory ${projectPath} already exists`);
48
- process.exit(1);
49
- }
50
- try {
51
- console.log('\nDownloading template...');
52
- // Clone the community repo to a temp directory
53
- const tempDir = fs.mkdtempSync((0, path_1.join)(os.tmpdir(), 'codebuff-starter-'));
54
- (0, child_process_1.execSync)('git clone --depth 1 https://github.com/CodebuffAI/codebuff-community.git .', {
55
- cwd: tempDir,
56
- stdio: 'pipe',
57
- });
58
- // Check if template exists in starter-templates or showcase directory
59
- const starterTemplateDir = (0, path_1.join)(tempDir, 'starter-templates', template);
60
- const showcaseDir = (0, path_1.join)(tempDir, 'showcase', template);
61
- let templateDir;
62
- if (fs.existsSync(starterTemplateDir)) {
63
- templateDir = starterTemplateDir;
64
- }
65
- else if (fs.existsSync(showcaseDir)) {
66
- templateDir = showcaseDir;
67
- }
68
- else {
69
- console.error(`Template ${template} not found in starter-templates/ or showcase/`);
70
- fs.rmSync(tempDir, { recursive: true, force: true });
71
- process.exit(1);
72
- }
73
- // Create parent directory if it doesn't exist
74
- if (projectDir) {
75
- fs.mkdirSync(projectDir, { recursive: true });
76
- }
77
- // Copy template to new directory
78
- fs.mkdirSync(projectPath);
79
- fs.cpSync(templateDir, projectPath, { recursive: true });
80
- // Remove .git directory if it exists
81
- const gitDir = (0, path_1.join)(projectPath, '.git');
82
- if (fs.existsSync(gitDir)) {
83
- fs.rmSync(gitDir, { recursive: true, force: true });
84
- }
85
- // Initialize new git repo
86
- console.log('\nInitializing git repo...');
87
- (0, child_process_1.execSync)('git init', { cwd: projectPath, stdio: 'pipe' });
88
- // Clean up temp directory
89
- fs.rmSync(tempDir, { recursive: true, force: true });
90
- // Install dependencies
91
- if (fs.existsSync((0, path_1.join)(projectPath, 'package-lock.json'))) {
92
- console.log('\nInstalling dependencies...');
93
- (0, child_process_1.execSync)('npm install', { cwd: projectPath, stdio: 'inherit' });
94
- }
95
- console.log((0, picocolors_1.green)(`\nSuccessfully created new project in ${projectPath}\n`));
96
- // Change into the new project directory and run codebuff
97
- process.chdir(projectPath);
98
- console.log('Starting Codebuff in the new project...\n');
99
- console.log('--------------------------------\n');
100
- (0, child_process_1.execSync)('codebuff', { stdio: 'inherit' });
101
- }
102
- catch (error) {
103
- console.error('Failed to initialize project:', error);
104
- process.exit(1);
105
- }
106
- }
107
- //# sourceMappingURL=create-template-project.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-template-project.js","sourceRoot":"","sources":["../src/create-template-project.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,sDAqGC;AA3GD,iDAAwC;AACxC,+BAA2B;AAC3B,uCAAwB;AACxB,uCAAwB;AACxB,2CAAkC;AAE3B,KAAK,UAAU,qBAAqB,CACzC,QAAgB,EAChB,UAAkB,EAClB,cAAsB,QAAQ;IAE9B,OAAO,CAAC,GAAG,CACT,yBAAyB,QAAQ,gBAAgB,UAAU,IAAI,WAAW,EAAE,CAC7E,CAAA;IAED,+EAA+E;IAC/E,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,OAAO,CAAC,KAAK,CACX,sEAAsE,CACvE,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,wBAAwB;IACxB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1C,OAAO,CAAC,KAAK,CACX,qEAAqE,CACtE,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,WAAW,CAAC,CAAA;IAEjD,oCAAoC;IACpC,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,aAAa,WAAW,iBAAiB,CAAC,CAAA;QACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;QACxC,+CAA+C;QAC/C,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,IAAA,WAAI,EAAC,EAAE,CAAC,MAAM,EAAE,EAAE,mBAAmB,CA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- import { User } from './common/util/credentials';
2
- export declare const userFromJson: (json: string, profileName?: string) => User | undefined;
3
- export declare const CONFIG_DIR: string;
4
- export declare const CREDENTIALS_PATH: string;
@@ -1,10 +0,0 @@
1
- import { StartupProcess } from './common/json-config/constants';
2
- /**
3
- * Starts background development processes defined in the config file.
4
- * Processes are started asynchronously and their output is tracked.
5
- * Only enabled processes are started.
6
- *
7
- * @param processes - Array of startup process configurations
8
- * @param projectPath - Base path of the project
9
- */
10
- export declare function startDevProcesses(processes: StartupProcess[], projectPath: string): void;
@@ -1 +0,0 @@
1
- export declare function calculateFingerprint(): Promise<string>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- // Modified from: https://github.com/andsmedeiros/hw-fingerprint
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.calculateFingerprint = calculateFingerprint;
5
- const node_crypto_1 = require("node:crypto");
6
- const node_os_1 = require("node:os");
7
- const systeminformation_1 = require("systeminformation");
8
- const getFingerprintInfo = async () => {
9
- const { manufacturer, model, serial, uuid } = await (0, systeminformation_1.system)();
10
- const { vendor, version: biosVersion, releaseDate } = await (0, systeminformation_1.bios)();
11
- const { manufacturer: boardManufacturer, model: boardModel, serial: boardSerial, } = await (0, systeminformation_1.baseboard)();
12
- const { manufacturer: cpuManufacturer, brand, speedMax, cores, physicalCores, socket, } = await (0, systeminformation_1.cpu)();
13
- const { platform, arch } = await (0, systeminformation_1.osInfo)();
14
- return {
15
- EOL: node_os_1.EOL,
16
- endianness: (0, node_os_1.endianness)(),
17
- manufacturer,
18
- model,
19
- serial,
20
- uuid,
21
- vendor,
22
- biosVersion,
23
- releaseDate,
24
- boardManufacturer,
25
- boardModel,
26
- boardSerial,
27
- cpuManufacturer,
28
- brand,
29
- speedMax: speedMax.toFixed(2),
30
- cores,
31
- physicalCores,
32
- socket,
33
- platform,
34
- arch,
35
- };
36
- };
37
- async function calculateFingerprint() {
38
- const fingerprintInfo = await getFingerprintInfo();
39
- const fingerprintString = JSON.stringify(fingerprintInfo);
40
- const fingerprintHash = (0, node_crypto_1.createHash)('sha256')
41
- .update(fingerprintString)
42
- .digest()
43
- .toString('base64url');
44
- // Add 8 random characters to make the fingerprint unique even on identical hardware
45
- const randomSuffix = (0, node_crypto_1.randomBytes)(6).toString('base64url').substring(0, 8);
46
- return `${fingerprintHash}-${randomSuffix}`;
47
- }
48
- //# sourceMappingURL=fingerprint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../src/fingerprint.ts"],"names":[],"mappings":";AAAA,gEAAgE;;AAsDhE,oDAYC;AAhED,6CAAqD;AACrD,qCAAyC;AACzC,yDAO0B;AAE1B,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;IACpC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,0BAAM,GAAE,CAAA;IAC5D,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,wBAAI,GAAE,CAAA;IAClE,MAAM,EACJ,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,WAAW,GACpB,GAAG,MAAM,IAAA,6BAAS,GAAE,CAAA;IACrB,MAAM,EACJ,YAAY,EAAE,eAAe,EAC7B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,aAAa,EACb,MAAM,GACP,GAAG,MAAM,IAAA,uBAAG,GAAE,CAAA;IACf,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,0BAAM,GAAE,CAAA;IAEzC,OAAO;QACL,GAAG,EAAH,aAAG;QACH,UAAU,EAAE,IAAA,oBAAU,GAAE;QACxB,YAAY;QACZ,KAAK;QACL,MAAM;QACN,IAAI;QACJ,MAAM;QACN,WAAW;QACX,WAAW;QACX,iBAAiB;QACjB,UAAU;QACV,WAAW;QACX,eAAe;QACf,KAAK;QACL,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7B,KAAK;QACL,aAAa;QACb,MAAM;QACN,QAAQ;QACR,IAAI;KACkB,CAAA;AAC1B,CAAC,CAAA;AACM,KAAK,UAAU,oBAAoB;IACxC,MAAM,eAAe,GAAG,MAAM,kBAAkB,EAAE,CAAA;IAClD,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAA;IACzD,MAAM,eAAe,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SACzC,MAAM,CAAC,iBAAiB,CAAC;SACzB,MAAM,EAAE;SACR,QAAQ,CAAC,WAAW,CAAC,CAAA;IAExB,oFAAoF;IACpF,MAAM,YAAY,GAAG,IAAA,yBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAEzE,OAAO,GAAG,eAAe,IAAI,YAAY,EAAE,CAAA;AAC7C,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/menu.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { CostMode } from './common/constants';
2
- export declare function displayGreeting(costMode: CostMode, username: string | null): void;
3
- export declare function displayMenu(): void;
@@ -1,114 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- import { CodebuffConfig } from './common/json-config/constants';
2
- export declare function logAndHandleStartup(projectRoot: string, config: CodebuffConfig | null): Promise<any>;
@@ -1,28 +0,0 @@
1
- import { BrowserResponse } from './common/browser-actions';
2
- import { RawToolCall } from './common/types/tools';
3
- export type ToolHandler<T extends Record<string, any>> = (parameters: T, id: string, projectPath: string) => Promise<string | BrowserResponse>;
4
- export declare const handleWriteFile: ToolHandler<{
5
- path: string;
6
- content: string;
7
- type: 'patch' | 'file';
8
- }>;
9
- export declare const handleScrapeWebPage: ToolHandler<{
10
- url: string;
11
- }>;
12
- export declare const handleRunTerminalCommand: (parameters: {
13
- command: string;
14
- mode?: "user" | "assistant";
15
- process_type: "SYNC" | "BACKGROUND";
16
- }, id: string, projectPath: string) => Promise<{
17
- result: string;
18
- stdout: string;
19
- }>;
20
- export declare const handleCodeSearch: ToolHandler<{
21
- pattern: string;
22
- }>;
23
- export declare const toolHandlers: Record<string, ToolHandler<any>>;
24
- export declare const handleToolCall: (toolCall: RawToolCall, projectPath: string) => Promise<{
25
- name: string;
26
- result: string;
27
- id: string;
28
- }>;
package/dist/types.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { CostMode } from './common/constants';
2
- export type GitCommand = 'stage' | undefined;
3
- export interface CliOptions {
4
- initialInput?: string;
5
- git: GitCommand;
6
- costMode: CostMode;
7
- runInitFlow?: boolean;
8
- model?: string;
9
- }
10
- /**
11
- * Utility type to make specific properties nullable
12
- */
13
- export type MakeNullable<T, K extends keyof T> = {
14
- [P in keyof T]: P extends K ? T[P] | null : T[P];
15
- };
@@ -1 +0,0 @@
1
- export declare function updateCodebuff(): Promise<void>;