goatchain-cli 0.0.9-beta.25 → 0.0.9-beta.28
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 +10 -61
- package/dist/ink.mjs +195 -193
- 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() {
|
|
@@ -114,6 +59,9 @@ async function runInk() {
|
|
|
114
59
|
// npm wrapper package rather than upstream `dimcode`.
|
|
115
60
|
process.env.DIMCODE_NPM_PACKAGE = 'goatchain-cli'
|
|
116
61
|
process.env.DIMCODE_NPM_PACKAGE_MANAGER = wrapperPm
|
|
62
|
+
// goatchain-cli is a beta-only channel: ignore any stable releases on the
|
|
63
|
+
// registry when deciding whether to upgrade.
|
|
64
|
+
process.env.DIMCODE_NPM_PACKAGE_BETA_ONLY = '1'
|
|
117
65
|
if (wrapperVersion)
|
|
118
66
|
process.env.DIMCODE_NPM_PACKAGE_VERSION = wrapperVersion
|
|
119
67
|
try {
|
|
@@ -146,8 +94,8 @@ function runOpentui(restArgs) {
|
|
|
146
94
|
const archMap = { x64: 'x64', arm64: 'arm64' }
|
|
147
95
|
const platform = platformMap[os.platform()] || os.platform()
|
|
148
96
|
const arch = archMap[os.arch()] || os.arch()
|
|
149
|
-
const base = '
|
|
150
|
-
const binary = platform === 'windows' ? '
|
|
97
|
+
const base = 'dimcode-' + platform + '-' + arch
|
|
98
|
+
const binary = platform === 'windows' ? 'dimcode.exe' : 'dimcode'
|
|
151
99
|
|
|
152
100
|
if (process.env.DIMCODE_DEBUG) {
|
|
153
101
|
console.error('[goatchain] Wrapper version: ' + wrapperVersion)
|
|
@@ -199,6 +147,7 @@ function spawnBinary(target, forwardedArgs) {
|
|
|
199
147
|
...process.env,
|
|
200
148
|
DIMCODE_NPM_PACKAGE: 'goatchain-cli',
|
|
201
149
|
DIMCODE_NPM_PACKAGE_MANAGER: wrapperPm,
|
|
150
|
+
DIMCODE_NPM_PACKAGE_BETA_ONLY: '1',
|
|
202
151
|
}
|
|
203
152
|
if (wrapperVersion)
|
|
204
153
|
env.DIMCODE_NPM_PACKAGE_VERSION = wrapperVersion
|