{"_id":"@plugdash/enrichkit","_rev":"5-be45af470bb2fcf61c8ae7738a9e2dfc","name":"@plugdash/enrichkit","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@plugdash/enrichkit","version":"0.1.0","keywords":["emdash","emdash-plugin","enrichkit","ai","llm","metadata","summary","auto-tagging"],"license":"MIT","_id":"@plugdash/enrichkit@0.1.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"d771386235a13660f76e25a7d8001114fdc7282a","tarball":"https://registry.npmjs.org/@plugdash/enrichkit/-/enrichkit-0.1.0.tgz","fileCount":15,"integrity":"sha512-KefkC6ZVKU2++hPpJ0R8Yy2CNy+sRehQBkKwohcH+KYT+32v/T5HpKUPlHHE4GvITp6ob2ZCsNxNYOaULWfkjQ==","signatures":[{"sig":"MEYCIQC4UVh3doienhyX0d4oirL4XGT12tgXMW860Blz6tf7OwIhAIPfYK6TTjqHyGASAGIbKTLfNjJFfb3XK2dJA9U53XmB","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90152},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./enrich-logic":{"types":"./dist/enrich-logic.d.mts","import":"./dist/enrich-logic.mjs"}},"gitHead":"b25b6667c81891ddea3b04b2ef9a675e4697ddf2","scripts":{"lint":"oxlint .","test":"vitest run","build":"tsdown src/index.ts --dts.eager && tsdown src/sandbox-entry.ts --dts.eager --no-clean && tsdown src/enrich-logic.ts --dts.eager --no-clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"abhinav061","email":"abhinav061@gmail.com"},"deprecated":"broken publish, use 0.1.1","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/enrichkit"},"_npmVersion":"12.1.0","description":"Enriches published EmDash content with an AI summary, key topics, auto-tags, reading level, and a tweet draft","directories":{},"_nodeVersion":"24.21.0","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"workspace:*","@plugdash/testing":"workspace:*"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/enrichkit_0.1.0_1790399754400_0.6603760006614843","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@plugdash/enrichkit","version":"0.1.1","keywords":["emdash","emdash-plugin","enrichkit","ai","llm","metadata","summary","auto-tagging"],"license":"MIT","_id":"@plugdash/enrichkit@0.1.1","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"2ae225ae5fae2e6b144ac9df55ed63732ba39102","tarball":"https://registry.npmjs.org/@plugdash/enrichkit/-/enrichkit-0.1.1.tgz","fileCount":15,"integrity":"sha512-JpO0UiztuNG47aRSGb1m4M0auBKVAeHeO6EFKLKa/WNjSic71RJIUA6/tylKqoTAMbCU2nd+YDjuxVn47BUuTA==","signatures":[{"sig":"MEQCIFjGxkjVMYWNR+85vbhsWWZQDly8ialsOB2V9dLYgaQ+AiAsuRjlPzeR9kbGnmky0EoCA7Q7aQBeQJUyjY/bHwt5Ug==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQC14Y6kozELX9oNLMOiuY6Ct8JdkuDUjfnmtVNs9ZXrKQIgMAOgNKxSL5h2k+VWaaz7CdgN5QOi5PGOvMVRHmtiRAQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fenrichkit@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":131212},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-enrichkit-0.1.1.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./enrich-logic":{"types":"./dist/enrich-logic.d.mts","import":"./dist/enrich-logic.mjs"}},"scripts":{"lint":"oxlint .","test":"vitest run","build":"tsdown src/index.ts --dts.eager && tsdown src/sandbox-entry.ts --dts.eager --no-clean && tsdown src/enrich-logic.ts --dts.eager --no-clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:cdcfb6e4-7ec5-4981-bbf0-05b644252cd2"}},"_resolved":"/tmp/dd47b144f260909d4e6b10767e63be02/plugdash-enrichkit-0.1.1.tgz","_integrity":"sha512-JpO0UiztuNG47aRSGb1m4M0auBKVAeHeO6EFKLKa/WNjSic71RJIUA6/tylKqoTAMbCU2nd+YDjuxVn47BUuTA==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/enrichkit"},"_npmVersion":"11.5.1","description":"Enriches published EmDash content with an AI summary, key topics, auto-tags, reading level, and a tweet draft","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/enrichkit_0.1.1_1790404195298_0.7053911478353632","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@plugdash/enrichkit","version":"0.1.2","keywords":["emdash","emdash-plugin","enrichkit","ai","llm","metadata","summary","auto-tagging"],"license":"MIT","_id":"@plugdash/enrichkit@0.1.2","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"673d78300278de74c8c5e87e8285cff15c245a8a","tarball":"https://registry.npmjs.org/@plugdash/enrichkit/-/enrichkit-0.1.2.tgz","fileCount":15,"integrity":"sha512-YTDm82DcI4VH7IovR/lfNC8/Vaz8UhJDILX9VJOGZXHfg3xWQUtRRlyZ0COwAWPjts09HN8JaY05EOAaxohyWQ==","signatures":[{"sig":"MEUCIDdirVbao7RK2nnbjlhJZPsCYxNlB7Yhb8klOiUBAFamAiEA2CXKLBM8UlUuC1Qk2mNaGPgVyOo/aB+OmnDYWHQ2EBg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQC+OhmAXKm+Fl39DgJJpBOEKfEv0Y5dzHwlAwbwvgbY9QIhAOfw7SknefCFp5v94obPt/sOa9Bk9ZIRcoiFT19iJig0","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fenrichkit@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":131359},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-enrichkit-0.1.2.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./enrich-logic":{"types":"./dist/enrich-logic.d.mts","import":"./dist/enrich-logic.mjs"}},"scripts":{"lint":"oxlint .","test":"vitest run","build":"tsdown src/index.ts --dts.eager && tsdown src/sandbox-entry.ts --dts.eager --no-clean && tsdown src/enrich-logic.ts --dts.eager --no-clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:cdcfb6e4-7ec5-4981-bbf0-05b644252cd2"}},"_resolved":"/tmp/bd8d45ddf6286cf967c9e399f19eb660/plugdash-enrichkit-0.1.2.tgz","_integrity":"sha512-YTDm82DcI4VH7IovR/lfNC8/Vaz8UhJDILX9VJOGZXHfg3xWQUtRRlyZ0COwAWPjts09HN8JaY05EOAaxohyWQ==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/enrichkit"},"_npmVersion":"11.5.1","description":"Enriches published EmDash content with an AI summary, key topics, auto-tags, reading level, and a tweet draft","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/enrichkit_0.1.2_1790409483489_0.12206967977565619","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"_id":"@plugdash/enrichkit@0.2.0","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"baf9faa236690e5d4d908862a284c7c4f1f03bfa","tarball":"https://registry.npmjs.org/@plugdash/enrichkit/-/enrichkit-0.2.0.tgz","fileCount":7,"integrity":"sha512-9dbeEf4J298hpNvEYXiEh18L5nT6wGdpt59H+UtWqhhdIWwJTBSc3/vWi3pr9mawPRxrDYudSWcCkl7Wlmz7RA==","signatures":[{"sig":"MEUCIBsaJu+mRceWDXLmg8Vl7xwnzJwIla5nDnZ9RpfSejXyAiEAuCLB0P1WP3sdSI+zQaP9XET9i+4euSms1i2mz7GNfzI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIACVqCY7zfrGAheGvUdldvlXMxOzzAJgL/bbmKEH0K0VAiEA1wAHzNeJKgLggPuMFFCHfSma5m6f0mV74DzMrLAZ5ns="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fenrichkit@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":76730},"main":"./dist/index.mjs","name":"@plugdash/enrichkit","type":"module","_from":"file:plugdash-enrichkit-0.2.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"}},"license":"MIT","scripts":{"lint":"oxlint .","test":"vitest run","build":"tsdown src/index.ts --dts.eager","typecheck":"tsc --noEmit"},"version":"0.2.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"cdcfb6e4-7ec5-4981-bbf0-05b644252cd2"}},"homepage":"https://github.com/plugdash/plugdash#readme","keywords":["ai","auto-tagging","emdash","emdash-plugin","enrichkit","llm","metadata","summary"],"_resolved":"/tmp/adde2ad6063d273c2673567e0057dbb5/plugdash-enrichkit-0.2.0.tgz","_integrity":"sha512-9dbeEf4J298hpNvEYXiEh18L5nT6wGdpt59H+UtWqhhdIWwJTBSc3/vWi3pr9mawPRxrDYudSWcCkl7Wlmz7RA==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/enrichkit"},"_npmVersion":"11.5.1","description":"Adds an AI summary, topics, tags and a tweet draft to EmDash posts with one LLM call per changed publish","directories":{},"maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"_nodeVersion":"22.23.3","_hasShrinkwrap":false,"devDependencies":{"emdash":"^1.0.1","vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=1.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/enrichkit_0.2.0_1790936765985_0.6000801105465978"}}},"time":{"created":"2026-09-26T05:15:54.175Z","modified":"2026-10-02T10:26:06.427Z","0.1.0":"2026-09-26T05:15:54.549Z","0.1.1":"2026-09-26T06:29:55.382Z","0.1.2":"2026-09-26T07:58:03.566Z","0.2.0":"2026-10-02T10:26:06.064Z"},"bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"license":"MIT","homepage":"https://github.com/plugdash/plugdash#readme","keywords":["ai","auto-tagging","emdash","emdash-plugin","enrichkit","llm","metadata","summary"],"repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/enrichkit"},"description":"Adds an AI summary, topics, tags and a tweet draft to EmDash posts with one LLM call per changed publish","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"readme":"# @plugdash/enrichkit\n\n**@plugdash/enrichkit** - writing a summary, tags and a tweet for every post is the chore nobody does. On publish it makes one LLM call and stores a summary, topics, tags, a reading level and a tweet draft, and fills an empty SEO description with the summary. Only on EmDash - the result sits next to the post, ready for an agent on the EmDash MCP server to pick up.\n\n## What it costs\n\nEnrichkit is built to call the provider as rarely as possible:\n\n- **Publish only.** It listens to `content:afterPublish`. Autosaves and draft saves never call the provider, even on a post that is already live.\n- **Unchanged content is free.** Each result stores a SHA-256 hash of the model, the enrichment flags, the title and the body text. Republishing the same text skips the call.\n- **One call, no retries.** The reply is structured output (a forced tool call on Anthropic, a strict JSON schema on OpenAI). If the reply still can't be read, a 429 comes back, or the request times out, it logs once and stops. The next changed publish tries again.\n- **Short posts are skipped.** Under 100 words, no call.\n- **Body is capped** at 12,000 characters.\n\nWith the default `claude-haiku-4-5`, a typical post costs well under a cent per changed publish.\n\n## Install\n\n```bash\npnpm add @plugdash/enrichkit\n```\n\n```js\n// astro.config.mjs\nimport { defineConfig } from \"astro/config\";\nimport emdash from \"emdash/astro\";\nimport { enrichkitPlugin } from \"@plugdash/enrichkit\";\n\nexport default defineConfig({\n\tintegrations: [\n\t\temdash({\n\t\t\tplugins: [enrichkitPlugin({ provider: \"anthropic\" })],\n\t\t}),\n\t],\n});\n```\n\n## Set the API key\n\nThe key is an encrypted plugin setting, so it never lands in your build output.\n\n1. Generate an encryption key and set `EMDASH_ENCRYPTION_KEY` in the server's process environment. Export it in the shell that runs `astro dev` or `node dist/server/entry.mjs` (on Cloudflare, add it as a Worker secret). A `.env` file alone was not picked up by `astro dev` in testing.\n\n   ```bash\n   pnpm exec emdash secrets generate\n   ```\n\n   Without it, saving the key fails with `PLUGIN_SETTING_ENCRYPTION_KEY_MISSING`.\n\n2. In the admin, open **Plugins > enrichkit > Settings** and paste your Anthropic or OpenAI key into **API key**.\n\nYou can also pass `apiKey` in the options. That works, but the key ends up in plain text in the build, and enrichkit logs a one-time warning recommending the admin setting. A key in the admin wins over the option.\n\n## Where results go\n\n- **KV `result:<entry id>`**, one row per entry: `{ summary, topics, tags, readingLevel, tweet, model, generatedAt, hash }` plus `collection` and `title`. Only enabled fields are present.\n- **`seo.description`**, when `writeSeoDescription` is on and the description is empty. This is a seo-only update, so it goes live right away without creating a draft. An author's own description is never overwritten. Collections without SEO are skipped.\n- **The admin page** at **Plugins > Enrichkit** shows the latest result for each enriched entry, with a **Regenerate** button that forces one new call.\n\n## Options\n\n| Option                     | Type                      | Default                                                    | Description                                          |\n| -------------------------- | ------------------------- | ---------------------------------------------------------- | ---------------------------------------------------- |\n| `provider`                 | `\"anthropic\" \\| \"openai\"` | `\"anthropic\"`                                              | Which API to call. Also sets `allowedHosts`.         |\n| `model`                    | `string`                  | `claude-haiku-4-5` / `gpt-4o-mini`                         | Model id                                             |\n| `enrichments.summary`      | `boolean`                 | `true`                                                     | 2-3 sentence summary                                 |\n| `enrichments.keyTopics`    | `boolean`                 | `true`                                                     | 3-5 topics                                           |\n| `enrichments.autoTags`     | `boolean`                 | `true`                                                     | 3-8 lowercase tags                                   |\n| `enrichments.readingLevel` | `boolean`                 | `false`                                                    | Estimated grade level                                |\n| `enrichments.tweetDraft`   | `boolean`                 | `true`                                                     | Tweet under 280 characters (longer ones are dropped) |\n| `field`                    | `string`                  | `content`, then `body`, then the first Portable Text field | Which field holds the body                           |\n| `writeSeoDescription`      | `boolean`                 | `true`                                                     | Fill an empty `seo.description` with the summary     |\n| `timeoutMs`                | `number`                  | `30000`                                                    | Abort the provider request after this long           |\n| `apiKey`                   | `string`                  | none                                                       | Fallback key. Prefer the admin setting.              |\n\n## Troubleshooting\n\nAll log lines are under the `enrichkit` plugin.\n\n- `calling provider` - one line per paid call. Count these to see what you are spending.\n- `content unchanged since last enrichment, skipping` - the hash matched, no call.\n- `host api.anthropic.com not in allowedHosts; set provider in astro.config.mjs or add it to allowedHosts` - the `provider` option doesn't match the API it is calling.\n- `no API key: ...` - set the key as described above.\n\n## What it does not do\n\n- Does not run on autosave, draft save, schedule or unpublish.\n- Does not retry. Not on a bad reply, not on 429, not on timeout.\n- Does not write to `data.metadata` (0.1.x did). Read results from KV or from `seo.description`.\n- Does not fail a publish. Every failure is logged and skipped.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}