@auto-engineer/design-system-importer 0.10.2 → 0.10.3

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 (44) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +3 -3
  3. package/.turbo/turbo-build.log +0 -5
  4. package/.turbo/turbo-format.log +0 -4
  5. package/.turbo/turbo-lint.log +0 -4
  6. package/.turbo/turbo-test.log +0 -13
  7. package/.turbo/turbo-type-check.log +0 -4
  8. package/dist/src/FigmaComponentsBuilder.d.ts +0 -17
  9. package/dist/src/FigmaComponentsBuilder.d.ts.map +0 -1
  10. package/dist/src/FigmaComponentsBuilder.js +0 -287
  11. package/dist/src/FigmaComponentsBuilder.js.map +0 -1
  12. package/dist/src/commands/import-design-system.d.ts +0 -27
  13. package/dist/src/commands/import-design-system.d.ts.map +0 -1
  14. package/dist/src/commands/import-design-system.js +0 -126
  15. package/dist/src/commands/import-design-system.js.map +0 -1
  16. package/dist/src/figma-api.d.ts +0 -6
  17. package/dist/src/figma-api.d.ts.map +0 -1
  18. package/dist/src/figma-api.js +0 -38
  19. package/dist/src/figma-api.js.map +0 -1
  20. package/dist/src/figma-importer.d.ts +0 -8
  21. package/dist/src/figma-importer.d.ts.map +0 -1
  22. package/dist/src/figma-importer.js +0 -79
  23. package/dist/src/figma-importer.js.map +0 -1
  24. package/dist/src/file-operations.d.ts +0 -4
  25. package/dist/src/file-operations.d.ts.map +0 -1
  26. package/dist/src/file-operations.js +0 -102
  27. package/dist/src/file-operations.js.map +0 -1
  28. package/dist/src/index.d.ts +0 -16
  29. package/dist/src/index.d.ts.map +0 -1
  30. package/dist/src/index.js +0 -8
  31. package/dist/src/index.js.map +0 -1
  32. package/dist/src/markdown-generator.d.ts +0 -7
  33. package/dist/src/markdown-generator.d.ts.map +0 -1
  34. package/dist/src/markdown-generator.js +0 -44
  35. package/dist/src/markdown-generator.js.map +0 -1
  36. package/dist/src/utils/FilterLoader.d.ts +0 -13
  37. package/dist/src/utils/FilterLoader.d.ts.map +0 -1
  38. package/dist/src/utils/FilterLoader.js +0 -250
  39. package/dist/src/utils/FilterLoader.js.map +0 -1
  40. package/dist/src/utils/templates/tsx-export.mjs +0 -17
  41. package/dist/src/utils/templates/tsx-final-loader.mjs +0 -10
  42. package/dist/src/utils/templates/tsx-loader.mjs +0 -48
  43. package/dist/src/utils/templates/tsx-wrapper.mjs +0 -15
  44. package/dist/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @auto-engineer/design-system-importer
2
2
 
3
+ ## 0.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @auto-engineer/message-bus@0.10.3
9
+
3
10
  ## 0.10.2
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -15,12 +15,12 @@
15
15
  "dependencies": {
16
16
  "figma-api": "2.0.2-beta",
17
17
  "tsx": "^3.12.7",
18
- "@auto-engineer/message-bus": "0.10.2"
18
+ "@auto-engineer/message-bus": "0.10.3"
19
19
  },
20
20
  "devDependencies": {
21
- "@auto-engineer/cli": "0.10.2"
21
+ "@auto-engineer/cli": "0.10.3"
22
22
  },
