Skip to content

feat: implement API mock for parallel development#8

Open
cgoder wants to merge 1 commit intoechoVic:mainfrom
cgoder:feat/mock
Open

feat: implement API mock for parallel development#8
cgoder wants to merge 1 commit intoechoVic:mainfrom
cgoder:feat/mock

Conversation

@cgoder
Copy link

@cgoder cgoder commented Mar 17, 2026

增加前后端联调的 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.

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Warning

.coderabbit.yaml has a parsing error

The 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
Loading

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.

❤️ Share

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟡 Minor

Missing template in directory structure listing.

The version history (line 533) and PR summary indicate that templates/api-contract.md.template was 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

📥 Commits

Reviewing files that changed from the base of the PR and between 35faee0 and 36521d5.

📒 Files selected for processing (9)
  • DESIGN.md
  • README.md
  • SKILL.md
  • agents/boss-architect.md
  • agents/boss-backend.md
  • agents/boss-frontend.md
  • agents/boss-scrum-master.md
  • references/artifact-guide.md
  • templates/api-contract.md.template

Comment on lines +68 to +75
- [ ] **阶段 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`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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-ui means "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`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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=md

Repository: 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' || true

Repository: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants