@contentrain/rules 0.4.0 → 0.5.1
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/context/context-bridge.md +2 -2
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/essential/contentrain-essentials.md +4 -2
- package/package.json +2 -2
- package/shared/mcp-usage.md +1 -1
- package/shared/workflow-rules.md +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`context.json` is the project intelligence file. It provides AI agents and Contentrain Studio with structured knowledge about the project: its tech stack, content patterns, conventions, and normalize configuration.
|
|
6
6
|
|
|
7
|
-
- **Written by:** MCP tools (
|
|
7
|
+
- **Written by:** MCP tools (regenerated on the `contentrain` branch after each merge — feature branches never carry it, so parallel writes cannot conflict on it)
|
|
8
8
|
- **Read by:** AI agents (at the start of every session) and Studio (for UI configuration)
|
|
9
9
|
- **Location:** `.contentrain/context.json`
|
|
10
10
|
|
|
@@ -206,7 +206,7 @@ When creating `context.json` for the first time, use stack-appropriate defaults.
|
|
|
206
206
|
|
|
207
207
|
## Update Behavior
|
|
208
208
|
|
|
209
|
-
MCP tools update `context.json`
|
|
209
|
+
MCP tools update `context.json` after each write operation lands. The file is never committed on `cr/*` feature branches (its timestamps would make parallel branches conflict); it is regenerated deterministically on the `contentrain` branch after merge:
|
|
210
210
|
- `contentrain_init` creates the initial file
|
|
211
211
|
- `contentrain_model_save` updates the domains list if a new domain is used
|
|
212
212
|
- `contentrain_content_save` updates content stats
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ declare const FIELD_TYPES: readonly ["string", "text", "email", "url", "slug", "
|
|
|
8
8
|
type FieldType = (typeof FIELD_TYPES)[number];
|
|
9
9
|
declare const MODEL_KINDS: readonly ["singleton", "collection", "document", "dictionary"];
|
|
10
10
|
type ModelKind = (typeof MODEL_KINDS)[number];
|
|
11
|
-
declare const MCP_TOOLS: readonly ["contentrain_status", "contentrain_describe", "contentrain_describe_format", "contentrain_init", "contentrain_scaffold", "contentrain_model_save", "contentrain_model_delete", "contentrain_content_save", "contentrain_content_delete", "contentrain_content_list", "contentrain_scan", "contentrain_apply", "contentrain_validate", "contentrain_submit", "contentrain_merge", "contentrain_bulk", "contentrain_doctor"];
|
|
11
|
+
declare const MCP_TOOLS: readonly ["contentrain_status", "contentrain_describe", "contentrain_describe_format", "contentrain_init", "contentrain_scaffold", "contentrain_model_save", "contentrain_model_delete", "contentrain_content_save", "contentrain_content_delete", "contentrain_content_list", "contentrain_scan", "contentrain_apply", "contentrain_validate", "contentrain_submit", "contentrain_merge", "contentrain_branch_list", "contentrain_branch_delete", "contentrain_bulk", "contentrain_doctor"];
|
|
12
12
|
type McpTool = (typeof MCP_TOOLS)[number];
|
|
13
13
|
declare const ESSENTIAL_RULES_FILE: "essential/contentrain-essentials.md";
|
|
14
14
|
declare const STACKS: readonly ["nuxt", "next", "astro", "sveltekit", "react", "node"];
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;AAQA;;;;cAAa,WAAA;AAAA,KAUD,SAAA,WAAoB,WAAA;AAAA,cAInB,WAAA;AAAA,KACD,SAAA,WAAoB,WAAA;AAAA,cAInB,SAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;AAQA;;;;cAAa,WAAA;AAAA,KAUD,SAAA,WAAoB,WAAA;AAAA,cAInB,WAAA;AAAA,KACD,SAAA,WAAoB,WAAA;AAAA,cAInB,SAAA;AAAA,KAaD,OAAA,WAAkB,SAAA;AAAA,cAIjB,oBAAA;AAAA,cAIA,MAAA;AAAA,KACD,KAAA,WAAgB,MAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ declare const FIELD_TYPES: readonly ["string", "text", "email", "url", "slug", "
|
|
|
8
8
|
type FieldType = (typeof FIELD_TYPES)[number];
|
|
9
9
|
declare const MODEL_KINDS: readonly ["singleton", "collection", "document", "dictionary"];
|
|
10
10
|
type ModelKind = (typeof MODEL_KINDS)[number];
|
|
11
|
-
declare const MCP_TOOLS: readonly ["contentrain_status", "contentrain_describe", "contentrain_describe_format", "contentrain_init", "contentrain_scaffold", "contentrain_model_save", "contentrain_model_delete", "contentrain_content_save", "contentrain_content_delete", "contentrain_content_list", "contentrain_scan", "contentrain_apply", "contentrain_validate", "contentrain_submit", "contentrain_merge", "contentrain_bulk", "contentrain_doctor"];
|
|
11
|
+
declare const MCP_TOOLS: readonly ["contentrain_status", "contentrain_describe", "contentrain_describe_format", "contentrain_init", "contentrain_scaffold", "contentrain_model_save", "contentrain_model_delete", "contentrain_content_save", "contentrain_content_delete", "contentrain_content_list", "contentrain_scan", "contentrain_apply", "contentrain_validate", "contentrain_submit", "contentrain_merge", "contentrain_branch_list", "contentrain_branch_delete", "contentrain_bulk", "contentrain_doctor"];
|
|
12
12
|
type McpTool = (typeof MCP_TOOLS)[number];
|
|
13
13
|
declare const ESSENTIAL_RULES_FILE: "essential/contentrain-essentials.md";
|
|
14
14
|
declare const STACKS: readonly ["nuxt", "next", "astro", "sveltekit", "react", "node"];
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;AAQA;;;;cAAa,WAAA;AAAA,KAUD,SAAA,WAAoB,WAAA;AAAA,cAInB,WAAA;AAAA,KACD,SAAA,WAAoB,WAAA;AAAA,cAInB,SAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;AAQA;;;;cAAa,WAAA;AAAA,KAUD,SAAA,WAAoB,WAAA;AAAA,cAInB,WAAA;AAAA,KACD,SAAA,WAAoB,WAAA;AAAA,cAInB,SAAA;AAAA,KAaD,OAAA,WAAkB,SAAA;AAAA,cAIjB,oBAAA;AAAA,cAIA,MAAA;AAAA,KACD,KAAA,WAAgB,MAAA"}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @contentrain/rules — AI agent rules for Contentrain\n *\n * Quality standards, architecture conventions, and IDE integration.\n */\n\n// ─── Field Types (27 flat types) ───\n\nexport const FIELD_TYPES = [\n 'string', 'text', 'email', 'url', 'slug', 'color', 'phone', 'code', 'icon',\n 'markdown', 'richtext',\n 'number', 'integer', 'decimal', 'percent', 'rating',\n 'boolean', 'date', 'datetime',\n 'image', 'video', 'file',\n 'relation', 'relations',\n 'select', 'array', 'object',\n] as const\n\nexport type FieldType = (typeof FIELD_TYPES)[number]\n\n// ─── Model Kinds ───\n\nexport const MODEL_KINDS = ['singleton', 'collection', 'document', 'dictionary'] as const\nexport type ModelKind = (typeof MODEL_KINDS)[number]\n\n// ─── MCP Tools (
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @contentrain/rules — AI agent rules for Contentrain\n *\n * Quality standards, architecture conventions, and IDE integration.\n */\n\n// ─── Field Types (27 flat types) ───\n\nexport const FIELD_TYPES = [\n 'string', 'text', 'email', 'url', 'slug', 'color', 'phone', 'code', 'icon',\n 'markdown', 'richtext',\n 'number', 'integer', 'decimal', 'percent', 'rating',\n 'boolean', 'date', 'datetime',\n 'image', 'video', 'file',\n 'relation', 'relations',\n 'select', 'array', 'object',\n] as const\n\nexport type FieldType = (typeof FIELD_TYPES)[number]\n\n// ─── Model Kinds ───\n\nexport const MODEL_KINDS = ['singleton', 'collection', 'document', 'dictionary'] as const\nexport type ModelKind = (typeof MODEL_KINDS)[number]\n\n// ─── MCP Tools (19 tools) ───\n\nexport const MCP_TOOLS = [\n 'contentrain_status', 'contentrain_describe', 'contentrain_describe_format',\n 'contentrain_init', 'contentrain_scaffold',\n 'contentrain_model_save', 'contentrain_model_delete',\n 'contentrain_content_save', 'contentrain_content_delete', 'contentrain_content_list',\n 'contentrain_scan', 'contentrain_apply',\n 'contentrain_validate', 'contentrain_submit',\n 'contentrain_merge',\n 'contentrain_branch_list', 'contentrain_branch_delete',\n 'contentrain_bulk',\n 'contentrain_doctor',\n] as const\n\nexport type McpTool = (typeof MCP_TOOLS)[number]\n\n// ─── Essential Rules ───\n\nexport const ESSENTIAL_RULES_FILE = 'essential/contentrain-essentials.md' as const\n\n// ─── Stacks ───\n\nexport const STACKS = ['nuxt', 'next', 'astro', 'sveltekit', 'react', 'node'] as const\nexport type Stack = (typeof STACKS)[number]\n"],"mappings":";;;;;;AAQA,MAAa,cAAc;CACzB;CAAU;CAAQ;CAAS;CAAO;CAAQ;CAAS;CAAS;CAAQ;CACpE;CAAY;CACZ;CAAU;CAAW;CAAW;CAAW;CAC3C;CAAW;CAAQ;CACnB;CAAS;CAAS;CAClB;CAAY;CACZ;CAAU;CAAS;CACpB;AAMD,MAAa,cAAc;CAAC;CAAa;CAAc;CAAY;CAAa;AAKhF,MAAa,YAAY;CACvB;CAAsB;CAAwB;CAC9C;CAAoB;CACpB;CAA0B;CAC1B;CAA4B;CAA8B;CAC1D;CAAoB;CACpB;CAAwB;CACxB;CACA;CAA2B;CAC3B;CACA;CACD;AAMD,MAAa,uBAAuB;AAIpC,MAAa,SAAS;CAAC;CAAQ;CAAQ;CAAS;CAAa;CAAS;CAAO"}
|
|
@@ -52,7 +52,9 @@ MCP is **deterministic infrastructure**. The agent (you) is the **intelligence l
|
|
|
52
52
|
| `contentrain_apply` | Apply normalize (extract/reuse) |
|
|
53
53
|
| `contentrain_validate` | Validate content against schemas |
|
|
54
54
|
| `contentrain_submit` | Push branches to remote |
|
|
55
|
-
| `contentrain_merge` | Merge a review-mode branch into contentrain locally |
|
|
55
|
+
| `contentrain_merge` | Merge a review-mode branch into contentrain locally (by exact branch or model) |
|
|
56
|
+
| `contentrain_branch_list` | List pending `cr/*` branches + merge status |
|
|
57
|
+
| `contentrain_branch_delete` | Delete a stale/failed `cr/*` branch (the contentrain branch is protected) |
|
|
56
58
|
| `contentrain_bulk` | Batch operations (copy_locale/update_status/delete_entries) |
|
|
57
59
|
| `contentrain_doctor` | Project health report (env + structure + orphan content + branch pressure + SDK freshness) |
|
|
58
60
|
|
|
@@ -75,7 +77,7 @@ MCP is **deterministic infrastructure**. The agent (you) is the **intelligence l
|
|
|
75
77
|
- Developer's working tree is never mutated during MCP git operations (no stash, no checkout, no merge on the developer's tree)
|
|
76
78
|
- If the developer manually edits `.contentrain/` files, MCP sync skips dirty files and warns
|
|
77
79
|
- The `contentrain` branch is protected from deletion
|
|
78
|
-
- context.json is committed
|
|
80
|
+
- context.json is never committed on feature branches — it is regenerated on the `contentrain` branch after merge
|
|
79
81
|
- Never create branches manually, never commit directly to main or the `contentrain` branch
|
|
80
82
|
- 50+ active `cr/*` branches = warning, 80+ = blocked
|
|
81
83
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentrain/rules",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
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.
|
|
58
|
+
"@contentrain/mcp": "1.5.1"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown src/index.ts --format esm,cjs --dts",
|
package/shared/mcp-usage.md
CHANGED
|
@@ -297,7 +297,7 @@ contentrain_apply(mode: "reuse", scope: {model: "model-id"}, dry_run: true) (pre
|
|
|
297
297
|
- Branch naming: `cr/{operation}/{model}[/{locale}]/{timestamp}-{suffix}` (locale included when applicable; legacy `contentrain/*` branches are auto-migrated on first init).
|
|
298
298
|
- You do not create branches manually. MCP handles Git transactions.
|
|
299
299
|
- Developer's working tree is never mutated during MCP operations (no stash, no checkout, no merge on the developer's tree).
|
|
300
|
-
- context.json is committed
|
|
300
|
+
- context.json is never committed on feature branches — it is regenerated on the `contentrain` branch after merge.
|
|
301
301
|
- In `auto-merge` mode: feature branch is merged into `contentrain`, then baseBranch is advanced via update-ref (fast-forward), then `.contentrain/` files are selectively synced to the developer's working tree. Dirty files are skipped with a warning.
|
|
302
302
|
- In `review` mode: feature branch stays local until `contentrain_submit` pushes it to remote.
|
|
303
303
|
|
package/shared/workflow-rules.md
CHANGED
|
@@ -75,7 +75,7 @@ The `contentrain` branch is the **single source of truth** for content state:
|
|
|
75
75
|
- Created automatically at `contentrain_init`.
|
|
76
76
|
- All content writes happen on feature branches forked from `contentrain`.
|
|
77
77
|
- The `contentrain` branch is **protected from deletion**.
|
|
78
|
-
- context.json is committed
|
|
78
|
+
- context.json is never committed on feature branches — it is regenerated on the `contentrain` branch after merge.
|
|
79
79
|
|
|
80
80
|
### 3.2 Worktree-Based Transactions
|
|
81
81
|
|