Skip to content

Persistent project knowledge graph for coding agents. MCP server with semantic search, in-process embeddings, and web explorer.

Prepare for open-source publish: LICENSE, tests, changelog, and metadata

0xk3vin44a6b75ff023
diff --git a/.gitignore b/.gitignore
index e671307..a18603a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,6 @@ dist/
.megamemory/
.osgrep/
*.db
-.osgrep
+*.tgz
+*.log
+.env*
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..2b2b070
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,15 @@
+# Changelog
+
+## 1.0.0 — Initial Release
+
+### Features
+
+- **MCP server** with 6 tools: `understand`, `create_concept`, `update_concept`, `link`, `remove_concept`, `list_roots`
+- **Semantic search** via in-process embeddings (all-MiniLM-L6-v2, 384 dimensions) — no external API calls
+- **SQLite persistence** with soft-delete, schema migrations, and WAL mode
+- **Web explorer** — browser-based graph visualization with Cytoscape.js at `megamemory serve`
+- **CLI** with colored output, graceful error handling, and interactive port conflict resolution
+- **`megamemory init`** — one-command setup for opencode (MCP config, AGENTS.md, skill plugin, bootstrap command)
+- **Concept kinds**: feature, module, pattern, config, decision, component
+- **Relationship types**: connects_to, depends_on, implements, calls, configured_by
+- **Knowledge graph** designed for LLM agents — concepts in natural language, not code symbols
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..64d68c2
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 Kevin (0xk3vin)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index 02da0b3..3da8451 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,9 @@
# megamemory
+[![npm version](https://img.shields.io/npm/v/megamemory)](https://www.npmjs.com/package/megamemory)
+[![license](https://img.shields.io/npm/l/megamemory)](./LICENSE)
+[![node](https://img.shields.io/node/v/megamemory)](https://nodejs.org)
+
Persistent project knowledge graph for coding agents. An MCP server that lets your agent build and query a graph of concepts, architecture, and decisions — so it remembers across sessions.
## How it works
diff --git a/package-lock.json b/package-lock.json
index dd27242..773fc34 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -22,7 +22,8 @@
"@types/better-sqlite3": "^7.6.12",
"@types/node": "^20.17.14",
"tsx": "^4.19.2",
- "typescript": "^5.7.3"
+ "typescript": "^5.7.3",
+ "vitest": "^4.0.18"
},
"engines": {
"node": ">=18"
@@ -491,6 +492,13 @@
"node": ">=18"
}
},
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@modelcontextprotocol/sdk": {
"version": "1.26.0",
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.26.0.tgz",
@@ -595,29 +603,522 @@
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
"license": "BSD-3-Clause"
},
- "node_modules/@types/better-sqlite3": {
- "version": "7.6.13",
- "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.13.tgz",
- "integrity": "sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==",
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.1.tgz",
+ "integrity": "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.1.tgz",
+ "integrity": "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.1.tgz",
+ "integrity": "sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.1.tgz",
+ "integrity": "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.1.tgz",
+ "integrity": "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.1.tgz",
+ "integrity": "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.1.tgz",
+ "integrity": "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.1.tgz",
+ "integrity": "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.1.tgz",
+ "integrity": "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.1.tgz",
+ "integrity": "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.1.tgz",
+ "integrity": "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.1.tgz",
+ "integrity": "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.1.tgz",
+ "integrity": "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.1.tgz",
+ "integrity": "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.1.tgz",
+ "integrity": "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.1.tgz",
+ "integrity": "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.1.tgz",
+ "integrity": "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz",
+ "integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz",
+ "integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-openbsd-x64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.1.tgz",
+ "integrity": "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-openharmony-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.1.tgz",
+ "integrity": "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.1.tgz",
+ "integrity": "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.1.tgz",
+ "integrity": "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz",
+ "integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz",
+ "integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/better-sqlite3": {
+ "version": "7.6.13",
+ "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.13.tgz",
+ "integrity": "sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/chai": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/deep-eql": "*",
+ "assertion-error": "^2.0.1"
+ }
+ },
+ "node_modules/@types/deep-eql": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/long": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",
+ "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==",
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "20.19.32",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.32.tgz",
+ "integrity": "sha512-Ez8QE4DMfhjjTsES9K2dwfV258qBui7qxUsoaixZDiTzbde4U12e1pXGNu/ECsUIOi5/zoCxAQxIhQnaUQ2VvA==",
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~6.21.0"
+ }
+ },
+ "node_modules/@vitest/expect": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.18.tgz",
+ "integrity": "sha512-8sCWUyckXXYvx4opfzVY03EOiYVxyNrHS5QxX3DAIi5dpJAAkyJezHCP77VMX4HKA2LDT/Jpfo8i2r5BE3GnQQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.0.0",
+ "@types/chai": "^5.2.2",
+ "@vitest/spy": "4.0.18",
+ "@vitest/utils": "4.0.18",
+ "chai": "^6.2.1",
+ "tinyrainbow": "^3.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/mocker": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.18.tgz",
+ "integrity": "sha512-HhVd0MDnzzsgevnOWCBj5Otnzobjy5wLBe4EdeeFGv8luMsGcYqDuFRMcttKWZA5vVO8RFjexVovXvAM4JoJDQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/spy": "4.0.18",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^0.30.21"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9",
+ "vite": "^6.0.0 || ^7.0.0-0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@vitest/pretty-format": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.18.tgz",
+ "integrity": "sha512-P24GK3GulZWC5tz87ux0m8OADrQIUVDPIjjj65vBXYG17ZeU3qD7r+MNZ1RNv4l8CGU2vtTRqixrOi9fYk/yKw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tinyrainbow": "^3.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/runner": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.18.tgz",
+ "integrity": "sha512-rpk9y12PGa22Jg6g5M3UVVnTS7+zycIGk9ZNGN+m6tZHKQb7jrP7/77WfZy13Y/EUDd52NDsLRQhYKtv7XfPQw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/utils": "4.0.18",
+ "pathe": "^2.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/snapshot": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.18.tgz",
+ "integrity": "sha512-PCiV0rcl7jKQjbgYqjtakly6T1uwv/5BQ9SwBLekVg/EaYeQFPiXcgrC2Y7vDMA8dM1SUEAEV82kgSQIlXNMvA==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@types/node": "*"
+ "@vitest/pretty-format": "4.0.18",
+ "magic-string": "^0.30.21",
+ "pathe": "^2.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
}
},
- "node_modules/@types/long": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",
- "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==",
- "license": "MIT"
+ "node_modules/@vitest/spy": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.18.tgz",
+ "integrity": "sha512-cbQt3PTSD7P2OARdVW3qWER5EGq7PHlvE+QfzSC0lbwO+xnt7+XH06ZzFjFRgzUX//JmpxrCu92VdwvEPlWSNw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
},
- "node_modules/@types/node": {
- "version": "20.19.32",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.32.tgz",
- "integrity": "sha512-Ez8QE4DMfhjjTsES9K2dwfV258qBui7qxUsoaixZDiTzbde4U12e1pXGNu/ECsUIOi5/zoCxAQxIhQnaUQ2VvA==",
+ "node_modules/@vitest/utils": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.18.tgz",
+ "integrity": "sha512-msMRKLMVLWygpK3u2Hybgi4MNjcYJvwTb0Ru09+fOyCXIgT5raYP041DRRdiJiI3k/2U6SEbAETB3YtBrUkCFA==",
+ "dev": true,
"license": "MIT",
"dependencies": {
- "undici-types": "~6.21.0"
+ "@vitest/pretty-format": "4.0.18",
+ "tinyrainbow": "^3.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
}
},
"node_modules/@xenova/transformers": {
@@ -680,6 +1181,16 @@
}
}
},
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/b4a": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz",
@@ -922,6 +1433,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/chai": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
+ "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/chownr": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
@@ -1155,6 +1676,13 @@
"node": ">= 0.4"
}
},
+ "node_modules/es-module-lexer": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
+ "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
@@ -1215,6 +1743,16 @@
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
+ "node_modules/estree-walker": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0"
+ }
+ },
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
@@ -1263,6 +1801,16 @@
"node": ">=6"
}
},
+ "node_modules/expect-type": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz",
+ "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
"node_modules/express": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
@@ -1352,6 +1900,24 @@
],
"license": "BSD-3-Clause"
},
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@@ -1671,6 +2237,16 @@
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
"license": "Apache-2.0"
},
+ "node_modules/magic-string": {
+ "version": "0.30.21",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.5"
+ }
+ },
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@@ -1759,6 +2335,25 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
+ "node_modules/nanoid": {
+ "version": "3.3.11",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
"node_modules/napi-build-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
@@ -1813,6 +2408,17 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/obug": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz",
+ "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/sxzz",
+ "https://opencollective.com/debug"
+ ],
+ "license": "MIT"
+ },
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
@@ -1906,12 +2512,32 @@
"url": "https://opencollective.com/express"
}
},
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
+ "node_modules/picomatch": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
+ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
"node_modules/pkce-challenge": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz",
@@ -1927,6 +2553,35 @@
"integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==",
"license": "MIT"
},
+ "node_modules/postcss": {
+ "version": "8.5.6",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
+ "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.11",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
"node_modules/prebuild-install": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
@@ -2089,6 +2744,51 @@
"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
}
},
+ "node_modules/rollup": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz",
+ "integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "1.0.8"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.57.1",
+ "@rollup/rollup-android-arm64": "4.57.1",
+ "@rollup/rollup-darwin-arm64": "4.57.1",
+ "@rollup/rollup-darwin-x64": "4.57.1",
+ "@rollup/rollup-freebsd-arm64": "4.57.1",
+ "@rollup/rollup-freebsd-x64": "4.57.1",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.57.1",
+ "@rollup/rollup-linux-arm-musleabihf": "4.57.1",
+ "@rollup/rollup-linux-arm64-gnu": "4.57.1",
+ "@rollup/rollup-linux-arm64-musl": "4.57.1",
+ "@rollup/rollup-linux-loong64-gnu": "4.57.1",
+ "@rollup/rollup-linux-loong64-musl": "4.57.1",
+ "@rollup/rollup-linux-ppc64-gnu": "4.57.1",
+ "@rollup/rollup-linux-ppc64-musl": "4.57.1",
+ "@rollup/rollup-linux-riscv64-gnu": "4.57.1",
+ "@rollup/rollup-linux-riscv64-musl": "4.57.1",
+ "@rollup/rollup-linux-s390x-gnu": "4.57.1",
+ "@rollup/rollup-linux-x64-gnu": "4.57.1",
+ "@rollup/rollup-linux-x64-musl": "4.57.1",
+ "@rollup/rollup-openbsd-x64": "4.57.1",
+ "@rollup/rollup-openharmony-arm64": "4.57.1",
+ "@rollup/rollup-win32-arm64-msvc": "4.57.1",
+ "@rollup/rollup-win32-ia32-msvc": "4.57.1",
+ "@rollup/rollup-win32-x64-gnu": "4.57.1",
+ "@rollup/rollup-win32-x64-msvc": "4.57.1",
+ "fsevents": "~2.3.2"
+ }
+ },
"node_modules/router": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
@@ -2335,6 +3035,13 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/siginfo": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/simple-concat": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
@@ -2389,6 +3096,23 @@
"is-arrayish": "^0.3.1"
}
},
+ "node_modules/source-map-js": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/stackback": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
@@ -2398,6 +3122,13 @@
"node": ">= 0.8"
}
},
+ "node_modules/std-env": {
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz",
+ "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/streamx": {
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz",
@@ -2464,6 +3195,50 @@
"b4a": "^1.6.4"
}
},
+ "node_modules/tinybench": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyexec": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz",
+ "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.15",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
+ "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/tinyrainbow": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.0.3.tgz",
+ "integrity": "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@@ -2563,6 +3338,159 @@
"node": ">= 0.8"
}
},
+ "node_modules/vite": {
+ "version": "7.3.1",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz",
+ "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "^0.27.0",
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.3",
+ "postcss": "^8.5.6",
+ "rollup": "^4.43.0",
+ "tinyglobby": "^0.2.15"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^20.19.0 || >=22.12.0",
+ "jiti": ">=1.21.0",
+ "less": "^4.0.0",
+ "lightningcss": "^1.21.0",
+ "sass": "^1.70.0",
+ "sass-embedded": "^1.70.0",
+ "stylus": ">=0.54.8",
+ "sugarss": "^5.0.0",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "lightningcss": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vitest": {
+ "version": "4.0.18",
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.18.tgz",
+ "integrity": "sha512-hOQuK7h0FGKgBAas7v0mSAsnvrIgAvWmRFjmzpJ7SwFHH3g1k2u37JtYwOwmEKhK6ZO3v9ggDBBm0La1LCK4uQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/expect": "4.0.18",
+ "@vitest/mocker": "4.0.18",
+ "@vitest/pretty-format": "4.0.18",
+ "@vitest/runner": "4.0.18",
+ "@vitest/snapshot": "4.0.18",
+ "@vitest/spy": "4.0.18",
+ "@vitest/utils": "4.0.18",
+ "es-module-lexer": "^1.7.0",
+ "expect-type": "^1.2.2",
+ "magic-string": "^0.30.21",
+ "obug": "^2.1.1",
+ "pathe": "^2.0.3",
+ "picomatch": "^4.0.3",
+ "std-env": "^3.10.0",
+ "tinybench": "^2.9.0",
+ "tinyexec": "^1.0.2",
+ "tinyglobby": "^0.2.15",
+ "tinyrainbow": "^3.0.3",
+ "vite": "^6.0.0 || ^7.0.0",
+ "why-is-node-running": "^2.3.0"
+ },
+ "bin": {
+ "vitest": "vitest.mjs"
+ },
+ "engines": {
+ "node": "^20.0.0 || ^22.0.0 || >=24.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@edge-runtime/vm": "*",
+ "@opentelemetry/api": "^1.9.0",
+ "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
+ "@vitest/browser-playwright": "4.0.18",
+ "@vitest/browser-preview": "4.0.18",
+ "@vitest/browser-webdriverio": "4.0.18",
+ "@vitest/ui": "4.0.18",
+ "happy-dom": "*",
+ "jsdom": "*"
+ },
+ "peerDependenciesMeta": {
+ "@edge-runtime/vm": {
+ "optional": true
+ },
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@types/node": {
+ "optional": true
+ },
+ "@vitest/browser-playwright": {
+ "optional": true
+ },
+ "@vitest/browser-preview": {
+ "optional": true
+ },
+ "@vitest/browser-webdriverio": {
+ "optional": true
+ },
+ "@vitest/ui": {
+ "optional": true
+ },
+ "happy-dom": {
+ "optional": true
+ },
+ "jsdom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -2578,6 +3506,23 @@
"node": ">= 8"
}
},
+ "node_modules/why-is-node-running": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "siginfo": "^2.0.0",
+ "stackback": "0.0.2"
+ },
+ "bin": {
+ "why-is-node-running": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
diff --git a/package.json b/package.json
index 079e189..68035bc 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"build": "tsc",
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
+ "test": "vitest run",
"prepublishOnly": "npm run build"
},
"keywords": [
@@ -24,14 +25,22 @@
"knowledge-graph",
"coding-agent",
"persistent-memory",
- "opencode"
+ "opencode",
+ "llm",
+ "sqlite",
+ "embeddings",
+ "ai"
],
- "author": "Kevin",
+ "author": "Kevin <https://github.com/0xk3vin>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/anomalyco/megamemory.git"
},
+ "homepage": "https://github.com/anomalyco/megamemory#readme",
+ "bugs": {
+ "url": "https://github.com/anomalyco/megamemory/issues"
+ },
"engines": {
"node": ">=18"
},
@@ -46,6 +55,7 @@
"@types/better-sqlite3": "^7.6.12",
"@types/node": "^20.17.14",
"tsx": "^4.19.2",
- "typescript": "^5.7.3"
+ "typescript": "^5.7.3",
+ "vitest": "^4.0.18"
}
}
diff --git a/src/__tests__/db.test.ts b/src/__tests__/db.test.ts
new file mode 100644
index 0000000..fa27ff3
--- /dev/null
+++ b/src/__tests__/db.test.ts
@@ -0,0 +1,353 @@
+import { describe, it, expect, beforeEach, afterEach } from "vitest";
+import { KnowledgeDB } from "../db.js";
+import fs from "fs";
+import path from "path";
+import os from "os";
+
+let db: KnowledgeDB;
+let dbPath: string;
+let tmpDir: string;
+
+beforeEach(() => {
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "megamemory-test-"));
+ dbPath = path.join(tmpDir, "knowledge.db");
+ db = new KnowledgeDB(dbPath);
+});
+
+afterEach(() => {
+ db.close();
+ fs.rmSync(tmpDir, { recursive: true, force: true });
+});
+
+describe("KnowledgeDB", () => {
+ describe("schema", () => {
+ it("creates the database file on construction", () => {
+ expect(fs.existsSync(dbPath)).toBe(true);
+ });
+
+ it("runs migrations cleanly on a fresh database", () => {
+ const stats = db.getStats();
+ expect(stats.nodes).toBe(0);
+ expect(stats.edges).toBe(0);
+ });
+ });
+
+ describe("nodes", () => {
+ it("inserts and retrieves a node", () => {
+ db.insertNode({
+ id: "test-node",
+ name: "Test Node",
+ kind: "feature",
+ summary: "A test node",
+ why: "For testing",
+ file_refs: ["src/test.ts"],
+ parent_id: null,
+ created_by_task: "test",
+ embedding: null,
+ });
+
+ const node = db.getNode("test-node");
+ expect(node).not.toBeNull();
+ expect(node!.name).toBe("Test Node");
+ expect(node!.kind).toBe("feature");
+ expect(node!.summary).toBe("A test node");
+ expect(node!.why).toBe("For testing");
+ });
+
+ it("returns undefined for non-existent node", () => {
+ expect(db.getNode("nonexistent")).toBeUndefined();
+ });
+
+ it("updates node fields", () => {
+ db.insertNode({
+ id: "update-me",
+ name: "Original",
+ kind: "feature",
+ summary: "Original summary",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+
+ db.updateNode("update-me", {
+ name: "Updated",
+ summary: "Updated summary",
+ });
+
+ const node = db.getNode("update-me");
+ expect(node!.name).toBe("Updated");
+ expect(node!.summary).toBe("Updated summary");
+ });
+
+ it("soft-deletes a node", () => {
+ db.insertNode({
+ id: "delete-me",
+ name: "To Delete",
+ kind: "module",
+ summary: "Will be deleted",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+
+ db.softDeleteNode("delete-me", "No longer needed");
+
+ // Should not appear in active queries
+ expect(db.getNode("delete-me")).toBeUndefined();
+
+ // Should appear in including-removed query
+ const removed = db.getNodeIncludingRemoved("delete-me");
+ expect(removed).not.toBeNull();
+ expect(removed!.removed_reason).toBe("No longer needed");
+ });
+
+ it("nodeExists returns true for existing, false for missing", () => {
+ db.insertNode({
+ id: "exists",
+ name: "Exists",
+ kind: "feature",
+ summary: "I exist",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+
+ expect(db.nodeExists("exists")).toBe(true);
+ expect(db.nodeExists("nope")).toBe(false);
+ });
+ });
+
+ describe("parent-child relationships", () => {
+ it("getRootNodes returns only parentless nodes", () => {
+ db.insertNode({
+ id: "root",
+ name: "Root",
+ kind: "module",
+ summary: "A root node",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+
+ db.insertNode({
+ id: "root/child",
+ name: "Child",
+ kind: "feature",
+ summary: "A child node",
+ why: null,
+ file_refs: null,
+ parent_id: "root",
+ created_by_task: null,
+ embedding: null,
+ });
+
+ const roots = db.getRootNodes();
+ expect(roots).toHaveLength(1);
+ expect(roots[0].id).toBe("root");
+ });
+
+ it("getChildren returns children of a parent", () => {
+ db.insertNode({
+ id: "parent",
+ name: "Parent",
+ kind: "module",
+ summary: "Parent",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+
+ db.insertNode({
+ id: "parent/child-a",
+ name: "Child A",
+ kind: "feature",
+ summary: "First child",
+ why: null,
+ file_refs: null,
+ parent_id: "parent",
+ created_by_task: null,
+ embedding: null,
+ });
+
+ db.insertNode({
+ id: "parent/child-b",
+ name: "Child B",
+ kind: "feature",
+ summary: "Second child",
+ why: null,
+ file_refs: null,
+ parent_id: "parent",
+ created_by_task: null,
+ embedding: null,
+ });
+
+ const children = db.getChildren("parent");
+ expect(children).toHaveLength(2);
+ const names = children.map((c) => c.name).sort();
+ expect(names).toEqual(["Child A", "Child B"]);
+ });
+ });
+
+ describe("edges", () => {
+ beforeEach(() => {
+ db.insertNode({
+ id: "node-a",
+ name: "Node A",
+ kind: "feature",
+ summary: "Node A",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+ db.insertNode({
+ id: "node-b",
+ name: "Node B",
+ kind: "module",
+ summary: "Node B",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+ });
+
+ it("inserts and retrieves an edge", () => {
+ db.insertEdge({
+ from_id: "node-a",
+ to_id: "node-b",
+ relation: "depends_on",
+ description: "A depends on B",
+ });
+
+ const outgoing = db.getOutgoingEdges("node-a");
+ expect(outgoing).toHaveLength(1);
+ expect(outgoing[0].to_id).toBe("node-b");
+ expect(outgoing[0].relation).toBe("depends_on");
+
+ const incoming = db.getIncomingEdges("node-b");
+ expect(incoming).toHaveLength(1);
+ expect(incoming[0].from_id).toBe("node-a");
+ });
+
+ it("cascade-deletes edges when a node is soft-deleted", () => {
+ db.insertEdge({
+ from_id: "node-a",
+ to_id: "node-b",
+ relation: "calls",
+ description: null,
+ });
+
+ db.softDeleteNode("node-a", "Removed");
+
+ // Edges involving node-a should be gone
+ const outgoing = db.getOutgoingEdges("node-a");
+ expect(outgoing).toHaveLength(0);
+ const incoming = db.getIncomingEdges("node-a");
+ expect(incoming).toHaveLength(0);
+ });
+
+ it("getAllEdges returns all edges", () => {
+ db.insertEdge({
+ from_id: "node-a",
+ to_id: "node-b",
+ relation: "depends_on",
+ description: null,
+ });
+
+ const edges = db.getAllEdges();
+ expect(edges).toHaveLength(1);
+ expect(edges[0].from_id).toBe("node-a");
+ expect(edges[0].to_id).toBe("node-b");
+ });
+ });
+
+ describe("stats", () => {
+ it("returns correct counts", () => {
+ db.insertNode({
+ id: "s1",
+ name: "S1",
+ kind: "feature",
+ summary: "s",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+ db.insertNode({
+ id: "s2",
+ name: "S2",
+ kind: "module",
+ summary: "s",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+ db.insertEdge({
+ from_id: "s1",
+ to_id: "s2",
+ relation: "calls",
+ description: null,
+ });
+
+ const stats = db.getStats();
+ expect(stats.nodes).toBe(2);
+ expect(stats.edges).toBe(1);
+ });
+
+ it("getKindsBreakdown returns counts per kind", () => {
+ db.insertNode({
+ id: "k1",
+ name: "K1",
+ kind: "feature",
+ summary: "s",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+ db.insertNode({
+ id: "k2",
+ name: "K2",
+ kind: "feature",
+ summary: "s",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+ db.insertNode({
+ id: "k3",
+ name: "K3",
+ kind: "module",
+ summary: "s",
+ why: null,
+ file_refs: null,
+ parent_id: null,
+ created_by_task: null,
+ embedding: null,
+ });
+
+ const kinds = db.getKindsBreakdown();
+ expect(kinds.feature).toBe(2);
+ expect(kinds.module).toBe(1);
+ });
+ });
+});
diff --git a/src/__tests__/embeddings.test.ts b/src/__tests__/embeddings.test.ts
new file mode 100644
index 0000000..d7512bd
--- /dev/null
+++ b/src/__tests__/embeddings.test.ts
@@ -0,0 +1,107 @@
+import { describe, it, expect } from "vitest";
+import {
+ embeddingText,
+ cosineSimilarity,
+ findTopK,
+ EMBEDDING_DIM,
+} from "../embeddings.js";
+
+/**
+ * Create a mock embedding buffer from a Float32Array of values.
+ */
+function mockEmbedding(values: number[]): Buffer {
+ const arr = new Float32Array(values);
+ return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength);
+}
+
+describe("EMBEDDING_DIM", () => {
+ it("is 384", () => {
+ expect(EMBEDDING_DIM).toBe(384);
+ });
+});
+
+describe("embeddingText", () => {
+ it("formats kind, name, and summary into a template string", () => {
+ const result = embeddingText("Auth Module", "module", "Handles JWT validation");
+ expect(result).toBe("module: Auth Module — Handles JWT validation");
+ });
+
+ it("works with empty summary", () => {
+ const result = embeddingText("Config", "config", "");
+ expect(result).toBe("config: Config — ");
+ });
+});
+
+describe("cosineSimilarity", () => {
+ it("returns 1.0 for identical vectors", () => {
+ const vec = mockEmbedding([1, 2, 3, 4]);
+ expect(cosineSimilarity(vec, vec)).toBeCloseTo(1.0, 5);
+ });
+
+ it("returns 0.0 for orthogonal vectors", () => {
+ const a = mockEmbedding([1, 0, 0, 0]);
+ const b = mockEmbedding([0, 1, 0, 0]);
+ expect(cosineSimilarity(a, b)).toBeCloseTo(0.0, 5);
+ });
+
+ it("returns -1.0 for opposite vectors", () => {
+ const a = mockEmbedding([1, 0, 0]);
+ const b = mockEmbedding([-1, 0, 0]);
+ expect(cosineSimilarity(a, b)).toBeCloseTo(-1.0, 5);
+ });
+
+ it("returns 0.0 when one vector is all zeros", () => {
+ const a = mockEmbedding([1, 2, 3]);
+ const b = mockEmbedding([0, 0, 0]);
+ expect(cosineSimilarity(a, b)).toBe(0);
+ });
+
+ it("throws on dimension mismatch", () => {
+ const a = mockEmbedding([1, 2, 3]);
+ const b = mockEmbedding([1, 2]);
+ expect(() => cosineSimilarity(a, b)).toThrow("Embedding dimension mismatch");
+ });
+
+ it("computes correct similarity for known vectors", () => {
+ // cos([1,1], [1,0]) = 1/sqrt(2) ≈ 0.7071
+ const a = mockEmbedding([1, 1]);
+ const b = mockEmbedding([1, 0]);
+ expect(cosineSimilarity(a, b)).toBeCloseTo(1 / Math.sqrt(2), 4);
+ });
+});
+
+describe("findTopK", () => {
+ const queryEmbedding = mockEmbedding([1, 0, 0]);
+
+ const candidates = [
+ { id: "exact", name: "Exact", kind: "feature", summary: "", embedding: mockEmbedding([1, 0, 0]) },
+ { id: "similar", name: "Similar", kind: "feature", summary: "", embedding: mockEmbedding([0.9, 0.1, 0]) },
+ { id: "orthogonal", name: "Orthogonal", kind: "feature", summary: "", embedding: mockEmbedding([0, 1, 0]) },
+ { id: "opposite", name: "Opposite", kind: "feature", summary: "", embedding: mockEmbedding([-1, 0, 0]) },
+ { id: "no-embedding", name: "None", kind: "feature", summary: "", embedding: null },
+ ];
+
+ it("returns results sorted by similarity descending", () => {
+ const results = findTopK(queryEmbedding, candidates, 10);
+ expect(results[0].id).toBe("exact");
+ expect(results[0].similarity).toBeCloseTo(1.0, 4);
+ expect(results[1].id).toBe("similar");
+ expect(results[results.length - 1].id).toBe("opposite");
+ });
+
+ it("respects the topK limit", () => {
+ const results = findTopK(queryEmbedding, candidates, 2);
+ expect(results).toHaveLength(2);
+ });
+
+ it("filters out candidates with null embeddings", () => {
+ const results = findTopK(queryEmbedding, candidates, 10);
+ const ids = results.map((r) => r.id);
+ expect(ids).not.toContain("no-embedding");
+ });
+
+ it("returns empty array for empty candidates", () => {
+ const results = findTopK(queryEmbedding, [], 5);
+ expect(results).toEqual([]);
+ });
+});
diff --git a/src/__tests__/id-generation.test.ts b/src/__tests__/id-generation.test.ts
new file mode 100644
index 0000000..5ecab40
--- /dev/null
+++ b/src/__tests__/id-generation.test.ts
@@ -0,0 +1,56 @@
+import { describe, it, expect } from "vitest";
+import { makeId } from "../tools.js";
+
+describe("makeId", () => {
+ it("converts a simple name to a slug", () => {
+ expect(makeId("MCP Server")).toBe("mcp-server");
+ });
+
+ it("converts underscores to hyphens", () => {
+ expect(makeId("my_cool_feature")).toBe("my-cool-feature");
+ });
+
+ it("converts spaces to hyphens", () => {
+ expect(makeId("Web Explorer")).toBe("web-explorer");
+ });
+
+ it("strips special characters", () => {
+ expect(makeId("Hello, World! (v2)")).toBe("hello-world-v2");
+ });
+
+ it("collapses multiple hyphens", () => {
+ expect(makeId("foo---bar")).toBe("foo-bar");
+ });
+
+ it("trims leading and trailing hyphens", () => {
+ expect(makeId("--leading-trailing--")).toBe("leading-trailing");
+ });
+
+ it("handles mixed underscores, spaces, and special chars", () => {
+ expect(makeId("Init Command — Setup")).toBe("init-command-setup");
+ });
+
+ it("lowercases everything", () => {
+ expect(makeId("CamelCaseInput")).toBe("camelcaseinput");
+ });
+
+ it("prefixes with parent ID when provided", () => {
+ expect(makeId("Tool Registration", "mcp-server")).toBe(
+ "mcp-server/tool-registration"
+ );
+ });
+
+ it("handles parent ID with nested slug", () => {
+ expect(makeId("Search Feature", "web-explorer")).toBe(
+ "web-explorer/search-feature"
+ );
+ });
+
+ it("returns empty string for input with only special chars", () => {
+ expect(makeId("!!!")).toBe("");
+ });
+
+ it("handles numeric input", () => {
+ expect(makeId("version 2")).toBe("version-2");
+ });
+});
diff --git a/src/tools.ts b/src/tools.ts
index 5c15f5d..2908494 100644
--- a/src/tools.ts
+++ b/src/tools.ts
@@ -17,7 +17,7 @@ import type {
* Generate a slug ID from a name, optionally prefixed with parent ID.
* Converts underscores and spaces to hyphens, lowercases, strips non-alphanumeric.
*/
-function makeId(name: string, parentId?: string): string {
+export function makeId(name: string, parentId?: string): string {
const normalized = name
.toLowerCase()
.replace(/[_\s]+/g, "-") // underscores/spaces → hyphens
diff --git a/web/index.html b/web/index.html
index 8b6b4a8..632cdea 100644
--- a/web/index.html
+++ b/web/index.html
@@ -63,6 +63,13 @@
#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-muted); }
+ .version {
+ margin-left: auto;
+ font-size: 11px;
+ color: var(--text-muted);
+ white-space: nowrap;
+ }
+
main {
flex: 1;
display: flex;
@@ -70,7 +77,20 @@
position: relative;
}
- #graph { flex: 1; background: var(--bg); }
+ #graph {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ background-color: var(--bg);
+ /* Grid layers: 1) small dots, 2) vertical major lines, 3) horizontal major lines */
+ background-image:
+ radial-gradient(circle, #1e2230 1px, transparent 1px),
+ linear-gradient(to right, #181c28 1px, transparent 1px),
+ linear-gradient(to bottom, #181c28 1px, transparent 1px);
+ /* Defaults — overwritten by JS on viewport changes */
+ background-size: 20px 20px, 100px 100px, 100px 100px;
+ background-position: 0 0, 0 0, 0 0;
+ }
/* ---- Panel ---- */
#panel {
@@ -232,8 +252,9 @@
<body>
<header>
- <span class="logo">megamemory</span>
+ <span class="logo">MegaMemory</span>
<input id="search" type="text" placeholder="Search concepts..." />
+ <span class="version">v{{VERSION}}</span>
</header>
<main>
@@ -456,6 +477,29 @@ const STYLE = [
},
];
+// ---- Grid background (moves with pan/zoom) ----
+
+const GRID_SMALL = 20; // dot spacing in graph-space pixels
+const GRID_MAJOR = 100; // major crosshair line spacing
+
+function updateGrid() {
+ if (!cy) return;
+ const zoom = cy.zoom();
+ const pan = cy.pan();
+
+ const smallSize = GRID_SMALL * zoom;
+ const majorSize = GRID_MAJOR * zoom;
+
+ const ox = pan.x % smallSize;
+ const oy = pan.y % smallSize;
+ const mx = pan.x % majorSize;
+ const my = pan.y % majorSize;
+
+ const el = cy.container();
+ el.style.backgroundSize = `${smallSize}px ${smallSize}px, ${majorSize}px ${majorSize}px, ${majorSize}px ${majorSize}px`;
+ el.style.backgroundPosition = `${ox}px ${oy}px, ${mx}px ${my}px, ${mx}px ${my}px`;
+}
+
// ---- Init graph ----
function initCytoscape(elements, data) {
@@ -494,6 +538,11 @@ function initCytoscape(elements, data) {
wheelSensitivity: 0.3,
});
+ // Update grid on every viewport change (pan, zoom, resize)
+ cy.on('viewport', updateGrid);
+ cy.on('layoutstop', updateGrid);
+ updateGrid();
+
// Click node → panel
cy.on('tap', 'node', async function(evt) {
const node = evt.target;