@odavl/guardian 0.2.0 → 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.
Files changed (84) hide show
  1. package/CHANGELOG.md +86 -2
  2. package/README.md +155 -97
  3. package/bin/guardian.js +1345 -60
  4. package/config/README.md +59 -0
  5. package/config/profiles/landing-demo.yaml +16 -0
  6. package/package.json +21 -11
  7. package/policies/landing-demo.json +22 -0
  8. package/src/enterprise/audit-logger.js +166 -0
  9. package/src/enterprise/pdf-exporter.js +267 -0
  10. package/src/enterprise/rbac-gate.js +142 -0
  11. package/src/enterprise/rbac.js +239 -0
  12. package/src/enterprise/site-manager.js +180 -0
  13. package/src/founder/feedback-system.js +156 -0
  14. package/src/founder/founder-tracker.js +213 -0
  15. package/src/founder/usage-signals.js +141 -0
  16. package/src/guardian/alert-ledger.js +121 -0
  17. package/src/guardian/attempt-engine.js +568 -7
  18. package/src/guardian/attempt-registry.js +42 -1
  19. package/src/guardian/attempt-relevance.js +106 -0
  20. package/src/guardian/attempt.js +24 -0
  21. package/src/guardian/baseline.js +12 -4
  22. package/src/guardian/breakage-intelligence.js +1 -0
  23. package/src/guardian/ci-cli.js +121 -0
  24. package/src/guardian/ci-output.js +4 -3
  25. package/src/guardian/cli-summary.js +79 -92
  26. package/src/guardian/config-loader.js +162 -0
  27. package/src/guardian/drift-detector.js +100 -0
  28. package/src/guardian/enhanced-html-reporter.js +221 -4
  29. package/src/guardian/env-guard.js +127 -0
  30. package/src/guardian/failure-intelligence.js +173 -0
  31. package/src/guardian/first-run-profile.js +89 -0
  32. package/src/guardian/first-run.js +6 -1
  33. package/src/guardian/flag-validator.js +17 -3
  34. package/src/guardian/html-reporter.js +2 -0
  35. package/src/guardian/human-reporter.js +431 -0
  36. package/src/guardian/index.js +22 -19
  37. package/src/guardian/init-command.js +9 -5
  38. package/src/guardian/intent-detector.js +146 -0
  39. package/src/guardian/journey-definitions.js +132 -0
  40. package/src/guardian/journey-scan-cli.js +145 -0
  41. package/src/guardian/journey-scanner.js +583 -0
  42. package/src/guardian/junit-reporter.js +18 -1
  43. package/src/guardian/live-cli.js +95 -0
  44. package/src/guardian/live-scheduler-runner.js +137 -0
  45. package/src/guardian/live-scheduler.js +146 -0
  46. package/src/guardian/market-reporter.js +341 -81
  47. package/src/guardian/pattern-analyzer.js +348 -0
  48. package/src/guardian/policy.js +80 -3
  49. package/src/guardian/preset-loader.js +9 -6
  50. package/src/guardian/reality.js +1278 -117
  51. package/src/guardian/reporter.js +27 -41
  52. package/src/guardian/run-artifacts.js +212 -0
  53. package/src/guardian/run-cleanup.js +207 -0
  54. package/src/guardian/run-latest.js +90 -0
  55. package/src/guardian/run-list.js +211 -0
  56. package/src/guardian/scan-presets.js +100 -11
  57. package/src/guardian/selector-fallbacks.js +394 -0
  58. package/src/guardian/semantic-contact-finder.js +2 -1
  59. package/src/guardian/site-introspection.js +257 -0
  60. package/src/guardian/smoke.js +2 -2
  61. package/src/guardian/snapshot-schema.js +25 -1
  62. package/src/guardian/snapshot.js +46 -2
  63. package/src/guardian/stability-scorer.js +169 -0
  64. package/src/guardian/template-command.js +184 -0
  65. package/src/guardian/text-formatters.js +426 -0
  66. package/src/guardian/verdict.js +320 -0
  67. package/src/guardian/verdicts.js +74 -0
  68. package/src/guardian/watch-runner.js +3 -7
  69. package/src/payments/stripe-checkout.js +169 -0
  70. package/src/plans/plan-definitions.js +148 -0
  71. package/src/plans/plan-manager.js +211 -0
  72. package/src/plans/usage-tracker.js +210 -0
  73. package/src/recipes/recipe-engine.js +188 -0
  74. package/src/recipes/recipe-failure-analysis.js +159 -0
  75. package/src/recipes/recipe-registry.js +134 -0
  76. package/src/recipes/recipe-runtime.js +507 -0
  77. package/src/recipes/recipe-store.js +410 -0
  78. package/guardian-contract-v1.md +0 -149
  79. /package/{guardian.config.json → config/guardian.config.json} +0 -0
  80. /package/{guardian.policy.json → config/guardian.policy.json} +0 -0
  81. /package/{guardian.profile.docs.yaml → config/profiles/docs.yaml} +0 -0
  82. /package/{guardian.profile.ecommerce.yaml → config/profiles/ecommerce.yaml} +0 -0
  83. /package/{guardian.profile.marketing.yaml → config/profiles/marketing.yaml} +0 -0
  84. /package/{guardian.profile.saas.yaml → config/profiles/saas.yaml} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [1.0.0] — 2025-12-28 — Tier-1 Institutional Trust
