@ikas/component-cli 0.15.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 (55) hide show
  1. package/bin/create-ikas-component.js +8 -0
  2. package/bin/ikas-component.js +8 -0
  3. package/dist/commands/add.d.ts +3 -0
  4. package/dist/commands/add.d.ts.map +1 -0
  5. package/dist/commands/add.js +156 -0
  6. package/dist/commands/add.js.map +1 -0
  7. package/dist/commands/build.d.ts +3 -0
  8. package/dist/commands/build.d.ts.map +1 -0
  9. package/dist/commands/build.js +273 -0
  10. package/dist/commands/build.js.map +1 -0
  11. package/dist/commands/create.d.ts +4 -0
  12. package/dist/commands/create.d.ts.map +1 -0
  13. package/dist/commands/create.js +572 -0
  14. package/dist/commands/create.js.map +1 -0
  15. package/dist/commands/dev.d.ts +3 -0
  16. package/dist/commands/dev.d.ts.map +1 -0
  17. package/dist/commands/dev.js +381 -0
  18. package/dist/commands/dev.js.map +1 -0
  19. package/dist/commands/publish.d.ts +3 -0
  20. package/dist/commands/publish.d.ts.map +1 -0
  21. package/dist/commands/publish.js +136 -0
  22. package/dist/commands/publish.js.map +1 -0
  23. package/dist/index.d.ts +3 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +20 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/types.d.ts +76 -0
  28. package/dist/types.d.ts.map +1 -0
  29. package/dist/types.js +2 -0
  30. package/dist/types.js.map +1 -0
  31. package/dist/utils/compile.d.ts +25 -0
  32. package/dist/utils/compile.d.ts.map +1 -0
  33. package/dist/utils/compile.js +420 -0
  34. package/dist/utils/compile.js.map +1 -0
  35. package/dist/utils/component-helpers.d.ts +23 -0
  36. package/dist/utils/component-helpers.d.ts.map +1 -0
  37. package/dist/utils/component-helpers.js +177 -0
  38. package/dist/utils/component-helpers.js.map +1 -0
  39. package/dist/utils/css-import-resolver.d.ts +10 -0
  40. package/dist/utils/css-import-resolver.d.ts.map +1 -0
  41. package/dist/utils/css-import-resolver.js +40 -0
  42. package/dist/utils/css-import-resolver.js.map +1 -0
  43. package/dist/utils/esm-transform.d.ts +29 -0
  44. package/dist/utils/esm-transform.d.ts.map +1 -0
  45. package/dist/utils/esm-transform.js +216 -0
  46. package/dist/utils/esm-transform.js.map +1 -0
  47. package/dist/utils/observer-runtime.d.ts +3 -0
  48. package/dist/utils/observer-runtime.d.ts.map +1 -0
  49. package/dist/utils/observer-runtime.js +52 -0
  50. package/dist/utils/observer-runtime.js.map +1 -0
  51. package/dist/utils/websocket-server.d.ts +180 -0
  52. package/dist/utils/websocket-server.d.ts.map +1 -0
  53. package/dist/utils/websocket-server.js +287 -0
  54. package/dist/utils/websocket-server.js.map +1 -0
  55. package/package.json +43 -0
