@brad-frost-web/eddie-reporter

中文文档
0.73.0发布于 2026/11/04MITTypeScriptES Module零依赖近 30 天下载 1693

The Eddie-reporter — a zero-dependency usage reporter installed on downstream Eddie products. It statically scans a product for Eddie asset usage (components, recipes, pages, tokens) and reports the activity back to Eddie's Brain, so adoption and activity

原始使用文档
文档目录11 节
  1. Why this exists
  2. Design principles
  3. Install & use
  4. Run it on a schedule
  5. CLI
  6. Build output that lives beside the sources
  7. bfw-process rulebooks
  8. Programmatic API
  9. What a report looks like
  10. A product's own ed-* elements are not Eddie usage
  11. The bigger picture

@brad-frost-web/eddie-reporter

The Eddie-reporter — a zero-dependency usage reporter you install on downstream Eddie products. It statically scans a product for Eddie asset usage (components, recipes, page templates, and design tokens) and reports that activity back to Eddie's Brain, so adoption and activity of the design system become a living, breathing feedback loop instead of a point-in-time guess.

Why this exists

Eddie's Brain already knows coverage (what the system offers) and, via the adoption scanner, coarse adoption (which org repos declare an Eddie dependency in package.json). What it couldn't see was activity: which assets a product actually uses, how heavily, and when it last changed.

The reporter closes that gap. It turns "16 repos depend on Eddie" into "these products use ed-card 240 times, nobody has touched ed-r-legacy-banner in 90 days, and ed-p-app-dashboard is the most-forked template this quarter." That signal flows into .eddie-brain/activity.json and out through the eddie_get_activity MCP tool.

Design principles

  • Zero dependencies. Node built-ins only. It installs instantly and adds no supply-chain surface to the products it ships to.
  • Static & read-only. It reads source text and counts references. It never executes the product, never reads runtime/user data, and never mutates the host. Reports are deterministic and privacy-friendly.
  • Never breaks a build. A failed beacon is logged, not thrown. The CLI exits 0 even when delivery fails.
  • Degrades gracefully. If there's no network (or you don't want telemetry), it writes a local artifact your CI can commit — the brain's org scan or a human can pick it up later.

Install & use

Run it with no install via npx:

npx @brad-frost-web/eddie-reporter --event build \
  --endpoint https://ds.bradfrost.com/report

Or add it as a dev dependency and wire it into a build/postbuild script:

// package.json
{
  "scripts": {
    "postbuild": "eddie-report --event build"
  }
}

Set the endpoint once via env so scripts stay clean:

export EDDIE_REPORT_ENDPOINT="https://ds.bradfrost.com/report"
export EDDIE_REPORT_TOKEN="…"   # optional

Run it on a schedule

The loop is designed to run unattended, on both ends:

  • Product side. Copy templates/eddie-report.yml to your product's .github/workflows/ and set the EDDIE_REPORT_ENDPOINT secret. It beacons weekly (cron), on every push to main/develop, and on demand. Products that deploy elsewhere can use a Netlify/Vercel scheduled function, a postbuild/postdeploy hook, or a plain server cron.
  • System side. The hosted POST /report endpoint durably captures each beacon in a Netlify Blobs store (serverless filesystems are ephemeral). The scheduled eddie-activity workflow in eddie-design-system then flushes that store into .eddie-brain/activity.json (eddie-brain activity flush), refreshes adoption, and opens a PR — so the ledger stays live with zero manual steps.

CLI

eddie-report [dir] [options]

  --endpoint <url>   Brain ingestion URL (env: EDDIE_REPORT_ENDPOINT)
  --token <token>    Bearer token (env: EDDIE_REPORT_TOKEN)
  --event <name>     build | deploy | install | ci | dev | manual  (default: manual)
  --out <path>       Local artifact path (default: .eddie/usage-report.json; '' to skip)
  --ignore <path>    Skip a file or directory, relative to dir (repeatable)
  --ignore-dir <n>   Skip every directory named <n>, anywhere in the tree (repeatable)
  --dry-run          Scan and print, but don't POST or write
  --json             Print the full report JSON to stdout
  --quiet            Suppress the human summary

Build output that lives beside the sources

