@spec-ade/cli 0.0.3
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/bin/spec-ade.js +72 -0
- package/package.json +21 -0
package/bin/spec-ade.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require('child_process')
|
|
4
|
+
const { existsSync } = require('fs')
|
|
5
|
+
const path = require('path')
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
'linux-x64': '@spec-ade/cli-linux-x64',
|
|
9
|
+
'linux-arm64': '@spec-ade/cli-linux-arm64',
|
|
10
|
+
'darwin-arm64': '@spec-ade/cli-darwin-arm64',
|
|
11
|
+
'win32-x64': '@spec-ade/cli-win32-x64',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const platformKey = `${process.platform}-${process.arch}`
|
|
15
|
+
const packageName = PLATFORMS[platformKey]
|
|
16
|
+
|
|
17
|
+
if (!packageName) {
|
|
18
|
+
console.error(
|
|
19
|
+
`Unsupported platform: ${process.platform} ${process.arch}\n` +
|
|
20
|
+
`Supported platforms: ${Object.keys(PLATFORMS).join(', ')}`
|
|
21
|
+
)
|
|
22
|
+
process.exit(1)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let binPath
|
|
26
|
+
try {
|
|
27
|
+
const binName = process.platform === 'win32' ? 'spec-ade.exe' : 'spec-ade'
|
|
28
|
+
binPath = path.join(
|
|
29
|
+
path.dirname(require.resolve(`${packageName}/package.json`)),
|
|
30
|
+
'bin',
|
|
31
|
+
binName
|
|
32
|
+
)
|
|
33
|
+
} catch {
|
|
34
|
+
console.error(
|
|
35
|
+
`Could not find the binary package "${packageName}".\n` +
|
|
36
|
+
`This usually means the package was not installed (e.g., --no-optional was used).\n` +
|
|
37
|
+
`Try reinstalling: npm install -g @spec-ade/cli`
|
|
38
|
+
)
|
|
39
|
+
process.exit(1)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!existsSync(binPath)) {
|
|
43
|
+
console.error(
|
|
44
|
+
`Binary not found at "${binPath}".\n` +
|
|
45
|
+
`The platform package "${packageName}" is installed but the binary is missing.\n` +
|
|
46
|
+
`Try reinstalling: npm install -g @spec-ade/cli`
|
|
47
|
+
)
|
|
48
|
+
process.exit(1)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Inject --port 4123 as default if user didn't pass --port or -p or SPEC_ADE_PORT env
|
|
52
|
+
const userArgs = process.argv.slice(2)
|
|
53
|
+
const hasPort = userArgs.some((arg, i) =>
|
|
54
|
+
arg.startsWith('--port=') || arg.startsWith('-p=') ||
|
|
55
|
+
/^-p\d/.test(arg) ||
|
|
56
|
+
((arg === '--port' || arg === '-p') && i + 1 < userArgs.length && !userArgs[i + 1].startsWith('-'))
|
|
57
|
+
) || !!process.env.SPEC_ADE_PORT
|
|
58
|
+
|
|
59
|
+
const args = hasPort ? userArgs : ['--port', '4123', ...userArgs]
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
execFileSync(binPath, args, {
|
|
63
|
+
stdio: 'inherit',
|
|
64
|
+
env: process.env,
|
|
65
|
+
})
|
|
66
|
+
process.exit(0)
|
|
67
|
+
} catch (e) {
|
|
68
|
+
if (e.signal) {
|
|
69
|
+
process.kill(process.pid, e.signal)
|
|
70
|
+
}
|
|
71
|
+
process.exit(e.status ?? 1)
|
|
72
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spec-ade/cli",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Spec ADE — full-stack GUI for AI coding assistants",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"spec-ade": "bin/spec-ade.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18"
|
|
14
|
+
},
|
|
15
|
+
"optionalDependencies": {
|
|
16
|
+
"@spec-ade/cli-linux-x64": "0.0.3",
|
|
17
|
+
"@spec-ade/cli-linux-arm64": "0.0.3",
|
|
18
|
+
"@spec-ade/cli-darwin-arm64": "0.0.3",
|
|
19
|
+
"@spec-ade/cli-win32-x64": "0.0.3"
|
|
20
|
+
}
|
|
21
|
+
}
|