23
- "version": "0.10.2",
23
+ "version": "0.10.3",
24
24
  "scripts": {
25
25
  "start": "tsx src/index.ts",
26
26
  "build": "tsc && tsx ../../scripts/fix-esm-imports.ts && cp -r src/utils/templates dist/src/utils/",
@@ -1,5 +0,0 @@
1
-
2
- > @auto-engineer/design-system-importer@0.10.2 build /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
3
- > tsc && tsx ../../scripts/fix-esm-imports.ts && cp -r src/utils/templates dist/src/utils/
4
-
5
- Fixed ESM imports in dist/
@@ -1,4 +0,0 @@
1
-
2
- > @auto-engineer/design-system-importer@0.10.1 format /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
3
- > prettier --write "**/*.{js,ts,json,md,yml,yaml}" --ignore-path ../../.prettierignore --log-level warn
4
-
@@ -1,4 +0,0 @@
1
-
2
- > @auto-engineer/design-system-importer@0.10.1 lint /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
3
- > eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts
4
-
@@ -1,13 +0,0 @@
1
-
2
- > @auto-engineer/design-system-importer@0.10.2 test /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
3
- > vitest run --reporter=dot
4
-
5
-
6
- RUN v3.2.4 /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
7
-
8
-
9
- No test files found, exiting with code 0
10
-
11
- include: **/*.specs.{js,ts}
12
- exclude: **/.tmp/**, **/node_modules/**, **/dist/**, **/examples/**, **/create-auto-app/templates/**, **/*-starter/**, **/vite.config.ts
13
-
@@ -1,4 +0,0 @@
1
-
2
- > @auto-engineer/design-system-importer@0.10.2 type-check /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
3
- > tsc --noEmit
4
-
@@ -1,17 +0,0 @@
1
- export interface FigmaComponent {
2
- name: string;
3
- description: string;
4
- thumbnail: string;
5
- }
6
- export type FilterFunctionType = (components: FigmaComponent[]) => FigmaComponent[];
7
- export declare class FigmaComponentsBuilder {
8
- components: FigmaComponent[];
9
- constructor();
10
- withFigmaComponents(): Promise<this>;
11
- withFigmaComponentSets(): Promise<this>;
12
- withFilteredNamesForShadcn(): void;
13
- withFilter(filter: FilterFunctionType): void;
14
- withAllFigmaInstanceNames(): Promise<this>;
15
- build(): FigmaComponent[];
16
- }
17
- //# sourceMappingURL=FigmaComponentsBuilder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FigmaComponentsBuilder.d.ts","sourceRoot":"","sources":["../../src/FigmaComponentsBuilder.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAC;AAUpF,qBAAa,sBAAsB;IACjC,UAAU,EAAE,cAAc,EAAE,CAAM;;IAO5B,mBAAmB;IA8CnB,sBAAsB;IA2D5B,0BAA0B,IAAI,IAAI;IAwClC,UAAU,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAYtC,yBAAyB;IAwH/B,KAAK;CASN"}
@@ -1,287 +0,0 @@
1
- import * as dotenv from 'dotenv';
2
- import * as Figma from 'figma-api';
3
- import createDebug from 'debug';
4
- const debug = createDebug('design-system-importer:figma-builder');
5
- const debugComponents = createDebug('design-system-importer:figma-builder:components');
6
- const debugFilters = createDebug('design-system-importer:figma-builder:filters');
7
- const debugAPI = createDebug('design-system-importer:figma-builder:api');
8
- const debugTree = createDebug('design-system-importer:figma-builder:tree');
9
- dotenv.config();
10
- debug('Initializing FigmaComponentsBuilder module');
11
- // Add timeout wrapper for Figma API calls
12
- const withTimeout = (promise, timeoutMs = 10000) => {
13
- return Promise.race([
14
- promise,
15
- new Promise((_, reject) => setTimeout(() => reject(new Error(`Figma API request timed out after ${timeoutMs}ms`)), timeoutMs)),
16
- ]);
17
- };
18
- const figmaApi = new Figma.Api({
19
- personalAccessToken: process.env.FIGMA_PERSONAL_TOKEN,
20
- });
21
- debug('Figma API initialized with personal access token');
22
- export class FigmaComponentsBuilder {
23
- constructor() {
24
- this.components = [];
25
- debug('FigmaComponentsBuilder instance created');
26
- debugComponents('Initial components array: empty');
27
- }
28
- async withFigmaComponents() {
29
- debugAPI('Fetching Figma components from file: %s', process.env.FIGMA_FILE_ID);
30
- if (process.env.FIGMA_PERSONAL_TOKEN?.trim() === '' ||
31
- process.env.FIGMA_FILE_ID?.trim() === '' ||
32
- process.env.FIGMA_PERSONAL_TOKEN === undefined ||
33
- process.env.FIGMA_FILE_ID === undefined) {
34
- debugAPI('Missing Figma credentials. FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID not set');
35
- console.warn('Skipping Figma import: Missing FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID in environment');
36
- return this;
37
- }
38
- try {
39
- debugAPI('Making API call to getFileComponents...');
40
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
41
- const response = await withTimeout(figmaApi.getFileComponents({ file_key: process.env.FIGMA_FILE_ID }), 10000);
42
- debugAPI('API response received');
43
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
44
- if (response.meta.components.length > 0) {
45
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
46
- debugComponents('Found %d components in Figma file', response.meta.components.length);
47
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
48
- this.components = response.meta.components.map((component) => {
49
- debugComponents('Processing component: %s', component.name);
50
- return {
51
- name: component.name,
52
- description: component.description,
53
- thumbnail: component.thumbnail_url,
54
- };
55
- });
56
- debugComponents('Successfully mapped %d components', this.components.length);
57
- }
58
- else {
59
- debugComponents('No components found in Figma file');
60
- }
61
- }
62
- catch (e) {
63
- debugAPI('ERROR: Failed to fetch Figma components: %O', e);
64
- console.error('Failed to fetch Figma components:', e);
65
- }
66
- debugComponents('withFigmaComponents complete, total components: %d', this.components.length);
67
- return this;
68
- }
69
- async withFigmaComponentSets() {
70
- debugAPI('Fetching Figma component sets from file: %s', process.env.FIGMA_FILE_ID);
71
- if (process.env.FIGMA_PERSONAL_TOKEN?.trim() === '' ||
72
- process.env.FIGMA_FILE_ID?.trim() === '' ||
73
- process.env.FIGMA_PERSONAL_TOKEN === undefined ||
74
- process.env.FIGMA_FILE_ID === undefined) {
75
- debugAPI('Missing Figma credentials. FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID not set');
76
- console.warn('Skipping Figma import: Missing FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID in environment');
77
- return this;
78
- }
79
- try {
80
- debugAPI('Making API call to getFileComponentSets...');
81
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
82
- const response = await withTimeout(figmaApi.getFileComponentSets({ file_key: process.env.FIGMA_FILE_ID }), 10000);
83
- debugAPI('API response received');
84
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
85
- if (response.meta.component_sets.length > 0) {
86
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
87
- debugComponents('Found %d component sets in Figma file', response.meta.component_sets.length);
88
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
89
- this.components = response.meta.component_sets.map((component) => {
90
- debugComponents('Processing component set: %s', component.name);
91
- const mapped = {
92
- name: component.name,
93
- description: component.description ?? 'N/A',
94
- thumbnail: component.thumbnail_url ?? 'N/A',
95
- };
96
- debugComponents(' - Description: %s', mapped.description.substring(0, 50));
97
- debugComponents(' - Has thumbnail: %s', mapped.thumbnail !== 'N/A');
98
- return mapped;
99
- });
100
- debugComponents('Successfully mapped %d component sets', this.components.length);
101
- }
102
- else {
103
- debugComponents('No component sets found in Figma file');
104
- }
105
- }
106
- catch (e) {
107
- debugAPI('ERROR: Failed to fetch Figma component sets: %O', e);
108
- console.error('Failed to fetch Figma component sets:', e);
109
- }
110
- debugComponents('withFigmaComponentSets complete, total components: %d', this.components.length);
111
- return this;
112
- }
113
- // extractBracketedComponents(item: FigmaComponent): FigmaComponent | null {
114
- // const match = item.name.match(/<([^>]+)>/);
115
- // return match ? { ...item, name: match[1].trim() } : null;
116
- // }
117
- //
118
- // withFilteredNamesForMui() {
119
- // // eslint-disable-next-line @typescript-eslint/unbound-method
120
- // this.components = this.components.map(this.extractBracketedComponents).filter(Boolean) as FigmaComponent[];
121
- // }
122
- withFilteredNamesForShadcn() {
123
- debugFilters('Applying Shadcn name filter to %d components', this.components.length);
124
- const originalCount = this.components.length;
125
- this.components = this.components
126
- .map((comp) => {
127
- if (!comp?.name) {
128
- debugFilters('Skipping component with no name');
129
- return null;
130
- }
131
- let str = comp.name.trim();
132
- debugFilters('Processing component name: %s', str);
133
- if (str.includes('/')) {
134
- const original = str;
135
- str = str.split('/')[0].trim();
136
- debugFilters(' Split by /: %s -> %s', original, str);
137
- }
138
- else {
139
- const original = str;
140
- str = str.split(' ')[0].trim();
141
- debugFilters(' Split by space: %s -> %s', original, str);
142
- }
143
- if (str.length > 0) {
144
- const capitalized = str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
145
- const final = capitalized.toLowerCase();
146
- debugFilters(' Normalized: %s -> %s', str, final);
147
- return {
148
- ...comp,
149
- name: final,
150
- };
151
- }
152
- else {
153
- debugFilters(' Empty string after processing, skipping');
154
- return null;
155
- }
156
- })
157
- .filter((c) => Boolean(c));
158
- debugFilters('Shadcn filter complete: %d -> %d components', originalCount, this.components.length);
159
- }
160
- withFilter(filter) {
161
- debugFilters('Applying custom filter function to %d components', this.components.length);
162
- const originalCount = this.components.length;
163
- try {
164
- this.components = filter(this.components);
165
- debugFilters('Custom filter applied successfully: %d -> %d components', originalCount, this.components.length);
166
- }
167
- catch (e) {
168
- debugFilters('ERROR: Failed to apply custom filter: %O', e);
169
- console.error('Error applying custom filter:', e);
170
- }
171
- }
172
- async withAllFigmaInstanceNames() {
173
- debugAPI('Fetching all Figma instance names from file: %s', process.env.FIGMA_FILE_ID);
174
- if (process.env.FIGMA_PERSONAL_TOKEN?.trim() === '' ||
175
- process.env.FIGMA_FILE_ID?.trim() === '' ||
176
- process.env.FIGMA_PERSONAL_TOKEN === undefined ||
177
- process.env.FIGMA_FILE_ID === undefined) {
178
- debugAPI('Missing Figma credentials. FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID not set');
179
- console.warn('Skipping Figma import: Missing FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID in environment');
180
- return this;
181
- }
182
- try {
183
- /// ----
184
- const usedComponentMap = new Map();
185
- debugTree('Created component map for tracking unique instances');
186
- debugAPI('Making API call to getFile with depth: 1...');
187
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
188
- const { document } = await withTimeout(figmaApi.getFile({
189
- file_key: process.env.FIGMA_FILE_ID,
190
- depth: 1,
191
- }), 10000);
192
- debugAPI('File document received, starting tree walk');
193
- // eslint-disable-next-line complexity
194
- function walkTree(node, depth = 0) {
195
- const indent = ' '.repeat(depth);
196
- debugTree('%sVisiting node: %s (type: %s)', indent, node.name, node.type);
197
- if (node.type === 'INSTANCE' && Boolean(node.name)) {
198
- if (!usedComponentMap.has(node.name)) {
199
- debugTree('%s -> Found new instance: %s', indent, node.name);
200
- usedComponentMap.set(node.name, {
201
- name: node.name,
202
- description: node.description ?? '',
203
- thumbnail: node.thumbnail_url ?? '',
204
- });
205
- debugTree('%s Description: %s', indent, node.description ? 'present' : 'empty');
206
- debugTree('%s Thumbnail: %s', indent, node.thumbnail_url ? 'present' : 'missing');
207
- }
208
- else {
209
- debugTree('%s -> Instance already tracked: %s', indent, node.name);
210
- }
211
- }
212
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
213
- if (node.children) {
214
- debugTree('%s Has %d children', indent, node.children.length);
215
- for (const child of node.children) {
216
- walkTree(child, depth + 1);
217
- }
218
- }
219
- }
220
- debugTree('Starting tree walk from document root');
221
- walkTree(document);
222
- debugTree('Tree walk complete');
223
- this.components = Array.from(usedComponentMap.values());
224
- debugComponents('Extracted %d unique component instances', this.components.length);
225
- /// ----
226
- // const components = []
227
- // // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
228
- // const { meta } = await figmaApi.getFileComponentSets({ file_key: process.env.FIGMA_FILE_ID });
229
- // // console.log(response);
230
- //
231
- // console.log('Component sets:', meta.component_sets); // ⬅️ Check this!
232
- //
233
- // const componentSetIds = meta.component_sets.map(componentSet => componentSet.node_id); // This must return valid Figma node IDs
234
- //
235
- // console.log('ComponentSet IDs:', componentSetIds);
236
- //
237
- // const fileNodes = await figmaApi.getFileNodes({
238
- // file_key: process.env.FIGMA_FILE_ID,
239
- // }, {
240
- // ids: componentSetIds.join(','),
241
- // });
242
- //
243
- // for (const node of Object.values(fileNodes.nodes)) {
244
- // const componentSet = node.document;
245
- //
246
- // if (componentSet.type === 'COMPONENT_SET' && componentSet.children?.length) {
247
- // const variants = componentSet.children;
248
- // const firstVariant = variants[0]; // or apply filtering logic
249
- //
250
- // components.push({
251
- // name: componentSet.name, // e.g. "Button"
252
- // id: firstVariant.id, // this is the actual variant node
253
- // variantName: firstVariant.name // e.g. "primary=true, size=md"
254
- // });
255
- // }
256
- // }
257
- //
258
- // fs.writeFileSync('output.json', JSON.stringify(components, null, 2));
259
- // if (Boolean(response)) {
260
- // // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
261
- // this.components = response.meta.component_sets.map(
262
- // (component: { name: string; description: string; thumbnail_url: string }) => ({
263
- // name: component.name,
264
- // description: component.description,
265
- // thumbnail_url: component.thumbnail_url,
266
- // }),
267
- // );
268
- // }
269
- }
270
- catch (e) {
271
- debugAPI('ERROR: Failed to fetch Figma instance names: %O', e);
272
- console.error('Failed to fetch Figma instance names:', e);
273
- }
274
- debugComponents('withAllFigmaInstanceNames complete, total components: %d', this.components.length);
275
- return this;
276
- }
277
- build() {
278
- debug('Building final component list');
279
- debugComponents('Returning %d components', this.components.length);
280
- if (this.components.length > 0) {
281
- debugComponents('First component: %s', this.components[0].name);
282
- debugComponents('Last component: %s', this.components[this.components.length - 1].name);
283
- }
284
- return this.components;
285
- }
286
- }
287
- //# sourceMappingURL=FigmaComponentsBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FigmaComponentsBuilder.js","sourceRoot":"","sources":["../../src/FigmaComponentsBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AACnC,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,sCAAsC,CAAC,CAAC;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AoE;YACpE,EAAE;YACF,wBAAwB;YACxB,wDAAwD;YACxD,0EAA0E;YAC1E,uEAAuE;YACvE,UAAU;YACV,MAAM;YACN,IAAI;YACJ,EAAE;YACF,wEAAwE;YAExE,2BAA2B;YAC3B,qJAAqJ;YACrJ,wDAAwD;YACxD,sFAAsF;YACtF,8BAA8B;YAC9B,4CAA4C;YAC5C,gDAAgD;YAChD,UAAU;YACV,OAAO;YACP,IAAI;QACN,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,QAAQ,CAAC,iDAAiD,EAAE,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,eAAe,CAAC,0DAA0D,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpG,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACvC,eAAe,CAAC,yBAAyB,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,eAAe,CAAC,qBAAqB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAChE,eAAe,CAAC,oBAAoB,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1F,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
@@ -1,27 +0,0 @@
1
- import { type Command, type Event } from '@auto-engineer/message-bus';
2
- import { ImportStrategy } from '../index';
3
- export type ImportDesignSystemCommand = Command<'ImportDesignSystem', {
4
- outputDir: string;
5
- strategy?: keyof typeof ImportStrategy;
6
- filterPath?: string;
7
- }>;
8
- export type DesignSystemImportedEvent = Event<'ImportDesignSystemCompleted', {
9
- outputDir: string;
10
- }>;
11
- export type DesignSystemImportFailedEvent = Event<'ImportDesignSystemFailed', {
12
- error: string;
13
- outputDir: string;
14
- }>;
15
- export declare const commandHandler: import("@auto-engineer/message-bus").UnifiedCommandHandler<Readonly<{
16
- type: "ImportDesignSystem";
17
- data: Readonly<{
18
- outputDir: string;
19
- strategy?: keyof typeof ImportStrategy;
20
- filterPath?: string;
21
- }>;
22
- timestamp?: Date;
23
- requestId?: string;
24
- correlationId?: string;
25
- }>>;
26
- export default commandHandler;
27
- //# sourceMappingURL=import-design-system.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"import-design-system.d.ts","sourceRoot":"","sources":["../../../src/commands/import-design-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAwB,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAyC,cAAc,EAA2B,MAAM,UAAU,CAAC;AAS1G,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,oBAAoB,EACpB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,6BAA6B,EAC7B;IACE,SAAS,EAAE,MAAM,CAAC;CACnB,CACF,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,KAAK,CAC/C,0BAA0B,EAC1B;IACE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CACF,CAAC;AAEF,eAAO,MAAM,cAAc;;;mBArBZ,MAAM;mBACN,MAAM,OAAO,cAAc;qBACzB,MAAM;;;;;GAyDrB,CAAC;AA+FH,eAAe,cAAc,CAAC"}
@@ -1,126 +0,0 @@
1
- import { defineCommandHandler } from '@auto-engineer/message-bus';
2
- import { importDesignSystemComponentsFromFigma, ImportStrategy } from '../index.js';
3
- import { FilterLoader } from '../utils/FilterLoader.js';
4
- import createDebug from 'debug';
5
- const debug = createDebug('design-system-importer:command');
6
- const debugFilter = createDebug('design-system-importer:command:filter');
7
- const debugHandler = createDebug('design-system-importer:command:handler');
8
- const debugResult = createDebug('design-system-importer:command:result');
9
- export const commandHandler = defineCommandHandler({
10
- name: 'ImportDesignSystem',
11
- alias: 'import:design-system',
12
- description: 'Import Figma design system',
13
- category: 'import',
14
- icon: 'palette',
15
- fields: {
16
- outputDir: {
17
- description: 'Source directory for design system',
18
- required: true,
19
- },
20
- strategy: {
21
- description: 'Import mode (e.g., WITH_COMPONENT_SETS)',
22
- },
23
- filterPath: {
24
- description: 'Optional filter file',
25
- },
26
- },
27
- examples: [
28
- '$ auto import:design-system --output-dir=./.context --strategy=WITH_COMPONENT_SETS --filter-path=./shadcn-filter.ts',
29
- ],
30
- events: ['ImportDesignSystemCompleted', 'ImportDesignSystemFailed'],
31
- handle: async (command) => {
32
- const typedCommand = command;
33
- debug('CommandHandler executing for ImportDesignSystem');
34
- const result = await handleImportDesignSystemCommandInternal(typedCommand);
35
- if (result.type === 'ImportDesignSystemCompleted') {
36
- debug('Command handler completed: success');
37
- debugResult('Design system imported successfully to %s', result.data.outputDir);
38
- }
39
- else {
40
- debug('Command handler completed: failure - %s', result.data.error);
41
- debugResult('Failed: %s', result.data.error);
42
- }
43
- return result;
44
- },
45
- });
46
- // Handler
47
- async function loadFilterFunction(filterPath) {
48
- if (typeof filterPath !== 'string' || filterPath.trim().length === 0) {
49
- debugFilter('No filter path provided, proceeding without custom filter');
50
- return undefined;
51
- }
52
- debugFilter('Loading custom filter from: %s', filterPath);
53
- let loader;
54
- try {
55
- loader = new FilterLoader();
56
- debugFilter('FilterLoader instance created');
57
- const filterFn = await loader.loadFilter(filterPath);
58
- debugFilter('Filter function loaded successfully');
59
- return filterFn;
60
- }
61
- catch (e) {
62
- debugFilter('ERROR: Failed to load filter from %s: %O', filterPath, e);
63
- debugFilter('WARNING: Could not import filter from %s. Skipping custom filter. Error: %O', filterPath, e);
64
- return undefined;
65
- }
66
- finally {
67
- if (loader) {
68
- debugFilter('Cleaning up FilterLoader');
69
- loader.cleanup();
70
- }
71
- }
72
- }
73
- function createSuccessEvent(command, outputDir) {
74
- const successEvent = {
75
- type: 'ImportDesignSystemCompleted',
76
- data: { outputDir },
77
- timestamp: new Date(),
78
- requestId: command.requestId,
79
- correlationId: command.correlationId,
80
- };
81
- debugResult('Returning success event: DesignSystemImported');
82
- debugResult(' Output directory: %s', outputDir);
83
- return successEvent;
84
- }
85
- function createFailureEvent(command, error, outputDir) {
86
- const errorMessage = error instanceof Error ? error.message : String(error);
87
- debugHandler('ERROR: Design system import failed: %O', error);
88
- debugResult('Error message: %s', errorMessage);
89
- const failureEvent = {
90
- type: 'ImportDesignSystemFailed',
91
- data: { error: errorMessage, outputDir },
92
- timestamp: new Date(),
93
- requestId: command.requestId,
94
- correlationId: command.correlationId,
95
- };
96
- debugResult('Returning failure event: ImportDesignSystemFailed');
97
- debugResult(' Error: %s', errorMessage);
98
- debugResult(' Output directory: %s', outputDir);
99
- return failureEvent;
100
- }
101
- // Handler
102
- async function handleImportDesignSystemCommandInternal(command) {
103
- const { outputDir, strategy, filterPath } = command.data;
104
- debug('Handling ImportDesignSystemCommand');
105
- debug(' Output directory: %s', outputDir);
106
- debug(' Strategy: %s', strategy ?? 'default');
107
- debug(' Filter path: %s', filterPath ?? 'none');
108
- debug(' Request ID: %s', command.requestId);
109
- debug(' Correlation ID: %s', command.correlationId ?? 'none');
110
- try {
111
- const resolvedStrategy = strategy ? ImportStrategy[strategy] : ImportStrategy.WITH_COMPONENT_SETS;
112
- debugHandler('Resolved strategy: %s', resolvedStrategy);
113
- const filterFn = await loadFilterFunction(filterPath);
114
- debugHandler('Calling importDesignSystemComponentsFromFigma...');
115
- await importDesignSystemComponentsFromFigma(outputDir, resolvedStrategy, filterFn);
116
- debugHandler('Import completed successfully');
117
- debugHandler('Design system files processed to %s', outputDir);
118
- return createSuccessEvent(command, outputDir);
119
- }
120
- catch (error) {
121
- return createFailureEvent(command, error, outputDir);
122
- }
123
- }
124
- // Default export is the command handler
125
- export default commandHandler;
126
- //# sourceMappingURL=import-design-system.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"import-design-system.js","sourceRoot":"","sources":["../../../src/commands/import-design-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,qCAAqC,EAAE,cAAc,EAA2B,MAAM,UAAU,CAAC;AAC1G,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,gCAAgC,CAAC,CAAC;AAC5D,MAAM,WAAW,GAAG,WAAW,CAAC,uCAAuC,CAAC,CAAC;AACzE,MAAM,YAAY,GAAG,WAAW,CAAC,wCAAwC,CAAC,CAAC;AAC3E,MAAM,WAAW,GAAG,WAAW,CAAC,uCAAuC,CAAC,CAAC;AA0BzE,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAGhD;IACA,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,sBAAsB;IAC7B,WAAW,EAAE,4BAA4B;IACzC,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE;QACN,SAAS,EAAE;YACT,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,yCAAyC;SACvD;QACD,UAAU,EAAE;YACV,WAAW,EAAE,sBAAsB;SACpC;KACF;IACD,QAAQ,EAAE;QACR,qHAAqH;KACtH;IACD,MAAM,EAAE,CAAC,6BAA6B,EAAE,0BAA0B,CAAC;IACnE,MAAM,EAAE,KAAK,EAAE,OAAgB,EAAsE,EAAE;QACrG,MAAM,YAAY,G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
1
- export declare function getFigmaComponents(): Promise<{
2
- name: string;
3
- description: string;
4
- thumbnail: string;
5
- }[]>;
6
- //# sourceMappingURL=figma-api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"figma-api.d.ts","sourceRoot":"","sources":["../../src/figma-api.ts"],"names":[],"mappings":"AAcA,wBAAsB,kBAAkB,IAAI,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CA+B9G"}
@@ -1,38 +0,0 @@
1
- import * as dotenv from 'dotenv';
2
- import * as Figma from 'figma-api';
3
- import createDebug from 'debug';
4
- dotenv.config();
5
- const debugFigma = createDebug('design-system-importer:figma');
6
- debugFigma('Initializing Figma API with personal access token');
7
- const api = new Figma.Api({
8
- personalAccessToken: process.env.FIGMA_PERSONAL_TOKEN,
9
- });
10
- debugFigma('Figma API initialized');
11
- export async function getFigmaComponents() {
12
- debugFigma('Fetching Figma components from file: %s', process.env.FIGMA_FILE_ID);
13
- let components = [];
14
- try {
15
- debugFigma('Making API call to Figma...');
16
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
17
- const response = await api.getFileComponentSets({ file_key: process.env.FIGMA_FILE_ID });
18
- debugFigma('Figma API response received');
19
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
20
- components = response.meta.component_sets.map((component) => {
21
- debugFigma('Processing component: %s', component.name);
22
- return {
23
- name: component.name,
24
- description: component.description,
25
- thumbnail: component.thumbnail_url,
26
- };
27
- });
28
- debugFigma('Successfully fetched %d components from Figma', components.length);
29
- console.log('figma response: ', response);
30
- }
31
- catch (e) {
32
- debugFigma('ERROR: Failed to fetch Figma components: %O', e);
33
- console.error(e);
34
- }
35
- console.log(components.length);
36
- return components;
37
- }
38
- //# sourceMappingURL=figma-api.js.map
@@ -1 +0,0 @@
1
-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AAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/E,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,UAAU,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAC;QAC7D,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,8 +0,0 @@
1
- import { type FilterFunctionType } from './FigmaComponentsBuilder.js';
2
- export declare enum ImportStrategy {
3
- WITH_COMPONENTS = "WITH_COMPONENTS",
4
- WITH_COMPONENT_SETS = "WITH_COMPONENT_SETS",
5
- WITH_ALL_FIGMA_INSTANCES = "WITH_ALL_FIGMA_INSTANCES"
6
- }
7
- export declare function importDesignSystemComponentsFromFigma(outputDir: string, strategy?: ImportStrategy, filterFn?: FilterFunctionType): Promise<void>;
8
- //# sourceMappingURL=figma-importer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"figma-importer.d.ts","sourceRoot":"","sources":["../../src/figma-importer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAQtE,oBAAY,cAAc;IACxB,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,wBAAwB,6BAA6B;CACtD;AAED,wBAAsB,qCAAqC,CACzD,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,cAAmD,EAC7D,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA8Ef"}