@scalebun/cli 1.10.2 → 1.11.0
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/lib/commands/ci-init.d.ts.map +1 -1
- package/lib/commands/ci-init.js +80 -2
- package/lib/commands/ci-init.js.map +1 -1
- package/lib/commands/doctor.d.ts.map +1 -1
- package/lib/commands/doctor.js +148 -3
- package/lib/commands/doctor.js.map +1 -1
- package/lib/commands/link.d.ts +16 -0
- package/lib/commands/link.d.ts.map +1 -0
- package/lib/commands/link.js +164 -0
- package/lib/commands/link.js.map +1 -0
- package/lib/commands/login.d.ts.map +1 -1
- package/lib/commands/login.js +29 -7
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/ota-bundle.d.ts +15 -2
- package/lib/commands/ota-bundle.d.ts.map +1 -1
- package/lib/commands/ota-bundle.js +142 -12
- package/lib/commands/ota-bundle.js.map +1 -1
- package/lib/commands/ota-channels.d.ts.map +1 -1
- package/lib/commands/ota-channels.js +213 -21
- package/lib/commands/ota-channels.js.map +1 -1
- package/lib/commands/ota-inspect.d.ts +3 -0
- package/lib/commands/ota-inspect.d.ts.map +1 -0
- package/lib/commands/ota-inspect.js +258 -0
- package/lib/commands/ota-inspect.js.map +1 -0
- package/lib/commands/ota-keys.d.ts +18 -0
- package/lib/commands/ota-keys.d.ts.map +1 -1
- package/lib/commands/ota-keys.js +149 -4
- package/lib/commands/ota-keys.js.map +1 -1
- package/lib/commands/ota-promote.d.ts +3 -0
- package/lib/commands/ota-promote.d.ts.map +1 -0
- package/lib/commands/ota-promote.js +194 -0
- package/lib/commands/ota-promote.js.map +1 -0
- package/lib/commands/ota-publish.d.ts.map +1 -1
- package/lib/commands/ota-publish.js +108 -38
- package/lib/commands/ota-publish.js.map +1 -1
- package/lib/commands/ota-rollout.d.ts.map +1 -1
- package/lib/commands/ota-rollout.js +201 -171
- package/lib/commands/ota-rollout.js.map +1 -1
- package/lib/commands/quickstart.d.ts.map +1 -1
- package/lib/commands/quickstart.js +110 -8
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/commands/shell.d.ts +28 -0
- package/lib/commands/shell.d.ts.map +1 -0
- package/lib/commands/shell.js +512 -0
- package/lib/commands/shell.js.map +1 -0
- package/lib/index.js +140 -4
- package/lib/index.js.map +1 -1
- package/lib/ui/menu.d.ts +109 -0
- package/lib/ui/menu.d.ts.map +1 -0
- package/lib/ui/menu.js +314 -0
- package/lib/ui/menu.js.map +1 -0
- package/lib/utils/bundle.d.ts.map +1 -1
- package/lib/utils/bundle.js +7 -1
- package/lib/utils/bundle.js.map +1 -1
- package/lib/utils/context.d.ts +88 -0
- package/lib/utils/context.d.ts.map +1 -0
- package/lib/utils/context.js +247 -0
- package/lib/utils/context.js.map +1 -0
- package/lib/utils/credentials.d.ts +16 -0
- package/lib/utils/credentials.d.ts.map +1 -1
- package/lib/utils/credentials.js +14 -3
- package/lib/utils/credentials.js.map +1 -1
- package/lib/utils/guide.d.ts +63 -0
- package/lib/utils/guide.d.ts.map +1 -0
- package/lib/utils/guide.js +189 -0
- package/lib/utils/guide.js.map +1 -0
- package/lib/utils/output.d.ts +96 -0
- package/lib/utils/output.d.ts.map +1 -0
- package/lib/utils/output.js +135 -0
- package/lib/utils/output.js.map +1 -0
- package/lib/utils/prompt.d.ts +80 -6
- package/lib/utils/prompt.d.ts.map +1 -1
- package/lib/utils/prompt.js +184 -20
- package/lib/utils/prompt.js.map +1 -1
- package/lib/utils/provenance.d.ts +30 -0
- package/lib/utils/provenance.d.ts.map +1 -0
- package/lib/utils/provenance.js +157 -0
- package/lib/utils/provenance.js.map +1 -0
- package/lib/utils/resolve.d.ts +81 -0
- package/lib/utils/resolve.d.ts.map +1 -0
- package/lib/utils/resolve.js +139 -0
- package/lib/utils/resolve.js.map +1 -0
- package/lib/utils/sdkBin.d.ts +18 -0
- package/lib/utils/sdkBin.d.ts.map +1 -0
- package/lib/utils/sdkBin.js +76 -0
- package/lib/utils/sdkBin.js.map +1 -0
- package/lib/utils/ui.d.ts +10 -1
- package/lib/utils/ui.d.ts.map +1 -1
- package/lib/utils/ui.js +18 -57
- package/lib/utils/ui.js.map +1 -1
- package/lib/utils/validate.d.ts +62 -0
- package/lib/utils/validate.d.ts.map +1 -0
- package/lib/utils/validate.js +189 -0
- package/lib/utils/validate.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.tokenize = tokenize;
|
|
40
|
+
exports.stripPrefix = stripPrefix;
|
|
41
|
+
exports.inShell = inShell;
|
|
42
|
+
exports.runShell = runShell;
|
|
43
|
+
exports.registerShellCommand = registerShellCommand;
|
|
44
|
+
const readline = __importStar(require("readline"));
|
|
45
|
+
const os = __importStar(require("os"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
49
|
+
const menu_1 = require("../ui/menu");
|
|
50
|
+
const guide_1 = require("../utils/guide");
|
|
51
|
+
const prompt_1 = require("../utils/prompt");
|
|
52
|
+
const output_1 = require("../utils/output");
|
|
53
|
+
const banner_1 = require("../ui/banner");
|
|
54
|
+
/**
|
|
55
|
+
* The interactive session — what a bare `scalebun` opens.
|
|
56
|
+
*
|
|
57
|
+
* ── Why ─────────────────────────────────────────────────────────────────────
|
|
58
|
+
*
|
|
59
|
+
* `scalebun launch` already opened a terminal window running `scalebun` with
|
|
60
|
+
* `-NoExit`, expecting something interactive; what it got was a splash and an
|
|
61
|
+
* exit. This is the thing it was opening a window for.
|
|
62
|
+
*
|
|
63
|
+
* The value is not saving nine keystrokes — shell history does that. It is
|
|
64
|
+
* that the surface has a shape: five groups, one of which is obviously the one
|
|
65
|
+
* you want, instead of thirty commands with equal weight. And inside a session
|
|
66
|
+
* with a bound project, the commands collapse to what you actually mean —
|
|
67
|
+
* `ota releases`, `ota rollout 25` — because the resolver landed first. Without
|
|
68
|
+
* it this would still be `ota releases --app-id cmsszi53z…` and a novelty.
|
|
69
|
+
*
|
|
70
|
+
* ── The two hard parts ──────────────────────────────────────────────────────
|
|
71
|
+
*
|
|
72
|
+
* 1. process.exit. Every command calls it, and in a session that kills the
|
|
73
|
+
* terminal instead of returning to the menu. Rather than rewrite 57 call
|
|
74
|
+
* sites — churn and regression risk across every command — `runOnce` swaps
|
|
75
|
+
* `process.exit` for a function that throws, catches the throw, and returns
|
|
76
|
+
* the code. Commander's own parse failures are handled by `exitOverride`.
|
|
77
|
+
*
|
|
78
|
+
* 2. stdin ownership. Raw-mode menus and readline cannot both hold stdin: both
|
|
79
|
+
* consume the keypress stream and neither sees a whole event. So exactly
|
|
80
|
+
* one owns it at a time — the menu while navigating, a readline only while
|
|
81
|
+
* a line is being typed, and neither while a command runs (commands make
|
|
82
|
+
* their own prompts via utils/prompt). `closePrompts()` after every command
|
|
83
|
+
* guarantees the third case, so a command that leaves a prompt open cannot
|
|
84
|
+
* poison the next frame.
|
|
85
|
+
*/
|
|
86
|
+
/** Thrown in place of process.exit while a command runs inside the session. */
|
|
87
|
+
class CommandExit extends Error {
|
|
88
|
+
constructor(code) {
|
|
89
|
+
super(`exit ${code}`);
|
|
90
|
+
this.code = code;
|
|
91
|
+
this.name = 'CommandExit';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const HISTORY_FILE = path.join(os.homedir(), '.scalebun', 'history');
|
|
95
|
+
const MAX_HISTORY = 500;
|
|
96
|
+
function loadHistory() {
|
|
97
|
+
try {
|
|
98
|
+
return fs
|
|
99
|
+
.readFileSync(HISTORY_FILE, 'utf8')
|
|
100
|
+
.split('\n')
|
|
101
|
+
.filter(Boolean)
|
|
102
|
+
.slice(-MAX_HISTORY)
|
|
103
|
+
// readline expects newest first.
|
|
104
|
+
.reverse();
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function saveHistory(lines) {
|
|
111
|
+
try {
|
|
112
|
+
fs.mkdirSync(path.dirname(HISTORY_FILE), { recursive: true });
|
|
113
|
+
fs.writeFileSync(HISTORY_FILE, lines.slice(0, MAX_HISTORY).reverse().join('\n') + '\n');
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
/* history is a convenience, never a failure */
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Split a line into argv, honouring quotes.
|
|
121
|
+
*
|
|
122
|
+
* `--release-note "a fix"` has to survive, or half the commands are unusable
|
|
123
|
+
* in the session.
|
|
124
|
+
*/
|
|
125
|
+
function tokenize(line) {
|
|
126
|
+
const out = [];
|
|
127
|
+
let cur = '';
|
|
128
|
+
let quote = null;
|
|
129
|
+
let has = false;
|
|
130
|
+
for (const ch of line) {
|
|
131
|
+
if (quote) {
|
|
132
|
+
if (ch === quote)
|
|
133
|
+
quote = null;
|
|
134
|
+
else
|
|
135
|
+
cur += ch;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (ch === '"' || ch === "'") {
|
|
139
|
+
quote = ch;
|
|
140
|
+
has = true; // '' is a real empty argument
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (/\s/.test(ch)) {
|
|
144
|
+
if (cur || has)
|
|
145
|
+
out.push(cur);
|
|
146
|
+
cur = '';
|
|
147
|
+
has = false;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
cur += ch;
|
|
151
|
+
}
|
|
152
|
+
if (cur || has)
|
|
153
|
+
out.push(cur);
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Strip a leading `scalebun` so anything copy-pasted from the docs runs.
|
|
158
|
+
*
|
|
159
|
+
* Without this the session becomes a second surface that diverges from every
|
|
160
|
+
* example ever written — the most common way an interactive mode makes a tool
|
|
161
|
+
* worse rather than better.
|
|
162
|
+
*/
|
|
163
|
+
function stripPrefix(argv) {
|
|
164
|
+
return argv.length && argv[0].toLowerCase() === 'scalebun' ? argv.slice(1) : argv;
|
|
165
|
+
}
|
|
166
|
+
let sessionActive = false;
|
|
167
|
+
/**
|
|
168
|
+
* True while a session is open.
|
|
169
|
+
*
|
|
170
|
+
* Guards the auto-entry in `index.ts`: typing a bare root flag INSIDE the
|
|
171
|
+
* session re-enters commander's root action, which would open a second session
|
|
172
|
+
* on the same stdin — two readers racing for keypresses, which hangs the
|
|
173
|
+
* terminal.
|
|
174
|
+
*/
|
|
175
|
+
function inShell() {
|
|
176
|
+
return sessionActive;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The logo drawn at the top of every frame.
|
|
180
|
+
*
|
|
181
|
+
* Block art, never sixel, and rendered ONCE for the whole session. The menu
|
|
182
|
+
* clears and repaints on every keypress, and `\x1b[2J` does not reliably erase
|
|
183
|
+
* a sixel image — on the terminals where it does not, the logo smears into a
|
|
184
|
+
* stack of ghosts. Detecting sixel support would also mean writing to stdin
|
|
185
|
+
* and waiting for the terminal to answer, which is exactly the stream the menu
|
|
186
|
+
* is about to take raw control of.
|
|
187
|
+
*/
|
|
188
|
+
function sessionArt() {
|
|
189
|
+
if (!(0, banner_1.shouldShowArt)())
|
|
190
|
+
return '';
|
|
191
|
+
const { version } = require('../../package.json');
|
|
192
|
+
return (0, banner_1.banner)({ version });
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Fingerprint of the code this process loaded.
|
|
196
|
+
*
|
|
197
|
+
* The session is ONE long-lived node process — every command runs inside it
|
|
198
|
+
* via `program.parseAsync`, against the modules loaded when the session
|
|
199
|
+
* opened. So a `scalebun` upgrade, or a rebuild during development, has no
|
|
200
|
+
* effect on a session that is already open: you fix a bug, run the command
|
|
201
|
+
* again in the session you already had up, and watch the old bug happen.
|
|
202
|
+
*
|
|
203
|
+
* That is invisible and infuriating, and it is not only a developer problem —
|
|
204
|
+
* after `npm i -g @scalebun/cli@latest`, anyone with a session open keeps
|
|
205
|
+
* running the old CLI with nothing on screen saying so.
|
|
206
|
+
*
|
|
207
|
+
* Comparing the entrypoint's mtime is enough: `npm install` and `tsc` both
|
|
208
|
+
* rewrite it.
|
|
209
|
+
*/
|
|
210
|
+
function codeStamp() {
|
|
211
|
+
try {
|
|
212
|
+
return fs.statSync(path.join(__dirname, '..', 'index.js')).mtimeMs;
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Offer the command's own follow-up advice as a choice.
|
|
220
|
+
*
|
|
221
|
+
* A command that has just shipped a release ends by telling you how to watch,
|
|
222
|
+
* widen or undo it — the right advice at the right moment, printed as prose
|
|
223
|
+
* you then have to retype. In a session that already knows how to run
|
|
224
|
+
* commands, that is a menu pretending to be a paragraph.
|
|
225
|
+
*
|
|
226
|
+
* Arrow keys only, drawn under the output rather than replacing it: the result
|
|
227
|
+
* they are deciding about is on screen above, and clearing it to ask "what
|
|
228
|
+
* next?" would take away the thing the answer depends on.
|
|
229
|
+
*
|
|
230
|
+
* Returns the argv to run, or null to go back to the menu.
|
|
231
|
+
*/
|
|
232
|
+
function chooseNextStep(steps, code) {
|
|
233
|
+
return new Promise((resolve) => {
|
|
234
|
+
const stdin = process.stdin;
|
|
235
|
+
const stdout = process.stdout;
|
|
236
|
+
let idx = 0;
|
|
237
|
+
// Going back is a real choice and belongs in the list, not in a footnote.
|
|
238
|
+
const rows = [...steps.map((s) => ({ step: s })), { step: null }];
|
|
239
|
+
const width = steps.reduce((w, s) => Math.max(w, s.argv.join(' ').length), 0);
|
|
240
|
+
const draw = (first) => {
|
|
241
|
+
if (!first)
|
|
242
|
+
stdout.write(`\x1b[${rows.length + 2}A`);
|
|
243
|
+
stdout.write('\r\x1b[K' + chalk_1.default.dim(code === 0 ? ' What next?' : ` exit ${code} · what next?`) + '\n');
|
|
244
|
+
stdout.write('\r\x1b[K\n');
|
|
245
|
+
rows.forEach((r, i) => {
|
|
246
|
+
const on = i === idx;
|
|
247
|
+
const pointer = on ? chalk_1.default.cyan('❯') : ' ';
|
|
248
|
+
if (!r.step) {
|
|
249
|
+
stdout.write(`\r\x1b[K ${pointer} ${on ? chalk_1.default.bold.cyan('back to the menu') : chalk_1.default.dim('back to the menu')}\n`);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const cmd = r.step.argv.join(' ').padEnd(width);
|
|
253
|
+
stdout.write(`\r\x1b[K ${pointer} ${on ? chalk_1.default.bold.cyan(cmd) : chalk_1.default.cyan(cmd)} ${chalk_1.default.dim(r.step.label.toLowerCase())}\n`);
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
const cleanup = () => {
|
|
257
|
+
if (stdin.isTTY)
|
|
258
|
+
stdin.setRawMode(false);
|
|
259
|
+
stdin.pause();
|
|
260
|
+
stdin.removeListener('data', onData);
|
|
261
|
+
stdout.write('\x1b[?25h');
|
|
262
|
+
};
|
|
263
|
+
const onData = (chunk) => {
|
|
264
|
+
// Same splitter as the menu: two arrows arriving in one chunk must not
|
|
265
|
+
// be dropped just because this list is smaller.
|
|
266
|
+
for (const key of (0, menu_1.splitKeys)(chunk)) {
|
|
267
|
+
if (key === '\x1b[A' || key === '\x1bOA') {
|
|
268
|
+
idx = (idx - 1 + rows.length) % rows.length;
|
|
269
|
+
draw(false);
|
|
270
|
+
}
|
|
271
|
+
else if (key === '\x1b[B' || key === '\x1bOB') {
|
|
272
|
+
idx = (idx + 1) % rows.length;
|
|
273
|
+
draw(false);
|
|
274
|
+
}
|
|
275
|
+
else if (key === '\r' || key === '\n') {
|
|
276
|
+
cleanup();
|
|
277
|
+
stdout.write('\n');
|
|
278
|
+
return resolve(rows[idx].step ? rows[idx].step.argv : null);
|
|
279
|
+
}
|
|
280
|
+
else if (key === '\x1b' || key === '\x03') {
|
|
281
|
+
cleanup();
|
|
282
|
+
stdout.write('\n');
|
|
283
|
+
return resolve(null);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
stdout.write('\n');
|
|
288
|
+
stdin.resume();
|
|
289
|
+
stdin.setEncoding('utf8');
|
|
290
|
+
if (stdin.isTTY)
|
|
291
|
+
stdin.setRawMode(true);
|
|
292
|
+
stdout.write('\x1b[?25l');
|
|
293
|
+
draw(true);
|
|
294
|
+
stdin.on('data', onData);
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/** Wait for any key. Used to hold command output on screen before redrawing. */
|
|
298
|
+
function pressAnyKey(label) {
|
|
299
|
+
return new Promise((resolve) => {
|
|
300
|
+
const stdin = process.stdin;
|
|
301
|
+
process.stdout.write('\n' + chalk_1.default.dim(label));
|
|
302
|
+
stdin.resume();
|
|
303
|
+
stdin.setEncoding('utf8');
|
|
304
|
+
if (stdin.isTTY)
|
|
305
|
+
stdin.setRawMode(true);
|
|
306
|
+
const onData = () => {
|
|
307
|
+
stdin.removeListener('data', onData);
|
|
308
|
+
if (stdin.isTTY)
|
|
309
|
+
stdin.setRawMode(false);
|
|
310
|
+
stdin.pause();
|
|
311
|
+
process.stdout.write('\n');
|
|
312
|
+
resolve();
|
|
313
|
+
};
|
|
314
|
+
stdin.on('data', onData);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Read one command line, seeded with the keystroke that opened it.
|
|
319
|
+
*
|
|
320
|
+
* A readline is created per line and closed immediately, rather than held for
|
|
321
|
+
* the session: the menu needs raw mode back the moment this returns, and an
|
|
322
|
+
* idle readline would keep swallowing the arrow keys meant for it.
|
|
323
|
+
*
|
|
324
|
+
* Returns null when the user backed out with an empty line or Escape.
|
|
325
|
+
*/
|
|
326
|
+
function readCommandLine(seed, history) {
|
|
327
|
+
return new Promise((resolve) => {
|
|
328
|
+
const rl = readline.createInterface({
|
|
329
|
+
input: process.stdin,
|
|
330
|
+
output: process.stdout,
|
|
331
|
+
history,
|
|
332
|
+
historySize: MAX_HISTORY,
|
|
333
|
+
completer: (line) => {
|
|
334
|
+
// Completion over the real command surface, so Tab can never suggest
|
|
335
|
+
// something the menu does not also offer.
|
|
336
|
+
const verbs = guide_1.GROUPS.flatMap((g) => g.commands.map((c) => c.argv.join(' ')));
|
|
337
|
+
const hits = verbs.filter((v) => v.startsWith(line));
|
|
338
|
+
return [hits.length ? hits : verbs, line];
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
let answered = false;
|
|
342
|
+
const done = (value) => {
|
|
343
|
+
if (answered)
|
|
344
|
+
return;
|
|
345
|
+
answered = true;
|
|
346
|
+
rl.close();
|
|
347
|
+
resolve(value);
|
|
348
|
+
};
|
|
349
|
+
rl.on('close', () => done(null));
|
|
350
|
+
rl.question(chalk_1.default.cyan(' › '), (line) => {
|
|
351
|
+
// Capture readline's history (newest first) before closing, or every
|
|
352
|
+
// typed command is forgotten the moment it runs.
|
|
353
|
+
const h = rl.history ?? [];
|
|
354
|
+
history.length = 0;
|
|
355
|
+
history.push(...h);
|
|
356
|
+
done(line);
|
|
357
|
+
});
|
|
358
|
+
// Escape abandons the line and goes back to the menu — the same key that
|
|
359
|
+
// means "back" everywhere else in the session.
|
|
360
|
+
const onKey = (_s, key) => {
|
|
361
|
+
if (key?.name === 'escape') {
|
|
362
|
+
process.stdin.removeListener('keypress', onKey);
|
|
363
|
+
process.stdout.write('\n');
|
|
364
|
+
done(null);
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
process.stdin.on('keypress', onKey);
|
|
368
|
+
rl.on('close', () => process.stdin.removeListener('keypress', onKey));
|
|
369
|
+
if (seed)
|
|
370
|
+
rl.write(seed);
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Run one command inside the session.
|
|
375
|
+
*
|
|
376
|
+
* Returns the exit code the command asked for. A non-zero code is reported and
|
|
377
|
+
* the session continues — that is the whole point.
|
|
378
|
+
*/
|
|
379
|
+
async function runOnce(program, argv) {
|
|
380
|
+
const realExit = process.exit;
|
|
381
|
+
let code = 0;
|
|
382
|
+
// The cast is deliberate: process.exit is typed as `never`-returning, and
|
|
383
|
+
// this replacement throws instead, which is the same control-flow contract.
|
|
384
|
+
process.exit = ((c) => {
|
|
385
|
+
throw new CommandExit(c ?? 0);
|
|
386
|
+
});
|
|
387
|
+
try {
|
|
388
|
+
await program.parseAsync(['node', 'scalebun', ...argv]);
|
|
389
|
+
}
|
|
390
|
+
catch (err) {
|
|
391
|
+
if (err instanceof CommandExit) {
|
|
392
|
+
code = err.code;
|
|
393
|
+
}
|
|
394
|
+
else if (err && typeof err === 'object' && 'exitCode' in err) {
|
|
395
|
+
// commander's exitOverride error — it already printed its own message.
|
|
396
|
+
code = Number(err.exitCode) || 1;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
console.error(chalk_1.default.red(`error: ${err instanceof Error ? err.message : String(err)}`));
|
|
400
|
+
code = 1;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
finally {
|
|
404
|
+
process.exit = realExit;
|
|
405
|
+
// A command that left a prompt open would keep reading the keys meant for
|
|
406
|
+
// the next frame's menu.
|
|
407
|
+
(0, prompt_1.closePrompts)();
|
|
408
|
+
}
|
|
409
|
+
return code;
|
|
410
|
+
}
|
|
411
|
+
async function runShell(program) {
|
|
412
|
+
// A session in CI is a hang waiting to happen. Refuse rather than block.
|
|
413
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
414
|
+
console.error('❌ `scalebun shell` needs an interactive terminal.');
|
|
415
|
+
console.error(' In a script or CI, run the commands directly.');
|
|
416
|
+
process.exit(1);
|
|
417
|
+
}
|
|
418
|
+
sessionActive = true;
|
|
419
|
+
// Commander must not kill the process on a parse error inside the session.
|
|
420
|
+
program.exitOverride();
|
|
421
|
+
const history = loadHistory();
|
|
422
|
+
const art = sessionArt();
|
|
423
|
+
const loadedStamp = codeStamp();
|
|
424
|
+
try {
|
|
425
|
+
// A follow-up picked from the last command's result. It runs straight
|
|
426
|
+
// away on the next turn, without a detour through the menu.
|
|
427
|
+
let pending = null;
|
|
428
|
+
for (;;) {
|
|
429
|
+
let argv;
|
|
430
|
+
if (pending) {
|
|
431
|
+
argv = pending;
|
|
432
|
+
pending = null;
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
const choice = await (0, menu_1.menu)({
|
|
436
|
+
art,
|
|
437
|
+
// Evaluated on every frame, because the upgrade lands while the menu
|
|
438
|
+
// is sitting open — which is exactly when nobody is looking for it.
|
|
439
|
+
notice: () => codeStamp() !== loadedStamp
|
|
440
|
+
? 'scalebun was updated on disk — this session still runs the older build. Exit and reopen.'
|
|
441
|
+
: undefined,
|
|
442
|
+
});
|
|
443
|
+
if (choice.kind === 'quit')
|
|
444
|
+
break;
|
|
445
|
+
if (choice.kind === 'type') {
|
|
446
|
+
const line = await readCommandLine(choice.seed, history);
|
|
447
|
+
if (line === null)
|
|
448
|
+
continue;
|
|
449
|
+
argv = stripPrefix(tokenize(line.trim()));
|
|
450
|
+
if (!argv.length)
|
|
451
|
+
continue;
|
|
452
|
+
const head = argv[0].toLowerCase();
|
|
453
|
+
if (head === 'exit' || head === 'quit' || head === 'q')
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
argv = choice.argv;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
// Give the command a clean screen and say what is running: after the
|
|
461
|
+
// menu disappears there is otherwise nothing on screen explaining where
|
|
462
|
+
// this output came from.
|
|
463
|
+
process.stdout.write('\x1b[H\x1b[2J\x1b[3J');
|
|
464
|
+
console.log(chalk_1.default.dim(' › ') + chalk_1.default.cyan(`scalebun ${argv.join(' ')}`));
|
|
465
|
+
// Repeated here because this is where the surprise happens: the command
|
|
466
|
+
// output is what looks wrong, so the reason belongs beside it.
|
|
467
|
+
if (codeStamp() !== loadedStamp) {
|
|
468
|
+
console.log(chalk_1.default.yellow(' ⚠ Running the build this session loaded, not the one now on disk.'));
|
|
469
|
+
console.log(chalk_1.default.dim(' Exit and reopen to pick it up.'));
|
|
470
|
+
}
|
|
471
|
+
console.log('');
|
|
472
|
+
const code = await runOnce(program, argv);
|
|
473
|
+
// The command may have advised what to do next. Those lines were already
|
|
474
|
+
// printed as prose — inside a session that knows how to run commands,
|
|
475
|
+
// asking the user to retype them is absurd. Offer them as a choice.
|
|
476
|
+
//
|
|
477
|
+
// Hold the output either way: redrawing the moment a command exits would
|
|
478
|
+
// wipe the result of whatever they just ran.
|
|
479
|
+
const steps = (0, output_1.takeNextSteps)();
|
|
480
|
+
if (steps.length) {
|
|
481
|
+
pending = await chooseNextStep(steps, code);
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
await pressAnyKey(code === 0
|
|
485
|
+
? ' press any key to go back'
|
|
486
|
+
: ` exit ${code} · press any key to go back`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
finally {
|
|
491
|
+
sessionActive = false;
|
|
492
|
+
saveHistory(history);
|
|
493
|
+
// Leave the terminal exactly as it was found: screen cleared of the menu,
|
|
494
|
+
// cursor visible, cooked mode. Quitting is not an event that needs
|
|
495
|
+
// announcing — the user is back at their own prompt, which is the whole
|
|
496
|
+
// message. A parting line just means the first thing in their scrollback
|
|
497
|
+
// is the CLI talking about itself.
|
|
498
|
+
process.stdout.write('\x1b[H\x1b[2J\x1b[3J\x1b[?25h');
|
|
499
|
+
if (process.stdin.isTTY)
|
|
500
|
+
process.stdin.setRawMode(false);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function registerShellCommand(program) {
|
|
504
|
+
program
|
|
505
|
+
.command('shell')
|
|
506
|
+
.alias('repl')
|
|
507
|
+
.description('Open an interactive session — run commands without retyping "scalebun"')
|
|
508
|
+
.action(async () => {
|
|
509
|
+
await runShell(program);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/commands/shell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,4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