Skip to content

Commit 10a1fc5

Browse files
mrdailey99claude
andcommitted
feat(auth): add sf provar auth rotate command
Implements /auth/rotate endpoint: atomically replaces the stored pv_k_ key with a new one without going through the browser login flow. Old key is invalidated immediately on success. - src/commands/provar/auth/rotate.ts — new SfProvarAuthRotate command - messages/sf.provar.auth.rotate.md — summary, description, examples - src/services/qualityHub/client.ts — rotateKey() function + indirection entry - test/unit/commands/provar/auth/rotate.test.ts — 5 unit tests (599 total) - README.md, docs/mcp.md — rotate command documentation Root cause of test ERROR: null debugged and fixed — ts-node/esm surfaces noUnusedLocals TS6133 as a null-prototype error when a module-level sinon stub variable is declared but never read (sinon.restore() cleans up without referencing it). Fixed by inlining stubs inside each it() block. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0fa223b commit 10a1fc5

6 files changed

Lines changed: 303 additions & 89 deletions

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ 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 rotate`](#sf-provar-auth-rotate)
6364
- [`sf provar auth status`](#sf-provar-auth-status)
6465
- [`sf provar auth clear`](#sf-provar-auth-clear)
6566
- [`sf provar mcp start`](#sf-provar-mcp-start)
@@ -120,6 +121,28 @@ EXAMPLES
120121
$ sf provar auth login --url https://dev.api.example.com
121122
```
122123

124+
## `sf provar auth rotate`
125+
126+
Rotate your stored API key without re-authenticating via browser.
127+
128+
```
129+
USAGE
130+
$ sf provar auth rotate
131+
132+
DESCRIPTION
133+
Exchanges your current pv_k_ key for a new one atomically. The old key is
134+
invalidated immediately. The new key is written to ~/.provar/credentials.json.
135+
136+
Use this to rotate your key on a regular schedule (~every 90 days) without
137+
going through the browser login flow. If your current key is already expired,
138+
run sf provar auth login instead.
139+
140+
EXAMPLES
141+
Rotate the stored API key:
142+
143+
$ sf provar auth rotate
144+
```
145+
123146
## `sf provar auth status`
124147

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

0 commit comments

Comments
 (0)