@goonnguyen/human-mcp 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/.claude/agents/code-reviewer.md +140 -0
- package/.claude/agents/database-admin.md +86 -0
- package/.claude/agents/debugger.md +119 -0
- package/.claude/agents/docs-manager.md +113 -0
- package/.claude/agents/git-manager.md +59 -0
- package/.claude/agents/planner-researcher.md +97 -0
- package/.claude/agents/project-manager.md +113 -0
- package/.claude/agents/tester.md +95 -0
- package/.claude/commands/cook.md +7 -0
- package/.claude/commands/debug.md +10 -0
- package/.claude/commands/docs/init.md +11 -0
- package/.claude/commands/docs/update.md +11 -0
- package/.claude/commands/fix/ci.md +8 -0
- package/.claude/commands/fix/fast.md +5 -0
- package/.claude/commands/fix/hard.md +7 -0
- package/.claude/commands/fix/test.md +16 -0
- package/.claude/commands/git/cm.md +5 -0
- package/.claude/commands/git/cp.md +4 -0
- package/.claude/commands/plan/ci.md +12 -0
- package/.claude/commands/plan/two.md +13 -0
- package/.claude/commands/plan.md +10 -0
- package/.claude/commands/test.md +7 -0
- package/.claude/commands/watzup.md +8 -0
- package/.claude/hooks/telegram_notify.sh +136 -0
- package/.claude/send-discord.sh +64 -0
- package/.claude/settings.json +7 -0
- package/.claude/statusline.sh +143 -0
- package/.env.example +17 -0
- package/.github/workflows/publish.yml +51 -0
- package/.releaserc.json +26 -0
- package/.serena/project.yml +68 -0
- package/CHANGELOG.md +27 -0
- package/CLAUDE.md +139 -0
- package/Dockerfile +28 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +97 -0
- package/README.md +234 -0
- package/bun.lock +1555 -0
- package/bunfig.toml +15 -0
- package/dist/index.js +24568 -0
- package/docs/codebase-structure-architecture-code-standards.md +416 -0
- package/docs/codebase-summary.md +321 -0
- package/docs/project-overview-pdr.md +270 -0
- package/examples/debugging-session.ts +96 -0
- package/inspector-wrapper.mjs +33 -0
- package/package.json +47 -0
- package/plans/reports/001-from-qa-engineer-to-development-team-test-suite-report.md +188 -0
- package/plans/templates/bug-fix-template.md +69 -0
- package/plans/templates/feature-implementation-template.md +84 -0
- package/plans/templates/refactor-template.md +82 -0
- package/plans/templates/template-usage-guide.md +58 -0
- package/src/index.ts +5 -0
- package/src/prompts/debugging-prompts.ts +149 -0
- package/src/prompts/index.ts +55 -0
- package/src/resources/documentation.ts +316 -0
- package/src/resources/index.ts +49 -0
- package/src/server.ts +36 -0
- package/src/tools/eyes/index.ts +225 -0
- package/src/tools/eyes/processors/gif.ts +137 -0
- package/src/tools/eyes/processors/image.ts +123 -0
- package/src/tools/eyes/processors/video.ts +135 -0
- package/src/tools/eyes/schemas.ts +51 -0
- package/src/tools/eyes/utils/formatters.ts +126 -0
- package/src/tools/eyes/utils/gemini-client.ts +73 -0
- package/src/types/index.ts +41 -0
- package/src/utils/config.ts +51 -0
- package/src/utils/errors.ts +40 -0
- package/src/utils/logger.ts +49 -0
- package/tests/integration/server.test.ts +24 -0
- package/tests/setup.ts +11 -0
- package/tests/unit/config.test.ts +40 -0
- package/tests/unit/formatters.test.ts +85 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Workaround for eventsource ESM import issues
|
|
4
|
+
import { createRequire } from 'module';
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// Try to fix the eventsource import by patching the module resolution
|
|
10
|
+
const Module = require('module');
|
|
11
|
+
const originalResolveFilename = Module._resolveFilename;
|
|
12
|
+
|
|
13
|
+
Module._resolveFilename = function (request, parent, isMain, options) {
|
|
14
|
+
if (request === 'eventsource' && parent?.filename?.includes('@modelcontextprotocol/inspector')) {
|
|
15
|
+
// Force CommonJS resolution for eventsource
|
|
16
|
+
return require.resolve('eventsource');
|
|
17
|
+
}
|
|
18
|
+
return originalResolveFilename.call(this, request, parent, isMain, options);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Run the inspector with the command line args
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
const child = spawn('npx', ['@modelcontextprotocol/inspector', ...args], {
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
env: {
|
|
26
|
+
...process.env,
|
|
27
|
+
NODE_OPTIONS: '--loader ./inspector-loader.mjs'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
child.on('close', (code) => {
|
|
32
|
+
process.exit(code);
|
|
33
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@goonnguyen/human-mcp",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Human MCP: Bringing Human Capabilities to Coding Agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "bun run --watch src/index.ts",
|
|
10
|
+
"build": "bun build src/index.ts --target=node --outdir=dist",
|
|
11
|
+
"start": "bun run dist/index.js",
|
|
12
|
+
"test": "bun test",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"inspector": "mcp-inspector stdio -- bun run src/index.ts"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "^1.4.0",
|
|
18
|
+
"zod": "^3.23.0",
|
|
19
|
+
"@google/generative-ai": "^0.21.0",
|
|
20
|
+
"sharp": "^0.33.0",
|
|
21
|
+
"fluent-ffmpeg": "^2.1.3"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@modelcontextprotocol/inspector": "^0.2.0",
|
|
25
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
26
|
+
"@semantic-release/git": "^10.0.1",
|
|
27
|
+
"@semantic-release/github": "^11.0.5",
|
|
28
|
+
"@semantic-release/npm": "^12.0.2",
|
|
29
|
+
"@types/bun": "latest",
|
|
30
|
+
"@types/fluent-ffmpeg": "^2.1.26",
|
|
31
|
+
"semantic-release": "^24.2.7",
|
|
32
|
+
"typescript": "^5.6.0"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"mcp",
|
|
36
|
+
"model-context-protocol",
|
|
37
|
+
"ai",
|
|
38
|
+
"multimodal",
|
|
39
|
+
"vision",
|
|
40
|
+
"debugging"
|
|
41
|
+
],
|
|
42
|
+
"author": "",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Human MCP Test Suite Analysis Report
|
|
2
|
+
|
|
3
|
+
**Report Generated:** September 8, 2025
|
|
4
|
+
**Project:** Human MCP - Model Context Protocol Server
|
|
5
|
+
**Test Framework:** Bun Test
|
|
6
|
+
**Report By:** QA Engineer
|
|
7
|
+
|
|
8
|
+
## Executive Summary
|
|
9
|
+
|
|
10
|
+
The test suite execution reveals **3 failing tests out of 10 total tests** (70% pass rate). While TypeScript compilation passes successfully, there are critical inconsistencies between test expectations and actual implementation that need immediate attention.
|
|
11
|
+
|
|
12
|
+
## Test Results Overview
|
|
13
|
+
|
|
14
|
+
- **Total Tests:** 10
|
|
15
|
+
- **Tests Passed:** 7 (70%)
|
|
16
|
+
- **Tests Failed:** 3 (30%)
|
|
17
|
+
- **Tests Skipped:** 0
|
|
18
|
+
- **Execution Time:** 417ms
|
|
19
|
+
- **TypeScript Compilation:** ✅ PASS
|
|
20
|
+
|
|
21
|
+
## Detailed Test Failures
|
|
22
|
+
|
|
23
|
+
### 1. Formatters Test Failure: Accessibility Prompt
|
|
24
|
+
|
|
25
|
+
**File:** `tests/unit/formatters.test.ts`
|
|
26
|
+
**Test:** "should create accessibility prompt"
|
|
27
|
+
**Status:** ❌ FAIL
|
|
28
|
+
|
|
29
|
+
**Issue:** Test expects "concise analysis" text in accessibility prompt for basic detail level, but the actual implementation uses "Provide a concise analysis focusing on the most important findings." instead.
|
|
30
|
+
|
|
31
|
+
**Expected:** `"concise analysis"`
|
|
32
|
+
**Received:** Full prompt text without the expected substring
|
|
33
|
+
|
|
34
|
+
**Root Cause:** Mismatch between test expectations and the `createPrompt()` function implementation in `src/tools/eyes/utils/formatters.ts`.
|
|
35
|
+
|
|
36
|
+
### 2. Config Test Failure: Default Model Mismatch
|
|
37
|
+
|
|
38
|
+
**File:** `tests/unit/config.test.ts`
|
|
39
|
+
**Test:** "should override defaults with environment variables"
|
|
40
|
+
**Status:** ❌ FAIL
|
|
41
|
+
|
|
42
|
+
**Issue:** Test expects `"gemini-2.0-flash-exp"` model but actual implementation returns `"gemini-2.5-flash"`.
|
|
43
|
+
|
|
44
|
+
**Expected:** `"gemini-2.0-flash-exp"`
|
|
45
|
+
**Received:** `"gemini-2.5-flash"`
|
|
46
|
+
|
|
47
|
+
**Root Cause:** The test is setting `process.env.GOOGLE_GEMINI_MODEL = "gemini-2.5-flash"` but expecting a different model name in the assertion.
|
|
48
|
+
|
|
49
|
+
### 3. Server Integration Test Failure: Type Mismatch
|
|
50
|
+
|
|
51
|
+
**File:** `tests/integration/server.test.ts`
|
|
52
|
+
**Test:** "should be properly configured"
|
|
53
|
+
**Status:** ❌ FAIL
|
|
54
|
+
|
|
55
|
+
**Issue:** Test expects server to be instance of `Server` class but receives `McpServer` instance.
|
|
56
|
+
|
|
57
|
+
**Expected:** Instance of `Server` (from `@modelcontextprotocol/sdk/server/index.js`)
|
|
58
|
+
**Received:** Instance of `McpServer`
|
|
59
|
+
|
|
60
|
+
**Root Cause:** Incorrect import and type expectation. The `createServer()` function returns `McpServer` instance, not `Server`.
|
|
61
|
+
|
|
62
|
+
## Coverage Analysis
|
|
63
|
+
|
|
64
|
+
**Note:** No coverage metrics are currently configured in the project. The package.json does not include coverage scripts.
|
|
65
|
+
|
|
66
|
+
**Recommendations for Coverage:**
|
|
67
|
+
- Add coverage collection with `bun test --coverage`
|
|
68
|
+
- Target minimum 80% coverage for critical paths
|
|
69
|
+
- Focus on vision analysis tools and configuration validation
|
|
70
|
+
|
|
71
|
+
## Performance Metrics
|
|
72
|
+
|
|
73
|
+
- **Test Execution Time:** 417ms (Acceptable)
|
|
74
|
+
- **Slowest Individual Test:** ~1.54ms (Server creation test)
|
|
75
|
+
- **Average Test Time:** ~41.7ms per test
|
|
76
|
+
|
|
77
|
+
The test performance is excellent with sub-second execution time.
|
|
78
|
+
|
|
79
|
+
## Critical Issues Requiring Immediate Attention
|
|
80
|
+
|
|
81
|
+
### High Priority
|
|
82
|
+
1. **Config Test Logic Error:** Test is setting an environment variable to one value but expecting a different value
|
|
83
|
+
2. **Server Type Mismatch:** Import and expectation mismatch for server type
|
|
84
|
+
|
|
85
|
+
### Medium Priority
|
|
86
|
+
1. **Formatter Test Expectations:** String matching issues in prompt generation tests
|
|
87
|
+
|
|
88
|
+
## Detailed Recommendations
|
|
89
|
+
|
|
90
|
+
### 1. Fix Config Test (HIGH PRIORITY)
|
|
91
|
+
**Location:** `tests/unit/config.test.ts:28`
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// Current problematic code:
|
|
95
|
+
process.env.GOOGLE_GEMINI_MODEL = "gemini-2.5-flash";
|
|
96
|
+
expect(config.gemini.model).toBe("gemini-2.0-flash-exp"); // Wrong expectation
|
|
97
|
+
|
|
98
|
+
// Should be:
|
|
99
|
+
process.env.GOOGLE_GEMINI_MODEL = "gemini-2.0-flash-exp";
|
|
100
|
+
expect(config.gemini.model).toBe("gemini-2.0-flash-exp");
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 2. Fix Server Type Test (HIGH PRIORITY)
|
|
104
|
+
**Location:** `tests/integration/server.test.ts:22`
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// Current problematic code:
|
|
108
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
109
|
+
expect(server).toBeInstanceOf(Server);
|
|
110
|
+
|
|
111
|
+
// Should be:
|
|
112
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
113
|
+
expect(server).toBeInstanceOf(McpServer);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 3. Fix Formatter Test (MEDIUM PRIORITY)
|
|
117
|
+
**Location:** `tests/unit/formatters.test.ts:30`
|
|
118
|
+
|
|
119
|
+
Update test expectation to match actual implementation:
|
|
120
|
+
```typescript
|
|
121
|
+
// Either update the test expectation:
|
|
122
|
+
expect(prompt).toContain("Provide a concise analysis");
|
|
123
|
+
|
|
124
|
+
// Or update the formatters.ts implementation to include "concise analysis"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 4. Add Test Coverage (MEDIUM PRIORITY)
|
|
128
|
+
Add to package.json:
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"scripts": {
|
|
132
|
+
"test:coverage": "bun test --coverage",
|
|
133
|
+
"test:watch": "bun test --watch"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 5. Enhance Test Suite (LOW PRIORITY)
|
|
139
|
+
- Add error scenario testing for vision analysis tools
|
|
140
|
+
- Add integration tests for Google Gemini API calls (with mocking)
|
|
141
|
+
- Add performance benchmarks for image/video processing
|
|
142
|
+
- Add end-to-end tests for MCP protocol compliance
|
|
143
|
+
|
|
144
|
+
## Test Quality Assessment
|
|
145
|
+
|
|
146
|
+
### Strengths
|
|
147
|
+
- Good separation between unit and integration tests
|
|
148
|
+
- Proper use of test setup/teardown with `beforeEach`/`afterAll`
|
|
149
|
+
- Environment variable management in tests
|
|
150
|
+
- Structured test organization
|
|
151
|
+
|
|
152
|
+
### Weaknesses
|
|
153
|
+
- Missing error scenario coverage
|
|
154
|
+
- No mocking for external dependencies (Google Gemini API)
|
|
155
|
+
- Limited edge case testing
|
|
156
|
+
- Missing performance validation tests
|
|
157
|
+
|
|
158
|
+
## Security Considerations
|
|
159
|
+
|
|
160
|
+
- Tests properly manage environment variables for API keys
|
|
161
|
+
- No sensitive data leakage detected in test files
|
|
162
|
+
- Test environment isolation appears adequate
|
|
163
|
+
|
|
164
|
+
## Next Steps (Prioritized)
|
|
165
|
+
|
|
166
|
+
1. **IMMEDIATE:** Fix the 3 failing tests by correcting assertions and imports
|
|
167
|
+
2. **SHORT TERM:** Add test coverage collection and reporting
|
|
168
|
+
3. **MEDIUM TERM:** Expand test suite with error scenarios and edge cases
|
|
169
|
+
4. **LONG TERM:** Add performance benchmarks and comprehensive integration tests
|
|
170
|
+
|
|
171
|
+
## Build Process Verification
|
|
172
|
+
|
|
173
|
+
- **TypeScript Compilation:** ✅ PASS - No type errors detected
|
|
174
|
+
- **Dependency Resolution:** ✅ PASS - All imports resolve correctly
|
|
175
|
+
- **Build Configuration:** ✅ PASS - Project builds successfully
|
|
176
|
+
|
|
177
|
+
## Files Requiring Attention
|
|
178
|
+
|
|
179
|
+
1. `/Users/duynguyen/www/human-mcp/tests/unit/config.test.ts` - Fix environment variable test logic
|
|
180
|
+
2. `/Users/duynguyen/www/human-mcp/tests/integration/server.test.ts` - Fix server type expectation
|
|
181
|
+
3. `/Users/duynguyen/www/human-mcp/tests/unit/formatters.test.ts` - Update string expectations
|
|
182
|
+
4. `/Users/duynguyen/www/human-mcp/package.json` - Add coverage scripts
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
**Quality Gate Status:** ❌ BLOCKED
|
|
187
|
+
**Reason:** 3 failing tests prevent production deployment
|
|
188
|
+
**Required Action:** Fix failing tests before proceeding with any releases
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# [Bug Fix] Implementation Plan
|
|
2
|
+
|
|
3
|
+
**Date**: YYYY-MM-DD
|
|
4
|
+
**Type**: Bug Fix
|
|
5
|
+
**Priority**: [Critical/High/Medium/Low]
|
|
6
|
+
**Context Tokens**: <150 words
|
|
7
|
+
|
|
8
|
+
## Executive Summary
|
|
9
|
+
Brief description of the bug and its impact.
|
|
10
|
+
|
|
11
|
+
## Issue Analysis
|
|
12
|
+
### Symptoms
|
|
13
|
+
- [ ] Symptom 1
|
|
14
|
+
- [ ] Symptom 2
|
|
15
|
+
|
|
16
|
+
### Root Cause
|
|
17
|
+
Brief explanation of the underlying cause.
|
|
18
|
+
|
|
19
|
+
### Evidence
|
|
20
|
+
- **Logs**: Reference to log files (don't include full logs)
|
|
21
|
+
- **Error Messages**: Key error patterns
|
|
22
|
+
- **Affected Components**: List of impacted files/modules
|
|
23
|
+
|
|
24
|
+
## Context Links
|
|
25
|
+
- **Related Issues**: [GitHub issue numbers]
|
|
26
|
+
- **Recent Changes**: [Relevant commits or PRs]
|
|
27
|
+
- **Dependencies**: [Related systems]
|
|
28
|
+
|
|
29
|
+
## Solution Design
|
|
30
|
+
### Approach
|
|
31
|
+
High-level fix strategy in 2-3 sentences.
|
|
32
|
+
|
|
33
|
+
### Changes Required
|
|
34
|
+
1. **File 1** (`path/to/file.ts`): Brief change description
|
|
35
|
+
2. **File 2** (`path/to/file.ts`): Brief change description
|
|
36
|
+
|
|
37
|
+
### Testing Changes
|
|
38
|
+
- [ ] Update existing tests
|
|
39
|
+
- [ ] Add new test cases
|
|
40
|
+
- [ ] Validate fix doesn't break existing functionality
|
|
41
|
+
|
|
42
|
+
## Implementation Steps
|
|
43
|
+
1. [ ] Step 1 - file: `path/to/file.ts`
|
|
44
|
+
2. [ ] Step 2 - file: `path/to/file.ts`
|
|
45
|
+
3. [ ] Run test suite
|
|
46
|
+
4. [ ] Validate fix in relevant environments
|
|
47
|
+
|
|
48
|
+
## Verification Plan
|
|
49
|
+
### Test Cases
|
|
50
|
+
- [ ] Test case 1: Expected behavior
|
|
51
|
+
- [ ] Test case 2: Edge case handling
|
|
52
|
+
- [ ] Regression test: Ensure no new issues
|
|
53
|
+
|
|
54
|
+
### Rollback Plan
|
|
55
|
+
If the fix causes issues:
|
|
56
|
+
1. Revert commit: `git revert <commit-hash>`
|
|
57
|
+
2. Restore previous behavior in files X, Y, Z
|
|
58
|
+
|
|
59
|
+
## Risk Assessment
|
|
60
|
+
| Risk | Impact | Mitigation |
|
|
61
|
+
|------|--------|------------|
|
|
62
|
+
| Risk 1 | Medium | Mitigation plan |
|
|
63
|
+
|
|
64
|
+
## TODO Checklist
|
|
65
|
+
- [ ] Implement fix
|
|
66
|
+
- [ ] Update tests
|
|
67
|
+
- [ ] Run full test suite
|
|
68
|
+
- [ ] Code review
|
|
69
|
+
- [ ] Deploy and verify
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# [Feature Name] Implementation Plan
|
|
2
|
+
|
|
3
|
+
**Date**: YYYY-MM-DD
|
|
4
|
+
**Type**: Feature Implementation
|
|
5
|
+
**Status**: Planning
|
|
6
|
+
**Context Tokens**: <200 words
|
|
7
|
+
|
|
8
|
+
## Executive Summary
|
|
9
|
+
Brief 2-3 sentence description of the feature and its business value.
|
|
10
|
+
|
|
11
|
+
## Context Links
|
|
12
|
+
- **Related Plans**: [List other plan files - no full content]
|
|
13
|
+
- **Dependencies**: [External systems, APIs, existing features]
|
|
14
|
+
- **Reference Docs**: [Link to docs in ./docs directory]
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
### Functional Requirements
|
|
18
|
+
- [ ] Requirement 1
|
|
19
|
+
- [ ] Requirement 2
|
|
20
|
+
|
|
21
|
+
### Non-Functional Requirements
|
|
22
|
+
- [ ] Performance target
|
|
23
|
+
- [ ] Security requirement
|
|
24
|
+
- [ ] Scalability requirement
|
|
25
|
+
|
|
26
|
+
## Architecture Overview
|
|
27
|
+
```mermaid
|
|
28
|
+
[Simple component diagram]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Key Components
|
|
32
|
+
- **Component 1**: Brief description
|
|
33
|
+
- **Component 2**: Brief description
|
|
34
|
+
|
|
35
|
+
### Data Models
|
|
36
|
+
- **Model 1**: Key fields
|
|
37
|
+
- **Model 2**: Key fields
|
|
38
|
+
|
|
39
|
+
## Implementation Phases
|
|
40
|
+
|
|
41
|
+
### Phase 1: [Name] (Est: X days)
|
|
42
|
+
**Scope**: Specific boundaries
|
|
43
|
+
**Tasks**:
|
|
44
|
+
1. [ ] Task 1 - file: `path/to/file.ts`
|
|
45
|
+
2. [ ] Task 2 - file: `path/to/file.ts`
|
|
46
|
+
|
|
47
|
+
**Acceptance Criteria**:
|
|
48
|
+
- [ ] Criteria 1
|
|
49
|
+
- [ ] Criteria 2
|
|
50
|
+
|
|
51
|
+
### Phase 2: [Name] (Est: X days)
|
|
52
|
+
[Repeat structure]
|
|
53
|
+
|
|
54
|
+
## Testing Strategy
|
|
55
|
+
- **Unit Tests**: Specific test coverage targets
|
|
56
|
+
- **Integration Tests**: Key interaction points
|
|
57
|
+
- **E2E Tests**: Critical user flows
|
|
58
|
+
|
|
59
|
+
## Security Considerations
|
|
60
|
+
- [ ] Security item 1
|
|
61
|
+
- [ ] Security item 2
|
|
62
|
+
|
|
63
|
+
## Risk Assessment
|
|
64
|
+
| Risk | Impact | Mitigation |
|
|
65
|
+
|------|--------|------------|
|
|
66
|
+
| Risk 1 | High | Mitigation strategy |
|
|
67
|
+
|
|
68
|
+
## Quick Reference
|
|
69
|
+
### Key Commands
|
|
70
|
+
```bash
|
|
71
|
+
npm run command
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Configuration Files
|
|
75
|
+
- `config/file.ts`: Purpose
|
|
76
|
+
- `.env.example`: Environment variables
|
|
77
|
+
|
|
78
|
+
## TODO Checklist
|
|
79
|
+
- [ ] Phase 1 Task 1
|
|
80
|
+
- [ ] Phase 1 Task 2
|
|
81
|
+
- [ ] Phase 2 Task 1
|
|
82
|
+
- [ ] Testing complete
|
|
83
|
+
- [ ] Documentation updated
|
|
84
|
+
- [ ] Code review passed
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# [Component/Module] Refactoring Plan
|
|
2
|
+
|
|
3
|
+
**Date**: YYYY-MM-DD
|
|
4
|
+
**Type**: Refactoring
|
|
5
|
+
**Scope**: [Module/Component/System level]
|
|
6
|
+
**Context Tokens**: <200 words
|
|
7
|
+
|
|
8
|
+
## Executive Summary
|
|
9
|
+
Brief description of what is being refactored and why.
|
|
10
|
+
|
|
11
|
+
## Current State Analysis
|
|
12
|
+
### Issues with Current Implementation
|
|
13
|
+
- [ ] Issue 1: Performance bottleneck
|
|
14
|
+
- [ ] Issue 2: Code maintainability
|
|
15
|
+
- [ ] Issue 3: Technical debt
|
|
16
|
+
|
|
17
|
+
### Metrics (Before)
|
|
18
|
+
- **Performance**: Current benchmarks
|
|
19
|
+
- **Code Quality**: Complexity metrics
|
|
20
|
+
- **Test Coverage**: Current percentage
|
|
21
|
+
|
|
22
|
+
## Context Links
|
|
23
|
+
- **Affected Modules**: [List without full content]
|
|
24
|
+
- **Dependencies**: [Other systems impacted]
|
|
25
|
+
- **Related Documentation**: [Links to docs]
|
|
26
|
+
|
|
27
|
+
## Refactoring Strategy
|
|
28
|
+
### Approach
|
|
29
|
+
High-level strategy for the refactoring in 2-3 sentences.
|
|
30
|
+
|
|
31
|
+
### Architecture Changes
|
|
32
|
+
```mermaid
|
|
33
|
+
[Before/After comparison diagram]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Key Improvements
|
|
37
|
+
- **Improvement 1**: Brief description
|
|
38
|
+
- **Improvement 2**: Brief description
|
|
39
|
+
|
|
40
|
+
## Implementation Plan
|
|
41
|
+
|
|
42
|
+
### Phase 1: Preparation (Est: X days)
|
|
43
|
+
**Scope**: Setup and preparation work
|
|
44
|
+
1. [ ] Create comprehensive tests for current functionality
|
|
45
|
+
2. [ ] Document current behavior
|
|
46
|
+
3. [ ] Identify all dependencies
|
|
47
|
+
|
|
48
|
+
### Phase 2: Core Refactoring (Est: X days)
|
|
49
|
+
**Scope**: Main refactoring work
|
|
50
|
+
1. [ ] Refactor component A - file: `path/to/file.ts`
|
|
51
|
+
2. [ ] Refactor component B - file: `path/to/file.ts`
|
|
52
|
+
3. [ ] Update integration points
|
|
53
|
+
|
|
54
|
+
### Phase 3: Integration & Testing (Est: X days)
|
|
55
|
+
**Scope**: Validation and cleanup
|
|
56
|
+
1. [ ] Integration testing
|
|
57
|
+
2. [ ] Performance validation
|
|
58
|
+
3. [ ] Documentation updates
|
|
59
|
+
|
|
60
|
+
## Backward Compatibility
|
|
61
|
+
- **Breaking Changes**: [List any breaking changes]
|
|
62
|
+
- **Migration Path**: [Steps for users/systems]
|
|
63
|
+
- **Deprecation Timeline**: [If applicable]
|
|
64
|
+
|
|
65
|
+
## Success Metrics (After)
|
|
66
|
+
- **Performance**: Target improvements
|
|
67
|
+
- **Code Quality**: Target metrics
|
|
68
|
+
- **Test Coverage**: Target percentage
|
|
69
|
+
|
|
70
|
+
## Risk Assessment
|
|
71
|
+
| Risk | Impact | Mitigation |
|
|
72
|
+
|------|--------|------------|
|
|
73
|
+
| Breaking changes | High | Comprehensive testing |
|
|
74
|
+
| Performance regression | Medium | Benchmarking |
|
|
75
|
+
|
|
76
|
+
## TODO Checklist
|
|
77
|
+
- [ ] Phase 1: Preparation complete
|
|
78
|
+
- [ ] Phase 2: Core refactoring complete
|
|
79
|
+
- [ ] Phase 3: Integration complete
|
|
80
|
+
- [ ] Performance benchmarks validated
|
|
81
|
+
- [ ] Documentation updated
|
|
82
|
+
- [ ] Code review passed
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Plan Template Usage Guide
|
|
2
|
+
|
|
3
|
+
## Template Selection
|
|
4
|
+
|
|
5
|
+
### Feature Implementation Template
|
|
6
|
+
**Use when**: Adding new functionality, endpoints, services, or modules
|
|
7
|
+
**File**: `feature-implementation-template.md`
|
|
8
|
+
**Size**: Medium to large scope changes
|
|
9
|
+
|
|
10
|
+
### Bug Fix Template
|
|
11
|
+
**Use when**: Fixing specific issues, errors, or broken functionality
|
|
12
|
+
**File**: `bug-fix-template.md`
|
|
13
|
+
**Size**: Small to medium scope changes
|
|
14
|
+
|
|
15
|
+
### Refactoring Template
|
|
16
|
+
**Use when**: Improving code structure, performance, or maintainability without changing functionality
|
|
17
|
+
**File**: `refactor-template.md`
|
|
18
|
+
**Size**: Medium to large scope changes
|
|
19
|
+
|
|
20
|
+
## Context Management Best Practices
|
|
21
|
+
|
|
22
|
+
### Keep Plans Focused
|
|
23
|
+
- **Executive Summary**: Max 3 sentences
|
|
24
|
+
- **Context Links**: Reference files, don't include full content
|
|
25
|
+
- **Tasks**: Max 10 per phase
|
|
26
|
+
- **Context Tokens**: Target <200 words for summaries
|
|
27
|
+
|
|
28
|
+
### Template Adaptation
|
|
29
|
+
1. Copy the appropriate template to `plans/NNN-feature-name-plan.md`
|
|
30
|
+
2. Replace bracketed placeholders with actual content
|
|
31
|
+
3. Remove sections not relevant to your specific use case
|
|
32
|
+
4. Keep the core structure intact for consistency
|
|
33
|
+
|
|
34
|
+
### Cross-References Instead of Duplication
|
|
35
|
+
- Link to existing documentation in `./docs/`
|
|
36
|
+
- Reference other plans without copying content
|
|
37
|
+
- Use file paths instead of code blocks where possible
|
|
38
|
+
- Focus on "what" and "why", not detailed "how"
|
|
39
|
+
|
|
40
|
+
## Quality Checklist
|
|
41
|
+
|
|
42
|
+
Before finalizing any plan:
|
|
43
|
+
- [ ] Executive summary is clear and concise
|
|
44
|
+
- [ ] Tasks are specific and actionable
|
|
45
|
+
- [ ] File paths are included for implementation tasks
|
|
46
|
+
- [ ] Success criteria are measurable
|
|
47
|
+
- [ ] Context links are used instead of full content
|
|
48
|
+
- [ ] TODO checklist is complete and realistic
|
|
49
|
+
|
|
50
|
+
## Context Refresh Triggers
|
|
51
|
+
|
|
52
|
+
Use these templates when:
|
|
53
|
+
- Starting a new development phase
|
|
54
|
+
- Switching between different types of work (feature → bugfix)
|
|
55
|
+
- After major context accumulation (>8000 tokens)
|
|
56
|
+
- When agent handoffs occur
|
|
57
|
+
|
|
58
|
+
This ensures each plan starts with fresh, focused context optimized for the specific task type.
|