@veraxhq/verax 0.1.0 → 0.2.1

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.
Files changed (135) hide show
  1. package/README.md +123 -88
  2. package/bin/verax.js +11 -452
  3. package/package.json +24 -36
  4. package/src/cli/commands/default.js +681 -0
  5. package/src/cli/commands/doctor.js +197 -0
  6. package/src/cli/commands/inspect.js +109 -0
  7. package/src/cli/commands/run.js +586 -0
  8. package/src/cli/entry.js +196 -0
  9. package/src/cli/util/atomic-write.js +37 -0
  10. package/src/cli/util/detection-engine.js +297 -0
  11. package/src/cli/util/env-url.js +33 -0
  12. package/src/cli/util/errors.js +44 -0
  13. package/src/cli/util/events.js +110 -0
  14. package/src/cli/util/expectation-extractor.js +388 -0
  15. package/src/cli/util/findings-writer.js +32 -0
  16. package/src/cli/util/idgen.js +87 -0
  17. package/src/cli/util/learn-writer.js +39 -0
  18. package/src/cli/util/observation-engine.js +412 -0
  19. package/src/cli/util/observe-writer.js +25 -0
  20. package/src/cli/util/paths.js +30 -0
  21. package/src/cli/util/project-discovery.js +297 -0
  22. package/src/cli/util/project-writer.js +26 -0
  23. package/src/cli/util/redact.js +128 -0
  24. package/src/cli/util/run-id.js +30 -0
  25. package/src/cli/util/runtime-budget.js +147 -0
  26. package/src/cli/util/summary-writer.js +43 -0
  27. package/src/types/global.d.ts +28 -0
  28. package/src/types/ts-ast.d.ts +24 -0
  29. package/src/verax/cli/ci-summary.js +35 -0
  30. package/src/verax/cli/context-explanation.js +89 -0
  31. package/src/verax/cli/doctor.js +277 -0
  32. package/src/verax/cli/error-normalizer.js +154 -0
  33. package/src/verax/cli/explain-output.js +105 -0
  34. package/src/verax/cli/finding-explainer.js +130 -0
  35. package/src/verax/cli/init.js +237 -0
  36. package/src/verax/cli/run-overview.js +163 -0
  37. package/src/verax/cli/url-safety.js +111 -0
  38. package/src/verax/cli/wizard.js +109 -0
  39. package/src/verax/cli/zero-findings-explainer.js +57 -0
  40. package/src/verax/cli/zero-interaction-explainer.js +127 -0
  41. package/src/verax/core/action-classifier.js +86 -0
  42. package/src/verax/core/budget-engine.js +218 -0
  43. package/src/verax/core/canonical-outcomes.js +157 -0
  44. package/src/verax/core/decision-snapshot.js +335 -0
  45. package/src/verax/core/determinism-model.js +432 -0
  46. package/src/verax/core/incremental-store.js +245 -0
  47. package/src/verax/core/invariants.js +356 -0
  48. package/src/verax/core/promise-model.js +230 -0
  49. package/src/verax/core/replay-validator.js +350 -0
  50. package/src/verax/core/replay.js +222 -0
  51. package/src/verax/core/run-id.js +175 -0
  52. package/src/verax/core/run-manifest.js +99 -0
  53. package/src/verax/core/silence-impact.js +369 -0
  54. package/src/verax/core/silence-model.js +523 -0
  55. package/src/verax/detect/comparison.js +7 -34
  56. package/src/verax/detect/confidence-engine.js +764 -329
  57. package/src/verax/detect/detection-engine.js +293 -0
  58. package/src/verax/detect/evidence-index.js +127 -0
  59. package/src/verax/detect/expectation-model.js +241 -168
  60. package/src/verax/detect/explanation-helpers.js +187 -0
  61. package/src/verax/detect/finding-detector.js +450 -0
  62. package/src/verax/detect/findings-writer.js +41 -12
  63. package/src/verax/detect/flow-detector.js +366 -0
  64. package/src/verax/detect/index.js +200 -288
  65. package/src/verax/detect/interactive-findings.js +612 -0
  66. package/src/verax/detect/signal-mapper.js +308 -0
  67. package/src/verax/detect/skip-classifier.js +4 -4
  68. package/src/verax/detect/verdict-engine.js +561 -0
  69. package/src/verax/evidence-index-writer.js +61 -0
  70. package/src/verax/flow/flow-engine.js +3 -2
  71. package/src/verax/flow/flow-spec.js +1 -2
  72. package/src/verax/index.js +103 -15
  73. package/src/verax/intel/effect-detector.js +368 -0
  74. package/src/verax/intel/handler-mapper.js +249 -0
  75. package/src/verax/intel/index.js +281 -0
  76. package/src/verax/intel/route-extractor.js +280 -0
  77. package/src/verax/intel/ts-program.js +256 -0
  78. package/src/verax/intel/vue-navigation-extractor.js +642 -0
  79. package/src/verax/intel/vue-router-extractor.js +325 -0
  80. package/src/verax/learn/action-contract-extractor.js +338 -104
  81. package/src/verax/learn/ast-contract-extractor.js +148 -6
  82. package/src/verax/learn/flow-extractor.js +172 -0
  83. package/src/verax/learn/index.js +36 -2
  84. package/src/verax/learn/manifest-writer.js +122 -58
  85. package/src/verax/learn/project-detector.js +40 -0
  86. package/src/verax/learn/route-extractor.js +28 -97
  87. package/src/verax/learn/route-validator.js +8 -7
  88. package/src/verax/learn/state-extractor.js +212 -0
  89. package/src/verax/learn/static-extractor-navigation.js +114 -0
  90. package/src/verax/learn/static-extractor-validation.js +88 -0
  91. package/src/verax/learn/static-extractor.js +119 -10
  92. package/src/verax/learn/truth-assessor.js +24 -21
  93. package/src/verax/learn/ts-contract-resolver.js +14 -12
  94. package/src/verax/observe/aria-sensor.js +211 -0
  95. package/src/verax/observe/browser.js +30 -6
  96. package/src/verax/observe/console-sensor.js +2 -18
  97. package/src/verax/observe/domain-boundary.js +10 -1
  98. package/src/verax/observe/expectation-executor.js +513 -0
  99. package/src/verax/observe/flow-matcher.js +143 -0
  100. package/src/verax/observe/focus-sensor.js +196 -0
  101. package/src/verax/observe/human-driver.js +660 -273
  102. package/src/verax/observe/index.js +910 -26
  103. package/src/verax/observe/interaction-discovery.js +378 -15
  104. package/src/verax/observe/interaction-runner.js +562 -197
  105. package/src/verax/observe/loading-sensor.js +145 -0
  106. package/src/verax/observe/navigation-sensor.js +255 -0
  107. package/src/verax/observe/network-sensor.js +55 -7
  108. package/src/verax/observe/observed-expectation-deriver.js +186 -0
  109. package/src/verax/observe/observed-expectation.js +305 -0
  110. package/src/verax/observe/page-frontier.js +234 -0
  111. package/src/verax/observe/settle.js +38 -17
  112. package/src/verax/observe/state-sensor.js +393 -0
  113. package/src/verax/observe/state-ui-sensor.js +7 -1
  114. package/src/verax/observe/timing-sensor.js +228 -0
  115. package/src/verax/observe/traces-writer.js +73 -21
  116. package/src/verax/observe/ui-signal-sensor.js +143 -17
  117. package/src/verax/scan-summary-writer.js +80 -15
  118. package/src/verax/shared/artifact-manager.js +111 -9
  119. package/src/verax/shared/budget-profiles.js +136 -0
  120. package/src/verax/shared/caching.js +1 -1
  121. package/src/verax/shared/ci-detection.js +39 -0
  122. package/src/verax/shared/config-loader.js +169 -0
  123. package/src/verax/shared/dynamic-route-utils.js +224 -0
  124. package/src/verax/shared/expectation-coverage.js +44 -0
  125. package/src/verax/shared/expectation-prover.js +81 -0
  126. package/src/verax/shared/expectation-tracker.js +201 -0
  127. package/src/verax/shared/expectations-writer.js +60 -0
  128. package/src/verax/shared/first-run.js +44 -0
  129. package/src/verax/shared/progress-reporter.js +171 -0
  130. package/src/verax/shared/retry-policy.js +9 -1
  131. package/src/verax/shared/root-artifacts.js +49 -0
  132. package/src/verax/shared/scan-budget.js +86 -0
  133. package/src/verax/shared/url-normalizer.js +162 -0
  134. package/src/verax/shared/zip-artifacts.js +66 -0
  135. package/src/verax/validate/context-validator.js +244 -0
