mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
Add comprehensive code review specifications and templates
- Introduced best practices requirements specification covering code quality, performance, maintainability, error handling, and documentation standards. - Established quality standards with overall quality metrics and mandatory checks for security, code quality, performance, and maintainability. - Created security requirements specification aligned with OWASP Top 10 and CWE Top 25, detailing checks and patterns for common vulnerabilities. - Developed templates for documenting best practice findings, security findings, and generating reports, including structured markdown and JSON formats. - Updated dependencies in the project, ensuring compatibility and stability. - Added test files and README documentation for vector indexing tests.
This commit is contained in:
@@ -622,7 +622,7 @@ export async function handleCodexLensRoutes(ctx: RouteContext): Promise<boolean>
|
||||
// API: CodexLens Init (Initialize workspace index)
|
||||
if (pathname === '/api/codexlens/init' && req.method === 'POST') {
|
||||
handlePostRequest(req, res, async (body) => {
|
||||
const { path: projectPath, indexType = 'vector', embeddingModel = 'code', embeddingBackend = 'fastembed', maxWorkers = 1 } = body;
|
||||
const { path: projectPath, indexType = 'vector', embeddingModel = 'code', embeddingBackend = 'fastembed', maxWorkers = 1, incremental = true } = body;
|
||||
const targetPath = projectPath || initialPath;
|
||||
|
||||
// Ensure LiteLLM backend dependencies are installed before running the CLI
|
||||
@@ -636,6 +636,13 @@ export async function handleCodexLensRoutes(ctx: RouteContext): Promise<boolean>
|
||||
// Build CLI arguments based on index type
|
||||
// Use 'index init' subcommand (new CLI structure)
|
||||
const args = ['index', 'init', targetPath, '--json'];
|
||||
|
||||
// Force mode: when incremental=false, add --force to rebuild all files
|
||||
// CLI defaults to incremental mode (skip unchanged files)
|
||||
if (!incremental) {
|
||||
args.push('--force');
|
||||
}
|
||||
|
||||
if (indexType === 'normal') {
|
||||
args.push('--no-embeddings');
|
||||
} else {
|
||||
@@ -728,6 +735,98 @@ export async function handleCodexLensRoutes(ctx: RouteContext): Promise<boolean>
|
||||
return true;
|
||||
}
|
||||
|
||||
// API: Generate embeddings only (without FTS rebuild)
|
||||
if (pathname === '/api/codexlens/embeddings/generate' && req.method === 'POST') {
|
||||
handlePostRequest(req, res, async (body) => {
|
||||
const { path: projectPath, incremental = false, backend = 'litellm', maxWorkers = 4, model } = body;
|
||||
const targetPath = projectPath || initialPath;
|
||||
|
||||
// Ensure LiteLLM backend dependencies are installed
|
||||
if (backend === 'litellm') {
|
||||
try {
|
||||
await ensureLiteLLMEmbedderReady();
|
||||
} catch (err) {
|
||||
return { success: false, error: `LiteLLM embedder setup failed: ${err.message}` };
|
||||
}
|
||||
}
|
||||
|
||||
// Build CLI arguments for embeddings generation
|
||||
// Use 'index embeddings' subcommand
|
||||
const args = ['index', 'embeddings', targetPath, '--json'];
|
||||
|
||||
// Add backend option
|
||||
if (backend && backend !== 'fastembed') {
|
||||
args.push('--backend', backend);
|
||||
}
|
||||
|
||||
// Add model if specified
|
||||
if (model) {
|
||||
args.push('--model', model);
|
||||
}
|
||||
|
||||
// Add max workers for API backend
|
||||
if (backend === 'litellm' && maxWorkers > 1) {
|
||||
args.push('--max-workers', String(maxWorkers));
|
||||
}
|
||||
|
||||
// Force mode: always use --force for litellm backend to avoid model conflict
|
||||
// (litellm uses different embeddings than fastembed, so regeneration is required)
|
||||
// For true incremental updates with same model, use fastembed backend
|
||||
if (!incremental || backend === 'litellm') {
|
||||
args.push('--force'); // Force regenerate embeddings
|
||||
}
|
||||
|
||||
try {
|
||||
// Broadcast progress start
|
||||
broadcastToClients({
|
||||
type: 'CODEXLENS_INDEX_PROGRESS',
|
||||
payload: { stage: 'embeddings', message: 'Generating embeddings...', percent: 10 }
|
||||
});
|
||||
|
||||
const result = await executeCodexLens(args, {
|
||||
cwd: targetPath,
|
||||
onProgress: (progress: ProgressInfo) => {
|
||||
broadcastToClients({
|
||||
type: 'CODEXLENS_INDEX_PROGRESS',
|
||||
payload: {
|
||||
stage: 'embeddings',
|
||||
message: progress.message || 'Processing...',
|
||||
percent: progress.percent || 50
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
broadcastToClients({
|
||||
type: 'CODEXLENS_INDEX_PROGRESS',
|
||||
payload: { stage: 'complete', message: 'Embeddings generated', percent: 100 }
|
||||
});
|
||||
|
||||
try {
|
||||
const parsed = extractJSON(result.output || '{}');
|
||||
return { success: true, result: parsed };
|
||||
} catch {
|
||||
return { success: true, result: { message: 'Embeddings generated successfully' } };
|
||||
}
|
||||
} else {
|
||||
broadcastToClients({
|
||||
type: 'CODEXLENS_INDEX_PROGRESS',
|
||||
payload: { stage: 'error', message: result.error || 'Failed', percent: 0 }
|
||||
});
|
||||
return { success: false, error: result.error };
|
||||
}
|
||||
} catch (err) {
|
||||
broadcastToClients({
|
||||
type: 'CODEXLENS_INDEX_PROGRESS',
|
||||
payload: { stage: 'error', message: err.message, percent: 0 }
|
||||
});
|
||||
return { success: false, error: err.message, status: 500 };
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
// API: CodexLens Semantic Search Status
|
||||
if (pathname === '/api/codexlens/semantic/status') {
|
||||
const status = await checkSemanticStatus();
|
||||
|
||||
@@ -429,34 +429,45 @@ async function generateSkillViaCLI({ generationType, description, skillName, loc
|
||||
await fsPromises.mkdir(baseDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Build CLI prompt
|
||||
// Build structured skill parameters for /skill-generator
|
||||
const targetLocationDisplay = location === 'project'
|
||||
? '.claude/skills/'
|
||||
: '~/.claude/skills/';
|
||||
|
||||
const prompt = `PURPOSE: Generate a complete Claude Code skill from description
|
||||
TASK: • Parse skill requirements • Create SKILL.md with proper frontmatter (name, description, version, allowed-tools) • Generate supporting files if needed in skill folder
|
||||
MODE: write
|
||||
CONTEXT: @**/*
|
||||
EXPECTED: Complete skill folder structure with SKILL.md and all necessary files
|
||||
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/universal/00-universal-rigorous-style.txt) | Follow Claude Code skill format | Include name, description in frontmatter | write=CREATE
|
||||
// Structured fields from user input
|
||||
const skillParams = {
|
||||
skill_name: skillName,
|
||||
description: description || 'Generate a basic skill template',
|
||||
target_location: targetLocationDisplay,
|
||||
target_path: targetPath,
|
||||
location_type: location // 'project' | 'user'
|
||||
};
|
||||
|
||||
SKILL DESCRIPTION:
|
||||
${description || 'Generate a basic skill template'}
|
||||
// Prompt that invokes /skill-generator skill with structured parameters
|
||||
const prompt = `/skill-generator
|
||||
|
||||
SKILL NAME: ${skillName}
|
||||
TARGET LOCATION: ${targetLocationDisplay}
|
||||
TARGET PATH: ${targetPath}
|
||||
## Skill Parameters (Structured Input)
|
||||
|
||||
REQUIREMENTS:
|
||||
1. Create SKILL.md with frontmatter containing:
|
||||
- name: "${skillName}"
|
||||
- description: Brief description of the skill
|
||||
- version: "1.0.0"
|
||||
- allowed-tools: List of tools this skill can use (e.g., [Read, Write, Edit, Bash])
|
||||
2. Add skill content below frontmatter explaining what the skill does and how to use it
|
||||
3. If the skill requires supporting files (e.g., templates, scripts), create them in the skill folder
|
||||
4. Ensure all files are properly formatted and follow best practices`;
|
||||
\`\`\`json
|
||||
${JSON.stringify(skillParams, null, 2)}
|
||||
\`\`\`
|
||||
|
||||
## User Request
|
||||
|
||||
Create a new Claude Code skill with the following specifications:
|
||||
|
||||
- **Skill Name**: ${skillName}
|
||||
- **Description**: ${description || 'Generate a basic skill template'}
|
||||
- **Target Location**: ${targetLocationDisplay}${skillName}
|
||||
- **Location Type**: ${location === 'project' ? 'Project-level (.claude/skills/)' : 'User-level (~/.claude/skills/)'}
|
||||
|
||||
## Instructions
|
||||
|
||||
1. Use the skill-generator to create a complete skill structure
|
||||
2. Generate SKILL.md with proper frontmatter (name, description, version, allowed-tools)
|
||||
3. Create necessary supporting files (phases, specs, templates as needed)
|
||||
4. Follow Claude Code skill design patterns and best practices
|
||||
5. Output all files to: ${targetPath}`;
|
||||
|
||||
// Execute CLI tool (Claude) with write mode
|
||||
const result = await executeCliTool({
|
||||
|
||||
Reference in New Issue
Block a user