@provartesting/provardx-cli 1.5.0-beta.1 → 1.5.0-beta.10

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 (78) hide show
  1. package/README.md +137 -13
  2. package/lib/commands/provar/auth/clear.d.ts +7 -0
  3. package/lib/commands/provar/auth/clear.js +36 -0
  4. package/lib/commands/provar/auth/clear.js.map +1 -0
  5. package/lib/commands/provar/auth/login.d.ts +10 -0
  6. package/lib/commands/provar/auth/login.js +90 -0
  7. package/lib/commands/provar/auth/login.js.map +1 -0
  8. package/lib/commands/provar/auth/rotate.d.ts +7 -0
  9. package/lib/commands/provar/auth/rotate.js +42 -0
  10. package/lib/commands/provar/auth/rotate.js.map +1 -0
  11. package/lib/commands/provar/auth/status.d.ts +7 -0
  12. package/lib/commands/provar/auth/status.js +107 -0
  13. package/lib/commands/provar/auth/status.js.map +1 -0
  14. package/lib/mcp/docs/PROVAR_TEST_STEP_REFERENCE.md +1430 -0
  15. package/lib/mcp/licensing/licenseValidator.d.ts +3 -3
  16. package/lib/mcp/licensing/licenseValidator.js +4 -4
  17. package/lib/mcp/prompts/index.d.ts +2 -0
  18. package/lib/mcp/prompts/index.js +19 -0
  19. package/lib/mcp/prompts/index.js.map +1 -0
  20. package/lib/mcp/prompts/loopPrompts.d.ts +6 -0
  21. package/lib/mcp/prompts/loopPrompts.js +435 -0
  22. package/lib/mcp/prompts/loopPrompts.js.map +1 -0
  23. package/lib/mcp/prompts/migrationPrompts.d.ts +4 -0
  24. package/lib/mcp/prompts/migrationPrompts.js +207 -0
  25. package/lib/mcp/prompts/migrationPrompts.js.map +1 -0
  26. package/lib/mcp/rules/provar_best_practices_rules.json +256 -544
  27. package/lib/mcp/server.js +45 -1
  28. package/lib/mcp/server.js.map +1 -1
  29. package/lib/mcp/tools/antTools.d.ts +15 -0
  30. package/lib/mcp/tools/antTools.js +204 -50
  31. package/lib/mcp/tools/antTools.js.map +1 -1
  32. package/lib/mcp/tools/automationTools.d.ts +36 -3
  33. package/lib/mcp/tools/automationTools.js +335 -42
  34. package/lib/mcp/tools/automationTools.js.map +1 -1
  35. package/lib/mcp/tools/bestPracticesEngine.js +161 -23
  36. package/lib/mcp/tools/bestPracticesEngine.js.map +1 -1
  37. package/lib/mcp/tools/connectionTools.d.ts +4 -0
  38. package/lib/mcp/tools/connectionTools.js +168 -0
  39. package/lib/mcp/tools/connectionTools.js.map +1 -0
  40. package/lib/mcp/tools/nitroXTools.d.ts +22 -0
  41. package/lib/mcp/tools/nitroXTools.js +750 -0
  42. package/lib/mcp/tools/nitroXTools.js.map +1 -0
  43. package/lib/mcp/tools/pageObjectGenerate.js +103 -35
  44. package/lib/mcp/tools/pageObjectGenerate.js.map +1 -1
  45. package/lib/mcp/tools/propertiesTools.d.ts +2 -0
  46. package/lib/mcp/tools/propertiesTools.js +277 -39
  47. package/lib/mcp/tools/propertiesTools.js.map +1 -1
  48. package/lib/mcp/tools/qualityHubApiTools.d.ts +3 -0
  49. package/lib/mcp/tools/qualityHubApiTools.js +134 -0
  50. package/lib/mcp/tools/qualityHubApiTools.js.map +1 -0
  51. package/lib/mcp/tools/qualityHubTools.js +127 -19
  52. package/lib/mcp/tools/qualityHubTools.js.map +1 -1
  53. package/lib/mcp/tools/rcaTools.d.ts +3 -2
  54. package/lib/mcp/tools/rcaTools.js +145 -20
  55. package/lib/mcp/tools/rcaTools.js.map +1 -1
  56. package/lib/mcp/tools/testCaseGenerate.js +88 -59
  57. package/lib/mcp/tools/testCaseGenerate.js.map +1 -1
  58. package/lib/mcp/tools/testCaseStepTools.d.ts +4 -0
  59. package/lib/mcp/tools/testCaseStepTools.js +221 -0
  60. package/lib/mcp/tools/testCaseStepTools.js.map +1 -0
  61. package/lib/mcp/tools/testCaseValidate.d.ts +11 -0
  62. package/lib/mcp/tools/testCaseValidate.js +146 -19
  63. package/lib/mcp/tools/testCaseValidate.js.map +1 -1
  64. package/lib/services/auth/credentials.d.ts +21 -0
  65. package/lib/services/auth/credentials.js +75 -0
  66. package/lib/services/auth/credentials.js.map +1 -0
  67. package/lib/services/auth/loginFlow.d.ts +68 -0
  68. package/lib/services/auth/loginFlow.js +216 -0
  69. package/lib/services/auth/loginFlow.js.map +1 -0
  70. package/lib/services/qualityHub/client.d.ts +161 -0
  71. package/lib/services/qualityHub/client.js +226 -0
  72. package/lib/services/qualityHub/client.js.map +1 -0
  73. package/messages/sf.provar.auth.clear.md +16 -0
  74. package/messages/sf.provar.auth.login.md +31 -0
  75. package/messages/sf.provar.auth.rotate.md +23 -0
  76. package/messages/sf.provar.auth.status.md +16 -0
  77. package/oclif.manifest.json +214 -1
  78. package/package.json +8 -4
@@ -0,0 +1,226 @@
1
+ /*
2
+ * Copyright (c) 2024 Provar Limited.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ /* eslint-disable camelcase */
8
+ import https from 'node:https';
9
+ import { URL as NodeURL } from 'node:url';
10
+ /**
11
+ * Map the raw API response to our internal validation result shape.
12
+ * Exported for unit testing; called by validateTestCaseViaApi once the stub is replaced.
13
+ *
14
+ * Mapping rules (from AWS memo 2026-04-10):
15
+ * raw.valid → is_valid
16
+ * raw.errors[].severity "critical" → issues[].severity "ERROR"
17
+ * raw.warnings[].severity * → issues[].severity "WARNING"
18
+ * raw.quality_metrics.quality_score → quality_score
19
+ * validity_score: 100 when valid, else max(0, 100 - errors.length * 20)
20
+ */
21
+ export function normaliseApiResponse(raw) {
22
+ const issues = [
23
+ ...raw.errors.map((v) => ({
24
+ rule_id: v.rule_id,
25
+ severity: 'ERROR',
26
+ message: v.message,
27
+ applies_to: v.applies_to?.[0],
28
+ suggestion: v.recommendation,
29
+ })),
30
+ ...raw.warnings.map((v) => ({
31
+ rule_id: v.rule_id,
32
+ severity: 'WARNING',
33
+ message: v.message,
34
+ applies_to: v.applies_to?.[0],
35
+ suggestion: v.recommendation,
36
+ })),
37
+ ];
38
+ return {
39
+ is_valid: raw.valid,
40
+ validity_score: raw.valid ? 100 : Math.max(0, 100 - raw.errors.length * 20),
41
+ quality_score: raw.quality_metrics.quality_score,
42
+ issues,
43
+ };
44
+ }
45
+ /**
46
+ * Typed errors returned when the API call fails in a known way.
47
+ * The MCP tool maps these to appropriate fallback behaviour.
48
+ */
49
+ export class QualityHubAuthError extends Error {
50
+ code = 'AUTH_ERROR';
51
+ }
52
+ export class QualityHubRateLimitError extends Error {
53
+ code = 'RATE_LIMITED';
54
+ }
55
+ /**
56
+ * POST /validate — submit XML to the Quality Hub validation API.
57
+ *
58
+ * Request:
59
+ * POST <baseUrl>/validate
60
+ * x-provar-key: pv_k_... (user auth — no x-api-key infra gate on this endpoint)
61
+ * Content-Type: application/json
62
+ * { "test_case_xml": "<full XML string>" }
63
+ *
64
+ * On failure the MCP tool catches and falls back to local validation
65
+ * (validation_source: "local_fallback"). No user-visible crash.
66
+ */
67
+ export async function validateTestCaseViaApi(xml, apiKey, baseUrl) {
68
+ const body = JSON.stringify({ test_case_xml: xml });
69
+ const { status, responseBody } = await httpsRequest(`${baseUrl}/validate`, 'POST', { 'Content-Type': 'application/json', 'x-provar-key': apiKey }, body);
70
+ if (status === 401) {
71
+ throw new QualityHubAuthError('API key is invalid, expired, or revoked. Run `sf provar auth login` to get a new key.');
72
+ }
73
+ if (status === 429) {
74
+ throw new QualityHubRateLimitError('Quality Hub validation rate limit exceeded. Try again later.');
75
+ }
76
+ if (!isOk(status)) {
77
+ throw new Error(`Quality Hub validate failed (${status}): ${responseBody}`);
78
+ }
79
+ return normaliseApiResponse(JSON.parse(responseBody));
80
+ }
81
+ /**
82
+ * Returns the Quality Hub base URL to use for API calls.
83
+ * Defaults to the dev environment URL; override via PROVAR_QUALITY_HUB_URL for production.
84
+ * Update DEFAULT_QUALITY_HUB_URL when the production URL is confirmed.
85
+ */
86
+ const DEFAULT_QUALITY_HUB_URL = 'https://aqqlrlhga7.execute-api.us-east-1.amazonaws.com/dev';
87
+ /**
88
+ * Self-service access request page for users who do not yet have a Provar MCP account.
89
+ * Public HTML — no API key or Cognito token required.
90
+ * Update when staging/prod stages are deployed.
91
+ */
92
+ export const REQUEST_ACCESS_URL = `${DEFAULT_QUALITY_HUB_URL}/auth/request-access`;
93
+ export function getQualityHubBaseUrl() {
94
+ return process.env.PROVAR_QUALITY_HUB_URL ?? DEFAULT_QUALITY_HUB_URL;
95
+ }
96
+ // ── Auth endpoint functions ───────────────────────────────────────────────────
97
+ /**
98
+ * POST /auth/exchange — exchange a Cognito access token for a pv_k_ key.
99
+ * Called immediately after PKCE callback; Cognito tokens are discarded after this call.
100
+ */
101
+ export async function exchangeTokenForKey(cognitoAccessToken, baseUrl) {
102
+ const body = JSON.stringify({ access_token: cognitoAccessToken });
103
+ const { status, responseBody } = await httpsRequest(`${baseUrl}/auth/exchange`, 'POST', { 'Content-Type': 'application/json' }, body);
104
+ if (status === 401)
105
+ throw new QualityHubAuthError(`Account not found or no active subscription.\nRequest access at: ${REQUEST_ACCESS_URL}`);
106
+ if (!isOk(status))
107
+ throw new Error(`Auth exchange failed (${status}): ${responseBody}`);
108
+ return JSON.parse(responseBody);
109
+ }
110
+ /**
111
+ * GET /auth/status — verify a stored pv_k_ key is still valid server-side.
112
+ * Best-effort: callers should catch and fall back to locally cached values on failure.
113
+ */
114
+ export async function fetchKeyStatus(apiKey, baseUrl) {
115
+ const { status, responseBody } = await httpsRequest(`${baseUrl}/auth/status`, 'GET', {
116
+ 'x-provar-key': apiKey,
117
+ });
118
+ if (!isOk(status))
119
+ throw new Error(`Auth status check failed (${status})`);
120
+ return JSON.parse(responseBody);
121
+ }
122
+ /**
123
+ * POST /auth/revoke — invalidate a pv_k_ key on the server.
124
+ * Best-effort: callers should catch, log a note, then delete the local file regardless.
125
+ */
126
+ export async function revokeKey(apiKey, baseUrl) {
127
+ const { status, responseBody } = await httpsRequest(`${baseUrl}/auth/revoke`, 'POST', {
128
+ 'x-provar-key': apiKey,
129
+ 'Content-Length': '0',
130
+ });
131
+ if (!isOk(status))
132
+ throw new Error(`Key revocation failed (${status}): ${responseBody}`);
133
+ }
134
+ /**
135
+ * POST /auth/rotate — atomically replace the current pv_k_ key with a new one.
136
+ * The old key is invalidated immediately. Returns the same shape as /auth/exchange.
137
+ * On 401: key is invalid/expired — caller should direct user to sf provar auth login.
138
+ */
139
+ export async function rotateKey(apiKey, baseUrl) {
140
+ const { status, responseBody } = await httpsRequest(`${baseUrl}/auth/rotate`, 'POST', {
141
+ 'x-provar-key': apiKey,
142
+ 'Content-Length': '0',
143
+ });
144
+ if (status === 401)
145
+ throw new QualityHubAuthError('API key is invalid or expired. Run `sf provar auth login` to get a new key.');
146
+ if (!isOk(status))
147
+ throw new Error(`Key rotation failed (${status}): ${responseBody}`);
148
+ return JSON.parse(responseBody);
149
+ }
150
+ // ── Corpus retrieval function ─────────────────────────────────────────────────
151
+ /**
152
+ * POST /corpus/retrieve — fetch N similar Provar test examples from the Bedrock KB corpus.
153
+ * Used by provar.qualityhub.examples.retrieve as the few-shot grounding step before
154
+ * the client LLM synthesises a new test case.
155
+ *
156
+ * Throws QualityHubAuthError on 401, QualityHubRateLimitError on 429.
157
+ * All other non-2xx responses throw a generic Error with status + body.
158
+ */
159
+ export async function retrieveCorpusExamples(query, apiKey, baseUrl, options = {}) {
160
+ const n = Math.min(Math.max(options.n ?? 5, 1), 10);
161
+ const body = JSON.stringify({
162
+ query,
163
+ n,
164
+ ...(options.app_filter !== undefined ? { app_filter: options.app_filter } : {}),
165
+ prefer_high_quality: options.prefer_high_quality ?? true,
166
+ });
167
+ const { status, responseBody } = await httpsRequest(`${baseUrl}/corpus/retrieve`, 'POST', { 'Content-Type': 'application/json', 'x-provar-key': apiKey }, body);
168
+ if (status === 401) {
169
+ throw new QualityHubAuthError('API key is invalid, expired, or revoked. Run `sf provar auth login` to get a new key.');
170
+ }
171
+ if (status === 429) {
172
+ throw new QualityHubRateLimitError('Quality Hub corpus retrieval rate limit exceeded. Try again later.');
173
+ }
174
+ if (!isOk(status)) {
175
+ throw new Error(`Corpus retrieval failed (${status}): ${responseBody}`);
176
+ }
177
+ return JSON.parse(responseBody);
178
+ }
179
+ // ── Internal HTTPS helper ─────────────────────────────────────────────────────
180
+ function isOk(status) {
181
+ return status >= 200 && status < 300;
182
+ }
183
+ const REQUEST_TIMEOUT_MS = 30000;
184
+ function httpsRequest(url, method, headers, body) {
185
+ return new Promise((resolve, reject) => {
186
+ const parsed = new NodeURL(url);
187
+ const opts = {
188
+ hostname: parsed.hostname,
189
+ port: parsed.port || undefined,
190
+ path: parsed.pathname + parsed.search,
191
+ method,
192
+ headers: {
193
+ ...headers,
194
+ ...(body ? { 'Content-Length': Buffer.byteLength(body).toString() } : {}),
195
+ },
196
+ };
197
+ const req = https.request(opts, (res) => {
198
+ let data = '';
199
+ res.on('data', (chunk) => {
200
+ data += chunk.toString('utf-8');
201
+ });
202
+ res.on('end', () => resolve({ status: res.statusCode ?? 0, responseBody: data }));
203
+ });
204
+ req.setTimeout(REQUEST_TIMEOUT_MS, () => {
205
+ req.destroy(new Error(`Quality Hub API request timed out after ${REQUEST_TIMEOUT_MS / 1000}s`));
206
+ });
207
+ req.on('error', reject);
208
+ if (body)
209
+ req.write(body);
210
+ req.end();
211
+ });
212
+ }
213
+ // ── Indirection object used by MCP tools and testable via sinon ───────────────
214
+ /**
215
+ * MCP tools and auth commands call qualityHubClient.X() so tests can replace
216
+ * properties with stubs without ESM re-export issues.
217
+ */
218
+ export const qualityHubClient = {
219
+ validateTestCaseViaApi,
220
+ exchangeTokenForKey,
221
+ fetchKeyStatus,
222
+ revokeKey,
223
+ rotateKey,
224
+ retrieveCorpusExamples,
225
+ };
226
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/services/qualityHub/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8BAA8B;AAC9B,OAAO,KAAK,MAAM,YAAY,CAAC;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G,EAAE,EAAE;YACtC,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC/B,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,UAAU,IAAI,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,UAAU,CAAC,kBAAkB,EAAE,GAAG,EAAE;YACtC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,2CAA2C,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;QAClG,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxB,IAAI,IAAI;YAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,GAAG,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,sBAAsB;IACtB,mBAAmB;IACnB,cAAc;IACd,SAAS;IACT,SAAS;IACT,sBAAsB;CACvB,CAAC"}
@@ -0,0 +1,16 @@
1
+ # summary
2
+
3
+ Remove the stored Provar API key.
4
+
5
+ # description
6
+
7
+ Deletes the API key stored at ~/.provar/credentials.json. After clearing, the
8
+ provar.testcase.validate MCP tool falls back to local validation (structural rules only,
9
+ no Quality Hub quality scoring).
10
+
11
+ The PROVAR_API_KEY environment variable is not affected by this command.
12
+
13
+ # examples
14
+
15
+ - Clear the stored API key:
16
+ <%= config.bin %> <%= command.id %>
@@ -0,0 +1,31 @@
1
+ # summary
2
+
3
+ Log in to Provar Quality Hub and store your API key.
4
+
5
+ # description
6
+
7
+ Opens a browser to the Provar login page. After you authenticate, your API key
8
+ is stored at ~/.provar/credentials.json and used automatically by the Provar MCP
9
+ tools and CI/CD integrations.
10
+
11
+ The Cognito session tokens are held in memory only for the duration of the key
12
+ exchange and are then discarded — only the pv*k* API key is written to disk.
13
+
14
+ Run 'sf provar auth status' after login to confirm the key is configured correctly.
15
+
16
+ Don't have an account? Request access at:
17
+ https://aqqlrlhga7.execute-api.us-east-1.amazonaws.com/dev/auth/request-access
18
+
19
+ # flags.url.summary
20
+
21
+ Override the Quality Hub API base URL (for testing against a non-production environment).
22
+
23
+ # examples
24
+
25
+ - Log in interactively (opens browser):
26
+
27
+ <%= config.bin %> <%= command.id %>
28
+
29
+ - Log in against a staging environment:
30
+
31
+ <%= config.bin %> <%= command.id %> --url https://dev.api.example.com
@@ -0,0 +1,23 @@
1
+ # summary
2
+
3
+ Rotate your stored Provar Quality Hub API key.
4
+
5
+ # description
6
+
7
+ Exchanges your current pv*k* key for a new one in a single atomic operation.
8
+ The old key is invalidated the moment the new key is issued — there is no window
9
+ where both are valid.
10
+
11
+ The new key is written to ~/.provar/credentials.json automatically.
12
+
13
+ Use this command to rotate your key on a regular schedule (every ~90 days) without
14
+ going through the browser login flow again.
15
+
16
+ If the current key is already expired or revoked, rotation is not possible — run
17
+ sf provar auth login instead to authenticate via browser and get a fresh key.
18
+
19
+ # examples
20
+
21
+ - Rotate the stored API key:
22
+
23
+ <%= config.bin %> <%= command.id %>
@@ -0,0 +1,16 @@
1
+ # summary
2
+
3
+ Show the current Provar API key configuration status.
4
+
5
+ # description
6
+
7
+ Reports where the active API key comes from (environment variable or stored file),
8
+ shows the key prefix and when it was set, and states whether validation will use the
9
+ Quality Hub API or local rules only. The full key is never printed.
10
+
11
+ If no key is configured, guidance is shown for logging in or requesting access.
12
+
13
+ # examples
14
+
15
+ - Check auth status:
16
+ <%= config.bin %> <%= command.id %>
@@ -1,5 +1,218 @@
1
1
  {
2
2
  "commands": {
3
+ "provar:auth:clear": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Deletes the API key stored at ~/.provar/credentials.json. After clearing, the\nprovar.testcase.validate MCP tool falls back to local validation (structural rules only,\nno Quality Hub quality scoring).\n\nThe PROVAR_API_KEY environment variable is not affected by this command.",
7
+ "examples": [
8
+ "Clear the stored API key:\n<%= config.bin %> <%= command.id %>"
9
+ ],
10
+ "flags": {
11
+ "json": {
12
+ "description": "Format output as json.",
13
+ "helpGroup": "GLOBAL",
14
+ "name": "json",
15
+ "allowNo": false,
16
+ "type": "boolean"
17
+ },
18
+ "flags-dir": {
19
+ "helpGroup": "GLOBAL",
20
+ "name": "flags-dir",
21
+ "summary": "Import flag values from a directory.",
22
+ "hasDynamicHelp": false,
23
+ "multiple": false,
24
+ "type": "option"
25
+ }
26
+ },
27
+ "hasDynamicHelp": false,
28
+ "hiddenAliases": [],
29
+ "id": "provar:auth:clear",
30
+ "pluginAlias": "@provartesting/provardx-cli",
31
+ "pluginName": "@provartesting/provardx-cli",
32
+ "pluginType": "core",
33
+ "strict": true,
34
+ "summary": "Remove the stored Provar API key.",
35
+ "enableJsonFlag": true,
36
+ "isESM": true,
37
+ "relativePath": [
38
+ "lib",
39
+ "commands",
40
+ "provar",
41
+ "auth",
42
+ "clear.js"
43
+ ],
44
+ "aliasPermutations": [],
45
+ "permutations": [
46
+ "provar:auth:clear",
47
+ "auth:provar:clear",
48
+ "auth:clear:provar",
49
+ "provar:clear:auth",
50
+ "clear:provar:auth",
51
+ "clear:auth:provar"
52
+ ]
53
+ },
54
+ "provar:auth:login": {
55
+ "aliases": [],
56
+ "args": {},
57
+ "description": "Opens a browser to the Provar login page. After you authenticate, your API key\nis stored at ~/.provar/credentials.json and used automatically by the Provar MCP\ntools and CI/CD integrations.\n\nThe Cognito session tokens are held in memory only for the duration of the key\nexchange and are then discarded — only the pv*k* API key is written to disk.\n\nRun 'sf provar auth status' after login to confirm the key is configured correctly.\n\nDon't have an account? Request access at:\nhttps://aqqlrlhga7.execute-api.us-east-1.amazonaws.com/dev/auth/request-access",
58
+ "examples": [
59
+ "Log in interactively (opens browser):\n<%= config.bin %> <%= command.id %>",
60
+ "Log in against a staging environment:\n<%= config.bin %> <%= command.id %> --url https://dev.api.example.com"
61
+ ],
62
+ "flags": {
63
+ "json": {
64
+ "description": "Format output as json.",
65
+ "helpGroup": "GLOBAL",
66
+ "name": "json",
67
+ "allowNo": false,
68
+ "type": "boolean"
69
+ },
70
+ "flags-dir": {
71
+ "helpGroup": "GLOBAL",
72
+ "name": "flags-dir",
73
+ "summary": "Import flag values from a directory.",
74
+ "hasDynamicHelp": false,
75
+ "multiple": false,
76
+ "type": "option"
77
+ },
78
+ "url": {
79
+ "name": "url",
80
+ "required": false,
81
+ "summary": "Override the Quality Hub API base URL (for testing against a non-production environment).",
82
+ "hasDynamicHelp": false,
83
+ "multiple": false,
84
+ "type": "option"
85
+ }
86
+ },
87
+ "hasDynamicHelp": false,
88
+ "hiddenAliases": [],
89
+ "id": "provar:auth:login",
90
+ "pluginAlias": "@provartesting/provardx-cli",
91
+ "pluginName": "@provartesting/provardx-cli",
92
+ "pluginType": "core",
93
+ "strict": true,
94
+ "summary": "Log in to Provar Quality Hub and store your API key.",
95
+ "enableJsonFlag": true,
96
+ "isESM": true,
97
+ "relativePath": [
98
+ "lib",
99
+ "commands",
100
+ "provar",
101
+ "auth",
102
+ "login.js"
103
+ ],
104
+ "aliasPermutations": [],
105
+ "permutations": [
106
+ "provar:auth:login",
107
+ "auth:provar:login",
108
+ "auth:login:provar",
109
+ "provar:login:auth",
110
+ "login:provar:auth",
111
+ "login:auth:provar"
112
+ ]
113
+ },
114
+ "provar:auth:rotate": {
115
+ "aliases": [],
116
+ "args": {},
117
+ "description": "Exchanges your current pv*k* key for a new one in a single atomic operation.\nThe old key is invalidated the moment the new key is issued — there is no window\nwhere both are valid.\n\nThe new key is written to ~/.provar/credentials.json automatically.\n\nUse this command to rotate your key on a regular schedule (every ~90 days) without\ngoing through the browser login flow again.\n\nIf the current key is already expired or revoked, rotation is not possible — run\nsf provar auth login instead to authenticate via browser and get a fresh key.",
118
+ "examples": [
119
+ "Rotate the stored API key:\n<%= config.bin %> <%= command.id %>"
120
+ ],
121
+ "flags": {
122
+ "json": {
123
+ "description": "Format output as json.",
124
+ "helpGroup": "GLOBAL",
125
+ "name": "json",
126
+ "allowNo": false,
127
+ "type": "boolean"
128
+ },
129
+ "flags-dir": {
130
+ "helpGroup": "GLOBAL",
131
+ "name": "flags-dir",
132
+ "summary": "Import flag values from a directory.",
133
+ "hasDynamicHelp": false,
134
+ "multiple": false,
135
+ "type": "option"
136
+ }
137
+ },
138
+ "hasDynamicHelp": false,
139
+ "hiddenAliases": [],
140
+ "id": "provar:auth:rotate",
141
+ "pluginAlias": "@provartesting/provardx-cli",
142
+ "pluginName": "@provartesting/provardx-cli",
143
+ "pluginType": "core",
144
+ "strict": true,
145
+ "summary": "Rotate your stored Provar Quality Hub API key.",
146
+ "enableJsonFlag": true,
147
+ "isESM": true,
148
+ "relativePath": [
149
+ "lib",
150
+ "commands",
151
+ "provar",
152
+ "auth",
153
+ "rotate.js"
154
+ ],
155
+ "aliasPermutations": [],
156
+ "permutations": [
157
+ "provar:auth:rotate",
158
+ "auth:provar:rotate",
159
+ "auth:rotate:provar",
160
+ "provar:rotate:auth",
161
+ "rotate:provar:auth",
162
+ "rotate:auth:provar"
163
+ ]
164
+ },
165
+ "provar:auth:status": {
166
+ "aliases": [],
167
+ "args": {},
168
+ "description": "Reports where the active API key comes from (environment variable or stored file),\nshows the key prefix and when it was set, and states whether validation will use the\nQuality Hub API or local rules only. The full key is never printed.\n\nIf no key is configured, guidance is shown for logging in or requesting access.",
169
+ "examples": [
170
+ "Check auth status:\n<%= config.bin %> <%= command.id %>"
171
+ ],
172
+ "flags": {
173
+ "json": {
174
+ "description": "Format output as json.",
175
+ "helpGroup": "GLOBAL",
176
+ "name": "json",
177
+ "allowNo": false,
178
+ "type": "boolean"
179
+ },
180
+ "flags-dir": {
181
+ "helpGroup": "GLOBAL",
182
+ "name": "flags-dir",
183
+ "summary": "Import flag values from a directory.",
184
+ "hasDynamicHelp": false,
185
+ "multiple": false,
186
+ "type": "option"
187
+ }
188
+ },
189
+ "hasDynamicHelp": false,
190
+ "hiddenAliases": [],
191
+ "id": "provar:auth:status",
192
+ "pluginAlias": "@provartesting/provardx-cli",
193
+ "pluginName": "@provartesting/provardx-cli",
194
+ "pluginType": "core",
195
+ "strict": true,
196
+ "summary": "Show the current Provar API key configuration status.",
197
+ "enableJsonFlag": true,
198
+ "isESM": true,
199
+ "relativePath": [
200
+ "lib",
201
+ "commands",
202
+ "provar",
203
+ "auth",
204
+ "status.js"
205
+ ],
206
+ "aliasPermutations": [],
207
+ "permutations": [
208
+ "provar:auth:status",
209
+ "auth:provar:status",
210
+ "auth:status:provar",
211
+ "provar:status:auth",
212
+ "status:provar:auth",
213
+ "status:auth:provar"
214
+ ]
215
+ },
3
216
  "provar:config:get": {
4
217
  "aliases": [],
5
218
  "args": {},
@@ -1811,5 +2024,5 @@
1811
2024
  ]
1812
2025
  }