package/README.md CHANGED
@@ -1,19 +1,21 @@
1
- 🛡️ VERAX
1
+ # 🛡️ VERAX
2
2
 
3
- VERAX detects silent user failures by comparing what your code promises with what users actually experience.
3
+ A forensic observation engine for real user outcomes
4
4
 
5
- Silent failures don’t crash your site.
6
- They don’t show errors.
5
+ VERAX observes and reports gaps between what your code explicitly promises and what users can actually observe.
6
+
7
+ Silent user failures don’t crash your site.
8
+ They don’t throw errors.
7
9
  They simply lose users quietly.
8
10
 
9
- VERAX exists to surface those failures — with evidence, not guesses.
11
+ VERAX exists to surface those gaps — with evidence, not guesses.
10
12
 
11
13
  🤔 What is VERAX?
12
14
 
13
15
  A silent user failure happens when your code clearly implies that something should happen —
14
16
  but from the user’s point of view, nothing meaningful does.
15
17
 
16
- Examples:
18
+ Concrete examples:
17
19
 
18
20
  A button click that should navigate… but doesn’t.
19
21
 
@@ -21,17 +23,31 @@ A form submission that triggers an API call… but shows no feedback.
21
23
 
22
24
  A state update that runs in code… but never reaches the UI.
23
25
 
