@vitronai/alethia 0.8.5 → 0.9.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.
@@ -0,0 +1,22 @@
1
+ export const meta = {
2
+ name: 'alethia:smoke',
3
+ description: 'Quick smoke test — navigate to a URL and assert the page loads',
4
+ phases: [
5
+ { title: 'Smoke' },
6
+ ],
7
+ }
8
+
9
+ // Pass args: { url: "http://localhost:3000", checks: "assert the dashboard heading is visible" }
10
+ const a = (typeof args === 'string' ? JSON.parse(args) : args) || {}
11
+ const url = a.url || 'http://localhost:3000'
12
+ const checks = a.checks || 'assert the page is visible'
13
+
14
+ log(`Smoke test → ${url}`)
15
+
16
+ phase('Smoke')
17
+ const result = await agent(
18
+ `Call alethia_tell with the following instructions and return the step results:\nnavigate to ${url}\n${checks}`,
19
+ { label: 'smoke', phase: 'Smoke' }
20
+ )
21
+
22
+ return { url, result }
@@ -0,0 +1,65 @@
1
+ # Examples
2
+
3
+ Copy-paste integration examples for adding Alethia to your project.
4
+
5
+ ## Claude Code commands
6
+
7
+ The `.claude/commands/` folder contains project-level slash commands for Claude Code. Copy any of these into your own project's `.claude/commands/` directory and they'll appear as `/command-name` in Claude Code when that project is open.
8
+
9
+ | Command | What it does |
10
+ |---------|-------------|
11
+ | `/smoke` | Quick navigate + assert the page loaded |
12
+ | `/audit` | Full WCAG + NIST compliance audit → signed evidence pack |
13
+ | `/safety-check` | Prove the EA1 gate blocks every destructive action on a page |
14
+ | `/bootstrap` | Scan a page with `propose_tests` and run each suggested block |
15
+ | `/multi-page` | Smoke test multiple pages in parallel |
16
+ | `/regression` | Run a fixed assertion suite — fail on any regression |
17
+
18
+ **Install:**
19
+ ```bash
20
+ # From the root of your project:
21
+ mkdir -p .claude/commands
22
+ curl -O --output-dir .claude/commands \
23
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/commands/smoke.md \
24
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/commands/audit.md \
25
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/commands/safety-check.md \
26
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/commands/bootstrap.md \
27
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/commands/multi-page.md \
28
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/commands/regression.md
29
+ ```
30
+
31
+ Or just copy the files manually. They're plain Markdown — edit the default URL or port to match your stack.
32
+
33
+ ## Claude Code workflows
34
+
35
+ The `.claude/workflows/` folder contains named workflow scripts for the Claude Code `Workflow()` tool. Copy any of these into your own project's `.claude/workflows/` directory and Claude Code can run them with `Workflow({ name: "alethia:<name>" })` or via the `/workflows` panel.
36
+
37
+ | Workflow | What it does |
38
+ |----------|-------------|
39
+ | `alethia:smoke` | Navigate to a URL and assert the page loads |
40
+ | `alethia:full-audit` | WCAG + NIST audits in parallel → signed evidence pack |
41
+ | `alethia:safety-gate` | EA1 per-action block/allow report |
42
+ | `alethia:bootstrap` | `propose_tests` → run each block sequentially |
43
+ | `alethia:multi-page` | Smoke test multiple pages in parallel via `alethia_tell_parallel` |
44
+ | `alethia:regression` | Fixed assertion suite — returns pass/fail + evidence hash |
45
+
46
+ All workflows accept a `url` arg (default: `http://localhost:3000`). See each file's header comment for the full args schema.
47
+
48
+ **Install:**
49
+ ```bash
50
+ # From the root of your project:
51
+ mkdir -p .claude/workflows
52
+ curl -O --output-dir .claude/workflows \
53
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/workflows/smoke.js \
54
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/workflows/full-audit.js \
55
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/workflows/safety-gate.js \
56
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/workflows/bootstrap.js \
57
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/workflows/multi-page.js \
58
+ https://raw.githubusercontent.com/vitron-ai/alethia-mcp/main/examples/.claude/workflows/regression.js
59
+ ```
60
+
61
+ ## GitHub Actions
62
+
63
+ `github-actions.yml` is a drop-in CI workflow that runs your `.alethia` test files on every push and pull request. Save it as `.github/workflows/alethia.yml` and adjust the "Start your app" step to match your stack.
64
+
65
+ See the file header for full setup instructions.
@@ -0,0 +1,62 @@
1
+ # Drop-in GitHub Actions workflow for running an Alethia E2E test suite.
2
+ # Save as `.github/workflows/alethia.yml` in your repo and adjust the
3
+ # `Start your app` step to match your stack.
4
+ #
5
+ # How it works:
6
+ # 1. Install the @vitronai/alethia bridge globally. The bridge auto-installs
7
+ # the signed runtime on first use (Ed25519-verified, no signup).
8
+ # 2. Start your app in the background.
9
+ # 3. `alethia run tests/...` drives the runtime headless and exits 0/1
10
+ # based on whether every step passed. CI environments are auto-detected
11
+ # so the cockpit window stays hidden.
12
+ #
13
+ # Test files (.alethia) are plain text — same NLP your agents already use.
14
+
15
+ name: E2E (Alethia)
16
+
17
+ on:
18
+ pull_request:
19
+ push:
20
+ branches: [main]
21
+
22
+ jobs:
23
+ alethia:
24
+ runs-on: ubuntu-latest
25
+ timeout-minutes: 10
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+
29
+ - uses: actions/setup-node@v4
30
+ with:
31
+ node-version: '20'
32
+
33
+ # Pin a specific runtime version for reproducible CI. Drop this if you
34
+ # always want the latest signed release on the default branch.
35
+ - name: Install Alethia bridge
36
+ run: npm install -g @vitronai/alethia
37
+
38
+ # Replace this with how YOUR app boots. Common patterns:
39
+ # npm run start & # most Node apps
40
+ # docker compose up -d # containerized stacks
41
+ # python -m http.server 3000 & # static sites
42
+ - name: Start your app
43
+ run: |
44
+ npm ci
45
+ npm run build
46
+ npm start &
47
+ npx wait-on http://localhost:3000 --timeout 60000
48
+
49
+ - name: Run Alethia E2E suite
50
+ run: |
51
+ for test in tests/e2e/*.alethia; do
52
+ echo "::group::$test"
53
+ alethia run "$test"
54
+ echo "::endgroup::"
55
+ done
56
+ env:
57
+ # Pin runtime version for reproducible CI runs. Remove to always
58
+ # fetch the latest signed release.
59
+ # ALETHIA_RUNTIME_VERSION: '0.7.1'
60
+ # The bridge auto-detects CI and runs headless; this is just for
61
+ # belt-and-suspenders if you set CI=false somewhere.
62
+ ALETHIA_HEADLESS: '1'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitronai/alethia",
3
- "version": "0.8.5",
3
+ "version": "0.9.0",
4
4
  "description": "MIT-licensed MCP bridge to the Alethia runtime — the patent-pending zero-IPC E2E test runtime for AI agents. 2-5x faster than Playwright MCP. Signed evidence packs, EA1 fail-closed safety gate, WCAG + NIST 800-53 audits built in. Local-first, zero telemetry. Auto-installs on first use.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,13 +12,14 @@
12
12
  "dist",
13
13
  "demo",
14
14
  "skills",
15
+ "examples",
15
16
  "LICENSE",
16
17
  "README.md"
17
18
  ],
18
19
  "scripts": {
19
20
  "build": "tsc",
20
21
  "dev": "tsc --watch",
21
- "test": "node --test bridge-tests/*.test.mjs",
22
+ "test": "themis test --isolation process",
22
23
  "prepublishOnly": "npm run build && npm test"
23
24
  },
24
25
  "keywords": [
@@ -42,7 +43,7 @@
42
43
  "fail-closed",
43
44
  "vitron"
44
45
  ],
45
- "author": "vitron.ai <gatekeeper@vitron.ai>",
46
+ "author": "vitron.ai <team@vitron.ai>",
46
47
  "license": "MIT",
47
48
  "homepage": "https://github.com/vitron-ai/alethia",
48
49
  "repository": {
@@ -52,6 +53,7 @@
52
53
  "bugs": {
53
54
  "url": "https://github.com/vitron-ai/alethia-mcp/issues"
54
55
  },
56
+ "mcpName": "io.github.vitron-ai/alethia",
55
57
  "publishConfig": {
56
58
  "access": "public"
57
59
  },
@@ -59,7 +61,8 @@
59
61
  "node": ">=18"
60
62
  },
61
63
  "devDependencies": {
62
- "typescript": "^5.9.3",
63
- "@types/node": "^25.2.3"
64
+ "@types/node": "^25.2.3",
65
+ "@vitronai/themis": "^1.3.0",
66
+ "typescript": "^5.9.3"
64
67
  }
65
68
  }
@@ -166,9 +166,35 @@ On any `alethia_tell` failure, the response includes:
166
166
 
167
167
  Read these before retrying. Most failures are phrasing mismatches, not real bugs — the suggested fix usually works.
168
168
 
169
- ## Escape hatches (use sparingly)
169
+ ## Dev feedback loop (eval as a DOM oracle)
170
170
 
171
- - **`alethia_eval({ expression })`** raw JavaScript in the page context. For cases where NLP can't express what you need (counting elements, reading computed styles, triggering React's native input setter). Runs in the target page, not the host.
171
+ During active frontend development, `alethia_eval` is more reliable than screenshots for catching bugs in real time. Screenshots can serve a cached frame; eval always returns live values from the current DOM.
172
+
173
+ **The pattern:** write code → navigate → eval the DOM → get exact values → correct → repeat.
174
+
175
+ ```javascript
176
+ // Did the CSS actually apply?
177
+ alethia_eval({ expression: "getComputedStyle(document.querySelector('.hero-title')).fontSize" })
178
+ // → "32px"
179
+
180
+ // Is the layout correct?
181
+ alethia_eval({ expression: "getComputedStyle(document.querySelector('.sidebar')).justifyContent" })
182
+ // → "flex-start"
183
+
184
+ // How wide is the element actually rendering?
185
+ alethia_eval({ expression: "document.querySelector('.card').offsetWidth" })
186
+ // → 320
187
+
188
+ // Count elements to verify a list rendered
189
+ alethia_eval({ expression: "document.querySelectorAll('.product-card').length" })
190
+ // → 6
191
+ ```
192
+
193
+ Use eval for **ground truth** (computed values, layout dimensions, element counts, React state). Use `alethia_screenshot` for **visual verification** (does it look right, are things positioned correctly on screen). When a CSS bug is suspected, reach for eval first — it returns exact values in milliseconds without any caching ambiguity.
194
+
195
+ ## Escape hatches
196
+
197
+ - **`alethia_eval({ expression })`** — raw JavaScript in the page context. Runs in the target page, not the host. See "Dev feedback loop" above for the primary use case; also useful for triggering React's native input setter when NLP typing doesn't fire onChange.
172
198
  - **`alethia_screenshot()`** — PNG of the current page, for visual verification.
173
199
  - **`alethia_activate_kill_switch` / `alethia_reset_kill_switch`** — emergency halt and resume. Blocks all tool calls until reset.
174
200