context-tracker-mcp1.0 1.0.9 → 1.0.11
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/.windsurf/mcp-config.json +12 -0
- package/.windsurf/workflows/co.md +0 -0
- package/.windsurf/workflows/context-tracking.md +12 -0
- package/.windsurf/workflows/doc.md +13 -0
- package/.windsurf/workflows/documentation.md +12 -0
- package/.windsurf/workflows/error-analysis.md +12 -0
- package/.windsurf/workflows/explain.md +13 -0
- package/.windsurf/workflows/fix.md +18 -0
- package/.windsurf/workflows/optimize.md +14 -0
- package/.windsurf/workflows/project-intelligence.md +12 -0
- package/.windsurf/workflows/refactor.md +14 -0
- package/.windsurf/workflows/test.md +13 -0
- package/dist/index.js +191 -0
- package/package.json +2 -1
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Track development context and code changes
|
|
3
|
+
---
|
|
4
|
+
# context-tracking Workflow
|
|
5
|
+
|
|
6
|
+
1. Initialize file watcher
|
|
7
|
+
2. Setup context tracking
|
|
8
|
+
3. Enable auto-tracking
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
This workflow is automatically managed by the Context Tracker MCP.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate documentation for code
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Generate clear documentation for the provided code:
|
|
6
|
+
|
|
7
|
+
1. **README section** - Project overview, setup, usage
|
|
8
|
+
2. **Function documentation** - JSDoc/docstring comments
|
|
9
|
+
3. **API documentation** - Input/output specifications
|
|
10
|
+
4. **Examples** - Code samples showing how to use
|
|
11
|
+
5. **Changelog notes** - What's new/changed
|
|
12
|
+
|
|
13
|
+
Make documentation beginner-friendly with examples.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate and maintain project documentation
|
|
3
|
+
---
|
|
4
|
+
# documentation Workflow
|
|
5
|
+
|
|
6
|
+
1. Scan project structure
|
|
7
|
+
2. Generate docs
|
|
8
|
+
3. Setup auto-doc generation
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
This workflow is automatically managed by the Context Tracker MCP.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze and track errors across sessions
|
|
3
|
+
---
|
|
4
|
+
# error-analysis Workflow
|
|
5
|
+
|
|
6
|
+
1. Enable error tracking
|
|
7
|
+
2. Setup error patterns
|
|
8
|
+
3. Configure notifications
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
This workflow is automatically managed by the Context Tracker MCP.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Explain code functionality and logic
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Explain the provided code in simple, clear terms. Include:
|
|
6
|
+
|
|
7
|
+
1. **What it does** - Overall purpose and functionality
|
|
8
|
+
2. **How it works** - Step-by-step logic flow
|
|
9
|
+
3. **Key components** - Important functions, variables, patterns
|
|
10
|
+
4. **Inputs/Outputs** - What goes in, what comes out
|
|
11
|
+
5. **Edge cases** - How it handles unusual scenarios
|
|
12
|
+
|
|
13
|
+
Keep explanations concise but comprehensive. Use bullet points and short paragraphs.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fix bugs and errors in code
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Analyze the provided code and fix all bugs, errors, and issues. Focus on:
|
|
6
|
+
|
|
7
|
+
1. **Syntax errors** - Fix typos, missing brackets, semicolons
|
|
8
|
+
2. **Logic errors** - Fix incorrect conditions, loops, calculations
|
|
9
|
+
3. **Runtime errors** - Fix null/undefined references, type errors
|
|
10
|
+
4. **Edge cases** - Handle empty inputs, boundary conditions
|
|
11
|
+
5. **Best practices** - Follow language conventions and patterns
|
|
12
|
+
|
|
13
|
+
Steps:
|
|
14
|
+
1. Read and understand the code
|
|
15
|
+
2. Identify all issues
|
|
16
|
+
3. Apply fixes with minimal changes
|
|
17
|
+
4. Verify the fix doesn't break existing functionality
|
|
18
|
+
5. Return the corrected code with brief explanation of changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Optimize code for performance
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Optimize the provided code for better performance. Focus on:
|
|
6
|
+
|
|
7
|
+
1. **Time complexity** - Reduce Big O where possible
|
|
8
|
+
2. **Memory usage** - Minimize memory allocations
|
|
9
|
+
3. **Loop optimization** - Remove unnecessary iterations
|
|
10
|
+
4. **Caching** - Add memoization where beneficial
|
|
11
|
+
5. **Async operations** - Parallelize independent tasks
|
|
12
|
+
6. **Bundle size** - Reduce for frontend code
|
|
13
|
+
|
|
14
|
+
Maintain readability while improving performance. Measure before and after if possible.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Learn and suggest based on project patterns
|
|
3
|
+
---
|
|
4
|
+
# project-intelligence Workflow
|
|
5
|
+
|
|
6
|
+
1. Analyze project patterns
|
|
7
|
+
2. Build knowledge base
|
|
8
|
+
3. Enable suggestions
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
This workflow is automatically managed by the Context Tracker MCP.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Refactor code for better structure
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Refactor the provided code to improve quality and maintainability:
|
|
6
|
+
|
|
7
|
+
1. **Extract functions** - Break large functions into smaller ones
|
|
8
|
+
2. **Rename variables** - Use clear, descriptive names
|
|
9
|
+
3. **Remove duplication** - Apply DRY principle
|
|
10
|
+
4. **Simplify logic** - Reduce nesting, use early returns
|
|
11
|
+
5. **Add types** - Add TypeScript types or JSDoc
|
|
12
|
+
6. **Improve patterns** - Use modern best practices
|
|
13
|
+
|
|
14
|
+
Make incremental changes that preserve functionality while improving code quality.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate unit tests for code
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Generate comprehensive unit tests for the provided code. Include:
|
|
6
|
+
|
|
7
|
+
1. **Happy path tests** - Normal expected inputs and outputs
|
|
8
|
+
2. **Edge case tests** - Empty inputs, boundaries, null values
|
|
9
|
+
3. **Error case tests** - Invalid inputs, exceptions, failures
|
|
10
|
+
4. **Integration tests** - How components work together
|
|
11
|
+
|
|
12
|
+
Use the testing framework appropriate for the language (Jest for JS, pytest for Python, etc.)
|
|
13
|
+
Cover at least 80% of code paths.
|
package/dist/index.js
CHANGED
|
@@ -193,6 +193,25 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
|
+
{
|
|
197
|
+
name: 'analyze_project_files',
|
|
198
|
+
description: 'Analyze project files to identify necessary files, MCP-generated files, and safe-to-remove files',
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: {
|
|
202
|
+
includeHidden: {
|
|
203
|
+
type: 'boolean',
|
|
204
|
+
description: 'Include hidden files and directories in analysis',
|
|
205
|
+
default: false
|
|
206
|
+
},
|
|
207
|
+
scanDepth: {
|
|
208
|
+
type: 'number',
|
|
209
|
+
description: 'How deep to scan directories (1-10, default: 5)',
|
|
210
|
+
default: 5
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
196
215
|
{
|
|
197
216
|
name: 'get_config',
|
|
198
217
|
description: 'Get current MCP configuration',
|
|
@@ -273,6 +292,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
273
292
|
case 'get_error_patterns':
|
|
274
293
|
const errorStats = errorAnalyzer.getErrorStatistics();
|
|
275
294
|
return { content: [{ type: 'text', text: JSON.stringify(errorStats, null, 2) }] };
|
|
295
|
+
case 'analyze_project_files':
|
|
296
|
+
const fileAnalysis = await analyzeProjectFiles(args?.includeHidden || false, args?.scanDepth || 5);
|
|
297
|
+
return { content: [{ type: 'text', text: JSON.stringify(fileAnalysis, null, 2) }] };
|
|
276
298
|
case 'get_config':
|
|
277
299
|
const config = await configManager.loadConfig();
|
|
278
300
|
const section = args?.section || 'all';
|
|
@@ -331,6 +353,175 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
331
353
|
};
|
|
332
354
|
}
|
|
333
355
|
});
|
|
356
|
+
// Analyze project files function
|
|
357
|
+
async function analyzeProjectFiles(includeHidden = false, scanDepth = 5) {
|
|
358
|
+
const path = await import('path');
|
|
359
|
+
const { promises: fs } = await import('fs');
|
|
360
|
+
const projectRoot = process.cwd();
|
|
361
|
+
const results = {
|
|
362
|
+
projectRoot,
|
|
363
|
+
analysis: {
|
|
364
|
+
necessary: [],
|
|
365
|
+
mcpFiles: [],
|
|
366
|
+
safeToRemove: [],
|
|
367
|
+
unknown: []
|
|
368
|
+
},
|
|
369
|
+
summary: {
|
|
370
|
+
totalFiles: 0,
|
|
371
|
+
necessaryCount: 0,
|
|
372
|
+
mcpFilesCount: 0,
|
|
373
|
+
safeToRemoveCount: 0,
|
|
374
|
+
unknownCount: 0
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
// MCP file patterns
|
|
378
|
+
const mcpPatterns = [
|
|
379
|
+
'.windsurf/',
|
|
380
|
+
'.context-data/',
|
|
381
|
+
'mcp-config.json',
|
|
382
|
+
'context-tracker-mcp*',
|
|
383
|
+
'setup-mcp-workflows*'
|
|
384
|
+
];
|
|
385
|
+
// Necessary file patterns for different project types
|
|
386
|
+
const necessaryPatterns = {
|
|
387
|
+
'package.json': true,
|
|
388
|
+
'tsconfig.json': true,
|
|
389
|
+
'webpack.config.js': true,
|
|
390
|
+
'vite.config.js': true,
|
|
391
|
+
'next.config.js': true,
|
|
392
|
+
'tailwind.config.js': true,
|
|
393
|
+
'.env': true,
|
|
394
|
+
'.env.example': true,
|
|
395
|
+
'README.md': true,
|
|
396
|
+
'LICENSE': true,
|
|
397
|
+
'.gitignore': true,
|
|
398
|
+
'src/': true,
|
|
399
|
+
'components/': true,
|
|
400
|
+
'pages/': true,
|
|
401
|
+
'lib/': true,
|
|
402
|
+
'utils/': true,
|
|
403
|
+
'public/': true,
|
|
404
|
+
'dist/': true,
|
|
405
|
+
'build/': true,
|
|
406
|
+
'node_modules/': false, // Not necessary for repo
|
|
407
|
+
'.git/': false // Not necessary for repo
|
|
408
|
+
};
|
|
409
|
+
// Safe to remove patterns
|
|
410
|
+
const safeToRemovePatterns = [
|
|
411
|
+
'node_modules/',
|
|
412
|
+
'.DS_Store',
|
|
413
|
+
'Thumbs.db',
|
|
414
|
+
'*.log',
|
|
415
|
+
'.vscode/settings.json.backup',
|
|
416
|
+
'.idea/workspace.xml',
|
|
417
|
+
'*.tmp',
|
|
418
|
+
'*.temp'
|
|
419
|
+
];
|
|
420
|
+
async function scanDirectory(dirPath, currentDepth = 0) {
|
|
421
|
+
if (currentDepth > scanDepth) return;
|
|
422
|
+
try {
|
|
423
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
424
|
+
for (const entry of entries) {
|
|
425
|
+
if (!includeHidden && entry.name.startsWith('.')) continue;
|
|
426
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
427
|
+
const relativePath = path.relative(projectRoot, fullPath);
|
|
428
|
+
results.summary.totalFiles++;
|
|
429
|
+
// Check MCP files
|
|
430
|
+
let isMcpFile = false;
|
|
431
|
+
for (const pattern of mcpPatterns) {
|
|
432
|
+
if (pattern.endsWith('/')) {
|
|
433
|
+
if (relativePath.startsWith(pattern)) {
|
|
434
|
+
isMcpFile = true;
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
if (relativePath.includes(pattern) || entry.name.includes(pattern)) {
|
|
439
|
+
isMcpFile = true;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
if (isMcpFile) {
|
|
445
|
+
results.analysis.mcpFiles.push({
|
|
446
|
+
path: relativePath,
|
|
447
|
+
type: entry.isDirectory() ? 'directory' : 'file',
|
|
448
|
+
description: 'MCP-generated file/folder'
|
|
449
|
+
});
|
|
450
|
+
results.summary.mcpFilesCount++;
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
// Check necessary files
|
|
454
|
+
let isNecessary = false;
|
|
455
|
+
let necessaryDesc = '';
|
|
456
|
+
for (const [pattern, desc] of Object.entries(necessaryPatterns)) {
|
|
457
|
+
if (pattern.endsWith('/')) {
|
|
458
|
+
if (relativePath.startsWith(pattern)) {
|
|
459
|
+
isNecessary = true;
|
|
460
|
+
necessaryDesc = typeof desc === 'string' ? desc : `Essential ${pattern} directory`;
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
if (entry.name === pattern || relativePath.endsWith(pattern)) {
|
|
465
|
+
isNecessary = true;
|
|
466
|
+
necessaryDesc = typeof desc === 'string' ? desc : `Essential ${pattern} file`;
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
if (isNecessary) {
|
|
472
|
+
results.analysis.necessary.push({
|
|
473
|
+
path: relativePath,
|
|
474
|
+
type: entry.isDirectory() ? 'directory' : 'file',
|
|
475
|
+
description: necessaryDesc
|
|
476
|
+
});
|
|
477
|
+
results.summary.necessaryCount++;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
// Check safe to remove
|
|
481
|
+
let isSafeToRemove = false;
|
|
482
|
+
for (const pattern of safeToRemovePatterns) {
|
|
483
|
+
if (pattern.endsWith('/')) {
|
|
484
|
+
if (relativePath.startsWith(pattern)) {
|
|
485
|
+
isSafeToRemove = true;
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
} else {
|
|
489
|
+
if (entry.name.match(pattern.replace('*', '.*'))) {
|
|
490
|
+
isSafeToRemove = true;
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
if (isSafeToRemove) {
|
|
496
|
+
results.analysis.safeToRemove.push({
|
|
497
|
+
path: relativePath,
|
|
498
|
+
type: entry.isDirectory() ? 'directory' : 'file',
|
|
499
|
+
description: 'Safe to remove - generated/cache file',
|
|
500
|
+
size: entry.isFile() ? (await fs.stat(fullPath)).size : null
|
|
501
|
+
});
|
|
502
|
+
results.summary.safeToRemoveCount++;
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
// Unknown/uncategorized
|
|
506
|
+
results.analysis.unknown.push({
|
|
507
|
+
path: relativePath,
|
|
508
|
+
type: entry.isDirectory() ? 'directory' : 'file',
|
|
509
|
+
description: 'Uncategorized file'
|
|
510
|
+
});
|
|
511
|
+
results.summary.unknownCount++;
|
|
512
|
+
// Recurse into directories
|
|
513
|
+
if (entry.isDirectory()) {
|
|
514
|
+
await scanDirectory(fullPath, currentDepth + 1);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
} catch (error) {
|
|
518
|
+
// Permission denied or other errors
|
|
519
|
+
console.warn(`Cannot access ${dirPath}:`, error.message);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
await scanDirectory(projectRoot);
|
|
523
|
+
return results;
|
|
524
|
+
}
|
|
334
525
|
// List resources
|
|
335
526
|
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
336
527
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-tracker-mcp1.0",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "MCP server for tracking context, code changes, and generating documentation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/**/*",
|
|
13
13
|
"bin/**/*",
|
|
14
|
+
".windsurf/workflows/**/*",
|
|
14
15
|
"README.md",
|
|
15
16
|
"mcp-config.json"
|
|
16
17
|
],
|