mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 16:09:43 +02:00
feat: use custom CLAUDE.md template path when creating cases
When creating new cases via /api/cases or /api/quick-start, the server now checks ~/.claudeman/settings.json for a defaultClaudeMdPath. If found and the file exists, it uses that template with placeholder substitution ([PROJECT_NAME], [PROJECT_DESCRIPTION], [DATE]). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
export function generateClaudeMd(caseName: string, description: string = ''): string {
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
|
||||
export function generateClaudeMd(caseName: string, description: string = '', templatePath?: string): string {
|
||||
const date = new Date().toISOString().split('T')[0];
|
||||
|
||||
// If a custom template path is provided and exists, use it
|
||||
if (templatePath && existsSync(templatePath)) {
|
||||
try {
|
||||
let template = readFileSync(templatePath, 'utf-8');
|
||||
// Replace placeholders with actual values
|
||||
template = template.replace(/\[PROJECT_NAME\]/g, caseName);
|
||||
template = template.replace(/\[PROJECT_DESCRIPTION\]/g, description || 'A new project');
|
||||
template = template.replace(/\[DATE\]/g, date);
|
||||
return template;
|
||||
} catch (err) {
|
||||
console.error(`Failed to read template from ${templatePath}:`, err);
|
||||
// Fall through to default template
|
||||
}
|
||||
}
|
||||
|
||||
return `# CLAUDE.md - Project Configuration
|
||||
|
||||
## Project Overview
|
||||
|
||||
Reference in New Issue
Block a user