codeseeker 1.7.2 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,9 +34,10 @@ Restart your IDE and you're done!
34
34
 
35
35
  **Linux (Snap) - All Distributions:**
36
36
  ```bash
37
- sudo snap install codeseeker --classic
37
+ sudo snap install codeseeker
38
38
  codeseeker install --vscode # or --cursor, --windsurf
39
39
  ```
40
+ > ⚠️ **Snap limitation:** Due to strict confinement, the snap can only access projects in your home directory (`~/`). For projects outside `~/`, use npm or Homebrew instead.
40
41
 
41
42
  **macOS/Linux (Homebrew):**
42
43
  ```bash
@@ -454,6 +455,10 @@ Open an issue: [GitHub Issues](https://github.com/jghiringhelli/codeseeker/issue
454
455
 
455
456
  > **Note:** Claude Code and GitHub Copilot both run in VS Code and share the same MCP configuration (`.vscode/mcp.json`). The flags `--vscode`, `--claude-code`, and `--copilot` are interchangeable.
456
457
 
458
+ ## Support
459
+
460
+ If CodeSeeker is useful to you, consider [sponsoring the project](https://github.com/sponsors/jghiringhelli).
461
+
457
462
  ## License
458
463
 
459
464
  MIT License. See [LICENSE](LICENSE).
@@ -228,15 +228,15 @@ class SetupCommandHandler extends base_command_handler_1.BaseCommandHandler {
228
228
  try {
229
229
  // Delete all nodes and relationships related to this project path
230
230
  // This is a simplified approach for MVP
231
- const result = await session.run(`
232
- MATCH (n {projectPath: $projectPath})-[r*0..]->(m)
233
- DETACH DELETE n, m
231
+ const result = await session.run(`
232
+ MATCH (n {projectPath: $projectPath})-[r*0..]->(m)
233
+ DETACH DELETE n, m
234
234
  `, { projectPath });
235
235
  // Also clean up any orphaned relationships
