@compilr-dev/sdk 0.2.5 → 0.2.7
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 +4 -1
- package/dist/index.js +13 -1
- package/dist/platform/file-anchor-service.d.ts +62 -0
- package/dist/platform/file-anchor-service.js +241 -0
- package/dist/platform/index.d.ts +2 -0
- package/dist/platform/index.js +2 -0
- 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,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coding Standards Template Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates the coding standards documentation.
|
|
5
|
+
*/
|
|
6
|
+
export function generateCodingStandardsMd(config) {
|
|
7
|
+
if (config.codingStandards === 'custom') {
|
|
8
|
+
return generateCustomTemplate(config);
|
|
9
|
+
}
|
|
10
|
+
return config.codingStandards === 'strict'
|
|
11
|
+
? generateStrictTemplate(config)
|
|
12
|
+
: generateRelaxedTemplate(config);
|
|
13
|
+
}
|
|
14
|
+
function generateCustomTemplate(config) {
|
|
15
|
+
return `# Coding Standards - ${config.name}
|
|
16
|
+
|
|
17
|
+
*Configure your coding standards here*
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## TypeScript Configuration
|
|
22
|
+
|
|
23
|
+
\`\`\`json
|
|
24
|
+
// tsconfig.json - customize as needed
|
|
25
|
+
{
|
|
26
|
+
"compilerOptions": {
|
|
27
|
+
"target": "ES2022",
|
|
28
|
+
"module": "NodeNext",
|
|
29
|
+
"strict": true, // Adjust based on preference
|
|
30
|
+
"esModuleInterop": true,
|
|
31
|
+
"skipLibCheck": true,
|
|
32
|
+
"forceConsistentCasingInFileNames": true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
\`\`\`
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Linting
|
|
40
|
+
|
|
41
|
+
*Add your ESLint configuration*
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Formatting
|
|
46
|
+
|
|
47
|
+
*Add your Prettier configuration*
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Git Workflow
|
|
52
|
+
|
|
53
|
+
*Define your branching strategy and commit conventions*
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Code Review
|
|
58
|
+
|
|
59
|
+
*Define your code review process*
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
*Last Updated: ${new Date().toISOString().split('T')[0]}*
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
function generateStrictTemplate(config) {
|
|
67
|
+
return `# Coding Standards - ${config.name}
|
|
68
|
+
|
|
69
|
+
**Preset:** TypeScript Strict
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## TypeScript Configuration
|
|
74
|
+
|
|
75
|
+
\`\`\`json
|
|
76
|
+
// tsconfig.json
|
|
77
|
+
{
|
|
78
|
+
"compilerOptions": {
|
|
79
|
+
"target": "ES2022",
|
|
80
|
+
"module": "NodeNext",
|
|
81
|
+
"moduleResolution": "NodeNext",
|
|
82
|
+
"strict": true,
|
|
83
|
+
"noUncheckedIndexedAccess": true,
|
|
84
|
+
"noImplicitReturns": true,
|
|
85
|
+
"noFallthroughCasesInSwitch": true,
|
|
86
|
+
"noUnusedLocals": true,
|
|
87
|
+
"noUnusedParameters": true,
|
|
88
|
+
"exactOptionalPropertyTypes": true,
|
|
89
|
+
"esModuleInterop": true,
|
|
90
|
+
"skipLibCheck": true,
|
|
91
|
+
"forceConsistentCasingInFileNames": true,
|
|
92
|
+
"declaration": true,
|
|
93
|
+
"declarationMap": true,
|
|
94
|
+
"sourceMap": true
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
\`\`\`
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ESLint Configuration
|
|
102
|
+
|
|
103
|
+
\`\`\`javascript
|
|
104
|
+
// eslint.config.js
|
|
105
|
+
import eslint from '@eslint/js';
|
|
106
|
+
import tseslint from 'typescript-eslint';
|
|
107
|
+
|
|
108
|
+
export default tseslint.config(
|
|
109
|
+
eslint.configs.recommended,
|
|
110
|
+
...tseslint.configs.strictTypeChecked,
|
|
111
|
+
{
|
|
112
|
+
languageOptions: {
|
|
113
|
+
parserOptions: {
|
|
114
|
+
projectService: true,
|
|
115
|
+
tsconfigRootDir: import.meta.dirname,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
rules: {
|
|
119
|
+
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
120
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
121
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
122
|
+
'@typescript-eslint/no-unused-vars': [
|
|
123
|
+
'error',
|
|
124
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
\`\`\`
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Prettier Configuration
|
|
134
|
+
|
|
135
|
+
\`\`\`json
|
|
136
|
+
// .prettierrc
|
|
137
|
+
{
|
|
138
|
+
"semi": true,
|
|
139
|
+
"singleQuote": true,
|
|
140
|
+
"tabWidth": 2,
|
|
141
|
+
"trailingComma": "es5",
|
|
142
|
+
"printWidth": 100
|
|
143
|
+
}
|
|
144
|
+
\`\`\`
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Git Workflow
|
|
149
|
+
|
|
150
|
+
### Branch Naming
|
|
151
|
+
|
|
152
|
+
\`\`\`
|
|
153
|
+
feat/feature-name # New features
|
|
154
|
+
fix/bug-description # Bug fixes
|
|
155
|
+
docs/update-area # Documentation
|
|
156
|
+
refactor/area # Code refactoring
|
|
157
|
+
\`\`\`
|
|
158
|
+
|
|
159
|
+
### Commit Messages (Conventional Commits)
|
|
160
|
+
|
|
161
|
+
\`\`\`
|
|
162
|
+
feat: add user authentication
|
|
163
|
+
fix: resolve login redirect issue
|
|
164
|
+
docs: update API documentation
|
|
165
|
+
refactor: simplify database queries
|
|
166
|
+
test: add unit tests for auth module
|
|
167
|
+
chore: update dependencies
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Code Review Checklist
|
|
173
|
+
|
|
174
|
+
Before merging, verify:
|
|
175
|
+
|
|
176
|
+
- [ ] All tests pass
|
|
177
|
+
- [ ] No TypeScript errors
|
|
178
|
+
- [ ] ESLint passes with no errors
|
|
179
|
+
- [ ] Code follows project patterns
|
|
180
|
+
- [ ] Documentation updated if needed
|
|
181
|
+
- [ ] No sensitive data in commits
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## File Organization
|
|
186
|
+
|
|
187
|
+
\`\`\`
|
|
188
|
+
src/
|
|
189
|
+
├── components/ # UI components
|
|
190
|
+
├── features/ # Feature modules
|
|
191
|
+
├── lib/ # Shared utilities
|
|
192
|
+
├── hooks/ # Custom hooks
|
|
193
|
+
├── types/ # TypeScript types
|
|
194
|
+
└── index.ts # Entry point
|
|
195
|
+
\`\`\`
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
*Last Updated: ${new Date().toISOString().split('T')[0]}*
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
function generateRelaxedTemplate(config) {
|
|
203
|
+
return `# Coding Standards - ${config.name}
|
|
204
|
+
|
|
205
|
+
**Preset:** TypeScript Relaxed
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## TypeScript Configuration
|
|
210
|
+
|
|
211
|
+
\`\`\`json
|
|
212
|
+
// tsconfig.json
|
|
213
|
+
{
|
|
214
|
+
"compilerOptions": {
|
|
215
|
+
"target": "ES2022",
|
|
216
|
+
"module": "NodeNext",
|
|
217
|
+
"moduleResolution": "NodeNext",
|
|
218
|
+
"strict": true,
|
|
219
|
+
"esModuleInterop": true,
|
|
220
|
+
"skipLibCheck": true,
|
|
221
|
+
"forceConsistentCasingInFileNames": true,
|
|
222
|
+
"declaration": true,
|
|
223
|
+
"sourceMap": true
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
\`\`\`
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## ESLint Configuration
|
|
231
|
+
|
|
232
|
+
\`\`\`javascript
|
|
233
|
+
// eslint.config.js
|
|
234
|
+
import eslint from '@eslint/js';
|
|
235
|
+
import tseslint from 'typescript-eslint';
|
|
236
|
+
|
|
237
|
+
export default tseslint.config(
|
|
238
|
+
eslint.configs.recommended,
|
|
239
|
+
...tseslint.configs.recommended,
|
|
240
|
+
{
|
|
241
|
+
languageOptions: {
|
|
242
|
+
parserOptions: {
|
|
243
|
+
projectService: true,
|
|
244
|
+
tsconfigRootDir: import.meta.dirname,
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
rules: {
|
|
248
|
+
'@typescript-eslint/no-unused-vars': [
|
|
249
|
+
'warn',
|
|
250
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
251
|
+
],
|
|
252
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
253
|
+
},
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
\`\`\`
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Prettier Configuration
|
|
261
|
+
|
|
262
|
+
\`\`\`json
|
|
263
|
+
// .prettierrc
|
|
264
|
+
{
|
|
265
|
+
"semi": true,
|
|
266
|
+
"singleQuote": true,
|
|
267
|
+
"tabWidth": 2,
|
|
268
|
+
"trailingComma": "es5",
|
|
269
|
+
"printWidth": 100
|
|
270
|
+
}
|
|
271
|
+
\`\`\`
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Git Workflow
|
|
276
|
+
|
|
277
|
+
### Commit Messages
|
|
278
|
+
|
|
279
|
+
Use descriptive commit messages. Conventional commits encouraged but not required:
|
|
280
|
+
|
|
281
|
+
\`\`\`
|
|
282
|
+
feat: add user authentication
|
|
283
|
+
fix: resolve login redirect issue
|
|
284
|
+
Update README
|
|
285
|
+
\`\`\`
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Code Review
|
|
290
|
+
|
|
291
|
+
- Tests should pass before merging
|
|
292
|
+
- No TypeScript errors
|
|
293
|
+
- Code should be readable
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
*Last Updated: ${new Date().toISOString().split('T')[0]}*
|
|
298
|
+
`;
|
|
299
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
import type { ImportProjectConfig } from '../types.js';
|
|
8
|
+
export declare function generateCompilrMdForImport(config: ImportProjectConfig): string;
|
|
@@ -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;
|