@salesforce/b2c-tooling-sdk 2.3.0 → 2.4.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 (99) hide show
  1. package/data/guides/enrichment.json +291 -0
  2. package/data/guides/index.json +426 -37
  3. package/data/schemas/dw.schema.json +576 -0
  4. package/data/tooling/index.json +14 -5
  5. package/dist/esm/cli/base-command.d.ts +20 -1
  6. package/dist/esm/cli/base-command.js +57 -8
  7. package/dist/esm/cli/base-command.js.map +1 -1
  8. package/dist/esm/cli/command-search.d.ts +85 -0
  9. package/dist/esm/cli/command-search.js +147 -0
  10. package/dist/esm/cli/command-search.js.map +1 -0
  11. package/dist/esm/cli/config.d.ts +10 -1
  12. package/dist/esm/cli/config.js +16 -9
  13. package/dist/esm/cli/config.js.map +1 -1
  14. package/dist/esm/cli/index.d.ts +2 -0
  15. package/dist/esm/cli/index.js +2 -0
  16. package/dist/esm/cli/index.js.map +1 -1
  17. package/dist/esm/cli/instance-command.d.ts +1 -0
  18. package/dist/esm/cli/mrt-command.d.ts +3 -2
  19. package/dist/esm/cli/mrt-command.js +4 -4
  20. package/dist/esm/cli/mrt-command.js.map +1 -1
  21. package/dist/esm/cli/oauth-command.d.ts +1 -0
  22. package/dist/esm/cli/ods-command.d.ts +1 -0
  23. package/dist/esm/cli/webdav-command.d.ts +1 -0
  24. package/dist/esm/clients/custom-apis.d.ts +36 -2
  25. package/dist/esm/clients/custom-apis.js +57 -4
  26. package/dist/esm/clients/custom-apis.js.map +1 -1
  27. package/dist/esm/clients/index.d.ts +1 -1
  28. package/dist/esm/clients/index.js +1 -1
  29. package/dist/esm/clients/index.js.map +1 -1
  30. package/dist/esm/config/dw-json-schema.d.ts +14 -0
  31. package/dist/esm/config/dw-json-schema.js +265 -0
  32. package/dist/esm/config/dw-json-schema.js.map +1 -0
  33. package/dist/esm/config/index.d.ts +6 -2
  34. package/dist/esm/config/index.js +4 -2
  35. package/dist/esm/config/index.js.map +1 -1
  36. package/dist/esm/config/mapping.d.ts +5 -0
  37. package/dist/esm/config/mapping.js +14 -1
  38. package/dist/esm/config/mapping.js.map +1 -1
  39. package/dist/esm/config/project-environment.d.ts +62 -0
  40. package/dist/esm/config/project-environment.js +113 -0
  41. package/dist/esm/config/project-environment.js.map +1 -1
  42. package/dist/esm/config/resolver.js +52 -8
  43. package/dist/esm/config/resolver.js.map +1 -1
  44. package/dist/esm/config/sources/dw-json-source.js +25 -3
  45. package/dist/esm/config/sources/dw-json-source.js.map +1 -1
  46. package/dist/esm/config/sources/env-source.d.ts +42 -8
  47. package/dist/esm/config/sources/env-source.js +83 -50
  48. package/dist/esm/config/sources/env-source.js.map +1 -1
  49. package/dist/esm/config/sources/index.d.ts +1 -1
  50. package/dist/esm/config/sources/index.js +1 -1
  51. package/dist/esm/config/sources/index.js.map +1 -1
  52. package/dist/esm/config/types.d.ts +7 -3
  53. package/dist/esm/docs/search.js +3 -1
  54. package/dist/esm/docs/search.js.map +1 -1
  55. package/dist/esm/docs/types.d.ts +3 -1
  56. package/dist/esm/guidance/bundle.d.ts +33 -0
  57. package/dist/esm/guidance/bundle.js +268 -0
  58. package/dist/esm/guidance/bundle.js.map +1 -0
  59. package/dist/esm/guidance/catalog.d.ts +8 -1
  60. package/dist/esm/guidance/catalog.js +48 -6
  61. package/dist/esm/guidance/catalog.js.map +1 -1
  62. package/dist/esm/guidance/index.d.ts +1 -0
  63. package/dist/esm/guidance/index.js +1 -0
  64. package/dist/esm/guidance/index.js.map +1 -1
  65. package/dist/esm/guidance/types.d.ts +17 -1
  66. package/dist/esm/guidance/types.js.map +1 -1
  67. package/dist/esm/index.d.ts +1 -1
  68. package/dist/esm/index.js +1 -1
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/scapi/catalog.d.ts +5 -2
  71. package/dist/esm/scapi/catalog.js.map +1 -1
  72. package/dist/esm/scapi/index.d.ts +2 -1
  73. package/dist/esm/scapi/index.js +2 -1
  74. package/dist/esm/scapi/index.js.map +1 -1
  75. package/dist/esm/scapi/live.d.ts +2 -2
  76. package/dist/esm/scapi/live.js +3 -3
  77. package/dist/esm/scapi/live.js.map +1 -1
  78. package/dist/esm/scapi/local.d.ts +9 -0
  79. package/dist/esm/scapi/local.js +91 -0
  80. package/dist/esm/scapi/local.js.map +1 -0
  81. package/dist/esm/scapi/request.js +2 -1
  82. package/dist/esm/scapi/request.js.map +1 -1
  83. package/dist/esm/scapi/worker-source.js +1 -1
  84. package/dist/esm/telemetry/telemetry.d.ts +1 -0
  85. package/dist/esm/telemetry/telemetry.js +18 -1
  86. package/dist/esm/telemetry/telemetry.js.map +1 -1
  87. package/dist/esm/telemetry/types.d.ts +9 -0
  88. package/dist/esm/test-utils/config-isolation.js +12 -13
  89. package/dist/esm/test-utils/config-isolation.js.map +1 -1
  90. package/dist/esm/ux/agent-context.d.ts +69 -0
  91. package/dist/esm/ux/agent-context.js +133 -0
  92. package/dist/esm/ux/agent-context.js.map +1 -0
  93. package/dist/esm/ux/confirm.d.ts +27 -0
  94. package/dist/esm/ux/confirm.js +32 -0
  95. package/dist/esm/ux/confirm.js.map +1 -1
  96. package/dist/esm/ux/index.d.ts +2 -1
  97. package/dist/esm/ux/index.js +2 -1
  98. package/dist/esm/ux/index.js.map +1 -1
  99. package/package.json +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"config-isolation.js","sourceRoot":"","sources":["../../../src/test-utils/config-isolation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAEhD,MAAM,mBAAmB,GAAG,CAAC,0BAA0B,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAMjF,IAAI,KAAK,GAA0B,IAAI,CAAC;AAExC,MAAM,UAAU,aAAa;IAC3B,IAAI,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IAElG,MAAM,YAAY,GAAuC,EAAE,CAAC;IAE5D,KAAK,MAAM,GA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AC,gBAAgB,GAAG,EAAE,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,WAAW,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,QAAQ,CAAC;IAEtC,4DAA4D;IAC5D,WAAW,EAAE,CAAC;IAEd,KAAK,GAAG,EAAC,YAAY,EAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,yCAAyC;IACzC,WAAW,EAAE,CAAC;IAEd,8EAA8E;IAC9E,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,IAAI,gBAAgB,CAAC,GAAG,CAAC;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9D,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACpD,CAAC;IAED,KAAK,GAAG,IAAI,CAAC;AACf,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Best-effort detection of AI coding agent harnesses (Claude Code, Cursor,
3
+ * Codex, etc.) from the environment of the current process.
4
+ *
5
+ * Detection is advisory: it tailors help output, disables interactive prompts,
6
+ * and attributes telemetry. It must never block or fail a command.
7
+ *
8
+ * Detection relies only on environment variables that harnesses set for their
9
+ * child processes. Users can override detection with `SFCC_AGENT`:
10
+ *
11
+ * - `SFCC_AGENT=<name>` forces agent mode and reports `<name>` as the harness
12
+ * - `SFCC_AGENT=0` (or `false`/`no`/`off`) disables detection entirely
13
+ *
14
+ * @module ux/agent-context
15
+ */
16
+ /** An AI coding agent harness (the tool driving the CLI). */
17
+ export interface AgentHarness {
18
+ /** Stable identifier (e.g. `claude-code`). */
19
+ id: string;
20
+ /** Human-readable name (e.g. `Claude Code`). */
21
+ name: string;
22
+ }
23
+ /** A single detector match. */
24
+ export interface AgentMatch {
25
+ harness: AgentHarness;
26
+ /** Harness session/thread/conversation identifier, when exposed. */
27
+ sessionId?: string;
28
+ /** Environment variable names that produced the match. */
29
+ signals: readonly string[];
30
+ }
31
+ /** Result of agent detection. */
32
+ export interface AgentContext {
33
+ /** True when any harness was detected (or forced via `SFCC_AGENT`). */
34
+ isAgentic: boolean;
35
+ /** Highest-precedence harness, or null. */
36
+ harness: AgentHarness | null;
37
+ /** First available session identifier across matches, or null. */
38
+ sessionId: null | string;
39
+ /** All matches in precedence order. */
40
+ matches: readonly AgentMatch[];
41
+ }
42
+ export type AgentEnvironment = Readonly<Record<string, string | undefined>>;
43
+ export type AgentDetector = (env: AgentEnvironment) => AgentMatch | null;
44
+ /**
45
+ * Detectors in precedence order. Direct agents precede host surfaces so that,
46
+ * for example, Claude Code launched inside Warp is reported as Claude Code
47
+ * while the Warp match is retained in `matches`.
48
+ */
49
+ export declare const agentDetectors: readonly AgentDetector[];
50
+ /**
51
+ * Detects whether the current process is being driven by an AI coding agent.
52
+ *
53
+ * @param env - Environment to inspect (defaults to `process.env`)
54
+ * @param detectors - Detectors in precedence order (defaults to {@link agentDetectors})
55
+ */
56
+ export declare function detectAgentContext(env?: AgentEnvironment, detectors?: readonly AgentDetector[]): AgentContext;
57
+ /**
58
+ * Cached {@link detectAgentContext} for `process.env`. The environment of a
59
+ * process does not change in ways relevant to detection, so detect once.
60
+ */
61
+ export declare function getAgentContext(): AgentContext;
62
+ /** Clears the cached agent context (for tests). */
63
+ export declare function resetAgentContext(): void;
64
+ /**
65
+ * Whether interactive prompts can be shown: stdin is a TTY and the process is
66
+ * not driven by an AI agent (agents typically cannot answer prompts, and
67
+ * hanging on one wastes the agent's turn).
68
+ */
69
+ export declare function isInteractive(): boolean;
@@ -0,0 +1,133 @@
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
+ const FALSE_LIKE_VALUES = new Set(['', '0', 'false', 'no', 'off']);
7
+ /** Returns the trimmed value, treating false-like values as unset. */
8
+ function value(env, name) {
9
+ const raw = env[name];
10
+ if (typeof raw !== 'string')
11
+ return undefined;
12
+ const normalized = raw.trim();
13
+ return FALSE_LIKE_VALUES.has(normalized.toLowerCase()) ? undefined : normalized;
14
+ }
15
+ /**
16
+ * Builds a detector that matches when any marker env var equals its expected
17
+ * value (or is set to any truthy value when `expected` is omitted).
18
+ */
19
+ function markerDetector(harness, markers, sessionVars = []) {
20
+ return (env) => {
21
+ const signals = [];
22
+ for (const { name, expected } of markers) {
23
+ const matched = expected === undefined ? value(env, name) !== undefined : env[name] === expected;
24
+ if (matched)
25
+ signals.push(name);
26
+ }
27
+ if (signals.length === 0)
28
+ return null;
29
+ let sessionId;
30
+ for (const name of sessionVars) {
31
+ const v = value(env, name);
32
+ if (v) {
33
+ signals.push(name);
34
+ sessionId ??= v;
35
+ }
36
+ }
37
+ return { harness, sessionId, signals };
38
+ };
39
+ }
40
+ /**
41
+ * Detectors in precedence order. Direct agents precede host surfaces so that,
42
+ * for example, Claude Code launched inside Warp is reported as Claude Code
43
+ * while the Warp match is retained in `matches`.
44
+ */
45
+ export const agentDetectors = [
46
+ markerDetector({ id: 'opencode', name: 'OpenCode' }, [{ name: 'OPENCODE', expected: '1' }]),
47
+ markerDetector({ id: 'qwen-code', name: 'Qwen Code' }, [{ name: 'QWEN_CODE_SESSION_ID' }], ['QWEN_CODE_SESSION_ID']),
48
+ markerDetector({ id: 'pi', name: 'Pi' }, [
49
+ { name: 'PI_CODING_AGENT', expected: 'true' },
50
+ { name: 'AI_AGENT', expected: 'pi' },
51
+ ], ['PI_SESSION_ID']),
52
+ markerDetector({ id: 'cursor-agent', name: 'Cursor Agent' }, [{ name: 'CURSOR_AGENT', expected: '1' }], ['CURSOR_CONVERSATION_ID']),
53
+ markerDetector({ id: 'claude-code', name: 'Claude Code' }, [{ name: 'CLAUDECODE', expected: '1' }], ['CLAUDE_CODE_SESSION_ID']),
54
+ markerDetector({ id: 'codex', name: 'OpenAI Codex' }, [{ name: 'CODEX_THREAD_ID' }], ['CODEX_THREAD_ID']),
55
+ markerDetector({ id: 'amp', name: 'Amp' }, [{ name: 'AMP_CURRENT_THREAD_ID' }], ['AMP_CURRENT_THREAD_ID']),
56
+ markerDetector({ id: 'gemini-cli', name: 'Gemini CLI' }, [{ name: 'GEMINI_CLI', expected: '1' }]),
57
+ markerDetector({ id: 'auggie', name: 'Auggie' }, [{ name: 'AUGMENT_AGENT', expected: '1' }]),
58
+ markerDetector({ id: 'crush', name: 'Crush' }, [
59
+ { name: 'CRUSH', expected: '1' },
60
+ { name: 'AI_AGENT', expected: 'crush' },
61
+ ]),
62
+ markerDetector({ id: 'vscode-copilot-agent', name: 'GitHub Copilot in VS Code' }, [
63
+ { name: 'AI_AGENT', expected: 'github_copilot_vscode_agent' },
64
+ { name: 'COPILOT_AGENT', expected: '1' },
65
+ ]),
66
+ markerDetector({ id: 'warp', name: 'Warp' }, [{ name: 'OZ_RUN_ID' }], ['OZ_RUN_ID']),
67
+ ];
68
+ const NOT_AGENTIC = { isAgentic: false, harness: null, sessionId: null, matches: [] };
69
+ /** Normalizes a user-supplied agent name into an id (lowercase, dash-separated). */
70
+ function toAgentId(name) {
71
+ return (name
72
+ .toLowerCase()
73
+ .replaceAll(/[^a-z0-9]+/g, '-')
74
+ .replaceAll(/^-|-$/g, '') || 'custom');
75
+ }
76
+ /**
77
+ * Detects whether the current process is being driven by an AI coding agent.
78
+ *
79
+ * @param env - Environment to inspect (defaults to `process.env`)
80
+ * @param detectors - Detectors in precedence order (defaults to {@link agentDetectors})
81
+ */
82
+ export function detectAgentContext(env = process.env, detectors = agentDetectors) {
83
+ const override = env.SFCC_AGENT;
84
+ if (override !== undefined) {
85
+ const forced = value(env, 'SFCC_AGENT');
86
+ if (!forced)
87
+ return NOT_AGENTIC;
88
+ // Values like "1"/"true" force agent mode without naming a harness.
89
+ const generic = ['1', 'true', 'yes', 'on'].includes(forced.toLowerCase());
90
+ const harness = generic ? { id: 'unknown', name: 'Unknown agent' } : { id: toAgentId(forced), name: forced };
91
+ const match = { harness, signals: ['SFCC_AGENT'] };
92
+ return { isAgentic: true, harness, sessionId: null, matches: [match] };
93
+ }
94
+ const matches = [];
95
+ for (const detector of detectors) {
96
+ try {
97
+ const match = detector(env);
98
+ if (match)
99
+ matches.push(match);
100
+ }
101
+ catch {
102
+ // Detection is advisory and must never prevent a command from running.
103
+ }
104
+ }
105
+ return {
106
+ isAgentic: matches.length > 0,
107
+ harness: matches[0]?.harness ?? null,
108
+ sessionId: matches.find((m) => m.sessionId)?.sessionId ?? null,
109
+ matches,
110
+ };
111
+ }
112
+ let cached;
113
+ /**
114
+ * Cached {@link detectAgentContext} for `process.env`. The environment of a
115
+ * process does not change in ways relevant to detection, so detect once.
116
+ */
117
+ export function getAgentContext() {
118
+ cached ??= detectAgentContext();
119
+ return cached;
120
+ }
121
+ /** Clears the cached agent context (for tests). */
122
+ export function resetAgentContext() {
123
+ cached = undefined;
124
+ }
125
+ /**
126
+ * Whether interactive prompts can be shown: stdin is a TTY and the process is
127
+ * not driven by an AI agent (agents typically cannot answer prompts, and
128
+ * hanging on one wastes the agent's turn).
129
+ */
130
+ export function isInteractive() {
131
+ return Boolean(process.stdin.isTTY) && !getAgentContext().isAgentic;
132
+ }
133
+ //# sourceMappingURL=agent-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-context.js","sourceRoot":"","sources":["../../../src/ux/agent-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkDH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,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E,CAAC;IACH,CAAC;IAED,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;QAC7B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,IAAI;QACpC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,SAAS,IAAI,IAAI;QAC9D,OAAO;KACR,CAAC;AACJ,CAAC;AAED,IAAI,MAAgC,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,kBAAkB,EAAE,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,SAAS,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,SAAS,CAAC;AACtE,CAAC"}
@@ -1,14 +1,41 @@
1
1
  export interface ConfirmOptions {
2
2
  /** Default to yes when the user presses Enter without typing. Defaults to false (no). */
3
3
  defaultYes?: boolean;
4
+ /**
5
+ * Behavior when prompting is not possible (no TTY on stdin, or an AI agent
6
+ * is driving the process):
7
+ *
8
+ * - `'error'` (default): throw {@link ConfirmationRequiredError} so the
9
+ * command fails fast with a non-zero exit instead of hanging
10
+ * - `'default'`: resolve to the default answer (`defaultYes`) without prompting
11
+ */
12
+ nonInteractive?: 'default' | 'error';
13
+ }
14
+ /**
15
+ * Thrown by {@link confirm} when a confirmation is required but cannot be
16
+ * prompted for. Callers should skip the prompt with an explicit flag
17
+ * (typically `--force` or `--yes`).
18
+ */
19
+ export declare class ConfirmationRequiredError extends Error {
20
+ /** The confirmation message that could not be prompted. */
21
+ readonly prompt: string;
22
+ readonly code = "CONFIRMATION_REQUIRED";
23
+ constructor(
24
+ /** The confirmation message that could not be prompted. */
25
+ prompt: string);
4
26
  }
