Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/emdash-1-0-1-floor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@eisbachcode/emdash-plugin-analytics": minor
---

Requires EmDash 1.0.1 or later. Both the peer dependency and the manifest's `env:emdash` requirement are now `>=1.0.1`, so EmDash refuses to install this version from the registry on an older site.

On EmDash 0.39 to 0.42, stay on 0.2.x, which keeps working there. To move to this version, update EmDash to 1.0.1 first, then the plugin. With pnpm, installing it on an older site only warns about the peer dependency; with npm 7 or later, the install fails with `ERESOLVE`. An existing `^0.2.x` range never resolves to 0.3.0, so no install moves on its own.

The plugin's behaviour and stored data are the same as in 0.2.4.
2 changes: 1 addition & 1 deletion .github/workflows/compat-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
strategy:
fail-fast: false
matrix:
emdash: [0.39.0, 0.39.1, 0.40.0, 0.40.1, 0.41.0, 0.42.0, "1.0.1:0.2.6"]
emdash: [1.0.1]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
Expand Down
27 changes: 12 additions & 15 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ Keep `emdash-plugin.jsonc` aligned with the runtime implementation, declare ever

## Toolchain

`emdash` is a peer with a floor and no ceiling (`>=0.39.0`, the same as
`env:emdash` in the manifest); the dev dependency stays below the next
major until the toolchain is moved on purpose. Built with
`@emdash-cms/plugin-cli@0.12.0`, `@emdash-cms/plugin-test@0.2.0` and
`@emdash-cms/blocks@0.39.0`; `scripts/compat-matrix.sh` runs the suite
`emdash` is a peer with a floor and no ceiling (`>=1.0.1`, the same as
`env:emdash` in the manifest). Never write the floor as `>=1.0.0` or
`^1.0.0`: npm carries an accidental, deprecated `emdash@1.0.0` published
in April 2026, five months before the real 1.0. The dev dependency stays
below the next major until the toolchain is moved on purpose. Built with
`@emdash-cms/plugin-cli@0.13.1`, `@emdash-cms/plugin-test@0.2.6` and
`@emdash-cms/blocks@1.0.1`; `scripts/compat-matrix.sh` runs the suite
against later EmDash releases. A plain `pnpm install` is enough.

