@decantr/essence-spec 1.0.8 → 2.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/README.md +6 -6
- package/dist/index.d.ts +34 -34
- package/dist/index.js +205 -271
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/schema/essence.v4.json +430 -0
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ npm install @decantr/essence-spec
|
|
|
15
15
|
|
|
16
16
|
- `validateEssence()` for schema validation
|
|
17
17
|
- `evaluateGuard()` for contract/guard checks
|
|
18
|
-
- `normalizeEssence()` for
|
|
19
|
-
- `
|
|
20
|
-
- Decantr
|
|
18
|
+
- `normalizeEssence()` for active Essence v4 normalization
|
|
19
|
+
- `migrateToV4()` for the explicit legacy migration path
|
|
20
|
+
- Decantr Essence v4 TypeScript types
|
|
21
21
|
|
|
22
22
|
## Example
|
|
23
23
|
|
|
@@ -34,12 +34,12 @@ const violations = evaluateGuard(essence, {});
|
|
|
34
34
|
|
|
35
35
|
## Schema Exports
|
|
36
36
|
|
|
37
|
-
- `@decantr/essence-spec/schema/essence.
|
|
38
|
-
- `@decantr/essence-spec/schema/essence.v3.json`
|
|
37
|
+
- `@decantr/essence-spec/schema/essence.v4.json`
|
|
38
|
+
- `@decantr/essence-spec/schema/essence.v2.json` and `essence.v3.json` remain archived references for migration tooling only
|
|
39
39
|
|
|
40
40
|
## Compatibility
|
|
41
41
|
|
|
42
|
-
`@decantr/essence-spec`
|
|
42
|
+
`@decantr/essence-spec` defines the active Essence v4 public contract for Decantr V2. Runtime validation accepts v4 only; older Essence v2/v3 files are supported through `decantr migrate --to v4`.
|
|
43
43
|
|
|
44
44
|
- additive schema fields may be introduced in compatible minor releases
|
|
45
45
|
- breaking schema or migration behavior changes require a major version
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Essence
|
|
2
|
+
* Essence v4 active contract types.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* vessel → platform, character → personality,
|
|
8
|
-
* decantation process → essence pipeline
|
|
4
|
+
* Decantr V2 treats Essence v4 as the only active runtime contract. Older
|
|
5
|
+
* Essence v2/v3 document shapes remain modeled only so `decantr migrate --to v4`
|
|
6
|
+
* can upgrade existing projects.
|
|
9
7
|
*/
|
|
10
8
|
type ThemeStyle = 'auradecantism' | 'clean' | 'glassmorphism' | 'retro' | 'bioluminescent' | 'launchpad' | 'dopamine' | 'editorial' | 'liquid-glass' | 'prismatic';
|
|
11
9
|
type ThemeMode = 'light' | 'dark' | 'auto';
|
|
@@ -121,7 +119,7 @@ interface Essence {
|
|
|
121
119
|
accessibility?: Accessibility;
|
|
122
120
|
_impression?: Impression;
|
|
123
121
|
}
|
|
124
|
-
interface
|
|
122
|
+
interface LegacyEssenceSection {
|
|
125
123
|
id: string;
|
|
126
124
|
path: string;
|
|
127
125
|
archetype: string;
|
|
@@ -134,7 +132,7 @@ interface SectionedEssence {
|
|
|
134
132
|
version: string;
|
|
135
133
|
platform: Platform;
|
|
136
134
|
personality: string[];
|
|
137
|
-
sections:
|
|
135
|
+
sections: LegacyEssenceSection[];
|
|
138
136
|
shared_features?: string[];
|
|
139
137
|
density: Density;
|
|
140
138
|
guard: Guard;
|
|
@@ -220,7 +218,7 @@ interface SectionNavigationItem {
|
|
|
220
218
|
active_match?: string;
|
|
221
219
|
badge?: string;
|
|
222
220
|
}
|
|
223
|
-
interface
|
|
221
|
+
interface EssenceSection {
|
|
224
222
|
id: string;
|
|
225
223
|
role: ArchetypeRole;
|
|
226
224
|
shell: ShellType | string;
|
|
@@ -243,20 +241,21 @@ interface RouteEntry {
|
|
|
243
241
|
}
|
|
244
242
|
interface EssenceBlueprint {
|
|
245
243
|
shell?: ShellType | string;
|
|
246
|
-
sections
|
|
244
|
+
sections: EssenceSection[];
|
|
245
|
+
/** Migration-only compatibility. Active v4 documents are sectioned-only. */
|
|
247
246
|
pages?: BlueprintPage[];
|
|
248
247
|
features: string[];
|
|
249
248
|
routes?: Record<string, RouteEntry>;
|
|
250
249
|
icon_style?: string;
|
|
251
250
|
avatar_style?: string;
|
|
252
251
|
}
|
|
253
|
-
interface
|
|
252
|
+
interface EssenceV4Guard {
|
|
254
253
|
mode: GuardMode;
|
|
255
254
|
dna_enforcement: 'error' | 'warn' | 'off';
|
|
256
255
|
blueprint_enforcement: 'warn' | 'off';
|
|
257
256
|
/**
|
|
258
|
-
*
|
|
259
|
-
*
|
|
257
|
+
* Severity for the experiential interactions guard rule. When patterns
|
|
258
|
+
* declare `interactions: [...]` but the source
|
|
260
259
|
* tree is missing the canonical implementations, this controls whether
|
|
261
260
|
* the violation is an error, warning, or ignored.
|
|
262
261
|
*
|
|
@@ -269,7 +268,7 @@ interface EssenceMeta {
|
|
|
269
268
|
archetype: string;
|
|
270
269
|
target: GeneratorTarget;
|
|
271
270
|
platform: Platform;
|
|
272
|
-
guard:
|
|
271
|
+
guard: EssenceV4Guard;
|
|
273
272
|
seo?: {
|
|
274
273
|
schema_org?: string[];
|
|
275
274
|
meta_priorities?: string[];
|
|
@@ -315,26 +314,31 @@ interface HotkeySemantics {
|
|
|
315
314
|
/** If true: hotkey matching is case-sensitive. Default false — uppercase implies Shift. */
|
|
316
315
|
match_case?: boolean;
|
|
317
316
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
317
|
+
* If true (default): render the .d-hotkey-indicator corner badge when a chord
|
|
318
|
+
* hotkey prefix is armed. If false: silent chord tracking (no visual feedback).
|
|
319
|
+
* Recommended true for discoverability.
|
|
321
320
|
*/
|
|
322
321
|
show_chord_indicator?: boolean;
|
|
323
322
|
}
|
|
324
|
-
interface
|
|
323
|
+
interface EssenceV4 {
|
|
325
324
|
$schema?: string;
|
|
326
|
-
version: '
|
|
325
|
+
version: '4.0.0';
|
|
327
326
|
dna: EssenceDNA;
|
|
328
327
|
blueprint: EssenceBlueprint;
|
|
329
328
|
meta: EssenceMeta;
|
|
330
329
|
_impression?: Impression;
|
|
331
330
|
}
|
|
332
|
-
type
|
|
333
|
-
|
|
331
|
+
type LegacyEssenceV3 = Omit<EssenceV4, 'version'> & {
|
|
332
|
+
version: '3.0.0' | '3.1.0';
|
|
333
|
+
};
|
|
334
|
+
type EssenceFile = EssenceV4;
|
|
335
|
+
type LegacyEssenceFile = Essence | SectionedEssence | LegacyEssenceV3 | EssenceV4;
|
|
336
|
+
declare function isV4(essence: unknown): essence is EssenceV4;
|
|
337
|
+
declare function isLegacyV3(essence: unknown): essence is LegacyEssenceV3;
|
|
334
338
|
/** Flatten sections into a flat page list (for guards and backward compat). */
|
|
335
339
|
declare function flattenPages(blueprint: EssenceBlueprint): BlueprintPage[];
|
|
336
|
-
declare function isSectioned(essence:
|
|
337
|
-
declare function isSimple(essence:
|
|
340
|
+
declare function isSectioned(essence: unknown): essence is SectionedEssence;
|
|
341
|
+
declare function isSimple(essence: unknown): essence is Essence;
|
|
338
342
|
|
|
339
343
|
interface SpatialHints {
|
|
340
344
|
density_bias?: number;
|
|
@@ -350,7 +354,7 @@ interface AutoFix {
|
|
|
350
354
|
interface GuardViolation {
|
|
351
355
|
rule: 'theme' | 'structure' | 'layout' | 'density' | 'theme-mode' | 'pattern-exists' | 'accessibility'
|
|
352
356
|
/**
|
|
353
|
-
*
|
|
357
|
+
* V4 C5. Experiential interactions guard rule. Fires when patterns
|
|
354
358
|
* declare `interactions: [...]` but the source tree is missing the
|
|
355
359
|
* canonical implementations. Severity controlled by
|
|
356
360
|
* `meta.guard.interactions_enforcement` (defaults: creative=off,
|
|
@@ -377,7 +381,7 @@ interface GuardContext {
|
|
|
377
381
|
patternRegistry?: Map<string, unknown>;
|
|
378
382
|
a11y_issues?: string[];
|
|
379
383
|
/**
|
|
380
|
-
*
|
|
384
|
+
* V4 C5. Pre-computed list of declared interactions whose canonical
|
|
381
385
|
* implementations are missing from the source tree. Produced by
|
|
382
386
|
* `verifyInteractionsInSource` from @decantr/verifier; passed in here
|
|
383
387
|
* so the guard rule can emit violations without owning the source-scan
|
|
@@ -391,15 +395,10 @@ interface GuardContext {
|
|
|
391
395
|
declare function evaluateGuard(essence: EssenceFile, context?: GuardContext): GuardViolation[];
|
|
392
396
|
|
|
393
397
|
/**
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*/
|
|
397
|
-
declare function migrateV2ToV3(essence: EssenceFile): EssenceV3;
|
|
398
|
-
/**
|
|
399
|
-
* Migrate a v3.0 flat-page EssenceV3 to v3.1 sectioned format.
|
|
400
|
-
* If already v3.1 or has blueprint.sections, returns unchanged.
|
|
398
|
+
* Explicit legacy-to-v4 migration path used by `decantr migrate --to v4`.
|
|
399
|
+
* Active Decantr V2 commands do not call this implicitly.
|
|
401
400
|
*/
|
|
402
|
-
declare function
|
|
401
|
+
declare function migrateToV4(input: unknown): EssenceV4;
|
|
403
402
|
|
|
404
403
|
declare function normalizeEssence(input: Record<string, unknown>): EssenceFile;
|
|
405
404
|
|
|
@@ -408,5 +407,6 @@ interface ValidationResult {
|
|
|
408
407
|
errors: string[];
|
|
409
408
|
}
|
|
410
409
|
declare function validateEssence(data: unknown): ValidationResult;
|
|
410
|
+
declare function validateLegacyEssenceForMigration(data: unknown): ValidationResult;
|
|
411
411
|
|
|
412
|
-
export { type Accessibility, type ArchetypeRole, type AutoFix, type BlueprintPage, type ColumnLayout, type CvdPreference, type DNAOverrides, type Density, type DensityLevel, type Essence, type EssenceBlueprint, type EssenceDNA, type EssenceFile, type EssenceMeta, type EssenceSection, type
|
|
412
|
+
export { type Accessibility, type ArchetypeRole, type AutoFix, type BlueprintPage, type ColumnLayout, type CvdPreference, type DNAOverrides, type Density, type DensityLevel, type Essence, type EssenceBlueprint, type EssenceDNA, type EssenceFile, type EssenceMeta, type EssenceSection, type EssenceV4, type EssenceV4Guard, type GeneratorTarget, type Guard, type GuardContext, type GuardMode, type GuardViolation, type Impression, type LayoutItem, type LegacyEssenceFile, type LegacyEssenceV3, type PatternRef, type Platform, type PlatformType, type RouteEntry, type RoutingStrategy, type SectionedEssence, type ShellGuidance, type ShellType, type SpatialTokenHints, type SpatialTokens, type StructurePage, type Theme, type ThemeMode, type ThemeShape, type ThemeStyle, type ValidationResult, type WcagLevel, computeDensity, computeSpatialTokens, evaluateGuard, flattenPages, getColumnAlias, getColumnId, getColumnPreset, isLegacyV3, isSectioned, isSimple, isV4, migrateToV4, normalizeEssence, validateEssence, validateLegacyEssenceForMigration };
|