@decantr/core 1.0.6 → 2.1.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/README.md +13 -1
- package/dist/index.d.ts +48 -10
- package/dist/index.js +197 -180
- package/dist/index.js.map +1 -1
- package/package.json +14 -3
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install @decantr/core
|
|
|
15
15
|
|
|
16
16
|
## Stability
|
|
17
17
|
|
|
18
|
-
`@decantr/core` is published for advanced package consumers that need low-level execution-pack primitives. It is stable in the `
|
|
18
|
+
`@decantr/core` is published for advanced package consumers that need low-level execution-pack primitives. It is stable in the `2.x` line for the documented exports in this package, but it is still not the recommended first integration surface for most Decantr adopters.
|
|
19
19
|
|
|
20
20
|
## What It Exports
|
|
21
21
|
|
|
@@ -28,6 +28,18 @@ npm install @decantr/core
|
|
|
28
28
|
|
|
29
29
|
In the current workflow architecture, `@decantr/core` owns the canonical adapter labels used by compiled packs, while runnable greenfield bootstrap adapters are resolved in the CLI on top of those labels.
|
|
30
30
|
|
|
31
|
+
## FAQ
|
|
32
|
+
|
|
33
|
+
Most teams should start with the CLI rather than this low-level package:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx @decantr/cli new my-app
|
|
37
|
+
npx @decantr/cli analyze
|
|
38
|
+
npx @decantr/cli check
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For common setup, brownfield, Studio, migration, CI, and agent-alignment questions, see the user-facing [Decantr FAQ](https://github.com/decantr-ai/decantr/blob/main/docs/faq.md).
|
|
42
|
+
|
|
31
43
|
## Example
|
|
32
44
|
|
|
33
45
|
```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StructurePage, EssenceFile,
|
|
1
|
+
import { StructurePage, EssenceFile, EssenceV4 } from '@decantr/essence-spec';
|
|
2
2
|
import { Pattern, ResolvedPreset, Theme, ContentResolver } from '@decantr/registry';
|
|
3
3
|
|
|
4
4
|
type IRNodeType = 'app' | 'shell' | 'page' | 'pattern' | 'grid' | 'nav' | 'store';
|
|
@@ -42,7 +42,7 @@ interface IRPatternMeta {
|
|
|
42
42
|
*/
|
|
43
43
|
presetDescription?: string;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Declared runtime interactions from the pattern JSON.
|
|
46
46
|
* Page-pack renderer surfaces these as a checkbox checklist.
|
|
47
47
|
*/
|
|
48
48
|
interactions?: string[];
|
|
@@ -92,7 +92,7 @@ interface IRRoute {
|
|
|
92
92
|
shell: string;
|
|
93
93
|
sectionId?: string;
|
|
94
94
|
}
|
|
95
|
-
/** Which
|
|
95
|
+
/** Which Essence v4 layer sourced this node */
|
|
96
96
|
type IRLayer = 'dna' | 'blueprint' | 'meta';
|
|
97
97
|
interface IRNode {
|
|
98
98
|
type: IRNodeType;
|
|
@@ -100,7 +100,7 @@ interface IRNode {
|
|
|
100
100
|
children: IRNode[];
|
|
101
101
|
spatial?: IRSpatial;
|
|
102
102
|
meta?: Record<string, unknown>;
|
|
103
|
-
/** When built from
|
|
103
|
+
/** When built from an Essence v4 document, indicates the originating layer */
|
|
104
104
|
layer?: IRLayer;
|
|
105
105
|
}
|
|
106
106
|
interface IRAppNode extends IRNode {
|
|
@@ -407,7 +407,7 @@ interface PagePackPattern {
|
|
|
407
407
|
*/
|
|
408
408
|
presetDescription?: string;
|
|
409
409
|
/**
|
|
410
|
-
*
|
|
410
|
+
* Declared interactions from the pattern JSON. Rendered
|
|
411
411
|
* as a checkbox checklist so cold LLMs in generation mode see a
|
|
412
412
|
* hard-edged list they can't categorize as "philosophy". Enforced by
|
|
413
413
|
* decantr check --strict (C5 guard rule).
|
|
@@ -544,8 +544,8 @@ interface CompileExecutionPackBundleOptions {
|
|
|
544
544
|
}
|
|
545
545
|
declare function renderExecutionPackMarkdown(pack: ExecutionPackBase<unknown>): string;
|
|
546
546
|
declare function resolvePackAdapter(target: string | undefined, platformType: string | undefined): string;
|
|
547
|
-
declare function listPackSections(essence:
|
|
548
|
-
declare function listPackPages(essence:
|
|
547
|
+
declare function listPackSections(essence: EssenceV4): SectionPackInput[];
|
|
548
|
+
declare function listPackPages(essence: EssenceV4): PagePackInput[];
|
|
549
549
|
declare function buildScaffoldPack(appNode: IRAppNode, options?: ScaffoldPackBuilderOptions): ScaffoldExecutionPack;
|
|
550
550
|
declare function buildSectionPack(appNode: IRAppNode, input: SectionPackInput, options?: SectionPackBuilderOptions): SectionExecutionPack;
|
|
551
551
|
declare function buildPagePack(appNode: IRAppNode, input: PagePackInput, options?: PagePackBuilderOptions): PageExecutionPack;
|
|
@@ -585,6 +585,44 @@ interface PipelineResult {
|
|
|
585
585
|
*/
|
|
586
586
|
declare function runPipeline(essence: EssenceFile, options: PipelineOptions): Promise<PipelineResult>;
|
|
587
587
|
|
|
588
|
+
type RealizationAdapter = 'react-vite' | 'next-app' | 'generic-web' | string;
|
|
589
|
+
interface RealizationRoute {
|
|
590
|
+
path: string;
|
|
591
|
+
sectionId: string;
|
|
592
|
+
sectionRole: string;
|
|
593
|
+
pageId: string;
|
|
594
|
+
shell: string;
|
|
595
|
+
patterns: string[];
|
|
596
|
+
states: Array<'empty' | 'loading' | 'error'>;
|
|
597
|
+
}
|
|
598
|
+
interface RealizationMockDataSeed {
|
|
599
|
+
id: string;
|
|
600
|
+
source: 'feature' | 'route';
|
|
601
|
+
shape: Record<string, unknown>;
|
|
602
|
+
}
|
|
603
|
+
interface RealizationInteractionPlaceholder {
|
|
604
|
+
id: string;
|
|
605
|
+
kind: 'command-palette' | 'hotkey' | 'auth-mock' | 'route-action';
|
|
606
|
+
route?: string;
|
|
607
|
+
label: string;
|
|
608
|
+
}
|
|
609
|
+
interface RealizationPlan {
|
|
610
|
+
version: '1.0.0';
|
|
611
|
+
sourceEssenceVersion: '4.0.0';
|
|
612
|
+
adapter: RealizationAdapter;
|
|
613
|
+
canRealizeFrameworkCode: boolean;
|
|
614
|
+
routes: RealizationRoute[];
|
|
615
|
+
shell: {
|
|
616
|
+
id: string;
|
|
617
|
+
theme: string;
|
|
618
|
+
mode: string;
|
|
619
|
+
};
|
|
620
|
+
mockData: RealizationMockDataSeed[];
|
|
621
|
+
interactions: RealizationInteractionPlaceholder[];
|
|
622
|
+
unsupportedReason?: string;
|
|
623
|
+
}
|
|
624
|
+
declare function compileRealizationPlan(essence: EssenceV4): RealizationPlan;
|
|
625
|
+
|
|
588
626
|
interface ResolvedPage {
|
|
589
627
|
page: ResolvedStructurePage;
|
|
590
628
|
patterns: Map<string, {
|
|
@@ -609,8 +647,8 @@ interface ResolvedEssence {
|
|
|
609
647
|
shell: IRShellConfig;
|
|
610
648
|
routes: IRRoute[];
|
|
611
649
|
features: string[];
|
|
612
|
-
/** True when the source essence
|
|
613
|
-
|
|
650
|
+
/** True when the source essence uses the active DNA/Blueprint/Meta contract. */
|
|
651
|
+
isBlueprintSource: boolean;
|
|
614
652
|
}
|
|
615
653
|
declare function resolveVisualEffects(theme: Theme, pattern: Pattern, _slot?: string): IRVisualEffect | null;
|
|
616
654
|
/** Resolve all external references in an Essence file */
|
|
@@ -619,4 +657,4 @@ declare function resolveEssence(essence: EssenceFile, resolver: ContentResolver)
|
|
|
619
657
|
/** Convert a kebab-case or snake_case string to PascalCase */
|
|
620
658
|
declare function pascalCase(str: string): string;
|
|
621
659
|
|
|
622
|
-
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 };
|
|
660
|
+
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 RealizationAdapter, type RealizationInteractionPlaceholder, type RealizationMockDataSeed, type RealizationPlan, type RealizationRoute, 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, compileRealizationPlan, compileSelectedExecutionPack, countPatterns, findNodes, listPackPages, listPackSections, pascalCase, renderExecutionPackMarkdown, resolveEssence, resolvePackAdapter, resolveVisualEffects, runPipeline, selectExecutionPackFromBundle, validateIR, walkIR };
|