feat: implement API mock for parallel development#8
feat: implement API mock for parallel development#8cgoder wants to merge 1 commit intoechoVic:mainfrom
Conversation
|
Warning
|
| 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 | 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_access setting to enable early access features such as new models, tools, and more.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
DESIGN.md (1)
347-354:⚠️ Potential issue | 🟡 MinorMissing template in directory structure listing.
The version history (line 533) and PR summary indicate that
templates/api-contract.md.templatewas added, but it's not listed in this templates directory structure section. This creates an inconsistency in the documentation.📝 Proposed fix to add the missing template
├── templates/ # 输出模板 │ ├── prd.md.template │ ├── architecture.md.template +│ ├── api-contract.md.template │ ├── ui-spec.md.template │ ├── tech-review.md.template │ ├── tasks.md.template │ ├── qa-report.md.template │ └── deploy-report.md.template🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DESIGN.md` around lines 347 - 354, The templates directory listing in the DESIGN.md file is missing the newly added template; update the templates tree under the templates/ section to include "api-contract.md.template" by adding an entry for templates/api-contract.md.template so the documentation matches the version history and PR summary; ensure the added line follows the same format as the other entries (e.g., "├── api-contract.md.template" or "└── api-contract.md.template" as appropriate).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@SKILL.md`:
- Around line 68-75: Clarify and tighten the condition in Step 2.3 so API
contract generation (via agents/boss-architect.md using architecture.md) runs
whenever a backend API exists rather than simply negating --skip-ui; update the
prose and any decision logic that controls creation of api-contract.md to check
for presence of backend components or an explicit flag (e.g., has-backend or
--generate-api-contract) instead of only testing --skip-ui, and document that
api-contract.md is produced for projects with backend APIs (including headless
or CLI-backed services) even if --skip-ui is set.
- Line 75: SKILL.md references updating .boss/<feature>/.meta/execution.json at
several phase checkpoints but there is no implementation; add logic to write the
phase state to "completed" after each phase either by implementing update steps
in the relevant agent files (agents/boss-pm.md after Phase 1,
agents/boss-architect.md after Phase 2, agents/boss-qa.md after Phase 3,
agents/boss-devops.md after Phase 4) or by centralizing the behavior in a
workflow orchestrator called from the agents; the update should open or create
the .boss/<feature>/.meta/execution.json produced by scripts/init-project.sh and
set the correct phase key to "completed" (ensuring atomic write and error
logging) so SKILL.md steps 1.6/2.6/3.6/4.4 are implemented.
---
Outside diff comments:
In `@DESIGN.md`:
- Around line 347-354: The templates directory listing in the DESIGN.md file is
missing the newly added template; update the templates tree under the templates/
section to include "api-contract.md.template" by adding an entry for
templates/api-contract.md.template so the documentation matches the version
history and PR summary; ensure the added line follows the same format as the
other entries (e.g., "├── api-contract.md.template" or "└──
api-contract.md.template" as appropriate).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f362c97f-e4d3-4666-8ddd-e33914983319
📒 Files selected for processing (9)
DESIGN.mdREADME.mdSKILL.mdagents/boss-architect.mdagents/boss-backend.mdagents/boss-frontend.mdagents/boss-scrum-master.mdreferences/artifact-guide.mdtemplates/api-contract.md.template
| - [ ] **阶段 2: 评审 + 契约 + 任务拆解** | ||
| - [ ] 2.0 ⏩ 检查点:若 `--continue-from 3+` 且 `tech-review.md` / `tasks.md` 已存在,跳过本阶段 | ||
| - [ ] 2.1 读取阶段 1 产物 | ||
| - [ ] 2.2 Load `agents/boss-tech-lead.md` → 技术评审 | ||
| - [ ] 2.3 Load `agents/boss-scrum-master.md` → 任务拆解 + 测试用例定义 | ||
| - [ ] 2.4 💾 保存产物:`tech-review.md`, `tasks.md` | ||
| - [ ] 2.5 📝 更新 `.meta/execution.json`:阶段 2 状态改为 `completed` | ||
| - [ ] 2.3 Load `agents/boss-architect.md` → 基于 `architecture.md` 生成 API 契约(全栈项目,非 `--skip-ui` 时) | ||
| - [ ] 2.4 Load `agents/boss-scrum-master.md` → 任务拆解 + 测试用例定义 | ||
| - [ ] 2.5 💾 保存产物:`tech-review.md`, `api-contract.md`(如有), `tasks.md` | ||
| - [ ] 2.6 📝 更新 `.meta/execution.json`:阶段 2 状态改为 `completed` |
There was a problem hiding this comment.
Clarify the --skip-ui condition for API contract generation.
Step 2.3 generates the API contract for "全栈项目,非 --skip-ui 时" (full-stack projects when NOT --skip-ui). However, the condition logic may be unclear:
- If
--skip-uimeans "no frontend UI," there could still be a backend API that needs contract definition (e.g., headless API services, CLI with backend). - The current condition would skip contract generation for API-only projects with
--skip-ui, potentially missing cases where backend contracts are valuable.
Suggestion: Consider whether the condition should be:
- "全栈项目" (any full-stack project), OR
- More precisely defined based on whether the project has separate frontend and backend components, regardless of UI presence
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@SKILL.md` around lines 68 - 75, Clarify and tighten the condition in Step 2.3
so API contract generation (via agents/boss-architect.md using architecture.md)
runs whenever a backend API exists rather than simply negating --skip-ui; update
the prose and any decision logic that controls creation of api-contract.md to
check for presence of backend components or an explicit flag (e.g., has-backend
or --generate-api-contract) instead of only testing --skip-ui, and document that
api-contract.md is produced for projects with backend APIs (including headless
or CLI-backed services) even if --skip-ui is set.
| - [ ] 2.3 Load `agents/boss-architect.md` → 基于 `architecture.md` 生成 API 契约(全栈项目,非 `--skip-ui` 时) | ||
| - [ ] 2.4 Load `agents/boss-scrum-master.md` → 任务拆解 + 测试用例定义 | ||
| - [ ] 2.5 💾 保存产物:`tech-review.md`, `api-contract.md`(如有), `tasks.md` | ||
| - [ ] 2.6 📝 更新 `.meta/execution.json`:阶段 2 状态改为 `completed` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for code that writes to execution.json during workflow
rg -n -C3 'execution\.json' --type=md
rg -n -C3 'Write.*execution' --type=mdRepository: echoVic/boss-skill
Length of output: 1839
🏁 Script executed:
#!/bin/bash
# Search all files (not just markdown) for execution.json updates
rg -n 'execution\.json' -A 3 -B 3
# Also search for patterns that suggest writing/updating this file
rg -n 'write.*execution|update.*execution|execution.*update|execution.*write' -i
# List all agent files to see what's available
find . -name "*.md" -path "*/agents/*" -o -name "*agent*.md"Repository: echoVic/boss-skill
Length of output: 2724
🏁 Script executed:
#!/bin/bash
# Search within agent files for execution.json references
for agent in agents/*.md; do
echo "=== Checking $agent ==="
rg -n 'execution' "$agent" || echo "No matches in $agent"
done
# Also check for any file I/O or update patterns in agents
rg -n 'write|update|save' agents/ -i | grep -i 'json\|file' || trueRepository: echoVic/boss-skill
Length of output: 760
Implement execution.json update mechanism across workflow phases.
Steps 1.6, 2.6, 3.6, and 4.4 in SKILL.md reference updating .boss/<feature>/.meta/execution.json to mark phases as completed. While the file structure is initialized in scripts/init-project.sh (lines 218-221), no update logic exists in any agent file (agents/boss-*.md) or workflow script. These update steps are currently listed as TODO items with no implementation path.
Add execution.json update instructions to the relevant agents (boss-pm.md after Phase 1, boss-architect.md after Phase 2, boss-qa.md after Phase 3, boss-devops.md after Phase 4) or centralize in a workflow orchestrator.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@SKILL.md` at line 75, SKILL.md references updating
.boss/<feature>/.meta/execution.json at several phase checkpoints but there is
no implementation; add logic to write the phase state to "completed" after each
phase either by implementing update steps in the relevant agent files
(agents/boss-pm.md after Phase 1, agents/boss-architect.md after Phase 2,
agents/boss-qa.md after Phase 3, agents/boss-devops.md after Phase 4) or by
centralizing the behavior in a workflow orchestrator called from the agents; the
update should open or create the .boss/<feature>/.meta/execution.json produced
by scripts/init-project.sh and set the correct phase key to "completed"
(ensuring atomic write and error logging) so SKILL.md steps 1.6/2.6/3.6/4.4 are
implemented.
增加前后端联调的 API mock 场景。
Summary by CodeRabbit