@promptui-lib/cli 0.1.4 → 0.1.7

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.
@@ -10,10 +10,12 @@ export interface IGenerateOptions {
10
10
  framework?: FrameworkType;
11
11
  preview?: boolean;
12
12
  noMeta?: boolean;
13
+ all?: boolean;
13
14
  }
14
15
  export declare function generateCommand(input: string, options: IGenerateOptions): Promise<void>;
15
16
  /**
16
17
  * Gera todos os componentes marcados com # no arquivo Figma
18
+ * Se --all for passado, exporta todos os frames de nível superior
17
19
  */
18
20
  export declare function generateAllCommand(options: IGenerateOptions): Promise<void>;
19
21
  //# sourceMappingURL=generate.cmd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.cmd.d.ts","sourceRoot":"","sources":["../../src/commands/generate.cmd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAc,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAapF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA0ED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAqJf;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFjF"}
1
+ {"version":3,"file":"generate.cmd.d.ts","sourceRoot":"","sources":["../../src/commands/generate.cmd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAc,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAapF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AA0ED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAqJf;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkGjF"}
@@ -187,9 +187,16 @@ export async function generateCommand(input, options) {
187
187
  }
188
188
  /**
189
189
  * Gera todos os componentes marcados com # no arquivo Figma
190
+ * Se --all for passado, exporta todos os frames de nível superior
190
191
  */
191
192
  export async function generateAllCommand(options) {
192
- console.log('[PromptUI] Generating all exportable components...');
193
+ const exportAll = options.all;
194
+ if (exportAll) {
195
+ console.log('[PromptUI] Generating ALL top-level frames (--all mode)...');
196
+ }
197
+ else {
198
+ console.log('[PromptUI] Generating all exportable components...');
199
+ }
193
200
  // Carrega config
194
201
  const config = await loadConfig();
195
202
  const resolved = resolveConfig(config);
@@ -205,24 +212,35 @@ export async function generateAllCommand(options) {
205
212
  try {
206
213
  const client = createFigmaClient({ token: resolved.figmaToken });
207
214
  const file = await client.getFile(resolved.figmaFileId);
208
- // Encontra todos os nodes exportáveis (começam com #)
215
+ // Encontra todos os nodes exportáveis
209
216
  const exportableNodes = [];
210
- function findExportable(node) {
211
- if (node.name.startsWith('#')) {
217
+ function findExportable(node, depth = 0) {
218
+ // Se --all, exporta frames de nível superior (depth <= 2 = document > page > frame)
219
+ // Se não, apenas os que começam com #
220
+ const isTopLevelFrame = depth === 2 && (node.type === 'FRAME' || node.type === 'COMPONENT');
221
+ const isMarkedForExport = node.name.startsWith('#');
222
+ if (exportAll ? isTopLevelFrame : isMarkedForExport) {
212
223
  exportableNodes.push(node);
213
224
  }
225
+ // Continua buscando em profundidade (para encontrar # em qualquer nível)
214
226
  if (node.children) {
215
227
  for (const child of node.children) {
216
- findExportable(child);
228
+ findExportable(child, depth + 1);
217
229
  }
218
230
  }
219
231
  }
220
232
  if (file.document) {
221
- findExportable(file.document);
233
+ findExportable(file.document, 0);
222
234
  }
223
235
  console.log(`[PromptUI] Found ${exportableNodes.length} exportable components`);
224
236
  if (exportableNodes.length === 0) {
225
- console.log('[PromptUI] No components found. Mark frames with # prefix to export.');
237
+ if (exportAll) {
238
+ console.log('[PromptUI] No top-level frames found in the file.');
239
+ }
240
+ else {
241
+ console.log('[PromptUI] No components found. Mark frames with # prefix to export.');
242
+ console.log('[PromptUI] Or use --all flag to export all top-level frames.');
243
+ }
226
244
  return;
227
245
  }
228
246
  let successCount = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.cmd.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.cmd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAUD;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CASjC;AAyBD;;GAEG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAoDf;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBnD"}
1
+ {"version":3,"file":"mcp.cmd.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.cmd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA8BD;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CASjC;AAyBD;;GAEG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAoDf;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBnD"}
@@ -10,6 +10,26 @@ const AVAILABLE_AGENTS = {
10
10
  description: 'Gera componentes React a partir de JSON do Figma (100% determinístico)',
11
11
  promptFile: '.claude/agents/promptui-figma-codegen.md',
12
12
  },
13
+ codegen: {
14
+ name: 'promptui-codegen',
15
+ description: 'Gera componentes a partir do Figma para qualquer framework suportado',
16
+ promptFile: '.claude/agents/promptui-codegen.md',
17
+ },
18
+ 'code-review': {
19
+ name: 'promptui-code-review',
20
+ description: 'Revisa código gerado e sugere melhorias (tokens, a11y, TypeScript, BEM)',
21
+ promptFile: '.claude/agents/promptui-code-review.md',
22
+ },
23
+ 'token-sync': {
24
+ name: 'promptui-token-sync',
25
+ description: 'Sincroniza design tokens do Figma para CSS/SCSS/Tailwind/MUI',
26
+ promptFile: '.claude/agents/promptui-token-sync.md',
27
+ },
28
+ 'design-lint': {
29
+ name: 'promptui-design-lint',
30
+ description: 'Valida designs no Figma antes de gerar código (Auto Layout, naming, etc)',
31
+ promptFile: '.claude/agents/promptui-design-lint.md',
32
+ },
13
33
  };
14
34
  /**
15
35
  * Lista agentes disponíveis
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsEH,wBAAsB,GAAG,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAkH/E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyEH,wBAAsB,GAAG,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAoH/E"}
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ Commands:
18
18
  init Initialize configuration file
19
19
  agent Start the MCP agent server
20
20
  generate Generate all #marked components (React + SCSS)
21
+ generate --all Generate ALL top-level frames (no # required)
21
22
  generate mui Generate all #marked components (Material UI)
22
23
  generate tailwind Generate all #marked components (Tailwind CSS)
23
24
  generate bootstrap Generate all #marked components (Bootstrap)
@@ -37,6 +38,7 @@ Options:
37
38
  --layer, -l Force layer (atoms|molecules|organisms)
38
39
  --preview, -p Preview output without writing files
39
40
  --no-meta Skip generating meta.json
41
+ --all, -a Export all top-level frames (no # prefix required)
40
42
 
41
43
  Frameworks:
42
44
  react React + SCSS with BEM methodology (default)
@@ -49,9 +51,10 @@ Frameworks:
49
51
  Examples:
50
52
  promptui init # Create promptui.config.json
51
53
  promptui agent # Start agent on port 17890
52
- promptui generate # Generate all (React + SCSS)
54
+ promptui generate # Generate all #marked components
55
+ promptui generate --all # Generate ALL frames (no # needed)
53
56
  promptui generate mui # Generate all (Material UI)
54
- promptui generate tailwind # Generate all (Tailwind CSS)
57
+ promptui generate tailwind --all # Generate ALL frames (Tailwind)
55
58
  promptui generate bootstrap # Generate all (Bootstrap)
56
59
  promptui generate flutter # Generate all (Flutter)
57
60
  promptui generate swiftui # Generate all (SwiftUI)
@@ -79,6 +82,7 @@ export async function run(args = process.argv.slice(2)) {
79
82
  framework: { type: 'string', short: 'F' },
80
83
  preview: { type: 'boolean', short: 'p' },
81
84
  'no-meta': { type: 'boolean' },
85
+ all: { type: 'boolean', short: 'a' },
82
86
  },
83
87
  allowPositionals: true,
84
88
  });
@@ -121,8 +125,9 @@ export async function run(args = process.argv.slice(2)) {
121
125
  framework,
122
126
  preview: values.preview,
123
127
  noMeta: values['no-meta'],
128
+ all: values.all,
124
129
  };
125
- if (generateAll) {
130
+ if (generateAll || values.all) {
126
131
  await generateAllCommand(generateOptions);
127
132
  }
128
133
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptui-lib/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "description": "CLI for PromptUI - Figma to React code generator",
6
6
  "license": "UNLICENSED",
@@ -45,10 +45,10 @@
45
45
  "bin"
46
46
  ],
47
47
  "dependencies": {
48
- "@promptui-lib/core": "0.1.4",
49
- "@promptui-lib/figma-parser": "0.1.4",
50
- "@promptui-lib/codegen": "0.1.4",
51
- "@promptui-lib/mcp-agent": "0.1.4"
48
+ "@promptui-lib/core": "0.1.7",
49
+ "@promptui-lib/figma-parser": "0.1.7",
50
+ "@promptui-lib/codegen": "0.1.7",
51
+ "@promptui-lib/mcp-agent": "0.1.7"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^20.0.0",