@salesforce/b2c-cli 1.19.0 → 1.20.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.
Files changed (50) hide show
  1. package/dist/commands/{setup/ide/prophet.d.ts → docs/cache.d.ts} +12 -18
  2. package/dist/commands/docs/cache.js +55 -0
  3. package/dist/commands/docs/cache.js.map +1 -0
  4. package/dist/commands/docs/read.d.ts +3 -0
  5. package/dist/commands/docs/read.js +18 -2
  6. package/dist/commands/docs/read.js.map +1 -1
  7. package/dist/commands/docs/search.d.ts +3 -6
  8. package/dist/commands/docs/search.js +11 -48
  9. package/dist/commands/docs/search.js.map +1 -1
  10. package/dist/commands/preferences/global/get.d.ts +16 -0
  11. package/dist/commands/preferences/global/get.js +53 -0
  12. package/dist/commands/preferences/global/get.js.map +1 -0
  13. package/dist/commands/preferences/global/list.d.ts +15 -0
  14. package/dist/commands/preferences/global/list.js +80 -0
  15. package/dist/commands/preferences/global/list.js.map +1 -0
  16. package/dist/commands/preferences/global/update.d.ts +18 -0
  17. package/dist/commands/preferences/global/update.js +102 -0
  18. package/dist/commands/preferences/global/update.js.map +1 -0
  19. package/dist/commands/preferences/site/get.d.ts +16 -0
  20. package/dist/commands/preferences/site/get.js +53 -0
  21. package/dist/commands/preferences/site/get.js.map +1 -0
  22. package/dist/commands/preferences/site/list.d.ts +16 -0
  23. package/dist/commands/preferences/site/list.js +84 -0
  24. package/dist/commands/preferences/site/list.js.map +1 -0
  25. package/dist/commands/preferences/site/preference/get.d.ts +16 -0
  26. package/dist/commands/preferences/site/preference/get.js +52 -0
  27. package/dist/commands/preferences/site/preference/get.js.map +1 -0
  28. package/dist/commands/preferences/site/preference/update.d.ts +19 -0
  29. package/dist/commands/preferences/site/preference/update.js +107 -0
  30. package/dist/commands/preferences/site/preference/update.js.map +1 -0
  31. package/dist/commands/preferences/site/search.d.ts +28 -0
  32. package/dist/commands/preferences/site/search.js +177 -0
  33. package/dist/commands/preferences/site/search.js.map +1 -0
  34. package/dist/commands/preferences/site/update.d.ts +19 -0
  35. package/dist/commands/preferences/site/update.js +103 -0
  36. package/dist/commands/preferences/site/update.js.map +1 -0
  37. package/dist/commands/setup/ide/index.js +1 -1
  38. package/dist/commands/setup/ide/index.js.map +1 -1
  39. package/dist/commands/setup/index.js +1 -1
  40. package/dist/commands/setup/index.js.map +1 -1
  41. package/dist/utils/docs/workspace.d.ts +31 -0
  42. package/dist/utils/docs/workspace.js +68 -0
  43. package/dist/utils/docs/workspace.js.map +1 -0
  44. package/dist/utils/preferences.d.ts +48 -0
  45. package/dist/utils/preferences.js +125 -0
  46. package/dist/utils/preferences.js.map +1 -0
  47. package/oclif.manifest.json +16562 -13743
  48. package/package.json +18 -2
  49. package/dist/commands/setup/ide/prophet.js +0 -327
  50. package/dist/commands/setup/ide/prophet.js.map +0 -1
@@ -1,21 +1,20 @@
1
1
  import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
