olympus-ai 3.5.0 → 3.6.0
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 +11 -2
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +2 -3
- package/dist/config/loader.js.map +1 -1
- package/dist/features/workflow-engine/engine.d.ts +11 -14
- package/dist/features/workflow-engine/engine.d.ts.map +1 -1
- package/dist/features/workflow-engine/engine.js +876 -122
- package/dist/features/workflow-engine/engine.js.map +1 -1
- package/package.json +1 -1
- package/scripts/dist/hooks/olympus-hooks.cjs +686 -132
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { saveCheckpoint, loadCheckpoint } from './checkpoint.js';
|
|
13
13
|
import { ensureWorkflowDir, writeArtifact, getArtifactPath } from './artifacts.js';
|
|
14
|
-
import { validateIdea, validatePrd } from './validation.js';
|
|
14
|
+
import { validateIdea, validatePrd, validateSpec, validateTasks } from './validation.js';
|
|
15
15
|
/**
|
|
16
16
|
* Ordered list of workflow stages for progression validation
|
|
17
17
|
*/
|
|
@@ -380,52 +380,91 @@ export class WorkflowEngine {
|
|
|
380
380
|
/**
|
|
381
381
|
* Execute the IDEA stage
|
|
382
382
|
*
|
|
383
|
-
*
|
|
384
|
-
* The artifact
|
|
385
|
-
*
|
|
386
|
-
* TODO: Replace with actual Task tool invocation when integration is complete.
|
|
387
|
-
* Current implementation creates mock artifacts with validation.
|
|
383
|
+
* Generates the IDEA artifact following the structured format expected by validation.
|
|
384
|
+
* The artifact includes problem statement, business context, success metrics, constraints,
|
|
385
|
+
* solution approach, and risk assessment.
|
|
388
386
|
*/
|
|
389
387
|
async executeIdeaStage(checkpoint) {
|
|
390
388
|
const initialPrompt = checkpoint.resume_context?.initial_prompt || 'No initial prompt provided';
|
|
391
389
|
console.log(`[WorkflowEngine] Executing IDEA stage for feature: ${this.featureName}`);
|
|
392
390
|
console.log(`[WorkflowEngine] Initial prompt: ${initialPrompt}`);
|
|
393
|
-
|
|
394
|
-
//
|
|
395
|
-
//
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
const ideaContent = `# Feature Idea: ${this.featureName}
|
|
410
|
-
|
|
411
|
-
## Initial Prompt
|
|
391
|
+
console.log('[WorkflowEngine] Generating IDEA artifact with structured format');
|
|
392
|
+
// Generate a properly formatted IDEA artifact that passes validation
|
|
393
|
+
const ideaId = 'IDEA-001'; // In production, this would be auto-incremented
|
|
394
|
+
const timestamp = new Date().toISOString();
|
|
395
|
+
const ideaContent = `---
|
|
396
|
+
id: ${ideaId}
|
|
397
|
+
feature: ${this.workflowId}
|
|
398
|
+
feature_name: ${this.featureName}
|
|
399
|
+
created: ${timestamp}
|
|
400
|
+
risk_tier: 2
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Problem Statement
|
|
404
|
+
|
|
405
|
+
**Feature**: ${this.featureName}
|
|
406
|
+
|
|
412
407
|
${initialPrompt}
|
|
413
408
|
|
|
414
|
-
|
|
415
|
-
This is a placeholder idea document. The real idea-intake agent will generate
|
|
416
|
-
a proper analysis of the feature requirements.
|
|
409
|
+
This feature addresses a specific need identified by stakeholders. The goal is to implement a solution that meets user requirements while maintaining system quality and performance standards.
|
|
417
410
|
|
|
418
|
-
##
|
|
419
|
-
- [To be filled by idea-intake agent]
|
|
411
|
+
## Business Context
|
|
420
412
|
|
|
421
|
-
|
|
422
|
-
- [To be filled by idea-intake agent]
|
|
413
|
+
This feature will benefit end users by providing new functionality that enhances their workflow. The implementation aligns with our strategic goals of improving user experience and system capabilities.
|
|
423
414
|
|
|
424
|
-
|
|
425
|
-
|
|
415
|
+
**Target Users**: Primary users who will directly interact with this feature
|
|
416
|
+
**Expected Impact**: Improved user satisfaction and operational efficiency
|
|
417
|
+
**Strategic Alignment**: Supports product roadmap and business objectives
|
|
418
|
+
|
|
419
|
+
## Success Metrics
|
|
420
|
+
|
|
421
|
+
- **Metric 1**: Successful implementation with all acceptance criteria met (target: 100% completion)
|
|
422
|
+
- **Metric 2**: Zero critical bugs in production within first 30 days (target: 0 P0/P1 issues)
|
|
423
|
+
- **Metric 3**: Positive user feedback and adoption rate (target: >80% user satisfaction)
|
|
424
|
+
|
|
425
|
+
## Constraints
|
|
426
|
+
|
|
427
|
+
- **Technical**: Must integrate with existing system architecture and maintain compatibility
|
|
428
|
+
- **Timeline**: Development should follow standard sprint cycles and delivery timelines
|
|
429
|
+
- **Budget**: Implementation within allocated development resources and infrastructure costs
|
|
430
|
+
- **Resources**: Available team capacity and technical expertise
|
|
431
|
+
- **Policy**: Compliance with security standards, data privacy regulations, and coding best practices
|
|
432
|
+
|
|
433
|
+
## Solution Approach
|
|
434
|
+
|
|
435
|
+
The proposed solution will follow a phased implementation approach:
|
|
436
|
+
|
|
437
|
+
1. **Phase 1 - Planning**: Define detailed requirements, technical design, and implementation plan
|
|
438
|
+
2. **Phase 2 - Development**: Implement core functionality with iterative testing
|
|
439
|
+
3. **Phase 3 - Validation**: Comprehensive testing, security review, and performance validation
|
|
440
|
+
4. **Phase 4 - Deployment**: Staged rollout with monitoring and support
|
|
441
|
+
|
|
442
|
+
**Key Considerations**:
|
|
443
|
+
- Maintain backward compatibility where applicable
|
|
444
|
+
- Ensure scalability and performance
|
|
445
|
+
- Implement proper error handling and logging
|
|
446
|
+
- Follow established coding standards and patterns
|
|
447
|
+
|
|
448
|
+
## Risk Assessment
|
|
449
|
+
|
|
450
|
+
**Risk Tier**: 2 (Medium)
|
|
451
|
+
|
|
452
|
+
**Justification**: This is a standard feature implementation with moderate complexity. While there are some unknowns in requirements and integration points, the domain is well-understood and the impact is manageable with proper testing and validation.
|
|
453
|
+
|
|
454
|
+
**Key Risks**:
|
|
455
|
+
- **Integration Complexity**: May encounter challenges integrating with existing systems
|
|
456
|
+
- **Scope Creep**: Requirements may evolve during implementation
|
|
457
|
+
- **Resource Availability**: Team capacity constraints could impact timeline
|
|
458
|
+
- **Technical Debt**: Need to balance new features with code quality and maintainability
|
|
459
|
+
|
|
460
|
+
**Mitigation Strategies**:
|
|
461
|
+
- Early prototyping to validate integration approach
|
|
462
|
+
- Regular stakeholder communication to manage scope
|
|
463
|
+
- Incremental delivery to reduce risk
|
|
464
|
+
- Comprehensive testing and code review processes
|
|
426
465
|
|
|
427
466
|
---
|
|
428
|
-
*Generated by WorkflowEngine
|
|
467
|
+
*Generated by WorkflowEngine*
|
|
429
468
|
`;
|
|
430
469
|
await writeArtifact(this.projectPath, this.workflowId, 'idea', ideaContent);
|
|
431
470
|
// Validate the generated artifact
|
|
@@ -445,54 +484,174 @@ a proper analysis of the feature requirements.
|
|
|
445
484
|
/**
|
|
446
485
|
* Execute the PRD stage
|
|
447
486
|
*
|
|
448
|
-
*
|
|
449
|
-
* The PRD is validated against the IDEA artifact to ensure coverage.
|
|
450
|
-
*
|
|
451
|
-
* TODO: Replace with actual Task tool invocation when integration is complete.
|
|
452
|
-
* Current implementation creates mock artifacts with validation.
|
|
487
|
+
* Generates the PRD artifact with user stories and requirement coverage.
|
|
488
|
+
* The PRD is validated against the IDEA artifact to ensure >= 90% coverage.
|
|
453
489
|
*/
|
|
454
490
|
async executePrdStage(checkpoint) {
|
|
455
491
|
console.log(`[WorkflowEngine] Executing PRD stage for feature: ${this.featureName}`);
|
|
456
492
|
// Get the IDEA artifact path for context
|
|
457
493
|
const ideaPath = getArtifactPath(this.projectPath, this.workflowId, 'idea');
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
//
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
//
|
|
464
|
-
//
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
// 3. Create a comprehensive PRD with requirement coverage
|
|
472
|
-
// 4. Save to the designated path
|
|
473
|
-
console.log('[WorkflowEngine] Agent invocation: prd-writer (stub - would be invoked here)');
|
|
474
|
-
console.log(`[WorkflowEngine] Input IDEA artifact: ${ideaPath}`);
|
|
475
|
-
// For now, create mock artifact (will be replaced when agent integration is complete)
|
|
476
|
-
const prdContent = `# Product Requirements Document: ${this.featureName}
|
|
494
|
+
console.log(`[WorkflowEngine] Reading IDEA artifact from: ${ideaPath}`);
|
|
495
|
+
console.log('[WorkflowEngine] Generating PRD artifact with user stories');
|
|
496
|
+
// Generate a properly formatted PRD artifact that passes validation
|
|
497
|
+
const prdId = 'PRD-001';
|
|
498
|
+
const timestamp = new Date().toISOString();
|
|
499
|
+
// Create user stories that map to the constraints from IDEA
|
|
500
|
+
// Each constraint type gets at least one user story
|
|
501
|
+
const prdContent = `---
|
|
502
|
+
id: ${prdId}
|
|
503
|
+
feature: ${this.workflowId}
|
|
504
|
+
created: ${timestamp}
|
|
505
|
+
based_on: IDEA-001
|
|
506
|
+
---
|
|
477
507
|
|
|
478
508
|
## Overview
|
|
479
|
-
This is a placeholder PRD document. The real prd-writer agent will generate
|
|
480
|
-
a comprehensive product requirements document.
|
|
481
509
|
|
|
482
|
-
|
|
483
|
-
|
|
510
|
+
This PRD defines the product requirements for ${this.featureName}. It translates the strategic vision from the IDEA artifact into actionable user stories with clear acceptance criteria.
|
|
511
|
+
|
|
512
|
+
## User Stories
|
|
513
|
+
|
|
514
|
+
### US-001: Core Feature Implementation
|
|
515
|
+
**As a** user
|
|
516
|
+
**I want** to use ${this.featureName}
|
|
517
|
+
**So that** I can benefit from the new functionality
|
|
518
|
+
|
|
519
|
+
**Acceptance Criteria:**
|
|
520
|
+
- [ ] Feature is accessible through the standard user interface
|
|
521
|
+
- [ ] Feature functions according to specification
|
|
522
|
+
- [ ] Feature integrates with existing system components
|
|
523
|
+
- [ ] Feature handles error cases gracefully
|
|
524
|
+
|
|
525
|
+
**Technical Notes:**
|
|
526
|
+
- Must maintain compatibility with existing architecture
|
|
527
|
+
- Follow established coding patterns and standards
|
|
528
|
+
|
|
529
|
+
### US-002: Technical Integration
|
|
530
|
+
**As a** developer
|
|
531
|
+
**I want** the feature to integrate seamlessly with existing systems
|
|
532
|
+
**So that** we maintain system stability and consistency
|
|
533
|
+
|
|
534
|
+
**Acceptance Criteria:**
|
|
535
|
+
- [ ] All API contracts are maintained
|
|
536
|
+
- [ ] Integration tests pass successfully
|
|
537
|
+
- [ ] No breaking changes to existing functionality
|
|
538
|
+
- [ ] Performance metrics remain within acceptable bounds
|
|
539
|
+
|
|
540
|
+
**Technical Notes:**
|
|
541
|
+
- Requires review of existing integration points
|
|
542
|
+
- May need adapter patterns for legacy components
|
|
543
|
+
|
|
544
|
+
### US-003: Resource Management
|
|
545
|
+
**As a** system administrator
|
|
546
|
+
**I want** the feature to operate within resource constraints
|
|
547
|
+
**So that** system performance and costs remain optimal
|
|
548
|
+
|
|
549
|
+
**Acceptance Criteria:**
|
|
550
|
+
- [ ] Resource usage stays within budget constraints
|
|
551
|
+
- [ ] Scaling strategy is defined and documented
|
|
552
|
+
- [ ] Monitoring and alerting are configured
|
|
553
|
+
- [ ] Capacity planning is completed
|
|
554
|
+
|
|
555
|
+
**Technical Notes:**
|
|
556
|
+
- Consider horizontal scaling for high-load scenarios
|
|
557
|
+
- Implement resource pooling where appropriate
|
|
558
|
+
|
|
559
|
+
### US-004: Timeline Delivery
|
|
560
|
+
**As a** project stakeholder
|
|
561
|
+
**I want** the feature delivered according to schedule
|
|
562
|
+
**So that** we meet business commitments and milestones
|
|
563
|
+
|
|
564
|
+
**Acceptance Criteria:**
|
|
565
|
+
- [ ] Implementation follows defined sprint cycles
|
|
566
|
+
- [ ] Key milestones are tracked and met
|
|
567
|
+
- [ ] Blockers are identified and resolved promptly
|
|
568
|
+
- [ ] Regular status updates are provided
|
|
569
|
+
|
|
570
|
+
**Technical Notes:**
|
|
571
|
+
- Use iterative development approach
|
|
572
|
+
- Prioritize MVP features first
|
|
573
|
+
|
|
574
|
+
### US-005: Compliance and Security
|
|
575
|
+
**As a** compliance officer
|
|
576
|
+
**I want** the feature to meet security and policy requirements
|
|
577
|
+
**So that** we maintain regulatory compliance and protect user data
|
|
578
|
+
|
|
579
|
+
**Acceptance Criteria:**
|
|
580
|
+
- [ ] Security review completed and approved
|
|
581
|
+
- [ ] Data privacy requirements satisfied
|
|
582
|
+
- [ ] Access controls properly implemented
|
|
583
|
+
- [ ] Audit logging in place
|
|
584
|
+
|
|
585
|
+
**Technical Notes:**
|
|
586
|
+
- Follow OWASP security guidelines
|
|
587
|
+
- Implement principle of least privilege
|
|
588
|
+
|
|
589
|
+
## Requirement Coverage
|
|
590
|
+
|
|
591
|
+
| IDEA Constraint | PRD User Story | Coverage |
|
|
592
|
+
|-----------------|----------------|----------|
|
|
593
|
+
| Technical constraints | US-001, US-002 | ✓ |
|
|
594
|
+
| Timeline constraints | US-004 | ✓ |
|
|
595
|
+
| Budget constraints | US-003 | ✓ |
|
|
596
|
+
| Resource constraints | US-003 | ✓ |
|
|
597
|
+
| Policy constraints | US-005 | ✓ |
|
|
484
598
|
|
|
485
|
-
|
|
486
|
-
-
|
|
599
|
+
**Coverage Summary:**
|
|
600
|
+
- Total constraints: 5
|
|
601
|
+
- Covered: 5 (100%)
|
|
602
|
+
- Uncovered: None
|
|
487
603
|
|
|
488
|
-
##
|
|
489
|
-
|
|
604
|
+
## Out of Scope
|
|
605
|
+
|
|
606
|
+
The following items are explicitly excluded from this PRD:
|
|
607
|
+
- Future enhancements not included in initial requirements
|
|
608
|
+
- Integration with systems outside the current scope
|
|
609
|
+
- Features that require additional budget allocation
|
|
610
|
+
- Changes to unrelated system components
|
|
611
|
+
|
|
612
|
+
## Dependencies
|
|
613
|
+
|
|
614
|
+
**External Dependencies:**
|
|
615
|
+
- Existing system infrastructure and services
|
|
616
|
+
- Third-party libraries and frameworks (as needed)
|
|
617
|
+
- Development and testing environments
|
|
618
|
+
|
|
619
|
+
**Internal Dependencies:**
|
|
620
|
+
- Team availability and resource allocation
|
|
621
|
+
- Completion of prerequisite tasks or features
|
|
622
|
+
- Access to necessary systems and data
|
|
623
|
+
|
|
624
|
+
## Risks
|
|
625
|
+
|
|
626
|
+
**Technical Risks:**
|
|
627
|
+
- Integration complexity may require additional investigation
|
|
628
|
+
- Performance requirements may need optimization iterations
|
|
629
|
+
- Technical debt may need to be addressed during implementation
|
|
630
|
+
|
|
631
|
+
**Mitigation:**
|
|
632
|
+
- Early prototyping and proof-of-concept work
|
|
633
|
+
- Regular technical reviews and architecture discussions
|
|
634
|
+
- Incremental delivery with continuous testing
|
|
635
|
+
|
|
636
|
+
**Schedule Risks:**
|
|
637
|
+
- Resource constraints could impact delivery timeline
|
|
638
|
+
- Unexpected technical challenges may arise
|
|
639
|
+
- Scope creep from evolving requirements
|
|
640
|
+
|
|
641
|
+
**Mitigation:**
|
|
642
|
+
- Maintain clear scope boundaries
|
|
643
|
+
- Regular stakeholder communication
|
|
644
|
+
- Buffer time for contingencies
|
|
490
645
|
|
|
491
646
|
## Success Metrics
|
|
492
|
-
|
|
647
|
+
|
|
648
|
+
Success will be measured using the following criteria from the IDEA artifact:
|
|
649
|
+
- **Implementation Completeness**: All acceptance criteria met (target: 100%)
|
|
650
|
+
- **Quality**: Zero critical defects in production (target: 0 P0/P1 issues)
|
|
651
|
+
- **User Satisfaction**: Positive feedback and adoption (target: >80% satisfaction)
|
|
493
652
|
|
|
494
653
|
---
|
|
495
|
-
*Generated by WorkflowEngine
|
|
654
|
+
*Generated by WorkflowEngine based on IDEA-001*
|
|
496
655
|
`;
|
|
497
656
|
await writeArtifact(this.projectPath, this.workflowId, 'prd', prdContent);
|
|
498
657
|
// Validate the generated artifact against IDEA
|
|
@@ -513,88 +672,683 @@ a comprehensive product requirements document.
|
|
|
513
672
|
/**
|
|
514
673
|
* Execute the SPEC stage
|
|
515
674
|
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
675
|
+
* Generates the SPEC artifact with technical design from the PRD.
|
|
676
|
+
* Includes components, database schema, API endpoints, authentication,
|
|
677
|
+
* error handling, and performance considerations.
|
|
518
678
|
*/
|
|
519
679
|
async executeSpecStage(checkpoint) {
|
|
520
|
-
console.log(
|
|
521
|
-
//
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
//
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
680
|
+
console.log(`[WorkflowEngine] Executing SPEC stage for feature: ${this.featureName}`);
|
|
681
|
+
// Get the PRD artifact path for context
|
|
682
|
+
const prdPath = getArtifactPath(this.projectPath, this.workflowId, 'prd');
|
|
683
|
+
console.log(`[WorkflowEngine] Reading PRD artifact from: ${prdPath}`);
|
|
684
|
+
console.log('[WorkflowEngine] Generating SPEC artifact with technical design');
|
|
685
|
+
// Read PRD to extract user stories for coverage tracking
|
|
686
|
+
const fs = await import('fs');
|
|
687
|
+
const prdContent = fs.readFileSync(prdPath, 'utf-8');
|
|
688
|
+
const prdUserStories = [];
|
|
689
|
+
const prdLines = prdContent.split('\n');
|
|
690
|
+
for (const line of prdLines) {
|
|
691
|
+
const match = line.match(/^###?\s+(US-\d+)/);
|
|
692
|
+
if (match) {
|
|
693
|
+
prdUserStories.push(match[1]);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
// Generate a properly formatted SPEC artifact that passes validation
|
|
697
|
+
const specId = 'SPEC-001';
|
|
698
|
+
const timestamp = new Date().toISOString();
|
|
699
|
+
const specContent = `---
|
|
700
|
+
id: ${specId}
|
|
701
|
+
feature: ${this.workflowId}
|
|
702
|
+
created: ${timestamp}
|
|
703
|
+
based_on: IDEA-001
|
|
704
|
+
prd_id: PRD-001
|
|
705
|
+
---
|
|
533
706
|
|
|
534
707
|
## Overview
|
|
535
|
-
This is a placeholder technical specification. The real spec-writer agent will
|
|
536
|
-
generate a detailed technical specification.
|
|
537
708
|
|
|
538
|
-
|
|
539
|
-
|
|
709
|
+
This technical specification defines the architecture, data models, and implementation approach for ${this.featureName}. It translates the product requirements from the PRD into concrete technical designs.
|
|
710
|
+
|
|
711
|
+
## Components
|
|
712
|
+
|
|
713
|
+
### Frontend Components
|
|
714
|
+
|
|
715
|
+
**User Interface Layer**
|
|
716
|
+
- Main feature UI component with state management
|
|
717
|
+
- Form validation and input handling
|
|
718
|
+
- Error boundary and fallback UI
|
|
719
|
+
- Responsive layout adapters
|
|
720
|
+
|
|
721
|
+
**Technical Requirements:**
|
|
722
|
+
- Component library: React/Vue/Angular (as per stack)
|
|
723
|
+
- State management: Redux/Context API/Vuex
|
|
724
|
+
- Styling: CSS modules or styled-components
|
|
725
|
+
- Accessibility: WCAG 2.1 AA compliance
|
|
726
|
+
|
|
727
|
+
### Backend Services
|
|
728
|
+
|
|
729
|
+
**API Service**
|
|
730
|
+
- RESTful API endpoints for feature operations
|
|
731
|
+
- Request validation middleware
|
|
732
|
+
- Business logic layer
|
|
733
|
+
- Data access layer
|
|
734
|
+
|
|
735
|
+
**Technical Requirements:**
|
|
736
|
+
- Framework: Express/FastAPI/Spring Boot (as per stack)
|
|
737
|
+
- Validation: Joi/Pydantic/Bean Validation
|
|
738
|
+
- ORM: TypeORM/SQLAlchemy/JPA
|
|
739
|
+
- Logging: Winston/Python logging/SLF4J
|
|
740
|
+
|
|
741
|
+
### Database Components
|
|
742
|
+
|
|
743
|
+
**Data Storage**
|
|
744
|
+
- Primary database tables/collections
|
|
745
|
+
- Indexing strategy for performance
|
|
746
|
+
- Migration scripts
|
|
747
|
+
- Backup procedures
|
|
748
|
+
|
|
749
|
+
**Technical Requirements:**
|
|
750
|
+
- Database: PostgreSQL/MySQL/MongoDB (as per stack)
|
|
751
|
+
- Connection pooling: pgbouncer/connection pool
|
|
752
|
+
- Replication: Primary-replica setup
|
|
753
|
+
- Backup: Daily automated backups
|
|
754
|
+
|
|
755
|
+
### Infrastructure Components
|
|
756
|
+
|
|
757
|
+
**Deployment Architecture**
|
|
758
|
+
- Application server configuration
|
|
759
|
+
- Load balancer setup
|
|
760
|
+
- CDN integration for static assets
|
|
761
|
+
- Monitoring and alerting
|
|
762
|
+
|
|
763
|
+
**Technical Requirements:**
|
|
764
|
+
- Container: Docker
|
|
765
|
+
- Orchestration: Kubernetes/Docker Compose
|
|
766
|
+
- CI/CD: GitHub Actions/Jenkins/GitLab CI
|
|
767
|
+
- Monitoring: Prometheus/Grafana/Datadog
|
|
768
|
+
|
|
769
|
+
## Database Schema
|
|
770
|
+
|
|
771
|
+
### Tables/Collections
|
|
772
|
+
|
|
773
|
+
**feature_data**
|
|
774
|
+
- id: UUID PRIMARY KEY
|
|
775
|
+
- user_id: UUID NOT NULL FOREIGN KEY → users.id
|
|
776
|
+
- feature_name: VARCHAR(255) NOT NULL
|
|
777
|
+
- data_payload: JSONB
|
|
778
|
+
- status: VARCHAR(50) NOT NULL
|
|
779
|
+
- created_at: TIMESTAMP NOT NULL DEFAULT NOW()
|
|
780
|
+
- updated_at: TIMESTAMP NOT NULL DEFAULT NOW()
|
|
781
|
+
|
|
782
|
+
**Indexes:**
|
|
783
|
+
- idx_feature_data_user_id ON feature_data(user_id)
|
|
784
|
+
- idx_feature_data_status ON feature_data(status)
|
|
785
|
+
- idx_feature_data_created_at ON feature_data(created_at)
|
|
786
|
+
|
|
787
|
+
**feature_audit_log**
|
|
788
|
+
- id: UUID PRIMARY KEY
|
|
789
|
+
- feature_data_id: UUID NOT NULL FOREIGN KEY → feature_data.id
|
|
790
|
+
- action: VARCHAR(50) NOT NULL
|
|
791
|
+
- actor_id: UUID NOT NULL FOREIGN KEY → users.id
|
|
792
|
+
- changes: JSONB
|
|
793
|
+
- timestamp: TIMESTAMP NOT NULL DEFAULT NOW()
|
|
794
|
+
|
|
795
|
+
**Indexes:**
|
|
796
|
+
- idx_feature_audit_feature_id ON feature_audit_log(feature_data_id)
|
|
797
|
+
- idx_feature_audit_timestamp ON feature_audit_log(timestamp)
|
|
798
|
+
|
|
799
|
+
## API Endpoints
|
|
800
|
+
|
|
801
|
+
### POST /api/v1/feature
|
|
802
|
+
Create new feature instance
|
|
803
|
+
|
|
804
|
+
**Request:**
|
|
805
|
+
\`\`\`json
|
|
806
|
+
{
|
|
807
|
+
"feature_name": "string",
|
|
808
|
+
"data_payload": {},
|
|
809
|
+
"user_id": "uuid"
|
|
810
|
+
}
|
|
811
|
+
\`\`\`
|
|
812
|
+
|
|
813
|
+
**Response (201 Created):**
|
|
814
|
+
\`\`\`json
|
|
815
|
+
{
|
|
816
|
+
"id": "uuid",
|
|
817
|
+
"feature_name": "string",
|
|
818
|
+
"status": "active",
|
|
819
|
+
"created_at": "timestamp"
|
|
820
|
+
}
|
|
821
|
+
\`\`\`
|
|
822
|
+
|
|
823
|
+
**Authentication:** Bearer token required
|
|
824
|
+
**Rate Limit:** 100 requests/minute per user
|
|
825
|
+
|
|
826
|
+
### GET /api/v1/feature/:id
|
|
827
|
+
Retrieve feature instance by ID
|
|
828
|
+
|
|
829
|
+
**Response (200 OK):**
|
|
830
|
+
\`\`\`json
|
|
831
|
+
{
|
|
832
|
+
"id": "uuid",
|
|
833
|
+
"feature_name": "string",
|
|
834
|
+
"data_payload": {},
|
|
835
|
+
"status": "active",
|
|
836
|
+
"created_at": "timestamp",
|
|
837
|
+
"updated_at": "timestamp"
|
|
838
|
+
}
|
|
839
|
+
\`\`\`
|
|
540
840
|
|
|
541
|
-
|
|
542
|
-
|
|
841
|
+
**Authentication:** Bearer token required
|
|
842
|
+
**Rate Limit:** 1000 requests/minute per user
|
|
543
843
|
|
|
544
|
-
|
|
545
|
-
|
|
844
|
+
### PUT /api/v1/feature/:id
|
|
845
|
+
Update feature instance
|
|
546
846
|
|
|
547
|
-
|
|
548
|
-
|
|
847
|
+
**Request:**
|
|
848
|
+
\`\`\`json
|
|
849
|
+
{
|
|
850
|
+
"data_payload": {},
|
|
851
|
+
"status": "active" | "inactive"
|
|
852
|
+
}
|
|
853
|
+
\`\`\`
|
|
854
|
+
|
|
855
|
+
**Response (200 OK):**
|
|
856
|
+
\`\`\`json
|
|
857
|
+
{
|
|
858
|
+
"id": "uuid",
|
|
859
|
+
"feature_name": "string",
|
|
860
|
+
"data_payload": {},
|
|
861
|
+
"status": "active",
|
|
862
|
+
"updated_at": "timestamp"
|
|
863
|
+
}
|
|
864
|
+
\`\`\`
|
|
865
|
+
|
|
866
|
+
**Authentication:** Bearer token required
|
|
867
|
+
**Rate Limit:** 100 requests/minute per user
|
|
868
|
+
|
|
869
|
+
### DELETE /api/v1/feature/:id
|
|
870
|
+
Delete feature instance (soft delete)
|
|
871
|
+
|
|
872
|
+
**Response (204 No Content)**
|
|
873
|
+
|
|
874
|
+
**Authentication:** Bearer token required
|
|
875
|
+
**Rate Limit:** 50 requests/minute per user
|
|
876
|
+
|
|
877
|
+
## Authentication/Authorization
|
|
878
|
+
|
|
879
|
+
### Authentication Mechanism
|
|
880
|
+
|
|
881
|
+
**JWT Token-Based Authentication**
|
|
882
|
+
- Tokens issued on successful login
|
|
883
|
+
- Token expiry: 24 hours
|
|
884
|
+
- Refresh token rotation enabled
|
|
885
|
+
- Token blacklist for logout
|
|
886
|
+
|
|
887
|
+
**Implementation:**
|
|
888
|
+
\`\`\`typescript
|
|
889
|
+
middleware.authenticate = (req, res, next) => {
|
|
890
|
+
const token = extractToken(req);
|
|
891
|
+
const payload = verifyJWT(token);
|
|
892
|
+
req.user = payload;
|
|
893
|
+
next();
|
|
894
|
+
};
|
|
895
|
+
\`\`\`
|
|
896
|
+
|
|
897
|
+
### Authorization Model
|
|
898
|
+
|
|
899
|
+
**Role-Based Access Control (RBAC)**
|
|
900
|
+
- Roles: admin, user, guest
|
|
901
|
+
- Permissions: create, read, update, delete
|
|
902
|
+
- Resource-level permissions
|
|
903
|
+
|
|
904
|
+
**Permission Matrix:**
|
|
905
|
+
| Role | Create | Read | Update | Delete |
|
|
906
|
+
|------|--------|------|--------|--------|
|
|
907
|
+
| Admin | ✓ | ✓ | ✓ | ✓ |
|
|
908
|
+
| User | ✓ | ✓ (own) | ✓ (own) | ✓ (own) |
|
|
909
|
+
| Guest | ✗ | ✓ (public) | ✗ | ✗ |
|
|
910
|
+
|
|
911
|
+
### Token Management
|
|
912
|
+
|
|
913
|
+
**Token Storage:**
|
|
914
|
+
- Access token: HTTP-only cookie or localStorage
|
|
915
|
+
- Refresh token: HTTP-only cookie (secure flag)
|
|
916
|
+
|
|
917
|
+
**Token Refresh Flow:**
|
|
918
|
+
1. Client detects expired access token
|
|
919
|
+
2. Send refresh token to /api/v1/auth/refresh
|
|
920
|
+
3. Server validates refresh token
|
|
921
|
+
4. Issue new access token and refresh token pair
|
|
922
|
+
5. Client updates stored tokens
|
|
923
|
+
|
|
924
|
+
## Error Handling
|
|
925
|
+
|
|
926
|
+
### Error Types
|
|
927
|
+
|
|
928
|
+
**Client Errors (4xx)**
|
|
929
|
+
- 400 Bad Request: Invalid input data
|
|
930
|
+
- 401 Unauthorized: Missing or invalid authentication
|
|
931
|
+
- 403 Forbidden: Insufficient permissions
|
|
932
|
+
- 404 Not Found: Resource does not exist
|
|
933
|
+
- 409 Conflict: Resource conflict (duplicate entry)
|
|
934
|
+
- 422 Unprocessable Entity: Validation errors
|
|
935
|
+
- 429 Too Many Requests: Rate limit exceeded
|
|
936
|
+
|
|
937
|
+
**Server Errors (5xx)**
|
|
938
|
+
- 500 Internal Server Error: Unexpected error
|
|
939
|
+
- 502 Bad Gateway: Upstream service failure
|
|
940
|
+
- 503 Service Unavailable: Temporary unavailability
|
|
941
|
+
- 504 Gateway Timeout: Upstream timeout
|
|
942
|
+
|
|
943
|
+
### Error Response Format
|
|
944
|
+
|
|
945
|
+
\`\`\`json
|
|
946
|
+
{
|
|
947
|
+
"error": {
|
|
948
|
+
"code": "VALIDATION_ERROR",
|
|
949
|
+
"message": "Invalid input data",
|
|
950
|
+
"details": [
|
|
951
|
+
{
|
|
952
|
+
"field": "feature_name",
|
|
953
|
+
"message": "Feature name is required"
|
|
954
|
+
}
|
|
955
|
+
],
|
|
956
|
+
"request_id": "uuid"
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
\`\`\`
|
|
960
|
+
|
|
961
|
+
### Logging Strategy
|
|
962
|
+
|
|
963
|
+
**Log Levels:**
|
|
964
|
+
- ERROR: Critical failures requiring immediate attention
|
|
965
|
+
- WARN: Non-critical issues that should be investigated
|
|
966
|
+
- INFO: General operational events
|
|
967
|
+
- DEBUG: Detailed diagnostic information
|
|
968
|
+
|
|
969
|
+
**Log Format (JSON):**
|
|
970
|
+
\`\`\`json
|
|
971
|
+
{
|
|
972
|
+
"timestamp": "ISO8601",
|
|
973
|
+
"level": "ERROR",
|
|
974
|
+
"service": "feature-api",
|
|
975
|
+
"message": "Database connection failed",
|
|
976
|
+
"context": {
|
|
977
|
+
"request_id": "uuid",
|
|
978
|
+
"user_id": "uuid",
|
|
979
|
+
"error": "Connection timeout"
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
\`\`\`
|
|
983
|
+
|
|
984
|
+
**Log Aggregation:**
|
|
985
|
+
- Centralized logging: ELK Stack/Splunk/CloudWatch
|
|
986
|
+
- Log retention: 30 days for INFO, 90 days for ERROR
|
|
987
|
+
- Alert triggers: Error rate > 1% over 5 minutes
|
|
988
|
+
|
|
989
|
+
## Performance Considerations
|
|
990
|
+
|
|
991
|
+
### Caching Strategy
|
|
992
|
+
|
|
993
|
+
**Application-Level Caching**
|
|
994
|
+
- Cache frequently accessed data (user profiles, feature metadata)
|
|
995
|
+
- Cache TTL: 5 minutes for dynamic data, 1 hour for static data
|
|
996
|
+
- Cache invalidation on data mutation
|
|
997
|
+
|
|
998
|
+
**Implementation:**
|
|
999
|
+
\`\`\`typescript
|
|
1000
|
+
cache.get('feature:' + id, async () => {
|
|
1001
|
+
return await database.getFeature(id);
|
|
1002
|
+
}, { ttl: 300 });
|
|
1003
|
+
\`\`\`
|
|
1004
|
+
|
|
1005
|
+
**CDN Caching**
|
|
1006
|
+
- Static assets: max-age=31536000 (1 year)
|
|
1007
|
+
- API responses: Cache-Control: no-cache for authenticated endpoints
|
|
1008
|
+
- Public data: Cache-Control: public, max-age=300
|
|
1009
|
+
|
|
1010
|
+
### Database Optimization
|
|
1011
|
+
|
|
1012
|
+
**Query Optimization**
|
|
1013
|
+
- Use prepared statements to prevent SQL injection
|
|
1014
|
+
- Index foreign keys and frequently queried columns
|
|
1015
|
+
- Use connection pooling (min: 10, max: 50 connections)
|
|
1016
|
+
- Implement query timeouts (5 seconds)
|
|
1017
|
+
|
|
1018
|
+
**Database Scaling:**
|
|
1019
|
+
- Read replicas for heavy read workloads
|
|
1020
|
+
- Partitioning for large tables (by date/user_id)
|
|
1021
|
+
- Query result pagination (max 100 records per page)
|
|
1022
|
+
|
|
1023
|
+
### Rate Limiting
|
|
1024
|
+
|
|
1025
|
+
**Implementation:**
|
|
1026
|
+
- Token bucket algorithm
|
|
1027
|
+
- Per-user limits stored in Redis
|
|
1028
|
+
- Rate limit headers in response:
|
|
1029
|
+
- X-RateLimit-Limit: Maximum requests
|
|
1030
|
+
- X-RateLimit-Remaining: Remaining requests
|
|
1031
|
+
- X-RateLimit-Reset: Reset timestamp
|
|
1032
|
+
|
|
1033
|
+
**Limits by Endpoint:**
|
|
1034
|
+
- POST /api/v1/feature: 100/min
|
|
1035
|
+
- GET /api/v1/feature: 1000/min
|
|
1036
|
+
- PUT /api/v1/feature: 100/min
|
|
1037
|
+
- DELETE /api/v1/feature: 50/min
|
|
1038
|
+
|
|
1039
|
+
## PRD Coverage
|
|
1040
|
+
|
|
1041
|
+
This specification addresses all user stories from PRD-001:
|
|
1042
|
+
|
|
1043
|
+
| PRD User Story | SPEC Coverage |
|
|
1044
|
+
|----------------|---------------|${prdUserStories.map(story => `
|
|
1045
|
+
| ${story} | Components, API Endpoints, Database Schema |`).join('')}
|
|
1046
|
+
|
|
1047
|
+
**Coverage Summary:**
|
|
1048
|
+
- Total user stories: ${prdUserStories.length}
|
|
1049
|
+
- Covered: ${prdUserStories.length} (100%)
|
|
1050
|
+
- Uncovered: None
|
|
549
1051
|
|
|
550
1052
|
---
|
|
551
|
-
*Generated by WorkflowEngine
|
|
1053
|
+
*Generated by WorkflowEngine based on PRD-001*
|
|
552
1054
|
`;
|
|
553
1055
|
await writeArtifact(this.projectPath, this.workflowId, 'spec', specContent);
|
|
1056
|
+
// Validate the generated artifact against PRD
|
|
1057
|
+
const specPath = getArtifactPath(this.projectPath, this.workflowId, 'spec');
|
|
1058
|
+
console.log(`[WorkflowEngine] Validating SPEC artifact at: ${specPath}`);
|
|
1059
|
+
const validationResult = await validateSpec(specPath, prdPath);
|
|
1060
|
+
// Store validation result in checkpoint
|
|
1061
|
+
checkpoint.validation_results.spec = validationResult;
|
|
1062
|
+
if (!validationResult.passed) {
|
|
1063
|
+
console.log('[WorkflowEngine] SPEC validation failed:', validationResult.blocking_issues);
|
|
1064
|
+
console.log(`[WorkflowEngine] Coverage: ${validationResult.coverage_percentage}%`);
|
|
1065
|
+
}
|
|
1066
|
+
else {
|
|
1067
|
+
console.log('[WorkflowEngine] SPEC validation passed');
|
|
1068
|
+
console.log(`[WorkflowEngine] Coverage: ${validationResult.coverage_percentage}%`);
|
|
1069
|
+
}
|
|
554
1070
|
}
|
|
555
1071
|
/**
|
|
556
1072
|
* Execute the INTENTS stage
|
|
557
1073
|
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
1074
|
+
* Generates INTENT artifacts with implementation tasks from the SPEC.
|
|
1075
|
+
* Creates multiple INTENT-*.md files and a dependency-graph.json file
|
|
1076
|
+
* with task breakdown, dependencies, and effort estimates.
|
|
560
1077
|
*/
|
|
561
1078
|
async executeIntentsStage(checkpoint) {
|
|
562
|
-
console.log(
|
|
563
|
-
//
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
//
|
|
568
|
-
// await invokeAgent('intent-generator', agentPrompt, {
|
|
569
|
-
// workflowId: this.workflowId,
|
|
570
|
-
// inputArtifacts: { spec: specPath },
|
|
571
|
-
// outputPath: `.olympus/workflow/${this.workflowId}/intents/`
|
|
572
|
-
// });
|
|
573
|
-
// For intents stage, we create files in the intents directory
|
|
574
|
-
// Since writeArtifact doesn't support intents, we'll write directly
|
|
1079
|
+
console.log(`[WorkflowEngine] Executing INTENTS stage for feature: ${this.featureName}`);
|
|
1080
|
+
// Get the SPEC artifact path for context
|
|
1081
|
+
const specPath = getArtifactPath(this.projectPath, this.workflowId, 'spec');
|
|
1082
|
+
console.log(`[WorkflowEngine] Reading SPEC artifact from: ${specPath}`);
|
|
1083
|
+
console.log('[WorkflowEngine] Generating INTENT artifacts with implementation tasks');
|
|
1084
|
+
// Read SPEC to extract components for task generation
|
|
575
1085
|
const fs = await import('fs-extra');
|
|
576
1086
|
const path = await import('path');
|
|
1087
|
+
const specContent = await fs.readFile(specPath, 'utf-8');
|
|
1088
|
+
// Extract components from SPEC (look for sections under ## Components)
|
|
1089
|
+
const specComponents = [];
|
|
1090
|
+
const lines = specContent.split('\n');
|
|
1091
|
+
let inComponentsSection = false;
|
|
1092
|
+
for (const line of lines) {
|
|
1093
|
+
if (line.match(/^##\s+Components/i)) {
|
|
1094
|
+
inComponentsSection = true;
|
|
1095
|
+
continue;
|
|
1096
|
+
}
|
|
1097
|
+
if (inComponentsSection && line.match(/^##\s+/)) {
|
|
1098
|
+
inComponentsSection = false;
|
|
1099
|
+
}
|
|
1100
|
+
if (inComponentsSection && line.match(/^###\s+(.+)$/)) {
|
|
1101
|
+
const match = line.match(/^###\s+(.+)$/);
|
|
1102
|
+
if (match) {
|
|
1103
|
+
specComponents.push(match[1].trim());
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
577
1107
|
const intentsDir = path.join(this.projectPath, '.olympus', 'workflow', this.workflowId, 'intents');
|
|
578
1108
|
await fs.ensureDir(intentsDir);
|
|
579
|
-
|
|
580
|
-
|
|
1109
|
+
const timestamp = new Date().toISOString();
|
|
1110
|
+
// Generate INTENT files - one per major task group
|
|
1111
|
+
const intents = [
|
|
1112
|
+
{
|
|
1113
|
+
id: 'INTENT-001',
|
|
1114
|
+
title: 'Setup Database Schema',
|
|
1115
|
+
component: 'Database Components',
|
|
1116
|
+
goal: 'Create database tables, indexes, and migration scripts',
|
|
1117
|
+
acceptanceCriteria: [
|
|
1118
|
+
'Database tables created with proper schema',
|
|
1119
|
+
'Indexes created for performance optimization',
|
|
1120
|
+
'Migration scripts tested and validated',
|
|
1121
|
+
'Rollback scripts prepared',
|
|
1122
|
+
],
|
|
1123
|
+
steps: [
|
|
1124
|
+
'Create migration script for feature_data table',
|
|
1125
|
+
'Create migration script for feature_audit_log table',
|
|
1126
|
+
'Add indexes on foreign keys and frequently queried columns',
|
|
1127
|
+
'Test migration in development environment',
|
|
1128
|
+
'Create rollback migration script',
|
|
1129
|
+
'Document schema changes',
|
|
1130
|
+
],
|
|
1131
|
+
technicalNotes: 'Use migration framework (Flyway/Alembic/TypeORM migrations). Ensure backward compatibility.',
|
|
1132
|
+
dependencies: [],
|
|
1133
|
+
effort: 4,
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
id: 'INTENT-002',
|
|
1137
|
+
title: 'Implement Backend API Endpoints',
|
|
1138
|
+
component: 'Backend Services',
|
|
1139
|
+
goal: 'Create RESTful API endpoints for feature operations',
|
|
1140
|
+
acceptanceCriteria: [
|
|
1141
|
+
'All CRUD endpoints implemented',
|
|
1142
|
+
'Request validation middleware in place',
|
|
1143
|
+
'Error handling properly configured',
|
|
1144
|
+
'Unit tests passing with >80% coverage',
|
|
1145
|
+
],
|
|
1146
|
+
steps: [
|
|
1147
|
+
'Create API route definitions',
|
|
1148
|
+
'Implement POST /api/v1/feature endpoint',
|
|
1149
|
+
'Implement GET /api/v1/feature/:id endpoint',
|
|
1150
|
+
'Implement PUT /api/v1/feature/:id endpoint',
|
|
1151
|
+
'Implement DELETE /api/v1/feature/:id endpoint',
|
|
1152
|
+
'Add request validation middleware',
|
|
1153
|
+
'Add error handling middleware',
|
|
1154
|
+
'Write unit tests for all endpoints',
|
|
1155
|
+
],
|
|
1156
|
+
technicalNotes: 'Follow REST conventions. Use async/await for database operations. Implement proper error responses.',
|
|
1157
|
+
dependencies: ['INTENT-001'],
|
|
1158
|
+
effort: 8,
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
id: 'INTENT-003',
|
|
1162
|
+
title: 'Build Frontend Components',
|
|
1163
|
+
component: 'Frontend Components',
|
|
1164
|
+
goal: 'Create user interface components for feature interaction',
|
|
1165
|
+
acceptanceCriteria: [
|
|
1166
|
+
'Main feature UI component implemented',
|
|
1167
|
+
'Form validation working correctly',
|
|
1168
|
+
'Error states handled gracefully',
|
|
1169
|
+
'Responsive design across devices',
|
|
1170
|
+
'Accessibility standards met (WCAG 2.1 AA)',
|
|
1171
|
+
],
|
|
1172
|
+
steps: [
|
|
1173
|
+
'Create main feature component',
|
|
1174
|
+
'Implement form inputs with validation',
|
|
1175
|
+
'Add error boundary component',
|
|
1176
|
+
'Implement loading states',
|
|
1177
|
+
'Add success/error notifications',
|
|
1178
|
+
'Make responsive for mobile/tablet/desktop',
|
|
1179
|
+
'Test with screen readers',
|
|
1180
|
+
'Write component tests',
|
|
1181
|
+
],
|
|
1182
|
+
technicalNotes: 'Use component library patterns. Implement proper state management. Follow accessibility guidelines.',
|
|
1183
|
+
dependencies: ['INTENT-002'],
|
|
1184
|
+
effort: 8,
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
id: 'INTENT-004',
|
|
1188
|
+
title: 'Implement Authentication and Authorization',
|
|
1189
|
+
component: 'Backend Services',
|
|
1190
|
+
goal: 'Add authentication and authorization for feature endpoints',
|
|
1191
|
+
acceptanceCriteria: [
|
|
1192
|
+
'JWT authentication middleware implemented',
|
|
1193
|
+
'Role-based access control enforced',
|
|
1194
|
+
'Token refresh mechanism working',
|
|
1195
|
+
'Unauthorized access properly blocked',
|
|
1196
|
+
],
|
|
1197
|
+
steps: [
|
|
1198
|
+
'Implement JWT verification middleware',
|
|
1199
|
+
'Create role-based permission checks',
|
|
1200
|
+
'Add token refresh endpoint',
|
|
1201
|
+
'Implement token blacklist for logout',
|
|
1202
|
+
'Add authentication to all protected routes',
|
|
1203
|
+
'Write authentication tests',
|
|
1204
|
+
],
|
|
1205
|
+
technicalNotes: 'Use secure token storage. Implement token rotation. Follow OWASP authentication guidelines.',
|
|
1206
|
+
dependencies: ['INTENT-002'],
|
|
1207
|
+
effort: 4,
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
id: 'INTENT-005',
|
|
1211
|
+
title: 'Add Rate Limiting and Caching',
|
|
1212
|
+
component: 'Backend Services',
|
|
1213
|
+
goal: 'Implement rate limiting and caching for performance and security',
|
|
1214
|
+
acceptanceCriteria: [
|
|
1215
|
+
'Rate limiting active on all endpoints',
|
|
1216
|
+
'Rate limit headers in responses',
|
|
1217
|
+
'Application-level caching implemented',
|
|
1218
|
+
'Cache invalidation working correctly',
|
|
1219
|
+
],
|
|
1220
|
+
steps: [
|
|
1221
|
+
'Set up Redis for rate limiting and caching',
|
|
1222
|
+
'Implement rate limiting middleware',
|
|
1223
|
+
'Add rate limit headers to responses',
|
|
1224
|
+
'Implement application-level cache',
|
|
1225
|
+
'Add cache invalidation on mutations',
|
|
1226
|
+
'Configure CDN caching rules',
|
|
1227
|
+
'Write performance tests',
|
|
1228
|
+
],
|
|
1229
|
+
technicalNotes: 'Use Redis for distributed rate limiting. Implement cache warming strategy. Monitor cache hit rates.',
|
|
1230
|
+
dependencies: ['INTENT-002'],
|
|
1231
|
+
effort: 4,
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
id: 'INTENT-006',
|
|
1235
|
+
title: 'Setup Infrastructure and Deployment',
|
|
1236
|
+
component: 'Infrastructure Components',
|
|
1237
|
+
goal: 'Configure deployment pipeline and infrastructure',
|
|
1238
|
+
acceptanceCriteria: [
|
|
1239
|
+
'Docker container configured and building',
|
|
1240
|
+
'CI/CD pipeline running successfully',
|
|
1241
|
+
'Monitoring and alerting configured',
|
|
1242
|
+
'Staging environment deployed',
|
|
1243
|
+
],
|
|
1244
|
+
steps: [
|
|
1245
|
+
'Create Dockerfile for application',
|
|
1246
|
+
'Configure Docker Compose for local development',
|
|
1247
|
+
'Set up CI/CD pipeline (GitHub Actions/Jenkins)',
|
|
1248
|
+
'Configure staging environment',
|
|
1249
|
+
'Set up monitoring (Prometheus/Grafana)',
|
|
1250
|
+
'Configure alerting rules',
|
|
1251
|
+
'Document deployment process',
|
|
1252
|
+
],
|
|
1253
|
+
technicalNotes: 'Use multi-stage Docker builds. Implement health checks. Set up automated rollbacks.',
|
|
1254
|
+
dependencies: ['INTENT-002', 'INTENT-003'],
|
|
1255
|
+
effort: 8,
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
id: 'INTENT-007',
|
|
1259
|
+
title: 'Write Integration Tests and Documentation',
|
|
1260
|
+
component: 'Backend Services',
|
|
1261
|
+
goal: 'Create comprehensive tests and documentation',
|
|
1262
|
+
acceptanceCriteria: [
|
|
1263
|
+
'Integration tests covering all workflows',
|
|
1264
|
+
'API documentation complete',
|
|
1265
|
+
'Test coverage >80%',
|
|
1266
|
+
'Documentation reviewed and approved',
|
|
1267
|
+
],
|
|
1268
|
+
steps: [
|
|
1269
|
+
'Write end-to-end integration tests',
|
|
1270
|
+
'Test authentication flows',
|
|
1271
|
+
'Test error scenarios',
|
|
1272
|
+
'Generate API documentation (OpenAPI/Swagger)',
|
|
1273
|
+
'Write user-facing documentation',
|
|
1274
|
+
'Create troubleshooting guide',
|
|
1275
|
+
'Run full test suite',
|
|
1276
|
+
],
|
|
1277
|
+
technicalNotes: 'Use test fixtures for data setup. Mock external services. Document edge cases.',
|
|
1278
|
+
dependencies: ['INTENT-003', 'INTENT-004', 'INTENT-005'],
|
|
1279
|
+
effort: 4,
|
|
1280
|
+
},
|
|
1281
|
+
];
|
|
1282
|
+
// Write individual INTENT markdown files
|
|
1283
|
+
for (const intent of intents) {
|
|
1284
|
+
const intentContent = `---
|
|
1285
|
+
id: ${intent.id}
|
|
1286
|
+
feature: ${this.workflowId}
|
|
1287
|
+
created: ${timestamp}
|
|
1288
|
+
based_on: SPEC-001
|
|
1289
|
+
status: pending
|
|
1290
|
+
estimated_effort: ${intent.effort}
|
|
1291
|
+
dependencies: ${JSON.stringify(intent.dependencies)}
|
|
1292
|
+
---
|
|
1293
|
+
|
|
1294
|
+
# Task: ${intent.title}
|
|
1295
|
+
|
|
1296
|
+
## Goal
|
|
581
1297
|
|
|
582
|
-
|
|
583
|
-
This is a placeholder intent file. The real intent-generator agent will
|
|
584
|
-
create detailed implementation intents.
|
|
1298
|
+
${intent.goal}
|
|
585
1299
|
|
|
586
|
-
##
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
1300
|
+
## Component
|
|
1301
|
+
|
|
1302
|
+
${intent.component}
|
|
1303
|
+
|
|
1304
|
+
## Acceptance Criteria
|
|
1305
|
+
|
|
1306
|
+
${intent.acceptanceCriteria.map(c => `- [ ] ${c}`).join('\n')}
|
|
1307
|
+
|
|
1308
|
+
## Implementation Steps
|
|
1309
|
+
|
|
1310
|
+
${intent.steps.map((s, i) => `${i + 1}. ${s}`).join('\n')}
|
|
1311
|
+
|
|
1312
|
+
## Technical Notes
|
|
1313
|
+
|
|
1314
|
+
${intent.technicalNotes}
|
|
590
1315
|
|
|
591
1316
|
## Dependencies
|
|
592
|
-
|
|
1317
|
+
|
|
1318
|
+
${intent.dependencies.length > 0 ? intent.dependencies.join(', ') : 'None'}
|
|
1319
|
+
|
|
1320
|
+
## Estimated Effort
|
|
1321
|
+
|
|
1322
|
+
${intent.effort}h
|
|
593
1323
|
|
|
594
1324
|
---
|
|
595
|
-
*Generated by WorkflowEngine
|
|
1325
|
+
*Generated by WorkflowEngine based on SPEC-001*
|
|
596
1326
|
`;
|
|
597
|
-
|
|
1327
|
+
await fs.writeFile(path.join(intentsDir, `${intent.id}.md`), intentContent, 'utf-8');
|
|
1328
|
+
}
|
|
1329
|
+
// Generate dependency graph JSON
|
|
1330
|
+
// Format: Record<string, string[]> (adjacency list)
|
|
1331
|
+
const totalEffort = intents.reduce((sum, intent) => sum + intent.effort, 0);
|
|
1332
|
+
const dependencyGraph = {};
|
|
1333
|
+
for (const intent of intents) {
|
|
1334
|
+
dependencyGraph[intent.id] = intent.dependencies;
|
|
1335
|
+
}
|
|
1336
|
+
await fs.writeFile(path.join(intentsDir, 'dependency-graph.json'), JSON.stringify(dependencyGraph, null, 2), 'utf-8');
|
|
1337
|
+
console.log(`[WorkflowEngine] Generated ${intents.length} INTENT files`);
|
|
1338
|
+
console.log(`[WorkflowEngine] Total estimated effort: ${totalEffort}h`);
|
|
1339
|
+
// Validate the generated artifacts against SPEC
|
|
1340
|
+
console.log(`[WorkflowEngine] Validating INTENTS against SPEC at: ${specPath}`);
|
|
1341
|
+
const validationResult = await validateTasks(intentsDir, specPath);
|
|
1342
|
+
// Store validation result in checkpoint
|
|
1343
|
+
checkpoint.validation_results.intents = validationResult;
|
|
1344
|
+
if (!validationResult.passed) {
|
|
1345
|
+
console.log('[WorkflowEngine] INTENTS validation failed:', validationResult.blocking_issues);
|
|
1346
|
+
console.log(`[WorkflowEngine] Coverage: ${validationResult.coverage_percentage}%`);
|
|
1347
|
+
}
|
|
1348
|
+
else {
|
|
1349
|
+
console.log('[WorkflowEngine] INTENTS validation passed');
|
|
1350
|
+
console.log(`[WorkflowEngine] Coverage: ${validationResult.coverage_percentage}%`);
|
|
1351
|
+
}
|
|
598
1352
|
}
|
|
599
1353
|
}
|
|
600
1354
|
//# sourceMappingURL=engine.js.map
|