4
+
5
+ ### Added (Tier-1 Trust & Governance)
6
+
7
+ - **SECURITY.md** — Vulnerability reporting policy, response timelines, coordinated disclosure
8
+ - **SUPPORT.md** — Support levels (critical/high/medium/low), response targets, upgrade expectations
9
+ - **MAINTAINERS.md** — Maintainer ownership, release responsibility, how to contribute
10
+ - **VERSIONING.md** — SemVer policy, backward compatibility guarantees, deprecation timeline
11
+ - **CI/CD Resilience Hardening**:
12
+ - **GitHub Actions**: Playwright v1.48.2 pinning, fail-on policy enforcement (none/friction/risk/any), 5-min timeout guards
13
+ - **GitLab CI**: Retry policy (max=2), fail-on enforcement in after_script, 15-min job timeout
14
+ - **Bitbucket Pipelines**: GUARDIAN_FAIL_ON variable, policy enforcement in after-script, max-time: 15
15
+ - **action.yml**: Complete retry/backoff logic (3 attempts, 2s/5s delays), Playwright cache with version pin, timeout buffer calculation
16
+ - **Retry & Backoff**: Implemented across all platforms (3 attempts, exponential backoff, exit codes 0/1/2 exempt from retry)
17
+ - **Caching Strategy**: Playwright browser cache with version pins, npm cache with hash keys (1-2 min savings)
18
+ - **Timeout Guards**: Explicit timeout enforcement at script and job levels; exit code 124 signals timeout failure
19
+ - **Determinism Enforcement**: Pinned Playwright version (v1.48.2), Node.js 20, validated inputs in all CI platforms
20
+
21
+ ### Key Improvements
22
+
23
+ - Guardian is now Tier-1 ready: governance, security, support, and resilience policies established
24
+ - All CI/CD platforms enforce identical resilience standards (retry, cache, timeout, policy)
25
+ - Institutional trust signals: SECURITY.md, SUPPORT.md, MAINTAINERS.md, VERSIONING.md
26
+ - No silent failures: every timeout, crash, or policy violation is explicit
27
+ - Deterministic verdict delivery: same input → same output across attempts (verdicts never retried)
28
+
29
+ ### Documentation
30
+
31
+ - Comprehensive CI/CD docs with production-grade examples (GitHub, GitLab, Bitbucket)
32
+ - Failure policy matrix (any/risk/friction/none) with clear blocking rules
33
+ - Resilience patterns documented (retry logic, caching, timeout guards)
34
+ - Guardian Contract v1 reference in VERSIONING.md
35
+
36
+ ## Unreleased — Stage V / Step 5.2
37
+
38
+ ### Added (Silence Discipline)
39
+
40
+ - **Centralized suppression helpers** (7 boolean functions) enforcing strict output discipline
41
+ - **shouldRenderFocusSummary** — Suppress when READY + high + no patterns
42
+ - **shouldRenderDeltaInsight** — Suppress when no improved/regressed lines
43
+ - **shouldRenderPatterns** — Suppress when patterns.length === 0
44
+ - **shouldRenderConfidenceDrivers** — Suppress when high confidence + run 3+
45
+ - **shouldRenderJourneyMessage** — Suppress when runIndex >= 3
46
+ - **shouldRenderNextRunHint** — Suppress when verdict === READY
47
+ - **shouldRenderFirstRunNote** — Suppress when runIndex >= 2
48
+ - **CLI integration** — All sections use centralized suppression helpers (no inline conditions)
49
+ - **HTML integration** — All cards use centralized suppression helpers (no inline conditions)
50
+ - **decision.json integration** — Keys omitted entirely when suppressed (not empty arrays/objects)
51
+ - **28 comprehensive tests** covering all suppression helpers, consistency, edge cases
52
+ - **Demo script** showing "silent case" vs "signal case" scenarios
53
+
54
+ ### Key Improvements
55
+
56
+ - Guardian speaks ONLY when there is clear, meaningful value
57
+ - Silence is the default state; output is an exception
58
+ - Consistent suppression across CLI, HTML, decision.json
59
+ - Deterministic helpers ensure predictable behavior
60
+ - "Silent case" (READY + high + no patterns) shows minimal output
61
+ - "Signal case" (FRICTION + patterns) provides full context
62
+ - Zero inline conditions in renderers (single source of truth)
63
+
64
+ ### Philosophy
65
+
66
+ - **Quiet:** Silence is the default state
67
+ - **Focused:** Show only meaningful signals
68
+ - **Intentional:** Every output has a purpose
69
+
70
+ ### Example
71
+
72
+ **Before Step 5.2:** READY + high + no patterns still showed empty sections
73
+
74
+ **After Step 5.2:** READY + high + no patterns shows ONLY verdict + confidence
75
+
76
+ 🟢 READY — Safe to launch
77
+ 📈 Coverage: 100%
78
+ 💬 Confidence: HIGH
79
+ [ALL OTHER SECTIONS SUPPRESSED — SILENT]
80
+
81
+ ## Unreleased
82
+
83
+ ### Added
84
+
85
+ - (Placeholder for future improvements)
86
+
3
87
  ## 0.2.0 — Performance Edition (2025-12-24)
