161ef94b4f
Check engine pin consistency / Dockerfile / CI pin consistency (push) Successful in 8s
Sirius CI/CD Pipeline / Detect Changes (push) Successful in 23s
Validate Docker Configuration / Validate Docker Compose Configuration (push) Successful in 47s
Sirius CI/CD Pipeline / Build API (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Build UI (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Engine Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Merge API Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Merge UI Manifest (push) Has been cancelled
Sirius CI/CD Pipeline / Build Engine (${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Build Infra (${{ matrix.service }}, ${{ matrix.platform }}) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-postgres) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-rabbitmq) (push) Has been cancelled
Sirius CI/CD Pipeline / Merge Infra Manifest (sirius-valkey) (push) Has been cancelled
Sirius CI/CD Pipeline / Integration Test (push) Has been cancelled
Sirius CI/CD Pipeline / Public Stack Contract (push) Has been cancelled
Sirius CI/CD Pipeline / Dispatch Demo Deployment (sirius-demo branch) (push) Has been cancelled
Sirius CI/CD Pipeline / Dispatch Demo Canary (main branch) (push) Has been cancelled
Sirius CI/CD Pipeline / Guard Registry Namespace (push) Has been cancelled
65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import { readFileContent } from '../utils/file-reader.js';
|
|
|
|
const PATTERN_SECTION_TITLES = [
|
|
'Code Patterns',
|
|
'Best Practices',
|
|
'Common Patterns',
|
|
'Development Workflow',
|
|
'Common Tasks',
|
|
'Troubleshooting',
|
|
];
|
|
|
|
function extractSection(content: string, sectionTitle: string): string | null {
|
|
// Try to find the section with various heading levels
|
|
const patterns = [
|
|
new RegExp(`## ${sectionTitle}\\s*\\n([\\s\\S]*?)(?=\\n## |\\n# |$)`, 'i'),
|
|
new RegExp(`### ${sectionTitle}\\s*\\n([\\s\\S]*?)(?=\\n### |\\n## |\\n# |$)`, 'i'),
|
|
];
|
|
|
|
for (const pattern of patterns) {
|
|
const match = content.match(pattern);
|
|
if (match && match[1]) {
|
|
return match[1].trim();
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
export async function extractCodePatterns(docPaths: string[]): Promise<string> {
|
|
let result = '';
|
|
|
|
for (const docPath of docPaths) {
|
|
try {
|
|
const content = await readFileContent(docPath);
|
|
|
|
// Try to extract each pattern section
|
|
for (const sectionTitle of PATTERN_SECTION_TITLES) {
|
|
const section = extractSection(content, sectionTitle);
|
|
if (section) {
|
|
result += `### ${sectionTitle}\n\n${section}\n\n`;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.error(`Error reading doc ${docPath}:`, error);
|
|
}
|
|
}
|
|
|
|
return result.trim() || 'No code patterns found in documentation';
|
|
}
|
|
|
|
export async function extractDocumentationLinks(
|
|
relatedDocs: string[]
|
|
): Promise<string> {
|
|
let result = '';
|
|
|
|
for (const doc of relatedDocs) {
|
|
const docName = doc.replace(/^.*\//, '').replace(/\.md$/, '');
|
|
result += `- [${docName}](mdc:documentation/dev/${doc})\n`;
|
|
}
|
|
|
|
return result.trim();
|
|
}
|
|
|
|
|