codebuff 1.0.290 → 1.0.291
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/cli-handlers/checkpoint.d.ts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/common/actions.d.ts +144 -144
- package/dist/common/db/schema.d.ts +1 -1
- package/dist/common/types/agent-state.d.ts +8 -8
- package/dist/common/types/message.d.ts +6 -6
- package/dist/common/types/organization.d.ts +102 -0
- package/dist/common/types/organization.js +3 -0
- package/dist/common/types/organization.js.map +1 -0
- package/dist/common/types/usage.d.ts +2 -2
- package/dist/common/util/credentials.d.ts +2 -2
- package/dist/common/websockets/websocket-schema.d.ts +256 -256
- package/dist/index.js +9 -3
- package/dist/organization-context.d.ts +33 -0
- package/dist/organization-context.js +112 -0
- package/dist/organization-context.js.map +1 -0
- package/dist/slash-commands.d.ts +7 -0
- package/dist/slash-commands.js +21 -0
- package/dist/slash-commands.js.map +1 -0
- package/dist/utils/spinner.js +1 -1
- package/package.json +1 -1
- package/dist/common/__tests__/project-file-tree.test.d.ts +0 -1
- package/dist/common/__tests__/project-file-tree.test.js +0 -251
- package/dist/common/__tests__/project-file-tree.test.js.map +0 -1
- package/dist/common/json-config/__tests__/__snapshots__/stringify-schema.test.js.snap +0 -119
- package/dist/common/util/process-stream.d.ts +0 -7
- package/dist/common/util/process-stream.js +0 -162
- package/dist/common/util/process-stream.js.map +0 -1
- package/dist/readline.d.ts +0 -22
- package/dist/readline.js +0 -180
- package/dist/readline.js.map +0 -1
- package/dist/utils/__tests__/__snapshots__/background-process-manager.test.js.snap +0 -137
- package/dist/utils/__tests__/file-paths.test.d.ts +0 -1
- package/dist/utils/__tests__/file-paths.test.js +0 -37
- package/dist/utils/__tests__/file-paths.test.js.map +0 -1
- package/dist/utils/__tests__/path.test.d.ts +0 -1
- package/dist/utils/__tests__/path.test.js +0 -37
- package/dist/utils/__tests__/path.test.js.map +0 -1
- package/dist/utils/file-paths.d.ts +0 -9
- package/dist/utils/file-paths.js +0 -24
- package/dist/utils/file-paths.js.map +0 -1
- package/dist/utils/path.d.ts +0 -9
- package/dist/utils/path.js +0 -27
- package/dist/utils/path.js.map +0 -1
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processStreamWithTags = processStreamWithTags;
|
|
4
|
-
const saxy_1 = require("./saxy");
|
|
5
|
-
async function* processStreamWithTags(stream, tags) {
|
|
6
|
-
const saxyParser = new saxy_1.Saxy();
|
|
7
|
-
let currentTagName = null;
|
|
8
|
-
let currentTagAttributes = {};
|
|
9
|
-
let currentTagContentBuffer = '';
|
|
10
|
-
let shouldStopProcessing = false;
|
|
11
|
-
const outputQueue = [];
|
|
12
|
-
const enqueueOutput = (str) => {
|
|
13
|
-
if (str) {
|
|
14
|
-
// Only enqueue non-empty strings
|
|
15
|
-
outputQueue.push(str);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
saxyParser.on('tagopen', (node) => {
|
|
19
|
-
if (shouldStopProcessing)
|
|
20
|
-
return;
|
|
21
|
-
if (currentTagName === null) {
|
|
22
|
-
// Not currently inside a tracked tag
|
|
23
|
-
if (tags[node.name]) {
|
|
24
|
-
// This is a tag we want to track
|
|
25
|
-
currentTagName = node.name;
|
|
26
|
-
try {
|
|
27
|
-
currentTagAttributes = saxy_1.Saxy.parseAttrs(node.attrs);
|
|
28
|
-
}
|
|
29
|
-
catch (e) {
|
|
30
|
-
// If attributes are malformed, default to empty or handle as error
|
|
31
|
-
// console.error(`Error parsing attributes for tag ${node.name}: "${node.attrs}"`, e);
|
|
32
|
-
currentTagAttributes = {}; // Default to empty attributes on parsing error
|
|
33
|
-
}
|
|
34
|
-
tags[currentTagName].onTagStart(currentTagAttributes);
|
|
35
|
-
currentTagContentBuffer = '';
|
|
36
|
-
if (node.isSelfClosing) {
|
|
37
|
-
const stop = tags[currentTagName].onTagEnd(currentTagContentBuffer, currentTagAttributes);
|
|
38
|
-
currentTagName = null;
|
|
39
|
-
currentTagAttributes = {};
|
|
40
|
-
if (stop) {
|
|
41
|
-
shouldStopProcessing = true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// A non-tracked tag, pass it through
|
|
47
|
-
enqueueOutput(`<${node.name}${node.attrs ? ' ' + node.attrs : ''}${node.isSelfClosing ? ' /' : ''}>`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
// Inside a tracked tag, so this is nested content
|
|
52
|
-
currentTagContentBuffer += `<${node.name}${node.attrs ? ' ' + node.attrs : ''}${node.isSelfClosing ? ' /' : ''}>`;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
saxyParser.on('text', (node) => {
|
|
56
|
-
if (shouldStopProcessing)
|
|
57
|
-
return;
|
|
58
|
-
if (currentTagName !== null) {
|
|
59
|
-
currentTagContentBuffer += node.contents;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
enqueueOutput(node.contents);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
saxyParser.on('tagclose', (node) => {
|
|
66
|
-
if (shouldStopProcessing)
|
|
67
|
-
return;
|
|
68
|
-
if (currentTagName === node.name) {
|
|
69
|
-
const stop = tags[currentTagName].onTagEnd(currentTagContentBuffer, currentTagAttributes);
|
|
70
|
-
currentTagName = null;
|
|
71
|
-
currentTagAttributes = {};
|
|
72
|
-
currentTagContentBuffer = '';
|
|
73
|
-
if (stop) {
|
|
74
|
-
shouldStopProcessing = true;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else if (currentTagName !== null) {
|
|
78
|
-
// Closing a nested tag inside a tracked tag
|
|
79
|
-
currentTagContentBuffer += `</${node.name}>`;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
// Closing a non-tracked tag, pass it through
|
|
83
|
-
enqueueOutput(`</${node.name}>`);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
saxyParser.on('cdata', (node) => {
|
|
87
|
-
if (shouldStopProcessing)
|
|
88
|
-
return;
|
|
89
|
-
const cdataStr = `<![CDATA[${node.contents}]]>`;
|
|
90
|
-
if (currentTagName !== null) {
|
|
91
|
-
currentTagContentBuffer += cdataStr;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
enqueueOutput(cdataStr);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
saxyParser.on('comment', (node) => {
|
|
98
|
-
if (shouldStopProcessing)
|
|
99
|
-
return;
|
|
100
|
-
const commentStr = `<!--${node.contents}-->`;
|
|
101
|
-
if (currentTagName !== null) {
|
|
102
|
-
currentTagContentBuffer += commentStr;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
enqueueOutput(commentStr);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
saxyParser.on('processinginstruction', (node) => {
|
|
109
|
-
if (shouldStopProcessing)
|
|
110
|
-
return;
|
|
111
|
-
const piStr = `<?${node.contents}?>`;
|
|
112
|
-
if (currentTagName !== null) {
|
|
113
|
-
currentTagContentBuffer += piStr;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
enqueueOutput(piStr);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
saxyParser.on('error', (err) => {
|
|
120
|
-
// Saxy might emit 'error' for issues not causing write/end to throw.
|
|
121
|
-
// This flag helps stop processing in such cases.
|
|
122
|
-
// console.error("Saxy parser emitted an error:", err);
|
|
123
|
-
shouldStopProcessing = true;
|
|
124
|
-
// The error might need to be explicitly thrown here if it's critical
|
|
125
|
-
// and not otherwise surfaced to the generator's caller.
|
|
126
|
-
// For now, this ensures processing stops.
|
|
127
|
-
});
|
|
128
|
-
try {
|
|
129
|
-
for await (const chunk of stream) {
|
|
130
|
-
if (shouldStopProcessing)
|
|
131
|
-
break;
|
|
132
|
-
saxyParser.write(chunk); // Saxy events fill outputQueue
|
|
133
|
-
while (outputQueue.length > 0) {
|
|
134
|
-
// If stopping and not inside a tracked tag, clear queue to prevent further passthrough.
|
|
135
|
-
if (shouldStopProcessing && currentTagName === null) {
|
|
136
|
-
outputQueue.length = 0;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
yield outputQueue.shift();
|
|
140
|
-
}
|
|
141
|
-
// Re-check stop condition after yielding, as an event during write might have set it.
|
|
142
|
-
if (shouldStopProcessing)
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
if (!shouldStopProcessing) {
|
|
146
|
-
saxyParser.end(); // Finalize parsing
|
|
147
|
-
while (outputQueue.length > 0) {
|
|
148
|
-
if (shouldStopProcessing && currentTagName === null) {
|
|
149
|
-
outputQueue.length = 0;
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
yield outputQueue.shift();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
// Catches errors from saxyParser.write() or saxyParser.end()
|
|
158
|
-
// console.error("Error during Saxy stream processing in generator:", error);
|
|
159
|
-
throw error; // Propagate error to the caller
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
//# sourceMappingURL=process-stream.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process-stream.js","sourceRoot":"","sources":["../../src/util/process-stream.ts"],"names":[],"mappings":";;AAUA,sDAkLC;AA5LD,iCAQe;AAER,KAAK,SAAS,CAAC,CAAC,qBAAqB,CAC1C,MAAyB,EACzB,IAOC;IAED,MAAM,UAAU,GAAG,IAAI,WAAI,EAAE,CAAA;IAC7B,IAAI,cAAc,GAAkB,IAAI,CAAA;IACxC,IAAI,oBAAoB,GAA2B,EAAE,CAAA;IACrD,IAAI,uBAAuB,GAAW,EAAE,CAAA;IACxC,IAAI,oBAAoB,GAAG,KAAK,CAAA;IAEhC,MAA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-
export declare class ReadlineManager {
|
|
3
|
-
private static instance;
|
|
4
|
-
private rl;
|
|
5
|
-
onLine: (line: string) => void;
|
|
6
|
-
onSigint: () => Promise<void>;
|
|
7
|
-
onClose: () => Promise<void>;
|
|
8
|
-
onKeyPress: (str: string, key: any) => void;
|
|
9
|
-
private constructor();
|
|
10
|
-
static getInstance(): ReadlineManager;
|
|
11
|
-
static getRLInstance(): readline.Interface;
|
|
12
|
-
private initReadlineInterface;
|
|
13
|
-
private _loadHistory;
|
|
14
|
-
appendToHistory(line: string): void;
|
|
15
|
-
private inputCompleter;
|
|
16
|
-
resetPrompt(): void;
|
|
17
|
-
prompt(): void;
|
|
18
|
-
write(data: string | Buffer | undefined): void;
|
|
19
|
-
get line(): string;
|
|
20
|
-
set line(value: string);
|
|
21
|
-
refreshLine(): void;
|
|
22
|
-
}
|
package/dist/readline.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ReadlineManager = void 0;
|
|
30
|
-
const fs_1 = __importDefault(require("fs"));
|
|
31
|
-
const os_1 = __importDefault(require("os"));
|
|
32
|
-
const path_1 = __importDefault(require("path"));
|
|
33
|
-
const picocolors_1 = require("picocolors");
|
|
34
|
-
const readline = __importStar(require("./readline"));
|
|
35
|
-
const credentials_1 = require("./credentials");
|
|
36
|
-
const menu_1 = require("./menu");
|
|
37
|
-
const project_files_1 = require("./project-files");
|
|
38
|
-
const PROMPT_HISTORY_PATH = path_1.default.join(credentials_1.CONFIG_DIR, 'prompt_history.json');
|
|
39
|
-
class ReadlineManager {
|
|
40
|
-
static instance = null;
|
|
41
|
-
rl;
|
|
42
|
-
// Callbacks to be set by the CLI
|
|
43
|
-
onLine = () => { };
|
|
44
|
-
onSigint = async () => { };
|
|
45
|
-
onClose = async () => { };
|
|
46
|
-
onKeyPress = () => { };
|
|
47
|
-
constructor() {
|
|
48
|
-
this.initReadlineInterface();
|
|
49
|
-
}
|
|
50
|
-
static getInstance() {
|
|
51
|
-
if (!ReadlineManager.instance) {
|
|
52
|
-
ReadlineManager.instance = new ReadlineManager();
|
|
53
|
-
}
|
|
54
|
-
return ReadlineManager.instance;
|
|
55
|
-
}
|
|
56
|
-
static getRLInstance() {
|
|
57
|
-
return this.getInstance().rl;
|
|
58
|
-
}
|
|
59
|
-
initReadlineInterface() {
|
|
60
|
-
this.rl = readline.createInterface({
|
|
61
|
-
input: process.stdin,
|
|
62
|
-
output: process.stdout,
|
|
63
|
-
historySize: 1000,
|
|
64
|
-
terminal: true,
|
|
65
|
-
completer: this.inputCompleter.bind(this),
|
|
66
|
-
});
|
|
67
|
-
// Load and populate history
|
|
68
|
-
const history = this._loadHistory();
|
|
69
|
-
this.rl.history.push(...history);
|
|
70
|
-
this.rl.on('line', (line) => this.onLine(line));
|
|
71
|
-
this.rl.on('SIGINT', async () => await this.onSigint());
|
|
72
|
-
this.rl.on('close', async () => await this.onClose());
|
|
73
|
-
process.stdin.on('keypress', (str, key) => this.onKeyPress(str, key));
|
|
74
|
-
}
|
|
75
|
-
_loadHistory() {
|
|
76
|
-
try {
|
|
77
|
-
if (fs_1.default.existsSync(PROMPT_HISTORY_PATH)) {
|
|
78
|
-
const content = fs_1.default.readFileSync(PROMPT_HISTORY_PATH, 'utf8');
|
|
79
|
-
const history = JSON.parse(content);
|
|
80
|
-
// Filter out empty lines and reverse for readline
|
|
81
|
-
return history.filter((line) => line.trim()).reverse();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.error('Error loading prompt history:', error);
|
|
86
|
-
// If file doesn't exist or is invalid JSON, create empty history file
|
|
87
|
-
fs_1.default.writeFileSync(PROMPT_HISTORY_PATH, '[]');
|
|
88
|
-
}
|
|
89
|
-
return [];
|
|
90
|
-
}
|
|
91
|
-
appendToHistory(line) {
|
|
92
|
-
try {
|
|
93
|
-
let history = [];
|
|
94
|
-
if (fs_1.default.existsSync(PROMPT_HISTORY_PATH)) {
|
|
95
|
-
const content = fs_1.default.readFileSync(PROMPT_HISTORY_PATH, 'utf8');
|
|
96
|
-
history = JSON.parse(content);
|
|
97
|
-
}
|
|
98
|
-
const trimmedLine = line.trim();
|
|
99
|
-
if (trimmedLine) {
|
|
100
|
-
// Remove all previous occurrences of the line
|
|
101
|
-
history = history.filter((h) => h !== trimmedLine);
|
|
102
|
-
// Add the new line to the end
|
|
103
|
-
history.push(trimmedLine);
|
|
104
|
-
fs_1.default.writeFileSync(PROMPT_HISTORY_PATH, JSON.stringify(history, null, 2));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
console.error('Error appending to prompt history:', error);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
inputCompleter(line) {
|
|
112
|
-
const lastWord = line.split(' ').pop() || '';
|
|
113
|
-
if (line.startsWith('/')) {
|
|
114
|
-
const slashCommands = (0, menu_1.getSlashCommands)();
|
|
115
|
-
const currentInput = line.substring(1); // Text after '/'
|
|
116
|
-
const matches = slashCommands
|
|
117
|
-
.map((cmd) => cmd.baseCommand) // Get base command strings
|
|
118
|
-
.filter((cmdName) => cmdName && cmdName.startsWith(currentInput))
|
|
119
|
-
.map((cmdName) => `/${cmdName}`); // Add back the slash for display
|
|
120
|
-
if (matches.length > 0) {
|
|
121
|
-
return [matches, line]; // Return all matches and the full line typed so far
|
|
122
|
-
}
|
|
123
|
-
return [[], line]; // No slash command matches
|
|
124
|
-
}
|
|
125
|
-
// Original file path completion logic
|
|
126
|
-
const input = lastWord.startsWith('~')
|
|
127
|
-
? os_1.default.homedir() + lastWord.slice(1)
|
|
128
|
-
: lastWord;
|
|
129
|
-
const directorySuffix = process.platform === 'win32' ? '\\' : '/';
|
|
130
|
-
const dir = input.endsWith(directorySuffix)
|
|
131
|
-
? input.slice(0, input.length - 1)
|
|
132
|
-
: path_1.default.dirname(input);
|
|
133
|
-
const partial = input.endsWith(directorySuffix) ? '' : path_1.default.basename(input);
|
|
134
|
-
let baseDir = path_1.default.isAbsolute(dir)
|
|
135
|
-
? dir
|
|
136
|
-
: path_1.default.join((0, project_files_1.getWorkingDirectory)(), dir);
|
|
137
|
-
try {
|
|
138
|
-
const files = fs_1.default.readdirSync(baseDir);
|
|
139
|
-
const fsMatches = files
|
|
140
|
-
.filter((file) => file.startsWith(partial))
|
|
141
|
-
.map((file) => file + ((0, project_files_1.isDir)(path_1.default.join(baseDir, file)) ? directorySuffix : ''));
|
|
142
|
-
return [fsMatches, partial];
|
|
143
|
-
}
|
|
144
|
-
catch {
|
|
145
|
-
return [[], line];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
resetPrompt() {
|
|
149
|
-
const projectRoot = (0, project_files_1.getProjectRoot)();
|
|
150
|
-
const cwd = (0, project_files_1.getWorkingDirectory)();
|
|
151
|
-
const projectDirName = path_1.default.parse(projectRoot).base;
|
|
152
|
-
const ps1Dir = projectDirName +
|
|
153
|
-
(cwd === projectRoot
|
|
154
|
-
? ''
|
|
155
|
-
: (os_1.default.platform() === 'win32' ? '\\' : '/') +
|
|
156
|
-
path_1.default.relative(projectRoot, cwd));
|
|
157
|
-
this.rl.setPrompt((0, picocolors_1.green)(`${ps1Dir} > `));
|
|
158
|
-
}
|
|
159
|
-
prompt() {
|
|
160
|
-
this.rl.prompt();
|
|
161
|
-
}
|
|
162
|
-
write(data) {
|
|
163
|
-
if (data !== undefined) {
|
|
164
|
-
this.rl.write(data);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
get line() {
|
|
168
|
-
return this.rl.line;
|
|
169
|
-
}
|
|
170
|
-
set line(value) {
|
|
171
|
-
;
|
|
172
|
-
this.rl.line = value;
|
|
173
|
-
}
|
|
174
|
-
refreshLine() {
|
|
175
|
-
;
|
|
176
|
-
this.rl._refreshLine();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
exports.ReadlineManager = ReadlineManager;
|
|
180
|
-
//# sourceMappingURL=readline.js.map
|
package/dist/readline.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readline.js","sourceRoot":"","sources":["../src/readline.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAmB;AACnB,4CAAmB;AACnB,gDAAuB;AACvB,2CAAkC;AAClC,mDAAoC;AACpC,+CAA0C;AAC1C,iCAAyC;AACzC,mDAA4E;AAE5E,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,wBAAU,EAAE,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,IAAI,CAAA;IAC9B,CAAC;IAED,IAAW,IAAI,CAAC,KAAa;QAC3B,CAAC;QAAC,IAAI,CAAC,EAAU,CAAC,IAAI,GAAG,KAAK,CAAA;IAChC,CAAC;IAEM,WAAW;QAChB,CAAC;QAAC,IAAI,CAAC,EAAU,CAAC,YAAY,EAAE,CAAA;IAClC,CAAC;;AAlKH,0CAmKC"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// Bun Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`getBackgroundProcessInfoString formats a running process correctly 1`] = `
|
|
4
|
-
"<background_process>
|
|
5
|
-
<process_id>123</process_id>
|
|
6
|
-
<command>npm test</command>
|
|
7
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
8
|
-
<duration_ms>2000</duration_ms>
|
|
9
|
-
<stdout>test output</stdout>
|
|
10
|
-
<stderr>test error</stderr>
|
|
11
|
-
<status>running</status>
|
|
12
|
-
</background_process>"
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
exports[`getBackgroundProcessInfoString formats a completed process correctly 1`] = `
|
|
16
|
-
"<background_process>
|
|
17
|
-
<process_id>456</process_id>
|
|
18
|
-
<command>npm build</command>
|
|
19
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
20
|
-
<duration_ms>1000</duration_ms>
|
|
21
|
-
<stdout>build successful</stdout>
|
|
22
|
-
<status>completed</status>
|
|
23
|
-
<exit_code>0</exit_code>
|
|
24
|
-
</background_process>"
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`getBackgroundProcessInfoString formats an errored process correctly 1`] = `
|
|
28
|
-
"<background_process>
|
|
29
|
-
<process_id>789</process_id>
|
|
30
|
-
<command>invalid-command</command>
|
|
31
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
32
|
-
<duration_ms>1500</duration_ms>
|
|
33
|
-
<stderr>command not found</stderr>
|
|
34
|
-
<status>error</status>
|
|
35
|
-
<exit_code>1</exit_code>
|
|
36
|
-
<signal_code>SIGTERM</signal_code>
|
|
37
|
-
</background_process>"
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
exports[`getBackgroundProcessInfoString handles new output since last report 1`] = `
|
|
41
|
-
"<background_process>
|
|
42
|
-
<process_id>102</process_id>
|
|
43
|
-
<command>echo test</command>
|
|
44
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
45
|
-
<duration_ms>1000</duration_ms>
|
|
46
|
-
<stdout>[PREVIOUS OUTPUT]
|
|
47
|
-
more output</stdout>
|
|
48
|
-
<status>completed</status>
|
|
49
|
-
</background_process>"
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
exports[`getBackgroundProcessInfoString handles no new content 1`] = `
|
|
53
|
-
"<background_process>
|
|
54
|
-
<process_id>103</process_id>
|
|
55
|
-
<command>echo test</command>
|
|
56
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
57
|
-
<duration_ms>1000</duration_ms>
|
|
58
|
-
<status>running</status>
|
|
59
|
-
</background_process>"
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
exports[`getBackgroundProcessInfoString handles new stderr without when no previous stderr 1`] = `
|
|
63
|
-
"<background_process>
|
|
64
|
-
<process_id>104</process_id>
|
|
65
|
-
<command>echo test</command>
|
|
66
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
67
|
-
<duration_ms>1000</duration_ms>
|
|
68
|
-
<stderr>new error</stderr>
|
|
69
|
-
<status>error</status>
|
|
70
|
-
</background_process>"
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
exports[`getBackgroundProcessInfoString handles new stdout without when no previous stdout 1`] = `
|
|
74
|
-
"<background_process>
|
|
75
|
-
<process_id>105</process_id>
|
|
76
|
-
<command>echo test</command>
|
|
77
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
78
|
-
<duration_ms>2000</duration_ms>
|
|
79
|
-
<stdout>first output</stdout>
|
|
80
|
-
<status>running</status>
|
|
81
|
-
</background_process>"
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
|
-
exports[`getBackgroundProcessInfoString reports completed process with new stderr even if stdout unchanged 1`] = `
|
|
85
|
-
"<background_process>
|
|
86
|
-
<process_id>106</process_id>
|
|
87
|
-
<command>echo test</command>
|
|
88
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
89
|
-
<duration_ms>1000</duration_ms>
|
|
90
|
-
<stderr>new error</stderr>
|
|
91
|
-
<status>completed</status>
|
|
92
|
-
</background_process>"
|
|
93
|
-
`;
|
|
94
|
-
|
|
95
|
-
exports[`getBackgroundProcessInfoString reports completed process with new stdout even if stderr unchanged 1`] = `
|
|
96
|
-
"<background_process>
|
|
97
|
-
<process_id>107</process_id>
|
|
98
|
-
<command>echo test</command>
|
|
99
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
100
|
-
<duration_ms>1000</duration_ms>
|
|
101
|
-
<stdout>[PREVIOUS OUTPUT]
|
|
102
|
-
more</stdout>
|
|
103
|
-
<status>completed</status>
|
|
104
|
-
</background_process>"
|
|
105
|
-
`;
|
|
106
|
-
|
|
107
|
-
exports[`getBackgroundProcessInfoString reports process when status changes even without output changes 1`] = `
|
|
108
|
-
"<background_process>
|
|
109
|
-
<process_id>108</process_id>
|
|
110
|
-
<command>echo test</command>
|
|
111
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
112
|
-
<duration_ms>1000</duration_ms>
|
|
113
|
-
<status>completed</status>
|
|
114
|
-
</background_process>"
|
|
115
|
-
`;
|
|
116
|
-
|
|
117
|
-
exports[`getBackgroundProcessInfoString calculates duration from endTime when available 1`] = `
|
|
118
|
-
"<background_process>
|
|
119
|
-
<process_id>109</process_id>
|
|
120
|
-
<command>echo test</command>
|
|
121
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
122
|
-
<duration_ms>1500</duration_ms>
|
|
123
|
-
<stdout>test</stdout>
|
|
124
|
-
<status>completed</status>
|
|
125
|
-
</background_process>"
|
|
126
|
-
`;
|
|
127
|
-
|
|
128
|
-
exports[`getBackgroundProcessInfoString calculates duration from current time when no endTime 1`] = `
|
|
129
|
-
"<background_process>
|
|
130
|
-
<process_id>110</process_id>
|
|
131
|
-
<command>echo test</command>
|
|
132
|
-
<start_time_utc>1970-01-01T00:00:01.000Z</start_time_utc>
|
|
133
|
-
<duration_ms>2000</duration_ms>
|
|
134
|
-
<stdout>test</stdout>
|
|
135
|
-
<status>running</status>
|
|
136
|
-
</background_process>"
|
|
137
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
const file_paths_1 = require("../file-paths");
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
describe('toAbsolutePath', () => {
|
|
9
|
-
const projectRoot = '/home/user/project';
|
|
10
|
-
it('should handle relative paths', () => {
|
|
11
|
-
expect((0, file_paths_1.toAbsolutePath)('src/file.ts', projectRoot))
|
|
12
|
-
.toBe(path_1.default.normalize(path_1.default.join(projectRoot, 'src/file.ts')));
|
|
13
|
-
});
|
|
14
|
-
it('should handle parent directory references', () => {
|
|
15
|
-
expect((0, file_paths_1.toAbsolutePath)('../file.ts', projectRoot))
|
|
16
|
-
.toBe(path_1.default.normalize(path_1.default.join(path_1.default.dirname(projectRoot), 'file.ts')));
|
|
17
|
-
});
|
|
18
|
-
it('should handle current directory references', () => {
|
|
19
|
-
expect((0, file_paths_1.toAbsolutePath)('./file.ts', projectRoot))
|
|
20
|
-
.toBe(path_1.default.normalize(path_1.default.join(projectRoot, 'file.ts')));
|
|
21
|
-
});
|
|
22
|
-
it('should return absolute paths unchanged', () => {
|
|
23
|
-
const absolutePath = '/absolute/path/file.ts';
|
|
24
|
-
expect((0, file_paths_1.toAbsolutePath)(absolutePath, projectRoot))
|
|
25
|
-
.toBe(path_1.default.normalize(absolutePath));
|
|
26
|
-
});
|
|
27
|
-
it('should handle Windows-style paths', () => {
|
|
28
|
-
const winPath = 'src\\file.ts';
|
|
29
|
-
expect((0, file_paths_1.toAbsolutePath)(winPath, projectRoot))
|
|
30
|
-
.toBe(path_1.default.normalize(path_1.default.join(projectRoot, 'src/file.ts')));
|
|
31
|
-
});
|
|
32
|
-
it('should normalize paths with multiple slashes', () => {
|
|
33
|
-
expect((0, file_paths_1.toAbsolutePath)('src//file.ts', projectRoot))
|
|
34
|
-
.toBe(path_1.default.normalize(path_1.default.join(projectRoot, 'src/file.ts')));
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=file-paths.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-paths.test.js","sourceRoot":"","sources":["../../../src/utils/__tests__/file-paths.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAA8C;AAC9C,gDAAuB;AAEvB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,WAAW,GAAG,oBAAoB,CAAA;IAExC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,IAAA,2BAAc,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;aAC/C,IAAI,CAAC,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,IAAA,2BAAc,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;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|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
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
|
-
const path_1 = require("../path");
|
|
7
|
-
const path_2 = __importDefault(require("path"));
|
|
8
|
-
describe('toAbsolutePath', () => {
|
|
9
|
-
const projectRoot = '/home/user/project';
|
|
10
|
-
it('should handle relative paths', () => {
|
|
11
|
-
expect((0, path_1.toAbsolutePath)('src/file.ts', projectRoot))
|
|
12
|
-
.toBe(path_2.default.normalize(path_2.default.join(projectRoot, 'src/file.ts')));
|
|
13
|
-
});
|
|
14
|
-
it('should handle parent directory references', () => {
|
|
15
|
-
expect((0, path_1.toAbsolutePath)('../file.ts', projectRoot))
|
|
16
|
-
.toBe(path_2.default.normalize(path_2.default.join(path_2.default.dirname(projectRoot), 'file.ts')));
|
|
17
|
-
});
|
|
18
|
-
it('should handle current directory references', () => {
|
|
19
|
-
expect((0, path_1.toAbsolutePath)('./file.ts', projectRoot))
|
|
20
|
-
.toBe(path_2.default.normalize(path_2.default.join(projectRoot, 'file.ts')));
|
|
21
|
-
});
|
|
22
|
-
it('should return absolute paths unchanged', () => {
|
|
23
|
-
const absolutePath = '/absolute/path/file.ts';
|
|
24
|
-
expect((0, path_1.toAbsolutePath)(absolutePath, projectRoot))
|
|
25
|
-
.toBe(path_2.default.normalize(absolutePath));
|
|
26
|
-
});
|
|
27
|
-
it('should handle Windows-style paths', () => {
|
|
28
|
-
const winPath = 'src\\file.ts';
|
|
29
|
-
expect((0, path_1.toAbsolutePath)(winPath, projectRoot))
|
|
30
|
-
.toBe(path_2.default.normalize(path_2.default.join(projectRoot, 'src/file.ts')));
|
|
31
|
-
});
|
|
32
|
-
it('should normalize paths with multiple slashes', () => {
|
|
33
|
-
expect((0, path_1.toAbsolutePath)('src//file.ts', projectRoot))
|
|
34
|
-
.toBe(path_2.default.normalize(path_2.default.join(projectRoot, 'src/file.ts')));
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=path.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.test.js","sourceRoot":"","sources":["../../../src/utils/__tests__/path.test.ts"],"names":[],"mappings":";;;;;AAAA,kCAAwC;AACxC,gDAAuB;AAEvB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,WAAW,GAAG,oBAAoB,CAAA;IAExC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,IAAA,qBAAc,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;aAC/C,IAAI,CAAC,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,IAAA,qBAAc,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;aAC9C,IAAI,CAAC,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,IAAA,qBAAc,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;aAC7C,IAAI,CAAC,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,YAAY,GAAG,wBAAwB,CAAA;QAC7C,MAAM,CAAC,IAAA,qBAAc,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;aAC9C,IAAI,CAAC,cAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,OAAO,GAAG,cAAc,CAAA;QAC9B,MAAM,CAAC,IAAA,qBAAc,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;aACzC,IAAI,CAAC,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,IAAA,qBAAc,EAAC,cAAc,EAAE,WAAW,CAAC,CAAC;aAChD,IAAI,CAAC,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transforms a relative filepath into an absolute one, using the project root as the base.
|
|
3
|
-
* Handles '..' and '.' in paths correctly. Also handles Windows paths.
|
|
4
|
-
*
|
|
5
|
-
* @param filepath The relative filepath to transform
|
|
6
|
-
* @param projectRoot The absolute path to the project root
|
|
7
|
-
* @returns The absolute filepath
|
|
8
|
-
*/
|
|
9
|
-
export declare function toAbsolutePath(filepath: string, projectRoot: string): string;
|
package/dist/utils/file-paths.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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.toAbsolutePath = toAbsolutePath;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
/**
|
|
9
|
-
* Transforms a relative filepath into an absolute one, using the project root as the base.
|
|
10
|
-
* Handles '..' and '.' in paths correctly. Also handles Windows paths.
|
|
11
|
-
*
|
|
12
|
-
* @param filepath The relative filepath to transform
|
|
13
|
-
* @param projectRoot The absolute path to the project root
|
|
14
|
-
* @returns The absolute filepath
|
|
15
|
-
*/
|
|
16
|
-
function toAbsolutePath(filepath, projectRoot) {
|
|
17
|
-
// If already absolute, normalize and return
|
|
18
|
-
if (path_1.default.isAbsolute(filepath)) {
|
|
19
|
-
return path_1.default.normalize(filepath);
|
|
20
|
-
}
|
|
21
|
-
// Handle '..' at the start by resolving against project root
|
|
22
|
-
return path_1.default.normalize(path_1.default.resolve(projectRoot, filepath));
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=file-paths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-paths.js","sourceRoot":"","sources":["../../src/utils/file-paths.ts"],"names":[],"mappings":";;;;;AAUA,wCAQC;AAlBD,gDAAuB;AAEvB;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,QAAgB,EAAE,WAAmB;IAClE,4CAA4C;IAC5C,IAAI,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,OAAO,cAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;IAED,6DAA6D;IAC7D,OAAO,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC5D,CAAC"}
|