aifastdb-devplan 1.0.0 → 1.0.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/README.md +669 -40
- package/dist/dev-plan-document-store.d.ts +309 -0
- package/dist/dev-plan-document-store.d.ts.map +1 -0
- package/dist/dev-plan-document-store.js +1543 -0
- package/dist/dev-plan-document-store.js.map +1 -0
- package/dist/dev-plan-factory.d.ts +49 -0
- package/dist/dev-plan-factory.d.ts.map +1 -0
- package/dist/dev-plan-factory.js +218 -0
- package/dist/dev-plan-factory.js.map +1 -0
- package/dist/dev-plan-graph-store.d.ts +114 -0
- package/dist/dev-plan-graph-store.d.ts.map +1 -0
- package/dist/dev-plan-graph-store.js +1073 -0
- package/dist/dev-plan-graph-store.js.map +1 -0
- package/dist/dev-plan-interface.d.ts +165 -0
- package/dist/dev-plan-interface.d.ts.map +1 -0
- package/dist/dev-plan-interface.js +10 -0
- package/dist/dev-plan-interface.js.map +1 -0
- package/dist/dev-plan-migrate.d.ts +52 -0
- package/dist/dev-plan-migrate.d.ts.map +1 -0
- package/dist/dev-plan-migrate.js +407 -0
- package/dist/dev-plan-migrate.js.map +1 -0
- package/dist/index.d.ts +20 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/index.d.ts +1 -0
- package/dist/mcp-server/index.d.ts.map +1 -1
- package/dist/mcp-server/index.js +304 -92
- package/dist/mcp-server/index.js.map +1 -1
- package/dist/types.d.ts +375 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +37 -0
- package/dist/types.js.map +1 -0
- package/dist/visualize/server.d.ts +18 -0
- package/dist/visualize/server.d.ts.map +1 -0
- package/dist/visualize/server.js +229 -0
- package/dist/visualize/server.js.map +1 -0
- package/dist/visualize/template.d.ts +8 -0
- package/dist/visualize/template.d.ts.map +1 -0
- package/dist/visualize/template.js +528 -0
- package/dist/visualize/template.js.map +1 -0
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -1,27 +1,433 @@
|
|
|
1
1
|
# aifastdb-devplan
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>AI-Powered Development Plan Management — MCP Server</strong>
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/aifastdb-devplan"><img src="https://img.shields.io/npm/v/aifastdb-devplan.svg" alt="npm version"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/aifastdb-devplan"><img src="https://img.shields.io/npm/dm/aifastdb-devplan.svg" alt="npm downloads"></a>
|
|
10
|
+
<a href="https://github.com/aifastdb/aifastdb-devplan/blob/main/LICENSE"><img src="https://img.shields.io/github/license/aifastdb/aifastdb-devplan" alt="license"></a>
|
|
11
|
+
<a href="https://github.com/aifastdb/aifastdb-devplan"><img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen" alt="node version"></a>
|
|
12
|
+
</p>
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
- **自动进度统计**:完成子任务时自动更新主任务进度
|
|
12
|
-
- **Markdown 导出**:生成开发计划的 Markdown 文档
|
|
14
|
+
<p align="center">
|
|
15
|
+
Let AI assistants (Cursor / Claude Desktop) manage your development plans, task tracking, and project documentation.<br/>
|
|
16
|
+
Built on the <a href="https://github.com/aifastdb/aifastdb">aifastdb</a> high-performance storage engine, seamlessly integrated with AI via the <a href="https://modelcontextprotocol.io">MCP protocol</a>.
|
|
17
|
+
</p>
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
<p align="center">
|
|
20
|
+
让 AI 助手(Cursor / Claude Desktop)直接管理你的开发计划、任务追踪和项目文档。<br/>
|
|
21
|
+
基于 <a href="https://github.com/aifastdb/aifastdb">aifastdb</a> 高性能存储引擎,通过 <a href="https://modelcontextprotocol.io">MCP 协议</a> 与 AI 无缝集成。
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<a href="#english">English</a> | <a href="#中文">中文</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<a id="english"></a>
|
|
31
|
+
|
|
32
|
+
## English
|
|
33
|
+
|
|
34
|
+
### Why aifastdb-devplan?
|
|
35
|
+
|
|
36
|
+
In the age of AI-assisted programming, developers collaborate with AI assistants more closely than ever. However, AI assistants lack **persistent project memory** — each conversation starts from scratch, with no knowledge of the overall project plan, current progress, or historical decisions.
|
|
37
|
+
|
|
38
|
+
**aifastdb-devplan** solves this problem by providing AI assistants with a set of **structured development plan management tools**, enabling AI to:
|
|
39
|
+
|
|
40
|
+
- 📋 **Understand the big picture** — Read project overviews, technical designs, API specifications, and more
|
|
41
|
+
- 🎯 **Track task progress** — Manage two-level task hierarchies (MainTask → SubTask) with real-time progress updates
|
|
42
|
+
- 🔗 **Anchor to Git history** — Automatically record Git commit hashes when completing tasks, with rollback detection
|
|
43
|
+
- 📦 **Modular management** — Organize tasks and docs by feature modules for a clear project architecture view
|
|
44
|
+
- 📄 **Export documentation** — Generate complete Markdown-formatted development plan documents in one click
|
|
45
|
+
|
|
46
|
+
### Key Features
|
|
47
|
+
|
|
48
|
+
| Feature | Description |
|
|
49
|
+
|---------|-------------|
|
|
50
|
+
| **Dual Storage Engine** | Choose between `graph` (SocialGraphV2, default) or `document` (JSONL) per project |
|
|
51
|
+
| **Graph Visualization** | Built-in HTTP server + vis-network page to visualize tasks/modules as an interactive graph |
|
|
52
|
+
| **11 Document Section Types** | overview, requirements, api_design, technical_notes, architecture, and more |
|
|
53
|
+
| **Two-Level Task Hierarchy** | MainTask + SubTask with priority levels (P0–P3) and status transitions |
|
|
54
|
+
| **Module Registry** | Aggregate tasks and docs by module for intuitive project architecture |
|
|
55
|
+
| **Git Commit Anchoring** | Auto-record commit hash on task completion; `sync_git` detects rollbacks |
|
|
56
|
+
| **Auto Progress Tracking** | Automatically update parent task progress when subtasks are completed |
|
|
57
|
+
| **Idempotent Task Import** | `upsert_task` prevents duplicates, ideal for batch initialization |
|
|
58
|
+
| **Data Migration** | Seamlessly migrate between `document` and `graph` engines with backup support |
|
|
59
|
+
| **Markdown Export** | Generate structured development plan documents for sharing and archiving |
|
|
60
|
+
| **Zero-Config Storage** | Local storage in the project's `.devplan/` directory — no external database needed |
|
|
61
|
+
|
|
62
|
+
### Quick Start
|
|
63
|
+
|
|
64
|
+
#### Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install -g aifastdb-devplan
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Option A: As an MCP Server (Recommended)
|
|
71
|
+
|
|
72
|
+
Configure in Cursor IDE (`.cursor/mcp.json`):
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"mcpServers": {
|
|
77
|
+
"aifastdb-devplan": {
|
|
78
|
+
"command": "npx",
|
|
79
|
+
"args": ["aifastdb-devplan"]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Or in Claude Desktop (`claude_desktop_config.json`):
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"aifastdb-devplan": {
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": ["aifastdb-devplan"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Once configured, your AI assistant can use 20 `devplan_*` tools to manage your development plans.
|
|
99
|
+
|
|
100
|
+
#### Option B: As an npm Package (Programmatic)
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { DevPlanStore, createDevPlan } from 'aifastdb-devplan';
|
|
104
|
+
|
|
105
|
+
const plan = createDevPlan('my-project');
|
|
106
|
+
|
|
107
|
+
// Create a main task
|
|
108
|
+
plan.createMainTask({
|
|
109
|
+
projectName: 'my-project',
|
|
110
|
+
taskId: 'phase-1',
|
|
111
|
+
title: 'Phase 1: Foundation Setup',
|
|
112
|
+
priority: 'P0',
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Add a subtask
|
|
116
|
+
plan.addSubTask({
|
|
117
|
+
projectName: 'my-project',
|
|
118
|
+
taskId: 'T1.1',
|
|
119
|
+
parentTaskId: 'phase-1',
|
|
120
|
+
title: 'Initialize project structure',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Complete task (auto-updates progress + Git commit anchoring)
|
|
124
|
+
plan.completeSubTask('T1.1');
|
|
125
|
+
|
|
126
|
+
// Check progress
|
|
127
|
+
const progress = plan.getProgress();
|
|
128
|
+
console.log(progress);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### MCP Tools (20 total)
|
|
132
|
+
|
|
133
|
+
#### 📋 Document Management
|
|
134
|
+
|
|
135
|
+
| Tool | Description |
|
|
136
|
+
|------|-------------|
|
|
137
|
+
| `devplan_init` | Initialize a development plan (auto-detects storage engine) |
|
|
138
|
+
| `devplan_save_section` | Save/update a document section (11 standard types) |
|
|
139
|
+
| `devplan_get_section` | Read a specific document section |
|
|
140
|
+
| `devplan_list_sections` | List all document sections |
|
|
141
|
+
|
|
142
|
+
#### 🎯 Task Management
|
|
143
|
+
|
|
144
|
+
| Tool | Description |
|
|
145
|
+
|------|-------------|
|
|
146
|
+
| `devplan_create_main_task` | Create a main task (priority P0–P3) |
|
|
147
|
+
| `devplan_add_sub_task` | Add a subtask to a main task |
|
|
148
|
+
| `devplan_upsert_task` | Idempotent task import (deduplication) |
|
|
149
|
+
| `devplan_complete_task` | Complete a task (auto-updates progress + Git anchoring) |
|
|
150
|
+
| `devplan_list_tasks` | List tasks (filter by status/priority/parent) |
|
|
151
|
+
| `devplan_get_progress` | Get overall project progress |
|
|
152
|
+
|
|
153
|
+
#### 📦 Module Management
|
|
154
|
+
|
|
155
|
+
| Tool | Description |
|
|
156
|
+
|------|-------------|
|
|
157
|
+
| `devplan_create_module` | Create a feature module |
|
|
158
|
+
| `devplan_list_modules` | List all feature modules |
|
|
159
|
+
| `devplan_get_module` | Get module details (linked tasks and docs) |
|
|
160
|
+
| `devplan_update_module` | Update module information |
|
|
161
|
+
|
|
162
|
+
#### 🔧 Utilities
|
|
163
|
+
|
|
164
|
+
| Tool | Description |
|
|
165
|
+
|------|-------------|
|
|
166
|
+
| `devplan_export_markdown` | Export full Markdown development plan |
|
|
167
|
+
| `devplan_export_graph` | Export graph structure `{ nodes, edges }` for visualization (graph engine only) |
|
|
168
|
+
| `devplan_migrate_engine` | Migrate data between `document` and `graph` engines |
|
|
169
|
+
| `devplan_sync_git` | Sync Git history and detect rollbacks |
|
|
170
|
+
| `devplan_start_visual` | Start the graph visualization HTTP server and open browser |
|
|
171
|
+
|
|
172
|
+
### Dual Storage Engine
|
|
173
|
+
|
|
174
|
+
Each project can independently choose its storage engine:
|
|
175
|
+
|
|
176
|
+
| Engine | Backend | Default | Features |
|
|
177
|
+
|--------|---------|---------|----------|
|
|
178
|
+
| `graph` | SocialGraphV2 (WAL + sharding) | ✅ New projects | Graph visualization, entity-relation model |
|
|
179
|
+
| `document` | EnhancedDocumentStore (JSONL) | Auto-detected for legacy | Lightweight, human-readable files |
|
|
180
|
+
|
|
181
|
+
Engine selection priority:
|
|
182
|
+
1. Explicit `engine` parameter in `createDevPlan()`
|
|
183
|
+
2. `.devplan/{project}/engine.json` configuration
|
|
184
|
+
3. Auto-detect existing JSONL files → `document`
|
|
185
|
+
4. New projects → `graph`
|
|
186
|
+
|
|
187
|
+
### Graph Visualization
|
|
188
|
+
|
|
189
|
+
Visualize your development plan as an interactive graph:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm run visualize -- --project my-project --base-path /path/to/.devplan
|
|
193
|
+
# or
|
|
194
|
+
aifastdb-devplan-visual --project my-project --port 3210
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The built-in HTTP server serves a self-contained HTML page with [vis-network](https://visjs.github.io/vis-network/), featuring:
|
|
198
|
+
|
|
199
|
+
- **5 node types**: project (star), module (diamond), main-task (circle), sub-task (dot), document (box)
|
|
200
|
+
- **Status-based coloring**: completed (green), in-progress (blue), pending (gray)
|
|
201
|
+
- **Interactive features**: click for details panel, filter by type, stats bar with progress
|
|
202
|
+
- **Dark theme**: consistent with modern development tools
|
|
203
|
+
|
|
204
|
+
### Enable DevPlan in Other Projects (Step-by-Step Guide)
|
|
205
|
+
|
|
206
|
+
Here's a complete guide to enable devplan in any project (e.g., `my-app`).
|
|
207
|
+
|
|
208
|
+
#### Method 1: npm Published Version (Recommended)
|
|
209
|
+
|
|
210
|
+
**Step 1: Install globally**
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
npm install -g aifastdb-devplan
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Step 2: Configure MCP Server in your project**
|
|
217
|
+
|
|
218
|
+
Create `.cursor/mcp.json` in your project root:
|
|
219
|
+
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"mcpServers": {
|
|
223
|
+
"aifastdb-devplan": {
|
|
224
|
+
"command": "npx",
|
|
225
|
+
"args": ["aifastdb-devplan"]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Step 3: Start using with AI assistant**
|
|
232
|
+
|
|
233
|
+
Open Cursor in your project directory and tell the AI:
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
Initialize a development plan for my-app project
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The AI will call `devplan_init` and data will be stored in `.devplan/my-app/` under your project root (auto-detected via `.git` or `package.json`).
|
|
240
|
+
|
|
241
|
+
#### Method 2: Local Development Version
|
|
242
|
+
|
|
243
|
+
If you're working with a local clone of `aifastdb-devplan` (not yet published or testing changes):
|
|
244
|
+
|
|
245
|
+
**Step 1: Build locally**
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
cd /path/to/aifastdb-devplan
|
|
249
|
+
npm install
|
|
250
|
+
npm run build
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Step 2: Configure MCP Server with local path**
|
|
254
|
+
|
|
255
|
+
Create `.cursor/mcp.json` in your target project:
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"mcpServers": {
|
|
260
|
+
"aifastdb-devplan": {
|
|
261
|
+
"command": "node",
|
|
262
|
+
"args": ["/path/to/aifastdb-devplan/dist/mcp-server/index.js"]
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Windows example:
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"mcpServers": {
|
|
273
|
+
"aifastdb-devplan": {
|
|
274
|
+
"command": "node",
|
|
275
|
+
"args": ["D:/Project/git/aifastdb-devplan/dist/mcp-server/index.js"]
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
#### Controlling Data Storage Location
|
|
282
|
+
|
|
283
|
+
By default, devplan auto-detects your project root and stores data in `.devplan/`. You can override this:
|
|
284
|
+
|
|
285
|
+
**Option A: Environment variable (global override)**
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# All devplan data will be stored under this path
|
|
289
|
+
export AIFASTDB_DEVPLAN_PATH=/path/to/shared/devplans
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Option B: `--base-path` for visualization server**
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# View another project's devplan graph
|
|
296
|
+
aifastdb-devplan-visual --project my-app --base-path /path/to/my-app/.devplan --port 3210
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### `--base-path` Parameter Details
|
|
300
|
+
|
|
301
|
+
| Parameter | Description | Default |
|
|
302
|
+
|-----------|-------------|---------|
|
|
303
|
+
| `--project` | Project name (must match the name used in `devplan_init`) | **Required** |
|
|
304
|
+
| `--base-path` | Absolute path to the `.devplan` directory | Auto-detect via `.git` / `package.json`, fallback to `~/.aifastdb/dev-plans/` |
|
|
305
|
+
| `--port` | HTTP server port | `3210` |
|
|
306
|
+
|
|
307
|
+
**Data directory structure** under `--base-path`:
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
<base-path>/
|
|
311
|
+
└── <project-name>/
|
|
312
|
+
├── engine.json # Engine config
|
|
313
|
+
├── graph-data/ # Graph engine data (WAL shards)
|
|
314
|
+
├── documents.jsonl # Document engine data
|
|
315
|
+
├── tasks.jsonl
|
|
316
|
+
└── modules.jsonl
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### Complete Example: Managing "my-app" from Scratch
|
|
15
320
|
|
|
16
321
|
```bash
|
|
17
|
-
|
|
322
|
+
# 1. Install devplan globally
|
|
323
|
+
npm install -g aifastdb-devplan
|
|
324
|
+
|
|
325
|
+
# 2. Go to your project
|
|
326
|
+
cd /path/to/my-app
|
|
327
|
+
|
|
328
|
+
# 3. Create MCP config
|
|
329
|
+
mkdir -p .cursor
|
|
330
|
+
echo '{"mcpServers":{"aifastdb-devplan":{"command":"npx","args":["aifastdb-devplan"]}}}' > .cursor/mcp.json
|
|
331
|
+
|
|
332
|
+
# 4. Open in Cursor and tell AI:
|
|
333
|
+
# "Initialize devplan for my-app, create Phase 1 with 3 subtasks"
|
|
334
|
+
|
|
335
|
+
# 5. Visualize the plan graph
|
|
336
|
+
npx aifastdb-devplan-visual --project my-app --base-path .devplan --port 3210
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Data Storage
|
|
340
|
+
|
|
341
|
+
Data is stored locally — **no external database required**:
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
.devplan/{projectName}/
|
|
345
|
+
├── engine.json # Engine configuration (graph or document)
|
|
346
|
+
├── documents.jsonl # Document sections (document engine)
|
|
347
|
+
├── tasks.jsonl # Main tasks + subtasks (document engine)
|
|
348
|
+
├── modules.jsonl # Feature modules (document engine)
|
|
349
|
+
└── graph-data/ # WAL-based graph storage (graph engine)
|
|
350
|
+
└── wal/ # Write-ahead log shards
|
|
18
351
|
```
|
|
19
352
|
|
|
20
|
-
|
|
353
|
+
Storage path resolution priority:
|
|
354
|
+
|
|
355
|
+
| Priority | Source | Description |
|
|
356
|
+
|----------|--------|-------------|
|
|
357
|
+
| 1 | `AIFASTDB_DEVPLAN_PATH` env var | Explicitly specify storage directory |
|
|
358
|
+
| 2 | `.devplan/` in project root | Auto-detect via `.git` / `package.json` |
|
|
359
|
+
| 3 | `~/.aifastdb/dev-plans/` | Global fallback path |
|
|
360
|
+
|
|
361
|
+
### Platform Support
|
|
362
|
+
|
|
363
|
+
`aifastdb-devplan` is a pure TypeScript/JavaScript project, supporting all platforms with Node.js ≥ 18:
|
|
364
|
+
|
|
365
|
+
| Platform | Architecture | Supported |
|
|
366
|
+
|----------|-------------|-----------|
|
|
367
|
+
| Windows | x64 | ✅ |
|
|
368
|
+
| macOS | x64 / Apple Silicon (M1/M2/M3/M4) | ✅ |
|
|
369
|
+
| Linux | x64 / ARM64 | ✅ |
|
|
370
|
+
|
|
371
|
+
> Note: The underlying storage engine [aifastdb](https://github.com/aifastdb/aifastdb) includes Rust native bindings with prebuilt binaries for all listed platforms.
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
<a id="中文"></a>
|
|
376
|
+
|
|
377
|
+
## 中文
|
|
378
|
+
|
|
379
|
+
### 为什么需要 aifastdb-devplan?
|
|
380
|
+
|
|
381
|
+
在 AI 辅助编程时代,开发者与 AI 助手的协作越来越密切。但 AI 助手缺乏**持久化的项目记忆**——每次对话都从零开始,无法了解项目的整体规划、当前进度和历史决策。
|
|
21
382
|
|
|
22
|
-
|
|
383
|
+
**aifastdb-devplan** 解决了这个问题:它为 AI 助手提供了一套**结构化的开发计划管理工具**,让 AI 能够:
|
|
384
|
+
|
|
385
|
+
- 📋 **了解项目全貌** — 读取项目概述、技术方案、API 设计等文档片段
|
|
386
|
+
- 🎯 **追踪任务进度** — 管理两级任务层级(主任务 → 子任务),实时更新进度
|
|
387
|
+
- 🔗 **锚定 Git 历史** — 完成任务时自动记录 Git commit hash,支持回滚检测
|
|
388
|
+
- 📦 **模块化管理** — 按功能模块组织任务和文档,清晰展示项目架构
|
|
389
|
+
- 📄 **导出文档** — 一键生成完整的 Markdown 格式开发计划文档
|
|
390
|
+
|
|
391
|
+
### 核心特性
|
|
392
|
+
|
|
393
|
+
| 特性 | 说明 |
|
|
394
|
+
|------|------|
|
|
395
|
+
| **双存储引擎** | 每个项目可独立选择 `graph`(SocialGraphV2,默认)或 `document`(JSONL)引擎 |
|
|
396
|
+
| **图谱可视化** | 内置 HTTP 服务器 + vis-network 页面,将任务/模块以交互式图谱展示 |
|
|
397
|
+
| **11 种文档片段** | overview, requirements, api_design, technical_notes, architecture 等标准类型 |
|
|
398
|
+
| **两级任务层级** | 主任务 (MainTask) + 子任务 (SubTask),支持优先级 (P0-P3) 和状态流转 |
|
|
399
|
+
| **功能模块注册表** | 按模块维度聚合任务和文档,直观展示项目架构 |
|
|
400
|
+
| **Git Commit 锚定** | 完成任务时自动记录 commit hash,`sync_git` 可检测代码回滚 |
|
|
401
|
+
| **自动进度统计** | 完成子任务时自动更新主任务进度百分比 |
|
|
402
|
+
| **幂等任务导入** | `upsert_task` 支持防重复导入,适合批量初始化 |
|
|
403
|
+
| **数据迁移** | 在 `document` 和 `graph` 引擎间无缝迁移,支持备份 |
|
|
404
|
+
| **Markdown 导出** | 生成结构化的开发计划文档,方便分享和归档 |
|
|
405
|
+
| **零配置存储** | 本地存储,数据保存在项目 `.devplan/` 目录中,无需外部数据库 |
|
|
406
|
+
|
|
407
|
+
### 快速开始
|
|
408
|
+
|
|
409
|
+
#### 安装
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
npm install -g aifastdb-devplan
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
#### 方式 A:作为 MCP Server 使用(推荐)
|
|
416
|
+
|
|
417
|
+
在 Cursor IDE 中配置 `.cursor/mcp.json`:
|
|
418
|
+
|
|
419
|
+
```json
|
|
420
|
+
{
|
|
421
|
+
"mcpServers": {
|
|
422
|
+
"aifastdb-devplan": {
|
|
423
|
+
"command": "npx",
|
|
424
|
+
"args": ["aifastdb-devplan"]
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
```
|
|
23
429
|
|
|
24
|
-
|
|
430
|
+
或在 Claude Desktop 中配置 `claude_desktop_config.json`:
|
|
25
431
|
|
|
26
432
|
```json
|
|
27
433
|
{
|
|
@@ -34,7 +440,9 @@ npm install aifastdb-devplan
|
|
|
34
440
|
}
|
|
35
441
|
```
|
|
36
442
|
|
|
37
|
-
|
|
443
|
+
配置完成后,AI 助手即可使用 20 个 `devplan_*` 工具来管理你的开发计划。
|
|
444
|
+
|
|
445
|
+
#### 方式 B:作为 npm 包编程使用
|
|
38
446
|
|
|
39
447
|
```typescript
|
|
40
448
|
import { DevPlanStore, createDevPlan } from 'aifastdb-devplan';
|
|
@@ -65,48 +473,269 @@ const progress = plan.getProgress();
|
|
|
65
473
|
console.log(progress);
|
|
66
474
|
```
|
|
67
475
|
|
|
68
|
-
|
|
476
|
+
### MCP 工具一览(20 个)
|
|
477
|
+
|
|
478
|
+
#### 📋 文档管理
|
|
69
479
|
|
|
70
480
|
| 工具 | 说明 |
|
|
71
481
|
|------|------|
|
|
72
|
-
| `devplan_init` |
|
|
73
|
-
| `devplan_save_section` |
|
|
74
|
-
| `devplan_get_section` |
|
|
482
|
+
| `devplan_init` | 初始化开发计划(自动检测存储引擎) |
|
|
483
|
+
| `devplan_save_section` | 保存/更新文档片段(11 种标准类型) |
|
|
484
|
+
| `devplan_get_section` | 读取指定文档片段 |
|
|
75
485
|
| `devplan_list_sections` | 列出所有文档片段 |
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
486
|
+
|
|
487
|
+
#### 🎯 任务管理
|
|
488
|
+
|
|
489
|
+
| 工具 | 说明 |
|
|
490
|
+
|------|------|
|
|
491
|
+
| `devplan_create_main_task` | 创建主任务(支持优先级 P0-P3) |
|
|
492
|
+
| `devplan_add_sub_task` | 添加子任务到主任务 |
|
|
493
|
+
| `devplan_upsert_task` | 幂等导入任务(防重复,适合批量初始化) |
|
|
494
|
+
| `devplan_complete_task` | 完成任务(自动更新进度 + Git 锚定) |
|
|
495
|
+
| `devplan_list_tasks` | 列出任务(支持按状态/优先级/主任务筛选) |
|
|
496
|
+
| `devplan_get_progress` | 获取项目整体进度概览 |
|
|
497
|
+
|
|
498
|
+
#### 📦 模块管理
|
|
499
|
+
|
|
500
|
+
| 工具 | 说明 |
|
|
501
|
+
|------|------|
|
|
84
502
|
| `devplan_create_module` | 创建功能模块 |
|
|
85
|
-
| `devplan_list_modules` |
|
|
86
|
-
| `devplan_get_module` |
|
|
503
|
+
| `devplan_list_modules` | 列出所有功能模块 |
|
|
504
|
+
| `devplan_get_module` | 获取模块详情(关联任务和文档) |
|
|
87
505
|
| `devplan_update_module` | 更新模块信息 |
|
|
88
506
|
|
|
89
|
-
|
|
507
|
+
#### 🔧 工具
|
|
508
|
+
|
|
509
|
+
| 工具 | 说明 |
|
|
510
|
+
|------|------|
|
|
511
|
+
| `devplan_export_markdown` | 导出完整 Markdown 格式开发计划 |
|
|
512
|
+
| `devplan_export_graph` | 导出图结构 `{ nodes, edges }` 用于可视化(仅 graph 引擎) |
|
|
513
|
+
| `devplan_migrate_engine` | 在 `document` 和 `graph` 引擎间迁移数据 |
|
|
514
|
+
| `devplan_sync_git` | 同步 Git 历史,检测代码回滚 |
|
|
515
|
+
| `devplan_start_visual` | 启动图谱可视化 HTTP 服务器并自动打开浏览器 |
|
|
516
|
+
|
|
517
|
+
### 双存储引擎
|
|
518
|
+
|
|
519
|
+
每个项目可独立选择存储引擎:
|
|
520
|
+
|
|
521
|
+
| 引擎 | 后端 | 默认 | 特点 |
|
|
522
|
+
|------|------|------|------|
|
|
523
|
+
| `graph` | SocialGraphV2(WAL + 分片) | ✅ 新项目 | 图可视化、实体-关系模型 |
|
|
524
|
+
| `document` | EnhancedDocumentStore(JSONL) | 旧项目自动检测 | 轻量、文件可读 |
|
|
525
|
+
|
|
526
|
+
引擎选择优先级:
|
|
527
|
+
1. `createDevPlan()` 显式传入 `engine` 参数
|
|
528
|
+
2. `.devplan/{project}/engine.json` 配置文件
|
|
529
|
+
3. 已有 JSONL 数据文件 → 自动识别为 `document`
|
|
530
|
+
4. 新项目 → 默认使用 `graph`
|
|
90
531
|
|
|
91
|
-
|
|
532
|
+
### 图谱可视化
|
|
533
|
+
|
|
534
|
+
将开发计划以交互式图谱形式展示:
|
|
535
|
+
|
|
536
|
+
```bash
|
|
537
|
+
npm run visualize -- --project my-project --base-path /path/to/.devplan
|
|
538
|
+
# 或
|
|
539
|
+
aifastdb-devplan-visual --project my-project --port 3210
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
内置 HTTP 服务器提供自包含 HTML 页面,使用 [vis-network](https://visjs.github.io/vis-network/) 渲染:
|
|
543
|
+
|
|
544
|
+
- **5 种节点类型**:项目(星形)、模块(菱形)、主任务(圆形)、子任务(小圆点)、文档(方形)
|
|
545
|
+
- **状态着色**:已完成(绿色)、进行中(蓝色)、待开始(灰色)
|
|
546
|
+
- **交互功能**:点击查看详情面板、按类型过滤、顶部统计栏 + 进度条
|
|
547
|
+
- **暗色主题**:与现代开发工具风格一致
|
|
548
|
+
|
|
549
|
+
### 在其它项目中启用 DevPlan(实战指南)
|
|
550
|
+
|
|
551
|
+
以下是在任意项目(例如 `my-app`)中启用 devplan 的完整步骤。
|
|
552
|
+
|
|
553
|
+
#### 方式一:使用 npm 发布版本(推荐)
|
|
554
|
+
|
|
555
|
+
**第 1 步:全局安装**
|
|
556
|
+
|
|
557
|
+
```bash
|
|
558
|
+
npm install -g aifastdb-devplan
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
**第 2 步:在目标项目中配置 MCP Server**
|
|
562
|
+
|
|
563
|
+
在项目根目录创建 `.cursor/mcp.json`:
|
|
564
|
+
|
|
565
|
+
```json
|
|
566
|
+
{
|
|
567
|
+
"mcpServers": {
|
|
568
|
+
"aifastdb-devplan": {
|
|
569
|
+
"command": "npx",
|
|
570
|
+
"args": ["aifastdb-devplan"]
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
**第 3 步:通过 AI 助手开始使用**
|
|
577
|
+
|
|
578
|
+
在 Cursor 中打开你的项目目录,对 AI 说:
|
|
579
|
+
|
|
580
|
+
```
|
|
581
|
+
为 my-app 项目初始化开发计划
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
AI 会调用 `devplan_init`,数据自动存储在项目根目录下的 `.devplan/my-app/` 中(通过 `.git` 或 `package.json` 自动检测项目根目录)。
|
|
585
|
+
|
|
586
|
+
#### 方式二:使用本地开发版本
|
|
587
|
+
|
|
588
|
+
如果你在使用本地克隆的 `aifastdb-devplan`(未发布到 npm 或正在测试修改):
|
|
589
|
+
|
|
590
|
+
**第 1 步:本地构建**
|
|
591
|
+
|
|
592
|
+
```bash
|
|
593
|
+
cd /path/to/aifastdb-devplan
|
|
594
|
+
npm install
|
|
595
|
+
npm run build
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
**第 2 步:使用本地路径配置 MCP Server**
|
|
599
|
+
|
|
600
|
+
在目标项目中创建 `.cursor/mcp.json`:
|
|
601
|
+
|
|
602
|
+
```json
|
|
603
|
+
{
|
|
604
|
+
"mcpServers": {
|
|
605
|
+
"aifastdb-devplan": {
|
|
606
|
+
"command": "node",
|
|
607
|
+
"args": ["/path/to/aifastdb-devplan/dist/mcp-server/index.js"]
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Windows 示例:
|
|
614
|
+
|
|
615
|
+
```json
|
|
616
|
+
{
|
|
617
|
+
"mcpServers": {
|
|
618
|
+
"aifastdb-devplan": {
|
|
619
|
+
"command": "node",
|
|
620
|
+
"args": ["D:/Project/git/aifastdb-devplan/dist/mcp-server/index.js"]
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
#### 控制数据存储位置
|
|
627
|
+
|
|
628
|
+
默认情况下,devplan 会自动检测项目根目录并将数据存储在 `.devplan/` 下。你可以通过以下方式覆盖:
|
|
629
|
+
|
|
630
|
+
**方案 A:环境变量(全局覆盖)**
|
|
631
|
+
|
|
632
|
+
```bash
|
|
633
|
+
# 所有 devplan 数据将存储在此路径下
|
|
634
|
+
export AIFASTDB_DEVPLAN_PATH=/path/to/shared/devplans
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
Windows PowerShell:
|
|
638
|
+
|
|
639
|
+
```powershell
|
|
640
|
+
$env:AIFASTDB_DEVPLAN_PATH = "D:\shared\devplans"
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
**方案 B:可视化服务器使用 `--base-path`**
|
|
644
|
+
|
|
645
|
+
```bash
|
|
646
|
+
# 查看另一个项目的 devplan 图谱
|
|
647
|
+
aifastdb-devplan-visual --project my-app --base-path /path/to/my-app/.devplan --port 3210
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
#### `--base-path` 参数详解
|
|
651
|
+
|
|
652
|
+
| 参数 | 说明 | 默认值 |
|
|
653
|
+
|------|------|--------|
|
|
654
|
+
| `--project` | 项目名称(必须与 `devplan_init` 时使用的名称一致) | **必填** |
|
|
655
|
+
| `--base-path` | `.devplan` 目录的绝对路径 | 自动检测(通过 `.git` / `package.json`),兜底 `~/.aifastdb/dev-plans/` |
|
|
656
|
+
| `--port` | HTTP 服务器端口 | `3210` |
|
|
657
|
+
|
|
658
|
+
**`--base-path` 下的数据目录结构**:
|
|
659
|
+
|
|
660
|
+
```
|
|
661
|
+
<base-path>/
|
|
662
|
+
└── <project-name>/
|
|
663
|
+
├── engine.json # 引擎配置
|
|
664
|
+
├── graph-data/ # Graph 引擎数据(WAL 分片)
|
|
665
|
+
├── documents.jsonl # Document 引擎数据
|
|
666
|
+
├── tasks.jsonl
|
|
667
|
+
└── modules.jsonl
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
#### 完整示例:从零管理 "my-app" 项目
|
|
671
|
+
|
|
672
|
+
```bash
|
|
673
|
+
# 1. 全局安装 devplan
|
|
674
|
+
npm install -g aifastdb-devplan
|
|
675
|
+
|
|
676
|
+
# 2. 进入你的项目目录
|
|
677
|
+
cd /path/to/my-app
|
|
678
|
+
|
|
679
|
+
# 3. 创建 MCP 配置
|
|
680
|
+
mkdir -p .cursor
|
|
681
|
+
echo '{"mcpServers":{"aifastdb-devplan":{"command":"npx","args":["aifastdb-devplan"]}}}' > .cursor/mcp.json
|
|
682
|
+
|
|
683
|
+
# 4. 在 Cursor 中打开项目,对 AI 说:
|
|
684
|
+
# "为 my-app 初始化开发计划,创建阶段一并添加 3 个子任务"
|
|
685
|
+
|
|
686
|
+
# 5. 可视化查看计划图谱
|
|
687
|
+
npx aifastdb-devplan-visual --project my-app --base-path .devplan --port 3210
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
### 数据存储
|
|
691
|
+
|
|
692
|
+
数据存储在本地,**无需外部数据库**:
|
|
92
693
|
|
|
93
694
|
```
|
|
94
695
|
.devplan/{projectName}/
|
|
95
|
-
├──
|
|
96
|
-
├──
|
|
97
|
-
|
|
696
|
+
├── engine.json # 引擎配置(graph 或 document)
|
|
697
|
+
├── documents.jsonl # 文档片段(document 引擎)
|
|
698
|
+
├── tasks.jsonl # 主任务 + 子任务(document 引擎)
|
|
699
|
+
├── modules.jsonl # 功能模块(document 引擎)
|
|
700
|
+
└── graph-data/ # WAL 图存储(graph 引擎)
|
|
701
|
+
└── wal/ # 预写日志分片
|
|
98
702
|
```
|
|
99
703
|
|
|
100
704
|
存储路径解析优先级:
|
|
101
|
-
1. `AIFASTDB_DEVPLAN_PATH` 环境变量
|
|
102
|
-
2. 项目内 `.devplan/` 目录(通过 `.git` / `package.json` 定位)
|
|
103
|
-
3. `~/.aifastdb/dev-plans/`(兜底)
|
|
104
705
|
|
|
105
|
-
|
|
706
|
+
| 优先级 | 路径来源 | 说明 |
|
|
707
|
+
|--------|---------|------|
|
|
708
|
+
| 1 | `AIFASTDB_DEVPLAN_PATH` 环境变量 | 显式指定存储目录 |
|
|
709
|
+
| 2 | 项目内 `.devplan/` 目录 | 自动检测项目根目录(通过 `.git` / `package.json`) |
|
|
710
|
+
| 3 | `~/.aifastdb/dev-plans/` | 全局兜底路径 |
|
|
711
|
+
|
|
712
|
+
### 平台支持
|
|
713
|
+
|
|
714
|
+
`aifastdb-devplan` 是纯 TypeScript/JavaScript 项目,支持所有 Node.js ≥ 18 的平台:
|
|
715
|
+
|
|
716
|
+
| 平台 | 架构 | 支持 |
|
|
717
|
+
|------|------|------|
|
|
718
|
+
| Windows | x64 | ✅ |
|
|
719
|
+
| macOS | x64 / Apple Silicon (M1/M2/M3/M4) | ✅ |
|
|
720
|
+
| Linux | x64 / ARM64 | ✅ |
|
|
721
|
+
|
|
722
|
+
> 注:底层存储引擎 [aifastdb](https://github.com/aifastdb/aifastdb) 包含 Rust 原生绑定,已为上述平台提供预编译二进制文件。
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
## Tech Stack / 技术栈
|
|
727
|
+
|
|
728
|
+
- **Storage Engine / 存储引擎**: [aifastdb](https://github.com/aifastdb/aifastdb) — Dual engine: SocialGraphV2 (graph) + EnhancedDocumentStore (JSONL), built with Rust + N-API
|
|
729
|
+
- **Protocol / 通信协议**: [MCP (Model Context Protocol)](https://modelcontextprotocol.io) — Standard protocol for AI assistant tool invocation
|
|
730
|
+
- **Visualization / 可视化**: [vis-network](https://visjs.github.io/vis-network/) — Interactive graph visualization (CDN, zero dependencies)
|
|
731
|
+
- **Runtime / 运行时**: Node.js ≥ 18
|
|
732
|
+
- **Language / 语言**: TypeScript (strict mode)
|
|
733
|
+
|
|
734
|
+
## Related Projects / 相关项目
|
|
106
735
|
|
|
107
|
-
- [aifastdb](https://github.com/aifastdb/aifastdb) —
|
|
108
|
-
- [
|
|
736
|
+
- [aifastdb](https://github.com/aifastdb/aifastdb) — AI-friendly high-performance database engine (vector search + semantic indexing + agent memory)
|
|
737
|
+
- [MCP Protocol](https://modelcontextprotocol.io) — Model Context Protocol official documentation
|
|
109
738
|
|
|
110
739
|
## License
|
|
111
740
|
|
|
112
|
-
MIT
|
|
741
|
+
[MIT](LICENSE)
|