1813
2026
  },
1814
- "version": "1.5.0-beta.1"
2027
+ "version": "1.5.0-beta.10"
1815
2028
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@provartesting/provardx-cli",
3
3
  "description": "A plugin for the Salesforce CLI to orchestrate testing activities and report quality metrics to Provar Quality Hub",
4
- "version": "1.5.0-beta.1",
4
+ "version": "1.5.0-beta.10",
5
+ "mcpName": "io.github.provartesting/provar",
5
6
  "license": "BSD-3-Clause",
6
7
  "plugins": [
7
8
  "@provartesting/provardx-plugins-automation",
@@ -35,7 +36,7 @@
35
36
  "wireit": "^0.14.0"
36
37
  },
37
38
  "engines": {
38
- "node": ">=18.0.0"
39
+ "node": ">=18.0.0 <25.0.0"
39
40
  },
40
41
  "files": [
41
42
  "/lib",
@@ -91,6 +92,9 @@
91
92
  }
92
93
  }
93
94
  },
95
+ "auth": {
96
+ "description": "Commands to manage Provar API key authentication."
97
+ },
94
98
  "automation": {
95
99
  "description": "Commands to interact with Provar Automation.",
96
100
  "subtopics": {
@@ -125,7 +129,7 @@
125
129
  "postpack": "shx rm -f oclif.manifest.json",
126
130
  "prepack": "sf-prepack",
127
131
  "test": "wireit",
128
- "test:nuts": "nyc mocha \"**/*generate.nut.ts\" \"**/*permission.nut.ts\" \"**/*load.nut.ts\" \"**/*validate.nut.ts\" \"**/*set.nut.ts\" \"**/*get.nut.ts\" --slow 4500 --timeout 600000 --reporter mochawesome",
132
+ "test:nuts": "nyc mocha \"**/*generate.nut.ts\" \"**/*permission.nut.ts\" \"**/*load.nut.ts\" \"**/*validate.nut.ts\" \"**/*set.nut.ts\" \"**/*get.nut.ts\" \"**/*key.nut.ts\" \"**/*status.nut.ts\" \"**/*clear.nut.ts\" --slow 4500 --timeout 600000 --reporter mochawesome",
129
133
  "test:only": "wireit",
130
134
  "test:dev": "nyc mocha \"test/**/*.test.ts\"",
131
135
  "test:watch": "mocha \"test/**/*.test.ts\" --watch --watch-files \"src/**/*.ts\" --watch-files \"test/**/*.ts\"",
@@ -142,7 +146,7 @@
142
146
  ]
143
147
  },
144
148
  "compile": {
145
- "command": "tsc -p . --pretty --incremental && shx mkdir -p lib/mcp/rules && shx cp src/mcp/rules/*.json lib/mcp/rules/",
149
+ "command": "tsc -p . --pretty --incremental && shx mkdir -p lib/mcp/rules && shx cp src/mcp/rules/*.json lib/mcp/rules/ && shx mkdir -p lib/mcp/docs && shx cp docs/PROVAR_TEST_STEP_REFERENCE.md lib/mcp/docs/",
146
150
  "files": [
147
151
  "src/**/*.ts",
148
152
  "src/mcp/rules/*.json",