Summary
Build a polished Chrome Manifest V3 ad blocker named Adblock using Bun + STX, with a premium extension UI, balanced blocking behavior, local/sync stats, and first-class YouTube and X/Twitter cleanup.
Principles
- Use STX for extension UI pages; no React.
- Keep all extension-page behavior in external bundled TypeScript modules for MV3 CSP compatibility.
- Use bundled static DNR rules plus dynamic local user/site rules; no remote updater in v1.
- Keep blocking balanced and maintainable: DNR, cosmetic cleanup, YouTube/X content scripts, skip-button automation where available, and no brittle video media hacks.
- Store no telemetry and make estimated data/time savings clear.
- Push small conventional commits as
chrisbbreuerwith noCo-authored-bytrailers.
Foundation
- Scaffold Bun TypeScript project.
- Install
@stacksjs/stxandbun-plugin-stxas proper package dependencies. - Add
src/,pages/,components/,rules/,scripts/,public/, and generateddist/structure. - Generate Chrome MV3
manifest.jsonintodist/. - Build popup/options STX pages into extension-safe HTML.
- Bundle background service worker, content scripts, popup script, and options script.
- Add package script and docs for creating an extension zip.
Blocking Engine
- Generate and validate static declarativeNetRequest rules.
- Add curated pinned filter attribution in
NOTICE.md. - Add dynamic DNR rules for per-site allowlist/blocklist and user overrides.
- Implement site protection state with default-on protection.
- Handle YouTube ad containers, overlays, companion ad slots, Shorts fixtures, and skip buttons.
- Handle X/Twitter promoted posts and noisy ad containers across home/search/profile fixtures.
- Add generic cosmetic filtering with mutation-observer performance guardrails.
Metrics And Storage
- Store compact settings and lifetime totals in
chrome.storage.sync. - Store hourly/daily rings and per-site rollups in
chrome.storage.local. - Track content-script block events.
- Reconcile recent and active-tab DNR matched-rule telemetry where Chrome exposes it.
- Estimate data saved by resource category.
- Estimate video minutes saved from detected/skipped video-ad durations.
- Add reset and export flows.
Popup UI
- Premium glass visual system with restrained depth and responsive popup sizing.
- Protection toggle and current-site state.
- Today and lifetime blocked counts.
- Estimated data saved and estimated video minutes saved.
- Top categories and mini timeline chart.
- Quick allowlist/site controls.
- Loading, empty, error, disabled, and no-active-tab states.
Options Dashboard
- Dashboard overview with history charts.
- Filter/ruleset status and diagnostics.
- Site rules management for allowlisted and manually blocked sites.
- Privacy/settings controls.
- Export/reset controls.
- Build/version information.
QA
bun testpasses.bun run typecheckpasses.bun run buildpasses.bun run packagecreates a zip artifact.- Generated DNR JSON validates.
- MV3 artifact validation passes with referenced files, PNG icons, and CSP-safe extension HTML.
- Chrome unpacked extension loads without manifest/CSP errors in Playwright Chromium.
- Smoke test: ad-heavy page, YouTube watch page, YouTube Shorts, X/Twitter home/search/profile fixtures.
- Smoke test: per-site pause/resume, reset/export, popup/options responsiveness and overflow checks.
Implemented Commit Chunks
- Project scaffold, STX/Bun build pipeline, manifest generation, popup/options, zip script.
- Static and dynamic DNR rules pipeline, allowlist model, rule validation tests.
- Background service worker, storage schema, sync/local metrics service, badge/current-tab accounting.
- Content scripts for cosmetic filtering, YouTube, X/Twitter, video-ad detection, and performance throttling.
- Polished STX popup UI with live stats, controls, charts, and states.
- Options/dashboard UI, settings, history, diagnostics, export/reset.
- QA pass, docs, packaged extension artifact, final push.
- Pinned EasyList/AdGuard host-rule generation, DNR telemetry, richer site-rule controls, and expanded Chromium smoke coverage.
Verification Evidence
- Latest verified commit:
738ad88(fix: install stx package dependency). - CI run: https://github.com/chrisbbreuer/adblock/actions/runs/28330429892
- CI passed: lint, test, typecheck, build, static DNR validation, MV3 artifact validation, package, and Chromium smoke.
- Local smoke passed with: generic=3, youtube=3, shorts=3, x=6, allowed=0, resumed=3, popup>=15, dashboard>=15.