rook-cli 1.2.3 → 1.3.2
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/package.json +1 -1
- package/src/mcp/server.js +22 -6
- package/src/templates/block.liquid.txt +25 -2
- package/src/templates/section.liquid.txt +29 -14
- package/src/utils/logger.js +1 -1
package/package.json
CHANGED
package/src/mcp/server.js
CHANGED
|
@@ -93,6 +93,10 @@ const InstallComponentSchema = z.object({
|
|
|
93
93
|
type: z
|
|
94
94
|
.enum(['component', 'kit'])
|
|
95
95
|
.describe('Tipo do pacote: "component" para componente individual, "kit" para kit completo.'),
|
|
96
|
+
projectPath: z
|
|
97
|
+
.string()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe('Obrigatório no Cursor/Claude Desktop: Caminho absoluto para a raiz do projeto (ex: /Users/nome/projeto).'),
|
|
96
100
|
});
|
|
97
101
|
|
|
98
102
|
const GenerateScaffoldSchema = z.object({
|
|
@@ -103,6 +107,10 @@ const GenerateScaffoldSchema = z.object({
|
|
|
103
107
|
elementType: z
|
|
104
108
|
.enum(['section', 'block', 'snippet', 'controller'])
|
|
105
109
|
.describe('Tipo de recurso Shopify a ser gerado.'),
|
|
110
|
+
projectPath: z
|
|
111
|
+
.string()
|
|
112
|
+
.optional()
|
|
113
|
+
.describe('Obrigatório no Cursor/Claude Desktop: Caminho absoluto para a raiz do projeto (ex: /Users/nome/projeto).'),
|
|
106
114
|
});
|
|
107
115
|
|
|
108
116
|
// ═══════════════════════════════════════════════════════════════
|
|
@@ -156,8 +164,8 @@ async function handleListComponents(args) {
|
|
|
156
164
|
* Instala um componente individual ou kit completo no tema do usuário.
|
|
157
165
|
*/
|
|
158
166
|
async function handleInstallComponent(args) {
|
|
159
|
-
const { name, type } = InstallComponentSchema.parse(args);
|
|
160
|
-
const diretorioAtual = process.cwd();
|
|
167
|
+
const { name, type, projectPath } = InstallComponentSchema.parse(args);
|
|
168
|
+
const diretorioAtual = projectPath || process.cwd();
|
|
161
169
|
|
|
162
170
|
if (type === 'kit') {
|
|
163
171
|
// --- Instalação de Kit ---
|
|
@@ -218,7 +226,7 @@ async function handleInstallComponent(args) {
|
|
|
218
226
|
* Gera boilerplate de um componente Liquid (section, block, snippet, controller).
|
|
219
227
|
*/
|
|
220
228
|
async function handleGenerateScaffold(args) {
|
|
221
|
-
const { name, elementType } = GenerateScaffoldSchema.parse(args);
|
|
229
|
+
const { name, elementType, projectPath } = GenerateScaffoldSchema.parse(args);
|
|
222
230
|
|
|
223
231
|
// Normaliza nomes (kebab, Pascal, snake)
|
|
224
232
|
const names = generateNames(name);
|
|
@@ -227,7 +235,7 @@ async function handleGenerateScaffold(args) {
|
|
|
227
235
|
const arquivo = await scaffoldService.generate(elementType, names);
|
|
228
236
|
|
|
229
237
|
// Grava no disco
|
|
230
|
-
const diretorioAtual = process.cwd();
|
|
238
|
+
const diretorioAtual = projectPath || process.cwd();
|
|
231
239
|
|
|
232
240
|
// Garantimos que o caminho seja relativo à pasta onde o comando foi chamado
|
|
233
241
|
// Evita erro de permissão ao tentar criar pastas na raiz do sistema (/)
|
|
@@ -338,8 +346,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
338
346
|
enum: ['component', 'kit'],
|
|
339
347
|
description: 'Tipo do pacote: "component" ou "kit".',
|
|
340
348
|
},
|
|
349
|
+
projectPath: {
|
|
350
|
+
type: 'string',
|
|
351
|
+
description: 'Obrigatório no Cursor/Claude Desktop: Caminho absoluto para a raiz do repositório Shopify que o pacote deve ser instalado.',
|
|
352
|
+
},
|
|
341
353
|
},
|
|
342
|
-
required: ['name', 'type'],
|
|
354
|
+
required: ['name', 'type', 'projectPath'],
|
|
343
355
|
},
|
|
344
356
|
},
|
|
345
357
|
{
|
|
@@ -359,8 +371,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
359
371
|
enum: ['section', 'block', 'snippet', 'controller'],
|
|
360
372
|
description: 'Tipo de recurso Shopify: section, block, snippet ou controller (JS asset).',
|
|
361
373
|
},
|
|
374
|
+
projectPath: {
|
|
375
|
+
type: 'string',
|
|
376
|
+
description: 'Obrigatório no Cursor/Claude Desktop: Caminho absoluto para a raiz do repositório Shopify que a entidade será gerada.',
|
|
377
|
+
},
|
|
362
378
|
},
|
|
363
|
-
required: ['name', 'elementType'],
|
|
379
|
+
required: ['name', 'elementType', 'projectPath'],
|
|
364
380
|
},
|
|
365
381
|
},
|
|
366
382
|
],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{%
|
|
1
|
+
{% comment %}
|
|
2
2
|
Block: {{PascalName}} Block
|
|
3
3
|
Usage: Use inside sections that support blocks.
|
|
4
|
-
{%
|
|
4
|
+
{% endcomment %}
|
|
5
5
|
|
|
6
6
|
{% liquid
|
|
7
7
|
assign block_id = block.id
|
|
@@ -12,6 +12,21 @@
|
|
|
12
12
|
class="{{kebabName}}-block"
|
|
13
13
|
data-block-id="{{ block_id }}"
|
|
14
14
|
{{ block.shopify_attributes }}
|
|
15
|
+
style="
|
|
16
|
+
--bg-color: {{ block.settings.bg_color }};
|
|
17
|
+
--text-color: {{ block.settings.text_color }};
|
|
18
|
+
--title-color: {{ block.settings.title_color }};
|
|
19
|
+
--border-color: {{ block.settings.border_color }};
|
|
20
|
+
--border-radius: {{ block.settings.border_radius }}px;
|
|
21
|
+
--border-width: {{ block.settings.border_width }}px;
|
|
22
|
+
--btn-bg: {{ block.settings.btn_bg_color }};
|
|
23
|
+
--btn-text: {{ block.settings.btn_text_color }};
|
|
24
|
+
--btn-radius: {{ block.settings.btn_border_radius }}px;
|
|
25
|
+
--fs-title-desktop: {{ block.settings.title_size_desktop }}px;
|
|
26
|
+
--fs-text-desktop: {{ block.settings.text_size_desktop }}px;
|
|
27
|
+
--fs-title-mobile: {{ block.settings.title_size_mobile }}px;
|
|
28
|
+
--fs-text-mobile: {{ block.settings.text_size_mobile }}px;
|
|
29
|
+
"
|
|
15
30
|
>
|
|
16
31
|
<div class="{{kebabName}}-block__inner">
|
|
17
32
|
{% if block.settings.title != blank %}
|
|
@@ -20,6 +35,14 @@
|
|
|
20
35
|
</div>
|
|
21
36
|
</{{kebabName}}-block>
|
|
22
37
|
|
|
38
|
+
{% stylesheet %}
|
|
39
|
+
/* Block Styling */
|
|
40
|
+
.{{kebabName}}-block {
|
|
41
|
+
display: block;
|
|
42
|
+
position: relative;
|
|
43
|
+
}
|
|
44
|
+
{% endstylesheet %}
|
|
45
|
+
|
|
23
46
|
{% schema %}
|
|
24
47
|
{
|
|
25
48
|
"name": "{{PascalName}} Block",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{%
|
|
1
|
+
{% comment %}
|
|
2
2
|
Section: {{PascalName}}
|
|
3
3
|
Description: Componente principal controlado via Web Component.
|
|
4
4
|
Architecture:
|
|
5
5
|
- HTML: Semântico com IDs dinâmicos
|
|
6
6
|
- JS: Web Component desacoplado
|
|
7
7
|
- CSS: Scoped ou via Assets
|
|
8
|
-
{%
|
|
8
|
+
{% endcomment %}
|
|
9
9
|
|
|
10
10
|
{% liquid
|
|
11
11
|
assign section_id = section.id
|
|
@@ -16,6 +16,21 @@
|
|
|
16
16
|
id="{{ container_id }}"
|
|
17
17
|
class="{{kebabName}} section-container"
|
|
18
18
|
data-section-id="{{ section_id }}"
|
|
19
|
+
style="
|
|
20
|
+
--bg-color: {{ section.settings.bg_color }};
|
|
21
|
+
--text-color: {{ section.settings.text_color }};
|
|
22
|
+
--title-color: {{ section.settings.title_color }};
|
|
23
|
+
--border-color: {{ section.settings.border_color }};
|
|
24
|
+
--border-radius: {{ section.settings.border_radius }}px;
|
|
25
|
+
--border-width: {{ section.settings.border_width }}px;
|
|
26
|
+
--btn-bg: {{ section.settings.btn_bg_color }};
|
|
27
|
+
--btn-text: {{ section.settings.btn_text_color }};
|
|
28
|
+
--btn-radius: {{ section.settings.btn_border_radius }}px;
|
|
29
|
+
--fs-title-desktop: {{ section.settings.title_size_desktop }}px;
|
|
30
|
+
--fs-text-desktop: {{ section.settings.text_size_desktop }}px;
|
|
31
|
+
--fs-title-mobile: {{ section.settings.title_size_mobile }}px;
|
|
32
|
+
--fs-text-mobile: {{ section.settings.text_size_mobile }}px;
|
|
33
|
+
"
|
|
19
34
|
>
|
|
20
35
|
<div class="{{kebabName}}__wrapper page-width">
|
|
21
36
|
{%- if section.settings.heading != blank -%}
|
|
@@ -28,6 +43,18 @@
|
|
|
28
43
|
</div>
|
|
29
44
|
</{{kebabName}}-section>
|
|
30
45
|
|
|
46
|
+
{% stylesheet %}
|
|
47
|
+
/* BEM Styling */
|
|
48
|
+
.{{kebabName}} {
|
|
49
|
+
display: block;
|
|
50
|
+
position: relative;
|
|
51
|
+
padding: 2rem 0;
|
|
52
|
+
}
|
|
53
|
+
.{{kebabName}}__heading {
|
|
54
|
+
margin-bottom: 1.5rem;
|
|
55
|
+
}
|
|
56
|
+
{% endstylesheet %}
|
|
57
|
+
|
|
31
58
|
{% schema %}
|
|
32
59
|
{
|
|
33
60
|
"name": "{{PascalName}}",
|
|
@@ -54,18 +81,6 @@
|
|
|
54
81
|
}
|
|
55
82
|
{% endschema %}
|
|
56
83
|
|
|
57
|
-
{% stylesheet %}
|
|
58
|
-
/* BEM Styling */
|
|
59
|
-
.{{kebabName}} {
|
|
60
|
-
display: block;
|
|
61
|
-
position: relative;
|
|
62
|
-
padding: 2rem 0;
|
|
63
|
-
}
|
|
64
|
-
.{{kebabName}}__heading {
|
|
65
|
-
margin-bottom: 1.5rem;
|
|
66
|
-
}
|
|
67
|
-
{% endstylesheet %}
|
|
68
|
-
|
|
69
84
|
{% javascript %}
|
|
70
85
|
class {{PascalName}}Section extends HTMLElement {
|
|
71
86
|
constructor() {
|
package/src/utils/logger.js
CHANGED
|
@@ -49,7 +49,7 @@ export class Logger {
|
|
|
49
49
|
banner() {
|
|
50
50
|
console.log('');
|
|
51
51
|
console.log(pc.bold(pc.white(' ╔══════════════════════════════╗')));
|
|
52
|
-
console.log(pc.bold(pc.white(' ║ ♟️ ROOK CLI v1.3.
|
|
52
|
+
console.log(pc.bold(pc.white(' ║ ♟️ ROOK CLI v1.3.2 ║')));
|
|
53
53
|
console.log(pc.bold(pc.white(' ║ Shopify Component Tool ║')));
|
|
54
54
|
console.log(pc.bold(pc.white(' ╚══════════════════════════════╝')));
|
|
55
55
|
console.log('');
|