Files
website-ricenoodletw-cms/.spec-workflow/templates/tasks-template.md
pkupuk 7e4270a36e feat(ci): add CI/CD workflow and spec workflow setup
- Add Gitea workflow for build and deploy
- Add spec workflow configuration and templates
- Update package lock file for dependencies
2025-12-02 17:49:08 +08:00

14 KiB

Tasks Document

  • 1. Create core interfaces in src/types/feature.ts

    • File: src/types/feature.ts
    • Define TypeScript interfaces for feature data structures
    • Extend existing base interfaces from base.ts
    • Purpose: Establish type safety for feature implementation
    • Leverage: src/types/base.ts
    • Requirements: 1.1
    • Prompt: Role: TypeScript Developer specializing in type systems and interfaces | Task: Create comprehensive TypeScript interfaces for the feature data structures following requirements 1.1, extending existing base interfaces from src/types/base.ts | Restrictions: Do not modify existing base interfaces, maintain backward compatibility, follow project naming conventions | Success: All interfaces compile without errors, proper inheritance from base types, full type coverage for feature requirements
  • 2. Create base model class in src/models/FeatureModel.ts

    • File: src/models/FeatureModel.ts
    • Implement base model extending BaseModel class
    • Add validation methods using existing validation utilities
    • Purpose: Provide data layer foundation for feature
    • Leverage: src/models/BaseModel.ts, src/utils/validation.ts
    • Requirements: 2.1
    • Prompt: Role: Backend Developer with expertise in Node.js and data modeling | Task: Create a base model class extending BaseModel and implementing validation following requirement 2.1, leveraging existing patterns from src/models/BaseModel.ts and src/utils/validation.ts | Restrictions: Must follow existing model patterns, do not bypass validation utilities, maintain consistent error handling | Success: Model extends BaseModel correctly, validation methods implemented and tested, follows project architecture patterns
  • 3. Add specific model methods to FeatureModel.ts

    • File: src/models/FeatureModel.ts (continue from task 2)
    • Implement create, update, delete methods
    • Add relationship handling for foreign keys
    • Purpose: Complete model functionality for CRUD operations
    • Leverage: src/models/BaseModel.ts
    • Requirements: 2.2, 2.3
    • Prompt: Role: Backend Developer with expertise in ORM and database operations | Task: Implement CRUD methods and relationship handling in FeatureModel.ts following requirements 2.2 and 2.3, extending patterns from src/models/BaseModel.ts | Restrictions: Must maintain transaction integrity, follow existing relationship patterns, do not duplicate base model functionality | Success: All CRUD operations work correctly, relationships are properly handled, database operations are atomic and efficient
  • 4. Create model unit tests in tests/models/FeatureModel.test.ts

    • File: tests/models/FeatureModel.test.ts
    • Write tests for model validation and CRUD methods
    • Use existing test utilities and fixtures
    • Purpose: Ensure model reliability and catch regressions
    • Leverage: tests/helpers/testUtils.ts, tests/fixtures/data.ts
    • Requirements: 2.1, 2.2
    • Prompt: Role: QA Engineer with expertise in unit testing and Jest/Mocha frameworks | Task: Create comprehensive unit tests for FeatureModel validation and CRUD methods covering requirements 2.1 and 2.2, using existing test utilities from tests/helpers/testUtils.ts and fixtures from tests/fixtures/data.ts | Restrictions: Must test both success and failure scenarios, do not test external dependencies directly, maintain test isolation | Success: All model methods are tested with good coverage, edge cases covered, tests run independently and consistently
  • 5. Create service interface in src/services/IFeatureService.ts

    • File: src/services/IFeatureService.ts
    • Define service contract with method signatures
    • Extend base service interface patterns
    • Purpose: Establish service layer contract for dependency injection
    • Leverage: src/services/IBaseService.ts
    • Requirements: 3.1
    • Prompt: Role: Software Architect specializing in service-oriented architecture and TypeScript interfaces | Task: Design service interface contract following requirement 3.1, extending base service patterns from src/services/IBaseService.ts for dependency injection | Restrictions: Must maintain interface segregation principle, do not expose internal implementation details, ensure contract compatibility with DI container | Success: Interface is well-defined with clear method signatures, extends base service appropriately, supports all required service operations
  • 6. Implement feature service in src/services/FeatureService.ts

    • File: src/services/FeatureService.ts
    • Create concrete service implementation using FeatureModel
    • Add error handling with existing error utilities
    • Purpose: Provide business logic layer for feature operations
    • Leverage: src/services/BaseService.ts, src/utils/errorHandler.ts, src/models/FeatureModel.ts
    • Requirements: 3.2
    • Prompt: Role: Backend Developer with expertise in service layer architecture and business logic | Task: Implement concrete FeatureService following requirement 3.2, using FeatureModel and extending BaseService patterns with proper error handling from src/utils/errorHandler.ts | Restrictions: Must implement interface contract exactly, do not bypass model validation, maintain separation of concerns from data layer | Success: Service implements all interface methods correctly, robust error handling implemented, business logic is well-encapsulated and testable
  • 7. Add service dependency injection in src/utils/di.ts

    • File: src/utils/di.ts (modify existing)
    • Register FeatureService in dependency injection container
    • Configure service lifetime and dependencies
    • Purpose: Enable service injection throughout application
    • Leverage: existing DI configuration in src/utils/di.ts
    • Requirements: 3.1
    • Prompt: Role: DevOps Engineer with expertise in dependency injection and IoC containers | Task: Register FeatureService in DI container following requirement 3.1, configuring appropriate lifetime and dependencies using existing patterns from src/utils/di.ts | Restrictions: Must follow existing DI container patterns, do not create circular dependencies, maintain service resolution efficiency | Success: FeatureService is properly registered and resolvable, dependencies are correctly configured, service lifetime is appropriate for use case
  • 8. Create service unit tests in tests/services/FeatureService.test.ts

    • File: tests/services/FeatureService.test.ts
    • Write tests for service methods with mocked dependencies
    • Test error handling scenarios
    • Purpose: Ensure service reliability and proper error handling
    • Leverage: tests/helpers/testUtils.ts, tests/mocks/modelMocks.ts
    • Requirements: 3.2, 3.3
    • Prompt: Role: QA Engineer with expertise in service testing and mocking frameworks | Task: Create comprehensive unit tests for FeatureService methods covering requirements 3.2 and 3.3, using mocked dependencies from tests/mocks/modelMocks.ts and test utilities | Restrictions: Must mock all external dependencies, test business logic in isolation, do not test framework code | Success: All service methods tested with proper mocking, error scenarios covered, tests verify business logic correctness and error handling
  • 4. Create API endpoints

    • Design API structure
    • Leverage: src/api/baseApi.ts, src/utils/apiUtils.ts
    • Requirements: 4.0
    • Prompt: Role: API Architect specializing in RESTful design and Express.js | Task: Design comprehensive API structure following requirement 4.0, leveraging existing patterns from src/api/baseApi.ts and utilities from src/utils/apiUtils.ts | Restrictions: Must follow REST conventions, maintain API versioning compatibility, do not expose internal data structures directly | Success: API structure is well-designed and documented, follows existing patterns, supports all required operations with proper HTTP methods and status codes
  • 4.1 Set up routing and middleware

    • Configure application routes
    • Add authentication middleware
    • Set up error handling middleware
    • Leverage: src/middleware/auth.ts, src/middleware/errorHandler.ts
    • Requirements: 4.1
    • Prompt: Role: Backend Developer with expertise in Express.js middleware and routing | Task: Configure application routes and middleware following requirement 4.1, integrating authentication from src/middleware/auth.ts and error handling from src/middleware/errorHandler.ts | Restrictions: Must maintain middleware order, do not bypass security middleware, ensure proper error propagation | Success: Routes are properly configured with correct middleware chain, authentication works correctly, errors are handled gracefully throughout the request lifecycle
  • 4.2 Implement CRUD endpoints

    • Create API endpoints
    • Add request validation
    • Write API integration tests
    • Leverage: src/controllers/BaseController.ts, src/utils/validation.ts
    • Requirements: 4.2, 4.3
    • Prompt: Role: Full-stack Developer with expertise in API development and validation | Task: Implement CRUD endpoints following requirements 4.2 and 4.3, extending BaseController patterns and using validation utilities from src/utils/validation.ts | Restrictions: Must validate all inputs, follow existing controller patterns, ensure proper HTTP status codes and responses | Success: All CRUD operations work correctly, request validation prevents invalid data, integration tests pass and cover all endpoints
  • 5. Add frontend components

    • Plan component architecture
    • Leverage: src/components/BaseComponent.tsx, src/styles/theme.ts
    • Requirements: 5.0
    • Prompt: Role: Frontend Architect with expertise in React component design and architecture | Task: Plan comprehensive component architecture following requirement 5.0, leveraging base patterns from src/components/BaseComponent.tsx and theme system from src/styles/theme.ts | Restrictions: Must follow existing component patterns, maintain design system consistency, ensure component reusability | Success: Architecture is well-planned and documented, components are properly organized, follows existing patterns and theme system
  • 5.1 Create base UI components

    • Set up component structure
    • Implement reusable components
    • Add styling and theming
    • Leverage: src/components/BaseComponent.tsx, src/styles/theme.ts
    • Requirements: 5.1
    • Prompt: Role: Frontend Developer specializing in React and component architecture | Task: Create reusable UI components following requirement 5.1, extending BaseComponent patterns and using existing theme system from src/styles/theme.ts | Restrictions: Must use existing theme variables, follow component composition patterns, ensure accessibility compliance | Success: Components are reusable and properly themed, follow existing architecture, accessible and responsive
  • 5.2 Implement feature-specific components

    • Create feature components
    • Add state management
    • Connect to API endpoints
    • Leverage: src/hooks/useApi.ts, src/components/BaseComponent.tsx
    • Requirements: 5.2, 5.3
    • Prompt: Role: React Developer with expertise in state management and API integration | Task: Implement feature-specific components following requirements 5.2 and 5.3, using API hooks from src/hooks/useApi.ts and extending BaseComponent patterns | Restrictions: Must use existing state management patterns, handle loading and error states properly, maintain component performance | Success: Components are fully functional with proper state management, API integration works smoothly, user experience is responsive and intuitive
  • 6. Integration and testing

    • Plan integration approach
    • Leverage: src/utils/integrationUtils.ts, tests/helpers/testUtils.ts
    • Requirements: 6.0
    • Prompt: Role: Integration Engineer with expertise in system integration and testing strategies | Task: Plan comprehensive integration approach following requirement 6.0, leveraging integration utilities from src/utils/integrationUtils.ts and test helpers | Restrictions: Must consider all system components, ensure proper test coverage, maintain integration test reliability | Success: Integration plan is comprehensive and feasible, all system components work together correctly, integration points are well-tested
  • 6.1 Write end-to-end tests

    • Set up E2E testing framework
    • Write user journey tests
    • Add test automation
    • Leverage: tests/helpers/testUtils.ts, tests/fixtures/data.ts
    • Requirements: All
    • Prompt: Role: QA Automation Engineer with expertise in E2E testing and test frameworks like Cypress or Playwright | Task: Implement comprehensive end-to-end tests covering all requirements, setting up testing framework and user journey tests using test utilities and fixtures | Restrictions: Must test real user workflows, ensure tests are maintainable and reliable, do not test implementation details | Success: E2E tests cover all critical user journeys, tests run reliably in CI/CD pipeline, user experience is validated from end-to-end
  • 6.2 Final integration and cleanup

    • Integrate all components
    • Fix any integration issues
    • Clean up code and documentation
    • Leverage: src/utils/cleanup.ts, docs/templates/
    • Requirements: All
    • Prompt: Role: Senior Developer with expertise in code quality and system integration | Task: Complete final integration of all components and perform comprehensive cleanup covering all requirements, using cleanup utilities and documentation templates | Restrictions: Must not break existing functionality, ensure code quality standards are met, maintain documentation consistency | Success: All components are fully integrated and working together, code is clean and well-documented, system meets all requirements and quality standards