## Two builds
Expand Down Expand Up @@ -42,11 +44,10 @@ against later EmDash releases. A plain `pnpm install` is enough.
after any change that adds a `ctx` call.
- **Block Kit keys are snake_case.** Use the constructors in
`src/ui/blocks.ts`; the renderer silently ignores camelCase.
- `routeCtx.ui` (locale, direction) reaches the widget and the pages in
both install modes from EmDash 1.0.1; before that, a `plugins: []`
install gets it undefined there. Read `routeCtx.ui?.locale` and fall back
to English; never return empty blocks when it is missing. The editor panel
gets it in both modes on every version, with `ui.entry`.
- `routeCtx.ui` (locale, direction) reaches the widget, the pages and the
editor panel in both install modes; the panel also gets `ui.entry`. Still
read `routeCtx.ui?.locale` and fall back to English; never return empty
blocks when it is missing.
- **MCP schemas never reach the runtime.** `emdash-plugin build` strips
the `mcp` property of `src/plugin.ts` from the bundle and writes the zod
schemas into the manifest as JSON Schema. `src/tools/declare.ts` is
Expand All @@ -59,10 +60,6 @@ against later EmDash releases. A plain `pnpm install` is enough.
does not match, so a loader's result and its declared output have to
agree key for key. `tests/tools.test.ts` checks each answer against the
schema the build wrote.
- **In `plugins: []`, MCP tools need EmDash 0.42.0 or later.** Older
in-process loaders read tools from the runtime module, where the build
removes them, so a `plugins: []` install on 0.39 to 0.41 lists none.
Sandboxed installs have them on every supported version.
- **Block Kit keeps no state.** Anything a page needs to remember between
interactions travels in an `action_id`, a button `value` or a table
cursor (see `src/ui/content.ts`).
Expand All @@ -85,7 +82,7 @@ pnpm install
pnpm typecheck
pnpm test # emdash-plugin validate, then vitest
pnpm build
./scripts/compat-matrix.sh 0.39.0 0.39.1 0.40.0 0.40.1 0.41.0 0.42.0 1.0.1:0.2.6 # the suite against other EmDash releases
./scripts/compat-matrix.sh 1.0.1 # the suite against other EmDash releases
```

## Releases
Expand Down
24 changes: 6 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ entry that earned them rather than to a URL string.
> **Status: early releases.** Cloudflare Web Analytics plus demo data: a
> dashboard widget, an Analytics page with a setup check, a per-entry page,
> an Analytics panel in the entry editor and four read-only MCP tools.
> Tested on EmDash 0.39 to 1.0. See "Not in this version".
> Needs EmDash 1.0.1 or later. See "Not in this version".

The screenshots show demo data on a site made from EmDash's blog template.

Expand Down Expand Up @@ -136,17 +136,11 @@ To use them:
After an update that changes a tool, EmDash stops serving the tools until
they are approved again, but the switch stays on. Turn it off and on.

**Registered in `plugins: []`, the tools need EmDash 0.42 or later.** On
0.39 to 0.41, EmDash's in-process loader looks for tool declarations only in
the plugin's runtime module, where the plugin build leaves them out, so such
a site gets none. Under `sandboxed: []` or installed from the registry, the
tools work on every EmDash version this plugin supports.

## What you need

| | |
|---|---|
| EmDash | `>=0.39.0` — the plugin uses the content-join APIs (`ctx.schema`, `getPublicUrl`, `ctx.settings`) added in that release |
| EmDash | `>=1.0.1`, the first stable release. Sites on 0.x keep the plugin version they have; 0.2.x supports EmDash 0.39 and later |
| A Cloudflare account | with Web Analytics enabled for the site |
| An API token | permission **Account → Account Analytics → Read** |
| `EMDASH_ENCRYPTION_KEY` | set on the site, or the API token cannot be stored (`npx emdash secrets generate`) |
Expand Down Expand Up @@ -336,16 +330,10 @@ English and German, following the administrator's admin language. Any other admi
language gets English. Number, date and country names follow the same
language, so a German admin reads "1.234", "18.09.2026" and "Deutschland".

Two limits come from EmDash, not from this plugin:

- **Before EmDash 1.0.1, the widget and the pages stay English in a
`plugins: []` install**, because EmDash passes such a plugin the admin
language there only from 1.0.1 on. Installed from the registry, the
plugin gets it on earlier versions too. The editor panel gets it either
way.
- **Labels declared in the manifest stay English everywhere:** the sidebar
entry, the widget title and the settings form. EmDash renders those
itself and does not read plugin translations.
One limit comes from EmDash, not from this plugin: **labels declared in
the manifest stay English everywhere**, that is the sidebar entry, the
widget title and the settings form. EmDash renders those itself and does
not read plugin translations.

## Privacy and data residency

Expand Down
2 changes: 1 addition & 1 deletion emdash-plugin.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// break. The manifest has no advisory "tested up to" field to express
// caution without blocking, so the tested range belongs in the README.
"release": {
"requires": { "env:emdash": ">=0.39.0" },
"requires": { "env:emdash": ">=1.0.1" },
"artifacts": {
"screenshots": [
{ "file": "images/analytics-page.png", "lang": "en" },
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
"node": ">=22.16"
},
"peerDependencies": {
"emdash": ">=0.39.0"
"emdash": ">=1.0.1"
},
"devDependencies": {
"@changesets/cli": "^3.0.3",
"@emdash-cms/blocks": "0.39.0",
"@emdash-cms/plugin-cli": "0.12.0",
"@emdash-cms/plugin-test": "0.2.0",
"emdash": ">=0.39.0 <1.0.0",
"@emdash-cms/blocks": "1.0.1",
"@emdash-cms/plugin-cli": "0.13.1",
"@emdash-cms/plugin-test": "0.2.6",
"emdash": "^1.0.1",
"tsdown": "0.20.3",
"typescript": "^5.9.0",
"vitest": "^4.1.0",
Expand Down
Loading
Loading