Conversation
Remove sensitive internal details from public changelog entries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Hook scripts missing +x caused "hook error" on every tool call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents regression where hook scripts lose +x permission. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removed: auto-release, e2e, installation-test, plugin-deployment-check. Kept: ci.yml (build+test), codeql.yml (security), publish-npm.yml (npm). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reduce from 26 production dependencies to 3 (better-sqlite3, @modelcontextprotocol/sdk, zod). Remove daemon mode, 4 hooks, CLI features, and skills from config files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Direct better-sqlite3 with WAL mode, foreign keys, 4 tables (entities, observations, relations, tags), FTS5 virtual table, and 5 indexes. 10 BDD tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
KnowledgeGraph class with dependency injection, contentless FTS5 sync, upsert semantics, tag filtering, cascade delete. 18 BDD tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tools with zod validation, FTS5 search, tag filtering. MCP server via StdioServerTransport. 15 BDD tests passing, no regressions on existing 28 tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two standalone ESM hooks replacing 7 old files. session-start auto-recalls project memories with observations. post-commit detects git commits and stores as entities. 13 BDD tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Delete all old source modules (embeddings, memory, core, cli, handlers, daemon), 30 scripts, 14 test directories, and 3 config files. Keep only v3 core: 5 src files, 6 test files, 2 hooks. 63 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrite README, CLAUDE.md, ARCHITECTURE.md, API_REFERENCE.md for v3 minimal architecture. Remove obsolete docs. Fix critical schema drift: add missing relations table to post-commit.js SCHEMA_SQL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generates self-contained HTML dashboard with D3.js force-directed knowledge graph, entity table with search, and statistics summary. Also fixes vitest pool from threads to forks to prevent SIGSEGV with better-sqlite3 native module. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v3.0.0-alpha.1: Minimal core rewrite - 3 MCP tools (remember/recall/forget), 2 hooks, 3 deps - memesh-view CLI dashboard (D3.js knowledge graph) - 95,001 lines removed, 73 tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
||
| const html = generateDashboardHtml(dbPath); | ||
| const outPath = path.join(os.tmpdir(), 'memesh-dashboard.html'); | ||
| fs.writeFileSync(outPath, html, 'utf-8'); |
Check failure
Code scanning / CodeQL
Insecure temporary file High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 14 days ago
In general, the fix is to stop manually constructing a filename in the OS temp directory and instead use a temp‑file helper that (a) creates the file atomically with exclusive access, (b) uses a unique, hard‑to‑predict name, and (c) sets secure permissions. For Node, the recommended approach is to use the well‑tested tmp package and call tmp.fileSync() (or tmp.file() for async) to obtain a securely created temp file path.
For this code, the best minimal‑impact fix is:
- Import the
tmplibrary at the top ofsrc/cli/view.ts. We’ll keep existing imports intact and addimport tmp from 'tmp';. - Replace the manual
outPath = path.join(os.tmpdir(), 'memesh-dashboard.html');with a call totmp.fileSync(). We should:- Request a descriptive prefix or postfix/extension (e.g.
.html) so the OS and browser treat it as HTML. - Use the returned
.namefield as theoutPath.
- Request a descriptive prefix or postfix/extension (e.g.
- Keep writing the HTML using
fs.writeFileSyncto that path and keep the browser‑opening logic unchanged.
Concretely, in src/cli/view.ts:
-
Near the existing imports (around line 3–8), add
import tmp from 'tmp';. -
Around line 550–551, replace:
const outPath = path.join(os.tmpdir(), 'memesh-dashboard.html');fs.writeFileSync(outPath, html, 'utf-8');
with something like:
const tmpFile = tmp.fileSync({ postfix: '.html' }); const outPath = tmpFile.name; fs.writeFileSync(outPath, html, 'utf-8');
This preserves functionality (a temp HTML file is created and opened) while ensuring a unique, securely created temp file.
| @@ -6,6 +6,7 @@ | ||
| import os from 'os'; | ||
| import { execFile } from 'child_process'; | ||
| import { fileURLToPath } from 'url'; | ||
| import tmp from 'tmp'; | ||
|
|
||
| interface DashboardData { | ||
| entities: Array<{ | ||
| @@ -547,7 +548,8 @@ | ||
| path.join(os.homedir(), '.memesh', 'knowledge-graph.db'); | ||
|
|
||
| const html = generateDashboardHtml(dbPath); | ||
| const outPath = path.join(os.tmpdir(), 'memesh-dashboard.html'); | ||
| const tmpFile = tmp.fileSync({ postfix: '.html' }); | ||
| const outPath = tmpFile.name; | ||
| fs.writeFileSync(outPath, html, 'utf-8'); | ||
|
|
||
| // Open in default browser |
| @@ -33,7 +33,8 @@ | ||
| "dependencies": { | ||
| "better-sqlite3": "^12.6.2", | ||
| "@modelcontextprotocol/sdk": "^1.25.3", | ||
| "zod": "^4.3.5" | ||
| "zod": "^4.3.5", | ||
| "tmp": "^0.2.5" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/better-sqlite3": "^7.6.13", |
| Package | Version | Security advisories |
| tmp (npm) | 0.2.5 | None |
Matches the existing v2 database filename for backward compatibility. All source files and documentation updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show only top 40 most-connected entities in graph (not all 777), increase force repulsion, truncate long labels. Add screenshot to README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrite README to reflect current architecture including cli/view.ts, accurate tool descriptions, hook event types, and CLI dashboard section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add try-catch in handleTool to prevent MCP server crash on DB errors
- Fix escapeJsonForHtml: replace & before < > (standard ordering)
- Fix FTS5 duplicate entries: use INSERT OR IGNORE changes to detect new entities
- Fix post-commit hook FTS5 delete: use actual observations text, not empty string
- Add graceful shutdown (SIGINT/SIGTERM) with DB cleanup in server.ts
- Add try-finally in hooks to guarantee db.close() on error paths
- Add stderr logging in post-commit hook (silent but traceable)
- Fix session-start hook: report errors honestly instead of fake success
- Add FTS5 search error handling (catch syntax errors, return empty)
- Add error logging in view.ts when DB open fails
- Fix ARCHITECTURE.md: 7 test files / 73 tests (was 6/63)
- Fix API_REFERENCE.md: .mcp.json uses ${CLAUDE_PLUGIN_ROOT}
- Clean vitest.config.ts: remove outdated comments and dead exclusion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
remember,recall,forget— 移除其他 5 個 toolsmemesh-viewCLI: 新增 D3.js HTML dashboard (knowledge graph + entity table + stats)Breaking Changes
Test plan
npm run typecheck— cleannpm run build— successfulnpx vitest run— 73/73 tests passingmemesh-viewsmoke test — opens HTML dashboard in browser🤖 Generated with Claude Code