-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathbin.mjs
More file actions
executable file
·24 lines (23 loc) · 843 Bytes
/
bin.mjs
File metadata and controls
executable file
·24 lines (23 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env node
import { dirname, join } from "path"
import { fileURLToPath } from "url"
import { spawnSync } from "child_process"
const cmd = "node_modules/.bin/genaiscript"
const args = process.argv.slice(2)
const scriptDir = dirname(fileURLToPath(import.meta.url))
if ("configure" === args[0]) {
const result = spawnSync(cmd, args, { stdio: "inherit" })
if (result.error || result.status !== 0) process.exit(1)
} else {
const genaiArgs = [
"run",
join(scriptDir, "src", "genaisrc", "promptpex.genai.mts"),
...args,
"--no-run-trace",
]
console.error(`genaiscript ${genaiArgs.join(" ")}`)
const result = spawnSync(cmd, genaiArgs, { stdio: "inherit" })
if (result.error)
console.error(result.error.message)
if (result.error || result.status !== 0) process.exit(1)
}