-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
65 lines (55 loc) · 1.91 KB
/
Copy pathcli.ts
File metadata and controls
65 lines (55 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env node
/**
* LoopCode CLI — The open-source standard for autonomous AI agent loops.
*
* Usage:
* loopcode init Initialize a new LoopCode project
* loopcode validate Validate loop configuration
* loopcode run <loop-name> Execute a loop
* loopcode status Show project status
* loopcode --help Show help
* loopcode --version Show version
*/
import { Command } from 'commander';
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { initCommand } from './commands/init.js';
import { validateCommand } from './commands/validate.js';
import { runCommand } from './commands/run.js';
import { statusCommand } from './commands/status.js';
const require = createRequire(import.meta.url);
const pkg = require('../package.json');
const program = new Command();
program
.name('loopcode')
.description('The open-source standard for autonomous AI agent loops')
.version(pkg.version);
program
.command('init')
.description('Initialize a new LoopCode project in the current directory')
.option('-f, --force', 'Overwrite existing files')
.action(async (options) => {
await initCommand(process.cwd(), options);
});
program
.command('validate')
.description('Validate loop configuration and calculate readiness scores')
.action(() => {
const result = validateCommand(process.cwd());
process.exit(result.valid ? 0 : 1);
});
program
.command('run')
.description('Execute a named loop')
.argument('<loop-name>', 'Name of the loop to run')
.action(async (loopName: string) => {
const result = await runCommand(loopName, process.cwd());
process.exit(result.success ? 0 : 1);
});
program
.command('status')
.description('Show project status and loop readiness scores')
.action(() => {
statusCommand(process.cwd());
});
program.parse(process.argv);