design-brain-memory 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/agentBrowser.d.ts +1 -0
  2. package/dist/agentBrowser.js +1 -0
  3. package/dist/agentBrowser.js.map +1 -1
  4. package/dist/classify.d.ts +21 -0
  5. package/dist/classify.js +205 -0
  6. package/dist/classify.js.map +1 -0
  7. package/dist/cli.js +216 -219
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands.d.ts +1 -60
  10. package/dist/commands.js +10 -322
  11. package/dist/commands.js.map +1 -1
  12. package/dist/extractFromUrl.d.ts +0 -7
  13. package/dist/extractFromUrl.js +353 -82
  14. package/dist/extractFromUrl.js.map +1 -1
  15. package/dist/index.d.ts +12 -24
  16. package/dist/index.js +11 -16
  17. package/dist/index.js.map +1 -1
  18. package/dist/llm.d.ts +6 -0
  19. package/dist/llm.js +12 -1
  20. package/dist/llm.js.map +1 -1
  21. package/dist/persona.d.ts +2 -0
  22. package/dist/persona.js +234 -0
  23. package/dist/persona.js.map +1 -0
  24. package/dist/query.js +6 -1
  25. package/dist/query.js.map +1 -1
  26. package/dist/render.d.ts +10 -2
  27. package/dist/render.js +175 -80
  28. package/dist/render.js.map +1 -1
  29. package/dist/scan.d.ts +10 -0
  30. package/dist/scan.js +393 -0
  31. package/dist/scan.js.map +1 -0
  32. package/dist/scanRenderer.d.ts +2 -0
  33. package/dist/scanRenderer.js +155 -0
  34. package/dist/scanRenderer.js.map +1 -0
  35. package/dist/skillPrompt.d.ts +3 -1
  36. package/dist/skillPrompt.js +148 -22
  37. package/dist/skillPrompt.js.map +1 -1
  38. package/dist/store.d.ts +5 -1
  39. package/dist/store.js +19 -0
  40. package/dist/store.js.map +1 -1
  41. package/dist/taste.d.ts +9 -0
  42. package/dist/taste.js +598 -0
  43. package/dist/taste.js.map +1 -0
  44. package/dist/tasteDiff.d.ts +19 -0
  45. package/dist/tasteDiff.js +340 -0
  46. package/dist/tasteDiff.js.map +1 -0
  47. package/dist/tasteGenerate.d.ts +12 -0
  48. package/dist/tasteGenerate.js +140 -0
  49. package/dist/tasteGenerate.js.map +1 -0
  50. package/dist/tasteRefine.d.ts +13 -0
  51. package/dist/tasteRefine.js +351 -0
  52. package/dist/tasteRefine.js.map +1 -0
  53. package/dist/tasteRenderer.d.ts +4 -0
  54. package/dist/tasteRenderer.js +133 -0
  55. package/dist/tasteRenderer.js.map +1 -0
  56. package/dist/theatrical.d.ts +5 -0
  57. package/dist/theatrical.js +258 -0
  58. package/dist/theatrical.js.map +1 -0
  59. package/dist/types.d.ts +196 -27
  60. package/package.json +4 -3
  61. package/skills/SKILL.md +36 -0
  62. package/skills/design-brain/SKILL.md +77 -0
  63. package/README.md +0 -242
  64. package/dist/aggregate.d.ts +0 -9
  65. package/dist/aggregate.js +0 -53
  66. package/dist/aggregate.js.map +0 -1
  67. package/dist/batch.d.ts +0 -16
  68. package/dist/batch.js +0 -44
  69. package/dist/batch.js.map +0 -1
  70. package/dist/compare.d.ts +0 -33
  71. package/dist/compare.js +0 -83
  72. package/dist/compare.js.map +0 -1
  73. package/dist/componentGraph.d.ts +0 -22
  74. package/dist/componentGraph.js +0 -106
  75. package/dist/componentGraph.js.map +0 -1
  76. package/dist/contextLayer.d.ts +0 -12
  77. package/dist/contextLayer.js +0 -263
  78. package/dist/contextLayer.js.map +0 -1
  79. package/dist/cssInJs.d.ts +0 -9
  80. package/dist/cssInJs.js +0 -124
  81. package/dist/cssInJs.js.map +0 -1
  82. package/dist/graphView.d.ts +0 -21
  83. package/dist/graphView.js +0 -492
  84. package/dist/graphView.js.map +0 -1
  85. package/dist/knowledge.d.ts +0 -20
  86. package/dist/knowledge.js +0 -208
  87. package/dist/knowledge.js.map +0 -1
  88. package/dist/liveView.d.ts +0 -15
  89. package/dist/liveView.js +0 -476
  90. package/dist/liveView.js.map +0 -1
  91. package/dist/moodboard.d.ts +0 -3
  92. package/dist/moodboard.js +0 -139
  93. package/dist/moodboard.js.map +0 -1
  94. package/dist/reviewChecklist.d.ts +0 -17
  95. package/dist/reviewChecklist.js +0 -126
  96. package/dist/reviewChecklist.js.map +0 -1
  97. package/dist/scorecard.d.ts +0 -48
  98. package/dist/scorecard.js +0 -201
  99. package/dist/scorecard.js.map +0 -1
  100. package/dist/styleDictionary.d.ts +0 -16
  101. package/dist/styleDictionary.js +0 -89
  102. package/dist/styleDictionary.js.map +0 -1
  103. package/dist/svg.d.ts +0 -5
  104. package/dist/svg.js +0 -162
  105. package/dist/svg.js.map +0 -1
  106. package/dist/systemDiff.d.ts +0 -28
  107. package/dist/systemDiff.js +0 -107
  108. package/dist/systemDiff.js.map +0 -1
  109. package/dist/tailwind.d.ts +0 -2
  110. package/dist/tailwind.js +0 -122
  111. package/dist/tailwind.js.map +0 -1
  112. package/dist/tokenNaming.d.ts +0 -5
  113. package/dist/tokenNaming.js +0 -229
  114. package/dist/tokenNaming.js.map +0 -1
  115. package/dist/tokens.d.ts +0 -17
  116. package/dist/tokens.js +0 -44
  117. package/dist/tokens.js.map +0 -1
  118. package/dist/trends.d.ts +0 -12
  119. package/dist/trends.js +0 -178
  120. package/dist/trends.js.map +0 -1
  121. package/dist/wiki.d.ts +0 -10
  122. package/dist/wiki.js +0 -346
  123. package/dist/wiki.js.map +0 -1
  124. package/dist/writingStyle.d.ts +0 -38
  125. package/dist/writingStyle.js +0 -224
  126. package/dist/writingStyle.js.map +0 -1
