@odla-ai/blog 0.0.4 → 0.0.5

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 CHANGED
@@ -1,13 +1,13 @@
1
1
  # @odla-ai/blog
2
2
 
3
- > ⚠️ **Experimentalan agentic-coding experiment.** This package is built and
4
- > operated by autonomous coding agents as an experiment in agentic loops. APIs
5
- > change without notice and nothing here is production-hardened. **Use at your
6
- > own risk.**
3
+ > ⚠️ **Early access pre-1.0.** Agents work from bounded runbooks; humans
4
+ > approve credentials, production changes, releases, and merges. APIs and exact
5
+ > package availability can change. Review the documented guarantees and
6
+ > limitations; this software is MIT-licensed and provided without warranty.
7
7
 
8
8
  Minimal-dependency, static-first blogging platform. A site is a directory of
9
9
  markdown plus one JSON config; `build()` emits a fully static site that works on
10
- GitHub Pages or Cloudflare. When [odla-db](https://github.com/odla-ai/odla-db) is
10
+ GitHub Pages or Cloudflare. When [odla-db](https://www.npmjs.com/package/@odla-ai/db) is
11
11
  configured, interactive features (sign-in, comments, likes) light up as a
12
12
  progressive layer — the static site never depends on it.
13
13
 
@@ -43,19 +43,21 @@ Pick one with `"theme": "salt"` in `blog.config.json`. Themes ship in the
43
43
  design system); every built site also gets ui's class-scoped component layer
44
44
  (`assets/odla-ui.css` — buttons, form fields, cards, …) theme-matched via the
45
45
  theme's `ui.css` token aliases. Override any theme file by placing a
46
- same-named file in your site's `theme/` directory. Preview all four against
47
- the example site with `npm run preview` (from the monorepo root).
46
+ same-named file in your site's `theme/` directory. Build your site with the
47
+ package API and preview the emitted static directory with your usual local
48
+ static server.
48
49
 
49
50
  ## Deploy (Cloudflare)
50
51
 
51
52
  `build()` emits a plain static directory; serve it from a Worker assets
52
53
  binding — `{ "assets": { "directory": "./dist-site" } }` in `wrangler.jsonc`,
53
54
  build before every deploy. Add a `main` worker script only when you want
54
- `/api/*` routes next to the static site (see `examples/demo-app` in the
55
- odla-ai monorepo for the full pattern, including odla-db + o11y wiring).
55
+ `/api/*` routes next to the static site; the public platform manual describes
56
+ how to combine the assets binding with odla-db and o11y.
56
57
 
57
58
  ## Status
58
59
 
59
- Early. The build pipeline, themes, and example site work; CLI (`init`/`new`/`dev`/
60
- `check`), feeds, search, deploy scaffolding, and the odla-db islands are in
61
- progress see `PLAN.md` at the repo root.
60
+ Early. The build pipeline and themes work; CLI (`init`/`new`/`dev`/`check`),
61
+ feeds, search, deploy scaffolding, and the odla-db islands are in progress.
62
+ Track supported behavior in the public docs and the package's shipped
63
+ `llms.txt` rather than relying on internal planning files.
package/llms.txt CHANGED
@@ -1,8 +1,11 @@
1
- # @odla-ai/blog — agent reference (llms.txt)
1
+ # @odla-ai/blog — LLM context
2
2
 
3
- > EXPERIMENTAL an agentic-coding experiment. This package is built and operated
4
- > by autonomous coding agents as an experiment in agentic loops. APIs change
5
- > without notice and nothing here is production-hardened. Use at your own risk.
3
+ > Minimal-dependency, static-first blogging platform. Files in, site out; odla-db lights up interactivity when configured.
4
+
5
+ > EARLY ACCESS pre-1.0. Agents work from bounded runbooks; humans approve
6
+ > credentials, production changes, releases, and merges. APIs and exact package
7
+ > availability can change. Review the documented guarantees and limitations;
8
+ > this software is MIT-licensed and provided without warranty.
6
9
 
7
10
  This file ships in the npm package so an agent working in a *site* repo can
8
11
  operate the platform from `node_modules/@odla-ai/blog/llms.txt` alone. The
@@ -176,7 +179,7 @@ to the theme's CSS (after the `ui.css` aliases). Post URLs live under
176
179
 
177
180
  The output is a plain static directory — serve it from a Worker's assets
178
181
  binding (this is what `blog init --deploy cloudflare` will generate; a
179
- working example lives at `examples/demo-app` in the odla-ai monorepo):
182
+ the public platform manual documents the same Worker + assets composition):
180
183
 
181
184
  ```js
182
185
  // build-site.mjs — run before every deploy
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@odla-ai/blog",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Minimal-dependency, static-first blogging platform. Files in, site out; odla-db lights up interactivity when configured.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "homepage": "https://odla.ai/docs/packages/blog",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/cory/odla-ai.git",
11
+ "directory": "packages/blog"
12
+ },
7
13
  "exports": {
8
14
  ".": "./src/index.js"
9
15
  },
@@ -14,7 +20,8 @@
14
20
  "config.schema.json"
15
21
  ],
16
22
  "publishConfig": {
17
- "access": "public"
23
+ "access": "public",
24
+ "provenance": false
18
25
  },
19
26
  "engines": {
20
27
  "node": ">=20"
@@ -22,10 +29,12 @@
22
29
  "scripts": {
23
30
  "preview": "node scripts/preview.mjs",
24
31
  "test": "node --test --test-reporter=spec",
25
- "coverage": "c8 --src=src --reporter=text --reporter=html node --test"
32
+ "coverage": "c8 --src=src --reporter=text --reporter=html node --test",
33
+ "gen:llms": "node ../../scripts/gen-llms.mjs",
34
+ "prepublishOnly": "npm run gen:llms && npm test"
26
35
  },
27
36
  "dependencies": {
28
- "@odla-ai/ui": "^0.1.0",
37
+ "@odla-ai/ui": "^0.2.2",
29
38
  "highlight.js": "^11.11.0",
30
39
  "marked": "^16.0.0",
31
40
  "yaml": "^2.8.0"
package/src/markdown.js CHANGED
@@ -31,12 +31,21 @@ export function slugify(text) {
31
31
  // is synchronous, so module-level state is safe.
32
32
  let footnoteNumbers = new Map(); // id → number, in first-reference order
33
33
  let footnoteBodies = new Map(); // id → rendered inline HTML
34
+ let headingIds = new Map(); // base slug → occurrences in this document
35
+
36
+ function uniqueHeadingId(text) {
37
+ const base = slugify(text);
38
+ const count = (headingIds.get(base) ?? 0) + 1;
39
+ headingIds.set(base, count);
40
+ return count === 1 ? base : `${base}-${count}`;
41
+ }
34
42
 
35
43
  const footnotes = {
36
44
  hooks: {
37
45
  preprocess(markdown) {
38
46
  footnoteNumbers = new Map();
39
47
  footnoteBodies = new Map();
48
+ headingIds = new Map();
40
49
  // Number by first reference (definitions like "[^id]:" excluded).
41
50
  for (const match of markdown.matchAll(/\[\^([^\]\s]+)\](?!:)/g)) {
42
51
  if (!footnoteNumbers.has(match[1])) {
@@ -135,7 +144,7 @@ const marked = new Marked(
135
144
  },
136
145
  heading({ tokens, depth }) {
137
146
  const text = this.parser.parseInline(tokens);
138
- const id = slugify(text);
147
+ const id = uniqueHeadingId(text);
139
148
  return `<h${depth} id="${id}">${text}</h${depth}>\n`;
140
149
  },
141
150
  },