@compilr-dev/cli 0.4.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 (152) hide show
  1. package/README.md +110 -0
  2. package/dist/agent.d.ts +62 -0
  3. package/dist/agent.js +317 -0
  4. package/dist/agents/registry.d.ts +66 -0
  5. package/dist/agents/registry.js +238 -0
  6. package/dist/agents/types.d.ts +40 -0
  7. package/dist/agents/types.js +94 -0
  8. package/dist/commands/custom-registry.d.ts +69 -0
  9. package/dist/commands/custom-registry.js +246 -0
  10. package/dist/commands/index.d.ts +7 -0
  11. package/dist/commands/index.js +7 -0
  12. package/dist/commands/types.d.ts +31 -0
  13. package/dist/commands/types.js +26 -0
  14. package/dist/commands.d.ts +63 -0
  15. package/dist/commands.js +324 -0
  16. package/dist/db/index.d.ts +42 -0
  17. package/dist/db/index.js +146 -0
  18. package/dist/db/repositories/document-repository.d.ts +63 -0
  19. package/dist/db/repositories/document-repository.js +184 -0
  20. package/dist/db/repositories/index.d.ts +9 -0
  21. package/dist/db/repositories/index.js +6 -0
  22. package/dist/db/repositories/project-repository.d.ts +132 -0
  23. package/dist/db/repositories/project-repository.js +337 -0
  24. package/dist/db/repositories/work-item-repository.d.ts +115 -0
  25. package/dist/db/repositories/work-item-repository.js +389 -0
  26. package/dist/db/schema.d.ts +83 -0
  27. package/dist/db/schema.js +143 -0
  28. package/dist/debug.d.ts +8 -0
  29. package/dist/debug.js +48 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +348 -0
  32. package/dist/index.old.d.ts +7 -0
  33. package/dist/index.old.js +1014 -0
  34. package/dist/repl.d.ts +121 -0
  35. package/dist/repl.js +1878 -0
  36. package/dist/settings/index.d.ts +80 -0
  37. package/dist/settings/index.js +195 -0
  38. package/dist/shared-handlers.d.ts +63 -0
  39. package/dist/shared-handlers.js +57 -0
  40. package/dist/slash-autocomplete.d.ts +41 -0
  41. package/dist/slash-autocomplete.js +638 -0
  42. package/dist/state.d.ts +75 -0
  43. package/dist/state.js +130 -0
  44. package/dist/tabbed-menu.d.ts +11 -0
  45. package/dist/tabbed-menu.js +328 -0
  46. package/dist/templates/backlog-md.d.ts +7 -0
  47. package/dist/templates/backlog-md.js +94 -0
  48. package/dist/templates/claude-md.d.ts +7 -0
  49. package/dist/templates/claude-md.js +189 -0
  50. package/dist/templates/coding-standards.d.ts +7 -0
  51. package/dist/templates/coding-standards.js +299 -0
  52. package/dist/templates/compilr-md.d.ts +7 -0
  53. package/dist/templates/compilr-md.js +189 -0
  54. package/dist/templates/config-json.d.ts +38 -0
  55. package/dist/templates/config-json.js +39 -0
  56. package/dist/templates/gitignore.d.ts +7 -0
  57. package/dist/templates/gitignore.js +85 -0
  58. package/dist/templates/index.d.ts +19 -0
  59. package/dist/templates/index.js +302 -0
  60. package/dist/templates/package-json.d.ts +7 -0
  61. package/dist/templates/package-json.js +111 -0
  62. package/dist/templates/readme-md.d.ts +7 -0
  63. package/dist/templates/readme-md.js +161 -0
  64. package/dist/templates/tsconfig.d.ts +7 -0
  65. package/dist/templates/tsconfig.js +61 -0
  66. package/dist/templates/types.d.ts +33 -0
  67. package/dist/templates/types.js +24 -0
  68. package/dist/test-autocomplete.d.ts +7 -0
  69. package/dist/test-autocomplete.js +85 -0
  70. package/dist/test-tabbed-menu.d.ts +7 -0
  71. package/dist/test-tabbed-menu.js +25 -0
  72. package/dist/themes/colors.d.ts +49 -0
  73. package/dist/themes/colors.js +135 -0
  74. package/dist/themes/index.d.ts +23 -0
  75. package/dist/themes/index.js +24 -0
  76. package/dist/themes/registry.d.ts +60 -0
  77. package/dist/themes/registry.js +195 -0
  78. package/dist/themes/types.d.ts +82 -0
  79. package/dist/themes/types.js +7 -0
  80. package/dist/tool-selector.d.ts +71 -0
  81. package/dist/tool-selector.js +184 -0
  82. package/dist/tools/ask-user-simple.d.ts +19 -0
  83. package/dist/tools/ask-user-simple.js +86 -0
  84. package/dist/tools/ask-user.d.ts +32 -0
  85. package/dist/tools/ask-user.js +113 -0
  86. package/dist/tools/backlog.d.ts +53 -0
  87. package/dist/tools/backlog.js +709 -0
  88. package/dist/tools.d.ts +15 -0
  89. package/dist/tools.js +121 -0
  90. package/dist/ui/agents-overlay.d.ts +12 -0
  91. package/dist/ui/agents-overlay.js +501 -0
  92. package/dist/ui/arch-type-overlay.d.ts +20 -0
  93. package/dist/ui/arch-type-overlay.js +229 -0
  94. package/dist/ui/ask-user-overlay.d.ts +26 -0
  95. package/dist/ui/ask-user-overlay.js +647 -0
  96. package/dist/ui/ask-user-simple-overlay.d.ts +25 -0
  97. package/dist/ui/ask-user-simple-overlay.js +242 -0
  98. package/dist/ui/backlog-overlay.d.ts +17 -0
  99. package/dist/ui/backlog-overlay.js +786 -0
  100. package/dist/ui/commands-overlay.d.ts +11 -0
  101. package/dist/ui/commands-overlay.js +410 -0
  102. package/dist/ui/config-overlay.d.ts +34 -0
  103. package/dist/ui/config-overlay.js +977 -0
  104. package/dist/ui/conversation.d.ts +82 -0
  105. package/dist/ui/conversation.js +508 -0
  106. package/dist/ui/diff.d.ts +38 -0
  107. package/dist/ui/diff.js +182 -0
  108. package/dist/ui/ephemeral.d.ts +111 -0
  109. package/dist/ui/ephemeral.js +413 -0
  110. package/dist/ui/file-autocomplete.d.ts +45 -0
  111. package/dist/ui/file-autocomplete.js +237 -0
  112. package/dist/ui/footer.d.ts +153 -0
  113. package/dist/ui/footer.js +422 -0
  114. package/dist/ui/index.d.ts +12 -0
  115. package/dist/ui/index.js +15 -0
  116. package/dist/ui/init-overlay.d.ts +24 -0
  117. package/dist/ui/init-overlay.js +525 -0
  118. package/dist/ui/input-prompt-v2.d.ts +179 -0
  119. package/dist/ui/input-prompt-v2.js +991 -0
  120. package/dist/ui/input-prompt.d.ts +97 -0
  121. package/dist/ui/input-prompt.js +800 -0
  122. package/dist/ui/iteration-limit-overlay.d.ts +21 -0
  123. package/dist/ui/iteration-limit-overlay.js +150 -0
  124. package/dist/ui/keys-overlay.d.ts +14 -0
  125. package/dist/ui/keys-overlay.js +181 -0
  126. package/dist/ui/model-warning-overlay.d.ts +30 -0
  127. package/dist/ui/model-warning-overlay.js +171 -0
  128. package/dist/ui/overlay-controller.d.ts +25 -0
  129. package/dist/ui/overlay-controller.js +35 -0
  130. package/dist/ui/overlays.d.ts +47 -0
  131. package/dist/ui/overlays.js +627 -0
  132. package/dist/ui/permission-overlay.d.ts +16 -0
  133. package/dist/ui/permission-overlay.js +494 -0
  134. package/dist/ui/terminal.d.ts +117 -0
  135. package/dist/ui/terminal.js +237 -0
  136. package/dist/ui/todo-zone.d.ts +112 -0
  137. package/dist/ui/todo-zone.js +353 -0
  138. package/dist/ui/tools-overlay.d.ts +26 -0
  139. package/dist/ui/tools-overlay.js +278 -0
  140. package/dist/ui/tutorial-overlay.d.ts +10 -0
  141. package/dist/ui/tutorial-overlay.js +936 -0
  142. package/dist/ui/types.d.ts +103 -0
  143. package/dist/ui/types.js +33 -0
  144. package/dist/utils/credentials.d.ts +55 -0
  145. package/dist/utils/credentials.js +268 -0
  146. package/dist/utils/model-tiers.d.ts +37 -0
  147. package/dist/utils/model-tiers.js +118 -0
  148. package/dist/utils/project-memory.d.ts +47 -0
  149. package/dist/utils/project-memory.js +117 -0
  150. package/dist/utils/project-status.d.ts +56 -0
  151. package/dist/utils/project-status.js +237 -0
  152. package/package.json +66 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Config JSON Template Generator