The scanner already skips the usual output directories (dist, _site, .output, …). It cannot tell that a file inside a source directory is generated. A committed css/styles.css compiled from css/*.scss inlines Eddie's entire token sheet, so a site that uses two dozen tokens reports six hundred. Name such files explicitly:

eddie-report --event ci --ignore css/styles.css --ignore css/styles.tmp.css

The same option exists on the API as ignorePaths (paths relative to the scanned directory; a directory skips its subtree). Matching is case-sensitive; an absolute path inside the scanned directory is accepted, one outside it never matches. A missing or flag-shaped value (--ignore --dry-run) is a usage error and exits 2.

bfw-process rulebooks

A bfw-process product carries a rulebook that quotes Eddie markup and token names as examples of the rules. Counted as usage, it credits a recipe or token to a product that only mentions it (#1861).

  • .bfw-process/ and .microagents/ are never scanned: the scanner skips every dot-directory.
  • AGENTS.md, CLAUDE.md and SPEC.md are not, because root markdown on a docs site can be real usage. Opt them out explicitly, as the workflow template does:
eddie-report --event ci --ignore AGENTS.md --ignore CLAUDE.md --ignore SPEC.md

Programmatic API

import { buildReport, sendReport } from '@brad-frost-web/eddie-reporter';

const report = buildReport({ dir: process.cwd(), event: 'build' });
await sendReport(report, { endpoint: process.env.EDDIE_REPORT_ENDPOINT });

What a report looks like

{
  "schema": "eddie-usage-report/1",
  "reporterVersion": "0.62.1",
  "generatedAt": "2026-07-14T00:00:00.000Z",
  "event": "build",
  "product": {
    "id": "bradfrost.com",
    "repo": "Brad-Frost-Web/bradfrost.com",
    "branch": "main",
    "commit": "a1b2c3d…",
    "environment": "ci"
  },
  "eddie": {
    "declared": { "@brad-frost-web/eddie-web-components": "^0.37.0" },
    "packages": ["design-tokens", "web-components"]
  },
  "usage": {
    "components": { "ed-card": 24, "ed-button": 18 },
    "recipes": { "ed-r-site-header": 1 },
    "pages": { "ed-p-app-dashboard": 1 },
    "tokens": { "--ed-theme-color-content-default": 63 },
    "unknownPrefixed": { "ed-slide": 12 },
    "filesScanned": 210,
    "filesMatched": 47
  },
  "totals": { "distinctComponents": 2, "distinctRecipes": 1, "distinctPages": 1, "distinctTokens": 1, "occurrences": 107, "distinctUnknownPrefixed": 1 }
}

A product's own ed-* elements are not Eddie usage

The ed- prefix means "in Eddie's catalog". A product that defines its own custom elements under it — Eddie Slides shipped fourteen, ed-slide, ed-robot, ed-r-site-frame among them — used to have them counted as Eddie components, and the Brain could not tell them from the real thing (#2192).

The reporter now ships a snapshot of the catalog (dist/known-tags.json, generated at build time from the Brain's graph for the Eddie release it was published with). An ed-* / ed-r-* / ed-p-* tag outside it goes to usage.unknownPrefixed instead of a usage bucket, counts as zero Eddie usage, and is left out of totals.occurrences. The Brain surfaces the bucket on the product's roll-up and in eddie_get_activity's unrecognised stats, and eddie_validate_file warns on the same tags in source.

Two readings of an entry, and the fix for each: it is the product's element, so give it the product's own prefix (es- for Eddie Slides) — or it is Eddie's and newer than the installed reporter, so update the reporter. A catalog of your own can be passed as knownTags to scanUsage / buildReport; a reporter running from source without a built snapshot omits the field, and the Brain partitions that report by its own catalog instead.

The bigger picture

This reporter is the first leg of a two-way system↔product relationship. See docs/VISION.md for the full map of where this goes — usage-weighted health, deprecation radar, drift nudges, a public adoption dashboard, and closing the loop back into governance.

版本与发布记录

@brad-frost-web/eddie-reporter 共发布 39 个版本,首次发布于 2026/07/21;过去 12 个月发布了 39 个版本。

版本发布日期距今
0.73.0latest2026/11/045 天前
0.72.12026/10/2713 天前
0.72.02026/10/2614 天前
0.71.02026/10/2020 天前
0.70.02026/10/011 个月前
0.69.02026/10/011 个月前

关于 @brad-frost-web/eddie-reporter 的常见问题

@brad-frost-web/eddie-reporter 是什么?

The Eddie-reporter — a zero-dependency usage reporter installed on downstream Eddie products. It statically scans a product for Eddie asset usage (components, recipes, pages, tokens) and reports the activity back to Eddie's Brain, so adoption and activity

如何安装 @brad-frost-web/eddie-reporter?

在项目目录运行 npm install @brad-frost-web/eddie-reporter,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 eddie-report,可以用 npx eddie-report 直接运行。

@brad-frost-web/eddie-reporter 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@brad-frost-web/eddie-reporter 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@brad-frost-web/eddie-reporter 可以商用吗?

@brad-frost-web/eddie-reporter 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@brad-frost-web/eddie-reporter 的下载量有多少?

根据 npm 官方下载统计,@brad-frost-web/eddie-reporter 在 2026/10/09 – 2026/11/07 这 30 天内被下载 1,693 次,日均约 56 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@brad-frost-web/eddie-reporter 还在维护吗?

最新版本 0.73.0 发布于 2026/11/04(5 天前);至今共发布 39 个版本,其中过去 12 个月发布了 39 个;首次发布于 2026/07/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。