mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +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();
|
||||
|
||||
Reference in New Issue
Block a user