glyph-ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -0
- package/bundled/overlay/overlay.js +63 -0
- package/bundled/server/context/brand-references.d.ts +7 -0
- package/bundled/server/context/brand-references.d.ts.map +1 -0
- package/bundled/server/context/brand-references.js +20 -0
- package/bundled/server/context/brand-references.js.map +1 -0
- package/bundled/server/context/design-philosophy.d.ts +6 -0
- package/bundled/server/context/design-philosophy.d.ts.map +1 -0
- package/bundled/server/context/design-philosophy.js +82 -0
- package/bundled/server/context/design-philosophy.js.map +1 -0
- package/bundled/server/context/design-system-loader.d.ts +11 -0
- package/bundled/server/context/design-system-loader.d.ts.map +1 -0
- package/bundled/server/context/design-system-loader.js +169 -0
- package/bundled/server/context/design-system-loader.js.map +1 -0
- package/bundled/server/context/design-system.d.ts +7 -0
- package/bundled/server/context/design-system.d.ts.map +1 -0
- package/bundled/server/context/design-system.js +75 -0
- package/bundled/server/context/design-system.js.map +1 -0
- package/bundled/server/context/prompt-builder.d.ts +15 -0
- package/bundled/server/context/prompt-builder.d.ts.map +1 -0
- package/bundled/server/context/prompt-builder.js +123 -0
- package/bundled/server/context/prompt-builder.js.map +1 -0
- package/bundled/server/context/token-template.d.ts +36 -0
- package/bundled/server/context/token-template.d.ts.map +1 -0
- package/bundled/server/context/token-template.js +226 -0
- package/bundled/server/context/token-template.js.map +1 -0
- package/bundled/server/data/design-systems/apple-design-system.md +474 -0
- package/bundled/server/data/design-systems/arc-design-system.md +922 -0
- package/bundled/server/data/design-systems/claude-ai-design-system.md +1443 -0
- package/bundled/server/data/design-systems/elevenlabs-design-system.md +669 -0
- package/bundled/server/data/design-systems/generating_design.md +9 -0
- package/bundled/server/data/design-systems/linear-design-system.md +607 -0
- package/bundled/server/data/design-systems/notion-design-system.md +866 -0
- package/bundled/server/data/design-systems/raycast-design-system.md +709 -0
- package/bundled/server/data/design-systems/stripe-design-system.md +592 -0
- package/bundled/server/data/design-systems/vercel-design-system.md +824 -0
- package/bundled/server/data/design.md +971 -0
- package/bundled/server/index.d.ts +2 -0
- package/bundled/server/index.d.ts.map +1 -0
- package/bundled/server/index.js +310 -0
- package/bundled/server/index.js.map +1 -0
- package/bundled/server/mcp/tools/apply-variation.d.ts +3 -0
- package/bundled/server/mcp/tools/apply-variation.d.ts.map +1 -0
- package/bundled/server/mcp/tools/apply-variation.js +43 -0
- package/bundled/server/mcp/tools/apply-variation.js.map +1 -0
- package/bundled/server/mcp/tools/generate-variations.d.ts +3 -0
- package/bundled/server/mcp/tools/generate-variations.d.ts.map +1 -0
- package/bundled/server/mcp/tools/generate-variations.js +58 -0
- package/bundled/server/mcp/tools/generate-variations.js.map +1 -0
- package/bundled/server/mcp/tools/index.d.ts +3 -0
- package/bundled/server/mcp/tools/index.d.ts.map +1 -0
- package/bundled/server/mcp/tools/index.js +11 -0
- package/bundled/server/mcp/tools/index.js.map +1 -0
- package/bundled/server/mcp/tools/scan-design-system.d.ts +3 -0
- package/bundled/server/mcp/tools/scan-design-system.d.ts.map +1 -0
- package/bundled/server/mcp/tools/scan-design-system.js +27 -0
- package/bundled/server/mcp/tools/scan-design-system.js.map +1 -0
- package/bundled/server/mcp/tools/submit-variations.d.ts +3 -0
- package/bundled/server/mcp/tools/submit-variations.d.ts.map +1 -0
- package/bundled/server/mcp/tools/submit-variations.js +50 -0
- package/bundled/server/mcp/tools/submit-variations.js.map +1 -0
- package/bundled/server/mcp-entry.d.ts +2 -0
- package/bundled/server/mcp-entry.d.ts.map +1 -0
- package/bundled/server/mcp-entry.js +56 -0
- package/bundled/server/mcp-entry.js.map +1 -0
- package/bundled/server/preview/css-resolver.d.ts +6 -0
- package/bundled/server/preview/css-resolver.d.ts.map +1 -0
- package/bundled/server/preview/css-resolver.js +57 -0
- package/bundled/server/preview/css-resolver.js.map +1 -0
- package/bundled/server/preview/html-builder.d.ts +6 -0
- package/bundled/server/preview/html-builder.d.ts.map +1 -0
- package/bundled/server/preview/html-builder.js +85 -0
- package/bundled/server/preview/html-builder.js.map +1 -0
- package/bundled/server/telemetry.d.ts +4 -0
- package/bundled/server/telemetry.d.ts.map +1 -0
- package/bundled/server/telemetry.js +71 -0
- package/bundled/server/telemetry.js.map +1 -0
- package/bundled/server/types.d.ts +69 -0
- package/bundled/server/types.d.ts.map +1 -0
- package/bundled/server/types.js +2 -0
- package/bundled/server/types.js.map +1 -0
- package/bundled/server/variations/file-writer.d.ts +5 -0
- package/bundled/server/variations/file-writer.d.ts.map +1 -0
- package/bundled/server/variations/file-writer.js +29 -0
- package/bundled/server/variations/file-writer.js.map +1 -0
- package/bundled/server/variations/git-utils.d.ts +3 -0
- package/bundled/server/variations/git-utils.d.ts.map +1 -0
- package/bundled/server/variations/git-utils.js +23 -0
- package/bundled/server/variations/git-utils.js.map +1 -0
- package/bundled/server/variations/store.d.ts +11 -0
- package/bundled/server/variations/store.d.ts.map +1 -0
- package/bundled/server/variations/store.js +52 -0
- package/bundled/server/variations/store.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +299 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/stop.d.ts +2 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +32 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getAvailableBrands } from './design-system-loader.js';
|
|
2
|
+
export { getAvailableBrands };
|
|
3
|
+
export declare function getBrandReference(brand: string): Promise<string>;
|
|
4
|
+
export declare function getBrandBoilerplates(brand: string): Promise<Map<string, string> | null>;
|
|
5
|
+
export declare function getBrandFullData(brand: string): Promise<import("./design-system-loader.js").BrandDesignSystem | null>;
|
|
6
|
+
export declare function isValidBrand(brand: string): boolean;
|
|
7
|
+
//# sourceMappingURL=brand-references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-references.d.ts","sourceRoot":"","sources":["../../src/context/brand-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAG7F;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,yEAEnD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { loadBrandDesignSystem, getAvailableBrands } from './design-system-loader.js';
|
|
2
|
+
export { getAvailableBrands };
|
|
3
|
+
export async function getBrandReference(brand) {
|
|
4
|
+
const data = await loadBrandDesignSystem(brand.toLowerCase());
|
|
5
|
+
if (!data) {
|
|
6
|
+
return `No detailed reference available for "${brand}". Use a clean, modern aesthetic with sensible defaults.`;
|
|
7
|
+
}
|
|
8
|
+
return data.designSystem;
|
|
9
|
+
}
|
|
10
|
+
export async function getBrandBoilerplates(brand) {
|
|
11
|
+
const data = await loadBrandDesignSystem(brand.toLowerCase());
|
|
12
|
+
return data?.sectionBoilerplates ?? null;
|
|
13
|
+
}
|
|
14
|
+
export async function getBrandFullData(brand) {
|
|
15
|
+
return loadBrandDesignSystem(brand.toLowerCase());
|
|
16
|
+
}
|
|
17
|
+
export function isValidBrand(brand) {
|
|
18
|
+
return getAvailableBrands().includes(brand.toLowerCase());
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=brand-references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand-references.js","sourceRoot":"","sources":["../../src/context/brand-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAAa;IACnD,MAAM,IAAI,GAAG,MAAM,qBAAqB,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,wCAAwC,KAAK,0DAA0D,CAAC;IACjH,CAAC;IACD,OAAO,IAAI,CAAC,YAAY,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAa;IACtD,MAAM,IAAI,GAAG,MAAM,qBAAqB,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9D,OAAO,IAAI,EAAE,mBAAmB,IAAI,IAAI,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAa;IAClD,OAAO,qBAAqB,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,kBAAkB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-philosophy.d.ts","sourceRoot":"","sources":["../../src/context/design-philosophy.ts"],"names":[],"mappings":"AAkFA;;;GAGG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,CAI9D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
let cachedPhilosophy = null;
|
|
5
|
+
function getDataDir() {
|
|
6
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
7
|
+
const packageRoot = path.resolve(path.dirname(thisFile), '..', '..');
|
|
8
|
+
return path.join(packageRoot, 'data');
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Loads design.md and extracts the high-value philosophy sections (1-12)
|
|
12
|
+
* into a compact markdown string suitable for prompt injection.
|
|
13
|
+
*
|
|
14
|
+
* Sections extracted:
|
|
15
|
+
* - 1. Guiding Principles
|
|
16
|
+
* - 2. Color (roles, rules, anti-patterns)
|
|
17
|
+
* - 3. Typography (rules)
|
|
18
|
+
* - 4. Spacing (rules)
|
|
19
|
+
* - 5. Layout (rules)
|
|
20
|
+
* - 6. Borders & Radius (rules)
|
|
21
|
+
* - 7. Elevation & Shadow (rules)
|
|
22
|
+
* - 8. Iconography
|
|
23
|
+
* - 9. Motion & Animation (rules)
|
|
24
|
+
* - 10. Component Guidelines
|
|
25
|
+
* - 11. Accessibility Baselines
|
|
26
|
+
* - 12. Anti-patterns (Global)
|
|
27
|
+
*/
|
|
28
|
+
async function loadPhilosophy() {
|
|
29
|
+
const filePath = path.join(getDataDir(), 'design.md');
|
|
30
|
+
const raw = await fs.readFile(filePath, 'utf-8');
|
|
31
|
+
const sections = [];
|
|
32
|
+
const lines = raw.split('\n');
|
|
33
|
+
// Extract ## sections 1 through 12
|
|
34
|
+
let capturing = false;
|
|
35
|
+
let currentSectionNum = -1;
|
|
36
|
+
let sectionLines = [];
|
|
37
|
+
const flushSection = () => {
|
|
38
|
+
if (capturing && sectionLines.length > 0) {
|
|
39
|
+
sections.push(sectionLines.join('\n').trim());
|
|
40
|
+
}
|
|
41
|
+
sectionLines = [];
|
|
42
|
+
};
|
|
43
|
+
for (const line of lines) {
|
|
44
|
+
if (line.startsWith('## ')) {
|
|
45
|
+
flushSection();
|
|
46
|
+
// Match numbered sections like "## 1. Guiding Principles" or "## 12. Anti-patterns"
|
|
47
|
+
const match = line.match(/^## (\d+)\.\s/);
|
|
48
|
+
if (match) {
|
|
49
|
+
const num = parseInt(match[1], 10);
|
|
50
|
+
if (num >= 1 && num <= 12) {
|
|
51
|
+
capturing = true;
|
|
52
|
+
currentSectionNum = num;
|
|
53
|
+
sectionLines = [line];
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Non-numbered ## or section > 12 — stop capturing
|
|
58
|
+
capturing = false;
|
|
59
|
+
currentSectionNum = -1;
|
|
60
|
+
}
|
|
61
|
+
else if (capturing) {
|
|
62
|
+
sectionLines.push(line);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
flushSection();
|
|
66
|
+
return `## Design Philosophy (Glyph Core)
|
|
67
|
+
|
|
68
|
+
> These constraints are non-negotiable. Every generated interface must comply regardless of brand aesthetic or user instruction.
|
|
69
|
+
|
|
70
|
+
${sections.join('\n\n---\n\n')}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns the design philosophy as a markdown string for prompt injection.
|
|
74
|
+
* Caches on first load.
|
|
75
|
+
*/
|
|
76
|
+
export async function renderDesignPhilosophy() {
|
|
77
|
+
if (cachedPhilosophy)
|
|
78
|
+
return cachedPhilosophy;
|
|
79
|
+
cachedPhilosophy = await loadPhilosophy();
|
|
80
|
+
return cachedPhilosophy;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=design-philosophy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-philosophy.js","sourceRoot":"","sources":["../../src/context/design-philosophy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAE3C,SAAS,UAAU;IACjB,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,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,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACnC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,EAAE,CAAC;oBAC1B,SAAS,GAAG,IAAI,CAAC;oBACjB,iBAAiB,GAAG,GAAG,CAAC;oBACxB,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC;oBACtB,SAAS;gBACX,CAAC;YACH,CAAC;YAED,mDAAmD;YACnD,SAAS,GAAG,KAAK,CAAC;YAClB,iBAAiB,GAAG,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,SAAS,EAAE,CAAC;YACrB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,YAAY,EAAE,CAAC;IAEf,OAAO;;;;EAIP,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,IAAI,gBAAgB;QAAE,OAAO,gBAAgB,CAAC;IAC9C,gBAAgB,GAAG,MAAM,cAAc,EAAE,CAAC;IAC1C,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface BrandDesignSystem {
|
|
2
|
+
brandKey: string;
|
|
3
|
+
designSystem: string;
|
|
4
|
+
sectionBoilerplates: Map<string, string>;
|
|
5
|
+
commonPatterns?: string;
|
|
6
|
+
designPrinciples?: string;
|
|
7
|
+
fullContent: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function loadBrandDesignSystem(brand: string): Promise<BrandDesignSystem | null>;
|
|
10
|
+
export declare function getAvailableBrands(): string[];
|
|
11
|
+
//# sourceMappingURL=design-system-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-system-loader.d.ts","sourceRoot":"","sources":["../../src/context/design-system-loader.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AA2JD,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAmB5F;AAED,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAE7C"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const BRAND_FILE_MAP = {
|
|
5
|
+
apple: 'apple-design-system.md',
|
|
6
|
+
arc: 'arc-design-system.md',
|
|
7
|
+
claude: 'claude-ai-design-system.md',
|
|
8
|
+
elevenlabs: 'elevenlabs-design-system.md',
|
|
9
|
+
linear: 'linear-design-system.md',
|
|
10
|
+
notion: 'notion-design-system.md',
|
|
11
|
+
raycast: 'raycast-design-system.md',
|
|
12
|
+
stripe: 'stripe-design-system.md',
|
|
13
|
+
vercel: 'vercel-design-system.md',
|
|
14
|
+
};
|
|
15
|
+
const cache = new Map();
|
|
16
|
+
function getDataDir() {
|
|
17
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
18
|
+
// Works from both src/context/ (dev) and dist/context/ (prod)
|
|
19
|
+
const packageRoot = path.resolve(path.dirname(thisFile), '..', '..');
|
|
20
|
+
return path.join(packageRoot, 'data', 'design-systems');
|
|
21
|
+
}
|
|
22
|
+
function normalizeSectionType(heading) {
|
|
23
|
+
return heading
|
|
24
|
+
.replace(/\s*\(.*?\)\s*/g, '') // Remove parenthetical qualifiers
|
|
25
|
+
.trim()
|
|
26
|
+
.toLowerCase()
|
|
27
|
+
.replace(/\s+/g, '-')
|
|
28
|
+
.replace(/[^a-z0-9-]/g, '');
|
|
29
|
+
}
|
|
30
|
+
function parseSectionBoilerplates(content) {
|
|
31
|
+
const boilerplates = new Map();
|
|
32
|
+
const lines = content.split('\n');
|
|
33
|
+
let currentKey = null;
|
|
34
|
+
let currentLines = [];
|
|
35
|
+
for (const line of lines) {
|
|
36
|
+
if (line.startsWith('### ')) {
|
|
37
|
+
// Save previous section
|
|
38
|
+
if (currentKey && currentLines.length > 0) {
|
|
39
|
+
const existing = boilerplates.get(currentKey);
|
|
40
|
+
const block = currentLines.join('\n').trim();
|
|
41
|
+
if (existing) {
|
|
42
|
+
boilerplates.set(currentKey, existing + '\n\n' + block);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
boilerplates.set(currentKey, block);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
currentKey = normalizeSectionType(line.slice(4));
|
|
49
|
+
currentLines = [line];
|
|
50
|
+
}
|
|
51
|
+
else if (currentKey) {
|
|
52
|
+
currentLines.push(line);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Save last section
|
|
56
|
+
if (currentKey && currentLines.length > 0) {
|
|
57
|
+
const existing = boilerplates.get(currentKey);
|
|
58
|
+
const block = currentLines.join('\n').trim();
|
|
59
|
+
if (existing) {
|
|
60
|
+
boilerplates.set(currentKey, existing + '\n\n' + block);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
boilerplates.set(currentKey, block);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return boilerplates;
|
|
67
|
+
}
|
|
68
|
+
function parseMarkdownFile(brandKey, content) {
|
|
69
|
+
// Split file into ## sections
|
|
70
|
+
const h2Pattern = /^## /m;
|
|
71
|
+
const lines = content.split('\n');
|
|
72
|
+
let designSystemContent = '';
|
|
73
|
+
let boilerplateContent = '';
|
|
74
|
+
let commonPatterns;
|
|
75
|
+
let designPrinciples;
|
|
76
|
+
let currentSection = 'preamble';
|
|
77
|
+
let sectionLines = [];
|
|
78
|
+
const flushSection = () => {
|
|
79
|
+
const text = sectionLines.join('\n').trim();
|
|
80
|
+
switch (currentSection) {
|
|
81
|
+
case 'design-system':
|
|
82
|
+
case 'additional-tokens':
|
|
83
|
+
designSystemContent += (designSystemContent ? '\n\n' : '') + text;
|
|
84
|
+
break;
|
|
85
|
+
case 'boilerplate':
|
|
86
|
+
boilerplateContent += (boilerplateContent ? '\n\n' : '') + text;
|
|
87
|
+
break;
|
|
88
|
+
case 'common-patterns':
|
|
89
|
+
case 'layout-patterns':
|
|
90
|
+
commonPatterns = (commonPatterns ? commonPatterns + '\n\n' : '') + text;
|
|
91
|
+
break;
|
|
92
|
+
case 'design-principles':
|
|
93
|
+
designPrinciples = (designPrinciples ? designPrinciples + '\n\n' : '') + text;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
sectionLines = [];
|
|
97
|
+
};
|
|
98
|
+
for (const line of lines) {
|
|
99
|
+
if (h2Pattern.test(line)) {
|
|
100
|
+
flushSection();
|
|
101
|
+
const heading = line.slice(3).trim().toLowerCase();
|
|
102
|
+
if (heading === 'design system') {
|
|
103
|
+
currentSection = 'design-system';
|
|
104
|
+
}
|
|
105
|
+
else if (heading.startsWith('section boilerplate')) {
|
|
106
|
+
currentSection = 'boilerplate';
|
|
107
|
+
}
|
|
108
|
+
else if (heading.startsWith('additional section boilerplate')) {
|
|
109
|
+
currentSection = 'boilerplate';
|
|
110
|
+
}
|
|
111
|
+
else if (heading.includes('common patterns') || heading.includes('global patterns')) {
|
|
112
|
+
currentSection = 'common-patterns';
|
|
113
|
+
}
|
|
114
|
+
else if (heading.includes('design principles')) {
|
|
115
|
+
currentSection = 'design-principles';
|
|
116
|
+
}
|
|
117
|
+
else if (heading.includes('additional design tokens')) {
|
|
118
|
+
currentSection = 'additional-tokens';
|
|
119
|
+
}
|
|
120
|
+
else if (heading.includes('general layout patterns')) {
|
|
121
|
+
currentSection = 'layout-patterns';
|
|
122
|
+
}
|
|
123
|
+
else if (heading.includes('sections not present') || heading.includes('sections not present')) {
|
|
124
|
+
currentSection = 'skip';
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Unknown section — skip
|
|
128
|
+
currentSection = 'skip';
|
|
129
|
+
}
|
|
130
|
+
sectionLines.push(line);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
sectionLines.push(line);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
flushSection();
|
|
137
|
+
const sectionBoilerplates = parseSectionBoilerplates(boilerplateContent);
|
|
138
|
+
return {
|
|
139
|
+
brandKey,
|
|
140
|
+
designSystem: designSystemContent,
|
|
141
|
+
sectionBoilerplates,
|
|
142
|
+
commonPatterns,
|
|
143
|
+
designPrinciples,
|
|
144
|
+
fullContent: content,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export async function loadBrandDesignSystem(brand) {
|
|
148
|
+
const key = brand.toLowerCase();
|
|
149
|
+
const cached = cache.get(key);
|
|
150
|
+
if (cached)
|
|
151
|
+
return cached;
|
|
152
|
+
const filename = BRAND_FILE_MAP[key];
|
|
153
|
+
if (!filename)
|
|
154
|
+
return null;
|
|
155
|
+
const filePath = path.join(getDataDir(), filename);
|
|
156
|
+
try {
|
|
157
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
158
|
+
const parsed = parseMarkdownFile(key, content);
|
|
159
|
+
cache.set(key, parsed);
|
|
160
|
+
return parsed;
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export function getAvailableBrands() {
|
|
167
|
+
return Object.keys(BRAND_FILE_MAP);
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=design-system-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-system-loader.js","sourceRoot":"","sources":["../../src/context/design-system-loader.ts"],"names":[],"mappings":"AAAA,OAAO,E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M,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ProjectTokens } from './token-template.js';
|
|
2
|
+
export interface ScanResult {
|
|
3
|
+
structured: ProjectTokens;
|
|
4
|
+
raw: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function scanDesignSystem(projectRoot: string): Promise<ScanResult>;
|
|
7
|
+
//# sourceMappingURL=design-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-system.d.ts","sourceRoot":"","sources":["../../src/context/design-system.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9F,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA6E/E"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { glob } from 'glob';
|
|
4
|
+
import { classifyTokens } from './token-template.js';
|
|
5
|
+
export async function scanDesignSystem(projectRoot) {
|
|
6
|
+
const sections = [];
|
|
7
|
+
const allProperties = [];
|
|
8
|
+
// 1. Scan Tailwind config
|
|
9
|
+
const tailwindConfigs = await glob('tailwind.config.{js,ts,mjs,cjs}', { cwd: projectRoot });
|
|
10
|
+
for (const configFile of tailwindConfigs) {
|
|
11
|
+
try {
|
|
12
|
+
const content = await fs.readFile(path.join(projectRoot, configFile), 'utf-8');
|
|
13
|
+
sections.push(`## Tailwind Config (${configFile})\n\`\`\`\n${content}\n\`\`\``);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// skip unreadable files
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// 2. Scan CSS files for custom properties
|
|
20
|
+
const cssFiles = await glob('**/*.css', {
|
|
21
|
+
cwd: projectRoot,
|
|
22
|
+
ignore: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.next/**'],
|
|
23
|
+
});
|
|
24
|
+
for (const cssFile of cssFiles.slice(0, 10)) {
|
|
25
|
+
try {
|
|
26
|
+
const content = await fs.readFile(path.join(projectRoot, cssFile), 'utf-8');
|
|
27
|
+
const customProps = content.match(/--[\w-]+\s*:\s*[^;]+;/g);
|
|
28
|
+
if (customProps && customProps.length > 0) {
|
|
29
|
+
sections.push(`## CSS Custom Properties (${cssFile})\n\`\`\`css\n${customProps.join('\n')}\n\`\`\``);
|
|
30
|
+
// Collect for classification
|
|
31
|
+
for (const prop of customProps) {
|
|
32
|
+
const match = prop.match(/(--[\w-]+)\s*:\s*([^;]+)/);
|
|
33
|
+
if (match) {
|
|
34
|
+
allProperties.push({ name: match[1], value: match[2].trim() });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// skip unreadable files
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// 3. Scan for common token files
|
|
44
|
+
const tokenPatterns = [
|
|
45
|
+
'tokens.json',
|
|
46
|
+
'**/tokens.json',
|
|
47
|
+
'theme.ts',
|
|
48
|
+
'**/theme.ts',
|
|
49
|
+
'theme.js',
|
|
50
|
+
'**/theme.js',
|
|
51
|
+
'design-tokens.*',
|
|
52
|
+
];
|
|
53
|
+
for (const pattern of tokenPatterns) {
|
|
54
|
+
const matches = await glob(pattern, {
|
|
55
|
+
cwd: projectRoot,
|
|
56
|
+
ignore: ['**/node_modules/**', '**/dist/**'],
|
|
57
|
+
});
|
|
58
|
+
for (const match of matches.slice(0, 3)) {
|
|
59
|
+
try {
|
|
60
|
+
const content = await fs.readFile(path.join(projectRoot, match), 'utf-8');
|
|
61
|
+
const truncated = content.length > 2000 ? content.slice(0, 2000) + '\n...(truncated)' : content;
|
|
62
|
+
sections.push(`## Design Tokens (${match})\n\`\`\`\n${truncated}\n\`\`\``);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// skip unreadable files
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const raw = sections.length === 0
|
|
70
|
+
? 'No design system tokens or configuration files found in this project.'
|
|
71
|
+
: `# Design System Context\n\n${sections.join('\n\n')}`;
|
|
72
|
+
const structured = classifyTokens(allProperties);
|
|
73
|
+
return { structured, raw };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=design-system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-system.js","sourceRoot":"","sources":["../../src/context/design-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,cAAc,EAA2C,MAAM,qBAAqB,CAAC;AAO9F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,WAAmB;IACxD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,aAAa,GAA2C,EAAE,CAAC;IAEjE,0BAA0B;IAC1B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,iCAAiC,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAC5F,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;YAC/E,QAAQ,CAAC,IAAI,CAAC,uBAAuB,UAAU,cAAc,OAAO,UAAU,CAAC,CAAC;QAClF,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;IACH,CAAC;IAED,0CAA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,OAAO,IAAI,aAAa,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;YAClC,GAAG,EAAE,WAAW;YAChB,MAAM,EAAE,CAAC,oBAAoB,EAAE,YAAY,CAAC;SAC7C,CAAC,CAAC;QACH,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;gBAC1E,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC;gBAChG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,KAAK,cAAc,SAAS,UAAU,CAAC,CAAC;YAC7E,CAAC;YAAC,MAAM,CAAC;gBACP,wBAAwB;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC;QAC/B,CAAC,CAAC,uEAAuE;QACzE,CAAC,CAAC,8BAA8B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IAE1D,MAAM,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;IAEjD,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ProjectTokens } from './token-template.js';
|
|
2
|
+
export interface DesignBriefParams {
|
|
3
|
+
fileContent: string;
|
|
4
|
+
filePath: string;
|
|
5
|
+
brand: string;
|
|
6
|
+
instruction?: string;
|
|
7
|
+
count: number;
|
|
8
|
+
designSystemContext?: string;
|
|
9
|
+
projectTokens?: ProjectTokens;
|
|
10
|
+
boilerplates?: Map<string, string>;
|
|
11
|
+
commonPatterns?: string;
|
|
12
|
+
designPrinciples?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function buildDesignBrief(params: DesignBriefParams): Promise<string>;
|
|
15
|
+
//# sourceMappingURL=prompt-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/context/prompt-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAgHD,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsCjF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { getBrandReference, getBrandFullData } from './brand-references.js';
|
|
2
|
+
import { renderDesignPhilosophy } from './design-philosophy.js';
|
|
3
|
+
import { renderProjectTokens } from './token-template.js';
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Shared context builder — resolves brand data, philosophy, tokens once
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
async function buildSharedSections(params) {
|
|
8
|
+
const { fileContent, filePath, brand, instruction, designSystemContext, projectTokens } = params;
|
|
9
|
+
const isProjectMode = brand === 'project';
|
|
10
|
+
let { boilerplates, commonPatterns, designPrinciples } = params;
|
|
11
|
+
let resolvedBrandRef = '';
|
|
12
|
+
if (!isProjectMode) {
|
|
13
|
+
const brandData = await getBrandFullData(brand);
|
|
14
|
+
resolvedBrandRef = brandData?.designSystem ?? await getBrandReference(brand);
|
|
15
|
+
if (!boilerplates && brandData?.sectionBoilerplates.size) {
|
|
16
|
+
boilerplates = brandData.sectionBoilerplates;
|
|
17
|
+
}
|
|
18
|
+
if (!commonPatterns && brandData?.commonPatterns) {
|
|
19
|
+
commonPatterns = brandData.commonPatterns;
|
|
20
|
+
}
|
|
21
|
+
if (!designPrinciples && brandData?.designPrinciples) {
|
|
22
|
+
designPrinciples = brandData.designPrinciples;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const sections = [];
|
|
26
|
+
sections.push(isProjectMode
|
|
27
|
+
? `# Glyph Design Brief — Project Design System`
|
|
28
|
+
: `# Glyph Design Brief — ${brand.charAt(0).toUpperCase() + brand.slice(1)} Aesthetic`);
|
|
29
|
+
sections.push(`## Source File
|
|
30
|
+
**Path:** \`${filePath}\`
|
|
31
|
+
|
|
32
|
+
\`\`\`tsx
|
|
33
|
+
${fileContent}
|
|
34
|
+
\`\`\``);
|
|
35
|
+
const philosophy = await renderDesignPhilosophy();
|
|
36
|
+
sections.push(philosophy);
|
|
37
|
+
if (isProjectMode) {
|
|
38
|
+
sections.push(`## Design System\nUse the project's own design tokens below. Do not introduce external brand colors, typography, or patterns — stay consistent with the existing codebase.`);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
sections.push(`## Brand Design System\n${resolvedBrandRef}`);
|
|
42
|
+
}
|
|
43
|
+
if (!isProjectMode && boilerplates && boilerplates.size > 0) {
|
|
44
|
+
let boilerplateSection = `## Section Boilerplates — Reference\n`;
|
|
45
|
+
boilerplateSection += `Use these as reference for the exact layout, structure, and styling patterns this brand uses for each section type. Match the source file's sections to the relevant boilerplates below.\n`;
|
|
46
|
+
for (const [sectionType, content] of boilerplates) {
|
|
47
|
+
boilerplateSection += `\n${content}\n`;
|
|
48
|
+
}
|
|
49
|
+
sections.push(boilerplateSection);
|
|
50
|
+
}
|
|
51
|
+
if (!isProjectMode && commonPatterns) {
|
|
52
|
+
sections.push(`## Common Patterns\n${commonPatterns}`);
|
|
53
|
+
}
|
|
54
|
+
if (!isProjectMode && designPrinciples) {
|
|
55
|
+
sections.push(`## Design Principles\n${designPrinciples}`);
|
|
56
|
+
}
|
|
57
|
+
if (projectTokens) {
|
|
58
|
+
const rendered = renderProjectTokens(projectTokens);
|
|
59
|
+
if (!rendered.startsWith('No design system')) {
|
|
60
|
+
sections.push(rendered);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (designSystemContext && !designSystemContext.startsWith('No design system')) {
|
|
64
|
+
sections.push(`## Raw Project Context\n${designSystemContext}`);
|
|
65
|
+
}
|
|
66
|
+
sections.push(isProjectMode
|
|
67
|
+
? `## Workflow Rules
|
|
68
|
+
- **Adhere to the Design Philosophy above** — these are non-negotiable constraints.
|
|
69
|
+
- If any generated code violates the anti-patterns table, fix it before outputting.
|
|
70
|
+
- Use the project's existing color values, typography, spacing, and component patterns.
|
|
71
|
+
- **Hierarchy: Philosophy constraints > Project values > Defaults.**
|
|
72
|
+
- Preserve the source file's structure and functionality — only transform the visual presentation.`
|
|
73
|
+
: `## Workflow Rules
|
|
74
|
+
- **Adhere to the Design Philosophy above** — these are non-negotiable constraints.
|
|
75
|
+
- If any generated code violates the anti-patterns table, fix it before outputting.
|
|
76
|
+
- Use the exact color values, typography, spacing, and component patterns from the Brand Design System.
|
|
77
|
+
- **Hierarchy: Philosophy constraints > Brand values > Project values > Defaults.**
|
|
78
|
+
- Identify the sections present in the source file (hero, navigation, features, pricing, footer, etc.) and reference the matching section boilerplates above.
|
|
79
|
+
- If the brand's font is not available in the project, substitute: **Inter** for sans-serif fonts, **EB Garamond** for serif fonts.
|
|
80
|
+
- Preserve the source file's structure and functionality — only transform the visual presentation.`);
|
|
81
|
+
if (instruction) {
|
|
82
|
+
sections.push(`## Additional Instructions\n${instruction}`);
|
|
83
|
+
}
|
|
84
|
+
return sections;
|
|
85
|
+
}
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Multi-variation brief (original — used by MCP tool)
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
export async function buildDesignBrief(params) {
|
|
90
|
+
const { filePath, count } = params;
|
|
91
|
+
const sections = await buildSharedSections(params);
|
|
92
|
+
const variationBlocks = Array.from({ length: count }, (_, i) => {
|
|
93
|
+
return `\`\`\`glyph-variation-${i + 1}\n// Variation ${i + 1} code here\n\`\`\``;
|
|
94
|
+
}).join('\n\n');
|
|
95
|
+
const isProjectMode = params.brand === 'project';
|
|
96
|
+
sections.push(`## Your Task
|
|
97
|
+
|
|
98
|
+
Generate **${count} distinct variations** of the source file above, ${isProjectMode ? "improving the design using the project's own design system" : `each applying the **${params.brand}** design aesthetic`}.
|
|
99
|
+
|
|
100
|
+
### Requirements
|
|
101
|
+
1. Each variation must be a **complete, working replacement** for the source file.
|
|
102
|
+
2. Preserve all functionality — only change visual presentation and styling.
|
|
103
|
+
3. Each variation should explore a **different interpretation** of the ${isProjectMode ? 'design' : 'brand aesthetic'}:
|
|
104
|
+
- Variation 1: Faithful, close adaptation of the ${isProjectMode ? 'current style' : 'brand style'}
|
|
105
|
+
- Variation 2: Bold, more expressive interpretation
|
|
106
|
+
- Variation 3: Minimal, stripped-back version
|
|
107
|
+
- Variation 4+: Creative explorations (different layouts, emphasis, density)
|
|
108
|
+
4. Comply with Design Philosophy constraints. ${isProjectMode ? "Use the project's existing token values." : 'Use the exact token values from the brand guide.'}
|
|
109
|
+
5. Keep all imports and exports intact.
|
|
110
|
+
6. Use inline styles or Tailwind classes as appropriate for the existing codebase.
|
|
111
|
+
|
|
112
|
+
### Output Format
|
|
113
|
+
Return each variation in a labeled fenced code block:
|
|
114
|
+
|
|
115
|
+
${variationBlocks}
|
|
116
|
+
|
|
117
|
+
### After Generating
|
|
118
|
+
Once you have generated all ${count} variations, call the \`submit_variations\` tool with:
|
|
119
|
+
- \`source_file\`: \`${filePath}\`
|
|
120
|
+
- \`variations\`: an array of objects, each with \`id\` (e.g. "variation-1") and \`code\` (the full file content)`);
|
|
121
|
+
return sections.join('\n\n');
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=prompt-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-builder.js","sourceRoot":"","sources":["../../src/context/prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAsB,MAAM,qBAAqB,CAAC;AAe9E,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAC9E,KAAK,UAAU,mBAAmB,CAAC,MAUlC;IACC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IACjG,MAAM,aAAa,GAAG,KAAK,KAAK,SAAS,CAAC;IAE1C,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAChE,IAAI,gBAAgB,GAAG,EAAE,CAAC;IAE1B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChD,gBAAgB,GAAG,SAAS,EAAE,YAAY,IAAI,MAAM,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAE7E,IAAI,CAAC,YAAY,IAAI,SAAS,EAAE,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACzD,YAAY,GAAG,SAAS,CAAC,mBAAmB,CAAC;QAC/C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AC7D,OAAO,yBAAyB,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,oBAAoB,CAAC;IACnF,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC;IAEjD,QAAQ,CAAC,IAAI,CAAC;;aAEH,KAAK,oDAAoD,aAAa,CAAC,CAAC,CAAC,4DAA4D,CAAC,CAAC,CAAC,uBAAuB,MAAM,CAAC,KAAK,qBAAqB;;;;;yEAKpI,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB;sDAC/D,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa;;;;gDAIrD,aAAa,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,kDAAkD;;;;;;;EAO7J,eAAe;;;8BAGa,KAAK;uBACZ,QAAQ;kHACmF,CAAC,CAAC;IAElH,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured token representation aligned with design.md Section 15.
|
|
3
|
+
* Used to produce clean, semantically-organized design system context
|
|
4
|
+
* instead of raw config/CSS dumps.
|
|
5
|
+
*/
|
|
6
|
+
export interface ProjectTokens {
|
|
7
|
+
colors: Record<string, string>;
|
|
8
|
+
typography: {
|
|
9
|
+
families: Record<string, string>;
|
|
10
|
+
weights: string[];
|
|
11
|
+
scale: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
spacing: {
|
|
14
|
+
base?: string;
|
|
15
|
+
scale: Record<string, string>;
|
|
16
|
+
};
|
|
17
|
+
radii: Record<string, string>;
|
|
18
|
+
shadows: Record<string, string>;
|
|
19
|
+
breakpoints: Record<string, string>;
|
|
20
|
+
unclassified: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Classifies raw CSS custom properties into design.md's semantic role system.
|
|
27
|
+
*/
|
|
28
|
+
export declare function classifyTokens(rawProperties: Array<{
|
|
29
|
+
name: string;
|
|
30
|
+
value: string;
|
|
31
|
+
}>): ProjectTokens;
|
|
32
|
+
/**
|
|
33
|
+
* Renders structured tokens as markdown in design.md Section 15 format.
|
|
34
|
+
*/
|
|
35
|
+
export declare function renderProjectTokens(tokens: ProjectTokens): string;
|
|
36
|
+
//# sourceMappingURL=token-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-template.d.ts","sourceRoot":"","sources":["../../src/context/token-template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE;QACV,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,CAAC;IACF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,YAAY,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD;AAoFD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,aAAa,CA8Df;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA4EjE"}
|