@bloodyeagle/megamemory 0.0.0-stage → 1.6.3-fork.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +208 -2
- package/README.ru.md +211 -0
- package/commands/bootstrap-memory.md +51 -0
- package/commands/save-memory.md +84 -0
- package/dist/cli-utils.d.ts +23 -0
- package/dist/cli-utils.d.ts.map +1 -0
- package/dist/cli-utils.js +174 -0
- package/dist/cli-utils.js.map +1 -0
- package/dist/consolidate-cli.d.ts +9 -0
- package/dist/consolidate-cli.d.ts.map +1 -0
- package/dist/consolidate-cli.js +81 -0
- package/dist/consolidate-cli.js.map +1 -0
- package/dist/consolidate.d.ts +36 -0
- package/dist/consolidate.d.ts.map +1 -0
- package/dist/consolidate.js +161 -0
- package/dist/consolidate.js.map +1 -0
- package/dist/db.d.ts +305 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +1077 -0
- package/dist/db.js.map +1 -0
- package/dist/digest-cli.d.ts +8 -0
- package/dist/digest-cli.d.ts.map +1 -0
- package/dist/digest-cli.js +51 -0
- package/dist/digest-cli.js.map +1 -0
- package/dist/digest.d.ts +70 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +176 -0
- package/dist/digest.js.map +1 -0
- package/dist/doctor-cli.d.ts +8 -0
- package/dist/doctor-cli.d.ts.map +1 -0
- package/dist/doctor-cli.js +43 -0
- package/dist/doctor-cli.js.map +1 -0
- package/dist/doctor.d.ts +41 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +144 -0
- package/dist/doctor.js.map +1 -0
- package/dist/embed-model.d.ts +11 -0
- package/dist/embed-model.d.ts.map +1 -0
- package/dist/embed-model.js +11 -0
- package/dist/embed-model.js.map +1 -0
- package/dist/embeddings.d.ts +72 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +204 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/eval-cli.d.ts +8 -0
- package/dist/eval-cli.d.ts.map +1 -0
- package/dist/eval-cli.js +63 -0
- package/dist/eval-cli.js.map +1 -0
- package/dist/eval.d.ts +32 -0
- package/dist/eval.d.ts.map +1 -0
- package/dist/eval.js +48 -0
- package/dist/eval.js.map +1 -0
- package/dist/export-cli.d.ts +9 -0
- package/dist/export-cli.d.ts.map +1 -0
- package/dist/export-cli.js +56 -0
- package/dist/export-cli.js.map +1 -0
- package/dist/export.d.ts +38 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +117 -0
- package/dist/export.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +559 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +3 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +617 -0
- package/dist/install.js.map +1 -0
- package/dist/merge-cli.d.ts +4 -0
- package/dist/merge-cli.d.ts.map +1 -0
- package/dist/merge-cli.js +251 -0
- package/dist/merge-cli.js.map +1 -0
- package/dist/merge.d.ts +44 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +468 -0
- package/dist/merge.js.map +1 -0
- package/dist/migrate-cli.d.ts +16 -0
- package/dist/migrate-cli.d.ts.map +1 -0
- package/dist/migrate-cli.js +117 -0
- package/dist/migrate-cli.js.map +1 -0
- package/dist/migrate-schema.d.ts +41 -0
- package/dist/migrate-schema.d.ts.map +1 -0
- package/dist/migrate-schema.js +275 -0
- package/dist/migrate-schema.js.map +1 -0
- package/dist/migrate.d.ts +34 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +134 -0
- package/dist/migrate.js.map +1 -0
- package/dist/norm.d.ts +8 -0
- package/dist/norm.d.ts.map +1 -0
- package/dist/norm.js +14 -0
- package/dist/norm.js.map +1 -0
- package/dist/reembed-cli.d.ts +11 -0
- package/dist/reembed-cli.d.ts.map +1 -0
- package/dist/reembed-cli.js +54 -0
- package/dist/reembed-cli.js.map +1 -0
- package/dist/reembed.d.ts +26 -0
- package/dist/reembed.d.ts.map +1 -0
- package/dist/reembed.js +45 -0
- package/dist/reembed.js.map +1 -0
- package/dist/search.d.ts +76 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +176 -0
- package/dist/search.js.map +1 -0
- package/dist/stats.d.ts +2 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +159 -0
- package/dist/stats.js.map +1 -0
- package/dist/timeline.d.ts +13 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +21 -0
- package/dist/timeline.js.map +1 -0
- package/dist/tools.d.ts +62 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +657 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +285 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/web.d.ts +2 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +859 -0
- package/dist/web.js.map +1 -0
- package/docs/FORK.md +118 -0
- package/docs/FORK.ru.md +118 -0
- package/fixtures/demo.db +0 -0
- package/fixtures/eval.jsonl +25 -0
- package/package.json +65 -4
- package/plugin/megamemory.ts +170 -0
- package/web/index.html +2428 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 0xk3vin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,209 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">MegaMemory <sub><sup>fork</sup></sub></h1>
|
|
3
|
+
</p>
|
|
4
|
+
<p align="center">Persistent project knowledge graph for coding agents — multilingual, token-economical, visible in the UI.</p>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="./LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" /></a>
|
|
8
|
+
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square" />
|
|
9
|
+
<img alt="version" src="https://img.shields.io/badge/version-1.6.3--fork.1-orange?style=flat-square" />
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="./assets/preview.png" alt="MegaMemory web explorer" width="800" />
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
> **Fork of [0xK3vin/MegaMemory](https://github.com/0xK3vin/MegaMemory) v1.6.2 (MIT).**
|
|
17
|
+
> Upstream keeps the concept, this fork fixes multilingual IDs, adds hybrid search,
|
|
18
|
+
> a context budget, fact freshness, digests, export and token accounting.
|
|
19
|
+
> Русская версия: [README.ru.md](./README.ru.md).
|
|
20
|
+
|
|
21
|
+
An [MCP](https://modelcontextprotocol.io/) server that lets your coding agent build and query a
|
|
22
|
+
graph of concepts, architecture, and decisions — so it **remembers across sessions**.
|
|
23
|
+
|
|
24
|
+
The LLM is the indexer. No AST parsing, no static analysis: the agent reads code, writes concepts
|
|
25
|
+
in its own words, and queries them before future tasks. The graph stores **concepts** — features,
|
|
26
|
+
modules, patterns, decisions — not code symbols. Everything persists in a per-project SQLite
|
|
27
|
+
database at `.megamemory/knowledge.db`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## What this fork changes
|
|
32
|
+
|
|
33
|
+
| Area | Upstream 1.6.2 | This fork |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| Node IDs | slug strips everything outside `[a-z0-9-]`; Cyrillic, CJK, Greek, emoji names collapse to `""` and the second such node is lost | Unicode-safe slug: letters of any script, diacritics stripped only after Latin/Cyrillic/Greek/Hebrew bases (katakana dakuten and Hangul jamo are preserved), `/` becomes `-`, NFC output, hash fallback for emoji-only names, `-<hash8>` on collisions |
|
|
36
|
+
| Embeddings | `all-MiniLM-L6-v2`, English-only, dimension hardcoded | `Xenova/multilingual-e5-small` by default (`MEGAMEMORY_EMBED_MODEL`), e5 `passage:`/`query:` prefixes, dimension read from the model, vector search disabled on model mismatch until `megamemory reembed` |
|
|
37
|
+
| Search | cosine similarity only | hybrid: FTS5 + vector fused with RRF, per-hit `via: vector \| fts \| both`, query sanitization for `MATCH`, short-CJK routing, optional trigram index, `name_norm` LIKE fallback |
|
|
38
|
+
| Context | `understand` returns everything it found | `mode: "compact"` by default, bounded by `max_tokens` (1500), summaries trimmed to 240 chars, edges between returned nodes only, `meta.returned / dropped / tokens_estimated` |
|
|
39
|
+
| Freshness | delete or nothing | node `status` (`active`/`superseded`/`deprecated`), `supersedes` and `contradicts` edges, outdated nodes hidden from answers but visible in the graph |
|
|
40
|
+
| Duplicates | manual merge | `megamemory consolidate` finds embedding-similar pairs (≥ 0.95) and merges them with edge transfer |
|
|
41
|
+
| Long modules | every child read separately | `digest` nodes: one per module, rebuilt after the 5th child, lower search weight |
|
|
42
|
+
| Portability | DB only | `megamemory export --md <dir>` writes one markdown file per node (frontmatter + wiki-links), `--check` for CI |
|
|
43
|
+
| Cost visibility | none | every `understand` / `list_roots` / `get_concept` is measured; 7-day aggregates in `megamemory stats`, `/api/stats` and the explorer's **Tokens** panel |
|
|
44
|
+
| Migration | — | `megamemory migrate --dry-run/--apply` upgrades an upstream database in place, additively, with backups and a downgrade-safe schema |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## The loop
|
|
49
|
+
|
|
50
|
+
`understand → work → update`
|
|
51
|
+
|
|
52
|
+
1. **Session start** — the agent calls `list_roots` (budgeted) to orient itself.
|
|
53
|
+
2. **Before a task** — `understand` with a natural-language query, or `get_concept` for an exact ID.
|
|
54
|
+
3. **After a task** — `create_concept` / `update_concept`, then `link` for relationships.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
Requires Node.js >= 18. For Russian-only projects a much smaller model (`cointegrated/rubert-tiny2`, 312-dim) works after an ONNX conversion; the model unloads after 5 minutes idle (`MEGAMEMORY_EMBED_IDLE_MS=0` disables that), and `MEGAMEMORY_SEARCH=fts` avoids loading it at all. The embedding model (~120 MB, multilingual) downloads on first use and is
|
|
61
|
+
cached in `~/.cache/huggingface`.
|
|
62
|
+
|
|
63
|
+
Install globally from npm:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install -g @bloodyeagle/megamemory
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or build from a checkout (for development):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/BloodyEagle/MegaMemoryAgent.git
|
|
73
|
+
cd MegaMemoryAgent
|
|
74
|
+
npm ci
|
|
75
|
+
npm run build
|
|
76
|
+
npm pack # megamemory-1.6.3-fork.1.tgz
|
|
77
|
+
npm install -g ./megamemory-1.6.3-fork.1.tgz
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then either run the installer or register the MCP server by hand:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
megamemory install # interactive: opencode / [CC] / Codex / Antigravity
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"megamemory": {
|
|
89
|
+
"type": "local",
|
|
90
|
+
"command": ["megamemory"],
|
|
91
|
+
"enabled": true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The server reads `.megamemory/knowledge.db` relative to the working directory; override with
|
|
97
|
+
`MEGAMEMORY_DB_PATH`.
|
|
98
|
+
|
|
99
|
+
### Upgrading an existing upstream database
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
megamemory migrate --dry-run # prints the plan, changes nothing
|
|
103
|
+
megamemory migrate --apply # backs up knowledge.db.bak-<ts>, applies the additive schema
|
|
104
|
+
megamemory reembed # only needed if the embedding model changed
|
|
105
|
+
megamemory doctor # health check, exit code 1 on problems
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The migration never drops or renames a column, so upstream v1.6.2 still opens a migrated database.
|
|
109
|
+
Nodes lost upstream to the empty-ID bug cannot be recovered; `--dry-run` reports them explicitly.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## MCP tools
|
|
114
|
+
|
|
115
|
+
| Tool | Description |
|
|
116
|
+
|---|---|
|
|
117
|
+
| `understand` | Hybrid search over the graph. `top_k`, `max_tokens`, `mode: "compact" \| "full"`, `include_inactive`. |
|
|
118
|
+
| `get_concept` | Exact-ID lookup with children, edges, incoming edges, parent. |
|
|
119
|
+
| `create_concept` | Add a concept with edges, file refs and `supersedes`. |
|
|
120
|
+
| `update_concept` | Update fields; embeddings are regenerated. |
|
|
121
|
+
| `link` | Typed relationship between concepts. |
|
|
122
|
+
| `remove_concept` | Soft-delete with a reason; history kept, status set to `deprecated`. |
|
|
123
|
+
| `list_roots` | Top-level concepts with direct children (budgeted). |
|
|
124
|
+
| `list_conflicts` | Unresolved merge conflicts, plus `contradicts` pairs. |
|
|
125
|
+
| `resolve_conflict` | Resolve a conflict with verified content. |
|
|
126
|
+
|
|
127
|
+
**Kinds:** `feature` · `module` · `pattern` · `config` · `decision` · `component` · `digest`
|
|
128
|
+
|
|
129
|
+
**Relations:** `connects_to` · `depends_on` · `implements` · `calls` · `configured_by` · `supersedes` · `contradicts`
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## CLI
|
|
134
|
+
|
|
135
|
+
| Command | What it does |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `megamemory install` | Configure an MCP client |
|
|
138
|
+
| `megamemory serve [--port N]` | Web explorer (graph, search, node cards, Tokens panel, consolidate tab) |
|
|
139
|
+
| `megamemory migrate [--dry-run\|--apply]` | Upgrade an upstream database |
|
|
140
|
+
| `megamemory repair-ids [--apply]` | Rebuild empty / trailing-slash IDs from names |
|
|
141
|
+
| `megamemory reembed` | Recompute embeddings (resumable, batched) |
|
|
142
|
+
| `megamemory doctor` | Health check: schema, model, FTS, IDs, vectors, orphans, digests |
|
|
143
|
+
| `megamemory stats` | Graph and token statistics |
|
|
144
|
+
| `megamemory eval` | recall@10 over `fixtures/eval.jsonl` |
|
|
145
|
+
| `megamemory consolidate [--dry-run\|--apply]` | Find and merge near-duplicate nodes |
|
|
146
|
+
| `megamemory digest [--apply]` | Build or rebuild digest nodes |
|
|
147
|
+
| `megamemory export --md <dir> [--check]` | Markdown export, CI-friendly drift check |
|
|
148
|
+
| `megamemory merge`, `conflicts`, `resolve` | Two-way merge of graphs across branches |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Environment
|
|
153
|
+
|
|
154
|
+
| Variable | Default | Meaning |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| `MEGAMEMORY_DB_PATH` | `./.megamemory/knowledge.db` | Database location |
|
|
157
|
+
| `MEGAMEMORY_EMBED_MODEL` | `Xenova/multilingual-e5-small` | Embedding model (any transformers.js ONNX model) |
|
|
158
|
+
| `MEGAMEMORY_SEARCH` | `hybrid` | `hybrid` / `fts` / `vector` |
|
|
159
|
+
| `MEGAMEMORY_FTS_TOKENIZER` | — | `trigram` adds a second index for CJK |
|
|
160
|
+
| `MEGAMEMORY_AUTO_DIGEST` | on | `0` disables auto-digest after the 5th child |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Web explorer
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
megamemory serve --port 8080
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- nodes colored by kind, sized by edge count; `digest` nodes and outdated (`superseded`) nodes are visually distinct
|
|
171
|
+
- `supersedes` edges drawn dashed, status badges in the node card, "show outdated" toggle
|
|
172
|
+
- search hits carry a `via` badge (vector / fts / both) and a budget line: `N nodes, ~X tokens, dropped M · saved ~Z vs full`
|
|
173
|
+
- **Tokens** panel: average answer size and saved tokens over 7 days
|
|
174
|
+
- **Consolidate** tab: duplicate candidates with apply
|
|
175
|
+
- per-kind filter checkboxes (persisted), visible/total counter, **export bundle** button and per-node `download .md`
|
|
176
|
+
- **Health** chip: vectors, FTS sync, digests, empty ids, orphans, memory — with remedy hints
|
|
177
|
+
- digest cards list source concepts with a `stale` badge and a **focus** toggle
|
|
178
|
+
- timeline **status changes** mode; node cards show recent status transitions with reasons
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Tests
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npm run build
|
|
186
|
+
npx vitest run src/__tests__/id-generation.test.ts --reporter=dot # targeted
|
|
187
|
+
npx vitest run # full suite (slow: model download)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`fixtures/demo.db` is a ready-made graph (ru/en/zh/emoji, one `superseded`, one `digest`, one
|
|
191
|
+
duplicate pair) for manual checks in the explorer.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Compatibility and limits
|
|
196
|
+
|
|
197
|
+
- Upstream v1.6.2 keeps working against a migrated database: new columns have defaults, FTS
|
|
198
|
+
triggers maintain the index for upstream inserts. Backups `knowledge.db.bak-<ts>`, last 3 kept.
|
|
199
|
+
- FTS5 requires libsql's local file mode — MegaMemory is local-only; remote Turso forbids virtual tables.
|
|
200
|
+
- After any `VACUUM`, run `megamemory migrate --apply` to rebuild the FTS index (rowids are not stable).
|
|
201
|
+
- Russian text is not stemmed by FTS5's `unicode61`; the vector channel compensates, prefix queries help.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Credits and license
|
|
206
|
+
|
|
207
|
+
Based on [MegaMemory](https://github.com/0xK3vin/MegaMemory) by 0xK3vin (MIT).
|
|
208
|
+
Fork maintained by [BloodyEagle](https://github.com/BloodyEagle). MIT, see [LICENSE](./LICENSE).
|
|
209
|
+
Differences and sync instructions: [docs/FORK.md](./docs/FORK.md).
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">MegaMemory <sub><sup>форк</sup></sub></h1>
|
|
3
|
+
</p>
|
|
4
|
+
<p align="center">Граф знаний проекта для кодинг-агентов — мультиязычный, экономный по токенам, видимый в интерфейсе.</p>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="./LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" /></a>
|
|
8
|
+
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=flat-square" />
|
|
9
|
+
<img alt="version" src="https://img.shields.io/badge/version-1.6.3--fork.1-orange?style=flat-square" />
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="./assets/preview.png" alt="Веб-обозреватель MegaMemory" width="800" />
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
> **Форк [0xK3vin/MegaMemory](https://github.com/0xK3vin/MegaMemory) v1.6.2 (MIT).**
|
|
17
|
+
> Идея и база — upstream. В форке: исправлены идентификаторы для любых языков, добавлены
|
|
18
|
+
> гибридный поиск, бюджет контекста, актуальность фактов, digest-узлы, экспорт и учёт токенов.
|
|
19
|
+
> English version: [README.md](./README.md).
|
|
20
|
+
|
|
21
|
+
[MCP](https://modelcontextprotocol.io/)-сервер, который даёт кодинг-агенту строить граф концепций,
|
|
22
|
+
архитектуры и решений — и **помнить проект между сессиями**.
|
|
23
|
+
|
|
24
|
+
Индексатор — сам LLM. Никакого AST-парсинга и статического анализа: агент читает код, записывает
|
|
25
|
+
концепции своими словами и запрашивает их перед следующими задачами. В графе хранятся **концепции** —
|
|
26
|
+
фичи, модули, паттерны, решения, — а не символы кода. Всё лежит в SQLite проекта:
|
|
27
|
+
`.megamemory/knowledge.db`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Что изменилось в форке
|
|
32
|
+
|
|
33
|
+
| Область | Upstream 1.6.2 | Этот форк |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| Идентификаторы | slug вырезает всё вне `[a-z0-9-]`: кириллица, CJK, греческий, эмодзи схлопываются в `""`, второй такой узел теряется | Unicode-слаг: буквы любого алфавита, диакритика снимается только после латиницы/кириллицы/греческого/иврита (дакутэн катаканы и хангыль сохраняются), `/` → `-`, вывод в NFC, hash-фолбэк для имён из эмодзи, суффикс `-<hash8>` при коллизии |
|
|
36
|
+
| Эмбеддинги | `all-MiniLM-L6-v2`, только английский, размерность зашита | по умолчанию `Xenova/multilingual-e5-small` (`MEGAMEMORY_EMBED_MODEL`), префиксы e5 `passage:`/`query:`, размерность берётся из модели, при смене модели векторный поиск отключается до `megamemory reembed` |
|
|
37
|
+
| Поиск | только косинус | гибрид: FTS5 + вектор через RRF, у каждого попадания `via: vector \| fts \| both`, санитизация запросов для `MATCH`, маршрутизация коротких CJK-запросов, опциональный trigram-индекс, LIKE-фолбэк по `name_norm` |
|
|
38
|
+
| Контекст | `understand` отдаёт всё найденное | по умолчанию `mode: "compact"` с лимитом `max_tokens` (1500), summary обрезается до 240 символов, рёбра — только между возвращёнными узлами, `meta.returned / dropped / tokens_estimated` |
|
|
39
|
+
| Актуальность | либо удалить, либо никак | `status` (`active`/`superseded`/`deprecated`), рёбра `supersedes` и `contradicts`, устаревшее скрыто из ответов, но видно в графе |
|
|
40
|
+
| Дубли | только ручной merge | `megamemory consolidate` находит пары с близостью эмбеддингов ≥ 0.95 и сливает их с переносом рёбер |
|
|
41
|
+
| Большие модули | каждый ребёнок читается отдельно | `digest`-узлы: один на модуль, пересобирается после 5-го ребёнка, пониженный вес в поиске |
|
|
42
|
+
| Переносимость | только БД | `megamemory export --md <dir>` — по файлу на узел (frontmatter + wiki-ссылки), `--check` для CI |
|
|
43
|
+
| Видимость цены | нет | каждый `understand` / `list_roots` / `get_concept` измеряется; агрегаты за 7 дней в `megamemory stats`, `/api/stats` и панели **Tokens** в explorer |
|
|
44
|
+
| Миграция | — | `megamemory migrate --dry-run/--apply` обновляет базу upstream на месте, аддитивно, с бэкапами и совместимостью вниз |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Цикл работы
|
|
49
|
+
|
|
50
|
+
`understand → работа → update`
|
|
51
|
+
|
|
52
|
+
1. **Начало сессии** — агент вызывает `list_roots` (с бюджетом), чтобы сориентироваться.
|
|
53
|
+
2. **Перед задачей** — `understand` с запросом на естественном языке или `get_concept` по точному id.
|
|
54
|
+
3. **После задачи** — `create_concept` / `update_concept`, затем `link` для связей.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Установка
|
|
59
|
+
|
|
60
|
+
Нужен Node.js >= 18. Для чисто русских проектов подойдёт значительно меньшая модель (`cointegrated/rubert-tiny2`, 312-мерная) после конвертации в ONNX; модель выгружается после 5 минут простоя (`MEGAMEMORY_EMBED_IDLE_MS=0` отключает выгрузку), а `MEGAMEMORY_SEARCH=fts` не загружает её вовсе. Модель эмбеддингов (~120 МБ, мультиязычная) скачивается при первом
|
|
61
|
+
запуске и кешируется в `~/.cache/huggingface`.
|
|
62
|
+
|
|
63
|
+
Установка глобально из npm:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install -g @bloodyeagle/megamemory
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Или сборка из чекаута (для разработки):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/BloodyEagle/MegaMemoryAgent.git
|
|
73
|
+
cd MegaMemoryAgent
|
|
74
|
+
npm ci
|
|
75
|
+
npm run build
|
|
76
|
+
npm pack # megamemory-1.6.3-fork.1.tgz
|
|
77
|
+
npm install -g ./megamemory-1.6.3-fork.1.tgz
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Дальше — либо установщик, либо регистрация MCP-сервера руками:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
megamemory install # интерактивно: opencode / [CC] / Codex / Antigravity
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"megamemory": {
|
|
89
|
+
"type": "local",
|
|
90
|
+
"command": ["megamemory"],
|
|
91
|
+
"enabled": true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Сервер читает `.megamemory/knowledge.db` относительно рабочей директории; путь переопределяется
|
|
97
|
+
через `MEGAMEMORY_DB_PATH`.
|
|
98
|
+
|
|
99
|
+
### Обновление существующей базы upstream
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
megamemory migrate --dry-run # печатает план, ничего не меняет
|
|
103
|
+
megamemory migrate --apply # бэкап knowledge.db.bak-<ts>, аддитивная миграция схемы
|
|
104
|
+
megamemory reembed # нужен только если сменилась модель эмбеддингов
|
|
105
|
+
megamemory doctor # проверка здоровья, код выхода 1 при проблемах
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Миграция не удаляет и не переименовывает столбцы, поэтому upstream v1.6.2 открывает
|
|
109
|
+
мигрированную базу. Узлы, потерянные в upstream из-за пустых id, восстановить нельзя —
|
|
110
|
+
`--dry-run` честно их показывает.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## MCP-инструменты
|
|
115
|
+
|
|
116
|
+
| Инструмент | Что делает |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `understand` | Гибридный поиск по графу. `top_k`, `max_tokens`, `mode: "compact" \| "full"`, `include_inactive`. |
|
|
119
|
+
| `get_concept` | Точный поиск по id: дети, рёбра, входящие рёбра, родитель. |
|
|
120
|
+
| `create_concept` | Новая концепция с рёбрами, ссылками на файлы и `supersedes`. |
|
|
121
|
+
| `update_concept` | Обновление полей; эмбеддинг пересчитывается. |
|
|
122
|
+
| `link` | Типизированная связь между концепциями. |
|
|
123
|
+
| `remove_concept` | Мягкое удаление с причиной; история сохраняется, статус `deprecated`. |
|
|
124
|
+
| `list_roots` | Корневые концепции с детьми (с бюджетом). |
|
|
125
|
+
| `list_conflicts` | Неразрешённые конфликты merge и пары `contradicts`. |
|
|
126
|
+
| `resolve_conflict` | Разрешение конфликта проверенным содержимым. |
|
|
127
|
+
|
|
128
|
+
**Типы узлов:** `feature` · `module` · `pattern` · `config` · `decision` · `component` · `digest`
|
|
129
|
+
|
|
130
|
+
**Типы связей:** `connects_to` · `depends_on` · `implements` · `calls` · `configured_by` · `supersedes` · `contradicts`
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## CLI
|
|
135
|
+
|
|
136
|
+
| Команда | Назначение |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `megamemory install` | Настроить MCP-клиент |
|
|
139
|
+
| `megamemory serve [--port N]` | Веб-обозреватель: граф, поиск, карточки узлов, панель Tokens, вкладка consolidate |
|
|
140
|
+
| `megamemory migrate [--dry-run\|--apply]` | Обновить базу upstream |
|
|
141
|
+
| `megamemory repair-ids [--apply]` | Пересобрать пустые id и id с хвостовым `/` |
|
|
142
|
+
| `megamemory reembed` | Пересчитать эмбеддинги (прерываемо, пакетами) |
|
|
143
|
+
| `megamemory doctor` | Проверка: схема, модель, FTS, id, векторы, осиротевшие рёбра, digest |
|
|
144
|
+
| `megamemory stats` | Статистика графа и токенов |
|
|
145
|
+
| `megamemory eval` | recall@10 по `fixtures/eval.jsonl` |
|
|
146
|
+
| `megamemory consolidate [--dry-run\|--apply]` | Поиск и слияние почти одинаковых узлов |
|
|
147
|
+
| `megamemory digest [--apply]` | Сборка и пересборка digest-узлов |
|
|
148
|
+
| `megamemory export --md <dir> [--check]` | Markdown-экспорт и проверка расхождений для CI |
|
|
149
|
+
| `megamemory merge`, `conflicts`, `resolve` | Двусторонний merge графов между ветками |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Переменные окружения
|
|
154
|
+
|
|
155
|
+
| Переменная | По умолчанию | Значение |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| `MEGAMEMORY_DB_PATH` | `./.megamemory/knowledge.db` | Путь к базе |
|
|
158
|
+
| `MEGAMEMORY_EMBED_MODEL` | `Xenova/multilingual-e5-small` | Модель эмбеддингов (любая ONNX-модель transformers.js) |
|
|
159
|
+
| `MEGAMEMORY_SEARCH` | `hybrid` | `hybrid` / `fts` / `vector` |
|
|
160
|
+
| `MEGAMEMORY_FTS_TOKENIZER` | — | `trigram` добавляет второй индекс для CJK |
|
|
161
|
+
| `MEGAMEMORY_AUTO_DIGEST` | включено | `0` отключает автосборку digest после 5-го ребёнка |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Веб-обозреватель
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
megamemory serve --port 8080
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- узлы раскрашены по типу, размер — по числу рёбер; `digest` и устаревшие (`superseded`) визуально отличаются
|
|
172
|
+
- рёбра `supersedes` — пунктиром, бейдж статуса в карточке узла, тумблер «показывать устаревшие»
|
|
173
|
+
- у результатов поиска бейдж `via` (vector / fts / both) и строка бюджета: `N nodes, ~X tokens, dropped M` · `saved ~Z vs full`
|
|
174
|
+
- панель **Tokens**: средний размер ответа и сэкономленные токены за 7 дней
|
|
175
|
+
- вкладка **Consolidate**: кандидаты-дубликаты с кнопкой применения
|
|
176
|
+
- чекбоксы фильтра по типам узлов (с сохранением), счётчик видимых, кнопка **export bundle** и `download .md` в карточке
|
|
177
|
+
- чип **Health**: векторы, синхронность FTS, digest, пустые id, сироты, память — с подсказками
|
|
178
|
+
- карточка digest показывает исходные концепции, бейдж `stale` и переключатель **focus**
|
|
179
|
+
- режим **status changes** в таймлайне; в карточке узла — последние смены статусов с причинами
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Тесты
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm run build
|
|
187
|
+
npx vitest run src/__tests__/id-generation.test.ts --reporter=dot # целевой прогон
|
|
188
|
+
npx vitest run # всё (долго: скачивание модели)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`fixtures/demo.db` — готовый граф (ru/en/zh/эмодзи, один `superseded`, один `digest`, пара дублей)
|
|
192
|
+
для ручной проверки в обозревателе.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Совместимость и ограничения
|
|
197
|
+
|
|
198
|
+
- Upstream v1.6.2 работает с мигрированной базой: у новых столбцов есть `DEFAULT`, FTS-триггеры
|
|
199
|
+
поддерживают индекс при вставках upstream. Бэкапы `knowledge.db.bak-<ts>`, хранятся 3 последних.
|
|
200
|
+
- FTS5 требует локального файлового режима libsql — MegaMemory локальная; удалённый Turso
|
|
201
|
+
виртуальные таблицы запрещает.
|
|
202
|
+
- После любого `VACUUM` нужен `megamemory migrate --apply` — пересборка FTS (rowid не гарантированы).
|
|
203
|
+
- Русский текст FTS5 `unicode61` не стеммит; компенсирует векторный канал, помогают префикс-запросы.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Авторы и лицензия
|
|
208
|
+
|
|
209
|
+
Основа — [MegaMemory](https://github.com/0xK3vin/MegaMemory), автор 0xK3vin (MIT).
|
|
210
|
+
Форк поддерживает [BloodyEagle](https://github.com/BloodyEagle). MIT, см. [LICENSE](./LICENSE).
|
|
211
|
+
Отличия и порядок синхронизации с upstream: [docs/FORK.ru.md](./docs/FORK.ru.md) (english: [docs/FORK.md](./docs/FORK.md)).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!-- MegaMemory-managed file. Safe for megamemory install to update. -->
|
|
2
|
+
# Bootstrap Project Knowledge Graph
|
|
3
|
+
|
|
4
|
+
RUN { git ls-files; git ls-files --others --exclude-standard; } 2>/dev/null | sort -u | xargs wc -l 2>/dev/null | sort -rn | head -150
|
|
5
|
+
READ README.md
|
|
6
|
+
|
|
7
|
+
You are bootstrapping the megamemory knowledge graph for this project.
|
|
8
|
+
|
|
9
|
+
Your job is to understand the codebase and record its core concepts, architecture,
|
|
10
|
+
and patterns as knowledge graph nodes. The file listing above is sorted by line
|
|
11
|
+
count — the biggest files are where the core logic lives.
|
|
12
|
+
|
|
13
|
+
## Step 1: Check existing graph
|
|
14
|
+
|
|
15
|
+
Call `megamemory:list_roots` to see what's already recorded. If the graph has
|
|
16
|
+
good coverage, report what's there and ask if I want to fill in specific areas.
|
|
17
|
+
|
|
18
|
+
## Step 2: Identify major modules
|
|
19
|
+
|
|
20
|
+
From the file listing and README, identify the top-level systems in this project.
|
|
21
|
+
Think in terms of:
|
|
22
|
+
- What does this project DO? (features)
|
|
23
|
+
- What are the distinct subsystems? (modules)
|
|
24
|
+
- How is it structured? (patterns, decisions)
|
|
25
|
+
|
|
26
|
+
## Step 3: Read and create root concepts
|
|
27
|
+
|
|
28
|
+
For each major module, read its key files to understand what it does. Then call
|
|
29
|
+
`megamemory:create_concept` with a specific, detailed summary. Include parameter
|
|
30
|
+
names, defaults, file paths, and behavior details — not vague descriptions.
|
|
31
|
+
|
|
32
|
+
## Step 4: Create children for important sub-components
|
|
33
|
+
|
|
34
|
+
For substantial modules, create child concepts for key pieces. Stay max 2 levels
|
|
35
|
+
deep. Focus on things a developer would need to know when working in that area.
|
|
36
|
+
|
|
37
|
+
## Step 5: Link related concepts
|
|
38
|
+
|
|
39
|
+
Connect concepts that interact across boundaries using `megamemory:link`.
|
|
40
|
+
Focus on meaningful relationships: depends_on, calls, connects_to, implements,
|
|
41
|
+
configured_by.
|
|
42
|
+
|
|
43
|
+
## Guidelines
|
|
44
|
+
|
|
45
|
+
- Be specific. "Handles auth" is useless. "JWT auth with RS256, tokens from
|
|
46
|
+
/auth/login, validated in middleware, refresh tokens in Redis with 7d TTL" is useful.
|
|
47
|
+
- Focus on the top 10-15 most important concepts first. The graph grows over time.
|
|
48
|
+
- Don't document trivial things. If it's obvious from the file name, skip it.
|
|
49
|
+
|
|
50
|
+
- When a concept replaces an earlier decision, pass `supersedes: [old_id]` instead of deleting.
|
|
51
|
+
- Do not create digest nodes manually — they are built from children automatically.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<!-- MegaMemory-managed file. Safe for megamemory install to update. -->
|
|
2
|
+
# Save Session Knowledge
|
|
3
|
+
|
|
4
|
+
You are saving what you learned this session into the megamemory knowledge graph.
|
|
5
|
+
This is YOUR memory — record anything valuable for future sessions: what you
|
|
6
|
+
understood about the project, what you built, decisions that were made, patterns
|
|
7
|
+
you noticed, or intent the user shared.
|
|
8
|
+
|
|
9
|
+
## Step 1: Load existing graph
|
|
10
|
+
|
|
11
|
+
Call `megamemory:list_roots` to see what's already recorded. Understanding the
|
|
12
|
+
current state prevents duplicates and helps you decide what to update vs create.
|
|
13
|
+
|
|
14
|
+
## Step 2: Reflect on this session
|
|
15
|
+
|
|
16
|
+
Think about what happened this session. Consider:
|
|
17
|
+
- What did you learn about the project's purpose or intent?
|
|
18
|
+
- What features, modules, or components did you build or change?
|
|
19
|
+
- What design decisions were made and why?
|
|
20
|
+
- What patterns or conventions did you discover?
|
|
21
|
+
- What architectural understanding do you have now that isn't in the graph?
|
|
22
|
+
- Did anything get removed, replaced, or deprecated?
|
|
23
|
+
|
|
24
|
+
## Step 3: Search for overlap
|
|
25
|
+
|
|
26
|
+
Before creating anything new, call `megamemory:understand` with queries based on
|
|
27
|
+
what you worked on this session. For each area you touched, search to see if
|
|
28
|
+
concepts already exist that should be updated rather than duplicated.
|
|
29
|
+
|
|
30
|
+
For example, if you worked on authentication, call:
|
|
31
|
+
megamemory:understand — query="authentication"
|
|
32
|
+
|
|
33
|
+
Do this for each distinct area. Existing concepts that are stale or incomplete
|
|
34
|
+
should be updated — don't create a new node when an update will do.
|
|
35
|
+
|
|
36
|
+
## Step 4: Write to the knowledge graph
|
|
37
|
+
|
|
38
|
+
For each thing worth remembering:
|
|
39
|
+
|
|
40
|
+
**New understanding** → `megamemory:create_concept`
|
|
41
|
+
- name: human-readable name
|
|
42
|
+
- kind: use `decision` for intent/rationale, `feature` for capabilities,
|
|
43
|
+
`module` for subsystems, `pattern` for conventions, `config` for setup,
|
|
44
|
+
`component` for distinct pieces of a system
|
|
45
|
+
- summary: be specific — include parameter names, defaults, file paths,
|
|
46
|
+
behavior details, and the WHY behind things
|
|
47
|
+
- why: the rationale — this is often the most valuable part
|
|
48
|
+
- file_refs: relevant files if applicable
|
|
49
|
+
- edges: connect to existing concepts where relationships exist
|
|
50
|
+
[{to: "concept-id", relation: "depends_on|implements|calls|connects_to|configured_by", description: "why"}]
|
|
51
|
+
- created_by_task: brief description of what you were doing this session
|
|
52
|
+
|
|
53
|
+
**Updated understanding** → `megamemory:update_concept`
|
|
54
|
+
- id: the concept slug
|
|
55
|
+
- changes: {summary?, why?, file_refs?, name?, kind?}
|
|
56
|
+
If an existing concept is now stale or incomplete based on what you learned,
|
|
57
|
+
update it. This is often more valuable than creating new nodes.
|
|
58
|
+
|
|
59
|
+
**New connections** → `megamemory:link`
|
|
60
|
+
- from, to: concept IDs
|
|
61
|
+
- relation: depends_on | implements | calls | connects_to | configured_by
|
|
62
|
+
- description: why this relationship exists
|
|
63
|
+
If you discovered how existing concepts relate to each other.
|
|
64
|
+
|
|
65
|
+
**Removed/replaced things** → `megamemory:remove_concept`
|
|
66
|
+
- id: concept to remove
|
|
67
|
+
- reason: why it was removed
|
|
68
|
+
If something in the graph is no longer true.
|
|
69
|
+
|
|
70
|
+
## Step 5: Verify
|
|
71
|
+
|
|
72
|
+
Call `megamemory:list_roots` again. Confirm the graph reflects your current
|
|
73
|
+
understanding. Report what you saved.
|
|
74
|
+
|
|
75
|
+
## Guidelines
|
|
76
|
+
|
|
77
|
+
- Record what a future you (with no memory of this session) would need to know.
|
|
78
|
+
- Intent and rationale ("why") are more valuable than implementation details.
|
|
79
|
+
- Update existing concepts before creating new ones — keep the graph lean.
|
|
80
|
+
- Don't record trivial things. If it's obvious from the code, skip it.
|
|
81
|
+
- Max 2 levels of nesting. Flat is better than deep.
|
|
82
|
+
- Connect concepts — isolated nodes are less useful than a connected graph.
|
|
83
|
+
- Be specific. "Handles auth" is useless. "JWT auth with RS256, validated in
|
|
84
|
+
middleware at src/middleware/auth.ts, refresh tokens in Redis with 7d TTL" is useful.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function error(msg: string): void;
|
|
2
|
+
export declare function errorBold(msg: string): void;
|
|
3
|
+
export declare function warn(msg: string): void;
|
|
4
|
+
export declare function success(msg: string): void;
|
|
5
|
+
export declare function skip(msg: string): void;
|
|
6
|
+
export declare function info(msg: string): void;
|
|
7
|
+
export declare function heading(msg: string): void;
|
|
8
|
+
export declare function ask(question: string): Promise<string>;
|
|
9
|
+
export declare function multiSelect(prompt: string, options: Array<{
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
}>): Promise<string[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Prompt the user for a port when the current one is in use.
|
|
16
|
+
* Returns the chosen port number, or null if the user wants to cancel.
|
|
17
|
+
*/
|
|
18
|
+
export declare function askPort(currentPort: number): Promise<number | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Validate a port number. Returns an error message or null if valid.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validatePort(value: unknown, rawInput?: string): string | null;
|
|
23
|
+
//# sourceMappingURL=cli-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-utils.d.ts","sourceRoot":"","sources":["../src/cli-utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzC;AAID,wBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAWrD;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,OAAO,CAAC,MAAM,EAAE,CAAC,CAmHnB;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmBzE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM7E"}
|