devsmind-mcp 1.2.1 → 2.0.0

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Abialidr
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abialidr
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
@@ -42,23 +42,28 @@ Git tells you **WHAT** changed. **DevsMind tells your AI agent WHY it changed, W
42
42
 
43
43
  ## 🛠️ Architecture: The `.devmind/` Directory
44
44
 
45
- Running `devsmind init` creates a `.devmind/` directory in your workspace. This folder contains the entire brain:
45
+ Running `devsmind init` creates a `.devmind/` directory in your workspace. This folder contains the configuration, distributed graph database, and local cache:
46
46
 
47
47
  ```
48
48
  .devmind/
49
49
  ├── config.json ← Project metadata & repository mapping (Committed to Git)
50
50
  ├── .env ← Local developer machine paths (Gitignored)
51
- └── brain.db ← SQLite database with the knowledge graph (Committed to Git)
51
+ ├── brain.db ← Metadata-only SQLite cache database (Gitignored)
52
+ ├── history/ ← Distributed change logs & code snapshots as JSON (Committed to Git)
53
+ │ └── [id].json
54
+ └── graph/ ← Distributed graph structure JSON files (Committed to Git)
55
+ └── [repo_name]/
56
+ └── [path].json
52
57
  ```
53
58
 
54
59
  ### Flexibility: Where should the brain live?
55
60
 
56
61
  DevsMind supports two deployment topologies depending on your team's workflow:
57
62
 
58
- * **Option A: Inside the workspace/project root directory (Committed to Git, shared with team)**
63
+ * **Option A: Inside the workspace/project root directory (Shared with team)**
59
64
  ```
60
65
  c:\work\my-project\
61
- ├── .devmind\ ← Brain lives inside the project root directory
66
+ ├── .devmind\ ← Config and distributed JSON database live here
62
67
  ├── backend-service\
63
68
  └── frontend-web\
64
69
  ```
@@ -134,31 +139,17 @@ Index the entire workspace upfront so the AI knows every type, schema, and API c
134
139
  You have two ways to run the upfront index:
135
140
 
136
141
  #### Option A: Background CLI Indexing (Recommended — Faster & Free)