236
- await session.run(`
237
- MATCH ()-[r]-()
238
- WHERE r.projectPath = $projectPath
239
- DELETE r
236
+ await session.run(`
237
+ MATCH ()-[r]-()
238
+ WHERE r.projectPath = $projectPath
239
+ DELETE r
240
240
  `, { projectPath });
241
241
  console.log(theme_1.Theme.colors.success('✅ Cleaned up Neo4j knowledge graph data'));
242
242
  }
@@ -592,9 +592,9 @@ class SetupCommandHandler extends base_command_handler_1.BaseCommandHandler {
592
592
  const client = await pool.connect();
593
593
  try {
594
594
  // Check if semantic_search_embeddings has the content_type column
595
- const embeddingsSchemaCheck = await client.query(`
596
- SELECT column_name FROM information_schema.columns
597
- WHERE table_name = 'semantic_search_embeddings' AND column_name = 'content_type'
595
+ const embeddingsSchemaCheck = await client.query(`
596
+ SELECT column_name FROM information_schema.columns
597
+ WHERE table_name = 'semantic_search_embeddings' AND column_name = 'content_type'
598
598
  `);
599
599
  if (embeddingsSchemaCheck.rows.length > 0) {
600
600
  console.log(theme_1.Theme.colors.success('✅ Consolidated schema already applied correctly'));
@@ -651,65 +651,65 @@ class SetupCommandHandler extends base_command_handler_1.BaseCommandHandler {
651
651
  */
652
652
  async createBasicTables(client) {
653
653
  // Create essential tables manually
654
- const basicSchema = `
655
- -- Enable extensions
656
- CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
657
- CREATE EXTENSION IF NOT EXISTS vector;
658
-
659
- -- Projects table
660
- CREATE TABLE IF NOT EXISTS projects (
661
- id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
662
- project_path TEXT UNIQUE NOT NULL,
663
- project_name TEXT NOT NULL,
664
- project_type TEXT DEFAULT 'unknown',
665
- languages JSONB DEFAULT '[]'::jsonb,
666
- frameworks JSONB DEFAULT '[]'::jsonb,
667
- total_files INTEGER DEFAULT 0,
668
- total_lines INTEGER DEFAULT 0,
669
- status TEXT DEFAULT 'active',
670
- metadata JSONB DEFAULT '{}'::jsonb,
671
- created_at TIMESTAMPTZ DEFAULT NOW(),
672
- updated_at TIMESTAMPTZ DEFAULT NOW()
673
- );
674
-
675
- -- Analysis results table
676
- CREATE TABLE IF NOT EXISTS analysis_results (
677
- id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
678
- project_id UUID REFERENCES projects(id) ON DELETE CASCADE,
679
- file_path TEXT NOT NULL,
680
- file_hash TEXT NOT NULL,
681
- analysis_type TEXT NOT NULL,
682
- analysis_subtype TEXT,
683
- analysis_result JSONB NOT NULL,
684
- confidence_score DECIMAL(3,2),
685
- severity TEXT DEFAULT 'info',
686
- status TEXT DEFAULT 'detected',
687
- metadata JSONB DEFAULT '{}'::jsonb,
688
- tags JSONB DEFAULT '[]'::jsonb,
689
- created_at TIMESTAMPTZ DEFAULT NOW(),
690
- updated_at TIMESTAMPTZ DEFAULT NOW()
691
- );
692
-
693
- -- Semantic search embeddings table
694
- CREATE TABLE IF NOT EXISTS semantic_search_embeddings (
695
- id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
696
- project_id UUID REFERENCES projects(id) ON DELETE CASCADE,
697
- file_path TEXT NOT NULL,
698
- chunk_index INTEGER DEFAULT 0,
699
- content_type TEXT DEFAULT 'code',
700
- content_text TEXT NOT NULL,
701
- content_hash TEXT NOT NULL,
702
- embedding VECTOR(384),
703
- metadata JSONB DEFAULT '{}'::jsonb,
704
- created_at TIMESTAMPTZ DEFAULT NOW(),
705
- updated_at TIMESTAMPTZ DEFAULT NOW(),
706
- UNIQUE(project_id, file_path, chunk_index, content_hash)
707
- );
708
-
709
- -- Create indexes
710
- CREATE INDEX IF NOT EXISTS idx_projects_path ON projects(project_path);
711
- CREATE INDEX IF NOT EXISTS idx_analysis_project_type ON analysis_results(project_id, analysis_type);
712
- CREATE INDEX IF NOT EXISTS idx_semantic_embeddings_project ON semantic_search_embeddings(project_id);
654
+ const basicSchema = `
655
+ -- Enable extensions
656
+ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
657
+ CREATE EXTENSION IF NOT EXISTS vector;
658
+
659
+ -- Projects table
660
+ CREATE TABLE IF NOT EXISTS projects (
661
+ id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
662
+ project_path TEXT UNIQUE NOT NULL,
663
+ project_name TEXT NOT NULL,
664
+ project_type TEXT DEFAULT 'unknown',
665
+ languages JSONB DEFAULT '[]'::jsonb,
666
+ frameworks JSONB DEFAULT '[]'::jsonb,
667
+ total_files INTEGER DEFAULT 0,
668
+ total_lines INTEGER DEFAULT 0,
669
+ status TEXT DEFAULT 'active',
670
+ metadata JSONB DEFAULT '{}'::jsonb,
671
+ created_at TIMESTAMPTZ DEFAULT NOW(),
672
+ updated_at TIMESTAMPTZ DEFAULT NOW()
673
+ );
674
+
675
+ -- Analysis results table
676
+ CREATE TABLE IF NOT EXISTS analysis_results (
677
+ id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
678
+ project_id UUID REFERENCES projects(id) ON DELETE CASCADE,
679
+ file_path TEXT NOT NULL,
680
+ file_hash TEXT NOT NULL,
681
+ analysis_type TEXT NOT NULL,
682
+ analysis_subtype TEXT,
683
+ analysis_result JSONB NOT NULL,
684
+ confidence_score DECIMAL(3,2),
685
+ severity TEXT DEFAULT 'info',
686
+ status TEXT DEFAULT 'detected',
687
+ metadata JSONB DEFAULT '{}'::jsonb,
688
+ tags JSONB DEFAULT '[]'::jsonb,
689
+ created_at TIMESTAMPTZ DEFAULT NOW(),
690
+ updated_at TIMESTAMPTZ DEFAULT NOW()
691
+ );
692
+
693
+ -- Semantic search embeddings table
694
+ CREATE TABLE IF NOT EXISTS semantic_search_embeddings (
695
+ id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
696
+ project_id UUID REFERENCES projects(id) ON DELETE CASCADE,
697
+ file_path TEXT NOT NULL,
698
+ chunk_index INTEGER DEFAULT 0,
699
+ content_type TEXT DEFAULT 'code',
700
+ content_text TEXT NOT NULL,
701
+ content_hash TEXT NOT NULL,
702
+ embedding VECTOR(384),
703
+ metadata JSONB DEFAULT '{}'::jsonb,
704
+ created_at TIMESTAMPTZ DEFAULT NOW(),
705
+ updated_at TIMESTAMPTZ DEFAULT NOW(),
706
+ UNIQUE(project_id, file_path, chunk_index, content_hash)
707
+ );
708
+
709
+ -- Create indexes
710
+ CREATE INDEX IF NOT EXISTS idx_projects_path ON projects(project_path);
711
+ CREATE INDEX IF NOT EXISTS idx_analysis_project_type ON analysis_results(project_id, analysis_type);
712
+ CREATE INDEX IF NOT EXISTS idx_semantic_embeddings_project ON semantic_search_embeddings(project_id);
713
713
  `;
714
714
  await client.query(basicSchema);
715
715
  }
@@ -765,14 +765,14 @@ class SetupCommandHandler extends base_command_handler_1.BaseCommandHandler {
765
765
  const client = await pool.connect();
766
766
  try {
767
767
  // Insert or update project
768
- const result = await client.query(`
769
- INSERT INTO projects (id, project_path, project_name, status, metadata)
770
- VALUES ($1, $2, $3, 'active', $4)
771
- ON CONFLICT (project_path) DO UPDATE SET
772
- project_name = EXCLUDED.project_name,
773
- status = 'active',
774
- updated_at = NOW()
775
- RETURNING id, project_name, project_path
768
+ const result = await client.query(`
769
+ INSERT INTO projects (id, project_path, project_name, status, metadata)
770
+ VALUES ($1, $2, $3, 'active', $4)
771
+ ON CONFLICT (project_path) DO UPDATE SET
772
+ project_name = EXCLUDED.project_name,
773
+ status = 'active',
774
+ updated_at = NOW()
775
+ RETURNING id, project_name, project_path
776
776
  `, [projectId, projectPath, projectName, JSON.stringify({
777
777
  initialized_at: new Date().toISOString(),
778
778
  cli_version: '2.0.0'
@@ -854,46 +854,46 @@ class SetupCommandHandler extends base_command_handler_1.BaseCommandHandler {
854
854
  if (platforms.length > 0) {
855
855
  console.log(theme_1.Theme.colors.success(` Found ${platforms.length} platforms: ${platforms.map(p => p.name).join(', ')}`));
856
856
  }
857
- const defaultInstructions = `# CODESEEKER.md - ${path.basename(projectPath)}
858
-
859
- This file provides instructions to CodeSeeker for analyzing and working with this project.
860
-
861
- ## Project Overview
862
-
863
- **Project**: ${path.basename(projectPath)}
864
- **Type**: api_service
865
- **Description**: Your project description here
866
- **Languages**: JavaScript, TypeScript
867
- **Architecture**: Add your architecture pattern
868
- **Testing Strategy**: Unit + Integration Testing
869
- **Coding Standards**: ESLint/Prettier
870
-
871
- ${platformsSection}
872
- ## Development Guidelines
873
-
874
- ### Architecture Principles
875
- - Follow SOLID principles consistently
876
- - Use dependency injection patterns
877
- - Maintain clear separation of concerns
878
-
879
- ### Code Quality Standards
880
- - High Performance, High Reliability, Secure
881
- - Comprehensive error handling
882
- - Proper logging and monitoring
883
-
884
- ### Important Files and Patterns
885
- - Add important file patterns here
886
- - Document coding conventions
887
- - List key dependencies and their purposes
888
-
889
- ## CodeSeeker Instructions
890
-
891
- - Analyze code for SOLID principles violations
892
- - Focus on maintainability and scalability
893
- - Suggest improvements for performance and security
894
- - Help with refactoring and code organization
895
-
896
- Generated by CodeSeeker CLI v2.0.0
857
+ const defaultInstructions = `# CODESEEKER.md - ${path.basename(projectPath)}
858
+
859
+ This file provides instructions to CodeSeeker for analyzing and working with this project.
860
+
861
+ ## Project Overview
862
+
863
+ **Project**: ${path.basename(projectPath)}
864
+ **Type**: api_service
865
+ **Description**: Your project description here
866
+ **Languages**: JavaScript, TypeScript
867
+ **Architecture**: Add your architecture pattern
868
+ **Testing Strategy**: Unit + Integration Testing
869
+ **Coding Standards**: ESLint/Prettier
870
+
871
+ ${platformsSection}
872
+ ## Development Guidelines
873
+
874
+ ### Architecture Principles
875
+ - Follow SOLID principles consistently
876
+ - Use dependency injection patterns
877
+ - Maintain clear separation of concerns
878
+
879
+ ### Code Quality Standards
880
+ - High Performance, High Reliability, Secure
881
+ - Comprehensive error handling
882
+ - Proper logging and monitoring
883
+
884
+ ### Important Files and Patterns
885
+ - Add important file patterns here
886
+ - Document coding conventions
887
+ - List key dependencies and their purposes
888
+
889
+ ## CodeSeeker Instructions
890
+
891
+ - Analyze code for SOLID principles violations
892
+ - Focus on maintainability and scalability
893
+ - Suggest improvements for performance and security
894
+ - Help with refactoring and code organization
895
+
896
+ Generated by CodeSeeker CLI v2.0.0
897
897
  `;
898
898
  await fs.writeFile(instructionsPath, defaultInstructions);
899
899
  console.log(theme_1.Theme.colors.success('✅ Created CODESEEKER.md with platform detection'));
@@ -932,94 +932,94 @@ Generated by CodeSeeker CLI v2.0.0
932
932
  * Used for CLAUDE.md, AGENTS.md, .cursorrules, COPILOT.md, GEMINI.md, GROK.md, etc.
933
933
  * This tells AI assistants to prefer CodeSeeker MCP tools over grep/glob
934
934
  */
935
- CODESEEKER_MCP_GUIDANCE = `
936
- ## CodeSeeker MCP Tools - MANDATORY FOR CODE DISCOVERY
937
-
938
- **CRITICAL**: This project has CodeSeeker MCP tools available. You MUST use them as your PRIMARY method for code discovery, NOT grep/glob.
939
-
940
- ### Auto-Initialization Check
941
-
942
- **BEFORE any code search**, verify the project is indexed:
943
- 1. Call \`projects()\` to see indexed projects
944
- 2. If this project is NOT listed, call \`index({path: "PROJECT_ROOT_PATH"})\` first
945
- 3. If tools return "Not connected", the MCP server may need restart
946
-
947
- ### When to Use CodeSeeker (DEFAULT)
948
-
949
- **ALWAYS use CodeSeeker for these queries:**
950
- - "Where is X handled?" → \`search("X handling logic")\`
951
- - "Find the auth/login/validation code" → \`search("authentication")\`
952
- - "How does Y work?" → \`search_and_read("Y implementation")\`
953
- - "What calls/imports Z?" → \`show_dependencies({filepath: "path/to/Z"})\`
954
- - "Show me the error handling" → \`search_and_read("error handling patterns")\`
955
-
956
- | Task | MUST Use | NOT This |
957
- |------|----------|----------|
958
- | Find code by meaning | \`search("authentication logic")\` | ❌ \`grep -r "auth"\` |
959
- | Search + read files | \`search_and_read("error handling")\` | ❌ \`grep\` then \`cat\` |
960
- | Show dependencies | \`show_dependencies({filepath})\` | ❌ Manual file reading |
961
- | Find patterns | \`standards({project})\` | ❌ Searching manually |
962
- | Understand a file | \`read_with_context({filepath})\` | ❌ Just Read alone |
963
-
964
- ### When to Use grep/glob (EXCEPTIONS ONLY)
965
-
966
- Only fall back to grep/glob when:
967
- - Searching for **exact literal strings** (UUIDs, specific error codes, magic numbers)
968
- - Using **regex patterns** that semantic search can't handle
969
- - You **already know the exact file path**
970
-
971
- ### Why CodeSeeker is Better
972
-
973
- \`\`\`
974
- ❌ grep -r "error handling" src/
975
- → Only finds literal text "error handling"
976
-
977
- ✅ search("how errors are handled")
978
- → Finds: try-catch blocks, .catch() callbacks, error responses,
979
- validation errors, custom Error classes - even if they don't
980
- contain the words "error handling"
981
- \`\`\`
982
-
983
- ### Available MCP Tools
984
-
985
- | Tool | Purpose | When to Use |
986
- |------|---------|-------------|
987
- | \`search(query)\` | Semantic search | First choice for any "find X" query |
988
- | \`search_and_read(query)\` | Search + read combined | When you need file contents |
989
- | \`show_dependencies({filepath})\` | Dependency graph | "What uses this?", "What does this depend on?" |
990
- | \`read_with_context({filepath})\` | File + related code | Reading a file for the first time |
991
- | \`standards({project})\` | Project patterns | Before writing new code |
992
- | \`index({path})\` | Index a project | If project not indexed |
993
- | \`sync({changes})\` | Update index | After editing files |
994
- | \`projects()\` | Show indexed projects | Check if project is indexed |
995
-
996
- ### Keep Index Updated
997
-
998
- After using Edit/Write tools, call:
999
- \`\`\`
1000
- sync({changes: [{type: "modified", path: "path/to/file"}]})
1001
- \`\`\`
1002
-
1003
- ## Claude Code Best Practices (from 2000+ hours of expert usage)
1004
-
1005
- ### Subagent Strategy for Complex Tasks
1006
- - For multi-step or complex tasks, spawn subagents using the **main model** (not cheaper/smaller models) instead of cramming everything into one context
1007
- - Pattern: "Orchestrator coordinates + focused subagents execute" >> "Single massive context"
1008
- - Use subagents MORE than you think necessary, especially for large codebases
1009
- - Each subagent gets fresh, focused context = better quality output
1010
-
1011
- ### Context Hygiene - Prevent "Lost in the Middle"
1012
- - Quality degrades as context grows - the "lost in the middle" problem is real
1013
- - Use **double-escape (Esc Esc)** to time travel when context gets polluted with failed attempts
1014
- - Compact strategically and intentionally, not automatically
1015
- - When output quality drops, consider starting fresh rather than adding more context
1016
-
1017
- ### Error Attribution Mindset
1018
- - Issues in AI-generated code trace back to **prompting or context engineering**
1019
- - When something fails, ask "what context was missing?" not "the AI is broken"
1020
- - Log failures mentally: prompt → context → outcome. Patterns will emerge.
1021
- - Better input = better output. Always.
1022
-
935
+ CODESEEKER_MCP_GUIDANCE = `
936
+ ## CodeSeeker MCP Tools - MANDATORY FOR CODE DISCOVERY
937
+
938
+ **CRITICAL**: This project has CodeSeeker MCP tools available. You MUST use them as your PRIMARY method for code discovery, NOT grep/glob.
939
+
940
+ ### Auto-Initialization Check
941
+
942
+ **BEFORE any code search**, verify the project is indexed:
943
+ 1. Call \`projects()\` to see indexed projects
944
+ 2. If this project is NOT listed, call \`index({path: "PROJECT_ROOT_PATH"})\` first
945
+ 3. If tools return "Not connected", the MCP server may need restart
946
+
947
+ ### When to Use CodeSeeker (DEFAULT)
948
+
949
+ **ALWAYS use CodeSeeker for these queries:**
950
+ - "Where is X handled?" → \`search("X handling logic")\`
951
+ - "Find the auth/login/validation code" → \`search("authentication")\`
952
+ - "How does Y work?" → \`search_and_read("Y implementation")\`
953
+ - "What calls/imports Z?" → \`show_dependencies({filepath: "path/to/Z"})\`
954
+ - "Show me the error handling" → \`search_and_read("error handling patterns")\`
955
+
956
+ | Task | MUST Use | NOT This |
957
+ |------|----------|----------|
958
+ | Find code by meaning | \`search("authentication logic")\` | ❌ \`grep -r "auth"\` |
959
+ | Search + read files | \`search_and_read("error handling")\` | ❌ \`grep\` then \`cat\` |
960
+ | Show dependencies | \`show_dependencies({filepath})\` | ❌ Manual file reading |
961
+ | Find patterns | \`standards({project})\` | ❌ Searching manually |
962
+ | Understand a file | \`read_with_context({filepath})\` | ❌ Just Read alone |
963
+
964
+ ### When to Use grep/glob (EXCEPTIONS ONLY)
965
+
966
+ Only fall back to grep/glob when:
967
+ - Searching for **exact literal strings** (UUIDs, specific error codes, magic numbers)
968
+ - Using **regex patterns** that semantic search can't handle
969
+ - You **already know the exact file path**
970
+
971
+ ### Why CodeSeeker is Better
972
+
973
+ \`\`\`
974
+ ❌ grep -r "error handling" src/
975
+ → Only finds literal text "error handling"
976
+
977
+ ✅ search("how errors are handled")
978
+ → Finds: try-catch blocks, .catch() callbacks, error responses,
979
+ validation errors, custom Error classes - even if they don't
980
+ contain the words "error handling"
981
+ \`\`\`
982
+
983
+ ### Available MCP Tools
984
+
985
+ | Tool | Purpose | When to Use |
986
+ |------|---------|-------------|
987
+ | \`search(query)\` | Semantic search | First choice for any "find X" query |
988
+ | \`search_and_read(query)\` | Search + read combined | When you need file contents |
989
+ | \`show_dependencies({filepath})\` | Dependency graph | "What uses this?", "What does this depend on?" |
990
+ | \`read_with_context({filepath})\` | File + related code | Reading a file for the first time |
991
+ | \`standards({project})\` | Project patterns | Before writing new code |
992
+ | \`index({path})\` | Index a project | If project not indexed |
993
+ | \`sync({changes})\` | Update index | After editing files |
994
+ | \`projects()\` | Show indexed projects | Check if project is indexed |
995
+
996
+ ### Keep Index Updated
997
+
998
+ After using Edit/Write tools, call:
999
+ \`\`\`
1000
+ sync({changes: [{type: "modified", path: "path/to/file"}]})
1001
+ \`\`\`
1002
+
1003
+ ## Claude Code Best Practices (from 2000+ hours of expert usage)
1004
+
1005
+ ### Subagent Strategy for Complex Tasks
1006
+ - For multi-step or complex tasks, spawn subagents using the **main model** (not cheaper/smaller models) instead of cramming everything into one context
1007
+ - Pattern: "Orchestrator coordinates + focused subagents execute" >> "Single massive context"
1008
+ - Use subagents MORE than you think necessary, especially for large codebases
1009
+ - Each subagent gets fresh, focused context = better quality output
1010
+
1011
+ ### Context Hygiene - Prevent "Lost in the Middle"
1012
+ - Quality degrades as context grows - the "lost in the middle" problem is real
1013
+ - Use **double-escape (Esc Esc)** to time travel when context gets polluted with failed attempts
1014
+ - Compact strategically and intentionally, not automatically
1015
+ - When output quality drops, consider starting fresh rather than adding more context
1016
+
1017
+ ### Error Attribution Mindset
1018
+ - Issues in AI-generated code trace back to **prompting or context engineering**
1019
+ - When something fails, ask "what context was missing?" not "the AI is broken"
1020
+ - Log failures mentally: prompt → context → outcome. Patterns will emerge.
1021
+ - Better input = better output. Always.
1022
+
1023
1023
  `;
1024
1024
  /**
1025
1025
  * Common agent instruction files to check and update with CodeSeeker MCP guidance
@@ -330,9 +330,9 @@ class ContextAwareClarificationService {
330
330
  const clarificationText = Array.from(clarifications.entries())
331
331
  .map(([id, answer]) => `- ${this.formatClarification(id, answer)}`)
332
332
  .join('\n');
333
- return `${originalQuery}
334
-
335
- ## User Clarifications (from codebase analysis):
333
+ return `${originalQuery}
334
+
335
+ ## User Clarifications (from codebase analysis):
336
336
  ${clarificationText}`;
337
337
  }
338
338
  /**
@@ -190,47 +190,47 @@ class CodeConsolidationHandler {
190
190
  * Build comprehensive Claude Code instruction
191
191
  */
192
192
  buildClaudeInstruction(plan, projectPath) {
193
- const instruction = `
194
- **Code Consolidation Task: ${plan.action.replace(/_/g, ' ').toUpperCase()}**
195
-
196
- **Objective**: ${plan.instructions}
197
-
198
- **Target Location**: ${plan.targetLocation}
199
-
200
- **Files to Modify**:
201
- ${plan.affectedFiles.map(file => `- ${file}`).join('\n')}
202
-
203
- **Prerequisites** (complete these first):
204
- ${plan.prerequisites.map(req => `- ${req}`).join('\n')}
205
-
206
- **Instructions**:
207
- 1. Analyze the duplicate code patterns in the affected files
208
- 2. Create the new utility/function/class at: ${plan.targetLocation}
209
- 3. Replace all duplicate occurrences with calls to the new implementation
210
- 4. Ensure all tests pass after refactoring
211
- 5. Update any related documentation
212
- 6. Follow the project's existing coding standards and patterns
213
-
214
- **Quality Requirements**:
215
- - Maintain or improve code readability
216
- - Ensure backward compatibility
217
- - Add appropriate error handling
218
- - Include comprehensive documentation
219
- - Follow SOLID principles
220
- - Ensure thread safety if applicable
221
-
222
- **Testing Requirements**:
223
- - Run all existing tests to ensure no regressions
224
- - Add tests for the new utility if creating new functionality
225
- - Verify performance is maintained or improved
226
-
227
- **Output Requirements**:
228
- - List all files modified
229
- - Report lines of code reduced
230
- - Summarize the consolidation approach taken
231
- - Note any potential issues or considerations for review
232
-
233
- Please proceed with this consolidation task step by step.
193
+ const instruction = `
194
+ **Code Consolidation Task: ${plan.action.replace(/_/g, ' ').toUpperCase()}**
195
+
196
+ **Objective**: ${plan.instructions}
197
+
198
+ **Target Location**: ${plan.targetLocation}
199
+
200
+ **Files to Modify**:
201
+ ${plan.affectedFiles.map(file => `- ${file}`).join('\n')}
202
+
203
+ **Prerequisites** (complete these first):
204
+ ${plan.prerequisites.map(req => `- ${req}`).join('\n')}
205
+
206
+ **Instructions**:
207
+ 1. Analyze the duplicate code patterns in the affected files
208
+ 2. Create the new utility/function/class at: ${plan.targetLocation}
209
+ 3. Replace all duplicate occurrences with calls to the new implementation
210
+ 4. Ensure all tests pass after refactoring
211
+ 5. Update any related documentation
212
+ 6. Follow the project's existing coding standards and patterns
213
+
214
+ **Quality Requirements**:
215
+ - Maintain or improve code readability
216
+ - Ensure backward compatibility
217
+ - Add appropriate error handling
218
+ - Include comprehensive documentation
219
+ - Follow SOLID principles
220
+ - Ensure thread safety if applicable
221
+
222
+ **Testing Requirements**:
223
+ - Run all existing tests to ensure no regressions
224
+ - Add tests for the new utility if creating new functionality
225
+ - Verify performance is maintained or improved
226
+
227
+ **Output Requirements**:
228
+ - List all files modified
229
+ - Report lines of code reduced
230
+ - Summarize the consolidation approach taken
231
+ - Note any potential issues or considerations for review
232
+
233
+ Please proceed with this consolidation task step by step.
234
234
  `;
235
235
  return instruction.trim();
236
236
  }