4
88
 
5
89
  ### Highlights
@@ -15,8 +99,8 @@
15
99
 
16
100
  ### Commands
17
101
 
18
- - guardian smoke <url>
19
- - guardian protect <url> --fast --parallel 3
102
+ - `guardian smoke <url>`
103
+ - `guardian protect <url> --fast --parallel 3`
20
104
 
21
105
  ## Unreleased — Wave 1.1
22
106
 
package/README.md CHANGED
@@ -1,141 +1,199 @@
1
- # 🛡️ ODAVL Guardian — Market Reality Testing Engine
1
+ # 🛡️ ODAVL Guardian
2
2
 
3
- Guardian tests your product before the market does — it runs real-browser checks to catch broken flows early and produces evidence you can trust.
3
+ The Reality Guard for Websites
4
4
 
5
- ---
5
+ ODAVL Guardian does not test code.
6
+ It tests reality — before your users do.
6
7
 
7
- ## Public Preview
8
+ What is ODAVL Guardian?
8
9
 
9
- - Distribution: GitHub-only (no npm publish yet)
10
- - Scope: CLI usage from source
10
+ ODAVL Guardian is a reality-based website guard.
11
11
 
12
- ---
12
+ It behaves like a real human visitor, navigates your website end-to-end, and verifies that the actual user experience works as intended — not just that the code exists.
13
13
 
14
- ## Requirements
14
+ Guardian clicks, types, submits, waits, retries, fails, hesitates, and reacts
15
+ exactly like a real user would.
15
16
 
16
- - Node.js 18+
17
- - npm
18
- - Playwright browsers (Chromium)
17
+ If something breaks in reality, Guardian finds it first.
19
18
 
20
- Install browsers once per machine:
19
+ Why ODAVL Guardian Exists
21
20
 
22
- ```bash
23
- npx playwright install --with-deps chromium
24
- ```
21
+ Most websites don’t fail because of:
25
22
 
