@decantr/core 1.0.0-beta.9 → 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Decantr AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @decantr/core
2
+
3
+ Support status: `core-supported`
4
+ Release channel: `stable`
5
+
6
+ Low-level Decantr compiler and execution-pack foundation.
7
+
8
+ Most teams should use `@decantr/cli`, `@decantr/registry`, or `@decantr/mcp-server` directly. This package remains inside the Decantr implementation boundary and is not part of the supported public package contract.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @decantr/core
14
+ ```
15
+
16
+ ## Stability
17
+
18
+ `@decantr/core` is published for advanced package consumers that need low-level execution-pack primitives. It is stable in the `1.x` line for the documented exports in this package, but it is still not the recommended first integration surface for most Decantr adopters.
19
+
20
+ ## What It Exports
21
+
22
+ - execution-pack builders for scaffold, section, page, mutation, and review scopes
23
+ - execution-pack schema URLs
24
+ - markdown rendering for compiled packs
25
+ - IR and pipeline helpers used by higher-level Decantr surfaces
26
+
27
+ ## Example
28
+
29
+ ```ts
30
+ import { buildReviewPack, renderExecutionPackMarkdown } from '@decantr/core';
31
+
32
+ const pack = buildReviewPack({
33
+ projectName: 'Acme Console',
34
+ target: 'react',
35
+ routeCount: 4,
36
+ sections: ['overview', 'settings'],
37
+ });
38
+
39
+ const markdown = renderExecutionPackMarkdown(pack);
40
+ ```
41
+
42
+ ## Schema Exports
43
+
44
+ This package publishes execution-pack schemas under:
45
+
46
+ - `@decantr/core/schema/scaffold-pack.v1.json`
47
+ - `@decantr/core/schema/section-pack.v1.json`
48
+ - `@decantr/core/schema/page-pack.v1.json`
49
+ - `@decantr/core/schema/mutation-pack.v1.json`
50
+ - `@decantr/core/schema/review-pack.v1.json`
51
+ - `@decantr/core/schema/pack-manifest.v1.json`
52
+
53
+ ## License
54
+
55
+ MIT
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { EssenceFile, StructurePage } from '@decantr/essence-spec';
2
- import { Pattern, ResolvedPreset, Theme, ContentResolver } from '@decantr/registry';
1
+ import { EssenceFile, EssenceV3, StructurePage } from '@decantr/essence-spec';
2
+ import { ContentResolver, Pattern, ResolvedPreset, Theme } from '@decantr/registry';
3
3
 
4
4
  type IRNodeType = 'app' | 'shell' | 'page' | 'pattern' | 'grid' | 'nav' | 'store';
5
5
  interface IRSpatial {
@@ -31,8 +31,8 @@ interface IRPatternMeta {
31
31
  contained: boolean;
32
32
  standalone: boolean;
33
33
  code: {
34
- imports: string;
35
- example: string;
34
+ imports?: string;
35
+ example?: string;
36
36
  } | null;
37
37
  components: string[];
38
38
  }
@@ -94,7 +94,7 @@ interface IRAppNode extends IRNode {
94
94
  type: 'app';
95
95
  theme: IRTheme;
96
96
  routes: IRRoute[];
97
- routing: 'hash' | 'history';
97
+ routing: 'hash' | 'history' | 'pathname';
98
98
  shell: IRShellNode;
99
99
  store: IRStoreNode;
100
100
  features: string[];
@@ -136,13 +136,283 @@ interface IRStoreNode extends IRNode {
136
136
  }[];
137
137
  }
138
138
 
139
+ type ExecutionPackType = 'scaffold' | 'section' | 'page' | 'mutation' | 'review';
140
+ declare const EXECUTION_PACK_SCHEMA_URLS: {
141
+ readonly scaffold: "https://decantr.ai/schemas/scaffold-pack.v1.json";
142
+ readonly section: "https://decantr.ai/schemas/section-pack.v1.json";
143
+ readonly page: "https://decantr.ai/schemas/page-pack.v1.json";
144
+ readonly mutation: "https://decantr.ai/schemas/mutation-pack.v1.json";
145
+ readonly review: "https://decantr.ai/schemas/review-pack.v1.json";
146
+ };
147
+ declare const PACK_MANIFEST_SCHEMA_URL = "https://decantr.ai/schemas/pack-manifest.v1.json";
148
+ declare const EXECUTION_PACK_BUNDLE_SCHEMA_URL = "https://decantr.ai/schemas/execution-pack-bundle.v1.json";
149
+ declare const SELECTED_EXECUTION_PACK_SCHEMA_URL = "https://decantr.ai/schemas/selected-execution-pack.v1.json";
150
+ interface ExecutionPackTarget {
151
+ platform: 'web';
152
+ framework: string | null;
153
+ runtime: string | null;
154
+ adapter: string;
155
+ }
156
+ interface ExecutionPackScope {
157
+ appId: string;
158
+ pageIds: string[];
159
+ patternIds: string[];
160
+ }
161
+ interface ExecutionPackExample {
162
+ id: string;
163
+ label: string;
164
+ language: string;
165
+ snippet: string;
166
+ }
167
+ interface ExecutionPackAntiPattern {
168
+ id: string;
169
+ summary: string;
170
+ guidance: string;
171
+ }
172
+ interface ExecutionPackSuccessCheck {
173
+ id: string;
174
+ label: string;
175
+ severity: 'error' | 'warn' | 'info';
176
+ }
177
+ interface ExecutionPackTokenBudget {
178
+ target: number;
179
+ max: number;
180
+ strategy: string[];
181
+ }
182
+ interface ExecutionPackBase<TData> {
183
+ $schema: string;
184
+ packVersion: '1.0.0';
185
+ packType: ExecutionPackType;
186
+ objective: string;
187
+ target: ExecutionPackTarget;
188
+ preset: string | null;
189
+ scope: ExecutionPackScope;
190
+ requiredSetup: string[];
191
+ allowedVocabulary: string[];
192
+ examples: ExecutionPackExample[];
193
+ antiPatterns: ExecutionPackAntiPattern[];
194
+ successChecks: ExecutionPackSuccessCheck[];
195
+ tokenBudget: ExecutionPackTokenBudget;
196
+ data: TData;
197
+ renderedMarkdown: string;
198
+ }
199
+ interface PackManifestEntry {
200
+ id: string;
201
+ markdown: string;
202
+ json: string;
203
+ }
204
+ interface PackManifestSectionEntry extends PackManifestEntry {
205
+ pageIds: string[];
206
+ }
207
+ interface PackManifestPageEntry extends PackManifestEntry {
208
+ sectionId: string | null;
209
+ sectionRole: string | null;
210
+ }
211
+ interface PackManifestMutationEntry extends PackManifestEntry {
212
+ mutationType: MutationPackKind;
213
+ }
214
+ interface ExecutionPackManifest {
215
+ $schema: string;
216
+ version: '1.0.0';
217
+ generatedAt: string;
218
+ scaffold: PackManifestEntry | null;
219
+ review: PackManifestEntry | null;
220
+ sections: PackManifestSectionEntry[];
221
+ pages: PackManifestPageEntry[];
222
+ mutations: PackManifestMutationEntry[];
223
+ }
224
+ interface ScaffoldPackRoute {
225
+ pageId: string;
226
+ path: string;
227
+ patternIds: string[];
228
+ }
229
+ interface ScaffoldPackData {
230
+ shell: string;
231
+ theme: {
232
+ id: string;
233
+ mode: string;
234
+ shape: string | null;
235
+ };
236
+ routing: 'hash' | 'history' | 'pathname';
237
+ features: string[];
238
+ routes: ScaffoldPackRoute[];
239
+ }
240
+ interface ScaffoldExecutionPack extends ExecutionPackBase<ScaffoldPackData> {
241
+ packType: 'scaffold';
242
+ }
243
+ interface SectionPackInput {
244
+ id: string;
245
+ role: string;
246
+ shell: string;
247
+ description: string;
248
+ features: string[];
249
+ pageIds: string[];
250
+ }
251
+ interface SectionPackRoute {
252
+ pageId: string;
253
+ path: string;
254
+ patternIds: string[];
255
+ }
256
+ interface SectionPackData {
257
+ sectionId: string;
258
+ role: string;
259
+ shell: string;
260
+ description: string;
261
+ features: string[];
262
+ theme: {
263
+ id: string;
264
+ mode: string;
265
+ shape: string | null;
266
+ };
267
+ routes: SectionPackRoute[];
268
+ }
269
+ interface SectionExecutionPack extends ExecutionPackBase<SectionPackData> {
270
+ packType: 'section';
271
+ }
272
+ interface PagePackInput {
273
+ pageId: string;
274
+ shell: string;
275
+ sectionId: string | null;
276
+ sectionRole: string | null;
277
+ features: string[];
278
+ }
279
+ interface PagePackPattern {
280
+ id: string;
281
+ alias: string;
282
+ preset: string;
283
+ layout: string;
284
+ }
285
+ interface PagePackData {
286
+ pageId: string;
287
+ path: string;
288
+ shell: string;
289
+ sectionId: string | null;
290
+ sectionRole: string | null;
291
+ features: string[];
292
+ surface: string;
293
+ theme: {
294
+ id: string;
295
+ mode: string;
296
+ shape: string | null;
297
+ };
298
+ wiringSignals: string[];
299
+ patterns: PagePackPattern[];
300
+ }
301
+ interface PageExecutionPack extends ExecutionPackBase<PagePackData> {
302
+ packType: 'page';
303
+ }
304
+ type MutationPackKind = 'add-page' | 'modify';
305
+ interface MutationPackData {
306
+ mutationType: MutationPackKind;
307
+ shell: string;
308
+ theme: {
309
+ id: string;
310
+ mode: string;
311
+ shape: string | null;
312
+ };
313
+ routing: 'hash' | 'history' | 'pathname';
314
+ features: string[];
315
+ routes: ScaffoldPackRoute[];
316
+ workflow: string[];
317
+ }
318
+ interface MutationExecutionPack extends ExecutionPackBase<MutationPackData> {
319
+ packType: 'mutation';
320
+ }
321
+ type ReviewPackKind = 'app';
322
+ interface ReviewPackData {
323
+ reviewType: ReviewPackKind;
324
+ shell: string;
325
+ theme: {
326
+ id: string;
327
+ mode: string;
328
+ shape: string | null;
329
+ };
330
+ routing: 'hash' | 'history' | 'pathname';
331
+ features: string[];
332
+ routes: ScaffoldPackRoute[];
333
+ focusAreas: string[];
334
+ workflow: string[];
335
+ }
336
+ interface ReviewExecutionPack extends ExecutionPackBase<ReviewPackData> {
337
+ packType: 'review';
338
+ }
339
+ interface ExecutionPackBundle {
340
+ $schema: string;
341
+ generatedAt: string;
342
+ sourceEssenceVersion: string;
343
+ manifest: ExecutionPackManifest;
344
+ scaffold: ScaffoldExecutionPack;
345
+ review: ReviewExecutionPack;
346
+ sections: SectionExecutionPack[];
347
+ pages: PageExecutionPack[];
348
+ mutations: MutationExecutionPack[];
349
+ }
350
+ type SelectedExecutionPack = ScaffoldExecutionPack | ReviewExecutionPack | SectionExecutionPack | PageExecutionPack | MutationExecutionPack;
351
+ interface ExecutionPackSelector {
352
+ packType: ExecutionPackType;
353
+ id?: string | null;
354
+ }
355
+ interface SelectedExecutionPackResponse {
356
+ $schema: string;
357
+ generatedAt: string;
358
+ sourceEssenceVersion: string;
359
+ manifest: ExecutionPackManifest;
360
+ selector: {
361
+ packType: ExecutionPackType;
362
+ id: string | null;
363
+ };
364
+ pack: SelectedExecutionPack;
365
+ }
366
+ interface ScaffoldPackBuilderOptions {
367
+ objective?: string;
368
+ target?: Partial<ExecutionPackTarget>;
369
+ preset?: string | null;
370
+ requiredSetup?: string[];
371
+ examples?: ExecutionPackExample[];
372
+ antiPatterns?: ExecutionPackAntiPattern[];
373
+ successChecks?: ExecutionPackSuccessCheck[];
374
+ tokenBudget?: Partial<ExecutionPackTokenBudget>;
375
+ }
376
+ interface SectionPackBuilderOptions extends ScaffoldPackBuilderOptions {
377
+ }
378
+ interface PagePackBuilderOptions extends ScaffoldPackBuilderOptions {
379
+ }
380
+ interface MutationPackBuilderOptions extends ScaffoldPackBuilderOptions {
381
+ mutationType: MutationPackKind;
382
+ workflow?: string[];
383
+ }
384
+ interface ReviewPackBuilderOptions extends ScaffoldPackBuilderOptions {
385
+ reviewType?: ReviewPackKind;
386
+ focusAreas?: string[];
387
+ workflow?: string[];
388
+ }
389
+ interface CompileExecutionPackBundleOptions {
390
+ contentRoot?: string;
391
+ overridePaths?: string[];
392
+ resolver?: ContentResolver;
393
+ }
394
+ declare function renderExecutionPackMarkdown(pack: ExecutionPackBase<unknown>): string;
395
+ declare function resolvePackAdapter(target: string | undefined, platformType: string | undefined): string;
396
+ declare function listPackSections(essence: EssenceV3): SectionPackInput[];
397
+ declare function listPackPages(essence: EssenceV3): PagePackInput[];
398
+ declare function buildScaffoldPack(appNode: IRAppNode, options?: ScaffoldPackBuilderOptions): ScaffoldExecutionPack;
399
+ declare function buildSectionPack(appNode: IRAppNode, input: SectionPackInput, options?: SectionPackBuilderOptions): SectionExecutionPack;
400
+ declare function buildPagePack(appNode: IRAppNode, input: PagePackInput, options?: PagePackBuilderOptions): PageExecutionPack;
401
+ declare function buildMutationPack(appNode: IRAppNode, options: MutationPackBuilderOptions): MutationExecutionPack;
402
+ declare function buildReviewPack(appNode: IRAppNode, options?: ReviewPackBuilderOptions): ReviewExecutionPack;
403
+ declare function compileExecutionPackBundle(essence: EssenceFile, options?: CompileExecutionPackBundleOptions): Promise<ExecutionPackBundle>;
404
+ declare function selectExecutionPackFromBundle(bundle: ExecutionPackBundle, selector: ExecutionPackSelector): SelectedExecutionPackResponse | null;
405
+ declare function compileSelectedExecutionPack(essence: EssenceFile, selector: ExecutionPackSelector, options?: CompileExecutionPackBundleOptions): Promise<SelectedExecutionPackResponse | null>;
406
+
139
407
  interface PipelineOptions {
140
408
  /** Path to content directory (patterns, archetypes, themes) */
141
- contentRoot: string;
409
+ contentRoot?: string;
142
410
  /** Override paths for local content resolution */
143
411
  overridePaths?: string[];
144
412
  /** Only resolve specific page(s) */
145
413
  pageFilter?: string;
414
+ /** Optional custom resolver for hosted or in-memory execution */
415
+ resolver?: ContentResolver;
146
416
  }
147
417
  interface PipelineResult {
148
418
  /** The framework-agnostic intermediate representation */
@@ -205,4 +475,4 @@ declare function validateIR(root: IRNode): string[];
205
475
  /** Convert a kebab-case or snake_case string to PascalCase */
206
476
  declare function pascalCase(str: string): string;
207
477
 
208
- export { type IRAppNode, type IRBreakpointEntry, type IRCardWrapping, type IRGridNode, type IRHookType, type IRLayer, type IRNavItem, type IRNode, type IRNodeType, type IRPageNode, type IRPatternMeta, type IRPatternNode, type IRRoute, type IRShellConfig, type IRShellNode, type IRSpatial, type IRStoreNode, type IRTheme, type IRThemeDecoration, type IRVisualEffect, type IRWiring, type IRWiringSignal, type PipelineOptions, type PipelineResult, type ResolvedEssence, type ResolvedPage, buildPageIR, countPatterns, findNodes, pascalCase, resolveEssence, resolveVisualEffects, runPipeline, validateIR, walkIR };
478
+ export { type CompileExecutionPackBundleOptions, EXECUTION_PACK_BUNDLE_SCHEMA_URL, EXECUTION_PACK_SCHEMA_URLS, type ExecutionPackAntiPattern, type ExecutionPackBase, type ExecutionPackBundle, type ExecutionPackExample, type ExecutionPackManifest, type ExecutionPackScope, type ExecutionPackSelector, type ExecutionPackSuccessCheck, type ExecutionPackTarget, type ExecutionPackTokenBudget, type ExecutionPackType, type IRAppNode, type IRBreakpointEntry, type IRCardWrapping, type IRGridNode, type IRHookType, type IRLayer, type IRNavItem, type IRNode, type IRNodeType, type IRPageNode, type IRPatternMeta, type IRPatternNode, type IRRoute, type IRShellConfig, type IRShellNode, type IRSpatial, type IRStoreNode, type IRTheme, type IRThemeDecoration, type IRVisualEffect, type IRWiring, type IRWiringSignal, type MutationExecutionPack, type MutationPackBuilderOptions, type MutationPackData, type MutationPackKind, PACK_MANIFEST_SCHEMA_URL, type PackManifestEntry, type PackManifestMutationEntry, type PackManifestPageEntry, type PackManifestSectionEntry, type PageExecutionPack, type PagePackBuilderOptions, type PagePackData, type PagePackInput, type PagePackPattern, type PipelineOptions, type PipelineResult, type ResolvedEssence, type ResolvedPage, type ReviewExecutionPack, type ReviewPackBuilderOptions, type ReviewPackData, type ReviewPackKind, SELECTED_EXECUTION_PACK_SCHEMA_URL, type ScaffoldExecutionPack, type ScaffoldPackBuilderOptions, type ScaffoldPackData, type ScaffoldPackRoute, type SectionExecutionPack, type SectionPackBuilderOptions, type SectionPackData, type SectionPackInput, type SectionPackRoute, type SelectedExecutionPack, type SelectedExecutionPackResponse, buildMutationPack, buildPageIR, buildPagePack, buildReviewPack, buildScaffoldPack, buildSectionPack, compileExecutionPackBundle, compileSelectedExecutionPack, countPatterns, findNodes, listPackPages, listPackSections, pascalCase, renderExecutionPackMarkdown, resolveEssence, resolvePackAdapter, resolveVisualEffects, runPipeline, selectExecutionPackFromBundle, validateIR, walkIR };