@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
package/lib/index.js
CHANGED
|
@@ -20,6 +20,15 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
20
20
|
const ui_1 = require("./utils/ui");
|
|
21
21
|
const banner_1 = require("./ui/banner");
|
|
22
22
|
const graphics_1 = require("./ui/graphics");
|
|
23
|
+
// Shared with quickstart's native-wiring step — one resolver, one behaviour.
|
|
24
|
+
const sdkBin_1 = require("./utils/sdkBin");
|
|
25
|
+
const link_1 = require("./commands/link");
|
|
26
|
+
const shell_1 = require("./commands/shell");
|
|
27
|
+
const ota_inspect_1 = require("./commands/ota-inspect");
|
|
28
|
+
const ota_promote_1 = require("./commands/ota-promote");
|
|
29
|
+
const context_1 = require("./utils/context");
|
|
30
|
+
const guide_1 = require("./utils/guide");
|
|
31
|
+
const output_1 = require("./utils/output");
|
|
23
32
|
const program = new commander_1.Command();
|
|
24
33
|
// Kept in one place so the block-art and sixel paths show the same tagline.
|
|
25
34
|
const TAGLINE = 'Enterprise OTA Update & Telemetry Control Plane';
|
|
@@ -51,7 +60,98 @@ async function printSplash() {
|
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
(0, ui_1.renderStatus)();
|
|
54
|
-
|
|
63
|
+
// The command list is now stage-aware: stage 0 shows one command, stage 4
|
|
64
|
+
// shows the full grouped surface. See utils/guide.ts for why the stage is
|
|
65
|
+
// derived rather than stored.
|
|
66
|
+
const ctx = (0, context_1.getContext)();
|
|
67
|
+
(0, guide_1.renderContextLine)(ctx);
|
|
68
|
+
(0, guide_1.renderGuide)(ctx);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Should a bare `scalebun` hand over to the interactive session?
|
|
72
|
+
*
|
|
73
|
+
* The splash was a dead end: it printed a list of commands and exited, so the
|
|
74
|
+
* promise of "you don't have to type `scalebun` every time" was only reachable
|
|
75
|
+
* by typing `scalebun shell` — a mode you had to already know about, since the
|
|
76
|
+
* splash did not mention it below stage 4.
|
|
77
|
+
*
|
|
78
|
+
* Every guard below is a way this could hang something that cannot answer a
|
|
79
|
+
* prompt. A pipe (`scalebun | head`), a redirect, a CI runner, and machine mode
|
|
80
|
+
* all take the old path: print, exit, done. `SCALEBUN_NO_SHELL=1` is the escape
|
|
81
|
+
* hatch for a human who wants the splash and their prompt back.
|
|
82
|
+
*/
|
|
83
|
+
function shouldEnterShell() {
|
|
84
|
+
if (process.env.SCALEBUN_NO_SHELL === '1')
|
|
85
|
+
return false;
|
|
86
|
+
if (process.env.CI === 'true')
|
|
87
|
+
return false;
|
|
88
|
+
if ((0, output_1.isJson)())
|
|
89
|
+
return false;
|
|
90
|
+
if ((0, shell_1.inShell)())
|
|
91
|
+
return false;
|
|
92
|
+
return !!process.stdin.isTTY && !!process.stdout.isTTY;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* What `scalebun` with no command does.
|
|
96
|
+
*
|
|
97
|
+
* On a terminal it IS the session — the menu draws its own frame (art, status,
|
|
98
|
+
* project, commands) and redraws it after every command, so printing a splash
|
|
99
|
+
* first would only be erased a frame later. Everywhere else it stays exactly
|
|
100
|
+
* what it was: print and exit.
|
|
101
|
+
*/
|
|
102
|
+
async function runBareInvocation() {
|
|
103
|
+
if (shouldEnterShell()) {
|
|
104
|
+
await (0, shell_1.runShell)(program);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
await printSplash();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Honour --json / --non-interactive before commander parses.
|
|
111
|
+
*
|
|
112
|
+
* Commander does not surface root options to subcommand handlers, so the flag
|
|
113
|
+
* is read from argv directly — the same argv-sniff precedent `--verbose`
|
|
114
|
+
* already uses in utils/ui.ts.
|
|
115
|
+
*/
|
|
116
|
+
function applyGlobalFlags(argv) {
|
|
117
|
+
if (argv.includes('--json'))
|
|
118
|
+
(0, output_1.setJsonMode)(true);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Commands that live in @scalebun/react-native's bin, not here.
|
|
122
|
+
*
|
|
123
|
+
* `init android` / `init ios` wire the host app's native files for OTA — they
|
|
124
|
+
* need the SDK package's codemods, so they ship with the SDK. But this CLI's
|
|
125
|
+
* own splash lists `scalebun init android` as step 3 of the getting-started
|
|
126
|
+
* flow, so when THIS binary wins the `scalebun` bin race it must forward the
|
|
127
|
+
* command rather than swallow it. (The SDK bin already forwards `ota …` the
|
|
128
|
+
* other way — this closes the loop so both binaries expose the same surface.)
|
|
129
|
+
*/
|
|
130
|
+
const SDK_BIN_COMMANDS = new Set(['init']);
|
|
131
|
+
/**
|
|
132
|
+
* Handle argv that matched no registered command.
|
|
133
|
+
*
|
|
134
|
+
* This used to fall through to the root action, print the splash, and EXIT 0 —
|
|
135
|
+
* so `scalebun init android` (listed on our own splash) and any typo reported
|
|
136
|
+
* success while doing nothing. In CI that green exit is actively dangerous:
|
|
137
|
+
* a misspelled publish step passes the pipeline having published nothing.
|
|
138
|
+
*/
|
|
139
|
+
function handleUnmatchedCommand(argv) {
|
|
140
|
+
const cmd = argv[0];
|
|
141
|
+
if (SDK_BIN_COMMANDS.has(cmd)) {
|
|
142
|
+
const sdkBin = (0, sdkBin_1.resolveSdkBin)();
|
|
143
|
+
if (sdkBin) {
|
|
144
|
+
process.exit((0, sdkBin_1.runSdkBin)(sdkBin, argv));
|
|
145
|
+
}
|
|
146
|
+
console.error(`"scalebun ${cmd}" wires the native app and is provided by @scalebun/react-native.`);
|
|
147
|
+
console.error('It could not be resolved from here. Run this from your app root (the');
|
|
148
|
+
console.error('folder with node_modules/@scalebun/react-native), or install the SDK:');
|
|
149
|
+
console.error(' npm install @scalebun/react-native');
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
console.error(`error: unknown command '${cmd}'`);
|
|
153
|
+
console.error("Run `scalebun --help` for the list of commands.");
|
|
154
|
+
process.exit(1);
|
|
55
155
|
}
|
|
56
156
|
program
|
|
57
157
|
.name('scalebun')
|
|
@@ -61,8 +161,25 @@ program
|
|
|
61
161
|
// directly (shouldShowArt / renderStatus), so these just keep commander happy.
|
|
62
162
|
.option('--no-banner', 'Hide the splash art (status + commands still print)')
|
|
63
163
|
.option('--verbose', 'Show extra detail (e.g. the API target in the status box)')
|
|
64
|
-
.
|
|
65
|
-
|
|
164
|
+
// Machine mode. Also honoured from SCALEBUN_JSON=1 so a CI job can set it
|
|
165
|
+
// once for the whole pipeline instead of on every invocation. Declared here
|
|
166
|
+
// so `--help` documents it; each command reads it via utils/output.
|
|
167
|
+
.option('--json', 'Machine-readable output; implies --non-interactive')
|
|
168
|
+
.option('--non-interactive', 'Never prompt — fail with the flag to pass instead')
|
|
169
|
+
// The variadic catch-all is what routes unmatched tokens into an explicit
|
|
170
|
+
// handler instead of commander's permissive default (which treated them as
|
|
171
|
+
// excess arguments to the root action and exited 0).
|
|
172
|
+
.argument('[command...]')
|
|
173
|
+
// ROOT ONLY (subcommands keep strict parsing): forwarded commands carry
|
|
174
|
+
// their own flags — `init android --check` — and without this the root
|
|
175
|
+
// parser rejects `--check` before the forwarder ever sees it.
|
|
176
|
+
.allowUnknownOption()
|
|
177
|
+
.action(async (extra) => {
|
|
178
|
+
if (!extra || extra.length === 0) {
|
|
179
|
+
await runBareInvocation();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
handleUnmatchedCommand(extra);
|
|
66
183
|
});
|
|
67
184
|
// `registerLoginCommand` was imported and never called, so `scalebun login`
|
|
68
185
|
// did not exist — every other command depends on the credentials it writes,
|
|
@@ -71,6 +188,8 @@ program
|
|
|
71
188
|
(0, quickstart_1.registerQuickstartCommand)(program);
|
|
72
189
|
(0, quickstart_1.registerAppsCommand)(program);
|
|
73
190
|
(0, doctor_1.registerDoctorCommand)(program);
|
|
191
|
+
(0, link_1.registerLinkCommands)(program);
|
|
192
|
+
(0, shell_1.registerShellCommand)(program);
|
|
74
193
|
const ota = program.command('ota').description('OTA update management');
|
|
75
194
|
(0, ota_publish_1.registerOtaPublishCommand)(ota);
|
|
76
195
|
(0, ota_bundle_1.registerOtaBundleCommand)(ota);
|
|
@@ -78,12 +197,29 @@ const ota = program.command('ota').description('OTA update management');
|
|
|
78
197
|
(0, ota_delete_bundle_1.registerOtaDeleteBundleCommand)(ota);
|
|
79
198
|
(0, ota_keys_1.registerOtaKeysCommand)(ota);
|
|
80
199
|
(0, ota_rollout_1.registerOtaRolloutCommands)(ota);
|
|
200
|
+
(0, ota_inspect_1.registerOtaInspectCommands)(ota);
|
|
201
|
+
(0, ota_promote_1.registerOtaPromoteCommand)(ota);
|
|
81
202
|
(0, launch_1.registerLaunchCommand)(program);
|
|
203
|
+
/**
|
|
204
|
+
* `scalebun help [--all]` — the escape hatch from the staged splash.
|
|
205
|
+
*
|
|
206
|
+
* The splash shows only what is relevant to the current stage, which is right
|
|
207
|
+
* for a newcomer and wrong for anyone who already knows the tool. This always
|
|
208
|
+
* prints the full grouped surface, at any stage.
|
|
209
|
+
*/
|
|
210
|
+
program
|
|
211
|
+
.command('help')
|
|
212
|
+
.description('Show every command, grouped by task')
|
|
213
|
+
.option('--all', 'Print every command regardless of project stage')
|
|
214
|
+
.action(() => {
|
|
215
|
+
(0, guide_1.renderAllCommands)();
|
|
216
|
+
});
|
|
82
217
|
const migrate = program.command('migrate').description('Migration utilities from other platforms');
|
|
83
218
|
(0, migrate_codepush_1.registerMigrateCodepushCommand)(migrate);
|
|
84
219
|
(0, ci_init_1.registerCiInitCommand)(program);
|
|
220
|
+
applyGlobalFlags(process.argv);
|
|
85
221
|
if (process.argv.length <= 2) {
|
|
86
|
-
void
|
|
222
|
+
void runBareInvocation();
|
|
87
223
|
}
|
|
88
224
|
else {
|
|
89
225
|
program.parse(process.argv);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,4CAAwD;AACxD,8CAA0D;AAC1D,wDAAmE;AACnE,sDAAiE;AACjE,0DAAqE;AACrE,oEAA8E;AAC9E,kDAA6D;AAC7D,wDAAoE;AACpE,8CAA0D;AAC1D,kEAA6E;AAC7E,gDAA2D;AAC3D,sDAAuF;AACvF,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,4CAAwD;AACxD,8CAA0D;AAC1D,wDAAmE;AACnE,sDAAiE;AACjE,0DAAqE;AACrE,oEAA8E;AAC9E,kDAA6D;AAC7D,wDAAoE;AACpE,8CAA0D;AAC1D,kEAA6E;AAC7E,gDAA2D;AAC3D,sDAAuF;AACvF,kDAA0B;AAC1B,mCAA0C;AAC1C,wCAA8D;AAC9D,4CAAqD;AACrD,6EAA6E;AAC7E,2CAA0D;AAC1D,0CAAuD;AACvD,4CAA2E;AAC3E,wDAAoE;AACpE,wDAAmE;AACnE,6CAA6C;AAC7C,yCAAkF;AAClF,2CAAqD;AAErD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,4EAA4E;AAC5E,MAAM,OAAO,GAAG,iDAAiD,CAAC;AAElE,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,mCAAmC;AACnC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE;;;;;;;GAOG;AACH,KAAK,UAAU,WAAW;IACxB,IAAI,IAAA,sBAAa,GAAE,EAAE,CAAC;QACpB,6EAA6E;QAC7E,4EAA4E;QAC5E,8EAA8E;QAC9E,4EAA4E;QAC5E,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC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,CAAC,CAAC;AAC5B,IAAA,wCAA0B,EAAC,GAAG,CAAC,CAAC;AAChC,IAAA,wCAA0B,EAAC,GAAG,CAAC,CAAC;AAChC,IAAA,uCAAyB,EAAC,GAAG,CAAC,CAAC;AAC/B,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;AAE/B;;;;;;GAMG;AACH,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,qCAAqC,CAAC;KAClD,MAAM,CAAC,OAAO,EAAE,iDAAiD,CAAC;KAClE,MAAM,CAAC,GAAG,EAAE;IACX,IAAA,yBAAiB,GAAE,CAAC;AACtB,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;AACnG,IAAA,iDAA8B,EAAC,OAAO,CAAC,CAAC;AACxC,IAAA,+BAAqB,EAAC,OAAO,CAAC,CAAC;AAE/B,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC7B,KAAK,iBAAiB,EAAE,CAAC;AAC3B,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
package/lib/ui/menu.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The interactive home screen — arrow keys through the grouped commands.
|
|
3
|
+
*
|
|
4
|
+
* ── Why a menu and not just a prompt ────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* A bare prompt only helps someone who already knows what to type, which is
|
|
7
|
+
* precisely the person who did not need an interactive mode. Printing all
|
|
8
|
+
* thirty commands instead solves discovery and destroys it in the same breath:
|
|
9
|
+
* a wall of cyan has no shape, so nothing stands out. Grouping and then
|
|
10
|
+
* revealing one group at a time keeps the whole surface reachable while never
|
|
11
|
+
* showing more than about five things at once.
|
|
12
|
+
*
|
|
13
|
+
* Typing still works, and works from the menu — any printable key opens the
|
|
14
|
+
* command line seeded with that character. So the menu is a floor, not a
|
|
15
|
+
* ceiling: it never stands between an experienced user and the thing they were
|
|
16
|
+
* going to type anyway.
|
|
17
|
+
*
|
|
18
|
+
* ── The frame must FIT ──────────────────────────────────────────────────────
|
|
19
|
+
*
|
|
20
|
+
* This is the whole ballgame, and getting it wrong is not a cosmetic bug.
|
|
21
|
+
* Logo, status box, project line, group header and the ten SETUP commands come
|
|
22
|
+
* to 32 lines; a normal terminal is 24 to 30. Overflow does not merely crop —
|
|
23
|
+
* the terminal scrolls to fit, so the next frame's `\x1b[H` (cursor home) lands
|
|
24
|
+
* at the top of the VIEWPORT rather than the top of the frame, and each redraw
|
|
25
|
+
* paints over a shifting target. Within a few keypresses the screen is a
|
|
26
|
+
* collage of half-frames, arrow keys appear to do nothing, and the session
|
|
27
|
+
* looks hung when it is in fact working perfectly.
|
|
28
|
+
*
|
|
29
|
+
* So the frame is budgeted against `stdout.rows` and the command list is
|
|
30
|
+
* windowed to whatever is left. The logo is never what gets sacrificed — it is
|
|
31
|
+
* the reason for coming back to this screen — so the list scrolls instead.
|
|
32
|
+
*
|
|
33
|
+
* Frames are composed in memory and written ONCE. Sequential console.log calls
|
|
34
|
+
* tear visibly: the terminal paints each line as it arrives, so an arrow key
|
|
35
|
+
* produces a flicker of half-drawn screen.
|
|
36
|
+
*/
|
|
37
|
+
export type MenuChoice = {
|
|
38
|
+
kind: 'run';
|
|
39
|
+
argv: string[];
|
|
40
|
+
}
|
|
41
|
+
/** The user started typing; `seed` is the character that triggered it. */
|
|
42
|
+
| {
|
|
43
|
+
kind: 'type';
|
|
44
|
+
seed: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'quit';
|
|
47
|
+
};
|
|
48
|
+
export interface MenuDeps {
|
|
49
|
+
/**
|
|
50
|
+
* Splash art, rendered ONCE by the caller and reused for every frame.
|
|
51
|
+
* Detecting terminal capabilities means writing to stdin and waiting for a
|
|
52
|
+
* reply, which is impossible while the menu owns raw mode.
|
|
53
|
+
*/
|
|
54
|
+
art: string;
|
|
55
|
+
/**
|
|
56
|
+
* A line that must not be dropped by the layout ladder — currently the
|
|
57
|
+
* "your session is running stale code" warning, which is worthless if it is
|
|
58
|
+
* the first thing sacrificed on a short terminal.
|
|
59
|
+
*
|
|
60
|
+
* A FUNCTION, not a string: the menu can sit open for a long time, and the
|
|
61
|
+
* condition it reports (an upgrade landing on disk) happens while it sits
|
|
62
|
+
* there. Passing a string would freeze the answer at the moment the menu was
|
|
63
|
+
* entered, so the warning would only appear after running an unrelated
|
|
64
|
+
* command — by which point the user has already hit the stale behaviour.
|
|
65
|
+
*/
|
|
66
|
+
notice?: () => string | undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Split one stdin chunk into individual keypresses.
|
|
70
|
+
*
|
|
71
|
+
* stdin delivers BYTES, not keys. Press two arrows faster than the event loop
|
|
72
|
+
* drains stdin — which is just "press them quickly" — and both arrive in a
|
|
73
|
+
* single chunk as `\x1b[B\x1b[B`. Comparing the whole chunk against a table of
|
|
74
|
+
* key sequences matches nothing, so the keys are silently dropped and the menu
|
|
75
|
+
* looks frozen. The same happens to a held-down arrow and to any paste.
|
|
76
|
+
*
|
|
77
|
+
* Escape sequences are ESC, an introducer (`[` for CSI, `O` for SS3), then
|
|
78
|
+
* parameter bytes up to a final byte in the 0x40-0x7E range. A lone ESC with
|
|
79
|
+
* nothing after it is the Escape key.
|
|
80
|
+
*/
|
|
81
|
+
export declare function splitKeys(chunk: string): string[];
|
|
82
|
+
export interface FrameInput {
|
|
83
|
+
/** Terminal height. The frame is built to fit in `rows - 1`. */
|
|
84
|
+
rows: number;
|
|
85
|
+
art: string[];
|
|
86
|
+
status: string[];
|
|
87
|
+
/** Project line, stage hint — kept when they fit, dropped before the logo. */
|
|
88
|
+
extras: string[];
|
|
89
|
+
title: string[];
|
|
90
|
+
items: string[];
|
|
91
|
+
/** Index into `items` that must stay visible. */
|
|
92
|
+
active: number;
|
|
93
|
+
footer: string;
|
|
94
|
+
/** Always rendered, never traded away for space. */
|
|
95
|
+
notice?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Compose one frame that fits.
|
|
99
|
+
*
|
|
100
|
+
* Pure, and exported, because the fit is the invariant that matters and it is
|
|
101
|
+
* invisible until it breaks: an overflowing frame scrolls the terminal, so the
|
|
102
|
+
* next redraw's cursor-home lands somewhere other than the top of the frame and
|
|
103
|
+
* the screen degrades into a collage of half-frames. That reads as a hung
|
|
104
|
+
* session, not as a layout bug, which is what makes it worth a test rather than
|
|
105
|
+
* an eyeball.
|
|
106
|
+
*/
|
|
107
|
+
export declare function composeFrame(input: FrameInput): string[];
|
|
108
|
+
export declare function menu(deps: MenuDeps): Promise<MenuChoice>;
|
|
109
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/ui/menu.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE;AACjC,0EAA0E;GACxE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CACnC;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBjD;AAyCD,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,CA0DxD;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CA8JxD"}
|
package/lib/ui/menu.js
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.splitKeys = splitKeys;
|
|
7
|
+
exports.composeFrame = composeFrame;
|
|
8
|
+
exports.menu = menu;
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const ui_1 = require("../utils/ui");
|
|
11
|
+
const context_1 = require("../utils/context");
|
|
12
|
+
const guide_1 = require("../utils/guide");
|
|
13
|
+
const KEY = {
|
|
14
|
+
up: ['\x1b[A', '\x1bOA'],
|
|
15
|
+
down: ['\x1b[B', '\x1bOB'],
|
|
16
|
+
right: ['\x1b[C', '\x1bOC'],
|
|
17
|
+
left: ['\x1b[D', '\x1bOD'],
|
|
18
|
+
enter: ['\r', '\n'],
|
|
19
|
+
esc: '\x1b',
|
|
20
|
+
ctrlC: '\x03',
|
|
21
|
+
backspace: ['\x7f', '\b'],
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Split one stdin chunk into individual keypresses.
|
|
25
|
+
*
|
|
26
|
+
* stdin delivers BYTES, not keys. Press two arrows faster than the event loop
|
|
27
|
+
* drains stdin — which is just "press them quickly" — and both arrive in a
|
|
28
|
+
* single chunk as `\x1b[B\x1b[B`. Comparing the whole chunk against a table of
|
|
29
|
+
* key sequences matches nothing, so the keys are silently dropped and the menu
|
|
30
|
+
* looks frozen. The same happens to a held-down arrow and to any paste.
|
|
31
|
+
*
|
|
32
|
+
* Escape sequences are ESC, an introducer (`[` for CSI, `O` for SS3), then
|
|
33
|
+
* parameter bytes up to a final byte in the 0x40-0x7E range. A lone ESC with
|
|
34
|
+
* nothing after it is the Escape key.
|
|
35
|
+
*/
|
|
36
|
+
function splitKeys(chunk) {
|
|
37
|
+
const keys = [];
|
|
38
|
+
let i = 0;
|
|
39
|
+
while (i < chunk.length) {
|
|
40
|
+
if (chunk[i] === '\x1b' && (chunk[i + 1] === '[' || chunk[i + 1] === 'O')) {
|
|
41
|
+
let j = i + 2;
|
|
42
|
+
// Parameter and intermediate bytes come before the final byte.
|
|
43
|
+
while (j < chunk.length && chunk[j] >= '0' && chunk[j] <= '?')
|
|
44
|
+
j++;
|
|
45
|
+
keys.push(chunk.slice(i, j + 1));
|
|
46
|
+
i = j + 1;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
keys.push(chunk[i]);
|
|
50
|
+
i += 1;
|
|
51
|
+
}
|
|
52
|
+
return keys;
|
|
53
|
+
}
|
|
54
|
+
/** Widest label in a list, so descriptions line up in one column. */
|
|
55
|
+
function column(labels) {
|
|
56
|
+
return labels.reduce((w, l) => Math.max(w, l.length), 0);
|
|
57
|
+
}
|
|
58
|
+
function lines(s) {
|
|
59
|
+
return s.replace(/\n+$/, '').split('\n');
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Show at most `max` items, keeping the cursor in view.
|
|
63
|
+
*
|
|
64
|
+
* Two rows are given up to the more-markers only when there is something to
|
|
65
|
+
* mark, and the window is clamped to the ends of the list so the last item is
|
|
66
|
+
* reachable rather than always leaving the cursor mid-screen.
|
|
67
|
+
*/
|
|
68
|
+
function windowItems(items, active, max) {
|
|
69
|
+
if (max <= 0)
|
|
70
|
+
return [];
|
|
71
|
+
if (items.length <= max)
|
|
72
|
+
return items;
|
|
73
|
+
// Below three rows there is no room for an item AND its markers, and
|
|
74
|
+
// returning them anyway would overflow the very budget this exists to
|
|
75
|
+
// respect. Show the cursor row alone — the caller's plan ladder makes this
|
|
76
|
+
// unreachable today, but a future layout must not be able to break the fit
|
|
77
|
+
// by asking for a smaller list.
|
|
78
|
+
if (max < 3)
|
|
79
|
+
return [items[active]].slice(0, max);
|
|
80
|
+
const inner = Math.max(1, max - 2);
|
|
81
|
+
const start = Math.max(0, Math.min(active - Math.floor(inner / 2), items.length - inner));
|
|
82
|
+
const end = start + inner;
|
|
83
|
+
const above = start;
|
|
84
|
+
const below = items.length - end;
|
|
85
|
+
return [
|
|
86
|
+
chalk_1.default.dim(above > 0 ? ` ↑ ${above} more` : ''),
|
|
87
|
+
...items.slice(start, end),
|
|
88
|
+
chalk_1.default.dim(below > 0 ? ` ↓ ${below} more` : ''),
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Compose one frame that fits.
|
|
93
|
+
*
|
|
94
|
+
* Pure, and exported, because the fit is the invariant that matters and it is
|
|
95
|
+
* invisible until it breaks: an overflowing frame scrolls the terminal, so the
|
|
96
|
+
* next redraw's cursor-home lands somewhere other than the top of the frame and
|
|
97
|
+
* the screen degrades into a collage of half-frames. That reads as a hung
|
|
98
|
+
* session, not as a layout bug, which is what makes it worth a test rather than
|
|
99
|
+
* an eyeball.
|
|
100
|
+
*/
|
|
101
|
+
function composeFrame(input) {
|
|
102
|
+
// One row is left unused on purpose: writing the very last line of a
|
|
103
|
+
// terminal scrolls it by one, which is the same overflow this budget exists
|
|
104
|
+
// to prevent.
|
|
105
|
+
const rows = Math.max(8, input.rows - 1);
|
|
106
|
+
const build = (show) => {
|
|
107
|
+
const head = [];
|
|
108
|
+
if (show.status)
|
|
109
|
+
head.push(...input.status);
|
|
110
|
+
if (show.extras)
|
|
111
|
+
head.push(...input.extras);
|
|
112
|
+
head.push('');
|
|
113
|
+
const top = show.art ? input.art : [];
|
|
114
|
+
// rows - top - head - title - (blank + footer)
|
|
115
|
+
return {
|
|
116
|
+
top,
|
|
117
|
+
head,
|
|
118
|
+
budget: rows - top.length - head.length - input.title.length - 2 - (input.notice ? 1 : 0),
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
// Progressive degradation, in the order things are worth losing.
|
|
122
|
+
//
|
|
123
|
+
// The status box goes FIRST. It says you are authenticated, which `doctor`
|
|
124
|
+
// will tell you and which you will find out the moment you run anything.
|
|
125
|
+
// `extras` is the project line — which app and channel you are pointed at —
|
|
126
|
+
// and on a tool that can roll back production for every device, knowing the
|
|
127
|
+
// target beats knowing the login state.
|
|
128
|
+
//
|
|
129
|
+
// The logo goes LAST, because it is the reason for coming back to this
|
|
130
|
+
// screen rather than staying in the scrollback of the last command.
|
|
131
|
+
//
|
|
132
|
+
// Three visible rows is the floor for a list still being navigable.
|
|
133
|
+
const PLANS = [
|
|
134
|
+
{ art: true, status: true, extras: true },
|
|
135
|
+
{ art: true, status: false, extras: true },
|
|
136
|
+
{ art: true, status: false, extras: false },
|
|
137
|
+
{ art: false, status: true, extras: true },
|
|
138
|
+
{ art: false, status: false, extras: true },
|
|
139
|
+
{ art: false, status: false, extras: false },
|
|
140
|
+
];
|
|
141
|
+
let layout = build(PLANS[PLANS.length - 1]);
|
|
142
|
+
for (const plan of PLANS) {
|
|
143
|
+
const candidate = build(plan);
|
|
144
|
+
if (candidate.budget >= 3) {
|
|
145
|
+
layout = candidate;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return [
|
|
150
|
+
...layout.top,
|
|
151
|
+
...layout.head,
|
|
152
|
+
...input.title,
|
|
153
|
+
...windowItems(input.items, input.active, layout.budget),
|
|
154
|
+
...(input.notice ? [chalk_1.default.yellow(` ⚠ ${input.notice}`)] : []),
|
|
155
|
+
'',
|
|
156
|
+
input.footer,
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
function menu(deps) {
|
|
160
|
+
return new Promise((resolve) => {
|
|
161
|
+
const stdin = process.stdin;
|
|
162
|
+
const stdout = process.stdout;
|
|
163
|
+
/** null = looking at the group list; a number = inside that group. */
|
|
164
|
+
let openGroup = null;
|
|
165
|
+
let groupIdx = 0;
|
|
166
|
+
let cmdIdx = 0;
|
|
167
|
+
/** Title block, selectable rows, and the key hint — before any windowing. */
|
|
168
|
+
const parts = () => {
|
|
169
|
+
if (openGroup === null) {
|
|
170
|
+
const width = column(guide_1.GROUPS.map((g) => g.title));
|
|
171
|
+
return {
|
|
172
|
+
title: [` ${chalk_1.default.bold.white('WHAT DO YOU WANT TO DO?')}`, ''],
|
|
173
|
+
items: guide_1.GROUPS.map((g, i) => {
|
|
174
|
+
const on = i === groupIdx;
|
|
175
|
+
const pointer = on ? chalk_1.default.cyan('❯') : ' ';
|
|
176
|
+
const t = g.title.padEnd(width);
|
|
177
|
+
return ` ${pointer} ${on ? chalk_1.default.bold.cyan(t) : chalk_1.default.white(t)} ${chalk_1.default.dim(g.summary)}`;
|
|
178
|
+
}),
|
|
179
|
+
footer: chalk_1.default.dim(' ↑↓ move · ↵ open · type to run a command · esc quit'),
|
|
180
|
+
active: groupIdx,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const g = guide_1.GROUPS[openGroup];
|
|
184
|
+
const labels = g.commands.map((c) => c.argv.join(' '));
|
|
185
|
+
const width = column(labels);
|
|
186
|
+
return {
|
|
187
|
+
title: [
|
|
188
|
+
` ${chalk_1.default.bold.white(g.title)} ${chalk_1.default.dim(g.summary)}`,
|
|
189
|
+
'',
|
|
190
|
+
],
|
|
191
|
+
items: g.commands.map((c, i) => {
|
|
192
|
+
const on = i === cmdIdx;
|
|
193
|
+
const pointer = on ? chalk_1.default.cyan('❯') : ' ';
|
|
194
|
+
const label = labels[i].padEnd(width);
|
|
195
|
+
return ` ${pointer} ${on ? chalk_1.default.bold.cyan(label) : chalk_1.default.cyan(label)} ${chalk_1.default.dim(c.desc)}`;
|
|
196
|
+
}),
|
|
197
|
+
footer: chalk_1.default.dim(' ↑↓ move · ↵ run · ← back · esc back · type to run a command'),
|
|
198
|
+
active: cmdIdx,
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
const draw = () => {
|
|
202
|
+
const ctx = (0, context_1.getContext)();
|
|
203
|
+
const { title, items, footer, active } = parts();
|
|
204
|
+
const extras = [];
|
|
205
|
+
const ctxLine = (0, guide_1.contextLineText)(ctx);
|
|
206
|
+
if (ctxLine)
|
|
207
|
+
extras.push(ctxLine);
|
|
208
|
+
const hint = (0, guide_1.nextStepHint)(ctx);
|
|
209
|
+
if (hint)
|
|
210
|
+
extras.push(hint);
|
|
211
|
+
const frame = composeFrame({
|
|
212
|
+
rows: stdout.rows ?? 24,
|
|
213
|
+
notice: deps.notice?.(),
|
|
214
|
+
art: deps.art ? lines(deps.art) : [],
|
|
215
|
+
status: lines((0, ui_1.statusText)()),
|
|
216
|
+
extras,
|
|
217
|
+
title,
|
|
218
|
+
items,
|
|
219
|
+
active,
|
|
220
|
+
footer,
|
|
221
|
+
});
|
|
222
|
+
// \x1b[H home · \x1b[2J clear the screen · \x1b[3J drop the scrollback a
|
|
223
|
+
// finished command left behind, so nothing can scroll back into view.
|
|
224
|
+
// No trailing newline: that alone would push the frame up by one row.
|
|
225
|
+
stdout.write('\x1b[H\x1b[2J\x1b[3J' + frame.join('\n'));
|
|
226
|
+
};
|
|
227
|
+
let done = false;
|
|
228
|
+
const cleanup = () => {
|
|
229
|
+
if (stdin.isTTY)
|
|
230
|
+
stdin.setRawMode(false);
|
|
231
|
+
stdin.pause();
|
|
232
|
+
stdin.removeListener('data', onData);
|
|
233
|
+
stdout.removeListener('resize', draw);
|
|
234
|
+
stdout.write('\x1b[?25h'); // show cursor
|
|
235
|
+
};
|
|
236
|
+
const finish = (choice) => {
|
|
237
|
+
done = true;
|
|
238
|
+
cleanup();
|
|
239
|
+
resolve(choice);
|
|
240
|
+
};
|
|
241
|
+
const onData = (chunk) => {
|
|
242
|
+
// One chunk can carry several keypresses. Handle each in turn, and stop
|
|
243
|
+
// the moment one of them ends the menu — the rest belong to whatever
|
|
244
|
+
// comes next, not to a menu that is already gone.
|
|
245
|
+
for (const key of splitKeys(chunk)) {
|
|
246
|
+
if (done)
|
|
247
|
+
return;
|
|
248
|
+
handleKey(key, chunk);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
const handleKey = (key, whole) => {
|
|
252
|
+
const list = openGroup === null ? guide_1.GROUPS : guide_1.GROUPS[openGroup].commands;
|
|
253
|
+
const idx = openGroup === null ? groupIdx : cmdIdx;
|
|
254
|
+
const setIdx = (n) => {
|
|
255
|
+
if (openGroup === null)
|
|
256
|
+
groupIdx = n;
|
|
257
|
+
else
|
|
258
|
+
cmdIdx = n;
|
|
259
|
+
};
|
|
260
|
+
const back = () => {
|
|
261
|
+
openGroup = null;
|
|
262
|
+
draw();
|
|
263
|
+
};
|
|
264
|
+
if (KEY.up.includes(key)) {
|
|
265
|
+
setIdx((idx - 1 + list.length) % list.length);
|
|
266
|
+
return draw();
|
|
267
|
+
}
|
|
268
|
+
if (KEY.down.includes(key)) {
|
|
269
|
+
setIdx((idx + 1) % list.length);
|
|
270
|
+
return draw();
|
|
271
|
+
}
|
|
272
|
+
if (KEY.enter.includes(key) || KEY.right.includes(key)) {
|
|
273
|
+
if (openGroup === null) {
|
|
274
|
+
openGroup = groupIdx;
|
|
275
|
+
cmdIdx = 0;
|
|
276
|
+
return draw();
|
|
277
|
+
}
|
|
278
|
+
return finish({ kind: 'run', argv: guide_1.GROUPS[openGroup].commands[cmdIdx].argv });
|
|
279
|
+
}
|
|
280
|
+
if (KEY.left.includes(key) || KEY.backspace.includes(key)) {
|
|
281
|
+
if (openGroup !== null)
|
|
282
|
+
return back();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (key === KEY.esc) {
|
|
286
|
+
if (openGroup !== null)
|
|
287
|
+
return back();
|
|
288
|
+
return finish({ kind: 'quit' });
|
|
289
|
+
}
|
|
290
|
+
if (key === KEY.ctrlC)
|
|
291
|
+
return finish({ kind: 'quit' });
|
|
292
|
+
// Anything printable is the user deciding they would rather type. The
|
|
293
|
+
// seed is the whole printable run from this key, not just the one
|
|
294
|
+
// character: a fast typist or a paste puts several in at once, and
|
|
295
|
+
// seeding only the first would drop the rest on the floor — the same
|
|
296
|
+
// class of bug as dropping a doubled arrow key.
|
|
297
|
+
if (key.length === 1 && key >= ' ' && key !== '\x7f') {
|
|
298
|
+
const printable = whole.length > 1 && /^[ -~]+$/.test(whole) ? whole : key;
|
|
299
|
+
return finish({ kind: 'type', seed: printable === '/' ? '' : printable });
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
stdin.resume();
|
|
303
|
+
stdin.setEncoding('utf8');
|
|
304
|
+
if (stdin.isTTY)
|
|
305
|
+
stdin.setRawMode(true);
|
|
306
|
+
stdout.write('\x1b[?25l'); // hide cursor
|
|
307
|
+
stdin.on('data', onData);
|
|
308
|
+
// Dragging the window smaller changes the budget; without this the frame
|
|
309
|
+
// keeps its old height and starts overflowing again.
|
|
310
|
+
stdout.on('resize', draw);
|
|
311
|
+
draw();
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/ui/menu.ts"],"names":[],"mappings":";;;;;AA6FA,8BAgBC;AAmED,oCA0DC;AAED,oBA8JC;AA1YD,kDAA0B;AAC1B,oCAAyC;AACzC,8CAA8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