@enterpriseai/cli 3.19.2 → 3.19.4

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 (139) hide show
  1. package/README.md +28 -0
  2. package/dist/commands/chat.d.ts.map +1 -1
  3. package/dist/commands/chat.js +116 -35
  4. package/dist/commands/chat.js.map +1 -1
  5. package/dist/commands/eai-managed-deploy-customer-source.d.ts.map +1 -1
  6. package/dist/commands/eai-managed-deploy-customer-source.js +24 -0
  7. package/dist/commands/eai-managed-deploy-customer-source.js.map +1 -1
  8. package/dist/commands/eai-managed-deploy-github-dispatch.d.ts.map +1 -1
  9. package/dist/commands/eai-managed-deploy-github-dispatch.js +30 -0
  10. package/dist/commands/eai-managed-deploy-github-dispatch.js.map +1 -1
  11. package/dist/commands/eai-managed-source-move.js +2 -2
  12. package/dist/commands/eai-managed-source-move.js.map +1 -1
  13. package/dist/commands/env.js +15 -2
  14. package/dist/commands/env.js.map +1 -1
  15. package/dist/commands/gofer.js +8 -1
  16. package/dist/commands/gofer.js.map +1 -1
  17. package/dist/commands/init.d.ts +4 -0
  18. package/dist/commands/init.d.ts.map +1 -1
  19. package/dist/commands/init.js +187 -8
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/commands/login.d.ts.map +1 -1
  22. package/dist/commands/login.js +6 -2
  23. package/dist/commands/login.js.map +1 -1
  24. package/dist/commands/provision.d.ts.map +1 -1
  25. package/dist/commands/provision.js +27 -13
  26. package/dist/commands/provision.js.map +1 -1
  27. package/dist/commands/publicapi.d.ts.map +1 -1
  28. package/dist/commands/publicapi.js +14 -2
  29. package/dist/commands/publicapi.js.map +1 -1
  30. package/dist/commands/resources.d.ts.map +1 -1
  31. package/dist/commands/resources.js +41 -20
  32. package/dist/commands/resources.js.map +1 -1
  33. package/dist/commands/support.d.ts +18 -0
  34. package/dist/commands/support.d.ts.map +1 -0
  35. package/dist/commands/support.js +110 -0
  36. package/dist/commands/support.js.map +1 -0
  37. package/dist/commands/tenant.js +39 -3
  38. package/dist/commands/tenant.js.map +1 -1
  39. package/dist/commands/types.d.ts +12 -1
  40. package/dist/commands/types.d.ts.map +1 -1
  41. package/dist/commands/types.js +172 -35
  42. package/dist/commands/types.js.map +1 -1
  43. package/dist/commands/verify.d.ts.map +1 -1
  44. package/dist/commands/verify.js +89 -44
  45. package/dist/commands/verify.js.map +1 -1
  46. package/dist/commands/vertical.d.ts.map +1 -1
  47. package/dist/commands/vertical.js +163 -15
  48. package/dist/commands/vertical.js.map +1 -1
  49. package/dist/index.js +54 -7
  50. package/dist/index.js.map +1 -1
  51. package/dist/lib/agent-guide.d.ts.map +1 -1
  52. package/dist/lib/agent-guide.js +25 -4
  53. package/dist/lib/agent-guide.js.map +1 -1
  54. package/dist/lib/api.d.ts +25 -4
  55. package/dist/lib/api.d.ts.map +1 -1
  56. package/dist/lib/api.js +152 -39
  57. package/dist/lib/api.js.map +1 -1
  58. package/dist/lib/cloud-env.d.ts +1 -0
  59. package/dist/lib/cloud-env.d.ts.map +1 -1
  60. package/dist/lib/cloud-env.js +28 -15
  61. package/dist/lib/cloud-env.js.map +1 -1
  62. package/dist/lib/config.d.ts +6 -2
  63. package/dist/lib/config.d.ts.map +1 -1
  64. package/dist/lib/config.js +13 -1
  65. package/dist/lib/config.js.map +1 -1
  66. package/dist/lib/eai-managed-deploy-contract.d.ts +4 -0
  67. package/dist/lib/eai-managed-deploy-contract.d.ts.map +1 -1
  68. package/dist/lib/eai-managed-deploy-contract.js.map +1 -1
  69. package/dist/lib/eai-managed-deploy-operation.d.ts.map +1 -1
  70. package/dist/lib/eai-managed-deploy-operation.js +14 -0
  71. package/dist/lib/eai-managed-deploy-operation.js.map +1 -1
  72. package/dist/lib/eai-managed-deploy-state.d.ts.map +1 -1
  73. package/dist/lib/eai-managed-deploy-state.js +15 -1
  74. package/dist/lib/eai-managed-deploy-state.js.map +1 -1
  75. package/dist/lib/eai-managed-source-client-types.d.ts +3 -0
  76. package/dist/lib/eai-managed-source-client-types.d.ts.map +1 -1
  77. package/dist/lib/error-codes.d.ts.map +1 -1
  78. package/dist/lib/error-codes.js +6 -3
  79. package/dist/lib/error-codes.js.map +1 -1
  80. package/dist/lib/object-type-export-filesystem.d.ts +13 -0
  81. package/dist/lib/object-type-export-filesystem.d.ts.map +1 -0
  82. package/dist/lib/object-type-export-filesystem.js +112 -0
  83. package/dist/lib/object-type-export-filesystem.js.map +1 -0
  84. package/dist/lib/object-type-export.d.ts +13 -0
  85. package/dist/lib/object-type-export.d.ts.map +1 -0
  86. package/dist/lib/object-type-export.js +173 -0
  87. package/dist/lib/object-type-export.js.map +1 -0
  88. package/dist/lib/output.d.ts +1 -0
  89. package/dist/lib/output.d.ts.map +1 -1
  90. package/dist/lib/output.js +24 -1
  91. package/dist/lib/output.js.map +1 -1
  92. package/dist/lib/platform-diagnostics.d.ts +21 -0
  93. package/dist/lib/platform-diagnostics.d.ts.map +1 -0
  94. package/dist/lib/platform-diagnostics.js +50 -0
  95. package/dist/lib/platform-diagnostics.js.map +1 -0
  96. package/dist/lib/profile.d.ts +9 -2
  97. package/dist/lib/profile.d.ts.map +1 -1
  98. package/dist/lib/profile.js +139 -4
  99. package/dist/lib/profile.js.map +1 -1
  100. package/dist/lib/schema-builder.d.ts +2 -0
  101. package/dist/lib/schema-builder.d.ts.map +1 -1
  102. package/dist/lib/schema-builder.js +5 -0
  103. package/dist/lib/schema-builder.js.map +1 -1
  104. package/dist/lib/support-context.d.ts +31 -0
  105. package/dist/lib/support-context.d.ts.map +1 -0
  106. package/dist/lib/support-context.js +193 -0
  107. package/dist/lib/support-context.js.map +1 -0
  108. package/dist/lib/support-redaction.d.ts +10 -0
  109. package/dist/lib/support-redaction.d.ts.map +1 -0
  110. package/dist/lib/support-redaction.js +44 -0
  111. package/dist/lib/support-redaction.js.map +1 -0
  112. package/dist/lib/support-report.d.ts +68 -0
  113. package/dist/lib/support-report.d.ts.map +1 -0
  114. package/dist/lib/support-report.js +165 -0
  115. package/dist/lib/support-report.js.map +1 -0
  116. package/package.json +3 -2
  117. package/resources/deploy/eai-app-template/.github/workflows/eai-app.yml +46 -13
  118. package/resources/deploy/eai-app-template/producer-pin.json +8 -8
  119. package/resources/deploy/eai-app-template/scripts/source-unknown-deployment-evidence.mjs +29 -2
  120. package/resources/deploy/eai-app-template/tests/source-unknown-deployment-evidence.test.mjs +99 -1
  121. package/resources/gofer/agents-skills/eai/SKILL.md +20 -0
  122. package/resources/gofer/claude-commands/eai.md +20 -0
  123. package/resources/gofer/claude-skills/eai/SKILL.md +20 -0
  124. package/resources/gofer/commands/0_gofer_start.md +18 -0
  125. package/resources/gofer/commands/gofer_eai_first_run.md +18 -0
  126. package/resources/gofer/copilot-prompts/eai.prompt.md +20 -0
  127. package/resources/gofer/gemini/commands/gofer/eai.md +20 -0
  128. package/resources/gofer/github-skills/eai/SKILL.md +20 -0
  129. package/resources/gofer/grok-skills/eai/SKILL.md +20 -0
  130. package/resources/gofer/instruction-templates/base/agents-base.md +18 -0
  131. package/resources/gofer/instruction-templates/base/claude-base.md +18 -0
  132. package/resources/gofer/instruction-templates/base/copilot-base.md +18 -0
  133. package/resources/gofer/instruction-templates/gofer/gofer-claude.md +4 -0
  134. package/resources/gofer/node-scripts/generate-commands.mjs +26 -0
  135. package/resources/gofer/references/platform/eai-support.md +19 -0
  136. package/resources/gofer/specify-commands/0_gofer_start.md +18 -0
  137. package/resources/gofer/specify-commands/gofer_eai_first_run.md +18 -0
  138. package/resources/gofer/system-skills/eai/SKILL.md +20 -0
  139. package/resources/linked-sources.json +2 -2