24
- These issues are frustrating for users and difficult for teams to catch.
26
+ These issues are frustrating for users and notoriously hard for teams to notice.
25
27
 
26
- VERAX reads your source code to understand what should happen, then opens your website in a real browser and experiences it like a human user.
27
- When code expectations and user reality don’t match, VERAX reports the gap clearly and honestly.
28
+ VERAX reads your source code to understand what is promised, then opens your site in a real browser and experiences it like a user.
29
+ When expectations and reality don’t align, VERAX reports the gap clearly and honestly.
28
30
 
29
31
  VERAX does not guess intent.
30
- It only reports failures that your code explicitly promises.
32
+ It only reports observations backed by explicit code promises.
33
+
34
+ 🧠 Clarification: “Silent failure”
35
+
36
+ In VERAX, a silent failure is not a judgment about correctness.
37
+
38
+ It means:
39
+
40
+ For a promised interaction (for example, a click expected to navigate or save),
41
+ no observable, user-visible effect could be verified
42
+ (no URL change, no network request, no feedback).
43
+
44
+ This does not mean your code is wrong.
45
+ It means the observation produced no verifiable effect for the promise being evaluated.
31
46
 
32
47
  ✅ What VERAX does (today)
33
48
 
34
- 🔍 Detects silent user failures by comparing code-derived expectations with real browser behavior
49
+ 🔍 Observes and reports gaps between code promises and user-visible outcomes
50
+ (by comparing code-derived expectations with real browser behavior)
35
51
 
36
52
  🧠 Extracts expectations from source code using static analysis:
37
53
 
@@ -39,23 +55,24 @@ Navigation from HTML links and React Router / Next.js routes
39
55
 
40
56
  Network actions from fetch / axios calls with static URLs
41
57
 
42
- State mutations from React useState, Redux dispatch, and Zustand set
58
+ State mutations from React useState, Redux dispatch, Zustand set
43
59
 
44
- 🖱️ Observes websites like a real user using Playwright (clicks, forms, navigation, scrolling)
60
+ 🖱️ Observes websites like a real user using Playwright
61
+ (clicks, forms, navigation, scrolling)
45
62
 
46
- 📊 Assigns confidence levels (HIGH / MEDIUM / LOW) based on evidence strength
63
+ 📊 Assigns confidence levels (HIGH / MEDIUM / LOW) based on evidence strength and coverage
47
64
 
48
- 🧾 Provides clear evidence for every finding:
65
+ 🧾 Provides concrete evidence for every reported discrepancy:
49
66
 
50
67
  Screenshots
51
68
 
52
69
  Network activity
53
70
 
54
- Console errors
71
+ Console logs
55
72
 
56
73
  DOM and state changes
57
74
 
58
- 💻 Runs as a CLI tool with verax scan and verax flow
75
+ 💻 Runs as a CLI tool via `verax run` (and inspects results with `verax inspect`)
59
76
 
60
77
  🧱 Supports real-world projects:
61
78
 
@@ -71,7 +88,7 @@ Next.js (App Router & Pages Router)
71
88
 