package/README.md DELETED
@@ -1,242 +0,0 @@
1
- # design-brain-memory
2
-
3
- A persistent design knowledge system that captures inspiration from websites and screenshots, extracts reusable patterns, and builds a grep-friendly markdown knowledge graph.
4
-
5
- Built on [Agent Browser CLI](https://github.com/vercel-labs/agent-browser) for headless capture. No external LLM required — bring your own optionally for semantic enrichment.
6
-
7
- ## Features
8
-
9
- - **Capture** — Extract colors, typography, components, motion, layout, and CSS variables from any URL or screenshot
10
- - **Knowledge system** — Three-space architecture (self / notes / ops) with pattern, decision, and principle notes
11
- - **Processing pipeline** — Extract → Synthesize → Evolve → Verify with queue tracking
12
- - **Tailwind export** — Generate `tailwind.config.js` from captured design tokens with auto-named colors from CSS variables
13
- - **Visual catalog** — SVG palette, component, typography, and layout visualizations per capture
14
- - **Component isolation** — Grouped JSON tokens by component kind (button, card, navigation, etc.)
15
- - **Version lineage** — Fingerprint-based versioning with diffs between captures
16
- - **Responsive coverage** — Capture at multiple viewports in a single pass
17
- - **Interaction states** — Hover, focus, and active state extraction from runtime CSS
18
- - **Journey capture** — Click-through exploration with per-step snapshots
19
- - **Ripgrep-friendly** — Flat markdown files with YAML frontmatter, wiki links, and CSV relation graph
20
-
21
- ## Install
22
-
23
- ```bash
24
- npm install -g design-brain-memory
25
- agent-browser install
26
- ```
27
-
28
- ## Quick Start
29
-
30
- ```bash
31
- # Initialize the knowledge system
32
- design-brain-memory init --root .
33
-
34
- # Capture a website
35
- design-brain-memory ingest \
36
- --project my-project \
37
- --url https://stripe.com \
38
- --name "Stripe Homepage" \
39
- --tags fintech,payments
40
-
41
- # Search with ripgrep
42
- rg "button|card" .design-brain/notes/patterns/
43
- rg "#533AFD" .design-brain/
44
-
45
- # Or use the built-in search
46
- design-brain-memory search --query "button hierarchy"
47
-
48
- # Export Tailwind config
49
- design-brain-memory export --project my-project --format tailwind
50
- ```
51
-
52
- ## Commands
53
-
54
- | Command | Description |
55
- |---------|-------------|
56
- | `init` | Create `.design-brain/` with knowledge system directories |
57
- | `ingest` | Capture inspiration from a URL or screenshot |
58
- | `outcome` | Record a design outcome linked to inspirations |
59
- | `search` | Keyword search across the brain |
60
- | `ask` | Semantic search (requires LLM config) |
61
- | `export` | Export tokens (tailwind or style-dictionary format) |
62
- | `compare` | Compare two captures or version diff |
63
- | `batch` | Batch capture from a URL list file |
64
- | `moodboard` | Generate HTML + PNG visual moodboard |
65
- | `trends` | Detect design trends across captures |
66
- | `scorecard` | Audit codebase against captured design tokens |
67
- | `reindex` | Regenerate all markdown, SVGs, and knowledge files |
68
-
69
- ### Ingest
70
-
71
- ```bash
72
- design-brain-memory ingest \
73
- --project checkout-redesign \
74
- --project-name "Checkout Redesign" \
75
- --url https://stripe.com \
76
- --name "Stripe checkout inspiration" \
77
- --tags payments,checkout,cta \
78
- --journey-steps 4 \
79
- --viewport desktop=1440x1200 tablet=1024x1366 mobile=390x844
80
- ```
81
-
82
- From a screenshot:
83
-
84
- ```bash
85
- design-brain-memory ingest \
86
- --project checkout-redesign \
87
- --screenshot ./screens/inspo-hero.png \
88
- --name "Hero screenshot" \
89
- --tags hero,landing
90
- ```
91
-
92
- ### Record Outcome
93
-
94
- ```bash
95
- design-brain-memory outcome \
96
- --project checkout-redesign \
97
- --title "v1 shipped" \
98
- --description "Card-based checkout with clear primary CTA" \
99
- --inspired-by inspo-stripe-checkout-1234abcd \
100
- --tags shipped,frontend
101
- ```
102
-
103
- ## Knowledge System
104
-
105
- The brain organizes knowledge across five spaces:
106
-
107
- ```
108
- .design-brain/
109
- ├── self/ # Agent identity and methodology
110
- │ ├── identity.md
111
- │ └── methodology.md
112
- ├── notes/ # Knowledge graph
113
- │ ├── patterns/*.md # Reusable design patterns
114
- │ ├── decisions/*.md # Design decisions with rationale
115
- │ ├── principles/*.md # Cross-project principles
116
- │ └── mocs/ # Maps of Content
117
- │ ├── hub.md
118
- │ ├── color-systems.md
119
- │ ├── typography.md
120
- │ ├── components.md
121
- │ ├── layout.md
122
- │ ├── motion.md
123
- │ └── brand.md
124
- ├── ops/ # Operations
125
- │ ├── queue/*.yaml # Processing pipeline queue
126
- │ ├── sessions/*.md # Session activity logs
127
- │ └── maintenance.md # Health signals
128
- ├── projects/ # Raw captures
129
- │ └── <project>/
130
- │ ├── README.md
131
- │ ├── inspirations/*.md
132
- │ ├── outcomes/*.md
133
- │ ├── tokens/ # Aggregated design tokens
134
- │ ├── visuals/*.svg # SVG visual catalog
135
- │ └── tailwind.config.js # Generated Tailwind config
136
- └── graph/ # Relation graph
137
- ├── entities.csv
138
- └── relations.csv
139
- ```
140
-
141
- ### Note Schema
142
-
143
- All notes use YAML frontmatter:
144
-
145
- ```yaml
146
- ---
147
- type: pattern | decision | principle
148
- title: "Descriptive title"
149
- sources: ["[[inspo-id]]"]
150
- domains: [web, brand, mobile, design-systems]
151
- tags: [relevant, tags]
152
- confidence: emerging | established | canonical
153
- created: 2026-02-18
154
- updated: 2026-02-18
155
- ---
156
- ```
157
-
158
- ### Processing Pipeline
159
-
160
- ```
161
- Capture → Extract → Synthesize → Evolve → Verify
162
- ```
163
-
164
- 1. **Capture** — Ingest inspiration, create queue entry
165
- 2. **Extract** — Generate pattern and decision notes from capture data
166
- 3. **Synthesize** — Find connections, add wiki links, update MOCs
167
- 4. **Evolve** — Update older notes with new evidence, upgrade confidence
168
- 5. **Verify** — Check schema compliance, link health, MOC coverage
169
-
170
- ## Retrieval
171
-
172
- Designed for ripgrep:
173
-
174
- ```bash
175
- # Find patterns by keyword
176
- rg "button|card|navigation" .design-brain/notes/patterns/
177
-
178
- # Find canonical patterns
179
- rg "confidence: canonical" .design-brain/notes/
180
-
181
- # Search by color hex
182
- rg "#533AFD" .design-brain/
183
-
184
- # Query the relation graph
185
- rg "has_inspiration|inspired_by" .design-brain/graph/relations.csv
186
-
187
- # Find notes linked to a specific capture
188
- rg "inspo-stripe" .design-brain/notes/
189
- ```
190
-
191
- ## Claude Code Plugin
192
-
193
- design-brain ships as a Claude Code plugin with slash commands and hooks:
194
-
195
- | Command | Description |
196
- |---------|-------------|
197
- | `/db-capture` | Capture inspiration from URL or screenshot |
198
- | `/db-extract` | Extract patterns and decisions from captures |
199
- | `/db-synthesize` | Find connections, update MOCs |
200
- | `/db-evolve` | Backward pass — update older notes |
201
- | `/db-verify` | Schema and link health check |
202
- | `/db-pipeline` | Run all pipeline phases |
203
- | `/db-next` | Show next pending queue item |
204
- | `/db-search` | Ripgrep search across the brain |
205
- | `/db-stats` | Vault metrics and health report |
206
- | `/db-export` | Export Tailwind or Style Dictionary tokens |
207
- | `/db-compare` | Compare two captures or version diff |
208
- | `/db-batch` | Batch capture from URL list file |
209
- | `/db-moodboard` | Generate visual moodboard |
210
- | `/db-trends` | Detect design trends across captures |
211
- | `/db-scorecard` | Audit codebase against captured tokens |
212
-
213
- ### Hooks
214
-
215
- | Event | Action |
216
- |-------|--------|
217
- | SessionStart | Load identity context, queue status, maintenance signals |
218
- | PostToolUse (Write) | Validate note frontmatter schema |
219
- | Stop | Log session activity summary |
220
-
221
- ## Optional: LLM Enrichment
222
-
223
- For semantic search and richer capture summaries, configure any OpenAI-compatible endpoint:
224
-
225
- ```bash
226
- export DESIGN_BRAIN_LLM_BASE_URL="https://api.openai.com/v1"
227
- export DESIGN_BRAIN_LLM_API_KEY="<your-key>"
228
- export DESIGN_BRAIN_LLM_MODEL="gpt-4o-mini"
229
- ```
230
-
231
- Or pass per command: `--llm-base-url <url> --llm-api-key <key> --llm-model <model>`
232
-
233
- Not required for core functionality.
234
-
235
- ## Requirements
236
-
237
- - Node.js 20+
238
- - [Agent Browser CLI](https://github.com/vercel-labs/agent-browser) (`agent-browser install`)
239
-
240
- ## License
241
-
242
- MIT
@@ -1,9 +0,0 @@
1
- import type { ColorToken, ComponentToken, InspirationRecord, MotionToken, TypographyToken } from './types.js';
2
- export declare function aggregateColors(records: InspirationRecord[]): ColorToken[];
3
- export declare function aggregateTypography(records: InspirationRecord[]): TypographyToken[];
4
- export declare function aggregateComponents(records: InspirationRecord[]): Array<ComponentToken & {
5
- count: number;
6
- }>;
7
- export declare function aggregateMotion(records: InspirationRecord[]): Array<MotionToken & {
8
- count: number;
9
- }>;
package/dist/aggregate.js DELETED
@@ -1,53 +0,0 @@
1
- export function aggregateColors(records) {
2
- const map = new Map();
3
- for (const record of records) {
4
- for (const color of record.analysis.colors) {
5
- const existing = map.get(color.hex) ?? { hex: color.hex, count: 0, samples: [] };
6
- existing.count += color.count;
7
- for (const sample of color.samples) {
8
- if (existing.samples.length < 6 && !existing.samples.includes(sample)) {
9
- existing.samples.push(sample);
10
- }
11
- }
12
- map.set(color.hex, existing);
13
- }
14
- }
15
- return [...map.values()].sort((a, b) => b.count - a.count).slice(0, 40);
16
- }
17
- export function aggregateTypography(records) {
18
- const map = new Map();
19
- for (const record of records) {
20
- for (const token of record.analysis.typography) {
21
- const key = `${token.fontFamily}|${token.fontSize}|${token.fontWeight}|${token.lineHeight}`;
22
- const existing = map.get(key) ?? { ...token, count: 0 };
23
- existing.count += token.count;
24
- map.set(key, existing);
25
- }
26
- }
27
- return [...map.values()].sort((a, b) => b.count - a.count).slice(0, 60);
28
- }
29
- export function aggregateComponents(records) {
30
- const map = new Map();
31
- for (const record of records) {
32
- for (const token of record.analysis.components) {
33
- const key = `${token.kind}|${token.tag}|${token.selector}`;
34
- const existing = map.get(key) ?? { ...token, count: 0 };
35
- existing.count += 1;
36
- map.set(key, existing);
37
- }
38
- }
39
- return [...map.values()].sort((a, b) => b.count - a.count).slice(0, 120);
40
- }
41
- export function aggregateMotion(records) {
42
- const map = new Map();
43
- for (const record of records) {
44
- for (const token of record.analysis.motion) {
45
- const key = `${token.selector}|${token.transition}|${token.animation}|${token.transform}`;
46
- const existing = map.get(key) ?? { ...token, count: 0 };
47
- existing.count += 1;
48
- map.set(key, existing);
49
- }
50
- }
51
- return [...map.values()].sort((a, b) => b.count - a.count).slice(0, 140);
52
- }
53
- //# sourceMappingURL=aggregate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../src/aggregate.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,eAAe,CAAC,OAA4B;IAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC1C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC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AI,OAAO,EAAE,CAAC;QAC7B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YAC1F,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YACxD,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC;YACpB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC3E,CAAC"}
package/dist/batch.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export interface BatchEntry {
2
- url: string;
3
- name?: string;
4
- tags: string[];
5
- }
6
- export declare function parseBatchFile(content: string): BatchEntry[];
7
- export declare function batchCapture(params: {
8
- rootDir: string;
9
- project: string;
10
- filePath: string;
11
- skipVisuals: boolean;
12
- }): Promise<{
13
- total: number;
14
- succeeded: number;
15
- failed: string[];
16
- }>;
package/dist/batch.js DELETED
@@ -1,44 +0,0 @@
1
- import fs from 'fs-extra';
2
- import { ingestInspiration } from './commands.js';
3
- export function parseBatchFile(content) {
4
- return content
5
- .split('\n')
6
- .map((line) => line.trim())
7
- .filter((line) => line.length > 0 && !line.startsWith('#'))
8
- .map((line) => {
9
- const parts = line.split('\t');
10
- const url = parts[0].trim();
11
- const name = parts[1]?.trim() || undefined;
12
- const tags = parts[2] ? parts[2].split(',').map((t) => t.trim()).filter(Boolean) : [];
13
- return { url, name, tags };
14
- });
15
- }
16
- export async function batchCapture(params) {
17
- const content = await fs.readFile(params.filePath, 'utf-8');
18
- const entries = parseBatchFile(content);
19
- const failed = [];
20
- let succeeded = 0;
21
- for (let i = 0; i < entries.length; i++) {
22
- const entry = entries[i];
23
- const label = entry.name || entry.url;
24
- console.log(`[${i + 1}/${entries.length}] Capturing ${label}...`);
25
- try {
26
- await ingestInspiration({
27
- rootDir: params.rootDir,
28
- project: params.project,
29
- url: entry.url,
30
- name: entry.name,
31
- tags: entry.tags,
32
- skipVisuals: params.skipVisuals,
33
- });
34
- succeeded++;
35
- }
36
- catch (error) {
37
- const msg = error instanceof Error ? error.message : String(error);
38
- console.error(` Failed: ${msg}`);
39
- failed.push(entry.url);
40
- }
41
- }
42
- return { total: entries.length, succeeded, failed };
43
- }
44
- //# sourceMappingURL=batch.js.map
package/dist/batch.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch.js","sourceRoot":"","sources":["../src/batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQlD,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,OAAO;SACX,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SAC1D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CA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AK,CAAC,IAAI;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC,CAAC;YACH,SAAS,EAAE,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnE,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACtD,CAAC"}
package/dist/compare.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import type { ColorToken, InspirationRecord, TypographyToken } from './types.js';
2
- export interface ComparisonReport {
3
- nameA: string;
4
- nameB: string;
5
- idA: string;
6
- idB: string;
7
- colors: {
8
- added: ColorToken[];
9
- removed: ColorToken[];
10
- shared: Array<{
11
- hex: string;
12
- countA: number;
13
- countB: number;
14
- }>;
15
- };
16
- typography: {
17
- added: TypographyToken[];
18
- removed: TypographyToken[];
19
- shared: TypographyToken[];
20
- };
21
- components: {
22
- addedKinds: string[];
23
- removedKinds: string[];
24
- sharedKinds: string[];
25
- };
26
- motion: {
27
- addedCount: number;
28
- removedCount: number;
29
- sharedCount: number;
30
- };
31
- }
32
- export declare function compareInspirations(a: InspirationRecord, b: InspirationRecord): ComparisonReport;
33
- export declare function renderComparison(report: ComparisonReport): string;
package/dist/compare.js DELETED
@@ -1,83 +0,0 @@
1
- export function compareInspirations(a, b) {
2
- // Colors
3
- const colorsA = new Map(a.analysis.colors.map((c) => [c.hex.toUpperCase(), c]));
4
- const colorsB = new Map(b.analysis.colors.map((c) => [c.hex.toUpperCase(), c]));
5
- const addedColors = [...colorsB.values()].filter((c) => !colorsA.has(c.hex.toUpperCase()));
6
- const removedColors = [...colorsA.values()].filter((c) => !colorsB.has(c.hex.toUpperCase()));
7
- const sharedColors = [...colorsA.entries()]
8
- .filter(([hex]) => colorsB.has(hex))
9
- .map(([hex, ca]) => ({ hex, countA: ca.count, countB: colorsB.get(hex).count }));
10
- // Typography
11
- const typoKey = (t) => `${t.fontFamily}|${t.fontSize}|${t.fontWeight}`;
12
- const typoA = new Map(a.analysis.typography.map((t) => [typoKey(t), t]));
13
- const typoB = new Map(b.analysis.typography.map((t) => [typoKey(t), t]));
14
- const addedTypo = [...typoB.values()].filter((t) => !typoA.has(typoKey(t)));
15
- const removedTypo = [...typoA.values()].filter((t) => !typoB.has(typoKey(t)));
16
- const sharedTypo = [...typoA.values()].filter((t) => typoB.has(typoKey(t)));
17
- // Components
18
- const kindsA = new Set(a.analysis.components.map((c) => c.kind));
19
- const kindsB = new Set(b.analysis.components.map((c) => c.kind));
20
- const addedKinds = [...kindsB].filter((k) => !kindsA.has(k));
21
- const removedKinds = [...kindsA].filter((k) => !kindsB.has(k));
22
- const sharedKinds = [...kindsA].filter((k) => kindsB.has(k));
23
- // Motion
24
- const motionKeyFn = (m) => `${m.selector}|${m.transition}|${m.animation}`;
25
- const motionA = new Set(a.analysis.motion.map(motionKeyFn));
26
- const motionB = new Set(b.analysis.motion.map(motionKeyFn));
27
- const addedMotion = [...motionB].filter((k) => !motionA.has(k)).length;
28
- const removedMotion = [...motionA].filter((k) => !motionB.has(k)).length;
29
- const sharedMotion = [...motionA].filter((k) => motionB.has(k)).length;
30
- return {
31
- nameA: a.name, nameB: b.name,
32
- idA: a.id, idB: b.id,
33
- colors: { added: addedColors, removed: removedColors, shared: sharedColors },
34
- typography: { added: addedTypo, removed: removedTypo, shared: sharedTypo },
35
- components: { addedKinds, removedKinds, sharedKinds },
36
- motion: { addedCount: addedMotion, removedCount: removedMotion, sharedCount: sharedMotion },
37
- };
38
- }
39
- export function renderComparison(report) {
40
- const lines = [];
41
- lines.push(`# Compare: ${report.nameA} vs ${report.nameB}\n`);
42
- // Colors
43
- lines.push('## Colors\n');
44
- lines.push('| Status | Hex | Detail |');
45
- lines.push('| --- | --- | --- |');
46
- for (const c of report.colors.added)
47
- lines.push(`| + Added | ${c.hex} | count: ${c.count} |`);
48
- for (const c of report.colors.removed)
49
- lines.push(`| - Removed | ${c.hex} | count: ${c.count} |`);
50
- for (const c of report.colors.shared)
51
- lines.push(`| = Shared | ${c.hex} | ${c.countA} → ${c.countB} |`);
52
- lines.push('');
53
- // Typography
54
- lines.push('## Typography\n');
55
- lines.push('| Status | Font | Size | Weight |');
56
- lines.push('| --- | --- | --- | --- |');
57
- for (const t of report.typography.added)
58
- lines.push(`| + Added | ${t.fontFamily} | ${t.fontSize} | ${t.fontWeight} |`);
59
- for (const t of report.typography.removed)
60
- lines.push(`| - Removed | ${t.fontFamily} | ${t.fontSize} | ${t.fontWeight} |`);
61
- for (const t of report.typography.shared)
62
- lines.push(`| = Shared | ${t.fontFamily} | ${t.fontSize} | ${t.fontWeight} |`);
63
- lines.push('');
64
- // Components
65
- lines.push('## Components\n');
66
- if (report.components.addedKinds.length > 0)
67
- lines.push(`Added: ${report.components.addedKinds.join(', ')}`);
68
- if (report.components.removedKinds.length > 0)
69
- lines.push(`Removed: ${report.components.removedKinds.join(', ')}`);
70
- lines.push(`Shared: ${report.components.sharedKinds.length} kinds`);
71
- lines.push('');
72
- // Motion
73
- lines.push('## Motion\n');
74
- lines.push(`Added: ${report.motion.addedCount} | Removed: ${report.motion.removedCount} | Shared: ${report.motion.sharedCount}`);
75
- lines.push('');
76
- // Summary
77
- const ca = report.colors.added.length, cr = report.colors.removed.length, cs = report.colors.shared.length;
78
- const ta = report.typography.added.length, tr = report.typography.removed.length, ts = report.typography.shared.length;
79
- lines.push('## Summary\n');
80
- lines.push(`Colors: +${ca} -${cr} =${cs} | Typography: +${ta} -${tr} =${ts} | Components: +${report.components.addedKinds.length} -${report.components.removedKinds.length} =${report.components.sharedKinds.length}`);
81
- return lines.join('\n');
82
- }
83
- //# sourceMappingURL=compare.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compare.js","sourceRoot":"","sources":["../src/compare.ts"],"names":[],"mappings":"AAkCA,MAAM,UAAU,mBAAmB,CAAC,CAAoB,EAAE,CAAoB;IAC5E,SAAS;IACT,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,WAAW,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC3F,MAAM,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC7F,MAAM,YAAY,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;SACxC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACnC,GAAG,CAAC,CAAC,CAAC,GAA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C,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;IACvH,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IAEvN,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,22 +0,0 @@
1
- import type { InspirationRecord } from './types.js';
2
- export interface ComponentEdge {
3
- parent: string;
4
- child: string;
5
- count: number;
6
- sourceSelectors: string[];
7
- }
8
- export interface CoOccurrence {
9
- kindA: string;
10
- kindB: string;
11
- count: number;
12
- }
13
- export interface ComponentGraph {
14
- nodes: Array<{
15
- kind: string;
16
- count: number;
17
- }>;
18
- edges: ComponentEdge[];
19
- coOccurrences: CoOccurrence[];
20
- }
21
- export declare function buildComponentGraph(inspirations: InspirationRecord[]): ComponentGraph;
22
- export declare function renderComponentGraphMd(graph: ComponentGraph): string;
@@ -1,106 +0,0 @@
1
- function findKindForSelector(selectorPart, components) {
2
- const kinds = [];
3
- for (const comp of components) {
4
- const parts = comp.selector.trim().split(/\s+/);
5
- if (parts.includes(selectorPart)) {
6
- kinds.push(comp.kind);
7
- }
8
- }
9
- return [...new Set(kinds)];
10
- }
11
- function extractNesting(components) {
12
- const parentChild = new Map();
13
- for (const comp of components) {
14
- const parts = comp.selector.trim().split(/\s+/).filter(Boolean);
15
- if (parts.length < 2)
16
- continue;
17
- for (let i = 0; i < parts.length - 1; i++) {
18
- const parentKinds = findKindForSelector(parts[i], components);
19
- const childKinds = findKindForSelector(parts[i + 1], components);
20
- for (const parentKind of parentKinds) {
21
- for (const childKind of childKinds) {
22
- if (parentKind === childKind)
23
- continue;
24
- const children = parentChild.get(parentKind) ?? new Set();
25
- children.add(childKind);
26
- parentChild.set(parentKind, children);
27
- }
28
- }
29
- }
30
- }
31
- return parentChild;
32
- }
33
- export function buildComponentGraph(inspirations) {
34
- const kindCounts = new Map();
35
- const edgeMap = new Map();
36
- const coOccMap = new Map();
37
- for (const inspo of inspirations) {
38
- const components = inspo.analysis.components;
39
- const kindsInCapture = new Set();
40
- for (const comp of components) {
41
- kindCounts.set(comp.kind, (kindCounts.get(comp.kind) ?? 0) + 1);
42
- kindsInCapture.add(comp.kind);
43
- }
44
- const nesting = extractNesting(components);
45
- for (const [parent, children] of nesting) {
46
- for (const child of children) {
47
- const key = `${parent}→${child}`;
48
- const existing = edgeMap.get(key) ?? { parent, child, count: 0, selectors: new Set() };
49
- existing.count += 1;
50
- existing.selectors.add(inspo.id);
51
- edgeMap.set(key, existing);
52
- }
53
- }
54
- const kindList = [...kindsInCapture].sort();
55
- for (let i = 0; i < kindList.length; i++) {
56
- for (let j = i + 1; j < kindList.length; j++) {
57
- const key = `${kindList[i]}|${kindList[j]}`;
58
- coOccMap.set(key, (coOccMap.get(key) ?? 0) + 1);
59
- }
60
- }
61
- }
62
- const nodes = [...kindCounts.entries()]
63
- .map(([kind, count]) => ({ kind, count }))
64
- .sort((a, b) => b.count - a.count);
65
- const edges = [...edgeMap.values()]
66
- .map((e) => ({ parent: e.parent, child: e.child, count: e.count, sourceSelectors: [...e.selectors] }))
67
- .sort((a, b) => b.count - a.count);
68
- const coOccurrences = [...coOccMap.entries()]
69
- .map(([key, count]) => {
70
- const [kindA, kindB] = key.split('|');
71
- return { kindA, kindB, count };
72
- })
73
- .sort((a, b) => b.count - a.count);
74
- return { nodes, edges, coOccurrences };
75
- }
76
- export function renderComponentGraphMd(graph) {
77
- const lines = [];
78
- lines.push('# Component Relationship Graph\n');
79
- lines.push('## Component Kinds\n');
80
- lines.push('| Kind | Occurrences |');
81
- lines.push('| --- | --- |');
82
- for (const node of graph.nodes) {
83
- lines.push(`| ${node.kind} | ${node.count} |`);
84
- }
85
- lines.push('');
86
- if (graph.edges.length > 0) {
87
- lines.push('## Parent-Child Relationships\n');
88
- lines.push('| Parent | Child | Captures |');
89
- lines.push('| --- | --- | --- |');
90
- for (const edge of graph.edges) {
91
- lines.push(`| ${edge.parent} | ${edge.child} | ${edge.count} |`);
92
- }
93
- lines.push('');
94
- }
95
- if (graph.coOccurrences.length > 0) {
96
- lines.push('## Co-Occurrences\n');
97
- lines.push('| Component A | Component B | Captures |');
98
- lines.push('| --- | --- | --- |');
99
- for (const co of graph.coOccurrences.slice(0, 30)) {
100
- lines.push(`| ${co.kindA} | ${co.kindB} | ${co.count} |`);
101
- }
102
- lines.push('');
103
- }
104
- return lines.join('\n');
105
- }
106
- //# sourceMappingURL=componentGraph.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"componentGraph.js","sourceRoot":"","sources":["../src/componentGraph.ts"],"names":[],"mappings":"AAqBA,SAAS,mBAAmB,CAAC,YAAoB,EAAE,UAA4B;IAC7E,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,cAAc,CAAC,UAA4B;IAClD,MAAM,WAAW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