sdd-mcp-server 1.3.7 → 1.3.9

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/mcp-server.js +545 -56
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,7 +6,7 @@
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.3.7 Update**: Complete self-contained MCP server with 15 SDD workflow tools. Features fixed steering document generation, universal AI agent compatibility, and easy installation via `npx -y sdd-mcp-server@latest`. No custom commands required!
9
+ > **✅ v1.3.9 Update**: AI-driven MCP server with language-agnostic workflow tools. Fixed all hardcoded templates, made tools truly universal for any programming language/framework, and added comprehensive AGENTS.md support. Fixed AGENTS.md file placement in .kiro/steering/ directory. Perfect for Spring Boot, React, Python, Go, and any other project!
10
10
 
11
11
  ## 🚀 Quick Start
12
12
 
package/mcp-server.js CHANGED
@@ -107,8 +107,8 @@ server.registerTool("sdd-init", {
107
107
  const requirementsTemplate = `# Requirements Document\n\n## Project Description (Input)\n${description}\n\n## Requirements\n<!-- Will be generated in /kiro:spec-requirements phase -->`;
108
108
  await fs.writeFile(path.join(featurePath, 'requirements.md'), requirementsTemplate);
109
109
 
110
- // Ensure AGENTS.md exists based on CLAUDE.md (static exception)
111
- const agentsPath = path.join(currentPath, 'AGENTS.md');
110
+ // Ensure AGENTS.md exists in steering directory based on CLAUDE.md (static exception)
111
+ const agentsPath = path.join(steeringPath, 'AGENTS.md');
112
112
  const claudePath = path.join(currentPath, 'CLAUDE.md');
113
113
  const agentsExists = await fs.access(agentsPath).then(() => true).catch(() => false);
114
114
  if (!agentsExists) {
@@ -172,8 +172,39 @@ server.registerTool("sdd-requirements", {
172
172
  const specContent = await fs.readFile(specPath, 'utf8');
173
173
  const spec = JSON.parse(specContent);
174
174
 
175
- // Generate EARS-format requirements
176
- const requirementsContent = `# Requirements Document\n\n## Introduction\nThis feature delivers comprehensive spec-driven development workflow capabilities to AI development teams.\n\n## Requirements\n\n### Requirement 1: Project Initialization\n**Objective:** As a developer, I want to initialize SDD projects with proper structure, so that I can follow structured development workflows\n\n#### Acceptance Criteria\n1. WHEN a user runs sdd-init THEN the system SHALL create .kiro directory structure\n2. WHEN initialization occurs THEN the system SHALL generate spec.json with metadata\n3. WHEN project is created THEN the system SHALL create requirements.md template\n4. WHERE .kiro directory exists THE system SHALL track project state and approvals\n\n### Requirement 2: Requirements Generation\n**Objective:** As a developer, I want to generate comprehensive requirements, so that I can clearly define project scope\n\n1. WHEN requirements are requested THEN the system SHALL generate EARS-format acceptance criteria\n2. IF project description exists THEN the system SHALL incorporate it into requirements\n3. WHILE requirements are being generated THE system SHALL follow structured documentation patterns\n\n### Requirement 3: Workflow Phase Management\n**Objective:** As a developer, I want phase-based workflow control, so that I can ensure proper development progression\n\n1. WHEN each phase completes THEN the system SHALL require approval before proceeding\n2. IF approvals are missing THEN the system SHALL block phase transitions\n3. WHERE workflow violations occur THE system SHALL provide clear guidance`;
175
+ // Generate requirements based on project analysis and AI understanding
176
+ const requirementsContent = `# Requirements Document
177
+
178
+ ## Project Context
179
+ **Feature**: ${spec.feature_name}
180
+ **Description**: ${spec.description || 'Feature to be implemented'}
181
+
182
+ ## Instructions for AI Agent
183
+
184
+ Please analyze the current project structure and the feature description above to generate comprehensive requirements. Consider:
185
+
186
+ 1. **Project Analysis**: Examine the codebase structure, existing files, dependencies, and architecture patterns
187
+ 2. **Feature Scope**: Based on the feature description, identify what needs to be built
188
+ 3. **User Stories**: Create user stories that capture the value this feature provides
189
+ 4. **Technical Requirements**: Identify technical constraints and integration points
190
+ 5. **Acceptance Criteria**: Use EARS format (WHEN/IF/WHILE/WHERE) for testable criteria
191
+
192
+ ## Requirements Generation Guidelines
193
+
194
+ Generate requirements that:
195
+ - Are specific to this actual project (not generic)
196
+ - Consider the existing codebase architecture
197
+ - Include functional and non-functional requirements
198
+ - Use EARS format for acceptance criteria
199
+ - Are testable and measurable
200
+ - Consider integration with existing features
201
+
202
+ ## Current Project Information
203
+ - Project Path: ${process.cwd()}
204
+ - Feature Name: ${spec.feature_name}
205
+ - Initialization Date: ${spec.created_at}
206
+
207
+ **Note**: This template will be replaced by AI-generated requirements specific to your project and feature description.`;
177
208
 
178
209
  await fs.writeFile(path.join(featurePath, 'requirements.md'), requirementsContent);
179
210
 
@@ -226,8 +257,17 @@ server.registerTool("sdd-design", {
226
257
  };
227
258
  }
228
259
 
260
+ // Read requirements for context
261
+ const requirementsPath = path.join(featurePath, 'requirements.md');
262
+ let requirementsContext = '';
263
+ try {
264
+ requirementsContext = await fs.readFile(requirementsPath, 'utf8');
265
+ } catch (error) {
266
+ requirementsContext = 'Requirements document not available';
267
+ }
268
+
229
269
  // Generate design document
230
- const designContent = `# Technical Design Document\n\n## Overview\n\n**Purpose**: This feature delivers comprehensive MCP server capabilities for spec-driven development workflows to AI development teams.\n\n**Users**: AI developers and development teams will utilize this for structured project development.\n\n**Impact**: Transforms ad-hoc development into systematic, phase-based workflows with quality gates.\n\n### Goals\n- Provide complete SDD workflow automation\n- Ensure quality through Linus-style code review\n- Enable multi-language development support\n- Integrate seamlessly with AI development tools\n\n### Non-Goals\n- Real-time collaboration features\n- Deployment automation\n- Version control integration\n\n## Architecture\n\n### High-Level Architecture\n\n\`\`\`mermaid\ngraph TB\n A[AI Client] --> B[MCP Server]\n B --> C[SDD Workflow Engine]\n C --> D[Project Management]\n C --> E[Template System]\n C --> F[Quality Analysis]\n D --> G[File System]\n E --> G\n F --> G\n\`\`\`\n\n### Technology Stack\n\n**Runtime**: Node.js with ES modules\n**Protocol**: Model Context Protocol (MCP)\n**Templates**: Handlebars-based generation\n**Quality**: AST-based code analysis\n**Storage**: File-based project persistence\n\n### Key Design Decisions\n\n**Decision**: Use MCP protocol for AI tool integration\n**Context**: Need seamless integration with Claude Code and other AI development tools\n**Alternatives**: REST API, GraphQL, custom protocol\n**Selected Approach**: MCP provides standardized AI tool integration\n**Rationale**: Direct integration with AI development workflows\n**Trade-offs**: Protocol-specific but optimized for AI use cases\n\n## Components and Interfaces\n\n### SDD Workflow Engine\n\n**Responsibility**: Manages 5-phase workflow state transitions\n**Domain Boundary**: Workflow orchestration and validation\n**Data Ownership**: Phase state, approval tracking, transition rules\n\n**Contract Definition**:\n\`\`\`typescript\ninterface SDDWorkflowEngine {\n initializeProject(name: string, description: string): ProjectSpec;\n generateRequirements(featureName: string): RequirementsDoc;\n generateDesign(featureName: string): DesignDoc;\n generateTasks(featureName: string): TasksDoc;\n checkQuality(code: string): QualityReport;\n}\n\`\`\`\n\n### Template System\n\n**Responsibility**: Generate structured documents from templates\n**Domain Boundary**: Document generation and formatting\n**Data Ownership**: Template definitions, generated content\n\n### Quality Analysis Engine\n\n**Responsibility**: Perform Linus-style 5-layer code review\n**Domain Boundary**: Code quality assessment\n**Data Ownership**: Quality metrics, review reports\n\n## Data Models\n\n### Project Specification\n\`\`\`json\n{\n "feature_name": "string",\n "created_at": "ISO8601",\n "updated_at": "ISO8601",\n "language": "en",\n "phase": "initialized|requirements-generated|design-generated|tasks-generated|implementation",\n "approvals": {\n "requirements": { "generated": boolean, "approved": boolean },\n "design": { "generated": boolean, "approved": boolean },\n "tasks": { "generated": boolean, "approved": boolean }\n },\n "ready_for_implementation": boolean\n}\n\`\`\`\n\n## Error Handling\n\n### Error Strategy\n- Phase validation with clear error messages\n- Graceful degradation for missing dependencies\n- Detailed logging for debugging\n\n### Error Categories\n**User Errors**: Invalid phase transitions → workflow guidance\n**System Errors**: File system failures → graceful error handling\n**Business Logic Errors**: Missing approvals → phase requirement messages\n\n## Testing Strategy\n\n- Unit Tests: SDD workflow engine methods\n- Integration Tests: MCP protocol communication\n- E2E Tests: Complete workflow execution\n- Performance Tests: Large project handling`;
270
+ const designContent = `# Technical Design Document\n\n## Project Context\n**Feature**: ${spec.feature_name}\n**Description**: ${spec.description || 'Feature to be implemented'}\n**Requirements Phase**: ${spec.approvals.requirements.generated ? 'Completed' : 'Pending'}\n\n## Instructions for AI Agent\n\nPlease analyze the requirements document and current project structure to create a comprehensive technical design. Consider:\n\n1. **Requirements Analysis**: Review the requirements to understand what needs to be built\n2. **Architecture Review**: Examine the existing codebase architecture and patterns\n3. **Technology Stack**: Identify the current tech stack and integration points\n4. **Design Decisions**: Make architectural decisions based on the project context\n5. **Component Design**: Define components, interfaces, and data models\n6. **Implementation Strategy**: Outline how this feature fits into the existing system\n\n## Design Generation Guidelines\n\nCreate a design that:\n- Addresses all requirements from requirements.md\n- Fits naturally into the existing codebase architecture\n- Uses the project's existing technology stack and patterns\n- Includes specific component interfaces and data models\n- Considers error handling and edge cases\n- Provides clear implementation guidance\n\n## Requirements Context\n\`\`\`\n${requirementsContext.substring(0, 2000)}${requirementsContext.length > 2000 ? '...\n[Requirements document truncated - see requirements.md for full content]' : ''}\n\`\`\`\n\n## Current Project Information\n- Project Path: ${process.cwd()}\n- Feature Name: ${spec.feature_name}\n- Phase: ${spec.phase}\n- Created: ${spec.created_at}\n\n**Note**: This template will be replaced by AI-generated design specific for spec-driven development workflows to AI development teams.\n\n**Users**: AI developers and development teams will utilize this for structured project development.\n\n**Impact**: Transforms ad-hoc development into systematic, phase-based workflows with quality gates.\n\n### Goals\n- Provide complete SDD workflow automation\n- Ensure quality through Linus-style code review\n- Enable multi-language development support\n- Integrate seamlessly with AI development tools\n\n### Non-Goals\n- Real-time collaboration features\n- Deployment automation\n- Version control integration\n\n## Architecture\n\n### High-Level Architecture\n\n\`\`\`mermaid\ngraph TB\n A[AI Client] --> B[MCP Server]\n B --> C[SDD Workflow Engine]\n C --> D[Project Management]\n C --> E[Template System]\n C --> F[Quality Analysis]\n D --> G[File System]\n E --> G\n F --> G\n\`\`\`\n\n### Technology Stack\n\n**Runtime**: Node.js with ES modules\n**Protocol**: Model Context Protocol (MCP)\n**Templates**: Handlebars-based generation\n**Quality**: AST-based code analysis\n**Storage**: File-based project persistence\n\n### Key Design Decisions\n\n**Decision**: Use MCP protocol for AI tool integration\n**Context**: Need seamless integration with Claude Code and other AI development tools\n**Alternatives**: REST API, GraphQL, custom protocol\n**Selected Approach**: MCP provides standardized AI tool integration\n**Rationale**: Direct integration with AI development workflows\n**Trade-offs**: Protocol-specific but optimized for AI use cases\n\n## Components and Interfaces\n\n### SDD Workflow Engine\n\n**Responsibility**: Manages 5-phase workflow state transitions\n**Domain Boundary**: Workflow orchestration and validation\n**Data Ownership**: Phase state, approval tracking, transition rules\n\n**Contract Definition**:\n\`\`\`typescript\ninterface SDDWorkflowEngine {\n initializeProject(name: string, description: string): ProjectSpec;\n generateRequirements(featureName: string): RequirementsDoc;\n generateDesign(featureName: string): DesignDoc;\n generateTasks(featureName: string): TasksDoc;\n checkQuality(code: string): QualityReport;\n}\n\`\`\`\n\n### Template System\n\n**Responsibility**: Generate structured documents from templates\n**Domain Boundary**: Document generation and formatting\n**Data Ownership**: Template definitions, generated content\n\n### Quality Analysis Engine\n\n**Responsibility**: Perform Linus-style 5-layer code review\n**Domain Boundary**: Code quality assessment\n**Data Ownership**: Quality metrics, review reports\n\n## Data Models\n\n### Project Specification\n\`\`\`json\n{\n "feature_name": "string",\n "created_at": "ISO8601",\n "updated_at": "ISO8601",\n "language": "en",\n "phase": "initialized|requirements-generated|design-generated|tasks-generated|implementation",\n "approvals": {\n "requirements": { "generated": boolean, "approved": boolean },\n "design": { "generated": boolean, "approved": boolean },\n "tasks": { "generated": boolean, "approved": boolean }\n },\n "ready_for_implementation": boolean\n}\n\`\`\`\n\n## Error Handling\n\n### Error Strategy\n- Phase validation with clear error messages\n- Graceful degradation for missing dependencies\n- Detailed logging for debugging\n\n### Error Categories\n**User Errors**: Invalid phase transitions → workflow guidance\n**System Errors**: File system failures → graceful error handling\n**Business Logic Errors**: Missing approvals → phase requirement messages\n\n## Testing Strategy\n\n- Unit Tests: SDD workflow engine methods\n- Integration Tests: MCP protocol communication\n- E2E Tests: Complete workflow execution\n- Performance Tests: Large project handling`;
231
271
 
232
272
  await fs.writeFile(path.join(featurePath, 'design.md'), designContent);
233
273
 
@@ -280,8 +320,70 @@ server.registerTool("sdd-tasks", {
280
320
  };
281
321
  }
282
322
 
283
- // Generate tasks document
284
- const tasksContent = `# Implementation Plan\n\n- [ ] 1. Set up MCP server foundation and infrastructure\n - Initialize Node.js project with MCP SDK dependencies\n - Configure server infrastructure and request handling\n - Establish project directory structure and file operations\n - Set up configuration and environment management\n - _Requirements: All requirements need foundational setup_\n\n- [ ] 2. Build core SDD workflow engine\n- [ ] 2.1 Implement project initialization functionality\n - Set up .kiro directory structure creation\n - Implement spec.json metadata generation\n - Build requirements template creation logic\n - Add project state tracking mechanisms\n - _Requirements: 1.1, 1.2, 1.3_\n\n- [ ] 2.2 Enable workflow phase management\n - Implement phase transition validation logic\n - Build approval tracking system\n - Create workflow state persistence\n - Develop phase progression controls\n - _Requirements: 3.1, 3.2, 3.3_\n\n- [ ] 3. Implement document generation system\n- [ ] 3.1 Build requirements generation capabilities\n - Implement EARS-format requirements generation\n - Build project description integration\n - Create structured documentation patterns\n - Add requirements validation logic\n - _Requirements: 2.1, 2.2, 2.3_\n\n- [ ] 3.2 Create design document generation\n - Implement technical design template generation\n - Build architecture diagram integration\n - Create component specification logic\n - Add design validation and approval tracking\n - _Requirements: Design workflow requirements_\n\n- [ ] 3.3 Develop task breakdown functionality\n - Implement task generation from design specifications\n - Build sequential task numbering system\n - Create requirements traceability mapping\n - Add task completion tracking\n - _Requirements: Task management requirements_\n\n- [ ] 4. Integrate quality analysis and review system\n- [ ] 4.1 Implement Linus-style code review engine\n - Build 5-layer code analysis framework\n - Implement AST-based code quality assessment\n - Create quality report generation\n - Add review criteria and scoring system\n - _Requirements: Quality management requirements_\n\n- [ ] 5. Build MCP protocol integration\n- [ ] 5.1 Implement complete MCP tool registration\n - Register all 10 SDD tools with proper schemas\n - Implement tool execution handlers\n - Build error handling and validation\n - Add protocol compliance and communication\n - _Requirements: All tool integration requirements_\n\n- [ ] 6. Add testing and validation\n- [ ] 6.1 Create comprehensive test suite\n - Build unit tests for workflow engine\n - Implement integration tests for MCP communication\n - Create end-to-end workflow validation tests\n - Add performance and reliability testing\n - _Requirements: Testing and validation requirements_`;
323
+ // Read design and requirements for context
324
+ const designPath = path.join(featurePath, 'design.md');
325
+ const requirementsPath = path.join(featurePath, 'requirements.md');
326
+ let designContext = '';
327
+ let requirementsContext = '';
328
+
329
+ try {
330
+ designContext = await fs.readFile(designPath, 'utf8');
331
+ } catch (error) {
332
+ designContext = 'Design document not available';
333
+ }
334
+
335
+ try {
336
+ requirementsContext = await fs.readFile(requirementsPath, 'utf8');
337
+ } catch (error) {
338
+ requirementsContext = 'Requirements document not available';
339
+ }
340
+
341
+ // Generate tasks document based on requirements and design
342
+ const tasksContent = `# Implementation Plan
343
+
344
+ ## Project Context
345
+ **Feature**: ${spec.feature_name}
346
+ **Description**: ${spec.description || 'Feature to be implemented'}
347
+ **Design Phase**: ${spec.approvals.design.generated ? 'Completed' : 'Pending'}
348
+
349
+ ## Instructions for AI Agent
350
+
351
+ Please analyze the requirements and design documents to create a comprehensive implementation plan. Consider:
352
+
353
+ 1. **Requirements Review**: Understand all requirements that need to be implemented
354
+ 2. **Design Analysis**: Review the technical design and architecture decisions
355
+ 3. **Implementation Strategy**: Break down the work into logical, sequential tasks
356
+ 4. **Dependencies**: Identify task dependencies and prerequisites
357
+ 5. **Acceptance Criteria**: Ensure each task maps to testable requirements
358
+ 6. **Integration Points**: Consider how tasks integrate with existing codebase
359
+
360
+ ## Task Generation Guidelines
361
+
362
+ Create tasks that:
363
+ - Are specific and actionable
364
+ - Map directly to requirements and design components
365
+ - Include clear acceptance criteria
366
+ - Consider the existing codebase and architecture
367
+ - Are appropriately sized (not too large or too small)
368
+ - Include proper sequencing and dependencies
369
+
370
+ ## Requirements Context
371
+ \`\`\`
372
+ ${requirementsContext.substring(0, 1000)}${requirementsContext.length > 1000 ? '...\n[Requirements truncated - see requirements.md for full content]' : ''}
373
+ \`\`\`
374
+
375
+ ## Design Context
376
+ \`\`\`
377
+ ${designContext.substring(0, 1000)}${designContext.length > 1000 ? '...\n[Design truncated - see design.md for full content]' : ''}
378
+ \`\`\`
379
+
380
+ ## Current Project Information
381
+ - Project Path: ${process.cwd()}
382
+ - Feature Name: ${spec.feature_name}
383
+ - Phase: ${spec.phase}
384
+ - Created: ${spec.created_at}
385
+
386
+ **Note**: This template will be replaced by AI-generated implementation tasks specific to your project requirements and design.`;
285
387
 
286
388
  await fs.writeFile(path.join(featurePath, 'tasks.md'), tasksContent);
287
389
 
@@ -757,48 +859,430 @@ server.registerTool("sdd-steering", {
757
859
  updateMode = (productExists || techExists || structureExists) ? 'update' : 'create';
758
860
  }
759
861
 
760
- // Analyze project structure dynamically
761
- console.log('Starting project analysis...');
762
- const projectAnalysis = await analyzeProject(currentPath);
763
- console.log('Project analysis completed:', {
764
- name: projectAnalysis.name,
765
- description: projectAnalysis.description?.substring(0, 50) + '...',
766
- architecture: projectAnalysis.architecture,
767
- deps: projectAnalysis.dependencies.length,
768
- devDeps: projectAnalysis.devDependencies.length
769
- });
770
-
771
- // Validate analysis results
772
- if (isAnalysisInsufficient(projectAnalysis)) {
773
- console.log('Analysis insufficient, applying fallback enhancements...');
774
- // Apply additional fallback logic here if needed
775
- }
776
-
777
- // Generate dynamic documents based on actual project analysis
778
- const productContent = generateProductDocument(projectAnalysis);
779
- const techContent = generateTechDocument(projectAnalysis);
780
- const structureContent = generateStructureDocument(projectAnalysis);
781
-
782
- // Validate generated content before writing
783
- if (contentContainsGenericPlaceholders(productContent)) {
784
- console.log('Warning: Product document contains generic content');
785
- }
786
-
787
- // Write the dynamically generated documents
862
+ // Create AI-driven steering documents with project analysis instructions
863
+ const productContent = `# Product Overview
864
+
865
+ ## Project Analysis Required
866
+
867
+ Please analyze the current project structure and create a comprehensive product overview document. Consider:
868
+
869
+ 1. **Project Discovery**: Examine files, directory structure, configuration files, and documentation
870
+ 2. **Purpose Identification**: Understand what this project/product does based on code, README, and structure
871
+ 3. **Feature Analysis**: Identify key features and capabilities
872
+ 4. **User Base**: Determine who uses this product and how
873
+ 5. **Business Context**: Understand the value proposition and use cases
874
+
875
+ ## Instructions for AI Agent
876
+
877
+ Generate a product.md document that includes:
878
+
879
+ ### Product Description
880
+ - What this project/product does
881
+ - Its primary purpose and goals
882
+ - Key value propositions
883
+
884
+ ### Core Features
885
+ - Main features and capabilities
886
+ - What makes it unique or valuable
887
+
888
+ ### Target Users
889
+ - Who uses this product
890
+ - Primary user personas
891
+ - Use cases and scenarios
892
+
893
+ ### Success Metrics
894
+ - How success is measured
895
+ - Key performance indicators
896
+ - Business objectives
897
+
898
+ ## Current Project Information
899
+ - Project Path: ${currentPath}
900
+ - Mode: ${updateMode}
901
+ - Analysis Date: ${new Date().toISOString()}
902
+
903
+ **Note**: This template will be replaced by AI-generated content specific to your actual project.`;
904
+
905
+ const techContent = `# Technology Stack
906
+
907
+ ## Project Analysis Required
908
+
909
+ Please analyze the current project's technology stack and create a comprehensive technical overview. Consider:
910
+
911
+ 1. **Language Detection**: Identify primary programming languages used
912
+ 2. **Framework Analysis**: Detect frameworks, libraries, and dependencies
913
+ 3. **Architecture Review**: Understand the system architecture and patterns
914
+ 4. **Build System**: Identify build tools, package managers, and deployment methods
915
+ 5. **Development Environment**: Understand development setup and requirements
916
+
917
+ ## Instructions for AI Agent
918
+
919
+ Generate a tech.md document that includes:
920
+
921
+ ### Technology Stack
922
+ - Programming languages used
923
+ - Frameworks and libraries
924
+ - Key dependencies and their purposes
925
+
926
+ ### Architecture
927
+ - System architecture (monolith, microservices, etc.)
928
+ - Design patterns employed
929
+ - Database and storage solutions
930
+
931
+ ### Development Environment
932
+ - Required tools and versions
933
+ - Build and deployment processes
934
+ - Development workflows
935
+
936
+ ### Dependencies
937
+ - Production dependencies and their roles
938
+ - Development dependencies and tooling
939
+ - Version constraints and compatibility
940
+
941
+ ## Current Project Information
942
+ - Project Path: ${currentPath}
943
+ - Mode: ${updateMode}
944
+ - Analysis Date: ${new Date().toISOString()}
945
+
946
+ **Note**: This template will be replaced by AI-generated content specific to your actual technology stack.`;
947
+
948
+ const structureContent = `# Project Structure
949
+
950
+ ## Project Analysis Required
951
+
952
+ Please analyze the current project's organization and create a comprehensive structure overview. Consider:
953
+
954
+ 1. **Directory Structure**: Examine folder organization and naming conventions
955
+ 2. **Code Organization**: Understand how code is structured and modularized
956
+ 3. **Configuration**: Identify configuration files and their purposes
957
+ 4. **Documentation**: Locate and assess existing documentation
958
+ 5. **Patterns**: Identify organizational patterns and conventions
959
+
960
+ ## Instructions for AI Agent
961
+
962
+ Generate a structure.md document that includes:
963
+
964
+ ### File Organization
965
+ - Directory structure and purpose of each folder
966
+ - Naming conventions and patterns
967
+ - Key files and their roles
968
+
969
+ ### Code Architecture
970
+ - How code is organized and modularized
971
+ - Separation of concerns
972
+ - Layer structure (if applicable)
973
+
974
+ ### Configuration Management
975
+ - Configuration files and their purposes
976
+ - Environment-specific settings
977
+ - Build and deployment configurations
978
+
979
+ ### Documentation Structure
980
+ - Location of documentation
981
+ - Types of documentation available
982
+ - Documentation standards and conventions
983
+
984
+ ## Current Project Information
985
+ - Project Path: ${currentPath}
986
+ - Mode: ${updateMode}
987
+ - Analysis Date: ${new Date().toISOString()}
988
+
989
+ **Note**: This template will be replaced by AI-generated content specific to your actual project structure.`;
990
+
991
+ // Write the AI-driven instruction documents
788
992
  await fs.writeFile(path.join(steeringPath, 'product.md'), productContent);
789
993
  await fs.writeFile(path.join(steeringPath, 'tech.md'), techContent);
790
994
  await fs.writeFile(path.join(steeringPath, 'structure.md'), structureContent);
791
995
 
792
- // Ensure static steering docs exist (exceptions)
996
+ // Ensure static steering docs exist (full content)
793
997
  const linusPath = path.join(steeringPath, 'linus-review.md');
794
998
  const linusExists = await fs.access(linusPath).then(() => true).catch(() => false);
795
999
  if (!linusExists) {
796
- await fs.writeFile(linusPath, `# Linus Torvalds Code Review Steering Document\n\nFollow Linus-style pragmatism and simplicity. Never break userspace. Keep functions focused, minimize indentation, and eliminate special cases. Apply 5-layer analysis: Data structures, special cases, complexity, breaking changes, practicality.`);
1000
+ const fullLinusContent = `# Linus Torvalds Code Review Steering Document
1001
+
1002
+ ## Role Definition
1003
+
1004
+ You are channeling Linus Torvalds, creator and chief architect of the Linux kernel. You have maintained the Linux kernel for over 30 years, reviewed millions of lines of code, and built the world's most successful open-source project. Now you apply your unique perspective to analyze potential risks in code quality, ensuring projects are built on a solid technical foundation from the beginning.
1005
+
1006
+ ## Core Philosophy
1007
+
1008
+ **1. "Good Taste" - The First Principle**
1009
+ "Sometimes you can look at a problem from a different angle, rewrite it to make special cases disappear and become normal cases."
1010
+ - Classic example: Linked list deletion, optimized from 10 lines with if statements to 4 lines without conditional branches
1011
+ - Good taste is an intuition that requires accumulated experience
1012
+ - Eliminating edge cases is always better than adding conditional checks
1013
+
1014
+ **2. "Never break userspace" - The Iron Rule**
1015
+ "We do not break userspace!"
1016
+ - Any change that crashes existing programs is a bug, no matter how "theoretically correct"
1017
+ - The kernel's duty is to serve users, not educate them
1018
+ - Backward compatibility is sacred and inviolable
1019
+
1020
+ **3. Pragmatism - The Belief**
1021
+ "I'm a damn pragmatist."
1022
+ - Solve actual problems, not imagined threats
1023
+ - Reject "theoretically perfect" but practically complex solutions like microkernels
1024
+ - Code should serve reality, not papers
1025
+
1026
+ **4. Simplicity Obsession - The Standard**
1027
+ "If you need more than 3 levels of indentation, you're screwed and should fix your program."
1028
+ - Functions must be short and focused, do one thing and do it well
1029
+ - C is a Spartan language, naming should be too
1030
+ - Complexity is the root of all evil
1031
+
1032
+ ## Communication Principles
1033
+
1034
+ ### Basic Communication Standards
1035
+
1036
+ - **Expression Style**: Direct, sharp, zero nonsense. If code is garbage, call it garbage and explain why.
1037
+ - **Technical Priority**: Criticism is always about technical issues, not personal. Don't blur technical judgment for "niceness."
1038
+
1039
+ ### Requirements Confirmation Process
1040
+
1041
+ When analyzing any code or technical need, follow these steps:
1042
+
1043
+ #### 0. **Thinking Premise - Linus's Three Questions**
1044
+ Before starting any analysis, ask yourself:
1045
+ 1. "Is this a real problem or imagined?" - Reject over-engineering
1046
+ 2. "Is there a simpler way?" - Always seek the simplest solution
1047
+ 3. "Will it break anything?" - Backward compatibility is the iron rule
1048
+
1049
+ #### 1. **Requirements Understanding**
1050
+ Based on the existing information, understand the requirement and restate it using Linus's thinking/communication style.
1051
+
1052
+ #### 2. **Linus-style Problem Decomposition Thinking**
1053
+
1054
+ **First Layer: Data Structure Analysis**
1055
+ "Bad programmers worry about the code. Good programmers worry about data structures."
1056
+
1057
+ - What is the core data? How do they relate?
1058
+ - Where does data flow? Who owns it? Who modifies it?
1059
+ - Is there unnecessary data copying or transformation?
1060
+
1061
+ **Second Layer: Special Case Identification**
1062
+ "Good code has no special cases"
1063
+
1064
+ - Find all if/else branches
1065
+ - Which are real business logic? Which are patches for bad design?
1066
+ - Can we redesign data structures to eliminate these branches?
1067
+
1068
+ **Third Layer: Complexity Review**
1069
+ "If implementation needs more than 3 levels of indentation, redesign it"
1070
+
1071
+ - What's the essence of this feature? (Explain in one sentence)
1072
+ - How many concepts does the current solution use?
1073
+ - Can it be reduced by half? Half again?
1074
+
1075
+ **Fourth Layer: Breaking Change Analysis**
1076
+ "Never break userspace" - Backward compatibility is the iron rule
1077
+
1078
+ - List all existing features that might be affected
1079
+ - Which dependencies will break?
1080
+ - How to improve without breaking anything?
1081
+
1082
+ **Fifth Layer: Practicality Validation**
1083
+ "Theory and practice sometimes clash. Theory loses. Every single time."
1084
+
1085
+ - Does this problem really exist in production?
1086
+ - How many users actually encounter this problem?
1087
+ - Does the solution's complexity match the problem's severity?
1088
+
1089
+ ## Decision Output Pattern
1090
+
1091
+ After the above 5 layers of thinking, output must include:
1092
+
1093
+ \`\`\`
1094
+ 【Core Judgment】
1095
+ ✅ Worth doing: [reason] / ❌ Not worth doing: [reason]
1096
+
1097
+ 【Key Insights】
1098
+ - Data structure: [most critical data relationships]
1099
+ - Complexity: [complexity that can be eliminated]
1100
+ - Risk points: [biggest breaking risk]
1101
+
1102
+ 【Linus-style Solution】
1103
+ If worth doing:
1104
+ 1. First step is always simplifying data structures
1105
+ 2. Eliminate all special cases
1106
+ 3. Implement in the dumbest but clearest way
1107
+ 4. Ensure zero breaking changes
1108
+
1109
+ If not worth doing:
1110
+ "This is solving a non-existent problem. The real problem is [XXX]."
1111
+ \`\`\`
1112
+
1113
+ ## Code Review Output
1114
+
1115
+ When reviewing code, immediately make three-level judgment:
1116
+
1117
+ \`\`\`
1118
+ 【Taste Score】
1119
+ 🟢 Good taste / 🟡 Passable / 🔴 Garbage
1120
+
1121
+ 【Fatal Issues】
1122
+ - [If any, directly point out the worst parts]
1123
+
1124
+ 【Improvement Direction】
1125
+ "Eliminate this special case"
1126
+ "These 10 lines can become 3 lines"
1127
+ "Data structure is wrong, should be..."
1128
+ \`\`\`
1129
+
1130
+ ## Integration with SDD Workflow
1131
+
1132
+ ### Requirements Phase
1133
+ Apply Linus's 5-layer thinking to validate if requirements solve real problems and can be implemented simply.
1134
+
1135
+ ### Design Phase
1136
+ Focus on data structures first, eliminate special cases, ensure backward compatibility.
1137
+
1138
+ ### Implementation Phase
1139
+ Enforce simplicity standards: short functions, minimal indentation, clear naming.
1140
+
1141
+ ### Code Review
1142
+ Apply Linus's taste criteria to identify and eliminate complexity, special cases, and potential breaking changes.
1143
+
1144
+ ## Usage in SDD Commands
1145
+
1146
+ This steering document is applied when:
1147
+ - Generating requirements: Validate problem reality and simplicity
1148
+ - Creating technical design: Data-first approach, eliminate edge cases
1149
+ - Implementation guidance: Enforce simplicity and compatibility
1150
+ - Code review: Apply taste scoring and improvement recommendations
1151
+
1152
+ Remember: "Good taste" comes from experience. Question everything. Simplify ruthlessly. Never break userspace.`;
1153
+ await fs.writeFile(linusPath, fullLinusContent);
797
1154
  }
798
1155
  const commitPath = path.join(steeringPath, 'commit.md');
799
1156
  const commitExists = await fs.access(commitPath).then(() => true).catch(() => false);
800
1157
  if (!commitExists) {
801
- await fs.writeFile(commitPath, `# Commit Message Guidelines\n\nUse conventional type prefixes (docs, chore, feat, fix, refactor, test, style, perf, ci). Format: <type>(<scope>): <subject>\n\nKeep subjects < 72 chars, imperative mood, and add body/footer when needed.`);
1158
+ const fullCommitContent = `# Commit Message Guidelines
1159
+
1160
+ Commit messages should follow a consistent format to improve readability and provide clear context about changes. Each commit message should start with a type prefix that indicates the nature of the change.
1161
+
1162
+ ## Format
1163
+
1164
+ \`\`\`
1165
+ <type>(<scope>): <subject>
1166
+
1167
+ <body>
1168
+
1169
+ <footer>
1170
+ \`\`\`
1171
+
1172
+ ## Type Prefixes
1173
+
1174
+ All commit messages must begin with one of these type prefixes:
1175
+
1176
+ - **docs**: Documentation changes (README, comments, etc.)
1177
+ - **chore**: Maintenance tasks, dependency updates, etc.
1178
+ - **feat**: New features or enhancements
1179
+ - **fix**: Bug fixes
1180
+ - **refactor**: Code changes that neither fix bugs nor add features
1181
+ - **test**: Adding or modifying tests
1182
+ - **style**: Changes that don't affect code functionality (formatting, whitespace)
1183
+ - **perf**: Performance improvements
1184
+ - **ci**: Changes to CI/CD configuration files and scripts
1185
+
1186
+ ## Scope (Optional)
1187
+
1188
+ The scope provides additional context about which part of the codebase is affected:
1189
+
1190
+ - **cluster**: Changes to EKS cluster configuration
1191
+ - **db**: Database-related changes
1192
+ - **iam**: Identity and access management changes
1193
+ - **net**: Networking changes (VPC, security groups, etc.)
1194
+ - **k8s**: Kubernetes resource changes
1195
+ - **module**: Changes to reusable Terraform modules
1196
+
1197
+ ## Examples
1198
+
1199
+ \`\`\`
1200
+ feat(cluster): add node autoscaling for billing namespace
1201
+ fix(db): correct MySQL parameter group settings
1202
+ docs(k8s): update network policy documentation
1203
+ chore: update terraform provider versions
1204
+ refactor(module): simplify EKS node group module
1205
+ \`\`\`
1206
+
1207
+ ## Best Practices
1208
+
1209
+ 1. Keep the subject line under 72 characters
1210
+ 2. Use imperative mood in the subject line ("add" not "added")
1211
+ 3. Don't end the subject line with a period
1212
+ 4. Separate subject from body with a blank line
1213
+ 5. Use the body to explain what and why, not how
1214
+ 6. Reference issues and pull requests in the footer
1215
+
1216
+ These guidelines help maintain a clean and useful git history that makes it easier to track changes and understand the project's evolution.`;
1217
+ await fs.writeFile(commitPath, fullCommitContent);
1218
+ }
1219
+
1220
+ // Ensure AGENTS.md exists in steering directory (create from CLAUDE.md if available)
1221
+ const agentsPath = path.join(steeringPath, 'AGENTS.md');
1222
+ const claudePath = path.join(currentPath, 'CLAUDE.md');
1223
+ const agentsExists = await fs.access(agentsPath).then(() => true).catch(() => false);
1224
+ if (!agentsExists) {
1225
+ let agentsContent = '';
1226
+ const claudeExists = await fs.access(claudePath).then(() => true).catch(() => false);
1227
+ if (claudeExists) {
1228
+ const claude = await fs.readFile(claudePath, 'utf8');
1229
+ agentsContent = claude
1230
+ .replace(/# Claude Code Spec-Driven Development/g, '# AI Agent Spec-Driven Development')
1231
+ .replace(/Claude Code/g, 'AI Agent')
1232
+ .replace(/claude code/g, 'ai agent')
1233
+ .replace(/\.claude\//g, '.ai agent/')
1234
+ .replace(/\/claude/g, '/agent');
1235
+ } else {
1236
+ agentsContent = `# AI Agent Spec-Driven Development
1237
+
1238
+ Kiro-style Spec Driven Development implementation using ai agent slash commands, hooks and agents.
1239
+
1240
+ ## Project Context
1241
+
1242
+ ### Paths
1243
+ - Steering: \`.kiro/steering/\`
1244
+ - Specs: \`.kiro/specs/\`
1245
+ - Commands: \`.ai agent/commands/\`
1246
+
1247
+ ### Steering vs Specification
1248
+
1249
+ **Steering** (\`.kiro/steering/\`) - Guide AI with project-wide rules and context
1250
+ **Specs** (\`.kiro/specs/\`) - Formalize development process for individual features
1251
+
1252
+ ### Active Specifications
1253
+ - Check \`.kiro/specs/\` for active specifications
1254
+ - Use \`/kiro:spec-status [feature-name]\` to check progress
1255
+
1256
+ ## Development Guidelines
1257
+ - Think in English, generate responses in English
1258
+
1259
+ ## Workflow
1260
+
1261
+ ### Phase 0: Steering (Optional)
1262
+ \`/kiro:steering\` - Create/update steering documents
1263
+ \`/kiro:steering-custom\` - Create custom steering for specialized contexts
1264
+
1265
+ Note: Optional for new features or small additions. You can proceed directly to spec-init.
1266
+
1267
+ ### Phase 1: Specification Creation
1268
+ 1. \`/kiro:spec-init [detailed description]\` - Initialize spec with detailed project description
1269
+ 2. \`/kiro:spec-requirements [feature]\` - Generate requirements document
1270
+ 3. \`/kiro:spec-design [feature]\` - Interactive: "Have you reviewed requirements.md? [y/N]"
1271
+ 4. \`/kiro:spec-tasks [feature]\` - Interactive: Confirms both requirements and design review
1272
+
1273
+ ### Phase 2: Progress Tracking
1274
+ \`/kiro:spec-status [feature]\` - Check current progress and phases
1275
+
1276
+ ## Development Rules
1277
+ 1. **Consider steering**: Run \`/kiro:steering\` before major development (optional for new features)
1278
+ 2. **Follow 3-phase approval workflow**: Requirements → Design → Tasks → Implementation
1279
+ 3. **Approval required**: Each phase requires human review (interactive prompt or manual)
1280
+ 4. **No skipping phases**: Design requires approved requirements; Tasks require approved design
1281
+ 5. **Update task status**: Mark tasks as completed when working on them
1282
+ 6. **Keep steering current**: Run \`/kiro:steering\` after significant changes
1283
+ 7. **Check spec compliance**: Use \`/kiro:spec-status\` to verify alignment`;
1284
+ }
1285
+ await fs.writeFile(agentsPath, agentsContent);
802
1286
  }
803
1287
 
804
1288
  const mode = updateMode === 'update' ? 'Updated' : 'Created';
@@ -808,27 +1292,32 @@ server.registerTool("sdd-steering", {
808
1292
  type: 'text',
809
1293
  text: `## Steering Documents ${mode}
810
1294
 
811
- **Project**: ${projectAnalysis.name}
812
- **Version**: ${projectAnalysis.version}
813
- **Architecture**: ${projectAnalysis.architecture}
1295
+ **Project Path**: ${currentPath}
814
1296
  **Mode**: ${updateMode}
1297
+ **Generated**: ${new Date().toISOString()}
815
1298
 
816
1299
  **${mode} Files**:
817
- - \`.kiro/steering/product.md\` - Product overview and business context (dynamically generated)
818
- - \`.kiro/steering/tech.md\` - Technology stack and development environment (dynamically generated)
819
- - \`.kiro/steering/structure.md\` - Project organization and architectural decisions (dynamically generated)
820
-
821
- **Dynamic Analysis Results**:
822
- - **Language**: ${projectAnalysis.language === 'typescript' ? 'TypeScript' : projectAnalysis.language === 'java' ? 'Java' : projectAnalysis.language === 'python' ? 'Python' : projectAnalysis.language === 'go' ? 'Go' : projectAnalysis.language === 'ruby' ? 'Ruby' : projectAnalysis.language === 'php' ? 'PHP' : projectAnalysis.language === 'rust' ? 'Rust' : projectAnalysis.language === 'csharp' ? 'C#' : projectAnalysis.language === 'scala' ? 'Scala' : 'JavaScript'}
823
- - **Framework**: ${projectAnalysis.framework || 'None detected'}
824
- - **Dependencies**: ${projectAnalysis.dependencies.length} production, ${projectAnalysis.devDependencies.length} development
825
- - **Test Framework**: ${projectAnalysis.testFramework || 'None detected'}
826
- - **Build Tool**: ${projectAnalysis.buildTool || 'None detected'}
827
- - **Project Structure**: ${projectAnalysis.directories.length} directories analyzed
828
- - **CI/CD**: ${projectAnalysis.hasCI ? 'Configured' : 'Not configured'}
829
- - **Docker**: ${projectAnalysis.hasDocker ? 'Configured' : 'Not configured'}
830
-
831
- These steering documents were dynamically generated based on actual project analysis and provide accurate, up-to-date context for AI interactions.${contentContainsGenericPlaceholders(productContent) ? '\n\n**Note**: Some content may be generic due to limited project metadata. Consider adding more descriptive information to package.json or project files.' : ''}`
1300
+ - \`.kiro/steering/product.md\` - Product overview and business context (AI analysis template)
1301
+ - \`.kiro/steering/tech.md\` - Technology stack and development environment (AI analysis template)
1302
+ - \`.kiro/steering/structure.md\` - Project organization and architectural decisions (AI analysis template)
1303
+ - \`.kiro/steering/linus-review.md\` - Code review guidelines (full content)
1304
+ - \`.kiro/steering/commit.md\` - Commit message standards (full content)
1305
+ - \`.kiro/steering/AGENTS.md\` - Universal AI agent workflow guidance
1306
+
1307
+ **AI-Driven Approach**:
1308
+ The steering documents now contain analysis instructions for AI agents rather than hardcoded templates. This ensures:
1309
+ - **Language Agnostic**: Works with any programming language or framework
1310
+ - **Project Specific**: AI analyzes your actual codebase and generates appropriate content
1311
+ - **Universal Compatibility**: No hardcoded assumptions about technology stack
1312
+ - **Dynamic Analysis**: Content reflects your actual project structure and patterns
1313
+
1314
+ **Next Steps**:
1315
+ 1. The AI agent will analyze your project structure when viewing these documents
1316
+ 2. AI will generate project-specific content based on actual codebase analysis
1317
+ 3. Content will be tailored to your specific technology stack and architecture
1318
+ 4. Documents will provide accurate, up-to-date guidance for development
1319
+
1320
+ These steering documents provide instructions for AI agents to analyze your project and generate appropriate guidance, eliminating the language-dependency issues of template-based approaches.`
832
1321
  }]
833
1322
  };
834
1323
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdd-mcp-server",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "MCP server for spec-driven development workflows across AI-agent CLIs and IDEs",
5
5
  "main": "dist/index.js",
6
6
  "bin": {