feat: add chrome extension on top of wasm#24
Conversation
… port Proves internal/audit, internal/rules (CEL), internal/model and internal/schema compile cleanly under GOOS=js GOARCH=wasm and run correctly: 24 real issues returned in 20ms, 0.54ms/audit warm, 2.9MB gzipped with -ldflags="-s -w" -trimpath. Build-tagged //go:build js && wasm so it stays inert for the native CLI.
Move the audit logic out of internal/ into core/ so the CLI and the
new browser extension both consume one implementation with two
frontends:
internal/audit -> core/checks (package renamed audit -> checks)
internal/model -> core/model
internal/rules -> core/rules
internal/schema -> core/schema
core/engine (new) thin orchestrator for both callers
cmd/wasm now uses core/engine and exposes a { ok, data, error }
envelope consumed by the extension over syscall/js.
The extension (extension/) is a Vue 3 + CRXJS + Vite 8 + TypeScript +
Zod + Bun side panel. It captures real response headers via
chrome.webRequest.onResponseStarted, extracts the DOM via a content
script, and hands a PageSnapshot to the service worker which owns a
single WasmRuntime instance. Every payload crossing the WASM ↔ JS
boundary is Zod-validated — invalid data becomes null, never a throw.
Design tokens (Sanity-inspired, dark-first) live in
extension/src/styles/tokens.css; no component hard-codes colour,
radius, font, or spacing. Home tab is the juiciest view: editorial
serif score dial, per-category health bars, top critical issues,
page facts, detected tech stack.
Pre-existing flaky tests in core/checks/structured_data_v2_test.go
are unchanged and still flaky (map iteration order); not addressed
here.
for more information, see https://pre-commit.ci
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Proves internal/audit, internal/rules (CEL), internal/model and
internal/schema compile cleanly under GOOS=js GOARCH=wasm and run
correctly: 24 real issues returned in 20ms, 0.54ms/audit warm, 2.9MB
gzipped with -ldflags="-s -w" -trimpath.
Build-tagged //go:build js && wasm so it stays inert for the native CLI.