@@ -0,0 +1,572 @@
1
+ import chalk from "chalk";
2
+ import { Command } from "commander";
3
+ import * as fs from "fs";
4
+ import inquirer from "inquirer";
5
+ import ora from "ora";
6
+ import * as path from "path";
7
+ import { generateProjectId, generateComponentId } from "../utils/component-helpers.js";
8
+ const PROP_TYPES = [
9
+ "TEXT",
10
+ "NUMBER",
11
+ "BOOLEAN",
12
+ "IMAGE",
13
+ "LINK",
14
+ "LIST_OF_LINK",
15
+ "COLOR",
16
+ "SELECT",
17
+ "PRODUCT",
18
+ "PRODUCT_LIST",
19
+ "CATEGORY",
20
+ "CATEGORY_LIST",
21
+ "BRAND",
22
+ "BRAND_LIST",
23
+ "BLOG_POST",
24
+ "BLOG_POST_LIST"
25
+ ];
26
+ async function createProject(projectName) {
27
+ const spinner = ora("Creating project...").start();
28
+ try {
29
+ const projectPath = path.resolve(process.cwd(), projectName);
30
+ // Check if directory exists
31
+ if (fs.existsSync(projectPath)) {
32
+ spinner.fail(`Directory "${projectName}" already exists`);
33
+ process.exit(1);
34
+ }
35
+ // Create directory structure
36
+ fs.mkdirSync(projectPath, { recursive: true });
37
+ fs.mkdirSync(path.join(projectPath, "src/components/ExampleComponent"), { recursive: true });
38
+ fs.mkdirSync(path.join(projectPath, "src/components/ExampleSection"), { recursive: true });
39
+ // Create package.json
40
+ const packageJson = {
41
+ name: projectName,
42
+ version: "1.0.0",
43
+ type: "module",
44
+ scripts: {
45
+ dev: "ikas-component dev",
46
+ build: "ikas-component build",
47
+ add: "ikas-component add",
48
+ publish: "ikas-component publish"
49
+ },
50
+ dependencies: {
51
+ preact: "^10.19.3"
52
+ },
53
+ devDependencies: {
54
+ "@ikas/component-cli": "^0.0.1",
55
+ "@ikas/bp-storefront": "*",
56
+ "@ikas/code-components-mcp": "*",
57
+ typescript: "^5.3.0",
58
+ vite: "^5.0.0"
59
+ }
60
+ };
61
+ fs.writeFileSync(path.join(projectPath, "package.json"), JSON.stringify(packageJson, null, 2));
62
+ // Create tsconfig.json
63
+ const tsConfig = {
64
+ compilerOptions: {
65
+ target: "ES2022",
66
+ lib: ["DOM", "DOM.Iterable", "ES2022"],
67
+ module: "ESNext",
68
+ moduleResolution: "bundler",
69
+ jsx: "react-jsx",
70
+ jsxImportSource: "preact",
71
+ strict: true,
72
+ esModuleInterop: true,
73
+ skipLibCheck: true,
74
+ forceConsistentCasingInFileNames: true,
75
+ resolveJsonModule: true,
76
+ declaration: true,
77
+ declarationMap: true,
78
+ outDir: "./dist",
79
+ rootDir: "./src"
80
+ },
81
+ include: ["src/**/*"],
82
+ exclude: ["node_modules", "dist"]
83
+ };
84
+ fs.writeFileSync(path.join(projectPath, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
85
+ // Create vite.config.ts
86
+ const viteConfig = `import { defineConfig } from "vite";
87
+ import preact from "@preact/preset-vite";
88
+
89
+ export default defineConfig({
90
+ plugins: [preact()],
91
+ build: {
92
+ lib: {
93
+ entry: "./src/components/index.ts",
94
+ formats: ["es"]
95
+ },
96
+ rollupOptions: {
97
+ external: ["preact", "preact/hooks", "@ikas/component-utils"]
98
+ }
99
+ }
100
+ });
101
+ `;
102
+ fs.writeFileSync(path.join(projectPath, "vite.config.ts"), viteConfig);
103
+ // Create ikas.config.json
104
+ const projectId = generateProjectId();
105
+ const ikasConfig = {
106
+ name: projectName,
107
+ version: "1.0.0",
108
+ projectId,
109
+ components: [
110
+ {
111
+ id: generateComponentId(projectId, "example-component"),
112
+ name: "Example Component",
113
+ entry: "./src/components/ExampleComponent/index.tsx",
114
+ styles: "./src/components/ExampleComponent/styles.css",
115
+ props: [
116
+ {
117
+ name: "title",
118
+ displayName: "Title",
119
+ type: "TEXT",
120
+ required: true,
121
+ defaultValue: "Hello World",
122
+ description: "The main title text"
123
+ },
124
+ {
125
+ name: "showButton",
126
+ displayName: "Show Button",
127
+ type: "BOOLEAN",
128
+ required: false,
129
+ defaultValue: true,
130
+ description: "Whether to show the action button"
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ id: generateComponentId(projectId, "example-section"),
136
+ name: "Example Section",
137
+ entry: "./src/components/ExampleSection/index.tsx",
138
+ styles: "./src/components/ExampleSection/styles.css",
139
+ type: "section",
140
+ props: [
141
+ {
142
+ name: "heading",
143
+ displayName: "Heading",
144
+ type: "TEXT",
145
+ required: true,
146
+ defaultValue: "Welcome to Our Store",
147
+ description: "The section heading text"
148
+ },
149
+ {
150
+ name: "subtitle",
151
+ displayName: "Subtitle",
152
+ type: "TEXT",
153
+ required: false,
154
+ defaultValue: "Discover our latest products and collections.",
155
+ description: "The subtitle text below the heading"
156
+ },
157
+ {
158
+ name: "backgroundColor",
159
+ displayName: "Background Color",
160
+ type: "COLOR",
161
+ required: false,
162
+ description: "The section background color"
163
+ }
164
+ ]
165
+ }
166
+ ]
167
+ };
168
+ fs.writeFileSync(path.join(projectPath, "ikas.config.json"), JSON.stringify(ikasConfig, null, 2));
169
+ // Create ExampleComponent
170
+ const exampleComponentTsx = `import { Props } from "./types";
171
+
172
+ export function ExampleComponent({ title, showButton }: Props) {
173
+ const handleClick = () => {
174
+ alert("Button clicked!");
175
+ };
176
+
177
+ return (
178
+ <div className="example-component">
179
+ <h1 className="example-title">{title}</h1>
180
+ <p className="example-description">
181
+ This is an example ikas code component built with Preact.
182
+ </p>
183
+ {showButton && (
184
+ <button className="example-button" onClick={handleClick}>
185
+ Click Me
186
+ </button>
187
+ )}
188
+ </div>
189
+ );
190
+ }
191
+ `;
192
+ fs.writeFileSync(path.join(projectPath, "src/components/ExampleComponent/index.tsx"), exampleComponentTsx);
193
+ // Create component types
194
+ const componentTypes = `// Auto-generated types based on ikas.config.json props
195
+ export interface Props {
196
+ title: string;
197
+ showButton?: boolean;
198
+ }
199
+ `;
200
+ fs.writeFileSync(path.join(projectPath, "src/components/ExampleComponent/types.ts"), componentTypes);
201
+ // Create component styles
202
+ const componentStyles = `.example-component {
203
+ padding: 24px;
204
+ border-radius: 8px;
205
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
206
+ color: white;
207
+ font-family: system-ui, -apple-system, sans-serif;
208
+ }
209
+
210
+ .example-title {
211
+ margin: 0 0 12px 0;
212
+ font-size: 28px;
213
+ font-weight: 700;
214
+ }
215
+
216
+ .example-description {
217
+ margin: 0 0 20px 0;
218
+ font-size: 16px;
219
+ opacity: 0.9;
220
+ }
221
+
222
+ .example-button {
223
+ padding: 12px 24px;
224
+ border: none;
225
+ border-radius: 6px;
226
+ background: white;
227
+ color: #667eea;
228
+ font-size: 16px;
229
+ font-weight: 600;
230
+ cursor: pointer;
231
+ transition: transform 0.2s, box-shadow 0.2s;
232
+ }
233
+
234
+ .example-button:hover {
235
+ transform: translateY(-2px);
236
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
237
+ }
238
+ `;
239
+ fs.writeFileSync(path.join(projectPath, "src/components/ExampleComponent/styles.css"), componentStyles);
240
+ // Create ExampleSection
241
+ const exampleSectionTsx = `import { Props } from "./types";
242
+
243
+ export function ExampleSection({ heading, subtitle, backgroundColor }: Props) {
244
+ return (
245
+ <section className="example-section" style={backgroundColor ? { backgroundColor } : undefined}>
246
+ <div className="example-section-inner">
247
+ <h2 className="example-section-heading">{heading}</h2>
248
+ {subtitle && <p className="example-section-subtitle">{subtitle}</p>}
249
+ </div>
250
+ </section>
251
+ );
252
+ }
253
+ `;
254
+ fs.writeFileSync(path.join(projectPath, "src/components/ExampleSection/index.tsx"), exampleSectionTsx);
255
+ // Create section types
256
+ const sectionTypes = `// Auto-generated types based on ikas.config.json props
257
+ export interface Props {
258
+ heading: string;
259
+ subtitle?: string;
260
+ backgroundColor?: string;
261
+ }
262
+ `;
263
+ fs.writeFileSync(path.join(projectPath, "src/components/ExampleSection/types.ts"), sectionTypes);
264
+ // Create section styles
265
+ const sectionStyles = `.example-section {
266
+ width: 100%;
267
+ padding: 64px 24px;
268
+ background: #f8f9fa;
269
+ }
270
+
271
+ .example-section-inner {
272
+ max-width: 1200px;
273
+ margin: 0 auto;
274
+ text-align: center;
275
+ }
276
+
277
+ .example-section-heading {
278
+ margin: 0 0 16px 0;
279
+ font-size: 36px;
280
+ font-weight: 700;
281
+ color: #1a1a2e;
282
+ font-family: system-ui, -apple-system, sans-serif;
283
+ }
284
+
285
+ .example-section-subtitle {
286
+ margin: 0;
287
+ font-size: 18px;
288
+ color: #6b7280;
289
+ font-family: system-ui, -apple-system, sans-serif;
290
+ max-width: 600px;
291
+ margin-left: auto;
292
+ margin-right: auto;
293
+ }
294
+ `;
295
+ fs.writeFileSync(path.join(projectPath, "src/components/ExampleSection/styles.css"), sectionStyles);
296
+ // Create components index
297
+ const componentsIndex = `export { ExampleComponent } from "./ExampleComponent/index";
298
+ export { ExampleSection } from "./ExampleSection/index";
299
+ `;
300
+ fs.writeFileSync(path.join(projectPath, "src/components/index.ts"), componentsIndex);
301
+ // Create README
302
+ const readme = `# ${projectName}
303
+
304
+ An ikas code components project.
305
+
306
+ ## Getting Started
307
+
308
+ 1. Install dependencies:
309
+ \`\`\`bash
310
+ npm install
311
+ \`\`\`
312
+
313
+ 2. Start the development server:
314
+ \`\`\`bash
315
+ npm run dev
316
+ \`\`\`
317
+
318
+ 3. Open the ikas editor and connect to the dev server from the Dev Components panel.
319
+
320
+ ## Commands
321
+
322
+ - \`npm run dev\` - Start development server with live editor updates
323
+ - \`npm run build\` - Build components for production
324
+ - \`npm run add\` - Add a new component to the project
325
+
326
+ ## Project Structure
327
+
328
+ \`\`\`
329
+ ${projectName}/
330
+ ├── src/
331
+ │ └── components/
332
+ │ ├── ExampleComponent/ # A child component (type: "component")
333
+ │ │ ├── index.tsx
334
+ │ │ ├── styles.css
335
+ │ │ └── types.ts
336
+ │ ├── ExampleSection/ # A page-level section (type: "section")
337
+ │ │ ├── index.tsx
338
+ │ │ ├── styles.css
339
+ │ │ └── types.ts
340
+ │ └── index.ts
341
+ ├── ikas.config.json
342
+ ├── package.json
343
+ ├── tsconfig.json
344
+ └── vite.config.ts
345
+ \`\`\`
346
+
347
+ ## Sections vs Components
348
+
349
+ There are two types of code components:
350
+
351
+ - **Sections** are page-level, full-width containers (e.g. Header, Hero Banner, Footer).
352
+ Set \`"type": "section"\` on the component entry in \`ikas.config.json\`.
353
+ - **Components** are child elements placed inside sections (e.g. buttons, cards, badges).
354
+ No \`type\` field needed — it defaults to \`"component"\`.
355
+
356
+ ## Adding Props
357
+
358
+ Edit \`ikas.config.json\` to add props to your components. Available prop types:
359
+
360
+ - \`TEXT\` - String input
361
+ - \`NUMBER\` - Number input
362
+ - \`BOOLEAN\` - Checkbox toggle
363
+ - \`IMAGE\` - Image picker
364
+ - \`LINK\` - Link/URL input
365
+ - \`LIST_OF_LINK\` - List of navigation links
366
+ - \`COLOR\` - Color picker
367
+ - \`SELECT\` - Dropdown selection
368
+ - \`PRODUCT\` - Single product selector
369
+ - \`PRODUCT_LIST\` - Multiple products selector
370
+ - \`CATEGORY\` - Single category selector
371
+ - \`CATEGORY_LIST\` - Multiple categories selector
372
+ - \`BRAND\` - Single brand selector
373
+ - \`BRAND_LIST\` - Multiple brands selector
374
+ - \`BLOG_POST\` - Single blog post selector
375
+ - \`BLOG_POST_LIST\` - Multiple blog posts selector
376
+
377
+ ## Building for Production
378
+
379
+ Run \`npm run build\` to compile your components. The output will be ready to upload to the ikas editor.
380
+ `;
381
+ fs.writeFileSync(path.join(projectPath, "README.md"), readme);
382
+ // Create .gitignore
383
+ const gitignore = `node_modules/
384
+ dist/
385
+ .DS_Store
386
+ *.log
387
+ `;
388
+ fs.writeFileSync(path.join(projectPath, ".gitignore"), gitignore);
389
+ // Create type declarations for virtual modules
390
+ const componentUtilsTypes = `declare module "@ikas/component-utils" {
391
+ export function observer<T extends (props: any) => any>(component: T): T;
392
+ }
393
+ `;
394
+ fs.writeFileSync(path.join(projectPath, "src/ikas-component-utils.d.ts"), componentUtilsTypes);
395
+ // Create CLAUDE.md for Claude Code AI assistant
396
+ const claudeMd = `# ikas Code Components Project
397
+
398
+ This project uses ikas Code Components. Use the code-components MCP server
399
+ tools to look up API documentation and framework conventions.
400
+
401
+ ## MCP Tools Available
402
+
403
+ - \`search_docs(query)\` - Search across all storefront API docs and framework guides
404
+ - \`get_function_doc(name)\` - Get full docs for a specific function (e.g. "addItemToCart")
405
+ - \`list_functions(category?)\` - List all functions, optionally by category (ProductDetail, Cart, ProductList, Navigation, Customer)
406
+ - \`get_code_example(task)\` - Get a code example (e.g. "add to cart", "variant selection")
407
+ - \`get_framework_guide(topic)\` - Get framework docs (e.g. "prop-types", "css-scoping", "imports")
408
+ - \`get_prop_types()\` - Get all available ikas.config.json prop types
409
+
410
+ ## Quick Reference
411
+
412
+ - Tech: Preact + TypeScript
413
+ - Functions & Types: \`import { addItemToCart, IkasProduct } from "@ikas/bp-storefront"\`
414
+ - Config: \`ikas.config.json\` defines components and their props
415
+ - Each component: \`index.tsx\` + \`types.ts\` + \`styles.css\`
416
+
417
+ ## Sections vs Components
418
+
419
+ There are two types of code components:
420
+
421
+ - **Sections** = page-level, full-width containers (Header, Hero Banner, Footer, Product Grid).
422
+ Set \`"type": "section"\` in \`ikas.config.json\`. Use \`<section>\` root element. Name the props interface \`Props\`.
423
+ - **Components** = child elements placed inside sections (buttons, cards, badges).
424
+ No \`type\` field needed (defaults to \`"component"\`). Use \`<div>\` root element. Name the props interface \`Props\`.
425
+
426
+ The key config difference is the \`type\` field on the component definition in \`ikas.config.json\`.
427
+
428
+ ## Build Verification
429
+
430
+ IMPORTANT: After completing any task, always run \`npm run build\` to check for
431
+ TypeScript and build errors. Fix any errors before considering the task done.
432
+ `;
433
+ fs.writeFileSync(path.join(projectPath, "CLAUDE.md"), claudeMd);
434
+ // Create .cursorrules for Cursor AI assistant
435
+ const cursorrules = `# ikas Code Components
436
+
437
+ This project uses ikas Code Components with an MCP server for API documentation.
438
+
439
+ ## MCP Tools (use these to look up docs)
440
+ - search_docs(query) - Search all storefront API docs and framework guides
441
+ - get_function_doc(name) - Full docs for a function (e.g. "addItemToCart")
442
+ - list_functions(category?) - List functions by category
443
+ - get_code_example(task) - Code examples (e.g. "add to cart")
444
+ - get_framework_guide(topic) - Framework docs (e.g. "prop-types", "imports")
445
+ - get_prop_types() - All available prop types
446
+
447
+ ## Quick Reference
448
+ - Tech: Preact + TypeScript
449
+ - Functions & Types: import { addItemToCart, IkasProduct } from "@ikas/bp-storefront"
450
+ - Config: ikas.config.json defines components and their props
451
+ - Each component: index.tsx + types.ts + styles.css
452
+
453
+ ## Sections vs Components
454
+ - Sections = page-level, full-width containers (Header, Hero Banner, Footer).
455
+ Set "type": "section" in ikas.config.json. Use <section> root element. Props interface: Props.
456
+ - Components = child elements placed inside sections (buttons, cards, badges).
457
+ No "type" field needed (defaults to "component"). Use <div> root element. Props interface: Props.
458
+
459
+ ## Build Verification
460
+ IMPORTANT: After completing any task, always run \`npm run build\` to check for
461
+ TypeScript and build errors. Fix any errors before considering the task done.
462
+ `;
463
+ fs.writeFileSync(path.join(projectPath, ".cursorrules"), cursorrules);
464
+ // Create .mcp.json for MCP server configuration
465
+ // Uses npx which resolves the bin through node_modules hierarchy,
466
+ // working both in standalone projects and monorepo workspaces.
467
+ const mcpConfig = {
468
+ mcpServers: {
469
+ "ikas-code-components": {
470
+ command: "npx",
471
+ args: ["ikas-mcp"]
472
+ }
473
+ }
474
+ };
475
+ fs.writeFileSync(path.join(projectPath, ".mcp.json"), JSON.stringify(mcpConfig, null, 2));
476
+ // Create or merge .cursor/mcp.json for Cursor editor
477
+ // Uses node + ${workspaceFolder} instead of npx because Cursor
478
+ // doesn't reliably inherit the shell PATH.
479
+ const cursorDir = path.join(projectPath, ".cursor");
480
+ const cursorMcpPath = path.join(cursorDir, "mcp.json");
481
+ fs.mkdirSync(cursorDir, { recursive: true });
482
+ let cursorMcpConfig = { mcpServers: {} };
483
+ if (fs.existsSync(cursorMcpPath)) {
484
+ try {
485
+ cursorMcpConfig = JSON.parse(fs.readFileSync(cursorMcpPath, "utf-8"));
486
+ if (!cursorMcpConfig.mcpServers) {
487
+ cursorMcpConfig.mcpServers = {};
488
+ }
489
+ }
490
+ catch {
491
+ cursorMcpConfig = { mcpServers: {} };
492
+ }
493
+ }
494
+ cursorMcpConfig.mcpServers["ikas-code-components"] = {
495
+ command: "node",
496
+ args: ["${workspaceFolder}/node_modules/@ikas/code-components-mcp/dist/index.js"]
497
+ };
498
+ fs.writeFileSync(cursorMcpPath, JSON.stringify(cursorMcpConfig, null, 2));
499
+ spinner.succeed(chalk.green(`Project "${projectName}" created successfully!`));
500
+ console.log("\n" + chalk.cyan("Next steps:"));
501
+ console.log(chalk.white(` cd ${projectName}`));
502
+ console.log(chalk.white(" npm install"));
503
+ console.log(chalk.white(" npm run dev"));
504
+ console.log("\n" + chalk.gray("Happy coding! 🚀"));
505
+ }
506
+ catch (error) {
507
+ spinner.fail("Failed to create project");
508
+ console.error(error);
509
+ process.exit(1);
510
+ }
511
+ }
512
+ export function createCreateCommand() {
513
+ return new Command("create")
514
+ .description("Create a new ikas component project")
515
+ .argument("[name]", "Project name")
516
+ .action(async (name) => {
517
+ let projectName = name;
518
+ if (!projectName) {
519
+ const answers = await inquirer.prompt([
520
+ {
521
+ type: "input",
522
+ name: "projectName",
523
+ message: "What is your project name?",
524
+ default: "my-ikas-components",
525
+ validate: (input) => {
526
+ if (!input.trim())
527
+ return "Project name is required";
528
+ if (!/^[a-z0-9-_]+$/i.test(input)) {
529
+ return "Project name can only contain letters, numbers, hyphens, and underscores";
530
+ }
531
+ return true;
532
+ }
533
+ }
534
+ ]);
535
+ projectName = answers.projectName;
536
+ }
537
+ await createProject(projectName);
538
+ });
539
+ }
540
+ // Standalone runner for create-ikas-component command
541
+ export async function run() {
542
+ const program = new Command();
543
+ program
544
+ .name("create-ikas-component")
545
+ .description("Create a new ikas component project")
546
+ .argument("[name]", "Project name")
547
+ .action(async (name) => {
548
+ let projectName = name;
549
+ if (!projectName) {
550
+ const answers = await inquirer.prompt([
551
+ {
552
+ type: "input",
553
+ name: "projectName",
554
+ message: "What is your project name?",
555
+ default: "my-ikas-components",
556
+ validate: (input) => {
557
+ if (!input.trim())
558
+ return "Project name is required";
559
+ if (!/^[a-z0-9-_]+$/i.test(input)) {
560
+ return "Project name can only contain letters, numbers, hyphens, and underscores";
561
+ }
562
+ return true;
563
+ }
564
+ }
565
+ ]);
566
+ projectName = answers.projectName;
567
+ }
568
+ await createProject(projectName);
569
+ });
570
+ program.parse(process.argv);
571
+ }
572
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAMvF,MAAM,UAAU,GAAG;IACjB,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,MAAM;IACN,cAAc;IACd,OAAO;IACP,QAAQ;IACR,SAAS;IACT,cAAc;IACd,UAAU;IACV,e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AAqB,CAAC;QAC9C,CAAC;QAED,MAAM,aAAa,CAAC,WAAY,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function createDevCommand(): Command;
3
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6epC,wBAAgB,gBAAgB,IAAI,OAAO,CAI1C"}