@mainwave/cli 0.11.0 → 0.13.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/README.md +203 -16
- package/dist/adapters/claude-code.js +3 -3
- package/dist/adapters/claude-desktop.js +35 -1
- package/dist/adapters/codex-cli.js +16 -16
- package/dist/adapters/cursor.js +7 -2
- package/dist/adapters/kiro.js +13 -8
- package/dist/commands.js +219 -0
- package/dist/core/apply.js +47 -8
- package/dist/core/auth-commands.js +2 -1
- package/dist/core/codecs/kiro-hooks-json.js +1 -1
- package/dist/core/codex-trust.js +178 -0
- package/dist/core/doctor.js +144 -12
- package/dist/core/entry-script.js +2 -3
- package/dist/core/format.js +0 -1
- package/dist/core/hook-copies.js +157 -0
- package/dist/core/install-hooks.js +198 -15
- package/dist/core/interview.js +36 -16
- package/dist/core/markers.js +209 -44
- package/dist/core/redaction.js +188 -0
- package/dist/core/skills.js +3 -11
- package/dist/core/status.js +21 -1
- package/dist/core/store.js +254 -4
- package/dist/core/wizard.js +91 -6
- package/dist/main.js +173 -163
- package/hooks/codex-turns.mjs +584 -0
- package/hooks/kiro-otlp.mjs +10 -1
- package/hooks/mainwave-hook.mjs +27 -3
- package/hooks/marker-core.mjs +66 -8
- package/hooks/matchers.json +98 -1
- package/hooks/redaction-data.mjs +209 -0
- package/hooks/redaction-json.mjs +215 -0
- package/hooks/redaction-pattern.mjs +503 -0
- package/hooks/redaction.d.mts +84 -0
- package/hooks/redaction.mjs +701 -0
- package/hooks/vocabulary.mjs +41 -2
- package/package.json +3 -1
- package/skills/mainwave-instrument/SKILL.md +24 -6
- package/skills/mainwave-instrument/reference/frameworks.md +4 -2
- package/skills/mainwave-instrument/reference/troubleshooting.md +4 -0
- package/skills/mainwave-instrument-node/SKILL.md +83 -38
- package/skills/mainwave-instrument-node/reference/api.md +16 -16
- package/skills/mainwave-instrument-node/reference/frameworks.md +42 -27
- package/skills/mainwave-instrument-node/reference/troubleshooting.md +11 -7
package/dist/main.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { claudeCodeFor } from './adapters/claude-code.js';
|
|
2
|
+
import { codexCli } from './adapters/codex-cli.js';
|
|
2
3
|
import { adapterNames, adapters } from './adapters/index.js';
|
|
4
|
+
import { commandFlags, detailsBlock, isCommand, usageBlock } from './commands.js';
|
|
3
5
|
import { runLogin, runLogout, runWhoami } from './core/auth-commands.js';
|
|
4
6
|
import { runDoctor } from './core/doctor.js';
|
|
5
7
|
import { runEdit } from './core/edit.js';
|
|
6
8
|
import { runEnvCommand } from './core/env-command.js';
|
|
7
9
|
import { PlatformError, WizardAbort } from './core/errors.js';
|
|
8
|
-
import { runInstallHooks, sessionConfigDir } from './core/install-hooks.js';
|
|
9
|
-
import {
|
|
10
|
+
import { runInstallCodexHooks, runInstallHooks, sessionConfigDir } from './core/install-hooks.js';
|
|
11
|
+
import { parseRedactionPacks } from './core/redaction.js';
|
|
12
|
+
import { parseArgs } from './core/flags.js';
|
|
10
13
|
import { color } from './core/format.js';
|
|
11
14
|
import { promptAdapters } from './core/prompts.js';
|
|
12
15
|
import { runStatus } from './core/status.js';
|
|
@@ -15,7 +18,6 @@ import { VERSION } from './core/version.js';
|
|
|
15
18
|
import { runVerify } from './core/verify.js';
|
|
16
19
|
import { runRemove } from './core/remove.js';
|
|
17
20
|
import { runSetup, runSkillsOnly } from './core/wizard.js';
|
|
18
|
-
export { VERSION };
|
|
19
21
|
const printHelp = () => {
|
|
20
22
|
const list = adapterNames()
|
|
21
23
|
.map((n) => ` ${n}`)
|
|
@@ -23,57 +25,10 @@ const printHelp = () => {
|
|
|
23
25
|
console.log(`mainwave-cli — Mainwave AI setup wizard
|
|
24
26
|
|
|
25
27
|
Usage:
|
|
26
|
-
|
|
27
|
-
sign in to Mainwave: shows a code and opens the app to
|
|
28
|
-
approve it. --password uses email + password instead
|
|
29
|
-
(MAINWAVE_EMAIL / MAINWAVE_PASSWORD drive it
|
|
30
|
-
non-interactively); --device forces the browser flow
|
|
31
|
-
without a terminal (coding agents); --no-browser
|
|
32
|
-
prints the URL
|
|
33
|
-
mainwave-cli logout forget the stored session
|
|
34
|
-
mainwave-cli whoami [--json] print the signed-in user, org, and endpoints
|
|
35
|
-
mainwave-cli setup [<adapter>...] run the interactive setup wizard; with no adapter,
|
|
36
|
-
every detected tool is configured and the rest are
|
|
37
|
-
offered, and with several, configure them all in
|
|
38
|
-
one pass. Always writes user-global config
|
|
39
|
-
mainwave-cli verify [--ucid <id|url>] [--no-sample] [--timeout <s>] [--json]
|
|
40
|
-
push a sample trace and wait for it to land, then
|
|
41
|
-
print where your activity appears
|
|
42
|
-
mainwave-cli status [<adapter>] [--json]
|
|
43
|
-
show current on-disk config for all (or one) adapter
|
|
44
|
-
mainwave-cli edit <adapter> [--local|--global]
|
|
45
|
-
open a settings file in $EDITOR (interactive picker by default;
|
|
46
|
-
flag is required in non-TTY)
|
|
47
|
-
mainwave-cli doctor <adapter> [--validate] [--json]
|
|
48
|
-
show settings hierarchy and run health checks
|
|
49
|
-
mainwave-cli env <adapter> print export lines for shell-sourceable adapters
|
|
50
|
-
(usage: \`eval "$(mainwave-cli env <adapter>)"\`)
|
|
51
|
-
mainwave-cli install-hooks [--quiet] install or refresh the Mainwave hook entry and the
|
|
52
|
-
latest release's hook scripts, with no prompts or
|
|
53
|
-
sign-in (run at session start by an org's managed
|
|
54
|
-
settings, and by setup's own session-start hook)
|
|
28
|
+
${usageBlock()}
|
|
55
29
|
mainwave-cli --help show this message
|
|
56
30
|
|
|
57
|
-
|
|
58
|
-
--api-key <k> --collector-url <u> --api-url <u>
|
|
59
|
-
--ucid <id|url> --use-case <name> pin every tool to one use case (by default none
|
|
60
|
-
is written: each tool's activity is attributed at ingest
|
|
61
|
-
from your identity). A pin survives later default runs;
|
|
62
|
-
--no-use-case removes it
|
|
63
|
-
--email <e> --new-key
|
|
64
|
-
--invite <token> redeem an account-less developer invite: no login, no key
|
|
65
|
-
to paste — the token brings its own key, collector, and
|
|
66
|
-
identity (mutually exclusive with --api-key/--ucid/--use-case)
|
|
67
|
-
--opt-in prompts,tool-details,tool-content,repository|all|none content capture
|
|
68
|
-
(default: all on — "--opt-in none" sends metadata only;
|
|
69
|
-
repository = repository names on Claude Code telemetry)
|
|
70
|
-
--no-markers skip the Mainwave hooks (installed by default): the ticket
|
|
71
|
-
& PR markers and, for Claude Code, the plan snapshot
|
|
72
|
-
--yes --json --no-verify --verify-timeout <seconds>
|
|
73
|
-
--skills / --no-skills install the agent skills payload (default: ask, or on in scripts)
|
|
74
|
-
--skills-only install only the skills, touching no telemetry config
|
|
75
|
-
--remove take this CLI's config for the named tools back off this
|
|
76
|
-
machine (Kiro: its hooks file entries and kiro.env)
|
|
31
|
+
${detailsBlock()}
|
|
77
32
|
mainwave-cli --version print version
|
|
78
33
|
|
|
79
34
|
Available adapters:
|
|
@@ -128,38 +83,55 @@ const detectedAdapters = () => {
|
|
|
128
83
|
return found;
|
|
129
84
|
};
|
|
130
85
|
const setupOptions = (parsed) => {
|
|
131
|
-
|
|
86
|
+
const flags = commandFlags('setup', parsed);
|
|
87
|
+
if (flags.has('scope')) {
|
|
132
88
|
throw new WizardAbort('--scope was removed: setup writes user-global config only. Drop the flag.');
|
|
133
89
|
}
|
|
134
|
-
const invite =
|
|
135
|
-
if (
|
|
90
|
+
const invite = flags.value('invite');
|
|
91
|
+
if (flags.has('invite') && invite === undefined) {
|
|
136
92
|
throw new WizardAbort('--invite requires a token, e.g. --invite <token>');
|
|
137
93
|
}
|
|
138
94
|
if (invite !== undefined) {
|
|
139
95
|
for (const conflicting of ['api-key', 'ucid', 'use-case']) {
|
|
140
|
-
if (
|
|
96
|
+
if (flags.has(conflicting)) {
|
|
141
97
|
throw new WizardAbort(`--invite cannot be combined with --${conflicting}`);
|
|
142
98
|
}
|
|
143
99
|
}
|
|
144
100
|
}
|
|
101
|
+
const redactionFile = flags.value('redaction-file');
|
|
102
|
+
if (flags.has('redaction-file') && (redactionFile === undefined || redactionFile === '')) {
|
|
103
|
+
throw new WizardAbort('--redaction-file requires a path, e.g. --redaction-file ./redaction.json');
|
|
104
|
+
}
|
|
105
|
+
const noRedaction = flags.bool('redaction') === false;
|
|
106
|
+
if (redactionFile !== undefined && noRedaction) {
|
|
107
|
+
throw new WizardAbort('--redaction-file and --no-redaction cannot be combined');
|
|
108
|
+
}
|
|
109
|
+
const redactSecrets = flags.bool('redact-secrets');
|
|
110
|
+
if ((redactionFile !== undefined || noRedaction || redactSecrets !== undefined) &&
|
|
111
|
+
flags.bool('skills-only') === true) {
|
|
112
|
+
throw new WizardAbort('--skills-only touches no telemetry config, so redaction flags do not apply');
|
|
113
|
+
}
|
|
145
114
|
return {
|
|
146
115
|
invite,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
116
|
+
redactionFile,
|
|
117
|
+
noRedaction,
|
|
118
|
+
redactSecrets,
|
|
119
|
+
apiKey: flags.value('api-key'),
|
|
120
|
+
collectorUrl: flags.value('collector-url'),
|
|
121
|
+
apiUrl: flags.value('api-url'),
|
|
122
|
+
ucid: flags.value('ucid'),
|
|
123
|
+
useCaseName: flags.value('use-case'),
|
|
124
|
+
skipUseCase: flags.bool('use-case') === false,
|
|
125
|
+
userEmail: flags.value('email'),
|
|
126
|
+
optIns: parseOptIns(flags.value('opt-in')),
|
|
127
|
+
markers: flags.bool('markers'),
|
|
128
|
+
skills: flags.bool('skills'),
|
|
129
|
+
skillsOnly: flags.bool('skills-only') === true,
|
|
130
|
+
newKey: flags.bool('new-key') === true,
|
|
131
|
+
yes: flags.bool('yes') === true,
|
|
132
|
+
json: flags.bool('json') === true,
|
|
133
|
+
skipVerify: flags.bool('verify') === false,
|
|
134
|
+
verifyTimeoutMs: seconds(flags.value('verify-timeout')),
|
|
163
135
|
};
|
|
164
136
|
};
|
|
165
137
|
const reportCommandError = (err) => {
|
|
@@ -179,56 +151,56 @@ const reportCommandError = (err) => {
|
|
|
179
151
|
printError(err instanceof Error ? err.message : String(err));
|
|
180
152
|
return 1;
|
|
181
153
|
};
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (cmd === '--version' || cmd === '-v') {
|
|
190
|
-
console.log(VERSION);
|
|
191
|
-
return 0;
|
|
192
|
-
}
|
|
193
|
-
const AUTH_COMMANDS = ['login', 'logout', 'whoami'];
|
|
194
|
-
if (cmd !== 'setup' &&
|
|
195
|
-
cmd !== 'doctor' &&
|
|
196
|
-
cmd !== 'env' &&
|
|
197
|
-
cmd !== 'status' &&
|
|
198
|
-
cmd !== 'edit' &&
|
|
199
|
-
cmd !== 'verify' &&
|
|
200
|
-
cmd !== 'install-hooks' &&
|
|
201
|
-
!AUTH_COMMANDS.includes(cmd)) {
|
|
202
|
-
printError(`unknown command: ${cmd}`);
|
|
203
|
-
printHelp();
|
|
204
|
-
return 1;
|
|
154
|
+
const resolveAdapters = (names) => {
|
|
155
|
+
const named = [];
|
|
156
|
+
for (const name of names) {
|
|
157
|
+
const resolved = resolveAdapter(name);
|
|
158
|
+
if (typeof resolved === 'number')
|
|
159
|
+
return resolved;
|
|
160
|
+
named.push(resolved);
|
|
205
161
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
162
|
+
return named;
|
|
163
|
+
};
|
|
164
|
+
const HANDLERS = {
|
|
165
|
+
login: async (args) => {
|
|
166
|
+
const flags = commandFlags('login', parseArgs(args));
|
|
209
167
|
try {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
if (cmd === 'logout')
|
|
223
|
-
return await runLogout({ json });
|
|
224
|
-
return await runWhoami({ apiUrl: flagValue(parsed, 'api-url'), json });
|
|
168
|
+
return await runLogin({
|
|
169
|
+
email: flags.value('email'),
|
|
170
|
+
usePassword: flags.bool('password') === true,
|
|
171
|
+
useDevice: flags.bool('device') === true,
|
|
172
|
+
noBrowser: flags.bool('browser') === false,
|
|
173
|
+
deviceTimeoutMs: seconds(flags.value('device-timeout')),
|
|
174
|
+
apiUrl: flags.value('api-url'),
|
|
175
|
+
force: flags.bool('force') === true,
|
|
176
|
+
json: flags.bool('json') === true,
|
|
177
|
+
});
|
|
225
178
|
}
|
|
226
179
|
catch (err) {
|
|
227
180
|
return reportCommandError(err);
|
|
228
181
|
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const
|
|
182
|
+
},
|
|
183
|
+
logout: async (args) => {
|
|
184
|
+
const flags = commandFlags('logout', parseArgs(args));
|
|
185
|
+
try {
|
|
186
|
+
return await runLogout({ json: flags.bool('json') === true });
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
return reportCommandError(err);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
whoami: async (args) => {
|
|
193
|
+
const flags = commandFlags('whoami', parseArgs(args));
|
|
194
|
+
try {
|
|
195
|
+
return await runWhoami({ apiUrl: flags.value('api-url'), json: flags.bool('json') === true });
|
|
196
|
+
}
|
|
197
|
+
catch (err) {
|
|
198
|
+
return reportCommandError(err);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
status: async (args) => {
|
|
202
|
+
const parsed = parseArgs(args);
|
|
203
|
+
const flags = commandFlags('status', parsed);
|
|
232
204
|
const name = parsed.positionals[0];
|
|
233
205
|
let target;
|
|
234
206
|
if (name !== undefined) {
|
|
@@ -238,55 +210,70 @@ export const main = async (argv) => {
|
|
|
238
210
|
target = resolved;
|
|
239
211
|
}
|
|
240
212
|
try {
|
|
241
|
-
return await runStatus(target, { json:
|
|
213
|
+
return await runStatus(target, { json: flags.bool('json') === true });
|
|
242
214
|
}
|
|
243
215
|
catch (err) {
|
|
244
216
|
printError(err instanceof Error ? err.message : String(err));
|
|
245
217
|
return 1;
|
|
246
218
|
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const
|
|
219
|
+
},
|
|
220
|
+
verify: async (args) => {
|
|
221
|
+
const flags = commandFlags('verify', parseArgs(args));
|
|
250
222
|
try {
|
|
251
223
|
return await runVerify({
|
|
252
|
-
ucid:
|
|
253
|
-
noSample:
|
|
254
|
-
timeoutMs: seconds(
|
|
255
|
-
apiUrl:
|
|
256
|
-
collectorUrl:
|
|
257
|
-
apiKey:
|
|
258
|
-
json:
|
|
224
|
+
ucid: flags.value('ucid'),
|
|
225
|
+
noSample: flags.bool('sample') === false,
|
|
226
|
+
timeoutMs: seconds(flags.value('timeout')),
|
|
227
|
+
apiUrl: flags.value('api-url'),
|
|
228
|
+
collectorUrl: flags.value('collector-url'),
|
|
229
|
+
apiKey: flags.value('api-key'),
|
|
230
|
+
json: flags.bool('json') === true,
|
|
259
231
|
});
|
|
260
232
|
}
|
|
261
233
|
catch (err) {
|
|
262
234
|
return reportCommandError(err);
|
|
263
235
|
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const
|
|
236
|
+
},
|
|
237
|
+
'install-hooks': async (args) => {
|
|
238
|
+
const flags = commandFlags('install-hooks', parseArgs(args));
|
|
239
|
+
let redactionPacks;
|
|
240
|
+
if (flags.has('redaction-packs')) {
|
|
241
|
+
try {
|
|
242
|
+
redactionPacks = parseRedactionPacks(flags.value('redaction-packs'));
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
process.stderr.write(`mainwave-cli install-hooks: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
246
|
+
return 1;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const host = flags.has('host') ? flags.value('host') : undefined;
|
|
250
|
+
if (host !== undefined && host !== 'codex') {
|
|
251
|
+
process.stderr.write(`mainwave-cli install-hooks: --host takes \`codex\`, not "${host}"\n`);
|
|
252
|
+
return 1;
|
|
253
|
+
}
|
|
254
|
+
if (host === 'codex') {
|
|
255
|
+
return runInstallCodexHooks(codexCli, { quiet: flags.bool('quiet') === true });
|
|
256
|
+
}
|
|
267
257
|
const dir = await sessionConfigDir();
|
|
268
258
|
return runInstallHooks(dir === undefined ? undefined : claudeCodeFor(dir), {
|
|
269
|
-
quiet:
|
|
259
|
+
quiet: flags.bool('quiet') === true,
|
|
260
|
+
...(redactionPacks === undefined ? {} : { redactionPacks }),
|
|
270
261
|
});
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const parsed = parseArgs(args
|
|
274
|
-
const
|
|
275
|
-
const named =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (typeof resolved === 'number')
|
|
279
|
-
return resolved;
|
|
280
|
-
named.push(resolved);
|
|
281
|
-
}
|
|
262
|
+
},
|
|
263
|
+
setup: async (args) => {
|
|
264
|
+
const parsed = parseArgs(args);
|
|
265
|
+
const flags = commandFlags('setup', parsed);
|
|
266
|
+
const named = resolveAdapters(parsed.positionals);
|
|
267
|
+
if (typeof named === 'number')
|
|
268
|
+
return named;
|
|
282
269
|
try {
|
|
283
|
-
if (
|
|
270
|
+
if (flags.bool('remove') === true) {
|
|
284
271
|
if (named.length === 0) {
|
|
285
272
|
throw new WizardAbort('--remove needs the tools to remove, e.g. `setup kiro-ide --remove`');
|
|
286
273
|
}
|
|
287
274
|
return await runRemove(named, {
|
|
288
|
-
yes:
|
|
289
|
-
json:
|
|
275
|
+
yes: flags.bool('yes') === true,
|
|
276
|
+
json: flags.bool('json') === true,
|
|
290
277
|
});
|
|
291
278
|
}
|
|
292
279
|
const opts = setupOptions(parsed);
|
|
@@ -304,16 +291,17 @@ export const main = async (argv) => {
|
|
|
304
291
|
catch (err) {
|
|
305
292
|
return reportCommandError(err);
|
|
306
293
|
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
const flags = args.slice(
|
|
313
|
-
const local = flags.includes('--local');
|
|
314
|
-
const global = flags.includes('--global');
|
|
294
|
+
},
|
|
295
|
+
edit: async (args) => {
|
|
296
|
+
const adapter = resolveAdapter(args[0]);
|
|
297
|
+
if (typeof adapter === 'number')
|
|
298
|
+
return adapter;
|
|
299
|
+
const flags = commandFlags('edit', parseArgs(args.slice(1)));
|
|
315
300
|
try {
|
|
316
|
-
return await runEdit(adapter, {
|
|
301
|
+
return await runEdit(adapter, {
|
|
302
|
+
local: flags.bool('local') === true,
|
|
303
|
+
global: flags.bool('global') === true,
|
|
304
|
+
});
|
|
317
305
|
}
|
|
318
306
|
catch (err) {
|
|
319
307
|
if (err instanceof WizardAbort) {
|
|
@@ -323,21 +311,27 @@ export const main = async (argv) => {
|
|
|
323
311
|
printError(err instanceof Error ? err.message : String(err));
|
|
324
312
|
return 1;
|
|
325
313
|
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const
|
|
314
|
+
},
|
|
315
|
+
doctor: async (args) => {
|
|
316
|
+
const adapter = resolveAdapter(args[0]);
|
|
317
|
+
if (typeof adapter === 'number')
|
|
318
|
+
return adapter;
|
|
319
|
+
const flags = commandFlags('doctor', parseArgs(args.slice(1)));
|
|
329
320
|
try {
|
|
330
321
|
return await runDoctor(adapter, {
|
|
331
|
-
validate:
|
|
332
|
-
json:
|
|
322
|
+
validate: flags.bool('validate') === true,
|
|
323
|
+
json: flags.bool('json') === true,
|
|
333
324
|
});
|
|
334
325
|
}
|
|
335
326
|
catch (err) {
|
|
336
327
|
printError(err instanceof Error ? err.message : String(err));
|
|
337
328
|
return 1;
|
|
338
329
|
}
|
|
339
|
-
}
|
|
340
|
-
|
|
330
|
+
},
|
|
331
|
+
env: async (args) => {
|
|
332
|
+
const adapter = resolveAdapter(args[0]);
|
|
333
|
+
if (typeof adapter === 'number')
|
|
334
|
+
return adapter;
|
|
341
335
|
try {
|
|
342
336
|
return await runEnvCommand(adapter);
|
|
343
337
|
}
|
|
@@ -345,7 +339,23 @@ export const main = async (argv) => {
|
|
|
345
339
|
printError(err instanceof Error ? err.message : String(err));
|
|
346
340
|
return 1;
|
|
347
341
|
}
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
export const main = async (argv) => {
|
|
345
|
+
const args = argv.slice(2);
|
|
346
|
+
const cmd = args[0];
|
|
347
|
+
if (cmd === undefined || cmd === '--help' || cmd === '-h' || cmd === 'help') {
|
|
348
|
+
printHelp();
|
|
349
|
+
return 0;
|
|
348
350
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
if (cmd === '--version' || cmd === '-v') {
|
|
352
|
+
console.log(VERSION);
|
|
353
|
+
return 0;
|
|
354
|
+
}
|
|
355
|
+
if (!isCommand(cmd)) {
|
|
356
|
+
printError(`unknown command: ${cmd}`);
|
|
357
|
+
printHelp();
|
|
358
|
+
return 1;
|
|
359
|
+
}
|
|
360
|
+
return HANDLERS[cmd](args.slice(1));
|
|
351
361
|
};
|