@litmers/cursorflow-orchestrator 0.1.3 → 0.1.5
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/CHANGELOG.md +7 -6
- package/dist/cli/clean.d.ts +5 -0
- package/dist/cli/clean.js +57 -0
- package/dist/cli/clean.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.js +120 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +7 -0
- package/dist/cli/init.js +302 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/monitor.d.ts +8 -0
- package/dist/cli/monitor.js +210 -0
- package/dist/cli/monitor.js.map +1 -0
- package/dist/cli/resume.d.ts +5 -0
- package/dist/cli/resume.js +58 -0
- package/dist/cli/resume.js.map +1 -0
- package/dist/cli/run.d.ts +5 -0
- package/dist/cli/run.js +74 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/setup-commands.d.ts +19 -0
- package/dist/cli/setup-commands.js +218 -0
- package/dist/cli/setup-commands.js.map +1 -0
- package/dist/core/orchestrator.d.ts +47 -0
- package/dist/core/orchestrator.js +192 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/reviewer.d.ts +60 -0
- package/dist/core/reviewer.js +239 -0
- package/dist/core/reviewer.js.map +1 -0
- package/dist/core/runner.d.ts +49 -0
- package/dist/core/runner.js +475 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/utils/config.d.ts +31 -0
- package/dist/utils/config.js +198 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/cursor-agent.d.ts +61 -0
- package/dist/utils/cursor-agent.js +263 -0
- package/dist/utils/cursor-agent.js.map +1 -0
- package/dist/utils/git.d.ts +131 -0
- package/dist/utils/git.js +272 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +68 -0
- package/dist/utils/logger.js +158 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/state.d.ts +65 -0
- package/dist/utils/state.js +216 -0
- package/dist/utils/state.js.map +1 -0
- package/dist/utils/types.d.ts +117 -0
- package/dist/utils/types.js +6 -0
- package/dist/utils/types.js.map +1 -0
- package/examples/README.md +155 -0
- package/examples/demo-project/README.md +262 -0
- package/examples/demo-project/_cursorflow/tasks/demo-test/01-create-utils.json +18 -0
- package/examples/demo-project/_cursorflow/tasks/demo-test/02-add-tests.json +18 -0
- package/examples/demo-project/_cursorflow/tasks/demo-test/README.md +109 -0
- package/package.json +71 -61
- package/scripts/ai-security-check.js +11 -4
- package/scripts/local-security-gate.sh +76 -0
- package/src/cli/{clean.js → clean.ts} +11 -5
- package/src/cli/{index.js → index.ts} +22 -16
- package/src/cli/{init.js → init.ts} +26 -18
- package/src/cli/{monitor.js → monitor.ts} +57 -44
- package/src/cli/{resume.js → resume.ts} +11 -5
- package/src/cli/run.ts +54 -0
- package/src/cli/{setup-commands.js → setup-commands.ts} +19 -18
- package/src/core/{orchestrator.js → orchestrator.ts} +44 -26
- package/src/core/{reviewer.js → reviewer.ts} +36 -29
- package/src/core/{runner.js → runner.ts} +78 -56
- package/src/utils/{config.js → config.ts} +17 -25
- package/src/utils/{cursor-agent.js → cursor-agent.ts} +38 -47
- package/src/utils/{git.js → git.ts} +70 -56
- package/src/utils/{logger.js → logger.ts} +170 -178
- package/src/utils/{state.js → state.ts} +30 -38
- package/src/utils/types.ts +133 -0
- package/src/cli/run.js +0 -51
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Git utilities for CursorFlow
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runGit = runGit;
|
|
7
|
+
exports.runGitResult = runGitResult;
|
|
8
|
+
exports.getCurrentBranch = getCurrentBranch;
|
|
9
|
+
exports.getRepoRoot = getRepoRoot;
|
|
10
|
+
exports.isGitRepo = isGitRepo;
|
|
11
|
+
exports.worktreeExists = worktreeExists;
|
|
12
|
+
exports.createWorktree = createWorktree;
|
|
13
|
+
exports.removeWorktree = removeWorktree;
|
|
14
|
+
exports.listWorktrees = listWorktrees;
|
|
15
|
+
exports.hasUncommittedChanges = hasUncommittedChanges;
|
|
16
|
+
exports.getChangedFiles = getChangedFiles;
|
|
17
|
+
exports.commit = commit;
|
|
18
|
+
exports.push = push;
|
|
19
|
+
exports.fetch = fetch;
|
|
20
|
+
exports.branchExists = branchExists;
|
|
21
|
+
exports.deleteBranch = deleteBranch;
|
|
22
|
+
exports.merge = merge;
|
|
23
|
+
exports.getCommitInfo = getCommitInfo;
|
|
24
|
+
const child_process_1 = require("child_process");
|
|
25
|
+
/**
|
|
26
|
+
* Run git command and return output
|
|
27
|
+
*/
|
|
28
|
+
function runGit(args, options = {}) {
|
|
29
|
+
const { cwd, silent = false } = options;
|
|
30
|
+
try {
|
|
31
|
+
const result = (0, child_process_1.spawnSync)('git', args, {
|
|
32
|
+
cwd: cwd || process.cwd(),
|
|
33
|
+
encoding: 'utf8',
|
|
34
|
+
stdio: silent ? 'pipe' : 'inherit',
|
|
35
|
+
});
|
|
36
|
+
if (result.status !== 0 && !silent) {
|
|
37
|
+
throw new Error(`Git command failed: git ${args.join(' ')}\n${result.stderr || ''}`);
|
|
38
|
+
}
|
|
39
|
+
return result.stdout ? result.stdout.trim() : '';
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (silent) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Run git command and return result object
|
|
50
|
+
*/
|
|
51
|
+
function runGitResult(args, options = {}) {
|
|
52
|
+
const { cwd } = options;
|
|
53
|
+
const result = (0, child_process_1.spawnSync)('git', args, {
|
|
54
|
+
cwd: cwd || process.cwd(),
|
|
55
|
+
encoding: 'utf8',
|
|
56
|
+
stdio: 'pipe',
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
exitCode: result.status ?? 1,
|
|
60
|
+
stdout: (result.stdout || '').toString().trim(),
|
|
61
|
+
stderr: (result.stderr || '').toString().trim(),
|
|
62
|
+
success: result.status === 0,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get current branch name
|
|
67
|
+
*/
|
|
68
|
+
function getCurrentBranch(cwd) {
|
|
69
|
+
return runGit(['rev-parse', '--abbrev-ref', 'HEAD'], { cwd, silent: true });
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get repository root directory
|
|
73
|
+
*/
|
|
74
|
+
function getRepoRoot(cwd) {
|
|
75
|
+
return runGit(['rev-parse', '--show-toplevel'], { cwd, silent: true });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check if directory is a git repository
|
|
79
|
+
*/
|
|
80
|
+
function isGitRepo(cwd) {
|
|
81
|
+
const result = runGitResult(['rev-parse', '--git-dir'], { cwd });
|
|
82
|
+
return result.success;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if worktree exists
|
|
86
|
+
*/
|
|
87
|
+
function worktreeExists(worktreePath, cwd) {
|
|
88
|
+
const result = runGitResult(['worktree', 'list'], { cwd });
|
|
89
|
+
if (!result.success)
|
|
90
|
+
return false;
|
|
91
|
+
return result.stdout.includes(worktreePath);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create worktree
|
|
95
|
+
*/
|
|
96
|
+
function createWorktree(worktreePath, branchName, options = {}) {
|
|
97
|
+
const { cwd, baseBranch = 'main' } = options;
|
|
98
|
+
// Check if branch already exists
|
|
99
|
+
const branchExists = runGitResult(['rev-parse', '--verify', branchName], { cwd }).success;
|
|
100
|
+
if (branchExists) {
|
|
101
|
+
// Branch exists, checkout to worktree
|
|
102
|
+
runGit(['worktree', 'add', worktreePath, branchName], { cwd });
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// Create new branch from base
|
|
106
|
+
runGit(['worktree', 'add', '-b', branchName, worktreePath, baseBranch], { cwd });
|
|
107
|
+
}
|
|
108
|
+
return worktreePath;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Remove worktree
|
|
112
|
+
*/
|
|
113
|
+
function removeWorktree(worktreePath, options = {}) {
|
|
114
|
+
const { cwd, force = false } = options;
|
|
115
|
+
const args = ['worktree', 'remove', worktreePath];
|
|
116
|
+
if (force) {
|
|
117
|
+
args.push('--force');
|
|
118
|
+
}
|
|
119
|
+
runGit(args, { cwd });
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* List all worktrees
|
|
123
|
+
*/
|
|
124
|
+
function listWorktrees(cwd) {
|
|
125
|
+
const result = runGitResult(['worktree', 'list', '--porcelain'], { cwd });
|
|
126
|
+
if (!result.success)
|
|
127
|
+
return [];
|
|
128
|
+
const worktrees = [];
|
|
129
|
+
const lines = result.stdout.split('\n');
|
|
130
|
+
let current = {};
|
|
131
|
+
for (const line of lines) {
|
|
132
|
+
if (line.startsWith('worktree ')) {
|
|
133
|
+
if (current.path) {
|
|
134
|
+
worktrees.push(current);
|
|
135
|
+
}
|
|
136
|
+
current = { path: line.slice(9) };
|
|
137
|
+
}
|
|
138
|
+
else if (line.startsWith('branch ')) {
|
|
139
|
+
current.branch = line.slice(7);
|
|
140
|
+
}
|
|
141
|
+
else if (line.startsWith('HEAD ')) {
|
|
142
|
+
current.head = line.slice(5);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (current.path) {
|
|
146
|
+
worktrees.push(current);
|
|
147
|
+
}
|
|
148
|
+
return worktrees;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Check if there are uncommitted changes
|
|
152
|
+
*/
|
|
153
|
+
function hasUncommittedChanges(cwd) {
|
|
154
|
+
const result = runGitResult(['status', '--porcelain'], { cwd });
|
|
155
|
+
return result.success && result.stdout.length > 0;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get list of changed files
|
|
159
|
+
*/
|
|
160
|
+
function getChangedFiles(cwd) {
|
|
161
|
+
const result = runGitResult(['status', '--porcelain'], { cwd });
|
|
162
|
+
if (!result.success)
|
|
163
|
+
return [];
|
|
164
|
+
return result.stdout
|
|
165
|
+
.split('\n')
|
|
166
|
+
.filter(line => line.trim())
|
|
167
|
+
.map(line => {
|
|
168
|
+
const status = line.slice(0, 2);
|
|
169
|
+
const file = line.slice(3);
|
|
170
|
+
return { status, file };
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Create commit
|
|
175
|
+
*/
|
|
176
|
+
function commit(message, options = {}) {
|
|
177
|
+
const { cwd, addAll = true } = options;
|
|
178
|
+
if (addAll) {
|
|
179
|
+
runGit(['add', '-A'], { cwd });
|
|
180
|
+
}
|
|
181
|
+
runGit(['commit', '-m', message], { cwd });
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Push to remote
|
|
185
|
+
*/
|
|
186
|
+
function push(branchName, options = {}) {
|
|
187
|
+
const { cwd, force = false, setUpstream = false } = options;
|
|
188
|
+
const args = ['push'];
|
|
189
|
+
if (force) {
|
|
190
|
+
args.push('--force');
|
|
191
|
+
}
|
|
192
|
+
if (setUpstream) {
|
|
193
|
+
args.push('-u', 'origin', branchName);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
args.push('origin', branchName);
|
|
197
|
+
}
|
|
198
|
+
runGit(args, { cwd });
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Fetch from remote
|
|
202
|
+
*/
|
|
203
|
+
function fetch(options = {}) {
|
|
204
|
+
const { cwd, prune = true } = options;
|
|
205
|
+
const args = ['fetch', 'origin'];
|
|
206
|
+
if (prune) {
|
|
207
|
+
args.push('--prune');
|
|
208
|
+
}
|
|
209
|
+
runGit(args, { cwd });
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Check if branch exists (local or remote)
|
|
213
|
+
*/
|
|
214
|
+
function branchExists(branchName, options = {}) {
|
|
215
|
+
const { cwd, remote = false } = options;
|
|
216
|
+
if (remote) {
|
|
217
|
+
const result = runGitResult(['ls-remote', '--heads', 'origin', branchName], { cwd });
|
|
218
|
+
return result.success && result.stdout.length > 0;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const result = runGitResult(['rev-parse', '--verify', branchName], { cwd });
|
|
222
|
+
return result.success;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Delete branch
|
|
227
|
+
*/
|
|
228
|
+
function deleteBranch(branchName, options = {}) {
|
|
229
|
+
const { cwd, force = false, remote = false } = options;
|
|
230
|
+
if (remote) {
|
|
231
|
+
runGit(['push', 'origin', '--delete', branchName], { cwd });
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
const args = ['branch', force ? '-D' : '-d', branchName];
|
|
235
|
+
runGit(args, { cwd });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Merge branch
|
|
240
|
+
*/
|
|
241
|
+
function merge(branchName, options = {}) {
|
|
242
|
+
const { cwd, noFf = false, message = null } = options;
|
|
243
|
+
const args = ['merge'];
|
|
244
|
+
if (noFf) {
|
|
245
|
+
args.push('--no-ff');
|
|
246
|
+
}
|
|
247
|
+
if (message) {
|
|
248
|
+
args.push('-m', message);
|
|
249
|
+
}
|
|
250
|
+
args.push(branchName);
|
|
251
|
+
runGit(args, { cwd });
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get commit info
|
|
255
|
+
*/
|
|
256
|
+
function getCommitInfo(commitHash, options = {}) {
|
|
257
|
+
const { cwd } = options;
|
|
258
|
+
const format = '--format=%H%n%h%n%an%n%ae%n%at%n%s';
|
|
259
|
+
const result = runGitResult(['show', '-s', format, commitHash], { cwd });
|
|
260
|
+
if (!result.success)
|
|
261
|
+
return null;
|
|
262
|
+
const lines = result.stdout.split('\n');
|
|
263
|
+
return {
|
|
264
|
+
hash: lines[0] || '',
|
|
265
|
+
shortHash: lines[1] || '',
|
|
266
|
+
author: lines[2] || '',
|
|
267
|
+
authorEmail: lines[3] || '',
|
|
268
|
+
timestamp: parseInt(lines[4] || '0'),
|
|
269
|
+
subject: lines[5] || '',
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAuCH,wBAqBC;AAKD,oCAeC;AAKD,4CAEC;AAKD,kCAEC;AAKD,8BAGC;AAKD,wCAKC;AAKD,wCAeC;AAKD,wCASC;AAKD,sCA0BC;AAKD,sDAGC;AAKD,0CAYC;AAKD,wBAQC;AAKD,oBAgBC;AAKD,sBASC;AAKD,oCAUC;AAKD,oCASC;AAKD,sBAgBC;AAKD,sCAiBC;AAhUD,iDAAoD;AAkCpD;;GAEG;AACH,SAAgB,MAAM,CAAC,IAAc,EAAE,UAAyB,EAAE;IAChE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAExC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,KAAK,EAAE,IAAI,EAAE;YACpC,GAAG,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;YACzB,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SACnC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,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are const COLORS: {
|
|
11
|
+
reset: string;
|
|
12
|
+
red: string;
|
|
13
|
+
yellow: string;
|
|
14
|
+
green: string;
|
|
15
|
+
blue: string;
|
|
16
|
+
cyan: string;
|
|
17
|
+
gray: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Set log level
|
|
21
|
+
*/
|
|
22
|
+
export declare function setLogLevel(level: string | number): void;
|
|
23
|
+
/**
|
|
24
|
+
* Error log
|
|
25
|
+
*/
|
|
26
|
+
export declare function error(message: string, emoji?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Warning log
|
|
29
|
+
*/
|
|
30
|
+
export declare function warn(message: string, emoji?: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Info log
|
|
33
|
+
*/
|
|
34
|
+
export declare function info(message: string, emoji?: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Success log
|
|
37
|
+
*/
|
|
38
|
+
export declare function success(message: string, emoji?: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Debug log
|
|
41
|
+
*/
|
|
42
|
+
export declare function debug(message: string, emoji?: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Progress log
|
|
45
|
+
*/
|
|
46
|
+
export declare function progress(message: string, emoji?: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Section header
|
|
49
|
+
*/
|
|
50
|
+
export declare function section(message: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Simple log without formatting
|
|
53
|
+
*/
|
|
54
|
+
export declare function log(message: string | any): void;
|
|
55
|
+
/**
|
|
56
|
+
* Log JSON data (pretty print in debug mode)
|
|
57
|
+
*/
|
|
58
|
+
export declare function json(data: any): void;
|
|
59
|
+
export interface Spinner {
|
|
60
|
+
start(): void;
|
|
61
|
+
stop(finalMessage?: string | null): void;
|
|
62
|
+
succeed(message: string): void;
|
|
63
|
+
fail(message: string): void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create spinner (simple implementation)
|
|
67
|
+
*/
|
|
68
|
+
export declare function createSpinner(message: string): Spinner;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Logging utilities for CursorFlow
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.COLORS = exports.LogLevel = void 0;
|
|
7
|
+
exports.setLogLevel = setLogLevel;
|
|
8
|
+
exports.error = error;
|
|
9
|
+
exports.warn = warn;
|
|
10
|
+
exports.info = info;
|
|
11
|
+
exports.success = success;
|
|
12
|
+
exports.debug = debug;
|
|
13
|
+
exports.progress = progress;
|
|
14
|
+
exports.section = section;
|
|
15
|
+
exports.log = log;
|
|
16
|
+
exports.json = json;
|
|
17
|
+
exports.createSpinner = createSpinner;
|
|
18
|
+
var LogLevel;
|
|
19
|
+
(function (LogLevel) {
|
|
20
|
+
LogLevel[LogLevel["error"] = 0] = "error";
|
|
21
|
+
LogLevel[LogLevel["warn"] = 1] = "warn";
|
|
22
|
+
LogLevel[LogLevel["info"] = 2] = "info";
|
|
23
|
+
LogLevel[LogLevel["debug"] = 3] = "debug";
|
|
24
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
25
|
+
exports.COLORS = {
|
|
26
|
+
reset: '\x1b[0m',
|
|
27
|
+
red: '\x1b[31m',
|
|
28
|
+
yellow: '\x1b[33m',
|
|
29
|
+
green: '\x1b[32m',
|
|
30
|
+
blue: '\x1b[34m',
|
|
31
|
+
cyan: '\x1b[36m',
|
|
32
|
+
gray: '\x1b[90m',
|
|
33
|
+
};
|
|
34
|
+
let currentLogLevel = LogLevel.info;
|
|
35
|
+
/**
|
|
36
|
+
* Set log level
|
|
37
|
+
*/
|
|
38
|
+
function setLogLevel(level) {
|
|
39
|
+
if (typeof level === 'string') {
|
|
40
|
+
currentLogLevel = LogLevel[level] ?? LogLevel.info;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
currentLogLevel = level;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Format message with timestamp
|
|
48
|
+
*/
|
|
49
|
+
function formatMessage(level, message, emoji = '') {
|
|
50
|
+
const timestamp = new Date().toISOString();
|
|
51
|
+
const prefix = emoji ? `${emoji} ` : '';
|
|
52
|
+
return `[${timestamp}] [${level.toUpperCase()}] ${prefix}${message}`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Log with color
|
|
56
|
+
*/
|
|
57
|
+
function logWithColor(color, level, message, emoji = '') {
|
|
58
|
+
if (LogLevel[level] > currentLogLevel) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const formatted = formatMessage(level, message, emoji);
|
|
62
|
+
console.log(`${color}${formatted}${exports.COLORS.reset}`);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Error log
|
|
66
|
+
*/
|
|
67
|
+
function error(message, emoji = '❌') {
|
|
68
|
+
logWithColor(exports.COLORS.red, 'error', message, emoji);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Warning log
|
|
72
|
+
*/
|
|
73
|
+
function warn(message, emoji = '⚠️') {
|
|
74
|
+
logWithColor(exports.COLORS.yellow, 'warn', message, emoji);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Info log
|
|
78
|
+
*/
|
|
79
|
+
function info(message, emoji = 'ℹ️') {
|
|
80
|
+
logWithColor(exports.COLORS.cyan, 'info', message, emoji);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Success log
|
|
84
|
+
*/
|
|
85
|
+
function success(message, emoji = '✅') {
|
|
86
|
+
logWithColor(exports.COLORS.green, 'info', message, emoji);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Debug log
|
|
90
|
+
*/
|
|
91
|
+
function debug(message, emoji = '🔍') {
|
|
92
|
+
logWithColor(exports.COLORS.gray, 'debug', message, emoji);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Progress log
|
|
96
|
+
*/
|
|
97
|
+
function progress(message, emoji = '🔄') {
|
|
98
|
+
logWithColor(exports.COLORS.blue, 'info', message, emoji);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Section header
|
|
102
|
+
*/
|
|
103
|
+
function section(message) {
|
|
104
|
+
console.log('');
|
|
105
|
+
console.log(`${exports.COLORS.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${exports.COLORS.reset}`);
|
|
106
|
+
console.log(`${exports.COLORS.cyan} ${message}${exports.COLORS.reset}`);
|
|
107
|
+
console.log(`${exports.COLORS.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${exports.COLORS.reset}`);
|
|
108
|
+
console.log('');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Simple log without formatting
|
|
112
|
+
*/
|
|
113
|
+
function log(message) {
|
|
114
|
+
console.log(message);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Log JSON data (pretty print in debug mode)
|
|
118
|
+
*/
|
|
119
|
+
function json(data) {
|
|
120
|
+
if (currentLogLevel >= LogLevel.debug) {
|
|
121
|
+
console.log(JSON.stringify(data, null, 2));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Create spinner (simple implementation)
|
|
126
|
+
*/
|
|
127
|
+
function createSpinner(message) {
|
|
128
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
129
|
+
let i = 0;
|
|
130
|
+
let interval = null;
|
|
131
|
+
const spinner = {
|
|
132
|
+
start() {
|
|
133
|
+
process.stdout.write(`${message} ${frames[0]}`);
|
|
134
|
+
interval = setInterval(() => {
|
|
135
|
+
i = (i + 1) % frames.length;
|
|
136
|
+
process.stdout.write(`\r${message} ${frames[i]}`);
|
|
137
|
+
}, 80);
|
|
138
|
+
},
|
|
139
|
+
stop(finalMessage = null) {
|
|
140
|
+
if (interval) {
|
|
141
|
+
clearInterval(interval);
|
|
142
|
+
interval = null;
|
|
143
|
+
}
|
|
144
|
+
process.stdout.write('\r\x1b[K'); // Clear line
|
|
145
|
+
if (finalMessage) {
|
|
146
|
+
console.log(finalMessage);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
succeed(message) {
|
|
150
|
+
this.stop(`${exports.COLORS.green}✓${exports.COLORS.reset} ${message}`);
|
|
151
|
+
},
|
|
152
|
+
fail(message) {
|
|
153
|
+
this.stop(`${exports.COLORS.red}✗${exports.COLORS.reset} ${message}`);
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
return spinner;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAwBH,kCAMC;AA0BD,sBAEC;AAKD,oBAEC;AAKD,oBAEC;AAKD,0BAEC;AAKD,sBAEC;AAKD,4BAEC;AAKD,0BAMC;AAKD,kBAEC;AAKD,oBAIC;AAYD,sCAmCC;AArKD,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;AACX,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAEY,QAAA,MAAM,GAAG;IACpB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,IAAI,eAAe,GAAW,QAAQ,CAAC,IAAI,CAAC;AAE5C;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAsB;IACh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rB,IAAI,CAAC,IAAI,CAAC,GAAG,cAAM,CAAC,KAAK,IAAI,cAAM,CAAC,KAAK,IAAI,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC,OAAe;YAClB,IAAI,CAAC,IAAI,CAAC,GAAG,cAAM,CAAC,GAAG,IAAI,cAAM,CAAC,KAAK,IAAI,OAAO,EAAE,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State management utilities for CursorFlow
|
|
3
|
+
*/
|
|
4
|
+
import { LaneState, ConversationEntry, GitLogEntry, EventEntry, RunnerConfig } from './types';
|
|
5
|
+
export { LaneState, ConversationEntry, GitLogEntry, EventEntry };
|
|
6
|
+
/**
|
|
7
|
+
* Save state to JSON file
|
|
8
|
+
*/
|
|
9
|
+
export declare function saveState(statePath: string, state: any): void;
|
|
10
|
+
/**
|
|
11
|
+
* Load state from JSON file
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadState<T = any>(statePath: string): T | null;
|
|
14
|
+
/**
|
|
15
|
+
* Append to JSONL log file
|
|
16
|
+
*/
|
|
17
|
+
export declare function appendLog(logPath: string, entry: any): void;
|
|
18
|
+
/**
|
|
19
|
+
* Read JSONL log file
|
|
20
|
+
*/
|
|
21
|
+
export declare function readLog<T = any>(logPath: string): T[];
|
|
22
|
+
/**
|
|
23
|
+
* Create initial lane state
|
|
24
|
+
*/
|
|
25
|
+
export declare function createLaneState(laneName: string, config: RunnerConfig): LaneState;
|
|
26
|
+
/**
|
|
27
|
+
* Update lane state
|
|
28
|
+
*/
|
|
29
|
+
export declare function updateLaneState(state: LaneState, updates: Partial<LaneState>): LaneState;
|
|
30
|
+
/**
|
|
31
|
+
* Create conversation log entry
|
|
32
|
+
*/
|
|
33
|
+
export declare function createConversationEntry(role: ConversationEntry['role'], text: string, options?: {
|
|
34
|
+
task?: string;
|
|
35
|
+
model?: string;
|
|
36
|
+
}): ConversationEntry;
|
|
37
|
+
/**
|
|
38
|
+
* Create git operation log entry
|
|
39
|
+
*/
|
|
40
|
+
export declare function createGitLogEntry(operation: string, details?: any): GitLogEntry;
|
|
41
|
+
/**
|
|
42
|
+
* Create event log entry
|
|
43
|
+
*/
|
|
44
|
+
export declare function createEventEntry(event: string, data?: any): EventEntry;
|
|
45
|
+
/**
|
|
46
|
+
* Get latest run directory
|
|
47
|
+
*/
|
|
48
|
+
export declare function getLatestRunDir(logsDir: string): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* List all lanes in a run directory
|
|
51
|
+
*/
|
|
52
|
+
export declare function listLanesInRun(runDir: string): {
|
|
53
|
+
name: string;
|
|
54
|
+
dir: string;
|
|
55
|
+
statePath: string;
|
|
56
|
+
}[];
|
|
57
|
+
/**
|
|
58
|
+
* Get lane state summary
|
|
59
|
+
*/
|
|
60
|
+
export declare function getLaneStateSummary(statePath: string): {
|
|
61
|
+
status: string;
|
|
62
|
+
progress: string;
|
|
63
|
+
label?: string;
|
|
64
|
+
error?: string | null;
|
|
65
|
+
};
|