72
89
  ❌ Does not guess intent — no heuristics, no assumptions
73
90
 
74
- ❌ Does not support dynamic routes (/user/${id} is intentionally skipped)
91
+ ❌ Does not support dynamic routes (e.g. /user/${id} is intentionally skipped)
75
92
 
76
93
  ❌ Does not replace QA or tests — it complements them
77
94
 
@@ -79,7 +96,7 @@ Next.js (App Router & Pages Router)
79
96
 
80
97
  ❌ Does not work for every framework
81
98
 
82
- ❌ Does not detect every bug — only silent failures backed by code promises
99
+ ❌ Does not detect every bug — only gaps backed by explicit code promises
83
100
 
84
101
  ❌ Does not use AI — all results are deterministic and explainable
85
102
 
@@ -87,128 +104,138 @@ Next.js (App Router & Pages Router)
87
104
 
88
105
  VERAX runs three phases automatically:
89
106
 
90
- 1️⃣ Learn
91
-
92
- Analyzes your source code to understand:
93
-
94
- Project structure
95
-
96
- Routes
97
-
98
- What interactions promise to do
99
- Creates a manifest of expectations derived directly from code.
100
-
101
- 2️⃣ Observe
102
-
103
- Opens your site in a real browser and interacts naturally:
107
+ 1) **Learn**
108
+ Analyze source code to derive explicit, proven expectations
109
+ (routes, static network actions, state changes).
104
110
 
105
- Clicks buttons
111
+ 2) **Observe**
112
+ Open the site in a real browser and execute user interactions safely,
113
+ recording what actually happens.
106
114
 
107
- Fills forms
115
+ 3) **Detect**
116
+ Compare code-derived expectations with observed outcomes and report:
117
+ - Discrepancies
118
+ - Coverage gaps
119
+ - Unknowns
120
+ - Safety blocks
108
121
 
109
- Follows links
110
- Records what actually happens.
111
-
112
- 3️⃣ Detect
113
-
114
- Compares code expectations with real behavior.
115
- Reports a finding only when code promised an outcome that did not occur — with evidence and confidence.
116
-
117
- You run one command. VERAX handles the rest.
122
+ All with evidence.
118
123
 
119
124
  📦 Installation
120
125
 
121
126
  Requirements: Node.js 18+
122
127
 
123
- From npm (when published):
124
- npm install -g @verax/verax
128
+ From npm:
129
+
130
+ npm install -g @veraxhq/verax
125
131
 
126
132
  From source:
133
+
127
134
  git clone <repository-url>
128
- cd odavlguardian
135
+ cd verax
129
136
  npm install
130
137
  npm link
131
138
 
132
- 🚀 Basic usage
133
- Scan a website:
134
- verax scan --url <http://localhost:3000>
139
+ ## Commands
135
140
 
136
- JSON output (CI-friendly):
137
- verax scan --url <http://localhost:3000> --json
141
+ VERAX provides these CLI commands:
138
142
 
139
- Scan a specific project directory:
140
- verax scan --url <http://localhost:3000> --projectRoot ./my-website
143
+ - `verax` Interactive mode (detects URL or prompts for it)
144
+ - `verax run --url <url> [--src <path>] [--out <path>]` — Non-interactive CI mode (strict, explicit)
145
+ - `verax inspect <runPath>` — Inspect results from a previous run
146
+ - `verax doctor [--json]` — Verify environment (Node, Playwright, Chromium binary)
147
+ - `verax --version` — Show CLI version
148
+ - `verax --help` — Show help text
141
149
 
142
- Execute a user flow:
143
- verax flow --flow ./flows/login.json --url <http://localhost:3000>
150
+ ## Examples
144
151
 
145
- Outputs
152
+ Run a non-interactive scan (ideal for CI):
146
153
 
147
- Artifacts are written to:
154
+ ```bash
155
+ verax run --url http://localhost:3000 --src . --out .verax
156
+ ```
148
157
 
149
- .verax/runs/<runId>/
158
+ Run interactive mode (default auto-detection):
150
159
 
151
- Includes:
160
+ ```bash
161
+ verax
162
+ ```
152
163
 
153
- summary.json overall results
164
+ Check environment readiness:
154
165
 
155
- findings.json — detected issues with evidence
166
+ ```bash
167
+ verax doctor --json
168
+ ```
156
169
 
