framework-aidf 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +174 -0
- package/INSTALLATION.md +140 -0
- package/LICENSE +21 -0
- package/QODER.md +88 -0
- package/README.md +142 -2
- package/UTILISATION.md +188 -0
- package/assets/adapters/qoder/agents/aidf-orchestrator.md +30 -0
- package/assets/adapters/qoder/rules/00-core.md +28 -0
- package/assets/adapters/qoder/rules/10-security.md +33 -0
- package/assets/adapters/qoder/rules/20-context.md +39 -0
- package/assets/core/AGENTS.fragment.md +18 -0
- package/assets/core/AIDF.md +107 -0
- package/assets/docs/APPFLOW.md +66 -0
- package/assets/docs/BACKEND.md +71 -0
- package/assets/docs/CHANGELOG.md +25 -0
- package/assets/docs/CONVENTIONS.md +95 -0
- package/assets/docs/DECISIONS.md +60 -0
- package/assets/docs/PLAN.md +53 -0
- package/assets/docs/PRD.md +88 -0
- package/assets/docs/SECURITY.md +94 -0
- package/assets/docs/TRD.md +78 -0
- package/assets/docs/UI-UX.md +71 -0
- package/assets/docs/constitution.md +86 -0
- package/assets/hooks/audit.mjs +45 -0
- package/assets/hooks/session-context.mjs +53 -0
- package/assets/integrations/spec-kit/mapping.yaml +92 -0
- package/assets/knowledge/best-practices/testing.md +53 -0
- package/assets/knowledge/best-practices/web-dev-baseline.md +39 -0
- package/assets/knowledge/rules/api.md +45 -0
- package/assets/knowledge/rules/sql.md +44 -0
- package/assets/knowledge/rules/typescript.md +50 -0
- package/assets/knowledge/security-references/owasp-baseline.md +58 -0
- package/assets/registry/activation-map.yaml +83 -0
- package/assets/registry/dependencies.yaml +35 -0
- package/assets/registry/skills.yaml +541 -0
- package/assets/registry/sources.yaml +396 -0
- package/assets/schemas/architecture/v1.json +110 -0
- package/assets/schemas/constraints/v1.json +93 -0
- package/assets/schemas/decision/v1.json +106 -0
- package/assets/schemas/discovery/v1.json +91 -0
- package/assets/schemas/requirement/v1.json +136 -0
- package/assets/schemas/security/threat-model/v1.json +127 -0
- package/assets/schemas/test-plan/v1.json +108 -0
- package/assets/skills/aidf-architecture-review/SKILL.md +49 -0
- package/assets/skills/aidf-backend-implementation/SKILL.md +47 -0
- package/assets/skills/aidf-database-design/SKILL.md +48 -0
- package/assets/skills/aidf-devops-engineering/SKILL.md +41 -0
- package/assets/skills/aidf-documentation-maintenance/SKILL.md +41 -0
- package/assets/skills/aidf-frontend-implementation/SKILL.md +44 -0
- package/assets/skills/aidf-phase-transition/SKILL.md +48 -0
- package/assets/skills/aidf-product-analysis/SKILL.md +47 -0
- package/assets/skills/aidf-project-context/SKILL.md +57 -0
- package/assets/skills/aidf-requirements-engineering/SKILL.md +52 -0
- package/assets/skills/aidf-security-review/SKILL.md +57 -0
- package/assets/skills/aidf-testing-validation/SKILL.md +48 -0
- package/assets/skills/aidf-ui-ux-implementation/SKILL.md +43 -0
- package/assets/workflows/gates.yaml +232 -0
- package/assets/workflows/phases.yaml +161 -0
- package/bin/aidf.mjs +12 -0
- package/demo/run-demo.mjs +97 -0
- package/docs/aidf/ADR-001-artefacts-architectur.md +126 -0
- package/docs/aidf/ADR-002-requirements-registry.md +145 -0
- package/docs/aidf/ADR-003-traceability-chain.md +145 -0
- package/docs/aidf/ADR-004-markdown-generation.md +134 -0
- package/docs/aidf/ADR-005-validation-and-tests.md +170 -0
- package/docs/aidf/ADR-006-cli-commands.md +189 -0
- package/docs/aidf/ADR-007-compatibility-and-migration.md +119 -0
- package/docs/aidf/ADR-008-schema-versioning.md +115 -0
- package/docs/aidf/ADR-009-artefacts-scope.md +84 -0
- package/docs/aidf/ARCHITECTURE.md +137 -0
- package/docs/aidf/COMPATIBILITY.md +90 -0
- package/docs/aidf/DECISIONS.md +200 -0
- package/docs/aidf/FRAMEWORK.md +38 -0
- package/docs/aidf/IDE-QODER.md +61 -0
- package/docs/aidf/INSTALL.md +99 -0
- package/docs/aidf/INVENTORY.md +72 -0
- package/docs/aidf/L1-ARCHITECTURE-RAPPORT.md +353 -0
- package/docs/aidf/LIMITATIONS.md +69 -0
- package/docs/aidf/MATRICE-0.1.0-vers-0.2.0.md +155 -0
- package/docs/aidf/SECURITY.md +86 -0
- package/docs/aidf/SKILLS.md +78 -0
- package/docs/aidf/SPECKIT.md +67 -0
- package/docs/aidf/USAGE.md +113 -0
- package/docs/aidf/VALIDATION.md +55 -0
- package/package.json +37 -4
- package/src/cli.mjs +148 -0
- package/src/commands/artefacts.mjs +129 -0
- package/src/commands/config.mjs +130 -0
- package/src/commands/context.mjs +55 -0
- package/src/commands/decision.mjs +142 -0
- package/src/commands/design.mjs +141 -0
- package/src/commands/docs.mjs +133 -0
- package/src/commands/doctor.mjs +210 -0
- package/src/commands/evidence.mjs +178 -0
- package/src/commands/install.mjs +154 -0
- package/src/commands/release.mjs +214 -0
- package/src/commands/requirements.mjs +196 -0
- package/src/commands/resources.mjs +181 -0
- package/src/commands/scan.mjs +139 -0
- package/src/commands/security.mjs +97 -0
- package/src/commands/setup.mjs +68 -0
- package/src/commands/skills.mjs +204 -0
- package/src/commands/speckit.mjs +78 -0
- package/src/commands/tests.mjs +81 -0
- package/src/commands/traceability.mjs +116 -0
- package/src/commands/uninstall.mjs +238 -0
- package/src/commands/validate.mjs +84 -0
- package/src/commands/workflow.mjs +137 -0
- package/src/core/adapters/base.mjs +32 -0
- package/src/core/adapters/generic.mjs +70 -0
- package/src/core/adapters/index.mjs +24 -0
- package/src/core/adapters/opencode.mjs +115 -0
- package/src/core/adapters/qoder.mjs +228 -0
- package/src/core/artefacts/index.mjs +1 -0
- package/src/core/artefacts/validation.mjs +161 -0
- package/src/core/bootstrap.mjs +179 -0
- package/src/core/config.mjs +123 -0
- package/src/core/context.mjs +187 -0
- package/src/core/design-engineering/complexity-classifier.mjs +78 -0
- package/src/core/design-engineering/engine.mjs +197 -0
- package/src/core/design-engineering/fallback/mockups.mjs +221 -0
- package/src/core/design-engineering/fallback/wireframes.mjs +114 -0
- package/src/core/design-engineering/figma/validators.mjs +178 -0
- package/src/core/design-engineering/index.mjs +9 -0
- package/src/core/design-engineering/visual-parity/capture.mjs +172 -0
- package/src/core/detect.mjs +220 -0
- package/src/core/docsgen.mjs +175 -0
- package/src/core/evidence.mjs +210 -0
- package/src/core/installer.mjs +377 -0
- package/src/core/manifest.mjs +53 -0
- package/src/core/paths.mjs +94 -0
- package/src/core/requirements/index.mjs +13 -0
- package/src/core/requirements/registry.mjs +234 -0
- package/src/core/resource-inventory.mjs +434 -0
- package/src/core/resources.mjs +280 -0
- package/src/core/security/threat-model.mjs +235 -0
- package/src/core/skills.mjs +353 -0
- package/src/core/source-skills.mjs +213 -0
- package/src/core/speckit.mjs +195 -0
- package/src/core/technology-decision/analyzer-deterministic.mjs +240 -0
- package/src/core/technology-decision/engine.mjs +157 -0
- package/src/core/technology-decision/generator.mjs +204 -0
- package/src/core/technology-decision/index.mjs +17 -0
- package/src/core/technology-decision/options/index.mjs +10 -0
- package/src/core/testplan.mjs +176 -0
- package/src/core/traceability/chain.mjs +488 -0
- package/src/core/traceability/index.mjs +12 -0
- package/src/core/workflow.mjs +471 -0
- package/src/util/args.mjs +69 -0
- package/src/util/frontmatter.mjs +26 -0
- package/src/util/fsx.mjs +208 -0
- package/src/util/logger.mjs +74 -0
- package/src/util/text.mjs +66 -0
- package/src/util/yaml.mjs +379 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { classifyComplexity, getWorkflow } from './complexity-classifier.mjs';
|
|
2
|
+
import { validateFigma, testConnection, verifyIdentity, checkPermissions, checkFile } from './figma/validators.mjs';
|
|
3
|
+
import { generateSVGWireframe, generateHTMLWireframe } from './fallback/wireframes.mjs';
|
|
4
|
+
import { generateCSSMockup } from './fallback/mockups.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Main orchestrator for design engineering workflow.
|
|
8
|
+
*/
|
|
9
|
+
export async function runDesignWorkflow(projectContext) {
|
|
10
|
+
// Step 1: Classify complexity
|
|
11
|
+
const complexity = classifyComplexity(projectContext);
|
|
12
|
+
|
|
13
|
+
// Step 2: Check Figma availability
|
|
14
|
+
const figmaStatus = await validateFigma(projectContext.figma);
|
|
15
|
+
|
|
16
|
+
// Step 3: Select workflow
|
|
17
|
+
const workflow = getWorkflow(complexity.complexity);
|
|
18
|
+
|
|
19
|
+
// Step 4: Execute workflow
|
|
20
|
+
let result;
|
|
21
|
+
if (figmaStatus.status === 'fully_verified') {
|
|
22
|
+
result = await runFigmaWorkflow(projectContext, workflow, figmaStatus);
|
|
23
|
+
} else {
|
|
24
|
+
result = await runFallbackWorkflow(projectContext, workflow, figmaStatus);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Step 5: Run visual parity check if enabled
|
|
28
|
+
if (projectContext.visualParity?.enabled) {
|
|
29
|
+
const parityResult = await runVisualParityCheck(projectContext);
|
|
30
|
+
result.visualParity = parityResult;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Step 6: Document everything
|
|
34
|
+
result.complexity = complexity;
|
|
35
|
+
result.workflow = workflow;
|
|
36
|
+
result.figmaStatus = figmaStatus;
|
|
37
|
+
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Run Figma-enabled workflow.
|
|
43
|
+
*/
|
|
44
|
+
async function runFigmaWorkflow(projectContext, workflow, figmaStatus) {
|
|
45
|
+
return {
|
|
46
|
+
status: 'figma_enabled',
|
|
47
|
+
figmaStatus,
|
|
48
|
+
workflow,
|
|
49
|
+
steps: getFigmaWorkflowSteps(workflow),
|
|
50
|
+
outputs: {
|
|
51
|
+
designFile: projectContext.figma.fileId
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Run fallback workflow when Figma unavailable.
|
|
58
|
+
*/
|
|
59
|
+
async function runFallbackWorkflow(projectContext, workflow, figmaStatus) {
|
|
60
|
+
const fallbackResult = {
|
|
61
|
+
status: 'fallback',
|
|
62
|
+
figmaStatus,
|
|
63
|
+
workflow,
|
|
64
|
+
reasons: getFallbackReasons(figmaStatus),
|
|
65
|
+
outputs: {}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Generate wireframes
|
|
69
|
+
if (projectContext.screens) {
|
|
70
|
+
fallbackResult.outputs.wireframes = projectContext.screens.map(screen =>
|
|
71
|
+
generateSVGWireframe(screen)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Generate mockups
|
|
76
|
+
if (projectContext.theme) {
|
|
77
|
+
fallbackResult.outputs.mockups = generateCSSMockup(projectContext.theme);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Generate documentation
|
|
81
|
+
fallbackResult.outputs.documentation = generateFallbackDocumentation(figmaStatus);
|
|
82
|
+
|
|
83
|
+
return fallbackResult;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get steps for each workflow type.
|
|
88
|
+
*/
|
|
89
|
+
function getFigmaWorkflowSteps(workflow) {
|
|
90
|
+
const steps = {
|
|
91
|
+
quick: [
|
|
92
|
+
'User journey map',
|
|
93
|
+
'Basic wireframes',
|
|
94
|
+
'Style guide',
|
|
95
|
+
'Accessibility review'
|
|
96
|
+
],
|
|
97
|
+
standard: [
|
|
98
|
+
'User personas',
|
|
99
|
+
'User flow diagrams',
|
|
100
|
+
'Wireframes',
|
|
101
|
+
'Interactive prototype',
|
|
102
|
+
'Design system (basic)',
|
|
103
|
+
'Accessibility audit'
|
|
104
|
+
],
|
|
105
|
+
extended: [
|
|
106
|
+
'UX research',
|
|
107
|
+
'User testing',
|
|
108
|
+
'High-fidelity mockups',
|
|
109
|
+
'Design system (comprehensive)',
|
|
110
|
+
'Accessibility audit',
|
|
111
|
+
'Visual regression suite'
|
|
112
|
+
]
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return steps[workflow] || steps.standard;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get reasons for fallback.
|
|
120
|
+
*/
|
|
121
|
+
function getFallbackReasons(figmaStatus) {
|
|
122
|
+
const reasons = [];
|
|
123
|
+
|
|
124
|
+
if (figmaStatus.status === 'disabled') {
|
|
125
|
+
reasons.push('Figma integration disabled');
|
|
126
|
+
}
|
|
127
|
+
if (figmaStatus.status === 'configuration_missing') {
|
|
128
|
+
reasons.push('Missing Figma configuration');
|
|
129
|
+
}
|
|
130
|
+
if (figmaStatus.status === 'connection_failed') {
|
|
131
|
+
reasons.push(`Connection failed: ${figmaStatus.error}`);
|
|
132
|
+
}
|
|
133
|
+
if (figmaStatus.status === 'permissions_failed') {
|
|
134
|
+
reasons.push(`Missing permissions: ${figmaStatus.missing?.join(', ')}`);
|
|
135
|
+
}
|
|
136
|
+
if (figmaStatus.status === 'file_failed') {
|
|
137
|
+
reasons.push(`File access failed: ${figmaStatus.error}`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return reasons;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Generate fallback documentation.
|
|
145
|
+
*/
|
|
146
|
+
function generateFallbackDocumentation(figmaStatus) {
|
|
147
|
+
let doc = `# Design Fallback Documentation\n\n`;
|
|
148
|
+
doc += `## Figma Status\n`;
|
|
149
|
+
|
|
150
|
+
switch (figmaStatus.status) {
|
|
151
|
+
case 'disabled':
|
|
152
|
+
doc += `Figma integration disabled\n`;
|
|
153
|
+
break;
|
|
154
|
+
case 'configuration_missing':
|
|
155
|
+
doc += `Missing Figma configuration\n`;
|
|
156
|
+
break;
|
|
157
|
+
case 'connection_failed':
|
|
158
|
+
doc += `Connection failed: ${figmaStatus.error}\n`;
|
|
159
|
+
break;
|
|
160
|
+
case 'permissions_failed':
|
|
161
|
+
doc += `Missing permissions: ${figmaStatus.missing?.join(', ')}\n`;
|
|
162
|
+
break;
|
|
163
|
+
case 'file_failed':
|
|
164
|
+
doc += `File access failed: ${figmaStatus.error}\n`;
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
doc += `Unknown issue\n`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
doc += `\n## Generated Outputs\n`;
|
|
171
|
+
doc += `- Wireframes: HTML/SVG format\n`;
|
|
172
|
+
doc += `- Mockups: CSS-based assets\n`;
|
|
173
|
+
doc += `- Screenshots: Implementation captures\n`;
|
|
174
|
+
|
|
175
|
+
doc += `\n## Limitations\n`;
|
|
176
|
+
doc += `- No Figma collaboration features\n`;
|
|
177
|
+
doc += `- No real-time updates\n`;
|
|
178
|
+
doc += `- Manual version control required\n`;
|
|
179
|
+
|
|
180
|
+
doc += `\n## Next Steps\n`;
|
|
181
|
+
doc += `- Review locally generated assets\n`;
|
|
182
|
+
doc += `- Make updates to HTML/SVG/CSS files\n`;
|
|
183
|
+
doc += `- Commit to version control\n`;
|
|
184
|
+
|
|
185
|
+
return doc;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Run visual parity check.
|
|
190
|
+
*/
|
|
191
|
+
async function runVisualParityCheck(projectContext) {
|
|
192
|
+
// This would integrate with the visual parity module
|
|
193
|
+
return {
|
|
194
|
+
status: 'awaiting_capture',
|
|
195
|
+
note: 'Visual parity check available when implementation is accessible'
|
|
196
|
+
};
|
|
197
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L3: Fallback Mockup Generation
|
|
3
|
+
* Generates CSS-based mockups when Figma is unavailable.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate CSS mockup based on theme configuration.
|
|
8
|
+
*/
|
|
9
|
+
export function generateCSSMockup(theme) {
|
|
10
|
+
const { colors = {}, typography = {}, components = {} } = theme;
|
|
11
|
+
|
|
12
|
+
const colorVars = Object.entries(colors).map(([name, value]) => ` --color-${name}: ${value};`).join('\n');
|
|
13
|
+
const fontVars = Object.entries(typography).map(([name, value]) => ` --font-${name}: ${value};`).join('\n');
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
type: 'css',
|
|
17
|
+
name: 'Design System - CSS Mockup',
|
|
18
|
+
css: `
|
|
19
|
+
/* Design System - CSS Mockup */
|
|
20
|
+
:root {
|
|
21
|
+
${colorVars}
|
|
22
|
+
${fontVars}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Reset */
|
|
26
|
+
* {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
body {
|
|
33
|
+
font-family: var(--font-body, sans-serif);
|
|
34
|
+
font-size: var(--font-size-base, 16px);
|
|
35
|
+
line-height: var(--font-line-height, 1.5);
|
|
36
|
+
color: var(--color-text, #333);
|
|
37
|
+
background-color: var(--color-bg, #fff);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Component: Button */
|
|
41
|
+
.btn {
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
padding: var(--spacing-sm, 12px) var(--spacing-md, 24px);
|
|
46
|
+
border-radius: var(--border-radius-sm, 4px);
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
font-size: var(--font-size-base, 14px);
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
border: none;
|
|
51
|
+
transition: all 0.2s ease;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.btn-primary {
|
|
55
|
+
background-color: var(--color-primary, #0066cc);
|
|
56
|
+
color: var(--color-primary-text, #fff);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.btn-primary:hover {
|
|
60
|
+
background-color: var(--color-primary-hover, #0052a3);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.btn-secondary {
|
|
64
|
+
background-color: var(--color-secondary, #6c757d);
|
|
65
|
+
color: var(--color-secondary-text, #fff);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.btn-secondary:hover {
|
|
69
|
+
background-color: var(--color-secondary-hover, #5a6268);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Component: Input */
|
|
73
|
+
.input {
|
|
74
|
+
display: block;
|
|
75
|
+
width: 100%;
|
|
76
|
+
padding: var(--spacing-sm, 12px);
|
|
77
|
+
border: 1px solid var(--color-border, #ddd);
|
|
78
|
+
border-radius: var(--border-radius-sm, 4px);
|
|
79
|
+
font-size: var(--font-size-base, 14px);
|
|
80
|
+
transition: border-color 0.2s;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.input:focus {
|
|
84
|
+
outline: none;
|
|
85
|
+
border-color: var(--color-primary, #0066cc);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.input::placeholder {
|
|
89
|
+
color: var(--color-placeholder, #999);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Component: Card */
|
|
93
|
+
.card {
|
|
94
|
+
background: var(--color-bg, #fff);
|
|
95
|
+
border: 1px solid var(--color-border, #ddd);
|
|
96
|
+
border-radius: var(--border-radius-md, 8px);
|
|
97
|
+
padding: var(--spacing-md, 20px);
|
|
98
|
+
box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.05));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.card-header {
|
|
102
|
+
margin-bottom: var(--spacing-sm, 12px);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.card-title {
|
|
106
|
+
font-size: var(--font-size-lg, 18px);
|
|
107
|
+
font-weight: 600;
|
|
108
|
+
margin-bottom: var(--spacing-xs, 4px);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.card-body {
|
|
112
|
+
font-size: var(--font-size-base, 14px);
|
|
113
|
+
color: var(--color-text-secondary, #666);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Component: Navigation */
|
|
117
|
+
.nav {
|
|
118
|
+
display: flex;
|
|
119
|
+
gap: var(--spacing-sm, 16px);
|
|
120
|
+
padding: var(--spacing-md, 20px);
|
|
121
|
+
background-color: var(--color-bg, #fff);
|
|
122
|
+
border-bottom: 1px solid var(--color-border, #ddd);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.nav-item {
|
|
126
|
+
text-decoration: none;
|
|
127
|
+
color: var(--color-text, #333);
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
padding: var(--spacing-xs, 8px) var(--spacing-sm, 12px);
|
|
130
|
+
border-radius: var(--border-radius-sm, 4px);
|
|
131
|
+
transition: background-color 0.2s;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.nav-item:hover {
|
|
135
|
+
background-color: var(--color-bg-secondary, #f5f5f5);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* Component: Badge */
|
|
139
|
+
.badge {
|
|
140
|
+
display: inline-flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
padding: 2px 8px;
|
|
143
|
+
border-radius: var(--border-radius-pill, 12px);
|
|
144
|
+
font-size: 12px;
|
|
145
|
+
font-weight: 500;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.badge-primary {
|
|
149
|
+
background-color: var(--color-primary, #0066cc);
|
|
150
|
+
color: var(--color-primary-text, #fff);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.badge-success {
|
|
154
|
+
background-color: var(--color-success, #28a745);
|
|
155
|
+
color: var(--color-success-text, #fff);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.badge-warning {
|
|
159
|
+
background-color: var(--color-warning, #ffc107);
|
|
160
|
+
color: var(--color-warning-text, #333);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.badge-danger {
|
|
164
|
+
background-color: var(--color-danger, #dc3545);
|
|
165
|
+
color: var(--color-danger-text, #fff);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Utilities */
|
|
169
|
+
.text-center { text-align: center; }
|
|
170
|
+
.text-right { text-align: right; }
|
|
171
|
+
.mt-sm { margin-top: var(--spacing-xs, 8px); }
|
|
172
|
+
.mt-md { margin-top: var(--spacing-sm, 12px); }
|
|
173
|
+
.mt-lg { margin-top: var(--spacing-md, 20px); }
|
|
174
|
+
.mt-xl { margin-top: var(--spacing-lg, 32px); }
|
|
175
|
+
.py-sm { padding-top: var(--spacing-xs, 8px); padding-bottom: var(--spacing-xs, 8px); }
|
|
176
|
+
.py-md { padding-top: var(--spacing-sm, 12px); padding-bottom: var(--spacing-sm, 12px); }
|
|
177
|
+
.py-lg { padding-top: var(--spacing-md, 20px); padding-bottom: var(--spacing-md, 20px); }
|
|
178
|
+
.py-xl { padding-top: var(--spacing-lg, 32px); padding-bottom: var(--spacing-lg, 32px); }
|
|
179
|
+
|
|
180
|
+
/* Responsive */
|
|
181
|
+
@media (max-width: 768px) {
|
|
182
|
+
.nav {
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
gap: var(--spacing-xs, 8px);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
`.trim(),
|
|
188
|
+
timestamp: new Date().toISOString()
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Generate responsive CSS with media queries.
|
|
194
|
+
*/
|
|
195
|
+
export function generateResponsiveCSS(baseCSS, breakpoints = {
|
|
196
|
+
mobile: 375,
|
|
197
|
+
tablet: 768,
|
|
198
|
+
desktop: 1024,
|
|
199
|
+
large: 1440
|
|
200
|
+
}) {
|
|
201
|
+
return `
|
|
202
|
+
${baseCSS}
|
|
203
|
+
|
|
204
|
+
/* Responsive Utilities */
|
|
205
|
+
@media (max-width: ${breakpoints.mobile}px) {
|
|
206
|
+
.container { padding: 0 var(--spacing-sm, 16px); }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@media (min-width: ${breakpoints.tablet}px) {
|
|
210
|
+
.container { max-width: ${breakpoints.tablet}px; }
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@media (min-width: ${breakpoints.desktop}px) {
|
|
214
|
+
.container { max-width: ${breakpoints.desktop}px; }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@media (min-width: ${breakpoints.large}px) {
|
|
218
|
+
.container { max-width: ${breakpoints.large}px; }
|
|
219
|
+
}
|
|
220
|
+
`.trim();
|
|
221
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L3: Fallback Wireframe Generation
|
|
3
|
+
* Generates HTML/SVG wireframes when Figma is unavailable.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate SVG wireframe.
|
|
8
|
+
*/
|
|
9
|
+
export function generateSVGWireframe(screenConfig) {
|
|
10
|
+
const { width = 375, height = 667, elements = [], name = 'Untitled' } = screenConfig;
|
|
11
|
+
|
|
12
|
+
const svgElements = elements.map((el, index) => {
|
|
13
|
+
const attrs = {
|
|
14
|
+
x: el.x,
|
|
15
|
+
y: el.y,
|
|
16
|
+
width: el.width,
|
|
17
|
+
height: el.height,
|
|
18
|
+
fill: el.fill || 'none',
|
|
19
|
+
stroke: el.stroke || '#ddd',
|
|
20
|
+
'stroke-width': el.strokeWidth || 1
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
switch (el.type) {
|
|
24
|
+
case 'text':
|
|
25
|
+
return `<text x="${el.x}" y="${el.y}" font-family="sans-serif" font-size="${el.fontSize || 14}" fill="${el.color || '#333'}">${escapeXml(el.content)}</text>`;
|
|
26
|
+
case 'button':
|
|
27
|
+
return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" fill="${el.fill || 'none'}" stroke="${el.stroke || '#ddd'}" stroke-width="${el.strokeWidth || 1}" rx="4" /><text x="${el.x + el.width/2}" y="${el.y + el.height/2 + 4}" text-anchor="middle" font-size="14" fill="#333">${escapeXml(el.label)}</text>`;
|
|
28
|
+
case 'input':
|
|
29
|
+
return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" fill="${el.fill || 'none'}" stroke="${el.stroke || '#ddd'}" stroke-width="${el.strokeWidth || 1}" rx="2" /><text x="${el.x + 8}" y="${el.y + el.height/2 + 4}" font-size="12" fill="#999">${escapeXml(el.placeholder || 'Input')}</text>`;
|
|
30
|
+
case 'image':
|
|
31
|
+
return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" fill="#eee" stroke="#ddd" stroke-dasharray="4,4" /><text x="${el.x + el.width/2}" y="${el.y + el.height/2}" text-anchor="middle" font-size="10" fill="#999">[Image]</text>`;
|
|
32
|
+
case 'card':
|
|
33
|
+
return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" fill="${el.fill || 'none'}" stroke="${el.stroke || '#ddd'}" stroke-width="${el.strokeWidth || 1}" rx="4" />`;
|
|
34
|
+
default:
|
|
35
|
+
return `<rect x="${el.x}" y="${el.y}" width="${el.width}" height="${el.height}" fill="${el.fill || 'none'}" stroke="${el.stroke || '#ddd'}" stroke-width="${el.strokeWidth || 1}" />`;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
type: 'svg',
|
|
41
|
+
name,
|
|
42
|
+
width,
|
|
43
|
+
height,
|
|
44
|
+
svg: `
|
|
45
|
+
<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">
|
|
46
|
+
<!-- Wireframe: ${escapeXml(name)} -->
|
|
47
|
+
${svgElements.join('\n ')}
|
|
48
|
+
</svg>
|
|
49
|
+
`.trim(),
|
|
50
|
+
timestamp: new Date().toISOString()
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Generate HTML wireframe.
|
|
56
|
+
*/
|
|
57
|
+
export function generateHTMLWireframe(screenConfig) {
|
|
58
|
+
const { elements = [], name = 'Untitled', width = 375, height = 667 } = screenConfig;
|
|
59
|
+
|
|
60
|
+
const htmlElements = elements.map((el, index) => {
|
|
61
|
+
switch (el.type) {
|
|
62
|
+
case 'text':
|
|
63
|
+
return `<p style="font-size: ${el.fontSize || 14}px; margin: ${el.y}px 0 0 ${el.x}px;">${escapeXml(el.content)}</p>`;
|
|
64
|
+
case 'button':
|
|
65
|
+
return `<button style="position: absolute; left: ${el.x}px; top: ${el.y}px; width: ${el.width}px; height: ${el.height}px; border: 1px solid #ddd; border-radius: 4px; background: #f5f5f5;">${escapeXml(el.label)}</button>`;
|
|
66
|
+
case 'input':
|
|
67
|
+
return `<input type="text" placeholder="${escapeXml(el.placeholder || 'Input')}" style="position: absolute; left: ${el.x}px; top: ${el.y}px; width: ${el.width}px; height: ${el.height}px; border: 1px solid #ddd; border-radius: 2px; padding: 8px; box-sizing: border-box;" />`;
|
|
68
|
+
case 'image':
|
|
69
|
+
return `<div style="position: absolute; left: ${el.x}px; top: ${el.y}px; width: ${el.width}px; height: ${el.height}px; border: 1px dashed #ddd; background: #eee; display: flex; align-items: center; justify-content: center; color: #999; font-size: 10px;">[Image]</div>`;
|
|
70
|
+
case 'card':
|
|
71
|
+
return `<div style="position: absolute; left: ${el.x}px; top: ${el.y}px; width: ${el.width}px; height: ${el.height}px; border: 1px solid #ddd; background: #fff; border-radius: 8px; padding: 16px;"></div>`;
|
|
72
|
+
default:
|
|
73
|
+
return `<div style="position: absolute; left: ${el.x}px; top: ${el.y}px; width: ${el.width}px; height: ${el.height}px; border: 1px solid #ddd; background: #f9f9f9;"></div>`;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
type: 'html',
|
|
79
|
+
name,
|
|
80
|
+
html: `
|
|
81
|
+
<!DOCTYPE html>
|
|
82
|
+
<html>
|
|
83
|
+
<head>
|
|
84
|
+
<title>${escapeXml(name)}</title>
|
|
85
|
+
<style>
|
|
86
|
+
body { margin: 0; padding: 20px; font-family: sans-serif; background: #fff; }
|
|
87
|
+
.wireframe-container { position: relative; width: ${width || 375}px; height: ${height || 667}px; border: 1px solid #ddd; background: #fafafa; }
|
|
88
|
+
h1 { color: #333; margin-bottom: 20px; }
|
|
89
|
+
</style>
|
|
90
|
+
</head>
|
|
91
|
+
<body>
|
|
92
|
+
<h1>${escapeXml(name)}</h1>
|
|
93
|
+
<div class="wireframe-container">
|
|
94
|
+
${htmlElements.join('\n ')}
|
|
95
|
+
</div>
|
|
96
|
+
</body>
|
|
97
|
+
</html>
|
|
98
|
+
`.trim(),
|
|
99
|
+
timestamp: new Date().toISOString()
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Escape XML special characters.
|
|
105
|
+
*/
|
|
106
|
+
function escapeXml(str) {
|
|
107
|
+
if (!str) return '';
|
|
108
|
+
return str
|
|
109
|
+
.replace(/&/g, '&')
|
|
110
|
+
.replace(/</g, '<')
|
|
111
|
+
.replace(/>/g, '>')
|
|
112
|
+
.replace(/"/g, '"')
|
|
113
|
+
.replace(/'/g, ''');
|
|
114
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L3: Figma Validation Functions
|
|
3
|
+
* Validates Figma MCP server availability and permissions.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create Figma client instance.
|
|
8
|
+
*/
|
|
9
|
+
function createFigmaClient(figmaConfig) {
|
|
10
|
+
// This would create a real Figma API client
|
|
11
|
+
// For now, returns a mock that throws if not configured
|
|
12
|
+
if (!figmaConfig?.apiKey || !figmaConfig?.fileId) {
|
|
13
|
+
throw new Error('Figma configuration missing');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
testConnection: async () => {
|
|
18
|
+
// Test connection to Figma API
|
|
19
|
+
if (figmaConfig.apiKey === 'invalid') {
|
|
20
|
+
throw new Error('Invalid API key');
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
getMe: async () => {
|
|
24
|
+
// Get current user info
|
|
25
|
+
return {
|
|
26
|
+
id: 'user123',
|
|
27
|
+
handle: 'johndoe',
|
|
28
|
+
email: 'john@example.com',
|
|
29
|
+
permissions: {
|
|
30
|
+
read: true,
|
|
31
|
+
write: false
|
|
32
|
+
},
|
|
33
|
+
role: 'editor'
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
getFile: async (fileId) => {
|
|
37
|
+
// Get file details
|
|
38
|
+
if (fileId === 'nonexistent') {
|
|
39
|
+
throw new Error('File not found');
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
id: fileId,
|
|
43
|
+
name: 'Design File',
|
|
44
|
+
owner: 'johndoe',
|
|
45
|
+
modified_at: new Date().toISOString()
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Test Figma connection.
|
|
53
|
+
*/
|
|
54
|
+
export async function testConnection(figmaConfig) {
|
|
55
|
+
try {
|
|
56
|
+
const client = createFigmaClient(figmaConfig);
|
|
57
|
+
await client.testConnection();
|
|
58
|
+
return { status: 'connected', error: null };
|
|
59
|
+
} catch (error) {
|
|
60
|
+
return { status: 'error', error: error.message };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Verify Figma identity.
|
|
66
|
+
*/
|
|
67
|
+
export async function verifyIdentity(figmaConfig) {
|
|
68
|
+
try {
|
|
69
|
+
const client = createFigmaClient(figmaConfig);
|
|
70
|
+
const me = await client.getMe();
|
|
71
|
+
return {
|
|
72
|
+
status: 'verified',
|
|
73
|
+
identity: {
|
|
74
|
+
id: me.id,
|
|
75
|
+
handle: me.handle,
|
|
76
|
+
email: me.email
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
} catch (error) {
|
|
80
|
+
return { status: 'error', error: error.message };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Check Figma permissions.
|
|
86
|
+
*/
|
|
87
|
+
export async function checkPermissions(figmaConfig, requiredPermissions = ['read']) {
|
|
88
|
+
try {
|
|
89
|
+
const client = createFigmaClient(figmaConfig);
|
|
90
|
+
const me = await client.getMe();
|
|
91
|
+
|
|
92
|
+
const missing = requiredPermissions.filter(p => !me.permissions?.[p]);
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
status: missing.length === 0 ? 'authorized' : 'unauthorized',
|
|
96
|
+
missing
|
|
97
|
+
};
|
|
98
|
+
} catch (error) {
|
|
99
|
+
return { status: 'error', error: error.message };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Check file accessibility.
|
|
105
|
+
*/
|
|
106
|
+
export async function checkFile(figmaConfig, fileId) {
|
|
107
|
+
try {
|
|
108
|
+
const client = createFigmaClient(figmaConfig);
|
|
109
|
+
const file = await client.getFile(fileId);
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
status: 'accessible',
|
|
113
|
+
fileId,
|
|
114
|
+
name: file.name,
|
|
115
|
+
owner: file.owner,
|
|
116
|
+
lastModified: file.modified_at
|
|
117
|
+
};
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return {
|
|
120
|
+
status: 'error',
|
|
121
|
+
error: error.message,
|
|
122
|
+
fileExists: !error.message.includes('not found')
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Validate Figma configuration for use.
|
|
129
|
+
* Returns comprehensive validation result.
|
|
130
|
+
*/
|
|
131
|
+
export async function validateFigma(figmaConfig) {
|
|
132
|
+
// Check if Figma is disabled
|
|
133
|
+
if (!figmaConfig?.enabled) {
|
|
134
|
+
return { status: 'disabled' };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Check configuration
|
|
138
|
+
if (!figmaConfig.apiKey || !figmaConfig.fileId) {
|
|
139
|
+
return { status: 'configuration_missing' };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Test connection
|
|
143
|
+
const connection = await testConnection(figmaConfig);
|
|
144
|
+
if (connection.status !== 'connected') {
|
|
145
|
+
return { status: 'connection_failed', error: connection.error };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Verify identity
|
|
149
|
+
const identity = await verifyIdentity(figmaConfig);
|
|
150
|
+
if (identity.status !== 'verified') {
|
|
151
|
+
return { status: 'identity_failed', error: identity.error };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Check permissions
|
|
155
|
+
const permissions = await checkPermissions(figmaConfig, ['read']);
|
|
156
|
+
if (permissions.status !== 'authorized') {
|
|
157
|
+
return {
|
|
158
|
+
status: 'permissions_failed',
|
|
159
|
+
missing: permissions.missing
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Check file accessibility
|
|
164
|
+
const file = await checkFile(figmaConfig, figmaConfig.fileId);
|
|
165
|
+
if (file.status !== 'accessible') {
|
|
166
|
+
return {
|
|
167
|
+
status: 'file_failed',
|
|
168
|
+
error: file.error,
|
|
169
|
+
fileExists: file.fileExists
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// All checks passed
|
|
174
|
+
return {
|
|
175
|
+
status: 'fully_verified',
|
|
176
|
+
identity: identity.identity
|
|
177
|
+
};
|
|
178
|
+
}
|