feat: implement API mock for parallel development
增加前后端联调的 API mock 场景。
Summary by CodeRabbit
- Documentation
- Updated workflow to include API contract generation phase between architecture review and task decomposition.
- Added new API contract artifact template and guidelines for streamlined team coordination.
- Enhanced role-specific implementation requirements with contract-first approach for frontend, backend, and QA.
- Added endpoint mapping to task definitions for improved traceability and alignment.
[!WARNING]
.coderabbit.yamlhas a parsing errorThe CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.
💥 Parsing errors (1)
Validation error: Expected array, received object at "reviews.path_filters"⚙️ Configuration instructions
- Please see the configuration documentation for more information.
- You can also validate your configuration using the online YAML validator.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough
Walkthrough
The changes introduce an API Contract-First mechanism to the development workflow. Phase 2 now explicitly includes Architect-generated API contracts as a central artifact before task decomposition. Frontend and Backend agents consume contracts as source-of-truth, tasks are mapped to API endpoints, and a comprehensive template defines contract structure with metadata, schemas, mock data, and error codes.
Changes
| Cohort / File(s) | Summary |
|---|---|
Workflow & Phase Documentation DESIGN.md, SKILL.md, references/artifact-guide.md |
Updated Phase 2 workflow to include API contract generation as explicit step by Architect Agent before task decomposition. Added artifact references for api-contract.md across phase definitions and updated version history with v2.1 entries. |
Agent Implementation Guidelines agents/boss-architect.md, agents/boss-backend.md, agents/boss-frontend.md, agents/boss-scrum-master.md |
Added contract-first requirements: Architect generates api-contract.md with TypeScript interfaces and mock data; Backend and Frontend must read contracts before implementing; Scrum Master tasks now include "关联 API 端点" field mapping endpoints to tasks. |
Template & Index templates/api-contract.md.template, README.md |
New comprehensive API contract template defining structure (metadata, schemas, endpoints, mock data, error codes, changelog); updated README to reference new template and artifact in product documentation. |
Sequence Diagram
sequenceDiagram
participant Architect as Architect Agent
participant Contract as api-contract.md
participant Frontend as Frontend Developer
participant Backend as Backend Developer
participant Master as Scrum Master
participant QA as QA/Testing
Architect->>Contract: Generate contract<br/>(TypeScript, mocks, errors)
Contract-->>Master: Contract ready
Master->>Master: Map tasks to<br/>API endpoints
par Frontend & Backend Implementation
Frontend->>Contract: Read contract
Frontend->>Frontend: Generate src/types/api.ts<br/>Configure mock service
Backend->>Contract: Read contract
Backend->>Backend: Implement endpoints<br/>Match schema & errors
end
QA->>Contract: Validate against contract
QA->>QA: Verify mock data<br/>Error scenarios
QA-->>Frontend: Contract compliance OK
QA-->>Backend: Contract compliance OK
Estimated Code Review Effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
🐰 A rabbit hops through workflow new, Contracts first, then all work through, Architect draws the blueprint clear, Frontend and Backend need not fear— One source of truth, no more to guess, API contracts: progress! 🎉✨
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Title check | ⚠️ Warning | The PR title focuses on 'API mock for parallel development,' but the actual changes implement a comprehensive API Contract-First mechanism with workflow updates, role definitions, and artifact templates across multiple files. | Consider updating the title to 'feat: introduce API Contract-First mechanism for parallel development' to accurately reflect the broader scope and primary changes in the changeset. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
📝 Coding Plan
- [ ] Generate coding plan for human review comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
[!TIP]
You can get early access to new features in CodeRabbit.
Enable the
early_accesssetting to enable early access features such as new models, tools, and more.