@contentrain/skills 0.5.1 → 0.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/skills",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "license": "MIT",
5
5
  "description": "AI agent skills for Contentrain — workflow procedures, framework integration guides",
6
6
  "type": "module",
@@ -61,7 +61,7 @@
61
61
  "tsdown": "^0.21.0",
62
62
  "typescript": "^5.7.0",
63
63
  "vitest": "^3.0.0",
64
- "@contentrain/mcp": "1.5.1"
64
+ "@contentrain/mcp": "1.6.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "tsdown src/index.ts --format esm,cjs --dts",
@@ -271,7 +271,7 @@ Metadata files track governance information. They are system-managed -- agents N
271
271
  "status": "published",
272
272
  "source": "agent",
273
273
  "updated_by": "claude",
274
- "approved_by": "ahmet@contentrain.io",
274
+ "approved_by": "info@contentrain.io",
275
275
  "version": "1"
276
276
  }
277
277
  ```
@@ -10,6 +10,18 @@ Follow these guidelines when populating image, video, or file fields in any cont
10
10
 
11
11
  ---
12
12
 
13
+ ## Storage & Reference Models
14
+
15
+ Media references are stored in one of two models. Identify which one the project uses before populating image, video, or file fields. The asset rules below (dimensions, formats, size limits, naming) apply to **both**; only the **Asset Organization** section (paths under `assets_path`, relative references) is specific to the local-file model.
16
+
17
+ 1. **Local file model (default / OSS).** Media lives on disk under `config.json > assets_path` (default `.contentrain/assets/`) and is referenced by a **relative path from the project root** (e.g. `.contentrain/assets/blog/hero.webp`). To turn relative paths into URLs at read time, set `config.json > cdn.url` (or `contentrain generate --cdnBaseUrl <base>`) and use the `media()` resolver baked into the `@contentrain/query` generated client — `media('media/...') → {cdn.url}/{path}`.
18
+
19
+ 2. **Studio CDN model.** Media lives in the Studio CDN/object store and is referenced by a relative storage path (`media/...`) returned by the media library. Pass either that `media/...` path or its URL to `contentrain_content_save`: in **cloud mode** the value is **automatically normalized to an absolute public delivery URL** on save (`{base}/{path}`), in both media fields and markdown bodies, so the committed content renders in a browser anywhere with no SDK. In **local mode** the relative path is kept verbatim. The rewrite is idempotent and never touches external URLs (`http(s)://`, `//`, `data:`) or already-absolute delivery URLs — so for external images (a CDN or Unsplash URL), just save the URL directly.
20
+
21
+ Never hand-build delivery URLs or guess the CDN base. Save the path or URL the media library gives you; the platform resolves it.
22
+
23
+ ---
24
+
13
25
  ## Image Dimensions (Recommended)
14
26
 
15
27
  1. Use these standard dimensions unless the project's `context.json` specifies overrides:
@@ -78,6 +78,22 @@ const doc = document('blog-post').bySlug('getting-started')
78
78
  | `.where(field, op, value)` | Operator filter (same ops as QueryBuilder) |
79
79
  | `.include(relation)` | Resolve relation fields |
80
80
 
81
+ ### Media
82
+
83
+ Media / image / file field values are plain strings. How you turn them into a URL depends on the storage model:
84
+
85
+ - **Studio-CDN content** already carries absolute delivery URLs — the write path normalizes `media/...` references on save — so use the field value directly, no resolution needed.
86
+ - **Relative-path content** (OSS / local-file model, values like `media/...`) resolves through an optional `media()` helper baked into the generated client. Set `config.json > cdn.url` (or run `contentrain generate --cdnBaseUrl <base>`) and the client exports it:
87
+
88
+ ```typescript
89
+ import { media } from '#contentrain'
90
+
91
+ media('media/original/hero.webp') // → '{cdn.url}/media/original/hero.webp'
92
+ media('https://images.unsplash.com/x.jpg') // → unchanged (external pass-through)
93
+ ```
94
+
95
+ `media()` is omitted when no base is configured, and is idempotent — external URLs (`http(s)://`, `//`, `data:`) and already-absolute delivery URLs pass through untouched. It is the **local-mode** counterpart of CDN mode's `client.media()` (which returns a `MediaAccessor` over the media manifest, below).
96
+
81
97
  ## CDN Mode (Remote Data)
82
98
 
83
99
  For server-side or client-side apps that fetch content from Contentrain Studio CDN:
@@ -151,6 +167,7 @@ const history = await conv.history(response.conversationId)
151
167
  - Locale fallback chain: explicit → config default → first available
152
168
  - Generated files in `.contentrain/client/` are **immutable** — always regenerate, never edit
153
169
  - Run `contentrain generate` after any model change
170
+ - **Media**: Studio-CDN fields already carry absolute URLs; for relative `media/...` values set `config.cdn.url` (or `generate --cdnBaseUrl`) and resolve with the generated `media()` helper
154
171
 
155
172
  ## Framework Integration
156
173