@contentrain/mcp 1.1.0 → 1.1.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/README.md +7 -0
- package/dist/{apply-manager-CMAoS_nu.mjs → apply-manager-Cf5OWOJ7.mjs} +7 -7
- package/dist/{apply-manager-CMAoS_nu.mjs.map → apply-manager-Cf5OWOJ7.mjs.map} +1 -1
- package/dist/{branch-lifecycle-B7TgkxGr.mjs → branch-lifecycle-wGJg25LT.mjs} +3 -3
- package/dist/{branch-lifecycle-B7TgkxGr.mjs.map → branch-lifecycle-wGJg25LT.mjs.map} +1 -1
- package/dist/{config-CPlhDwsv.mjs → config-B5kc2oeV.mjs} +2 -2
- package/dist/{config-CPlhDwsv.mjs.map → config-B5kc2oeV.mjs.map} +1 -1
- package/dist/{context-CUFulSi2.mjs → context-DIDt_TxX.mjs} +4 -4
- package/dist/{context-CUFulSi2.mjs.map → context-DIDt_TxX.mjs.map} +1 -1
- package/dist/core/apply-manager.mjs +10 -5
- package/dist/core/config.mjs +3 -1
- package/dist/core/content-manager.d.mts +1 -9
- package/dist/core/content-manager.d.mts.map +1 -1
- package/dist/core/content-manager.mjs +4 -1
- package/dist/core/context.mjs +6 -2
- package/dist/core/graph-builder.mjs +4 -1
- package/dist/core/meta-manager.mjs +3 -1
- package/dist/core/model-manager.mjs +4 -1
- package/dist/core/scan-config.mjs +3 -1
- package/dist/core/scanner.mjs +4 -1
- package/dist/core/validator.d.mts.map +1 -1
- package/dist/core/validator.mjs +6 -2
- package/dist/{detect-C8XmJ4S6.mjs → detect-DinOQAmK.mjs} +2 -2
- package/dist/{detect-C8XmJ4S6.mjs.map → detect-DinOQAmK.mjs.map} +1 -1
- package/dist/{fs-BbuGnVcG.mjs → fs-BnIQ4dKj.mjs} +2 -2
- package/dist/{fs-BbuGnVcG.mjs.map → fs-BnIQ4dKj.mjs.map} +1 -1
- package/dist/git/branch-lifecycle.mjs +4 -1
- package/dist/git/transaction.mjs +8 -3
- package/dist/{graph-builder-fPrDDwnu.mjs → graph-builder-tM7zj-SX.mjs} +3 -3
- package/dist/{graph-builder-fPrDDwnu.mjs.map → graph-builder-tM7zj-SX.mjs.map} +1 -1
- package/dist/{id-BdD4HvMY.mjs → id-DV_T9Ic8.mjs} +3 -5
- package/dist/id-DV_T9Ic8.mjs.map +1 -0
- package/dist/index.mjs +16 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{meta-manager-CECrfsKm.mjs → meta-manager--0IwAPCl.mjs} +2 -2
- package/dist/{meta-manager-CECrfsKm.mjs.map → meta-manager--0IwAPCl.mjs.map} +1 -1
- package/dist/{model-manager-kl78AAMg.mjs → model-manager-DW_fOGRM.mjs} +16 -186
- package/dist/model-manager-DW_fOGRM.mjs.map +1 -0
- package/dist/{scan-config-AJGxCdNd.mjs → scan-config-QgnJ1-52.mjs} +2 -2
- package/dist/{scan-config-AJGxCdNd.mjs.map → scan-config-QgnJ1-52.mjs.map} +1 -1
- package/dist/{scanner-BdTiv8sw.mjs → scanner-DPrbU-oK.mjs} +3 -3
- package/dist/{scanner-BdTiv8sw.mjs.map → scanner-DPrbU-oK.mjs.map} +1 -1
- package/dist/serializer-CnHTtmc1.mjs +2 -0
- package/dist/{server-CDv6JNRi.mjs → server-BXguCuJb.mjs} +16 -16
- package/dist/{server-CDv6JNRi.mjs.map → server-BXguCuJb.mjs.map} +1 -1
- package/dist/server.mjs +16 -9
- package/dist/templates/index.mjs +1 -1
- package/dist/{templates-3HWi-PTu.mjs → templates-bRPzYq4M.mjs} +1 -1
- package/dist/{templates-3HWi-PTu.mjs.map → templates-bRPzYq4M.mjs.map} +1 -1
- package/dist/{transaction-CncRbpI9.mjs → transaction-B0V0_SE2.mjs} +6 -6
- package/dist/{transaction-CncRbpI9.mjs.map → transaction-B0V0_SE2.mjs.map} +1 -1
- package/dist/util/detect.mjs +3 -1
- package/dist/util/fs.mjs +2 -1
- package/dist/util/id.d.mts +2 -1
- package/dist/util/id.d.mts.map +1 -1
- package/dist/util/id.mjs +1 -1
- package/dist/util/serializer.d.mts +2 -14
- package/dist/util/serializer.mjs +2 -2
- package/dist/{validator-CyckZAVr.mjs → validator-SQYUV2JP.mjs} +23 -197
- package/dist/validator-SQYUV2JP.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/id-BdD4HvMY.mjs.map +0 -1
- package/dist/model-manager-kl78AAMg.mjs.map +0 -1
- package/dist/serializer-Dueih-i2.mjs +0 -33
- package/dist/serializer-Dueih-i2.mjs.map +0 -1
- package/dist/util/serializer.d.mts.map +0 -1
- package/dist/validator-CyckZAVr.mjs.map +0 -1
package/dist/server.mjs
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
1
|
+
import "./serializer-CnHTtmc1.mjs";
|
|
2
|
+
import "./fs-BnIQ4dKj.mjs";
|
|
3
|
+
import "./config-B5kc2oeV.mjs";
|
|
4
|
+
import "./meta-manager--0IwAPCl.mjs";
|
|
5
|
+
import "./model-manager-DW_fOGRM.mjs";
|
|
6
|
+
import "./context-DIDt_TxX.mjs";
|
|
7
|
+
import "./detect-DinOQAmK.mjs";
|
|
8
|
+
import "./branch-lifecycle-wGJg25LT.mjs";
|
|
9
|
+
import { t as createServer } from "./server-BXguCuJb.mjs";
|
|
10
|
+
import "./id-DV_T9Ic8.mjs";
|
|
11
|
+
import "./transaction-B0V0_SE2.mjs";
|
|
12
|
+
import "./validator-SQYUV2JP.mjs";
|
|
13
|
+
import "./scan-config-QgnJ1-52.mjs";
|
|
14
|
+
import "./graph-builder-tM7zj-SX.mjs";
|
|
15
|
+
import "./scanner-DPrbU-oK.mjs";
|
|
9
16
|
import "./tsx-parser-CYVyBWjn.mjs";
|
|
10
|
-
import "./apply-manager-
|
|
17
|
+
import "./apply-manager-Cf5OWOJ7.mjs";
|
|
11
18
|
export { createServer };
|
package/dist/templates/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as listTemplates, t as getTemplate } from "../templates-
|
|
1
|
+
import { n as listTemplates, t as getTemplate } from "../templates-bRPzYq4M.mjs";
|
|
2
2
|
export { getTemplate, listTemplates };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates-3HWi-PTu.mjs","names":[],"sources":["../src/templates/blog.ts","../src/templates/landing.ts","../src/templates/docs.ts","../src/templates/ecommerce.ts","../src/templates/saas.ts","../src/templates/i18n.ts","../src/templates/mobile.ts","../src/templates/index.ts"],"sourcesContent":["import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const blogTemplate: ScaffoldTemplate = {\n id: 'blog',\n models: [\n {\n id: 'blog-post',\n name: 'Blog Post',\n kind: 'document',\n domain: 'blog',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n slug: { type: 'slug', required: true, unique: true },\n excerpt: { type: 'text', max: 280 },\n cover: { type: 'image' },\n author: { type: 'relation', model: 'authors', required: true },\n category: { type: 'relation', model: 'categories' },\n tags: { type: 'array', items: 'string' },\n published_at: { type: 'datetime' },\n },\n },\n {\n id: 'categories',\n name: 'Categories',\n kind: 'collection',\n domain: 'blog',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n description: { type: 'text' },\n },\n },\n {\n id: 'authors',\n name: 'Authors',\n kind: 'collection',\n domain: 'blog',\n i18n: false,\n fields: {\n name: { type: 'string', required: true },\n email: { type: 'email' },\n bio: { type: 'text' },\n avatar: { type: 'image' },\n social: {\n type: 'object',\n fields: {\n twitter: { type: 'url' },\n linkedin: { type: 'url' },\n github: { type: 'url' },\n },\n },\n },\n },\n ],\n sample_content: {\n categories: {\n en: {\n 'cat-engineering': { name: 'Engineering', slug: 'engineering', description: 'Technical deep dives' },\n 'cat-product': { name: 'Product', slug: 'product', description: 'Product updates and news' },\n },\n },\n authors: {\n data: {\n 'author-1': { name: 'Team', email: 'team@example.com', bio: 'The team behind the product' },\n },\n },\n },\n vocabulary: {\n 'read-more': { en: 'Read More' },\n 'published-on': { en: 'Published on' },\n 'by-author': { en: 'By' },\n 'categories': { en: 'Categories' },\n 'tags': { en: 'Tags' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const landingTemplate: ScaffoldTemplate = {\n id: 'landing',\n models: [\n {\n id: 'hero',\n name: 'Hero Section',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n subtitle: { type: 'text', max: 280 },\n cta_text: { type: 'string' },\n cta_url: { type: 'url' },\n background: { type: 'image' },\n },\n },\n {\n id: 'features',\n name: 'Features Section',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n subtitle: { type: 'text' },\n items: {\n type: 'array',\n items: {\n type: 'object',\n fields: {\n title: { type: 'string', required: true },\n description: { type: 'text' },\n icon: { type: 'icon' },\n },\n },\n },\n },\n },\n {\n id: 'pricing',\n name: 'Pricing Plans',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n price: { type: 'number', required: true },\n currency: { type: 'string', default: 'USD' },\n period: { type: 'select', options: ['monthly', 'yearly'] },\n features: { type: 'array', items: 'string' },\n highlighted: { type: 'boolean', default: false },\n },\n },\n {\n id: 'faq',\n name: 'FAQ',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n question: { type: 'string', required: true },\n answer: { type: 'text', required: true },\n order: { type: 'integer' },\n },\n },\n {\n id: 'testimonials',\n name: 'Testimonials',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n role: { type: 'string' },\n company: { type: 'string' },\n quote: { type: 'text', required: true },\n avatar: { type: 'image' },\n rating: { type: 'rating' },\n },\n },\n ],\n sample_content: {\n hero: {\n en: {\n title: 'Build something amazing',\n subtitle: 'The fastest way to launch your product',\n cta_text: 'Get Started',\n cta_url: '/signup',\n },\n },\n pricing: {\n en: {\n 'plan-free': { name: 'Free', price: 0, currency: 'USD', period: 'monthly', features: ['1 project', 'Basic support'], highlighted: false },\n 'plan-pro': { name: 'Pro', price: 29, currency: 'USD', period: 'monthly', features: ['Unlimited projects', 'Priority support', 'Advanced analytics'], highlighted: true },\n },\n },\n },\n vocabulary: {\n 'get-started': { en: 'Get Started' },\n 'learn-more': { en: 'Learn More' },\n 'per-month': { en: '/month' },\n 'most-popular': { en: 'Most Popular' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const docsTemplate: ScaffoldTemplate = {\n id: 'docs',\n models: [\n {\n id: 'doc-page',\n name: 'Documentation Page',\n kind: 'document',\n domain: 'docs',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n slug: { type: 'slug', required: true, unique: true },\n category: { type: 'relation', model: 'doc-categories' },\n order: { type: 'integer' },\n excerpt: { type: 'text', max: 280 },\n },\n },\n {\n id: 'doc-categories',\n name: 'Doc Categories',\n kind: 'collection',\n domain: 'docs',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n order: { type: 'integer' },\n },\n },\n ],\n sample_content: {\n 'doc-categories': {\n en: {\n 'cat-getting-started': { name: 'Getting Started', slug: 'getting-started', order: 1 },\n 'cat-guides': { name: 'Guides', slug: 'guides', order: 2 },\n 'cat-api': { name: 'API Reference', slug: 'api', order: 3 },\n },\n },\n },\n vocabulary: {\n 'on-this-page': { en: 'On This Page' },\n 'edit-this-page': { en: 'Edit this page' },\n 'next': { en: 'Next' },\n 'previous': { en: 'Previous' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const ecommerceTemplate: ScaffoldTemplate = {\n id: 'ecommerce',\n models: [\n {\n id: 'products',\n name: 'Products',\n kind: 'collection',\n domain: 'shop',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n description: { type: 'text' },\n price: { type: 'decimal', required: true },\n currency: { type: 'string', default: 'USD' },\n image: { type: 'image' },\n category: { type: 'relation', model: 'product-categories' },\n brand: { type: 'relation', model: 'brands' },\n in_stock: { type: 'boolean', default: true },\n },\n },\n {\n id: 'product-categories',\n name: 'Product Categories',\n kind: 'collection',\n domain: 'shop',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n description: { type: 'text' },\n image: { type: 'image' },\n },\n },\n {\n id: 'brands',\n name: 'Brands',\n kind: 'collection',\n domain: 'shop',\n i18n: false,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n logo: { type: 'image' },\n website: { type: 'url' },\n },\n },\n ],\n sample_content: {\n 'product-categories': {\n en: {\n 'cat-electronics': { name: 'Electronics', slug: 'electronics', description: 'Electronic devices and accessories' },\n 'cat-clothing': { name: 'Clothing', slug: 'clothing', description: 'Apparel and fashion' },\n },\n },\n brands: {\n data: {\n 'brand-acme': { name: 'Acme Corp', slug: 'acme', website: 'https://example.com' },\n },\n },\n },\n vocabulary: {\n 'add-to-cart': { en: 'Add to Cart' },\n 'out-of-stock': { en: 'Out of Stock' },\n 'price': { en: 'Price' },\n 'category': { en: 'Category' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const saasTemplate: ScaffoldTemplate = {\n id: 'saas',\n models: [\n {\n id: 'hero',\n name: 'Hero Section',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n subtitle: { type: 'text', max: 280 },\n cta_text: { type: 'string' },\n cta_url: { type: 'url' },\n background: { type: 'image' },\n },\n },\n {\n id: 'features',\n name: 'Features',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n subtitle: { type: 'text' },\n items: {\n type: 'array',\n items: {\n type: 'object',\n fields: {\n title: { type: 'string', required: true },\n description: { type: 'text' },\n icon: { type: 'icon' },\n },\n },\n },\n },\n },\n {\n id: 'pricing',\n name: 'Pricing Plans',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n price: { type: 'number', required: true },\n currency: { type: 'string', default: 'USD' },\n period: { type: 'select', options: ['monthly', 'yearly'] },\n features: { type: 'array', items: 'string' },\n highlighted: { type: 'boolean', default: false },\n },\n },\n {\n id: 'changelog',\n name: 'Changelog',\n kind: 'document',\n domain: 'product',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n version: { type: 'string' },\n published_at: { type: 'date' },\n tags: { type: 'array', items: 'string' },\n },\n },\n {\n id: 'faq',\n name: 'FAQ',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n question: { type: 'string', required: true },\n answer: { type: 'text', required: true },\n order: { type: 'integer' },\n },\n },\n ],\n sample_content: {\n hero: {\n en: {\n title: 'Ship faster with our platform',\n subtitle: 'Everything you need to build, deploy, and scale',\n cta_text: 'Start Free Trial',\n cta_url: '/signup',\n },\n },\n pricing: {\n en: {\n 'plan-starter': { name: 'Starter', price: 0, currency: 'USD', period: 'monthly', features: ['Up to 3 projects', 'Community support'], highlighted: false },\n 'plan-team': { name: 'Team', price: 49, currency: 'USD', period: 'monthly', features: ['Unlimited projects', 'Priority support', 'Team collaboration'], highlighted: true },\n 'plan-enterprise': { name: 'Enterprise', price: 199, currency: 'USD', period: 'monthly', features: ['Everything in Team', 'SSO', 'SLA', 'Dedicated support'], highlighted: false },\n },\n },\n },\n vocabulary: {\n 'start-free': { en: 'Start Free Trial' },\n 'contact-sales': { en: 'Contact Sales' },\n 'per-month': { en: '/month' },\n 'changelog': { en: 'Changelog' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const i18nTemplate: ScaffoldTemplate = {\n id: 'i18n',\n models: [\n {\n id: 'navigation',\n name: 'Navigation',\n kind: 'singleton',\n domain: 'ui',\n i18n: true,\n fields: {\n brand: { type: 'string', required: true },\n items: {\n type: 'array',\n items: {\n type: 'object',\n fields: {\n label: { type: 'string', required: true },\n url: { type: 'url', required: true },\n },\n },\n },\n },\n },\n {\n id: 'form-labels',\n name: 'Form Labels',\n kind: 'singleton',\n domain: 'ui',\n i18n: true,\n fields: {\n name: { type: 'string' },\n email: { type: 'string' },\n password: { type: 'string' },\n submit: { type: 'string' },\n cancel: { type: 'string' },\n },\n },\n {\n id: 'error-messages',\n name: 'Error Messages',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n {\n id: 'app-strings',\n name: 'App Strings',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n ],\n sample_content: {\n navigation: {\n en: {\n brand: 'My App',\n items: [\n { label: 'Home', url: '/' },\n { label: 'About', url: '/about' },\n { label: 'Contact', url: '/contact' },\n ],\n },\n },\n 'form-labels': {\n en: {\n name: 'Name',\n email: 'Email',\n password: 'Password',\n submit: 'Submit',\n cancel: 'Cancel',\n },\n },\n 'error-messages': {\n en: {\n 'required-field': 'This field is required',\n 'invalid-email': 'Please enter a valid email',\n 'server-error': 'Something went wrong, please try again',\n },\n },\n 'app-strings': {\n en: {\n 'welcome': 'Welcome',\n 'loading': 'Loading...',\n 'no-results': 'No results found',\n },\n },\n },\n vocabulary: {\n 'language': { en: 'Language' },\n 'switch-locale': { en: 'Switch language' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const mobileTemplate: ScaffoldTemplate = {\n id: 'mobile',\n models: [\n {\n id: 'app-strings',\n name: 'App Strings',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n {\n id: 'error-messages',\n name: 'Error Messages',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n {\n id: 'onboarding',\n name: 'Onboarding Screens',\n kind: 'collection',\n domain: 'app',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n description: { type: 'text' },\n image: { type: 'image' },\n order: { type: 'integer', required: true },\n },\n },\n ],\n sample_content: {\n 'app-strings': {\n en: {\n 'welcome': 'Welcome',\n 'loading': 'Loading...',\n 'retry': 'Retry',\n 'ok': 'OK',\n 'cancel': 'Cancel',\n },\n },\n 'error-messages': {\n en: {\n 'network-error': 'No internet connection',\n 'server-error': 'Something went wrong',\n 'auth-error': 'Please sign in again',\n },\n },\n onboarding: {\n en: {\n 'step-1': { title: 'Welcome', description: 'Get started with our app', order: 1 },\n 'step-2': { title: 'Discover', description: 'Explore all features', order: 2 },\n 'step-3': { title: 'Ready', description: 'You are all set!', order: 3 },\n },\n },\n },\n vocabulary: {\n 'get-started': { en: 'Get Started' },\n 'skip': { en: 'Skip' },\n 'next': { en: 'Next' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\nimport { blogTemplate } from './blog.js'\nimport { landingTemplate } from './landing.js'\nimport { docsTemplate } from './docs.js'\nimport { ecommerceTemplate } from './ecommerce.js'\nimport { saasTemplate } from './saas.js'\nimport { i18nTemplate } from './i18n.js'\nimport { mobileTemplate } from './mobile.js'\n\nconst templates: Record<string, ScaffoldTemplate> = {\n blog: blogTemplate,\n landing: landingTemplate,\n docs: docsTemplate,\n ecommerce: ecommerceTemplate,\n saas: saasTemplate,\n i18n: i18nTemplate,\n mobile: mobileTemplate,\n}\n\nexport function getTemplate(id: string): ScaffoldTemplate | null {\n return templates[id] ?? null\n}\n\nexport function listTemplates(): string[] {\n return Object.keys(templates)\n}\n"],"mappings":";;AOSA,MAAM,YAA8C;CAClD,MPR4C;EAC5C,IAAI;EACJ,QAAQ;GACN;IACE,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,QAAQ;KACN,OAAc;MAAE,MAAM;MAAU,UAAU;MAAM,KAAK;MAAK;KAC1D,MAAc;MAAE,MAAM;MAAQ,UAAU;MAAM,QAAQ;MAAM;KAC5D,SAAc;MAAE,MAAM;MAAQ,KAAK;MAAK;KACxC,OAAc,EAAE,MAA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gB,YAAY,IAAqC;AAC/D,QAAO,UAAU,OAAO;;AAG1B,SAAgB,gBAA0B;AACxC,QAAO,OAAO,KAAK,UAAU"}
|
|
1
|
+
{"version":3,"file":"templates-bRPzYq4M.mjs","names":[],"sources":["../src/templates/blog.ts","../src/templates/landing.ts","../src/templates/docs.ts","../src/templates/ecommerce.ts","../src/templates/saas.ts","../src/templates/i18n.ts","../src/templates/mobile.ts","../src/templates/index.ts"],"sourcesContent":["import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const blogTemplate: ScaffoldTemplate = {\n id: 'blog',\n models: [\n {\n id: 'blog-post',\n name: 'Blog Post',\n kind: 'document',\n domain: 'blog',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n slug: { type: 'slug', required: true, unique: true },\n excerpt: { type: 'text', max: 280 },\n cover: { type: 'image' },\n author: { type: 'relation', model: 'authors', required: true },\n category: { type: 'relation', model: 'categories' },\n tags: { type: 'array', items: 'string' },\n published_at: { type: 'datetime' },\n },\n },\n {\n id: 'categories',\n name: 'Categories',\n kind: 'collection',\n domain: 'blog',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n description: { type: 'text' },\n },\n },\n {\n id: 'authors',\n name: 'Authors',\n kind: 'collection',\n domain: 'blog',\n i18n: false,\n fields: {\n name: { type: 'string', required: true },\n email: { type: 'email' },\n bio: { type: 'text' },\n avatar: { type: 'image' },\n social: {\n type: 'object',\n fields: {\n twitter: { type: 'url' },\n linkedin: { type: 'url' },\n github: { type: 'url' },\n },\n },\n },\n },\n ],\n sample_content: {\n categories: {\n en: {\n 'cat-engineering': { name: 'Engineering', slug: 'engineering', description: 'Technical deep dives' },\n 'cat-product': { name: 'Product', slug: 'product', description: 'Product updates and news' },\n },\n },\n authors: {\n data: {\n 'author-1': { name: 'Team', email: 'team@example.com', bio: 'The team behind the product' },\n },\n },\n },\n vocabulary: {\n 'read-more': { en: 'Read More' },\n 'published-on': { en: 'Published on' },\n 'by-author': { en: 'By' },\n 'categories': { en: 'Categories' },\n 'tags': { en: 'Tags' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const landingTemplate: ScaffoldTemplate = {\n id: 'landing',\n models: [\n {\n id: 'hero',\n name: 'Hero Section',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n subtitle: { type: 'text', max: 280 },\n cta_text: { type: 'string' },\n cta_url: { type: 'url' },\n background: { type: 'image' },\n },\n },\n {\n id: 'features',\n name: 'Features Section',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n subtitle: { type: 'text' },\n items: {\n type: 'array',\n items: {\n type: 'object',\n fields: {\n title: { type: 'string', required: true },\n description: { type: 'text' },\n icon: { type: 'icon' },\n },\n },\n },\n },\n },\n {\n id: 'pricing',\n name: 'Pricing Plans',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n price: { type: 'number', required: true },\n currency: { type: 'string', default: 'USD' },\n period: { type: 'select', options: ['monthly', 'yearly'] },\n features: { type: 'array', items: 'string' },\n highlighted: { type: 'boolean', default: false },\n },\n },\n {\n id: 'faq',\n name: 'FAQ',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n question: { type: 'string', required: true },\n answer: { type: 'text', required: true },\n order: { type: 'integer' },\n },\n },\n {\n id: 'testimonials',\n name: 'Testimonials',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n role: { type: 'string' },\n company: { type: 'string' },\n quote: { type: 'text', required: true },\n avatar: { type: 'image' },\n rating: { type: 'rating' },\n },\n },\n ],\n sample_content: {\n hero: {\n en: {\n title: 'Build something amazing',\n subtitle: 'The fastest way to launch your product',\n cta_text: 'Get Started',\n cta_url: '/signup',\n },\n },\n pricing: {\n en: {\n 'plan-free': { name: 'Free', price: 0, currency: 'USD', period: 'monthly', features: ['1 project', 'Basic support'], highlighted: false },\n 'plan-pro': { name: 'Pro', price: 29, currency: 'USD', period: 'monthly', features: ['Unlimited projects', 'Priority support', 'Advanced analytics'], highlighted: true },\n },\n },\n },\n vocabulary: {\n 'get-started': { en: 'Get Started' },\n 'learn-more': { en: 'Learn More' },\n 'per-month': { en: '/month' },\n 'most-popular': { en: 'Most Popular' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const docsTemplate: ScaffoldTemplate = {\n id: 'docs',\n models: [\n {\n id: 'doc-page',\n name: 'Documentation Page',\n kind: 'document',\n domain: 'docs',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n slug: { type: 'slug', required: true, unique: true },\n category: { type: 'relation', model: 'doc-categories' },\n order: { type: 'integer' },\n excerpt: { type: 'text', max: 280 },\n },\n },\n {\n id: 'doc-categories',\n name: 'Doc Categories',\n kind: 'collection',\n domain: 'docs',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n order: { type: 'integer' },\n },\n },\n ],\n sample_content: {\n 'doc-categories': {\n en: {\n 'cat-getting-started': { name: 'Getting Started', slug: 'getting-started', order: 1 },\n 'cat-guides': { name: 'Guides', slug: 'guides', order: 2 },\n 'cat-api': { name: 'API Reference', slug: 'api', order: 3 },\n },\n },\n },\n vocabulary: {\n 'on-this-page': { en: 'On This Page' },\n 'edit-this-page': { en: 'Edit this page' },\n 'next': { en: 'Next' },\n 'previous': { en: 'Previous' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const ecommerceTemplate: ScaffoldTemplate = {\n id: 'ecommerce',\n models: [\n {\n id: 'products',\n name: 'Products',\n kind: 'collection',\n domain: 'shop',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n description: { type: 'text' },\n price: { type: 'decimal', required: true },\n currency: { type: 'string', default: 'USD' },\n image: { type: 'image' },\n category: { type: 'relation', model: 'product-categories' },\n brand: { type: 'relation', model: 'brands' },\n in_stock: { type: 'boolean', default: true },\n },\n },\n {\n id: 'product-categories',\n name: 'Product Categories',\n kind: 'collection',\n domain: 'shop',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n description: { type: 'text' },\n image: { type: 'image' },\n },\n },\n {\n id: 'brands',\n name: 'Brands',\n kind: 'collection',\n domain: 'shop',\n i18n: false,\n fields: {\n name: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n logo: { type: 'image' },\n website: { type: 'url' },\n },\n },\n ],\n sample_content: {\n 'product-categories': {\n en: {\n 'cat-electronics': { name: 'Electronics', slug: 'electronics', description: 'Electronic devices and accessories' },\n 'cat-clothing': { name: 'Clothing', slug: 'clothing', description: 'Apparel and fashion' },\n },\n },\n brands: {\n data: {\n 'brand-acme': { name: 'Acme Corp', slug: 'acme', website: 'https://example.com' },\n },\n },\n },\n vocabulary: {\n 'add-to-cart': { en: 'Add to Cart' },\n 'out-of-stock': { en: 'Out of Stock' },\n 'price': { en: 'Price' },\n 'category': { en: 'Category' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const saasTemplate: ScaffoldTemplate = {\n id: 'saas',\n models: [\n {\n id: 'hero',\n name: 'Hero Section',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true, max: 120 },\n subtitle: { type: 'text', max: 280 },\n cta_text: { type: 'string' },\n cta_url: { type: 'url' },\n background: { type: 'image' },\n },\n },\n {\n id: 'features',\n name: 'Features',\n kind: 'singleton',\n domain: 'marketing',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n subtitle: { type: 'text' },\n items: {\n type: 'array',\n items: {\n type: 'object',\n fields: {\n title: { type: 'string', required: true },\n description: { type: 'text' },\n icon: { type: 'icon' },\n },\n },\n },\n },\n },\n {\n id: 'pricing',\n name: 'Pricing Plans',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n name: { type: 'string', required: true },\n price: { type: 'number', required: true },\n currency: { type: 'string', default: 'USD' },\n period: { type: 'select', options: ['monthly', 'yearly'] },\n features: { type: 'array', items: 'string' },\n highlighted: { type: 'boolean', default: false },\n },\n },\n {\n id: 'changelog',\n name: 'Changelog',\n kind: 'document',\n domain: 'product',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n slug: { type: 'slug', required: true, unique: true },\n version: { type: 'string' },\n published_at: { type: 'date' },\n tags: { type: 'array', items: 'string' },\n },\n },\n {\n id: 'faq',\n name: 'FAQ',\n kind: 'collection',\n domain: 'marketing',\n i18n: true,\n fields: {\n question: { type: 'string', required: true },\n answer: { type: 'text', required: true },\n order: { type: 'integer' },\n },\n },\n ],\n sample_content: {\n hero: {\n en: {\n title: 'Ship faster with our platform',\n subtitle: 'Everything you need to build, deploy, and scale',\n cta_text: 'Start Free Trial',\n cta_url: '/signup',\n },\n },\n pricing: {\n en: {\n 'plan-starter': { name: 'Starter', price: 0, currency: 'USD', period: 'monthly', features: ['Up to 3 projects', 'Community support'], highlighted: false },\n 'plan-team': { name: 'Team', price: 49, currency: 'USD', period: 'monthly', features: ['Unlimited projects', 'Priority support', 'Team collaboration'], highlighted: true },\n 'plan-enterprise': { name: 'Enterprise', price: 199, currency: 'USD', period: 'monthly', features: ['Everything in Team', 'SSO', 'SLA', 'Dedicated support'], highlighted: false },\n },\n },\n },\n vocabulary: {\n 'start-free': { en: 'Start Free Trial' },\n 'contact-sales': { en: 'Contact Sales' },\n 'per-month': { en: '/month' },\n 'changelog': { en: 'Changelog' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const i18nTemplate: ScaffoldTemplate = {\n id: 'i18n',\n models: [\n {\n id: 'navigation',\n name: 'Navigation',\n kind: 'singleton',\n domain: 'ui',\n i18n: true,\n fields: {\n brand: { type: 'string', required: true },\n items: {\n type: 'array',\n items: {\n type: 'object',\n fields: {\n label: { type: 'string', required: true },\n url: { type: 'url', required: true },\n },\n },\n },\n },\n },\n {\n id: 'form-labels',\n name: 'Form Labels',\n kind: 'singleton',\n domain: 'ui',\n i18n: true,\n fields: {\n name: { type: 'string' },\n email: { type: 'string' },\n password: { type: 'string' },\n submit: { type: 'string' },\n cancel: { type: 'string' },\n },\n },\n {\n id: 'error-messages',\n name: 'Error Messages',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n {\n id: 'app-strings',\n name: 'App Strings',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n ],\n sample_content: {\n navigation: {\n en: {\n brand: 'My App',\n items: [\n { label: 'Home', url: '/' },\n { label: 'About', url: '/about' },\n { label: 'Contact', url: '/contact' },\n ],\n },\n },\n 'form-labels': {\n en: {\n name: 'Name',\n email: 'Email',\n password: 'Password',\n submit: 'Submit',\n cancel: 'Cancel',\n },\n },\n 'error-messages': {\n en: {\n 'required-field': 'This field is required',\n 'invalid-email': 'Please enter a valid email',\n 'server-error': 'Something went wrong, please try again',\n },\n },\n 'app-strings': {\n en: {\n 'welcome': 'Welcome',\n 'loading': 'Loading...',\n 'no-results': 'No results found',\n },\n },\n },\n vocabulary: {\n 'language': { en: 'Language' },\n 'switch-locale': { en: 'Switch language' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\n\nexport const mobileTemplate: ScaffoldTemplate = {\n id: 'mobile',\n models: [\n {\n id: 'app-strings',\n name: 'App Strings',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n {\n id: 'error-messages',\n name: 'Error Messages',\n kind: 'dictionary',\n domain: 'system',\n i18n: true,\n },\n {\n id: 'onboarding',\n name: 'Onboarding Screens',\n kind: 'collection',\n domain: 'app',\n i18n: true,\n fields: {\n title: { type: 'string', required: true },\n description: { type: 'text' },\n image: { type: 'image' },\n order: { type: 'integer', required: true },\n },\n },\n ],\n sample_content: {\n 'app-strings': {\n en: {\n 'welcome': 'Welcome',\n 'loading': 'Loading...',\n 'retry': 'Retry',\n 'ok': 'OK',\n 'cancel': 'Cancel',\n },\n },\n 'error-messages': {\n en: {\n 'network-error': 'No internet connection',\n 'server-error': 'Something went wrong',\n 'auth-error': 'Please sign in again',\n },\n },\n onboarding: {\n en: {\n 'step-1': { title: 'Welcome', description: 'Get started with our app', order: 1 },\n 'step-2': { title: 'Discover', description: 'Explore all features', order: 2 },\n 'step-3': { title: 'Ready', description: 'You are all set!', order: 3 },\n },\n },\n },\n vocabulary: {\n 'get-started': { en: 'Get Started' },\n 'skip': { en: 'Skip' },\n 'next': { en: 'Next' },\n },\n}\n","import type { ScaffoldTemplate } from '@contentrain/types'\nimport { blogTemplate } from './blog.js'\nimport { landingTemplate } from './landing.js'\nimport { docsTemplate } from './docs.js'\nimport { ecommerceTemplate } from './ecommerce.js'\nimport { saasTemplate } from './saas.js'\nimport { i18nTemplate } from './i18n.js'\nimport { mobileTemplate } from './mobile.js'\n\nconst templates: Record<string, ScaffoldTemplate> = {\n blog: blogTemplate,\n landing: landingTemplate,\n docs: docsTemplate,\n ecommerce: ecommerceTemplate,\n saas: saasTemplate,\n i18n: i18nTemplate,\n mobile: mobileTemplate,\n}\n\nexport function getTemplate(id: string): ScaffoldTemplate | null {\n return templates[id] ?? null\n}\n\nexport function listTemplates(): string[] {\n return Object.keys(templates)\n}\n"],"mappings":";;AOSA,MAAM,YAA8C;CAClD,MPR4C;EAC5C,IAAI;EACJ,QAAQ;GACN;IACE,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,QAAQ;KACN,OAAc;MAAE,MAAM;MAAU,UAAU;MAAM,KAAK;MAAK;KAC1D,MAAc;MAAE,MAAM;MAAQ,UAAU;MAAM,QAAQ;MAAM;KAC5D,SAAc;MAAE,MAAM;MAAQ,KAAK;MAAK;KACxC,OAAc,EAAE,MAAM,SAAS;KAC/B,QAAc;MAAE,MAAM;MAAY,OAAO;MAAW,UAAU;MAAM;KACpE,UAAc;MAAE,MAAM;MAAY,OAAO;MAAc;KACvD,MAAc;MAAE,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
|
|
1
|
-
import { t as readConfig } from "./config-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as readConfig } from "./config-B5kc2oeV.mjs";
|
|
2
|
+
import { n as writeContext } from "./context-DIDt_TxX.mjs";
|
|
3
|
+
import { t as branchTimestamp } from "./id-DV_T9Ic8.mjs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { rm } from "node:fs/promises";
|
|
6
|
-
import { randomUUID } from "node:crypto";
|
|
7
|
-
import { simpleGit } from "simple-git";
|
|
8
6
|
import { CONTENTRAIN_BRANCH } from "@contentrain/types";
|
|
7
|
+
import { simpleGit } from "simple-git";
|
|
9
8
|
import { tmpdir } from "node:os";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
10
|
//#region src/git/transaction.ts
|
|
11
11
|
async function ensureContentBranch(projectRoot) {
|
|
12
12
|
const git = simpleGit(projectRoot);
|
|
@@ -285,4 +285,4 @@ function buildBranchName(scope, target, locale) {
|
|
|
285
285
|
//#endregion
|
|
286
286
|
export { createTransaction as n, ensureContentBranch as r, buildBranchName as t };
|
|
287
287
|
|
|
288
|
-
//# sourceMappingURL=transaction-
|
|
288
|
+
//# sourceMappingURL=transaction-B0V0_SE2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-CncRbpI9.mjs","names":["removeFile"],"sources":["../src/git/transaction.ts"],"sourcesContent":["import { simpleGit } from 'simple-git'\nimport { join } from 'node:path'\nimport { rm as removeFile } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { randomUUID } from 'node:crypto'\nimport { readConfig } from '../core/config.js'\nimport { writeContext } from '../core/context.js'\nimport { branchTimestamp } from '../util/id.js'\nimport type { SyncResult } from '@contentrain/types'\nimport { CONTENTRAIN_BRANCH } from '@contentrain/types'\n\nexport interface ContextUpdate {\n tool: string\n model: string\n locale?: string\n entries?: string[]\n}\n\nexport interface GitTransaction {\n worktree: string\n branch: string\n write(callback: (worktreePath: string) => Promise<void>): Promise<void>\n commit(message: string, contextUpdate?: ContextUpdate): Promise<string>\n complete(): Promise<{ action: 'auto-merged' | 'pending-review'; commit: string; sync?: SyncResult; warning?: string }>\n cleanup(): Promise<void>\n}\n\nexport async function ensureContentBranch(projectRoot: string): Promise<void> {\n const git = simpleGit(projectRoot)\n const config = await readConfig(projectRoot)\n\n // Check if contentrain branch exists locally\n const branches = await git.branchLocal()\n if (branches.all.includes(CONTENTRAIN_BRANCH)) return\n\n // Detect base branch\n const baseBranch = config?.repository?.default_branch\n || (await git.raw(['branch', '--show-current'])).trim()\n || 'main'\n\n // Migration: old system used `contentrain/*` feature branches which conflict\n // with creating a `contentrain` branch (git ref namespace: path can't be both\n // file and directory). Clean up merged old-prefix branches before creating.\n const oldPrefixBranches = branches.all.filter(b => b.startsWith('contentrain/'))\n if (oldPrefixBranches.length > 0) {\n // Get merged branches (safe to delete)\n let mergedBranches: string[] = []\n try {\n const mergedOutput = await git.raw(['branch', '--merged', baseBranch])\n mergedBranches = mergedOutput.split('\\n')\n .map(b => b.trim().replace(/^\\*\\s*/, ''))\n .filter(b => b.startsWith('contentrain/'))\n } catch { /* ignore */ }\n\n // Delete merged old-prefix branches\n for (const b of mergedBranches) {\n try { await git.raw(['branch', '-d', b]) } catch { /* skip if protected */ }\n }\n\n // Check if unmerged old-prefix branches still block creation\n const remaining = (await git.branchLocal()).all.filter(b => b.startsWith('contentrain/'))\n if (remaining.length > 0) {\n // Force-delete remaining old-prefix branches (they use the old system,\n // content is already on main via previous auto-merges)\n for (const b of remaining) {\n try { await git.raw(['branch', '-D', b]) } catch { /* skip */ }\n }\n }\n }\n\n // Create contentrain branch from base\n await git.branch([CONTENTRAIN_BRANCH, baseBranch])\n\n // Push to remote if exists\n const remoteName = process.env['CONTENTRAIN_REMOTE'] ?? 'origin'\n try {\n const remotes = await git.getRemotes()\n if (remotes.some(r => r.name === remoteName)) {\n await git.push(['-u', remoteName, CONTENTRAIN_BRANCH])\n }\n } catch {\n // Remote push is best-effort\n }\n}\n\nasync function selectiveSync(\n projectRoot: string,\n _worktreePath: string,\n contentrainTip: string,\n _previousBaseRef?: string,\n dirtyFilesBeforeUpdate?: Set<string>,\n): Promise<SyncResult> {\n const git = simpleGit(projectRoot)\n const synced: string[] = []\n const skipped: string[] = []\n\n // Use git plumbing to find ALL files that differ between old and new commits.\n // diff-tree is fast and ignores working tree / index state entirely.\n // Not limited to .contentrain/ — some ops also modify .gitignore, etc.\n const compareRef = _previousBaseRef ?? contentrainTip\n let changedFiles: string[] = []\n try {\n const diffOutput = await git.raw([\n 'diff-tree', '--name-only', '-r', '--no-commit-id',\n compareRef, contentrainTip,\n ])\n changedFiles = diffOutput.split('\\n').filter(f => f.trim().length > 0)\n } catch {\n // Fallback: list .contentrain/ files from the contentrainTip commit\n try {\n const lsOutput = await git.raw(['ls-tree', '-r', '--name-only', contentrainTip, '.contentrain/'])\n changedFiles = lsOutput.split('\\n').filter(f => f.trim().length > 0)\n } catch {\n return { synced, skipped }\n }\n }\n\n if (changedFiles.length === 0) return { synced, skipped }\n\n // Use pre-captured dirty files (before update-ref) to avoid false positives.\n // After update-ref, files appear as \"modified\" in status even though the developer\n // didn't touch them. We use the pre-update state to know what was truly dirty.\n const dirtyFiles = dirtyFilesBeforeUpdate ?? new Set<string>()\n\n // Determine which changed files still exist in contentrainTip (HEAD after update-ref)\n // Check each changed file individually — `ls-tree` on specific paths is efficient\n const filesInTip = new Set<string>()\n for (const file of changedFiles) {\n try {\n await git.raw(['cat-file', '-e', `${contentrainTip}:${file}`])\n filesInTip.add(file)\n } catch {\n // File does not exist in tip (was deleted)\n }\n }\n\n for (const file of changedFiles) {\n if (dirtyFiles.has(file)) {\n skipped.push(file)\n } else if (filesInTip.has(file)) {\n // File exists in new HEAD — checkout from HEAD\n try {\n await git.checkout(['HEAD', '--', file])\n synced.push(file)\n } catch {\n skipped.push(file)\n }\n } else {\n // File was deleted in new HEAD — remove from working tree\n try {\n const filePath = join(projectRoot, file)\n await removeFile(filePath, { force: true })\n synced.push(file)\n } catch {\n skipped.push(file)\n }\n }\n }\n\n const warning = skipped.length > 0\n ? `${skipped.length} file(s) skipped due to local changes: ${skipped.join(', ')}. Commit your changes, then run: git checkout HEAD -- ${skipped.join(' ')}`\n : undefined\n\n return { synced, skipped, warning }\n}\n\nexport async function createTransaction(\n projectRoot: string,\n branchName: string,\n options?: { workflowOverride?: 'review' | 'auto-merge' },\n): Promise<GitTransaction> {\n const git = simpleGit(projectRoot)\n const config = await readConfig(projectRoot)\n const workflow = options?.workflowOverride ?? config?.workflow ?? 'auto-merge'\n\n const remoteName = process.env['CONTENTRAIN_REMOTE'] ?? 'origin'\n\n // Detect base branch + current branch + remote in ONE batch\n // (reduces subprocess spawns from 4 to 2)\n let baseBranch = process.env['CONTENTRAIN_BRANCH'] ?? config?.repository?.default_branch ?? ''\n let currentBranch = ''\n let hasRemote = false\n\n const [branchResult, remotes] = await Promise.all([\n git.raw(['branch', '--show-current']).catch(() => ''),\n git.getRemotes().catch(() => []),\n ])\n currentBranch = branchResult.trim()\n if (!baseBranch) baseBranch = currentBranch || 'main'\n hasRemote = (remotes as { name: string }[]).some(r => r.name === remoteName)\n\n // Check if developer is on contentrain branch\n if (currentBranch === CONTENTRAIN_BRANCH) {\n throw Object.assign(new Error(\n `The '${CONTENTRAIN_BRANCH}' branch is checked out in your working directory. `\n + `Contentrain manages this branch automatically. `\n + `Switch to your working branch and retry.`,\n ), {\n code: 'CONTENT_BRANCH_CHECKED_OUT',\n agent_hint: 'Ask the developer to switch to their working branch (e.g., main or a feature branch), then retry the operation.',\n developer_action: `git checkout ${baseBranch}`,\n })\n }\n\n // Ensure contentrain branch exists (with migration for old contentrain/* branches)\n await ensureContentBranch(projectRoot)\n\n // Fetch latest from remote (parallel fetch for both branches)\n if (hasRemote) {\n await Promise.all([\n git.fetch(remoteName, baseBranch).catch(() => {}),\n git.fetch(remoteName, CONTENTRAIN_BRANCH).catch(() => {}),\n ])\n }\n\n const worktreePath = join(tmpdir(), `cr-${randomUUID()}`)\n const branch = branchName\n\n // Create worktree on contentrain branch\n await git.raw(['worktree', 'add', worktreePath, CONTENTRAIN_BRANCH])\n\n const wtGit = simpleGit(worktreePath)\n\n // Configure author (sequential — git config uses lock file)\n const authorName = process.env['CONTENTRAIN_AUTHOR_NAME'] ?? 'Contentrain'\n const authorEmail = process.env['CONTENTRAIN_AUTHOR_EMAIL'] ?? 'mcp@contentrain.io'\n await wtGit.addConfig('user.name', authorName)\n await wtGit.addConfig('user.email', authorEmail)\n\n // Sync contentrain with base branch (bring main changes into contentrain)\n try {\n await wtGit.merge([baseBranch, '--no-edit'])\n } catch {\n try { await wtGit.merge(['--abort']) } catch { /* not in merge state */ }\n if (hasRemote) {\n try {\n await wtGit.merge([`${remoteName}/${baseBranch}`, '--no-edit'])\n } catch {\n try { await wtGit.merge(['--abort']) } catch { /* ignore */ }\n }\n }\n }\n\n // Sync with remote contentrain if exists\n if (hasRemote) {\n try {\n await wtGit.merge([`${remoteName}/${CONTENTRAIN_BRANCH}`, '--no-edit'])\n } catch {\n try { await wtGit.merge(['--abort']) } catch { /* ignore */ }\n }\n }\n\n // Create feature branch from contentrain\n await wtGit.checkout(['-b', branch])\n\n let commitHash = ''\n\n return {\n worktree: worktreePath,\n branch,\n\n async write(callback) {\n await callback(worktreePath)\n },\n\n async commit(message, contextUpdate?) {\n // Write context.json together with content (no separate commit)\n if (contextUpdate) {\n await writeContext(worktreePath, contextUpdate)\n }\n await wtGit.add('.')\n const result = await wtGit.commit(message, { '--allow-empty': null })\n commitHash = result.commit || ''\n return commitHash\n },\n\n async complete() {\n if (workflow === 'review') {\n if (hasRemote) {\n await git.push(remoteName, branch)\n }\n return { action: 'pending-review', commit: commitHash }\n }\n\n // auto-merge: merge feature branch into contentrain, then advance base\n\n // Switch to contentrain branch in worktree\n await wtGit.checkout(CONTENTRAIN_BRANCH)\n\n // Merge feature branch into contentrain\n try {\n await wtGit.merge([branch, '--no-edit'])\n } catch {\n try {\n await wtGit.merge(['--abort'])\n } catch { /* not in merge state */ }\n throw Object.assign(new Error(\n `Merge conflict when merging branch \"${branch}\" into \"${CONTENTRAIN_BRANCH}\". `\n + `The branch still exists with your changes intact. `\n + `Resolve the conflict manually, or delete the branch and retry.`,\n ), {\n code: 'CONTENT_BRANCH_MERGE_CONFLICT',\n agent_hint: 'The feature branch could not be merged into the contentrain branch. Ask the developer to resolve the conflict.',\n developer_action: `git checkout ${CONTENTRAIN_BRANCH} && git merge ${branch}`,\n })\n }\n\n // Get contentrain tip + old base ref + dirty files in parallel\n const [contentrainTip, previousBaseRef, statusBeforeUpdate] = await Promise.all([\n wtGit.raw(['rev-parse', 'HEAD']).then(s => s.trim()),\n git.raw(['rev-parse', baseBranch]).then(s => s.trim()),\n git.status(),\n ])\n const dirtyFilesBeforeUpdate = new Set(statusBeforeUpdate.files.map(f => f.path))\n\n // Verify fast-forward: baseBranch must be an ancestor of contentrainTip\n // (guaranteed by the merge above, but verify for safety)\n try {\n await git.raw(['merge-base', '--is-ancestor', previousBaseRef, contentrainTip])\n } catch {\n throw Object.assign(new Error(\n `Cannot fast-forward \"${baseBranch}\" to contentrain tip. `\n + `The base branch has diverged. Merge \"${baseBranch}\" into \"${CONTENTRAIN_BRANCH}\" first.`,\n ), {\n code: 'BASE_UPDATE_FAILED',\n agent_hint: `The base branch has commits not in contentrain. Merge ${baseBranch} into ${CONTENTRAIN_BRANCH} first.`,\n developer_action: `git checkout ${CONTENTRAIN_BRANCH} && git merge ${baseBranch} && git checkout ${baseBranch}`,\n })\n }\n\n // Advance base branch to contentrain tip via update-ref\n await git.raw(['update-ref', `refs/heads/${baseBranch}`, contentrainTip])\n\n // Refresh index to match new HEAD.\n // update-ref moves the branch pointer but leaves the index stale.\n // read-tree updates the index to match HEAD without touching the working tree.\n try {\n await git.raw(['read-tree', 'HEAD'])\n } catch {\n // fallback: try reset for older git versions\n try { await git.raw(['reset', 'HEAD']) } catch { /* ignore */ }\n }\n\n // Selective sync: copy .contentrain/ files to developer's working tree\n const sync = await selectiveSync(projectRoot, worktreePath, contentrainTip, previousBaseRef, dirtyFilesBeforeUpdate)\n\n // Push to remote (best-effort with retry)\n if (hasRemote) {\n // Push contentrain branch\n try {\n await git.push(remoteName, CONTENTRAIN_BRANCH)\n } catch {\n // Retry: fetch, merge, push\n try {\n await wtGit.fetch(remoteName, CONTENTRAIN_BRANCH)\n await wtGit.merge([`${remoteName}/${CONTENTRAIN_BRANCH}`, '--no-edit'])\n await git.push(remoteName, CONTENTRAIN_BRANCH)\n } catch {\n // Push failed after retry — continue, local state is fine\n }\n }\n\n // Push base branch\n try {\n await git.push(remoteName, baseBranch)\n } catch {\n // push may fail, local merge succeeded\n }\n }\n\n return {\n action: 'auto-merged' as const,\n commit: commitHash,\n sync,\n ...(sync.warning ? { warning: sync.warning } : {}),\n }\n },\n\n async cleanup() {\n try {\n await git.raw(['worktree', 'remove', worktreePath, '--force'])\n } catch {\n // worktree may already be cleaned up\n }\n },\n }\n}\n\nexport function buildBranchName(scope: string, target: string, locale?: string): string {\n const ts = branchTimestamp()\n const parts = ['cr', scope, target]\n if (locale) parts.push(locale)\n parts.push(ts)\n return parts.join('/')\n}\n"],"mappings":";;;;;;;;;;AA2BA,eAAsB,oBAAoB,aAAoC;CAC5E,MAAM,MAAM,UAAU,YAAY;CAClC,MAAM,SAAS,MAAM,WAAW,YAAY;CAG5C,MAAM,WAAW,MAAM,IAAI,aAAa;AACxC,KAAI,SAAS,IAAI,SAAS,mBAAmB,CAAE;CAG/C,MAAM,aAAa,QAAQ,YAAY,mBACjC,MAAM,IAAI,IAAI,CAAC,UAAU,iBAAiB,CAAC,EAAE,MAAM,IACpD;AAML,KAD0B,SAAS,IAAI,QAAO,MAAK,EAAE,WAAW,eAAe,CAAC,CAC1D,SAAS,GAAG;EAEhC,IAAI,iBAA2B,EAAE;AACjC,MAAI;AAEF,qBADqB,MAAM,IAAI,IAAI;IAAC;IAAU;IAAY;IAAW,CAAC,EACxC,MAAM,KAAK,CACtC,K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N,YAAY,yDAAyD,WAAW,QAAQ,mBAAmB;KAC3G,kBAAkB,gBAAgB,mBAAmB,gBAAgB,WAAW,mBAAmB;KACpG,CAAC;;AAIJ,SAAM,IAAI,IAAI;IAAC;IAAc,cAAc;IAAc;IAAe,CAAC;AAKzE,OAAI;AACF,UAAM,IAAI,IAAI,CAAC,aAAa,OAAO,CAAC;WAC9B;AAEN,QAAI;AAAE,WAAM,IAAI,IAAI,CAAC,SAAS,OAAO,CAAC;YAAS;;GAIjD,MAAM,OAAO,MAAM,cAAc,aAAa,cAAc,gBAAgB,iBAAiB,uBAAuB;AAGpH,OAAI,WAAW;AAEb,QAAI;AACF,WAAM,IAAI,KAAK,YAAY,mBAAmB;YACxC;AAEN,SAAI;AACF,YAAM,MAAM,MAAM,YAAY,mBAAmB;AACjD,YAAM,MAAM,MAAM,CAAC,GAAG,WAAW,GAAG,sBAAsB,YAAY,CAAC;AACvE,YAAM,IAAI,KAAK,YAAY,mBAAmB;aACxC;;AAMV,QAAI;AACF,WAAM,IAAI,KAAK,YAAY,WAAW;YAChC;;AAKV,UAAO;IACL,QAAQ;IACR,QAAQ;IACR;IACA,GAAI,KAAK,UAAU,EAAE,SAAS,KAAK,SAAS,GAAG,EAAE;IAClD;;EAGH,MAAM,UAAU;AACd,OAAI;AACF,UAAM,IAAI,IAAI;KAAC;KAAY;KAAU;KAAc;KAAU,CAAC;WACxD;;EAIX;;AAGH,SAAgB,gBAAgB,OAAe,QAAgB,QAAyB;CACtF,MAAM,KAAK,iBAAiB;CAC5B,MAAM,QAAQ;EAAC;EAAM;EAAO;EAAO;AACnC,KAAI,OAAQ,OAAM,KAAK,OAAO;AAC9B,OAAM,KAAK,GAAG;AACd,QAAO,MAAM,KAAK,IAAI"}
|
|
1
|
+
{"version":3,"file":"transaction-B0V0_SE2.mjs","names":["removeFile"],"sources":["../src/git/transaction.ts"],"sourcesContent":["import { simpleGit } from 'simple-git'\nimport { join } from 'node:path'\nimport { rm as removeFile } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { randomUUID } from 'node:crypto'\nimport { readConfig } from '../core/config.js'\nimport { writeContext } from '../core/context.js'\nimport { branchTimestamp } from '../util/id.js'\nimport type { SyncResult } from '@contentrain/types'\nimport { CONTENTRAIN_BRANCH } from '@contentrain/types'\n\nexport interface ContextUpdate {\n tool: string\n model: string\n locale?: string\n entries?: string[]\n}\n\nexport interface GitTransaction {\n worktree: string\n branch: string\n write(callback: (worktreePath: string) => Promise<void>): Promise<void>\n commit(message: string, contextUpdate?: ContextUpdate): Promise<string>\n complete(): Promise<{ action: 'auto-merged' | 'pending-review'; commit: string; sync?: SyncResult; warning?: string }>\n cleanup(): Promise<void>\n}\n\nexport async function ensureContentBranch(projectRoot: string): Promise<void> {\n const git = simpleGit(projectRoot)\n const config = await readConfig(projectRoot)\n\n // Check if contentrain branch exists locally\n const branches = await git.branchLocal()\n if (branches.all.includes(CONTENTRAIN_BRANCH)) return\n\n // Detect base branch\n const baseBranch = config?.repository?.default_branch\n || (await git.raw(['branch', '--show-current'])).trim()\n || 'main'\n\n // Migration: old system used `contentrain/*` feature branches which conflict\n // with creating a `contentrain` branch (git ref namespace: path can't be both\n // file and directory). Clean up merged old-prefix branches before creating.\n const oldPrefixBranches = branches.all.filter(b => b.startsWith('contentrain/'))\n if (oldPrefixBranches.length > 0) {\n // Get merged branches (safe to delete)\n let mergedBranches: string[] = []\n try {\n const mergedOutput = await git.raw(['branch', '--merged', baseBranch])\n mergedBranches = mergedOutput.split('\\n')\n .map(b => b.trim().replace(/^\\*\\s*/, ''))\n .filter(b => b.startsWith('contentrain/'))\n } catch { /* ignore */ }\n\n // Delete merged old-prefix branches\n for (const b of mergedBranches) {\n try { await git.raw(['branch', '-d', b]) } catch { /* skip if protected */ }\n }\n\n // Check if unmerged old-prefix branches still block creation\n const remaining = (await git.branchLocal()).all.filter(b => b.startsWith('contentrain/'))\n if (remaining.length > 0) {\n // Force-delete remaining old-prefix branches (they use the old system,\n // content is already on main via previous auto-merges)\n for (const b of remaining) {\n try { await git.raw(['branch', '-D', b]) } catch { /* skip */ }\n }\n }\n }\n\n // Create contentrain branch from base\n await git.branch([CONTENTRAIN_BRANCH, baseBranch])\n\n // Push to remote if exists\n const remoteName = process.env['CONTENTRAIN_REMOTE'] ?? 'origin'\n try {\n const remotes = await git.getRemotes()\n if (remotes.some(r => r.name === remoteName)) {\n await git.push(['-u', remoteName, CONTENTRAIN_BRANCH])\n }\n } catch {\n // Remote push is best-effort\n }\n}\n\nasync function selectiveSync(\n projectRoot: string,\n _worktreePath: string,\n contentrainTip: string,\n _previousBaseRef?: string,\n dirtyFilesBeforeUpdate?: Set<string>,\n): Promise<SyncResult> {\n const git = simpleGit(projectRoot)\n const synced: string[] = []\n const skipped: string[] = []\n\n // Use git plumbing to find ALL files that differ between old and new commits.\n // diff-tree is fast and ignores working tree / index state entirely.\n // Not limited to .contentrain/ — some ops also modify .gitignore, etc.\n const compareRef = _previousBaseRef ?? contentrainTip\n let changedFiles: string[] = []\n try {\n const diffOutput = await git.raw([\n 'diff-tree', '--name-only', '-r', '--no-commit-id',\n compareRef, contentrainTip,\n ])\n changedFiles = diffOutput.split('\\n').filter(f => f.trim().length > 0)\n } catch {\n // Fallback: list .contentrain/ files from the contentrainTip commit\n try {\n const lsOutput = await git.raw(['ls-tree', '-r', '--name-only', contentrainTip, '.contentrain/'])\n changedFiles = lsOutput.split('\\n').filter(f => f.trim().length > 0)\n } catch {\n return { synced, skipped }\n }\n }\n\n if (changedFiles.length === 0) return { synced, skipped }\n\n // Use pre-captured dirty files (before update-ref) to avoid false positives.\n // After update-ref, files appear as \"modified\" in status even though the developer\n // didn't touch them. We use the pre-update state to know what was truly dirty.\n const dirtyFiles = dirtyFilesBeforeUpdate ?? new Set<string>()\n\n // Determine which changed files still exist in contentrainTip (HEAD after update-ref)\n // Check each changed file individually — `ls-tree` on specific paths is efficient\n const filesInTip = new Set<string>()\n for (const file of changedFiles) {\n try {\n await git.raw(['cat-file', '-e', `${contentrainTip}:${file}`])\n filesInTip.add(file)\n } catch {\n // File does not exist in tip (was deleted)\n }\n }\n\n for (const file of changedFiles) {\n if (dirtyFiles.has(file)) {\n skipped.push(file)\n } else if (filesInTip.has(file)) {\n // File exists in new HEAD — checkout from HEAD\n try {\n await git.checkout(['HEAD', '--', file])\n synced.push(file)\n } catch {\n skipped.push(file)\n }\n } else {\n // File was deleted in new HEAD — remove from working tree\n try {\n const filePath = join(projectRoot, file)\n await removeFile(filePath, { force: true })\n synced.push(file)\n } catch {\n skipped.push(file)\n }\n }\n }\n\n const warning = skipped.length > 0\n ? `${skipped.length} file(s) skipped due to local changes: ${skipped.join(', ')}. Commit your changes, then run: git checkout HEAD -- ${skipped.join(' ')}`\n : undefined\n\n return { synced, skipped, warning }\n}\n\nexport async function createTransaction(\n projectRoot: string,\n branchName: string,\n options?: { workflowOverride?: 'review' | 'auto-merge' },\n): Promise<GitTransaction> {\n const git = simpleGit(projectRoot)\n const config = await readConfig(projectRoot)\n const workflow = options?.workflowOverride ?? config?.workflow ?? 'auto-merge'\n\n const remoteName = process.env['CONTENTRAIN_REMOTE'] ?? 'origin'\n\n // Detect base branch + current branch + remote in ONE batch\n // (reduces subprocess spawns from 4 to 2)\n let baseBranch = process.env['CONTENTRAIN_BRANCH'] ?? config?.repository?.default_branch ?? ''\n let currentBranch = ''\n let hasRemote = false\n\n const [branchResult, remotes] = await Promise.all([\n git.raw(['branch', '--show-current']).catch(() => ''),\n git.getRemotes().catch(() => []),\n ])\n currentBranch = branchResult.trim()\n if (!baseBranch) baseBranch = currentBranch || 'main'\n hasRemote = (remotes as { name: string }[]).some(r => r.name === remoteName)\n\n // Check if developer is on contentrain branch\n if (currentBranch === CONTENTRAIN_BRANCH) {\n throw Object.assign(new Error(\n `The '${CONTENTRAIN_BRANCH}' branch is checked out in your working directory. `\n + `Contentrain manages this branch automatically. `\n + `Switch to your working branch and retry.`,\n ), {\n code: 'CONTENT_BRANCH_CHECKED_OUT',\n agent_hint: 'Ask the developer to switch to their working branch (e.g., main or a feature branch), then retry the operation.',\n developer_action: `git checkout ${baseBranch}`,\n })\n }\n\n // Ensure contentrain branch exists (with migration for old contentrain/* branches)\n await ensureContentBranch(projectRoot)\n\n // Fetch latest from remote (parallel fetch for both branches)\n if (hasRemote) {\n await Promise.all([\n git.fetch(remoteName, baseBranch).catch(() => {}),\n git.fetch(remoteName, CONTENTRAIN_BRANCH).catch(() => {}),\n ])\n }\n\n const worktreePath = join(tmpdir(), `cr-${randomUUID()}`)\n const branch = branchName\n\n // Create worktree on contentrain branch\n await git.raw(['worktree', 'add', worktreePath, CONTENTRAIN_BRANCH])\n\n const wtGit = simpleGit(worktreePath)\n\n // Configure author (sequential — git config uses lock file)\n const authorName = process.env['CONTENTRAIN_AUTHOR_NAME'] ?? 'Contentrain'\n const authorEmail = process.env['CONTENTRAIN_AUTHOR_EMAIL'] ?? 'mcp@contentrain.io'\n await wtGit.addConfig('user.name', authorName)\n await wtGit.addConfig('user.email', authorEmail)\n\n // Sync contentrain with base branch (bring main changes into contentrain)\n try {\n await wtGit.merge([baseBranch, '--no-edit'])\n } catch {\n try { await wtGit.merge(['--abort']) } catch { /* not in merge state */ }\n if (hasRemote) {\n try {\n await wtGit.merge([`${remoteName}/${baseBranch}`, '--no-edit'])\n } catch {\n try { await wtGit.merge(['--abort']) } catch { /* ignore */ }\n }\n }\n }\n\n // Sync with remote contentrain if exists\n if (hasRemote) {\n try {\n await wtGit.merge([`${remoteName}/${CONTENTRAIN_BRANCH}`, '--no-edit'])\n } catch {\n try { await wtGit.merge(['--abort']) } catch { /* ignore */ }\n }\n }\n\n // Create feature branch from contentrain\n await wtGit.checkout(['-b', branch])\n\n let commitHash = ''\n\n return {\n worktree: worktreePath,\n branch,\n\n async write(callback) {\n await callback(worktreePath)\n },\n\n async commit(message, contextUpdate?) {\n // Write context.json together with content (no separate commit)\n if (contextUpdate) {\n await writeContext(worktreePath, contextUpdate)\n }\n await wtGit.add('.')\n const result = await wtGit.commit(message, { '--allow-empty': null })\n commitHash = result.commit || ''\n return commitHash\n },\n\n async complete() {\n if (workflow === 'review') {\n if (hasRemote) {\n await git.push(remoteName, branch)\n }\n return { action: 'pending-review', commit: commitHash }\n }\n\n // auto-merge: merge feature branch into contentrain, then advance base\n\n // Switch to contentrain branch in worktree\n await wtGit.checkout(CONTENTRAIN_BRANCH)\n\n // Merge feature branch into contentrain\n try {\n await wtGit.merge([branch, '--no-edit'])\n } catch {\n try {\n await wtGit.merge(['--abort'])\n } catch { /* not in merge state */ }\n throw Object.assign(new Error(\n `Merge conflict when merging branch \"${branch}\" into \"${CONTENTRAIN_BRANCH}\". `\n + `The branch still exists with your changes intact. `\n + `Resolve the conflict manually, or delete the branch and retry.`,\n ), {\n code: 'CONTENT_BRANCH_MERGE_CONFLICT',\n agent_hint: 'The feature branch could not be merged into the contentrain branch. Ask the developer to resolve the conflict.',\n developer_action: `git checkout ${CONTENTRAIN_BRANCH} && git merge ${branch}`,\n })\n }\n\n // Get contentrain tip + old base ref + dirty files in parallel\n const [contentrainTip, previousBaseRef, statusBeforeUpdate] = await Promise.all([\n wtGit.raw(['rev-parse', 'HEAD']).then(s => s.trim()),\n git.raw(['rev-parse', baseBranch]).then(s => s.trim()),\n git.status(),\n ])\n const dirtyFilesBeforeUpdate = new Set(statusBeforeUpdate.files.map(f => f.path))\n\n // Verify fast-forward: baseBranch must be an ancestor of contentrainTip\n // (guaranteed by the merge above, but verify for safety)\n try {\n await git.raw(['merge-base', '--is-ancestor', previousBaseRef, contentrainTip])\n } catch {\n throw Object.assign(new Error(\n `Cannot fast-forward \"${baseBranch}\" to contentrain tip. `\n + `The base branch has diverged. Merge \"${baseBranch}\" into \"${CONTENTRAIN_BRANCH}\" first.`,\n ), {\n code: 'BASE_UPDATE_FAILED',\n agent_hint: `The base branch has commits not in contentrain. Merge ${baseBranch} into ${CONTENTRAIN_BRANCH} first.`,\n developer_action: `git checkout ${CONTENTRAIN_BRANCH} && git merge ${baseBranch} && git checkout ${baseBranch}`,\n })\n }\n\n // Advance base branch to contentrain tip via update-ref\n await git.raw(['update-ref', `refs/heads/${baseBranch}`, contentrainTip])\n\n // Refresh index to match new HEAD.\n // update-ref moves the branch pointer but leaves the index stale.\n // read-tree updates the index to match HEAD without touching the working tree.\n try {\n await git.raw(['read-tree', 'HEAD'])\n } catch {\n // fallback: try reset for older git versions\n try { await git.raw(['reset', 'HEAD']) } catch { /* ignore */ }\n }\n\n // Selective sync: copy .contentrain/ files to developer's working tree\n const sync = await selectiveSync(projectRoot, worktreePath, contentrainTip, previousBaseRef, dirtyFilesBeforeUpdate)\n\n // Push to remote (best-effort with retry)\n if (hasRemote) {\n // Push contentrain branch\n try {\n await git.push(remoteName, CONTENTRAIN_BRANCH)\n } catch {\n // Retry: fetch, merge, push\n try {\n await wtGit.fetch(remoteName, CONTENTRAIN_BRANCH)\n await wtGit.merge([`${remoteName}/${CONTENTRAIN_BRANCH}`, '--no-edit'])\n await git.push(remoteName, CONTENTRAIN_BRANCH)\n } catch {\n // Push failed after retry — continue, local state is fine\n }\n }\n\n // Push base branch\n try {\n await git.push(remoteName, baseBranch)\n } catch {\n // push may fail, local merge succeeded\n }\n }\n\n return {\n action: 'auto-merged' as const,\n commit: commitHash,\n sync,\n ...(sync.warning ? { warning: sync.warning } : {}),\n }\n },\n\n async cleanup() {\n try {\n await git.raw(['worktree', 'remove', worktreePath, '--force'])\n } catch {\n // worktree may already be cleaned up\n }\n },\n }\n}\n\nexport function buildBranchName(scope: string, target: string, locale?: string): string {\n const ts = branchTimestamp()\n const parts = ['cr', scope, target]\n if (locale) parts.push(locale)\n parts.push(ts)\n return parts.join('/')\n}\n"],"mappings":";;;;;;;;;;AA2BA,eAAsB,oBAAoB,aAAoC;CAC5E,MAAM,MAAM,UAAU,YAAY;CAClC,MAAM,SAAS,MAAM,WAAW,YAAY;CAG5C,MAAM,WAAW,MAAM,IAAI,aAAa;AACxC,KAAI,SAAS,IAAI,SAAS,mBAAmB,CAAE;CAG/C,MAAM,aAA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;CAC5B,MAAM,QAAQ;EAAC;EAAM;EAAO;EAAO;AACnC,KAAI,OAAQ,OAAM,KAAK,OAAO;AAC9B,OAAM,KAAK,GAAG;AACd,QAAO,MAAM,KAAK,IAAI"}
|
package/dist/util/detect.mjs
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../serializer-CnHTtmc1.mjs";
|
|
2
|
+
import "../fs-BnIQ4dKj.mjs";
|
|
3
|
+
import { n as detectStackInfo, r as inferPlatform, t as detectStack } from "../detect-DinOQAmK.mjs";
|
|
2
4
|
export { detectStack, detectStackInfo, inferPlatform };
|
package/dist/util/fs.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../serializer-CnHTtmc1.mjs";
|
|
2
|
+
import { a as readJson, c as writeText, i as readDir, n as ensureDir, o as readText, r as pathExists, s as writeJson, t as contentrainDir } from "../fs-BnIQ4dKj.mjs";
|
|
2
3
|
export { contentrainDir, ensureDir, pathExists, readDir, readJson, readText, writeJson, writeText };
|
package/dist/util/id.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { generateEntryId } from "@contentrain/types";
|
|
2
|
+
|
|
1
3
|
//#region src/util/id.d.ts
|
|
2
4
|
declare function branchTimestamp(): string;
|
|
3
|
-
declare function generateEntryId(): string;
|
|
4
5
|
//#endregion
|
|
5
6
|
export { branchTimestamp, generateEntryId };
|
|
6
7
|
//# sourceMappingURL=id.d.mts.map
|
package/dist/util/id.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.mts","names":[],"sources":["../../src/util/id.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"id.d.mts","names":[],"sources":["../../src/util/id.ts"],"mappings":";;;iBAEgB,eAAA,CAAA"}
|
package/dist/util/id.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as generateEntryId, t as branchTimestamp } from "../id-
|
|
1
|
+
import { n as generateEntryId, t as branchTimestamp } from "../id-DV_T9Ic8.mjs";
|
|
2
2
|
export { branchTimestamp, generateEntryId };
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Canonical JSON serialization — deterministic output for git diff stability.
|
|
4
|
-
*
|
|
5
|
-
* Rules (spec Section 14.10):
|
|
6
|
-
* - Top-level keys: lexicographic sort
|
|
7
|
-
* - Entry fields: follow fieldOrder if provided, else lexicographic
|
|
8
|
-
* - 2-space indent, UTF-8, trailing newline
|
|
9
|
-
* - Null/undefined values omitted
|
|
10
|
-
*/
|
|
11
|
-
declare function canonicalStringify(data: unknown, fieldOrder?: string[]): string;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { canonicalStringify };
|
|
14
|
-
//# sourceMappingURL=serializer.d.mts.map
|
|
1
|
+
import { canonicalStringify, sortKeys } from "@contentrain/types";
|
|
2
|
+
export { canonicalStringify, sortKeys };
|
package/dist/util/serializer.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as canonicalStringify } from "../serializer-
|
|
2
|
-
export { canonicalStringify };
|
|
1
|
+
import { n as sortKeys, t as canonicalStringify } from "../serializer-CnHTtmc1.mjs";
|
|
2
|
+
export { canonicalStringify, sortKeys };
|