-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·56 lines (45 loc) · 1.16 KB
/
cli.js
File metadata and controls
executable file
·56 lines (45 loc) · 1.16 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
import path from 'path'
import { fileURLToPath } from 'url'
import { spawn } from 'child_process'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
export function main(args) {
const cmd = args[0]
switch (cmd) {
case 'mutate':
runAgent([])
break
case 'next':
runAgent(['--next'])
break
case 'dry':
runAgent(['--dry'])
break
case 'quip':
runAgent(['--quip'])
break
case 'log':
runAgent(['--log', args[1] || '10'])
break
case 'evolve':
runRegistry()
break
default:
console.log('Asteroid commands:')
console.log(' asteroid mutate')
console.log(' asteroid next')
console.log(' asteroid dry')
console.log(' asteroid quip')
console.log(' asteroid log [n]')
console.log(' asteroid evolve')
break
}
}
function runAgent(flags) {
const runPath = path.join(__dirname, 'agent/run.js')
spawn('node', [runPath, ...flags], { stdio: 'inherit' })
}
function runRegistry() {
const regPath = path.join(__dirname, 'agent/build_registry.js')
spawn('node', [regPath], { stdio: 'inherit' })
}