26
- ---
23
+ bad code
27
24
 
28
- ## Install from Source
25
+ missing features
29
26
 
30
- ```bash
31
- # Clone the repository
32
- git clone https://github.com/ODAVL/odavl-guardian.git
33
- cd odavl-guardian
27
+ poor infrastructure
34
28
 
35
- # Install dependencies
36
- npm install
29
+ They fail because of small reality breaks:
37
30
 
38
- # Install Playwright browsers (Chromium)
39
- npx playwright install --with-deps chromium
40
- ```
31
+ a button that does nothing
41
32
 
42
- Quick try:
33
+ a form that never submits
43
34
 
44
- ```bash
45
- # Quick reality check with startup policy (from source)
46
- node bin/guardian.js protect https://example.com
35
+ a checkout that times out
47
36
 
48
- # Full reality snapshot with artifacts
49
- node bin/guardian.js reality --url https://example.com --artifacts ./artifacts
50
- ```
37
+ a language switch that lies
51
38
 
52
- ---
39
+ a flow that technically works but never reaches the goal
53
40
 
54
- ## CLI Commands
41
+ These issues are rarely caught by:
55
42
 
56
- Use the CLI from source during Public Preview:
43
+ unit tests
57
44
 
58
- ```text
59
- node bin/guardian.js init # Initialize Guardian in the current directory
60
- node bin/guardian.js protect <url> # Quick reality check using the startup preset
61
- node bin/guardian.js presets # List available policy presets
62
- node bin/guardian.js attempt [...] # Execute a single attempt
63
- node bin/guardian.js reality [...] # Full market reality snapshot
64
- node bin/guardian.js baseline save [...] # Save a named baseline
65
- node bin/guardian.js baseline check [...] # Check current run against a baseline
66
- ```
45
+ integration tests
67
46
 
68
- Examples:
47
+ linters
69
48
 
70
- ```bash
71
- node bin/guardian.js reality --url https://example.com --policy preset:saas --artifacts ./artifacts
72
- node bin/guardian.js baseline save --url "http://127.0.0.1:3000?mode=ok" --name ok-baseline --baseline-dir guardian-baselines --artifacts artifacts
73
- node bin/guardian.js baseline check --url "http://127.0.0.1:3000?mode=ok" --name ok-baseline --baseline-dir guardian-baselines --artifacts artifacts --junit artifacts/junit.xml
74
- ```
49
+ static analysis
75
50
 
76
- ---
51
+ They are usually discovered by real users — after damage is done.
77
52
 
78
- ## Artifacts
53
+ ODAVL Guardian exists to prevent that.
79
54
 
80
- - Market report: artifacts/market-run-*/market-report.html
81
- - Snapshot JSON: artifacts/market-run-*/snapshot.json
82
- - Attempt reports: artifacts/market-run-*/`<attempt-id>`/attempt-report.*
83
- - Playwright trace: artifacts/market-run-*/trace.zip (when enabled)
84
- - JUnit XML: artifacts/junit.xml (when requested)
55
+ Core Principle
85
56
 
86
- ---
57
+ Reality > Implementation
87
58
 
88
- ## Exit Codes
59
+ Guardian does not ask:
60
+ “Is the code correct?”
89
61
 
90
- ```text
91
- 0 READY # Safe to proceed - all checks passed
92
- 1 DO_NOT_LAUNCH # Critical issues found - do not deploy
93
- 2 FRICTION # Usability issues found - proceed with caution
94
- ```
62
+ Guardian asks:
63
+ “Did the human succeed?”
95
64
 
96
- ---
65
+ How It Works (Conceptually)
97
66
 
98
- ## CI Integration (Minimal)
67
+ You define a realistic user scenario
68
+ (landing, signup, checkout, dashboard, etc.)
99
69
 
