@compilr-dev/sdk 0.2.4 → 0.2.6
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/dist/index.d.ts +2 -0
- package/dist/index.js +12 -0
- package/dist/platform/sqlite/db.js +5 -3
- package/dist/project-generator/detection.d.ts +42 -0
- package/dist/project-generator/detection.js +401 -0
- package/dist/project-generator/generator.d.ts +14 -0
- package/dist/project-generator/generator.js +245 -0
- package/dist/project-generator/index.d.ts +11 -0
- package/dist/project-generator/index.js +13 -0
- package/dist/project-generator/templates/coding-standards.d.ts +7 -0
- package/dist/project-generator/templates/coding-standards.js +299 -0
- package/dist/project-generator/templates/compilr-md-import.d.ts +8 -0
- package/dist/project-generator/templates/compilr-md-import.js +241 -0
- package/dist/project-generator/templates/compilr-md.d.ts +7 -0
- package/dist/project-generator/templates/compilr-md.js +141 -0
- package/dist/project-generator/templates/config-json.d.ts +13 -0
- package/dist/project-generator/templates/config-json.js +39 -0
- package/dist/project-generator/templates/gitignore.d.ts +7 -0
- package/dist/project-generator/templates/gitignore.js +85 -0
- package/dist/project-generator/templates/index.d.ts +11 -0
- package/dist/project-generator/templates/index.js +11 -0
- package/dist/project-generator/templates/package-json.d.ts +7 -0
- package/dist/project-generator/templates/package-json.js +111 -0
- package/dist/project-generator/templates/readme-md.d.ts +7 -0
- package/dist/project-generator/templates/readme-md.js +165 -0
- package/dist/project-generator/templates/tsconfig.d.ts +7 -0
- package/dist/project-generator/templates/tsconfig.js +61 -0
- package/dist/project-generator/types.d.ts +95 -0
- package/dist/project-generator/types.js +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COMPILR.md Template Generator for Imported Projects
|
|
3
|
+
*
|
|
4
|
+
* Generates the AI assistant context file for existing projects that are being imported.
|
|
5
|
+
* Different from the new project template - acknowledges existing codebase structure.
|
|
6
|
+
*/
|
|
7
|
+
export function generateCompilrMdForImport(config) {
|
|
8
|
+
const techStackSection = generateTechStackSection(config);
|
|
9
|
+
const structureSection = generateStructureSection(config);
|
|
10
|
+
return `# COMPILR.md
|
|
11
|
+
|
|
12
|
+
This file provides guidance to AI coding assistants when working with this project.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Project Overview
|
|
17
|
+
|
|
18
|
+
**Project:** ${config.displayName}
|
|
19
|
+
${config.description ? `**Description:** ${config.description}` : '*Add a description for this project*'}
|
|
20
|
+
|
|
21
|
+
**Workflow:** ${config.workflowMode === 'guided' ? 'Guided (structured step-by-step workflow)' : 'Flexible (user-driven, exploratory)'}
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
${techStackSection}
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
${structureSection}
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Project Data (Database-Backed)
|
|
34
|
+
|
|
35
|
+
This project uses compilr's database for tracking. Use these tools to access project data:
|
|
36
|
+
|
|
37
|
+
| Data Type | Read Tool | Write Tool |
|
|
38
|
+
|-----------|-----------|------------|
|
|
39
|
+
| Work Items (Backlog) | \`workitem_query\` | \`workitem_add\`, \`workitem_update\` |
|
|
40
|
+
| Project Documents | \`project_document_get\`, \`project_document_list\` | \`project_document_add\` |
|
|
41
|
+
| Anchors (Context) | \`anchor_list\` | \`anchor_add\`, \`anchor_remove\` |
|
|
42
|
+
|
|
43
|
+
**Important:** Use database tools for project metadata. Explore the existing codebase for implementation details.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Development Commands
|
|
48
|
+
|
|
49
|
+
\`\`\`bash
|
|
50
|
+
${generateDevCommands(config)}
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Notes for AI Assistants
|
|
56
|
+
|
|
57
|
+
1. **This is an existing codebase** - Explore the code structure before making changes
|
|
58
|
+
2. **Respect existing patterns** - Follow the conventions already established in this project
|
|
59
|
+
3. **Use database tools** to query backlog, documents, and anchors (project metadata)
|
|
60
|
+
4. **Check the backlog** with \`workitem_query\` before starting new work
|
|
61
|
+
5. **Read existing code** to understand the architecture before adding features
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
*Generated by compilr on ${new Date().toISOString().split('T')[0]}*
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
function generateTechStackSection(config) {
|
|
69
|
+
const { detected } = config;
|
|
70
|
+
if (!detected.language) {
|
|
71
|
+
return `## Tech Stack
|
|
72
|
+
|
|
73
|
+
*Tech stack not auto-detected. Update this section with your project's technologies.*
|
|
74
|
+
|
|
75
|
+
| Component | Technology | Notes |
|
|
76
|
+
|-----------|------------|-------|
|
|
77
|
+
| Language | TBD | |
|
|
78
|
+
| Framework | TBD | |
|
|
79
|
+
| Database | TBD | |`;
|
|
80
|
+
}
|
|
81
|
+
const languageLabel = getLanguageLabel(detected.language);
|
|
82
|
+
const frameworkLabel = detected.framework
|
|
83
|
+
? getFrameworkLabel(detected.framework)
|
|
84
|
+
: 'Not detected';
|
|
85
|
+
const packageManagerLabel = detected.packageManager ?? 'Not detected';
|
|
86
|
+
return `## Tech Stack
|
|
87
|
+
|
|
88
|
+
*Auto-detected from project files. Update as needed.*
|
|
89
|
+
|
|
90
|
+
| Component | Technology | Notes |
|
|
91
|
+
|-----------|------------|-------|
|
|
92
|
+
| Language | ${languageLabel} | Detected |
|
|
93
|
+
| Framework | ${frameworkLabel} | ${detected.framework ? 'Detected' : 'Update this'} |
|
|
94
|
+
| Package Manager | ${packageManagerLabel} | ${detected.packageManager ? 'Detected' : 'Update this'} |
|
|
95
|
+
| Database | *Not detected* | Update this |`;
|
|
96
|
+
}
|
|
97
|
+
function generateStructureSection(config) {
|
|
98
|
+
const { detected } = config;
|
|
99
|
+
// Provide guidance based on detected language
|
|
100
|
+
const languageHints = {
|
|
101
|
+
node: `- \`src/\` - Source code
|
|
102
|
+
- \`package.json\` - Dependencies and scripts
|
|
103
|
+
- \`tsconfig.json\` - TypeScript configuration (if TypeScript)`,
|
|
104
|
+
python: `- \`src/\` or project module - Source code
|
|
105
|
+
- \`pyproject.toml\` / \`requirements.txt\` - Dependencies
|
|
106
|
+
- \`tests/\` - Test files`,
|
|
107
|
+
go: `- Go modules structure
|
|
108
|
+
- \`go.mod\` - Module definition
|
|
109
|
+
- \`cmd/\` - Main applications (if present)
|
|
110
|
+
- \`internal/\` - Private packages (if present)`,
|
|
111
|
+
rust: `- \`src/\` - Source code
|
|
112
|
+
- \`Cargo.toml\` - Dependencies and project config
|
|
113
|
+
- \`target/\` - Build output (gitignored)`,
|
|
114
|
+
default: `*Explore the project to understand its structure.*`,
|
|
115
|
+
};
|
|
116
|
+
const hint = detected.language
|
|
117
|
+
? (languageHints[detected.language] ?? languageHints.default)
|
|
118
|
+
: languageHints.default;
|
|
119
|
+
return `## Project Structure
|
|
120
|
+
|
|
121
|
+
*This is an existing codebase. Key locations:*
|
|
122
|
+
|
|
123
|
+
${hint}
|
|
124
|
+
|
|
125
|
+
**Tip:** Use \`glob\` and \`read_file\` tools to explore the codebase structure.`;
|
|
126
|
+
}
|
|
127
|
+
function generateDevCommands(config) {
|
|
128
|
+
const { detected } = config;
|
|
129
|
+
const commands = {
|
|
130
|
+
node: `# Install dependencies
|
|
131
|
+
npm install
|
|
132
|
+
|
|
133
|
+
# Development
|
|
134
|
+
npm run dev
|
|
135
|
+
|
|
136
|
+
# Build
|
|
137
|
+
npm run build
|
|
138
|
+
|
|
139
|
+
# Test
|
|
140
|
+
npm test`,
|
|
141
|
+
pnpm: `# Install dependencies
|
|
142
|
+
pnpm install
|
|
143
|
+
|
|
144
|
+
# Development
|
|
145
|
+
pnpm dev
|
|
146
|
+
|
|
147
|
+
# Build
|
|
148
|
+
pnpm build
|
|
149
|
+
|
|
150
|
+
# Test
|
|
151
|
+
pnpm test`,
|
|
152
|
+
yarn: `# Install dependencies
|
|
153
|
+
yarn install
|
|
154
|
+
|
|
155
|
+
# Development
|
|
156
|
+
yarn dev
|
|
157
|
+
|
|
158
|
+
# Build
|
|
159
|
+
yarn build
|
|
160
|
+
|
|
161
|
+
# Test
|
|
162
|
+
yarn test`,
|
|
163
|
+
python: `# Install dependencies (adjust for your package manager)
|
|
164
|
+
pip install -r requirements.txt
|
|
165
|
+
# or: poetry install
|
|
166
|
+
# or: pdm install
|
|
167
|
+
|
|
168
|
+
# Run application
|
|
169
|
+
python -m ${config.name.replace(/-/g, '_')}
|
|
170
|
+
|
|
171
|
+
# Test
|
|
172
|
+
pytest`,
|
|
173
|
+
go: `# Download dependencies
|
|
174
|
+
go mod download
|
|
175
|
+
|
|
176
|
+
# Build
|
|
177
|
+
go build ./...
|
|
178
|
+
|
|
179
|
+
# Test
|
|
180
|
+
go test ./...
|
|
181
|
+
|
|
182
|
+
# Run (adjust for your main package)
|
|
183
|
+
go run ./cmd/${config.name}`,
|
|
184
|
+
rust: `# Build
|
|
185
|
+
cargo build
|
|
186
|
+
|
|
187
|
+
# Run
|
|
188
|
+
cargo run
|
|
189
|
+
|
|
190
|
+
# Test
|
|
191
|
+
cargo test`,
|
|
192
|
+
default: `# Update these commands for your project
|
|
193
|
+
# npm run dev
|
|
194
|
+
# npm run build
|
|
195
|
+
# npm test`,
|
|
196
|
+
};
|
|
197
|
+
if (detected.packageManager === 'pnpm')
|
|
198
|
+
return commands.pnpm;
|
|
199
|
+
if (detected.packageManager === 'yarn')
|
|
200
|
+
return commands.yarn;
|
|
201
|
+
if (detected.language)
|
|
202
|
+
return commands[detected.language] ?? commands.default;
|
|
203
|
+
return commands.default;
|
|
204
|
+
}
|
|
205
|
+
function getLanguageLabel(language) {
|
|
206
|
+
const labels = {
|
|
207
|
+
node: 'Node.js / TypeScript',
|
|
208
|
+
go: 'Go',
|
|
209
|
+
python: 'Python',
|
|
210
|
+
rust: 'Rust',
|
|
211
|
+
java: 'Java',
|
|
212
|
+
kotlin: 'Kotlin',
|
|
213
|
+
php: 'PHP',
|
|
214
|
+
ruby: 'Ruby',
|
|
215
|
+
dotnet: '.NET (C#/F#)',
|
|
216
|
+
};
|
|
217
|
+
return labels[language] ?? language;
|
|
218
|
+
}
|
|
219
|
+
function getFrameworkLabel(framework) {
|
|
220
|
+
const labels = {
|
|
221
|
+
react: 'React',
|
|
222
|
+
vue: 'Vue.js',
|
|
223
|
+
svelte: 'Svelte',
|
|
224
|
+
angular: 'Angular',
|
|
225
|
+
next: 'Next.js',
|
|
226
|
+
nuxt: 'Nuxt.js',
|
|
227
|
+
express: 'Express.js',
|
|
228
|
+
fastify: 'Fastify',
|
|
229
|
+
koa: 'Koa',
|
|
230
|
+
hono: 'Hono',
|
|
231
|
+
electron: 'Electron',
|
|
232
|
+
fastapi: 'FastAPI',
|
|
233
|
+
django: 'Django',
|
|
234
|
+
flask: 'Flask',
|
|
235
|
+
rails: 'Ruby on Rails',
|
|
236
|
+
sinatra: 'Sinatra',
|
|
237
|
+
laravel: 'Laravel',
|
|
238
|
+
symfony: 'Symfony',
|
|
239
|
+
};
|
|
240
|
+
return labels[framework] ?? framework;
|
|
241
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COMPILR.md Template Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates the AI assistant context file.
|
|
5
|
+
*/
|
|
6
|
+
export function generateCompilrMd(config) {
|
|
7
|
+
const techStackSection = generateTechStackSection(config);
|
|
8
|
+
const codingStandardsSection = generateCodingStandardsSection(config);
|
|
9
|
+
return `# COMPILR.md
|
|
10
|
+
|
|
11
|
+
This file provides guidance to AI coding assistants when working with this project.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Project Overview
|
|
16
|
+
|
|
17
|
+
**Project:** ${config.name}
|
|
18
|
+
**Description:** ${config.description}
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
${techStackSection}
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
${codingStandardsSection}
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Project Data (Database-Backed)
|
|
31
|
+
|
|
32
|
+
This project uses compilr's database for tracking. Use these tools to access project data:
|
|
33
|
+
|
|
34
|
+
| Data Type | Read Tool | Write Tool |
|
|
35
|
+
|-----------|-----------|------------|
|
|
36
|
+
| Work Items (Backlog) | \`workitem_query\` | \`workitem_add\`, \`workitem_update\` |
|
|
37
|
+
| Project Documents | \`project_document_get\`, \`project_document_list\` | \`project_document_add\` |
|
|
38
|
+
| Anchors (Context) | \`anchor_list\` | \`anchor_add\`, \`anchor_remove\` |
|
|
39
|
+
|
|
40
|
+
**Important:** Always use database tools instead of exploring the filesystem for project data.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Development Commands
|
|
45
|
+
|
|
46
|
+
\`\`\`bash
|
|
47
|
+
npm run dev # Start development server
|
|
48
|
+
npm run build # Production build
|
|
49
|
+
npm run lint # Lint code
|
|
50
|
+
npm run test # Run tests
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Notes for AI Assistants
|
|
56
|
+
|
|
57
|
+
1. **Use database tools** to query backlog, documents, and anchors (not filesystem)
|
|
58
|
+
2. **Check the backlog** with \`workitem_query\` before starting new work
|
|
59
|
+
3. **Follow coding standards** defined in this project
|
|
60
|
+
4. **Document decisions** when making architectural choices
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
*Last Updated: ${new Date().toISOString().split('T')[0]}*
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
function generateTechStackSection(config) {
|
|
68
|
+
if (config.techStack === 'custom') {
|
|
69
|
+
return `## Tech Stack
|
|
70
|
+
|
|
71
|
+
*To be configured - update this section with your chosen technologies*
|
|
72
|
+
|
|
73
|
+
| Component | Technology | Notes |
|
|
74
|
+
|-----------|------------|-------|
|
|
75
|
+
| Frontend | TBD | |
|
|
76
|
+
| Backend | TBD | |
|
|
77
|
+
| Database | TBD | |
|
|
78
|
+
| Hosting | TBD | |`;
|
|
79
|
+
}
|
|
80
|
+
const stacks = {
|
|
81
|
+
'react-node-pg': `## Tech Stack
|
|
82
|
+
|
|
83
|
+
| Component | Technology | Notes |
|
|
84
|
+
|-----------|------------|-------|
|
|
85
|
+
| Frontend | React 18 + Vite | TypeScript, modern React |
|
|
86
|
+
| Backend | Node.js + Express | TypeScript, REST API |
|
|
87
|
+
| Database | PostgreSQL | Relational, ACID compliant |
|
|
88
|
+
| ORM | Prisma | Type-safe database access |`,
|
|
89
|
+
'react-python-pg': `## Tech Stack
|
|
90
|
+
|
|
91
|
+
| Component | Technology | Notes |
|
|
92
|
+
|-----------|------------|-------|
|
|
93
|
+
| Frontend | React 18 + Vite | TypeScript, modern React |
|
|
94
|
+
| Backend | Python + FastAPI | Async, auto-docs |
|
|
95
|
+
| Database | PostgreSQL | Relational, ACID compliant |
|
|
96
|
+
| ORM | SQLAlchemy | Python ORM |`,
|
|
97
|
+
'vue-node-pg': `## Tech Stack
|
|
98
|
+
|
|
99
|
+
| Component | Technology | Notes |
|
|
100
|
+
|-----------|------------|-------|
|
|
101
|
+
| Frontend | Vue 3 + Vite | TypeScript, Composition API |
|
|
102
|
+
| Backend | Node.js + Express | TypeScript, REST API |
|
|
103
|
+
| Database | PostgreSQL | Relational, ACID compliant |
|
|
104
|
+
| ORM | Prisma | Type-safe database access |`,
|
|
105
|
+
};
|
|
106
|
+
return stacks[config.techStack] ?? stacks['react-node-pg'];
|
|
107
|
+
}
|
|
108
|
+
function generateCodingStandardsSection(config) {
|
|
109
|
+
if (config.codingStandards === 'custom') {
|
|
110
|
+
return `## Coding Standards
|
|
111
|
+
|
|
112
|
+
*To be configured - update this section with your coding standards*
|
|
113
|
+
|
|
114
|
+
See ${config.repoPattern === 'single' ? '`.compilr/architecture/coding-standards.md`' : '`02-architecture/coding-standards.md`'} for details.`;
|
|
115
|
+
}
|
|
116
|
+
const standards = config.codingStandards === 'strict'
|
|
117
|
+
? `## Coding Standards
|
|
118
|
+
|
|
119
|
+
**Preset:** TypeScript Strict
|
|
120
|
+
|
|
121
|
+
- TypeScript strict mode enabled
|
|
122
|
+
- ESLint + Prettier configured
|
|
123
|
+
- Conventional commits required
|
|
124
|
+
- No \`any\` types allowed
|
|
125
|
+
- Explicit return types required
|
|
126
|
+
- Comprehensive error handling
|
|
127
|
+
|
|
128
|
+
See ${config.repoPattern === 'single' ? '`.compilr/architecture/coding-standards.md`' : '`02-architecture/coding-standards.md`'} for full details.`
|
|
129
|
+
: `## Coding Standards
|
|
130
|
+
|
|
131
|
+
**Preset:** TypeScript Relaxed
|
|
132
|
+
|
|
133
|
+
- TypeScript with relaxed settings
|
|
134
|
+
- ESLint + Prettier configured
|
|
135
|
+
- Conventional commits encouraged
|
|
136
|
+
- \`any\` types discouraged but allowed
|
|
137
|
+
- Implicit return types allowed
|
|
138
|
+
|
|
139
|
+
See ${config.repoPattern === 'single' ? '`.compilr/architecture/coding-standards.md`' : '`02-architecture/coding-standards.md`'} for full details.`;
|
|
140
|
+
return standards;
|
|
141
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/**
|
|
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 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,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,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template barrel export
|
|
3
|
+
*/
|
|
4
|
+
export { generateCompilrMd } from './compilr-md.js';
|
|
5
|
+
export { generateConfigJson } from './config-json.js';
|
|
6
|
+
export { generateReadmeMd } from './readme-md.js';
|
|
7
|
+
export { generateCodingStandardsMd } from './coding-standards.js';
|
|
8
|
+
export { generatePackageJson } from './package-json.js';
|
|
9
|
+
export { generateTsconfig } from './tsconfig.js';
|
|
10
|
+
export { generateGitignore } from './gitignore.js';
|
|
11
|
+
export { generateCompilrMdForImport } from './compilr-md-import.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template barrel export
|
|
3
|
+
*/
|
|
4
|
+
export { generateCompilrMd } from './compilr-md.js';
|
|
5
|
+
export { generateConfigJson } from './config-json.js';
|
|
6
|
+
export { generateReadmeMd } from './readme-md.js';
|
|
7
|
+
export { generateCodingStandardsMd } from './coding-standards.js';
|
|
8
|
+
export { generatePackageJson } from './package-json.js';
|
|
9
|
+
export { generateTsconfig } from './tsconfig.js';
|
|
10
|
+
export { generateGitignore } from './gitignore.js';
|
|
11
|
+
export { generateCompilrMdForImport } from './compilr-md-import.js';
|
|
@@ -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
|
+
}
|