guardrail-ship 1.0.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/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mock-implementation.d.ts +1 -0
- package/dist/mock-implementation.d.ts.map +1 -0
- package/dist/mock-implementation.js +2 -0
- package/dist/mock-implementation.js.map +1 -0
- package/dist/mockproof/__tests__/import-graph-scanner.test.d.ts +5 -0
- package/dist/mockproof/__tests__/import-graph-scanner.test.d.ts.map +1 -0
- package/dist/mockproof/__tests__/import-graph-scanner.test.js +92 -0
- package/dist/mockproof/__tests__/import-graph-scanner.test.js.map +1 -0
- package/dist/mockproof/import-graph-scanner.d.ts +93 -0
- package/dist/mockproof/import-graph-scanner.d.ts.map +1 -0
- package/dist/mockproof/import-graph-scanner.js +411 -0
- package/dist/mockproof/import-graph-scanner.js.map +1 -0
- package/dist/mockproof/index.d.ts +10 -0
- package/dist/mockproof/index.d.ts.map +1 -0
- package/dist/mockproof/index.js +10 -0
- package/dist/mockproof/index.js.map +1 -0
- package/dist/reality-mode/auth-enforcer.d.ts +13 -0
- package/dist/reality-mode/auth-enforcer.d.ts.map +1 -0
- package/dist/reality-mode/auth-enforcer.js +90 -0
- package/dist/reality-mode/auth-enforcer.js.map +1 -0
- package/dist/reality-mode/explorer/critical-flows.d.ts +71 -0
- package/dist/reality-mode/explorer/critical-flows.d.ts.map +1 -0
- package/dist/reality-mode/explorer/critical-flows.js +463 -0
- package/dist/reality-mode/explorer/critical-flows.js.map +1 -0
- package/dist/reality-mode/explorer/flow-parser.d.ts +52 -0
- package/dist/reality-mode/explorer/flow-parser.d.ts.map +1 -0
- package/dist/reality-mode/explorer/flow-parser.js +250 -0
- package/dist/reality-mode/explorer/flow-parser.js.map +1 -0
- package/dist/reality-mode/explorer/index.d.ts +11 -0
- package/dist/reality-mode/explorer/index.d.ts.map +1 -0
- package/dist/reality-mode/explorer/index.js +11 -0
- package/dist/reality-mode/explorer/index.js.map +1 -0
- package/dist/reality-mode/explorer/runtime-explorer.d.ts +35 -0
- package/dist/reality-mode/explorer/runtime-explorer.d.ts.map +1 -0
- package/dist/reality-mode/explorer/runtime-explorer.js +688 -0
- package/dist/reality-mode/explorer/runtime-explorer.js.map +1 -0
- package/dist/reality-mode/explorer/surface-discovery.d.ts +60 -0
- package/dist/reality-mode/explorer/surface-discovery.d.ts.map +1 -0
- package/dist/reality-mode/explorer/surface-discovery.js +357 -0
- package/dist/reality-mode/explorer/surface-discovery.js.map +1 -0
- package/dist/reality-mode/explorer/types.d.ts +275 -0
- package/dist/reality-mode/explorer/types.d.ts.map +1 -0
- package/dist/reality-mode/explorer/types.js +8 -0
- package/dist/reality-mode/explorer/types.js.map +1 -0
- package/dist/reality-mode/fake-success-detector.d.ts +10 -0
- package/dist/reality-mode/fake-success-detector.d.ts.map +1 -0
- package/dist/reality-mode/fake-success-detector.js +76 -0
- package/dist/reality-mode/fake-success-detector.js.map +1 -0
- package/dist/reality-mode/index.d.ts +14 -0
- package/dist/reality-mode/index.d.ts.map +1 -0
- package/dist/reality-mode/index.js +14 -0
- package/dist/reality-mode/index.js.map +1 -0
- package/dist/reality-mode/reality-scanner.d.ts +48 -0
- package/dist/reality-mode/reality-scanner.d.ts.map +1 -0
- package/dist/reality-mode/reality-scanner.js +516 -0
- package/dist/reality-mode/reality-scanner.js.map +1 -0
- package/dist/reality-mode/report-generator.d.ts +11 -0
- package/dist/reality-mode/report-generator.d.ts.map +1 -0
- package/dist/reality-mode/report-generator.js +233 -0
- package/dist/reality-mode/report-generator.js.map +1 -0
- package/dist/reality-mode/traffic-classifier.d.ts +14 -0
- package/dist/reality-mode/traffic-classifier.d.ts.map +1 -0
- package/dist/reality-mode/traffic-classifier.js +131 -0
- package/dist/reality-mode/traffic-classifier.js.map +1 -0
- package/dist/reality-mode/types.d.ts +90 -0
- package/dist/reality-mode/types.d.ts.map +1 -0
- package/dist/reality-mode/types.js +2 -0
- package/dist/reality-mode/types.js.map +1 -0
- package/dist/ship-badge/__tests__/ship-badge-generator.test.d.ts +5 -0
- package/dist/ship-badge/__tests__/ship-badge-generator.test.d.ts.map +1 -0
- package/dist/ship-badge/__tests__/ship-badge-generator.test.js +146 -0
- package/dist/ship-badge/__tests__/ship-badge-generator.test.js.map +1 -0
- package/dist/ship-badge/index.d.ts +9 -0
- package/dist/ship-badge/index.d.ts.map +1 -0
- package/dist/ship-badge/index.js +9 -0
- package/dist/ship-badge/index.js.map +1 -0
- package/dist/ship-badge/ship-badge-generator.d.ts +136 -0
- package/dist/ship-badge/ship-badge-generator.d.ts.map +1 -0
- package/dist/ship-badge/ship-badge-generator.js +681 -0
- package/dist/ship-badge/ship-badge-generator.js.map +1 -0
- package/package.json +20 -0
- package/src/index.ts +7 -0
- package/src/mock-implementation.ts +0 -0
- package/src/mockproof/__tests__/import-graph-scanner.test.ts +115 -0
- package/src/mockproof/import-graph-scanner.d.ts +93 -0
- package/src/mockproof/import-graph-scanner.d.ts.map +1 -0
- package/src/mockproof/import-graph-scanner.js +482 -0
- package/src/mockproof/import-graph-scanner.ts +540 -0
- package/src/mockproof/index.ts +18 -0
- package/src/reality-mode/auth-enforcer.ts +97 -0
- package/src/reality-mode/explorer/critical-flows.ts +504 -0
- package/src/reality-mode/explorer/flow-parser.ts +293 -0
- package/src/reality-mode/explorer/index.ts +22 -0
- package/src/reality-mode/explorer/runtime-explorer.ts +715 -0
- package/src/reality-mode/explorer/surface-discovery.ts +498 -0
- package/src/reality-mode/explorer/templates/example-flows/auth-flow.yaml +41 -0
- package/src/reality-mode/explorer/templates/example-flows/checkout-flow.yaml +66 -0
- package/src/reality-mode/explorer/templates/example-flows/contact-form.yaml +43 -0
- package/src/reality-mode/explorer/templates/github-action.yml +132 -0
- package/src/reality-mode/explorer/types.ts +356 -0
- package/src/reality-mode/fake-success-detector.ts +89 -0
- package/src/reality-mode/index.ts +19 -0
- package/src/reality-mode/reality-scanner.d.ts +123 -0
- package/src/reality-mode/reality-scanner.d.ts.map +1 -0
- package/src/reality-mode/reality-scanner.js +526 -0
- package/src/reality-mode/reality-scanner.ts +576 -0
- package/src/reality-mode/report-generator.ts +253 -0
- package/src/reality-mode/traffic-classifier.ts +169 -0
- package/src/reality-mode/types.ts +95 -0
- package/src/ship-badge/__tests__/ship-badge-generator.test.ts +162 -0
- package/src/ship-badge/index.ts +16 -0
- package/src/ship-badge/ship-badge-generator.d.ts +136 -0
- package/src/ship-badge/ship-badge-generator.d.ts.map +1 -0
- package/src/ship-badge/ship-badge-generator.js +779 -0
- package/src/ship-badge/ship-badge-generator.ts +873 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Pack YAML Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses custom flow definitions from YAML files so users can
|
|
5
|
+
* define their own critical paths to test.
|
|
6
|
+
*
|
|
7
|
+
* Example YAML:
|
|
8
|
+
* ```yaml
|
|
9
|
+
* id: custom-checkout
|
|
10
|
+
* name: Custom Checkout Flow
|
|
11
|
+
* description: Tests our specific checkout process
|
|
12
|
+
* steps:
|
|
13
|
+
* - action: navigate
|
|
14
|
+
* target: /products
|
|
15
|
+
* - action: click
|
|
16
|
+
* target: button:has-text("Add to Cart")
|
|
17
|
+
* - action: navigate
|
|
18
|
+
* target: /checkout
|
|
19
|
+
* - action: fill
|
|
20
|
+
* target: "#email"
|
|
21
|
+
* value: "{{email}}"
|
|
22
|
+
* assertions:
|
|
23
|
+
* - type: url-contains
|
|
24
|
+
* value: /confirmation
|
|
25
|
+
* critical: true
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Parse a YAML flow definition into a CriticalFlow object
|
|
30
|
+
*/
|
|
31
|
+
export function parseFlowYAML(yaml) {
|
|
32
|
+
// Simple YAML parser for flow definitions
|
|
33
|
+
// In production, would use a proper YAML library
|
|
34
|
+
const lines = yaml.split("\n");
|
|
35
|
+
const flow = {
|
|
36
|
+
steps: [],
|
|
37
|
+
assertions: [],
|
|
38
|
+
};
|
|
39
|
+
let currentSection = "root";
|
|
40
|
+
let currentItem = null;
|
|
41
|
+
for (const line of lines) {
|
|
42
|
+
const trimmed = line.trim();
|
|
43
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
44
|
+
continue;
|
|
45
|
+
// Detect section changes
|
|
46
|
+
if (trimmed === "steps:") {
|
|
47
|
+
currentSection = "steps";
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (trimmed === "assertions:") {
|
|
51
|
+
currentSection = "assertions";
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// Handle list items
|
|
55
|
+
if (trimmed.startsWith("- ")) {
|
|
56
|
+
if (currentItem && currentSection === "steps") {
|
|
57
|
+
flow.steps.push(currentItem);
|
|
58
|
+
}
|
|
59
|
+
else if (currentItem && currentSection === "assertions") {
|
|
60
|
+
flow.assertions.push(currentItem);
|
|
61
|
+
}
|
|
62
|
+
currentItem = {};
|
|
63
|
+
const content = trimmed.slice(2);
|
|
64
|
+
if (content.includes(":")) {
|
|
65
|
+
const [keyPart, ...valueParts] = content.split(":");
|
|
66
|
+
const key = keyPart?.trim();
|
|
67
|
+
const value = valueParts
|
|
68
|
+
.join(":")
|
|
69
|
+
.trim()
|
|
70
|
+
.replace(/^["']|["']$/g, "");
|
|
71
|
+
if (key)
|
|
72
|
+
currentItem[key] = parseValue(value);
|
|
73
|
+
}
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
// Handle properties
|
|
77
|
+
if (trimmed.includes(":")) {
|
|
78
|
+
const [keyPart, ...valueParts] = trimmed.split(":");
|
|
79
|
+
const key = keyPart?.trim();
|
|
80
|
+
const value = valueParts
|
|
81
|
+
.join(":")
|
|
82
|
+
.trim()
|
|
83
|
+
.replace(/^["']|["']$/g, "");
|
|
84
|
+
if (key && currentSection === "root") {
|
|
85
|
+
flow[key] = parseValue(value);
|
|
86
|
+
}
|
|
87
|
+
else if (key && currentItem) {
|
|
88
|
+
currentItem[key] = parseValue(value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Don't forget the last item
|
|
93
|
+
if (currentItem) {
|
|
94
|
+
if (currentSection === "steps") {
|
|
95
|
+
flow.steps.push(currentItem);
|
|
96
|
+
}
|
|
97
|
+
else if (currentSection === "assertions") {
|
|
98
|
+
flow.assertions.push(currentItem);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return convertToFlow(flow);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Parse a value, handling booleans and numbers
|
|
105
|
+
*/
|
|
106
|
+
function parseValue(value) {
|
|
107
|
+
if (value === "true")
|
|
108
|
+
return true;
|
|
109
|
+
if (value === "false")
|
|
110
|
+
return false;
|
|
111
|
+
if (/^\d+$/.test(value))
|
|
112
|
+
return parseInt(value, 10);
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Convert raw YAML to CriticalFlow
|
|
117
|
+
*/
|
|
118
|
+
function convertToFlow(raw) {
|
|
119
|
+
return {
|
|
120
|
+
id: raw.id || "custom-flow",
|
|
121
|
+
name: raw.name || "Custom Flow",
|
|
122
|
+
description: raw.description || "",
|
|
123
|
+
required: raw.required ?? false,
|
|
124
|
+
steps: raw.steps.map((s) => ({
|
|
125
|
+
action: s.action,
|
|
126
|
+
target: s.target,
|
|
127
|
+
value: s.value,
|
|
128
|
+
timeout: s.timeout,
|
|
129
|
+
})),
|
|
130
|
+
assertions: (raw.assertions || []).map((a) => ({
|
|
131
|
+
type: a.type,
|
|
132
|
+
value: a.value,
|
|
133
|
+
critical: a.critical ?? true,
|
|
134
|
+
})),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Load flow from file path
|
|
139
|
+
*/
|
|
140
|
+
export async function loadFlowFromFile(filePath) {
|
|
141
|
+
const fs = await import("fs").then((m) => m.promises);
|
|
142
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
143
|
+
return parseFlowYAML(content);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Load all flows from a directory
|
|
147
|
+
*/
|
|
148
|
+
export async function loadFlowsFromDirectory(dirPath) {
|
|
149
|
+
const fs = await import("fs").then((m) => m.promises);
|
|
150
|
+
const path = await import("path");
|
|
151
|
+
const flows = [];
|
|
152
|
+
try {
|
|
153
|
+
const files = await fs.readdir(dirPath);
|
|
154
|
+
for (const file of files) {
|
|
155
|
+
if (file.endsWith(".yaml") || file.endsWith(".yml")) {
|
|
156
|
+
const filePath = path.join(dirPath, file);
|
|
157
|
+
const flow = await loadFlowFromFile(filePath);
|
|
158
|
+
flows.push(flow);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
// Directory doesn't exist or can't be read
|
|
164
|
+
}
|
|
165
|
+
return flows;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Validate a flow definition
|
|
169
|
+
*/
|
|
170
|
+
export function validateFlow(flow) {
|
|
171
|
+
const errors = [];
|
|
172
|
+
if (!flow.id)
|
|
173
|
+
errors.push("Flow must have an id");
|
|
174
|
+
if (!flow.name)
|
|
175
|
+
errors.push("Flow must have a name");
|
|
176
|
+
if (!flow.steps || flow.steps.length === 0)
|
|
177
|
+
errors.push("Flow must have at least one step");
|
|
178
|
+
const validActions = ["navigate", "click", "fill", "wait", "assert"];
|
|
179
|
+
for (const step of flow.steps || []) {
|
|
180
|
+
if (!validActions.includes(step.action)) {
|
|
181
|
+
errors.push(`Invalid action: ${step.action}`);
|
|
182
|
+
}
|
|
183
|
+
if (step.action !== "wait" && !step.target) {
|
|
184
|
+
errors.push(`Step "${step.action}" requires a target`);
|
|
185
|
+
}
|
|
186
|
+
if (step.action === "fill" && !step.value) {
|
|
187
|
+
errors.push("Fill action requires a value");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const validAssertionTypes = [
|
|
191
|
+
"url-contains",
|
|
192
|
+
"element-visible",
|
|
193
|
+
"element-hidden",
|
|
194
|
+
"cookie-exists",
|
|
195
|
+
"localstorage-has",
|
|
196
|
+
"network-success",
|
|
197
|
+
"no-errors",
|
|
198
|
+
];
|
|
199
|
+
for (const assertion of flow.assertions || []) {
|
|
200
|
+
if (!validAssertionTypes.includes(assertion.type)) {
|
|
201
|
+
errors.push(`Invalid assertion type: ${assertion.type}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return { valid: errors.length === 0, errors };
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Generate example flow YAML
|
|
208
|
+
*/
|
|
209
|
+
export function generateExampleFlowYAML() {
|
|
210
|
+
return `# Example Critical Flow Definition
|
|
211
|
+
# Save this as .guardrail/flows/my-flow.yaml
|
|
212
|
+
|
|
213
|
+
id: my-custom-flow
|
|
214
|
+
name: My Custom Flow
|
|
215
|
+
description: Tests my specific user journey
|
|
216
|
+
required: false
|
|
217
|
+
|
|
218
|
+
steps:
|
|
219
|
+
- action: navigate
|
|
220
|
+
target: /my-page
|
|
221
|
+
|
|
222
|
+
- action: fill
|
|
223
|
+
target: input[name="email"]
|
|
224
|
+
value: "{{email}}"
|
|
225
|
+
|
|
226
|
+
- action: fill
|
|
227
|
+
target: input[name="password"]
|
|
228
|
+
value: "{{password}}"
|
|
229
|
+
|
|
230
|
+
- action: click
|
|
231
|
+
target: button[type="submit"]
|
|
232
|
+
|
|
233
|
+
- action: wait
|
|
234
|
+
timeout: 3000
|
|
235
|
+
|
|
236
|
+
assertions:
|
|
237
|
+
- type: url-contains
|
|
238
|
+
value: /success
|
|
239
|
+
critical: true
|
|
240
|
+
|
|
241
|
+
- type: element-visible
|
|
242
|
+
value: .welcome-message
|
|
243
|
+
critical: false
|
|
244
|
+
|
|
245
|
+
- type: no-errors
|
|
246
|
+
value: ""
|
|
247
|
+
critical: true
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=flow-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-parser.js","sourceRoot":"","sources":["../../../src/reality-mode/explorer/flow-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAsBH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,0CAA0C;IAC1C,iDAAiD;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAyB;QACjC,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,EAAE;KACf,CAAC;IAEF,IAAI,cAAc,GAAoC,MAAM,CAAC;IAC7D,IAAI,WAAW,GAA+B,IAAI,CAAC;IAEnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAElD,yBAAyB;QACzB,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzB,cAAc,GAAG,OAAO,CAAC;YACzB,SAAS;QACX,CAAC;QACD,IAAI,OAAO,KAAK,aAAa,EAAE,CAAC;YAC9B,cAAc,GAAG,YAAY,CAAC;YAC9B,SAAS;QACX,CAAC;QAED,oBAAoB;QACpB,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,IAAI,WAAW,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;gBAC9C,IAAI,CAAC,KAAM,CAAC,IAAI,CAAC,WAAkB,CAAC,CAAC;YACvC,CAAC;iBAAM,IAAI,WAAW,IAAI,cAAc,KAAK,YAAY,EAAE,CAAC;gBAC1D,IAAI,CAAC,UAAW,CAAC,IAAI,CAAC,WAAkB,CAAC,CAA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BAAiB;QACjB,gBAAgB;QAChB,eAAe;QACf,kBAAkB;QAClB,iBAAiB;QACjB,WAAW;KACZ,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;QAC9C,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAClD,MAAM,CAAC,IAAI,CAAC,2BAA2B,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reality Explorer - Main Export
|
|
3
|
+
*
|
|
4
|
+
* The "legit" Reality Mode that actually tests everything in your app.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./types";
|
|
7
|
+
export { SurfaceDiscovery } from "./surface-discovery";
|
|
8
|
+
export { RuntimeExplorer, createDefaultConfig } from "./runtime-explorer";
|
|
9
|
+
export { FLOW_PACKS, getAllFlows, getFlowPack, generateFlowTest, } from "./critical-flows";
|
|
10
|
+
export { parseFlowYAML, loadFlowFromFile, loadFlowsFromDirectory, validateFlow, generateExampleFlowYAML, } from "./flow-parser";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reality-mode/explorer/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,UAAU,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reality Explorer - Main Export
|
|
3
|
+
*
|
|
4
|
+
* The "legit" Reality Mode that actually tests everything in your app.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./types";
|
|
7
|
+
export { SurfaceDiscovery } from "./surface-discovery";
|
|
8
|
+
export { RuntimeExplorer, createDefaultConfig } from "./runtime-explorer";
|
|
9
|
+
export { FLOW_PACKS, getAllFlows, getFlowPack, generateFlowTest, } from "./critical-flows";
|
|
10
|
+
export { parseFlowYAML, loadFlowFromFile, loadFlowsFromDirectory, validateFlow, generateExampleFlowYAML, } from "./flow-parser";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reality-mode/explorer/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,UAAU,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Explorer
|
|
3
|
+
*
|
|
4
|
+
* The "robot user" that actually clicks through the app using Playwright.
|
|
5
|
+
* - Navigates to all discovered routes
|
|
6
|
+
* - Clicks buttons, opens modals, interacts with dropdowns
|
|
7
|
+
* - Fills and submits forms with test data
|
|
8
|
+
* - Captures errors, network calls, state changes
|
|
9
|
+
*/
|
|
10
|
+
import type { ExplorerConfig } from "./types";
|
|
11
|
+
export declare class RuntimeExplorer {
|
|
12
|
+
private config;
|
|
13
|
+
private surfaceDiscovery;
|
|
14
|
+
private errors;
|
|
15
|
+
private networkCalls;
|
|
16
|
+
private isAuthenticated;
|
|
17
|
+
constructor(config: ExplorerConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Generate the complete Playwright test file for exploration
|
|
20
|
+
*/
|
|
21
|
+
generateExplorerTest(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Generate auth test section if auth config is provided
|
|
24
|
+
*/
|
|
25
|
+
private generateAuthTest;
|
|
26
|
+
/**
|
|
27
|
+
* Get the explorer configuration
|
|
28
|
+
*/
|
|
29
|
+
getConfig(): ExplorerConfig;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create default explorer config
|
|
33
|
+
*/
|
|
34
|
+
export declare function createDefaultConfig(baseUrl: string, outputDir: string): ExplorerConfig;
|
|
35
|
+
//# sourceMappingURL=runtime-explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-explorer.d.ts","sourceRoot":"","sources":["../../../src/reality-mode/explorer/runtime-explorer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAWV,cAAc,EACf,MAAM,SAAS,CAAC;AAkBjB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,eAAe,CAAS;gBAEpB,MAAM,EAAE,cAAc;IAKlC;;OAEG;IACH,oBAAoB,IAAI,MAAM;IAslB9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;OAEG;IACH,SAAS,IAAI,cAAc;CAG5B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,cAAc,CAqBhB"}
|