@salesforce/b2c-cli 1.5.0 → 1.7.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/dist/commands/cap/install.d.ts +49 -0
- package/dist/commands/cap/install.js +138 -0
- package/dist/commands/cap/install.js.map +1 -0
- package/dist/commands/cap/list.d.ts +47 -0
- package/dist/commands/cap/list.js +172 -0
- package/dist/commands/cap/list.js.map +1 -0
- package/dist/commands/cap/package.d.ts +17 -0
- package/dist/commands/cap/package.js +55 -0
- package/dist/commands/cap/package.js.map +1 -0
- package/dist/commands/cap/pull.d.ts +48 -0
- package/dist/commands/cap/pull.js +121 -0
- package/dist/commands/cap/pull.js.map +1 -0
- package/dist/commands/cap/tasks.d.ts +56 -0
- package/dist/commands/cap/tasks.js +90 -0
- package/dist/commands/cap/tasks.js.map +1 -0
- package/dist/commands/cap/uninstall.d.ts +47 -0
- package/dist/commands/cap/uninstall.js +123 -0
- package/dist/commands/cap/uninstall.js.map +1 -0
- package/dist/commands/cap/validate.d.ts +11 -0
- package/dist/commands/cap/validate.js +49 -0
- package/dist/commands/cap/validate.js.map +1 -0
- package/dist/commands/setup/skills.js +24 -11
- package/dist/commands/setup/skills.js.map +1 -1
- package/oclif.manifest.json +4011 -2007
- package/package.json +3 -2
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { Args, Flags } from '@oclif/core';
|
|
8
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
9
|
+
import { listInstalledApps, pullCommerceApps, } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
10
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
11
|
+
export default class CapPull extends JobCommand {
|
|
12
|
+
static description = withDocs(t('commands.cap.pull.description', 'Pull installed Commerce Apps from a B2C Commerce instance'), '/cli/cap.html#b2c-cap-pull');
|
|
13
|
+
static args = {
|
|
14
|
+
appName: Args.string({
|
|
15
|
+
description: 'Commerce App feature name to pull (e.g. avalara-tax). If omitted, pulls all registry apps.',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
static enableJsonFlag = true;
|
|
20
|
+
static examples = [
|
|
21
|
+
'<%= config.bin %> <%= command.id %>',
|
|
22
|
+
'<%= config.bin %> <%= command.id %> avalara-tax',
|
|
23
|
+
'<%= config.bin %> <%= command.id %> --site-id RefArch',
|
|
24
|
+
'<%= config.bin %> <%= command.id %> --output ./my-apps',
|
|
25
|
+
];
|
|
26
|
+
static flags = {
|
|
27
|
+
...JobCommand.baseFlags,
|
|
28
|
+
'site-id': Flags.string({
|
|
29
|
+
char: 's',
|
|
30
|
+
description: 'Site ID to query for installed apps. If omitted, queries all sites.',
|
|
31
|
+
aliases: ['site'],
|
|
32
|
+
}),
|
|
33
|
+
output: Flags.string({
|
|
34
|
+
char: 'o',
|
|
35
|
+
description: 'Output directory (default: ./commerce-apps)',
|
|
36
|
+
default: 'commerce-apps',
|
|
37
|
+
}),
|
|
38
|
+
timeout: Flags.integer({
|
|
39
|
+
char: 't',
|
|
40
|
+
description: 'Timeout in seconds (default: no timeout)',
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
operations = {
|
|
44
|
+
listInstalledApps,
|
|
45
|
+
pullCommerceApps,
|
|
46
|
+
};
|
|
47
|
+
async run() {
|
|
48
|
+
this.requireOAuthCredentials();
|
|
49
|
+
this.requireWebDavCredentials();
|
|
50
|
+
const { appName } = this.args;
|
|
51
|
+
const { 'site-id': siteId, output, timeout } = this.flags;
|
|
52
|
+
const hostname = this.resolvedConfig.values.hostname;
|
|
53
|
+
this.log(t('commands.cap.pull.fetching', 'Fetching installed apps from {{hostname}}...', { hostname }));
|
|
54
|
+
const listResult = await this.operations.listInstalledApps(this.instance, {
|
|
55
|
+
sites: siteId ? [siteId] : undefined,
|
|
56
|
+
waitOptions: {
|
|
57
|
+
timeoutSeconds: timeout || undefined,
|
|
58
|
+
onPoll: (info) => {
|
|
59
|
+
if (!this.jsonEnabled()) {
|
|
60
|
+
this.log(t('commands.cap.pull.progress', ' Status: {{status}} ({{elapsed}}s elapsed)', {
|
|
61
|
+
status: info.status,
|
|
62
|
+
elapsed: Math.floor(info.elapsedSeconds).toString(),
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
// Deduplicate features by name (same app installed on multiple sites shares the same version)
|
|
69
|
+
const uniqueFeatures = new Map();
|
|
70
|
+
for (const f of listResult.features) {
|
|
71
|
+
if (!uniqueFeatures.has(f.featureName)) {
|
|
72
|
+
uniqueFeatures.set(f.featureName, f);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let toPull;
|
|
76
|
+
if (appName) {
|
|
77
|
+
const feature = uniqueFeatures.get(appName);
|
|
78
|
+
if (!feature) {
|
|
79
|
+
this.error(t('commands.cap.pull.notFound', 'Commerce App "{{appName}}" not found on {{hostname}}', {
|
|
80
|
+
appName,
|
|
81
|
+
hostname,
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
toPull = [feature];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
toPull = [...uniqueFeatures.values()].filter((f) => f.featureSource === 'AppRegistry');
|
|
88
|
+
}
|
|
89
|
+
if (toPull.length === 0) {
|
|
90
|
+
this.log(t('commands.cap.pull.noApps', 'No registry-sourced apps found.'));
|
|
91
|
+
return { pulled: [], failed: [] };
|
|
92
|
+
}
|
|
93
|
+
this.log(t('commands.cap.pull.pulling', 'Pulling {{count}} app(s)...', {
|
|
94
|
+
count: toPull.length,
|
|
95
|
+
}));
|
|
96
|
+
const result = await this.operations.pullCommerceApps(this.instance, toPull, {
|
|
97
|
+
outputDir: output,
|
|
98
|
+
});
|
|
99
|
+
if (!this.jsonEnabled()) {
|
|
100
|
+
const bold = '[1m';
|
|
101
|
+
const dim = '[2m';
|
|
102
|
+
const cyan = '[36m';
|
|
103
|
+
const yellow = '[33m';
|
|
104
|
+
const red = '[31m';
|
|
105
|
+
const reset = '[0m';
|
|
106
|
+
for (const app of result.pulled) {
|
|
107
|
+
const relativePath = path.relative(process.cwd(), app.extractedPath);
|
|
108
|
+
const sourceNote = app.source === 'github' ? ` ${yellow}(from GitHub)${reset}` : '';
|
|
109
|
+
process.stdout.write(`\n ${bold}${app.featureName}${reset} v${app.version}${sourceNote}\n`);
|
|
110
|
+
process.stdout.write(` ${dim}domain: ${app.domain}${reset}\n`);
|
|
111
|
+
process.stdout.write(` ${cyan}→ ./${relativePath}${reset}\n`);
|
|
112
|
+
}
|
|
113
|
+
for (const fail of result.failed) {
|
|
114
|
+
process.stdout.write(`\n ${red}${fail.featureName}: ${fail.error}${reset}\n`);
|
|
115
|
+
}
|
|
116
|
+
process.stdout.write('\n');
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=pull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/commands/cap/pull.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GAEjB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,UAA0B;IAC7D,MAAM,C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E,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,gBAAgB,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,GAAG,GAAG,CAAC,WAAW,GAAG,KAAK,KAAK,GAAG,CAAC,OAAO,GAAG,UAAU,IAAI,CAAC,CAAC;gBAC7F,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,KAAK,IAAI,CAAC,CAAC;gBACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,OAAO,YAAY,GAAG,KAAK,IAAI,CAAC,CAAC;YACpE,CAAC;YAED,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC;YACjF,CAAC;YAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { listInstalledApps, type CommerceFeatureState } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
3
|
+
interface ConfigTask {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
link: string;
|
|
7
|
+
taskNumber: string;
|
|
8
|
+
}
|
|
9
|
+
export default class CapTasks extends JobCommand<typeof CapTasks> {
|
|
10
|
+
static args: {
|
|
11
|
+
appName: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
static description: string;
|
|
14
|
+
static enableJsonFlag: boolean;
|
|
15
|
+
static examples: string[];
|
|
16
|
+
static flags: {
|
|
17
|
+
'site-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'webdav-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'code-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
certificate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
passphrase: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
selfsigned: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
|
+
verify: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
|
+
'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
34
|
+
'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
35
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
39
|
+
jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
40
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
43
|
+
'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
44
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
45
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
46
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
47
|
+
};
|
|
48
|
+
protected operations: {
|
|
49
|
+
listInstalledApps: typeof listInstalledApps;
|
|
50
|
+
};
|
|
51
|
+
run(): Promise<{
|
|
52
|
+
feature: CommerceFeatureState;
|
|
53
|
+
tasks: ConfigTask[];
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Args, Flags } from '@oclif/core';
|
|
7
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { listInstalledApps } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
export default class CapTasks extends JobCommand {
|
|
11
|
+
static args = {
|
|
12
|
+
appName: Args.string({
|
|
13
|
+
description: 'Commerce App feature name (e.g. avalara-tax)',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
static description = withDocs(t('commands.cap.tasks.description', 'List configuration tasks for an installed Commerce App'), '/cli/cap.html#b2c-cap-tasks');
|
|
18
|
+
static enableJsonFlag = true;
|
|
19
|
+
static examples = [
|
|
20
|
+
'<%= config.bin %> <%= command.id %> avalara-tax --site-id RefArch',
|
|
21
|
+
'<%= config.bin %> <%= command.id %> avalara-tax --site-id RefArch --json',
|
|
22
|
+
];
|
|
23
|
+
static flags = {
|
|
24
|
+
...JobCommand.baseFlags,
|
|
25
|
+
'site-id': Flags.string({
|
|
26
|
+
char: 's',
|
|
27
|
+
description: 'Site ID to query',
|
|
28
|
+
required: true,
|
|
29
|
+
aliases: ['site'],
|
|
30
|
+
}),
|
|
31
|
+
timeout: Flags.integer({
|
|
32
|
+
char: 't',
|
|
33
|
+
description: 'Timeout in seconds (default: no timeout)',
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
operations = {
|
|
37
|
+
listInstalledApps,
|
|
38
|
+
};
|
|
39
|
+
async run() {
|
|
40
|
+
this.requireOAuthCredentials();
|
|
41
|
+
this.requireWebDavCredentials();
|
|
42
|
+
const { appName: name } = this.args;
|
|
43
|
+
const { 'site-id': siteId, timeout } = this.flags;
|
|
44
|
+
const hostname = this.resolvedConfig.values.hostname;
|
|
45
|
+
this.log(t('commands.cap.tasks.fetching', 'Fetching configuration tasks for {{name}} on {{hostname}}...', {
|
|
46
|
+
name,
|
|
47
|
+
hostname,
|
|
48
|
+
}));
|
|
49
|
+
const result = await this.operations.listInstalledApps(this.instance, {
|
|
50
|
+
sites: [siteId],
|
|
51
|
+
waitOptions: {
|
|
52
|
+
timeoutSeconds: timeout || undefined,
|
|
53
|
+
onPoll: (info) => {
|
|
54
|
+
if (!this.jsonEnabled()) {
|
|
55
|
+
this.log(t('commands.cap.tasks.progress', ' Status: {{status}} ({{elapsed}}s elapsed)', {
|
|
56
|
+
status: info.status,
|
|
57
|
+
elapsed: Math.floor(info.elapsedSeconds).toString(),
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const feature = result.features.find((f) => f.featureName === name);
|
|
64
|
+
if (!feature) {
|
|
65
|
+
this.error(t('commands.cap.tasks.notFound', 'Commerce App "{{name}}" not found on site {{siteId}}', { name, siteId }));
|
|
66
|
+
}
|
|
67
|
+
const tasks = (feature.configTasks ?? []);
|
|
68
|
+
if (tasks.length === 0) {
|
|
69
|
+
this.log(t('commands.cap.tasks.noTasks', 'No configuration tasks found.'));
|
|
70
|
+
return { feature, tasks };
|
|
71
|
+
}
|
|
72
|
+
this.log(t('commands.cap.tasks.found', 'Configuration tasks for {{name}} ({{status}}):', {
|
|
73
|
+
name: feature.featureName,
|
|
74
|
+
status: feature.configStatus,
|
|
75
|
+
}));
|
|
76
|
+
if (!this.jsonEnabled()) {
|
|
77
|
+
const bold = '[1m';
|
|
78
|
+
const dim = '[2m';
|
|
79
|
+
const cyan = '[36m';
|
|
80
|
+
const reset = '[0m';
|
|
81
|
+
for (const task of tasks) {
|
|
82
|
+
process.stdout.write(`\n ${bold}${task.taskNumber}. ${task.name}${reset}\n`);
|
|
83
|
+
process.stdout.write(` ${dim}${task.description}${reset}\n`);
|
|
84
|
+
process.stdout.write(` ${cyan}→ https://${hostname}${task.link}${reset}\n`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return { feature, tasks };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/commands/cap/tasks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAA4B,MAAM,4CAA4C,CAAC;AACxG,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAShD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAA2B;IAC/D,MAAM,CAAC,IAAI,GAAG;QACZ,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,gCAAgC,EAAE,wDAAwD,CAAC,EAC7F,6BAA6B,CAC9B,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;QAChB,mEAAmE;QACnE,0EAA0E;KAC3E,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,UAAU,CAAC,SAAS;QACvB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,CAAC,MAA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aAAa,QAAQ,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;QAED,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC;IAC1B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { commerceAppUninstall, listInstalledApps, type CommerceAppUninstallResult } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
3
|
+
export default class CapUninstall extends JobCommand<typeof CapUninstall> {
|
|
4
|
+
static args: {
|
|
5
|
+
appName: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
'site-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'webdav-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'code-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
certificate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
passphrase: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
selfsigned: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
verify: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
'client-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
'client-secret': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
'auth-scope': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'short-code': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
'tenant-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'auth-methods': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'user-auth': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
'account-manager-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
|
+
'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
32
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
33
|
+
jsonl: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
lang: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
35
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
instance: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
'project-directory': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
'extra-query': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
|
+
'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
40
|
+
'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
};
|
|
42
|
+
protected operations: {
|
|
43
|
+
commerceAppUninstall: typeof commerceAppUninstall;
|
|
44
|
+
listInstalledApps: typeof listInstalledApps;
|
|
45
|
+
};
|
|
46
|
+
run(): Promise<CommerceAppUninstallResult>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Args, Flags } from '@oclif/core';
|
|
7
|
+
import { JobCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { commerceAppUninstall, listInstalledApps, JobExecutionError, } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
export default class CapUninstall extends JobCommand {
|
|
11
|
+
static args = {
|
|
12
|
+
appName: Args.string({
|
|
13
|
+
description: 'App ID to uninstall (from commerce-app.json "id" field, e.g. "avalara-tax")',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
static description = withDocs(t('commands.cap.uninstall.description', 'Uninstall a Commerce App from a B2C Commerce instance'), '/cli/cap.html#b2c-cap-uninstall');
|
|
18
|
+
static enableJsonFlag = true;
|
|
19
|
+
static examples = ['<%= config.bin %> <%= command.id %> avalara-tax --site-id RefArch'];
|
|
20
|
+
static flags = {
|
|
21
|
+
...JobCommand.baseFlags,
|
|
22
|
+
'site-id': Flags.string({
|
|
23
|
+
char: 's',
|
|
24
|
+
description: 'Site ID to uninstall the Commerce App from',
|
|
25
|
+
required: true,
|
|
26
|
+
aliases: ['site'],
|
|
27
|
+
}),
|
|
28
|
+
timeout: Flags.integer({
|
|
29
|
+
char: 't',
|
|
30
|
+
description: 'Timeout in seconds (default: no timeout)',
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
operations = {
|
|
34
|
+
commerceAppUninstall,
|
|
35
|
+
listInstalledApps,
|
|
36
|
+
};
|
|
37
|
+
async run() {
|
|
38
|
+
this.requireOAuthCredentials();
|
|
39
|
+
this.requireWebDavCredentials();
|
|
40
|
+
const { appName } = this.args;
|
|
41
|
+
const { 'site-id': site, timeout } = this.flags;
|
|
42
|
+
const hostname = this.resolvedConfig.values.hostname;
|
|
43
|
+
this.log(t('commands.cap.uninstall.lookingUp', 'Looking up {{appName}} on {{hostname}} (site: {{site}})...', {
|
|
44
|
+
appName,
|
|
45
|
+
hostname,
|
|
46
|
+
site,
|
|
47
|
+
}));
|
|
48
|
+
const listResult = await this.operations.listInstalledApps(this.instance, {
|
|
49
|
+
sites: [site],
|
|
50
|
+
waitOptions: { timeoutSeconds: timeout || undefined },
|
|
51
|
+
});
|
|
52
|
+
const feature = listResult.features.find((f) => f.featureName === appName);
|
|
53
|
+
if (!feature) {
|
|
54
|
+
this.error(t('commands.cap.uninstall.notFound', 'Commerce App "{{appName}}" not found on site {{site}}', {
|
|
55
|
+
appName,
|
|
56
|
+
site,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
const domain = feature.featureDomain;
|
|
60
|
+
this.log(t('commands.cap.uninstall.uninstalling', 'Uninstalling {{appName}} from {{hostname}} (site: {{site}})...', {
|
|
61
|
+
appName,
|
|
62
|
+
hostname,
|
|
63
|
+
site,
|
|
64
|
+
}));
|
|
65
|
+
const context = this.createContext('cap:uninstall', { appName, domain, site, hostname });
|
|
66
|
+
const beforeResult = await this.runBeforeHooks(context);
|
|
67
|
+
if (beforeResult.skip) {
|
|
68
|
+
this.log(t('commands.cap.uninstall.skipped', 'Uninstall skipped: {{reason}}', {
|
|
69
|
+
reason: beforeResult.skipReason || 'skipped by plugin',
|
|
70
|
+
}));
|
|
71
|
+
return {
|
|
72
|
+
execution: { execution_status: 'finished', exit_status: { code: 'skipped' } },
|
|
73
|
+
appName,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
const result = await this.operations.commerceAppUninstall(this.instance, appName, domain, {
|
|
78
|
+
siteId: site,
|
|
79
|
+
waitOptions: {
|
|
80
|
+
timeoutSeconds: timeout || undefined,
|
|
81
|
+
onPoll: (info) => {
|
|
82
|
+
if (!this.jsonEnabled()) {
|
|
83
|
+
this.log(t('commands.cap.uninstall.progress', ' Status: {{status}} ({{elapsed}}s elapsed)', {
|
|
84
|
+
status: info.status,
|
|
85
|
+
elapsed: Math.floor(info.elapsedSeconds).toString(),
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
const durationSec = result.execution.duration ? (result.execution.duration / 1000).toFixed(1) : 'N/A';
|
|
92
|
+
this.log(t('commands.cap.uninstall.completed', 'Uninstall completed: {{status}} (duration: {{duration}}s)', {
|
|
93
|
+
status: result.execution.exit_status?.code || result.execution.execution_status,
|
|
94
|
+
duration: durationSec,
|
|
95
|
+
}));
|
|
96
|
+
await this.runAfterHooks(context, {
|
|
97
|
+
success: true,
|
|
98
|
+
duration: Date.now() - context.startTime,
|
|
99
|
+
data: result,
|
|
100
|
+
});
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
await this.runAfterHooks(context, {
|
|
105
|
+
success: false,
|
|
106
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
107
|
+
duration: Date.now() - context.startTime,
|
|
108
|
+
data: error instanceof JobExecutionError ? error.execution : undefined,
|
|
109
|
+
});
|
|
110
|
+
if (error instanceof JobExecutionError) {
|
|
111
|
+
await this.showJobLog(error.execution);
|
|
112
|
+
this.error(t('commands.cap.uninstall.failed', 'Uninstall failed: {{status}}', {
|
|
113
|
+
status: error.execution.exit_status?.code || 'ERROR',
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
if (error instanceof Error) {
|
|
117
|
+
this.error(t('commands.cap.uninstall.error', 'Uninstall error: {{message}}', { message: error.message }));
|
|
118
|
+
}
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=uninstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/cap/uninstall.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAA+B;IACvE,MAAM,CAAC,IAAI,GAAG;QACZ,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,6EAA6E;YAC1F,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CAAC,oCAAoC,EAAE,uDAAuD,CAAC,EAChG,iCAAiC,CAClC,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG,CAAC,mEAAmE,CAAC,CAAC;IAExF,MAAM,CAAC,KAA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E,CAAC;gBACvC,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACvC,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,+BAA+B,EAAE,8BAA8B,EAAE;oBACjE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,IAAI,OAAO;iBACrD,CAAC,CACH,CAAC;YACJ,CAAC;YACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,8BAA8B,EAAE,8BAA8B,EAAE,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC;YAC1G,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
2
|
+
import { type CapValidationResult } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
3
|
+
export default class CapValidate extends BaseCommand<typeof CapValidate> {
|
|
4
|
+
static args: {
|
|
5
|
+
path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static enableJsonFlag: boolean;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
run(): Promise<CapValidationResult>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Args } from '@oclif/core';
|
|
7
|
+
import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
|
|
8
|
+
import { validateCap } from '@salesforce/b2c-tooling-sdk/operations/cap';
|
|
9
|
+
import { t, withDocs } from '../../i18n/index.js';
|
|
10
|
+
export default class CapValidate extends BaseCommand {
|
|
11
|
+
static args = {
|
|
12
|
+
path: Args.string({
|
|
13
|
+
description: 'Path to a CAP directory or .zip file',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
17
|
+
static description = withDocs(t('commands.cap.validate.description', 'Validate the structure and manifest of a Commerce App Package (CAP)'), '/cli/cap.html#b2c-cap-validate');
|
|
18
|
+
static enableJsonFlag = true;
|
|
19
|
+
static examples = [
|
|
20
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5',
|
|
21
|
+
'<%= config.bin %> <%= command.id %> ./commerce-avalara-tax-app-v0.2.5.zip',
|
|
22
|
+
];
|
|
23
|
+
async run() {
|
|
24
|
+
const { path } = this.args;
|
|
25
|
+
this.log(t('commands.cap.validate.validating', 'Validating CAP: {{path}}', { path }));
|
|
26
|
+
const result = await validateCap(path);
|
|
27
|
+
if (result.errors.length > 0) {
|
|
28
|
+
this.log(`\nErrors (${result.errors.length}):`);
|
|
29
|
+
for (const err of result.errors) {
|
|
30
|
+
this.log(` ✗ ${err}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (result.warnings.length > 0) {
|
|
34
|
+
this.log(`\nWarnings (${result.warnings.length}):`);
|
|
35
|
+
for (const warn of result.warnings) {
|
|
36
|
+
this.log(` ⚠ ${warn}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (result.valid) {
|
|
40
|
+
const appInfo = result.manifest ? ` (${result.manifest.name} v${result.manifest.version})` : '';
|
|
41
|
+
this.log(t('commands.cap.validate.valid', '\n✓ CAP is valid{{appInfo}}', { appInfo }));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.error(`CAP validation failed with ${result.errors.length} error(s)`, { exit: 1 });
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=validate.js.map
|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,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAC;YACpD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACnC,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAChG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,6BAA6B,EAAE,6BAA6B,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC;QACvF,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,8BAA8B,MAAM,CAAC,MAAM,CAAC,MAAM,WAAW,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC;QACvF,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { Args, Flags, ux } from '@oclif/core';
|
|
7
7
|
import { checkbox, confirm, input } from '@inquirer/prompts';
|
|
8
8
|
import { BaseCommand, createTable } from '@salesforce/b2c-tooling-sdk/cli';
|
|
9
|
-
import { ALL_IDE_TYPES, detectInstalledIdes, downloadSkillsArtifact, scanSkills, installSkills, isSkillInstalled, getIdeDisplayName, getIdeDocsUrl, findSkillsByName, } from '@salesforce/b2c-tooling-sdk/skills';
|
|
9
|
+
import { ALL_IDE_TYPES, ALL_SKILL_SETS, SKILL_SOURCES, detectInstalledIdes, downloadSkillsArtifact, scanSkills, installSkills, isSkillInstalled, getIdeDisplayName, getIdeDocsUrl, findSkillsByName, } from '@salesforce/b2c-tooling-sdk/skills';
|
|
10
10
|
import { t, withDocs } from '../../i18n/index.js';
|
|
11
11
|
/**
|
|
12
12
|
* Table columns for skill listing.
|
|
@@ -33,8 +33,8 @@ const DEFAULT_SKILL_COLUMNS = ['name', 'description', 'skillSet'];
|
|
|
33
33
|
export default class SetupSkills extends BaseCommand {
|
|
34
34
|
static args = {
|
|
35
35
|
skillset: Args.string({
|
|
36
|
-
description: 'Skill set to install: b2c or
|
|
37
|
-
options:
|
|
36
|
+
description: 'Skill set to install: b2c, b2c-cli, or cap-dev',
|
|
37
|
+
options: ALL_SKILL_SETS,
|
|
38
38
|
}),
|
|
39
39
|
};
|
|
40
40
|
static description = withDocs(t('commands.setup.skills.description', 'Install agent skills for AI-powered IDEs'), '/cli/setup.html#b2c-setup-skills');
|
|
@@ -42,6 +42,7 @@ export default class SetupSkills extends BaseCommand {
|
|
|
42
42
|
static examples = [
|
|
43
43
|
'<%= config.bin %> <%= command.id %> b2c',
|
|
44
44
|
'<%= config.bin %> <%= command.id %> b2c-cli --ide cursor --global',
|
|
45
|
+
'<%= config.bin %> <%= command.id %> cap-dev --ide claude-code --global',
|
|
45
46
|
'<%= config.bin %> <%= command.id %> b2c --list',
|
|
46
47
|
'<%= config.bin %> <%= command.id %> b2c-cli --skill b2c-code --skill b2c-webdav --ide cursor',
|
|
47
48
|
'<%= config.bin %> <%= command.id %> b2c --global --update --force',
|
|
@@ -93,15 +94,15 @@ export default class SetupSkills extends BaseCommand {
|
|
|
93
94
|
skillsets = [this.args.skillset];
|
|
94
95
|
}
|
|
95
96
|
else if (this.flags.force) {
|
|
96
|
-
this.error(t('commands.setup.skills.skillsetRequired', 'Skillset argument required in non-interactive mode. Specify b2c or
|
|
97
|
+
this.error(t('commands.setup.skills.skillsetRequired', 'Skillset argument required in non-interactive mode. Specify b2c, b2c-cli, or cap-dev.'));
|
|
97
98
|
}
|
|
98
99
|
else {
|
|
99
100
|
skillsets = await checkbox({
|
|
100
101
|
message: t('commands.setup.skills.selectSkillset', 'Select skill set(s) to install:'),
|
|
101
|
-
choices:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
choices: ALL_SKILL_SETS.map((id) => ({
|
|
103
|
+
name: `${id} - ${SKILL_SOURCES[id].displayName}`,
|
|
104
|
+
value: id,
|
|
105
|
+
})),
|
|
105
106
|
});
|
|
106
107
|
if (skillsets.length === 0) {
|
|
107
108
|
ux.stdout(t('commands.setup.skills.noSkillsetsSelected', 'No skill sets selected.'));
|
|
@@ -109,9 +110,21 @@ export default class SetupSkills extends BaseCommand {
|
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
// Download and scan skills
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
const hasReleaseArtifacts = skillsets.some((s) => SKILL_SOURCES[s].type === 'release-artifact');
|
|
114
|
+
const hasRepoContents = skillsets.some((s) => SKILL_SOURCES[s].type === 'repo-contents');
|
|
115
|
+
if (hasReleaseArtifacts && hasRepoContents) {
|
|
116
|
+
this.log(t('commands.setup.skills.downloading', 'Downloading skills...'));
|
|
117
|
+
}
|
|
118
|
+
else if (hasRepoContents) {
|
|
119
|
+
this.log(t('commands.setup.skills.downloadingRepo', 'Downloading skills from repository ({{ref}})...', {
|
|
120
|
+
ref: this.flags.version || 'main',
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.log(t('commands.setup.skills.downloadingRelease', 'Downloading skills from release {{version}}...', {
|
|
125
|
+
version: this.flags.version || 'latest',
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
115
128
|
// Download skills for all skillsets in parallel
|
|
116
129
|
const downloadResults = await Promise.all(skillsets.map(async (skillset) => {
|
|
117
130
|
const skillsDir = await downloadSkillsArtifact(skillset, {
|