@xera-ai/core 0.4.4 → 0.5.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/artifact/status.d.ts +12 -0
- package/dist/artifact/status.d.ts.map +1 -1
- package/dist/bin/internal.js +822 -464
- package/dist/bin-internal/auth-setup.d.ts +2 -0
- package/dist/bin-internal/auth-setup.d.ts.map +1 -0
- package/dist/bin-internal/exec.d.ts.map +1 -1
- package/dist/bin-internal/graph-record.d.ts.map +1 -1
- package/dist/bin-internal/index.d.ts.map +1 -1
- package/dist/bin-internal/normalize.d.ts.map +1 -1
- package/dist/bin-internal/report.d.ts.map +1 -1
- package/dist/bin-internal/verify-prompts.d.ts.map +1 -1
- package/dist/classifier/aggregate.d.ts.map +1 -1
- package/dist/classifier/auth-expired.d.ts +12 -0
- package/dist/classifier/auth-expired.d.ts.map +1 -0
- package/dist/classifier/contract-drift.d.ts +35 -0
- package/dist/classifier/contract-drift.d.ts.map +1 -0
- package/dist/classifier/rate-limited.d.ts +15 -0
- package/dist/classifier/rate-limited.d.ts.map +1 -0
- package/dist/config/schema.d.ts +32 -3
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/graph/schema.d.ts +9 -0
- package/dist/graph/schema.d.ts.map +1 -1
- package/dist/graph/types.d.ts +1 -1
- package/dist/graph/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/scrub/index.d.ts +2 -0
- package/dist/scrub/index.d.ts.map +1 -0
- package/dist/scrub/rules.d.ts +12 -0
- package/dist/scrub/rules.d.ts.map +1 -0
- package/dist/src/index.js +109 -4
- package/package.json +4 -3
- package/src/artifact/status.ts +3 -0
- package/src/bin-internal/auth-setup.ts +116 -0
- package/src/bin-internal/exec.ts +42 -9
- package/src/bin-internal/graph-record.ts +3 -0
- package/src/bin-internal/index.ts +2 -0
- package/src/bin-internal/normalize.ts +13 -1
- package/src/bin-internal/report.ts +94 -2
- package/src/bin-internal/verify-prompts.ts +2 -1
- package/src/classifier/aggregate.ts +3 -0
- package/src/classifier/auth-expired.ts +44 -0
- package/src/classifier/contract-drift.ts +111 -0
- package/src/classifier/rate-limited.ts +25 -0
- package/src/config/schema.ts +51 -8
- package/src/graph/schema.ts +3 -0
- package/src/graph/types.ts +4 -1
- package/src/index.ts +2 -0
- package/src/scrub/index.ts +1 -0
- package/src/scrub/rules.ts +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-setup.d.ts","sourceRoot":"","sources":["../../src/bin-internal/auth-setup.ts"],"names":[],"mappings":"AA0BA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAyFlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/bin-internal/exec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/bin-internal/exec.ts"],"names":[],"mappings":"AAYA,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwJ7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-record.d.ts","sourceRoot":"","sources":["../../src/bin-internal/graph-record.ts"],"names":[],"mappings":"AA2EA,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqCnF;AAiFD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"graph-record.d.ts","sourceRoot":"","sources":["../../src/bin-internal/graph-record.ts"],"names":[],"mappings":"AA2EA,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqCnF;AAiFD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAgGpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin-internal/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin-internal/index.ts"],"names":[],"mappings":"AAwDA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAczD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/bin-internal/normalize.ts"],"names":[],"mappings":"AAKA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/bin-internal/normalize.ts"],"names":[],"mappings":"AAKA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/bin-internal/report.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/bin-internal/report.ts"],"names":[],"mappings":"AAuBA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6K/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-prompts.d.ts","sourceRoot":"","sources":["../../src/bin-internal/verify-prompts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"verify-prompts.d.ts","sourceRoot":"","sources":["../../src/bin-internal/verify-prompts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAgBD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CA8B7D;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAQvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/classifier/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAc,sBAAsB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/classifier/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAc,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAgBlF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,sBAAsB,EAAE,GAAG,cAAc,CAoBtF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ClassifyResult, HttpCallSummary } from './rate-limited';
|
|
2
|
+
export interface AuthFileSummary {
|
|
3
|
+
token: string;
|
|
4
|
+
type: 'bearer' | 'apiKey' | 'basic' | 'cookie';
|
|
5
|
+
expires_at: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ClassifyAuthExpiredInput {
|
|
8
|
+
calls: readonly HttpCallSummary[];
|
|
9
|
+
authFiles: Record<string, AuthFileSummary>;
|
|
10
|
+
}
|
|
11
|
+
export declare function classifyAuthExpired(input: ClassifyAuthExpiredInput): ClassifyResult | null;
|
|
12
|
+
//# sourceMappingURL=auth-expired.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-expired.d.ts","sourceRoot":"","sources":["../../src/classifier/auth-expired.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC5C;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,cAAc,GAAG,IAAI,CAe1F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ClassifyResult } from './rate-limited';
|
|
2
|
+
export interface OpenAPISchema {
|
|
3
|
+
type?: 'object' | 'array' | 'string' | 'integer' | 'number' | 'boolean' | 'null';
|
|
4
|
+
properties?: Record<string, OpenAPISchema>;
|
|
5
|
+
required?: readonly string[];
|
|
6
|
+
items?: OpenAPISchema;
|
|
7
|
+
}
|
|
8
|
+
interface OpenAPIOperation {
|
|
9
|
+
responses?: Record<string, {
|
|
10
|
+
content?: Record<string, {
|
|
11
|
+
schema?: OpenAPISchema;
|
|
12
|
+
}>;
|
|
13
|
+
}>;
|
|
14
|
+
requestBody?: {
|
|
15
|
+
content?: Record<string, {
|
|
16
|
+
schema?: OpenAPISchema;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface OpenAPIDocument {
|
|
21
|
+
paths: Record<string, Partial<Record<'get' | 'post' | 'put' | 'patch' | 'delete', OpenAPIOperation>>>;
|
|
22
|
+
}
|
|
23
|
+
export interface ContractDriftCall {
|
|
24
|
+
method: string;
|
|
25
|
+
url: string;
|
|
26
|
+
status: number;
|
|
27
|
+
respBody: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface ClassifyContractDriftInput {
|
|
30
|
+
calls: readonly ContractDriftCall[];
|
|
31
|
+
openapi: OpenAPIDocument | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function classifyContractDrift(input: ClassifyContractDriftInput): ClassifyResult | null;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=contract-drift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-drift.d.ts","sourceRoot":"","sources":["../../src/classifier/contract-drift.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,MAAM,CAAC,EAAE,aAAa,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAAC;IACrF,WAAW,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,MAAM,CAAC,EAAE,aAAa,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CACxE;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CACX,MAAM,EACN,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAC/E,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACpC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;CACjC;AAoCD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,cAAc,GAAG,IAAI,CA2C9F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Classification } from '../artifact/status';
|
|
2
|
+
export interface HttpCallSummary {
|
|
3
|
+
method: string;
|
|
4
|
+
url: string;
|
|
5
|
+
status: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ClassifyResult {
|
|
8
|
+
class: Classification;
|
|
9
|
+
rationale: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ClassifyRateLimitedInput {
|
|
12
|
+
calls: readonly HttpCallSummary[];
|
|
13
|
+
}
|
|
14
|
+
export declare function classifyRateLimited(input: ClassifyRateLimitedInput): ClassifyResult | null;
|
|
15
|
+
//# sourceMappingURL=rate-limited.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limited.d.ts","sourceRoot":"","sources":["../../src/classifier/rate-limited.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,cAAc,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CACnC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,cAAc,GAAG,IAAI,CAO1F"}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const XeraConfigSchema: z.ZodObject<{
|
|
|
9
9
|
attachments: z.ZodDefault<z.ZodString>;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
|
-
web: z.ZodObject<{
|
|
12
|
+
web: z.ZodOptional<z.ZodObject<{
|
|
13
13
|
baseUrl: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
14
14
|
defaultEnv: z.ZodString;
|
|
15
15
|
auth: z.ZodPrefault<z.ZodObject<{
|
|
@@ -31,7 +31,33 @@ export declare const XeraConfigSchema: z.ZodObject<{
|
|
|
31
31
|
fromAuth: z.ZodString;
|
|
32
32
|
}, z.core.$strip>>>;
|
|
33
33
|
}, z.core.$strip>>;
|
|
34
|
-
}, z.core.$strip
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
http: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
baseUrl: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
37
|
+
defaultEnv: z.ZodString;
|
|
38
|
+
spec: z.ZodOptional<z.ZodString>;
|
|
39
|
+
auth: z.ZodPrefault<z.ZodObject<{
|
|
40
|
+
strategy: z.ZodDefault<z.ZodEnum<{
|
|
41
|
+
custom: "custom";
|
|
42
|
+
none: "none";
|
|
43
|
+
bearer: "bearer";
|
|
44
|
+
apiKey: "apiKey";
|
|
45
|
+
basic: "basic";
|
|
46
|
+
"oauth-cc": "oauth-cc";
|
|
47
|
+
}>>;
|
|
48
|
+
ttl: z.ZodDefault<z.ZodString>;
|
|
49
|
+
refreshBuffer: z.ZodDefault<z.ZodString>;
|
|
50
|
+
roles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
51
|
+
tokenEnv: z.ZodOptional<z.ZodString>;
|
|
52
|
+
userEnv: z.ZodOptional<z.ZodString>;
|
|
53
|
+
passEnv: z.ZodOptional<z.ZodString>;
|
|
54
|
+
tokenUrl: z.ZodOptional<z.ZodString>;
|
|
55
|
+
clientIdEnv: z.ZodOptional<z.ZodString>;
|
|
56
|
+
clientSecretEnv: z.ZodOptional<z.ZodString>;
|
|
57
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
35
61
|
ai: z.ZodPrefault<z.ZodObject<{
|
|
36
62
|
livePageSnapshot: z.ZodDefault<z.ZodBoolean>;
|
|
37
63
|
confidenceThreshold: z.ZodDefault<z.ZodEnum<{
|
|
@@ -66,7 +92,10 @@ export declare const XeraConfigSchema: z.ZodObject<{
|
|
|
66
92
|
threshold: z.ZodDefault<z.ZodNumber>;
|
|
67
93
|
}, z.core.$strip>>;
|
|
68
94
|
}, z.core.$strip>>>;
|
|
69
|
-
adapters: z.ZodDefault<z.ZodArray<z.
|
|
95
|
+
adapters: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
96
|
+
web: "web";
|
|
97
|
+
http: "http";
|
|
98
|
+
}>>>;
|
|
70
99
|
}, z.core.$strip>;
|
|
71
100
|
export type XeraConfig = z.infer<typeof XeraConfigSchema>;
|
|
72
101
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiHxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBzB,CAAC;AAEL,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/graph/schema.d.ts
CHANGED
|
@@ -109,6 +109,9 @@ export declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
109
109
|
FLAKY: "FLAKY";
|
|
110
110
|
TEST_BUG: "TEST_BUG";
|
|
111
111
|
TEST_OUTDATED: "TEST_OUTDATED";
|
|
112
|
+
CONTRACT_DRIFT: "CONTRACT_DRIFT";
|
|
113
|
+
RATE_LIMITED: "RATE_LIMITED";
|
|
114
|
+
AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
112
115
|
}>;
|
|
113
116
|
confidence: z.ZodEnum<{
|
|
114
117
|
low: "low";
|
|
@@ -132,6 +135,9 @@ export declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
132
135
|
FLAKY: "FLAKY";
|
|
133
136
|
TEST_BUG: "TEST_BUG";
|
|
134
137
|
TEST_OUTDATED: "TEST_OUTDATED";
|
|
138
|
+
CONTRACT_DRIFT: "CONTRACT_DRIFT";
|
|
139
|
+
RATE_LIMITED: "RATE_LIMITED";
|
|
140
|
+
AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
135
141
|
}>;
|
|
136
142
|
disputedTo: z.ZodEnum<{
|
|
137
143
|
PASS: "PASS";
|
|
@@ -140,6 +146,9 @@ export declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
140
146
|
FLAKY: "FLAKY";
|
|
141
147
|
TEST_BUG: "TEST_BUG";
|
|
142
148
|
TEST_OUTDATED: "TEST_OUTDATED";
|
|
149
|
+
CONTRACT_DRIFT: "CONTRACT_DRIFT";
|
|
150
|
+
RATE_LIMITED: "RATE_LIMITED";
|
|
151
|
+
AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
143
152
|
}>;
|
|
144
153
|
qaActor: z.ZodString;
|
|
145
154
|
qaReason: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/graph/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/graph/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAyHrC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BActB,CAAC;AAEH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,GACb;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAA;CAAE,CAIxE"}
|
package/dist/graph/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare const SCHEMA_VERSION: 1;
|
|
|
2
2
|
export type Priority = 'p0' | 'p1' | 'p2';
|
|
3
3
|
export type ScenarioStatus = 'pass' | 'fail';
|
|
4
4
|
export type EdgeKind = 'tests' | 'uses' | 'covers' | 'modifies' | 'jira-linked' | 'similar' | 'ran';
|
|
5
|
-
export type Classification = 'REAL_BUG' | 'TEST_BUG' | 'SELECTOR_DRIFT' | 'FLAKY' | 'PASS' | 'TEST_OUTDATED';
|
|
5
|
+
export type Classification = 'REAL_BUG' | 'TEST_BUG' | 'SELECTOR_DRIFT' | 'FLAKY' | 'PASS' | 'TEST_OUTDATED' | 'CONTRACT_DRIFT' | 'RATE_LIMITED' | 'AUTH_EXPIRED';
|
|
6
6
|
export interface TicketFetchedPayload {
|
|
7
7
|
ticketId: string;
|
|
8
8
|
summary: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,EAAG,CAAU,CAAC;AAEzC,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,KAAK,CAAC;AAEpG,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,OAAO,GACP,MAAM,GACN,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,EAAG,CAAU,CAAC;AAEzC,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,KAAK,CAAC;AAEpG,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,OAAO,GACP,MAAM,GACN,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd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AAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAChC,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAC9C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './auth/encrypt';
|
|
|
8
8
|
export * from './auth/key';
|
|
9
9
|
export * from './auth/refresh';
|
|
10
10
|
export * from './auth/state';
|
|
11
|
+
export type { OpenAPIDocument, OpenAPISchema } from './classifier/contract-drift';
|
|
11
12
|
export * from './config/define';
|
|
12
13
|
export * from './config/load';
|
|
13
14
|
export * from './config/schema';
|
|
@@ -17,4 +18,5 @@ export * from './jira/retry';
|
|
|
17
18
|
export * from './jira/types';
|
|
18
19
|
export * from './lock/file-lock';
|
|
19
20
|
export * from './logging/ndjson-logger';
|
|
21
|
+
export * from './scrub';
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,mBAAmB,iBAAiB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,mBAAmB,iBAAiB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAClF,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scrub/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const SENSITIVE_HEADERS: readonly string[];
|
|
2
|
+
export declare const SENSITIVE_BODY_KEYS: readonly RegExp[];
|
|
3
|
+
export declare const JWT_RE: RegExp;
|
|
4
|
+
export declare const CREDIT_CARD_RE: RegExp;
|
|
5
|
+
export declare const EMAIL_RE: RegExp;
|
|
6
|
+
export declare const PHONE_RE: RegExp;
|
|
7
|
+
export declare const EMAIL_RE_G: RegExp;
|
|
8
|
+
export declare const PHONE_RE_G: RegExp;
|
|
9
|
+
export declare function scrubHeaders(headers: Record<string, string>): Record<string, string>;
|
|
10
|
+
export declare function scrubBodyJson(body: unknown): unknown;
|
|
11
|
+
export declare function scrubFreeText(s: string): string;
|
|
12
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/scrub/rules.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAQ9C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAYhD,CAAC;AAEF,eAAO,MAAM,MAAM,QAAmE,CAAC;AACvF,eAAO,MAAM,cAAc,QAAgC,CAAC;AAC5D,eAAO,MAAM,QAAQ,QAAuD,CAAC;AAE7E,eAAO,MAAM,QAAQ,QAA8B,CAAC;AAIpD,eAAO,MAAM,UAAU,QAAmC,CAAC;AAC3D,eAAO,MAAM,UAAU,QAAmC,CAAC;AAI3D,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMpF;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAepD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM/C"}
|
package/dist/src/index.js
CHANGED
|
@@ -113,7 +113,10 @@ var ClassificationEnum = z2.enum([
|
|
|
113
113
|
"SELECTOR_DRIFT",
|
|
114
114
|
"FLAKY",
|
|
115
115
|
"TEST_BUG",
|
|
116
|
-
"TEST_OUTDATED"
|
|
116
|
+
"TEST_OUTDATED",
|
|
117
|
+
"CONTRACT_DRIFT",
|
|
118
|
+
"RATE_LIMITED",
|
|
119
|
+
"AUTH_EXPIRED"
|
|
117
120
|
]);
|
|
118
121
|
var ResultEnum = z2.enum(["PASS", "FAIL"]);
|
|
119
122
|
var ConfidenceEnum = z2.enum(["low", "medium", "high"]);
|
|
@@ -297,6 +300,32 @@ var WebSchema = z4.object({
|
|
|
297
300
|
message: "defaultEnv must exist in baseUrl map",
|
|
298
301
|
path: ["defaultEnv"]
|
|
299
302
|
});
|
|
303
|
+
var HttpAuthRoleSchema = z4.object({
|
|
304
|
+
tokenEnv: z4.string().optional(),
|
|
305
|
+
userEnv: z4.string().optional(),
|
|
306
|
+
passEnv: z4.string().optional(),
|
|
307
|
+
tokenUrl: z4.string().url().optional(),
|
|
308
|
+
clientIdEnv: z4.string().optional(),
|
|
309
|
+
clientSecretEnv: z4.string().optional(),
|
|
310
|
+
scope: z4.string().optional()
|
|
311
|
+
});
|
|
312
|
+
var HttpAuthSchema = z4.object({
|
|
313
|
+
strategy: z4.enum(["bearer", "apiKey", "basic", "oauth-cc", "custom", "none"]).default("none"),
|
|
314
|
+
ttl: z4.string().default("8h"),
|
|
315
|
+
refreshBuffer: z4.string().default("30m"),
|
|
316
|
+
roles: z4.record(z4.string(), HttpAuthRoleSchema).default({})
|
|
317
|
+
});
|
|
318
|
+
var HttpSchema = z4.object({
|
|
319
|
+
baseUrl: z4.record(z4.string(), z4.string().url()).refine((m) => Object.keys(m).length > 0, {
|
|
320
|
+
message: "baseUrl must have at least one environment"
|
|
321
|
+
}),
|
|
322
|
+
defaultEnv: z4.string(),
|
|
323
|
+
spec: z4.string().optional(),
|
|
324
|
+
auth: HttpAuthSchema.prefault({})
|
|
325
|
+
}).refine((h) => h.baseUrl[h.defaultEnv] !== undefined, {
|
|
326
|
+
message: "defaultEnv must exist in baseUrl map",
|
|
327
|
+
path: ["defaultEnv"]
|
|
328
|
+
});
|
|
300
329
|
var JiraSchema = z4.object({
|
|
301
330
|
baseUrl: z4.string().url(),
|
|
302
331
|
projectKeys: z4.array(z4.string().min(1)).min(1),
|
|
@@ -332,11 +361,17 @@ var RunSchema = z4.object({
|
|
|
332
361
|
}).prefault({});
|
|
333
362
|
var XeraConfigSchema = z4.object({
|
|
334
363
|
jira: JiraSchema,
|
|
335
|
-
web: WebSchema,
|
|
364
|
+
web: WebSchema.optional(),
|
|
365
|
+
http: HttpSchema.optional(),
|
|
336
366
|
ai: AISchema,
|
|
337
367
|
reporting: ReportingSchema,
|
|
338
368
|
run: RunSchema.prefault({}),
|
|
339
|
-
adapters: z4.array(z4.
|
|
369
|
+
adapters: z4.array(z4.enum(["web", "http"])).min(1).default(["web"])
|
|
370
|
+
}).refine((c) => c.web !== undefined || c.http !== undefined, {
|
|
371
|
+
message: "At least one of `web` or `http` must be configured"
|
|
372
|
+
}).refine((c) => c.adapters.every((a) => (a === "web" ? c.web : c.http) !== undefined), {
|
|
373
|
+
message: "Every adapter in `adapters` must have a corresponding config block",
|
|
374
|
+
path: ["adapters"]
|
|
340
375
|
});
|
|
341
376
|
|
|
342
377
|
// src/config/load.ts
|
|
@@ -585,7 +620,66 @@ class NdjsonLogger {
|
|
|
585
620
|
`).map((line) => JSON.parse(line));
|
|
586
621
|
}
|
|
587
622
|
}
|
|
588
|
-
|
|
623
|
+
// src/scrub/rules.ts
|
|
624
|
+
var SENSITIVE_HEADERS = [
|
|
625
|
+
"authorization",
|
|
626
|
+
"cookie",
|
|
627
|
+
"set-cookie",
|
|
628
|
+
"x-api-key",
|
|
629
|
+
"x-auth-token",
|
|
630
|
+
"x-csrf-token",
|
|
631
|
+
"proxy-authorization"
|
|
632
|
+
];
|
|
633
|
+
var SENSITIVE_BODY_KEYS = [
|
|
634
|
+
/password/i,
|
|
635
|
+
/passwd/i,
|
|
636
|
+
/token/i,
|
|
637
|
+
/secret/i,
|
|
638
|
+
/api[-_]?key/i,
|
|
639
|
+
/access[-_]?key/i,
|
|
640
|
+
/private[-_]?key/i,
|
|
641
|
+
/authorization/i,
|
|
642
|
+
/credit[-_]?card/i,
|
|
643
|
+
/card[-_]?number/i,
|
|
644
|
+
/cvv/i
|
|
645
|
+
];
|
|
646
|
+
var JWT_RE = /\beyJ[A-Za-z0-9_-]{7,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{5,}\b/;
|
|
647
|
+
var CREDIT_CARD_RE = /\b(?:\d{4}[-\s]?){3}\d{4}\b/;
|
|
648
|
+
var EMAIL_RE = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/;
|
|
649
|
+
var PHONE_RE = /(?:\+?\d[\d\s().-]{6,}\d)/;
|
|
650
|
+
var JWT_RE_G = new RegExp(JWT_RE.source, "g");
|
|
651
|
+
var CREDIT_CARD_RE_G = new RegExp(CREDIT_CARD_RE.source, "g");
|
|
652
|
+
var EMAIL_RE_G = new RegExp(EMAIL_RE.source, "g");
|
|
653
|
+
var PHONE_RE_G = new RegExp(PHONE_RE.source, "g");
|
|
654
|
+
var REDACTED = "[REDACTED]";
|
|
655
|
+
function scrubHeaders(headers) {
|
|
656
|
+
const out = {};
|
|
657
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
658
|
+
out[k] = SENSITIVE_HEADERS.includes(k.toLowerCase()) ? REDACTED : v;
|
|
659
|
+
}
|
|
660
|
+
return out;
|
|
661
|
+
}
|
|
662
|
+
function scrubBodyJson(body) {
|
|
663
|
+
if (Array.isArray(body))
|
|
664
|
+
return body.map(scrubBodyJson);
|
|
665
|
+
if (body && typeof body === "object") {
|
|
666
|
+
const out = {};
|
|
667
|
+
for (const [k, v] of Object.entries(body)) {
|
|
668
|
+
if (SENSITIVE_BODY_KEYS.some((re) => re.test(k))) {
|
|
669
|
+
out[k] = REDACTED;
|
|
670
|
+
} else {
|
|
671
|
+
out[k] = scrubBodyJson(v);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
return out;
|
|
675
|
+
}
|
|
676
|
+
if (typeof body === "string")
|
|
677
|
+
return scrubFreeText(body);
|
|
678
|
+
return body;
|
|
679
|
+
}
|
|
680
|
+
function scrubFreeText(s) {
|
|
681
|
+
return s.replace(JWT_RE_G, REDACTED).replace(CREDIT_CARD_RE_G, REDACTED).replace(EMAIL_RE_G, REDACTED).replace(PHONE_RE_G, REDACTED);
|
|
682
|
+
}
|
|
589
683
|
// src/index.ts
|
|
590
684
|
var VERSION2 = "0.1.0";
|
|
591
685
|
export {
|
|
@@ -594,6 +688,9 @@ export {
|
|
|
594
688
|
writeAuthState,
|
|
595
689
|
withRetry,
|
|
596
690
|
updateMeta,
|
|
691
|
+
scrubHeaders,
|
|
692
|
+
scrubFreeText,
|
|
693
|
+
scrubBodyJson,
|
|
597
694
|
resolveAuthKey,
|
|
598
695
|
resolveArtifactPaths,
|
|
599
696
|
releaseLock,
|
|
@@ -621,9 +718,17 @@ export {
|
|
|
621
718
|
XeraConfigSchema,
|
|
622
719
|
VERSION2 as VERSION,
|
|
623
720
|
StatusJsonSchema,
|
|
721
|
+
SENSITIVE_HEADERS,
|
|
722
|
+
SENSITIVE_BODY_KEYS,
|
|
723
|
+
PHONE_RE_G,
|
|
724
|
+
PHONE_RE,
|
|
624
725
|
NdjsonLogger,
|
|
625
726
|
MetaJsonSchema,
|
|
727
|
+
JWT_RE,
|
|
626
728
|
HistoryEntrySchema,
|
|
729
|
+
EMAIL_RE_G,
|
|
730
|
+
EMAIL_RE,
|
|
731
|
+
CREDIT_CARD_RE,
|
|
627
732
|
AuthStateEntrySchema,
|
|
628
733
|
AUTH_KEY_ENV
|
|
629
734
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xera-ai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
"bin"
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "bun build ./src/index.ts ./bin/internal.ts --outdir ./dist --target bun --external @playwright/test --external @xera-ai/web --external zod",
|
|
28
|
+
"build": "bun build ./src/index.ts ./bin/internal.ts --outdir ./dist --target bun --external @playwright/test --external @xera-ai/web --external @xera-ai/http --external zod",
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"zod": "4.4.3",
|
|
33
|
-
"@xera-ai/web": "^0.
|
|
33
|
+
"@xera-ai/web": "^0.3.0",
|
|
34
|
+
"@xera-ai/http": "^0.1.0",
|
|
34
35
|
"@playwright/test": "1.60.0",
|
|
35
36
|
"fflate": "0.8.3",
|
|
36
37
|
"yaml": "2.9.0"
|
package/src/artifact/status.ts
CHANGED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { loadConfig } from '../config/load';
|
|
5
|
+
|
|
6
|
+
interface AuthSetupOpts {
|
|
7
|
+
role?: string;
|
|
8
|
+
shape: 'web' | 'http' | 'all';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function parseOpts(argv: string[]): AuthSetupOpts {
|
|
12
|
+
const opts: AuthSetupOpts = { shape: 'all' };
|
|
13
|
+
for (let i = 0; i < argv.length; i++) {
|
|
14
|
+
const a = argv[i];
|
|
15
|
+
const next = argv[i + 1];
|
|
16
|
+
if (a === '--role' && next) {
|
|
17
|
+
opts.role = next;
|
|
18
|
+
i++;
|
|
19
|
+
} else if (a === '--shape' && next) {
|
|
20
|
+
if (next === 'web' || next === 'http' || next === 'all') opts.shape = next;
|
|
21
|
+
i++;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return opts;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function authSetupCmd(argv: string[]): Promise<number> {
|
|
28
|
+
const opts = parseOpts(argv);
|
|
29
|
+
const cwd = process.cwd();
|
|
30
|
+
const config = await loadConfig(cwd);
|
|
31
|
+
|
|
32
|
+
const authSetupScript = join(cwd, 'shared', 'auth-setup.ts');
|
|
33
|
+
if (!existsSync(authSetupScript)) {
|
|
34
|
+
console.error(
|
|
35
|
+
`[xera:auth-setup] auth-setup.ts not found at ${authSetupScript}. Run 'bunx @xera-ai/cli init' first.`,
|
|
36
|
+
);
|
|
37
|
+
return 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const mod = (await import(pathToFileURL(authSetupScript).href)) as {
|
|
41
|
+
web?: unknown;
|
|
42
|
+
http?: unknown;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
let exitCode = 0;
|
|
46
|
+
|
|
47
|
+
// Web roles
|
|
48
|
+
if (
|
|
49
|
+
(opts.shape === 'all' || opts.shape === 'web') &&
|
|
50
|
+
config.web &&
|
|
51
|
+
typeof mod.web === 'function'
|
|
52
|
+
) {
|
|
53
|
+
const { runAuthSetup } = await import('@xera-ai/web');
|
|
54
|
+
const { chromium } = await import('@playwright/test');
|
|
55
|
+
const browser = await chromium.launch();
|
|
56
|
+
try {
|
|
57
|
+
for (const [roleName, roleCreds] of Object.entries(config.web.auth.roles)) {
|
|
58
|
+
if (opts.role && roleName !== opts.role) continue;
|
|
59
|
+
const email = process.env[roleCreds.envEmail];
|
|
60
|
+
const password = process.env[roleCreds.envPassword];
|
|
61
|
+
if (!email || !password) {
|
|
62
|
+
console.error(
|
|
63
|
+
`[xera:auth-setup] missing env vars ${roleCreds.envEmail} / ${roleCreds.envPassword} for role '${roleName}'`,
|
|
64
|
+
);
|
|
65
|
+
exitCode = 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
await runAuthSetup({
|
|
70
|
+
role: roleName,
|
|
71
|
+
creds: { email, password },
|
|
72
|
+
setupScriptPath: authSetupScript,
|
|
73
|
+
authDir: join(cwd, '.xera', '.auth'),
|
|
74
|
+
browser,
|
|
75
|
+
});
|
|
76
|
+
console.log(`[xera:auth-setup] ✓ ${roleName}.json (web)`);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
console.error(`[xera:auth-setup] ✗ web/${roleName}: ${(e as Error).message}`);
|
|
79
|
+
exitCode = 1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} finally {
|
|
83
|
+
await browser.close();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Http roles
|
|
88
|
+
if (
|
|
89
|
+
(opts.shape === 'all' || opts.shape === 'http') &&
|
|
90
|
+
config.http &&
|
|
91
|
+
typeof mod.http === 'function'
|
|
92
|
+
) {
|
|
93
|
+
// The auth-setup.ts template reads config via globalThis; set it for the user's function.
|
|
94
|
+
(globalThis as Record<string, unknown>).__XERA_HTTP_CONFIG__ = config.http;
|
|
95
|
+
|
|
96
|
+
const { runHttpAuthSetup } = await import('@xera-ai/http');
|
|
97
|
+
for (const roleName of Object.keys(config.http.auth.roles)) {
|
|
98
|
+
if (opts.role && roleName !== opts.role) continue;
|
|
99
|
+
try {
|
|
100
|
+
await runHttpAuthSetup({
|
|
101
|
+
authDir: join(cwd, '.xera', '.auth'),
|
|
102
|
+
role: roleName,
|
|
103
|
+
config: config.http,
|
|
104
|
+
setupFn: mod.http as Parameters<typeof runHttpAuthSetup>[0]['setupFn'],
|
|
105
|
+
creds: { email: '', password: '' },
|
|
106
|
+
});
|
|
107
|
+
console.log(`[xera:auth-setup] ✓ http/${roleName}.json`);
|
|
108
|
+
} catch (e) {
|
|
109
|
+
console.error(`[xera:auth-setup] ✗ http/${roleName}: ${(e as Error).message}`);
|
|
110
|
+
exitCode = 1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return exitCode;
|
|
116
|
+
}
|