ccqa 1.29.0 → 1.30.0
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.
- package/dist/bin/ccqa.mjs +21 -7
- package/dist/hub-client/index.d.mts +2 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/bin/ccqa.mjs
CHANGED
|
@@ -871,10 +871,12 @@ function cloudProviderEnabled() {
|
|
|
871
871
|
/**
|
|
872
872
|
* Probe whether the host has any credential the Anthropic SDK can pick up:
|
|
873
873
|
* 1. ANTHROPIC_API_KEY env var (CI / scripted use)
|
|
874
|
-
* 2.
|
|
874
|
+
* 2. CLAUDE_CODE_OAUTH_TOKEN env var (a long-lived subscription token from
|
|
875
|
+
* `claude setup-token`, the headless-CI counterpart of a login)
|
|
876
|
+
* 3. CLAUDE_CODE_USE_BEDROCK / CLAUDE_CODE_USE_VERTEX (cloud-provider
|
|
875
877
|
* endpoints authenticated by the cloud SDK's credential chain)
|
|
876
|
-
*
|
|
877
|
-
*
|
|
878
|
+
* 4. ~/.claude/.credentials.json (Claude Code login, file-based platforms)
|
|
879
|
+
* 5. macOS Keychain item "Claude Code-credentials" (Claude Code login on
|
|
878
880
|
* darwin stores the OAuth credentials in the Keychain, not on disk)
|
|
879
881
|
*
|
|
880
882
|
* Claude-driven hooks are opt-in, so the caller only consults this after the
|
|
@@ -882,14 +884,16 @@ function cloudProviderEnabled() {
|
|
|
882
884
|
* that surfaces as "analysis skipped".
|
|
883
885
|
*/
|
|
884
886
|
function driftAuthAvailable() {
|
|
885
|
-
const key
|
|
886
|
-
|
|
887
|
+
for (const key of ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"]) {
|
|
888
|
+
const value = process.env[key];
|
|
889
|
+
if (typeof value === "string" && value.length > 0) return { ok: true };
|
|
890
|
+
}
|
|
887
891
|
if (cloudProviderEnabled()) return { ok: true };
|
|
888
892
|
if (existsSync(join(homedir(), ".claude", ".credentials.json"))) return { ok: true };
|
|
889
893
|
if (process.platform === "darwin" && keychainHasClaudeCredentials()) return { ok: true };
|
|
890
894
|
return {
|
|
891
895
|
ok: false,
|
|
892
|
-
reason: "no ANTHROPIC_API_KEY / Bedrock or Vertex env / claude login"
|
|
896
|
+
reason: "no ANTHROPIC_API_KEY / CLAUDE_CODE_OAUTH_TOKEN / Bedrock or Vertex env / claude login"
|
|
893
897
|
};
|
|
894
898
|
}
|
|
895
899
|
/**
|
|
@@ -1509,18 +1513,27 @@ function resolveModel(explicit) {
|
|
|
1509
1513
|
* - `ANTHROPIC_AUTH_TOKEN` — sent as `Authorization: Bearer <token>`.
|
|
1510
1514
|
* - `ANTHROPIC_API_KEY` — API key, when used instead of a token.
|
|
1511
1515
|
* - `ANTHROPIC_CUSTOM_HEADERS` — extra request headers.
|
|
1516
|
+
* - `CLAUDE_CODE_OAUTH_TOKEN` — long-lived subscription token from
|
|
1517
|
+
* `claude setup-token`, the headless-CI counterpart of a login.
|
|
1512
1518
|
*/
|
|
1513
1519
|
const ENDPOINT_ENV_KEYS = [
|
|
1514
1520
|
"ANTHROPIC_BASE_URL",
|
|
1515
1521
|
"ANTHROPIC_AUTH_TOKEN",
|
|
1516
1522
|
"ANTHROPIC_API_KEY",
|
|
1517
|
-
"ANTHROPIC_CUSTOM_HEADERS"
|
|
1523
|
+
"ANTHROPIC_CUSTOM_HEADERS",
|
|
1524
|
+
"CLAUDE_CODE_OAUTH_TOKEN"
|
|
1518
1525
|
];
|
|
1519
1526
|
/**
|
|
1520
1527
|
* Collects the endpoint/auth variables set in the current process environment
|
|
1521
1528
|
* so they can be forwarded, verbatim, to every Claude Code invocation. Returns
|
|
1522
1529
|
* only the keys that are actually set (non-empty), so unset variables never
|
|
1523
1530
|
* override the SDK's own defaults.
|
|
1531
|
+
*
|
|
1532
|
+
* When both credentials are present the OAuth token wins and the API key is
|
|
1533
|
+
* not forwarded. Left to the CLI the API key would win, which makes "switch a
|
|
1534
|
+
* CI job to the subscription token" require unwiring the key everywhere; with
|
|
1535
|
+
* the precedence here, adding the one variable is the whole switch, and
|
|
1536
|
+
* removing it is the whole rollback.
|
|
1524
1537
|
*/
|
|
1525
1538
|
function resolveEndpointEnv() {
|
|
1526
1539
|
const endpointEnv = {};
|
|
@@ -1528,6 +1541,7 @@ function resolveEndpointEnv() {
|
|
|
1528
1541
|
const value = process.env[key];
|
|
1529
1542
|
if (value && value.length > 0) endpointEnv[key] = value;
|
|
1530
1543
|
}
|
|
1544
|
+
if (endpointEnv["CLAUDE_CODE_OAUTH_TOKEN"]) delete endpointEnv["ANTHROPIC_API_KEY"];
|
|
1531
1545
|
return endpointEnv;
|
|
1532
1546
|
}
|
|
1533
1547
|
/**
|
|
@@ -35,9 +35,9 @@ declare const RunSchema: z.ZodObject<{
|
|
|
35
35
|
running: "running";
|
|
36
36
|
}>;
|
|
37
37
|
kind: z.ZodDefault<z.ZodEnum<{
|
|
38
|
-
record: "record";
|
|
39
38
|
run: "run";
|
|
40
39
|
drift: "drift";
|
|
40
|
+
record: "record";
|
|
41
41
|
}>>;
|
|
42
42
|
drift: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
43
43
|
specs: z.ZodNumber;
|
|
@@ -621,9 +621,9 @@ type ReportSpecResult = z.infer<typeof ReportSpecResultSchema>;
|
|
|
621
621
|
declare const RunReportDataSchema: z.ZodObject<{
|
|
622
622
|
schemaVersion: z.ZodLiteral<1>;
|
|
623
623
|
kind: z.ZodDefault<z.ZodEnum<{
|
|
624
|
-
record: "record";
|
|
625
624
|
run: "run";
|
|
626
625
|
drift: "drift";
|
|
626
|
+
record: "record";
|
|
627
627
|
}>>;
|
|
628
628
|
createdAt: z.ZodString;
|
|
629
629
|
runId: z.ZodNullable<z.ZodString>;
|
package/dist/package.json
CHANGED