@pcircle/memesh 2.9.2 → 2.9.4
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.de.md +119 -78
- package/README.es.md +116 -75
- package/README.fr.md +116 -75
- package/README.id.md +115 -74
- package/README.ja.md +111 -70
- package/README.ko.md +116 -75
- package/README.md +113 -72
- package/README.th.md +118 -77
- package/README.vi.md +116 -75
- package/README.zh-CN.md +120 -79
- package/README.zh-TW.md +116 -75
- package/dist/core/GitCommandParser.d.ts +11 -0
- package/dist/core/GitCommandParser.d.ts.map +1 -0
- package/dist/core/GitCommandParser.js +43 -0
- package/dist/core/GitCommandParser.js.map +1 -0
- package/dist/core/HookIntegration.d.ts +0 -3
- package/dist/core/HookIntegration.d.ts.map +1 -1
- package/dist/core/HookIntegration.js +6 -30
- package/dist/core/HookIntegration.js.map +1 -1
- package/dist/db/ConnectionPool.d.ts.map +1 -1
- package/dist/db/ConnectionPool.js +17 -1
- package/dist/db/ConnectionPool.js.map +1 -1
- package/dist/db/adapters/BetterSqlite3Adapter.d.ts.map +1 -1
- package/dist/db/adapters/BetterSqlite3Adapter.js +22 -0
- package/dist/db/adapters/BetterSqlite3Adapter.js.map +1 -1
- package/dist/embeddings/EmbeddingService.d.ts +3 -0
- package/dist/embeddings/EmbeddingService.d.ts.map +1 -1
- package/dist/embeddings/EmbeddingService.js +28 -6
- package/dist/embeddings/EmbeddingService.js.map +1 -1
- package/dist/embeddings/InMemoryVectorAdapter.d.ts +15 -0
- package/dist/embeddings/InMemoryVectorAdapter.d.ts.map +1 -0
- package/dist/embeddings/InMemoryVectorAdapter.js +58 -0
- package/dist/embeddings/InMemoryVectorAdapter.js.map +1 -0
- package/dist/embeddings/SqliteVecAdapter.d.ts +15 -0
- package/dist/embeddings/SqliteVecAdapter.d.ts.map +1 -0
- package/dist/embeddings/SqliteVecAdapter.js +107 -0
- package/dist/embeddings/SqliteVecAdapter.js.map +1 -0
- package/dist/embeddings/VectorExtension.d.ts +2 -4
- package/dist/embeddings/VectorExtension.d.ts.map +1 -1
- package/dist/embeddings/VectorExtension.js.map +1 -1
- package/dist/embeddings/VectorSearchAdapter.d.ts +17 -0
- package/dist/embeddings/VectorSearchAdapter.d.ts.map +1 -0
- package/dist/embeddings/VectorSearchAdapter.js +2 -0
- package/dist/embeddings/VectorSearchAdapter.js.map +1 -0
- package/dist/embeddings/index.d.ts +6 -1
- package/dist/embeddings/index.d.ts.map +1 -1
- package/dist/embeddings/index.js +4 -1
- package/dist/embeddings/index.js.map +1 -1
- package/dist/knowledge-graph/ContentHasher.d.ts +4 -0
- package/dist/knowledge-graph/ContentHasher.d.ts.map +1 -0
- package/dist/knowledge-graph/ContentHasher.js +8 -0
- package/dist/knowledge-graph/ContentHasher.js.map +1 -0
- package/dist/knowledge-graph/KGSearchEngine.d.ts +37 -0
- package/dist/knowledge-graph/KGSearchEngine.d.ts.map +1 -0
- package/dist/knowledge-graph/KGSearchEngine.js +257 -0
- package/dist/knowledge-graph/KGSearchEngine.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +18 -7
- package/dist/knowledge-graph/index.d.ts.map +1 -1
- package/dist/knowledge-graph/index.js +147 -242
- package/dist/knowledge-graph/index.js.map +1 -1
- package/dist/mcp/ServerInitializer.d.ts.map +1 -1
- package/dist/mcp/ServerInitializer.js +1 -1
- package/dist/mcp/ServerInitializer.js.map +1 -1
- package/dist/mcp/StdinBufferManager.d.ts +11 -0
- package/dist/mcp/StdinBufferManager.d.ts.map +1 -0
- package/dist/mcp/StdinBufferManager.js +62 -0
- package/dist/mcp/StdinBufferManager.js.map +1 -0
- package/dist/mcp/ToolDefinitions.js +3 -3
- package/dist/mcp/ToolDefinitions.js.map +1 -1
- package/dist/mcp/daemon/StdioProxyClient.d.ts.map +1 -1
- package/dist/mcp/daemon/StdioProxyClient.js +6 -0
- package/dist/mcp/daemon/StdioProxyClient.js.map +1 -1
- package/dist/mcp/handlers/HookToolHandler.d.ts +10 -0
- package/dist/mcp/handlers/HookToolHandler.d.ts.map +1 -0
- package/dist/mcp/handlers/HookToolHandler.js +92 -0
- package/dist/mcp/handlers/HookToolHandler.js.map +1 -0
- package/dist/mcp/handlers/MemoryToolHandler.d.ts +21 -0
- package/dist/mcp/handlers/MemoryToolHandler.d.ts.map +1 -0
- package/dist/mcp/handlers/MemoryToolHandler.js +430 -0
- package/dist/mcp/handlers/MemoryToolHandler.js.map +1 -0
- package/dist/mcp/handlers/SystemToolHandler.d.ts +14 -0
- package/dist/mcp/handlers/SystemToolHandler.d.ts.map +1 -0
- package/dist/mcp/handlers/SystemToolHandler.js +224 -0
- package/dist/mcp/handlers/SystemToolHandler.js.map +1 -0
- package/dist/mcp/handlers/ToolHandlers.d.ts +4 -17
- package/dist/mcp/handlers/ToolHandlers.d.ts.map +1 -1
- package/dist/mcp/handlers/ToolHandlers.js +19 -689
- package/dist/mcp/handlers/ToolHandlers.js.map +1 -1
- package/dist/mcp/handlers/index.d.ts +3 -0
- package/dist/mcp/handlers/index.d.ts.map +1 -1
- package/dist/mcp/handlers/index.js +3 -0
- package/dist/mcp/handlers/index.js.map +1 -1
- package/dist/mcp/server-bootstrap.js +24 -59
- package/dist/mcp/server-bootstrap.js.map +1 -1
- package/dist/mcp/tools/buddy-do.d.ts.map +1 -1
- package/dist/mcp/tools/buddy-do.js +17 -1
- package/dist/mcp/tools/buddy-do.js.map +1 -1
- package/dist/mcp/tools/buddy-remember.d.ts +1 -1
- package/dist/mcp/tools/buddy-remember.d.ts.map +1 -1
- package/dist/mcp/tools/buddy-remember.js +58 -16
- package/dist/mcp/tools/buddy-remember.js.map +1 -1
- package/dist/mcp/tools/create-entities.d.ts.map +1 -1
- package/dist/mcp/tools/create-entities.js +18 -24
- package/dist/mcp/tools/create-entities.js.map +1 -1
- package/dist/memory/MemorySearchEngine.d.ts +17 -0
- package/dist/memory/MemorySearchEngine.d.ts.map +1 -0
- package/dist/memory/MemorySearchEngine.js +88 -0
- package/dist/memory/MemorySearchEngine.js.map +1 -0
- package/dist/memory/ProactiveRecaller.d.ts +26 -0
- package/dist/memory/ProactiveRecaller.d.ts.map +1 -0
- package/dist/memory/ProactiveRecaller.js +96 -0
- package/dist/memory/ProactiveRecaller.js.map +1 -0
- package/dist/memory/UnifiedMemoryStore.d.ts +1 -0
- package/dist/memory/UnifiedMemoryStore.d.ts.map +1 -1
- package/dist/memory/UnifiedMemoryStore.js +12 -64
- package/dist/memory/UnifiedMemoryStore.js.map +1 -1
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/ui/MetricsStore.d.ts.map +1 -1
- package/dist/ui/MetricsStore.js +21 -2
- package/dist/ui/MetricsStore.js.map +1 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/tracing/index.d.ts +0 -1
- package/dist/utils/tracing/index.d.ts.map +1 -1
- package/dist/utils/tracing/index.js +0 -1
- package/dist/utils/tracing/index.js.map +1 -1
- package/package.json +2 -12
- package/plugin.json +1 -1
- package/scripts/hooks/__tests__/post-tool-use-recall.test.js +192 -0
- package/scripts/hooks/__tests__/session-start-recall.test.js +86 -0
- package/scripts/hooks/post-tool-use-recall-utils.js +74 -0
- package/scripts/hooks/post-tool-use.js +83 -0
- package/scripts/hooks/pre-tool-use.js +30 -1
- package/scripts/hooks/session-start-recall-utils.js +40 -0
- package/scripts/hooks/session-start.js +66 -0
- package/scripts/hooks/templates/planning-template.md +46 -0
- package/scripts/postinstall-new.js +8 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetricsStore.js","sourceRoot":"","sources":["../../src/ui/MetricsStore.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAC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,IAAI,CAAC,GAAG,KAAK,IAAI,KAAK,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAKO,iBAAiB;QACvB,OAAO,WAAW,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IACrD,CAAC;IAEO,gBAAgB;QACtB,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE;YACnC,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,cAAc,EAAE,CAAC;YACjB,WAAW,EAAE,CAAC;YACd,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,CAAC;YAClB,mBAAmB,EAAE,EAAE;SACxB,CAAC;IACJ,CAAC;CACF"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -9,11 +9,9 @@ export * from './json.js';
|
|
|
9
9
|
export { logger, setLogLevel, LogLevel, log } from './logger.js';
|
|
10
10
|
export { LRUCache } from './lru-cache.js';
|
|
11
11
|
export * from './memory.js';
|
|
12
|
-
export * from './money.js';
|
|
13
12
|
export * from './pathValidation.js';
|
|
14
13
|
export * from './paths.js';
|
|
15
14
|
export * from './requestId.js';
|
|
16
15
|
export * from './retry.js';
|
|
17
|
-
export * from './toonify-adapter.js';
|
|
18
16
|
export type { ILogger } from './ILogger.js';
|
|
19
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,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gB,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAG3B,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -8,10 +8,8 @@ export * from './json.js';
|
|
|
8
8
|
export { logger, setLogLevel, LogLevel, log } from './logger.js';
|
|
9
9
|
export { LRUCache } from './lru-cache.js';
|
|
10
10
|
export * from './memory.js';
|
|
11
|
-
export * from './money.js';
|
|
12
11
|
export * from './pathValidation.js';
|
|
13
12
|
export * from './paths.js';
|
|
14
13
|
export * from './requestId.js';
|
|
15
14
|
export * from './retry.js';
|
|
16
|
-
export * from './toonify-adapter.js';
|
|
17
15
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,OAAO,EACP,cAAc,EACd,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,GACV,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,OAAO,EACP,cAAc,EACd,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,GACV,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { type TraceContext, generateTraceId, generateSpanId, isValidTraceId, isValidSpanId, parseW3CTraceparent, formatW3CTraceparent, extractTraceContext, injectTraceContext, createTraceContext, getTraceContext, runWithTraceContext, createChildSpan, withChildSpan, withChildSpanAsync, extractTraceTimestamp, } from './TraceContext.js';
|
|
2
|
-
export { type TracedRequest, type TracingMiddlewareOptions, tracingMiddleware, getRequestTraceContext, spanMiddleware, } from './middleware.js';
|
|
3
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/tracing/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,YAAY,EACjB,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/tracing/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,YAAY,EACjB,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { generateTraceId, generateSpanId, isValidTraceId, isValidSpanId, parseW3CTraceparent, formatW3CTraceparent, extractTraceContext, injectTraceContext, createTraceContext, getTraceContext, runWithTraceContext, createChildSpan, withChildSpan, withChildSpanAsync, extractTraceTimestamp, } from './TraceContext.js';
|
|
2
|
-
export { tracingMiddleware, getRequestTraceContext, spanMiddleware, } from './middleware.js';
|
|
3
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/tracing/index.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/tracing/index.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pcircle/memesh",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.4",
|
|
4
4
|
"description": "MeMesh — Persistent memory plugin for Claude Code. Remembers architecture decisions, coding patterns, and project context across sessions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -72,10 +72,8 @@
|
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
74
74
|
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
75
|
-
"@types/form-data": "^2.2.1",
|
|
76
75
|
"@types/fs-extra": "^11.0.4",
|
|
77
76
|
"@types/inquirer": "^9.0.9",
|
|
78
|
-
"@types/multer": "^2.0.0",
|
|
79
77
|
"@xenova/transformers": "^2.17.2",
|
|
80
78
|
"asciichart": "^1.5.25",
|
|
81
79
|
"better-sqlite3": "^12.6.2",
|
|
@@ -85,22 +83,16 @@
|
|
|
85
83
|
"cli-spinners": "^3.4.0",
|
|
86
84
|
"cli-table3": "^0.6.5",
|
|
87
85
|
"commander": "^14.0.2",
|
|
88
|
-
"cors": "^2.8.5",
|
|
89
86
|
"dotenv": "^17.2.3",
|
|
90
87
|
"express": "^5.2.1",
|
|
91
|
-
"form-data": "^4.0.5",
|
|
92
88
|
"fs-extra": "^11.3.3",
|
|
93
89
|
"glob": "^13.0.0",
|
|
94
|
-
"ink": "^6.6.0",
|
|
95
|
-
"ink-spinner": "^5.0.0",
|
|
96
90
|
"inquirer": "^13.2.2",
|
|
97
|
-
"log-update": "^7.0.2",
|
|
98
91
|
"minimatch": "^10.1.1",
|
|
99
|
-
"multer": "^2.0.2",
|
|
100
92
|
"onnxruntime-node": "^1.23.2",
|
|
101
93
|
"ora": "^9.0.0",
|
|
102
94
|
"sqlite": "^5.1.1",
|
|
103
|
-
"sqlite-vec": "
|
|
95
|
+
"sqlite-vec": "0.1.3",
|
|
104
96
|
"uuid": "^13.0.0",
|
|
105
97
|
"winston": "^3.19.0",
|
|
106
98
|
"zod": "^4.3.5"
|
|
@@ -108,10 +100,8 @@
|
|
|
108
100
|
"devDependencies": {
|
|
109
101
|
"@types/asciichart": "^1.5.8",
|
|
110
102
|
"@types/better-sqlite3": "^7.6.13",
|
|
111
|
-
"@types/cors": "^2.8.19",
|
|
112
103
|
"@types/express": "^5.0.6",
|
|
113
104
|
"@types/node": "^25.0.9",
|
|
114
|
-
"@types/react": "^19.2.8",
|
|
115
105
|
"@types/supertest": "^6.0.3",
|
|
116
106
|
"@types/uuid": "^11.0.0",
|
|
117
107
|
"@types/winston": "^2.4.4",
|
package/plugin.json
CHANGED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
isTestCommand,
|
|
4
|
+
extractTestFailureContext,
|
|
5
|
+
buildTestFailureQuery,
|
|
6
|
+
buildErrorQuery,
|
|
7
|
+
} from '../post-tool-use-recall-utils.js';
|
|
8
|
+
|
|
9
|
+
describe('isTestCommand', () => {
|
|
10
|
+
it('detects "npm test"', () => {
|
|
11
|
+
expect(isTestCommand('npm test')).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('detects "npm run test"', () => {
|
|
15
|
+
expect(isTestCommand('npm run test')).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('detects "npx vitest"', () => {
|
|
19
|
+
expect(isTestCommand('npx vitest')).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('detects "vitest run"', () => {
|
|
23
|
+
expect(isTestCommand('vitest run')).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('detects "vitest" alone', () => {
|
|
27
|
+
expect(isTestCommand('vitest')).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('detects "npx jest"', () => {
|
|
31
|
+
expect(isTestCommand('npx jest')).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('detects "jest" alone', () => {
|
|
35
|
+
expect(isTestCommand('jest')).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('detects "pytest"', () => {
|
|
39
|
+
expect(isTestCommand('pytest')).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('detects "bun test"', () => {
|
|
43
|
+
expect(isTestCommand('bun test')).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('detects "mocha"', () => {
|
|
47
|
+
expect(isTestCommand('mocha')).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('rejects "ls -la"', () => {
|
|
51
|
+
expect(isTestCommand('ls -la')).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('rejects "git commit"', () => {
|
|
55
|
+
expect(isTestCommand('git commit -m "test"')).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('rejects "echo test"', () => {
|
|
59
|
+
expect(isTestCommand('echo test')).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('rejects empty string', () => {
|
|
63
|
+
expect(isTestCommand('')).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('rejects null/undefined', () => {
|
|
67
|
+
expect(isTestCommand(null)).toBe(false);
|
|
68
|
+
expect(isTestCommand(undefined)).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('is case-insensitive', () => {
|
|
72
|
+
expect(isTestCommand('NPM TEST')).toBe(true);
|
|
73
|
+
expect(isTestCommand('Vitest Run')).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe('extractTestFailureContext', () => {
|
|
78
|
+
it('returns null for null/undefined/empty input', () => {
|
|
79
|
+
expect(extractTestFailureContext(null)).toBeNull();
|
|
80
|
+
expect(extractTestFailureContext(undefined)).toBeNull();
|
|
81
|
+
expect(extractTestFailureContext('')).toBeNull();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('returns null for passing test output', () => {
|
|
85
|
+
const output = `
|
|
86
|
+
✓ src/utils/helper.test.ts (3 tests) 12ms
|
|
87
|
+
Test Files 1 passed (1)
|
|
88
|
+
Tests 3 passed (3)
|
|
89
|
+
`;
|
|
90
|
+
expect(extractTestFailureContext(output)).toBeNull();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('extracts from vitest FAIL output', () => {
|
|
94
|
+
const output = `
|
|
95
|
+
FAIL src/mcp/handlers/HookToolHandler.test.ts
|
|
96
|
+
✕ should process tool use (5ms)
|
|
97
|
+
Error: expect(received).toBe(expected)
|
|
98
|
+
`;
|
|
99
|
+
const ctx = extractTestFailureContext(output);
|
|
100
|
+
expect(ctx).not.toBeNull();
|
|
101
|
+
expect(ctx.testName).toBe('src/mcp/handlers/HookToolHandler.test.ts');
|
|
102
|
+
expect(ctx.errorMessage).toMatch(/Error/);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('extracts from jest-style FAIL output', () => {
|
|
106
|
+
const output = `
|
|
107
|
+
FAIL src/auth/login.test.js
|
|
108
|
+
● should validate credentials
|
|
109
|
+
expect(received).toBe(expected)
|
|
110
|
+
`;
|
|
111
|
+
const ctx = extractTestFailureContext(output);
|
|
112
|
+
expect(ctx).not.toBeNull();
|
|
113
|
+
expect(ctx.testName).toBe('src/auth/login.test.js');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('extracts error message from output with "failed"', () => {
|
|
117
|
+
const output = `
|
|
118
|
+
Tests: 2 failed, 5 passed
|
|
119
|
+
Error: Connection refused
|
|
120
|
+
`;
|
|
121
|
+
const ctx = extractTestFailureContext(output);
|
|
122
|
+
expect(ctx).not.toBeNull();
|
|
123
|
+
expect(ctx.errorMessage).toMatch(/Error.*Connection refused/);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('handles output with ✕ marker', () => {
|
|
127
|
+
const output = `
|
|
128
|
+
✕ my test case
|
|
129
|
+
`;
|
|
130
|
+
const ctx = extractTestFailureContext(output);
|
|
131
|
+
expect(ctx).not.toBeNull();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('buildTestFailureQuery', () => {
|
|
136
|
+
it('combines short test name + error message', () => {
|
|
137
|
+
const result = buildTestFailureQuery('src/utils/helper.test.ts', 'Connection refused');
|
|
138
|
+
expect(result).toBe('helper Connection refused');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('strips directory path and test/spec suffix', () => {
|
|
142
|
+
const result = buildTestFailureQuery('src/mcp/handlers/HookToolHandler.test.ts', 'error');
|
|
143
|
+
expect(result).toBe('HookToolHandler error');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('strips spec suffix', () => {
|
|
147
|
+
const result = buildTestFailureQuery('auth.spec.js', 'fail');
|
|
148
|
+
expect(result).toBe('auth fail');
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('handles unknown test name', () => {
|
|
152
|
+
const result = buildTestFailureQuery('unknown test', 'some error');
|
|
153
|
+
expect(result).toBe('unknown test some error');
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('handles empty error message', () => {
|
|
157
|
+
const result = buildTestFailureQuery('src/foo.test.ts', '');
|
|
158
|
+
expect(result).toBe('foo');
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe('buildErrorQuery', () => {
|
|
163
|
+
it('combines error type + first line of message', () => {
|
|
164
|
+
const result = buildErrorQuery('TypeError', 'Cannot read property x of undefined');
|
|
165
|
+
expect(result).toBe('TypeError Cannot read property x of undefined');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('uses only first line of multiline message', () => {
|
|
169
|
+
const result = buildErrorQuery('ReferenceError', 'x is not defined\n at foo.js:10\n at bar.js:20');
|
|
170
|
+
expect(result).toBe('ReferenceError x is not defined');
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('handles null/undefined error type', () => {
|
|
174
|
+
const result = buildErrorQuery(null, 'something broke');
|
|
175
|
+
expect(result).toBe('Error something broke');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('handles undefined error type', () => {
|
|
179
|
+
const result = buildErrorQuery(undefined, 'something broke');
|
|
180
|
+
expect(result).toBe('Error something broke');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('handles null/undefined error message', () => {
|
|
184
|
+
const result = buildErrorQuery('SyntaxError', null);
|
|
185
|
+
expect(result).toBe('SyntaxError');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('handles empty inputs', () => {
|
|
189
|
+
const result = buildErrorQuery('', '');
|
|
190
|
+
expect(result).toBe('Error');
|
|
191
|
+
});
|
|
192
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { buildSessionRecallQuery, formatRecallOutput } from '../session-start-recall-utils.js';
|
|
3
|
+
|
|
4
|
+
describe('buildSessionRecallQuery', () => {
|
|
5
|
+
it('combines project name and commits', () => {
|
|
6
|
+
const result = buildSessionRecallQuery('my-project', ['add login page', 'fix header bug']);
|
|
7
|
+
expect(result).toBe('my-project add login page fix header bug');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('handles empty commits array', () => {
|
|
11
|
+
const result = buildSessionRecallQuery('my-project', []);
|
|
12
|
+
expect(result).toBe('my-project');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('handles undefined commits', () => {
|
|
16
|
+
const result = buildSessionRecallQuery('my-project');
|
|
17
|
+
expect(result).toBe('my-project');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('strips conventional commit prefixes', () => {
|
|
21
|
+
const commits = [
|
|
22
|
+
'fix: resolve null pointer',
|
|
23
|
+
'feat(auth): add OAuth support',
|
|
24
|
+
'chore(deps): update dependencies',
|
|
25
|
+
'refactor: simplify logic',
|
|
26
|
+
];
|
|
27
|
+
const result = buildSessionRecallQuery('app', commits);
|
|
28
|
+
expect(result).toBe('app resolve null pointer add OAuth support update dependencies simplify logic');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('filters out empty strings after stripping prefixes', () => {
|
|
32
|
+
const commits = ['fix:', 'feat(scope): '];
|
|
33
|
+
const result = buildSessionRecallQuery('app', commits);
|
|
34
|
+
expect(result).toBe('app');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('formatRecallOutput', () => {
|
|
39
|
+
it('formats results with similarity percentage', () => {
|
|
40
|
+
const results = [
|
|
41
|
+
{ name: 'Entity1', observations: ['obs1', 'obs2'], similarity: 0.85 },
|
|
42
|
+
];
|
|
43
|
+
const output = formatRecallOutput(results);
|
|
44
|
+
expect(output).toBe(' - Entity1 (85%): obs1; obs2');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('returns empty string for empty results', () => {
|
|
48
|
+
expect(formatRecallOutput([])).toBe('');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('returns empty string for null results', () => {
|
|
52
|
+
expect(formatRecallOutput(null)).toBe('');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('returns empty string for undefined results', () => {
|
|
56
|
+
expect(formatRecallOutput(undefined)).toBe('');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('limits observations to 2', () => {
|
|
60
|
+
const results = [
|
|
61
|
+
{ name: 'Entity1', observations: ['obs1', 'obs2', 'obs3', 'obs4'], similarity: 0.7 },
|
|
62
|
+
];
|
|
63
|
+
const output = formatRecallOutput(results);
|
|
64
|
+
expect(output).toBe(' - Entity1 (70%): obs1; obs2');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('formats multiple results on separate lines', () => {
|
|
68
|
+
const results = [
|
|
69
|
+
{ name: 'A', observations: ['a1'], similarity: 0.9 },
|
|
70
|
+
{ name: 'B', observations: ['b1', 'b2'], similarity: 0.6 },
|
|
71
|
+
];
|
|
72
|
+
const output = formatRecallOutput(results);
|
|
73
|
+
const lines = output.split('\n');
|
|
74
|
+
expect(lines).toHaveLength(2);
|
|
75
|
+
expect(lines[0]).toBe(' - A (90%): a1');
|
|
76
|
+
expect(lines[1]).toBe(' - B (60%): b1; b2');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('rounds similarity percentage', () => {
|
|
80
|
+
const results = [
|
|
81
|
+
{ name: 'X', observations: ['x1'], similarity: 0.456 },
|
|
82
|
+
];
|
|
83
|
+
const output = formatRecallOutput(results);
|
|
84
|
+
expect(output).toBe(' - X (46%): x1');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-Tool-Use Recall Utilities
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for detecting test failures and errors in tool output,
|
|
5
|
+
* used by the proactive recall system in post-tool-use.js.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const TEST_PATTERNS = [
|
|
9
|
+
/vitest\s*(run|watch)?/i,
|
|
10
|
+
/jest\b/i,
|
|
11
|
+
/npm\s+test/i,
|
|
12
|
+
/npm\s+run\s+test/i,
|
|
13
|
+
/npx\s+vitest/i,
|
|
14
|
+
/npx\s+jest/i,
|
|
15
|
+
/pytest\b/i,
|
|
16
|
+
/bun\s+test/i,
|
|
17
|
+
/mocha\b/i,
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Check if a command string is a test runner invocation.
|
|
22
|
+
* @param {string} command - Shell command to check
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export function isTestCommand(command) {
|
|
26
|
+
if (!command) return false;
|
|
27
|
+
return TEST_PATTERNS.some(p => p.test(command));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Extract test failure context (test name + error message) from test output.
|
|
32
|
+
* Returns null if no failure is detected.
|
|
33
|
+
* @param {string} output - Test runner stdout/stderr
|
|
34
|
+
* @returns {{ testName: string, errorMessage: string } | null}
|
|
35
|
+
*/
|
|
36
|
+
export function extractTestFailureContext(output) {
|
|
37
|
+
if (!output) return null;
|
|
38
|
+
const hasFailure = /FAIL|failed|failing|\u2715|\u2717|error/i.test(output);
|
|
39
|
+
if (!hasFailure) return null;
|
|
40
|
+
|
|
41
|
+
const fileMatch = output.match(/FAIL\s+(\S+\.(?:test|spec)\.\S+)/i)
|
|
42
|
+
|| output.match(/(\S+\.(?:test|spec)\.\S+)/i);
|
|
43
|
+
const testName = fileMatch ? fileMatch[1] : 'unknown test';
|
|
44
|
+
|
|
45
|
+
const errorMatch = output.match(/(?:Error|AssertionError|AssertError|expect).*$/m)
|
|
46
|
+
|| output.match(/(?:\u2715|\u2717)\s*(.+)$/m);
|
|
47
|
+
const errorMessage = errorMatch ? errorMatch[0].trim() : 'test failed';
|
|
48
|
+
|
|
49
|
+
return { testName, errorMessage };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Build a search query from a test failure context.
|
|
54
|
+
* Strips path and test/spec suffix from the test file name.
|
|
55
|
+
* @param {string} testName - Test file name or path
|
|
56
|
+
* @param {string} errorMessage - Error message
|
|
57
|
+
* @returns {string}
|
|
58
|
+
*/
|
|
59
|
+
export function buildTestFailureQuery(testName, errorMessage) {
|
|
60
|
+
const shortName = testName.replace(/^.*[/\\]/, '').replace(/\.(test|spec)\.\w+$/, '');
|
|
61
|
+
return `${shortName} ${errorMessage}`.trim();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Build a search query from an error type and message.
|
|
66
|
+
* Uses only the first line of the error message.
|
|
67
|
+
* @param {string} errorType - Error class name (e.g. "TypeError")
|
|
68
|
+
* @param {string} errorMessage - Error message (may be multiline)
|
|
69
|
+
* @returns {string}
|
|
70
|
+
*/
|
|
71
|
+
export function buildErrorQuery(errorType, errorMessage) {
|
|
72
|
+
const firstLine = (errorMessage || '').split('\n')[0].trim();
|
|
73
|
+
return `${errorType || 'Error'} ${firstLine}`.trim();
|
|
74
|
+
}
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
updateEntityMetadata,
|
|
35
35
|
addObservation,
|
|
36
36
|
} from './hook-utils.js';
|
|
37
|
+
import { isTestCommand, extractTestFailureContext, buildTestFailureQuery, buildErrorQuery } from './post-tool-use-recall-utils.js';
|
|
37
38
|
import fs from 'fs';
|
|
38
39
|
import path from 'path';
|
|
39
40
|
|
|
@@ -545,7 +546,11 @@ function trackFileModifications(toolData, currentSession) {
|
|
|
545
546
|
currentSession.modifiedFiles = [];
|
|
546
547
|
}
|
|
547
548
|
|
|
549
|
+
const MAX_MODIFIED_FILES = 100;
|
|
548
550
|
if (!currentSession.modifiedFiles.includes(filePath)) {
|
|
551
|
+
if (currentSession.modifiedFiles.length >= MAX_MODIFIED_FILES) {
|
|
552
|
+
currentSession.modifiedFiles.shift(); // Remove oldest entry
|
|
553
|
+
}
|
|
549
554
|
currentSession.modifiedFiles.push(filePath);
|
|
550
555
|
}
|
|
551
556
|
}
|
|
@@ -729,6 +734,81 @@ function detectPlanFile(toolData) {
|
|
|
729
734
|
}
|
|
730
735
|
}
|
|
731
736
|
|
|
737
|
+
// ============================================================================
|
|
738
|
+
// Proactive Recall on Test Failure / Error Detection
|
|
739
|
+
// ============================================================================
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Trigger proactive recall on test failure or error detection.
|
|
743
|
+
* Writes results to proactive-recall.json for HookToolHandler.
|
|
744
|
+
* @param {Object} toolData - Normalized tool data
|
|
745
|
+
*/
|
|
746
|
+
function triggerProactiveRecall(toolData) {
|
|
747
|
+
try {
|
|
748
|
+
const recallFile = path.join(STATE_DIR, 'proactive-recall.json');
|
|
749
|
+
let query = null;
|
|
750
|
+
let trigger = null;
|
|
751
|
+
|
|
752
|
+
// Test failure detection
|
|
753
|
+
if (toolData.toolName === 'Bash' && toolData.arguments?.command) {
|
|
754
|
+
if (isTestCommand(toolData.arguments.command) && !toolData.success) {
|
|
755
|
+
const ctx = extractTestFailureContext(toolData._raw?.output || '');
|
|
756
|
+
if (ctx) {
|
|
757
|
+
query = buildTestFailureQuery(ctx.testName, ctx.errorMessage);
|
|
758
|
+
trigger = 'test-failure';
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// Error detection (non-test failures)
|
|
764
|
+
if (!trigger && !toolData.success && toolData._raw?.output) {
|
|
765
|
+
const errorMatch = toolData._raw.output.match(/(\w*Error):\s*(.+)/);
|
|
766
|
+
if (errorMatch) {
|
|
767
|
+
query = buildErrorQuery(errorMatch[1], errorMatch[2]);
|
|
768
|
+
trigger = 'error-detection';
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
if (!query || !trigger) return;
|
|
773
|
+
|
|
774
|
+
// Build FTS5 query
|
|
775
|
+
const ftsTokens = query.split(/\s+/)
|
|
776
|
+
.filter(t => t.length > 2)
|
|
777
|
+
.slice(0, 8)
|
|
778
|
+
.map(t => `"${t.replace(/"/g, '""')}"*`)
|
|
779
|
+
.join(' OR ');
|
|
780
|
+
|
|
781
|
+
if (!ftsTokens) return;
|
|
782
|
+
|
|
783
|
+
const sql = `
|
|
784
|
+
SELECT e.name,
|
|
785
|
+
(SELECT json_group_array(content) FROM observations o WHERE o.entity_id = e.id) as observations_json
|
|
786
|
+
FROM entities e
|
|
787
|
+
JOIN entities_fts ON entities_fts.rowid = e.id
|
|
788
|
+
WHERE entities_fts MATCH ?
|
|
789
|
+
ORDER BY bm25(entities_fts, 10.0, 5.0)
|
|
790
|
+
LIMIT 3
|
|
791
|
+
`;
|
|
792
|
+
|
|
793
|
+
const result = sqliteQueryJSON(MEMESH_DB_PATH, sql, [ftsTokens]);
|
|
794
|
+
if (!result || result.length === 0) return;
|
|
795
|
+
|
|
796
|
+
const recallData = {
|
|
797
|
+
trigger,
|
|
798
|
+
query,
|
|
799
|
+
timestamp: Date.now(),
|
|
800
|
+
results: result.map(r => ({
|
|
801
|
+
name: r.name,
|
|
802
|
+
observations: JSON.parse(r.observations_json || '[]').filter(Boolean).slice(0, 2),
|
|
803
|
+
})),
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
writeJSONFile(recallFile, recallData);
|
|
807
|
+
} catch (error) {
|
|
808
|
+
logError('proactive-recall-trigger', error);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
732
812
|
// ============================================================================
|
|
733
813
|
// Main PostToolUse Logic
|
|
734
814
|
// ============================================================================
|
|
@@ -778,6 +858,9 @@ async function postToolUse() {
|
|
|
778
858
|
// Detect anomalies
|
|
779
859
|
const anomalies = detectAnomalies(toolData, sessionContext);
|
|
780
860
|
|
|
861
|
+
// Trigger proactive recall on test failure or error
|
|
862
|
+
triggerProactiveRecall(toolData);
|
|
863
|
+
|
|
781
864
|
// Fire async writes in parallel
|
|
782
865
|
const pendingWrites = [contextWritePromise];
|
|
783
866
|
|