@intra-mart/accel 0.5.0-dev.202608040843 → 0.5.0-dev.202608250608
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 +33 -31
- package/dist/asset/deployer.d.ts +2 -0
- package/dist/asset/deployer.js +11 -9
- package/dist/asset/git-provider.d.ts +1 -0
- package/dist/asset/git-provider.js +20 -9
- package/dist/asset/updater.d.ts +9 -2
- package/dist/asset/updater.js +12 -6
- package/dist/asset/walker.d.ts +2 -1
- package/dist/asset/walker.js +36 -0
- package/dist/commands/asset-provider.d.ts +1 -1
- package/dist/commands/asset-provider.js +2 -2
- package/dist/commands/attach.d.ts +116 -82
- package/dist/commands/attach.js +176 -145
- package/dist/commands/cache.js +11 -19
- package/dist/commands/deploy.d.ts +53 -32
- package/dist/commands/deploy.js +112 -75
- package/dist/commands/detach.d.ts +18 -0
- package/dist/commands/detach.js +69 -54
- package/dist/commands/init.d.ts +117 -83
- package/dist/commands/init.js +119 -98
- package/dist/commands/login.d.ts +12 -10
- package/dist/commands/login.js +14 -10
- package/dist/commands/preset.js +26 -33
- package/dist/commands/run-wrapper.d.ts +15 -0
- package/dist/commands/run-wrapper.js +62 -0
- package/dist/commands/switch.d.ts +48 -20
- package/dist/commands/switch.js +201 -176
- package/dist/commands/update.d.ts +142 -87
- package/dist/commands/update.js +342 -296
- package/dist/core/color-env.d.ts +1 -0
- package/dist/core/color-env.js +6 -0
- package/dist/core/constants.d.ts +0 -1
- package/dist/core/constants.js +0 -3
- package/dist/core/errors.d.ts +6 -0
- package/dist/core/errors.js +16 -0
- package/dist/core/logger.d.ts +15 -0
- package/dist/core/logger.js +1 -0
- package/dist/core/paths.d.ts +6 -0
- package/dist/core/paths.js +22 -0
- package/dist/core/types.d.ts +6 -1
- package/dist/core/validation.d.ts +34 -0
- package/dist/core/validation.js +87 -0
- package/dist/deploy/api-client.d.ts +1 -0
- package/dist/deploy/api-client.js +7 -1
- package/dist/git/config-file.d.ts +3 -0
- package/dist/git/config-file.js +178 -0
- package/dist/git/errors.d.ts +5 -0
- package/dist/git/errors.js +21 -2
- package/dist/git/git-objects.d.ts +11 -0
- package/dist/git/git-objects.js +49 -0
- package/dist/git/http.d.ts +2 -2
- package/dist/git/http.js +22 -10
- package/dist/git/index-file.d.ts +17 -0
- package/dist/git/index-file.js +111 -0
- package/dist/git/object-cache.d.ts +1 -0
- package/dist/git/object-cache.js +11 -15
- package/dist/git/object-store.d.ts +4 -0
- package/dist/git/object-store.js +82 -107
- package/dist/git/pack-parse.d.ts +19 -0
- package/dist/git/pack-parse.js +261 -0
- package/dist/git/pack-store.d.ts +20 -0
- package/dist/git/pack-store.js +144 -0
- package/dist/git/read-capped.d.ts +1 -0
- package/dist/git/read-capped.js +26 -0
- package/dist/git/redact-url.d.ts +1 -0
- package/dist/git/redact-url.js +14 -0
- package/dist/git/repo-layout.d.ts +5 -0
- package/dist/git/repo-layout.js +44 -0
- package/dist/git/smart-http.d.ts +3 -2
- package/dist/git/smart-http.js +5 -5
- package/dist/git/untracked.d.ts +11 -0
- package/dist/git/untracked.js +93 -0
- package/dist/git/worktree-status.d.ts +4 -0
- package/dist/git/worktree-status.js +140 -0
- package/dist/git/zlib-inflate.d.ts +7 -0
- package/dist/git/zlib-inflate.js +78 -0
- package/dist/i18n/en.js +12 -0
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/ja.js +12 -0
- package/dist/i18n/zh_CN.js +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/interactive/asset-messages.d.ts +2 -1
- package/dist/interactive/asset-messages.js +4 -4
- package/dist/interactive/clack-logger.d.ts +2 -0
- package/dist/interactive/clack-logger.js +11 -0
- package/dist/interactive/credential-auth.d.ts +2 -0
- package/dist/interactive/credential-auth.js +7 -6
- package/dist/interactive/credentials-prompts.js +10 -6
- package/dist/interactive/next-steps.d.ts +2 -1
- package/dist/interactive/next-steps.js +3 -3
- package/dist/interactive/progress.d.ts +8 -1
- package/dist/interactive/progress.js +0 -0
- package/dist/interactive/prompts.d.ts +3 -33
- package/dist/interactive/prompts.js +23 -111
- package/dist/interactive/summary.d.ts +2 -1
- package/dist/interactive/summary.js +3 -3
- package/dist/juggling/resolve.d.ts +7 -0
- package/dist/juggling/resolve.js +18 -0
- package/dist/lib.d.ts +34 -0
- package/dist/lib.js +29 -0
- package/dist/utils/args.d.ts +4 -1
- package/dist/utils/args.js +26 -3
- package/dist/utils/githooks-sync.d.ts +3 -1
- package/dist/utils/githooks-sync.js +37 -37
- package/dist/utils/mcp-generate.d.ts +26 -0
- package/dist/utils/mcp-generate.js +313 -0
- package/dist/utils/preset-io.d.ts +1 -0
- package/dist/utils/preset-io.js +5 -2
- package/dist/utils/settings-io.d.ts +1 -0
- package/dist/utils/settings-io.js +1 -1
- package/package.json +21 -14
- package/dist/utils/mcp-sync.d.ts +0 -4
- package/dist/utils/mcp-sync.js +0 -103
package/dist/commands/login.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
|
-
import
|
|
2
|
+
import { createClackLogger } from "../interactive/clack-logger.js";
|
|
3
3
|
import { detectLocale } from "../utils/locale-detect.js";
|
|
4
4
|
import { readSettingsSafe } from "../utils/settings-io.js";
|
|
5
5
|
import { readCredentials as defaultReadCredentials, resolveCredentialInputs, } from "../utils/credentials.js";
|
|
6
|
-
import {
|
|
6
|
+
import { createPersistCredentialsWithMcp } from "../utils/mcp-generate.js";
|
|
7
7
|
import { repromptCredentials as defaultRepromptCredentials, resolveCredentialsOrThrow as defaultResolveCredentialsOrThrow, } from "../interactive/credentials-prompts.js";
|
|
8
8
|
import { verifyCredentialsLoop } from "../interactive/credential-auth.js";
|
|
9
9
|
import { createApiClient as defaultApiClientFactory, } from "../deploy/api-client.js";
|
|
10
10
|
import { getMessage } from "../i18n/index.js";
|
|
11
11
|
import { lastFlagValue } from "../utils/args.js";
|
|
12
|
+
import { markReported } from "../core/errors.js";
|
|
13
|
+
import { withExitCode } from "./run-wrapper.js";
|
|
12
14
|
const resolveLocale = async (projectDir) => {
|
|
13
15
|
const settings = await readSettingsSafe(projectDir);
|
|
14
16
|
return settings?.locale ?? detectLocale();
|
|
@@ -16,14 +18,15 @@ const resolveLocale = async (projectDir) => {
|
|
|
16
18
|
export const runLogin = async (deps) => {
|
|
17
19
|
const { projectDir } = deps;
|
|
18
20
|
const locale = deps.locale ?? (await resolveLocale(projectDir));
|
|
21
|
+
const logger = deps.logger ?? createClackLogger();
|
|
19
22
|
const read = deps.readCredentials ?? defaultReadCredentials;
|
|
20
23
|
const reprompt = deps.repromptCredentials ?? defaultRepromptCredentials;
|
|
21
24
|
const resolveOrThrow = deps.resolveCredentialsOrThrow ?? defaultResolveCredentialsOrThrow;
|
|
22
|
-
const persist = deps.persistCredentials ??
|
|
25
|
+
const persist = deps.persistCredentials ?? createPersistCredentialsWithMcp(logger);
|
|
23
26
|
const apiClientFactory = deps.apiClientFactory ?? defaultApiClientFactory;
|
|
24
27
|
const env = deps.env ?? process.env;
|
|
25
28
|
const seed = resolveCredentialInputs({ endpoint: deps.endpoint, apiKey: deps.apiKey }, env);
|
|
26
|
-
|
|
29
|
+
logger.intro(getMessage("login.intro", locale));
|
|
27
30
|
let initial;
|
|
28
31
|
if (deps.nonInteractive) {
|
|
29
32
|
initial = await resolveOrThrow(projectDir, locale, seed);
|
|
@@ -36,9 +39,10 @@ export const runLogin = async (deps) => {
|
|
|
36
39
|
apiClientFactory,
|
|
37
40
|
repromptCredentials: reprompt,
|
|
38
41
|
persistCredentials: persist,
|
|
42
|
+
logger,
|
|
39
43
|
});
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
logger.success(`endpoint: ${creds.endpoint}`);
|
|
45
|
+
logger.outro(getMessage("login.complete", locale));
|
|
42
46
|
};
|
|
43
47
|
export const loginCommand = defineCommand({
|
|
44
48
|
meta: {
|
|
@@ -60,7 +64,7 @@ export const loginCommand = defineCommand({
|
|
|
60
64
|
default: false,
|
|
61
65
|
},
|
|
62
66
|
},
|
|
63
|
-
run: async ({ args }) => {
|
|
67
|
+
run: withExitCode(async ({ args }) => {
|
|
64
68
|
try {
|
|
65
69
|
await runLogin({
|
|
66
70
|
projectDir: process.cwd(),
|
|
@@ -69,8 +73,8 @@ export const loginCommand = defineCommand({
|
|
|
69
73
|
apiKey: lastFlagValue(args["api-key"]),
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
|
-
catch {
|
|
73
|
-
|
|
76
|
+
catch (err) {
|
|
77
|
+
throw markReported(err);
|
|
74
78
|
}
|
|
75
|
-
},
|
|
79
|
+
}),
|
|
76
80
|
});
|
package/dist/commands/preset.js
CHANGED
|
@@ -3,8 +3,11 @@ import { defineCommand } from "citty";
|
|
|
3
3
|
import * as p from "@clack/prompts";
|
|
4
4
|
import { findReleaseById } from "../core/catalog.js";
|
|
5
5
|
import { createPresetNameValidator } from "../core/validators.js";
|
|
6
|
-
import { printIntro, promptModules, promptFeatures, promptAgents,
|
|
6
|
+
import { printIntro, promptModules, promptFeatures, promptAgents, } from "../interactive/prompts.js";
|
|
7
|
+
import { collectSettingsErrors } from "../core/validation.js";
|
|
7
8
|
import { withHint, displayWidth } from "../interactive/format.js";
|
|
9
|
+
import { createCancelledError } from "../core/errors.js";
|
|
10
|
+
import { withExitCode } from "./run-wrapper.js";
|
|
8
11
|
import { getMessage } from "../i18n/index.js";
|
|
9
12
|
import { detectLocale } from "../utils/locale-detect.js";
|
|
10
13
|
import { readSettingsSafe } from "../utils/settings-io.js";
|
|
@@ -15,8 +18,7 @@ const requirePresetContext = async (argLocale) => {
|
|
|
15
18
|
const fallbackLocale = argLocale ?? detectLocale();
|
|
16
19
|
const settings = await readSettingsSafe(projectDir);
|
|
17
20
|
if (!settings) {
|
|
18
|
-
|
|
19
|
-
process.exit(1);
|
|
21
|
+
throw new Error(getMessage("preset.error.noSettings", fallbackLocale));
|
|
20
22
|
}
|
|
21
23
|
return {
|
|
22
24
|
projectDir,
|
|
@@ -27,10 +29,9 @@ const requirePresetContext = async (argLocale) => {
|
|
|
27
29
|
const resolveRelease = (settings, locale) => {
|
|
28
30
|
const release = findReleaseById(settings.accelplatformVersion.label);
|
|
29
31
|
if (!release) {
|
|
30
|
-
|
|
32
|
+
throw new Error(getMessage("error.invalidVersion", locale, {
|
|
31
33
|
version: settings.accelplatformVersion.label,
|
|
32
34
|
}));
|
|
33
|
-
process.exit(1);
|
|
34
35
|
}
|
|
35
36
|
return release;
|
|
36
37
|
};
|
|
@@ -51,12 +52,12 @@ const defaultPrompts = {
|
|
|
51
52
|
};
|
|
52
53
|
const resolveTextInput = (input) => {
|
|
53
54
|
if (p.isCancel(input))
|
|
54
|
-
|
|
55
|
+
throw createCancelledError();
|
|
55
56
|
return typeof input === "string" ? input.trim() : "";
|
|
56
57
|
};
|
|
57
58
|
const resolveConfirmInput = (input) => {
|
|
58
59
|
if (p.isCancel(input))
|
|
59
|
-
|
|
60
|
+
throw createCancelledError();
|
|
60
61
|
return input === true;
|
|
61
62
|
};
|
|
62
63
|
export const runPresetCreateInteractive = async (ctx, release, cli, force = false, prompts = defaultPrompts) => {
|
|
@@ -88,7 +89,7 @@ export const runPresetCreateInteractive = async (ctx, release, cli, force = fals
|
|
|
88
89
|
break;
|
|
89
90
|
if (nameFromArg) {
|
|
90
91
|
p.log.info(getMessage("preset.cancelled", locale));
|
|
91
|
-
|
|
92
|
+
throw createCancelledError();
|
|
92
93
|
}
|
|
93
94
|
name = undefined;
|
|
94
95
|
}
|
|
@@ -160,7 +161,7 @@ const createCommand = defineCommand({
|
|
|
160
161
|
default: false,
|
|
161
162
|
},
|
|
162
163
|
},
|
|
163
|
-
run: async ({ args }) => {
|
|
164
|
+
run: withExitCode(async ({ args }) => {
|
|
164
165
|
const ctx = await requirePresetContext(args.locale);
|
|
165
166
|
const { projectDir, settings, locale } = ctx;
|
|
166
167
|
const nameArg = args.name;
|
|
@@ -197,8 +198,7 @@ const createCommand = defineCommand({
|
|
|
197
198
|
isInit: false,
|
|
198
199
|
}, locale, settings.accelplatformVersion.label));
|
|
199
200
|
if (errors.length > 0) {
|
|
200
|
-
|
|
201
|
-
process.exit(1);
|
|
201
|
+
throw new Error(errors.join("\n"));
|
|
202
202
|
}
|
|
203
203
|
const release = resolveRelease(settings, locale);
|
|
204
204
|
const isInteractive = !args["non-interactive"];
|
|
@@ -223,17 +223,15 @@ const createCommand = defineCommand({
|
|
|
223
223
|
}));
|
|
224
224
|
}
|
|
225
225
|
if (requiredErrors.length > 0) {
|
|
226
|
-
|
|
227
|
-
process.exit(1);
|
|
226
|
+
throw new Error(requiredErrors.join("\n"));
|
|
228
227
|
}
|
|
229
228
|
if ((await presetExists(projectDir, cli.name)) &&
|
|
230
229
|
!args.force) {
|
|
231
|
-
|
|
232
|
-
process.exit(1);
|
|
230
|
+
throw new Error(getMessage("preset.error.exists", locale, { name: cli.name }));
|
|
233
231
|
}
|
|
234
232
|
await writePreset(projectDir, buildPreset(cli.name, cli.label ?? "", cli.description ?? "", cli.modules, cli.features, cli.agents));
|
|
235
233
|
p.log.success(getMessage("preset.created", locale, { name: cli.name }));
|
|
236
|
-
},
|
|
234
|
+
}),
|
|
237
235
|
});
|
|
238
236
|
export const buildPresetListBody = (summaries) => {
|
|
239
237
|
const displays = summaries.map(formatPresetDisplayName);
|
|
@@ -253,7 +251,7 @@ const listCommand = defineCommand({
|
|
|
253
251
|
name: "list",
|
|
254
252
|
description: "List registered configuration presets",
|
|
255
253
|
},
|
|
256
|
-
run: async () => {
|
|
254
|
+
run: withExitCode(async () => {
|
|
257
255
|
const { projectDir, locale } = await requirePresetContext();
|
|
258
256
|
const summaries = await listPresetSummaries(projectDir);
|
|
259
257
|
if (summaries.length === 0) {
|
|
@@ -261,7 +259,7 @@ const listCommand = defineCommand({
|
|
|
261
259
|
return;
|
|
262
260
|
}
|
|
263
261
|
p.log.info(buildPresetListBody(summaries));
|
|
264
|
-
},
|
|
262
|
+
}),
|
|
265
263
|
});
|
|
266
264
|
export const buildPresetShowBody = (raw, locale) => {
|
|
267
265
|
const empty = getMessage("summary.empty", locale);
|
|
@@ -288,13 +286,11 @@ export const buildPresetShowBody = (raw, locale) => {
|
|
|
288
286
|
};
|
|
289
287
|
const requirePresetName = (nameArg, command, locale) => {
|
|
290
288
|
if (!nameArg) {
|
|
291
|
-
|
|
292
|
-
process.exit(1);
|
|
289
|
+
throw new Error(getMessage("preset.error.missingName", locale, { command }));
|
|
293
290
|
}
|
|
294
291
|
const nameError = createPresetNameValidator(locale)(nameArg);
|
|
295
292
|
if (nameError) {
|
|
296
|
-
|
|
297
|
-
process.exit(1);
|
|
293
|
+
throw new Error(nameError);
|
|
298
294
|
}
|
|
299
295
|
return nameArg;
|
|
300
296
|
};
|
|
@@ -310,7 +306,7 @@ const showCommand = defineCommand({
|
|
|
310
306
|
required: false,
|
|
311
307
|
},
|
|
312
308
|
},
|
|
313
|
-
run: async ({ args }) => {
|
|
309
|
+
run: withExitCode(async ({ args }) => {
|
|
314
310
|
const { projectDir, locale } = await requirePresetContext();
|
|
315
311
|
const name = requirePresetName(args.name, "show", locale);
|
|
316
312
|
let content;
|
|
@@ -318,8 +314,7 @@ const showCommand = defineCommand({
|
|
|
318
314
|
content = await readFile(presetPath(projectDir, name), "utf-8");
|
|
319
315
|
}
|
|
320
316
|
catch {
|
|
321
|
-
|
|
322
|
-
process.exit(1);
|
|
317
|
+
throw new Error(getMessage("preset.error.notFound", locale, { name }));
|
|
323
318
|
}
|
|
324
319
|
let raw;
|
|
325
320
|
try {
|
|
@@ -330,19 +325,18 @@ const showCommand = defineCommand({
|
|
|
330
325
|
raw = parsed;
|
|
331
326
|
}
|
|
332
327
|
catch (err) {
|
|
333
|
-
|
|
328
|
+
throw new Error(getMessage("preset.error.invalid", locale, {
|
|
334
329
|
name,
|
|
335
330
|
errors: ` - ${getMessage("preset.error.parse", locale, {
|
|
336
331
|
message: sanitizeDisplayText(err instanceof Error ? err.message : String(err)),
|
|
337
332
|
})}`,
|
|
338
333
|
}));
|
|
339
|
-
process.exit(1);
|
|
340
334
|
}
|
|
341
335
|
p.note(buildPresetShowBody(raw, locale), formatPresetDisplayName({
|
|
342
336
|
name,
|
|
343
337
|
label: typeof raw.label === "string" ? raw.label : undefined,
|
|
344
338
|
}));
|
|
345
|
-
},
|
|
339
|
+
}),
|
|
346
340
|
});
|
|
347
341
|
const deleteCommand = defineCommand({
|
|
348
342
|
meta: {
|
|
@@ -361,12 +355,11 @@ const deleteCommand = defineCommand({
|
|
|
361
355
|
default: false,
|
|
362
356
|
},
|
|
363
357
|
},
|
|
364
|
-
run: async ({ args }) => {
|
|
358
|
+
run: withExitCode(async ({ args }) => {
|
|
365
359
|
const { projectDir, locale } = await requirePresetContext();
|
|
366
360
|
const name = requirePresetName(args.name, "delete", locale);
|
|
367
361
|
if (!(await presetExists(projectDir, name))) {
|
|
368
|
-
|
|
369
|
-
process.exit(1);
|
|
362
|
+
throw new Error(getMessage("preset.error.notFound", locale, { name }));
|
|
370
363
|
}
|
|
371
364
|
if (!args["non-interactive"]) {
|
|
372
365
|
const ok = await p.confirm({
|
|
@@ -375,12 +368,12 @@ const deleteCommand = defineCommand({
|
|
|
375
368
|
});
|
|
376
369
|
if (p.isCancel(ok) || ok !== true) {
|
|
377
370
|
p.log.info(getMessage("preset.cancelled", locale));
|
|
378
|
-
|
|
371
|
+
throw createCancelledError();
|
|
379
372
|
}
|
|
380
373
|
}
|
|
381
374
|
await deletePreset(projectDir, name);
|
|
382
375
|
p.log.success(getMessage("preset.deleted", locale, { name }));
|
|
383
|
-
},
|
|
376
|
+
}),
|
|
384
377
|
});
|
|
385
378
|
export const presetCommand = defineCommand({
|
|
386
379
|
meta: {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ArgDef = {
|
|
2
|
+
type?: string;
|
|
3
|
+
alias?: string | string[];
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
type FlagContext = {
|
|
7
|
+
args?: Record<string, unknown>;
|
|
8
|
+
rawArgs?: readonly string[];
|
|
9
|
+
cmd?: {
|
|
10
|
+
args?: Record<string, ArgDef | undefined>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const findUnknownFlags: (ctx: FlagContext) => string[];
|
|
14
|
+
export declare const withExitCode: <C>(run: (ctx: C) => void | Promise<void>) => ((ctx: C) => Promise<void>);
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { isCancelledError, isReportedError } from "../core/errors.js";
|
|
3
|
+
import { getMessage } from "../i18n/index.js";
|
|
4
|
+
import { toCamelCase, toKebabCase } from "../utils/args.js";
|
|
5
|
+
import { detectLocale } from "../utils/locale-detect.js";
|
|
6
|
+
import { sanitizeDisplayText } from "../utils/sanitize-text.js";
|
|
7
|
+
export const findUnknownFlags = (ctx) => {
|
|
8
|
+
const declared = new Set(["_", "--"]);
|
|
9
|
+
const positionals = new Set();
|
|
10
|
+
const markDeclared = (key, into = declared) => {
|
|
11
|
+
into.add(key);
|
|
12
|
+
into.add(toCamelCase(key));
|
|
13
|
+
into.add(toKebabCase(key));
|
|
14
|
+
};
|
|
15
|
+
for (const [key, def] of Object.entries(ctx.cmd?.args ?? {})) {
|
|
16
|
+
markDeclared(key);
|
|
17
|
+
if (def?.type === "positional")
|
|
18
|
+
markDeclared(key, positionals);
|
|
19
|
+
const alias = def?.alias;
|
|
20
|
+
for (const a of Array.isArray(alias) ? alias : alias ? [alias] : []) {
|
|
21
|
+
markDeclared(a);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const unknown = new Set();
|
|
25
|
+
for (const key of Object.keys(ctx.args ?? {})) {
|
|
26
|
+
if (declared.has(key))
|
|
27
|
+
continue;
|
|
28
|
+
unknown.add(key.length === 1 ? `-${key}` : `--${toKebabCase(toCamelCase(key))}`);
|
|
29
|
+
}
|
|
30
|
+
for (const token of ctx.rawArgs ?? []) {
|
|
31
|
+
if (token === "--")
|
|
32
|
+
break;
|
|
33
|
+
if (!token.startsWith("--"))
|
|
34
|
+
continue;
|
|
35
|
+
const flagName = token.slice(2).split("=", 1)[0];
|
|
36
|
+
if (positionals.has(flagName)) {
|
|
37
|
+
unknown.add(`--${toKebabCase(toCamelCase(flagName))}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return [...unknown];
|
|
41
|
+
};
|
|
42
|
+
export const withExitCode = (run) => async (ctx) => {
|
|
43
|
+
const unknown = findUnknownFlags(ctx);
|
|
44
|
+
if (unknown.length > 0) {
|
|
45
|
+
p.log.error(getMessage("error.unknownFlags", detectLocale(), {
|
|
46
|
+
flags: sanitizeDisplayText(unknown.join(", ")),
|
|
47
|
+
}));
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
await run(ctx);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
if (isCancelledError(err)) {
|
|
55
|
+
process.exit(0);
|
|
56
|
+
}
|
|
57
|
+
if (!isReportedError(err)) {
|
|
58
|
+
p.log.error(err instanceof Error ? err.message : String(err));
|
|
59
|
+
}
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
@@ -1,28 +1,56 @@
|
|
|
1
|
+
import type { Logger } from "../core/logger.js";
|
|
2
|
+
import { type Release } from "../core/catalog.js";
|
|
3
|
+
import { type UpdaterProgressCallbacks } from "../asset/updater.js";
|
|
4
|
+
import { type PresetSummary } from "../utils/preset-io.js";
|
|
5
|
+
import { type generateMcpConfigs } from "../utils/mcp-generate.js";
|
|
6
|
+
export type SwitchPrompts = {
|
|
7
|
+
selectPreset: (presets: PresetSummary[], locale: string) => Promise<string | undefined>;
|
|
8
|
+
selectModules: (release: Release, initial: string[], locale: string) => Promise<string[]>;
|
|
9
|
+
selectFeatures: (release: Release, initial: string[], locale: string) => Promise<string[]>;
|
|
10
|
+
selectAgents: (initial: string[], locale: string) => Promise<string[]>;
|
|
11
|
+
confirmApply: (locale: string) => Promise<boolean>;
|
|
12
|
+
};
|
|
13
|
+
export type RunSwitchDeps = {
|
|
14
|
+
projectDir: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
nonInteractive?: boolean;
|
|
17
|
+
modules?: string[];
|
|
18
|
+
features?: string[];
|
|
19
|
+
agents?: string[];
|
|
20
|
+
preset?: string;
|
|
21
|
+
skipInstall?: boolean;
|
|
22
|
+
logger?: Logger;
|
|
23
|
+
prompts?: SwitchPrompts;
|
|
24
|
+
progress?: UpdaterProgressCallbacks;
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
generateMcpConfigs?: typeof generateMcpConfigs;
|
|
27
|
+
};
|
|
28
|
+
export declare const runSwitch: (deps: RunSwitchDeps) => Promise<void>;
|
|
1
29
|
export declare const switchCommand: import("citty").CommandDef<{
|
|
2
|
-
module: {
|
|
3
|
-
type: "string";
|
|
4
|
-
description:
|
|
30
|
+
readonly module: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
readonly description: "Modules to use (comma-separated artifactIds, e.g., im_workflow)";
|
|
5
33
|
};
|
|
6
|
-
feature: {
|
|
7
|
-
type: "string";
|
|
8
|
-
description:
|
|
34
|
+
readonly feature: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly description: "Features to use (comma-separated function ids, e.g., jssp)";
|
|
9
37
|
};
|
|
10
|
-
agent: {
|
|
11
|
-
type: "string";
|
|
12
|
-
description:
|
|
38
|
+
readonly agent: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly description: "Agent type";
|
|
13
41
|
};
|
|
14
|
-
preset: {
|
|
15
|
-
type: "string";
|
|
16
|
-
description:
|
|
42
|
+
readonly preset: {
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
readonly description: "Configuration preset name to apply (mutually exclusive with --module / --feature / --agent)";
|
|
17
45
|
};
|
|
18
|
-
"non-interactive": {
|
|
19
|
-
type: "boolean";
|
|
20
|
-
description:
|
|
21
|
-
default: false;
|
|
46
|
+
readonly "non-interactive": {
|
|
47
|
+
readonly type: "boolean";
|
|
48
|
+
readonly description: "Non-interactive mode";
|
|
49
|
+
readonly default: false;
|
|
22
50
|
};
|
|
23
|
-
"skip-install": {
|
|
24
|
-
type: "boolean";
|
|
25
|
-
description:
|
|
26
|
-
default: false;
|
|
51
|
+
readonly "skip-install": {
|
|
52
|
+
readonly type: "boolean";
|
|
53
|
+
readonly description: "Skip install / build even when dependency files changed";
|
|
54
|
+
readonly default: false;
|
|
27
55
|
};
|
|
28
56
|
}>;
|