mycontext-cli 0.2.0 → 0.2.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 +17 -16
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +118 -11
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +8 -0
- package/dist/commands/setup.js.map +1 -1
- package/dist/config/dependencies.json +180 -0
- package/package.json +9 -8
- package/dist/cli/src/agents/implementations/CodeGenSubAgent.d.ts +0 -44
- package/dist/cli/src/agents/implementations/CodeGenSubAgent.d.ts.map +0 -1
- package/dist/cli/src/agents/implementations/CodeGenSubAgent.js +0 -1374
- package/dist/cli/src/agents/implementations/CodeGenSubAgent.js.map +0 -1
- package/dist/cli/src/agents/implementations/DocsSubAgent.d.ts +0 -35
- package/dist/cli/src/agents/implementations/DocsSubAgent.d.ts.map +0 -1
- package/dist/cli/src/agents/implementations/DocsSubAgent.js +0 -351
- package/dist/cli/src/agents/implementations/DocsSubAgent.js.map +0 -1
- package/dist/cli/src/agents/implementations/EnhancementAgent.d.ts +0 -120
- package/dist/cli/src/agents/implementations/EnhancementAgent.d.ts.map +0 -1
- package/dist/cli/src/agents/implementations/EnhancementAgent.js +0 -606
- package/dist/cli/src/agents/implementations/EnhancementAgent.js.map +0 -1
- package/dist/cli/src/agents/implementations/QASubAgent.d.ts +0 -31
- package/dist/cli/src/agents/implementations/QASubAgent.d.ts.map +0 -1
- package/dist/cli/src/agents/implementations/QASubAgent.js +0 -190
- package/dist/cli/src/agents/implementations/QASubAgent.js.map +0 -1
- package/dist/cli/src/agents/interfaces/SubAgent.d.ts +0 -287
- package/dist/cli/src/agents/interfaces/SubAgent.d.ts.map +0 -1
- package/dist/cli/src/agents/interfaces/SubAgent.js +0 -7
- package/dist/cli/src/agents/interfaces/SubAgent.js.map +0 -1
- package/dist/cli/src/agents/orchestrator/SubAgentOrchestrator.d.ts +0 -59
- package/dist/cli/src/agents/orchestrator/SubAgentOrchestrator.d.ts.map +0 -1
- package/dist/cli/src/agents/orchestrator/SubAgentOrchestrator.js +0 -305
- package/dist/cli/src/agents/orchestrator/SubAgentOrchestrator.js.map +0 -1
- package/dist/cli/src/agents/personalities/definitions.d.ts +0 -34
- package/dist/cli/src/agents/personalities/definitions.d.ts.map +0 -1
- package/dist/cli/src/agents/personalities/definitions.js +0 -389
- package/dist/cli/src/agents/personalities/definitions.js.map +0 -1
- package/dist/cli/src/cli.d.ts +0 -3
- package/dist/cli/src/cli.d.ts.map +0 -1
- package/dist/cli/src/cli.js +0 -298
- package/dist/cli/src/cli.js.map +0 -1
- package/dist/cli/src/commands/auth.d.ts +0 -23
- package/dist/cli/src/commands/auth.d.ts.map +0 -1
- package/dist/cli/src/commands/auth.js +0 -212
- package/dist/cli/src/commands/auth.js.map +0 -1
- package/dist/cli/src/commands/enhance.d.ts +0 -28
- package/dist/cli/src/commands/enhance.d.ts.map +0 -1
- package/dist/cli/src/commands/enhance.js +0 -246
- package/dist/cli/src/commands/enhance.js.map +0 -1
- package/dist/cli/src/commands/generate-components.d.ts +0 -27
- package/dist/cli/src/commands/generate-components.d.ts.map +0 -1
- package/dist/cli/src/commands/generate-components.js +0 -680
- package/dist/cli/src/commands/generate-components.js.map +0 -1
- package/dist/cli/src/commands/generate.d.ts +0 -108
- package/dist/cli/src/commands/generate.d.ts.map +0 -1
- package/dist/cli/src/commands/generate.js +0 -1970
- package/dist/cli/src/commands/generate.js.map +0 -1
- package/dist/cli/src/commands/init.d.ts +0 -13
- package/dist/cli/src/commands/init.d.ts.map +0 -1
- package/dist/cli/src/commands/init.js +0 -91
- package/dist/cli/src/commands/init.js.map +0 -1
- package/dist/cli/src/commands/list.d.ts +0 -17
- package/dist/cli/src/commands/list.d.ts.map +0 -1
- package/dist/cli/src/commands/list.js +0 -210
- package/dist/cli/src/commands/list.js.map +0 -1
- package/dist/cli/src/commands/model.d.ts +0 -25
- package/dist/cli/src/commands/model.d.ts.map +0 -1
- package/dist/cli/src/commands/model.js +0 -317
- package/dist/cli/src/commands/model.js.map +0 -1
- package/dist/cli/src/commands/preview.d.ts +0 -23
- package/dist/cli/src/commands/preview.d.ts.map +0 -1
- package/dist/cli/src/commands/preview.js +0 -1200
- package/dist/cli/src/commands/preview.js.map +0 -1
- package/dist/cli/src/commands/setup.d.ts +0 -35
- package/dist/cli/src/commands/setup.d.ts.map +0 -1
- package/dist/cli/src/commands/setup.js +0 -412
- package/dist/cli/src/commands/setup.js.map +0 -1
- package/dist/cli/src/commands/status.d.ts +0 -21
- package/dist/cli/src/commands/status.d.ts.map +0 -1
- package/dist/cli/src/commands/status.js +0 -287
- package/dist/cli/src/commands/status.js.map +0 -1
- package/dist/cli/src/commands/validate.d.ts +0 -22
- package/dist/cli/src/commands/validate.d.ts.map +0 -1
- package/dist/cli/src/commands/validate.js +0 -259
- package/dist/cli/src/commands/validate.js.map +0 -1
- package/dist/cli/src/types/index.d.ts +0 -152
- package/dist/cli/src/types/index.d.ts.map +0 -1
- package/dist/cli/src/types/index.js +0 -3
- package/dist/cli/src/types/index.js.map +0 -1
- package/dist/cli/src/utils/apiKeyManager.d.ts +0 -137
- package/dist/cli/src/utils/apiKeyManager.d.ts.map +0 -1
- package/dist/cli/src/utils/apiKeyManager.js +0 -471
- package/dist/cli/src/utils/apiKeyManager.js.map +0 -1
- package/dist/cli/src/utils/componentValidator.d.ts +0 -60
- package/dist/cli/src/utils/componentValidator.d.ts.map +0 -1
- package/dist/cli/src/utils/componentValidator.js +0 -191
- package/dist/cli/src/utils/componentValidator.js.map +0 -1
- package/dist/cli/src/utils/designTokenExtractor.d.ts +0 -94
- package/dist/cli/src/utils/designTokenExtractor.d.ts.map +0 -1
- package/dist/cli/src/utils/designTokenExtractor.js +0 -231
- package/dist/cli/src/utils/designTokenExtractor.js.map +0 -1
- package/dist/cli/src/utils/errorHandler.d.ts +0 -105
- package/dist/cli/src/utils/errorHandler.d.ts.map +0 -1
- package/dist/cli/src/utils/errorHandler.js +0 -332
- package/dist/cli/src/utils/errorHandler.js.map +0 -1
- package/dist/cli/src/utils/fileSystem.d.ts +0 -58
- package/dist/cli/src/utils/fileSystem.d.ts.map +0 -1
- package/dist/cli/src/utils/fileSystem.js +0 -230
- package/dist/cli/src/utils/fileSystem.js.map +0 -1
- package/dist/cli/src/utils/githubModels.d.ts +0 -53
- package/dist/cli/src/utils/githubModels.d.ts.map +0 -1
- package/dist/cli/src/utils/githubModels.js +0 -239
- package/dist/cli/src/utils/githubModels.js.map +0 -1
- package/dist/cli/src/utils/ollamaClient.d.ts +0 -37
- package/dist/cli/src/utils/ollamaClient.d.ts.map +0 -1
- package/dist/cli/src/utils/ollamaClient.js +0 -213
- package/dist/cli/src/utils/ollamaClient.js.map +0 -1
- package/dist/cli/src/utils/spinner.d.ts +0 -30
- package/dist/cli/src/utils/spinner.d.ts.map +0 -1
- package/dist/cli/src/utils/spinner.js +0 -119
- package/dist/cli/src/utils/spinner.js.map +0 -1
- package/dist/cli/src/utils/xaiClient.d.ts +0 -59
- package/dist/cli/src/utils/xaiClient.d.ts.map +0 -1
- package/dist/cli/src/utils/xaiClient.js +0 -244
- package/dist/cli/src/utils/xaiClient.js.map +0 -1
- package/dist/lib/analytics/usage-tracker.d.ts +0 -125
- package/dist/lib/analytics/usage-tracker.d.ts.map +0 -1
- package/dist/lib/analytics/usage-tracker.js +0 -429
- package/dist/lib/analytics/usage-tracker.js.map +0 -1
- package/dist/utils/githubModels.d.ts +0 -53
- package/dist/utils/githubModels.d.ts.map +0 -1
- package/dist/utils/githubModels.js +0 -239
- package/dist/utils/githubModels.js.map +0 -1
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Component Validator
|
|
4
|
-
*
|
|
5
|
-
* Validates React components for syntax, structure, and best practices.
|
|
6
|
-
* Used by the EnhancementAgent to ensure quality and compliance.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ComponentValidator = void 0;
|
|
10
|
-
class ComponentValidator {
|
|
11
|
-
/**
|
|
12
|
-
* Validate component syntax
|
|
13
|
-
*/
|
|
14
|
-
async validateSyntax(componentCode) {
|
|
15
|
-
try {
|
|
16
|
-
// Basic syntax validation
|
|
17
|
-
if (!componentCode.includes('export default')) {
|
|
18
|
-
throw new Error('Component must have default export');
|
|
19
|
-
}
|
|
20
|
-
if (!componentCode.includes('function') && !componentCode.includes('const')) {
|
|
21
|
-
throw new Error('Component must be a function or const');
|
|
22
|
-
}
|
|
23
|
-
if (!componentCode.includes('return')) {
|
|
24
|
-
throw new Error('Component must have return statement');
|
|
25
|
-
}
|
|
26
|
-
// Check for basic React imports
|
|
27
|
-
if (!componentCode.includes('import React') && !componentCode.includes('import { useState }')) {
|
|
28
|
-
throw new Error('Component must import React or React hooks');
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
console.error('Syntax validation failed:', error);
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Validate enhancement against constraints
|
|
39
|
-
*/
|
|
40
|
-
async validateEnhancement(componentCode, constraints) {
|
|
41
|
-
const errors = [];
|
|
42
|
-
const warnings = [];
|
|
43
|
-
const suggestions = [];
|
|
44
|
-
// Check dependencies
|
|
45
|
-
const dependencies = this.extractDependencies(componentCode);
|
|
46
|
-
if (dependencies.length > constraints.maxDependencies) {
|
|
47
|
-
errors.push({
|
|
48
|
-
type: "structure",
|
|
49
|
-
message: `Too many dependencies: ${dependencies.length} > ${constraints.maxDependencies}`,
|
|
50
|
-
severity: "error",
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
// Check for shadcn/ui usage if required
|
|
54
|
-
if (constraints.uiLibrary === "shadcn") {
|
|
55
|
-
const shadcnComponents = this.extractShadcnComponents(componentCode);
|
|
56
|
-
if (shadcnComponents.length === 0) {
|
|
57
|
-
warnings.push({
|
|
58
|
-
type: "best-practice",
|
|
59
|
-
message: "No shadcn/ui components found",
|
|
60
|
-
suggestion: "Consider using shadcn/ui components for consistency",
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// Check accessibility
|
|
65
|
-
const accessibilityIssues = this.checkAccessibility(componentCode);
|
|
66
|
-
warnings.push(...accessibilityIssues);
|
|
67
|
-
// Check performance
|
|
68
|
-
const performanceIssues = this.checkPerformance(componentCode);
|
|
69
|
-
warnings.push(...performanceIssues);
|
|
70
|
-
// Calculate score
|
|
71
|
-
const score = this.calculateScore(errors, warnings);
|
|
72
|
-
return {
|
|
73
|
-
isValid: errors.length === 0,
|
|
74
|
-
errors,
|
|
75
|
-
warnings,
|
|
76
|
-
score,
|
|
77
|
-
suggestions,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Extract dependencies from component code
|
|
82
|
-
*/
|
|
83
|
-
extractDependencies(componentCode) {
|
|
84
|
-
const dependencies = [];
|
|
85
|
-
// React hooks
|
|
86
|
-
if (componentCode.includes('useState'))
|
|
87
|
-
dependencies.push('useState');
|
|
88
|
-
if (componentCode.includes('useEffect'))
|
|
89
|
-
dependencies.push('useEffect');
|
|
90
|
-
if (componentCode.includes('useCallback'))
|
|
91
|
-
dependencies.push('useCallback');
|
|
92
|
-
if (componentCode.includes('useMemo'))
|
|
93
|
-
dependencies.push('useMemo');
|
|
94
|
-
if (componentCode.includes('useRef'))
|
|
95
|
-
dependencies.push('useRef');
|
|
96
|
-
if (componentCode.includes('useContext'))
|
|
97
|
-
dependencies.push('useContext');
|
|
98
|
-
// shadcn/ui components
|
|
99
|
-
const shadcnComponents = [
|
|
100
|
-
'Button', 'Input', 'Card', 'Dialog', 'Modal', 'Select', 'Checkbox',
|
|
101
|
-
'RadioGroup', 'Textarea', 'Switch', 'Slider', 'Progress', 'Badge',
|
|
102
|
-
'Avatar', 'Alert', 'Toast', 'Tooltip', 'Popover', 'DropdownMenu'
|
|
103
|
-
];
|
|
104
|
-
shadcnComponents.forEach(component => {
|
|
105
|
-
if (componentCode.includes(component)) {
|
|
106
|
-
dependencies.push(`@/components/ui/${component.toLowerCase()}`);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
return dependencies;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Extract shadcn/ui components
|
|
113
|
-
*/
|
|
114
|
-
extractShadcnComponents(componentCode) {
|
|
115
|
-
const shadcnComponents = [
|
|
116
|
-
'Button', 'Input', 'Card', 'Dialog', 'Modal', 'Select', 'Checkbox',
|
|
117
|
-
'RadioGroup', 'Textarea', 'Switch', 'Slider', 'Progress', 'Badge',
|
|
118
|
-
'Avatar', 'Alert', 'Toast', 'Tooltip', 'Popover', 'DropdownMenu'
|
|
119
|
-
];
|
|
120
|
-
return shadcnComponents.filter(component => componentCode.includes(component));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Check accessibility issues
|
|
124
|
-
*/
|
|
125
|
-
checkAccessibility(componentCode) {
|
|
126
|
-
const warnings = [];
|
|
127
|
-
if (!componentCode.includes('aria-label') && !componentCode.includes('aria-labelledby')) {
|
|
128
|
-
warnings.push({
|
|
129
|
-
type: "accessibility",
|
|
130
|
-
message: "Missing ARIA labels",
|
|
131
|
-
suggestion: "Add aria-label or aria-labelledby for better screen reader support",
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (componentCode.includes('onClick') && !componentCode.includes('onKeyDown')) {
|
|
135
|
-
warnings.push({
|
|
136
|
-
type: "accessibility",
|
|
137
|
-
message: "Missing keyboard navigation",
|
|
138
|
-
suggestion: "Add onKeyDown handler for keyboard accessibility",
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
if (componentCode.includes('button') && !componentCode.includes('type=')) {
|
|
142
|
-
warnings.push({
|
|
143
|
-
type: "accessibility",
|
|
144
|
-
message: "Button missing type attribute",
|
|
145
|
-
suggestion: "Add type='button' to prevent form submission",
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
return warnings;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Check performance issues
|
|
152
|
-
*/
|
|
153
|
-
checkPerformance(componentCode) {
|
|
154
|
-
const warnings = [];
|
|
155
|
-
if (componentCode.includes('map') && !componentCode.includes('key=')) {
|
|
156
|
-
warnings.push({
|
|
157
|
-
type: "performance",
|
|
158
|
-
message: "Missing key prop in map",
|
|
159
|
-
suggestion: "Add unique key prop to mapped elements",
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
if (componentCode.includes('useState') && !componentCode.includes('useCallback')) {
|
|
163
|
-
warnings.push({
|
|
164
|
-
type: "performance",
|
|
165
|
-
message: "Consider using useCallback",
|
|
166
|
-
suggestion: "Use useCallback for event handlers to prevent unnecessary re-renders",
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
if (componentCode.includes('useEffect') && !componentCode.includes('dependencies')) {
|
|
170
|
-
warnings.push({
|
|
171
|
-
type: "performance",
|
|
172
|
-
message: "Missing useEffect dependencies",
|
|
173
|
-
suggestion: "Add dependency array to useEffect to prevent infinite loops",
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
return warnings;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Calculate validation score
|
|
180
|
-
*/
|
|
181
|
-
calculateScore(errors, warnings) {
|
|
182
|
-
let score = 100;
|
|
183
|
-
// Deduct points for errors
|
|
184
|
-
score -= errors.length * 20;
|
|
185
|
-
// Deduct points for warnings
|
|
186
|
-
score -= warnings.length * 5;
|
|
187
|
-
return Math.max(0, score);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
exports.ComponentValidator = ComponentValidator;
|
|
191
|
-
//# sourceMappingURL=componentValidator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
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 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Design Token Extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts design tokens from React component code including colors, spacing, typography, shadows, and animations.
|
|
5
|
-
*/
|
|
6
|
-
export interface DesignTokens {
|
|
7
|
-
colors: ColorTokens;
|
|
8
|
-
spacing: SpacingTokens;
|
|
9
|
-
typography: TypographyTokens;
|
|
10
|
-
shadows: ShadowTokens;
|
|
11
|
-
borderRadius: BorderRadiusTokens;
|
|
12
|
-
animations: AnimationTokens;
|
|
13
|
-
}
|
|
14
|
-
export interface ColorTokens {
|
|
15
|
-
primary: string[];
|
|
16
|
-
secondary: string[];
|
|
17
|
-
accent: string[];
|
|
18
|
-
neutral: string[];
|
|
19
|
-
success: string[];
|
|
20
|
-
warning: string[];
|
|
21
|
-
error: string[];
|
|
22
|
-
}
|
|
23
|
-
export interface SpacingTokens {
|
|
24
|
-
xs: string;
|
|
25
|
-
sm: string;
|
|
26
|
-
md: string;
|
|
27
|
-
lg: string;
|
|
28
|
-
xl: string;
|
|
29
|
-
"2xl": string;
|
|
30
|
-
"3xl": string;
|
|
31
|
-
}
|
|
32
|
-
export interface TypographyTokens {
|
|
33
|
-
fontFamily: string[];
|
|
34
|
-
fontSize: string[];
|
|
35
|
-
fontWeight: string[];
|
|
36
|
-
lineHeight: string[];
|
|
37
|
-
}
|
|
38
|
-
export interface ShadowTokens {
|
|
39
|
-
sm: string;
|
|
40
|
-
md: string;
|
|
41
|
-
lg: string;
|
|
42
|
-
xl: string;
|
|
43
|
-
}
|
|
44
|
-
export interface BorderRadiusTokens {
|
|
45
|
-
sm: string;
|
|
46
|
-
md: string;
|
|
47
|
-
lg: string;
|
|
48
|
-
xl: string;
|
|
49
|
-
full: string;
|
|
50
|
-
}
|
|
51
|
-
export interface AnimationTokens {
|
|
52
|
-
duration: string[];
|
|
53
|
-
easing: string[];
|
|
54
|
-
properties: string[];
|
|
55
|
-
}
|
|
56
|
-
export declare class DesignTokenExtractor {
|
|
57
|
-
/**
|
|
58
|
-
* Extract design tokens from component code
|
|
59
|
-
*/
|
|
60
|
-
extractTokens(componentCode: string): Promise<DesignTokens>;
|
|
61
|
-
/**
|
|
62
|
-
* Extract color tokens from Tailwind classes
|
|
63
|
-
*/
|
|
64
|
-
private extractColors;
|
|
65
|
-
/**
|
|
66
|
-
* Extract spacing tokens
|
|
67
|
-
*/
|
|
68
|
-
private extractSpacing;
|
|
69
|
-
/**
|
|
70
|
-
* Extract typography tokens
|
|
71
|
-
*/
|
|
72
|
-
private extractTypography;
|
|
73
|
-
/**
|
|
74
|
-
* Extract shadow tokens
|
|
75
|
-
*/
|
|
76
|
-
private extractShadows;
|
|
77
|
-
/**
|
|
78
|
-
* Extract border radius tokens
|
|
79
|
-
*/
|
|
80
|
-
private extractBorderRadius;
|
|
81
|
-
/**
|
|
82
|
-
* Extract animation tokens
|
|
83
|
-
*/
|
|
84
|
-
private extractAnimations;
|
|
85
|
-
/**
|
|
86
|
-
* Map Tailwind color names to hex values
|
|
87
|
-
*/
|
|
88
|
-
private mapTailwindToHex;
|
|
89
|
-
/**
|
|
90
|
-
* Generate CSS custom properties from design tokens
|
|
91
|
-
*/
|
|
92
|
-
generateCSSVariables(tokens: DesignTokens): string;
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=designTokenExtractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"designTokenExtractor.d.ts","sourceRoot":"","sources":["../../../../src/utils/designTokenExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CA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Aa;IAsCrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAkBtB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAc3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA4DxB;;OAEG;IACH,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;CAsCnD"}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Design Token Extractor
|
|
4
|
-
*
|
|
5
|
-
* Extracts design tokens from React component code including colors, spacing, typography, shadows, and animations.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.DesignTokenExtractor = void 0;
|
|
9
|
-
class DesignTokenExtractor {
|
|
10
|
-
/**
|
|
11
|
-
* Extract design tokens from component code
|
|
12
|
-
*/
|
|
13
|
-
async extractTokens(componentCode) {
|
|
14
|
-
return {
|
|
15
|
-
colors: this.extractColors(componentCode),
|
|
16
|
-
spacing: this.extractSpacing(componentCode),
|
|
17
|
-
typography: this.extractTypography(componentCode),
|
|
18
|
-
shadows: this.extractShadows(componentCode),
|
|
19
|
-
borderRadius: this.extractBorderRadius(componentCode),
|
|
20
|
-
animations: this.extractAnimations(componentCode),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Extract color tokens from Tailwind classes
|
|
25
|
-
*/
|
|
26
|
-
extractColors(componentCode) {
|
|
27
|
-
const colorPatterns = {
|
|
28
|
-
primary: /(?:bg-|text-|border-)(primary|blue-\d+|indigo-\d+|purple-\d+)/g,
|
|
29
|
-
secondary: /(?:bg-|text-|border-)(secondary|gray-\d+|slate-\d+)/g,
|
|
30
|
-
accent: /(?:bg-|text-|border-)(accent|emerald-\d+|teal-\d+|cyan-\d+)/g,
|
|
31
|
-
neutral: /(?:bg-|text-|border-)(neutral|zinc-\d+|stone-\d+)/g,
|
|
32
|
-
success: /(?:bg-|text-|border-)(success|green-\d+|emerald-\d+)/g,
|
|
33
|
-
warning: /(?:bg-|text-|border-)(warning|yellow-\d+|amber-\d+|orange-\d+)/g,
|
|
34
|
-
error: /(?:bg-|text-|border-)(error|red-\d+|rose-\d+)/g,
|
|
35
|
-
};
|
|
36
|
-
const colors = {
|
|
37
|
-
primary: [],
|
|
38
|
-
secondary: [],
|
|
39
|
-
accent: [],
|
|
40
|
-
neutral: [],
|
|
41
|
-
success: [],
|
|
42
|
-
warning: [],
|
|
43
|
-
error: [],
|
|
44
|
-
};
|
|
45
|
-
Object.entries(colorPatterns).forEach(([category, pattern]) => {
|
|
46
|
-
const matches = componentCode.match(pattern) || [];
|
|
47
|
-
const uniqueColors = [
|
|
48
|
-
...new Set(matches.map((match) => {
|
|
49
|
-
const color = match.split("-").slice(1).join("-");
|
|
50
|
-
return this.mapTailwindToHex(color);
|
|
51
|
-
})),
|
|
52
|
-
];
|
|
53
|
-
colors[category] = uniqueColors;
|
|
54
|
-
});
|
|
55
|
-
return colors;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Extract spacing tokens
|
|
59
|
-
*/
|
|
60
|
-
extractSpacing(componentCode) {
|
|
61
|
-
const spacingPattern = /(?:p-|m-|gap-|space-)(xs|sm|md|lg|xl|2xl|3xl)/g;
|
|
62
|
-
const matches = componentCode.match(spacingPattern) || [];
|
|
63
|
-
const uniqueSpacings = [
|
|
64
|
-
...new Set(matches.map((match) => match.split("-")[1])),
|
|
65
|
-
];
|
|
66
|
-
return {
|
|
67
|
-
xs: uniqueSpacings.includes("xs") ? "0.25rem" : "0.25rem",
|
|
68
|
-
sm: uniqueSpacings.includes("sm") ? "0.5rem" : "0.5rem",
|
|
69
|
-
md: uniqueSpacings.includes("md") ? "1rem" : "1rem",
|
|
70
|
-
lg: uniqueSpacings.includes("lg") ? "1.5rem" : "1.5rem",
|
|
71
|
-
xl: uniqueSpacings.includes("xl") ? "2rem" : "2rem",
|
|
72
|
-
"2xl": uniqueSpacings.includes("2xl") ? "3rem" : "3rem",
|
|
73
|
-
"3xl": uniqueSpacings.includes("3xl") ? "4rem" : "4rem",
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Extract typography tokens
|
|
78
|
-
*/
|
|
79
|
-
extractTypography(componentCode) {
|
|
80
|
-
const fontFamilyPattern = /font-(sans|serif|mono)/g;
|
|
81
|
-
const fontSizePattern = /text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)/g;
|
|
82
|
-
const fontWeightPattern = /font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)/g;
|
|
83
|
-
const lineHeightPattern = /leading-(none|tight|snug|normal|relaxed|loose)/g;
|
|
84
|
-
return {
|
|
85
|
-
fontFamily: [...new Set(componentCode.match(fontFamilyPattern) || [])],
|
|
86
|
-
fontSize: [...new Set(componentCode.match(fontSizePattern) || [])],
|
|
87
|
-
fontWeight: [...new Set(componentCode.match(fontWeightPattern) || [])],
|
|
88
|
-
lineHeight: [...new Set(componentCode.match(lineHeightPattern) || [])],
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Extract shadow tokens
|
|
93
|
-
*/
|
|
94
|
-
extractShadows(componentCode) {
|
|
95
|
-
const shadowPattern = /shadow-(sm|md|lg|xl|2xl)/g;
|
|
96
|
-
const matches = componentCode.match(shadowPattern) || [];
|
|
97
|
-
const shadowMatches = matches.map((match) => match.split("-")[1]);
|
|
98
|
-
return {
|
|
99
|
-
sm: shadowMatches.includes("sm")
|
|
100
|
-
? "0 1px 2px 0 rgb(0 0 0 / 0.05)"
|
|
101
|
-
: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
102
|
-
md: shadowMatches.includes("md")
|
|
103
|
-
? "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
|
|
104
|
-
: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
105
|
-
lg: shadowMatches.includes("lg")
|
|
106
|
-
? "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)"
|
|
107
|
-
: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
108
|
-
xl: shadowMatches.includes("xl")
|
|
109
|
-
? "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"
|
|
110
|
-
: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Extract border radius tokens
|
|
115
|
-
*/
|
|
116
|
-
extractBorderRadius(componentCode) {
|
|
117
|
-
const borderRadiusPattern = /rounded-(sm|md|lg|xl|2xl|3xl|full)/g;
|
|
118
|
-
const matches = componentCode.match(borderRadiusPattern) || [];
|
|
119
|
-
const radiusMatches = matches.map((match) => match.split("-")[1]);
|
|
120
|
-
return {
|
|
121
|
-
sm: radiusMatches.includes("sm") ? "0.125rem" : "0.125rem",
|
|
122
|
-
md: radiusMatches.includes("md") ? "0.375rem" : "0.375rem",
|
|
123
|
-
lg: radiusMatches.includes("lg") ? "0.5rem" : "0.5rem",
|
|
124
|
-
xl: radiusMatches.includes("xl") ? "0.75rem" : "0.75rem",
|
|
125
|
-
full: radiusMatches.includes("full") ? "9999px" : "9999px",
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Extract animation tokens
|
|
130
|
-
*/
|
|
131
|
-
extractAnimations(componentCode) {
|
|
132
|
-
const durationPattern = /duration-(\d+)/g;
|
|
133
|
-
const easingPattern = /ease-(linear|in|out|in-out)/g;
|
|
134
|
-
const animationPattern = /animate-(pulse|bounce|spin|ping|pulse|bounce|spin|ping|wiggle|shake|fade-in|fade-out|slide-in|slide-out)/g;
|
|
135
|
-
return {
|
|
136
|
-
duration: [...new Set(componentCode.match(durationPattern) || [])],
|
|
137
|
-
easing: [...new Set(componentCode.match(easingPattern) || [])],
|
|
138
|
-
properties: [...new Set(componentCode.match(animationPattern) || [])],
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Map Tailwind color names to hex values
|
|
143
|
-
*/
|
|
144
|
-
mapTailwindToHex(colorName) {
|
|
145
|
-
const colorMap = {
|
|
146
|
-
// Primary colors
|
|
147
|
-
primary: "#3b82f6",
|
|
148
|
-
"blue-500": "#3b82f6",
|
|
149
|
-
"blue-600": "#2563eb",
|
|
150
|
-
"blue-700": "#1d4ed8",
|
|
151
|
-
"indigo-500": "#6366f1",
|
|
152
|
-
"indigo-600": "#4f46e5",
|
|
153
|
-
"purple-500": "#8b5cf6",
|
|
154
|
-
"purple-600": "#7c3aed",
|
|
155
|
-
// Secondary colors
|
|
156
|
-
secondary: "#6b7280",
|
|
157
|
-
"gray-500": "#6b7280",
|
|
158
|
-
"gray-600": "#4b5563",
|
|
159
|
-
"slate-500": "#64748b",
|
|
160
|
-
"slate-600": "#475569",
|
|
161
|
-
// Accent colors
|
|
162
|
-
accent: "#8b5cf6",
|
|
163
|
-
"emerald-500": "#10b981",
|
|
164
|
-
"emerald-600": "#059669",
|
|
165
|
-
"teal-500": "#14b8a6",
|
|
166
|
-
"teal-600": "#0d9488",
|
|
167
|
-
"cyan-500": "#06b6d4",
|
|
168
|
-
"cyan-600": "#0891b2",
|
|
169
|
-
// Neutral colors
|
|
170
|
-
neutral: "#f3f4f6",
|
|
171
|
-
"zinc-500": "#71717a",
|
|
172
|
-
"zinc-600": "#52525b",
|
|
173
|
-
"stone-500": "#78716c",
|
|
174
|
-
"stone-600": "#57534e",
|
|
175
|
-
// Success colors
|
|
176
|
-
success: "#10b981",
|
|
177
|
-
"green-500": "#22c55e",
|
|
178
|
-
"green-600": "#16a34a",
|
|
179
|
-
// Warning colors
|
|
180
|
-
warning: "#f59e0b",
|
|
181
|
-
"yellow-500": "#eab308",
|
|
182
|
-
"yellow-600": "#ca8a04",
|
|
183
|
-
"amber-500": "#f59e0b",
|
|
184
|
-
"amber-600": "#d97706",
|
|
185
|
-
"orange-500": "#f97316",
|
|
186
|
-
"orange-600": "#ea580c",
|
|
187
|
-
// Error colors
|
|
188
|
-
error: "#ef4444",
|
|
189
|
-
"red-500": "#ef4444",
|
|
190
|
-
"red-600": "#dc2626",
|
|
191
|
-
"rose-500": "#f43f5e",
|
|
192
|
-
"rose-600": "#e11d48",
|
|
193
|
-
};
|
|
194
|
-
return colorMap[colorName] || "#000000";
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Generate CSS custom properties from design tokens
|
|
198
|
-
*/
|
|
199
|
-
generateCSSVariables(tokens) {
|
|
200
|
-
let css = ":root {\n";
|
|
201
|
-
// Colors
|
|
202
|
-
Object.entries(tokens.colors).forEach(([category, colors]) => {
|
|
203
|
-
colors.forEach((color, index) => {
|
|
204
|
-
css += ` --color-${category}-${index + 1}: ${color};\n`;
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
// Spacing
|
|
208
|
-
Object.entries(tokens.spacing).forEach(([size, value]) => {
|
|
209
|
-
css += ` --spacing-${size}: ${value};\n`;
|
|
210
|
-
});
|
|
211
|
-
// Typography
|
|
212
|
-
if (tokens.typography.fontFamily.length > 0) {
|
|
213
|
-
css += ` --font-family: ${tokens.typography.fontFamily.join(", ")};\n`;
|
|
214
|
-
}
|
|
215
|
-
if (tokens.typography.fontSize.length > 0) {
|
|
216
|
-
css += ` --font-size-base: ${tokens.typography.fontSize.includes("text-base") ? "1rem" : "1rem"};\n`;
|
|
217
|
-
}
|
|
218
|
-
// Shadows
|
|
219
|
-
Object.entries(tokens.shadows).forEach(([size, value]) => {
|
|
220
|
-
css += ` --shadow-${size}: ${value};\n`;
|
|
221
|
-
});
|
|
222
|
-
// Border radius
|
|
223
|
-
Object.entries(tokens.borderRadius).forEach(([size, value]) => {
|
|
224
|
-
css += ` --radius-${size}: ${value};\n`;
|
|
225
|
-
});
|
|
226
|
-
css += "}\n";
|
|
227
|
-
return css;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
exports.DesignTokenExtractor = DesignTokenExtractor;
|
|
231
|
-
//# sourceMappingURL=designTokenExtractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"designTokenExtractor.js","sourceRoot":"","sources":["../../../../src/utils/designTokenExtractor.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA2DH,MAAa,oBAAoB;IAC/B;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,aAAqB;QACvC,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;YACzC,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC;YAC3C,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC;YACjD,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC;YAC3C,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC;YACrD,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC;SAClD,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,aAAqB;QACzC,MAAM,aAAa,GAAG;YACpB,OAAO,EAAE,gEAAgE;YACzE,SAAS,EAAE,sDAAsD;YACjE,MAAM,EAAE,8DAA8D;YACtE,OAAO,EAAE,oDAAoD;YAC7D,OAAO,EAAE,uDAAuD;YAChE,OAAO,EACL,iEAAiE;YACnE,KAAK,EAAE,gDAAgD;SACxD,CAAC;QAEF,MAAM,MAAM,GAAgB;YAC1B,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE;YACb,MAA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EH,GAAG,IAAI,KAAK,CAAC;QACb,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAjQD,oDAiQC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comprehensive Error Handling System for MyContext CLI
|
|
3
|
-
*
|
|
4
|
-
* Provides structured error handling, logging, and recovery mechanisms
|
|
5
|
-
* for AI providers, API calls, and CLI operations.
|
|
6
|
-
*/
|
|
7
|
-
export declare enum ErrorType {
|
|
8
|
-
API_ERROR = "API_ERROR",
|
|
9
|
-
NETWORK_ERROR = "NETWORK_ERROR",
|
|
10
|
-
AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
|
|
11
|
-
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
12
|
-
FILE_SYSTEM_ERROR = "FILE_SYSTEM_ERROR",
|
|
13
|
-
CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
|
|
14
|
-
AI_PROVIDER_ERROR = "AI_PROVIDER_ERROR",
|
|
15
|
-
RATE_LIMIT_ERROR = "RATE_LIMIT_ERROR",
|
|
16
|
-
TIMEOUT_ERROR = "TIMEOUT_ERROR",
|
|
17
|
-
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
18
|
-
}
|
|
19
|
-
export declare enum ErrorSeverity {
|
|
20
|
-
LOW = "LOW",
|
|
21
|
-
MEDIUM = "MEDIUM",
|
|
22
|
-
HIGH = "HIGH",
|
|
23
|
-
CRITICAL = "CRITICAL"
|
|
24
|
-
}
|
|
25
|
-
export interface StructuredError {
|
|
26
|
-
type: ErrorType;
|
|
27
|
-
severity: ErrorSeverity;
|
|
28
|
-
message: string;
|
|
29
|
-
code?: string | number;
|
|
30
|
-
details?: Record<string, unknown>;
|
|
31
|
-
timestamp: string;
|
|
32
|
-
source?: string;
|
|
33
|
-
retryable?: boolean;
|
|
34
|
-
retryAfter?: number;
|
|
35
|
-
suggestions?: string[];
|
|
36
|
-
}
|
|
37
|
-
export interface ErrorContext {
|
|
38
|
-
operation?: string;
|
|
39
|
-
provider?: string;
|
|
40
|
-
userId?: string;
|
|
41
|
-
requestId?: string;
|
|
42
|
-
metadata?: Record<string, unknown>;
|
|
43
|
-
}
|
|
44
|
-
export declare class MyContextError extends Error {
|
|
45
|
-
readonly type: ErrorType;
|
|
46
|
-
readonly severity: ErrorSeverity;
|
|
47
|
-
readonly code?: string | number;
|
|
48
|
-
readonly details?: Record<string, unknown>;
|
|
49
|
-
readonly timestamp: string;
|
|
50
|
-
readonly source?: string;
|
|
51
|
-
readonly retryable?: boolean;
|
|
52
|
-
readonly retryAfter?: number;
|
|
53
|
-
readonly suggestions?: string[];
|
|
54
|
-
constructor(structuredError: StructuredError);
|
|
55
|
-
toJSON(): StructuredError;
|
|
56
|
-
}
|
|
57
|
-
export declare class ErrorHandler {
|
|
58
|
-
private static instance;
|
|
59
|
-
private errorLog;
|
|
60
|
-
private maxLogSize;
|
|
61
|
-
private constructor();
|
|
62
|
-
static getInstance(): ErrorHandler;
|
|
63
|
-
/**
|
|
64
|
-
* Create a structured error from various input types
|
|
65
|
-
*/
|
|
66
|
-
createError(error: unknown, context?: ErrorContext, defaultType?: ErrorType): MyContextError;
|
|
67
|
-
/**
|
|
68
|
-
* Handle AI provider specific errors
|
|
69
|
-
*/
|
|
70
|
-
handleAIProviderError(error: unknown, provider: string, operation: string, requestData?: Record<string, unknown>): MyContextError;
|
|
71
|
-
/**
|
|
72
|
-
* Handle network and connectivity errors
|
|
73
|
-
*/
|
|
74
|
-
handleNetworkError(error: unknown, context?: ErrorContext): MyContextError;
|
|
75
|
-
/**
|
|
76
|
-
* Handle file system errors
|
|
77
|
-
*/
|
|
78
|
-
handleFileSystemError(error: unknown, filePath?: string): MyContextError;
|
|
79
|
-
/**
|
|
80
|
-
* Log error for debugging and monitoring
|
|
81
|
-
*/
|
|
82
|
-
private logError;
|
|
83
|
-
/**
|
|
84
|
-
* Get recent errors for debugging
|
|
85
|
-
*/
|
|
86
|
-
getRecentErrors(count?: number): StructuredError[];
|
|
87
|
-
/**
|
|
88
|
-
* Clear error log
|
|
89
|
-
*/
|
|
90
|
-
clearErrors(): void;
|
|
91
|
-
/**
|
|
92
|
-
* Handle standard JavaScript errors
|
|
93
|
-
*/
|
|
94
|
-
private handleStandardError;
|
|
95
|
-
/**
|
|
96
|
-
* Handle object-type errors (API responses, etc.)
|
|
97
|
-
*/
|
|
98
|
-
private handleObjectError;
|
|
99
|
-
}
|
|
100
|
-
export declare const errorHandler: ErrorHandler;
|
|
101
|
-
export declare const createAIProviderError: (error: unknown, provider: string, operation: string) => MyContextError;
|
|
102
|
-
export declare const createNetworkError: (error: unknown, context?: ErrorContext) => MyContextError;
|
|
103
|
-
export declare const createFileSystemError: (error: unknown, filePath?: string) => MyContextError;
|
|
104
|
-
export declare const createError: (error: unknown, context?: ErrorContext, type?: ErrorType) => MyContextError;
|
|
105
|
-
//# sourceMappingURL=errorHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../../../src/utils/errorHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,oBAAY,SAAS;IACnB,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;CAChC;AAED,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MA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