100
- ```yaml
101
- name: Guardian Reality Check
102
- on: [push, pull_request]
70
+ Guardian executes the scenario as a human-like agent
103
71
 
104
- jobs:
105
- guardian:
106
- runs-on: ubuntu-latest
107
- steps:
108
- - uses: actions/checkout@v4
109
- - uses: actions/setup-node@v4
110
- with:
111
- node-version: '18'
72
+ real navigation
112
73
 
113
- - run: npm ci
114
- - run: node bin/guardian.js reality --url https://staging.example.com --max-pages 25
74
+ real waits
115
75
 
116
- - uses: actions/upload-artifact@v4
117
- with:
118
- name: guardian-report
119
- path: artifacts/market-run-*/market-report.html
120
- ```
76
+ real interactions
121
77
 
122
- ---
78
+ real failure conditions
123
79
 
124
- ## Docs & Specs
80
+ Guardian evaluates the result using reality rules
125
81
 
126
- - Contract: [guardian-contract-v1.md](guardian-contract-v1.md)
127
- - Engine docs: [docs/guardian](docs/guardian)
82
+ goal reached or not
128
83
 
129
- ---
84
+ partial success
130
85
 
131
- ## Status & Known Issues
86
+ friction
132
87
 
133
- - Public Preview (GitHub-only). CLI usage is via source: see [bin/guardian.js](bin/guardian.js).
134
- - Website subproject build has an ESLint rule failure (react/no-unescaped-entities). Not required for CLI usage.
135
- - Tests: most suites pass; see [CHANGELOG.md](CHANGELOG.md) for current failures/regressions, if any.
88
+ silent failure
136
89
 
137
- ---
90
+ Guardian produces a decision, not just logs.
138
91
 
139
- ## License
92
+ Result Semantics (Honest by Design)
140
93
 
141
- Licensed under the MIT License. See [LICENSE](LICENSE) for details.
94
+ Guardian never pretends success.
95
+
96
+ It classifies reality into clear outcomes:
97
+
98
+ SAFE — goal reached, no failures
99
+
100
+ RISK — partial progress, friction, or near-success
101
+
102
+ DO_NOT_LAUNCH — user failed or flow broken
103
+
104
+ No green checkmarks for broken experiences.
105
+
106
+ What Guardian Is Not
107
+
108
+ Guardian is not:
109
+
110
+ a unit testing framework
111
+
112
+ a code quality tool
113
+
114
+ a performance benchmark
115
+
116
+ a security scanner
117
+
118
+ a synthetic lighthouse replacement
119
+
120
+ Guardian complements those tools — it does not replace them.
121
+
122
+ Who Is This For?
123
+
124
+ ODAVL Guardian is built for:
125
+
126
+ founders before launch
127
+
128
+ teams before deployment
129
+
130
+ SaaS products before scaling
131
+
132
+ marketing pages before campaigns
133
+
134
+ checkout flows before ads
135
+
136
+ international sites before localization
137
+
138
+ Anyone who cares about what users actually experience.
139
+
140
+ Example Use Cases
141
+
142
+ “Can a new user actually sign up?”
143
+
144
+ “Does checkout really finish?”
145
+
146
+ “Does language switching change content?”
147
+
148
+ “Does the CTA lead somewhere meaningful?”
149
+
150
+ “Does the flow succeed without retries?”
151
+
152
+ If a human can fail — Guardian will find it.
153
+
154
+ Philosophy
155
+
156
+ ODAVL Guardian follows a strict philosophy:
157
+
158
+ No hallucination
159
+
160
+ No fake success
161
+
162
+ No optimistic assumptions
163
+
164
+ No silent failures
165
+
166
+ If reality is broken, Guardian says so.
167
+
168
+ Status
169
+
170
+ Project maturity:
171
+ Early but real.
172
+ Opinionated.
173
+ Built with honesty over hype.
174
+
175
+ This is a foundation — not a marketing shell.
176
+
177
+ Part of ODAVL
178
+
179
+ ODAVL Guardian is part of the ODAVL ecosystem, focused on:
180
+
181
+ truth
182
+
183
+ evidence
184
+
185
+ safety
186
+
187
+ reality-driven decisions
188
+
189
+ More tools may exist — but Guardian protects the human layer.
190
+
191
+ Final Thought
192
+
193
+ Tests can pass.
194
+ Metrics can look good.
195
+ Code can be clean.
196
+
197
+ And users can still fail.
198
+
199
+ ODAVL Guardian makes sure they don’t.