ralph-wiggum-ui 0.1.0
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/commands/add.d.ts +10 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +87 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +91 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +9 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +90 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/run.d.ts +10 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +200 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +10 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +57 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/status.d.ts +5 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +63 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +76 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/lib/config.d.ts +53 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +164 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/index.d.ts +11 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +18 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/logger.d.ts +72 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +159 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/preflight.d.ts +45 -0
- package/dist/lib/preflight.d.ts.map +1 -0
- package/dist/lib/preflight.js +173 -0
- package/dist/lib/preflight.js.map +1 -0
- package/dist/lib/progress.d.ts +41 -0
- package/dist/lib/progress.d.ts.map +1 -0
- package/dist/lib/progress.js +122 -0
- package/dist/lib/progress.js.map +1 -0
- package/dist/lib/tasks.d.ts +77 -0
- package/dist/lib/tasks.d.ts.map +1 -0
- package/dist/lib/tasks.js +259 -0
- package/dist/lib/tasks.js.map +1 -0
- package/dist/lib/templates.d.ts +25 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/templates.js +86 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/server/api.d.ts +7 -0
- package/dist/server/api.d.ts.map +1 -0
- package/dist/server/api.js +258 -0
- package/dist/server/api.js.map +1 -0
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +59 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/runner.d.ts +15 -0
- package/dist/server/runner.d.ts.map +1 -0
- package/dist/server/runner.js +265 -0
- package/dist/server/runner.js.map +1 -0
- package/dist/types/index.d.ts +129 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +37 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/assets/index-DBOjIoHW.js +137 -0
- package/dist/ui/assets/index-mu6cQFl4.css +1 -0
- package/dist/ui/favicon.svg +3 -0
- package/dist/ui/index.html +14 -0
- package/package.json +78 -0
- package/templates/AGENTS.md +48 -0
- package/templates/prompt.md +64 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* status command - Show current status and next task
|
|
3
|
+
*/
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { runOperationalPreflightChecks, getStatusSummary, loadConfig, getCurrentBranch, } from '../../lib/index.js';
|
|
6
|
+
export async function statusCommand() {
|
|
7
|
+
const cwd = process.cwd();
|
|
8
|
+
// Run pre-flight checks
|
|
9
|
+
const preflight = await runOperationalPreflightChecks(cwd);
|
|
10
|
+
if (!preflight.allPassed) {
|
|
11
|
+
for (const check of preflight.checks) {
|
|
12
|
+
if (!check.passed) {
|
|
13
|
+
console.log(chalk.red(`\n✗ ${check.message}\n`));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
const config = loadConfig(cwd);
|
|
19
|
+
const status = getStatusSummary(cwd);
|
|
20
|
+
const branch = getCurrentBranch(cwd) || 'unknown';
|
|
21
|
+
console.log(chalk.bold('\n🎭 Ralph Wiggum UI - Status\n'));
|
|
22
|
+
console.log(chalk.dim('─'.repeat(50)));
|
|
23
|
+
// Project info
|
|
24
|
+
console.log(` ${chalk.dim('Project:')} ${chalk.white(config.project)}`);
|
|
25
|
+
console.log(` ${chalk.dim('Branch:')} ${chalk.cyan(branch)}`);
|
|
26
|
+
console.log('');
|
|
27
|
+
// Task counts
|
|
28
|
+
const progressPercent = status.totalTasks > 0
|
|
29
|
+
? Math.round((status.completedTasks / status.totalTasks) * 100)
|
|
30
|
+
: 0;
|
|
31
|
+
console.log(` ${chalk.dim('Progress:')} ${chalk.white(`${status.completedTasks}/${status.totalTasks}`)} tasks (${progressPercent}%)`);
|
|
32
|
+
// Progress bar
|
|
33
|
+
const barWidth = 30;
|
|
34
|
+
const filledWidth = Math.round((progressPercent / 100) * barWidth);
|
|
35
|
+
const emptyWidth = barWidth - filledWidth;
|
|
36
|
+
const progressBar = chalk.green('█'.repeat(filledWidth)) + chalk.dim('░'.repeat(emptyWidth));
|
|
37
|
+
console.log(` ${progressBar}`);
|
|
38
|
+
console.log('');
|
|
39
|
+
// Task breakdown
|
|
40
|
+
console.log(` ${chalk.green('✓')} Completed: ${status.completedTasks}`);
|
|
41
|
+
console.log(` ${chalk.yellow('→')} In Progress: ${status.inProgressTasks}`);
|
|
42
|
+
console.log(` ${chalk.dim('○')} Pending: ${status.pendingTasks}`);
|
|
43
|
+
console.log(chalk.dim('\n─'.repeat(50)));
|
|
44
|
+
// Next task
|
|
45
|
+
if (status.nextTask) {
|
|
46
|
+
console.log(chalk.bold('\n Next Task:\n'));
|
|
47
|
+
console.log(` ${chalk.cyan(status.nextTask.id)}: ${status.nextTask.title}`);
|
|
48
|
+
if (status.nextTask.description) {
|
|
49
|
+
console.log(chalk.dim(` ${status.nextTask.description}`));
|
|
50
|
+
}
|
|
51
|
+
console.log('');
|
|
52
|
+
console.log(chalk.dim(` Run: ${chalk.white('npx ralph-wiggum-ui run')}`));
|
|
53
|
+
}
|
|
54
|
+
else if (status.completedTasks === status.totalTasks && status.totalTasks > 0) {
|
|
55
|
+
console.log(chalk.green('\n 🎉 All tasks completed!\n'));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.log(chalk.yellow('\n No pending tasks. Add some with:'));
|
|
59
|
+
console.log(chalk.cyan(' npx ralph-wiggum-ui add "Your task"\n'));
|
|
60
|
+
}
|
|
61
|
+
console.log('');
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,UAAU,EACV,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,wBAAwB;IACxB,MAAM,SAAS,GAAG,MAAM,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAE3D,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACrC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBAClB,OAAO,CAAC,GAAG,CAAC,KA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AAM,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/E,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC;SAAM,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;QAChF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAC5D,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;GAEG"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Ralph Wiggum UI - CLI Entry Point
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import { join, dirname } from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { initCommand } from './commands/init.js';
|
|
10
|
+
import { statusCommand } from './commands/status.js';
|
|
11
|
+
import { listCommand } from './commands/list.js';
|
|
12
|
+
import { addCommand } from './commands/add.js';
|
|
13
|
+
import { runCommand } from './commands/run.js';
|
|
14
|
+
import { serveCommand } from './commands/serve.js';
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = dirname(__filename);
|
|
17
|
+
// Load package.json for version
|
|
18
|
+
function getVersion() {
|
|
19
|
+
try {
|
|
20
|
+
const packageJsonPath = join(__dirname, '..', '..', 'package.json');
|
|
21
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
22
|
+
return packageJson.version || '0.0.0';
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return '0.0.0';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const program = new Command();
|
|
29
|
+
program
|
|
30
|
+
.name('ralph-wiggum-ui')
|
|
31
|
+
.description('A visual Kanban UI for autonomous AI coding with Claude Code')
|
|
32
|
+
.version(getVersion());
|
|
33
|
+
// Initialize in current directory
|
|
34
|
+
program
|
|
35
|
+
.command('init')
|
|
36
|
+
.description('Initialize Ralph Wiggum UI in the current directory')
|
|
37
|
+
.action(initCommand);
|
|
38
|
+
// Show status
|
|
39
|
+
program
|
|
40
|
+
.command('status')
|
|
41
|
+
.description('Show current status and next task')
|
|
42
|
+
.action(statusCommand);
|
|
43
|
+
// List tasks
|
|
44
|
+
program
|
|
45
|
+
.command('list')
|
|
46
|
+
.description('List all tasks')
|
|
47
|
+
.option('-s, --status <status>', 'Filter by status (pending, in_progress, completed, failed)')
|
|
48
|
+
.action(listCommand);
|
|
49
|
+
// Add a task
|
|
50
|
+
program
|
|
51
|
+
.command('add [title]')
|
|
52
|
+
.description('Add a new task')
|
|
53
|
+
.option('-d, --description <description>', 'Task description')
|
|
54
|
+
.option('-c, --criteria <criteria...>', 'Acceptance criteria')
|
|
55
|
+
.action(addCommand);
|
|
56
|
+
// Run tasks
|
|
57
|
+
program
|
|
58
|
+
.command('run [count]')
|
|
59
|
+
.description('Run tasks (default: next task, or specify count for AFK mode)')
|
|
60
|
+
.option('--all', 'Run all remaining tasks')
|
|
61
|
+
.option('--no-stop-on-failure', 'Continue running even if a task fails')
|
|
62
|
+
.action(runCommand);
|
|
63
|
+
// Start web UI server
|
|
64
|
+
program
|
|
65
|
+
.command('serve')
|
|
66
|
+
.description('Start the web UI server')
|
|
67
|
+
.option('-p, --port <port>', 'Port to run on', '3210')
|
|
68
|
+
.option('--no-open', 'Do not open browser automatically')
|
|
69
|
+
.action(serveCommand);
|
|
70
|
+
// Default command (no subcommand) - start the web UI
|
|
71
|
+
program
|
|
72
|
+
.action(() => {
|
|
73
|
+
serveCommand({ port: '3210', open: true });
|
|
74
|
+
});
|
|
75
|
+
program.parse();
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,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AU,CAAC,CAAC;AAEtB,YAAY;AACZ,OAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,+DAA+D,CAAC;KAC5E,MAAM,CAAC,OAAO,EAAE,yBAAyB,CAAC;KAC1C,MAAM,CAAC,sBAAsB,EAAE,uCAAuC,CAAC;KACvE,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtB,sBAAsB;AACtB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,CAAC;KACrD,MAAM,CAAC,WAAW,EAAE,mCAAmC,CAAC;KACxD,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,qDAAqD;AACrD,OAAO;KACJ,MAAM,CAAC,GAAG,EAAE;IACX,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration management for Ralph Wiggum UI
|
|
3
|
+
*/
|
|
4
|
+
import type { Config } from '../types/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Get the path to the Ralph directory
|
|
7
|
+
*/
|
|
8
|
+
export declare function getRalphDir(cwd: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Get the path to a file within the Ralph directory
|
|
11
|
+
*/
|
|
12
|
+
export declare function getRalphFilePath(cwd: string, filename: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Check if Ralph is initialized in the given directory
|
|
15
|
+
*/
|
|
16
|
+
export declare function isRalphInitialized(cwd: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Create the Ralph directory structure
|
|
19
|
+
*/
|
|
20
|
+
export declare function createRalphDirectories(cwd: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Load the configuration file
|
|
23
|
+
*/
|
|
24
|
+
export declare function loadConfig(cwd: string): Config;
|
|
25
|
+
/**
|
|
26
|
+
* Save the configuration file
|
|
27
|
+
*/
|
|
28
|
+
export declare function saveConfig(cwd: string, config: Config): void;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new configuration with user inputs
|
|
31
|
+
*/
|
|
32
|
+
export declare function createConfig(options: {
|
|
33
|
+
project: string;
|
|
34
|
+
sourceDir: string;
|
|
35
|
+
testCommand?: string;
|
|
36
|
+
buildCommand?: string;
|
|
37
|
+
typecheckCommand?: string;
|
|
38
|
+
}): Config;
|
|
39
|
+
interface DetectedConfig {
|
|
40
|
+
project: string;
|
|
41
|
+
hasTest: boolean;
|
|
42
|
+
hasBuild: boolean;
|
|
43
|
+
hasTypecheck: boolean;
|
|
44
|
+
testCommand?: string;
|
|
45
|
+
buildCommand?: string;
|
|
46
|
+
typecheckCommand?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Detect project configuration from package.json
|
|
50
|
+
*/
|
|
51
|
+
export declare function detectProjectConfig(cwd: string): DetectedConfig;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,mBAAmB,CAAC;AAUhE;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAUxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiB9C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAI5D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAuBT;AA6BD,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAoD/D"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration management for Ralph Wiggum UI
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { RALPH_DIR, CONFIG_FILE, DEFAULT_CONFIG, LOGS_DIR, STATE_DIR, ARCHIVE_DIR, } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Get the path to the Ralph directory
|
|
9
|
+
*/
|
|
10
|
+
export function getRalphDir(cwd) {
|
|
11
|
+
return join(cwd, RALPH_DIR);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get the path to a file within the Ralph directory
|
|
15
|
+
*/
|
|
16
|
+
export function getRalphFilePath(cwd, filename) {
|
|
17
|
+
return join(getRalphDir(cwd), filename);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Check if Ralph is initialized in the given directory
|
|
21
|
+
*/
|
|
22
|
+
export function isRalphInitialized(cwd) {
|
|
23
|
+
const configPath = getRalphFilePath(cwd, CONFIG_FILE);
|
|
24
|
+
return existsSync(configPath);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create the Ralph directory structure
|
|
28
|
+
*/
|
|
29
|
+
export function createRalphDirectories(cwd) {
|
|
30
|
+
const ralphDir = getRalphDir(cwd);
|
|
31
|
+
const logsDir = join(ralphDir, LOGS_DIR);
|
|
32
|
+
const stateDir = join(ralphDir, STATE_DIR);
|
|
33
|
+
const archiveDir = join(ralphDir, ARCHIVE_DIR);
|
|
34
|
+
mkdirSync(ralphDir, { recursive: true });
|
|
35
|
+
mkdirSync(logsDir, { recursive: true });
|
|
36
|
+
mkdirSync(stateDir, { recursive: true });
|
|
37
|
+
mkdirSync(archiveDir, { recursive: true });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Load the configuration file
|
|
41
|
+
*/
|
|
42
|
+
export function loadConfig(cwd) {
|
|
43
|
+
const configPath = getRalphFilePath(cwd, CONFIG_FILE);
|
|
44
|
+
if (!existsSync(configPath)) {
|
|
45
|
+
throw new Error(`Config file not found: ${configPath}`);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
49
|
+
const config = JSON.parse(content);
|
|
50
|
+
return mergeWithDefaults(config);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error instanceof SyntaxError) {
|
|
54
|
+
throw new Error(`Invalid JSON in config file: ${configPath}`);
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Save the configuration file
|
|
61
|
+
*/
|
|
62
|
+
export function saveConfig(cwd, config) {
|
|
63
|
+
const configPath = getRalphFilePath(cwd, CONFIG_FILE);
|
|
64
|
+
const content = JSON.stringify(config, null, 2);
|
|
65
|
+
writeFileSync(configPath, content, 'utf-8');
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a new configuration with user inputs
|
|
69
|
+
*/
|
|
70
|
+
export function createConfig(options) {
|
|
71
|
+
const commands = {};
|
|
72
|
+
const testCmd = options.testCommand ?? DEFAULT_CONFIG.commands.test;
|
|
73
|
+
const buildCmd = options.buildCommand ?? DEFAULT_CONFIG.commands.build;
|
|
74
|
+
const typecheckCmd = options.typecheckCommand ?? DEFAULT_CONFIG.commands.typecheck;
|
|
75
|
+
if (testCmd) {
|
|
76
|
+
commands.test = testCmd;
|
|
77
|
+
}
|
|
78
|
+
if (buildCmd) {
|
|
79
|
+
commands.build = buildCmd;
|
|
80
|
+
}
|
|
81
|
+
if (typecheckCmd) {
|
|
82
|
+
commands.typecheck = typecheckCmd;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
...DEFAULT_CONFIG,
|
|
86
|
+
project: options.project,
|
|
87
|
+
sourceDir: options.sourceDir,
|
|
88
|
+
commands,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Merge user config with defaults to ensure all fields are present
|
|
93
|
+
*/
|
|
94
|
+
function mergeWithDefaults(config) {
|
|
95
|
+
return {
|
|
96
|
+
version: config.version ?? DEFAULT_CONFIG.version,
|
|
97
|
+
project: config.project ?? DEFAULT_CONFIG.project,
|
|
98
|
+
sourceDir: config.sourceDir ?? DEFAULT_CONFIG.sourceDir,
|
|
99
|
+
commands: {
|
|
100
|
+
...DEFAULT_CONFIG.commands,
|
|
101
|
+
...config.commands,
|
|
102
|
+
},
|
|
103
|
+
claude: {
|
|
104
|
+
...DEFAULT_CONFIG.claude,
|
|
105
|
+
...config.claude,
|
|
106
|
+
},
|
|
107
|
+
afk: {
|
|
108
|
+
...DEFAULT_CONFIG.afk,
|
|
109
|
+
...config.afk,
|
|
110
|
+
},
|
|
111
|
+
logs: {
|
|
112
|
+
...DEFAULT_CONFIG.logs,
|
|
113
|
+
...config.logs,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Detect project configuration from package.json
|
|
119
|
+
*/
|
|
120
|
+
export function detectProjectConfig(cwd) {
|
|
121
|
+
const packageJsonPath = join(cwd, 'package.json');
|
|
122
|
+
const result = {
|
|
123
|
+
project: 'my-project',
|
|
124
|
+
hasTest: false,
|
|
125
|
+
hasBuild: false,
|
|
126
|
+
hasTypecheck: false,
|
|
127
|
+
};
|
|
128
|
+
if (!existsSync(packageJsonPath)) {
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const content = readFileSync(packageJsonPath, 'utf-8');
|
|
133
|
+
const packageJson = JSON.parse(content);
|
|
134
|
+
if (packageJson.name) {
|
|
135
|
+
result.project = packageJson.name;
|
|
136
|
+
}
|
|
137
|
+
const scripts = packageJson.scripts || {};
|
|
138
|
+
if (scripts['test']) {
|
|
139
|
+
result.hasTest = true;
|
|
140
|
+
result.testCommand = 'npm test';
|
|
141
|
+
}
|
|
142
|
+
if (scripts['build']) {
|
|
143
|
+
result.hasBuild = true;
|
|
144
|
+
result.buildCommand = 'npm run build';
|
|
145
|
+
}
|
|
146
|
+
if (scripts['typecheck']) {
|
|
147
|
+
result.hasTypecheck = true;
|
|
148
|
+
result.typecheckCommand = 'npm run typecheck';
|
|
149
|
+
}
|
|
150
|
+
else if (scripts['type-check']) {
|
|
151
|
+
result.hasTypecheck = true;
|
|
152
|
+
result.typecheckCommand = 'npm run type-check';
|
|
153
|
+
}
|
|
154
|
+
else if (scripts['tsc']) {
|
|
155
|
+
result.hasTypecheck = true;
|
|
156
|
+
result.typecheckCommand = 'npm run tsc';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// Ignore parse errors
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,QAAgB;IAC5D,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IACtD,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAE/C,SAAS,CAAC,Q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C;YACjC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;YAC3B,MAAM,CAAC,gBAAgB,GAAG,oBAAoB,CAAC;QACjD,CAAC;aAAM,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;YAC3B,MAAM,CAAC,gBAAgB,GAAG,aAAa,CAAC;QAC1C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sBAAsB;IACxB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Wiggum UI - Core Library
|
|
3
|
+
*/
|
|
4
|
+
export * from './config.js';
|
|
5
|
+
export * from './preflight.js';
|
|
6
|
+
export * from './tasks.js';
|
|
7
|
+
export * from './logger.js';
|
|
8
|
+
export * from './progress.js';
|
|
9
|
+
export * from './templates.js';
|
|
10
|
+
export * from '../types/index.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Wiggum UI - Core Library
|
|
3
|
+
*/
|
|
4
|
+
// Configuration
|
|
5
|
+
export * from './config.js';
|
|
6
|
+
// Pre-flight checks
|
|
7
|
+
export * from './preflight.js';
|
|
8
|
+
// Task management
|
|
9
|
+
export * from './tasks.js';
|
|
10
|
+
// Logging
|
|
11
|
+
export * from './logger.js';
|
|
12
|
+
// Progress file
|
|
13
|
+
export * from './progress.js';
|
|
14
|
+
// Templates
|
|
15
|
+
export * from './templates.js';
|
|
16
|
+
// Re-export types
|
|
17
|
+
export * from '../types/index.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gBAAgB;AAChB,cAAc,aAAa,CAAC;AAE5B,oBAAoB;AACpB,cAAc,gBAAgB,CAAC;AAE/B,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAE3B,UAAU;AACV,cAAc,aAAa,CAAC;AAE5B,gBAAgB;AAChB,cAAc,eAAe,CAAC;AAE9B,YAAY;AACZ,cAAc,gBAAgB,CAAC;AAE/B,kBAAkB;AAClB,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for Ralph Wiggum UI
|
|
3
|
+
*/
|
|
4
|
+
export interface LogEntry {
|
|
5
|
+
timestamp: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get the logs directory path
|
|
10
|
+
*/
|
|
11
|
+
export declare function getLogsDir(cwd: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Generate a log filename for a task
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateLogFilename(taskId: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Get the full path to a log file
|
|
18
|
+
*/
|
|
19
|
+
export declare function getLogFilePath(cwd: string, filename: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new log file for a task
|
|
22
|
+
*/
|
|
23
|
+
export declare function createLogFile(cwd: string, taskId: string, taskTitle: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Append a message to a log file
|
|
26
|
+
*/
|
|
27
|
+
export declare function appendToLog(cwd: string, filename: string, message: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Append a completion message to a log file
|
|
30
|
+
*/
|
|
31
|
+
export declare function finalizeLog(cwd: string, filename: string, success: boolean, message?: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Format a log entry with timestamp
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatLogEntry(message: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Parse a log entry
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseLogEntry(line: string): LogEntry | null;
|
|
40
|
+
/**
|
|
41
|
+
* Read a log file
|
|
42
|
+
*/
|
|
43
|
+
export declare function readLogFile(cwd: string, filename: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Read log file as entries
|
|
46
|
+
*/
|
|
47
|
+
export declare function readLogEntries(cwd: string, filename: string): LogEntry[];
|
|
48
|
+
/**
|
|
49
|
+
* List all log files
|
|
50
|
+
*/
|
|
51
|
+
export declare function listLogFiles(cwd: string): string[];
|
|
52
|
+
/**
|
|
53
|
+
* List log files for a specific task
|
|
54
|
+
*/
|
|
55
|
+
export declare function listTaskLogFiles(cwd: string, taskId: string): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Get the most recent log file for a task
|
|
58
|
+
*/
|
|
59
|
+
export declare function getLatestTaskLog(cwd: string, taskId: string): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Clean up old log files based on retention policy
|
|
62
|
+
*/
|
|
63
|
+
export declare function cleanupOldLogs(cwd: string): number;
|
|
64
|
+
/**
|
|
65
|
+
* Create a log stream writer for real-time logging
|
|
66
|
+
*/
|
|
67
|
+
export declare function createLogWriter(cwd: string, taskId: string, taskTitle: string): {
|
|
68
|
+
filename: string;
|
|
69
|
+
write: (message: string) => void;
|
|
70
|
+
finalize: (success: boolean, message?: string) => void;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA;;GA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,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA0BlD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG;IAC/E,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD,CAQA"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for Ralph Wiggum UI
|
|
3
|
+
*/
|
|
4
|
+
import { writeFileSync, appendFileSync, readFileSync, readdirSync, unlinkSync, existsSync, } from 'fs';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { LOGS_DIR } from '../types/index.js';
|
|
7
|
+
import { getRalphDir, loadConfig } from './config.js';
|
|
8
|
+
/**
|
|
9
|
+
* Get the logs directory path
|
|
10
|
+
*/
|
|
11
|
+
export function getLogsDir(cwd) {
|
|
12
|
+
return join(getRalphDir(cwd), LOGS_DIR);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generate a log filename for a task
|
|
16
|
+
*/
|
|
17
|
+
export function generateLogFilename(taskId) {
|
|
18
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
19
|
+
return `${taskId}_${timestamp}.log`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the full path to a log file
|
|
23
|
+
*/
|
|
24
|
+
export function getLogFilePath(cwd, filename) {
|
|
25
|
+
return join(getLogsDir(cwd), filename);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a new log file for a task
|
|
29
|
+
*/
|
|
30
|
+
export function createLogFile(cwd, taskId, taskTitle) {
|
|
31
|
+
const filename = generateLogFilename(taskId);
|
|
32
|
+
const filePath = getLogFilePath(cwd, filename);
|
|
33
|
+
const header = formatLogEntry(`Task started: ${taskId} - ${taskTitle}`);
|
|
34
|
+
writeFileSync(filePath, header + '\n', 'utf-8');
|
|
35
|
+
return filename;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Append a message to a log file
|
|
39
|
+
*/
|
|
40
|
+
export function appendToLog(cwd, filename, message) {
|
|
41
|
+
const filePath = getLogFilePath(cwd, filename);
|
|
42
|
+
const entry = formatLogEntry(message);
|
|
43
|
+
appendFileSync(filePath, entry + '\n', 'utf-8');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Append a completion message to a log file
|
|
47
|
+
*/
|
|
48
|
+
export function finalizeLog(cwd, filename, success, message) {
|
|
49
|
+
const filePath = getLogFilePath(cwd, filename);
|
|
50
|
+
const status = success ? 'Task completed successfully' : `Task failed: ${message || 'Unknown error'}`;
|
|
51
|
+
const entry = formatLogEntry(status);
|
|
52
|
+
appendFileSync(filePath, entry + '\n', 'utf-8');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Format a log entry with timestamp
|
|
56
|
+
*/
|
|
57
|
+
export function formatLogEntry(message) {
|
|
58
|
+
const timestamp = new Date().toISOString().replace('T', ' ').substring(0, 19);
|
|
59
|
+
return `[${timestamp}] ${message}`;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse a log entry
|
|
63
|
+
*/
|
|
64
|
+
export function parseLogEntry(line) {
|
|
65
|
+
const match = line.match(/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\] (.*)$/);
|
|
66
|
+
if (match && match[1] && match[2]) {
|
|
67
|
+
return {
|
|
68
|
+
timestamp: match[1],
|
|
69
|
+
message: match[2],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Read a log file
|
|
76
|
+
*/
|
|
77
|
+
export function readLogFile(cwd, filename) {
|
|
78
|
+
const filePath = getLogFilePath(cwd, filename);
|
|
79
|
+
if (!existsSync(filePath)) {
|
|
80
|
+
throw new Error(`Log file not found: ${filename}`);
|
|
81
|
+
}
|
|
82
|
+
return readFileSync(filePath, 'utf-8');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Read log file as entries
|
|
86
|
+
*/
|
|
87
|
+
export function readLogEntries(cwd, filename) {
|
|
88
|
+
const content = readLogFile(cwd, filename);
|
|
89
|
+
const lines = content.split('\n').filter((line) => line.trim());
|
|
90
|
+
return lines
|
|
91
|
+
.map(parseLogEntry)
|
|
92
|
+
.filter((entry) => entry !== null);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* List all log files
|
|
96
|
+
*/
|
|
97
|
+
export function listLogFiles(cwd) {
|
|
98
|
+
const logsDir = getLogsDir(cwd);
|
|
99
|
+
if (!existsSync(logsDir)) {
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
return readdirSync(logsDir)
|
|
103
|
+
.filter((file) => file.endsWith('.log'))
|
|
104
|
+
.sort()
|
|
105
|
+
.reverse(); // Most recent first
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* List log files for a specific task
|
|
109
|
+
*/
|
|
110
|
+
export function listTaskLogFiles(cwd, taskId) {
|
|
111
|
+
return listLogFiles(cwd).filter((file) => file.startsWith(`${taskId}_`));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get the most recent log file for a task
|
|
115
|
+
*/
|
|
116
|
+
export function getLatestTaskLog(cwd, taskId) {
|
|
117
|
+
const logs = listTaskLogFiles(cwd, taskId);
|
|
118
|
+
return logs[0] ?? null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Clean up old log files based on retention policy
|
|
122
|
+
*/
|
|
123
|
+
export function cleanupOldLogs(cwd) {
|
|
124
|
+
try {
|
|
125
|
+
const config = loadConfig(cwd);
|
|
126
|
+
const retention = config.logs.retention;
|
|
127
|
+
const files = listLogFiles(cwd);
|
|
128
|
+
if (files.length <= retention) {
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
const filesToDelete = files.slice(retention);
|
|
132
|
+
let deleted = 0;
|
|
133
|
+
for (const file of filesToDelete) {
|
|
134
|
+
try {
|
|
135
|
+
unlinkSync(getLogFilePath(cwd, file));
|
|
136
|
+
deleted++;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Ignore deletion errors
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return deleted;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return 0;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Create a log stream writer for real-time logging
|
|
150
|
+
*/
|
|
151
|
+
export function createLogWriter(cwd, taskId, taskTitle) {
|
|
152
|
+
const filename = createLogFile(cwd, taskId, taskTitle);
|
|
153
|
+
return {
|
|
154
|
+
filename,
|
|
155
|
+
write: (message) => appendToLog(cwd, filename, message),
|
|
156
|
+
finalize: (success, message) => finalizeLog(cwd, filename, success, message),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=logger.js.map
|