mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-19 02:13:58 +00:00
fix: additional CodeRabbit review fixes for primer
- Fix Python detection to use correct source file (pyproject.toml, requirements.txt, or setup.py) - Escape regex special characters in glob pattern matching (e.g., *.module.css) - Derive ALL_AGENTS from AGENT_CONFIG to avoid divergence - Map agent config format to template format based on file extension
This commit is contained in:
@@ -232,10 +232,15 @@ export class PrimerAnalyzer {
|
||||
}
|
||||
|
||||
if (this.hasFile('pyproject.toml') || this.hasFile('requirements.txt') || this.hasFile('setup.py')) {
|
||||
const source = this.hasFile('pyproject.toml')
|
||||
? 'pyproject.toml'
|
||||
: this.hasFile('requirements.txt')
|
||||
? 'requirements.txt'
|
||||
: 'setup.py';
|
||||
languages.push({
|
||||
name: 'python',
|
||||
confidence: 100,
|
||||
source: 'pyproject.toml',
|
||||
source,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -597,7 +602,9 @@ export class PrimerAnalyzer {
|
||||
|
||||
private hasFile(name: string): boolean {
|
||||
if (name.includes('*')) {
|
||||
const regex = new RegExp(name.replace(/\*/g, '.*'));
|
||||
const regex = new RegExp(
|
||||
name.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*')
|
||||
);
|
||||
for (const file of this.files) {
|
||||
if (regex.test(file)) return true;
|
||||
}
|
||||
|
||||
@@ -12,40 +12,7 @@ import type {
|
||||
import { AGENT_INSTRUCTION_TEMPLATES } from './types.js';
|
||||
import { analyzePrimer } from './analyzer.js';
|
||||
|
||||
const ALL_AGENTS: AgentType[] = [
|
||||
'claude-code',
|
||||
'cursor',
|
||||
'codex',
|
||||
'gemini-cli',
|
||||
'opencode',
|
||||
'antigravity',
|
||||
'amp',
|
||||
'clawdbot',
|
||||
'droid',
|
||||
'github-copilot',
|
||||
'goose',
|
||||
'kilo',
|
||||
'kiro-cli',
|
||||
'roo',
|
||||
'trae',
|
||||
'windsurf',
|
||||
'universal',
|
||||
'cline',
|
||||
'codebuddy',
|
||||
'commandcode',
|
||||
'continue',
|
||||
'crush',
|
||||
'factory',
|
||||
'mcpjam',
|
||||
'mux',
|
||||
'neovate',
|
||||
'openhands',
|
||||
'pi',
|
||||
'qoder',
|
||||
'qwen',
|
||||
'vercel',
|
||||
'zencoder',
|
||||
];
|
||||
const ALL_AGENTS: AgentType[] = Object.keys(AGENT_CONFIG) as AgentType[];
|
||||
|
||||
export class PrimerGenerator {
|
||||
private projectPath: string;
|
||||
@@ -172,10 +139,21 @@ export class PrimerGenerator {
|
||||
}
|
||||
|
||||
private getDefaultTemplate(agent: AgentType, config: AgentDirectoryConfig): AgentInstructionTemplate {
|
||||
const formatMap: Record<string, 'markdown' | 'json' | 'mdc' | 'xml'> = {
|
||||
'.md': 'markdown',
|
||||
'.json': 'json',
|
||||
'.mdc': 'mdc',
|
||||
'.xml': 'xml',
|
||||
};
|
||||
const ext = config.configFile.includes('.')
|
||||
? '.' + config.configFile.split('.').pop()
|
||||
: '.md';
|
||||
const format = formatMap[ext] || 'markdown';
|
||||
|
||||
return {
|
||||
agent,
|
||||
filename: config.configFile,
|
||||
format: 'markdown',
|
||||
format,
|
||||
sectionOrder: ['overview', 'stack', 'commands', 'conventions', 'structure', 'guidelines'],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user