# Task Template: 新增 API + Mock（轻量版）

task:
  id: add-api-and-mock
  intent: "新增一个 API 调用函数，并同步补一个 Mock 路由（用于开发联调）"

inputs:
  required:
    - domain
    - function_name
    - method   # get/post/...
    - path     # 例如 /router/getList

outputs:
  files_to_change:
    - "src/api/<domain>.ts"
    - "mock/controller/<domain>.js"

rules:
  - "API path 与 Mock path 必须一致"
  - "Mock 路由对象必须包含 url/type/response"

acceptance:
  - "开发环境请求能命中 mock"
  - "API 函数能被页面调用且类型不报错（若涉及类型需补 types/）"
