codebuff 1.0.294 → 1.0.295
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 +3 -3
- package/dist/browser-runner.d.ts +35 -0
- package/dist/browser-runner.js +4 -4
- package/dist/chat-storage.d.ts +2 -0
- package/dist/chat-storage.js +1 -1
- package/dist/checkpoints/checkpoint-manager.d.ts +94 -0
- package/dist/checkpoints/checkpoint-manager.js +1 -1
- package/dist/checkpoints/file-manager.d.ts +72 -0
- package/dist/checkpoints/file-manager.js +294 -0
- package/dist/checkpoints/file-manager.js.map +1 -0
- package/dist/cli-definitions.d.ts +9 -0
- package/dist/cli-definitions.js +54 -0
- package/dist/cli-definitions.js.map +1 -0
- package/dist/cli-handlers/api-key.d.ts +25 -0
- package/dist/cli-handlers/api-key.js +1 -1
- package/dist/cli-handlers/checkpoint.d.ts +18 -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 +1 -1
- package/dist/cli.d.ts +65 -0
- package/dist/cli.js +2 -2
- package/dist/client.d.ts +7 -7
- package/dist/client.js +9 -9
- 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 +2 -2
- package/dist/dev-process-manager.d.ts +10 -0
- package/dist/dev-process-manager.js +1 -1
- package/dist/display.d.ts +11 -0
- package/dist/display.js +85 -0
- package/dist/display.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 +7 -1
- package/dist/menu.d.ts +14 -0
- package/dist/menu.js +295 -0
- package/dist/menu.js.map +1 -0
- package/dist/project-files.d.ts +2 -2
- package/dist/project-files.js +5 -5
- package/dist/startup-process-handler.d.ts +2 -0
- package/dist/tool-handlers.d.ts +2 -2
- package/dist/tool-handlers.js +5 -5
- package/dist/tool-handlers.js.map +1 -1
- 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 +1 -1
- package/dist/utils/__tests__/background-process-manager.test.d.ts +1 -0
- package/dist/utils/__tests__/background-process-manager.test.js +327 -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 +2 -2
- package/dist/utils/__tests__/xml-stream-parser.test.d.ts +1 -0
- package/dist/utils/__tests__/xml-stream-parser.test.js +1 -1
- package/dist/utils/analytics.d.ts +6 -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/git.d.ts +2 -0
- package/dist/utils/git.js +40 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +21 -0
- package/dist/utils/logger.js +1 -1
- package/dist/utils/spinner.d.ts +12 -0
- package/dist/utils/spinner.js +94 -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 +43 -0
- package/dist/utils/terminal.js +3 -3
- package/dist/utils/tool-renderers.d.ts +16 -0
- package/dist/utils/tool-renderers.js +2 -2
- package/dist/utils/xml-stream-parser.d.ts +1 -1
- package/dist/utils/xml-stream-parser.js +2 -2
- package/dist/web-scraper.d.ts +3 -0
- package/dist/web-scraper.js +1 -1
- 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 +1 -1
- package/package.json +2 -2
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
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>;
|
package/dist/update-codebuff.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.updateCodebuff = updateCodebuff;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const picocolors_1 = require("picocolors");
|
|
9
|
-
const analytics_events_1 = require("common/constants/analytics-events");
|
|
9
|
+
const analytics_events_1 = require("./common/constants/analytics-events");
|
|
10
10
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
11
11
|
const background_process_manager_1 = require("./background-process-manager");
|
|
12
12
|
const config_1 = require("./config");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,327 @@
|
|
|
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
|
+
// @ts-ignore: bun:test types aren't available
|
|
27
|
+
const bun_test_1 = require("bun:test");
|
|
28
|
+
// @ts-ignore: bun:test types aren't available
|
|
29
|
+
const bun_test_2 = require("bun:test");
|
|
30
|
+
// Mock the child process
|
|
31
|
+
const mockChildProcess = {
|
|
32
|
+
exitCode: null,
|
|
33
|
+
signalCode: null,
|
|
34
|
+
};
|
|
35
|
+
// Check if we are in CI/CD
|
|
36
|
+
const isCI = process.env.CODEBUFF_GITHUB_ACTIONS === 'true';
|
|
37
|
+
// Skip tests entirely in CI
|
|
38
|
+
if (!isCI) {
|
|
39
|
+
// Wrap the dynamic import and tests in an async IIFE to avoid top-level await
|
|
40
|
+
(async () => {
|
|
41
|
+
// Only import the implementation if not in CI
|
|
42
|
+
const { getBackgroundProcessInfoString } = await Promise.resolve().then(() => __importStar(require('../../background-process-manager')));
|
|
43
|
+
(0, bun_test_2.describe)('getBackgroundProcessInfoString', () => {
|
|
44
|
+
let dateNowSpy;
|
|
45
|
+
const currentTime = 3000;
|
|
46
|
+
(0, bun_test_2.beforeEach)(() => {
|
|
47
|
+
(0, bun_test_2.spyOn)(Date, 'now').mockReturnValue(currentTime);
|
|
48
|
+
});
|
|
49
|
+
(0, bun_test_2.afterEach)(() => {
|
|
50
|
+
bun_test_2.mock.restore();
|
|
51
|
+
});
|
|
52
|
+
(0, bun_test_1.test)('formats a running process correctly', () => {
|
|
53
|
+
const startTime = 1000;
|
|
54
|
+
const info = {
|
|
55
|
+
pid: 123,
|
|
56
|
+
toolCallId: 'toolCall123',
|
|
57
|
+
command: 'npm test',
|
|
58
|
+
process: mockChildProcess,
|
|
59
|
+
stdoutBuffer: ['test output'],
|
|
60
|
+
stderrBuffer: ['test error'],
|
|
61
|
+
status: 'running',
|
|
62
|
+
startTime,
|
|
63
|
+
endTime: null,
|
|
64
|
+
lastReportedStdoutLength: 0,
|
|
65
|
+
lastReportedStderrLength: 0,
|
|
66
|
+
lastReportedStatus: null,
|
|
67
|
+
};
|
|
68
|
+
const result = getBackgroundProcessInfoString(info);
|
|
69
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
(0, bun_test_1.test)('formats a completed process correctly', () => {
|
|
72
|
+
const startTime = 1000;
|
|
73
|
+
const endTime = 2000;
|
|
74
|
+
const mockCompletedProcess = {
|
|
75
|
+
...mockChildProcess,
|
|
76
|
+
exitCode: 0,
|
|
77
|
+
};
|
|
78
|
+
const info = {
|
|
79
|
+
pid: 456,
|
|
80
|
+
toolCallId: 'toolCall456',
|
|
81
|
+
command: 'npm build',
|
|
82
|
+
process: mockCompletedProcess,
|
|
83
|
+
stdoutBuffer: ['build successful'],
|
|
84
|
+
stderrBuffer: [],
|
|
85
|
+
status: 'completed',
|
|
86
|
+
startTime,
|
|
87
|
+
endTime,
|
|
88
|
+
lastReportedStdoutLength: 0,
|
|
89
|
+
lastReportedStderrLength: 0,
|
|
90
|
+
lastReportedStatus: null,
|
|
91
|
+
};
|
|
92
|
+
const result = getBackgroundProcessInfoString(info);
|
|
93
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
94
|
+
});
|
|
95
|
+
(0, bun_test_1.test)('formats an errored process correctly', () => {
|
|
96
|
+
const startTime = 1000;
|
|
97
|
+
const endTime = 2500;
|
|
98
|
+
const mockErroredProcess = {
|
|
99
|
+
...mockChildProcess,
|
|
100
|
+
exitCode: 1,
|
|
101
|
+
signalCode: 'SIGTERM',
|
|
102
|
+
};
|
|
103
|
+
const info = {
|
|
104
|
+
pid: 789,
|
|
105
|
+
toolCallId: 'toolCall789',
|
|
106
|
+
command: 'invalid-command',
|
|
107
|
+
process: mockErroredProcess,
|
|
108
|
+
stdoutBuffer: [],
|
|
109
|
+
stderrBuffer: ['command not found'],
|
|
110
|
+
status: 'error',
|
|
111
|
+
startTime,
|
|
112
|
+
endTime,
|
|
113
|
+
lastReportedStdoutLength: 0,
|
|
114
|
+
lastReportedStderrLength: 0,
|
|
115
|
+
lastReportedStatus: null,
|
|
116
|
+
};
|
|
117
|
+
const result = getBackgroundProcessInfoString(info);
|
|
118
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
119
|
+
});
|
|
120
|
+
(0, bun_test_1.test)('returns empty string for completed process with no changes', () => {
|
|
121
|
+
const startTime = 1000;
|
|
122
|
+
const endTime = 2000;
|
|
123
|
+
const info = {
|
|
124
|
+
pid: 101,
|
|
125
|
+
toolCallId: 'toolCall101',
|
|
126
|
+
command: 'echo test',
|
|
127
|
+
process: mockChildProcess,
|
|
128
|
+
stdoutBuffer: ['test'],
|
|
129
|
+
stderrBuffer: [],
|
|
130
|
+
status: 'completed',
|
|
131
|
+
startTime,
|
|
132
|
+
endTime,
|
|
133
|
+
lastReportedStdoutLength: 4, // Length of 'test'
|
|
134
|
+
lastReportedStderrLength: 0,
|
|
135
|
+
lastReportedStatus: 'completed',
|
|
136
|
+
};
|
|
137
|
+
const result = getBackgroundProcessInfoString(info);
|
|
138
|
+
(0, bun_test_2.expect)(result).toBe('');
|
|
139
|
+
});
|
|
140
|
+
(0, bun_test_1.test)('handles new output since last report', () => {
|
|
141
|
+
const startTime = 1000;
|
|
142
|
+
const endTime = 2000;
|
|
143
|
+
const info = {
|
|
144
|
+
pid: 102,
|
|
145
|
+
toolCallId: 'toolCall102',
|
|
146
|
+
command: 'echo test',
|
|
147
|
+
process: mockChildProcess,
|
|
148
|
+
stdoutBuffer: ['test', ' more output'],
|
|
149
|
+
stderrBuffer: [],
|
|
150
|
+
status: 'completed',
|
|
151
|
+
startTime,
|
|
152
|
+
endTime,
|
|
153
|
+
lastReportedStdoutLength: 4, // Only 'test' was reported
|
|
154
|
+
lastReportedStderrLength: 0,
|
|
155
|
+
lastReportedStatus: 'completed',
|
|
156
|
+
};
|
|
157
|
+
const result = getBackgroundProcessInfoString(info);
|
|
158
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
159
|
+
});
|
|
160
|
+
(0, bun_test_1.test)('handles no new content', () => {
|
|
161
|
+
const startTime = 1000;
|
|
162
|
+
const endTime = 2000;
|
|
163
|
+
const info = {
|
|
164
|
+
pid: 103,
|
|
165
|
+
toolCallId: 'toolCall103',
|
|
166
|
+
command: 'echo test',
|
|
167
|
+
process: mockChildProcess,
|
|
168
|
+
stdoutBuffer: ['test'],
|
|
169
|
+
stderrBuffer: [],
|
|
170
|
+
status: 'running',
|
|
171
|
+
startTime,
|
|
172
|
+
endTime,
|
|
173
|
+
lastReportedStdoutLength: 4, // All content reported
|
|
174
|
+
lastReportedStderrLength: 0,
|
|
175
|
+
lastReportedStatus: 'running',
|
|
176
|
+
};
|
|
177
|
+
const result = getBackgroundProcessInfoString(info);
|
|
178
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
179
|
+
});
|
|
180
|
+
(0, bun_test_1.test)('handles new stderr without when no previous stderr', () => {
|
|
181
|
+
const startTime = 1000;
|
|
182
|
+
const endTime = 2000;
|
|
183
|
+
const info = {
|
|
184
|
+
pid: 104,
|
|
185
|
+
toolCallId: 'toolCall104',
|
|
186
|
+
command: 'echo test',
|
|
187
|
+
process: mockChildProcess,
|
|
188
|
+
stdoutBuffer: [],
|
|
189
|
+
stderrBuffer: ['new error'],
|
|
190
|
+
status: 'error',
|
|
191
|
+
startTime,
|
|
192
|
+
endTime,
|
|
193
|
+
lastReportedStdoutLength: 0,
|
|
194
|
+
lastReportedStderrLength: 0, // No previous stderr
|
|
195
|
+
lastReportedStatus: null,
|
|
196
|
+
};
|
|
197
|
+
const result = getBackgroundProcessInfoString(info);
|
|
198
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
199
|
+
});
|
|
200
|
+
(0, bun_test_1.test)('handles new stdout without when no previous stdout', () => {
|
|
201
|
+
const startTime = 1000;
|
|
202
|
+
const info = {
|
|
203
|
+
pid: 105,
|
|
204
|
+
toolCallId: 'toolCall105',
|
|
205
|
+
command: 'echo test',
|
|
206
|
+
process: mockChildProcess,
|
|
207
|
+
stdoutBuffer: ['first output'],
|
|
208
|
+
stderrBuffer: [],
|
|
209
|
+
status: 'running',
|
|
210
|
+
startTime,
|
|
211
|
+
endTime: null,
|
|
212
|
+
lastReportedStdoutLength: 0, // No previous stdout
|
|
213
|
+
lastReportedStderrLength: 0,
|
|
214
|
+
lastReportedStatus: null,
|
|
215
|
+
};
|
|
216
|
+
const result = getBackgroundProcessInfoString(info);
|
|
217
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
218
|
+
});
|
|
219
|
+
(0, bun_test_1.test)('reports completed process with new stderr even if stdout unchanged', () => {
|
|
220
|
+
const startTime = 1000;
|
|
221
|
+
const endTime = 2000;
|
|
222
|
+
const info = {
|
|
223
|
+
pid: 106,
|
|
224
|
+
toolCallId: 'toolCall106',
|
|
225
|
+
command: 'echo test',
|
|
226
|
+
process: mockChildProcess,
|
|
227
|
+
stdoutBuffer: ['test'],
|
|
228
|
+
stderrBuffer: ['new error'],
|
|
229
|
+
status: 'completed',
|
|
230
|
+
startTime,
|
|
231
|
+
endTime,
|
|
232
|
+
lastReportedStdoutLength: 4, // All stdout reported
|
|
233
|
+
lastReportedStderrLength: 0, // No stderr reported
|
|
234
|
+
lastReportedStatus: 'completed',
|
|
235
|
+
};
|
|
236
|
+
const result = getBackgroundProcessInfoString(info);
|
|
237
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
238
|
+
});
|
|
239
|
+
(0, bun_test_1.test)('reports completed process with new stdout even if stderr unchanged', () => {
|
|
240
|
+
const startTime = 1000;
|
|
241
|
+
const endTime = 2000;
|
|
242
|
+
const info = {
|
|
243
|
+
pid: 107,
|
|
244
|
+
toolCallId: 'toolCall107',
|
|
245
|
+
command: 'echo test',
|
|
246
|
+
process: mockChildProcess,
|
|
247
|
+
stdoutBuffer: ['test', ' more'],
|
|
248
|
+
stderrBuffer: ['error'],
|
|
249
|
+
status: 'completed',
|
|
250
|
+
startTime,
|
|
251
|
+
endTime,
|
|
252
|
+
lastReportedStdoutLength: 4, // Only 'test' reported
|
|
253
|
+
lastReportedStderrLength: 5, // All stderr reported
|
|
254
|
+
lastReportedStatus: 'completed',
|
|
255
|
+
};
|
|
256
|
+
const result = getBackgroundProcessInfoString(info);
|
|
257
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
258
|
+
});
|
|
259
|
+
(0, bun_test_1.test)('reports process when status changes even without output changes', () => {
|
|
260
|
+
const startTime = 1000;
|
|
261
|
+
const endTime = 2000;
|
|
262
|
+
const info = {
|
|
263
|
+
pid: 108,
|
|
264
|
+
toolCallId: 'toolCall108',
|
|
265
|
+
command: 'echo test',
|
|
266
|
+
process: mockChildProcess,
|
|
267
|
+
stdoutBuffer: ['test'],
|
|
268
|
+
stderrBuffer: [],
|
|
269
|
+
status: 'completed',
|
|
270
|
+
startTime,
|
|
271
|
+
endTime,
|
|
272
|
+
lastReportedStdoutLength: 4, // All output reported
|
|
273
|
+
lastReportedStderrLength: 0,
|
|
274
|
+
lastReportedStatus: 'running', // Status changed from running to completed
|
|
275
|
+
};
|
|
276
|
+
const result = getBackgroundProcessInfoString(info);
|
|
277
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
278
|
+
});
|
|
279
|
+
(0, bun_test_1.test)('calculates duration from endTime when available', () => {
|
|
280
|
+
const startTime = 1000;
|
|
281
|
+
const endTime = 2500;
|
|
282
|
+
const info = {
|
|
283
|
+
pid: 109,
|
|
284
|
+
toolCallId: 'toolCall109',
|
|
285
|
+
command: 'echo test',
|
|
286
|
+
process: mockChildProcess,
|
|
287
|
+
stdoutBuffer: ['test'],
|
|
288
|
+
stderrBuffer: [],
|
|
289
|
+
status: 'completed',
|
|
290
|
+
startTime,
|
|
291
|
+
endTime,
|
|
292
|
+
lastReportedStdoutLength: 0,
|
|
293
|
+
lastReportedStderrLength: 0,
|
|
294
|
+
lastReportedStatus: null,
|
|
295
|
+
};
|
|
296
|
+
const result = getBackgroundProcessInfoString(info);
|
|
297
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
298
|
+
});
|
|
299
|
+
(0, bun_test_1.test)('calculates duration from current time when no endTime', () => {
|
|
300
|
+
const startTime = 1000;
|
|
301
|
+
const info = {
|
|
302
|
+
pid: 110,
|
|
303
|
+
toolCallId: 'toolCall110',
|
|
304
|
+
command: 'echo test',
|
|
305
|
+
process: mockChildProcess,
|
|
306
|
+
stdoutBuffer: ['test'],
|
|
307
|
+
stderrBuffer: [],
|
|
308
|
+
status: 'running',
|
|
309
|
+
startTime,
|
|
310
|
+
endTime: null,
|
|
311
|
+
lastReportedStdoutLength: 0,
|
|
312
|
+
lastReportedStderrLength: 0,
|
|
313
|
+
lastReportedStatus: null,
|
|
314
|
+
};
|
|
315
|
+
const result = getBackgroundProcessInfoString(info);
|
|
316
|
+
(0, bun_test_2.expect)(result).toMatchSnapshot();
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
})();
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
// Add a skipped describe block for clarity in test reports
|
|
323
|
+
bun_test_2.describe.skip('getBackgroundProcessInfoString (skipped in CI)', () => {
|
|
324
|
+
bun_test_1.test.skip('skipped', () => { });
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=background-process-manager.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background-process-manager.test.js","sourceRoot":"","sources":["../../../src/utils/__tests__/background-process-manager.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAA8C;AAC9C,uCAA+B;AAC/B,8CAA8C;AAC9C,uCAA+E;AAK/E,yBAAyB;AACzB,MAAM,gBAAgB,GAAG;IACvB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;CACV,CAAA;AAER,2BAA2B;AAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK,MAAM,CAAC;AAE5D,4BAA4B;AAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;IACV,8EAA8E;IAC9E,CAAC,KAAK,IAAI,EAAE;QACV,8CAA8C;QAC9C,MAAM,EAAE,8BAA8B,EAAE,GAAG,wDAAa,kCAAkC,GAAC,CAAC;QAE5F,IAAA,mBAAQ,EAAC,gCAAgC,EAAE,GAAG,EAAE;YAC9C,IAAI,UAAoC,CAAA;YACxC,MAAM,WAAW,GAAG,IAAI,CAAA;YAExB,IAAA,qBAAU,EAAC,GAAG,EAAE;gBACd,IAAA,gBAAK,EAAC,IAAI,EAAE,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,eAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -29,8 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const stream_1 = require("stream");
|
|
30
30
|
// @ts-ignore
|
|
31
31
|
const bun_test_1 = require("bun:test");
|
|
32
|
-
const tools_1 = require("common/constants/tools");
|
|
33
|
-
const projectFileTree = __importStar(require("common/project-file-tree"));
|
|
32
|
+
const tools_1 = require("../../common/constants/tools");
|
|
33
|
+
const projectFileTree = __importStar(require("../../common/project-file-tree"));
|
|
34
34
|
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
35
35
|
const projectFiles = __importStar(require("../../project-files"));
|
|
36
36
|
const tool_renderers_1 = require("../tool-renderers");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const stream_1 = require("stream");
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
const bun_test_1 = require("bun:test");
|
|
11
|
-
const tools_1 = require("common/constants/tools");
|
|
11
|
+
const tools_1 = require("../../common/constants/tools");
|
|
12
12
|
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
13
13
|
const tool_renderers_1 = require("../tool-renderers");
|
|
14
14
|
const xml_stream_parser_1 = require("../xml-stream-parser");
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AnalyticsEvent } from '../common/constants/analytics-events';
|
|
2
|
+
export declare let identified: boolean;
|
|
3
|
+
export declare function initAnalytics(): void;
|
|
4
|
+
export declare function flushAnalytics(): Promise<void>;
|
|
5
|
+
export declare function trackEvent(event: AnalyticsEvent, properties?: Record<string, any>): void;
|
|
6
|
+
export declare function identifyUser(userId: string, properties?: Record<string, any>): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectShell(): 'bash' | 'zsh' | 'fish' | 'cmd.exe' | 'powershell' | 'unknown' | string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectShell = detectShell;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
function detectShell() {
|
|
7
|
+
// Get the parent process environment
|
|
8
|
+
const shell = process.env.SHELL || process.env.COMSPEC || process.env.PSModulePath;
|
|
9
|
+
try {
|
|
10
|
+
// Handle Windows detection
|
|
11
|
+
if ((0, os_1.platform)() === 'win32') {
|
|
12
|
+
try {
|
|
13
|
+
// Check if running in PowerShell
|
|
14
|
+
(0, child_process_1.execSync)('$PSVersionTable', { stdio: 'pipe' });
|
|
15
|
+
return 'powershell';
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// Check explicit CMD environment
|
|
19
|
+
if (process.env.COMSPEC?.toLowerCase().includes('cmd.exe')) {
|
|
20
|
+
return 'cmd.exe';
|
|
21
|
+
}
|
|
22
|
+
// Check parent process as final Windows check
|
|
23
|
+
const parentProcess = (0, child_process_1.execSync)('wmic process get ParentProcessId,CommandLine', { stdio: 'pipe' })
|
|
24
|
+
.toString()
|
|
25
|
+
.toLowerCase();
|
|
26
|
+
if (parentProcess.includes('powershell'))
|
|
27
|
+
return 'powershell';
|
|
28
|
+
if (parentProcess.includes('cmd.exe'))
|
|
29
|
+
return 'cmd.exe';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Handle Unix-like systems
|
|
33
|
+
if (shell) {
|
|
34
|
+
const shellLower = shell.toLowerCase();
|
|
35
|
+
if (shellLower.includes('bash'))
|
|
36
|
+
return 'bash';
|
|
37
|
+
if (shellLower.includes('zsh'))
|
|
38
|
+
return 'zsh';
|
|
39
|
+
if (shellLower.includes('fish'))
|
|
40
|
+
return 'fish';
|
|
41
|
+
}
|
|
42
|
+
// Try to get the parent process name on Unix systems
|
|
43
|
+
if ((0, os_1.platform)() !== 'win32') {
|
|
44
|
+
const ppid = process.ppid;
|
|
45
|
+
const parentProcess = (0, child_process_1.execSync)(`ps -p ${ppid} -o comm=`, {
|
|
46
|
+
stdio: 'pipe',
|
|
47
|
+
})
|
|
48
|
+
.toString()
|
|
49
|
+
.trim();
|
|
50
|
+
if (parentProcess)
|
|
51
|
+
return parentProcess;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// Log error if needed
|
|
56
|
+
// console.error('Error detecting shell:', error);
|
|
57
|
+
}
|
|
58
|
+
return 'unknown';
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=detect-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-shell.js","sourceRoot":"","sources":["../../src/utils/detect-shell.ts"],"names":[],"mappings":";;AAGA,kCA6DC;AAhED,iDAAwC;AACxC,2BAA6B;AAE7B,SAAgB,WAAW;IAQzB,qCAAqC;IACrC,MAAM,KAAK,GACT,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;IAEtE,IAAI,CAAC;QACH,2BAA2B;QAC3B,IAAI,IAAA,aAAQ,GAAE,KAAK,OAAO,EAAE,CAAC;YAC3B,IAAI,CAAC;gBACH,iCAAiC;gBACjC,IAAA,wBAAQ,EAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;gBAC9C,OAAO,YAAY,CAAA;YACrB,CAAC;YAAC,MAAM,CAAC;gBACP,iCAAiC;gBACjC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;oBAC3D,OAAO,SAAS,CAAA;gBAClB,CAAC;gBAED,8CAA8C;gBAC9C,MAAM,aAAa,GAAG,IAAA,wBAAQ,EAC5B,8CAA8C,EAC9C,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB;qBACE,QAAQ,EAAE;qBACV,WAAW,EAAE,CAAA;gBAChB,IAAI,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC;oBAAE,OAAO,YAAY,CAAA;gBAC7D,IAAI,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;oBAAE,OAAO,SAAS,CAAA;YACzD,CAAC;QACH,CAAC;QAED,2BAA2B;QAC3B,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;YACtC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,OAAO,MAAM,CAAA;YAC9C,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAA;YAC5C,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,OAAO,MAAM,CAAA;QAChD,CAAC;QAED,qDAAqD;QACrD,IAAI,IAAA,aAAQ,GAAE,KAAK,OAAO,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;YACzB,MAAM,aAAa,GAAG,IAAA,wBAAQ,EAAC,SAAS,IAAI,WAAW,EAAE;gBACvD,KAAK,EAAE,MAAM;aACd,CAAC;iBACC,QAAQ,EAAE;iBACV,IAAI,EAAE,CAAA;YACT,IAAI,aAAa;gBAAE,OAAO,aAAa,CAAA;QACzC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,sBAAsB;QACtB,kDAAkD;IACpD,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.gitCommandIsAvailable = gitCommandIsAvailable;
|
|
7
|
+
exports.findGitRoot = findGitRoot;
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the native git command is available on the system.
|
|
13
|
+
* Caches the result to avoid repeated checks.
|
|
14
|
+
* @returns boolean indicating if git command is available
|
|
15
|
+
*/
|
|
16
|
+
let cachedGitAvailable = null;
|
|
17
|
+
function gitCommandIsAvailable() {
|
|
18
|
+
if (cachedGitAvailable === null) {
|
|
19
|
+
try {
|
|
20
|
+
(0, child_process_1.execFileSync)('git', ['--version'], { stdio: 'ignore' });
|
|
21
|
+
cachedGitAvailable = true;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
cachedGitAvailable = false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return cachedGitAvailable;
|
|
28
|
+
}
|
|
29
|
+
function findGitRoot(startDir) {
|
|
30
|
+
let currentDir = startDir;
|
|
31
|
+
while (currentDir !== path_1.default.parse(currentDir).root) {
|
|
32
|
+
const gitDir = path_1.default.join(currentDir, '.git');
|
|
33
|
+
if ((0, fs_1.existsSync)(gitDir) && (0, fs_1.statSync)(gitDir).isDirectory()) {
|
|
34
|
+
return currentDir;
|
|
35
|
+
}
|
|
36
|
+
currentDir = path_1.default.dirname(currentDir);
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":";;;;;AAUA,sDAWC;AAED,kCAYC;AAnCD,iDAA4C;AAC5C,2BAAyC;AACzC,gDAAuB;AAEvB;;;;GAIG;AACH,IAAI,kBAAkB,GAAmB,IAAI,CAAA;AAC7C,SAAgB,qBAAqB;IACnC,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC;YACH,IAAA,4BAAY,EAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;YACvD,kBAAkB,GAAG,IAAI,CAAA;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,kBAAkB,GAAG,KAAK,CAAA;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAED,SAAgB,WAAW,CAAC,QAAgB;IAC1C,IAAI,UAAU,GAAG,QAAQ,CAAA;IAEzB,OAAO,UAAU,KAAK,cAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;QAC5C,IAAI,IAAA,eAAU,EAAC,MAAM,CAAC,IAAI,IAAA,aAAQ,EAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACzD,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { pino } from 'pino';
|
|
2
|
+
export interface LoggerContext {
|
|
3
|
+
userId?: string;
|
|
4
|
+
userEmail?: string;
|
|
5
|
+
clientSessionId?: string;
|
|
6
|
+
fingerprintId?: string;
|
|
7
|
+
clientRequestId?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export declare const loggerContext: LoggerContext;
|
|
11
|
+
declare const loggingLevels: readonly ["info", "debug", "warn", "error", "fatal"];
|
|
12
|
+
type LogLevel = (typeof loggingLevels)[number];
|
|
13
|
+
/**
|
|
14
|
+
* Wrapper around Pino logger.
|
|
15
|
+
*
|
|
16
|
+
* To also send to Posthog, set data.eventId to type AnalyticsEvent
|
|
17
|
+
*
|
|
18
|
+
* e.g. logger.info({eventId: AnalyticsEvent.SOME_EVENT, field: value}, 'some message')
|
|
19
|
+
*/
|
|
20
|
+
export declare const logger: Record<LogLevel, pino.LogFn>;
|
|
21
|
+
export {};
|
package/dist/utils/logger.js
CHANGED
|
@@ -27,7 +27,7 @@ exports.logger = exports.loggerContext = void 0;
|
|
|
27
27
|
const fs_1 = require("fs");
|
|
28
28
|
const path_1 = __importStar(require("path"));
|
|
29
29
|
const util_1 = require("util");
|
|
30
|
-
const analytics_events_1 = require("common/constants/analytics-events");
|
|
30
|
+
const analytics_events_1 = require("../common/constants/analytics-events");
|
|
31
31
|
const pino_1 = require("pino");
|
|
32
32
|
const project_files_1 = require("../project-files");
|
|
33
33
|
const analytics_1 = require("./analytics");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class Spinner {
|
|
2
|
+
private static instance;
|
|
3
|
+
private loadingInterval;
|
|
4
|
+
private previous;
|
|
5
|
+
private constructor();
|
|
6
|
+
static get(): Spinner;
|
|
7
|
+
start(): void;
|
|
8
|
+
stop(): void;
|
|
9
|
+
restoreCursor(): void;
|
|
10
|
+
log(message: string): void;
|
|
11
|
+
private rewriteLine;
|
|
12
|
+
}
|