Skip to content

Commit fc2a8a6

Browse files
mrdailey99claude
andcommitted
chore(auth): remove sf provar auth set-key command
No AWS route backs this command and keys can only be obtained via sf provar auth login. set-key was clutter in --help. Removed: src command, messages file, unit tests, NUT file. Updated: status.ts, testCaseValidate.ts, README, mcp.md, mcp-pilot-guide.md all point to sf provar auth login instead. clear/status NUTs now seed credentials.json directly rather than depending on set-key as a test fixture. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4816dea commit fc2a8a6

11 files changed

Lines changed: 24 additions & 237 deletions

File tree

README.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ When `NODE_ENV=test` the validation step is skipped entirely. This is intended o
6060
# Commands
6161

6262
- [`sf provar auth login`](#sf-provar-auth-login)
63-
- [`sf provar auth set-key`](#sf-provar-auth-set-key)
6463
- [`sf provar auth status`](#sf-provar-auth-status)
6564
- [`sf provar auth clear`](#sf-provar-auth-clear)
6665
- [`sf provar mcp start`](#sf-provar-mcp-start)
@@ -121,28 +120,6 @@ EXAMPLES
121120
$ sf provar auth login --url https://dev.api.example.com
122121
```
123122

124-
## `sf provar auth set-key`
125-
126-
Store a Provar Quality Hub API key manually.
127-
128-
```
129-
USAGE
130-
$ sf provar auth set-key --key <value>
131-
132-
FLAGS
133-
--key=<value> (required) API key to store. Must start with pv_k_.
134-
135-
DESCRIPTION
136-
Stores a pv_k_ API key in ~/.provar/credentials.json. Use this if you obtained
137-
your key from https://success.provartesting.com rather than via browser login.
138-
For CI/CD pipelines, set the PROVAR_API_KEY environment variable instead.
139-
140-
EXAMPLES
141-
Store an API key:
142-
143-
$ sf provar auth set-key --key pv_k_your_key_here
144-
```
145-
146123
## `sf provar auth status`
147124

148125
Show the current API key configuration and validate it against Quality Hub.

docs/mcp-pilot-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ The MCP server uses **stdio transport** exclusively. Communication travels over
346346

347347
**Salesforce org credentials** — the Quality Hub and Automation tools invoke `sf` subprocesses. Salesforce org credentials are managed entirely by the Salesforce CLI and stored in its own credential store (`~/.sf/`). The Provar MCP server never reads, parses, or transmits those credentials.
348348

349-
**Provar API key** — the `provar.testcase.validate` tool optionally reads a `pv_k_` API key to enable Quality Hub API validation. The key is stored at `~/.provar/credentials.json` (written by `sf provar auth login` or `sf provar auth set-key`) or read from the `PROVAR_API_KEY` environment variable. The key is sent to the Provar Quality Hub API only when a validation request is made — it is never logged or written anywhere other than `~/.provar/credentials.json`.
349+
**Provar API key** — the `provar.testcase.validate` tool optionally reads a `pv_k_` API key to enable Quality Hub API validation. The key is stored at `~/.provar/credentials.json` (written by `sf provar auth login`) or read from the `PROVAR_API_KEY` environment variable. The key is sent to the Provar Quality Hub API only when a validation request is made — it is never logged or written anywhere other than `~/.provar/credentials.json`.
350350

351351
### Path policy enforcement
352352

docs/mcp.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,6 @@ sf provar auth login
167167
```
168168
Opens a browser to the Provar login page. After you authenticate, the key is stored automatically at `~/.provar/credentials.json`.
169169

170-
**Manual key entry:**
171-
```sh
172-
sf provar auth set-key --key pv_k_your_key_here
173-
```
174-
175170
**Check current status:**
176171
```sh
177172
sf provar auth status

messages/sf.provar.auth.set-key.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/commands/provar/auth/set-key.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/commands/provar/auth/status.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ export default class SfProvarAuthStatus extends SfCommand<void> {
7878
this.log('No API key configured.');
7979
this.log('');
8080
this.log('To enable Quality Hub validation (170 rules):');
81-
this.log(' 1. Run: sf provar auth login');
82-
this.log(' Or get your key from https://success.provartesting.com and run:');
83-
this.log(' sf provar auth set-key --key <your-key>');
81+
this.log(' Run: sf provar auth login');
8482
this.log('');
8583
this.log('For CI/CD: set the PROVAR_API_KEY environment variable.');
8684
this.log('');

src/mcp/tools/testCaseValidate.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ import { runBestPractices } from './bestPracticesEngine.js';
2626

2727
const ONBOARDING_MESSAGE =
2828
'Quality Hub validation unavailable — running local validation only (structural rules, no quality scoring).\n' +
29-
'To enable Quality Hub (170 rules): visit https://success.provartesting.com, copy your API key, then run:\n' +
30-
' sf provar auth set-key --key <your-key>\n' +
29+
'To enable Quality Hub (170 rules): run sf provar auth login\n' +
3130
'For CI/CD: set the PROVAR_API_KEY environment variable.';
3231

3332
const AUTH_WARNING =
3433
'Quality Hub API key is invalid or expired. Running local validation only.\n' +
35-
'To update your key: sf provar auth set-key --key <your-key>';
34+
'Run sf provar auth login to get a new key.';
3635

3736
const RATE_LIMIT_WARNING = 'Quality Hub API rate limit reached. Running local validation only. Try again shortly.';
3837

@@ -43,7 +42,7 @@ const UNREACHABLE_WARNING =
4342
export function registerTestCaseValidate(server: McpServer, config: ServerConfig): void {
4443
server.tool(
4544
'provar.testcase.validate',
46-
'Validate a Provar XML test case for structural correctness and quality. Checks XML declaration, root element, required attributes (guid UUID v4, testItemId integer), <steps> presence, and applies best-practice rules. When a Provar API key is configured (sf provar auth set-key), calls the Quality Hub API for full 170-rule scoring. Falls back to local validation if no key is set or the API is unavailable. Returns validity_score (schema compliance), quality_score (best practices, 0–100), and validation_source indicating which ruleset was applied.',
45+
'Validate a Provar XML test case for structural correctness and quality. Checks XML declaration, root element, required attributes (guid UUID v4, testItemId integer), <steps> presence, and applies best-practice rules. When a Provar API key is configured (via sf provar auth login or PROVAR_API_KEY env var), calls the Quality Hub API for full 170-rule scoring. Falls back to local validation if no key is set or the API is unavailable. Returns validity_score (schema compliance), quality_score (best practices, 0–100), and validation_source indicating which ruleset was applied.',
4746
{
4847
content: z.string().optional().describe('XML content to validate directly (alias: xml)'),
4948
xml: z.string().optional().describe('XML content to validate — API-compatible alias for content'),

test/commands/provar/auth/clear.nut.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ import { SfProvarCommandResult } from '@provartesting/provardx-plugins-utils';
1414

1515
const CREDS_PATH = path.join(os.homedir(), '.provar', 'credentials.json');
1616

17+
function seedCredentials(): void {
18+
fs.mkdirSync(path.dirname(CREDS_PATH), { recursive: true });
19+
fs.writeFileSync(
20+
CREDS_PATH,
21+
JSON.stringify({ api_key: 'pv_k_cleartest123456', prefix: 'pv_k_clearte', set_at: new Date().toISOString(), source: 'manual' }),
22+
'utf-8'
23+
);
24+
}
25+
1726
describe('sf provar auth clear NUTs', () => {
1827
let credentialsBackup: string | null = null;
1928

@@ -40,7 +49,7 @@ describe('sf provar auth clear NUTs', () => {
4049
});
4150

4251
it('removes the credentials file and reports success', () => {
43-
execCmd<SfProvarCommandResult>('provar auth set-key --key pv_k_cleartest123456');
52+
seedCredentials();
4453
expect(fs.existsSync(CREDS_PATH)).to.equal(true);
4554

4655
const output = execCmd<SfProvarCommandResult>('provar auth clear').shellOutput;
@@ -50,15 +59,15 @@ describe('sf provar auth clear NUTs', () => {
5059
});
5160

5261
it('is idempotent — clearing twice does not throw', () => {
53-
execCmd<SfProvarCommandResult>('provar auth set-key --key pv_k_cleartest123456');
62+
seedCredentials();
5463
execCmd<SfProvarCommandResult>('provar auth clear');
5564
const output = execCmd<SfProvarCommandResult>('provar auth clear').shellOutput;
5665
expect(output.stderr).to.equal('');
5766
expect(output.stdout).to.include('API key cleared');
5867
});
5968

6069
it('status shows no key after clear', () => {
61-
execCmd<SfProvarCommandResult>('provar auth set-key --key pv_k_cleartest123456');
70+
seedCredentials();
6271
execCmd<SfProvarCommandResult>('provar auth clear');
6372
const output = execCmd<SfProvarCommandResult>('provar auth status').shellOutput;
6473
expect(output.stdout).to.include('No API key configured');

test/commands/provar/auth/set-key.nut.ts

Lines changed: 0 additions & 73 deletions
This file was deleted.

test/commands/provar/auth/status.nut.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ describe('sf provar auth status NUTs', () => {
5555
expect(output.stdout).to.include('local only');
5656
});
5757

58-
it('reports key source as credentials file when set via set-key', () => {
59-
execCmd<SfProvarCommandResult>('provar auth set-key --key pv_k_statustest12345');
58+
it('reports key source as credentials file when credentials file exists', () => {
59+
fs.mkdirSync(path.dirname(CREDS_PATH), { recursive: true });
60+
fs.writeFileSync(
61+
CREDS_PATH,
62+
JSON.stringify({ api_key: 'pv_k_statustest12345', prefix: 'pv_k_statust', set_at: new Date().toISOString(), source: 'manual' }),
63+
'utf-8'
64+
);
6065
const output = execCmd<SfProvarCommandResult>('provar auth status').shellOutput;
6166
expect(output.stderr).to.equal('');
6267
expect(output.stdout).to.include('API key configured');

0 commit comments

Comments
 (0)