@karaoke-cms/enrich 0.9.3 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -27
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,48 +1,36 @@
|
|
|
1
1
|
# @karaoke-cms/enrich
|
|
2
2
|
|
|
3
|
-
AI enrichment pipeline for karaoke-cms. Reads published vault content and writes AI-generated metadata (
|
|
3
|
+
AI enrichment pipeline for karaoke-cms. Reads published vault content and writes AI-generated metadata (`reading_time`, `tags`, `description`, `related`) back into frontmatter.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# .githooks/pre-commit
|
|
11
|
-
node scripts/enrich.js --staged
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Or manually against the full vault:
|
|
7
|
+
Runs as a pre-commit hook — not in CI:
|
|
15
8
|
|
|
16
9
|
```bash
|
|
10
|
+
# triggered automatically on git commit
|
|
11
|
+
# or run manually:
|
|
17
12
|
node scripts/enrich.js
|
|
18
13
|
```
|
|
19
14
|
|
|
20
|
-
Requires `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` in the environment
|
|
15
|
+
Requires `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` in the environment or `.env`.
|
|
21
16
|
|
|
22
17
|
## What it does
|
|
23
18
|
|
|
24
|
-
For each published Markdown file
|
|
25
|
-
|
|
26
|
-
1. **Reading time** — counts words, estimates minutes at 200 wpm, writes `reading_time` to frontmatter
|
|
27
|
-
2. **Tags** — asks the AI to suggest 3–5 tags; writes `tags` array to frontmatter
|
|
28
|
-
3. **Description** — asks the AI for a one-sentence summary; writes `description` to frontmatter
|
|
29
|
-
4. **Related posts** — computes overlap between tag arrays across all posts; writes `related` array (slugs) to frontmatter
|
|
19
|
+
For each published Markdown file that hasn't been enriched yet (or whose body has changed):
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
1. **Reading time** — counts words, writes `reading_time` in minutes
|
|
22
|
+
2. **Tags** — asks the AI for 3–5 tags, writes `tags` array
|
|
23
|
+
3. **Description** — asks the AI for a one-sentence summary, writes `description`
|
|
24
|
+
4. **Related posts** — computes tag overlap across all posts, writes `related` (slugs)
|
|
32
25
|
|
|
33
|
-
Results are cached in `.enrich-cache.json` (gitignored) — files are skipped
|
|
26
|
+
Results are cached in `.enrich-cache.json` (gitignored) — unchanged files are skipped. A per-run cap prevents runaway API costs.
|
|
34
27
|
|
|
35
28
|
**Privacy gate**: only processes files with `publish: true`. Private vault notes are never sent to an AI provider.
|
|
36
29
|
|
|
37
30
|
## Status
|
|
38
31
|
|
|
39
|
-
**Stub** — the package
|
|
40
|
-
|
|
41
|
-
The canonical implementation is at `apps/template/scripts/enrich.js` in this monorepo and at `scripts/enrich.js` in scaffolded projects.
|
|
32
|
+
**Stub** — the package placeholder is installed by scaffolded projects. The implementation lives at `scripts/enrich.js` in your project directory.
|
|
42
33
|
|
|
43
|
-
##
|
|
34
|
+
## What's new in 0.9.5
|
|
44
35
|
|
|
45
|
-
-
|
|
46
|
-
- Enriched fields (`reading_time`, `tags`, `description`, `related`) are consumed by theme components: reading time appears on post cards, tags power the `/tags` routes, related posts appear in the post sidebar.
|
|
47
|
-
- The pre-commit hook means enrichment runs automatically on staged content — authors never need to think about it.
|
|
48
|
-
- Enrichment is disabled in CI by default (`ENRICH_ENABLED` env var). It runs locally on the author's machine, so enriched frontmatter is committed alongside the content.
|
|
36
|
+
No user-facing changes in this release — version bumped for lockstep with the monorepo.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karaoke-cms/enrich",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.6",
|
|
5
5
|
"description": "AI enrichment pipeline for karaoke-cms",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"astro",
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
"openai": ">=6.0.0"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"test": "echo \"No tests yet — source lives in apps/
|
|
17
|
+
"test": "echo \"No tests yet — source lives in apps/website/scripts/\""
|
|
18
18
|
}
|
|
19
19
|
}
|