context-forge
Version:
AI orchestration platform with autonomous teams, enhancement planning, migration tools, 25+ slash commands, checkpoints & hooks. Multi-IDE: Claude, Cursor, Windsurf, Cline, Copilot
195 lines (179 loc) • 7.18 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateClaudeMd = generateClaudeMd;
const fs_extra_1 = __importDefault(require("fs-extra"));
const path_1 = __importDefault(require("path"));
const handlebars_1 = __importDefault(require("handlebars"));
async function generateClaudeMd(config) {
// Determine which template to use based on tech stack
const templateFile = await selectTemplate(config.techStack);
const templatePath = path_1.default.join(__dirname, '../../templates/claude', templateFile);
// Check if tech-stack specific template exists
const templateExists = await fs_extra_1.default.pathExists(templatePath);
if (templateExists) {
const templateContent = await fs_extra_1.default.readFile(templatePath, 'utf-8');
const template = handlebars_1.default.compile(templateContent);
const context = {
projectName: config.projectName,
description: config.description,
projectStructure: generateProjectStructure(config.techStack),
prpConfig: config.extras.prp,
};
return template(context);
}
else {
// Fallback to basic template
return generateBasicClaudeMd(config);
}
}
async function selectTemplate(techStack) {
// Priority order for template selection
if (techStack.frontend === 'nextjs') {
return 'tech-stacks/nextjs-15.md';
}
else if (techStack.frontend === 'react') {
return 'tech-stacks/react.md';
}
else if (techStack.frontend === 'vue') {
return 'tech-stacks/vuejs.md';
}
else if (techStack.frontend === 'angular') {
return 'tech-stacks/angular.md';
}
else if (techStack.backend === 'fastapi') {
return 'tech-stacks/python-fastapi.md';
}
else if (techStack.backend === 'express') {
return 'tech-stacks/node-express.md';
}
else if (techStack.backend === 'django') {
return 'tech-stacks/django.md';
}
else if (techStack.backend === 'spring') {
return 'tech-stacks/spring-boot.md';
}
else if (techStack.backend === 'rails') {
return 'tech-stacks/ruby-on-rails.md';
}
// Default to a generic template
return 'generate.md';
}
function generateProjectStructure(techStack) {
if (techStack.frontend === 'nextjs') {
return `src/
├── app/
│ ├── (routes)/
│ ├── layout.tsx
│ └── page.tsx
├── components/
│ ├── ui/
│ └── features/
├── hooks/
├── lib/
└── types/
}
if (techStack.backend === 'fastapi') {
return `app/
├── api/
│ └── v1/
├── core/
├── db/
├── models/
├── schemas/
├── services/
└── tests/
}
if (techStack.backend === 'express') {
return `src/
├── controllers/
├── middleware/
├── models/
├── routes/
├── services/
├── utils/
├── app.ts
└── server.ts
}
if (techStack.frontend === 'react') {
return `src/
├── components/
├── hooks/
├── pages/
├── services/
├── store/
├── styles/
├── utils/
└── App.tsx
}
// Default structure
return `src/
├── components/
├── services/
├── utils/
└── tests/`;
}
function generateBasicClaudeMd(config) {
return `
${config.description}
This project uses context engineering principles for efficient AI-assisted development.
- \`/Docs/Implementation.md\` - Staged development plan
- \`/Docs/project_structure.md\` - Project organization
- \`/Docs/UI_UX_doc.md\` - Design specifications
- \`/Docs/Bug_tracking.md\` - Error tracking
${config.extras.prp ? `- \`/PRPs/\` - Product Requirement Prompts for detailed implementation` : ''}
${config.extras.aiDocs ? `- \`/ai_docs/\` - Curated documentation for AI context` : ''}
Simplicity should be a key goal in design. Choose straightforward solutions over complex ones whenever possible.
Avoid building functionality on speculation. Implement features only when they are needed.
- **Never create a file longer than 500 lines of code**
- **Functions should be short and focused**
- **Components/Classes should have single responsibility**
- Consult \`/Docs/Implementation.md\` for current stage and available tasks
- Check task dependencies and prerequisites
- Verify scope understanding
1. Read task from Implementation.md
2. Check relevant documentation
3. Implement following existing patterns
4. Test thoroughly
5. Mark task complete only when fully working
1. \`/Docs/Bug_tracking.md\` - Check for known issues first
2. \`/Docs/Implementation.md\` - Main task reference
3. \`/Docs/project_structure.md\` - Structure guidance
4. \`/Docs/UI_UX_doc.md\` - Design requirements
${config.extras.prp ? `5. \`/PRPs/\` - Detailed implementation prompts with validation loops` : ''}
${Object.entries(config.techStack)
.filter(([_, value]) => value)
.map(([key, value]) => `- **${key}**: ${value}`)
.join('\n')}
- Minimum 80% code coverage
- All features must have tests
- Test user behavior, not implementation details
- Validate all user inputs
- Use environment variables for sensitive data
- Follow OWASP security best practices
- [ ] All tests passing
- [ ] Linting passes
- [ ] Type checking passes (if applicable)
- [ ] Documentation updated
- [ ] No console.log statements
- [ ] Security considerations addressed
`;
}
//# sourceMappingURL=claudeMd.js.map