5
27
  /**
6
28
  * Simple yes/no confirmation prompt.
7
29
  *
8
30
  * Output goes to stderr so it doesn't interfere with structured stdout output.
9
31
  *
32
+ * When prompting is not possible (stdin is not a TTY, or an AI agent is
33
+ * detected), this throws {@link ConfirmationRequiredError} by default rather
34
+ * than waiting on input that will never arrive. See {@link ConfirmOptions.nonInteractive}.
35
+ *
10
36
  * @param message - Prompt message (the hint is appended automatically)
11
37
  * @param options - Options to control default behavior
12
38
  * @returns true if user confirmed, false otherwise
39
+ * @throws ConfirmationRequiredError when prompting is not possible and `nonInteractive` is `'error'`
13
40
  */
14
41
  export declare function confirm(message: string, options?: ConfirmOptions): Promise<boolean>;
@@ -4,17 +4,49 @@
4
4
  * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
6
  import * as readline from 'node:readline';
7
+ import { getAgentContext, isInteractive } from './agent-context.js';
8
+ /**
9
+ * Thrown by {@link confirm} when a confirmation is required but cannot be
10
+ * prompted for. Callers should skip the prompt with an explicit flag
11
+ * (typically `--force` or `--yes`).
12
+ */
13
+ export class ConfirmationRequiredError extends Error {
14
+ prompt;
15
+ code = 'CONFIRMATION_REQUIRED';
16
+ constructor(
17
+ /** The confirmation message that could not be prompted. */
18
+ prompt) {
19
+ const agent = getAgentContext().harness;
20
+ const reason = agent
21
+ ? `running under an AI agent (${agent.name}), so interactive prompts are disabled`
22
+ : 'no interactive terminal is available';
23
+ super(`Confirmation required but ${reason}:\n ${prompt.trim()}\n` +
24
+ `Re-run with the command's --force (or --yes) flag to proceed without prompting.`);
25
+ this.prompt = prompt;
26
+ this.name = 'ConfirmationRequiredError';
27
+ }
28
+ }
7
29
  /**
8
30
  * Simple yes/no confirmation prompt.
9
31
  *
10
32
  * Output goes to stderr so it doesn't interfere with structured stdout output.
11
33
  *
34
+ * When prompting is not possible (stdin is not a TTY, or an AI agent is
35
+ * detected), this throws {@link ConfirmationRequiredError} by default rather
36
+ * than waiting on input that will never arrive. See {@link ConfirmOptions.nonInteractive}.
37
+ *
12
38
  * @param message - Prompt message (the hint is appended automatically)
13
39
  * @param options - Options to control default behavior
14
40
  * @returns true if user confirmed, false otherwise
41
+ * @throws ConfirmationRequiredError when prompting is not possible and `nonInteractive` is `'error'`
15
42
  */