3
+ *
4
+ * Generates the .compilr/config.json file for workflow versioning and settings.
5
+ */
6
+ import type { ProjectConfig } from './types.js';
7
+ export interface CompilrConfig {
8
+ version: string;
9
+ project: {
10
+ name: string;
11
+ description: string;
12
+ createdAt: string;
13
+ };
14
+ paths: {
15
+ /** Absolute path to the project/code repository */
16
+ project: string;
17
+ /** Absolute path to the docs repository (two-repo pattern only) */
18
+ docs: string | null;
19
+ /** Directory where .compilr/config.json lives (for reference) */
20
+ workflowRoot: string;
21
+ };
22
+ settings: {
23
+ repoPattern: 'single' | 'two-repo';
24
+ techStack: string;
25
+ codingStandards: string;
26
+ };
27
+ sessions: {
28
+ count: number;
29
+ lastSession: string | null;
30
+ };
31
+ }
32
+ /**
33
+ * Generate config.json content
34
+ * @param config Project configuration
35
+ * @param projectPath Absolute path to the project folder
36
+ * @param docsPath Absolute path to the docs folder (for two-repo pattern)
37
+ */
38
+ export declare function generateConfigJson(config: ProjectConfig, projectPath?: string, docsPath?: string): string;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Config JSON Template Generator
3
+ *
4
+ * Generates the .compilr/config.json file for workflow versioning and settings.
5
+ */
6
+ import { WORKFLOW_VERSION } from './types.js';
7
+ /**
8
+ * Generate config.json content
9
+ * @param config Project configuration
10
+ * @param projectPath Absolute path to the project folder
11
+ * @param docsPath Absolute path to the docs folder (for two-repo pattern)
12
+ */
13
+ export function generateConfigJson(config, projectPath, docsPath) {
14
+ // Determine workflow root (where config.json lives)
15
+ const workflowRoot = config.repoPattern === 'two-repo' ? docsPath : projectPath;
16
+ const compilrConfig = {
17
+ version: WORKFLOW_VERSION,
18
+ project: {
19
+ name: config.name,
20
+ description: config.description,
21
+ createdAt: new Date().toISOString(),
22
+ },
23
+ paths: {
24
+ project: projectPath ?? '',
25
+ docs: config.repoPattern === 'two-repo' ? (docsPath ?? null) : null,
26
+ workflowRoot: workflowRoot ?? '',
27
+ },
28
+ settings: {
29
+ repoPattern: config.repoPattern,
30
+ techStack: config.techStack,
31
+ codingStandards: config.codingStandards,
32
+ },
33
+ sessions: {
34
+ count: 0,
35
+ lastSession: null,
36
+ },
37
+ };
38
+ return JSON.stringify(compilrConfig, null, 2) + '\n';
39
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Gitignore Template Generator
3
+ *
4
+ * Generates a .gitignore file based on tech stack.
5
+ */
6
+ import type { ProjectConfig } from './types.js';
7
+ export declare function generateGitignore(config: ProjectConfig): string;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Gitignore Template Generator
3
+ *
4
+ * Generates a .gitignore file based on tech stack.
5
+ */
6
+ export function generateGitignore(config) {
7
+ const common = `# Dependencies
8
+ node_modules/
9
+ .pnp/
10
+ .pnp.js
11
+
12
+ # Build outputs
13
+ dist/
14
+ build/
15
+ *.tsbuildinfo
16
+
17
+ # Environment files
18
+ .env
19
+ .env.local
20
+ .env.*.local
21
+
22
+ # IDE
23
+ .idea/
24
+ .vscode/
25
+ *.swp
26
+ *.swo
27
+ *~
28
+
29
+ # OS
30
+ .DS_Store
31
+ Thumbs.db
32
+
33
+ # Logs
34
+ logs/
35
+ *.log
36
+ npm-debug.log*
37
+
38
+ # Testing
39
+ coverage/
40
+ .nyc_output/
41
+
42
+ # Cache
43
+ .cache/
44
+ .parcel-cache/
45
+ `;
46
+ const techSpecific = getTechSpecificIgnore(config.techStack);
47
+ return common + '\n' + techSpecific;
48
+ }
49
+ function getTechSpecificIgnore(techStack) {
50
+ switch (techStack) {
51
+ case 'react-node-pg':
52
+ case 'vue-node-pg':
53
+ return `# Vite
54
+ .vite/
55
+
56
+ # Prisma
57
+ prisma/*.db
58
+ prisma/*.db-journal
59
+ `;
60
+ case 'react-python-pg':
61
+ return `# Vite
62
+ .vite/
63
+
64
+ # Python
65
+ __pycache__/
66
+ *.py[cod]
67
+ *$py.class
68
+ *.so
69
+ .Python
70
+ venv/
71
+ .venv/
72
+ ENV/
73
+ env/
74
+ .eggs/
75
+ *.egg-info/
76
+ *.egg
77
+ .mypy_cache/
78
+ .pytest_cache/
79
+ `;
80
+ case 'custom':
81
+ default:
82
+ return `# Add tech-specific ignores here
83
+ `;
84
+ }
85
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Project Generator
3
+ *
4
+ * Main module for generating project scaffolding.
5
+ */
6
+ import type { ProjectConfig, GenerationResult } from './types.js';
7
+ export * from './types.js';
8
+ /**
9
+ * Generate a new project from configuration
10
+ */
11
+ export declare function generateProject(config: ProjectConfig, basePath?: string): Promise<GenerationResult>;
12
+ /**
13
+ * Validate project name
14
+ */
15
+ export declare function isValidProjectName(name: string): boolean;
16
+ /**
17
+ * Check if project directory already exists
18
+ */
19
+ export declare function projectExists(name: string, basePath?: string): boolean;
@@ -0,0 +1,302 @@
1
+ /**
2
+ * Project Generator
3
+ *
4
+ * Main module for generating project scaffolding.
5
+ */
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import { execSync } from 'child_process';
9
+ export * from './types.js';
10
+ import { generateCompilrMd } from './compilr-md.js';
11
+ import { generateBacklogMd } from './backlog-md.js';
12
+ import { generateCodingStandardsMd } from './coding-standards.js';
13
+ import { generateConfigJson } from './config-json.js';
14
+ import { generateReadmeMd } from './readme-md.js';
15
+ import { generatePackageJson } from './package-json.js';
16
+ import { generateGitignore } from './gitignore.js';
17
+ import { generateTsconfig } from './tsconfig.js';
18
+ // =============================================================================
19
+ // Main Generator
20
+ // =============================================================================
21
+ /**
22
+ * Generate a new project from configuration
23
+ */
24
+ export function generateProject(config, basePath = process.cwd()) {
25
+ const filesCreated = [];
26
+ try {
27
+ if (config.repoPattern === 'single') {
28
+ return Promise.resolve(generateSingleRepoProject(config, basePath, filesCreated));
29
+ }
30
+ else {
31
+ return Promise.resolve(generateTwoRepoProject(config, basePath, filesCreated));
32
+ }
33
+ }
34
+ catch (error) {
35
+ return Promise.resolve({
36
+ success: false,
37
+ projectPath: path.join(basePath, config.name),
38
+ filesCreated,
39
+ error: error instanceof Error ? error.message : String(error),
40
+ });
41
+ }
42
+ }
43
+ // =============================================================================
44
+ // Single Repo Pattern
45
+ // =============================================================================
46
+ function generateSingleRepoProject(config, basePath, filesCreated) {
47
+ const projectPath = path.join(basePath, config.name);
48
+ // Create directory structure
49
+ const dirs = [
50
+ projectPath,
51
+ path.join(projectPath, 'src'),
52
+ path.join(projectPath, '.compilr'),
53
+ path.join(projectPath, '.compilr', 'requirements'),
54
+ path.join(projectPath, '.compilr', 'architecture'),
55
+ path.join(projectPath, '.compilr', 'architecture', 'decisions'),
56
+ path.join(projectPath, '.compilr', 'docs'),
57
+ path.join(projectPath, '.compilr', 'sessions'),
58
+ ];
59
+ for (const dir of dirs) {
60
+ fs.mkdirSync(dir, { recursive: true });
61
+ }
62
+ // Generate and write files
63
+ const files = [
64
+ // Root files
65
+ { path: path.join(projectPath, 'COMPILR.md'), content: generateCompilrMd(config) },
66
+ { path: path.join(projectPath, 'README.md'), content: generateReadmeMd(config) },
67
+ { path: path.join(projectPath, 'package.json'), content: generatePackageJson(config) },
68
+ { path: path.join(projectPath, '.gitignore'), content: generateGitignore(config) },
69
+ { path: path.join(projectPath, 'tsconfig.json'), content: generateTsconfig(config) },
70
+ // .compilr files
71
+ { path: path.join(projectPath, '.compilr', 'config.json'), content: generateConfigJson(config, projectPath) },
72
+ { path: path.join(projectPath, '.compilr', 'backlog.md'), content: generateBacklogMd(config) },
73
+ { path: path.join(projectPath, '.compilr', 'roadmap.md'), content: generateRoadmapMd(config) },
74
+ {
75
+ path: path.join(projectPath, '.compilr', 'architecture', 'coding-standards.md'),
76
+ content: generateCodingStandardsMd(config),
77
+ },
78
+ {
79
+ path: path.join(projectPath, '.compilr', 'requirements', 'PRD.md'),
80
+ content: generatePrdMd(config),
81
+ },
82
+ {
83
+ path: path.join(projectPath, '.compilr', 'docs', 'README.md'),
84
+ content: '# Documentation\n\n*Add your documentation here*\n',
85
+ },
86
+ {
87
+ path: path.join(projectPath, '.compilr', 'sessions', 'README.md'),
88
+ content: '# Session Notes\n\n*Session notes will be auto-generated here*\n',
89
+ },
90
+ ];
91
+ for (const file of files) {
92
+ fs.writeFileSync(file.path, file.content, 'utf-8');
93
+ filesCreated.push(file.path);
94
+ }
95
+ // Initialize git if requested
96
+ if (config.initGit) {
97
+ initGit(projectPath);
98
+ }
99
+ return {
100
+ success: true,
101
+ projectPath,
102
+ filesCreated,
103
+ };
104
+ }
105
+ // =============================================================================
106
+ // Two Repo Pattern
107
+ // =============================================================================
108
+ function generateTwoRepoProject(config, basePath, filesCreated) {
109
+ const projectPath = path.join(basePath, config.name);
110
+ const docsPath = path.join(basePath, `${config.name}-docs`);
111
+ // Create code repo structure
112
+ const codeDirs = [projectPath, path.join(projectPath, 'src')];
113
+ for (const dir of codeDirs) {
114
+ fs.mkdirSync(dir, { recursive: true });
115
+ }
116
+ // Create docs repo structure
117
+ const docsDirs = [
118
+ docsPath,
119
+ path.join(docsPath, '.compilr'),
120
+ path.join(docsPath, '00-requirements'),
121
+ path.join(docsPath, '01-planning'),
122
+ path.join(docsPath, '02-architecture'),
123
+ path.join(docsPath, '02-architecture', 'decisions'),
124
+ path.join(docsPath, '03-documentation'),
125
+ path.join(docsPath, '04-session-notes'),
126
+ ];
127
+ for (const dir of docsDirs) {
128
+ fs.mkdirSync(dir, { recursive: true });
129
+ }
130
+ // Generate code repo files
131
+ const codeFiles = [
132
+ { path: path.join(projectPath, 'README.md'), content: generateReadmeMd(config) },
133
+ { path: path.join(projectPath, 'package.json'), content: generatePackageJson(config) },
134
+ { path: path.join(projectPath, '.gitignore'), content: generateGitignore(config) },
135
+ { path: path.join(projectPath, 'tsconfig.json'), content: generateTsconfig(config) },
136
+ ];
137
+ for (const file of codeFiles) {
138
+ fs.writeFileSync(file.path, file.content, 'utf-8');
139
+ filesCreated.push(file.path);
140
+ }
141
+ // Generate docs repo files
142
+ const docsFiles = [
143
+ { path: path.join(docsPath, 'COMPILR.md'), content: generateCompilrMd(config) },
144
+ { path: path.join(docsPath, '.compilr', 'config.json'), content: generateConfigJson(config, projectPath, docsPath) },
145
+ { path: path.join(docsPath, '00-requirements', 'PRD.md'), content: generatePrdMd(config) },
146
+ { path: path.join(docsPath, '01-planning', 'backlog.md'), content: generateBacklogMd(config) },
147
+ { path: path.join(docsPath, '01-planning', 'roadmap.md'), content: generateRoadmapMd(config) },
148
+ {
149
+ path: path.join(docsPath, '02-architecture', 'coding-standards.md'),
150
+ content: generateCodingStandardsMd(config),
151
+ },
152
+ {
153
+ path: path.join(docsPath, '03-documentation', 'README.md'),
154
+ content: '# Documentation\n\n*Add your documentation here*\n',
155
+ },
156
+ {
157
+ path: path.join(docsPath, '04-session-notes', 'README.md'),
158
+ content: '# Session Notes\n\n*Session notes will be auto-generated here*\n',
159
+ },
160
+ ];
161
+ for (const file of docsFiles) {
162
+ fs.writeFileSync(file.path, file.content, 'utf-8');
163
+ filesCreated.push(file.path);
164
+ }
165
+ // Initialize git if requested
166
+ if (config.initGit) {
167
+ initGit(projectPath);
168
+ initGit(docsPath);
169
+ }
170
+ return {
171
+ success: true,
172
+ projectPath,
173
+ docsPath,
174
+ filesCreated,
175
+ };
176
+ }
177
+ // =============================================================================
178
+ // Helper Functions
179
+ // =============================================================================
180
+ function initGit(projectPath) {
181
+ try {
182
+ execSync('git init', { cwd: projectPath, stdio: 'ignore' });
183
+ execSync('git add .', { cwd: projectPath, stdio: 'ignore' });
184
+ execSync('git commit -m "Initial commit from compilr init"', {
185
+ cwd: projectPath,
186
+ stdio: 'ignore',
187
+ });
188
+ }
189
+ catch {
190
+ // Git init failed - not critical
191
+ }
192
+ }
193
+ function generateRoadmapMd(config) {
194
+ return `# Roadmap - ${config.name}
195
+
196
+ ## Vision
197
+
198
+ ${config.description}
199
+
200
+ ---
201
+
202
+ ## Milestones
203
+
204
+ ### Milestone 1: Foundation
205
+ - [ ] Project setup
206
+ - [ ] Development environment
207
+ - [ ] CI/CD pipeline
208
+
209
+ ### Milestone 2: Core Features
210
+ - [ ] *Define your core features*
211
+
212
+ ### Milestone 3: Launch
213
+ - [ ] Testing
214
+ - [ ] Documentation
215
+ - [ ] Deploy to production
216
+
217
+ ---
218
+
219
+ ## Timeline
220
+
221
+ *Add your timeline here*
222
+
223
+ ---
224
+
225
+ *Last Updated: ${new Date().toISOString().split('T')[0]}*
226
+ `;
227
+ }
228
+ function generatePrdMd(config) {
229
+ return `# Product Requirements Document - ${config.name}
230
+
231
+ ## Overview
232
+
233
+ ${config.description}
234
+
235
+ ---
236
+
237
+ ## Problem Statement
238
+
239
+ *What problem does this project solve?*
240
+
241
+ ---
242
+
243
+ ## Goals
244
+
245
+ 1. *Primary goal*
246
+ 2. *Secondary goal*
247
+ 3. *Success metrics*
248
+
249
+ ---
250
+
251
+ ## User Stories
252
+
253
+ ### As a user, I want to...
254
+
255
+ 1. *User story 1*
256
+ 2. *User story 2*
257
+ 3. *User story 3*
258
+
259
+ ---
260
+
261
+ ## Requirements
262
+
263
+ ### Functional Requirements
264
+
265
+ | ID | Requirement | Priority |
266
+ |----|-------------|----------|
267
+ | FR-1 | | High |
268
+ | FR-2 | | Medium |
269
+ | FR-3 | | Low |
270
+
271
+ ### Non-Functional Requirements
272
+
273
+ - Performance: *Specify targets*
274
+ - Security: *Specify requirements*
275
+ - Accessibility: *Specify standards*
276
+
277
+ ---
278
+
279
+ ## Out of Scope
280
+
281
+ *What is NOT included in this version*
282
+
283
+ ---
284
+
285
+ *Last Updated: ${new Date().toISOString().split('T')[0]}*
286
+ `;
287
+ }
288
+ // =============================================================================
289
+ // Validation
290
+ // =============================================================================
291
+ /**
292
+ * Validate project name
293
+ */
294
+ export function isValidProjectName(name) {
295
+ return /^[a-z][a-z0-9-]{1,49}$/.test(name);
296
+ }
297
+ /**
298
+ * Check if project directory already exists
299
+ */
300
+ export function projectExists(name, basePath = process.cwd()) {
301
+ return fs.existsSync(path.join(basePath, name));
302
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Package JSON Template Generator
3
+ *
4
+ * Generates a basic package.json for the project.
5
+ */
6
+ import type { ProjectConfig } from './types.js';
7
+ export declare function generatePackageJson(config: ProjectConfig): string;
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Package JSON Template Generator
3
+ *
4
+ * Generates a basic package.json for the project.
5
+ */
6
+ export function generatePackageJson(config) {
7
+ const pkg = getPackageTemplate(config);
8
+ return JSON.stringify(pkg, null, 2) + '\n';
9
+ }
10
+ function getPackageTemplate(config) {
11
+ const base = {
12
+ name: config.name,
13
+ version: '0.0.1',
14
+ description: config.description,
15
+ type: 'module',
16
+ scripts: {},
17
+ dependencies: {},
18
+ devDependencies: {},
19
+ };
20
+ switch (config.techStack) {
21
+ case 'react-node-pg':
22
+ return {
23
+ ...base,
24
+ scripts: {
25
+ dev: 'vite',
26
+ build: 'tsc && vite build',
27
+ lint: 'eslint src/',
28
+ preview: 'vite preview',
29
+ },
30
+ dependencies: {
31
+ react: '^18.2.0',
32
+ 'react-dom': '^18.2.0',
33
+ },
34
+ devDependencies: {
35
+ '@types/react': '^18.2.0',
36
+ '@types/react-dom': '^18.2.0',
37
+ '@vitejs/plugin-react': '^4.2.0',
38
+ typescript: '^5.3.0',
39
+ vite: '^5.0.0',
40
+ ...(config.codingStandards !== 'custom'
41
+ ? {
42
+ eslint: '^9.0.0',
43
+ '@eslint/js': '^9.0.0',
44
+ 'typescript-eslint': '^8.0.0',
45
+ prettier: '^3.2.0',
46
+ }
47
+ : {}),
48
+ },
49
+ };
50
+ case 'vue-node-pg':
51
+ return {
52
+ ...base,
53
+ scripts: {
54
+ dev: 'vite',
55
+ build: 'vue-tsc && vite build',
56
+ lint: 'eslint src/',
57
+ preview: 'vite preview',
58
+ },
59
+ dependencies: {
60
+ vue: '^3.4.0',
61
+ },
62
+ devDependencies: {
63
+ '@vitejs/plugin-vue': '^5.0.0',
64
+ typescript: '^5.3.0',
65
+ 'vue-tsc': '^1.8.0',
66
+ vite: '^5.0.0',
67
+ ...(config.codingStandards !== 'custom'
68
+ ? {
69
+ eslint: '^9.0.0',
70
+ '@eslint/js': '^9.0.0',
71
+ 'typescript-eslint': '^8.0.0',
72
+ prettier: '^3.2.0',
73
+ }
74
+ : {}),
75
+ },
76
+ };
77
+ case 'react-python-pg':
78
+ // Frontend only - Python backend has its own requirements.txt
79
+ return {
80
+ ...base,
81
+ scripts: {
82
+ dev: 'vite',
83
+ build: 'tsc && vite build',
84
+ lint: 'eslint src/',
85
+ preview: 'vite preview',
86
+ },
87
+ dependencies: {
88
+ react: '^18.2.0',
89
+ 'react-dom': '^18.2.0',
90
+ },
91
+ devDependencies: {
92
+ '@types/react': '^18.2.0',
93
+ '@types/react-dom': '^18.2.0',
94
+ '@vitejs/plugin-react': '^4.2.0',
95
+ typescript: '^5.3.0',
96
+ vite: '^5.0.0',
97
+ },
98
+ };
99
+ case 'custom':
100
+ default:
101
+ return {
102
+ ...base,
103
+ scripts: {
104
+ dev: 'echo "Add your dev command"',
105
+ build: 'echo "Add your build command"',
106
+ lint: 'echo "Add your lint command"',
107
+ test: 'echo "Add your test command"',
108
+ },
109
+ };
110
+ }
111
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * README.md Template Generator
3
+ *
4
+ * Generates the project README with next steps.
5
+ */
6
+ import type { ProjectConfig } from './types.js';
7
+ export declare function generateReadmeMd(config: ProjectConfig): string;