@buoy-design/core 0.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.
Files changed (57) hide show
  1. package/dist/analysis/index.d.ts +2 -0
  2. package/dist/analysis/index.d.ts.map +1 -0
  3. package/dist/analysis/index.js +2 -0
  4. package/dist/analysis/index.js.map +1 -0
  5. package/dist/analysis/semantic-diff.d.ts +100 -0
  6. package/dist/analysis/semantic-diff.d.ts.map +1 -0
  7. package/dist/analysis/semantic-diff.js +716 -0
  8. package/dist/analysis/semantic-diff.js.map +1 -0
  9. package/dist/analysis/semantic-diff.test.d.ts +2 -0
  10. package/dist/analysis/semantic-diff.test.d.ts.map +1 -0
  11. package/dist/analysis/semantic-diff.test.js +188 -0
  12. package/dist/analysis/semantic-diff.test.js.map +1 -0
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +7 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/models/component.d.ts +638 -0
  18. package/dist/models/component.d.ts.map +1 -0
  19. package/dist/models/component.js +116 -0
  20. package/dist/models/component.js.map +1 -0
  21. package/dist/models/component.test.d.ts +2 -0
  22. package/dist/models/component.test.d.ts.map +1 -0
  23. package/dist/models/component.test.js +55 -0
  24. package/dist/models/component.test.js.map +1 -0
  25. package/dist/models/drift.d.ts +692 -0
  26. package/dist/models/drift.d.ts.map +1 -0
  27. package/dist/models/drift.js +152 -0
  28. package/dist/models/drift.js.map +1 -0
  29. package/dist/models/drift.test.d.ts +2 -0
  30. package/dist/models/drift.test.d.ts.map +1 -0
  31. package/dist/models/drift.test.js +38 -0
  32. package/dist/models/drift.test.js.map +1 -0
  33. package/dist/models/index.d.ts +9 -0
  34. package/dist/models/index.d.ts.map +1 -0
  35. package/dist/models/index.js +9 -0
  36. package/dist/models/index.js.map +1 -0
  37. package/dist/models/intent.d.ts +226 -0
  38. package/dist/models/intent.d.ts.map +1 -0
  39. package/dist/models/intent.js +84 -0
  40. package/dist/models/intent.js.map +1 -0
  41. package/dist/models/token.d.ts +740 -0
  42. package/dist/models/token.d.ts.map +1 -0
  43. package/dist/models/token.js +164 -0
  44. package/dist/models/token.js.map +1 -0
  45. package/dist/models/token.test.d.ts +2 -0
  46. package/dist/models/token.test.d.ts.map +1 -0
  47. package/dist/models/token.test.js +168 -0
  48. package/dist/models/token.test.js.map +1 -0
  49. package/dist/plugins/index.d.ts +2 -0
  50. package/dist/plugins/index.d.ts.map +1 -0
  51. package/dist/plugins/index.js +2 -0
  52. package/dist/plugins/index.js.map +1 -0
  53. package/dist/plugins/types.d.ts +60 -0
  54. package/dist/plugins/types.d.ts.map +1 -0
  55. package/dist/plugins/types.js +2 -0
  56. package/dist/plugins/types.js.map +1 -0
  57. package/package.json +49 -0