2
- /**
3
- * JSON output structure for setup ide prophet command.
4
- */
5
- interface SetupIdeProphetResponse {
6
- overwritten: boolean;
7
- path: string;
2
+ interface CacheResult {
3
+ /** The action taken: reported stats only, or cleared the cache. */
4
+ action: 'clear' | 'status';
5
+ /** Cache directory. */
6
+ dir: string;
7
+ /** Number of cached files (before clearing, when `--clear`). */
8
+ files: number;
9
+ /** Total bytes (before clearing, when `--clear`). */
10
+ bytes: number;
8
11
  }
9
- /**
10
- * Create dw.js integration script for Prophet VS Code extension.
11
- */
12
- export default class SetupIdeProphet extends BaseCommand<typeof SetupIdeProphet> {
12
+ export default class DocsCache extends BaseCommand<typeof DocsCache> {
13
13
  static description: string;
14
14
  static enableJsonFlag: boolean;
15
15
  static examples: string[];
16
16
  static flags: {
17
- output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
18
- force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ clear: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
18
  'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
19
  debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
20
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -28,11 +27,6 @@ export default class SetupIdeProphet extends BaseCommand<typeof SetupIdeProphet>
28
27
  'extra-body': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
28
  'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
29
  };
31
- run(): Promise<SetupIdeProphetResponse>;
32
- /**
33
- * Build setup inspect arguments for the generated script.
34
- * Includes setup context flags so runtime resolution matches command intent.
35
- */
36
- private buildInspectArgs;
30
+ run(): Promise<CacheResult>;
37
31
  }
38
32
  export {};
@@ -0,0 +1,55 @@
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 { Flags } from '@oclif/core';
7
+ import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
8
+ import { getContentCacheStats, purgeContentCache } from '@salesforce/b2c-tooling-sdk/docs';
9
+ import { t } from '../../i18n/index.js';
10
+ function formatBytes(bytes) {
11
+ if (bytes < 1024)
12
+ return `${bytes} B`;
13
+ if (bytes < 1024 * 1024)
14
+ return `${(bytes / 1024).toFixed(1)} KB`;
15
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
16
+ }
17
+ export default class DocsCache extends BaseCommand {
18
+ static description = t('commands.docs.cache.description', 'Show or clear the local documentation content cache (online docs cached after first read)');
19
+ static enableJsonFlag = true;
20
+ static examples = [
21
+ '<%= config.bin %> <%= command.id %>',
22
+ '<%= config.bin %> <%= command.id %> --clear',
23
+ '<%= config.bin %> <%= command.id %> --json',
24
+ ];
25
+ static flags = {
26
+ ...BaseCommand.baseFlags,
27
+ clear: Flags.boolean({
28
+ description: 'Delete all cached documentation content (memory + on-disk)',
29
+ default: false,
30
+ }),
31
+ };
32
+ async run() {
33
+ const { clear } = this.flags;
34
+ if (clear) {
35
+ const purged = purgeContentCache();
36
+ if (!this.jsonEnabled()) {
37
+ this.log(t('commands.docs.cache.cleared', 'Cleared documentation cache: removed {{files}} file(s) ({{size}}) from {{dir}}', { files: purged.files, size: formatBytes(purged.bytes), dir: purged.dir }));
38
+ }
39
+ return { action: 'clear', dir: purged.dir, files: purged.files, bytes: purged.bytes };
40
+ }
41
+ const stats = getContentCacheStats();
42
+ if (!this.jsonEnabled()) {
43
+ this.log(t('commands.docs.cache.status', 'Documentation cache: {{files}} file(s), {{size}} at {{dir}}', {
44
+ files: stats.files,
45
+ size: formatBytes(stats.bytes),
46
+ dir: stats.dir,
47
+ }));
48
+ if (stats.files > 0) {
49
+ this.log(t('commands.docs.cache.clearHint', 'Run with --clear to empty it.'));
50
+ }
51
+ }
52
+ return { action: 'status', dir: stats.dir, files: stats.files, bytes: stats.bytes };
53
+ }
54
+ }
55
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/commands/docs/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAyB,MAAM,kCAAkC,CAAC;AACjH,OAAO,EAAC,CAAC,EAAC,MAAM,qBAAqB,CAAC;AAatC,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,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AAG,oBAAoB,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CACN,CAAC,CAAC,4BAA4B,EAAE,6DAA6D,EAAE;gBAC7F,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC;gBAC9B,GAAG,EAAE,KAAK,CAAC,GAAG;aACf,CAAC,CACH,CAAC;YACF,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;gBACpB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,+BAA+B,EAAE,+BAA+B,CAAC,CAAC,CAAC;YAChF,CAAC;QACH,CAAC;QACD,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAC,CAAC;IACpF,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
2
2
  import { readDocByQuery, type DocEntry } from '@salesforce/b2c-tooling-sdk/docs';
3
+ import { detectWorkspaceType } from '@salesforce/b2c-tooling-sdk/discovery';
3
4
  interface ReadDocsResult {
4
5
  entry: DocEntry;
5
6
  content: string;
@@ -14,6 +15,7 @@ export default class DocsRead extends BaseCommand<typeof DocsRead> {
14
15
  static flags: {
15
16
  raw: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
17
  topics: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
19
  'log-level': import("@oclif/core/interfaces").OptionFlag<"trace" | "debug" | "info" | "warn" | "error" | "silent" | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
20
  debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
21
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -28,6 +30,7 @@ export default class DocsRead extends BaseCommand<typeof DocsRead> {
28
30
  };
29
31
  protected operations: {
30
32
  readDocByQuery: typeof readDocByQuery;
33
+ detectWorkspaceType: typeof detectWorkspaceType;
31
34
  };
32
35
  run(): Promise<ReadDocsResult>;
33
36
  }
@@ -8,7 +8,9 @@ import { marked } from 'marked';
8
8
  import { markedTerminal } from 'marked-terminal';
9
9
  import { BaseCommand } from '@salesforce/b2c-tooling-sdk/cli';
10
10
  import { readDocByQuery, resolveEnabledCategories } from '@salesforce/b2c-tooling-sdk/docs';
11
+ import { detectWorkspaceType, PROJECT_TYPES } from '@salesforce/b2c-tooling-sdk/discovery';
11
12
  import { t } from '../../i18n/index.js';
13
+ import { resolveDocsWorkspace } from '../../utils/docs/workspace.js';
12
14
  // Configure marked with terminal renderer
13
15
  marked.use(markedTerminal({
14
16
  width: 80,
@@ -46,17 +48,31 @@ export default class DocsRead extends BaseCommand {
46
48
  'corpus). Unknown names are ignored with a warning.',
47
49
  env: 'SFCC_DOCS_TOPICS',
48
50
  }),
51
+ workspace: Flags.string({
52
+ // No oclif `options`: it validates the whole value, so it would reject a
53
+ // comma-separated list. Validation happens in resolveDocsWorkspace.
54
+ description: `Favor docs for a workspace type (auto|all|${PROJECT_TYPES.join('|')}) when resolving a fuzzy query, ` +
55
+ 'matching `docs search` ranking. Defaults to auto-detecting; "all" applies no preference. ' +
56
+ 'Ignored for an exact id match.',
57
+ }),
49
58
  };
50
59
  operations = {
51
60
  readDocByQuery,
61
+ detectWorkspaceType,
52
62
  };
53
63
  async run() {
54
64
  const { query } = this.args;
55
65
  const { raw } = this.flags;
56
- const enabledCategories = resolveEnabledCategories(this.flags.topics, (invalid) => this.warn(t('commands.docs.read.invalidTopics', 'Ignoring unknown documentation topic(s): {{topics}}', {
66
+ // Flag first (--topics / SFCC_DOCS_TOPICS), else config `docsCategories`.
67
+ const topicsInput = this.flags.topics ?? this.resolvedConfig?.values.docsCategories;
68
+ const enabledCategories = resolveEnabledCategories(topicsInput, (invalid) => this.warn(t('commands.docs.read.invalidTopics', 'Ignoring unknown documentation topic(s): {{topics}}', {
57
69
  topics: invalid.join(', '),
58
70
  })));
59
- const result = await this.operations.readDocByQuery(query, { enabledCategories });
71
+ // Resolve workspace the same way `docs search` does, so a fuzzy `docs read`
72
+ // picks the same top hit search ranks first (exact id matches ignore it —
73
+ // readDocByQuery short-circuits on an exact id before searching).
74
+ const workspace = await resolveDocsWorkspace(this.flags.workspace, this.operations.detectWorkspaceType, this.logger, this.warn.bind(this));
75
+ const result = await this.operations.readDocByQuery(query, { enabledCategories, workspace });
60
76
  if (!result) {
61
77
  this.error(t('commands.docs.read.notFound', 'No documentation found matching: {{query}}', { query }), {
62
78
  suggestions: ['Try a broader search term', 'Use "b2c docs search <query>" to see available matches'],
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/commands/docs/read.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAC,cAAc,EAAE,wBAAwB,EAAgB,MAAM,kCAAkC,CAAC;AACzG,OAAO,EAAC,CAAC,EAAC,MAAM,qBAAqB,CAAC;AAOtC,0CAA0C;AAC1C,MAAM,CAAC,GAAG,CACR,cAAc,CAAC;IACb,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE;QACZ,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;KACpB;CACF,CAAC,CACH,CAAC;AAEF,MAAM,CAAC,OAAO,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sD;QACtD,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QAE5C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAkB,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -44,12 +44,9 @@ export default class DocsSearch extends BaseCommand<typeof DocsSearch> {
44
44
  };
45
45
  run(): Promise<ListDocsResponse | SearchDocsResponse>;
46
46
  /**
47
- * Resolves the --workspace flag to concrete project type(s).
48
- *
49
- * Workspace awareness is ON by default (matching the MCP docs tools): when
50
- * the flag is unset — or explicitly `auto` — workspace detection runs and its
51
- * result favors the detected workspace's docs. `all` opts out (no
52
- * preference); an explicit type (or comma-separated list) is used verbatim without detection.
47
+ * Resolves the --workspace flag to concrete project type(s). Shared with
48
+ * `docs read` via {@link resolveDocsWorkspace} so both apply the same
49
+ * workspace-aware ranking.
53
50
  */
54
51
  private resolveWorkspace;
55
52
  }
@@ -8,6 +8,7 @@ import { BaseCommand, TableRenderer, columnFlagsFor, selectColumns, } from '@sal
8
8
  import { searchDocs, listDocs, categoriesForWorkspace, resolveEnabledCategories, DOC_CATEGORIES, } from '@salesforce/b2c-tooling-sdk/docs';
9
9
  import { detectWorkspaceType, PROJECT_TYPES } from '@salesforce/b2c-tooling-sdk/discovery';
10
10
  import { t } from '../../i18n/index.js';
11
+ import { resolveDocsWorkspace } from '../../utils/docs/workspace.js';
11
12
  /**
12
13
  * The `--workspace` sentinels plus every concrete workspace marker (from the
13
14
  * SDK's canonical {@link PROJECT_TYPES}). `auto` forces detection, `all` opts
@@ -113,8 +114,11 @@ export default class DocsSearch extends BaseCommand {
113
114
  async run() {
114
115
  const { query } = this.args;
115
116
  const { limit, list, category } = this.flags;
116
- // Launch-time allowlist that bounds the whole corpus (from --topics / SFCC_DOCS_TOPICS).
117
- const enabledCategories = resolveEnabledCategories(this.flags.topics, (invalid) => this.warn(t('commands.docs.search.invalidTopics', 'Ignoring unknown documentation topic(s): {{topics}}', {
117
+ // Allowlist that bounds the whole corpus. Precedence: --topics /
118
+ // SFCC_DOCS_TOPICS flag first, else the resolved config's `docsCategories`
119
+ // (dw.json `docs-categories`, SFCC_DOCS_CATEGORIES, package.json).
120
+ const topicsInput = this.flags.topics ?? this.resolvedConfig?.values.docsCategories;
121
+ const enabledCategories = resolveEnabledCategories(topicsInput, (invalid) => this.warn(t('commands.docs.search.invalidTopics', 'Ignoring unknown documentation topic(s): {{topics}}', {
118
122
  topics: invalid.join(', '),
119
123
  })));
120
124
  // List mode
@@ -177,53 +181,12 @@ export default class DocsSearch extends BaseCommand {
177
181
  return response;
178
182
  }
179
183
  /**
180
- * Resolves the --workspace flag to concrete project type(s).
181
- *
182
- * Workspace awareness is ON by default (matching the MCP docs tools): when
183
- * the flag is unset — or explicitly `auto` — workspace detection runs and its
184
- * result favors the detected workspace's docs. `all` opts out (no
185
- * preference); an explicit type (or comma-separated list) is used verbatim without detection.
184
+ * Resolves the --workspace flag to concrete project type(s). Shared with
185
+ * `docs read` via {@link resolveDocsWorkspace} so both apply the same
186
+ * workspace-aware ranking.
186
187
  */
187
- async resolveWorkspace(value) {
188
- if (value === 'all') {
189
- this.logger.debug('Workspace preference disabled (--workspace all); no detection run');
190
- return undefined;
191
- }
192
- if (!value || value === 'auto') {
193
- const cwd = process.cwd();
194
- const detection = await this.operations.detectWorkspaceType(cwd);
195
- const resolved = detection.projectTypes.length > 0 ? detection.projectTypes : undefined;
196
- this.logger.debug({
197
- cwd,
198
- workspaceFlag: value ?? '(unset, defaults to auto)',
199
- matchedPatterns: detection.matchedPatterns,
200
- projectTypes: detection.projectTypes,
201
- resolved: resolved ?? null,
202
- }, resolved
203
- ? `Auto-detected workspace: ${resolved.join(', ')}`
204
- : 'No workspace detected; searching with no workspace preference');
205
- return resolved;
206
- }
207
- // Handle one or more comma-separated explicit types. Validate against the
208
- // canonical PROJECT_TYPES; warn on (and drop) anything unrecognized.
209
- const known = new Set(PROJECT_TYPES);
210
- const requested = value
211
- .split(',')
212
- .map((t) => t.trim().toLowerCase())
213
- .filter((t) => t.length > 0);
214
- const valid = requested.filter((t) => known.has(t));
215
- const invalid = requested.filter((t) => !known.has(t));
216
- if (invalid.length > 0) {
217
- this.warn(t('commands.docs.search.invalidWorkspace', 'Ignoring unknown workspace type(s): {{types}}', {
218
- types: invalid.join(', '),
219
- }));
220
- }
221
- if (valid.length === 0) {
222
- this.logger.debug({ requested }, 'No valid workspace types specified; searching with no workspace preference');
223
- return undefined;
224
- }
225
- this.logger.debug({ workspace: valid }, 'Using explicitly specified workspace type(s)');
226
- return [...new Set(valid)];
188
+ resolveWorkspace(value) {
189
+ return resolveDocsWorkspace(value, this.operations.detectWorkspaceType, this.logger, this.warn.bind(this));
227
190
  }
228
191
  }
229
192
  //# sourceMappingURL=search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/commands/docs/search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,GAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,GAIf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,mBAAmB,EAAE,aAAa,EAAmB,MAAM,uCAAuC,CAAC;AAC3G,OAAO,EAAC,CAAC,EAAC,MAAM,qBAAqB,CAAC;AAatC;;;;;;GAMG;AACH,MAAM,q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I,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,gCAAgC,EAAE,4CAA4C,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC;YACtG,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE/G,IAAI,CAAC,GAAG,CACN,CAAC,CAAC,kCAAkC,EAAE,yCAAyC,EAAE;YAC/E,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,KAAK;SACN,CAAC,CACH,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAC,KAAyB;QAChD,OAAO,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7G,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { PreferencesCommand } from '../../../utils/preferences.js';
2
+ import { type OrganizationPreferences } from '@salesforce/b2c-tooling-sdk';
3
+ export default class PreferencesGlobalGet extends PreferencesCommand<typeof PreferencesGlobalGet> {
4
+ static args: {
5
+ 'group-id': 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
+ 'instance-type': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'mask-passwords': import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ expand: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ };
15
+ run(): Promise<OrganizationPreferences>;
16
+ }
@@ -0,0 +1,53 @@
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, ux } from '@oclif/core';
7
+ import { PreferencesCommand, instanceTypeFlag, maskPasswordsFlag } from '../../../utils/preferences.js';
8
+ import { getApiErrorMessage, } from '@salesforce/b2c-tooling-sdk';
9
+ import { t, withDocs } from '../../../i18n/index.js';
10
+ export default class PreferencesGlobalGet extends PreferencesCommand {
11
+ static args = {
12
+ 'group-id': Args.string({
13
+ description: 'Preference group ID',
14
+ required: true,
15
+ }),
16
+ };
17
+ static description = withDocs(t('commands.preferences.global.get.description', 'Read custom preferences in a global preference group for a given instance type'), '/cli/preferences.html#get-global');
18
+ static enableJsonFlag = true;
19
+ static examples = [
20
+ '<%= config.bin %> <%= command.id %> CustomGroupId --tenant-id zzxy_prd',
21
+ '<%= config.bin %> <%= command.id %> CustomGroupId --instance-type staging --tenant-id zzxy_prd',
22
+ '<%= config.bin %> <%= command.id %> CustomGroupId --tenant-id zzxy_prd --expand sites',
23
+ ];
24
+ static flags = {
25
+ 'instance-type': instanceTypeFlag,
26
+ 'mask-passwords': maskPasswordsFlag,
27
+ expand: Flags.string({
28
+ description: 'Expand option ("sites" returns site-specific values)',
29
+ options: ['sites'],
30
+ }),
31
+ };
32
+ async run() {
33
+ this.requireOAuthCredentials();
34
+ const { 'group-id': groupId } = this.args;
35
+ const { 'instance-type': instanceType, 'mask-passwords': maskPasswords, expand } = this.flags;
36
+ const organizationId = this.getOrganizationId();
37
+ const result = await this.preferencesClient.GET('/organizations/{organizationId}/global-preference-groups/{groupId}/{instanceType}', {
38
+ params: {
39
+ path: { organizationId, groupId, instanceType: instanceType },
40
+ query: { maskPasswords, expand: expand ? [expand] : undefined },
41
+ },
42
+ });
43
+ if (!result.data) {
44
+ const message = getApiErrorMessage(result.error, result.response);
45
+ this.error(t('commands.preferences.global.get.error', 'Failed to read global preference group: {{message}}', { message }));
46
+ }
47
+ if (this.jsonEnabled())
48
+ return result.data;
49
+ ux.stdout(JSON.stringify(result.data, null, 2) + '\n');
50
+ return result.data;
51
+ }
52
+ }
53
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/preferences/global/get.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACtG,OAAO,EACL,kBAAkB,GAGnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,CAAC,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,kBAA+C;IAC/F,MAAM,CAAC,IAAI,GAAG;QACZ,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAC3B,CAAC,CACC,6CAA6C,EAC7C,gFAAgF,CACjF,EACD,kCAAkC,CACnC,CAAC;IAEF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAG;QAChB,wEAAwE;QACxE,gGAAgG;QAChG,uFAAuF;KACxF,CAAC;IAEF,MAAM,CAAC,KAAK,GAAG;QACb,eAAe,EAAE,gBAAgB;QACjC,gBAAgB,EAAE,iBAAiB;QACnC,MAAM,EAAE,KAAK,CAAC,MAAM,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0 +1,15 @@
1
+ import { PreferencesCommand } from '../../../utils/preferences.js';
2
+ import { type CustomPreferenceList } from '@salesforce/b2c-tooling-sdk';
3
+ export default class PreferencesGlobalList extends PreferencesCommand<typeof PreferencesGlobalList> {
4
+ static description: string;
5
+ static enableJsonFlag: boolean;
6
+ static examples: string[];
7
+ static flags: {
8
+ columns: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ extended: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ offset: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'mask-password': import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ run(): Promise<CustomPreferenceList>;
15
+ }
@@ -0,0 +1,80 @@
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 { Flags, ux } from '@oclif/core';
7
+ import { PreferencesCommand } from '../../../utils/preferences.js';
8
+ import { TableRenderer, columnFlagsFor, selectColumns } from '@salesforce/b2c-tooling-sdk/cli';
9
+ import { getApiErrorMessage } from '@salesforce/b2c-tooling-sdk';
10
+ import { t, withDocs } from '../../../i18n/index.js';
11
+ const COLUMNS = {
12
+ id: { header: 'ID', get: (p) => p.id || '-' },
13
+ value: { header: 'Value', get: (p) => formatValue(p.value) },
14
+ groupId: { header: 'Group ID', get: (p) => p.groupId || '-', extended: true },
15
+ };
16
+ const DEFAULT_COLUMNS = ['id', 'value'];
17
+ const tableRenderer = new TableRenderer(COLUMNS);
18
+ function formatValue(value) {
19
+ if (value === null || value === undefined)
20
+ return '-';
21
+ if (typeof value === 'object')
22
+ return JSON.stringify(value);
23
+ return String(value);
24
+ }
25
+ export default class PreferencesGlobalList extends PreferencesCommand {
26
+ static description = withDocs(t('commands.preferences.global.list.description', 'List global custom preferences for the organization'), '/cli/preferences.html#list-global');
27
+ static enableJsonFlag = true;
28
+ static examples = [
29
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd',
30
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --limit 50',
31
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --extended',
32
+ '<%= config.bin %> <%= command.id %> --tenant-id zzxy_prd --json',
33
+ ];
34
+ static flags = {
35
+ limit: Flags.integer({
36
+ char: 'l',
37
+ description: 'Maximum number of results (1-200)',
38
+ default: 200,
39
+ min: 1,
40
+ max: 200,
41
+ }),
42
+ offset: Flags.integer({
43
+ char: 'o',
44
+ description: 'Result offset for pagination',
45
+ default: 0,
46
+ min: 0,
47
+ }),
48
+ 'mask-password': Flags.boolean({
49
+ description: 'Mask values of type password',
50
+ default: false,
51
+ allowNo: true,
52
+ }),
53
+ ...columnFlagsFor(COLUMNS),
54
+ };
55
+ async run() {
56
+ this.requireOAuthCredentials();
57
+ const { limit, offset, 'mask-password': maskPassword } = this.flags;
58
+ const organizationId = this.getOrganizationId();
59
+ const result = await this.preferencesClient.GET('/organizations/{organizationId}/global-custom-preferences', {
60
+ params: {
61
+ path: { organizationId },
62
+ query: { limit, offset, maskPassword },
63
+ },
64
+ });
65
+ if (!result.data) {
66
+ const message = getApiErrorMessage(result.error, result.response);
67
+ this.error(t('commands.preferences.global.list.error', 'Failed to list global custom preferences: {{message}}', { message }));
68
+ }
69
+ if (this.jsonEnabled())
70
+ return result.data;
71
+ const data = result.data.data || [];
72
+ ux.stdout('\n');
73
+ tableRenderer.render(data, selectColumns(this.flags, tableRenderer, DEFAULT_COLUMNS, this.warn.bind(this)));
74
+ ux.stdout(t('commands.preferences.global.list.total', '\nTotal: {{total}} preferences\n', {
75
+ total: result.data.total ?? data.length,
76
+ }));
77
+ return result.data;
78
+ }
79
+ }
80
+ //# sourceMappingURL=list.js.map
@@ -0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AAE,MAAM,EAAE,YAAY,EAAC;aACrC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAClE,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,wCAAwC,EAAE,uDAAuD,EAAE,EAAC,OAAO,EAAC,CAAC,CAChH,CAAC;QACJ,CAAC;QAED,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC;QAE3C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACpC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChB,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5G,EAAE,CAAC,MAAM,CACP,CAAC,CAAC,wCAAwC,EAAE,kCAAkC,EAAE;YAC9E,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM;SACxC,CAAC,CACH,CAAC;QAEF,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { PreferencesCommand } from '../../../utils/preferences.js';
2
+ import { type OrganizationPreferences } from '@salesforce/b2c-tooling-sdk';
3
+ export default class PreferencesGlobalUpdate extends PreferencesCommand<typeof PreferencesGlobalUpdate> {
4
+ static args: {
5
+ 'group-id': 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
+ 'instance-type': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'mask-passwords': import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ };
16
+ static strict: boolean;
17
+ run(): Promise<OrganizationPreferences>;
18
+ }
@@ -0,0 +1,102 @@
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 fs from 'node:fs';
7
+ import { Args, Flags, ux } from '@oclif/core';
8
+ import { PreferencesCommand, buildAssignmentMap, instanceTypeFlag, maskPasswordsFlag, } from '../../../utils/preferences.js';
9
+ import { getApiErrorMessage, } from '@salesforce/b2c-tooling-sdk';
10
+ import { t, withDocs } from '../../../i18n/index.js';
11
+ export default class PreferencesGlobalUpdate extends PreferencesCommand {
12
+ static args = {
13
+ 'group-id': Args.string({
14
+ description: 'Preference group ID',
15
+ required: true,
16
+ }),
17
+ };
18
+ static description = withDocs(t('commands.preferences.global.update.description', 'Update custom preferences in a global preference group. Pass attribute assignments (KEY=value, KEY:=json, KEY=@file, KEY:=@file, KEY=) or use --file/--body for bulk edits.'), '/cli/preferences.html#update-global');
19
+ static enableJsonFlag = true;
20
+ static examples = [
21
+ '<%= config.bin %> <%= command.id %> CustomGroupId c_name=hello c_count:=5 c_on:=true --tenant-id zzxy_prd',
22
+ '<%= config.bin %> <%= command.id %> CustomGroupId -I staging c_count:=5 --tenant-id zzxy_prd',
23
+ '<%= config.bin %> <%= command.id %> CustomGroupId c_temp= --tenant-id zzxy_prd',
24
+ '<%= config.bin %> <%= command.id %> CustomGroupId --file prefs.json --tenant-id zzxy_prd',
25
+ ];
26
+ static flags = {
27
+ 'instance-type': instanceTypeFlag,
28
+ file: Flags.string({
29
+ char: 'f',
30
+ description: 'JSON file with preferences body. Custom attributes use the "c_" prefix.',
31
+ exclusive: ['body'],
32
+ }),
33
+ body: Flags.string({
34
+ description: 'Inline JSON body with preferences. Custom attributes use the "c_" prefix.',
35
+ exclusive: ['file'],
36
+ }),
37
+ 'mask-passwords': maskPasswordsFlag,
38
+ };
39
+ // Allow variadic KEY=value / KEY:=json assignments after <group-id>.
40
+ static strict = false;
41
+ async run() {
42
+ this.requireOAuthCredentials();
43
+ const { 'group-id': groupId } = this.args;
44
+ const { 'instance-type': instanceType, file, body, 'mask-passwords': maskPasswords } = this.flags;
45
+ const organizationId = this.getOrganizationId();
46
+ // Variadic assignments are everything in argv after the group-id positional.
47
+ const { argv } = await this.parse(PreferencesGlobalUpdate);
48
+ const assignments = argv.slice(1);
49
+ const haveAssignments = assignments.length > 0;
50
+ if (haveAssignments && (file || body)) {
51
+ this.error(t('commands.preferences.assignmentsAndBodyExclusive', 'Provide either KEY=value assignments or --file/--body, not both.'));
52
+ }
53
+ if (!haveAssignments && !file && !body) {
54
+ this.error(t('commands.preferences.bodyRequired', 'Provide KEY=value assignments or --file/--body with the preferences to update.'));
55
+ }
56
+ let requestBody;
57
+ if (haveAssignments) {
58
+ try {
59
+ requestBody = buildAssignmentMap(assignments);
60
+ }
61
+ catch (error) {
62
+ this.error(error.message);
63
+ }
64
+ }
65
+ else {
66
+ let raw;
67
+ if (file) {
68
+ if (!fs.existsSync(file)) {
69
+ this.error(t('commands.preferences.fileNotFound', 'File not found: {{file}}', { file }));
70
+ }
71
+ raw = fs.readFileSync(file, 'utf8');
72
+ }
73
+ else {
74
+ raw = body;
75
+ }
76
+ try {
77
+ requestBody = JSON.parse(raw);
78
+ }
79
+ catch {
80
+ this.error(t('commands.preferences.parseError', 'Failed to parse JSON body'));
81
+ }
82
+ }
83
+ const result = await this.preferencesRwClient.PATCH('/organizations/{organizationId}/global-preference-groups/{groupId}/{instanceType}', {
84
+ params: {
85
+ path: { organizationId, groupId, instanceType: instanceType },
86
+ query: { maskPasswords },
87
+ },
88
+ body: requestBody,
89
+ });
90
+ if (!result.data) {
91
+ const message = getApiErrorMessage(result.error, result.response);
92
+ this.error(t('commands.preferences.global.update.error', 'Failed to update global preference group: {{message}}', {
93
+ message,
94
+ }));
95
+ }
96
+ if (this.jsonEnabled())
97
+ return result.data;
98
+ ux.stdout(JSON.stringify(result.data, null, 2) + '\n');
99
+ return result.data;
100
+ }
101
+ }
102
+ //# sourceMappingURL=update.js.map