157
- traces.jsonl interaction traces
170
+ Inspect a previous run:
158
171
 
159
- evidence/ — screenshots and logs
172
+ ```bash
173
+ verax inspect .verax/runs/2026-01-11T12-34-56Z_abc123
174
+ ```
160
175
 
161
- Exit codes
176
+ 📁 Output (CI-friendly)
162
177
 
163
- 0 No HIGH confidence findings
178
+ Run a scan:
164
179
 
165
- 1 — MEDIUM / LOW findings only
180
+ ```bash
181
+ verax run --url http://localhost:3000 --src . --out .verax
182
+ ```
166
183
 
167
- 2 At least one HIGH confidence finding
184
+ Artifacts are written to:
185
+
186
+ `.verax/runs/<runId>/`
187
+
188
+ Including:
168
189
 
169
- 3Fatal error
190
+ - `summary.json` overall observation summary with digest counts
191
+ - `findings.json` — reported discrepancies with evidence
192
+ - `learn.json` — code-derived expectations
193
+ - `observe.json` — browser observations and outcomes
194
+ - `evidence/` — screenshots and logs
170
195
 
171
- 📊 Understanding results
196
+ 🚦 Exit codes (tool-only semantics)
172
197
 
173
- Each finding includes:
198
+ Exit codes reflect tool execution status only.
199
+ They do not represent site quality or correctness and must not be used as a pass/fail gate without explicit user logic.
174
200
 
175
- Typewhat kind of failure occurred
201
+ 0VERAX executed successfully (regardless of findings, gaps, or confidence)
176
202
 
177
- Reasonplain English explanation
203
+ 2Tool crashed or failed internally
178
204
 
179
- Confidencescore (0–100) + level
205
+ 64Invalid CLI usage (missing args, invalid flags)
180
206
 
181
- Evidencescreenshots, network data, console logs
207
+ 65Invalid input data (e.g. malformed JSON, unreadable manifest)
182
208
 
183
- Confidence levels:
209
+ 📊 Reading results (observer-first)
184
210
 
185
- HIGH (80–100) strong, unambiguous evidence
211
+ Each reported discrepancy includes:
186
212
 
187
- MEDIUM (60–79) likely failure with some ambiguity
213
+ Promise context: navigation, network action, state change, feedback
188
214
 
189
- LOW (<60) weak or partial evidence
215
+ Outcome classification: silent failure, coverage gap, unproven interaction, safety block, informational
190
216
 
191
- VERAX prefers missing an issue over reporting a false one.
217
+ Evidence: screenshots, network artifacts, console logs, trace references
192
218
 
193
- 🔐 Safety and privacy
219
+ Confidence: coverage ratio and silence impact
194
220
 
195
- 🔒 No guessing
221
+ Confidence (observer truth)
196
222
 
197
- 🧹 Automatic redaction of secrets and personal data
223
+ Confidence reflects the quality and completeness of observation,
224
+ not the quality or correctness of the site.
198
225
 
199
- 🛑 Safe by default blocks destructive actions unless explicitly allowed
226
+ HIGH (≥80) strong evidence and coverage; observations are reliable
200
227
 
201
- 🧭 Flows are opt-in only nothing runs without your definition
228
+ MEDIUM (60–79)likely discrepancy with some ambiguity
202
229
 
203
- 🎯 When VERAX is a good fit
230
+ LOW (<60) weak or partial evidence; interpret cautiously
204
231
 
205
- Marketing and public-facing websites
232
+ 🧭 When VERAX is a good fit
206
233
 
207
234
  SaaS signup and pricing flows
208
235
 
209
236
  React and Next.js projects
210
237
 
211
- CI pipelines that need UX validation
238
+ CI pipelines that need UX reality checks
212
239
 
213
240
  Teams that value evidence over assumptions
214
241
 
@@ -232,6 +259,14 @@ It is designed for early adopters and technical teams.
232
259
  VERAX is not a SaaS product.
233
260
  It runs locally or in CI. There is no hosted service.
234
261
 
262
+ ⚠ Important
263
+
264
+ VERAX does not certify correctness.
265
+ Zero findings do not mean a site is safe.
266
+
267
+ VERAX exists to prevent false certainty, not to grant confidence.
268
+ Use the Decision Snapshot and evidence to make a human judgment.
269
+
235
270
  📄 License
236
271
 
237
272
  MIT