mycontext-cli 4.1.0 → 4.1.2
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 +20 -90
- package/dist/README.md +35 -0
- package/dist/agents/implementations/DesignPipelineAgent.d.ts +1 -1
- package/dist/agents/implementations/DesignPipelineAgent.d.ts.map +1 -1
- package/dist/commands/agent.js +2 -2
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +18 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/sync-readme.js +2 -2
- package/dist/commands/sync-readme.js.map +1 -1
- package/dist/package.json +3 -3
- package/dist/services/ContextService.d.ts +1 -1
- package/dist/services/ContextService.d.ts.map +1 -1
- package/dist/services/ContextService.js +2 -2
- package/dist/services/ContextService.js.map +1 -1
- package/dist/services/IntentEnricher.d.ts +1 -1
- package/dist/services/IntentEnricher.d.ts.map +1 -1
- package/dist/utils/contextEnricher.d.ts +1 -1
- package/dist/utils/contextEnricher.d.ts.map +1 -1
- package/dist/utils/contextEnricher.js +2 -2
- package/dist/utils/contextEnricher.js.map +1 -1
- package/dist/utils/designFallbacks.d.ts +1 -1
- package/dist/utils/designFallbacks.d.ts.map +1 -1
- package/dist/utils/unifiedDesignContextLoader.d.ts +1 -1
- package/dist/utils/unifiedDesignContextLoader.d.ts.map +1 -1
- package/dist/utils/unifiedDesignContextLoader.js +2 -2
- package/dist/utils/unifiedDesignContextLoader.js.map +1 -1
- package/package.json +3 -3
- package/dist/types/design-pipeline.d.ts +0 -306
- package/dist/types/design-pipeline.d.ts.map +0 -1
- package/dist/types/design-pipeline.js +0 -9
- package/dist/types/design-pipeline.js.map +0 -1
- package/dist/utils/designManifestManager.d.ts +0 -93
- package/dist/utils/designManifestManager.d.ts.map +0 -1
- package/dist/utils/designManifestManager.js +0 -694
- package/dist/utils/designManifestManager.js.map +0 -1
|
@@ -1,694 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.DesignManifestManager = void 0;
|
|
40
|
-
const fs = __importStar(require("fs-extra"));
|
|
41
|
-
const path = __importStar(require("path"));
|
|
42
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
43
|
-
/**
|
|
44
|
-
* Design Manifest Manager
|
|
45
|
-
*
|
|
46
|
-
* Handles storage, loading, validation, and context enrichment
|
|
47
|
-
* for the mycontext design pipeline manifest.
|
|
48
|
-
*/
|
|
49
|
-
class DesignManifestManager {
|
|
50
|
-
constructor(projectPath = process.cwd()) {
|
|
51
|
-
this.projectPath = projectPath;
|
|
52
|
-
this.manifestPath = path.join(projectPath, ".mycontext", "design-manifest.json");
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Save design manifest to .mycontext/design-manifest.json
|
|
56
|
-
*/
|
|
57
|
-
async saveDesignManifest(manifest) {
|
|
58
|
-
try {
|
|
59
|
-
// Ensure .mycontext directory exists
|
|
60
|
-
const contextDir = path.dirname(this.manifestPath);
|
|
61
|
-
await fs.ensureDir(contextDir);
|
|
62
|
-
// Write manifest with pretty formatting
|
|
63
|
-
await fs.writeJSON(this.manifestPath, manifest, { spaces: 2 });
|
|
64
|
-
console.log(chalk_1.default.green("✅ Design manifest saved to .mycontext/design-manifest.json"));
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
console.error(chalk_1.default.red("❌ Failed to save design manifest:"), error);
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Load design manifest from .mycontext/design-manifest.json
|
|
73
|
-
*/
|
|
74
|
-
async loadDesignManifest() {
|
|
75
|
-
try {
|
|
76
|
-
if (!(await fs.pathExists(this.manifestPath))) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
const manifestData = await fs.readJSON(this.manifestPath);
|
|
80
|
-
return this.validateManifest(manifestData).valid ? manifestData : null;
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.warn(chalk_1.default.yellow("⚠️ Failed to load design manifest:"), error);
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Check if design manifest exists and is valid
|
|
89
|
-
*/
|
|
90
|
-
async hasValidManifest() {
|
|
91
|
-
const manifest = await this.loadDesignManifest();
|
|
92
|
-
return manifest !== null;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Validate design manifest structure and completeness
|
|
96
|
-
*/
|
|
97
|
-
validateManifest(manifest) {
|
|
98
|
-
const errors = [];
|
|
99
|
-
const warnings = [];
|
|
100
|
-
const suggestions = [];
|
|
101
|
-
// Check required top-level fields
|
|
102
|
-
if (!manifest.version)
|
|
103
|
-
errors.push("Missing version field");
|
|
104
|
-
if (!manifest.generated_at)
|
|
105
|
-
errors.push("Missing generated_at field");
|
|
106
|
-
if (!manifest.project_name)
|
|
107
|
-
errors.push("Missing project_name field");
|
|
108
|
-
if (!manifest.phases)
|
|
109
|
-
errors.push("Missing phases object");
|
|
110
|
-
if (manifest.phases) {
|
|
111
|
-
// Validate each phase
|
|
112
|
-
const phaseValidations = this.validatePhases(manifest.phases);
|
|
113
|
-
phaseValidations.forEach((validation) => {
|
|
114
|
-
if (!validation.result.valid) {
|
|
115
|
-
errors.push(...validation.result.errors.map((e) => `${validation.phase_name}: ${e}`));
|
|
116
|
-
}
|
|
117
|
-
warnings.push(...validation.result.warnings.map((w) => `${validation.phase_name}: ${w}`));
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
// Check metadata
|
|
121
|
-
if (!manifest.metadata) {
|
|
122
|
-
warnings.push("Missing metadata object");
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
if (!manifest.metadata.generation_time_ms) {
|
|
126
|
-
warnings.push("Missing generation_time_ms in metadata");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// Calculate confidence score
|
|
130
|
-
const confidenceScore = this.calculateOverallConfidence(manifest);
|
|
131
|
-
return {
|
|
132
|
-
valid: errors.length === 0,
|
|
133
|
-
errors,
|
|
134
|
-
warnings,
|
|
135
|
-
suggestions,
|
|
136
|
-
confidence_score: confidenceScore,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Validate individual phases
|
|
141
|
-
*/
|
|
142
|
-
validatePhases(phases) {
|
|
143
|
-
const validations = [];
|
|
144
|
-
// Phase 1: Functional Summary
|
|
145
|
-
validations.push(this.validatePhase("functional_summary", phases.functional_summary, [
|
|
146
|
-
"app_name",
|
|
147
|
-
"core_purpose",
|
|
148
|
-
"key_features",
|
|
149
|
-
"primary_user_actions",
|
|
150
|
-
"platform",
|
|
151
|
-
"technical_requirements",
|
|
152
|
-
"complexity_level",
|
|
153
|
-
]));
|
|
154
|
-
// Phase 2: Project Scope
|
|
155
|
-
validations.push(this.validatePhase("project_scope", phases.project_scope, [
|
|
156
|
-
"build_scope",
|
|
157
|
-
"reason",
|
|
158
|
-
"expected_outputs",
|
|
159
|
-
]));
|
|
160
|
-
// Phase 3: Context Gaps
|
|
161
|
-
validations.push(this.validatePhase("context_gaps", phases.context_gaps, [
|
|
162
|
-
"missing",
|
|
163
|
-
"recommended_next_action",
|
|
164
|
-
]));
|
|
165
|
-
// Phase 4: Design Brief
|
|
166
|
-
validations.push(this.validatePhase("design_brief", phases.design_brief, [
|
|
167
|
-
"theme",
|
|
168
|
-
"inspiration_sources",
|
|
169
|
-
"blended_style",
|
|
170
|
-
"primary_color",
|
|
171
|
-
"support_colors",
|
|
172
|
-
"typography",
|
|
173
|
-
"ui_principles",
|
|
174
|
-
"motion_style",
|
|
175
|
-
]));
|
|
176
|
-
// Phase 5: Visual System
|
|
177
|
-
validations.push(this.validatePhase("visual_system", phases.visual_system, [
|
|
178
|
-
"colors",
|
|
179
|
-
"typography",
|
|
180
|
-
"spacing",
|
|
181
|
-
"radii",
|
|
182
|
-
"shadows",
|
|
183
|
-
"motion",
|
|
184
|
-
"breakpoints",
|
|
185
|
-
]));
|
|
186
|
-
// Phase 6: Component Hierarchy
|
|
187
|
-
validations.push(this.validatePhase("component_hierarchy", phases.component_hierarchy, [
|
|
188
|
-
"screens",
|
|
189
|
-
"components",
|
|
190
|
-
"design_patterns",
|
|
191
|
-
"interaction_flows",
|
|
192
|
-
]));
|
|
193
|
-
// Phase 7: Implementation Plan
|
|
194
|
-
validations.push(this.validatePhase("implementation_plan", phases.implementation_plan, [
|
|
195
|
-
"framework",
|
|
196
|
-
"pages",
|
|
197
|
-
"state_management",
|
|
198
|
-
"build_requirements",
|
|
199
|
-
"data_persistence",
|
|
200
|
-
"performance_optimizations",
|
|
201
|
-
]));
|
|
202
|
-
// Phase 8: Design Intent
|
|
203
|
-
validations.push(this.validatePhase("design_intent", phases.design_intent, [
|
|
204
|
-
"visual_philosophy",
|
|
205
|
-
"design_anchors",
|
|
206
|
-
"user_experience_goals",
|
|
207
|
-
]));
|
|
208
|
-
return validations;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Validate a single phase
|
|
212
|
-
*/
|
|
213
|
-
validatePhase(phaseName, phaseData, requiredFields) {
|
|
214
|
-
const errors = [];
|
|
215
|
-
const warnings = [];
|
|
216
|
-
const missingFields = [];
|
|
217
|
-
if (!phaseData) {
|
|
218
|
-
errors.push("Phase data is missing");
|
|
219
|
-
return {
|
|
220
|
-
phase_name: phaseName,
|
|
221
|
-
result: {
|
|
222
|
-
valid: false,
|
|
223
|
-
errors,
|
|
224
|
-
warnings,
|
|
225
|
-
suggestions: [],
|
|
226
|
-
confidence_score: 0,
|
|
227
|
-
},
|
|
228
|
-
required_fields: requiredFields,
|
|
229
|
-
missing_fields: requiredFields,
|
|
230
|
-
quality_indicators: {},
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
// Check required fields
|
|
234
|
-
requiredFields.forEach((field) => {
|
|
235
|
-
if (!phaseData[field]) {
|
|
236
|
-
missingFields.push(field);
|
|
237
|
-
errors.push(`Missing required field: ${field}`);
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
// Phase-specific validations
|
|
241
|
-
if (phaseName === "functional_summary") {
|
|
242
|
-
if (phaseData.complexity_level &&
|
|
243
|
-
!["low", "medium", "high"].includes(phaseData.complexity_level)) {
|
|
244
|
-
errors.push("Invalid complexity_level value");
|
|
245
|
-
}
|
|
246
|
-
if (phaseData.key_features && !Array.isArray(phaseData.key_features)) {
|
|
247
|
-
errors.push("key_features must be an array");
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (phaseName === "design_brief") {
|
|
251
|
-
if (phaseData.theme &&
|
|
252
|
-
!["dark", "light", "mixed"].includes(phaseData.theme)) {
|
|
253
|
-
errors.push("Invalid theme value");
|
|
254
|
-
}
|
|
255
|
-
if (phaseData.primary_color && !phaseData.primary_color.startsWith("#")) {
|
|
256
|
-
warnings.push("Primary color should be a hex value");
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (phaseName === "visual_system") {
|
|
260
|
-
if (phaseData.colors && !phaseData.colors.primary) {
|
|
261
|
-
errors.push("Missing primary color in visual system");
|
|
262
|
-
}
|
|
263
|
-
if (phaseData.typography && !phaseData.typography.font_families) {
|
|
264
|
-
errors.push("Missing font families in typography");
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
const confidenceScore = this.calculatePhaseConfidence(phaseData, requiredFields.length - missingFields.length);
|
|
268
|
-
return {
|
|
269
|
-
phase_name: phaseName,
|
|
270
|
-
result: {
|
|
271
|
-
valid: errors.length === 0,
|
|
272
|
-
errors,
|
|
273
|
-
warnings,
|
|
274
|
-
suggestions: this.generatePhaseSuggestions(phaseName, phaseData),
|
|
275
|
-
confidence_score: confidenceScore,
|
|
276
|
-
},
|
|
277
|
-
required_fields: requiredFields,
|
|
278
|
-
missing_fields: missingFields,
|
|
279
|
-
quality_indicators: this.extractQualityIndicators(phaseName, phaseData),
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Calculate overall confidence score for the manifest
|
|
284
|
-
*/
|
|
285
|
-
calculateOverallConfidence(manifest) {
|
|
286
|
-
if (!manifest.phases)
|
|
287
|
-
return 0;
|
|
288
|
-
const phaseScores = Object.values(manifest.phases).map((phase) => this.calculatePhaseConfidence(phase, Object.keys(phase).length));
|
|
289
|
-
const averageScore = phaseScores.reduce((sum, score) => sum + score, 0) / phaseScores.length;
|
|
290
|
-
// Boost score if metadata indicates AI generation
|
|
291
|
-
if (manifest.metadata?.ai_model_used) {
|
|
292
|
-
return Math.min(1, averageScore + 0.1);
|
|
293
|
-
}
|
|
294
|
-
return averageScore;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Calculate confidence score for a single phase
|
|
298
|
-
*/
|
|
299
|
-
calculatePhaseConfidence(phaseData, fieldCount) {
|
|
300
|
-
if (!phaseData)
|
|
301
|
-
return 0;
|
|
302
|
-
const totalFields = Object.keys(phaseData).length;
|
|
303
|
-
const completeness = fieldCount / Math.max(totalFields, 1);
|
|
304
|
-
// Additional quality checks
|
|
305
|
-
let qualityBonus = 0;
|
|
306
|
-
if (phaseData.colors?.primary)
|
|
307
|
-
qualityBonus += 0.1;
|
|
308
|
-
if (phaseData.typography?.font_families)
|
|
309
|
-
qualityBonus += 0.1;
|
|
310
|
-
if (phaseData.design_anchors?.length > 0)
|
|
311
|
-
qualityBonus += 0.1;
|
|
312
|
-
return Math.min(1, completeness + qualityBonus);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Generate suggestions for improving a phase
|
|
316
|
-
*/
|
|
317
|
-
generatePhaseSuggestions(phaseName, phaseData) {
|
|
318
|
-
const suggestions = [];
|
|
319
|
-
switch (phaseName) {
|
|
320
|
-
case "functional_summary":
|
|
321
|
-
if (!phaseData.user_personas) {
|
|
322
|
-
suggestions.push("Add user personas to better understand target audience");
|
|
323
|
-
}
|
|
324
|
-
if (!phaseData.business_goals) {
|
|
325
|
-
suggestions.push("Define business goals for better alignment");
|
|
326
|
-
}
|
|
327
|
-
break;
|
|
328
|
-
case "design_brief":
|
|
329
|
-
if (!phaseData.accessibility_focus) {
|
|
330
|
-
suggestions.push("Add accessibility focus areas");
|
|
331
|
-
}
|
|
332
|
-
if (phaseData.inspiration_sources?.length < 3) {
|
|
333
|
-
suggestions.push("Add more inspiration sources for richer design direction");
|
|
334
|
-
}
|
|
335
|
-
break;
|
|
336
|
-
case "visual_system":
|
|
337
|
-
if (!phaseData.colors?.success) {
|
|
338
|
-
suggestions.push("Add semantic colors (success, warning, error)");
|
|
339
|
-
}
|
|
340
|
-
if (!phaseData.motion?.duration) {
|
|
341
|
-
suggestions.push("Define motion timing for better consistency");
|
|
342
|
-
}
|
|
343
|
-
break;
|
|
344
|
-
case "component_hierarchy":
|
|
345
|
-
if (phaseData.components?.length === 0) {
|
|
346
|
-
suggestions.push("Define specific components needed for the project");
|
|
347
|
-
}
|
|
348
|
-
if (!phaseData.design_patterns?.length) {
|
|
349
|
-
suggestions.push("Identify design patterns to maintain consistency");
|
|
350
|
-
}
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
return suggestions;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Extract quality indicators for a phase
|
|
357
|
-
*/
|
|
358
|
-
extractQualityIndicators(phaseName, phaseData) {
|
|
359
|
-
const indicators = {};
|
|
360
|
-
switch (phaseName) {
|
|
361
|
-
case "functional_summary":
|
|
362
|
-
indicators.feature_count = phaseData.key_features?.length || 0;
|
|
363
|
-
indicators.has_personas = !!phaseData.user_personas?.length;
|
|
364
|
-
indicators.has_goals = !!phaseData.business_goals?.length;
|
|
365
|
-
break;
|
|
366
|
-
case "design_brief":
|
|
367
|
-
indicators.inspiration_count =
|
|
368
|
-
phaseData.inspiration_sources?.length || 0;
|
|
369
|
-
indicators.has_accessibility = !!phaseData.accessibility_focus?.length;
|
|
370
|
-
indicators.color_count = phaseData.support_colors?.length || 0;
|
|
371
|
-
break;
|
|
372
|
-
case "visual_system":
|
|
373
|
-
indicators.color_completeness = this.calculateColorCompleteness(phaseData.colors);
|
|
374
|
-
indicators.typography_completeness =
|
|
375
|
-
this.calculateTypographyCompleteness(phaseData.typography);
|
|
376
|
-
break;
|
|
377
|
-
case "component_hierarchy":
|
|
378
|
-
indicators.screen_count = phaseData.screens?.length || 0;
|
|
379
|
-
indicators.component_count = phaseData.components?.length || 0;
|
|
380
|
-
indicators.pattern_count = phaseData.design_patterns?.length || 0;
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
return indicators;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Calculate color completeness score
|
|
387
|
-
*/
|
|
388
|
-
calculateColorCompleteness(colors) {
|
|
389
|
-
if (!colors)
|
|
390
|
-
return 0;
|
|
391
|
-
const requiredColors = [
|
|
392
|
-
"primary",
|
|
393
|
-
"background",
|
|
394
|
-
"surface",
|
|
395
|
-
"text",
|
|
396
|
-
"text_muted",
|
|
397
|
-
];
|
|
398
|
-
const optionalColors = [
|
|
399
|
-
"secondary",
|
|
400
|
-
"accent",
|
|
401
|
-
"border",
|
|
402
|
-
"success",
|
|
403
|
-
"warning",
|
|
404
|
-
"error",
|
|
405
|
-
];
|
|
406
|
-
const requiredCount = requiredColors.filter((color) => colors[color]).length;
|
|
407
|
-
const optionalCount = optionalColors.filter((color) => colors[color]).length;
|
|
408
|
-
return (requiredCount / requiredColors.length +
|
|
409
|
-
(optionalCount / optionalColors.length) * 0.3);
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Calculate typography completeness score
|
|
413
|
-
*/
|
|
414
|
-
calculateTypographyCompleteness(typography) {
|
|
415
|
-
if (!typography)
|
|
416
|
-
return 0;
|
|
417
|
-
let score = 0;
|
|
418
|
-
if (typography.font_families?.heading)
|
|
419
|
-
score += 0.3;
|
|
420
|
-
if (typography.font_families?.body)
|
|
421
|
-
score += 0.3;
|
|
422
|
-
if (typography.scale)
|
|
423
|
-
score += 0.2;
|
|
424
|
-
if (typography.weights)
|
|
425
|
-
score += 0.2;
|
|
426
|
-
return Math.min(1, score);
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Enrich context with design manifest data
|
|
430
|
-
*/
|
|
431
|
-
async enrichContextWithDesign(prd, types = "", brand = "") {
|
|
432
|
-
const manifest = await this.loadDesignManifest();
|
|
433
|
-
if (!manifest) {
|
|
434
|
-
throw new Error("No design manifest found. Run design pipeline first.");
|
|
435
|
-
}
|
|
436
|
-
return {
|
|
437
|
-
project_summary: manifest.phases.functional_summary,
|
|
438
|
-
design_system: manifest.phases.visual_system,
|
|
439
|
-
design_intent: manifest.phases.design_intent,
|
|
440
|
-
component_architecture: manifest.phases.component_hierarchy,
|
|
441
|
-
technical_context: {
|
|
442
|
-
prd,
|
|
443
|
-
types,
|
|
444
|
-
brand,
|
|
445
|
-
},
|
|
446
|
-
implementation_guidelines: manifest.phases.implementation_plan,
|
|
447
|
-
design_principles: manifest.phases.design_brief.ui_principles,
|
|
448
|
-
visual_tokens: this.extractVisualTokens(manifest.phases.visual_system),
|
|
449
|
-
interaction_patterns: manifest.phases.component_hierarchy.interaction_flows,
|
|
450
|
-
accessibility_requirements: manifest.phases.design_brief.accessibility_focus || [],
|
|
451
|
-
// NEW: Intent-based specifications
|
|
452
|
-
enriched_intents: manifest.phases.intent_validation?.enriched_intents || [],
|
|
453
|
-
intent_validation_report: manifest.phases.intent_validation?.validation_report || undefined,
|
|
454
|
-
intent_clarifications: manifest.phases.intent_validation?.clarifications || [],
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Extract visual tokens for easy consumption
|
|
459
|
-
*/
|
|
460
|
-
extractVisualTokens(visualSystem) {
|
|
461
|
-
return {
|
|
462
|
-
colors: visualSystem.colors,
|
|
463
|
-
spacing: visualSystem.spacing,
|
|
464
|
-
typography: visualSystem.typography,
|
|
465
|
-
radii: visualSystem.radii,
|
|
466
|
-
shadows: visualSystem.shadows,
|
|
467
|
-
motion: visualSystem.motion,
|
|
468
|
-
breakpoints: visualSystem.breakpoints,
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Get design manifest summary for display
|
|
473
|
-
*/
|
|
474
|
-
async getManifestSummary() {
|
|
475
|
-
const manifest = await this.loadDesignManifest();
|
|
476
|
-
if (!manifest) {
|
|
477
|
-
return "No design manifest found";
|
|
478
|
-
}
|
|
479
|
-
const { phases } = manifest;
|
|
480
|
-
const summary = [
|
|
481
|
-
`🎨 Design Manifest: ${manifest.project_name}`,
|
|
482
|
-
`📱 Platform: ${phases.functional_summary.platform}`,
|
|
483
|
-
`🎯 Scope: ${phases.project_scope.build_scope}`,
|
|
484
|
-
`🎨 Theme: ${phases.design_brief.theme}`,
|
|
485
|
-
`🎨 Primary Color: ${phases.design_brief.primary_color}`,
|
|
486
|
-
`📐 Components: ${phases.component_hierarchy.components.length}`,
|
|
487
|
-
`📱 Screens: ${phases.component_hierarchy.screens.length}`,
|
|
488
|
-
`⚡ Framework: ${phases.implementation_plan.framework}`,
|
|
489
|
-
`🎯 Design Anchors: ${phases.design_intent.design_anchors.join(", ")}`,
|
|
490
|
-
];
|
|
491
|
-
return summary.join("\n");
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Check if manifest needs regeneration based on age or changes
|
|
495
|
-
*/
|
|
496
|
-
async shouldRegenerateManifest(maxAgeHours = 24) {
|
|
497
|
-
const manifest = await this.loadDesignManifest();
|
|
498
|
-
if (!manifest)
|
|
499
|
-
return true;
|
|
500
|
-
const generatedAt = new Date(manifest.generated_at);
|
|
501
|
-
const ageHours = (Date.now() - generatedAt.getTime()) / (1000 * 60 * 60);
|
|
502
|
-
return ageHours > maxAgeHours;
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Get manifest file path
|
|
506
|
-
*/
|
|
507
|
-
getManifestPath() {
|
|
508
|
-
return this.manifestPath;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Check if manifest file exists
|
|
512
|
-
*/
|
|
513
|
-
async manifestExists() {
|
|
514
|
-
return await fs.pathExists(this.manifestPath);
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Delete manifest file
|
|
518
|
-
*/
|
|
519
|
-
async deleteManifest() {
|
|
520
|
-
try {
|
|
521
|
-
if (await fs.pathExists(this.manifestPath)) {
|
|
522
|
-
await fs.remove(this.manifestPath);
|
|
523
|
-
console.log(chalk_1.default.yellow("🗑️ Design manifest deleted"));
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
catch (error) {
|
|
527
|
-
console.error(chalk_1.default.red("❌ Failed to delete design manifest:"), error);
|
|
528
|
-
throw error;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Create a default design manifest
|
|
533
|
-
*/
|
|
534
|
-
createDefaultManifest(projectName, description) {
|
|
535
|
-
const timestamp = new Date().toISOString();
|
|
536
|
-
return {
|
|
537
|
-
version: "1.0.0",
|
|
538
|
-
generated_at: timestamp,
|
|
539
|
-
project_name: projectName,
|
|
540
|
-
phases: {
|
|
541
|
-
functional_summary: {
|
|
542
|
-
app_name: projectName,
|
|
543
|
-
core_purpose: description,
|
|
544
|
-
key_features: [],
|
|
545
|
-
primary_user_actions: [],
|
|
546
|
-
platform: "web",
|
|
547
|
-
technical_requirements: [],
|
|
548
|
-
complexity_level: "low",
|
|
549
|
-
},
|
|
550
|
-
project_scope: {
|
|
551
|
-
build_scope: "full_app",
|
|
552
|
-
reason: "Default initialization",
|
|
553
|
-
expected_outputs: [],
|
|
554
|
-
},
|
|
555
|
-
context_gaps: {
|
|
556
|
-
missing: ["PRD detail", "User flows", "Design tokens"],
|
|
557
|
-
recommended_next_action: "Run 'mycontext generate context --full' to flesh out requirements",
|
|
558
|
-
},
|
|
559
|
-
design_brief: {
|
|
560
|
-
theme: "light",
|
|
561
|
-
inspiration_sources: [],
|
|
562
|
-
blended_style: "modern",
|
|
563
|
-
primary_color: "#3B82F6",
|
|
564
|
-
support_colors: [],
|
|
565
|
-
typography: {
|
|
566
|
-
heading: "Inter",
|
|
567
|
-
body: "Inter",
|
|
568
|
-
},
|
|
569
|
-
ui_principles: [],
|
|
570
|
-
motion_style: "normal",
|
|
571
|
-
personality_keywords: [],
|
|
572
|
-
emotional_tone: "professional",
|
|
573
|
-
target_audience: "General users",
|
|
574
|
-
},
|
|
575
|
-
visual_system: {
|
|
576
|
-
colors: {
|
|
577
|
-
primary: "#3B82F6",
|
|
578
|
-
background: "#FFFFFF",
|
|
579
|
-
surface: "#F9FAFB",
|
|
580
|
-
text: "#111827",
|
|
581
|
-
text_muted: "#6B7280",
|
|
582
|
-
},
|
|
583
|
-
typography: {
|
|
584
|
-
font_families: {
|
|
585
|
-
heading: "Inter",
|
|
586
|
-
body: "Inter",
|
|
587
|
-
mono: "ui-monospace",
|
|
588
|
-
},
|
|
589
|
-
scale: {
|
|
590
|
-
xs: "0.75rem",
|
|
591
|
-
sm: "0.875rem",
|
|
592
|
-
md: "1rem",
|
|
593
|
-
lg: "1.125rem",
|
|
594
|
-
xl: "1.25rem",
|
|
595
|
-
"2xl": "1.5rem",
|
|
596
|
-
"3xl": "1.875rem",
|
|
597
|
-
"4xl": "2.25rem",
|
|
598
|
-
},
|
|
599
|
-
weights: {
|
|
600
|
-
normal: "400",
|
|
601
|
-
medium: "500",
|
|
602
|
-
semibold: "600",
|
|
603
|
-
bold: "700",
|
|
604
|
-
},
|
|
605
|
-
},
|
|
606
|
-
spacing: {
|
|
607
|
-
xs: "0.25rem",
|
|
608
|
-
sm: "0.5rem",
|
|
609
|
-
md: "1rem",
|
|
610
|
-
lg: "1.5rem",
|
|
611
|
-
xl: "2rem",
|
|
612
|
-
"2xl": "3rem",
|
|
613
|
-
"3xl": "4rem",
|
|
614
|
-
"4xl": "6rem",
|
|
615
|
-
},
|
|
616
|
-
radii: {
|
|
617
|
-
none: "0",
|
|
618
|
-
sm: "0.125rem",
|
|
619
|
-
md: "0.25rem",
|
|
620
|
-
lg: "0.5rem",
|
|
621
|
-
xl: "0.75rem",
|
|
622
|
-
full: "9999px",
|
|
623
|
-
},
|
|
624
|
-
shadows: {
|
|
625
|
-
sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
626
|
-
md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
|
|
627
|
-
lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)",
|
|
628
|
-
xl: "0 20px 25px -5px rgb(0 0 0 / 0.1)",
|
|
629
|
-
},
|
|
630
|
-
motion: {
|
|
631
|
-
duration: {
|
|
632
|
-
fast: "150ms",
|
|
633
|
-
normal: "250ms",
|
|
634
|
-
slow: "350ms",
|
|
635
|
-
},
|
|
636
|
-
easing: {
|
|
637
|
-
linear: "linear",
|
|
638
|
-
ease_in: "cubic-bezier(0.4, 0, 1, 1)",
|
|
639
|
-
ease_out: "cubic-bezier(0, 0, 0.2, 1)",
|
|
640
|
-
ease_in_out: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
641
|
-
},
|
|
642
|
-
},
|
|
643
|
-
breakpoints: {
|
|
644
|
-
sm: "640px",
|
|
645
|
-
md: "768px",
|
|
646
|
-
lg: "1024px",
|
|
647
|
-
xl: "1280px",
|
|
648
|
-
},
|
|
649
|
-
},
|
|
650
|
-
component_hierarchy: {
|
|
651
|
-
screens: [],
|
|
652
|
-
components: [],
|
|
653
|
-
design_patterns: [],
|
|
654
|
-
interaction_flows: [],
|
|
655
|
-
state_management: [],
|
|
656
|
-
data_flow: [],
|
|
657
|
-
},
|
|
658
|
-
implementation_plan: {
|
|
659
|
-
framework: "nextjs",
|
|
660
|
-
pages: [],
|
|
661
|
-
state_management: "react-query",
|
|
662
|
-
build_requirements: [],
|
|
663
|
-
data_persistence: "vantage",
|
|
664
|
-
performance_optimizations: [],
|
|
665
|
-
accessibility_implementation: [],
|
|
666
|
-
testing_strategy: [],
|
|
667
|
-
},
|
|
668
|
-
design_intent: {
|
|
669
|
-
visual_philosophy: "Clean, professional, and accessible",
|
|
670
|
-
design_anchors: ["modern", "trustworthy"],
|
|
671
|
-
user_experience_goals: ["ease of use", "clarity"],
|
|
672
|
-
brand_alignment: "Aligned with modern professional standards",
|
|
673
|
-
technical_constraints: ["Responsive design", "Accessibility compliance"],
|
|
674
|
-
scalability_considerations: ["Component-based architecture"],
|
|
675
|
-
maintenance_guidelines: ["Documented props", "Consistent naming"],
|
|
676
|
-
success_criteria: ["Project initialized", "Manifest generated"],
|
|
677
|
-
},
|
|
678
|
-
state_attestation: {
|
|
679
|
-
last_audit_at: timestamp,
|
|
680
|
-
drift_score: 0,
|
|
681
|
-
compliance_status: "compliant",
|
|
682
|
-
untracked_changes: [],
|
|
683
|
-
},
|
|
684
|
-
},
|
|
685
|
-
metadata: {
|
|
686
|
-
confidence_scores: {},
|
|
687
|
-
fallbacks_used: [],
|
|
688
|
-
generation_time_ms: 0,
|
|
689
|
-
},
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
exports.DesignManifestManager = DesignManifestManager;
|
|
694
|
-
//# sourceMappingURL=designManifestManager.js.map
|