16
43
  export async function confirm(message, options) {
17
44
  const defaultYes = options?.defaultYes ?? false;
45
+ if (!isInteractive()) {
46
+ if (options?.nonInteractive === 'default')
47
+ return defaultYes;
48
+ throw new ConfirmationRequiredError(message);
49
+ }
18
50
  const hint = defaultYes ? '(Y/n)' : '(y/N)';
19
51
  const rl = readline.createInterface({
20
52
  input: process.stdin,
@@ -1 +1 @@
1
- {"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../../src/ux/confirm.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAO1C;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAe,EAAE,OAAwB;IACrE,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,KAAK,CAAC;IAChD,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5C,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAClC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,GAAG,OAAO,IAAI,IAAI,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE;YAC5C,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAC/C,IAAI,UAAU,KAAK,EAAE,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,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5C,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAClC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,GAAG,OAAO,IAAI,IAAI,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE;YAC5C,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAC/C,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;gBACtB,OAAO,CAAC,UAAU,CAAC,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,KAAK,CAAC,CAAC;YACtD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1,2 @@
1
- export { confirm, type ConfirmOptions } from './confirm.js';
1
+ export { confirm, ConfirmationRequiredError, type ConfirmOptions } from './confirm.js';
2
+ export { agentDetectors, detectAgentContext, getAgentContext, isInteractive, resetAgentContext, type AgentContext, type AgentDetector, type AgentEnvironment, type AgentHarness, type AgentMatch, } from './agent-context.js';
@@ -3,5 +3,6 @@
3
3
  * SPDX-License-Identifier: Apache-2
4
4
  * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- export { confirm } from './confirm.js';
6
+ export { confirm, ConfirmationRequiredError } from './confirm.js';
7
+ export { agentDetectors, detectAgentContext, getAgentContext, isInteractive, resetAgentContext, } from './agent-context.js';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ux/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAsB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ux/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAE,yBAAyB,EAAsB,MAAM,cAAc,CAAC;AACrF,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,GAMlB,MAAM,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/b2c-tooling-sdk",
3
3
  "description": "Core tooling library for Salesforce B2C Commerce CLI",
4
- "version": "2.3.0",
4
+ "version": "2.4.0",
5
5
  "author": "Charles Lavery",
6
6
  "license": "Apache-2.0",
7
7
  "repository": "SalesforceCommerceCloud/b2c-developer-tooling",
@@ -28,6 +28,7 @@
28
28
  "default": "./dist/esm/scapi/index.js"
29
29
  },
30
30
  "./package.json": "./package.json",
31
+ "./schemas/dw.schema.json": "./data/schemas/dw.schema.json",
31
32
  ".": {
32
33
  "types": "./dist/esm/index.d.ts",
33
34
  "default": "./dist/esm/index.js"
@@ -298,6 +299,8 @@
298
299
  "check:guides-links": "tsx scripts/check-guides-links.ts",
299
300
  "generate:tooling-index": "tsx scripts/generate-tooling-index.ts",
300
301
  "check:tooling-index": "tsx scripts/generate-tooling-index.ts --check",
302
+ "generate:dw-json-schema": "tsx scripts/generate-dw-json-schema.ts",
303
+ "check:dw-json-schema": "tsx scripts/generate-dw-json-schema.ts --check",
301
304
  "generate:help-corpus": "tsx scripts/generate-help-corpus.ts",
302
305
  "enrich:docs": "tsx scripts/enrich-docs.ts"
303
306
  }