mycontext-cli 2.0.2 → 2.0.4

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 (69) hide show
  1. package/README.md +426 -103
  2. package/dist/README.md +426 -103
  3. package/dist/agents/implementations/ClaudeAgentWorkflow.d.ts.map +1 -1
  4. package/dist/agents/implementations/ClaudeAgentWorkflow.js +75 -4
  5. package/dist/agents/implementations/ClaudeAgentWorkflow.js.map +1 -1
  6. package/dist/agents/implementations/CodeGenSubAgent.d.ts.map +1 -1
  7. package/dist/agents/implementations/CodeGenSubAgent.js +69 -0
  8. package/dist/agents/implementations/CodeGenSubAgent.js.map +1 -1
  9. package/dist/agents/implementations/PromptConstructorAgent.d.ts.map +1 -1
  10. package/dist/agents/implementations/PromptConstructorAgent.js +23 -0
  11. package/dist/agents/implementations/PromptConstructorAgent.js.map +1 -1
  12. package/dist/agents/interfaces/SubAgent.d.ts +2 -0
  13. package/dist/agents/interfaces/SubAgent.d.ts.map +1 -1
  14. package/dist/cli.js +13 -40
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/generate-components.d.ts +0 -5
  17. package/dist/commands/generate-components.d.ts.map +1 -1
  18. package/dist/commands/generate-components.js +0 -101
  19. package/dist/commands/generate-components.js.map +1 -1
  20. package/dist/commands/health-check.d.ts +28 -0
  21. package/dist/commands/health-check.d.ts.map +1 -0
  22. package/dist/commands/health-check.js +271 -0
  23. package/dist/commands/health-check.js.map +1 -0
  24. package/dist/commands/init.d.ts.map +1 -1
  25. package/dist/commands/init.js +2 -6
  26. package/dist/commands/init.js.map +1 -1
  27. package/dist/config/build-strategies.json +173 -22
  28. package/dist/package.json +2 -2
  29. package/dist/utils/NextJSProjectGenerator.d.ts +70 -0
  30. package/dist/utils/NextJSProjectGenerator.d.ts.map +1 -0
  31. package/dist/utils/NextJSProjectGenerator.js +811 -0
  32. package/dist/utils/NextJSProjectGenerator.js.map +1 -0
  33. package/dist/utils/NextJSProjectValidator.d.ts +103 -0
  34. package/dist/utils/NextJSProjectValidator.d.ts.map +1 -0
  35. package/dist/utils/NextJSProjectValidator.js +759 -0
  36. package/dist/utils/NextJSProjectValidator.js.map +1 -0
  37. package/dist/utils/PreCommandValidator.d.ts +77 -0
  38. package/dist/utils/PreCommandValidator.d.ts.map +1 -0
  39. package/dist/utils/PreCommandValidator.js +251 -0
  40. package/dist/utils/PreCommandValidator.js.map +1 -0
  41. package/dist/utils/ProjectHealthMonitor.d.ts +131 -0
  42. package/dist/utils/ProjectHealthMonitor.d.ts.map +1 -0
  43. package/dist/utils/ProjectHealthMonitor.js +454 -0
  44. package/dist/utils/ProjectHealthMonitor.js.map +1 -0
  45. package/dist/utils/ProjectInitializationSafeguards.d.ts +81 -0
  46. package/dist/utils/ProjectInitializationSafeguards.d.ts.map +1 -0
  47. package/dist/utils/ProjectInitializationSafeguards.js +620 -0
  48. package/dist/utils/ProjectInitializationSafeguards.js.map +1 -0
  49. package/dist/utils/ProjectStructureRepair.d.ts +110 -0
  50. package/dist/utils/ProjectStructureRepair.d.ts.map +1 -0
  51. package/dist/utils/ProjectStructureRepair.js +785 -0
  52. package/dist/utils/ProjectStructureRepair.js.map +1 -0
  53. package/dist/utils/ProjectStructureValidator.d.ts +128 -0
  54. package/dist/utils/ProjectStructureValidator.d.ts.map +1 -0
  55. package/dist/utils/ProjectStructureValidator.js +662 -0
  56. package/dist/utils/ProjectStructureValidator.js.map +1 -0
  57. package/dist/utils/agentDefinitions.d.ts +5 -0
  58. package/dist/utils/agentDefinitions.d.ts.map +1 -1
  59. package/dist/utils/agentDefinitions.js +99 -1
  60. package/dist/utils/agentDefinitions.js.map +1 -1
  61. package/dist/utils/mcpTools.d.ts +189 -0
  62. package/dist/utils/mcpTools.d.ts.map +1 -1
  63. package/dist/utils/mcpTools.js +462 -1
  64. package/dist/utils/mcpTools.js.map +1 -1
  65. package/package.json +2 -2
  66. package/dist/commands/core.d.ts +0 -24
  67. package/dist/commands/core.d.ts.map +0 -1
  68. package/dist/commands/core.js +0 -410
  69. package/dist/commands/core.js.map +0 -1
