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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cliOptions = exports.cliArguments = void 0;
|
|
4
|
+
exports.cliArguments = [
|
|
5
|
+
{
|
|
6
|
+
flags: '[project-directory]',
|
|
7
|
+
description: 'Project directory (default: current directory)',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
flags: '[initial-prompt...]',
|
|
11
|
+
description: 'Initial prompt to send',
|
|
12
|
+
menuDescription: 'Initial prompt to send to Codebuff',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
exports.cliOptions = [
|
|
16
|
+
{
|
|
17
|
+
flags: '--create <template> [name]',
|
|
18
|
+
description: 'Create new project from template',
|
|
19
|
+
menuDetails: [
|
|
20
|
+
'Available templates: nextjs, convex, vite, remix, node-cli,',
|
|
21
|
+
'python-cli, chrome-extension',
|
|
22
|
+
'See all: https://github.com/CodebuffAI/codebuff-community',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
flags: '--init',
|
|
27
|
+
description: 'Initialize codebuff on this project for a smoother experience',
|
|
28
|
+
menuDescription: 'Initialize Codebuff for the project',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
flags: '--model <model>',
|
|
32
|
+
description: 'Experimental: Specify the main model to use for the agent ("sonnet-3.6", "sonnet-3.7", "gpt-4.1", "gemini-2.5-pro", "o4-mini", "o3"). Be aware codebuff might not work as well with non-default models.',
|
|
33
|
+
menuDescription: 'Specify main LLM (e.g., "sonnet-3.7") (Experimental)',
|
|
34
|
+
hidden: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
flags: '--lite',
|
|
38
|
+
description: 'Use budget models & fetch fewer files',
|
|
39
|
+
menuDescription: 'Use budget models & fetch fewer files (faster)',
|
|
40
|
+
hidden: false,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
flags: '--max',
|
|
44
|
+
description: 'Use higher quality models and fetch more files',
|
|
45
|
+
menuDescription: 'Use higher quality models and fetch more files (thorough)',
|
|
46
|
+
hidden: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
flags: '--experimental',
|
|
50
|
+
description: 'Use cutting-edge experimental features and models',
|
|
51
|
+
hidden: true,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
//# sourceMappingURL=cli-definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-definitions.js","sourceRoot":"","sources":["../src/cli-definitions.ts"],"names":[],"mappings":";;;AAQa,QAAA,YAAY,GAAe;IACtC;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,gDAAgD;KAC9D;IACD;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,wBAAwB;QACrC,eAAe,EAAE,oCAAoC;KACtD;CACF,CAAA;AAEY,QAAA,UAAU,GAAe;IACpC;QACE,KAAK,EAAE,4BAA4B;QACnC,WAAW,EAAE,kCAAkC;QAC/C,WAAW,EAAE;YACX,6DAA6D;YAC7D,8BAA8B;YAC9B,2DAA2D;SAC5D;KACF;IACD;QACE,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,+DAA+D;QACjE,eAAe,EAAE,qCAAqC;KACvD;IACD;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,yMAAyM;QAC3M,eAAe,EAAE,sDAAsD;QACvE,MAAM,EAAE,IAAI;KACb;IACD;QACE,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,uCAAuC;QACpD,eAAe,EAAE,gDAAgD;QACjE,MAAM,EAAE,KAAK;KACd;IACD;QACE,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,gDAAgD;QAC7D,eAAe,EACb,2DAA2D;QAC7D,MAAM,EAAE,KAAK;KACd;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,mDAAmD;QAChE,MAAM,EAAE,IAAI;KACb;CACF,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ApiKeyType } from '../common/api-keys/constants';
|
|
2
|
+
import { Client } from '../client';
|
|
3
|
+
export type ApiKeyDetectionResult = {
|
|
4
|
+
status: 'found';
|
|
5
|
+
type: ApiKeyType;
|
|
6
|
+
key: string;
|
|
7
|
+
} | {
|
|
8
|
+
status: 'prefix_only';
|
|
9
|
+
type: ApiKeyType;
|
|
10
|
+
prefix: string;
|
|
11
|
+
length: number;
|
|
12
|
+
} | {
|
|
13
|
+
status: 'not_found';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Detects if the user input contains a known API key pattern.
|
|
17
|
+
* Returns information about the detected key or prefix.
|
|
18
|
+
*/
|
|
19
|
+
export declare function detectApiKey(userInput: string): ApiKeyDetectionResult;
|
|
20
|
+
/**
|
|
21
|
+
* Handles the result of API key detection.
|
|
22
|
+
*/
|
|
23
|
+
export declare function handleApiKeyInput(client: Client, detectionResult: Exclude<ApiKeyDetectionResult, {
|
|
24
|
+
status: 'not_found';
|
|
25
|
+
}>, readyPromise: Promise<any>, returnControlToUser: () => void): Promise<void>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.detectApiKey = detectApiKey;
|
|
4
4
|
exports.handleApiKeyInput = handleApiKeyInput;
|
|
5
|
-
const constants_1 = require("common/api-keys/constants");
|
|
5
|
+
const constants_1 = require("../common/api-keys/constants");
|
|
6
6
|
const picocolors_1 = require("picocolors");
|
|
7
7
|
/**
|
|
8
8
|
* Detects if the user input contains a known API key pattern.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Interface as ReadlineInterface } from 'readline';
|
|
2
|
+
import type { Client } from '../client';
|
|
3
|
+
export declare const checkpointCommands: {
|
|
4
|
+
readonly save: readonly [readonly ["checkpoint"], "Save current state as a new checkpoint"];
|
|
5
|
+
readonly list: readonly [readonly ["checkpoint list", "checkpoints"], "List all saved checkpoints"];
|
|
6
|
+
readonly clear: readonly [readonly ["checkpoint clear"], "Clear all checkpoints"];
|
|
7
|
+
readonly undo: readonly [readonly ["undo", "u"], "Undo to previous checkpoint"];
|
|
8
|
+
readonly redo: readonly [readonly ["redo", "r"], "Redo previously undone checkpoint"];
|
|
9
|
+
readonly restore: readonly [readonly [RegExp], "Restore to checkpoint number <n>"];
|
|
10
|
+
};
|
|
11
|
+
export declare function displayCheckpointMenu(): void;
|
|
12
|
+
export declare function isCheckpointCommand(userInput: string, type?: keyof typeof checkpointCommands | null): boolean | RegExpMatchArray;
|
|
13
|
+
export declare function listCheckpoints(): Promise<void>;
|
|
14
|
+
export declare function handleUndo(client: Client, rl: ReadlineInterface): Promise<string>;
|
|
15
|
+
export declare function handleRedo(client: Client, rl: ReadlineInterface): Promise<string>;
|
|
16
|
+
export declare function handleRestoreCheckpoint(id: number, client: Client, rl: ReadlineInterface): Promise<string>;
|
|
17
|
+
export declare function handleClearCheckpoints(): void;
|
|
18
|
+
export declare function saveCheckpoint(userInput: string, client: Client, readyPromise: Promise<any>, saveWithNoChanges?: boolean): Promise<void>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleDiff = handleDiff;
|
|
4
|
+
const picocolors_1 = require("picocolors");
|
|
5
|
+
function handleDiff(lastChanges) {
|
|
6
|
+
if (lastChanges.length === 0) {
|
|
7
|
+
console.log((0, picocolors_1.yellow)('No changes found in the last assistant response.'));
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
lastChanges.forEach((change) => {
|
|
11
|
+
console.log((0, picocolors_1.bold)(`___${change.path}___`));
|
|
12
|
+
const lines = change.content
|
|
13
|
+
.split('\n')
|
|
14
|
+
.map((line) => (change.type === 'file' ? '+' + line : line));
|
|
15
|
+
lines.forEach((line) => {
|
|
16
|
+
if (line.startsWith('+')) {
|
|
17
|
+
console.log((0, picocolors_1.green)(line));
|
|
18
|
+
}
|
|
19
|
+
else if (line.startsWith('-')) {
|
|
20
|
+
console.log((0, picocolors_1.red)(line));
|
|
21
|
+
}
|
|
22
|
+
else if (line.startsWith('@@')) {
|
|
23
|
+
console.log((0, picocolors_1.cyan)(line));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
console.log(line);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/cli-handlers/diff.ts"],"names":[],"mappings":";;AAGA,gCAwBC;AA1BD,2CAA2D;AAE3D,SAAgB,UAAU,CAAC,WAAyB;IAClD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAM,EAAC,kDAAkD,CAAC,CAAC,CAAA;QACvE,OAAM;IACR,CAAC;IAED,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAA,iBAAI,EAAC,MAAM,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAA;QACzC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO;aACzB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QAE9D,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,GAAG,CAAC,IAAA,kBAAK,EAAC,IAAI,CAAC,CAAC,CAAA;YAC1B,CAAC;iBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,IAAA,gBAAG,EAAC,IAAI,CAAC,CAAC,CAAA;YACxB,CAAC;iBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,IAAA,iBAAI,EAAC,IAAI,CAAC,CAAC,CAAA;YACzB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function showEasterEgg(complete: () => void): Promise<void>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showEasterEgg = showEasterEgg;
|
|
4
|
+
const picocolors_1 = require("picocolors");
|
|
5
|
+
// Utility: clear the terminal screen
|
|
6
|
+
function clearScreen() {
|
|
7
|
+
process.stdout.write('\u001b[2J\u001b[0;0H');
|
|
8
|
+
}
|
|
9
|
+
// Utility: Generate a set of points tracing a "C" shape using an arc.
|
|
10
|
+
function generateCPath(cx, cy, r, steps) {
|
|
11
|
+
const points = [];
|
|
12
|
+
// A typical "C" opens to the right: from 45° to 315° (in radians)
|
|
13
|
+
const startAngle = Math.PI / 4;
|
|
14
|
+
const endAngle = (7 * Math.PI) / 4;
|
|
15
|
+
const angleStep = (endAngle - startAngle) / steps;
|
|
16
|
+
for (let i = 0; i <= steps; i++) {
|
|
17
|
+
const angle = startAngle + i * angleStep;
|
|
18
|
+
const x = Math.floor(cx + r * Math.cos(angle));
|
|
19
|
+
const y = Math.floor(cy + r * Math.sin(angle));
|
|
20
|
+
points.push({ x, y });
|
|
21
|
+
}
|
|
22
|
+
return points;
|
|
23
|
+
}
|
|
24
|
+
// Utility: Generate points along a quadratic Bézier curve.
|
|
25
|
+
function quadraticBezier(P0, P1, P2, steps) {
|
|
26
|
+
const points = [];
|
|
27
|
+
for (let i = 0; i <= steps; i++) {
|
|
28
|
+
const t = i / steps;
|
|
29
|
+
const x = Math.round((1 - t) ** 2 * P0.x + 2 * (1 - t) * t * P1.x + t ** 2 * P2.x);
|
|
30
|
+
const y = Math.round((1 - t) ** 2 * P0.y + 2 * (1 - t) * t * P1.y + t ** 2 * P2.y);
|
|
31
|
+
points.push({ x, y });
|
|
32
|
+
}
|
|
33
|
+
return points;
|
|
34
|
+
}
|
|
35
|
+
// Generate a vertical line from startY to endY at a given x.
|
|
36
|
+
function generateVerticalLine(x, startY, endY) {
|
|
37
|
+
const points = [];
|
|
38
|
+
const step = startY < endY ? 1 : -1;
|
|
39
|
+
for (let y = startY; y !== endY; y += step) {
|
|
40
|
+
points.push({ x, y });
|
|
41
|
+
}
|
|
42
|
+
points.push({ x, y: endY });
|
|
43
|
+
return points;
|
|
44
|
+
}
|
|
45
|
+
// Generate a path approximating a B shape using two quadratic Bézier curves
|
|
46
|
+
// for the rounded bubbles, and then closing the shape with a vertical spine.
|
|
47
|
+
function generateBPath(bX, bYTop, bYBottom, bWidth, bGap, stepsPerCurve) {
|
|
48
|
+
let points = [];
|
|
49
|
+
const middle = Math.floor((bYTop + bYBottom) / 2);
|
|
50
|
+
// Upper bubble: from top-left (spine) out then back to the spine at the middle.
|
|
51
|
+
const upperStart = { x: bX, y: bYTop };
|
|
52
|
+
const upperControl = {
|
|
53
|
+
x: bX + bWidth + bGap - 10,
|
|
54
|
+
y: Math.floor((bYTop + middle) / 2),
|
|
55
|
+
};
|
|
56
|
+
const upperEnd = { x: bX, y: middle };
|
|
57
|
+
const upperCurve = quadraticBezier(upperStart, upperControl, upperEnd, stepsPerCurve);
|
|
58
|
+
// Lower bubble: from the middle to the bottom.
|
|
59
|
+
const lowerStart = { x: bX, y: middle };
|
|
60
|
+
const lowerControl = {
|
|
61
|
+
x: bX + bWidth + bGap,
|
|
62
|
+
y: Math.floor((middle + bYBottom) / 2),
|
|
63
|
+
};
|
|
64
|
+
const lowerEnd = { x: bX, y: bYBottom };
|
|
65
|
+
const lowerCurve = quadraticBezier(lowerStart, lowerControl, lowerEnd, stepsPerCurve);
|
|
66
|
+
// Combine the curves.
|
|
67
|
+
points = points.concat(upperCurve, lowerCurve);
|
|
68
|
+
// Add a vertical line from the bottom of the B back up to the top.
|
|
69
|
+
const closingLine = generateVerticalLine(bX, bYBottom, bYTop);
|
|
70
|
+
points = points.concat(closingLine);
|
|
71
|
+
return points;
|
|
72
|
+
}
|
|
73
|
+
// Array of picocolors functions for random colors.
|
|
74
|
+
const colors = [picocolors_1.red, picocolors_1.green, picocolors_1.yellow, picocolors_1.blue, picocolors_1.magenta, picocolors_1.cyan];
|
|
75
|
+
function getRandomColor() {
|
|
76
|
+
return colors[Math.floor(Math.random() * colors.length)];
|
|
77
|
+
}
|
|
78
|
+
async function showEasterEgg(complete) {
|
|
79
|
+
const text = 'codebuffy';
|
|
80
|
+
const termWidth = process.stdout.columns;
|
|
81
|
+
const termHeight = process.stdout.rows;
|
|
82
|
+
const baselineWidth = 80;
|
|
83
|
+
const baselineHeight = 24;
|
|
84
|
+
const scaleFactor = Math.min(termWidth / baselineWidth, termHeight / baselineHeight);
|
|
85
|
+
// Dynamically scale parameters for the shapes.
|
|
86
|
+
// Use Math.max to ensure values don't get too small.
|
|
87
|
+
const cCenterX = Math.floor(termWidth * 0.3);
|
|
88
|
+
const cCenterY = Math.floor(termHeight / 2);
|
|
89
|
+
const cRadius = Math.max(2, Math.floor(8 * scaleFactor));
|
|
90
|
+
const cSteps = Math.max(10, Math.floor(30 * scaleFactor));
|
|
91
|
+
const bX = Math.floor(termWidth * 0.55);
|
|
92
|
+
const bYTop = Math.floor(termHeight / 2 - 7 * scaleFactor);
|
|
93
|
+
const bYBottom = Math.floor(termHeight / 2 + 7 * scaleFactor);
|
|
94
|
+
const bWidth = Math.max(2, Math.floor(8 * scaleFactor));
|
|
95
|
+
const bGap = Math.max(1, Math.floor(35 * scaleFactor));
|
|
96
|
+
const bStepsPerCurve = Math.max(10, Math.floor(20 * scaleFactor));
|
|
97
|
+
// Generate the paths.
|
|
98
|
+
const fullPath = [
|
|
99
|
+
...generateCPath(cCenterX, cCenterY, cRadius, cSteps),
|
|
100
|
+
...generateBPath(bX, bYTop, bYBottom, bWidth, bGap, bStepsPerCurve),
|
|
101
|
+
];
|
|
102
|
+
// Animation state: index into the fullPath.
|
|
103
|
+
let index = 0;
|
|
104
|
+
let completedCycle = false;
|
|
105
|
+
// Main animation function
|
|
106
|
+
function animate() {
|
|
107
|
+
if (index >= fullPath.length) {
|
|
108
|
+
completedCycle = true;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const { x, y } = fullPath[index];
|
|
112
|
+
const cursorPosition = `\u001b[${y + 1};${x + 1}H`;
|
|
113
|
+
process.stdout.write(cursorPosition + getRandomColor()(text));
|
|
114
|
+
index++;
|
|
115
|
+
}
|
|
116
|
+
clearScreen();
|
|
117
|
+
const interval = setInterval(() => {
|
|
118
|
+
animate();
|
|
119
|
+
if (completedCycle) {
|
|
120
|
+
clearInterval(interval);
|
|
121
|
+
clearScreen();
|
|
122
|
+
complete();
|
|
123
|
+
}
|
|
124
|
+
}, 100);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=easter-egg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"easter-egg.js","sourceRoot":"","sources":["../../src/cli-handlers/easter-egg.ts"],"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C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;QAClD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,GAAG,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;QAE7D,KAAK,EAAE,CAAA;IACT,CAAC;IAED,WAAW,EAAE,CAAA;IACb,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,OAAO,EAAE,CAAA;QACT,IAAI,cAAc,EAAE,CAAC;YACnB,aAAa,CAAC,QAAQ,CAAC,CAAA;YACvB,WAAW,EAAE,CAAA;YACb,QAAQ,EAAE,CAAA;QACZ,CAAC;IACH,CAAC,EAAE,GAAG,CAAC,CAAA;AACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handleInitializationFlowLocally(): void;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.handleInitializationFlowLocally = handleInitializationFlowLocally;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const constants_1 = require("common/json-config/constants");
|
|
9
|
+
const constants_1 = require("../common/json-config/constants");
|
|
10
10
|
const project_files_1 = require("../project-files");
|
|
11
11
|
function handleInitializationFlowLocally() {
|
|
12
12
|
const projectRoot = (0, project_files_1.getProjectRoot)();
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as readline from 'readline';
|
|
2
|
+
import { ProjectFileContext } from './common/util/file';
|
|
3
|
+
import { CliOptions } from './types';
|
|
4
|
+
export declare class CLI {
|
|
5
|
+
private static instance;
|
|
6
|
+
private readyPromise;
|
|
7
|
+
private git;
|
|
8
|
+
private costMode;
|
|
9
|
+
private isReceivingResponse;
|
|
10
|
+
private stopResponse;
|
|
11
|
+
private lastSigintTime;
|
|
12
|
+
private lastInputTime;
|
|
13
|
+
private consecutiveFastInputs;
|
|
14
|
+
private pastedContent;
|
|
15
|
+
private isPasting;
|
|
16
|
+
private shouldReconnectWhenIdle;
|
|
17
|
+
rl: readline.Interface;
|
|
18
|
+
private constructor();
|
|
19
|
+
static initialize(readyPromise: Promise<[ProjectFileContext, void, void]>, options: CliOptions): void;
|
|
20
|
+
static getInstance(): CLI;
|
|
21
|
+
private setupSignalHandlers;
|
|
22
|
+
private _loadHistory;
|
|
23
|
+
private _appendToHistory;
|
|
24
|
+
private initReadlineInterface;
|
|
25
|
+
private inputCompleter;
|
|
26
|
+
private setPrompt;
|
|
27
|
+
/**
|
|
28
|
+
* Prompts the user with a clean prompt state
|
|
29
|
+
*/
|
|
30
|
+
private freshPrompt;
|
|
31
|
+
printInitialPrompt({ initialInput, runInitFlow, }: {
|
|
32
|
+
initialInput?: string;
|
|
33
|
+
runInitFlow?: boolean;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
printDiff(): Promise<void>;
|
|
36
|
+
private handleLine;
|
|
37
|
+
private handleUserInput;
|
|
38
|
+
/**
|
|
39
|
+
* Cleans command input by removing leading slash while preserving special command syntax
|
|
40
|
+
* @param input The raw user input
|
|
41
|
+
* @returns The cleaned command string
|
|
42
|
+
*/
|
|
43
|
+
private cleanCommandInput;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if a command is a known slash command
|
|
46
|
+
* @param command The command to check (without leading slash)
|
|
47
|
+
*/
|
|
48
|
+
private isKnownSlashCommand;
|
|
49
|
+
/**
|
|
50
|
+
* Handles an unknown slash command by displaying an error message
|
|
51
|
+
* @param command The unknown command that was entered
|
|
52
|
+
*/
|
|
53
|
+
private handleUnknownCommand;
|
|
54
|
+
private processCommand;
|
|
55
|
+
private forwardUserInput;
|
|
56
|
+
private reconnectWhenNextIdle;
|
|
57
|
+
private onWebSocketError;
|
|
58
|
+
private onWebSocketReconnect;
|
|
59
|
+
private handleKeyPress;
|
|
60
|
+
private handleSigint;
|
|
61
|
+
private handleEscKey;
|
|
62
|
+
private handleStopResponse;
|
|
63
|
+
private handleExit;
|
|
64
|
+
private detectPasting;
|
|
65
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -29,8 +29,8 @@ const os = __importStar(require("os"));
|
|
|
29
29
|
const os_1 = require("os");
|
|
30
30
|
const path_1 = __importStar(require("path"));
|
|
31
31
|
const readline = __importStar(require("readline"));
|
|
32
|
-
const analytics_events_1 = require("common/constants/analytics-events");
|
|
33
|
-
const string_1 = require("common/util/string");
|
|
32
|
+
const analytics_events_1 = require("./common/constants/analytics-events");
|
|
33
|
+
const string_1 = require("./common/util/string");
|
|
34
34
|
const picocolors_1 = require("picocolors");
|
|
35
35
|
const background_process_manager_1 = require("./background-process-manager");
|
|
36
36
|
const chat_storage_1 = require("./chat-storage");
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FileChanges, UsageResponse } from 'common/actions';
|
|
2
|
-
import { ApiKeyType } from 'common/api-keys/constants';
|
|
3
|
-
import { CostMode } from 'common/constants';
|
|
4
|
-
import { AgentState, ToolResult } from 'common/types/agent-state';
|
|
5
|
-
import { User } from 'common/util/credentials';
|
|
6
|
-
import { ProjectFileContext } from 'common/util/file';
|
|
1
|
+
import { FileChanges, UsageResponse } from './common/actions';
|
|
2
|
+
import { ApiKeyType } from './common/api-keys/constants';
|
|
3
|
+
import { CostMode } from './common/constants';
|
|
4
|
+
import { AgentState, ToolResult } from './common/types/agent-state';
|
|
5
|
+
import { User } from './common/util/credentials';
|
|
6
|
+
import { ProjectFileContext } from './common/util/file';
|
|
7
7
|
import { GitCommand, MakeNullable } from './types';
|
|
8
8
|
type UsageData = Omit<MakeNullable<UsageResponse, 'remainingBalance'>, 'type'>;
|
|
9
9
|
interface ClientOptions {
|
|
@@ -66,7 +66,7 @@ export declare class Client {
|
|
|
66
66
|
agentContext: string;
|
|
67
67
|
fileContext: {
|
|
68
68
|
currentWorkingDirectory: string;
|
|
69
|
-
fileTree: import("common/util/file").FileTreeNode[];
|
|
69
|
+
fileTree: import("./common/util/file").FileTreeNode[];
|
|
70
70
|
fileTokenScores: Record<string, Record<string, number>>;
|
|
71
71
|
knowledgeFiles: Record<string, string>;
|
|
72
72
|
gitChanges: {
|
package/dist/client.js
CHANGED
|
@@ -8,15 +8,15 @@ const child_process_1 = require("child_process");
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const actions_1 = require("common/actions");
|
|
12
|
-
const constants_1 = require("common/api-keys/constants");
|
|
13
|
-
const constants_2 = require("common/constants");
|
|
14
|
-
const analytics_events_1 = require("common/constants/analytics-events");
|
|
15
|
-
const constants_3 = require("common/json-config/constants");
|
|
16
|
-
const agent_state_1 = require("common/types/agent-state");
|
|
17
|
-
const array_1 = require("common/util/array");
|
|
18
|
-
const string_1 = require("common/util/string");
|
|
19
|
-
const websocket_client_1 = require("common/websockets/websocket-client");
|
|
11
|
+
const actions_1 = require("./common/actions");
|
|
12
|
+
const constants_1 = require("./common/api-keys/constants");
|
|
13
|
+
const constants_2 = require("./common/constants");
|
|
14
|
+
const analytics_events_1 = require("./common/constants/analytics-events");
|
|
15
|
+
const constants_3 = require("./common/json-config/constants");
|
|
16
|
+
const agent_state_1 = require("./common/types/agent-state");
|
|
17
|
+
const array_1 = require("./common/util/array");
|
|
18
|
+
const string_1 = require("./common/util/string");
|
|
19
|
+
const websocket_client_1 = require("./common/websockets/websocket-client");
|
|
20
20
|
const picocolors_1 = require("picocolors");
|
|
21
21
|
const ts_pattern_1 = require("ts-pattern");
|
|
22
22
|
const zod_1 = require("zod");
|
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createTemplateProject(template: string, projectDir: string, projectName?: string): Promise<void>;
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,C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E,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAEpD,uBAAuB;QACvB,IAAI,EAAE,CAAC,UAAU,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;YAC3C,IAAA,wBAAQ,EAAC,aAAa,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;QACjE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,IAAA,kBAAK,EAAC,yCAAyC,WAAW,IAAI,CAAC,CAAC,CAAA;QAE5E,yDAAyD;QACzD,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAC1B,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAA;QACxD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;QACjD,IAAA,wBAAQ,EAAC,UAAU,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
|
package/dist/credentials.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CREDENTIALS_PATH = exports.CONFIG_DIR = exports.userFromJson = void 0;
|
|
7
|
-
const credentials_1 = require("common/util/credentials");
|
|
7
|
+
const credentials_1 = require("./common/util/credentials");
|
|
8
8
|
const zod_1 = require("zod");
|
|
9
9
|
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -25,7 +25,7 @@ const userFromJson = (json, profileName = 'default') => {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
exports.userFromJson = userFromJson;
|
|
28
|
-
const file_1 = require("common/util/file");
|
|
28
|
+
const file_1 = require("./common/util/file");
|
|
29
29
|
exports.CONFIG_DIR = node_path_1.default.join(os_1.default.homedir(), '.config', 'manicode' +
|
|
30
30
|
// on a development stack?
|
|
31
31
|
(process.env.NEXT_PUBLIC_CB_ENVIRONMENT &&
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.startDevProcesses = startDevProcesses;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const string_1 = require("common/util/string");
|
|
8
|
+
const string_1 = require("./common/util/string");
|
|
9
9
|
const picocolors_1 = require("picocolors");
|
|
10
10
|
const terminal_1 = require("./utils/terminal");
|
|
11
11
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overwrites writing multiple (more than 2) newlines for all functions.
|
|
3
|
+
*
|
|
4
|
+
* Only replaces raw '\n\n\n' strings. i.e. '\n\n' + green('\n\n'), still
|
|
5
|
+
* renders as four newline characters. Because there is an ANSI escape
|
|
6
|
+
* character between the first two and the last two newline characters.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPrevious(): string;
|
|
9
|
+
export declare function setPrevious(str: string): void;
|
|
10
|
+
export declare function enableSquashNewlines(): void;
|
|
11
|
+
export declare function disableSquashNewlines(): void;
|