goatchain-cli 0.0.9-beta.24 → 0.0.9-beta.26
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/goatchain.mjs +6 -61
- package/dist/ink.mjs +162 -161
- package/package.json +7 -7
package/bin/goatchain.mjs
CHANGED
|
@@ -39,68 +39,13 @@ function resolveRouting(argv) {
|
|
|
39
39
|
// Explicit `goatchain ink ...` forces the Ink TUI.
|
|
40
40
|
if (argv[0] === 'ink')
|
|
41
41
|
return { target: 'ink', forwardArgs: argv.slice(1) }
|
|
42
|
-
// Explicit `goatchain opentui ...`
|
|
42
|
+
// Explicit `goatchain opentui ...` also routes to the opentui binary
|
|
43
|
+
// (kept for backwards compatibility; opentui is now the default).
|
|
43
44
|
if (argv[0] === 'opentui')
|
|
44
45
|
return { target: 'opentui', forwardArgs: argv.slice(1) }
|
|
45
46
|
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
const opentuiSubcommands = new Set([
|
|
49
|
-
'version',
|
|
50
|
-
'--version',
|
|
51
|
-
'-v',
|
|
52
|
-
'upgrade',
|
|
53
|
-
'update',
|
|
54
|
-
'acp',
|
|
55
|
-
'auth',
|
|
56
|
-
'exec',
|
|
57
|
-
'e',
|
|
58
|
-
'--help',
|
|
59
|
-
'-h',
|
|
60
|
-
])
|
|
61
|
-
if (opentuiSubcommands.has(first))
|
|
62
|
-
return { target: 'opentui', forwardArgs: argv }
|
|
63
|
-
|
|
64
|
-
// One-shot prompt (non-flag first positional, e.g. `goatchain hi`) or
|
|
65
|
-
// one-shot flags (`--cwd`, `--session`, `--no-interaction`) go to opentui.
|
|
66
|
-
if (isOneShotPromptArgv(argv))
|
|
67
|
-
return { target: 'opentui', forwardArgs: argv }
|
|
68
|
-
|
|
69
|
-
// Bare invocation (no args) or flag-only invocation: default to Ink.
|
|
70
|
-
return { target: 'ink', forwardArgs: argv }
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function isOneShotPromptArgv(argv) {
|
|
74
|
-
const oneShotFlags = new Set([
|
|
75
|
-
'-c',
|
|
76
|
-
'-cwd',
|
|
77
|
-
'--cwd',
|
|
78
|
-
'--chdir',
|
|
79
|
-
'-s',
|
|
80
|
-
'--session',
|
|
81
|
-
'--no-interaction',
|
|
82
|
-
])
|
|
83
|
-
let sawOneShotFlag = false
|
|
84
|
-
for (let i = 0; i < argv.length; i++) {
|
|
85
|
-
const arg = String(argv[i] ?? '').trim()
|
|
86
|
-
if (!arg)
|
|
87
|
-
continue
|
|
88
|
-
if (arg === '--')
|
|
89
|
-
return true
|
|
90
|
-
if (arg.startsWith('-cwd=')) {
|
|
91
|
-
sawOneShotFlag = true
|
|
92
|
-
continue
|
|
93
|
-
}
|
|
94
|
-
if (oneShotFlags.has(arg)) {
|
|
95
|
-
sawOneShotFlag = true
|
|
96
|
-
i += 1
|
|
97
|
-
continue
|
|
98
|
-
}
|
|
99
|
-
if (arg.startsWith('-'))
|
|
100
|
-
return false
|
|
101
|
-
return true
|
|
102
|
-
}
|
|
103
|
-
return sawOneShotFlag
|
|
47
|
+
// Default: everything goes to the opentui binary.
|
|
48
|
+
return { target: 'opentui', forwardArgs: argv }
|
|
104
49
|
}
|
|
105
50
|
|
|
106
51
|
async function runInk() {
|
|
@@ -146,8 +91,8 @@ function runOpentui(restArgs) {
|
|
|
146
91
|
const archMap = { x64: 'x64', arm64: 'arm64' }
|
|
147
92
|
const platform = platformMap[os.platform()] || os.platform()
|
|
148
93
|
const arch = archMap[os.arch()] || os.arch()
|
|
149
|
-
const base = '
|
|
150
|
-
const binary = platform === 'windows' ? '
|
|
94
|
+
const base = 'dimcode-' + platform + '-' + arch
|
|
95
|
+
const binary = platform === 'windows' ? 'dimcode.exe' : 'dimcode'
|
|
151
96
|
|
|
152
97
|
if (process.env.DIMCODE_DEBUG) {
|
|
153
98
|
console.error('[goatchain] Wrapper version: ' + wrapperVersion)
|