@@ -0,0 +1,811 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.NextJSProjectGenerator = void 0;
40
+ const fs = __importStar(require("fs-extra"));
41
+ const path = __importStar(require("path"));
42
+ const chalk_1 = __importDefault(require("chalk"));
43
+ class NextJSProjectGenerator {
44
+ constructor(options) {
45
+ this.projectRoot = options.projectPath;
46
+ this.options = options;
47
+ }
48
+ /**
49
+ * Generate complete Next.js project structure
50
+ */
51
+ async generateProject() {
52
+ console.log(chalk_1.default.blue("🚀 Generating Next.js project structure..."));
53
+ console.log(chalk_1.default.blue("==========================================\n"));
54
+ const generatedFiles = [];
55
+ try {
56
+ // Step 1: Create basic project structure
57
+ await this.createBasicStructure(generatedFiles);
58
+ // Step 2: Generate package.json
59
+ await this.generatePackageJson(generatedFiles);
60
+ // Step 3: Generate Next.js configuration
61
+ await this.generateNextJSConfig(generatedFiles);
62
+ // Step 4: Generate TypeScript configuration
63
+ if (this.options.withTypeScript) {
64
+ await this.generateTypeScriptConfig(generatedFiles);
65
+ }
66
+ // Step 5: Generate Tailwind configuration
67
+ if (this.options.withTailwind) {
68
+ await this.generateTailwindConfig(generatedFiles);
69
+ }
70
+ // Step 6: Generate App Router structure
71
+ if (this.options.withAppRouter) {
72
+ await this.generateAppRouterStructure(generatedFiles);
73
+ }
74
+ // Step 7: Generate shadcn/ui configuration
75
+ if (this.options.withShadcn) {
76
+ await this.generateShadcnConfig(generatedFiles);
77
+ }
78
+ // Step 8: Generate component structure
79
+ if (this.options.withComponents) {
80
+ await this.generateComponentStructure(generatedFiles);
81
+ }
82
+ // Step 9: Generate layout structure
83
+ if (this.options.withLayouts) {
84
+ await this.generateLayoutStructure(generatedFiles);
85
+ }
86
+ // Step 10: Generate utility files
87
+ await this.generateUtilityFiles(generatedFiles);
88
+ console.log(chalk_1.default.green(`\n✅ Generated ${generatedFiles.length} files successfully!`));
89
+ return generatedFiles;
90
+ }
91
+ catch (error) {
92
+ console.log(chalk_1.default.red(`❌ Project generation failed: ${error}`));
93
+ throw error;
94
+ }
95
+ }
96
+ /**
97
+ * Create basic project structure
98
+ */
99
+ async createBasicStructure(generatedFiles) {
100
+ console.log(chalk_1.default.blue("📁 Creating basic project structure..."));
101
+ const directories = [
102
+ "app",
103
+ "components",
104
+ "lib",
105
+ "hooks",
106
+ "types",
107
+ "public",
108
+ ".mycontext",
109
+ ];
110
+ for (const dir of directories) {
111
+ const dirPath = path.join(this.projectRoot, dir);
112
+ await fs.ensureDir(dirPath);
113
+ generatedFiles.push({
114
+ path: dirPath,
115
+ content: "",
116
+ type: "directory",
117
+ });
118
+ }
119
+ // Create .gitignore
120
+ const gitignorePath = path.join(this.projectRoot, ".gitignore");
121
+ const gitignoreContent = this.generateGitignoreContent();
122
+ await fs.writeFile(gitignorePath, gitignoreContent);
123
+ generatedFiles.push({
124
+ path: gitignorePath,
125
+ content: gitignoreContent,
126
+ type: "file",
127
+ });
128
+ console.log(chalk_1.default.green("✅ Basic structure created"));
129
+ }
130
+ /**
131
+ * Generate package.json
132
+ */
133
+ async generatePackageJson(generatedFiles) {
134
+ console.log(chalk_1.default.blue("📦 Generating package.json..."));
135
+ const packageJson = {
136
+ name: this.options.projectName.toLowerCase().replace(/[^a-z0-9-]/g, "-"),
137
+ version: "0.1.0",
138
+ private: true,
139
+ scripts: {
140
+ dev: "next dev",
141
+ build: "next build",
142
+ start: "next start",
143
+ lint: "next lint",
144
+ "type-check": "tsc --noEmit",
145
+ },
146
+ dependencies: {
147
+ react: "^18.0.0",
148
+ "react-dom": "^18.0.0",
149
+ next: "^14.0.0",
150
+ },
151
+ devDependencies: {
152
+ typescript: "^5.0.0",
153
+ "@types/node": "^20.0.0",
154
+ "@types/react": "^18.0.0",
155
+ "@types/react-dom": "^18.0.0",
156
+ eslint: "^8.0.0",
157
+ "eslint-config-next": "^14.0.0",
158
+ },
159
+ packageManager: "pnpm@10.11.0",
160
+ };
161
+ // Add Tailwind CSS dependencies if enabled
162
+ if (this.options.withTailwind) {
163
+ packageJson.devDependencies = {
164
+ ...packageJson.devDependencies,
165
+ tailwindcss: "^3.0.0",
166
+ autoprefixer: "^10.0.0",
167
+ postcss: "^8.0.0",
168
+ };
169
+ }
170
+ const packageJsonPath = path.join(this.projectRoot, "package.json");
171
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
172
+ generatedFiles.push({
173
+ path: packageJsonPath,
174
+ content: JSON.stringify(packageJson, null, 2),
175
+ type: "file",
176
+ });
177
+ console.log(chalk_1.default.green("✅ package.json generated"));
178
+ }
179
+ /**
180
+ * Generate Next.js configuration
181
+ */
182
+ async generateNextJSConfig(generatedFiles) {
183
+ console.log(chalk_1.default.blue("⚙️ Generating Next.js configuration..."));
184
+ const nextConfigContent = `import type { NextConfig } from "next";
185
+
186
+ const nextConfig: NextConfig = {
187
+ experimental: {
188
+ turbo: true,
189
+ },
190
+ typescript: {
191
+ ignoreBuildErrors: false,
192
+ },
193
+ eslint: {
194
+ ignoreDuringBuilds: false,
195
+ },
196
+ };
197
+
198
+ export default nextConfig;
199
+ `;
200
+ const nextConfigPath = path.join(this.projectRoot, "next.config.ts");
201
+ await fs.writeFile(nextConfigPath, nextConfigContent);
202
+ generatedFiles.push({
203
+ path: nextConfigPath,
204
+ content: nextConfigContent,
205
+ type: "file",
206
+ });
207
+ console.log(chalk_1.default.green("✅ Next.js configuration generated"));
208
+ }
209
+ /**
210
+ * Generate TypeScript configuration
211
+ */
212
+ async generateTypeScriptConfig(generatedFiles) {
213
+ console.log(chalk_1.default.blue("📝 Generating TypeScript configuration..."));
214
+ const tsConfig = {
215
+ compilerOptions: {
216
+ target: "es5",
217
+ lib: ["dom", "dom.iterable", "es6"],
218
+ allowJs: true,
219
+ skipLibCheck: true,
220
+ strict: true,
221
+ noEmit: true,
222
+ esModuleInterop: true,
223
+ module: "esnext",
224
+ moduleResolution: "bundler",
225
+ resolveJsonModule: true,
226
+ isolatedModules: true,
227
+ jsx: "preserve",
228
+ incremental: true,
229
+ plugins: [
230
+ {
231
+ name: "next",
232
+ },
233
+ ],
234
+ paths: {
235
+ "@/*": ["./*"],
236
+ },
237
+ },
238
+ include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
239
+ exclude: ["node_modules"],
240
+ };
241
+ const tsConfigPath = path.join(this.projectRoot, "tsconfig.json");
242
+ await fs.writeJson(tsConfigPath, tsConfig, { spaces: 2 });
243
+ generatedFiles.push({
244
+ path: tsConfigPath,
245
+ content: JSON.stringify(tsConfig, null, 2),
246
+ type: "file",
247
+ });
248
+ console.log(chalk_1.default.green("✅ TypeScript configuration generated"));
249
+ }
250
+ /**
251
+ * Generate Tailwind CSS configuration
252
+ */
253
+ async generateTailwindConfig(generatedFiles) {
254
+ console.log(chalk_1.default.blue("🎨 Generating Tailwind CSS configuration..."));
255
+ const tailwindConfig = `import type { Config } from "tailwindcss";
256
+
257
+ const config: Config = {
258
+ content: [
259
+ "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
260
+ "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
261
+ "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
262
+ "./app/**/*.{js,ts,jsx,tsx,mdx}",
263
+ "./components/**/*.{js,ts,jsx,tsx,mdx}",
264
+ ],
265
+ theme: {
266
+ extend: {
267
+ colors: {
268
+ background: "var(--background)",
269
+ foreground: "var(--foreground)",
270
+ card: {
271
+ DEFAULT: "var(--card)",
272
+ foreground: "var(--card-foreground)",
273
+ },
274
+ popover: {
275
+ DEFAULT: "var(--popover)",
276
+ foreground: "var(--popover-foreground)",
277
+ },
278
+ primary: {
279
+ DEFAULT: "var(--primary)",
280
+ foreground: "var(--primary-foreground)",
281
+ },
282
+ secondary: {
283
+ DEFAULT: "var(--secondary)",
284
+ foreground: "var(--secondary-foreground)",
285
+ },
286
+ muted: {
287
+ DEFAULT: "var(--muted)",
288
+ foreground: "var(--muted-foreground)",
289
+ },
290
+ accent: {
291
+ DEFAULT: "var(--accent)",
292
+ foreground: "var(--accent-foreground)",
293
+ },
294
+ destructive: {
295
+ DEFAULT: "var(--destructive)",
296
+ foreground: "var(--destructive-foreground)",
297
+ },
298
+ border: "var(--border)",
299
+ input: "var(--input)",
300
+ ring: "var(--ring)",
301
+ chart: {
302
+ "1": "var(--chart-1)",
303
+ "2": "var(--chart-2)",
304
+ "3": "var(--chart-3)",
305
+ "4": "var(--chart-4)",
306
+ "5": "var(--chart-5)",
307
+ },
308
+ },
309
+ borderRadius: {
310
+ lg: "var(--radius)",
311
+ md: "calc(var(--radius) - 2px)",
312
+ sm: "calc(var(--radius) - 4px)",
313
+ },
314
+ },
315
+ },
316
+ plugins: [],
317
+ };
318
+
319
+ export default config;
320
+ `;
321
+ const tailwindConfigPath = path.join(this.projectRoot, "tailwind.config.ts");
322
+ await fs.writeFile(tailwindConfigPath, tailwindConfig);
323
+ generatedFiles.push({
324
+ path: tailwindConfigPath,
325
+ content: tailwindConfig,
326
+ type: "file",
327
+ });
328
+ // Generate PostCSS configuration
329
+ const postcssConfig = `module.exports = {
330
+ plugins: {
331
+ tailwindcss: {},
332
+ autoprefixer: {},
333
+ },
334
+ };
335
+ `;
336
+ const postcssConfigPath = path.join(this.projectRoot, "postcss.config.js");
337
+ await fs.writeFile(postcssConfigPath, postcssConfig);
338
+ generatedFiles.push({
339
+ path: postcssConfigPath,
340
+ content: postcssConfig,
341
+ type: "file",
342
+ });
343
+ console.log(chalk_1.default.green("✅ Tailwind CSS configuration generated"));
344
+ }
345
+ /**
346
+ * Generate App Router structure
347
+ */
348
+ async generateAppRouterStructure(generatedFiles) {
349
+ console.log(chalk_1.default.blue("📁 Generating App Router structure..."));
350
+ // Generate root layout
351
+ const rootLayoutContent = `import type { Metadata } from "next";
352
+ import { Inter } from "next/font/google";
353
+ import "./globals.css";
354
+
355
+ const inter = Inter({ subsets: ["latin"] });
356
+
357
+ export const metadata: Metadata = {
358
+ title: "${this.options.projectName}",
359
+ description: "A modern web application built with Next.js",
360
+ };
361
+
362
+ export default function RootLayout({
363
+ children,
364
+ }: {
365
+ children: React.ReactNode;
366
+ }) {
367
+ return (
368
+ <html lang="en">
369
+ <body className={inter.className}>{children}</body>
370
+ </html>
371
+ );
372
+ }
373
+ `;
374
+ const rootLayoutPath = path.join(this.projectRoot, "app", "layout.tsx");
375
+ await fs.writeFile(rootLayoutPath, rootLayoutContent);
376
+ generatedFiles.push({
377
+ path: rootLayoutPath,
378
+ content: rootLayoutContent,
379
+ type: "file",
380
+ });
381
+ // Generate root page
382
+ const rootPageContent = `import { Button } from "@/components/ui/button";
383
+
384
+ export default function HomePage() {
385
+ return (
386
+ <main className="flex min-h-screen flex-col items-center justify-center p-24">
387
+ <div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm">
388
+ <h1 className="text-4xl font-bold text-center mb-8">
389
+ Welcome to ${this.options.projectName}
390
+ </h1>
391
+ <p className="text-center text-lg text-muted-foreground mb-8">
392
+ A modern web application built with Next.js, TypeScript, and Tailwind CSS.
393
+ </p>
394
+ <div className="flex justify-center">
395
+ <Button>Get Started</Button>
396
+ </div>
397
+ </div>
398
+ </main>
399
+ );
400
+ }
401
+ `;
402
+ const rootPagePath = path.join(this.projectRoot, "app", "page.tsx");
403
+ await fs.writeFile(rootPagePath, rootPageContent);
404
+ generatedFiles.push({
405
+ path: rootPagePath,
406
+ content: rootPageContent,
407
+ type: "file",
408
+ });
409
+ // Generate global CSS
410
+ const globalCssContent = `@tailwind base;
411
+ @tailwind components;
412
+ @tailwind utilities;
413
+
414
+ @layer base {
415
+ :root {
416
+ --background: 0 0% 100%;
417
+ --foreground: 222.2 84% 4.9%;
418
+ --card: 0 0% 100%;
419
+ --card-foreground: 222.2 84% 4.9%;
420
+ --popover: 0 0% 100%;
421
+ --popover-foreground: 222.2 84% 4.9%;
422
+ --primary: 222.2 47.4% 11.2%;
423
+ --primary-foreground: 210 40% 98%;
424
+ --secondary: 210 40% 96%;
425
+ --secondary-foreground: 222.2 47.4% 11.2%;
426
+ --muted: 210 40% 96%;
427
+ --muted-foreground: 215.4 16.3% 46.9%;
428
+ --accent: 210 40% 96%;
429
+ --accent-foreground: 222.2 47.4% 11.2%;
430
+ --destructive: 0 84.2% 60.2%;
431
+ --destructive-foreground: 210 40% 98%;
432
+ --border: 214.3 31.8% 91.4%;
433
+ --input: 214.3 31.8% 91.4%;
434
+ --ring: 222.2 84% 4.9%;
435
+ --chart-1: 12 76% 61%;
436
+ --chart-2: 173 58% 39%;
437
+ --chart-3: 197 37% 24%;
438
+ --chart-4: 43 74% 66%;
439
+ --chart-5: 27 87% 67%;
440
+ --radius: 0.5rem;
441
+ }
442
+
443
+ .dark {
444
+ --background: 222.2 84% 4.9%;
445
+ --foreground: 210 40% 98%;
446
+ --card: 222.2 84% 4.9%;
447
+ --card-foreground: 210 40% 98%;
448
+ --popover: 222.2 84% 4.9%;
449
+ --popover-foreground: 210 40% 98%;
450
+ --primary: 210 40% 98%;
451
+ --primary-foreground: 222.2 47.4% 11.2%;
452
+ --secondary: 217.2 32.6% 17.5%;
453
+ --secondary-foreground: 210 40% 98%;
454
+ --muted: 217.2 32.6% 17.5%;
455
+ --muted-foreground: 215 20.2% 65.1%;
456
+ --accent: 217.2 32.6% 17.5%;
457
+ --accent-foreground: 210 40% 98%;
458
+ --destructive: 0 62.8% 30.6%;
459
+ --destructive-foreground: 210 40% 98%;
460
+ --border: 217.2 32.6% 17.5%;
461
+ --input: 217.2 32.6% 17.5%;
462
+ --ring: 212.7 26.8% 83.9%;
463
+ --chart-1: 220 70% 50%;
464
+ --chart-2: 160 60% 45%;
465
+ --chart-3: 30 80% 55%;
466
+ --chart-4: 280 65% 60%;
467
+ --chart-5: 340 75% 55%;
468
+ }
469
+ }
470
+
471
+ @layer base {
472
+ * {
473
+ @apply border-border;
474
+ }
475
+ body {
476
+ @apply bg-background text-foreground;
477
+ }
478
+ }
479
+ `;
480
+ const globalCssPath = path.join(this.projectRoot, "app", "globals.css");
481
+ await fs.writeFile(globalCssPath, globalCssContent);
482
+ generatedFiles.push({
483
+ path: globalCssPath,
484
+ content: globalCssContent,
485
+ type: "file",
486
+ });
487
+ console.log(chalk_1.default.green("✅ App Router structure generated"));
488
+ }
489
+ /**
490
+ * Generate shadcn/ui configuration
491
+ */
492
+ async generateShadcnConfig(generatedFiles) {
493
+ console.log(chalk_1.default.blue("🎨 Generating shadcn/ui configuration..."));
494
+ const componentsJson = {
495
+ $schema: "https://ui.shadcn.com/schema.json",
496
+ style: "default",
497
+ rsc: true,
498
+ tsx: true,
499
+ tailwind: {
500
+ config: "tailwind.config.ts",
501
+ css: "app/globals.css",
502
+ baseColor: "slate",
503
+ cssVariables: true,
504
+ prefix: "",
505
+ },
506
+ aliases: {
507
+ components: "@/components",
508
+ utils: "@/lib/utils",
509
+ },
510
+ };
511
+ const componentsJsonPath = path.join(this.projectRoot, "components.json");
512
+ await fs.writeJson(componentsJsonPath, componentsJson, { spaces: 2 });
513
+ generatedFiles.push({
514
+ path: componentsJsonPath,
515
+ content: JSON.stringify(componentsJson, null, 2),
516
+ type: "file",
517
+ });
518
+ console.log(chalk_1.default.green("✅ shadcn/ui configuration generated"));
519
+ }
520
+ /**
521
+ * Generate component structure
522
+ */
523
+ async generateComponentStructure(generatedFiles) {
524
+ console.log(chalk_1.default.blue("🧩 Generating component structure..."));
525
+ // Create UI components directory
526
+ const uiDir = path.join(this.projectRoot, "components", "ui");
527
+ await fs.ensureDir(uiDir);
528
+ generatedFiles.push({
529
+ path: uiDir,
530
+ content: "",
531
+ type: "directory",
532
+ });
533
+ // Generate basic Button component (shadcn/ui style)
534
+ const buttonComponent = `import * as React from "react";
535
+ import { Slot } from "@radix-ui/react-slot";
536
+ import { cva, type VariantProps } from "class-variance-authority";
537
+ import { cn } from "@/lib/utils";
538
+
539
+ const buttonVariants = cva(
540
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
541
+ {
542
+ variants: {
543
+ variant: {
544
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
545
+ destructive:
546
+ "bg-destructive text-destructive-foreground hover:bg-destructive/90",
547
+ outline:
548
+ "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
549
+ secondary:
550
+ "bg-secondary text-secondary-foreground hover:bg-secondary/80",
551
+ ghost: "hover:bg-accent hover:text-accent-foreground",
552
+ link: "text-primary underline-offset-4 hover:underline",
553
+ },
554
+ size: {
555
+ default: "h-10 px-4 py-2",
556
+ sm: "h-9 rounded-md px-3",
557
+ lg: "h-11 rounded-md px-8",
558
+ icon: "h-10 w-10",
559
+ },
560
+ },
561
+ defaultVariants: {
562
+ variant: "default",
563
+ size: "default",
564
+ },
565
+ }
566
+ );
567
+
568
+ export interface ButtonProps
569
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
570
+ VariantProps<typeof buttonVariants> {
571
+ asChild?: boolean;
572
+ }
573
+
574
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
575
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
576
+ const Comp = asChild ? Slot : "button";
577
+ return (
578
+ <Comp
579
+ className={cn(buttonVariants({ variant, size, className }))}
580
+ ref={ref}
581
+ {...props}
582
+ />
583
+ );
584
+ }
585
+ );
586
+ Button.displayName = "Button";
587
+
588
+ export { Button, buttonVariants };
589
+ `;
590
+ const buttonPath = path.join(uiDir, "button.tsx");
591
+ await fs.writeFile(buttonPath, buttonComponent);
592
+ generatedFiles.push({
593
+ path: buttonPath,
594
+ content: buttonComponent,
595
+ type: "file",
596
+ });
597
+ console.log(chalk_1.default.green("✅ Component structure generated"));
598
+ }
599
+ /**
600
+ * Generate layout structure
601
+ */
602
+ async generateLayoutStructure(generatedFiles) {
603
+ console.log(chalk_1.default.blue("🎨 Generating layout structure..."));
604
+ // Create dashboard layout example
605
+ const dashboardDir = path.join(this.projectRoot, "app", "dashboard");
606
+ await fs.ensureDir(dashboardDir);
607
+ generatedFiles.push({
608
+ path: dashboardDir,
609
+ content: "",
610
+ type: "directory",
611
+ });
612
+ // Generate dashboard layout
613
+ const dashboardLayoutContent = `export default function DashboardLayout({
614
+ children,
615
+ }: {
616
+ children: React.ReactNode;
617
+ }) {
618
+ return (
619
+ <div className="flex h-screen flex-col md:flex-row md:overflow-hidden">
620
+ <div className="w-full flex-none md:w-64">
621
+ <nav className="flex h-full flex-col px-3 py-4">
622
+ <div className="flex grow flex-row justify-between space-x-2 md:flex-col md:space-x-0 md:space-y-2">
623
+ <div className="flex h-[48px] grow items-center rounded-md bg-gray-50 p-3 text-sm font-medium md:h-auto md:justify-start md:p-2 md:px-3">
624
+ Dashboard
625
+ </div>
626
+ </div>
627
+ </nav>
628
+ </div>
629
+ <div className="flex-grow p-6 md:overflow-y-auto md:p-12">
630
+ {children}
631
+ </div>
632
+ </div>
633
+ );
634
+ }
635
+ `;
636
+ const dashboardLayoutPath = path.join(dashboardDir, "layout.tsx");
637
+ await fs.writeFile(dashboardLayoutPath, dashboardLayoutContent);
638
+ generatedFiles.push({
639
+ path: dashboardLayoutPath,
640
+ content: dashboardLayoutContent,
641
+ type: "file",
642
+ });
643
+ // Generate dashboard page
644
+ const dashboardPageContent = `export default function DashboardPage() {
645
+ return (
646
+ <div>
647
+ <h1 className="text-2xl font-bold mb-4">Dashboard</h1>
648
+ <p className="text-muted-foreground">
649
+ Welcome to your dashboard. This is an example of nested routing with layouts.
650
+ </p>
651
+ </div>
652
+ );
653
+ }
654
+ `;
655
+ const dashboardPagePath = path.join(dashboardDir, "page.tsx");
656
+ await fs.writeFile(dashboardPagePath, dashboardPageContent);
657
+ generatedFiles.push({
658
+ path: dashboardPagePath,
659
+ content: dashboardPageContent,
660
+ type: "file",
661
+ });
662
+ console.log(chalk_1.default.green("✅ Layout structure generated"));
663
+ }
664
+ /**
665
+ * Generate utility files
666
+ */
667
+ async generateUtilityFiles(generatedFiles) {
668
+ console.log(chalk_1.default.blue("🛠️ Generating utility files..."));
669
+ // Generate lib/utils.ts
670
+ const utilsContent = `import { type ClassValue, clsx } from "clsx";
671
+ import { twMerge } from "tailwind-merge";
672
+
673
+ export function cn(...inputs: ClassValue[]) {
674
+ return twMerge(clsx(inputs));
675
+ }
676
+ `;
677
+ const utilsPath = path.join(this.projectRoot, "lib", "utils.ts");
678
+ await fs.writeFile(utilsPath, utilsContent);
679
+ generatedFiles.push({
680
+ path: utilsPath,
681
+ content: utilsContent,
682
+ type: "file",
683
+ });
684
+ // Generate next-env.d.ts
685
+ const nextEnvContent = `/// <reference types="next" />
686
+ /// <reference types="next/image-types/global" />
687
+
688
+ // NOTE: This file should not be edited
689
+ // see https://nextjs.org/docs/basic-features/typescript for more information.
690
+ `;
691
+ const nextEnvPath = path.join(this.projectRoot, "next-env.d.ts");
692
+ await fs.writeFile(nextEnvPath, nextEnvContent);
693
+ generatedFiles.push({
694
+ path: nextEnvPath,
695
+ content: nextEnvContent,
696
+ type: "file",
697
+ });
698
+ console.log(chalk_1.default.green("✅ Utility files generated"));
699
+ }
700
+ /**
701
+ * Generate .gitignore content
702
+ */
703
+ generateGitignoreContent() {
704
+ return `# Dependencies
705
+ node_modules/
706
+ .pnp
707
+ .pnp.js
708
+
709
+ # Production builds
710
+ .next/
711
+ out/
712
+ build/
713
+ dist/
714
+
715
+ # Environment variables
716
+ .env
717
+ .env.local
718
+ .env.development.local
719
+ .env.test.local
720
+ .env.production.local
721
+
722
+ # Logs
723
+ npm-debug.log*
724
+ yarn-debug.log*
725
+ yarn-error.log*
726
+ pnpm-debug.log*
727
+ lerna-debug.log*
728
+
729
+ # Runtime data
730
+ pids
731
+ *.pid
732
+ *.seed
733
+ *.pid.lock
734
+
735
+ # Coverage directory used by tools like istanbul
736
+ coverage/
737
+ *.lcov
738
+
739
+ # nyc test coverage
740
+ .nyc_output
741
+
742
+ # Dependency directories
743
+ node_modules/
744
+ jspm_packages/
745
+
746
+ # TypeScript cache
747
+ *.tsbuildinfo
748
+
749
+ # Optional npm cache directory
750
+ .npm
751
+
752
+ # Optional eslint cache
753
+ .eslintcache
754
+
755
+ # Optional REPL history
756
+ .node_repl_history
757
+
758
+ # Output of 'npm pack'
759
+ *.tgz
760
+
761
+ # Yarn Integrity file
762
+ .yarn-integrity
763
+
764
+ # parcel-bundler cache (https://parceljs.org/)
765
+ .cache
766
+ .parcel-cache
767
+
768
+ # Next.js build output
769
+ .next
770
+
771
+ # Nuxt.js build / generate output
772
+ .nuxt
773
+ dist
774
+
775
+ # Gatsby files
776
+ .cache/
777
+ public
778
+
779
+ # Storybook build outputs
780
+ .out
781
+ .storybook-out
782
+
783
+ # Temporary folders
784
+ tmp/
785
+ temp/
786
+
787
+ # Editor directories and files
788
+ .vscode/
789
+ .idea/
790
+ *.swp
791
+ *.swo
792
+ *~
793
+
794
+ # OS generated files
795
+ .DS_Store
796
+ .DS_Store?
797
+ ._*
798
+ .Spotlight-V100
799
+ .Trashes
800
+ ehthumbs.db
801
+ Thumbs.db
802
+
803
+ # MyContext specific
804
+ .mycontext/.env
805
+ .mycontext/logs/
806
+ .mycontext/cache/
807
+ `;
808
+ }
809
+ }
810
+ exports.NextJSProjectGenerator = NextJSProjectGenerator;
811
+ //# sourceMappingURL=NextJSProjectGenerator.js.map