@contentrain/rules 0.5.2 → 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/README.md CHANGED
@@ -44,7 +44,7 @@ Published under `shared/` — detailed standards per domain:
44
44
  - `content-quality.md` — structure, required fields, content completeness
45
45
  - `seo-rules.md` — meta optimization, keywords, canonical URLs
46
46
  - `accessibility-rules.md` — alt text, ARIA labels, color contrast
47
- - `media-rules.md` — image optimization, responsive sizing, asset naming
47
+ - `media-rules.md` — storage models (local-file vs Studio-CDN delivery), image optimization, responsive sizing, asset naming
48
48
  - `schema-rules.md` — model design, field types, relations, inheritance
49
49
  - `i18n-quality.md` — translation completeness, locale parity
50
50
  - `security-rules.md` — sensitive data patterns, secret detection, XSS prevention
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/rules",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "license": "MIT",
5
5
  "description": "AI agent rules for Contentrain — quality standards, architecture conventions, IDE integration",
6
6
  "type": "module",
@@ -55,7 +55,7 @@
55
55
  "tsdown": "^0.21.0",
56
56
  "typescript": "^5.7.0",
57
57
  "vitest": "^3.0.0",
58
- "@contentrain/mcp": "1.5.2"
58
+ "@contentrain/mcp": "1.6.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsdown src/index.ts --format esm,cjs --dts",
@@ -5,6 +5,18 @@ Follow these guidelines when populating image, video, or file fields in any cont
5
5
 
6
6
  ---
7
7
 
8
+ ## Storage & Reference Models
9
+
10
+ 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.
11
+
12
+ 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}`.
13
+
14
+ 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.
15
+
16
+ Never hand-build delivery URLs or guess the CDN base. Save the path or URL the media library gives you; the platform resolves it.
17
+
18
+ ---
19
+
8
20
  ## Image Dimensions (Recommended)
9
21
 
10
22
  1. Use these standard dimensions unless the project's `context.json` specifies overrides: