Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ export async function verifyCredentials(apiKey: string): Promise<{
headers: {
'Authorization': `Bearer ${apiKey}`,
'User-Agent': CLI_USER_AGENT,
// Counts this check as CLI use in the API's request log.
'X-DealMachine-Source': 'cli',
},
});

Expand Down
29 changes: 29 additions & 0 deletions tests/factory/FW-1829.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": 1,
"issue": "FW-1829",
"criteria": [
{
"id": "AC-1",
"text": "GIVEN a person uses the CLI with an API key, WHEN they sign in with that key or ask the CLI to verify who they are signed in as, THEN the request that checks the key tells the API it came from the CLI, so it is counted as CLI use and not as plain API use."
}
],
"checks": [
{
"title": "CLI key check tells the API it came from the CLI",
"surface": "cli",
"repository": "cli",
"preconditions": [
"Run the reviewed CLI candidate with the approved Factory executor. No API credentials are needed."
],
"steps": [
"Run the CLI check suite. The CLI API helpers test in tests/lib/api.test.ts checks a key and inspects the request that was sent."
],
"expected": "The request that checks a key carries the CLI source marker alongside the key and the CLI version, so the API counts it as CLI use.",
"criterionId": "AC-1",
"execution": "automated",
"automation": {
"taskId": "cli:check"
}
}
]
}
1 change: 1 addition & 0 deletions tests/lib/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('CLI API helpers', () => {
headers: {
'Authorization': 'Bearer dm_sk_live_test',
'User-Agent': `dm-cli/${manifest.version}`,
'X-DealMachine-Source': 'cli',
},
});
});
Expand Down
Loading