sdd-mcp-server 1.4.3 → 1.4.5
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 +129 -61
- package/dist/__tests__/legacy/setup.d.ts +44 -0
- package/dist/__tests__/legacy/setup.js +178 -0
- package/dist/__tests__/legacy/setup.js.map +1 -0
- package/dist/__tests__/legacy/test-helpers/mock-factories.d.ts +26 -0
- package/dist/__tests__/legacy/test-helpers/mock-factories.js +466 -0
- package/dist/__tests__/legacy/test-helpers/mock-factories.js.map +1 -0
- package/dist/adapters/cli/SDDToolAdapter.js +2 -236
- package/dist/adapters/cli/SDDToolAdapter.js.map +1 -1
- package/dist/application/services/staticSteering.d.ts +6 -0
- package/dist/application/services/staticSteering.js +567 -0
- package/dist/application/services/staticSteering.js.map +1 -0
- package/dist/index.js +122 -13
- package/dist/index.js.map +1 -1
- package/dist/utils/specGenerator.js +178 -22
- package/dist/utils/specGenerator.js.map +1 -1
- package/mcp-server.js +44 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
A Model Context Protocol (MCP) server implementing Spec-Driven Development (SDD) workflows for AI-agent CLIs and IDEs like Claude Code, Cursor, and others.
|
|
8
8
|
|
|
9
|
-
> ✅ v1.4.
|
|
9
|
+
> ✅ **v1.4.5 Update**: Internal improvements! Reorganized test structure for better maintainability, centralized static steering document creation following DRY principle, improved code organization with better separation of concerns.
|
|
10
|
+
|
|
11
|
+
> ✅ **v1.4.4**: Comprehensive codebase analysis + TDD workflow! Documents are generated with real multi-language detection (TypeScript, Java, Python, Go, Ruby, PHP, Rust, C#, Scala), framework detection (Spring Boot, Django, FastAPI, Rails, Laravel, Express, React, etc.), and architecture pattern recognition. New `principles.md` steering document enforces SOLID, DRY, KISS, YAGNI, Separation of Concerns, and Modularity. Task generation now follows Test-Driven Development (RED-GREEN-REFACTOR) workflow.
|
|
10
12
|
|
|
11
13
|
## 🚀 Quick Start
|
|
12
14
|
|
|
@@ -16,7 +18,7 @@ A Model Context Protocol (MCP) server implementing Spec-Driven Development (SDD)
|
|
|
16
18
|
npx -y sdd-mcp-server@latest
|
|
17
19
|
|
|
18
20
|
# Pin exact version (optional)
|
|
19
|
-
npx -y sdd-mcp-server@1.4.
|
|
21
|
+
npx -y sdd-mcp-server@1.4.5
|
|
20
22
|
|
|
21
23
|
# For Claude Code MCP integration, add to your configuration:
|
|
22
24
|
# "sdd-mcp-server": {
|
|
@@ -31,7 +33,7 @@ npx -y sdd-mcp-server@1.4.2
|
|
|
31
33
|
npm install -g sdd-mcp-server@latest
|
|
32
34
|
|
|
33
35
|
# Pin exact version (optional)
|
|
34
|
-
npm install -g sdd-mcp-server@1.4.
|
|
36
|
+
npm install -g sdd-mcp-server@1.4.5
|
|
35
37
|
|
|
36
38
|
# Start the server
|
|
37
39
|
sdd-mcp-server
|
|
@@ -147,16 +149,16 @@ Once connected to your AI client, you can use these MCP tools:
|
|
|
147
149
|
| Tool | Description | Usage |
|
|
148
150
|
|------|-------------|--------|
|
|
149
151
|
| `sdd-init` | Initialize new SDD project | Creates .kiro directory structure + AGENTS.md for cross-platform AI support |
|
|
150
|
-
| `sdd-requirements` | Generate context-aware requirements | Analyzes package.json and structure to create EARS-formatted requirements |
|
|
151
|
-
| `sdd-design` | Create project-specific design | Generates architecture docs based on actual tech stack and
|
|
152
|
-
| `sdd-tasks` | Generate
|
|
152
|
+
| `sdd-requirements` | Generate context-aware requirements | Analyzes package.json and structure to create EARS-formatted requirements with comprehensive multi-language analysis |
|
|
153
|
+
| `sdd-design` | Create project-specific design | Generates architecture docs based on actual tech stack, dependencies, and framework detection |
|
|
154
|
+
| `sdd-tasks` | Generate TDD-focused task breakdown | Creates test-first implementation tasks following RED-GREEN-REFACTOR workflow |
|
|
153
155
|
| `sdd-implement` | Implementation guidelines | Provides implementation steering |
|
|
154
156
|
| `sdd-status` | Check workflow progress | Shows current phase and approvals |
|
|
155
157
|
| `sdd-approve` | Approve workflow phases | Mark phases as approved for progression |
|
|
156
158
|
| `sdd-quality-check` | Code quality analysis | Linus-style 5-layer code review |
|
|
157
159
|
| `sdd-context-load` | Load project context | Restore project memory and state |
|
|
158
160
|
| `sdd-template-render` | Render templates | Generate files from templates |
|
|
159
|
-
| `sdd-steering` | Create/update steering docs | Analyzes project to generate product.md, tech.md, structure.md
|
|
161
|
+
| `sdd-steering` | Create/update steering docs | Analyzes project to generate product.md, tech.md, structure.md + static docs: linus-review.md, commit.md, security-check.md, tdd-guideline.md, principles.md (SOLID/DRY/KISS/YAGNI/SoC/Modularity) |
|
|
160
162
|
| `sdd-steering-custom` | Create custom steering docs | Add specialized guidance documents |
|
|
161
163
|
| `sdd-validate-design` | Design quality validation | Interactive GO/NO-GO design review |
|
|
162
164
|
| `sdd-validate-gap` | Implementation gap analysis | Analyze requirements vs codebase |
|
|
@@ -167,57 +169,95 @@ Once connected to your AI client, you can use these MCP tools:
|
|
|
167
169
|
1. **Initialize Project & Steering**
|
|
168
170
|
```
|
|
169
171
|
Use sdd-init to create a new SDD project
|
|
170
|
-
Use sdd-steering to generate
|
|
172
|
+
Use sdd-steering to generate 8 steering documents:
|
|
173
|
+
- product.md, tech.md, structure.md (dynamic, analyzed from codebase)
|
|
174
|
+
- linus-review.md, commit.md, security-check.md (static quality standards)
|
|
175
|
+
- tdd-guideline.md (Test-Driven Development workflow)
|
|
176
|
+
- principles.md (SOLID, DRY, KISS, YAGNI, SoC, Modularity)
|
|
171
177
|
```
|
|
172
178
|
|
|
173
179
|
2. **Generate Requirements**
|
|
174
180
|
```
|
|
175
|
-
Use sdd-requirements to analyze
|
|
181
|
+
Use sdd-requirements to analyze your project with comprehensive multi-language detection
|
|
182
|
+
Automatically detects: language, framework, build tools, test frameworks, architecture patterns
|
|
183
|
+
Creates EARS-formatted requirements based on actual project context
|
|
176
184
|
Use sdd-validate-gap to analyze implementation feasibility
|
|
177
185
|
```
|
|
178
186
|
|
|
179
187
|
3. **Create Design**
|
|
180
188
|
```
|
|
181
|
-
Use sdd-design to generate architecture based on
|
|
189
|
+
Use sdd-design to generate architecture based on detected tech stack
|
|
190
|
+
Includes: component structure, data models, API design, tech stack details
|
|
182
191
|
Use sdd-validate-design for GO/NO-GO design review
|
|
183
192
|
```
|
|
184
193
|
|
|
185
|
-
4. **Plan Tasks**
|
|
194
|
+
4. **Plan Tasks with TDD**
|
|
186
195
|
```
|
|
187
|
-
Use sdd-tasks to create implementation breakdown
|
|
196
|
+
Use sdd-tasks to create TDD-focused implementation breakdown
|
|
197
|
+
Tasks follow RED-GREEN-REFACTOR workflow automatically
|
|
198
|
+
Phases: Test Setup → Implementation → Refactoring → Integration
|
|
188
199
|
```
|
|
189
200
|
|
|
190
201
|
5. **Implement with TDD**
|
|
191
202
|
```
|
|
192
|
-
Use sdd-spec-impl to execute tasks with
|
|
193
|
-
|
|
194
|
-
|
|
203
|
+
Use sdd-spec-impl to execute tasks with Test-Driven Development
|
|
204
|
+
Follow the generated TDD workflow from tdd-guideline.md
|
|
205
|
+
Use sdd-quality-check for Linus-style code review and SOLID principles validation
|
|
206
|
+
```
|
|
195
207
|
|
|
196
208
|
6. **Monitor & Manage**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
## Upgrading to 1.4.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
-
|
|
219
|
-
|
|
220
|
-
|
|
209
|
+
```
|
|
210
|
+
Use sdd-status to check workflow progress and phase approvals
|
|
211
|
+
Use sdd-approve to mark phases as approved
|
|
212
|
+
Use sdd-context-load to restore project memory
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Upgrading to 1.4.4
|
|
216
|
+
|
|
217
|
+
**What's New in v1.4.4**:
|
|
218
|
+
- ✅ **Comprehensive Codebase Analysis**: Documents now generated with full multi-language detection (TypeScript, Java, Python, Go, Ruby, PHP, Rust, C#, Scala)
|
|
219
|
+
- ✅ **Framework Detection**: Automatic recognition of Spring Boot, Django, FastAPI, Rails, Laravel, Express, React, Vue, Angular, Next.js, and 20+ frameworks
|
|
220
|
+
- ✅ **Build Tool & Test Framework Detection**: Identifies Maven, Gradle, npm, pip, cargo, Jest, pytest, JUnit, Mocha, and more
|
|
221
|
+
- ✅ **Architecture Pattern Recognition**: Detects DDD, MVC, Microservices, and Clean Architecture patterns
|
|
222
|
+
- ✅ **New Steering Document**: `principles.md` added with comprehensive SOLID, DRY, KISS, YAGNI, Separation of Concerns, and Modularity guidance
|
|
223
|
+
- ✅ **TDD Task Generation**: All implementation tasks now follow Test-Driven Development (RED-GREEN-REFACTOR) workflow
|
|
224
|
+
- ✅ **Improved Error Handling**: Better logging and debug messages for analysis failures
|
|
225
|
+
- ✅ **User Feedback**: Clear indication whether comprehensive analysis or fallback template was used
|
|
226
|
+
|
|
227
|
+
**Upgrade Commands**:
|
|
228
|
+
```bash
|
|
229
|
+
# Prefer npx (no installation required)
|
|
230
|
+
npx -y sdd-mcp-server@latest
|
|
231
|
+
|
|
232
|
+
# Or pin to specific version
|
|
233
|
+
npx -y sdd-mcp-server@1.4.4
|
|
234
|
+
|
|
235
|
+
# Global installation
|
|
236
|
+
npm install -g sdd-mcp-server@latest
|
|
237
|
+
# Or pin: npm install -g sdd-mcp-server@1.4.4
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Migration Notes**:
|
|
241
|
+
- If you pinned a version in your MCP config, update it to `@latest` or `@1.4.4`
|
|
242
|
+
- All steering documents now include `principles.md` and `tdd-guideline.md` automatically
|
|
243
|
+
- TDD task generation is now default - tasks will follow RED-GREEN-REFACTOR order
|
|
244
|
+
- No code changes needed - all improvements are backward compatible
|
|
245
|
+
|
|
246
|
+
## Previous Versions
|
|
247
|
+
|
|
248
|
+
### v1.4.3
|
|
249
|
+
- Comprehensive codebase analysis fix for document generation
|
|
250
|
+
- Enhanced multi-language and framework detection
|
|
251
|
+
- Better error reporting and user feedback
|
|
252
|
+
|
|
253
|
+
### v1.4.2
|
|
254
|
+
- Added `tdd-guideline.md` steering document for TDD enforcement
|
|
255
|
+
- Security-check.md (OWASP Top 10) included in static steering docs
|
|
256
|
+
|
|
257
|
+
### v1.4.0
|
|
258
|
+
- Analysis-based document generation on first run (no more template-first step)
|
|
259
|
+
- Dynamic steering with static exceptions (`linus-review.md`, `commit.md`)
|
|
260
|
+
- Node.js >= 18 required
|
|
221
261
|
|
|
222
262
|
## ⚙️ Configuration
|
|
223
263
|
|
|
@@ -261,11 +301,16 @@ claude mcp add sdd "sdd-mcp-server"
|
|
|
261
301
|
## 🏗️ Key Features
|
|
262
302
|
|
|
263
303
|
- **5-Phase SDD Workflow**: INIT → REQUIREMENTS → DESIGN → TASKS → IMPLEMENTATION
|
|
264
|
-
- **
|
|
304
|
+
- **Comprehensive Multi-Language Analysis**: Automatic detection of TypeScript, JavaScript, Java, Python, Go, Ruby, PHP, Rust, C#, Scala projects with framework-specific insights
|
|
305
|
+
- **Framework Detection**: Recognizes Spring Boot, Django, FastAPI, Flask, Rails, Laravel, Express, React, Vue, Angular, Next.js, and 20+ other frameworks
|
|
306
|
+
- **TDD-First Task Generation**: All implementation tasks follow Test-Driven Development (RED-GREEN-REFACTOR) methodology
|
|
307
|
+
- **Coding Principles Enforcement**: Built-in SOLID, DRY, KISS, YAGNI, Separation of Concerns, and Modularity guidance
|
|
308
|
+
- **Context-Aware Generation**: Analyzes package.json, dependencies, build tools, test frameworks, and project structure for real content
|
|
265
309
|
- **EARS-Formatted Requirements**: Generate acceptance criteria based on actual npm scripts and dependencies
|
|
266
|
-
- **Architecture
|
|
267
|
-
- **Quality Enforcement**: Linus-style 5-layer code review system
|
|
268
|
-
- **
|
|
310
|
+
- **Architecture Pattern Recognition**: Detects DDD, MVC, Microservices, Clean Architecture patterns in your codebase
|
|
311
|
+
- **Quality Enforcement**: Linus-style 5-layer code review system with security (OWASP Top 10) checks
|
|
312
|
+
- **Comprehensive Steering Documents**: 8 auto-generated guidance docs (product, tech, structure, linus-review, commit, tdd-guideline, security-check, principles)
|
|
313
|
+
- **Multi-Language Support**: 10 languages with cultural adaptation (en, es, fr, de, it, pt, ru, ja, zh, ko)
|
|
269
314
|
- **Template Engine**: Handlebars-based file generation with project-specific data
|
|
270
315
|
- **Plugin System**: Extensible architecture for custom workflows
|
|
271
316
|
- **MCP Protocol**: Full compatibility with AI-agent CLIs and IDEs
|
|
@@ -276,22 +321,40 @@ Here's how to use the MCP SDD Server in your AI client:
|
|
|
276
321
|
|
|
277
322
|
```bash
|
|
278
323
|
# 1. Initialize a new project
|
|
279
|
-
"Use the sdd-init tool to create a project called 'my-web-app'
|
|
324
|
+
"Use the sdd-init tool to create a project called 'my-web-app'
|
|
325
|
+
for a React/TypeScript application with user authentication"
|
|
326
|
+
|
|
327
|
+
# 2. Generate steering documents
|
|
328
|
+
"Use sdd-steering to analyze my codebase and generate all steering documents"
|
|
329
|
+
# Result: 8 steering documents created including principles.md and tdd-guideline.md
|
|
280
330
|
|
|
281
|
-
#
|
|
331
|
+
# 3. Generate requirements with comprehensive analysis
|
|
282
332
|
"Use sdd-requirements to analyze the project and create requirements.md"
|
|
333
|
+
# Result: Detects TypeScript, React, npm, Jest, and generates EARS-formatted requirements
|
|
334
|
+
|
|
335
|
+
# 4. Create technical design
|
|
336
|
+
"Use sdd-design to generate architecture based on my React/TypeScript stack"
|
|
337
|
+
# Result: Component structure, state management design, API integration patterns
|
|
338
|
+
|
|
339
|
+
# 5. Validate design quality
|
|
340
|
+
"Use sdd-validate-design to review the architecture for potential issues"
|
|
341
|
+
# Result: GO/NO-GO assessment with improvement recommendations
|
|
283
342
|
|
|
284
|
-
#
|
|
285
|
-
"Use sdd-
|
|
343
|
+
# 6. Plan TDD-focused implementation tasks
|
|
344
|
+
"Use sdd-tasks to break down the work into TDD implementation phases"
|
|
345
|
+
# Result: Tasks organized as RED (tests) → GREEN (implementation) → REFACTOR (quality)
|
|
286
346
|
|
|
287
|
-
#
|
|
288
|
-
"Use sdd-
|
|
347
|
+
# 7. Implement with TDD
|
|
348
|
+
"Use sdd-spec-impl to execute the authentication tasks with TDD methodology"
|
|
349
|
+
# Result: Test-first development following principles.md and tdd-guideline.md
|
|
289
350
|
|
|
290
|
-
#
|
|
291
|
-
"Use sdd-
|
|
351
|
+
# 8. Review code quality
|
|
352
|
+
"Use sdd-quality-check to perform Linus-style code review with SOLID principles check"
|
|
353
|
+
# Result: 5-layer analysis + SOLID/DRY/KISS validation + security checks
|
|
292
354
|
|
|
293
|
-
#
|
|
294
|
-
"Use sdd-
|
|
355
|
+
# 9. Check workflow status
|
|
356
|
+
"Use sdd-status to see current progress and approvals"
|
|
357
|
+
# Result: Phase completion status and approval tracking
|
|
295
358
|
```
|
|
296
359
|
|
|
297
360
|
## 🛠️ Development & Troubleshooting
|
|
@@ -361,19 +424,24 @@ claude mcp add sdd "$(pwd)/mcp-server.js" -s local
|
|
|
361
424
|
sudo npm install -g sdd-mcp-server
|
|
362
425
|
```
|
|
363
426
|
|
|
364
|
-
**Issue: "Only template content generated" (
|
|
427
|
+
**Issue: "Only template content generated" (Improved in v1.4.3)**
|
|
365
428
|
|
|
366
|
-
As of
|
|
367
|
-
- Check the
|
|
368
|
-
-
|
|
429
|
+
As of v1.4.3, comprehensive codebase analysis is automatic with multi-language detection. Documents include real framework, build tool, and architecture information. If you still see a basic template:
|
|
430
|
+
- Check the tool response message — it shows "✅ Comprehensive codebase analysis" or "⚠️ Basic template (analysis failed)"
|
|
431
|
+
- Check the top of the generated file for warning headers with error details
|
|
432
|
+
- Common causes: missing package.json, permissions issues, or unsupported project structure
|
|
433
|
+
- Fix the issue and rerun the tool to get comprehensive analysis
|
|
369
434
|
|
|
370
435
|
## 📖 Advanced Documentation
|
|
371
436
|
|
|
372
437
|
For detailed documentation on:
|
|
373
|
-
- Plugin Development
|
|
374
|
-
- Docker Deployment
|
|
375
|
-
- Architecture Details
|
|
376
|
-
- Quality
|
|
438
|
+
- **Plugin Development**: See [DEPLOYMENT.md](DEPLOYMENT.md)
|
|
439
|
+
- **Docker Deployment**: See [Dockerfile](Dockerfile) and [docker-compose.yml](docker-compose.yml)
|
|
440
|
+
- **Architecture Details**: Explore the `/src` directory structure
|
|
441
|
+
- **Code Quality Standards**: Review `.kiro/steering/linus-review.md`
|
|
442
|
+
- **TDD Guidelines**: See `.kiro/steering/tdd-guideline.md` for complete Test-Driven Development workflow
|
|
443
|
+
- **Coding Principles**: Review `.kiro/steering/principles.md` for SOLID, DRY, KISS, YAGNI, SoC, and Modularity guidance
|
|
444
|
+
- **Security Checklist**: Check `.kiro/steering/security-check.md` for OWASP Top 10 aligned security practices
|
|
377
445
|
|
|
378
446
|
## 🐛 Support & Issues
|
|
379
447
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace jest {
|
|
4
|
+
interface Matchers<R> {
|
|
5
|
+
toBeWithinTimeThreshold(threshold?: number): R;
|
|
6
|
+
toHaveValidWorkflowState(): R;
|
|
7
|
+
toHaveValidPluginStructure(): R;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const TEST_CONFIG: {
|
|
11
|
+
timeout: number;
|
|
12
|
+
performanceThreshold: number;
|
|
13
|
+
tempDir: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare const TestUtils: {
|
|
17
|
+
createMockLogger: () => {
|
|
18
|
+
debug: jest.Mock<any, any, any>;
|
|
19
|
+
info: jest.Mock<any, any, any>;
|
|
20
|
+
warn: jest.Mock<any, any, any>;
|
|
21
|
+
error: jest.Mock<any, any, any>;
|
|
22
|
+
};
|
|
23
|
+
createMockFileSystem: () => {
|
|
24
|
+
readFile: jest.Mock<any, any, any>;
|
|
25
|
+
writeFile: jest.Mock<any, any, any>;
|
|
26
|
+
exists: jest.Mock<any, any, any>;
|
|
27
|
+
mkdir: jest.Mock<any, any, any>;
|
|
28
|
+
readdir: jest.Mock<any, any, any>;
|
|
29
|
+
stat: jest.Mock<any, any, any>;
|
|
30
|
+
join: jest.Mock<string, string[], any>;
|
|
31
|
+
basename: jest.Mock<string, [path: string], any>;
|
|
32
|
+
dirname: jest.Mock<string, [path: string], any>;
|
|
33
|
+
};
|
|
34
|
+
createMockValidation: () => {
|
|
35
|
+
validate: jest.Mock<any, any, any>;
|
|
36
|
+
validateSchema: jest.Mock<any, any, any>;
|
|
37
|
+
createValidator: jest.Mock<any, any, any>;
|
|
38
|
+
};
|
|
39
|
+
createTestWorkflowState: (overrides?: any) => any;
|
|
40
|
+
createTestPlugin: (overrides?: any) => any;
|
|
41
|
+
waitFor: (ms: number) => Promise<unknown>;
|
|
42
|
+
createTempDir: () => Promise<string>;
|
|
43
|
+
cleanupTempDir: (dir: string) => Promise<void>;
|
|
44
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Test setup and configuration for comprehensive testing framework
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
// Global test configuration
|
|
4
|
+
const TEST_TIMEOUT = 30000; // 30 seconds
|
|
5
|
+
const PERFORMANCE_THRESHOLD = 5000; // 5 seconds for performance tests
|
|
6
|
+
// Setup global test utilities
|
|
7
|
+
globalThis.TEST_CONFIG = {
|
|
8
|
+
timeout: TEST_TIMEOUT,
|
|
9
|
+
performanceThreshold: PERFORMANCE_THRESHOLD,
|
|
10
|
+
tempDir: process.env.TEST_TEMP_DIR || '/tmp/sdd-mcp-tests'
|
|
11
|
+
};
|
|
12
|
+
// Mock console methods for cleaner test output
|
|
13
|
+
const originalConsole = { ...console };
|
|
14
|
+
beforeAll(() => {
|
|
15
|
+
// Silence console output during tests unless TEST_VERBOSE is set
|
|
16
|
+
if (!process.env.TEST_VERBOSE) {
|
|
17
|
+
console.log = jest.fn();
|
|
18
|
+
console.debug = jest.fn();
|
|
19
|
+
console.info = jest.fn();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
afterAll(() => {
|
|
23
|
+
// Restore console methods
|
|
24
|
+
if (!process.env.TEST_VERBOSE) {
|
|
25
|
+
Object.assign(console, originalConsole);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
// Global error handling
|
|
29
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
30
|
+
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
|
31
|
+
});
|
|
32
|
+
// Setup test matchers
|
|
33
|
+
expect.extend({
|
|
34
|
+
toBeWithinTimeThreshold(received, threshold = PERFORMANCE_THRESHOLD) {
|
|
35
|
+
const pass = received <= threshold;
|
|
36
|
+
if (pass) {
|
|
37
|
+
return {
|
|
38
|
+
message: () => `Expected ${received}ms to exceed ${threshold}ms`,
|
|
39
|
+
pass: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return {
|
|
44
|
+
message: () => `Expected ${received}ms to be within ${threshold}ms threshold`,
|
|
45
|
+
pass: false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
toHaveValidWorkflowState(received) {
|
|
50
|
+
const requiredPhases = ['INIT', 'REQUIREMENTS', 'DESIGN', 'TASKS', 'IMPLEMENTATION'];
|
|
51
|
+
const requiredProperties = ['currentPhase', 'state', 'phases'];
|
|
52
|
+
const hasRequiredProperties = requiredProperties.every(prop => received && typeof received === 'object' && prop in received);
|
|
53
|
+
const hasAllPhases = requiredPhases.every(phase => received.phases && phase in received.phases);
|
|
54
|
+
const validCurrentPhase = requiredPhases.includes(received.currentPhase);
|
|
55
|
+
const pass = hasRequiredProperties && hasAllPhases && validCurrentPhase;
|
|
56
|
+
if (pass) {
|
|
57
|
+
return {
|
|
58
|
+
message: () => `Expected workflow state to be invalid`,
|
|
59
|
+
pass: true,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return {
|
|
64
|
+
message: () => `Expected workflow state to have valid structure with all phases and properties`,
|
|
65
|
+
pass: false,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
toHaveValidPluginStructure(received) {
|
|
70
|
+
const requiredProperties = ['id', 'name', 'version', 'capabilities'];
|
|
71
|
+
const hasRequiredProperties = requiredProperties.every(prop => received && typeof received === 'object' && prop in received);
|
|
72
|
+
const hasValidCapabilities = Array.isArray(received.capabilities);
|
|
73
|
+
const pass = hasRequiredProperties && hasValidCapabilities;
|
|
74
|
+
if (pass) {
|
|
75
|
+
return {
|
|
76
|
+
message: () => `Expected plugin structure to be invalid`,
|
|
77
|
+
pass: true,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
return {
|
|
82
|
+
message: () => `Expected plugin to have valid structure with required properties`,
|
|
83
|
+
pass: false,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
// Test utilities
|
|
89
|
+
export const TestUtils = {
|
|
90
|
+
// Create mock logger
|
|
91
|
+
createMockLogger: () => ({
|
|
92
|
+
debug: jest.fn(),
|
|
93
|
+
info: jest.fn(),
|
|
94
|
+
warn: jest.fn(),
|
|
95
|
+
error: jest.fn()
|
|
96
|
+
}),
|
|
97
|
+
// Create mock file system
|
|
98
|
+
createMockFileSystem: () => ({
|
|
99
|
+
readFile: jest.fn(),
|
|
100
|
+
writeFile: jest.fn(),
|
|
101
|
+
exists: jest.fn(),
|
|
102
|
+
mkdir: jest.fn(),
|
|
103
|
+
readdir: jest.fn(),
|
|
104
|
+
stat: jest.fn(),
|
|
105
|
+
join: jest.fn((...args) => args.join('/')),
|
|
106
|
+
basename: jest.fn((path) => path.split('/').pop() || ''),
|
|
107
|
+
dirname: jest.fn((path) => path.split('/').slice(0, -1).join('/'))
|
|
108
|
+
}),
|
|
109
|
+
// Create mock validation port
|
|
110
|
+
createMockValidation: () => ({
|
|
111
|
+
validate: jest.fn(),
|
|
112
|
+
validateSchema: jest.fn(),
|
|
113
|
+
createValidator: jest.fn()
|
|
114
|
+
}),
|
|
115
|
+
// Generate test workflow state
|
|
116
|
+
createTestWorkflowState: (overrides = {}) => ({
|
|
117
|
+
currentPhase: 'INIT',
|
|
118
|
+
state: 'IN_PROGRESS',
|
|
119
|
+
phases: {
|
|
120
|
+
INIT: { status: 'IN_PROGRESS', startedAt: new Date() },
|
|
121
|
+
REQUIREMENTS: { status: 'PENDING' },
|
|
122
|
+
DESIGN: { status: 'PENDING' },
|
|
123
|
+
TASKS: { status: 'PENDING' },
|
|
124
|
+
IMPLEMENTATION: { status: 'PENDING' }
|
|
125
|
+
},
|
|
126
|
+
startedAt: new Date(),
|
|
127
|
+
...overrides
|
|
128
|
+
}),
|
|
129
|
+
// Generate test plugin
|
|
130
|
+
createTestPlugin: (overrides = {}) => ({
|
|
131
|
+
id: 'test-plugin',
|
|
132
|
+
name: 'Test Plugin',
|
|
133
|
+
version: '1.0.0',
|
|
134
|
+
description: 'A test plugin',
|
|
135
|
+
author: 'Test Author',
|
|
136
|
+
license: 'MIT',
|
|
137
|
+
keywords: ['test'],
|
|
138
|
+
dependencies: [],
|
|
139
|
+
peerDependencies: [],
|
|
140
|
+
engines: [{ name: 'node', version: '>=18.0.0' }],
|
|
141
|
+
capabilities: [],
|
|
142
|
+
hooks: [],
|
|
143
|
+
tools: [],
|
|
144
|
+
steeringDocuments: [],
|
|
145
|
+
configuration: {
|
|
146
|
+
schema: {},
|
|
147
|
+
defaults: {},
|
|
148
|
+
required: [],
|
|
149
|
+
validation: []
|
|
150
|
+
},
|
|
151
|
+
metadata: {
|
|
152
|
+
createdAt: new Date(),
|
|
153
|
+
updatedAt: new Date(),
|
|
154
|
+
usageCount: 0,
|
|
155
|
+
ratings: [],
|
|
156
|
+
tags: [],
|
|
157
|
+
category: 'UTILITY',
|
|
158
|
+
maturity: 'STABLE',
|
|
159
|
+
supportedLanguages: ['typescript']
|
|
160
|
+
},
|
|
161
|
+
...overrides
|
|
162
|
+
}),
|
|
163
|
+
// Wait for promises to resolve
|
|
164
|
+
waitFor: (ms) => new Promise(resolve => setTimeout(resolve, ms)),
|
|
165
|
+
// Create temporary directory for tests
|
|
166
|
+
createTempDir: async () => {
|
|
167
|
+
const { promises: fs } = await import('fs');
|
|
168
|
+
const os = await import('os');
|
|
169
|
+
const path = await import('path');
|
|
170
|
+
return await fs.mkdtemp(path.join(os.tmpdir(), 'sdd-mcp-test-'));
|
|
171
|
+
},
|
|
172
|
+
// Clean up temporary directory
|
|
173
|
+
cleanupTempDir: async (dir) => {
|
|
174
|
+
const { promises: fs } = await import('fs');
|
|
175
|
+
await fs.rm(dir, { recursive: true, force: true });
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/__tests__/legacy/setup.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,kBAAkB,CAAC;AAE1B,4BAA4B;AAC5B,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,aAAa;AACzC,MAAM,qBAAqB,GAAG,IAAI,CAAC,CAAC,kCAAkC;AAEtE,8BAA8B;AAC7B,UAAkB,CAAC,WAAW,GAAG;IAChC,OAAO,EAAE,YAAY;IACrB,oBAAoB,EAAE,qBAAqB;IAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,oBAAoB;CAC3D,CAAC;AAEF,+CAA+C;AAC/C,MAAM,eAAe,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;AAEvC,SAAS,CAAC,GAAG,EAAE;IACb,iEAAiE;IACjE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACxB,OAAO,CAAC,KA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egistration(overrides?: any): any;
|
|
3
|
+
static createMockHookExecutionContext(overrides?: any): any;
|
|
4
|
+
static createMockHookResult(overrides?: any): any;
|
|
5
|
+
static createMockToolRegistration(overrides?: any): any;
|
|
6
|
+
static createMockToolExecutionContext(overrides?: any): any;
|
|
7
|
+
static createMockToolResult(overrides?: any): any;
|
|
8
|
+
static createMockSteeringDeclaration(overrides?: any): any;
|
|
9
|
+
static createMockSteeringContext(overrides?: any): any;
|
|
10
|
+
static createMockSteeringResult(overrides?: any): any;
|
|
11
|
+
static createMockPlugin(overrides?: any): any;
|
|
12
|
+
static createMockPluginInstance(overrides?: any): any;
|
|
13
|
+
static createMockPluginDescriptor(overrides?: any): any;
|
|
14
|
+
static createMockPluginValidationResult(overrides?: any): any;
|
|
15
|
+
static createMockWorkflowState(overrides?: any): any;
|
|
16
|
+
static createMockWorkflowMetrics(overrides?: any): any;
|
|
17
|
+
static createMockMCPTool(overrides?: any): any;
|
|
18
|
+
static createMockMCPRequest(overrides?: any): any;
|
|
19
|
+
static createMockMCPResponse(overrides?: any): any;
|
|
20
|
+
static createMockPerformanceMetrics(overrides?: any): any;
|
|
21
|
+
static createMockValidationError(overrides?: any): any;
|
|
22
|
+
static createMockSecurityIssue(overrides?: any): any;
|
|
23
|
+
static createMockHookRegistrations(count: number): any[];
|
|
24
|
+
static createMockToolRegistrations(count: number): any[];
|
|
25
|
+
static createMockSteeringDocuments(count: number): any[];
|
|
26
|
+
}
|