137
- Run the indexer directly in your local terminal using a cloud model (Gemini) or a local offline model (Ollama). This uses **zero tokens** in your active IDE chat session and runs in the background.
138
-
139
- * **Using Gemini 2.5 Flash (Free Cloud Tier)**:
140
- Obtain a free API key from [Google AI Studio](https://aistudio.google.com/) and run:
141
- ```bash
142
- devsmind index --run --provider gemini --key YOUR_API_KEY
143
- ```
144
- *(The runner automatically rate-limits itself to stay within the 15 RPM free tier limits).*
145
-
146
- * **Using Local Ollama (100% Offline & Free)**:
147
- Make sure Ollama is running, pull the model (`ollama pull qwen2.5-coder`), and run:
148
- ```bash
149
- devsmind index --run --provider ollama --model qwen2.5-coder
150
- ```
151
-
152
- * **Customizing Models & Settings**:
153
- You can pass any model supported by the provider using the `--model` flag. For example:
154
- * Run with the larger, smarter cloud model:
155
- ```bash
156
- devsmind index --run --provider gemini --model gemini-2.0-pro --key YOUR_API_KEY
157
- ```
158
- * Run with a different local Ollama model (e.g. `llama3.1`):
159
- ```bash
160
- devsmind index --run --provider ollama --model llama3.1
161
- ```
142
+ Run the indexer directly in your local terminal using a background LLM provider. This runs in the background and uses **zero tokens** in your active IDE chat session.
143
+
144
+ **Example Command:**
145
+ ```bash
146
+ devsmind index --run --provider gemini --model gemini-2.5-flash --key YOUR_API_KEY
147
+ ```
148
+
149
+ **Supported Providers (`--provider`):**
150
+ * `gemini` (Default. Free tier rate-limits to stay within 15 RPM).
151
+ * `vertex` (Google Cloud Vertex AI).
152
+ * `ollama` (For local offline models, e.g. `--model qwen2.5-coder`).
162
153
 
163
154
  #### Option B: In-Chat Agent Indexing
164
155
  Tell your AI assistant inside your IDE chat:
@@ -194,17 +185,18 @@ Regardless of whether you choose Option A (CLI) or Option B (In-Chat), the follo
194
185
 
195
186
  ## 🗄️ Database Schema: `.devmind/brain.db`
196
187
 
197
- The brain is backed by a local SQLite database containing exactly three tables:
188
+ The local SQLite database (`brain.db`) acts as a metadata cache. The full database schema consists of three tables:
198
189
 
199
190
  ### 1. `nodes` (Code Entities)
200
- Contains structural identifiers. **No code snapshots live here.**
191
+ Contains structural identifiers.
201
192
  ```sql
202
193
  CREATE TABLE nodes (
203
194
  id TEXT PRIMARY KEY, -- e.g., "CartService.applyPromoCode"
204
- type TEXT, -- Taxonomy type (e.g., nest_controller, route_handler)
205
- name TEXT, -- Friendly display name
206
- file_path TEXT, -- Source file path
195
+ type TEXT NOT NULL, -- Taxonomy type (e.g., nest_controller, route_handler)
196
+ name TEXT NOT NULL, -- Friendly display name
197
+ file_path TEXT NOT NULL, -- Source file path
207
198
  signature TEXT, -- Param types & return value signature
199
+ deprecated INTEGER DEFAULT 0, -- 1 if the node has been deprecated/removed
208
200
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP
209
201
  );
210
202
  ```
@@ -219,24 +211,26 @@ CREATE TABLE node_connections (
219
211
  FOREIGN KEY (source_node_id) REFERENCES nodes (id) ON DELETE CASCADE,
220
212
  FOREIGN KEY (target_node_id) REFERENCES nodes (id) ON DELETE CASCADE
221
213
  );
222
- -- Direction: source_node USES target_node (or target_node IS USED BY source_node)
214
+ -- Direction: source_node USES target_node
223
215
  ```
224
216
 
225
217
  ### 3. `history` (AI Change Logs)
226
- Holds snapshots and the evolutionary story.
218
+ Holds metadata references to version histories.
227
219
  ```sql
228
220
  CREATE TABLE history (
229
- id TEXT PRIMARY KEY,
230
- node_id TEXT, -- Associated node
231
- session_id TEXT, -- Session key (optional)
232
- created_at DATETIME, -- When version was opened
233
- updated_at DATETIME, -- When version was last updated
234
- code_snapshot TEXT, -- Source code of this entity at this point in time
235
- reasoning TEXT, -- JSON string of AI-written history logs
221
+ id TEXT PRIMARY KEY, -- UUID of the history block
222
+ node_id TEXT NOT NULL, -- Associated node
223
+ session_id TEXT NOT NULL, -- Session key
224
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
225
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
226
+ code_snapshot TEXT NOT NULL, -- Always empty string (stored in history/[id].json)
227
+ reasoning TEXT NOT NULL, -- Always empty string (stored in history/[id].json)
236
228
  FOREIGN KEY (node_id) REFERENCES nodes (id) ON DELETE CASCADE
237
229
  );
238
230
  ```
239
231
  > ⏱️ **Session Boundary Rule**: If the AI updates a function, it checks the last history log. If `updated_at` is less than **1 hour ago**, it updates the snapshot and reasoning in-place (same session). If older than 1 hour, it inserts a new history record (new session).
232
+ >
233
+ > 💾 **JSON Storage Note**: In version 2.0.0, the actual code snapshots and AI change reasonings are stored in `.devmind/history/[id].json` to resolve Git merge conflicts, while the SQLite database holds empty strings for `code_snapshot` and `reasoning`.
240
234
 
241
235
  ---
242
236
 
@@ -305,16 +299,30 @@ By placing `.devmind/config.json` and `.devmind/brain.db` in Git, you share the
305
299
 
306
300
  ### Joining a Project
307
301
  When a new developer joins your team, they onboard instantly:
308
- 1. Clone the project repository (which contains the `.devmind/` folder and `brain.db`).
302
+ 1. Clone the project repository (which contains `.devmind/config.json`, `.devmind/history/`, and `.devmind/graph/`).
309
303
  2. Install the package globally: `npm install -g devsmind-mcp`
310
- 3. Create their local `.devmind/.env` from `.devmind/.env.example` and update their machine paths.
311
- 4. Add the Workspace Rule to their IDE configuration.
312
- 5. Launch: `devsmind start`
304
+ 3. Initialize the local environment and generate local cache database by running: `devsmind init`
305
+ 4. Copy the workspace rule printed by `devsmind rule` into their IDE configuration rules.
306
+ 5. Launch the server: `devsmind start` (this automatically syncs and reconstructs the SQLite database cache from the local JSON files on startup).
313
307
 
314
308
  The new developer's AI agent now possesses the full architectural context and decision history of your senior team.
315
309
 
316
310
  ---
317
311
 
312
+ ## Changelog
313
+
314
+ ### Version 2.0.0 (Current Breaking Release)
315
+ * **Git-Friendly Distributed JSON Storage**: Solved Git binary merge conflicts by moving all massive code snapshots and reasoning logs to `.devmind/history/[id].json` and graph structures to `.devmind/graph/[repo_name]/[path].json`. This replaces the monolithic `brain.db` database storage completely.
316
+ * **Metadata-Only SQLite Cache**: Compacted the local SQLite database (`brain.db`) to store only structural metadata. Wiped all heavy text blobs, and added `brain.db` to `.gitignore`.
317
+ * **Auto-Sync & Reconstruction**: Added startup auto-sync. The database constructor automatically reconstructs your entire local SQLite database from the disk JSONs in less than 2 seconds on startup.
318
+ * **Env-Mapped Repo-Relative Paths**: Resolved cross-drive crashes and folder escape issues on Windows. Replaced relative dot paths in JSONs with clean repo placeholders (`{repo_name}/relativePath`) which are resolved dynamically using absolute paths configured in your local `.env` file.
319
+ * **Safe Import Transaction Toggles**: Disables foreign key checks during bulk syncing (`syncFromDisk()`) and edge connections (`addConnection()`) to prevent race conditions during out-of-order indexing.
320
+
321
+ ### Version 1.2.2
322
+ * **Node.js v24 LTS & npm Dependency Conflict Resolution**: Fixed native compilation conflicts (like `better-sqlite3` and `node-gyp` errors) that crashed on Node v24, ensuring DevsMind builds and installs out-of-the-box on both Node v22 and Node v24 environments.
323
+
324
+ ---
325
+
318
326
  ## 📄 License
319
327
 
320
328
  DevsMind is released under the [MIT License](LICENSE).