mcp-code-context 3.6.1 → 3.6.2
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 +5 -5
- package/HIRE_ME.md +234 -234
- package/INSTRUCTIONS.md +274 -274
- package/LICENSE +21 -21
- package/README.md +486 -486
- package/SECURITY.md +14 -14
- package/SPONSORS.md +104 -104
- package/dist/src/core/cacheManager.d.ts +6 -1
- package/dist/src/core/cacheManager.js +25 -16
- package/dist/src/core/cacheManager.js.map +1 -1
- package/dist/src/core/engine.d.ts +1 -1
- package/dist/src/core/engine.js +1 -1
- package/dist/src/core/validator.d.ts +1 -1
- package/dist/src/core/validator.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +207 -24
- package/dist/src/index.js.map +1 -1
- package/dist/src/operations/compress.d.ts +1 -1
- package/dist/src/operations/compress.js +1 -1
- package/dist/src/operations/confirmationStore.d.ts +1 -1
- package/dist/src/operations/confirmationStore.js +1 -1
- package/dist/src/operations/read.d.ts +37 -1
- package/dist/src/operations/read.js +168 -5
- package/dist/src/operations/read.js.map +1 -1
- package/dist/src/operations/write.d.ts +2 -2
- package/dist/src/operations/write.js +2 -2
- package/dist/src/parsers/base.d.ts +3 -1
- package/dist/src/parsers/base.js +1 -1
- package/dist/src/parsers/base.js.map +1 -1
- package/dist/src/parsers/dartTreeSitter.d.ts +1 -1
- package/dist/src/parsers/dartTreeSitter.js +5 -1
- package/dist/src/parsers/dartTreeSitter.js.map +1 -1
- package/dist/src/parsers/php.d.ts +1 -1
- package/dist/src/parsers/php.js +5 -1
- package/dist/src/parsers/php.js.map +1 -1
- package/dist/src/parsers/python.d.ts +1 -1
- package/dist/src/parsers/python.js +5 -1
- package/dist/src/parsers/python.js.map +1 -1
- package/dist/src/parsers/registry.d.ts +1 -1
- package/dist/src/parsers/registry.js +1 -1
- package/dist/src/parsers/typescript.d.ts +1 -1
- package/dist/src/parsers/typescript.js +9 -5
- package/dist/src/parsers/typescript.js.map +1 -1
- package/dist/src/utils/auditLogger.d.ts +1 -1
- package/dist/src/utils/auditLogger.js +1 -1
- package/dist/src/utils/backupManager.d.ts +1 -1
- package/dist/src/utils/backupManager.js +1 -1
- package/dist/src/utils/constants.d.ts +1 -1
- package/dist/src/utils/constants.js +1 -1
- package/dist/src/utils/diff.d.ts +1 -1
- package/dist/src/utils/diff.js +4 -4
- package/dist/src/utils/fileLock.d.ts +1 -1
- package/dist/src/utils/fileLock.js +1 -1
- package/dist/src/utils/fileWalker.d.ts +1 -1
- package/dist/src/utils/fileWalker.js +1 -1
- package/dist/src/utils/fileWatcher.d.ts +2 -1
- package/dist/src/utils/fileWatcher.js +12 -2
- package/dist/src/utils/fileWatcher.js.map +1 -1
- package/dist/src/utils/fuzzySearch.d.ts +1 -1
- package/dist/src/utils/fuzzySearch.js +1 -1
- package/dist/src/utils/logger.d.ts +1 -1
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/utils/rateLimiter.d.ts +5 -1
- package/dist/src/utils/rateLimiter.js +5 -1
- package/dist/src/utils/rateLimiter.js.map +1 -1
- package/dist/src/utils/safeRegex.d.ts +1 -1
- package/dist/src/utils/safeRegex.js +1 -1
- package/dist/src/utils/streaming.d.ts +1 -1
- package/dist/src/utils/streaming.js +1 -1
- package/dist/src/utils/telemetry.d.ts +1 -1
- package/dist/src/utils/telemetry.js +1 -1
- package/llms.txt +5 -5
- package/package.json +3 -3
- package/scripts/replace-version.js +59 -59
- package/vitest.config.ts +37 -37
package/SECURITY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Security Policy - mcp-code-context v3.6.
|
|
1
|
+
# Security Policy - mcp-code-context v3.6.2
|
|
2
2
|
|
|
3
|
-
## 🔒 Security Improvements in v3.6.
|
|
3
|
+
## 🔒 Security Improvements in v3.6.2
|
|
4
4
|
|
|
5
5
|
This release addresses **all critical security vulnerabilities** from comprehensive adversarial audit, implements full middleware pipeline, and hardens all 13 tool handlers.
|
|
6
6
|
|
|
@@ -10,11 +10,11 @@ This release addresses **all critical security vulnerabilities** from comprehens
|
|
|
10
10
|
|
|
11
11
|
### 1. Path Traversal (HIGH)
|
|
12
12
|
**CVSS Score**: 8.1 (High)
|
|
13
|
-
**Status**: ✅ FIXED in v3.2.0, **hardened in v3.6.
|
|
13
|
+
**Status**: ✅ FIXED in v3.2.0, **hardened in v3.6.2**
|
|
14
14
|
|
|
15
15
|
**Description**: Path traversal check occurred BEFORE path normalization, allowing bypass with absolute paths.
|
|
16
16
|
|
|
17
|
-
**Fix**: Check boundary AFTER `path.resolve()` normalization. In v3.6.
|
|
17
|
+
**Fix**: Check boundary AFTER `path.resolve()` normalization. In v3.6.2, **all 13 handlers** now require `projectRoot` and validate via `SecurityValidator`.
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -40,7 +40,7 @@ This release addresses **all critical security vulnerabilities** from comprehens
|
|
|
40
40
|
|
|
41
41
|
### 4. ReDoS in searchPattern and readLines (MEDIUM)
|
|
42
42
|
**CVSS Score**: 5.3 (Medium)
|
|
43
|
-
**Status**: ✅ FIXED in v3.6.
|
|
43
|
+
**Status**: ✅ FIXED in v3.6.2
|
|
44
44
|
|
|
45
45
|
**Description**: User-provided regex patterns could cause catastrophic backtracking.
|
|
46
46
|
|
|
@@ -58,7 +58,7 @@ This release addresses **all critical security vulnerabilities** from comprehens
|
|
|
58
58
|
|
|
59
59
|
### 6. extractSymbol API Mismatch (CRITICAL)
|
|
60
60
|
**CVSS Score**: 9.0 (Critical)
|
|
61
|
-
**Status**: ✅ FIXED in v3.6.
|
|
61
|
+
**Status**: ✅ FIXED in v3.6.2
|
|
62
62
|
|
|
63
63
|
**Description**: `read.ts` passed `content` as `symbolName` and real `symbolName` as `className`. Symbol extraction was 100% broken.
|
|
64
64
|
|
|
@@ -68,7 +68,7 @@ This release addresses **all critical security vulnerabilities** from comprehens
|
|
|
68
68
|
|
|
69
69
|
### 7. Handlers Without Path Validation (HIGH)
|
|
70
70
|
**CVSS Score**: 8.5 (High)
|
|
71
|
-
**Status**: ✅ FIXED in v3.6.
|
|
71
|
+
**Status**: ✅ FIXED in v3.6.2
|
|
72
72
|
|
|
73
73
|
**Description**: `readLines`, `searchPattern`, `analyzeImpact`, `getSemanticRepoMap` had no path boundary check.
|
|
74
74
|
|
|
@@ -78,7 +78,7 @@ This release addresses **all critical security vulnerabilities** from comprehens
|
|
|
78
78
|
|
|
79
79
|
### 8. renameSymbol Arbitrary Write (HIGH)
|
|
80
80
|
**CVSS Score**: 8.0 (High)
|
|
81
|
-
**Status**: ✅ FIXED in v3.6.
|
|
81
|
+
**Status**: ✅ FIXED in v3.6.2
|
|
82
82
|
|
|
83
83
|
**Description**: `renameSymbol` wrote dependent files without SecurityValidator check, using non-atomic writes.
|
|
84
84
|
|
|
@@ -88,7 +88,7 @@ This release addresses **all critical security vulnerabilities** from comprehens
|
|
|
88
88
|
|
|
89
89
|
### 9. LCS Diff OOM (MEDIUM)
|
|
90
90
|
**CVSS Score**: 5.0 (Medium)
|
|
91
|
-
**Status**: ✅ FIXED in v3.6.
|
|
91
|
+
**Status**: ✅ FIXED in v3.6.2
|
|
92
92
|
|
|
93
93
|
**Description**: LCS diff algorithm is O(n²) memory — 10K-line files cause OOM.
|
|
94
94
|
|
|
@@ -101,16 +101,16 @@ This release addresses **all critical security vulnerabilities** from comprehens
|
|
|
101
101
|
### Defense in Depth
|
|
102
102
|
|
|
103
103
|
1. **Input Validation**
|
|
104
|
-
- Path boundary enforcement on ALL handlers (v3.6.
|
|
104
|
+
- Path boundary enforcement on ALL handlers (v3.6.2)
|
|
105
105
|
- File size limits (10MB per file, 50MB total)
|
|
106
106
|
- Regex sanitization + timeout (1s limit)
|
|
107
107
|
|
|
108
|
-
2. **Two-Phase Write Workflow** (v3.6.
|
|
108
|
+
2. **Two-Phase Write Workflow** (v3.6.2)
|
|
109
109
|
- Phase 1: Dry-run returns diff + confirmation token
|
|
110
110
|
- Phase 2: Apply with token (5-minute expiry)
|
|
111
111
|
- Max 50 pending operations
|
|
112
112
|
|
|
113
|
-
3. **Middleware Pipeline** (v3.6.
|
|
113
|
+
3. **Middleware Pipeline** (v3.6.2)
|
|
114
114
|
- Rate limiting (token bucket per operation)
|
|
115
115
|
- File locking (prevents concurrent writes)
|
|
116
116
|
- Audit logging (persistent `.mcp-audit-logs/`)
|
|
@@ -160,7 +160,7 @@ node dist-tests/tests/test-security.js
|
|
|
160
160
|
- [x] Syntax validation
|
|
161
161
|
- [x] Bounded memory in compress
|
|
162
162
|
|
|
163
|
-
### v3.6.
|
|
163
|
+
### v3.6.2 ✅
|
|
164
164
|
- [x] Regex timeout enforcement (safeRegexTest)
|
|
165
165
|
- [x] Rate limiting (token bucket)
|
|
166
166
|
- [x] File locking (concurrent write prevention)
|
|
@@ -174,4 +174,4 @@ node dist-tests/tests/test-security.js
|
|
|
174
174
|
---
|
|
175
175
|
|
|
176
176
|
**Last Updated**: 2026-04-24
|
|
177
|
-
**Version**: 3.6.
|
|
177
|
+
**Version**: 3.6.2
|
package/SPONSORS.md
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
# Sponsors & Supporters
|
|
2
|
-
|
|
3
|
-
Thank you to everyone who supports mcp-code-context! 🙏
|
|
4
|
-
|
|
5
|
-
Your contributions help keep this project:
|
|
6
|
-
- ✅ Free and open source
|
|
7
|
-
- ✅ Actively maintained
|
|
8
|
-
- ✅ Continuously improved
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## 💎 Diamond Sponsors ($100+/month)
|
|
13
|
-
|
|
14
|
-
*(No sponsors yet - be the first!)*
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## 🥇 Gold Sponsors ($50-99/month)
|
|
19
|
-
|
|
20
|
-
*(No sponsors yet)*
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 🥈 Silver Sponsors ($25-49/month)
|
|
25
|
-
|
|
26
|
-
*(No sponsors yet)*
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## 🥉 Bronze Supporters ($5-24/month)
|
|
31
|
-
|
|
32
|
-
*(No sponsors yet)*
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## ☕ One-Time Contributors
|
|
37
|
-
|
|
38
|
-
*(No contributors yet - be the first!)*
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 🌟 How to Become a Sponsor
|
|
43
|
-
|
|
44
|
-
See the [Support This Project](#support-this-project) section in the [README](README.md#support-this-project).
|
|
45
|
-
|
|
46
|
-
### Available Options:
|
|
47
|
-
|
|
48
|
-
**Monthly Memberships** (Ko-fi):
|
|
49
|
-
- **$5/month** - Supporter: Name in SPONSORS.md + Early access to release notes
|
|
50
|
-
- **$25/month** - Contributor: Priority support + Early access to features + Vote on roadmap
|
|
51
|
-
- **$100/month** - Sponsor: Feature requests + Monthly consultation + Logo in README
|
|
52
|
-
|
|
53
|
-
**One-Time Donations**:
|
|
54
|
-
- **Ko-fi**: https://ko-fi.com/achatainga
|
|
55
|
-
- **PayPal**: https://paypal.me/achatainga
|
|
56
|
-
- **Binance (USDT)**: See README for addresses
|
|
57
|
-
|
|
58
|
-
- **TRC20**: `0xa68d53f7853ce0175eb96aaad4a30c068ca96444`
|
|
59
|
-
- **ERC20**: `0xa68d53f7853ce0175eb96aaad4a30c068ca96444`
|
|
60
|
-
- **Binance Pay ID**: `367669339`
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## 📊 Transparency Report
|
|
65
|
-
|
|
66
|
-
### April 2025
|
|
67
|
-
- **Monthly Donations**: $0
|
|
68
|
-
- **One-Time Donations**: $0
|
|
69
|
-
- **Total Supporters**: 0
|
|
70
|
-
- **Expenses**: ~$20 (npm registry, testing credits, domain)
|
|
71
|
-
- **Time Invested**: ~40 hours
|
|
72
|
-
- **Net**: -$20
|
|
73
|
-
|
|
74
|
-
*(Updated monthly)*
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 💼 Hire Me
|
|
79
|
-
|
|
80
|
-
Need custom MCP tools or AI integrations?
|
|
81
|
-
|
|
82
|
-
- **Rate**: $50-75/hour
|
|
83
|
-
- **Email**: a.chataing.a@gmail.com
|
|
84
|
-
- **Details**: [HIRE_ME.md](HIRE_ME.md)
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## ❤️ Non-Financial Support
|
|
89
|
-
|
|
90
|
-
Can't donate? No problem! You can still help:
|
|
91
|
-
|
|
92
|
-
- ⭐ Star the repo on GitHub
|
|
93
|
-
- 🐛 Report bugs or suggest features
|
|
94
|
-
- 📝 Improve documentation
|
|
95
|
-
- 🗣️ Share with others who might benefit
|
|
96
|
-
- 💬 Help other users in discussions
|
|
97
|
-
|
|
98
|
-
Every contribution matters, financial or not.
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
**Thank you for supporting open source! 🚀**
|
|
103
|
-
|
|
104
|
-
*Built with ❤️ from Caracas, Venezuela 🇻🇪*
|
|
1
|
+
# Sponsors & Supporters
|
|
2
|
+
|
|
3
|
+
Thank you to everyone who supports mcp-code-context! 🙏
|
|
4
|
+
|
|
5
|
+
Your contributions help keep this project:
|
|
6
|
+
- ✅ Free and open source
|
|
7
|
+
- ✅ Actively maintained
|
|
8
|
+
- ✅ Continuously improved
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 💎 Diamond Sponsors ($100+/month)
|
|
13
|
+
|
|
14
|
+
*(No sponsors yet - be the first!)*
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🥇 Gold Sponsors ($50-99/month)
|
|
19
|
+
|
|
20
|
+
*(No sponsors yet)*
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🥈 Silver Sponsors ($25-49/month)
|
|
25
|
+
|
|
26
|
+
*(No sponsors yet)*
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🥉 Bronze Supporters ($5-24/month)
|
|
31
|
+
|
|
32
|
+
*(No sponsors yet)*
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## ☕ One-Time Contributors
|
|
37
|
+
|
|
38
|
+
*(No contributors yet - be the first!)*
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🌟 How to Become a Sponsor
|
|
43
|
+
|
|
44
|
+
See the [Support This Project](#support-this-project) section in the [README](README.md#support-this-project).
|
|
45
|
+
|
|
46
|
+
### Available Options:
|
|
47
|
+
|
|
48
|
+
**Monthly Memberships** (Ko-fi):
|
|
49
|
+
- **$5/month** - Supporter: Name in SPONSORS.md + Early access to release notes
|
|
50
|
+
- **$25/month** - Contributor: Priority support + Early access to features + Vote on roadmap
|
|
51
|
+
- **$100/month** - Sponsor: Feature requests + Monthly consultation + Logo in README
|
|
52
|
+
|
|
53
|
+
**One-Time Donations**:
|
|
54
|
+
- **Ko-fi**: https://ko-fi.com/achatainga
|
|
55
|
+
- **PayPal**: https://paypal.me/achatainga
|
|
56
|
+
- **Binance (USDT)**: See README for addresses
|
|
57
|
+
|
|
58
|
+
- **TRC20**: `0xa68d53f7853ce0175eb96aaad4a30c068ca96444`
|
|
59
|
+
- **ERC20**: `0xa68d53f7853ce0175eb96aaad4a30c068ca96444`
|
|
60
|
+
- **Binance Pay ID**: `367669339`
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 📊 Transparency Report
|
|
65
|
+
|
|
66
|
+
### April 2025
|
|
67
|
+
- **Monthly Donations**: $0
|
|
68
|
+
- **One-Time Donations**: $0
|
|
69
|
+
- **Total Supporters**: 0
|
|
70
|
+
- **Expenses**: ~$20 (npm registry, testing credits, domain)
|
|
71
|
+
- **Time Invested**: ~40 hours
|
|
72
|
+
- **Net**: -$20
|
|
73
|
+
|
|
74
|
+
*(Updated monthly)*
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 💼 Hire Me
|
|
79
|
+
|
|
80
|
+
Need custom MCP tools or AI integrations?
|
|
81
|
+
|
|
82
|
+
- **Rate**: $50-75/hour
|
|
83
|
+
- **Email**: a.chataing.a@gmail.com
|
|
84
|
+
- **Details**: [HIRE_ME.md](HIRE_ME.md)
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## ❤️ Non-Financial Support
|
|
89
|
+
|
|
90
|
+
Can't donate? No problem! You can still help:
|
|
91
|
+
|
|
92
|
+
- ⭐ Star the repo on GitHub
|
|
93
|
+
- 🐛 Report bugs or suggest features
|
|
94
|
+
- 📝 Improve documentation
|
|
95
|
+
- 🗣️ Share with others who might benefit
|
|
96
|
+
- 💬 Help other users in discussions
|
|
97
|
+
|
|
98
|
+
Every contribution matters, financial or not.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**Thank you for supporting open source! 🚀**
|
|
103
|
+
|
|
104
|
+
*Built with ❤️ from Caracas, Venezuela 🇻🇪*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cache Manager - v3.6.
|
|
2
|
+
* Cache Manager - v3.6.2
|
|
3
3
|
* WASM SQLite cache with debounced persistence
|
|
4
4
|
*/
|
|
5
5
|
export interface CachedFile {
|
|
@@ -18,6 +18,8 @@ export declare class CacheManager {
|
|
|
18
18
|
private initPromise;
|
|
19
19
|
private watcher;
|
|
20
20
|
private projectRoot;
|
|
21
|
+
private hits;
|
|
22
|
+
private misses;
|
|
21
23
|
constructor(projectRoot: string);
|
|
22
24
|
private init;
|
|
23
25
|
private initSchema;
|
|
@@ -28,6 +30,9 @@ export declare class CacheManager {
|
|
|
28
30
|
getStats(): Promise<{
|
|
29
31
|
totalEntries: number;
|
|
30
32
|
totalSize: number;
|
|
33
|
+
hits: number;
|
|
34
|
+
misses: number;
|
|
35
|
+
hitRate: string;
|
|
31
36
|
oldestEntry: number | null;
|
|
32
37
|
newestEntry: number | null;
|
|
33
38
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cache Manager - v3.6.
|
|
2
|
+
* Cache Manager - v3.6.2
|
|
3
3
|
* WASM SQLite cache with debounced persistence
|
|
4
4
|
*/
|
|
5
5
|
import initSqlJs from 'sql.js';
|
|
@@ -19,6 +19,8 @@ export class CacheManager {
|
|
|
19
19
|
initPromise;
|
|
20
20
|
watcher = null;
|
|
21
21
|
projectRoot;
|
|
22
|
+
hits = 0;
|
|
23
|
+
misses = 0;
|
|
22
24
|
constructor(projectRoot) {
|
|
23
25
|
this.projectRoot = projectRoot;
|
|
24
26
|
const projectHash = crypto.createHash('md5')
|
|
@@ -58,17 +60,17 @@ export class CacheManager {
|
|
|
58
60
|
initSchema() {
|
|
59
61
|
if (!this.db)
|
|
60
62
|
return;
|
|
61
|
-
this.db.run(`
|
|
62
|
-
CREATE TABLE IF NOT EXISTS file_cache (
|
|
63
|
-
file_path TEXT PRIMARY KEY,
|
|
64
|
-
hash TEXT NOT NULL,
|
|
65
|
-
symbols TEXT NOT NULL,
|
|
66
|
-
last_modified INTEGER NOT NULL,
|
|
67
|
-
cached_at INTEGER NOT NULL
|
|
68
|
-
)
|
|
63
|
+
this.db.run(`
|
|
64
|
+
CREATE TABLE IF NOT EXISTS file_cache (
|
|
65
|
+
file_path TEXT PRIMARY KEY,
|
|
66
|
+
hash TEXT NOT NULL,
|
|
67
|
+
symbols TEXT NOT NULL,
|
|
68
|
+
last_modified INTEGER NOT NULL,
|
|
69
|
+
cached_at INTEGER NOT NULL
|
|
70
|
+
)
|
|
69
71
|
`);
|
|
70
|
-
this.db.run(`
|
|
71
|
-
CREATE INDEX IF NOT EXISTS idx_cached_at ON file_cache(cached_at)
|
|
72
|
+
this.db.run(`
|
|
73
|
+
CREATE INDEX IF NOT EXISTS idx_cached_at ON file_cache(cached_at)
|
|
72
74
|
`);
|
|
73
75
|
}
|
|
74
76
|
async get(filePath, currentHash) {
|
|
@@ -81,6 +83,7 @@ export class CacheManager {
|
|
|
81
83
|
if (stmt.step()) {
|
|
82
84
|
const row = stmt.getAsObject();
|
|
83
85
|
stmt.free();
|
|
86
|
+
this.hits++;
|
|
84
87
|
return {
|
|
85
88
|
filePath: row.file_path,
|
|
86
89
|
hash: row.hash,
|
|
@@ -90,6 +93,7 @@ export class CacheManager {
|
|
|
90
93
|
};
|
|
91
94
|
}
|
|
92
95
|
stmt.free();
|
|
96
|
+
this.misses++;
|
|
93
97
|
return null;
|
|
94
98
|
}
|
|
95
99
|
catch (error) {
|
|
@@ -102,8 +106,8 @@ export class CacheManager {
|
|
|
102
106
|
if (!this.db)
|
|
103
107
|
return;
|
|
104
108
|
try {
|
|
105
|
-
this.db.run(`INSERT OR REPLACE INTO file_cache
|
|
106
|
-
(file_path, hash, symbols, last_modified, cached_at)
|
|
109
|
+
this.db.run(`INSERT OR REPLACE INTO file_cache
|
|
110
|
+
(file_path, hash, symbols, last_modified, cached_at)
|
|
107
111
|
VALUES (?, ?, ?, ?, ?)`, [
|
|
108
112
|
file.filePath,
|
|
109
113
|
file.hash,
|
|
@@ -148,11 +152,11 @@ export class CacheManager {
|
|
|
148
152
|
async getStats() {
|
|
149
153
|
await this.initPromise;
|
|
150
154
|
if (!this.db) {
|
|
151
|
-
return { totalEntries: 0, totalSize: 0, oldestEntry: null, newestEntry: null };
|
|
155
|
+
return { totalEntries: 0, totalSize: 0, hits: 0, misses: 0, hitRate: '0%', oldestEntry: null, newestEntry: null };
|
|
152
156
|
}
|
|
153
157
|
try {
|
|
154
158
|
const stmt = this.db.prepare(`
|
|
155
|
-
SELECT
|
|
159
|
+
SELECT
|
|
156
160
|
COUNT(*) as count,
|
|
157
161
|
MIN(cached_at) as oldest,
|
|
158
162
|
MAX(cached_at) as newest
|
|
@@ -164,16 +168,21 @@ export class CacheManager {
|
|
|
164
168
|
const totalSize = existsSync(this.dbPath)
|
|
165
169
|
? (await fs.stat(this.dbPath)).size
|
|
166
170
|
: 0;
|
|
171
|
+
const total = this.hits + this.misses;
|
|
172
|
+
const hitRate = total > 0 ? `${Math.round((this.hits / total) * 100)}%` : '0%';
|
|
167
173
|
return {
|
|
168
174
|
totalEntries: row.count,
|
|
169
175
|
totalSize,
|
|
176
|
+
hits: this.hits,
|
|
177
|
+
misses: this.misses,
|
|
178
|
+
hitRate,
|
|
170
179
|
oldestEntry: row.oldest,
|
|
171
180
|
newestEntry: row.newest,
|
|
172
181
|
};
|
|
173
182
|
}
|
|
174
183
|
catch (error) {
|
|
175
184
|
logger.error({ error }, 'Failed to get cache stats');
|
|
176
|
-
return { totalEntries: 0, totalSize: 0, oldestEntry: null, newestEntry: null };
|
|
185
|
+
return { totalEntries: 0, totalSize: 0, hits: 0, misses: 0, hitRate: '0%', oldestEntry: null, newestEntry: null };
|
|
177
186
|
}
|
|
178
187
|
}
|
|
179
188
|
schedulePersist() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheManager.js","sourceRoot":"","sources":["../../../src/core/cacheManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,SAAuB,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAUtD,MAAM,OAAO,YAAY;IACf,EAAE,GAAoB,IAAI,CAAC;IAC3B,MAAM,CAAS;IACf,QAAQ,CAAS;IACjB,OAAO,GAA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