@@ -0,0 +1,152 @@
1
+ import { z } from 'zod';
2
+ // Drift types
3
+ export const DriftTypeSchema = z.enum([
4
+ 'deprecated-pattern',
5
+ 'accessibility-conflict',
6
+ 'semantic-mismatch',
7
+ 'orphaned-component',
8
+ 'orphaned-token',
9
+ 'value-divergence',
10
+ 'naming-inconsistency',
11
+ 'missing-documentation',
12
+ 'hardcoded-value',
13
+ 'framework-sprawl',
14
+ ]);
15
+ // Severity levels
16
+ export const SeveritySchema = z.enum(['info', 'warning', 'critical']);
17
+ // Drift source reference
18
+ export const DriftSourceSchema = z.object({
19
+ entityType: z.enum(['component', 'token']),
20
+ entityId: z.string(),
21
+ entityName: z.string(),
22
+ location: z.string(),
23
+ });
24
+ // Suggested action
25
+ export const SuggestedActionSchema = z.object({
26
+ action: z.string(),
27
+ effort: z.enum(['low', 'medium', 'high']),
28
+ priority: z.number(),
29
+ codeExample: z.string().optional(),
30
+ });
31
+ // Git context for drift forensics (used by `buoy drift explain`)
32
+ export const GitContextSchema = z.object({
33
+ // Who last modified this code and when
34
+ blame: z.object({
35
+ author: z.string(),
36
+ email: z.string().optional(),
37
+ date: z.date(),
38
+ commitHash: z.string(),
39
+ commitMessage: z.string(),
40
+ }).optional(),
41
+ // What the code looked like before the drift was introduced
42
+ previousValue: z.string().optional(),
43
+ // PR/MR context if available
44
+ pullRequest: z.object({
45
+ number: z.number(),
46
+ title: z.string(),
47
+ url: z.string().optional(),
48
+ }).optional(),
49
+ // Full history of changes to this line/file (most recent first)
50
+ history: z.array(z.object({
51
+ commitHash: z.string(),
52
+ author: z.string(),
53
+ date: z.date(),
54
+ message: z.string(),
55
+ })).optional(),
56
+ });
57
+ // Drift details
58
+ export const DriftDetailsSchema = z.object({
59
+ expected: z.unknown().optional(),
60
+ actual: z.unknown().optional(),
61
+ diff: z.string().optional(),
62
+ affectedFiles: z.array(z.string()).optional(),
63
+ suggestions: z.array(z.string()).optional(),
64
+ claudeAnalysis: z.string().optional(),
65
+ // For prop type inconsistency
66
+ usedIn: z.array(z.string()).optional(),
67
+ // For duplicate detection
68
+ relatedComponents: z.array(z.string()).optional(),
69
+ // For framework sprawl
70
+ frameworks: z.array(z.object({
71
+ name: z.string(),
72
+ version: z.string().optional(),
73
+ })).optional(),
74
+ // Git context for understanding how/why drift was introduced
75
+ // Populated by scanner when git info is available, used by `drift explain`
76
+ gitContext: GitContextSchema.optional(),
77
+ });
78
+ // Drift resolution
79
+ export const DriftResolutionTypeSchema = z.enum(['ignored', 'fixed', 'documented']);
80
+ export const DriftResolutionSchema = z.object({
81
+ type: DriftResolutionTypeSchema,
82
+ reason: z.string().optional(),
83
+ resolvedBy: z.string().optional(),
84
+ resolvedAt: z.date(),
85
+ });
86
+ // Main DriftSignal schema
87
+ export const DriftSignalSchema = z.object({
88
+ id: z.string(),
89
+ type: DriftTypeSchema,
90
+ severity: SeveritySchema,
91
+ source: DriftSourceSchema,
92
+ target: DriftSourceSchema.optional(),
93
+ message: z.string(),
94
+ details: DriftDetailsSchema,
95
+ detectedAt: z.date(),
96
+ resolvedAt: z.date().optional(),
97
+ resolution: DriftResolutionSchema.optional(),
98
+ });
99
+ // Helper to create drift ID
100
+ export function createDriftId(type, sourceId, targetId) {
101
+ const base = `drift:${type}:${sourceId}`;
102
+ return targetId ? `${base}:${targetId}` : base;
103
+ }
104
+ // Helper to get severity weight for sorting
105
+ export function getSeverityWeight(severity) {
106
+ switch (severity) {
107
+ case 'critical':
108
+ return 3;
109
+ case 'warning':
110
+ return 2;
111
+ case 'info':
112
+ return 1;
113
+ }
114
+ }
115
+ // Helper to get default severity for drift type
116
+ export function getDefaultSeverity(type) {
117
+ switch (type) {
118
+ case 'accessibility-conflict':
119
+ return 'critical';
120
+ case 'deprecated-pattern':
121
+ case 'semantic-mismatch':
122
+ case 'value-divergence':
123
+ case 'hardcoded-value':
124
+ case 'framework-sprawl':
125
+ return 'warning';
126
+ case 'orphaned-component':
127
+ case 'orphaned-token':
128
+ case 'naming-inconsistency':
129
+ case 'missing-documentation':
130
+ return 'info';
131
+ }
132
+ }
133
+ // Human-readable drift type labels
134
+ export const DRIFT_TYPE_LABELS = {
135
+ 'deprecated-pattern': 'Deprecated Pattern',
136
+ 'accessibility-conflict': 'Accessibility Conflict',
137
+ 'semantic-mismatch': 'Semantic Mismatch',
138
+ 'orphaned-component': 'Orphaned Component',
139
+ 'orphaned-token': 'Orphaned Token',
140
+ 'value-divergence': 'Value Divergence',
141
+ 'naming-inconsistency': 'Naming Inconsistency',
142
+ 'missing-documentation': 'Missing Documentation',
143
+ 'hardcoded-value': 'Hardcoded Value',
144
+ 'framework-sprawl': 'Framework Sprawl',
145
+ };
146
+ // Human-readable severity labels
147
+ export const SEVERITY_LABELS = {
148
+ critical: 'Critical',
149
+ warning: 'Warning',
150
+ info: 'Info',
151
+ };
152
+ //# sourceMappingURL=drift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drift.js","sourceRoot":"","sources":["../../src/models/drift.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc;AACd,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,oBAAoB;IACpB,wBAA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AC1C,gBAAgB,EAAE,gBAAgB;IAClC,kBAAkB,EAAE,kBAAkB;IACtC,sBAAsB,EAAE,sBAAsB;IAC9C,uBAAuB,EAAE,uBAAuB;IAChD,iBAAiB,EAAE,iBAAiB;IACpC,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF,iCAAiC;AACjC,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=drift.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drift.test.d.ts","sourceRoot":"","sources":["../../src/models/drift.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ // packages/core/src/models/drift.test.ts
2
+ import { describe, it, expect } from 'vitest';
3
+ import { createDriftId, getSeverityWeight, getDefaultSeverity, } from './drift.js';
4
+ describe('drift model helpers', () => {
5
+ describe('createDriftId', () => {
6
+ it('creates id with source only', () => {
7
+ const id = createDriftId('hardcoded-value', 'component-123');
8
+ expect(id).toBe('drift:hardcoded-value:component-123');
9
+ });
10
+ it('creates id with source and target', () => {
11
+ const id = createDriftId('semantic-mismatch', 'src-1', 'tgt-2');
12
+ expect(id).toBe('drift:semantic-mismatch:src-1:tgt-2');
13
+ });
14
+ });
15
+ describe('getSeverityWeight', () => {
16
+ it('returns 3 for critical', () => {
17
+ expect(getSeverityWeight('critical')).toBe(3);
18
+ });
19
+ it('returns 2 for warning', () => {
20
+ expect(getSeverityWeight('warning')).toBe(2);
21
+ });
22
+ it('returns 1 for info', () => {
23
+ expect(getSeverityWeight('info')).toBe(1);
24
+ });
25
+ });
26
+ describe('getDefaultSeverity', () => {
27
+ it('returns critical for accessibility-conflict', () => {
28
+ expect(getDefaultSeverity('accessibility-conflict')).toBe('critical');
29
+ });
30
+ it('returns warning for hardcoded-value', () => {
31
+ expect(getDefaultSeverity('hardcoded-value')).toBe('warning');
32
+ });
33
+ it('returns info for naming-inconsistency', () => {
34
+ expect(getDefaultSeverity('naming-inconsistency')).toBe('info');
35
+ });
36
+ });
37
+ });
38
+ //# sourceMappingURL=drift.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drift.test.js","sourceRoot":"","sources":["../../src/models/drift.test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,MAAM,EAAE,GAAG,aAAa,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;YAC7D,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,EAAE,GAAG,aAAa,CAAC,mBAAmB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAChE,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;QACjC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YAC5B,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACrD,MAAM,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { ComponentSchema, ComponentSourceSchema, ReactSourceSchema, FigmaSourceSchema, StorybookSourceSchema, VueSourceSchema, SvelteSourceSchema, PropDefinitionSchema, VariantDefinitionSchema, TokenReferenceSchema, AccessibilityInfoSchema, HardcodedValueSchema, ComponentMetadataSchema, createComponentId, normalizeComponentName, } from './component.js';
2
+ export type { Component, ComponentSource, ReactSource, FigmaSource, StorybookSource, VueSource, SvelteSource, PropDefinition, VariantDefinition, TokenReference, AccessibilityInfo, HardcodedValue, ComponentMetadata, } from './component.js';
3
+ export { DesignTokenSchema, TokenValueSchema, ColorValueSchema, SpacingValueSchema, TypographyValueSchema, ShadowValueSchema, BorderValueSchema, RawValueSchema, TokenSourceSchema, CssTokenSourceSchema, JsonTokenSourceSchema, ScssTokenSourceSchema, FigmaTokenSourceSchema, TokenCategorySchema, TokenMetadataSchema, createTokenId, normalizeTokenName, tokensMatch, } from './token.js';
4
+ export type { DesignToken, TokenValue, ColorValue, SpacingValue, TypographyValue, ShadowValue, BorderValue, RawValue, TokenSource, CssTokenSource, JsonTokenSource, ScssTokenSource, FigmaTokenSource, TokenCategory, TokenMetadata, } from './token.js';
5
+ export { DriftSignalSchema, DriftTypeSchema, SeveritySchema, DriftSourceSchema, SuggestedActionSchema, GitContextSchema, DriftDetailsSchema, DriftResolutionSchema, DriftResolutionTypeSchema, createDriftId, getSeverityWeight, getDefaultSeverity, DRIFT_TYPE_LABELS, SEVERITY_LABELS, } from './drift.js';
6
+ export type { DriftSignal, DriftType, Severity, DriftSource, SuggestedAction, GitContext, DriftDetails, DriftResolution, DriftResolutionType, } from './drift.js';
7
+ export { IntentSchema, IntentDecisionSchema, IntentDecisionTypeSchema, IntentStatusSchema, IntentAttachmentSchema, IntentAttachmentTypeSchema, IntentContextSchema, createIntentId, isIntentExpired, intentApplies, DECISION_TYPE_LABELS, STATUS_LABELS, } from './intent.js';
8
+ export type { Intent, IntentDecision, IntentDecisionType, IntentStatus, IntentAttachment, IntentAttachmentType, IntentContext, } from './intent.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,SAAS,EACT,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M,EACN,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACd,MAAM,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ // Component models
2
+ export { ComponentSchema, ComponentSourceSchema, ReactSourceSchema, FigmaSourceSchema, StorybookSourceSchema, VueSourceSchema, SvelteSourceSchema, PropDefinitionSchema, VariantDefinitionSchema, TokenReferenceSchema, AccessibilityInfoSchema, HardcodedValueSchema, ComponentMetadataSchema, createComponentId, normalizeComponentName, } from './component.js';
3
+ // Token models
4
+ export { DesignTokenSchema, TokenValueSchema, ColorValueSchema, SpacingValueSchema, TypographyValueSchema, ShadowValueSchema, BorderValueSchema, RawValueSchema, TokenSourceSchema, CssTokenSourceSchema, JsonTokenSourceSchema, ScssTokenSourceSchema, FigmaTokenSourceSchema, TokenCategorySchema, TokenMetadataSchema, createTokenId, normalizeTokenName, tokensMatch, } from './token.js';
5
+ // Drift models
6
+ export { DriftSignalSchema, DriftTypeSchema, SeveritySchema, DriftSourceSchema, SuggestedActionSchema, GitContextSchema, DriftDetailsSchema, DriftResolutionSchema, DriftResolutionTypeSchema, createDriftId, getSeverityWeight, getDefaultSeverity, DRIFT_TYPE_LABELS, SEVERITY_LABELS, } from './drift.js';
7
+ // Intent models
8
+ export { IntentSchema, IntentDecisionSchema, IntentDecisionTypeSchema, IntentStatusSchema, IntentAttachmentSchema, IntentAttachmentTypeSchema, IntentContextSchema, createIntentId, isIntentExpired, intentApplies, DECISION_TYPE_LABELS, STATUS_LABELS, } from './intent.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAkBxB,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,WAAW,GACZ,MAAM,YAAY,CAAC;AAoBpB,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AAcpB,gBAAgB;AAChB,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,aAAa,GACd,MAAM,aAAa,CAAC"}
@@ -0,0 +1,226 @@
1
+ import { z } from 'zod';
2
+ export declare const IntentDecisionTypeSchema: z.ZodEnum<["deprecation", "exception", "migration", "documentation", "standard"]>;
3
+ export declare const IntentStatusSchema: z.ZodEnum<["active", "archived", "expired"]>;
4
+ export declare const IntentDecisionSchema: z.ZodObject<{
5
+ type: z.ZodEnum<["deprecation", "exception", "migration", "documentation", "standard"]>;
6
+ status: z.ZodEnum<["active", "archived", "expired"]>;
7
+ title: z.ZodString;
8
+ description: z.ZodString;
9
+ rationale: z.ZodString;
10
+ alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ migrationPath: z.ZodOptional<z.ZodString>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ type: "documentation" | "deprecation" | "exception" | "migration" | "standard";
14
+ status: "active" | "archived" | "expired";
15
+ description: string;
16
+ title: string;
17
+ rationale: string;
18
+ alternatives?: string[] | undefined;
19
+ migrationPath?: string | undefined;
20
+ }, {
21
+ type: "documentation" | "deprecation" | "exception" | "migration" | "standard";
22
+ status: "active" | "archived" | "expired";
23
+ description: string;
24
+ title: string;
25
+ rationale: string;
26
+ alternatives?: string[] | undefined;
27
+ migrationPath?: string | undefined;
28
+ }>;
29
+ export declare const IntentAttachmentTypeSchema: z.ZodEnum<["link", "document", "figma", "slack", "github"]>;
30
+ export declare const IntentAttachmentSchema: z.ZodObject<{
31
+ type: z.ZodEnum<["link", "document", "figma", "slack", "github"]>;
32
+ url: z.ZodString;
33
+ title: z.ZodString;
34
+ }, "strip", z.ZodTypeAny, {
35
+ type: "figma" | "link" | "document" | "slack" | "github";
36
+ url: string;
37
+ title: string;
38
+ }, {
39
+ type: "figma" | "link" | "document" | "slack" | "github";
40
+ url: string;
41
+ title: string;
42
+ }>;
43
+ export declare const IntentContextSchema: z.ZodObject<{
44
+ relatedDriftId: z.ZodOptional<z.ZodString>;
45
+ relatedComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
46
+ relatedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
47
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
48
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
49
+ type: z.ZodEnum<["link", "document", "figma", "slack", "github"]>;
50
+ url: z.ZodString;
51
+ title: z.ZodString;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: "figma" | "link" | "document" | "slack" | "github";
54
+ url: string;
55
+ title: string;
56
+ }, {
57
+ type: "figma" | "link" | "document" | "slack" | "github";
58
+ url: string;
59
+ title: string;
60
+ }>, "many">>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ tags?: string[] | undefined;
63
+ relatedComponents?: string[] | undefined;
64
+ relatedDriftId?: string | undefined;
65
+ relatedTokens?: string[] | undefined;
66
+ attachments?: {
67
+ type: "figma" | "link" | "document" | "slack" | "github";
68
+ url: string;
69
+ title: string;
70
+ }[] | undefined;
71
+ }, {
72
+ tags?: string[] | undefined;
73
+ relatedComponents?: string[] | undefined;
74
+ relatedDriftId?: string | undefined;
75
+ relatedTokens?: string[] | undefined;
76
+ attachments?: {
77
+ type: "figma" | "link" | "document" | "slack" | "github";
78
+ url: string;
79
+ title: string;
80
+ }[] | undefined;
81
+ }>;
82
+ export declare const IntentSchema: z.ZodObject<{
83
+ id: z.ZodString;
84
+ entityType: z.ZodEnum<["component", "token", "pattern"]>;
85
+ entityId: z.ZodString;
86
+ entityName: z.ZodString;
87
+ decision: z.ZodObject<{
88
+ type: z.ZodEnum<["deprecation", "exception", "migration", "documentation", "standard"]>;
89
+ status: z.ZodEnum<["active", "archived", "expired"]>;
90
+ title: z.ZodString;
91
+ description: z.ZodString;
92
+ rationale: z.ZodString;
93
+ alternatives: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
94
+ migrationPath: z.ZodOptional<z.ZodString>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ type: "documentation" | "deprecation" | "exception" | "migration" | "standard";
97
+ status: "active" | "archived" | "expired";
98
+ description: string;
99
+ title: string;
100
+ rationale: string;
101
+ alternatives?: string[] | undefined;
102
+ migrationPath?: string | undefined;
103
+ }, {
104
+ type: "documentation" | "deprecation" | "exception" | "migration" | "standard";
105
+ status: "active" | "archived" | "expired";
106
+ description: string;
107
+ title: string;
108
+ rationale: string;
109
+ alternatives?: string[] | undefined;
110
+ migrationPath?: string | undefined;
111
+ }>;
112
+ context: z.ZodObject<{
113
+ relatedDriftId: z.ZodOptional<z.ZodString>;
114
+ relatedComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
115
+ relatedTokens: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
116
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
117
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
+ type: z.ZodEnum<["link", "document", "figma", "slack", "github"]>;
119
+ url: z.ZodString;
120
+ title: z.ZodString;
121
+ }, "strip", z.ZodTypeAny, {
122
+ type: "figma" | "link" | "document" | "slack" | "github";
123
+ url: string;
124
+ title: string;
125
+ }, {
126
+ type: "figma" | "link" | "document" | "slack" | "github";
127
+ url: string;
128
+ title: string;
129
+ }>, "many">>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ tags?: string[] | undefined;
132
+ relatedComponents?: string[] | undefined;
133
+ relatedDriftId?: string | undefined;
134
+ relatedTokens?: string[] | undefined;
135
+ attachments?: {
136
+ type: "figma" | "link" | "document" | "slack" | "github";
137
+ url: string;
138
+ title: string;
139
+ }[] | undefined;
140
+ }, {
141
+ tags?: string[] | undefined;
142
+ relatedComponents?: string[] | undefined;
143
+ relatedDriftId?: string | undefined;
144
+ relatedTokens?: string[] | undefined;
145
+ attachments?: {
146
+ type: "figma" | "link" | "document" | "slack" | "github";
147
+ url: string;
148
+ title: string;
149
+ }[] | undefined;
150
+ }>;
151
+ createdAt: z.ZodDate;
152
+ createdBy: z.ZodOptional<z.ZodString>;
153
+ updatedAt: z.ZodOptional<z.ZodDate>;
154
+ expiresAt: z.ZodOptional<z.ZodDate>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ id: string;
157
+ entityType: "component" | "token" | "pattern";
158
+ entityId: string;
159
+ entityName: string;
160
+ decision: {
161
+ type: "documentation" | "deprecation" | "exception" | "migration" | "standard";
162
+ status: "active" | "archived" | "expired";
163
+ description: string;
164
+ title: string;
165
+ rationale: string;
166
+ alternatives?: string[] | undefined;
167
+ migrationPath?: string | undefined;
168
+ };
169
+ context: {
170
+ tags?: string[] | undefined;
171
+ relatedComponents?: string[] | undefined;
172
+ relatedDriftId?: string | undefined;
173
+ relatedTokens?: string[] | undefined;
174
+ attachments?: {
175
+ type: "figma" | "link" | "document" | "slack" | "github";
176
+ url: string;
177
+ title: string;
178
+ }[] | undefined;
179
+ };
180
+ createdAt: Date;
181
+ createdBy?: string | undefined;
182
+ updatedAt?: Date | undefined;
183
+ expiresAt?: Date | undefined;
184
+ }, {
185
+ id: string;
186
+ entityType: "component" | "token" | "pattern";
187
+ entityId: string;
188
+ entityName: string;
189
+ decision: {
190
+ type: "documentation" | "deprecation" | "exception" | "migration" | "standard";
191
+ status: "active" | "archived" | "expired";
192
+ description: string;
193
+ title: string;
194
+ rationale: string;
195
+ alternatives?: string[] | undefined;
196
+ migrationPath?: string | undefined;
197
+ };
198
+ context: {
199
+ tags?: string[] | undefined;
200
+ relatedComponents?: string[] | undefined;
201
+ relatedDriftId?: string | undefined;
202
+ relatedTokens?: string[] | undefined;
203
+ attachments?: {
204
+ type: "figma" | "link" | "document" | "slack" | "github";
205
+ url: string;
206
+ title: string;
207
+ }[] | undefined;
208
+ };
209
+ createdAt: Date;
210
+ createdBy?: string | undefined;
211
+ updatedAt?: Date | undefined;
212
+ expiresAt?: Date | undefined;
213
+ }>;
214
+ export type IntentDecisionType = z.infer<typeof IntentDecisionTypeSchema>;
215
+ export type IntentStatus = z.infer<typeof IntentStatusSchema>;
216
+ export type IntentDecision = z.infer<typeof IntentDecisionSchema>;
217
+ export type IntentAttachmentType = z.infer<typeof IntentAttachmentTypeSchema>;
218
+ export type IntentAttachment = z.infer<typeof IntentAttachmentSchema>;
219
+ export type IntentContext = z.infer<typeof IntentContextSchema>;
220
+ export type Intent = z.infer<typeof IntentSchema>;
221
+ export declare function createIntentId(entityType: Intent['entityType'], entityId: string, decisionType: IntentDecisionType): string;
222
+ export declare function isIntentExpired(intent: Intent): boolean;
223
+ export declare function intentApplies(intent: Intent, driftId: string): boolean;
224
+ export declare const DECISION_TYPE_LABELS: Record<IntentDecisionType, string>;
225
+ export declare const STATUS_LABELS: Record<IntentStatus, string>;
226
+ //# sourceMappingURL=intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"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CAC5B,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,kBAAkB,GAC/B,MAAM,CAER;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGvD;AAGD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAKtE;AAGD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAMnE,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAItD,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { z } from 'zod';
2
+ // Intent decision types
3
+ export const IntentDecisionTypeSchema = z.enum([
4
+ 'deprecation',
5
+ 'exception',
6
+ 'migration',
7
+ 'documentation',
8
+ 'standard',
9
+ ]);
10
+ // Intent status
11
+ export const IntentStatusSchema = z.enum(['active', 'archived', 'expired']);
12
+ // Intent decision
13
+ export const IntentDecisionSchema = z.object({
14
+ type: IntentDecisionTypeSchema,
15
+ status: IntentStatusSchema,
16
+ title: z.string(),
17
+ description: z.string(),
18
+ rationale: z.string(),
19
+ alternatives: z.array(z.string()).optional(),
20
+ migrationPath: z.string().optional(),
21
+ });
22
+ // Intent attachment
23
+ export const IntentAttachmentTypeSchema = z.enum(['link', 'document', 'figma', 'slack', 'github']);
24
+ export const IntentAttachmentSchema = z.object({
25
+ type: IntentAttachmentTypeSchema,
26
+ url: z.string(),
27
+ title: z.string(),
28
+ });
29
+ // Intent context
30
+ export const IntentContextSchema = z.object({
31
+ relatedDriftId: z.string().optional(),
32
+ relatedComponents: z.array(z.string()).optional(),
33
+ relatedTokens: z.array(z.string()).optional(),
34
+ tags: z.array(z.string()).optional(),
35
+ attachments: z.array(IntentAttachmentSchema).optional(),
36
+ });
37
+ // Main Intent schema
38
+ export const IntentSchema = z.object({
39
+ id: z.string(),
40
+ entityType: z.enum(['component', 'token', 'pattern']),
41
+ entityId: z.string(),
42
+ entityName: z.string(),
43
+ decision: IntentDecisionSchema,
44
+ context: IntentContextSchema,
45
+ createdAt: z.date(),
46
+ createdBy: z.string().optional(),
47
+ updatedAt: z.date().optional(),
48
+ expiresAt: z.date().optional(),
49
+ });
50
+ // Helper to create intent ID
51
+ export function createIntentId(entityType, entityId, decisionType) {
52
+ return `intent:${entityType}:${entityId}:${decisionType}:${Date.now()}`;
53
+ }
54
+ // Helper to check if intent is expired
55
+ export function isIntentExpired(intent) {
56
+ if (!intent.expiresAt)
57
+ return false;
58
+ return new Date() > intent.expiresAt;
59
+ }
60
+ // Helper to check if intent applies to a drift
61
+ export function intentApplies(intent, driftId) {
62
+ if (intent.decision.status !== 'active')
63
+ return false;
64
+ if (isIntentExpired(intent))
65
+ return false;
66
+ if (intent.context.relatedDriftId === driftId)
67
+ return true;
68
+ return false;
69
+ }
70
+ // Human-readable decision type labels
71
+ export const DECISION_TYPE_LABELS = {
72
+ deprecation: 'Deprecation',
73
+ exception: 'Exception',
74
+ migration: 'Migration',
75
+ documentation: 'Documentation',
76
+ standard: 'Standard',
77
+ };
78
+ // Human-readable status labels
79
+ export const STATUS_LABELS = {
80
+ active: 'Active',
81
+ archived: 'Archived',
82
+ expired: 'Expired',
83
+ };
84
+ //# sourceMappingURL=intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.js","sourceRoot":"","sources":["../../src/models/intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAwB;AACxB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,aAAa;IACb,WAAW;IACX,WAAW;IACX,eAAe;IACf,UAAU;CACX,CAAC,CAAC;AAEH,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS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