@@ -0,0 +1,193 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { lstatSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, join } from 'node:path';
5
+ import { listErrorGuidance } from './error-guidance/catalog.js';
6
+ import { findGuidance } from './error-guidance/match.js';
7
+ import { getActiveProfile } from './profile.js';
8
+ import { isSupportSensitiveKey, redactSupportText } from './support-redaction.js';
9
+ const MAX_STDERR_LENGTH = 32768;
10
+ const MAX_CONTEXT_BYTES = 16384;
11
+ /** Shared escalation wording for text failures and the suggestion field of JSON errors. */
12
+ export const SUPPORT_SUGGESTION = 'Run eai support to prepare a report for your approval.';
13
+ let commandPath = 'eai';
14
+ let latestError = {};
15
+ let trackingInstalled = false;
16
+ function sensitiveEnvironmentValues() {
17
+ return Object.entries(process.env)
18
+ .filter(([key, value]) => isSupportSensitiveKey(key) && Boolean(value))
19
+ .map(([, value]) => value);
20
+ }
21
+ /** Keep only command names, because positional arguments and flags may contain credentials. */
22
+ export function setSupportCommand(command) {
23
+ commandPath = /^eai(?: [a-z][a-z0-9-]*)*$/.test(command) && command.length <= 256
24
+ ? command
25
+ : 'eai';
26
+ }
27
+ /** Keeps failures separate by profile without exposing the profile name in the cache filename. */
28
+ export function getSupportContextPath(profile = getActiveProfile()) {
29
+ const profileHash = createHash('sha256').update(profile).digest('hex').slice(0, 16);
30
+ return join(homedir(), '.eai', 'support', `last-error-${profileHash}.json`);
31
+ }
32
+ /** Match transient diagnostics to the catalog; retain only recognized error codes and reasons. */
33
+ export function recordSupportError(input) {
34
+ const message = typeof input.message === 'string'
35
+ ? redactSupportText(input.message, sensitiveEnvironmentValues()).trim()
36
+ : undefined;
37
+ const guidance = findGuidance({
38
+ ...input,
39
+ operation: input.operation ?? commandPath,
40
+ code: input.code ?? message?.match(/Error code:\s*(E\d{3})/i)?.[1],
41
+ reasonCode: input.reasonCode ?? message?.match(/Reason:\s*([a-z0-9_]+)/i)?.[1],
42
+ message,
43
+ }) ?? listErrorGuidance().find(entry => {
44
+ const title = entry.title.replace(/[.!?]+$/, '').toLowerCase();
45
+ return message?.split('\n').some(line => {
46
+ const text = line.replace(/^(?:ERROR:\s*|✗\s*)/, '').trim().toLowerCase();
47
+ return text === title || text.startsWith(`${title}.`) || text.startsWith(`${title}:`)
48
+ || text.startsWith(`${title} `);
49
+ });
50
+ });
51
+ latestError = {
52
+ ...latestError,
53
+ ...(guidance ? { errorCode: guidance.code, reasonCode: guidance.reasonCode } : {}),
54
+ };
55
+ }
56
+ function asRecord(value) {
57
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
58
+ ? value
59
+ : undefined;
60
+ }
61
+ /** Recognizes error/ok/success envelopes without changing their output; successful or unrelated values leave pending context intact. */
62
+ export function recordSupportJsonError(value) {
63
+ const payload = asRecord(value);
64
+ if (!payload || (!payload.error && payload.ok !== false && payload.success !== false))
65
+ return;
66
+ const error = asRecord(payload.error);
67
+ const guidance = asRecord(payload.guidance) ?? asRecord(error?.guidance);
68
+ const message = typeof payload.error === 'string' ? payload.error : error?.message ?? payload.message;
69
+ const code = guidance?.code ?? error?.code;
70
+ const reasonCode = guidance?.reasonCode ?? error?.reasonCode ?? payload.reasonCode;
71
+ recordSupportError({
72
+ ...(typeof code === 'string' ? { code } : {}),
73
+ ...(typeof reasonCode === 'string' ? { reasonCode } : {}),
74
+ ...(typeof message === 'string' ? { message } : {}),
75
+ ...(typeof payload.status === 'number' ? { status: payload.status } : {}),
76
+ ...(typeof error?.code === 'string' ? { serverCode: error.code } : {}),
77
+ });
78
+ }
79
+ function shouldKeepPreviousError() {
80
+ return commandPath === 'eai support' || commandPath.startsWith('eai support ')
81
+ || commandPath === 'eai errors' || commandPath.startsWith('eai errors ');
82
+ }
83
+ function persistSupportContext(exitCode) {
84
+ const path = getSupportContextPath();
85
+ const temporaryPath = `${path}.${randomUUID()}.tmp`;
86
+ const context = {
87
+ command: commandPath,
88
+ exitCode,
89
+ ...latestError,
90
+ recordedAt: new Date().toISOString(),
91
+ };
92
+ mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
93
+ try {
94
+ writeFileSync(temporaryPath, `${JSON.stringify(context)}\n`, { mode: 0o600, flag: 'wx' });
95
+ renameSync(temporaryPath, path);
96
+ }
97
+ catch (error) {
98
+ rmSync(temporaryPath, { force: true });
99
+ throw error;
100
+ }
101
+ }
102
+ /**
103
+ * Installs tracking once per process, including immediate process.exit() failures.
104
+ * Nonzero exits atomically save private, profile-scoped context; support/errors commands preserve the original failure.
105
+ */
106
+ export function installSupportErrorTracking() {
107
+ if (trackingInstalled)
108
+ return;
109
+ trackingInstalled = true;
110
+ const originalWrite = process.stderr.write;
111
+ let stderrText = '';
112
+ let hasStructuredStderrError = false;
113
+ process.stderr.write = ((...args) => {
114
+ const chunk = args[0];
115
+ const text = typeof chunk === 'string' ? chunk : chunk instanceof Uint8Array
116
+ ? Buffer.from(chunk).toString('utf8') : undefined;
117
+ if (text && !shouldKeepPreviousError()) {
118
+ // Fragmented diagnostics must remain together for catalog matching, but never enter the cache.
119
+ stderrText = `${stderrText}${text}`.slice(-MAX_STDERR_LENGTH);
120
+ recordSupportError({ message: stderrText });
121
+ if (stderrText.trim().startsWith('{')) {
122
+ try {
123
+ const payload = JSON.parse(stderrText);
124
+ recordSupportJsonError(payload);
125
+ const record = asRecord(payload);
126
+ hasStructuredStderrError = Boolean(record?.error)
127
+ || (typeof record?.suggestion === 'string' && record.suggestion.includes(SUPPORT_SUGGESTION));
128
+ }
129
+ catch {
130
+ // stderr may contain partial JSON or plain diagnostic text.
131
+ }
132
+ }
133
+ }
134
+ return Reflect.apply(originalWrite, process.stderr, args);
135
+ });
136
+ process.on('uncaughtExceptionMonitor', (error) => {
137
+ recordSupportError({ message: error.message });
138
+ });
139
+ process.on('exit', (exitCode) => {
140
+ if (exitCode === 0)
141
+ return;
142
+ if (!shouldKeepPreviousError()) {
143
+ try {
144
+ persistSupportContext(exitCode);
145
+ }
146
+ catch {
147
+ Reflect.apply(originalWrite, process.stderr, ['Could not save the previous error for eai support.\n']);
148
+ }
149
+ }
150
+ if (!hasStructuredStderrError) {
151
+ Reflect.apply(originalWrite, process.stderr, [`${SUPPORT_SUGGESTION}\n`]);
152
+ }
153
+ });
154
+ }
155
+ /**
156
+ * Returns validated failure metadata for the active profile, or null when no cache exists.
157
+ * Legacy diagnostic text is ignored because its project credentials may no longer be available for redaction.
158
+ * Invalid or unreadable caches throw; reading never changes the saved failure.
159
+ */
160
+ export function readSupportContext() {
161
+ const path = getSupportContextPath();
162
+ try {
163
+ const metadata = lstatSync(path);
164
+ if (!metadata.isFile() || metadata.size > MAX_CONTEXT_BYTES) {
165
+ throw new Error('Saved support context is invalid.');
166
+ }
167
+ const payload = asRecord(JSON.parse(readFileSync(path, 'utf8')));
168
+ if (!payload || typeof payload.command !== 'string'
169
+ || !/^eai(?: [a-z][a-z0-9-]*)*$/.test(payload.command)
170
+ || payload.command.length > 256
171
+ || typeof payload.exitCode !== 'number' || !Number.isInteger(payload.exitCode)
172
+ || payload.exitCode <= 0 || payload.exitCode > 255
173
+ || typeof payload.recordedAt !== 'string' || !Number.isFinite(Date.parse(payload.recordedAt))) {
174
+ throw new Error('Saved support context is invalid.');
175
+ }
176
+ const guidance = findGuidance({
177
+ ...(typeof payload.errorCode === 'string' ? { code: payload.errorCode } : {}),
178
+ ...(typeof payload.reasonCode === 'string' ? { reasonCode: payload.reasonCode } : {}),
179
+ });
180
+ return {
181
+ command: payload.command,
182
+ exitCode: payload.exitCode,
183
+ recordedAt: new Date(payload.recordedAt).toISOString(),
184
+ ...(guidance ? { errorCode: guidance.code, reasonCode: guidance.reasonCode } : {}),
185
+ };
186
+ }
187
+ catch (error) {
188
+ if (asRecord(error)?.code === 'ENOENT')
189
+ return null;
190
+ throw new Error('Could not read the previous error for eai support.', { cause: error });
191
+ }
192
+ }
193
+ //# sourceMappingURL=support-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-context.js","sourceRoot":"","sources":["../../src/lib/support-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,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Q,GAAG,YAAY,CAAC;YAC5B,GAAG,CAAC,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7E,GAAG,CAAC,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtF,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE;YACtD,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,oDAAoD,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** A key-name heuristic; opaque credentials under unrelated keys still need explicit sensitive values. */
2
+ export declare function isSupportSensitiveKey(key: string): boolean;
3
+ /**
4
+ * Removes known credential values, credential-shaped text and unsafe terminal controls before review.
5
+ * Supply values from every credential source: pattern matching alone cannot identify opaque secrets.
6
+ */
7
+ export declare function redactSupportText(text: string, sensitiveValues?: readonly string[]): string;
8
+ /** Redacts a JSON-compatible tree without mutating it; sensitive-key values become placeholders and strings use text redaction. */
9
+ export declare function redactSupportBundle<T>(value: T, sensitiveValues?: readonly string[]): T;
10
+ //# sourceMappingURL=support-redaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-redaction.d.ts","sourceRoot":"","sources":["../../src/lib/support-redaction.ts"],"names":[],"mappings":"AAEA,0GAA0G;AAC1G,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAmB/F;AAED,mIAAmI;AACnI,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,eAAe,GAAE,SAAS,MAAM,EAAO,GAAG,CAAC,CAS3F"}
@@ -0,0 +1,44 @@
1
+ const sensitiveKey = /token|secret|password|passwd|pwd|api[_-]?key|account[_-]?key|authorization|cookie|credential|connection[_-]?string|private[_-]?key/i;
2
+ /** A key-name heuristic; opaque credentials under unrelated keys still need explicit sensitive values. */
3
+ export function isSupportSensitiveKey(key) {
4
+ return sensitiveKey.test(key);
5
+ }
6
+ /**
7
+ * Removes known credential values, credential-shaped text and unsafe terminal controls before review.
8
+ * Supply values from every credential source: pattern matching alone cannot identify opaque secrets.
9
+ */
10
+ export function redactSupportText(text, sensitiveValues = []) {
11
+ let safe = text;
12
+ for (const value of sensitiveValues) {
13
+ if (value)
14
+ safe = safe.split(value).join('[redacted]');
15
+ }
16
+ return safe
17
+ .replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, '[redacted-private-key]')
18
+ .replace(/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, '$1 [redacted]')
19
+ .replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, '[redacted-jwt]')
20
+ .replace(/\b(?:gh[pousr]_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+|sk-[A-Za-z0-9_-]{16,})\b/g, '[redacted-key]')
21
+ .replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/@]+@/gi, '$1[redacted]@')
22
+ .replace(/((?:["']?[\w.-]*(?:token|secret|password|passwd|pwd|api[_-]?key|account[_-]?key|cookie|credential|authorization|connection[_-]?string|private[_-]?key)[\w.-]*["']?\s*[:=]\s*))(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,;}]+)/gi, '$1[redacted]')
23
+ .replace(/((?:--[\w-]*(?:token|secret|password|passwd|pwd|api[_-]?key|account[_-]?key|authorization|cookie|credential|connection[_-]?string|private[_-]?key)[\w-]*)\s+)(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s]+)/gi, '$1[redacted]')
24
+ .replace(/([?&](?:sig|signature|access_token|token|key|code)=)[^&#\s]*/gi, '$1[redacted]')
25
+ .replace(/#draft=[^\s"']+/gi, '#draft=[redacted]')
26
+ // eslint-disable-next-line no-control-regex -- Upstream terminal escapes must not execute during report review.
27
+ .replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '')
28
+ // eslint-disable-next-line no-control-regex -- Strip upstream terminal controls while retaining readable lines and tabs.
29
+ .replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, '');
30
+ }
31
+ /** Redacts a JSON-compatible tree without mutating it; sensitive-key values become placeholders and strings use text redaction. */
32
+ export function redactSupportBundle(value, sensitiveValues = []) {
33
+ if (typeof value === 'string')
34
+ return redactSupportText(value, sensitiveValues);
35
+ if (Array.isArray(value))
36
+ return value.map(item => redactSupportBundle(item, sensitiveValues));
37
+ if (value && typeof value === 'object') {
38
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [
39
+ key, isSupportSensitiveKey(key) ? '[redacted]' : redactSupportBundle(item, sensitiveValues),
40
+ ]));
41
+ }
42
+ return value;
43
+ }
44
+ //# sourceMappingURL=support-redaction.js.map
@@ -0,0 +1 @@
1
+ {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M,CAAC;IACrF,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAM,CAAC;IACpG,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YACnE,GAAG,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,eAAe,CAAC;SAC5F,CAAC,CAAM,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { StoredTokens } from './auth.js';
2
+ /** Deadline for one draft POST, including its bounded response body. */
3
+ export declare const SUPPORT_TIMEOUT_MS = 10000;
4
+ /** Report inputs; `yes` asserts the person approved this exact bundle before submission. */
5
+ export interface SupportOptions {
6
+ readonly format?: string;
7
+ readonly source?: string;
8
+ readonly tool?: string;
9
+ readonly toolVersion?: string;
10
+ readonly command?: string;
11
+ readonly exitCode?: string;
12
+ readonly errorCode?: string;
13
+ readonly description?: string;
14
+ readonly yes?: boolean;
15
+ readonly open?: boolean;
16
+ }
17
+ /** Redacted website draft payload; tenant and app labels are diagnostic context, not authorization. */
18
+ export interface SupportBundle {
19
+ readonly source: 'eai-cli' | 'harness';
20
+ readonly tool: {
21
+ readonly name: string;
22
+ readonly version: string;
23
+ };
24
+ readonly cli: {
25
+ readonly command?: string;
26
+ readonly exitCode?: number;
27
+ readonly errorCode?: string;
28
+ readonly reasonCode?: string;
29
+ };
30
+ readonly cliVersion: string;
31
+ readonly service: 'eai-cli';
32
+ readonly category: 'technical';
33
+ readonly summary: string;
34
+ readonly description: string;
35
+ readonly os: 'macos' | 'windows' | 'linux' | 'unknown';
36
+ readonly environment: 'dev' | 'test' | 'prod' | 'local' | 'unknown';
37
+ readonly tenantId?: string;
38
+ readonly tenantName?: string;
39
+ readonly appId?: string;
40
+ readonly appName?: string;
41
+ readonly error?: string;
42
+ readonly occurredAt?: string;
43
+ }
44
+ /** Safe draft failure code and message, excluding server response content and credentials. */
45
+ export declare class SupportRequestError extends Error {
46
+ readonly code: string;
47
+ constructor(code: string, message: string);
48
+ }
49
+ /** Resolve a trusted origin from user profile/runtime settings; project files cannot redirect the saved bearer. */
50
+ export declare function resolveSupportWebsite(): Promise<string>;
51
+ /** Collect a bounded, redacted report from the saved session, current project and canonical error metadata. */
52
+ export declare function collectSupportBundle(options: SupportOptions, session: StoredTokens | null): Promise<SupportBundle>;
53
+ /** Validated one-time capability link and expiry returned by the website. */
54
+ export interface SupportDraft {
55
+ readonly url: string;
56
+ readonly expiresAt: string;
57
+ }
58
+ /**
59
+ * Create one non-idempotent draft after consent; ambiguous failures never trigger a retry.
60
+ * @param website Trusted origin from resolveSupportWebsite.
61
+ * @param bundle Locally redacted payload returned by collectSupportBundle.
62
+ * @param bearer Access token from the saved eai login session.
63
+ * @param timeoutMs Deadline for the request and bounded response read.
64
+ * @returns A validated fragment link, or null when the website rejects the session with 401.
65
+ * @throws SupportRequestError for safe HTTP, response-validation or ambiguous request failures.
66
+ */
67
+ export declare function createSupportDraft(website: string, bundle: SupportBundle, bearer: string, timeoutMs?: number): Promise<SupportDraft | null>;
68
+ //# sourceMappingURL=support-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-report.d.ts","sourceRoot":"","sources":["../../src/lib/support-report.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAQ9C,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAGzC,4FAA4F;AAC5F,MAAM,WAAW,cA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AAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,WAAW,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,8FAA8F;AAC9F,qBAAa,mBAAoB,SAAQ,KAAK;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CACnD;AAED,mHAAmH;AACnH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAc7D;AAQD,+GAA+G;AAC/G,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAwCxH;AAED,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAAG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAElF;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAqB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAmD7J"}
@@ -0,0 +1,165 @@
1
+ import { createRequire } from 'node:module';
2
+ import { platform, release } from 'node:os';
3
+ import { findProjectRoot, loadEnvFile } from './config.js';
4
+ import { getActiveProfile, loadProfileConfig } from './profile.js';
5
+ import { findGuidanceByCodeOrReason } from './error-guidance/catalog.js';
6
+ import { readSupportContext } from './support-context.js';
7
+ import { isSupportSensitiveKey, redactSupportBundle, redactSupportText } from './support-redaction.js';
8
+ const require = createRequire(import.meta.url);
9
+ const { version: cliVersion } = require('../../package.json');
10
+ /** Deadline for one draft POST, including its bounded response body. */
11
+ export const SUPPORT_TIMEOUT_MS = 10_000;
12
+ const MAX_RESPONSE_BYTES = 8_192;
13
+ /** Safe draft failure code and message, excluding server response content and credentials. */
14
+ export class SupportRequestError extends Error {
15
+ code;
16
+ constructor(code, message) {
17
+ super(message);
18
+ this.code = code;
19
+ }
20
+ }
21
+ /** Resolve a trusted origin from user profile/runtime settings; project files cannot redirect the saved bearer. */
22
+ export async function resolveSupportWebsite() {
23
+ const profile = getActiveProfile();
24
+ const config = await loadProfileConfig(profile);
25
+ const value = process.env.EAI_WEBSITE_URL || config?.websiteUrl
26
+ || (profile === 'default' ? 'https://www.enterpriseaigroup.com' : undefined);
27
+ if (!value)
28
+ throw new Error('Configure websiteUrl for the active CLI profile before preparing a support report.');
29
+ let url;
30
+ try {
31
+ url = new URL(value);
32
+ }
33
+ catch {
34
+ throw new Error('The configured support website must be a valid origin.');
35
+ }
36
+ const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
37
+ if ((url.protocol !== 'https:' && !(url.protocol === 'http:' && loopback))
38
+ || url.username || url.password || url.search || url.hash || url.pathname !== '/') {
39
+ throw new Error('The support website must be an HTTPS origin (HTTP is allowed for a local fixture).');
40
+ }
41
+ return url.origin;
42
+ }
43
+ function boundedOption(value, limit, label) {
44
+ if (value !== undefined && (!value.trim() || value.length > limit)) {
45
+ throw new Error(`${label} must be nonempty and at most ${limit} characters.`);
46
+ }
47
+ }
48
+ /** Collect a bounded, redacted report from the saved session, current project and canonical error metadata. */
49
+ export async function collectSupportBundle(options, session) {
50
+ if (options.format && !['text', 'json'].includes(options.format))
51
+ throw new Error('Use --format text or --format json.');
52
+ const source = options.source ?? (options.tool ? 'harness' : 'eai-cli');
53
+ if (source !== 'harness' && source !== 'eai-cli')
54
+ throw new Error('Use --source eai-cli or --source harness.');
55
+ boundedOption(options.tool, 80, 'Tool name');
56
+ boundedOption(options.toolVersion, 100, 'Tool version');
57
+ boundedOption(options.command, 500, 'Command');
58
+ boundedOption(options.description, 6000, 'Description');
59
+ const exitCode = options.exitCode === undefined ? undefined : Number(options.exitCode);
60
+ if (exitCode !== undefined && (!/^-?\d+$/.test(options.exitCode) || !Number.isInteger(exitCode)
61
+ || exitCode < -2147483648 || exitCode > 2147483647))
62
+ throw new Error('Exit code must be a signed 32-bit integer.');
63
+ const context = readSupportContext();
64
+ const guidance = findGuidanceByCodeOrReason(options.errorCode ?? context?.errorCode ?? context?.reasonCode ?? '');
65
+ if (options.errorCode && !guidance)
66
+ throw new Error('Unknown error code or reason. Run eai errors list --format json.');
67
+ const projectRoot = await findProjectRoot();
68
+ const env = projectRoot ? await loadEnvFile(projectRoot) : {};
69
+ const sensitiveValues = [...new Set([session?.accessToken, session?.refreshToken,
70
+ ...[...Object.entries(env), ...Object.entries(process.env)]
71
+ .filter(([key]) => isSupportSensitiveKey(key)).map(([, value]) => value)]
72
+ .filter((value) => typeof value === 'string' && value.length > 0))];
73
+ const safe = (value, limit) => value ? redactSupportText(value, sensitiveValues).slice(0, limit) : undefined;
74
+ const os = platform() === 'darwin' ? 'macos' : platform() === 'win32' ? 'windows' : platform() === 'linux' ? 'linux' : 'unknown';
75
+ const profile = getActiveProfile();
76
+ const environment = ['dev', 'test', 'prod', 'local'].includes(profile) ? profile : profile === 'default' ? 'prod' : 'unknown';
77
+ const command = safe(options.command ?? context?.command, 500);
78
+ const description = safe(options.description ?? [
79
+ 'Help requested for an EAI CLI command.', `CLI version: ${cliVersion}`, `OS: ${os} ${release()}`,
80
+ command ? `Command: ${command}` : '', guidance ? `Error: ${guidance.code} (${guidance.reasonCode})` : '',
81
+ ].filter(Boolean).join('\n'), 6000).trim();
82
+ if (description.length < 10)
83
+ throw new Error('Description must contain at least 10 characters after redaction.');
84
+ return redactSupportBundle({
85
+ source, tool: { name: safe(options.tool ?? 'eai-cli', 80), version: safe(options.toolVersion ?? (options.tool ? undefined : cliVersion), 100) ?? '' },
86
+ cli: { command, exitCode: exitCode ?? context?.exitCode, errorCode: guidance?.code, reasonCode: guidance?.reasonCode },
87
+ cliVersion, service: 'eai-cli', category: 'technical', summary: safe(guidance?.title ?? 'Help with EAI CLI', 180),
88
+ description, os, environment,
89
+ tenantId: safe(env.EAI_TENANT_ID ?? env.NEXT_PUBLIC_EAI_TENANT_ID ?? env.TENANT_DEFAULT_ID ?? session?.activeTenantId, 160),
90
+ tenantName: safe(env.EAI_TENANT_NAME ?? session?.activeTenantName, 160),
91
+ appId: safe(env.EAI_APP_KEY ?? env.NEXT_PUBLIC_EAI_APP_KEY, 160), appName: safe(env.NEXT_PUBLIC_APP_NAME, 160),
92
+ error: safe(guidance?.title, 4000), occurredAt: context?.recordedAt,
93
+ }, sensitiveValues);
94
+ }
95
+ /**
96
+ * Create one non-idempotent draft after consent; ambiguous failures never trigger a retry.
97
+ * @param website Trusted origin from resolveSupportWebsite.
98
+ * @param bundle Locally redacted payload returned by collectSupportBundle.
99
+ * @param bearer Access token from the saved eai login session.
100
+ * @param timeoutMs Deadline for the request and bounded response read.
101
+ * @returns A validated fragment link, or null when the website rejects the session with 401.
102
+ * @throws SupportRequestError for safe HTTP, response-validation or ambiguous request failures.
103
+ */
104
+ export async function createSupportDraft(website, bundle, bearer, timeoutMs = SUPPORT_TIMEOUT_MS) {
105
+ try {
106
+ // Draft creates are not idempotent. A timeout must never trigger an automatic retry.
107
+ const response = await fetch(`${website}/api/support/drafts`, {
108
+ method: 'POST', redirect: 'error', signal: AbortSignal.timeout(timeoutMs),
109
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${bearer}` }, body: JSON.stringify(bundle),
110
+ });
111
+ if (response.status !== 201) {
112
+ await response.body?.cancel();
113
+ if (response.status === 401)
114
+ return null;
115
+ const messages = {
116
+ 400: 'The website rejected the support report fields.', 413: 'The support report is too large.',
117
+ 429: 'The support report limit was reached. Try again later.',
118
+ 503: 'The support website is temporarily unavailable.',
119
+ };
120
+ throw new SupportRequestError(`http_${response.status}`, messages[response.status] ?? 'The support website could not create a draft.');
121
+ }
122
+ if (!response.headers.get('content-type')?.includes('application/json') || !response.body) {
123
+ await response.body?.cancel();
124
+ throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
125
+ }
126
+ const reader = response.body.getReader();
127
+ const chunks = [];
128
+ let bytes = 0;
129
+ try {
130
+ while (true) {
131
+ const { done, value } = await reader.read();
132
+ if (done)
133
+ break;
134
+ bytes += value.byteLength;
135
+ if (bytes > MAX_RESPONSE_BYTES) {
136
+ await reader.cancel();
137
+ throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
138
+ }
139
+ chunks.push(value);
140
+ }
141
+ }
142
+ finally {
143
+ reader.releaseLock();
144
+ }
145
+ const data = JSON.parse(Buffer.concat(chunks).toString('utf8'));
146
+ if (!data || typeof data !== 'object')
147
+ throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
148
+ const { id, token, expiresAt, redeemUrl } = data;
149
+ if (typeof id !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)
150
+ || typeof token !== 'string' || !/^[A-Za-z0-9_-]{43}$/.test(token)
151
+ || typeof expiresAt !== 'string' || !Number.isFinite(Date.parse(expiresAt)) || Date.parse(expiresAt) <= Date.now()
152
+ || redeemUrl !== `${website}/support#draft=${id}.${token}`) {
153
+ throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
154
+ }
155
+ return { url: redeemUrl, expiresAt };
156
+ }
157
+ catch (error) {
158
+ if (error instanceof SupportRequestError)
159
+ throw error;
160
+ if (error instanceof SyntaxError)
161
+ throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
162
+ throw new SupportRequestError('request_failed', 'The support request failed or timed out. No retry was sent; a draft may have been created.');
163
+ }
164
+ }
165
+ //# sourceMappingURL=support-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-report.js","sourceRoot":"","sources":["../../src/lib/support-report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEvG,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AACrF,wEAAwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACzC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAoCjC,8FAA8F;AAC9F,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACvB;IAArB,YAAqB,IAAY,EAAE,OAAe;QAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAAhD,SAAI,GAAJ,IAAI,CAAQ;IAAqC,CAAC;CACxE;AAED,mHAAmH;AACnH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,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kBAAkB,EAAE,yDAAyD,CAAC,CAAC;QAC/G,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,mBAAmB;YAAE,MAAM,KAAK,CAAC;QACtD,IAAI,KAAK,YAAY,WAAW;YAAE,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,yDAAyD,CAAC,CAAC;QAC/I,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,4FAA4F,CAAC,CAAC;IAChJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enterpriseai/cli",
3
- "version": "3.19.2",
3
+ "version": "3.19.4",
4
4
  "description": "EnterpriseAI CLI for app setup, validation, deployment readiness, and platform operations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,7 @@
13
13
  "lint": "eslint src/",
14
14
  "typecheck": "tsc --noEmit",
15
15
  "test": "vitest run",
16
- "test:eai-cli:ci": "mkdir -p test-results && vitest run tests/unit/managed-profile-gateway.test.ts tests/unit/gofer-resource-override.test.ts tests/unit/init-app-binding.test.ts tests/unit/object-type-identifiers.test.ts tests/unit/release-terminology.test.ts tests/unit/ai-surfaces.test.ts tests/unit/eai-managed-deploy.test.ts tests/unit/eai-managed-deploy-write.test.ts tests/unit/eai-managed-source.test.ts tests/unit/eai-managed-source-race.test.ts tests/unit/eai-managed-source-client.test.ts tests/integration/object-type-documentation.test.ts tests/integration/login.test.ts tests/integration/whoami.test.ts tests/integration/tenant.test.ts tests/integration/init.test.ts tests/integration/create.test.ts tests/integration/splash.test.ts tests/integration/help.test.ts tests/integration/describe-contract.test.ts tests/integration/start.test.ts tests/integration/dev.test.ts tests/integration/update.test.ts tests/integration/output.test.ts tests/integration/error-guidance.test.ts tests/integration/resources-command.test.ts tests/integration/agent-guide.test.ts tests/integration/agent-discovery-eval.test.ts tests/integration/gofer.test.ts tests/integration/provision.test.ts tests/integration/types.test.ts tests/integration/user.test.ts tests/integration/publicapi.test.ts tests/integration/publicapi-v4-only.test.ts tests/integration/docs-classify.test.ts tests/integration/classifier.test.ts tests/integration/platform-api-client.test.ts tests/integration/eai-managed-deploy.test.ts tests/integration/vertical.test.ts tests/integration/dedicated-tenant-lifecycle.test.ts tests/integration/runtime-contract.test.ts tests/integration/inquirer-prompt-types.test.ts tests/integration/full-e2e-smoke.test.ts tests/integration/release-metadata.test.ts --reporter=default --reporter=junit --outputFile=test-results/eai-cli-results.xml",
16
+ "test:eai-cli:ci": "node scripts/run-eai-cli-tests.cjs docs-site/scripts/build-site.test.mjs -- tests/unit/managed-profile-gateway.test.ts tests/unit/gofer-resource-override.test.ts tests/unit/init-app-binding.test.ts tests/unit/object-type-identifiers.test.ts tests/unit/release-terminology.test.ts tests/unit/ai-surfaces.test.ts tests/unit/eai-managed-deploy.test.ts tests/unit/eai-managed-deploy-write.test.ts tests/unit/eai-managed-source.test.ts tests/unit/eai-managed-source-race.test.ts tests/unit/eai-managed-source-client.test.ts tests/integration/object-type-documentation.test.ts tests/integration/login.test.ts tests/integration/whoami.test.ts tests/integration/tenant.test.ts tests/integration/init.test.ts tests/integration/create.test.ts tests/integration/splash.test.ts tests/integration/help.test.ts tests/integration/describe-contract.test.ts tests/integration/start.test.ts tests/integration/dev.test.ts tests/integration/update.test.ts tests/integration/output.test.ts tests/integration/error-guidance.test.ts tests/integration/resources-command.test.ts tests/integration/agent-guide.test.ts tests/integration/agent-discovery-eval.test.ts tests/integration/gofer.test.ts tests/integration/provision.test.ts tests/integration/types.test.ts tests/integration/user.test.ts tests/integration/publicapi.test.ts tests/integration/publicapi-v4-only.test.ts tests/integration/docs-classify.test.ts tests/integration/classifier.test.ts tests/integration/platform-api-client.test.ts tests/integration/eai-managed-deploy.test.ts tests/integration/vertical.test.ts tests/integration/dedicated-tenant-lifecycle.test.ts tests/integration/runtime-contract.test.ts tests/integration/inquirer-prompt-types.test.ts tests/integration/full-e2e-smoke.test.ts tests/integration/release-metadata.test.ts tests/integration/support.test.ts tests/integration/support-context.test.ts tests/unit/support-report.test.ts tests/integration/verify-exit-status.test.ts tests/unit/cloud-env.test.ts tests/unit/env-command.test.ts tests/unit/profile-context.test.ts tests/unit/schema-builder.test.ts tests/unit/test-token-isolation.test.ts tests/unit/object-type-export.test.ts tests/unit/platform-diagnostics.test.ts tests/unit/cli-test-coverage.test.ts tests/unit/release-build.test.ts tests/integration/linked-sources.test.ts tests/integration/verify-calls.test.ts tests/unit/local-app-credential.test.ts tests/integration/chat-command.test.ts tests/integration/unsupported-command.test.ts --reporter=default --reporter=junit --outputFile=test-results/eai-cli-results.xml",
17
17
  "test:e2e-local": "bash scripts/test-local-dedicated-tenant-lifecycle.sh",
18
18
  "smoke:resourceapi-lifecycle": "bash scripts/smoke-resourceapi-schema-sync-lifecycle.sh",
19
19
  "smoke:eai-full:check": "node scripts/eai-full-e2e-smoke.cjs --check",
@@ -88,6 +88,7 @@
88
88
  },
89
89
  "devDependencies": {
90
90
  "@eslint/js": "10.0.1",
91
+ "@next/env": "15.5.27",
91
92
  "@types/node": "24.13.3",
92
93
  "@vitest/ui": "4.1.8",
93
94
  "eslint": "10.4.1",