@houtini/lm 1.0.0
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/CHANGELOG.md +273 -0
- package/LICENSE +21 -0
- package/README.md +203 -0
- package/dist/cache/analysis-cache.d.ts +33 -0
- package/dist/cache/analysis-cache.d.ts.map +1 -0
- package/dist/cache/analysis-cache.js +56 -0
- package/dist/cache/analysis-cache.js.map +1 -0
- package/dist/cache/cache-manager.d.ts +29 -0
- package/dist/cache/cache-manager.d.ts.map +1 -0
- package/dist/cache/cache-manager.js +85 -0
- package/dist/cache/cache-manager.js.map +1 -0
- package/dist/cache/index.d.ts +16 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +17 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/prompt-cache.d.ts +33 -0
- package/dist/cache/prompt-cache.d.ts.map +1 -0
- package/dist/cache/prompt-cache.js +61 -0
- package/dist/cache/prompt-cache.js.map +1 -0
- package/dist/config.d.ts +43 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +70 -0
- package/dist/config.js.map +1 -0
- package/dist/core/ThreeStagePromptManager.d.ts +39 -0
- package/dist/core/ThreeStagePromptManager.d.ts.map +1 -0
- package/dist/core/ThreeStagePromptManager.js +176 -0
- package/dist/core/ThreeStagePromptManager.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +230 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/base-plugin.d.ts +47 -0
- package/dist/plugins/base-plugin.d.ts.map +1 -0
- package/dist/plugins/base-plugin.js +90 -0
- package/dist/plugins/base-plugin.js.map +1 -0
- package/dist/plugins/index.d.ts +58 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +161 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/types.d.ts +5 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +5 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/prompts/analyze/code-quality.d.ts +116 -0
- package/dist/prompts/analyze/code-quality.d.ts.map +1 -0
- package/dist/prompts/analyze/code-quality.js +433 -0
- package/dist/prompts/analyze/code-quality.js.map +1 -0
- package/dist/prompts/analyze/compare-integration.d.ts +130 -0
- package/dist/prompts/analyze/compare-integration.d.ts.map +1 -0
- package/dist/prompts/analyze/compare-integration.js +543 -0
- package/dist/prompts/analyze/compare-integration.js.map +1 -0
- package/dist/prompts/analyze/count-files.d.ts +109 -0
- package/dist/prompts/analyze/count-files.d.ts.map +1 -0
- package/dist/prompts/analyze/count-files.js +399 -0
- package/dist/prompts/analyze/count-files.js.map +1 -0
- package/dist/prompts/analyze/database-queries.d.ts +156 -0
- package/dist/prompts/analyze/database-queries.d.ts.map +1 -0
- package/dist/prompts/analyze/database-queries.js +759 -0
- package/dist/prompts/analyze/database-queries.js.map +1 -0
- package/dist/prompts/analyze/dependencies.d.ts +97 -0
- package/dist/prompts/analyze/dependencies.d.ts.map +1 -0
- package/dist/prompts/analyze/dependencies.js +333 -0
- package/dist/prompts/analyze/dependencies.js.map +1 -0
- package/dist/prompts/analyze/diff-signatures.d.ts +139 -0
- package/dist/prompts/analyze/diff-signatures.d.ts.map +1 -0
- package/dist/prompts/analyze/diff-signatures.js +702 -0
- package/dist/prompts/analyze/diff-signatures.js.map +1 -0
- package/dist/prompts/analyze/find-patterns.d.ts +128 -0
- package/dist/prompts/analyze/find-patterns.d.ts.map +1 -0
- package/dist/prompts/analyze/find-patterns.js +520 -0
- package/dist/prompts/analyze/find-patterns.js.map +1 -0
- package/dist/prompts/analyze/find-unused-css.d.ts +151 -0
- package/dist/prompts/analyze/find-unused-css.d.ts.map +1 -0
- package/dist/prompts/analyze/find-unused-css.js +754 -0
- package/dist/prompts/analyze/find-unused-css.js.map +1 -0
- package/dist/prompts/analyze/n8n-workflow.d.ts +137 -0
- package/dist/prompts/analyze/n8n-workflow.d.ts.map +1 -0
- package/dist/prompts/analyze/n8n-workflow.js +529 -0
- package/dist/prompts/analyze/n8n-workflow.js.map +1 -0
- package/dist/prompts/analyze/project-structure.d.ts +126 -0
- package/dist/prompts/analyze/project-structure.d.ts.map +1 -0
- package/dist/prompts/analyze/project-structure.js +569 -0
- package/dist/prompts/analyze/project-structure.js.map +1 -0
- package/dist/prompts/analyze/security-audit.d.ts +142 -0
- package/dist/prompts/analyze/security-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/security-audit.js +637 -0
- package/dist/prompts/analyze/security-audit.js.map +1 -0
- package/dist/prompts/analyze/single-file.d.ts +162 -0
- package/dist/prompts/analyze/single-file.d.ts.map +1 -0
- package/dist/prompts/analyze/single-file.js +665 -0
- package/dist/prompts/analyze/single-file.js.map +1 -0
- package/dist/prompts/analyze/trace-execution.d.ts +126 -0
- package/dist/prompts/analyze/trace-execution.d.ts.map +1 -0
- package/dist/prompts/analyze/trace-execution.js +609 -0
- package/dist/prompts/analyze/trace-execution.js.map +1 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +116 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.js +454 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.js.map +1 -0
- package/dist/prompts/analyze/wordpress-security.d.ts +146 -0
- package/dist/prompts/analyze/wordpress-security.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-security.js +698 -0
- package/dist/prompts/analyze/wordpress-security.js.map +1 -0
- package/dist/prompts/analyze/wordpress-theme-audit.d.ts +114 -0
- package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-theme-audit.js +538 -0
- package/dist/prompts/analyze/wordpress-theme-audit.js.map +1 -0
- package/dist/prompts/custom/custom-prompt.d.ts +135 -0
- package/dist/prompts/custom/custom-prompt.d.ts.map +1 -0
- package/dist/prompts/custom/custom-prompt.js +419 -0
- package/dist/prompts/custom/custom-prompt.js.map +1 -0
- package/dist/prompts/fun/arcade-game.d.ts +152 -0
- package/dist/prompts/fun/arcade-game.d.ts.map +1 -0
- package/dist/prompts/fun/arcade-game.js +653 -0
- package/dist/prompts/fun/arcade-game.js.map +1 -0
- package/dist/prompts/fun/create_text_adventure.d.ts +100 -0
- package/dist/prompts/fun/create_text_adventure.d.ts.map +1 -0
- package/dist/prompts/fun/create_text_adventure.js +397 -0
- package/dist/prompts/fun/create_text_adventure.js.map +1 -0
- package/dist/prompts/fun/css-art-generator.d.ts +168 -0
- package/dist/prompts/fun/css-art-generator.d.ts.map +1 -0
- package/dist/prompts/fun/css-art-generator.js +827 -0
- package/dist/prompts/fun/css-art-generator.js.map +1 -0
- package/dist/prompts/generate/project-documentation.d.ts +137 -0
- package/dist/prompts/generate/project-documentation.d.ts.map +1 -0
- package/dist/prompts/generate/project-documentation.js +666 -0
- package/dist/prompts/generate/project-documentation.js.map +1 -0
- package/dist/prompts/generate/refactoring.d.ts +164 -0
- package/dist/prompts/generate/refactoring.d.ts.map +1 -0
- package/dist/prompts/generate/refactoring.js +621 -0
- package/dist/prompts/generate/refactoring.js.map +1 -0
- package/dist/prompts/generate/responsive-component.d.ts +147 -0
- package/dist/prompts/generate/responsive-component.d.ts.map +1 -0
- package/dist/prompts/generate/responsive-component.js +955 -0
- package/dist/prompts/generate/responsive-component.js.map +1 -0
- package/dist/prompts/generate/typescript-conversion.d.ts +144 -0
- package/dist/prompts/generate/typescript-conversion.d.ts.map +1 -0
- package/dist/prompts/generate/typescript-conversion.js +527 -0
- package/dist/prompts/generate/typescript-conversion.js.map +1 -0
- package/dist/prompts/generate/unit-tests.d.ts +139 -0
- package/dist/prompts/generate/unit-tests.d.ts.map +1 -0
- package/dist/prompts/generate/unit-tests.js +578 -0
- package/dist/prompts/generate/unit-tests.js.map +1 -0
- package/dist/prompts/generate/wordpress-plugin.d.ts +179 -0
- package/dist/prompts/generate/wordpress-plugin.d.ts.map +1 -0
- package/dist/prompts/generate/wordpress-plugin.js +763 -0
- package/dist/prompts/generate/wordpress-plugin.js.map +1 -0
- package/dist/prompts/generate/wordpress-theme-from-static.d.ts +177 -0
- package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +1 -0
- package/dist/prompts/generate/wordpress-theme-from-static.js +695 -0
- package/dist/prompts/generate/wordpress-theme-from-static.js.map +1 -0
- package/dist/prompts/shared/cache-manager.d.ts +45 -0
- package/dist/prompts/shared/cache-manager.d.ts.map +1 -0
- package/dist/prompts/shared/cache-manager.js +129 -0
- package/dist/prompts/shared/cache-manager.js.map +1 -0
- package/dist/prompts/shared/helpers.d.ts +39 -0
- package/dist/prompts/shared/helpers.d.ts.map +1 -0
- package/dist/prompts/shared/helpers.js +151 -0
- package/dist/prompts/shared/helpers.js.map +1 -0
- package/dist/prompts/shared/templates.d.ts +35 -0
- package/dist/prompts/shared/templates.d.ts.map +1 -0
- package/dist/prompts/shared/templates.js +77 -0
- package/dist/prompts/shared/templates.js.map +1 -0
- package/dist/prompts/shared/types.d.ts +112 -0
- package/dist/prompts/shared/types.d.ts.map +1 -0
- package/dist/prompts/shared/types.js +5 -0
- package/dist/prompts/shared/types.js.map +1 -0
- package/dist/prompts/system/find-unused-files.d.ts +106 -0
- package/dist/prompts/system/find-unused-files.d.ts.map +1 -0
- package/dist/prompts/system/find-unused-files.js +353 -0
- package/dist/prompts/system/find-unused-files.js.map +1 -0
- package/dist/security/index.d.ts +39 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +46 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/integration-helpers.d.ts +121 -0
- package/dist/security/integration-helpers.d.ts.map +1 -0
- package/dist/security/integration-helpers.js +190 -0
- package/dist/security/integration-helpers.js.map +1 -0
- package/dist/security/output-encoder.d.ts +94 -0
- package/dist/security/output-encoder.d.ts.map +1 -0
- package/dist/security/output-encoder.js +295 -0
- package/dist/security/output-encoder.js.map +1 -0
- package/dist/security/prompt-injection-guard.d.ts +59 -0
- package/dist/security/prompt-injection-guard.d.ts.map +1 -0
- package/dist/security/prompt-injection-guard.js +249 -0
- package/dist/security/prompt-injection-guard.js.map +1 -0
- package/dist/security/sanitisation.d.ts +67 -0
- package/dist/security/sanitisation.d.ts.map +1 -0
- package/dist/security/sanitisation.js +398 -0
- package/dist/security/sanitisation.js.map +1 -0
- package/dist/security/security-service.d.ts +103 -0
- package/dist/security/security-service.d.ts.map +1 -0
- package/dist/security/security-service.js +303 -0
- package/dist/security/security-service.js.map +1 -0
- package/dist/security-config.d.ts +45 -0
- package/dist/security-config.d.ts.map +1 -0
- package/dist/security-config.js +63 -0
- package/dist/security-config.js.map +1 -0
- package/dist/system/function-list.d.ts +61 -0
- package/dist/system/function-list.d.ts.map +1 -0
- package/dist/system/function-list.js +111 -0
- package/dist/system/function-list.js.map +1 -0
- package/dist/system/function-registry.d.ts +23 -0
- package/dist/system/function-registry.d.ts.map +1 -0
- package/dist/system/function-registry.js +136 -0
- package/dist/system/function-registry.js.map +1 -0
- package/dist/system/health-check.d.ts +33 -0
- package/dist/system/health-check.d.ts.map +1 -0
- package/dist/system/health-check.js +98 -0
- package/dist/system/health-check.js.map +1 -0
- package/dist/system/path-resolver.d.ts +55 -0
- package/dist/system/path-resolver.d.ts.map +1 -0
- package/dist/system/path-resolver.js +90 -0
- package/dist/system/path-resolver.js.map +1 -0
- package/dist/templates/plugin-template.d.ts +121 -0
- package/dist/templates/plugin-template.d.ts.map +1 -0
- package/dist/templates/plugin-template.js +450 -0
- package/dist/templates/plugin-template.js.map +1 -0
- package/dist/types/chunking-types.d.ts +88 -0
- package/dist/types/chunking-types.d.ts.map +1 -0
- package/dist/types/chunking-types.js +18 -0
- package/dist/types/chunking-types.js.map +1 -0
- package/dist/types/prompt-stages.d.ts +42 -0
- package/dist/types/prompt-stages.d.ts.map +1 -0
- package/dist/types/prompt-stages.js +6 -0
- package/dist/types/prompt-stages.js.map +1 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/css-parser.d.ts +26 -0
- package/dist/utils/css-parser.d.ts.map +1 -0
- package/dist/utils/css-parser.js +117 -0
- package/dist/utils/css-parser.js.map +1 -0
- package/dist/utils/path-resolver.d.ts +13 -0
- package/dist/utils/path-resolver.d.ts.map +1 -0
- package/dist/utils/path-resolver.js +78 -0
- package/dist/utils/path-resolver.js.map +1 -0
- package/dist/utils/plugin-utilities.d.ts +171 -0
- package/dist/utils/plugin-utilities.d.ts.map +1 -0
- package/dist/utils/plugin-utilities.js +221 -0
- package/dist/utils/plugin-utilities.js.map +1 -0
- package/dist/utils/streamHandler.d.ts +3 -0
- package/dist/utils/streamHandler.d.ts.map +1 -0
- package/dist/utils/streamHandler.js +137 -0
- package/dist/utils/streamHandler.js.map +1 -0
- package/dist/validation/output-validator.d.ts +136 -0
- package/dist/validation/output-validator.d.ts.map +1 -0
- package/dist/validation/output-validator.js +262 -0
- package/dist/validation/output-validator.js.map +1 -0
- package/dist/validation/response-factory.d.ts +44 -0
- package/dist/validation/response-factory.d.ts.map +1 -0
- package/dist/validation/response-factory.js +202 -0
- package/dist/validation/response-factory.js.map +1 -0
- package/dist/validation/schemas.d.ts +519 -0
- package/dist/validation/schemas.d.ts.map +1 -0
- package/dist/validation/schemas.js +6 -0
- package/dist/validation/schemas.js.map +1 -0
- package/package.json +72 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [4.1.0] - 2025-08-29
|
|
9
|
+
|
|
10
|
+
### 🎉 MAJOR RELEASE - 3-Stage Architecture Complete
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Complete 3-Stage Architecture Deployment** - All multifile plugins now use the proven 3-stage prompt architecture
|
|
14
|
+
- `ThreeStagePromptManager` integration across all 4 multifile plugins
|
|
15
|
+
- `getPromptStages()` method with structured prompt stages (System+Context, Data Payload, Output Instructions)
|
|
16
|
+
- `executeSinglePass()` and `executeWithChunking()` methods for intelligent operation sizing
|
|
17
|
+
- Dynamic context detection from LM Studio (23,832 tokens from Qwen 3 Coder 30B)
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- **Architecture Consistency** - Eliminated dual chunking conflicts throughout codebase
|
|
21
|
+
- Context Window Manager is now the sole chunking authority
|
|
22
|
+
- Single, consistent 3-stage chunking system across all multifile operations
|
|
23
|
+
- Smart prompt staging for optimal LLM utilization
|
|
24
|
+
- Consistent error handling and response formatting
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- **100% Success Rate** - All multifile functions tested and verified working:
|
|
28
|
+
- ✅ `compare_integration`: Perfect integration analysis with detailed findings
|
|
29
|
+
- ✅ `trace_execution_path`: Successful 4-chunk processing with execution traces
|
|
30
|
+
- ✅ `diff_method_signatures`: Accurate signature compatibility analysis
|
|
31
|
+
- ✅ `find_pattern_usage`: Pattern detection across entire codebase
|
|
32
|
+
|
|
33
|
+
### Performance
|
|
34
|
+
- **Context Preservation** - Eliminated hardcoded limits in favor of dynamic detection
|
|
35
|
+
- **Scalable Operations** - Support for any operation size through intelligent chunking
|
|
36
|
+
- **Memory Efficiency** - Optimized prompt staging reduces token waste
|
|
37
|
+
- **Reliability** - Robust error handling and fallback mechanisms
|
|
38
|
+
|
|
39
|
+
## [4.0.1] - 2025-08-29
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- **Cache Management Tools Registration** - Fixed plugin loader to properly register cache management functions
|
|
43
|
+
- `clear_analysis_cache` and `get_cache_statistics` now properly available as MCP tools
|
|
44
|
+
- Fixed file:// URL format issue in plugin loader for Windows paths
|
|
45
|
+
- Build process now correctly compiles and exposes all 17 functions
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
- **100% Function Completion** - All 17 functions from functional specification v4.0 now working:
|
|
49
|
+
- 4 Analysis functions: analyze_single_file, security_audit, analyze_project_structure, analyze_n8n_workflow
|
|
50
|
+
- 6 Generation functions: generate_unit_tests, generate_documentation, suggest_refactoring, generate_wordpress_plugin, convert_to_typescript, generate_responsive_component
|
|
51
|
+
- 4 Multi-file functions: compare_integration, trace_execution_path, find_pattern_usage, diff_method_signatures
|
|
52
|
+
- 3 System functions: health_check, clear_analysis_cache, get_cache_statistics
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
- **Documentation Updates** - Comprehensive README.md updates to reflect 100% completion status
|
|
56
|
+
- Updated function counts and categorization
|
|
57
|
+
- Added completion badges and status indicators
|
|
58
|
+
- Improved tool organization and descriptions
|
|
59
|
+
- Token savings data refreshed
|
|
60
|
+
|
|
61
|
+
## [4.0.0] - 2025-08-28
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
- **BREAKING**: Renamed `analyze_code_structure` to `analyze_single_file` for clarity
|
|
65
|
+
- The function now explicitly indicates it analyses a single file, not a directory
|
|
66
|
+
- Use `analyze_project_structure` for multi-file/directory analysis
|
|
67
|
+
- All enum references updated from `CODE_STRUCTURE` to `ANALYZE_SINGLE_FILE`
|
|
68
|
+
|
|
69
|
+
## [3.0.4] - 2025-08-27
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
- **Critical streaming issue** - Resolved `[object Object]` output when processing LLM responses
|
|
73
|
+
- **LM Studio SDK compatibility** - Proper handling of object-based chunks with `content` property
|
|
74
|
+
- **Qwen model support** - Fixed streaming for Qwen thinking models that output structured chunks
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
- **Stream handler integration** - Robust chunk processing for multiple streaming formats
|
|
78
|
+
- **Test scripts**:
|
|
79
|
+
- `test-llm-streaming.mjs` - Direct LLM streaming validation
|
|
80
|
+
- `test-streaming-fix.mjs` - MCP protocol streaming test
|
|
81
|
+
- **Comprehensive streaming support** for:
|
|
82
|
+
- LM Studio object chunks
|
|
83
|
+
- OpenAI-style responses
|
|
84
|
+
- Plain text strings
|
|
85
|
+
- Unknown object formats with JSON fallback
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
- Replaced simple string concatenation with `handleLLMResponse` function
|
|
89
|
+
- Improved error handling for malformed chunks
|
|
90
|
+
|
|
91
|
+
## [3.0.3] - 2025-08-26
|
|
92
|
+
|
|
93
|
+
### Fixed
|
|
94
|
+
- Added missing `health_check` tool definition (handler existed but tool wasn't registered)
|
|
95
|
+
- Added empty handlers for `resources/list` and `prompts/list` to prevent "Method not found" errors in Claude logs
|
|
96
|
+
- These optional MCP protocol methods now return empty arrays as expected
|
|
97
|
+
|
|
98
|
+
### Added
|
|
99
|
+
- **Diagnostic Tools**:
|
|
100
|
+
- `diagnostics/run-diagnostics.mjs` - Comprehensive system diagnostic tool that checks:
|
|
101
|
+
- Node.js version compatibility
|
|
102
|
+
- LM Studio connection and loaded models
|
|
103
|
+
- Claude configuration validity
|
|
104
|
+
- Multiple Claude process detection
|
|
105
|
+
- MCP server startup capability
|
|
106
|
+
- Generates detailed `diagnostic-report.json`
|
|
107
|
+
- `diagnostics/check-claude-processes.mjs` - Windows-specific tool to detect multiple Claude.exe processes
|
|
108
|
+
- **Documentation Updates**:
|
|
109
|
+
- Added "Known Issues" section to TROUBLESHOOTING.md
|
|
110
|
+
- Documented multiple Claude.exe processes issue and solution
|
|
111
|
+
- Documented "Method not found" errors and resolution
|
|
112
|
+
- Added diagnostic tool usage instructions
|
|
113
|
+
|
|
114
|
+
### Changed
|
|
115
|
+
- Enhanced troubleshooting guide with new debugging tools section
|
|
116
|
+
- Improved error diagnostics and user guidance
|
|
117
|
+
|
|
118
|
+
## [3.0.2] - 2025-08-23
|
|
119
|
+
|
|
120
|
+
### Fixed
|
|
121
|
+
- Added missing shebang (`#!/usr/bin/env node`) to dist/index.js for NPX execution
|
|
122
|
+
- Fixed NPM package execution on Windows
|
|
123
|
+
- Added post-build script to ensure shebang persists after TypeScript compilation
|
|
124
|
+
|
|
125
|
+
## [3.0.1] - 2025-08-23
|
|
126
|
+
|
|
127
|
+
### Changed
|
|
128
|
+
- Cleaned up root directory by removing development and handover files
|
|
129
|
+
- Updated .gitignore to prevent future development file commits
|
|
130
|
+
- Repository now contains only essential files for npm package and GitHub
|
|
131
|
+
|
|
132
|
+
### Removed
|
|
133
|
+
- Development documentation files (handover, implementation notes)
|
|
134
|
+
- Test files used during development (test-enhanced*.mjs)
|
|
135
|
+
- Backup directories and migration scripts
|
|
136
|
+
- 18 unnecessary files total
|
|
137
|
+
|
|
138
|
+
## [3.0.0] - 2025-08-25
|
|
139
|
+
|
|
140
|
+
### Added
|
|
141
|
+
- **Context-aware prompts** for enhanced code analysis
|
|
142
|
+
- Support for 11 project types (WordPress, React, n8n, Node.js, etc.)
|
|
143
|
+
- Framework-specific best practices and suggestions
|
|
144
|
+
- Optional context parameter maintains backward compatibility
|
|
145
|
+
- **5 new powerful tools**:
|
|
146
|
+
- `generate_wordpress_plugin` - Complete WordPress plugin generator with Brain Monkey test support
|
|
147
|
+
- `analyze_n8n_workflow` - n8n workflow optimization and analysis
|
|
148
|
+
- `generate_responsive_component` - Accessible, responsive component generator
|
|
149
|
+
- `convert_to_typescript` - Intelligent JavaScript to TypeScript converter
|
|
150
|
+
- `security_audit` - Project-specific security vulnerability scanner
|
|
151
|
+
- **90% token savings** through intelligent task delegation
|
|
152
|
+
- **Enhanced type system** with comprehensive TypeScript definitions
|
|
153
|
+
- **Project-specific security checklists** for each supported framework
|
|
154
|
+
|
|
155
|
+
### Changed
|
|
156
|
+
- **RENAMED**: `analyze_code_structure` is now `analyze_single_file` for clarity
|
|
157
|
+
- `analyze_single_file` - Now provides framework-specific insights for a single file
|
|
158
|
+
- Note: Use `analyze_project_structure` for multi-file/directory analysis
|
|
159
|
+
- Enhanced existing tools with optional context support:
|
|
160
|
+
- `generate_unit_tests` - Creates framework-aware test suites
|
|
161
|
+
- `generate_documentation` - Generates audience-appropriate documentation
|
|
162
|
+
- `suggest_refactoring` - Offers project-specific improvements
|
|
163
|
+
- Improved prompt quality for better LLM responses
|
|
164
|
+
- Better error messages with context-aware suggestions
|
|
165
|
+
|
|
166
|
+
### Technical Improvements
|
|
167
|
+
- Modular prompt system for easier maintenance
|
|
168
|
+
- Comprehensive type definitions for all contexts
|
|
169
|
+
- Enhanced prompt templates with domain knowledge
|
|
170
|
+
- Improved code organization and separation of concerns
|
|
171
|
+
|
|
172
|
+
## [2.2.2] - 2025-08-25
|
|
173
|
+
|
|
174
|
+
### Fixed
|
|
175
|
+
- Fixed NPX execution on Windows by normalizing file paths
|
|
176
|
+
- Handle forward/backward slash differences between import.meta.url and process.argv
|
|
177
|
+
- Fixed "server transport closed unexpectedly" error when using NPX
|
|
178
|
+
|
|
179
|
+
## [2.2.1] - 2025-08-25
|
|
180
|
+
|
|
181
|
+
### Fixed
|
|
182
|
+
- Added missing bin field to enable NPX execution
|
|
183
|
+
- Fixed "could not determine executable to run" error
|
|
184
|
+
- Updated examples to show NPX usage
|
|
185
|
+
|
|
186
|
+
### Added
|
|
187
|
+
- Clean and rebuild scripts for easier development
|
|
188
|
+
|
|
189
|
+
## [2.2.0] - 2025-08-25
|
|
190
|
+
|
|
191
|
+
### Fixed
|
|
192
|
+
- Restored all missing tool definitions in setupHandlers
|
|
193
|
+
- Fixed issue where only health_check was being registered
|
|
194
|
+
|
|
195
|
+
### Added
|
|
196
|
+
- All 10 tools now properly available:
|
|
197
|
+
- analyze_single_file
|
|
198
|
+
- generate_unit_tests
|
|
199
|
+
- generate_documentation
|
|
200
|
+
- suggest_refactoring
|
|
201
|
+
- detect_patterns
|
|
202
|
+
- validate_syntax
|
|
203
|
+
- suggest_variable_names
|
|
204
|
+
- analyze_file
|
|
205
|
+
- analyze_csv_data
|
|
206
|
+
- health_check
|
|
207
|
+
|
|
208
|
+
## [2.1.0] - 2025-08-24
|
|
209
|
+
|
|
210
|
+
### Added
|
|
211
|
+
- **Security Features**:
|
|
212
|
+
- Path validation to prevent unauthorized file access
|
|
213
|
+
- Configurable allowed directories via LLM_MCP_ALLOWED_DIRS
|
|
214
|
+
- Path traversal protection
|
|
215
|
+
- File size limits (configurable, default 10MB)
|
|
216
|
+
- **Configuration options**:
|
|
217
|
+
- Environment variable support for security settings
|
|
218
|
+
- Configurable retry logic
|
|
219
|
+
- Adjustable timeout settings
|
|
220
|
+
|
|
221
|
+
### Fixed
|
|
222
|
+
- Thinking tag regex for better response parsing
|
|
223
|
+
- TypeScript strict mode compliance
|
|
224
|
+
- Better error handling for invalid paths
|
|
225
|
+
|
|
226
|
+
### Changed
|
|
227
|
+
- Improved security posture with opt-in directory access
|
|
228
|
+
- Better error messages for permission issues
|
|
229
|
+
|
|
230
|
+
## [2.0.0] - 2025-08-23
|
|
231
|
+
|
|
232
|
+
### Added
|
|
233
|
+
- **File attachment support** - Analyze files directly without reading content first
|
|
234
|
+
- **LM Studio SDK integration** - Replaced axios with official @lmstudio/sdk
|
|
235
|
+
- **New tools**:
|
|
236
|
+
- `analyze_file` - General file analysis with custom instructions
|
|
237
|
+
- `analyze_csv_data` - CSV filtering and analysis
|
|
238
|
+
- **Streaming support** for better performance
|
|
239
|
+
- **Enhanced error handling** with better LM Studio status detection
|
|
240
|
+
|
|
241
|
+
### Changed
|
|
242
|
+
- Complete rewrite using LM Studio SDK
|
|
243
|
+
- Improved connection handling and retry logic
|
|
244
|
+
- Better model detection and validation
|
|
245
|
+
|
|
246
|
+
### Removed
|
|
247
|
+
- Axios dependency (replaced with LM Studio SDK)
|
|
248
|
+
- Manual HTTP request handling
|
|
249
|
+
|
|
250
|
+
## [1.0.0] - 2025-08-22
|
|
251
|
+
|
|
252
|
+
### Initial Release
|
|
253
|
+
- Basic code analysis tools
|
|
254
|
+
- Unit test generation
|
|
255
|
+
- Documentation generation
|
|
256
|
+
- Refactoring suggestions
|
|
257
|
+
- Pattern detection
|
|
258
|
+
- Bug finding
|
|
259
|
+
- Variable naming suggestions
|
|
260
|
+
- Basic LM Studio integration via HTTP
|
|
261
|
+
|
|
262
|
+
## Migration Notes
|
|
263
|
+
|
|
264
|
+
### Upgrading to v3.0.0
|
|
265
|
+
- No breaking changes - all existing code continues to work
|
|
266
|
+
- To use new context features, add optional `context` parameter
|
|
267
|
+
- New tools available immediately after upgrade
|
|
268
|
+
- See [Migration Guide](MIGRATION_GUIDE_V3.md) for detailed upgrade instructions
|
|
269
|
+
|
|
270
|
+
### Upgrading to v2.0.0
|
|
271
|
+
- Update LM Studio URL from http:// to ws:// protocol
|
|
272
|
+
- File analysis now available through new tools
|
|
273
|
+
- Check [Migration Guide](MIGRATION_GUIDE.md) for details
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Richard Baxter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Houtini LM - Local AI Development Assistant
|
|
2
|
+
|
|
3
|
+
**Version**: 1.0.0
|
|
4
|
+
**Your unlimited AI companion for code analysis, generation, and creativity**
|
|
5
|
+
|
|
6
|
+
Transform your development workflow with expert-level code analysis, professional documentation generation, and creative project scaffolding - all running locally without API costs.
|
|
7
|
+
|
|
8
|
+
## What This Does
|
|
9
|
+
|
|
10
|
+
Houtini LM **saves your Claude context window** by handling detailed analysis tasks locally whilst Claude focuses on strategy and complex problem-solving. Think of it as your intelligent coding assistant that never runs out of tokens.
|
|
11
|
+
|
|
12
|
+
**Perfect for:**
|
|
13
|
+
- 🔍 **Code analysis** - Deep insights into quality, security, and architecture
|
|
14
|
+
- 📝 **Documentation generation** - Professional docs from code analysis
|
|
15
|
+
- 🏗️ **Project scaffolding** - Complete applications, themes, and components
|
|
16
|
+
- 🎮 **Creative projects** - Games, CSS art, and interactive experiences
|
|
17
|
+
- 🛡️ **Security audits** - OWASP compliance and vulnerability detection
|
|
18
|
+
|
|
19
|
+
## Quick Start Prompt Guide
|
|
20
|
+
|
|
21
|
+
Once installed, simply use natural language prompts with Claude:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Use houtini-lm to analyse the code quality in C:/my-project/src/UserAuth.js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Generate comprehensive unit tests using houtini-lm for my React component at C:/components/Dashboard.jsx
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Use houtini-lm to create a WordPress plugin called "Event Manager" with custom post types and admin interface
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Audit the security of my WordPress theme using houtini-lm at C:/themes/my-theme
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Create a CSS art generator project using houtini-lm with space theme and neon colours
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Use houtini-lm to convert my JavaScript file to TypeScript with strict mode enabled
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Generate responsive HTML components using houtini-lm for a pricing card with dark mode support
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Prerequisites
|
|
52
|
+
|
|
53
|
+
**Essential Requirements:**
|
|
54
|
+
|
|
55
|
+
1. **LM Studio** - Download from [lmstudio.ai](https://lmstudio.ai)
|
|
56
|
+
- Must be running at `ws://127.0.0.1:1234`
|
|
57
|
+
- Model loaded and ready (13B+ parameters recommended)
|
|
58
|
+
|
|
59
|
+
2. **Desktop Commander MCP** - Essential for file operations
|
|
60
|
+
- Repository: [DesktopCommanderMCP](https://github.com/wonderwhy-er/DesktopCommanderMCP)
|
|
61
|
+
- Required for reading files and writing generated code
|
|
62
|
+
|
|
63
|
+
3. **Node.js 24.6.0 or later** - For MCP server functionality
|
|
64
|
+
- Download from [nodejs.org](https://nodejs.org)
|
|
65
|
+
|
|
66
|
+
4. **Claude Desktop** - For the best experience
|
|
67
|
+
- Download from [claude.ai/download](https://claude.ai/download)
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
### 1. Install Dependencies
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Clone the repository
|
|
75
|
+
git clone https://github.com/houtini-ai/lm.git
|
|
76
|
+
cd lm
|
|
77
|
+
|
|
78
|
+
# Install Node.js dependencies
|
|
79
|
+
npm install
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Configure Claude Desktop
|
|
83
|
+
|
|
84
|
+
Add to your Claude Desktop configuration file:
|
|
85
|
+
|
|
86
|
+
**Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
87
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcpServers": {
|
|
92
|
+
"houtini-lm": {
|
|
93
|
+
"command": "node",
|
|
94
|
+
"args": ["path/to/houtini-lm/index.js"],
|
|
95
|
+
"env": {
|
|
96
|
+
"LLM_MCP_ALLOWED_DIRS": "C:/your-projects,C:/dev,C:/websites"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 3. Start LM Studio
|
|
104
|
+
|
|
105
|
+
1. Launch LM Studio
|
|
106
|
+
2. Load a model (13B+ parameters recommended for best results)
|
|
107
|
+
3. Start the server at `ws://127.0.0.1:1234`
|
|
108
|
+
4. Verify the model is ready and responding
|
|
109
|
+
|
|
110
|
+
### 4. Verify Installation
|
|
111
|
+
|
|
112
|
+
Restart Claude Desktop, then test with:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
Use houtini-lm health check to verify everything is working
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Available Functions
|
|
119
|
+
|
|
120
|
+
### 🔍 Analysis Functions (17 functions)
|
|
121
|
+
- **`analyze_single_file`** - Deep code analysis and quality assessment
|
|
122
|
+
- **`count_files`** - Project structure with beautiful markdown trees
|
|
123
|
+
- **`find_unused_files`** - Dead code detection with risk assessment
|
|
124
|
+
- **`security_audit`** - OWASP compliance and vulnerability scanning
|
|
125
|
+
- **`analyze_dependencies`** - Circular dependencies and unused imports
|
|
126
|
+
- And 12 more specialized analysis tools...
|
|
127
|
+
|
|
128
|
+
### 🛠️ Generation Functions (10 functions)
|
|
129
|
+
- **`generate_unit_tests`** - Comprehensive test suites with framework patterns
|
|
130
|
+
- **`generate_documentation`** - Professional docs from code analysis
|
|
131
|
+
- **`convert_to_typescript`** - JavaScript to TypeScript with type safety
|
|
132
|
+
- **`generate_wordpress_plugin`** - Complete WordPress plugin creation
|
|
133
|
+
- **`generate_responsive_component`** - Accessible HTML/CSS components
|
|
134
|
+
- And 5 more generation tools...
|
|
135
|
+
|
|
136
|
+
### 🎮 Creative Functions (3 functions)
|
|
137
|
+
- **`css_art_generator`** - Pure CSS art and animations
|
|
138
|
+
- **`arcade_game`** - Complete playable HTML5 games
|
|
139
|
+
- **`create_text_adventure`** - Interactive fiction with branching stories
|
|
140
|
+
|
|
141
|
+
### ⚙️ System Functions (5 functions)
|
|
142
|
+
- **`health_check`** - Verify LM Studio connection
|
|
143
|
+
- **`list_functions`** - Discover all available functions
|
|
144
|
+
- **`resolve_path`** - Path analysis and suggestions
|
|
145
|
+
- And 2 more system utilities...
|
|
146
|
+
|
|
147
|
+
## Documentation
|
|
148
|
+
|
|
149
|
+
**Complete guides available:**
|
|
150
|
+
- [Analysis Functions Guide](docs/analysis-functions-md.md) - All 17 analysis tools
|
|
151
|
+
- [Generation Functions Guide](docs/generation-functions-md.md) - All 10 creation tools
|
|
152
|
+
- [Creative Functions Guide](docs/creative-functions-md.md) - Games and art tools
|
|
153
|
+
- [System Functions Guide](docs/system-functions-md.md) - Utilities and diagnostics
|
|
154
|
+
- [Complete User Guide](docs/user-guide-md.md) - Comprehensive usage manual
|
|
155
|
+
|
|
156
|
+
## Recommended Setup
|
|
157
|
+
|
|
158
|
+
**For Professional Development:**
|
|
159
|
+
- **CPU**: 8-core or better (for local LLM processing)
|
|
160
|
+
- **RAM**: 32GB (24GB for model, 8GB for development)
|
|
161
|
+
- **Storage**: SSD with 100GB+ free space
|
|
162
|
+
- **Model**: Qwen2.5-Coder-14B-Instruct or similar
|
|
163
|
+
|
|
164
|
+
**Performance Tips:**
|
|
165
|
+
- Use 13B+ parameter models for professional-quality results
|
|
166
|
+
- Configure `LLM_MCP_ALLOWED_DIRS` to include your project directories
|
|
167
|
+
- Install Desktop Commander MCP for complete file operation support
|
|
168
|
+
- Keep LM Studio running and model loaded for instant responses
|
|
169
|
+
|
|
170
|
+
## Version History
|
|
171
|
+
|
|
172
|
+
### Version 1.0.0 (Current)
|
|
173
|
+
- ✅ Complete function library (35+ functions)
|
|
174
|
+
- ✅ Professional documentation system
|
|
175
|
+
- ✅ WordPress-specific tools and auditing
|
|
176
|
+
- ✅ Creative project generators
|
|
177
|
+
- ✅ Comprehensive security analysis
|
|
178
|
+
- ✅ TypeScript conversion and test generation
|
|
179
|
+
- ✅ Cross-file integration analysis
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
**MIT License** - Use this project freely for personal and commercial projects. See [LICENSE](LICENSE) for details.
|
|
184
|
+
|
|
185
|
+
## Contributing
|
|
186
|
+
|
|
187
|
+
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on:
|
|
188
|
+
- Code standards and patterns
|
|
189
|
+
- Testing requirements
|
|
190
|
+
- Documentation updates
|
|
191
|
+
- Issue reporting
|
|
192
|
+
|
|
193
|
+
## Support
|
|
194
|
+
|
|
195
|
+
- **Issues**: [GitHub Issues](https://github.com/houtini-ai/lm/issues)
|
|
196
|
+
- **Discussions**: [GitHub Discussions](https://github.com/houtini-ai/lm/discussions)
|
|
197
|
+
- **Documentation**: Complete guides in the `docs/` directory
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
**Ready to supercharge your development workflow?** Install Houtini LM and start building amazing things with unlimited local AI assistance.
|
|
202
|
+
|
|
203
|
+
*Built for developers who think clearly but can't afford to think expensively.*
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analysis Result Cache
|
|
3
|
+
* Specialized caching for plugin analysis results
|
|
4
|
+
*/
|
|
5
|
+
import { BaseCacheManager, CacheConfig } from './cache-manager.js';
|
|
6
|
+
export interface AnalysisResult {
|
|
7
|
+
summary: string;
|
|
8
|
+
findings?: any[];
|
|
9
|
+
data?: any;
|
|
10
|
+
metadata?: {
|
|
11
|
+
modelUsed: string;
|
|
12
|
+
executionTime: number;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare class AnalysisCache extends BaseCacheManager<AnalysisResult> {
|
|
17
|
+
private static instance;
|
|
18
|
+
constructor(config?: Partial<CacheConfig>);
|
|
19
|
+
static getInstance(config?: Partial<CacheConfig>): AnalysisCache;
|
|
20
|
+
/**
|
|
21
|
+
* Generate cache key for analysis results
|
|
22
|
+
*/
|
|
23
|
+
generateKey(functionName: string, params: any, fileHashes?: string[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* Cache analysis result with metadata
|
|
26
|
+
*/
|
|
27
|
+
cacheAnalysis(key: string, result: AnalysisResult, metadata: AnalysisResult['metadata']): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Simple hash function for cache keys
|
|
30
|
+
*/
|
|
31
|
+
private hashObject;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=analysis-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-cache.d.ts","sourceRoot":"","sources":["../../src/cache/analysis-cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,QAAQ,CAAC,EAAE;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,qBAAa,aAAc,SAAQ,gBAAgB,CAAC,cAAc,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;gBAE3B,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IASzC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,aAAa;IAOhE;;OAEG;IACH,WAAW,CACT,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,GAAG,EACX,UAAU,CAAC,EAAE,MAAM,EAAE,GACpB,MAAM;IAOT;;OAEG;IACG,aAAa,CACjB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,IAAI,CAAC;IAYhB;;OAEG;IACH,OAAO,CAAC,UAAU;CAUnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analysis Result Cache
|
|
3
|
+
* Specialized caching for plugin analysis results
|
|
4
|
+
*/
|
|
5
|
+
import { BaseCacheManager } from './cache-manager.js';
|
|
6
|
+
export class AnalysisCache extends BaseCacheManager {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
super({
|
|
9
|
+
maxEntries: 50, // Smaller cache for analysis results
|
|
10
|
+
ttlMs: 30 * 60 * 1000, // 30 minutes TTL
|
|
11
|
+
enableStats: true,
|
|
12
|
+
...config
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
static getInstance(config) {
|
|
16
|
+
if (!this.instance) {
|
|
17
|
+
this.instance = new AnalysisCache(config);
|
|
18
|
+
}
|
|
19
|
+
return this.instance;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate cache key for analysis results
|
|
23
|
+
*/
|
|
24
|
+
generateKey(functionName, params, fileHashes) {
|
|
25
|
+
const paramHash = this.hashObject(params);
|
|
26
|
+
const filesHash = fileHashes ? fileHashes.join('|') : '';
|
|
27
|
+
return `${functionName}:${paramHash}:${filesHash}`.substring(0, 128);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Cache analysis result with metadata
|
|
31
|
+
*/
|
|
32
|
+
async cacheAnalysis(key, result, metadata) {
|
|
33
|
+
const enrichedResult = {
|
|
34
|
+
...result,
|
|
35
|
+
metadata: {
|
|
36
|
+
...metadata,
|
|
37
|
+
cachedAt: new Date().toISOString()
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
await this.set(key, enrichedResult);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Simple hash function for cache keys
|
|
44
|
+
*/
|
|
45
|
+
hashObject(obj) {
|
|
46
|
+
const str = JSON.stringify(obj, Object.keys(obj).sort());
|
|
47
|
+
let hash = 0;
|
|
48
|
+
for (let i = 0; i < str.length; i++) {
|
|
49
|
+
const char = str.charCodeAt(i);
|
|
50
|
+
hash = ((hash << 5) - hash) + char;
|
|
51
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
52
|
+
}
|
|
53
|
+
return Math.abs(hash).toString(36);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=analysis-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-cache.js","sourceRoot":"","sources":["../../src/cache/analysis-cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAanE,MAAM,OAAO,aAAc,SAAQ,gBAAgC;IAGjE,YAAY,MAA6B;QACvC,KAAK,CAAC;YACJ,UAAU,EAAE,EAAE,EAAG,qCAAqC;YACtD,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAG,iBAAiB;YACzC,WAAW,EAAE,IAAI;YACjB,GAAG,MAAM;SACV,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAA6B;QAC9C,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,WAAW,CACT,YAAoB,EACpB,MAAW,EACX,UAAqB;QAErB,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEzD,OAAO,GAAG,YAAY,IAAI,SAAS,IAAI,SAAS,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CACjB,GAAW,EACX,MAAsB,EACtB,QAAoC;QAEpC,MAAM,cAAc,GAAG;YACrB,GAAG,MAAM;YACT,QAAQ,EAAE;gBACR,GAAG,QAAQ;gBACX,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACnC;SACF,CAAC;QAEF,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,GAAQ;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;YACnC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,2BAA2B;QACjD,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Cache Manager
|
|
3
|
+
* Foundation for all caching functionality - analysis, prompts, memory, etc.
|
|
4
|
+
*/
|
|
5
|
+
export interface CacheEntry<T = any> {
|
|
6
|
+
value: T;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
hits: number;
|
|
9
|
+
size?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CacheConfig {
|
|
12
|
+
maxEntries: number;
|
|
13
|
+
ttlMs?: number;
|
|
14
|
+
enableStats: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class BaseCacheManager<T = any> {
|
|
17
|
+
protected cache: Map<string, CacheEntry<T>>;
|
|
18
|
+
protected config: CacheConfig;
|
|
19
|
+
constructor(config?: Partial<CacheConfig>);
|
|
20
|
+
protected isExpired(entry: CacheEntry<T>): boolean;
|
|
21
|
+
protected evictIfNeeded(): void;
|
|
22
|
+
protected createEntry(value: T): CacheEntry<T>;
|
|
23
|
+
protected estimateSize(value: T): number;
|
|
24
|
+
get(key: string): Promise<T | null>;
|
|
25
|
+
set(key: string, value: T): Promise<void>;
|
|
26
|
+
clear(key?: string): void;
|
|
27
|
+
getStatistics(): any;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=cache-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../src/cache/cache-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG;IACjC,KAAK,EAAE,CAAC,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,8BAAsB,gBAAgB,CAAC,CAAC,GAAG,GAAG;IAC5C,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAa;IACxD,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;gBAElB,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM;IAS7C,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO;IAKlD,SAAS,CAAC,aAAa,IAAI,IAAI;IAU/B,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAS9C,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM;IAQlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAgBnC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAQzB,aAAa,IAAI,GAAG;CAerB"}
|