@grec0/memory-bank-mcp 0.1.0 → 0.1.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 +189 -4
- package/dist/common/projectKnowledgeService.js +74 -0
- package/dist/index.js +355 -2
- package/dist/tools/initializeMemoryBank.js +364 -0
- package/dist/tools/recordDecision.js +208 -0
- package/dist/tools/trackProgress.js +355 -0
- package/dist/tools/updateContext.js +201 -0
- package/package.json +1 -1
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Initialize Memory Bank tool
|
|
3
|
+
* Creates the Memory Bank structure for a new project with initial templates
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
/**
|
|
8
|
+
* Document templates for initialization
|
|
9
|
+
*/
|
|
10
|
+
const DOCUMENT_TEMPLATES = {
|
|
11
|
+
projectBrief: (projectName, description, date) => `# Project Brief
|
|
12
|
+
|
|
13
|
+
## Project Overview
|
|
14
|
+
- **Project Name**: ${projectName}
|
|
15
|
+
- **Initialized**: ${date}
|
|
16
|
+
- **Status**: Active
|
|
17
|
+
|
|
18
|
+
## Description
|
|
19
|
+
${description || "Project description pending. Update this section with the main purpose and goals of the project."}
|
|
20
|
+
|
|
21
|
+
## Main Goals
|
|
22
|
+
- [ ] Define project requirements
|
|
23
|
+
- [ ] Establish architecture
|
|
24
|
+
- [ ] Implement core features
|
|
25
|
+
- [ ] Testing and deployment
|
|
26
|
+
|
|
27
|
+
## Target Audience
|
|
28
|
+
_Define who will use this project_
|
|
29
|
+
|
|
30
|
+
## Project Type
|
|
31
|
+
_Library / CLI Tool / Web App / API / Other_
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
*This document was auto-generated. Use \`memorybank_generate_project_docs\` with AI to create detailed documentation based on actual code analysis.*
|
|
35
|
+
`,
|
|
36
|
+
productContext: (projectName, date) => `# Product Context
|
|
37
|
+
|
|
38
|
+
## Purpose
|
|
39
|
+
_Why does this project exist? What problem does it solve?_
|
|
40
|
+
|
|
41
|
+
## User Stories
|
|
42
|
+
- As a user, I want to...
|
|
43
|
+
- As a developer, I want to...
|
|
44
|
+
|
|
45
|
+
## Key Features
|
|
46
|
+
1. Feature 1 - Description
|
|
47
|
+
2. Feature 2 - Description
|
|
48
|
+
3. Feature 3 - Description
|
|
49
|
+
|
|
50
|
+
## Business Logic
|
|
51
|
+
_Key business rules and workflows_
|
|
52
|
+
|
|
53
|
+
## Integration Points
|
|
54
|
+
- External APIs
|
|
55
|
+
- Services
|
|
56
|
+
- Databases
|
|
57
|
+
|
|
58
|
+
## Data Models
|
|
59
|
+
_Key entities and their relationships_
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
*Last updated: ${date}*
|
|
63
|
+
*Use \`memorybank_generate_project_docs\` to generate detailed product context from code analysis.*
|
|
64
|
+
`,
|
|
65
|
+
systemPatterns: (projectName, date) => `# System Patterns
|
|
66
|
+
|
|
67
|
+
## Architecture Style
|
|
68
|
+
_MVC / Microservices / Monolith / Serverless / Other_
|
|
69
|
+
|
|
70
|
+
## Design Patterns Used
|
|
71
|
+
- Pattern 1: Description and usage
|
|
72
|
+
- Pattern 2: Description and usage
|
|
73
|
+
|
|
74
|
+
## Code Organization
|
|
75
|
+
\`\`\`
|
|
76
|
+
src/
|
|
77
|
+
├── components/ # Description
|
|
78
|
+
├── services/ # Description
|
|
79
|
+
├── utils/ # Description
|
|
80
|
+
└── ...
|
|
81
|
+
\`\`\`
|
|
82
|
+
|
|
83
|
+
## Naming Conventions
|
|
84
|
+
- Files: kebab-case / camelCase / PascalCase
|
|
85
|
+
- Functions: camelCase
|
|
86
|
+
- Classes: PascalCase
|
|
87
|
+
- Constants: UPPER_SNAKE_CASE
|
|
88
|
+
|
|
89
|
+
## Error Handling Strategy
|
|
90
|
+
_How errors are managed across the codebase_
|
|
91
|
+
|
|
92
|
+
## State Management
|
|
93
|
+
_How state is handled (if applicable)_
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
*Last updated: ${date}*
|
|
97
|
+
*Use \`memorybank_generate_project_docs\` to auto-detect patterns from code analysis.*
|
|
98
|
+
`,
|
|
99
|
+
techContext: (projectName, date) => `# Technical Context
|
|
100
|
+
|
|
101
|
+
## Technology Stack
|
|
102
|
+
|
|
103
|
+
### Languages
|
|
104
|
+
- Language 1 (version)
|
|
105
|
+
|
|
106
|
+
### Frameworks
|
|
107
|
+
- Framework 1 (version)
|
|
108
|
+
|
|
109
|
+
### Key Dependencies
|
|
110
|
+
| Package | Version | Purpose |
|
|
111
|
+
|---------|---------|---------|
|
|
112
|
+
| package1 | x.x.x | Description |
|
|
113
|
+
|
|
114
|
+
## Development Environment
|
|
115
|
+
|
|
116
|
+
### Prerequisites
|
|
117
|
+
- Node.js >= 18.0.0
|
|
118
|
+
- Other requirements
|
|
119
|
+
|
|
120
|
+
### Setup Commands
|
|
121
|
+
\`\`\`bash
|
|
122
|
+
npm install
|
|
123
|
+
npm run build
|
|
124
|
+
npm run dev
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
### Environment Variables
|
|
128
|
+
| Variable | Required | Description |
|
|
129
|
+
|----------|----------|-------------|
|
|
130
|
+
| VAR_NAME | Yes/No | Description |
|
|
131
|
+
|
|
132
|
+
## Database / Storage
|
|
133
|
+
_Data persistence solutions_
|
|
134
|
+
|
|
135
|
+
## Testing
|
|
136
|
+
- Framework: Jest / Mocha / Other
|
|
137
|
+
- Coverage target: X%
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
*Last updated: ${date}*
|
|
141
|
+
*Use \`memorybank_generate_project_docs\` to auto-detect tech stack from code analysis.*
|
|
142
|
+
`,
|
|
143
|
+
activeContext: (projectName, date) => `# Active Context
|
|
144
|
+
|
|
145
|
+
## Current Session
|
|
146
|
+
- **Date**: ${date}
|
|
147
|
+
- **Mode**: development
|
|
148
|
+
- **Current Task**: Project initialization
|
|
149
|
+
|
|
150
|
+
## Session History
|
|
151
|
+
| Date | Mode | Task | Notes |
|
|
152
|
+
|------|------|------|-------|
|
|
153
|
+
| ${date} | development | Initialization | Memory Bank created |
|
|
154
|
+
|
|
155
|
+
## Recent Changes
|
|
156
|
+
- Memory Bank initialized for project "${projectName}"
|
|
157
|
+
|
|
158
|
+
## Open Questions
|
|
159
|
+
- What are the main goals for this project?
|
|
160
|
+
- What is the target architecture?
|
|
161
|
+
- Who is the target audience?
|
|
162
|
+
|
|
163
|
+
## Next Steps
|
|
164
|
+
- [ ] Index the codebase with \`memorybank_index_code\`
|
|
165
|
+
- [ ] Generate detailed docs with \`memorybank_generate_project_docs\`
|
|
166
|
+
- [ ] Define project requirements
|
|
167
|
+
- [ ] Set up development environment
|
|
168
|
+
|
|
169
|
+
## Active Considerations
|
|
170
|
+
_Current technical considerations and trade-offs_
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
*Update this document with \`memorybank_update_context\` to track session progress.*
|
|
174
|
+
`,
|
|
175
|
+
progress: (projectName, date) => `# Progress Tracking
|
|
176
|
+
|
|
177
|
+
## Current Phase
|
|
178
|
+
**Phase**: Initialization
|
|
179
|
+
**Status**: In Progress
|
|
180
|
+
**Started**: ${date}
|
|
181
|
+
|
|
182
|
+
## Completed
|
|
183
|
+
- [x] Repository setup
|
|
184
|
+
- [x] Memory Bank initialization
|
|
185
|
+
|
|
186
|
+
## In Progress
|
|
187
|
+
- [ ] Environment configuration
|
|
188
|
+
- [ ] Initial documentation
|
|
189
|
+
- [ ] Code indexing
|
|
190
|
+
|
|
191
|
+
## Upcoming
|
|
192
|
+
- [ ] Core feature development
|
|
193
|
+
- [ ] Testing setup
|
|
194
|
+
- [ ] Documentation completion
|
|
195
|
+
|
|
196
|
+
## Blockers
|
|
197
|
+
_No blockers currently_
|
|
198
|
+
|
|
199
|
+
## Milestones
|
|
200
|
+
| Milestone | Status | Target Date | Notes |
|
|
201
|
+
|-----------|--------|-------------|-------|
|
|
202
|
+
| Project Setup | In Progress | - | Initial setup phase |
|
|
203
|
+
| MVP | Pending | - | Minimum viable product |
|
|
204
|
+
| v1.0 | Pending | - | First stable release |
|
|
205
|
+
|
|
206
|
+
## Statistics
|
|
207
|
+
- Files indexed: 0
|
|
208
|
+
- Code chunks: 0
|
|
209
|
+
- Last indexing: Never
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
*Update this document with \`memorybank_track_progress\` to track tasks and milestones.*
|
|
213
|
+
`,
|
|
214
|
+
decisionLog: (projectName, date) => `# Decision Log
|
|
215
|
+
|
|
216
|
+
This document tracks technical decisions made during the development of ${projectName}.
|
|
217
|
+
|
|
218
|
+
## Recent Decisions
|
|
219
|
+
|
|
220
|
+
### ${date} - Memory Bank Initialization
|
|
221
|
+
**Decision**: Initialize Memory Bank for persistent project context
|
|
222
|
+
|
|
223
|
+
**Rationale**:
|
|
224
|
+
- Enable AI agents to maintain context across sessions
|
|
225
|
+
- Track technical decisions and their rationale
|
|
226
|
+
- Monitor project progress systematically
|
|
227
|
+
|
|
228
|
+
**Alternatives Considered**:
|
|
229
|
+
- Manual documentation only
|
|
230
|
+
- No persistent context tracking
|
|
231
|
+
- External documentation tools
|
|
232
|
+
|
|
233
|
+
**Impact**: Foundation for AI-assisted development with full project context
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Pending Decisions
|
|
238
|
+
- Architecture style to adopt
|
|
239
|
+
- Technology stack selection
|
|
240
|
+
- Testing strategy
|
|
241
|
+
|
|
242
|
+
## Decision Categories
|
|
243
|
+
- 🏗️ Architecture
|
|
244
|
+
- 💻 Technology
|
|
245
|
+
- 📦 Dependencies
|
|
246
|
+
- 🔧 Configuration
|
|
247
|
+
- 📋 Process
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
*Record new decisions with \`memorybank_record_decision\` to maintain decision history.*
|
|
251
|
+
`,
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Initializes the Memory Bank structure for a project
|
|
255
|
+
*/
|
|
256
|
+
export async function initializeMemoryBank(params, storagePath = ".memorybank") {
|
|
257
|
+
const { projectId, projectPath, projectName, description } = params;
|
|
258
|
+
console.error(`\n=== Initializing Memory Bank ===`);
|
|
259
|
+
console.error(`Project ID: ${projectId}`);
|
|
260
|
+
console.error(`Project Path: ${projectPath}`);
|
|
261
|
+
const date = new Date().toISOString().split("T")[0];
|
|
262
|
+
const name = projectName || projectId;
|
|
263
|
+
const desc = description || "";
|
|
264
|
+
// Define docs path
|
|
265
|
+
const docsPath = path.join(storagePath, "projects", projectId, "docs");
|
|
266
|
+
// Check if already exists
|
|
267
|
+
const alreadyExists = fs.existsSync(docsPath);
|
|
268
|
+
if (alreadyExists) {
|
|
269
|
+
console.error(`Memory Bank already exists at: ${docsPath}`);
|
|
270
|
+
// Check which docs exist
|
|
271
|
+
const existingDocs = [];
|
|
272
|
+
const docFiles = [
|
|
273
|
+
"projectBrief.md",
|
|
274
|
+
"productContext.md",
|
|
275
|
+
"systemPatterns.md",
|
|
276
|
+
"techContext.md",
|
|
277
|
+
"activeContext.md",
|
|
278
|
+
"progress.md",
|
|
279
|
+
"decisionLog.md",
|
|
280
|
+
];
|
|
281
|
+
for (const doc of docFiles) {
|
|
282
|
+
if (fs.existsSync(path.join(docsPath, doc))) {
|
|
283
|
+
existingDocs.push(doc);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
success: true,
|
|
288
|
+
message: `Memory Bank already initialized for project "${projectId}". ${existingDocs.length} documents exist.`,
|
|
289
|
+
projectId,
|
|
290
|
+
docsPath,
|
|
291
|
+
documentsCreated: [],
|
|
292
|
+
alreadyExists: true,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
// Create directory structure
|
|
296
|
+
console.error(`Creating directory: ${docsPath}`);
|
|
297
|
+
fs.mkdirSync(docsPath, { recursive: true });
|
|
298
|
+
// Create all template documents
|
|
299
|
+
const documentsCreated = [];
|
|
300
|
+
const documents = {
|
|
301
|
+
"projectBrief.md": DOCUMENT_TEMPLATES.projectBrief(name, desc, date),
|
|
302
|
+
"productContext.md": DOCUMENT_TEMPLATES.productContext(name, date),
|
|
303
|
+
"systemPatterns.md": DOCUMENT_TEMPLATES.systemPatterns(name, date),
|
|
304
|
+
"techContext.md": DOCUMENT_TEMPLATES.techContext(name, date),
|
|
305
|
+
"activeContext.md": DOCUMENT_TEMPLATES.activeContext(name, date),
|
|
306
|
+
"progress.md": DOCUMENT_TEMPLATES.progress(name, date),
|
|
307
|
+
"decisionLog.md": DOCUMENT_TEMPLATES.decisionLog(name, date),
|
|
308
|
+
};
|
|
309
|
+
for (const [filename, content] of Object.entries(documents)) {
|
|
310
|
+
const filePath = path.join(docsPath, filename);
|
|
311
|
+
fs.writeFileSync(filePath, content, "utf-8");
|
|
312
|
+
documentsCreated.push(filename);
|
|
313
|
+
console.error(` Created: ${filename}`);
|
|
314
|
+
}
|
|
315
|
+
console.error(`\n=== Memory Bank Initialized ===`);
|
|
316
|
+
console.error(`Documents created: ${documentsCreated.length}`);
|
|
317
|
+
return {
|
|
318
|
+
success: true,
|
|
319
|
+
message: `Memory Bank initialized for project "${projectId}" with ${documentsCreated.length} template documents. Use \`memorybank_index_code\` to index your code and \`memorybank_generate_project_docs\` to generate detailed AI documentation.`,
|
|
320
|
+
projectId,
|
|
321
|
+
docsPath,
|
|
322
|
+
documentsCreated,
|
|
323
|
+
alreadyExists: false,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Tool definition for MCP
|
|
328
|
+
*/
|
|
329
|
+
export const initializeMemoryBankToolDefinition = {
|
|
330
|
+
name: "memorybank_initialize",
|
|
331
|
+
description: `Inicializa el Memory Bank para un proyecto nuevo. Crea la estructura de directorios y 7 documentos markdown con plantillas iniciales:
|
|
332
|
+
|
|
333
|
+
- projectBrief.md: Descripción general del proyecto
|
|
334
|
+
- productContext.md: Contexto de producto y usuarios
|
|
335
|
+
- systemPatterns.md: Patrones de arquitectura
|
|
336
|
+
- techContext.md: Stack tecnológico
|
|
337
|
+
- activeContext.md: Contexto de sesión actual
|
|
338
|
+
- progress.md: Seguimiento de progreso
|
|
339
|
+
- decisionLog.md: Log de decisiones técnicas
|
|
340
|
+
|
|
341
|
+
Esta herramienta NO usa IA - crea plantillas estáticas. Para documentación detallada basada en análisis de código, usa \`memorybank_generate_project_docs\` después de indexar.`,
|
|
342
|
+
inputSchema: {
|
|
343
|
+
type: "object",
|
|
344
|
+
properties: {
|
|
345
|
+
projectId: {
|
|
346
|
+
type: "string",
|
|
347
|
+
description: "Identificador único del proyecto (OBLIGATORIO)",
|
|
348
|
+
},
|
|
349
|
+
projectPath: {
|
|
350
|
+
type: "string",
|
|
351
|
+
description: "Ruta absoluta del proyecto",
|
|
352
|
+
},
|
|
353
|
+
projectName: {
|
|
354
|
+
type: "string",
|
|
355
|
+
description: "Nombre legible del proyecto (opcional, usa projectId si no se especifica)",
|
|
356
|
+
},
|
|
357
|
+
description: {
|
|
358
|
+
type: "string",
|
|
359
|
+
description: "Descripción inicial del proyecto (opcional)",
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
required: ["projectId", "projectPath"],
|
|
363
|
+
},
|
|
364
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Record Decision tool for Memory Bank
|
|
3
|
+
* Records technical decisions with rationale in the decision log
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
/**
|
|
8
|
+
* Category emojis for visual identification
|
|
9
|
+
*/
|
|
10
|
+
const CATEGORY_EMOJIS = {
|
|
11
|
+
architecture: "🏗️",
|
|
12
|
+
technology: "💻",
|
|
13
|
+
dependencies: "📦",
|
|
14
|
+
configuration: "🔧",
|
|
15
|
+
process: "📋",
|
|
16
|
+
security: "🔒",
|
|
17
|
+
performance: "⚡",
|
|
18
|
+
testing: "🧪",
|
|
19
|
+
documentation: "📝",
|
|
20
|
+
default: "📌",
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Counts existing decisions in the log
|
|
24
|
+
*/
|
|
25
|
+
function countDecisions(content) {
|
|
26
|
+
const matches = content.match(/^### \d{4}-\d{2}-\d{2}/gm);
|
|
27
|
+
return matches ? matches.length : 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Formats a decision entry for the log
|
|
31
|
+
*/
|
|
32
|
+
function formatDecisionEntry(decision) {
|
|
33
|
+
const date = decision.date || new Date().toISOString().split("T")[0];
|
|
34
|
+
const category = decision.category || "default";
|
|
35
|
+
const emoji = CATEGORY_EMOJIS[category.toLowerCase()] || CATEGORY_EMOJIS.default;
|
|
36
|
+
let entry = `### ${date} - ${emoji} ${decision.title}
|
|
37
|
+
|
|
38
|
+
**Decision**: ${decision.description}
|
|
39
|
+
|
|
40
|
+
**Rationale**: ${decision.rationale}
|
|
41
|
+
`;
|
|
42
|
+
if (decision.alternatives && decision.alternatives.length > 0) {
|
|
43
|
+
entry += `
|
|
44
|
+
**Alternatives Considered**:
|
|
45
|
+
${decision.alternatives.map(alt => `- ${alt}`).join("\n")}
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
if (decision.impact) {
|
|
49
|
+
entry += `
|
|
50
|
+
**Impact**: ${decision.impact}
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
if (decision.category) {
|
|
54
|
+
entry += `
|
|
55
|
+
**Category**: ${emoji} ${decision.category}
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
entry += "\n---\n";
|
|
59
|
+
return entry;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Records a technical decision in the decision log
|
|
63
|
+
*/
|
|
64
|
+
export async function recordDecision(params, storagePath = ".memorybank") {
|
|
65
|
+
const { projectId, decision } = params;
|
|
66
|
+
console.error(`\n=== Recording Decision ===`);
|
|
67
|
+
console.error(`Project ID: ${projectId}`);
|
|
68
|
+
console.error(`Decision: ${decision.title}`);
|
|
69
|
+
const docsPath = path.join(storagePath, "projects", projectId, "docs");
|
|
70
|
+
const decisionLogPath = path.join(docsPath, "decisionLog.md");
|
|
71
|
+
// Check if Memory Bank exists
|
|
72
|
+
if (!fs.existsSync(docsPath)) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
message: `Memory Bank not initialized for project "${projectId}". Run \`memorybank_initialize\` first.`,
|
|
76
|
+
projectId,
|
|
77
|
+
decisionTitle: decision.title,
|
|
78
|
+
totalDecisions: 0,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Read existing decision log or create new one
|
|
82
|
+
let existingContent = "";
|
|
83
|
+
let totalDecisions = 0;
|
|
84
|
+
if (fs.existsSync(decisionLogPath)) {
|
|
85
|
+
existingContent = fs.readFileSync(decisionLogPath, "utf-8");
|
|
86
|
+
totalDecisions = countDecisions(existingContent);
|
|
87
|
+
console.error(` Found ${totalDecisions} existing decisions`);
|
|
88
|
+
}
|
|
89
|
+
// Format the new decision entry
|
|
90
|
+
const newEntry = formatDecisionEntry(decision);
|
|
91
|
+
// Insert the new decision after the "## Recent Decisions" header
|
|
92
|
+
let newContent;
|
|
93
|
+
if (existingContent.includes("## Recent Decisions")) {
|
|
94
|
+
// Insert after the header
|
|
95
|
+
newContent = existingContent.replace("## Recent Decisions\n", `## Recent Decisions\n\n${newEntry}`);
|
|
96
|
+
}
|
|
97
|
+
else if (existingContent) {
|
|
98
|
+
// Prepend to existing content with header
|
|
99
|
+
newContent = `# Decision Log\n\n## Recent Decisions\n\n${newEntry}\n${existingContent}`;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Create new file
|
|
103
|
+
const date = new Date().toISOString().split("T")[0];
|
|
104
|
+
newContent = `# Decision Log
|
|
105
|
+
|
|
106
|
+
This document tracks technical decisions made during the development of the project.
|
|
107
|
+
|
|
108
|
+
## Recent Decisions
|
|
109
|
+
|
|
110
|
+
${newEntry}
|
|
111
|
+
|
|
112
|
+
## Pending Decisions
|
|
113
|
+
_Add pending decisions that need to be made_
|
|
114
|
+
|
|
115
|
+
## Decision Categories
|
|
116
|
+
- 🏗️ Architecture
|
|
117
|
+
- 💻 Technology
|
|
118
|
+
- 📦 Dependencies
|
|
119
|
+
- 🔧 Configuration
|
|
120
|
+
- 📋 Process
|
|
121
|
+
- 🔒 Security
|
|
122
|
+
- ⚡ Performance
|
|
123
|
+
- 🧪 Testing
|
|
124
|
+
- 📝 Documentation
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
*Record new decisions with \`memorybank_record_decision\` to maintain decision history.*
|
|
128
|
+
*Last updated: ${date}*
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
// Write to file
|
|
132
|
+
fs.writeFileSync(decisionLogPath, newContent, "utf-8");
|
|
133
|
+
totalDecisions += 1;
|
|
134
|
+
console.error(` Decision recorded: ${decision.title}`);
|
|
135
|
+
console.error(` Total decisions: ${totalDecisions}`);
|
|
136
|
+
console.error(`\n=== Decision Recorded ===`);
|
|
137
|
+
return {
|
|
138
|
+
success: true,
|
|
139
|
+
message: `Decision "${decision.title}" recorded for project "${projectId}". Total decisions: ${totalDecisions}.`,
|
|
140
|
+
projectId,
|
|
141
|
+
decisionTitle: decision.title,
|
|
142
|
+
totalDecisions,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Tool definition for MCP
|
|
147
|
+
*/
|
|
148
|
+
export const recordDecisionToolDefinition = {
|
|
149
|
+
name: "memorybank_record_decision",
|
|
150
|
+
description: `Registra una decisión técnica en el log de decisiones del proyecto.
|
|
151
|
+
|
|
152
|
+
Cada decisión incluye:
|
|
153
|
+
- Título descriptivo
|
|
154
|
+
- Descripción de lo que se decidió
|
|
155
|
+
- Rationale (por qué se tomó la decisión)
|
|
156
|
+
- Alternativas consideradas (opcional)
|
|
157
|
+
- Impacto esperado (opcional)
|
|
158
|
+
- Categoría (opcional): architecture, technology, dependencies, configuration, process, security, performance, testing, documentation
|
|
159
|
+
|
|
160
|
+
Útil para mantener un historial de decisiones arquitectónicas y técnicas para referencia futura.
|
|
161
|
+
No usa IA - registro directo en el documento.`,
|
|
162
|
+
inputSchema: {
|
|
163
|
+
type: "object",
|
|
164
|
+
properties: {
|
|
165
|
+
projectId: {
|
|
166
|
+
type: "string",
|
|
167
|
+
description: "Identificador único del proyecto (OBLIGATORIO)",
|
|
168
|
+
},
|
|
169
|
+
decision: {
|
|
170
|
+
type: "object",
|
|
171
|
+
description: "Información de la decisión a registrar",
|
|
172
|
+
properties: {
|
|
173
|
+
title: {
|
|
174
|
+
type: "string",
|
|
175
|
+
description: "Título corto y descriptivo de la decisión",
|
|
176
|
+
},
|
|
177
|
+
description: {
|
|
178
|
+
type: "string",
|
|
179
|
+
description: "Descripción detallada de lo que se decidió",
|
|
180
|
+
},
|
|
181
|
+
rationale: {
|
|
182
|
+
type: "string",
|
|
183
|
+
description: "Por qué se tomó esta decisión",
|
|
184
|
+
},
|
|
185
|
+
alternatives: {
|
|
186
|
+
type: "array",
|
|
187
|
+
items: { type: "string" },
|
|
188
|
+
description: "Alternativas que se consideraron",
|
|
189
|
+
},
|
|
190
|
+
impact: {
|
|
191
|
+
type: "string",
|
|
192
|
+
description: "Impacto esperado de la decisión",
|
|
193
|
+
},
|
|
194
|
+
category: {
|
|
195
|
+
type: "string",
|
|
196
|
+
description: "Categoría: architecture, technology, dependencies, configuration, process, security, performance, testing, documentation",
|
|
197
|
+
},
|
|
198
|
+
date: {
|
|
199
|
+
type: "string",
|
|
200
|
+
description: "Fecha de la decisión (YYYY-MM-DD). Auto-genera si no se especifica",
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
required: ["title", "description", "rationale"],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
required: ["projectId", "decision"],
|
|
207
|
+
},
|
|
208
|
+
};
|