edsger 0.2.0 → 0.2.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/dist/api/features/feature-utils.d.ts +13 -0
- package/dist/api/features/feature-utils.js +46 -0
- package/dist/api/features/get-feature.d.ts +5 -0
- package/dist/api/features/get-feature.js +19 -0
- package/dist/api/features/index.d.ts +7 -0
- package/dist/api/features/index.js +9 -0
- package/dist/api/features/status-updater.d.ts +27 -0
- package/dist/api/features/status-updater.js +64 -0
- package/dist/api/features/test-cases.d.ts +21 -0
- package/dist/api/features/test-cases.js +63 -0
- package/dist/api/features/update-feature.d.ts +13 -0
- package/dist/api/features/update-feature.js +31 -0
- package/dist/api/features/user-stories.d.ts +21 -0
- package/dist/api/features/user-stories.js +63 -0
- package/dist/api/features.d.ts +100 -0
- package/dist/api/features.js +219 -0
- package/dist/api/mcp-client.d.ts +18 -0
- package/dist/api/mcp-client.js +58 -0
- package/dist/api/products.d.ts +10 -0
- package/dist/api/products.js +22 -0
- package/dist/api/test-reports.d.ts +9 -0
- package/dist/api/test-reports.js +25 -0
- package/dist/cli/commands/code-implementation-command.d.ts +2 -0
- package/dist/cli/commands/code-implementation-command.js +36 -0
- package/dist/cli/commands/code-review-command.d.ts +2 -0
- package/dist/cli/commands/code-review-command.js +39 -0
- package/dist/cli/commands/feature-analysis-command.d.ts +2 -0
- package/dist/cli/commands/feature-analysis-command.js +36 -0
- package/dist/cli/commands/functional-testing-command.d.ts +2 -0
- package/dist/cli/commands/functional-testing-command.js +36 -0
- package/dist/cli/commands/technical-design-command.d.ts +2 -0
- package/dist/cli/commands/technical-design-command.js +36 -0
- package/dist/cli/commands/workflow-command.d.ts +2 -0
- package/dist/cli/commands/workflow-command.js +34 -0
- package/dist/cli/formatters/code-implementation-formatter.d.ts +9 -0
- package/dist/cli/formatters/code-implementation-formatter.js +27 -0
- package/dist/cli/formatters/feature-analysis-formatter.d.ts +2 -0
- package/dist/cli/formatters/feature-analysis-formatter.js +27 -0
- package/dist/cli/formatters/functional-testing-formatter.d.ts +15 -0
- package/dist/cli/formatters/functional-testing-formatter.js +37 -0
- package/dist/cli/formatters/technical-design-formatter.d.ts +7 -0
- package/dist/cli/formatters/technical-design-formatter.js +30 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +99 -0
- package/dist/cli/utils/validation.d.ts +25 -0
- package/dist/cli/utils/validation.js +58 -0
- package/dist/cli/utils/workflow-utils.d.ts +21 -0
- package/dist/cli/utils/workflow-utils.js +47 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +11 -466
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{bug-fixing → phases/bug-fixing}/analyzer.d.ts +1 -1
- package/dist/{bug-fixing → phases/bug-fixing}/analyzer.js +1 -1
- package/dist/{bug-fixing → phases/bug-fixing}/context-fetcher.d.ts +4 -22
- package/dist/{bug-fixing → phases/bug-fixing}/context-fetcher.js +14 -58
- package/dist/{bug-fixing → phases/bug-fixing}/mcp-server.js +1 -30
- package/dist/phases/code-implementation/analyzer.d.ts +33 -0
- package/dist/{code-implementation → phases/code-implementation}/analyzer.js +174 -15
- package/dist/phases/code-implementation/context-fetcher.d.ts +17 -0
- package/dist/phases/code-implementation/context-fetcher.js +86 -0
- package/dist/{code-implementation → phases/code-implementation}/mcp-server.js +1 -30
- package/dist/{code-review → phases/code-review}/reviewer.d.ts +1 -1
- package/dist/{feature-analysis → phases/feature-analysis}/analyzer.d.ts +3 -2
- package/dist/{feature-analysis → phases/feature-analysis}/analyzer.js +29 -127
- package/dist/phases/feature-analysis/context-fetcher.d.ts +18 -0
- package/dist/phases/feature-analysis/context-fetcher.js +86 -0
- package/dist/{feature-analysis → phases/feature-analysis}/http-fallback.js +1 -1
- package/dist/{feature-analysis → phases/feature-analysis}/mcp-server.js +1 -24
- package/dist/{functional-testing → phases/functional-testing}/analyzer.d.ts +17 -2
- package/dist/{functional-testing → phases/functional-testing}/analyzer.js +225 -31
- package/dist/phases/functional-testing/context-fetcher.d.ts +16 -0
- package/dist/phases/functional-testing/context-fetcher.js +81 -0
- package/dist/{functional-testing → phases/functional-testing}/http-fallback.js +1 -1
- package/dist/{functional-testing → phases/functional-testing}/index.d.ts +1 -1
- package/dist/{functional-testing → phases/functional-testing}/index.js +1 -1
- package/dist/{functional-testing → phases/functional-testing}/mcp-server.js +1 -30
- package/dist/{functional-testing → phases/functional-testing}/test-report-creator.d.ts +26 -0
- package/dist/{functional-testing → phases/functional-testing}/test-report-creator.js +87 -5
- package/dist/phases/functional-testing/test-retry-handler.d.ts +16 -0
- package/dist/phases/functional-testing/test-retry-handler.js +75 -0
- package/dist/{pull-request → phases/pull-request}/creator.js +47 -6
- package/dist/phases/pull-request/handler.d.ts +16 -0
- package/dist/phases/pull-request/handler.js +60 -0
- package/dist/{technical-design → phases/technical-design}/analyzer.d.ts +7 -2
- package/dist/phases/technical-design/analyzer.js +418 -0
- package/dist/phases/technical-design/context-fetcher.d.ts +12 -0
- package/dist/phases/technical-design/context-fetcher.js +39 -0
- package/dist/{technical-design → phases/technical-design}/http-fallback.js +1 -1
- package/dist/{technical-design → phases/technical-design}/mcp-server.js +1 -30
- package/dist/prompts/bug-fixing.d.ts +2 -0
- package/dist/prompts/bug-fixing.js +63 -0
- package/dist/prompts/code-implementation.d.ts +3 -0
- package/dist/prompts/code-implementation.js +132 -0
- package/dist/prompts/feature-analysis.d.ts +3 -0
- package/dist/prompts/feature-analysis.js +149 -0
- package/dist/prompts/formatters.d.ts +29 -0
- package/dist/prompts/formatters.js +139 -0
- package/dist/prompts/functional-testing.d.ts +3 -0
- package/dist/prompts/functional-testing.js +126 -0
- package/dist/prompts/index.d.ts +6 -0
- package/dist/prompts/index.js +7 -0
- package/dist/prompts/technical-design.d.ts +3 -0
- package/dist/prompts/technical-design.js +130 -0
- package/dist/services/checklist.d.ts +99 -0
- package/dist/services/checklist.js +337 -0
- package/dist/types/features.d.ts +29 -0
- package/dist/types/features.js +1 -0
- package/dist/types/index.d.ts +112 -0
- package/dist/types/index.js +1 -0
- package/dist/types/pipeline.d.ts +25 -0
- package/dist/types/pipeline.js +4 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.js +52 -0
- package/dist/utils/pipeline-logger.d.ts +8 -0
- package/dist/utils/pipeline-logger.js +35 -0
- package/dist/workflow-runner/config/phase-configs.d.ts +5 -0
- package/dist/workflow-runner/config/phase-configs.js +34 -0
- package/dist/workflow-runner/config/stage-configs.d.ts +5 -0
- package/dist/workflow-runner/config/stage-configs.js +34 -0
- package/dist/workflow-runner/core/feature-filter.d.ts +16 -0
- package/dist/workflow-runner/core/feature-filter.js +46 -0
- package/dist/workflow-runner/core/feature-filter.test.d.ts +4 -0
- package/dist/workflow-runner/core/feature-filter.test.js +127 -0
- package/dist/workflow-runner/core/index.d.ts +8 -0
- package/dist/workflow-runner/core/index.js +12 -0
- package/dist/workflow-runner/core/pipeline-evaluator.d.ts +24 -0
- package/dist/workflow-runner/core/pipeline-evaluator.js +32 -0
- package/dist/workflow-runner/core/state-manager.d.ts +24 -0
- package/dist/workflow-runner/core/state-manager.js +42 -0
- package/dist/workflow-runner/core/workflow-logger.d.ts +20 -0
- package/dist/workflow-runner/core/workflow-logger.js +65 -0
- package/dist/workflow-runner/executors/phase-executor.d.ts +8 -0
- package/dist/workflow-runner/executors/phase-executor.js +183 -0
- package/dist/workflow-runner/executors/stage-executor.d.ts +8 -0
- package/dist/workflow-runner/executors/stage-executor.js +49 -0
- package/dist/workflow-runner/feature-service.d.ts +17 -0
- package/dist/workflow-runner/feature-service.js +60 -0
- package/dist/workflow-runner/feature-workflow-runner.d.ts +26 -0
- package/dist/workflow-runner/feature-workflow-runner.js +113 -0
- package/dist/workflow-runner/index.d.ts +0 -1
- package/dist/workflow-runner/index.js +0 -1
- package/dist/workflow-runner/pipeline-runner.d.ts +9 -19
- package/dist/workflow-runner/pipeline-runner.js +247 -256
- package/dist/workflow-runner/pipeline.d.ts +18 -0
- package/dist/workflow-runner/pipeline.js +197 -0
- package/dist/workflow-runner/processor.d.ts +40 -0
- package/dist/workflow-runner/processor.js +191 -0
- package/dist/workflow-runner/types.d.ts +48 -0
- package/dist/workflow-runner/types.js +4 -0
- package/dist/workflow-runner/workflow-processor.d.ts +6 -23
- package/dist/workflow-runner/workflow-processor.js +38 -100
- package/package.json +2 -2
- package/dist/code-implementation/analyzer.d.ts +0 -19
- package/dist/code-implementation/context-fetcher.d.ts +0 -38
- package/dist/code-implementation/context-fetcher.js +0 -147
- package/dist/feature-analysis/context-fetcher.d.ts +0 -54
- package/dist/feature-analysis/context-fetcher.js +0 -193
- package/dist/functional-testing/context-fetcher.d.ts +0 -47
- package/dist/functional-testing/context-fetcher.js +0 -192
- package/dist/technical-design/analyzer.js +0 -338
- package/dist/technical-design/context-fetcher.d.ts +0 -42
- package/dist/technical-design/context-fetcher.js +0 -170
- /package/dist/{bug-fixing → phases/bug-fixing}/index.d.ts +0 -0
- /package/dist/{bug-fixing → phases/bug-fixing}/index.js +0 -0
- /package/dist/{bug-fixing → phases/bug-fixing}/mcp-server.d.ts +0 -0
- /package/dist/{code-implementation → phases/code-implementation}/mcp-server.d.ts +0 -0
- /package/dist/{code-review → phases/code-review}/reviewer.js +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/http-fallback.d.ts +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/index.d.ts +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/index.js +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/mcp-server.d.ts +0 -0
- /package/dist/{functional-testing → phases/functional-testing}/http-fallback.d.ts +0 -0
- /package/dist/{functional-testing → phases/functional-testing}/mcp-server.d.ts +0 -0
- /package/dist/{pull-request → phases/pull-request}/creator.d.ts +0 -0
- /package/dist/{technical-design → phases/technical-design}/http-fallback.d.ts +0 -0
- /package/dist/{technical-design → phases/technical-design}/mcp-server.d.ts +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export const createTechnicalDesignSystemPrompt = (_config, mcpServerUrl, mcpToken, featureId) => {
|
|
2
|
+
let mcpInstructions = '';
|
|
3
|
+
if (mcpServerUrl && mcpToken && featureId) {
|
|
4
|
+
mcpInstructions = `
|
|
5
|
+
|
|
6
|
+
**MANDATORY Checklist Compliance**:
|
|
7
|
+
If you are provided with checklists in the context, you MUST satisfy ALL of them during your technical design work. Checklists are mandatory requirements that define quality standards and cannot be ignored or skipped.
|
|
8
|
+
|
|
9
|
+
- Review each checklist carefully and ensure your technical design addresses every requirement
|
|
10
|
+
- You MUST include ALL provided checklist item IDs in the "checklist_item_results" field of your JSON response
|
|
11
|
+
- CRITICAL: Use the exact UUID from the "ID:" field in each checklist ITEM, NOT the item title or description
|
|
12
|
+
- Set "is_passed": true for each checklist item you have completed successfully
|
|
13
|
+
- Provide appropriate "value" based on the item type (boolean: true/false, text: descriptive text, number: numeric value)
|
|
14
|
+
- If you cannot satisfy a checklist item requirement, set "is_passed": false and explain why in the "notes" field
|
|
15
|
+
- The system will validate that all checklist items have been addressed - missing items will cause the pipeline to fail
|
|
16
|
+
|
|
17
|
+
CRITICAL: Checklists are not optional suggestions - they are mandatory quality gates that must be satisfied.`;
|
|
18
|
+
}
|
|
19
|
+
return `You are a senior software architect and technical lead specializing in creating comprehensive technical design documents. Your task is to analyze a feature and generate detailed technical design documentation.
|
|
20
|
+
|
|
21
|
+
**Your Role**: Create detailed architectural design documents based on feature requirements, user stories, and test cases.
|
|
22
|
+
|
|
23
|
+
CRITICAL: You are NOT a software engineer who writes code. You are a technical architect who creates design documents, architectural diagrams in text form, and technical specifications. Your role is PURELY design-focused.
|
|
24
|
+
|
|
25
|
+
**Available Tools**:
|
|
26
|
+
- Glob: Find files and understand project structure
|
|
27
|
+
- Read: Examine existing code, configuration, and documentation files
|
|
28
|
+
- Bash: For repository analysis (read-only commands only)
|
|
29
|
+
|
|
30
|
+
**Technical Design Process**:
|
|
31
|
+
1. **Repository Analysis**: Analyze the current codebase to understand technology stack and architecture:
|
|
32
|
+
- Find configuration files: package.json, tsconfig.json, next.config.js, tailwind.config.js
|
|
33
|
+
- Examine dependencies and tech stack
|
|
34
|
+
- Understand project structure: src/app/**, src/components/**, src/services/**
|
|
35
|
+
- Look for database schema files, migration files, and configuration
|
|
36
|
+
- Examine documentation files (README.md, CLAUDE.md)
|
|
37
|
+
|
|
38
|
+
2. **Context Analysis**: All feature information, user stories, test cases, and existing technical design are provided in the prompt
|
|
39
|
+
|
|
40
|
+
3. **Design Creation**: Generate comprehensive technical design documentation that includes:
|
|
41
|
+
- Architecture overview and system integration
|
|
42
|
+
- Component design and data flow
|
|
43
|
+
- Database schema changes and API specifications
|
|
44
|
+
- Security, performance, and scalability considerations
|
|
45
|
+
- Testing strategy and deployment approach
|
|
46
|
+
|
|
47
|
+
**Important Guidelines**:
|
|
48
|
+
- All feature information is provided in the prompt - do NOT attempt to fetch additional context
|
|
49
|
+
- Focus on creating comprehensive technical specifications
|
|
50
|
+
- Consider integration with existing systems and architecture
|
|
51
|
+
- Address scalability, maintainability, and performance
|
|
52
|
+
- Include clear implementation guidance
|
|
53
|
+
|
|
54
|
+
**CRITICAL - Result Format**:
|
|
55
|
+
You MUST end your response with a JSON object containing the technical design results in this EXACT format:
|
|
56
|
+
|
|
57
|
+
\`\`\`json
|
|
58
|
+
{
|
|
59
|
+
"technical_design_result": {
|
|
60
|
+
"feature_id": "FEATURE_ID_PLACEHOLDER",
|
|
61
|
+
"status": "success",
|
|
62
|
+
"summary": "Brief summary of what was accomplished",
|
|
63
|
+
"technical_design": "The complete technical design document in markdown format",
|
|
64
|
+
"checklist_item_results": [
|
|
65
|
+
{
|
|
66
|
+
"checklist_item_id": "EXACT_CHECKLIST_ITEM_UUID_FROM_ID_FIELD",
|
|
67
|
+
"is_passed": true,
|
|
68
|
+
"value": "Result value based on item type (boolean, text, number, etc.)",
|
|
69
|
+
"notes": "Optional notes about this specific checklist item"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"recommendations": "Additional recommendations for implementation"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
\`\`\`
|
|
76
|
+
|
|
77
|
+
MANDATORY: If checklists are provided in the context, you MUST include checklist_item_results for ALL checklist items. Every checklist item ID must be addressed - either passed or with explanation in notes why it cannot be satisfied. Missing any checklist item will cause the pipeline to fail.
|
|
78
|
+
|
|
79
|
+
IMPORTANT: In the checklist context, look for lines that say "ID: [UUID]" in the items list - use these exact UUIDs as checklist_item_id values. Do NOT use the item title or description as the checklist_item_id.
|
|
80
|
+
|
|
81
|
+
**Technical Design Quality Guidelines**:
|
|
82
|
+
- Be specific and detailed in architectural decisions
|
|
83
|
+
- Consider scalability, maintainability, and performance
|
|
84
|
+
- Address security, accessibility, and error handling
|
|
85
|
+
- Include clear diagrams and flows (in text/ASCII format)
|
|
86
|
+
- Consider integration with existing systems
|
|
87
|
+
- Address deployment and monitoring requirements
|
|
88
|
+
- Think about future extensibility and maintenance
|
|
89
|
+
|
|
90
|
+
Focus on systematic technical design based on the provided context information.${mcpInstructions}`;
|
|
91
|
+
};
|
|
92
|
+
export const createTechnicalDesignPromptWithContext = (featureId, contextInfo) => {
|
|
93
|
+
return `Generate a comprehensive technical design for feature ID: ${featureId}
|
|
94
|
+
|
|
95
|
+
${contextInfo}
|
|
96
|
+
|
|
97
|
+
## Technical Design Instructions
|
|
98
|
+
|
|
99
|
+
Follow this systematic approach:
|
|
100
|
+
|
|
101
|
+
1. **Repository Analysis**: First, analyze the current codebase to understand the technology stack and architecture:
|
|
102
|
+
- Use Glob to find configuration files: package.json, tsconfig.json, next.config.js, tailwind.config.js
|
|
103
|
+
- Use Read to examine package.json to understand dependencies and tech stack
|
|
104
|
+
- Use Glob to understand project structure: src/app/**, src/components/**, src/services/**
|
|
105
|
+
- Look for database schema files, migration files, and configuration
|
|
106
|
+
- Examine README.md, CLAUDE.md or other documentation files if they exist
|
|
107
|
+
|
|
108
|
+
2. **Technical Design Creation**: Create comprehensive technical design documentation that addresses:
|
|
109
|
+
- **Architecture Overview**: How the feature integrates with the existing system
|
|
110
|
+
- **Component Design**: Frontend components, backend services, database changes needed
|
|
111
|
+
- **Data Flow**: How data moves through the system for this feature
|
|
112
|
+
- **API Design**: Endpoints, request/response formats, error handling
|
|
113
|
+
- **Database Design**: Schema changes, indexes, relationships, migration strategy
|
|
114
|
+
- **Security**: Authentication, authorization, data validation requirements
|
|
115
|
+
- **Performance**: Caching strategies, optimization, scalability considerations
|
|
116
|
+
- **Testing Strategy**: Unit, integration, and end-to-end testing approaches
|
|
117
|
+
- **Deployment**: How the feature will be deployed and monitored
|
|
118
|
+
|
|
119
|
+
3. **Implementation Guidance**: Provide specific implementation recommendations and considerations
|
|
120
|
+
|
|
121
|
+
## Important Notes
|
|
122
|
+
- Focus on creating detailed architectural specifications
|
|
123
|
+
- Consider the user stories to understand what needs to be built
|
|
124
|
+
- Use test cases to inform testing strategy and validation approaches
|
|
125
|
+
- Build upon existing technical design if available, or create from scratch
|
|
126
|
+
- Consider integration with existing systems and architecture
|
|
127
|
+
- Address scalability, maintainability, and performance requirements
|
|
128
|
+
|
|
129
|
+
Begin by analyzing the repository structure to understand the current technology stack, then create the comprehensive technical design.`;
|
|
130
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checklist service for pipeline integration
|
|
3
|
+
*/
|
|
4
|
+
import { PipelinePhaseOptions } from '../types/pipeline.js';
|
|
5
|
+
export interface ChecklistItem {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
item_type: 'boolean' | 'text' | 'number' | 'select';
|
|
10
|
+
is_required: boolean;
|
|
11
|
+
sort_order: number;
|
|
12
|
+
config: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
export interface Checklist {
|
|
15
|
+
id: string;
|
|
16
|
+
product_id: string;
|
|
17
|
+
feature_id: string | null;
|
|
18
|
+
name: string;
|
|
19
|
+
description: string | null;
|
|
20
|
+
role: string;
|
|
21
|
+
phase: string;
|
|
22
|
+
is_active: boolean;
|
|
23
|
+
sort_order: number;
|
|
24
|
+
created_at: string;
|
|
25
|
+
updated_at: string;
|
|
26
|
+
items: ChecklistItem[];
|
|
27
|
+
}
|
|
28
|
+
export interface ChecklistValidation {
|
|
29
|
+
checklist_id: string;
|
|
30
|
+
checklist_name: string;
|
|
31
|
+
role: string;
|
|
32
|
+
is_completed: boolean;
|
|
33
|
+
completed_at: string | null;
|
|
34
|
+
status: 'not_started' | 'pending' | 'in_progress' | 'completed' | 'skipped';
|
|
35
|
+
}
|
|
36
|
+
export interface ChecklistPhaseContext {
|
|
37
|
+
phase: string;
|
|
38
|
+
feature_id: string;
|
|
39
|
+
checklists: Checklist[];
|
|
40
|
+
}
|
|
41
|
+
export interface ChecklistValidationResult {
|
|
42
|
+
phase: string;
|
|
43
|
+
feature_id: string;
|
|
44
|
+
all_completed: boolean;
|
|
45
|
+
checklists_validation: ChecklistValidation[];
|
|
46
|
+
summary: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Fetch checklists for a specific phase
|
|
50
|
+
*/
|
|
51
|
+
export declare function getChecklistsForPhase(options: PipelinePhaseOptions, phase: string): Promise<ChecklistPhaseContext>;
|
|
52
|
+
/**
|
|
53
|
+
* Validate checklist completion for a phase
|
|
54
|
+
*/
|
|
55
|
+
export declare function validateChecklistsForPhase(options: PipelinePhaseOptions, phase: string): Promise<ChecklistValidationResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Create checklist results (mark as started/in-progress)
|
|
58
|
+
*/
|
|
59
|
+
export declare function createChecklistResult(options: PipelinePhaseOptions, checklistId: string, itemResults?: any[]): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Strictly validate that all required checklists have results
|
|
62
|
+
* Returns error if any checklists exist but don't have results
|
|
63
|
+
*/
|
|
64
|
+
export declare function validateRequiredChecklistResults(options: PipelinePhaseOptions, phase: string, verbose?: boolean): Promise<{
|
|
65
|
+
success: boolean;
|
|
66
|
+
error?: string;
|
|
67
|
+
missingChecklists: string[];
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Create checklist item result
|
|
71
|
+
*/
|
|
72
|
+
export declare function createChecklistItemResult(options: PipelinePhaseOptions, checklistItemId: string, isPassed: boolean, value?: any, notes?: string): Promise<any>;
|
|
73
|
+
/**
|
|
74
|
+
* Process checklist item results from phase JSON response and create MCP results
|
|
75
|
+
*/
|
|
76
|
+
export declare function processChecklistItemResultsFromResponse(options: PipelinePhaseOptions, phase: string, checklistItemResults?: Array<{
|
|
77
|
+
checklist_item_id: string;
|
|
78
|
+
is_passed: boolean;
|
|
79
|
+
value?: any;
|
|
80
|
+
notes?: string;
|
|
81
|
+
}>, verbose?: boolean): Promise<{
|
|
82
|
+
created: number;
|
|
83
|
+
errors: string[];
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Process checklist results from phase JSON response and create MCP results
|
|
87
|
+
*/
|
|
88
|
+
export declare function processChecklistResultsFromResponse(options: PipelinePhaseOptions, checklistResults?: Array<{
|
|
89
|
+
checklist_id: string;
|
|
90
|
+
satisfied: boolean;
|
|
91
|
+
notes?: string;
|
|
92
|
+
}>, verbose?: boolean): Promise<{
|
|
93
|
+
created: number;
|
|
94
|
+
errors: string[];
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Format checklist context as string for LLM consumption
|
|
98
|
+
*/
|
|
99
|
+
export declare function formatChecklistsForContext(context: ChecklistPhaseContext): string;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checklist service for pipeline integration
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Fetch checklists for a specific phase
|
|
6
|
+
*/
|
|
7
|
+
export async function getChecklistsForPhase(options, phase) {
|
|
8
|
+
const { mcpServerUrl, mcpToken, featureId } = options;
|
|
9
|
+
// Convert phase name from hyphen to underscore format for database compatibility
|
|
10
|
+
// e.g., 'feature-analysis' -> 'feature_analysis'
|
|
11
|
+
const dbPhase = phase.replace(/-/g, '_');
|
|
12
|
+
// Log the request details for debugging
|
|
13
|
+
const requestBody = {
|
|
14
|
+
jsonrpc: '2.0',
|
|
15
|
+
id: 1,
|
|
16
|
+
method: 'checklists/phase',
|
|
17
|
+
params: {
|
|
18
|
+
feature_id: featureId,
|
|
19
|
+
phase: dbPhase, // Use underscore format for database
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
console.log(`🔍 Fetching checklists: phase="${phase}" (db: "${dbPhase}"), feature_id="${featureId}"`);
|
|
23
|
+
const response = await fetch(`${mcpServerUrl}/mcp`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: {
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
Authorization: `Bearer ${mcpToken}`,
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify(requestBody),
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
const errorText = await response.text();
|
|
33
|
+
throw new Error(`Failed to fetch checklists for phase "${phase}": ${response.status} ${response.statusText}. Response: ${errorText}`);
|
|
34
|
+
}
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
if (data.error) {
|
|
37
|
+
throw new Error(`MCP Error for phase "${phase}": ${data.error.message || JSON.stringify(data.error)}`);
|
|
38
|
+
}
|
|
39
|
+
// Handle empty result gracefully
|
|
40
|
+
if (!data.result) {
|
|
41
|
+
return {
|
|
42
|
+
phase,
|
|
43
|
+
feature_id: featureId,
|
|
44
|
+
checklists: [],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return data.result;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate checklist completion for a phase
|
|
51
|
+
*/
|
|
52
|
+
export async function validateChecklistsForPhase(options, phase) {
|
|
53
|
+
const { mcpServerUrl, mcpToken, featureId } = options;
|
|
54
|
+
// Convert phase name from hyphen to underscore format for database compatibility
|
|
55
|
+
const dbPhase = phase.replace(/-/g, '_');
|
|
56
|
+
const response = await fetch(`${mcpServerUrl}/mcp`, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: {
|
|
59
|
+
'Content-Type': 'application/json',
|
|
60
|
+
Authorization: `Bearer ${mcpToken}`,
|
|
61
|
+
},
|
|
62
|
+
body: JSON.stringify({
|
|
63
|
+
jsonrpc: '2.0',
|
|
64
|
+
id: 1,
|
|
65
|
+
method: 'checklists/validate',
|
|
66
|
+
params: {
|
|
67
|
+
feature_id: featureId,
|
|
68
|
+
phase: dbPhase, // Use underscore format for database
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
throw new Error(`Failed to validate checklists for phase: ${response.statusText}`);
|
|
74
|
+
}
|
|
75
|
+
const data = await response.json();
|
|
76
|
+
if (data.error) {
|
|
77
|
+
throw new Error(`MCP Error: ${data.error.message}`);
|
|
78
|
+
}
|
|
79
|
+
return data.result;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create checklist results (mark as started/in-progress)
|
|
83
|
+
*/
|
|
84
|
+
export async function createChecklistResult(options, checklistId, itemResults) {
|
|
85
|
+
const { mcpServerUrl, mcpToken, featureId } = options;
|
|
86
|
+
const response = await fetch(`${mcpServerUrl}/mcp`, {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers: {
|
|
89
|
+
'Content-Type': 'application/json',
|
|
90
|
+
Authorization: `Bearer ${mcpToken}`,
|
|
91
|
+
},
|
|
92
|
+
body: JSON.stringify({
|
|
93
|
+
jsonrpc: '2.0',
|
|
94
|
+
id: 1,
|
|
95
|
+
method: 'checklist_results/create',
|
|
96
|
+
params: {
|
|
97
|
+
feature_id: featureId,
|
|
98
|
+
checklist_id: checklistId,
|
|
99
|
+
item_results: itemResults,
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
});
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
throw new Error(`Failed to create checklist result: ${response.statusText}`);
|
|
105
|
+
}
|
|
106
|
+
const data = await response.json();
|
|
107
|
+
if (data.error) {
|
|
108
|
+
throw new Error(`MCP Error: ${data.error.message}`);
|
|
109
|
+
}
|
|
110
|
+
return data.result;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Strictly validate that all required checklists have results
|
|
114
|
+
* Returns error if any checklists exist but don't have results
|
|
115
|
+
*/
|
|
116
|
+
export async function validateRequiredChecklistResults(options, phase, verbose) {
|
|
117
|
+
try {
|
|
118
|
+
// Get checklists for this phase
|
|
119
|
+
const checklistContext = await getChecklistsForPhase(options, phase);
|
|
120
|
+
// If no checklists exist for this phase, validation passes
|
|
121
|
+
if (!checklistContext.checklists ||
|
|
122
|
+
checklistContext.checklists.length === 0) {
|
|
123
|
+
if (verbose) {
|
|
124
|
+
console.log(`📋 No checklists found for phase ${phase} - validation passes`);
|
|
125
|
+
}
|
|
126
|
+
return { success: true, missingChecklists: [] };
|
|
127
|
+
}
|
|
128
|
+
// Validate checklist completion
|
|
129
|
+
const validation = await validateChecklistsForPhase(options, phase);
|
|
130
|
+
const missingChecklists = [];
|
|
131
|
+
// Check each checklist to ensure it has been addressed with results
|
|
132
|
+
for (const checklistValidation of validation.checklists_validation) {
|
|
133
|
+
// If checklist exists but has no result created (status is 'not_started')
|
|
134
|
+
if (checklistValidation.status === 'not_started') {
|
|
135
|
+
missingChecklists.push(checklistValidation.checklist_name);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (missingChecklists.length > 0) {
|
|
139
|
+
const errorMsg = `Phase ${phase} has ${checklistContext.checklists.length} MANDATORY checklists but ${missingChecklists.length} are missing results. All checklists must be addressed. Missing: ${missingChecklists.join(', ')}`;
|
|
140
|
+
if (verbose) {
|
|
141
|
+
console.log(`❌ ${errorMsg}`);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
success: false,
|
|
145
|
+
error: errorMsg,
|
|
146
|
+
missingChecklists,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (verbose) {
|
|
150
|
+
console.log(`✅ All ${validation.checklists_validation.length} mandatory checklists for phase ${phase} have been addressed`);
|
|
151
|
+
}
|
|
152
|
+
return { success: true, missingChecklists: [] };
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
const errorMsg = `Failed to validate mandatory checklist compliance for phase ${phase}: ${error instanceof Error ? error.message : String(error)}`;
|
|
156
|
+
return {
|
|
157
|
+
success: false,
|
|
158
|
+
error: errorMsg,
|
|
159
|
+
missingChecklists: [],
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Create checklist item result
|
|
165
|
+
*/
|
|
166
|
+
export async function createChecklistItemResult(options, checklistItemId, isPassed, value, notes) {
|
|
167
|
+
const { mcpServerUrl, mcpToken, featureId } = options;
|
|
168
|
+
const response = await fetch(`${mcpServerUrl}/mcp`, {
|
|
169
|
+
method: 'POST',
|
|
170
|
+
headers: {
|
|
171
|
+
'Content-Type': 'application/json',
|
|
172
|
+
Authorization: `Bearer ${mcpToken}`,
|
|
173
|
+
},
|
|
174
|
+
body: JSON.stringify({
|
|
175
|
+
jsonrpc: '2.0',
|
|
176
|
+
id: 1,
|
|
177
|
+
method: 'checklist_item_results/create',
|
|
178
|
+
params: {
|
|
179
|
+
feature_id: featureId,
|
|
180
|
+
checklist_item_id: checklistItemId,
|
|
181
|
+
is_passed: isPassed,
|
|
182
|
+
value: value,
|
|
183
|
+
notes: notes,
|
|
184
|
+
},
|
|
185
|
+
}),
|
|
186
|
+
});
|
|
187
|
+
if (!response.ok) {
|
|
188
|
+
throw new Error(`Failed to create checklist item result: ${response.statusText}`);
|
|
189
|
+
}
|
|
190
|
+
const data = await response.json();
|
|
191
|
+
if (data.error) {
|
|
192
|
+
throw new Error(`MCP Error: ${data.error.message}`);
|
|
193
|
+
}
|
|
194
|
+
return data.result;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Process checklist item results from phase JSON response and create MCP results
|
|
198
|
+
*/
|
|
199
|
+
export async function processChecklistItemResultsFromResponse(options, phase, checklistItemResults, verbose) {
|
|
200
|
+
const errors = [];
|
|
201
|
+
let created = 0;
|
|
202
|
+
if (!checklistItemResults || checklistItemResults.length === 0) {
|
|
203
|
+
if (verbose) {
|
|
204
|
+
console.log('📋 No checklist item results to process');
|
|
205
|
+
}
|
|
206
|
+
return { created, errors };
|
|
207
|
+
}
|
|
208
|
+
// Get current checklists to map checklist_item_id to checklist_id
|
|
209
|
+
const checklistContext = await getChecklistsForPhase(options, phase);
|
|
210
|
+
// Create a map from checklist_item_id to checklist_id
|
|
211
|
+
const itemToChecklistMap = new Map();
|
|
212
|
+
const checklistIds = new Set();
|
|
213
|
+
for (const checklist of checklistContext.checklists) {
|
|
214
|
+
checklistIds.add(checklist.id);
|
|
215
|
+
for (const item of checklist.items) {
|
|
216
|
+
itemToChecklistMap.set(item.id, checklist.id);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Group checklist item results by checklist
|
|
220
|
+
const resultsByChecklist = new Map();
|
|
221
|
+
for (const result of checklistItemResults) {
|
|
222
|
+
const checklistId = itemToChecklistMap.get(result.checklist_item_id);
|
|
223
|
+
if (!checklistId) {
|
|
224
|
+
const errorMsg = `Could not find checklist for item ${result.checklist_item_id}`;
|
|
225
|
+
errors.push(errorMsg);
|
|
226
|
+
if (verbose) {
|
|
227
|
+
console.log(`❌ ${errorMsg}`);
|
|
228
|
+
}
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (!resultsByChecklist.has(checklistId)) {
|
|
232
|
+
resultsByChecklist.set(checklistId, []);
|
|
233
|
+
}
|
|
234
|
+
resultsByChecklist.get(checklistId).push({
|
|
235
|
+
checklist_item_id: result.checklist_item_id,
|
|
236
|
+
is_passed: result.is_passed,
|
|
237
|
+
value: result.value,
|
|
238
|
+
notes: result.notes,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
// Create checklist results with item results for each checklist
|
|
242
|
+
for (const [checklistId, itemResults] of resultsByChecklist) {
|
|
243
|
+
try {
|
|
244
|
+
await createChecklistResult(options, checklistId, itemResults);
|
|
245
|
+
created += itemResults.length;
|
|
246
|
+
if (verbose) {
|
|
247
|
+
console.log(`📋 Created checklist result for ${checklistId} with ${itemResults.length} item results`);
|
|
248
|
+
for (const itemResult of itemResults) {
|
|
249
|
+
const status = itemResult.is_passed ? '✅' : '❌';
|
|
250
|
+
console.log(` ${status} Item: ${itemResult.checklist_item_id}`);
|
|
251
|
+
if (itemResult.notes) {
|
|
252
|
+
console.log(` Notes: ${itemResult.notes}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
const errorMsg = `Failed to create checklist result for ${checklistId}: ${error instanceof Error ? error.message : String(error)}`;
|
|
259
|
+
errors.push(errorMsg);
|
|
260
|
+
if (verbose) {
|
|
261
|
+
console.log(`❌ ${errorMsg}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return { created, errors };
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Process checklist results from phase JSON response and create MCP results
|
|
269
|
+
*/
|
|
270
|
+
export async function processChecklistResultsFromResponse(options, checklistResults, verbose) {
|
|
271
|
+
const errors = [];
|
|
272
|
+
let created = 0;
|
|
273
|
+
if (!checklistResults || checklistResults.length === 0) {
|
|
274
|
+
if (verbose) {
|
|
275
|
+
console.log('📋 No checklist results to process');
|
|
276
|
+
}
|
|
277
|
+
return { created, errors };
|
|
278
|
+
}
|
|
279
|
+
for (const result of checklistResults) {
|
|
280
|
+
if (result.satisfied) {
|
|
281
|
+
try {
|
|
282
|
+
await createChecklistResult(options, result.checklist_id);
|
|
283
|
+
created++;
|
|
284
|
+
if (verbose) {
|
|
285
|
+
console.log(`✅ Created checklist result for: ${result.checklist_id}`);
|
|
286
|
+
if (result.notes) {
|
|
287
|
+
console.log(` Notes: ${result.notes}`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
const errorMsg = `Failed to create checklist result for ${result.checklist_id}: ${error instanceof Error ? error.message : String(error)}`;
|
|
293
|
+
errors.push(errorMsg);
|
|
294
|
+
if (verbose) {
|
|
295
|
+
console.log(`❌ ${errorMsg}`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
// For unsatisfied checklists, still create a result but mark as failed/incomplete
|
|
301
|
+
if (verbose) {
|
|
302
|
+
console.log(`⚠️ Checklist ${result.checklist_id} marked as NOT satisfied`);
|
|
303
|
+
if (result.notes) {
|
|
304
|
+
console.log(` Reason: ${result.notes}`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// Note: We still need to create some form of result to track that this checklist was addressed
|
|
308
|
+
// but marked as unsatisfied. The current MCP API might need to support this case.
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return { created, errors };
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Format checklist context as string for LLM consumption
|
|
315
|
+
*/
|
|
316
|
+
export function formatChecklistsForContext(context) {
|
|
317
|
+
if (!context.checklists || context.checklists.length === 0) {
|
|
318
|
+
return `No checklists defined for phase: ${context.phase}`;
|
|
319
|
+
}
|
|
320
|
+
const sections = context.checklists
|
|
321
|
+
.map((checklist) => {
|
|
322
|
+
const itemsText = checklist.items
|
|
323
|
+
.map((item) => ` - **${item.title}** (ID: ${item.id})${item.is_required ? ' (required)' : ''}: ${item.description || 'No description'}`)
|
|
324
|
+
.join('\n');
|
|
325
|
+
return `**${checklist.name}** (${checklist.role})
|
|
326
|
+
ID: ${checklist.id}
|
|
327
|
+
${checklist.description || 'No description'}
|
|
328
|
+
Items:
|
|
329
|
+
${itemsText}`;
|
|
330
|
+
})
|
|
331
|
+
.join('\n\n');
|
|
332
|
+
return `# Checklists for ${context.phase} phase
|
|
333
|
+
|
|
334
|
+
${sections}
|
|
335
|
+
|
|
336
|
+
Please review these checklists and ensure your work addresses the relevant requirements for your role. These checklists will be used to validate the completion of this phase.`;
|
|
337
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface FeatureInfo {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
technical_design?: string;
|
|
6
|
+
status: string;
|
|
7
|
+
product_id: string;
|
|
8
|
+
execution_mode?: string;
|
|
9
|
+
created_at?: string;
|
|
10
|
+
updated_at?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UserStory {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
status: string;
|
|
17
|
+
created_at?: string;
|
|
18
|
+
updated_at?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
export interface TestCase {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
is_critical: boolean;
|
|
26
|
+
created_at?: string;
|
|
27
|
+
updated_at?: string;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|