@specpow/framework 0.5.11 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builtin/schemas/bug-fix/schema.yaml +77 -0
- package/builtin/schemas/bug-fix/templates/analysis.md +43 -0
- package/builtin/schemas/bug-fix/templates/fix-plan.md +19 -0
- package/builtin/schemas/bug-fix/templates/proposal.md +30 -0
- package/builtin/schemas/bug-fix/templates/regression-test.md +70 -0
- package/builtin/schemas/crud-module/schema.yaml +90 -0
- package/builtin/schemas/crud-module/templates/api-docs.md +146 -0
- package/builtin/schemas/crud-module/templates/design.md +36 -0
- package/builtin/schemas/crud-module/templates/menu-register.md +72 -0
- package/builtin/schemas/crud-module/templates/proposal.md +30 -0
- package/builtin/schemas/crud-module/templates/spec.md +33 -0
- package/builtin/schemas/crud-module/templates/tasks.md +57 -0
- package/builtin/schemas/spec-driven/schema.yaml +87 -0
- package/builtin/schemas/spec-driven/templates/design.md +54 -0
- package/builtin/schemas/spec-driven/templates/proposal.md +31 -0
- package/builtin/schemas/spec-driven/templates/spec.md +42 -0
- package/builtin/schemas/spec-driven/templates/tasks.md +98 -0
- package/builtin/skills/business-code-review/SKILL.md +78 -0
- package/builtin/skills/business-db-design/SKILL.md +74 -0
- package/builtin/skills/business-deploy-check/SKILL.md +72 -0
- package/builtin/skills/business-doc-sync/SKILL.md +72 -0
- package/builtin/skills/business-java-codegen/SKILL.md +97 -0
- package/builtin/skills/business-menu-register/SKILL.md +63 -0
- package/builtin/skills/business-prd-writer/SKILL.md +80 -0
- package/builtin/skills/business-test-gen/SKILL.md +82 -0
- package/builtin/skills/business-ui-codegen/SKILL.md +104 -0
- package/builtin/skills/cli-router/SKILL.md +107 -0
- package/builtin/skills/execution-finish-branch/SKILL.md +58 -0
- package/builtin/skills/execution-git-worktrees/SKILL.md +48 -0
- package/builtin/skills/execution-parallel-agents/SKILL.md +46 -0
- package/builtin/skills/execution-receiving-review/SKILL.md +47 -0
- package/builtin/skills/execution-requesting-review/SKILL.md +51 -0
- package/builtin/skills/execution-sdd-orchestrator/SKILL.md +366 -0
- package/builtin/skills/execution-subagent-dispatch/SKILL.md +295 -0
- package/builtin/skills/execution-subagent-driven-dev/SKILL.md +143 -0
- package/builtin/skills/execution-systematic-debugging/SKILL.md +95 -0
- package/builtin/skills/execution-tdd/SKILL.md +74 -0
- package/builtin/skills/execution-verification-before-completion/SKILL.md +75 -0
- package/builtin/skills/meta-create-skill/SKILL.md +374 -0
- package/builtin/skills/meta-using-skills/SKILL.md +97 -0
- package/builtin/skills/meta-writing-skills/SKILL.md +66 -0
- package/builtin/skills/planning-apply-change/SKILL.md +194 -0
- package/builtin/skills/planning-archive-change/SKILL.md +53 -0
- package/builtin/skills/planning-explore/SKILL.md +99 -0
- package/builtin/skills/planning-onboard/SKILL.md +60 -0
- package/builtin/skills/planning-propose/SKILL.md +156 -0
- package/builtin/skills/planning-update-change/SKILL.md +45 -0
- package/builtin/skills/planning-verify-change/SKILL.md +72 -0
- package/builtin/skills/planning-write-design/SKILL.md +59 -0
- package/builtin/skills/planning-write-plans/SKILL.md +55 -0
- package/builtin/skills/planning-write-specs/SKILL.md +73 -0
- package/builtin/skills/using-specpow/SKILL.md +232 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +49 -2
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +85 -14
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/propose.d.ts +1 -0
- package/dist/commands/propose.d.ts.map +1 -1
- package/dist/commands/propose.js +73 -2
- package/dist/commands/propose.js.map +1 -1
- package/dist/core/config/config-schema.d.ts +24 -0
- package/dist/core/config/config-schema.d.ts.map +1 -1
- package/dist/core/config/config-schema.js +2 -0
- package/dist/core/config/config-schema.js.map +1 -1
- package/dist/core/migration/index.js +1 -1
- package/dist/core/migration/index.js.map +1 -1
- package/dist/core/sdd-engine/ai-caller.d.ts.map +1 -1
- package/dist/core/sdd-engine/ai-caller.js +60 -35
- package/dist/core/sdd-engine/ai-caller.js.map +1 -1
- package/dist/core/sdd-engine/controller.js +1 -1
- package/dist/core/sdd-engine/controller.js.map +1 -1
- package/dist/core/sdd-engine/parallel-dispatcher.js +1 -1
- package/dist/core/sdd-engine/parallel-dispatcher.js.map +1 -1
- package/dist/core/sdd-engine/types.d.ts +1 -0
- package/dist/core/sdd-engine/types.d.ts.map +1 -1
- package/package.json +4 -5
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Bug 修复 Schema
|
|
2
|
+
# 用于快速定位和修复 Bug 的工件流
|
|
3
|
+
|
|
4
|
+
name: bug-fix
|
|
5
|
+
description: 系统化定位和修复 Bug
|
|
6
|
+
|
|
7
|
+
apply:
|
|
8
|
+
requires:
|
|
9
|
+
- tasks
|
|
10
|
+
|
|
11
|
+
artifacts:
|
|
12
|
+
- id: proposal
|
|
13
|
+
name: Bug 描述
|
|
14
|
+
description: 描述 Bug 现象和复现步骤
|
|
15
|
+
requires: []
|
|
16
|
+
template: proposal.md
|
|
17
|
+
instruction: |
|
|
18
|
+
记录 Bug 信息:
|
|
19
|
+
- Bug 标题
|
|
20
|
+
- 复现步骤(Step 1, 2, 3...)
|
|
21
|
+
- 预期行为
|
|
22
|
+
- 实际行为
|
|
23
|
+
- 环境信息
|
|
24
|
+
- 影响范围
|
|
25
|
+
output: proposal.md
|
|
26
|
+
|
|
27
|
+
- id: analysis
|
|
28
|
+
name: 根因分析
|
|
29
|
+
description: 分析 Bug 根因
|
|
30
|
+
requires: [proposal]
|
|
31
|
+
template: analysis.md
|
|
32
|
+
instruction: |
|
|
33
|
+
根因分析(4 阶段):
|
|
34
|
+
1. 调查 — 收集日志、堆栈、复现
|
|
35
|
+
2. 模式分析 — 识别错误模式
|
|
36
|
+
3. 假设 — 提出根因假设
|
|
37
|
+
4. 验证 — 验证假设正确性
|
|
38
|
+
output: analysis.md
|
|
39
|
+
|
|
40
|
+
- id: fix-plan
|
|
41
|
+
name: 修复计划
|
|
42
|
+
description: 制定修复方案
|
|
43
|
+
requires: [analysis]
|
|
44
|
+
template: fix-plan.md
|
|
45
|
+
instruction: |
|
|
46
|
+
修复方案:
|
|
47
|
+
- 修复策略(热修复/正常修复/重构修复)
|
|
48
|
+
- 修改文件列表
|
|
49
|
+
- 回归测试计划
|
|
50
|
+
output: fix-plan.md
|
|
51
|
+
|
|
52
|
+
- id: tasks
|
|
53
|
+
name: 修复任务
|
|
54
|
+
description: 修复步骤拆分
|
|
55
|
+
requires: [fix-plan]
|
|
56
|
+
template: tasks.md
|
|
57
|
+
instruction: |
|
|
58
|
+
修复任务拆分:
|
|
59
|
+
1. 编写失败测试(复现 Bug)
|
|
60
|
+
2. 修复代码
|
|
61
|
+
3. 验证测试通过
|
|
62
|
+
4. 回归测试
|
|
63
|
+
5. 更新文档
|
|
64
|
+
output: tasks.md
|
|
65
|
+
|
|
66
|
+
- id: regression-test
|
|
67
|
+
name: 回归测试
|
|
68
|
+
description: 定义修复后的回归验证用例
|
|
69
|
+
requires: [tasks]
|
|
70
|
+
template: regression-test.md
|
|
71
|
+
instruction: |
|
|
72
|
+
定义回归测试用例:
|
|
73
|
+
1. 复现测试 — 验证 Bug 已被修复
|
|
74
|
+
2. 边界测试 — 验证相关边界条件
|
|
75
|
+
3. 影响范围测试 — 验证修改未引入新问题
|
|
76
|
+
4. 性能回归 — 确认无性能退化
|
|
77
|
+
output: regression-test.md
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 根因分析
|
|
2
|
+
|
|
3
|
+
## 1. 调查
|
|
4
|
+
|
|
5
|
+
### 错误日志
|
|
6
|
+
```
|
|
7
|
+
(关键错误日志)
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### 堆栈跟踪
|
|
11
|
+
```
|
|
12
|
+
(关键堆栈)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 复现结果
|
|
16
|
+
- 是否可稳定复现: 是/否
|
|
17
|
+
- 复现频率:
|
|
18
|
+
|
|
19
|
+
## 2. 模式分析
|
|
20
|
+
|
|
21
|
+
### 错误模式
|
|
22
|
+
- 错误类型:
|
|
23
|
+
- 涉及模块:
|
|
24
|
+
- 最近变更:
|
|
25
|
+
|
|
26
|
+
## 3. 假设
|
|
27
|
+
|
|
28
|
+
### 假设 1: [描述]
|
|
29
|
+
- 证据:
|
|
30
|
+
- 验证方法:
|
|
31
|
+
|
|
32
|
+
### 假设 2: [描述]
|
|
33
|
+
- 证据:
|
|
34
|
+
- 验证方法:
|
|
35
|
+
|
|
36
|
+
## 4. 结论
|
|
37
|
+
|
|
38
|
+
### 根因
|
|
39
|
+
[确认的根因描述]
|
|
40
|
+
|
|
41
|
+
### 影响分析
|
|
42
|
+
- 直接影响:
|
|
43
|
+
- 间接影响:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Bug 描述
|
|
2
|
+
|
|
3
|
+
## Bug 标题
|
|
4
|
+
{{bugTitle}}
|
|
5
|
+
|
|
6
|
+
## 复现步骤
|
|
7
|
+
1.
|
|
8
|
+
2.
|
|
9
|
+
3.
|
|
10
|
+
|
|
11
|
+
## 预期行为
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 实际行为
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 环境信息
|
|
18
|
+
- 环境:
|
|
19
|
+
- 版本:
|
|
20
|
+
- 浏览器/客户端:
|
|
21
|
+
|
|
22
|
+
## 影响范围
|
|
23
|
+
- 影响用户:
|
|
24
|
+
- 影响功能:
|
|
25
|
+
- 严重程度: Critical / Major / Minor
|
|
26
|
+
|
|
27
|
+
## 相关日志
|
|
28
|
+
```
|
|
29
|
+
(粘贴错误日志)
|
|
30
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# 回归测试: {{bugTitle}}
|
|
2
|
+
|
|
3
|
+
## Bug 信息
|
|
4
|
+
|
|
5
|
+
- **Bug 标题**: {{bugTitle}}
|
|
6
|
+
- **修复分支**: feature/{{branch}}
|
|
7
|
+
- **修复日期**: {{timestamp}}
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. 复现验证
|
|
12
|
+
|
|
13
|
+
验证 Bug 已被修复。
|
|
14
|
+
|
|
15
|
+
| 步骤 | 操作 | 修复前结果 | 修复后预期 | 实际结果 | 通过 |
|
|
16
|
+
|------|------|-----------|-----------|---------|------|
|
|
17
|
+
| 1 | | | | | ☐ |
|
|
18
|
+
| 2 | | | | | ☐ |
|
|
19
|
+
| 3 | | | | | ☐ |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. 边界测试
|
|
24
|
+
|
|
25
|
+
验证相关边界条件。
|
|
26
|
+
|
|
27
|
+
| 场景 | 输入/条件 | 预期结果 | 实际结果 | 通过 |
|
|
28
|
+
|------|----------|---------|---------|------|
|
|
29
|
+
| 空值输入 | | | | ☐ |
|
|
30
|
+
| 最大值 | | | | ☐ |
|
|
31
|
+
| 并发场景 | | | | ☐ |
|
|
32
|
+
| 异常数据 | | | | ☐ |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 3. 影响范围验证
|
|
37
|
+
|
|
38
|
+
验证修改未引入新问题。
|
|
39
|
+
|
|
40
|
+
### 修改的文件
|
|
41
|
+
| 文件 | 修改类型 | 关联功能 | 验证状态 |
|
|
42
|
+
|------|---------|---------|---------|
|
|
43
|
+
| | | | ☐ 通过 / ☐ 失败 |
|
|
44
|
+
|
|
45
|
+
### 关联功能检查
|
|
46
|
+
| 功能模块 | 测试场景 | 验证状态 |
|
|
47
|
+
|---------|---------|---------|
|
|
48
|
+
| | | ☐ 通过 / ☐ 失败 |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 4. 性能回归
|
|
53
|
+
|
|
54
|
+
| 指标 | 修复前 | 修复后 | 是否退化 |
|
|
55
|
+
|------|-------|-------|---------|
|
|
56
|
+
| 响应时间 | | | ☐ 无退化 |
|
|
57
|
+
| 内存占用 | | | ☐ 无退化 |
|
|
58
|
+
| 数据库查询 | | | ☐ 无退化 |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 5. 回归确认
|
|
63
|
+
|
|
64
|
+
- [ ] 所有复现验证通过
|
|
65
|
+
- [ ] 所有边界测试通过
|
|
66
|
+
- [ ] 影响范围验证通过
|
|
67
|
+
- [ ] 性能无退化
|
|
68
|
+
- [ ] 已更新相关文档
|
|
69
|
+
|
|
70
|
+
**验证人**: _______________ **日期**: _______________
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# CRUD 模块 Schema
|
|
2
|
+
# 用于快速生成标准 CRUD 模块的工件流
|
|
3
|
+
|
|
4
|
+
name: crud-module
|
|
5
|
+
description: 快速生成标准 CRUD 模块(Entity/Mapper/Service/Controller/页面)
|
|
6
|
+
|
|
7
|
+
apply:
|
|
8
|
+
requires:
|
|
9
|
+
- tasks
|
|
10
|
+
|
|
11
|
+
artifacts:
|
|
12
|
+
- id: proposal
|
|
13
|
+
name: 模块提案
|
|
14
|
+
description: 描述要生成的 CRUD 模块
|
|
15
|
+
requires: []
|
|
16
|
+
template: proposal.md
|
|
17
|
+
instruction: |
|
|
18
|
+
根据用户描述,生成 CRUD 模块提案。
|
|
19
|
+
包含:模块名称、核心实体、CRUD 操作列表、业务规则。
|
|
20
|
+
output: proposal.md
|
|
21
|
+
|
|
22
|
+
- id: specs
|
|
23
|
+
name: 模块规范
|
|
24
|
+
description: 定义 CRUD 接口规范
|
|
25
|
+
requires: [proposal]
|
|
26
|
+
template: spec.md
|
|
27
|
+
instruction: |
|
|
28
|
+
定义 CRUD 接口规范:
|
|
29
|
+
- GET /api/{entity} — 分页查询
|
|
30
|
+
- GET /api/{entity}/:id — 详情查询
|
|
31
|
+
- POST /api/{entity} — 新增
|
|
32
|
+
- PUT /api/{entity}/:id — 修改
|
|
33
|
+
- DELETE /api/{entity}/:id — 删除
|
|
34
|
+
每个接口定义请求参数和响应格式。
|
|
35
|
+
output: specs/{{entity}}/spec.md
|
|
36
|
+
|
|
37
|
+
- id: design
|
|
38
|
+
name: 模块设计
|
|
39
|
+
description: 数据库设计和接口定义
|
|
40
|
+
requires: [proposal, specs]
|
|
41
|
+
template: design.md
|
|
42
|
+
instruction: |
|
|
43
|
+
设计数据库表结构和接口定义:
|
|
44
|
+
- 表结构(字段、类型、索引)
|
|
45
|
+
- 接口签名
|
|
46
|
+
- 前后端分工
|
|
47
|
+
output: design.md
|
|
48
|
+
|
|
49
|
+
- id: tasks
|
|
50
|
+
name: 任务列表
|
|
51
|
+
description: 代码生成任务拆分
|
|
52
|
+
requires: [design]
|
|
53
|
+
template: tasks.md
|
|
54
|
+
instruction: |
|
|
55
|
+
按以下顺序拆分任务:
|
|
56
|
+
1. Entity 实体类
|
|
57
|
+
2. Mapper + XML
|
|
58
|
+
3. Service 接口 + 实现
|
|
59
|
+
4. Controller
|
|
60
|
+
5. 前端 API 接口
|
|
61
|
+
6. 前端列表页
|
|
62
|
+
7. 前端表单页
|
|
63
|
+
8. 菜单注册
|
|
64
|
+
9. 单元测试
|
|
65
|
+
output: tasks.md
|
|
66
|
+
|
|
67
|
+
- id: api-docs
|
|
68
|
+
name: API 接口文档
|
|
69
|
+
description: 标准 API 接口文档
|
|
70
|
+
requires: [design]
|
|
71
|
+
template: api-docs.md
|
|
72
|
+
instruction: |
|
|
73
|
+
生成标准 API 接口文档:
|
|
74
|
+
- 接口概览表
|
|
75
|
+
- 每个接口的请求参数和响应示例(JSON 格式)
|
|
76
|
+
- 通用错误码说明
|
|
77
|
+
output: api-docs.md
|
|
78
|
+
|
|
79
|
+
- id: menu-register
|
|
80
|
+
name: 菜单注册
|
|
81
|
+
description: 菜单注册配置
|
|
82
|
+
requires: [tasks]
|
|
83
|
+
template: menu-register.md
|
|
84
|
+
instruction: |
|
|
85
|
+
生成菜单注册配置:
|
|
86
|
+
- 菜单名称、父级菜单、排序、图标
|
|
87
|
+
- 路由配置(path、component、meta)
|
|
88
|
+
- 权限标识(按钮级权限)
|
|
89
|
+
- SQL 插入语句
|
|
90
|
+
output: menu-register.md
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# API 接口文档: {{moduleName}}
|
|
2
|
+
|
|
3
|
+
> 模块: {{module}} | 实体: {{Entity}} | 基础路径: `/api/{{entity}}`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 接口概览
|
|
8
|
+
|
|
9
|
+
| Method | Path | 描述 | 认证 |
|
|
10
|
+
|--------|------|------|------|
|
|
11
|
+
| GET | `/api/{{entity}}` | 分页查询 | 需要 |
|
|
12
|
+
| GET | `/api/{{entity}}/:id` | 详情查询 | 需要 |
|
|
13
|
+
| POST | `/api/{{entity}}` | 新增 | 需要 |
|
|
14
|
+
| PUT | `/api/{{entity}}/:id` | 修改 | 需要 |
|
|
15
|
+
| DELETE | `/api/{{entity}}/:id` | 删除 | 需要 |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 1. 分页查询
|
|
20
|
+
|
|
21
|
+
**请求**: `GET /api/{{entity}}`
|
|
22
|
+
|
|
23
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
24
|
+
|------|------|------|------|
|
|
25
|
+
| page | number | 否 | 页码,默认 1 |
|
|
26
|
+
| size | number | 否 | 每页条数,默认 10 |
|
|
27
|
+
| keyword | string | 否 | 关键词搜索 |
|
|
28
|
+
|
|
29
|
+
**响应示例**:
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"code": 200,
|
|
33
|
+
"message": "success",
|
|
34
|
+
"data": {
|
|
35
|
+
"records": [
|
|
36
|
+
{
|
|
37
|
+
"id": 1,
|
|
38
|
+
"name": "示例数据",
|
|
39
|
+
"createTime": "2025-01-01 00:00:00"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"total": 100,
|
|
43
|
+
"page": 1,
|
|
44
|
+
"size": 10
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2. 详情查询
|
|
52
|
+
|
|
53
|
+
**请求**: `GET /api/{{entity}}/:id`
|
|
54
|
+
|
|
55
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
56
|
+
|------|------|------|------|
|
|
57
|
+
| id | number | 是 | 记录 ID(路径参数) |
|
|
58
|
+
|
|
59
|
+
**响应示例**:
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"code": 200,
|
|
63
|
+
"message": "success",
|
|
64
|
+
"data": {
|
|
65
|
+
"id": 1,
|
|
66
|
+
"name": "示例数据",
|
|
67
|
+
"createTime": "2025-01-01 00:00:00",
|
|
68
|
+
"updateTime": "2025-01-01 00:00:00"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 3. 新增
|
|
76
|
+
|
|
77
|
+
**请求**: `POST /api/{{entity}}`
|
|
78
|
+
|
|
79
|
+
**请求体**:
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"name": "新增数据"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**响应示例**:
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"code": 200,
|
|
90
|
+
"message": "success",
|
|
91
|
+
"data": 1
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 4. 修改
|
|
98
|
+
|
|
99
|
+
**请求**: `PUT /api/{{entity}}/:id`
|
|
100
|
+
|
|
101
|
+
**请求体**:
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"name": "修改后的数据"
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**响应示例**:
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"code": 200,
|
|
112
|
+
"message": "success",
|
|
113
|
+
"data": null
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 5. 删除
|
|
120
|
+
|
|
121
|
+
**请求**: `DELETE /api/{{entity}}/:id`
|
|
122
|
+
|
|
123
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
124
|
+
|------|------|------|------|
|
|
125
|
+
| id | number | 是 | 记录 ID(路径参数) |
|
|
126
|
+
|
|
127
|
+
**响应示例**:
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"code": 200,
|
|
131
|
+
"message": "success",
|
|
132
|
+
"data": null
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 通用错误码
|
|
139
|
+
|
|
140
|
+
| 错误码 | 说明 | 示例 |
|
|
141
|
+
|--------|------|------|
|
|
142
|
+
| 400 | 请求参数错误 | `{"code": 400, "message": "参数校验失败"}` |
|
|
143
|
+
| 401 | 未认证 | `{"code": 401, "message": "请先登录"}` |
|
|
144
|
+
| 403 | 无权限 | `{"code": 403, "message": "权限不足"}` |
|
|
145
|
+
| 404 | 资源不存在 | `{"code": 404, "message": "记录不存在"}` |
|
|
146
|
+
| 500 | 服务器内部错误 | `{"code": 500, "message": "系统异常"}` |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# CRUD 模块设计
|
|
2
|
+
|
|
3
|
+
## 1. 数据库设计
|
|
4
|
+
|
|
5
|
+
### 表结构
|
|
6
|
+
```sql
|
|
7
|
+
CREATE TABLE `{{table_name}}` (
|
|
8
|
+
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
9
|
+
-- 业务字段(根据提案填充)
|
|
10
|
+
`create_by` varchar(64) DEFAULT '' COMMENT '创建人',
|
|
11
|
+
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
12
|
+
`update_by` varchar(64) DEFAULT '' COMMENT '更新人',
|
|
13
|
+
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
14
|
+
`is_deleted` tinyint(1) DEFAULT 0 COMMENT '逻辑删除',
|
|
15
|
+
PRIMARY KEY (`id`)
|
|
16
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='{{table_comment}}';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 2. 接口定义
|
|
20
|
+
|
|
21
|
+
| Method | Path | 描述 | 请求参数 | 响应 |
|
|
22
|
+
|--------|------|------|----------|------|
|
|
23
|
+
| GET | /api/{{entity}} | 分页查询 | page, size, 查询条件 | PageResult |
|
|
24
|
+
| GET | /api/{{entity}}/:id | 详情 | - | EntityVO |
|
|
25
|
+
| POST | /api/{{entity}} | 新增 | EntityDTO | id |
|
|
26
|
+
| PUT | /api/{{entity}}/:id | 修改 | EntityDTO | - |
|
|
27
|
+
| DELETE | /api/{{entity}}/:id | 删除 | - | - |
|
|
28
|
+
|
|
29
|
+
## 3. 前后端分工
|
|
30
|
+
|
|
31
|
+
| 功能 | 前端 | 后端 |
|
|
32
|
+
|------|------|------|
|
|
33
|
+
| 列表页 | 表格+搜索+分页 | 分页查询接口 |
|
|
34
|
+
| 新增 | 表单弹窗 | 新增接口 |
|
|
35
|
+
| 编辑 | 表单弹窗 | 修改接口 |
|
|
36
|
+
| 删除 | 确认弹窗 | 删除接口 |
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# 菜单注册: {{moduleName}}
|
|
2
|
+
|
|
3
|
+
> 模块: {{module}} | 实体: {{Entity}} | 基础路径: `/{{module}}/{{entity}}`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. 菜单配置
|
|
8
|
+
|
|
9
|
+
| 配置项 | 值 | 说明 |
|
|
10
|
+
|--------|-----|------|
|
|
11
|
+
| 菜单名称 | {{moduleName}} | 显示在侧边栏的名称 |
|
|
12
|
+
| 父级菜单 | 根目录 / 按实际选择 | 菜单层级 |
|
|
13
|
+
| 排序 | 100 | 同级菜单排序,数字越小越靠前 |
|
|
14
|
+
| 图标 | el-icon-document | Element UI 图标名称 |
|
|
15
|
+
| 路由路径 | /{{module}}/{{entity}} | 前端路由 |
|
|
16
|
+
| 组件路径 | {{module}}/{{entity}}/index | Vue 组件路径 |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. 路由配置
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
// src/router/modules/{{module}}.js
|
|
24
|
+
export default {
|
|
25
|
+
path: '/{{module}}',
|
|
26
|
+
component: Layout,
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
path: '{{entity}}',
|
|
30
|
+
name: '{{Entity}}',
|
|
31
|
+
component: () => import('@/views/{{module}}/{{entity}}/index.vue'),
|
|
32
|
+
meta: {
|
|
33
|
+
title: '{{moduleName}}',
|
|
34
|
+
icon: 'document',
|
|
35
|
+
keepAlive: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 3. 权限标识
|
|
45
|
+
|
|
46
|
+
| 权限标识 | 描述 | 对应操作 |
|
|
47
|
+
|---------|------|---------|
|
|
48
|
+
| `{{module}}:{{entity}}:view` | 查看 | 列表页 + 详情 |
|
|
49
|
+
| `{{module}}:{{entity}}:add` | 新增 | 新增按钮 |
|
|
50
|
+
| `{{module}}:{{entity}}:edit` | 修改 | 编辑按钮 |
|
|
51
|
+
| `{{module}}:{{entity}}:delete` | 删除 | 删除按钮 |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 4. SQL 插入语句
|
|
56
|
+
|
|
57
|
+
```sql
|
|
58
|
+
-- 菜单数据
|
|
59
|
+
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time, remark)
|
|
60
|
+
VALUES ('{{moduleName}}', 0, 100, '/{{module}}/{{entity}}', '{{module}}/{{entity}}/index', 'C', '0', '0', '{{module}}:{{entity}}:view', 'document', 'admin', NOW(), '{{moduleName}}菜单');
|
|
61
|
+
|
|
62
|
+
-- 按钮权限
|
|
63
|
+
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, menu_type, visible, status, perms, icon, create_by, create_time, remark)
|
|
64
|
+
VALUES
|
|
65
|
+
-- 查看(@parentId 替换为上面插入的菜单 ID)
|
|
66
|
+
('{{moduleName}}查询', @parentId, 1, '#', '', 'F', '0', '0', '{{module}}:{{entity}}:view', '#', 'admin', NOW(), ''),
|
|
67
|
+
('{{moduleName}}新增', @parentId, 2, '#', '', 'F', '0', '0', '{{module}}:{{entity}}:add', '#', 'admin', NOW(), ''),
|
|
68
|
+
('{{moduleName}}修改', @parentId, 3, '#', '', 'F', '0', '0', '{{module}}:{{entity}}:edit', '#', 'admin', NOW(), ''),
|
|
69
|
+
('{{moduleName}}删除', @parentId, 4, '#', '', 'F', '0', '0', '{{module}}:{{entity}}:delete', '#', 'admin', NOW(), '');
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> **注意**: 执行 SQL 前请先确认 `parent_id` 的值(根据实际父级菜单调整)。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# CRUD 模块提案
|
|
2
|
+
|
|
3
|
+
## 模块名称
|
|
4
|
+
{{moduleName}}
|
|
5
|
+
|
|
6
|
+
## 核心实体
|
|
7
|
+
- 实体名:
|
|
8
|
+
- 表名:
|
|
9
|
+
- 描述:
|
|
10
|
+
|
|
11
|
+
## CRUD 操作
|
|
12
|
+
- [ ] 分页查询(列表)
|
|
13
|
+
- [ ] 详情查询
|
|
14
|
+
- [ ] 新增
|
|
15
|
+
- [ ] 修改
|
|
16
|
+
- [ ] 删除
|
|
17
|
+
- [ ] 导出(可选)
|
|
18
|
+
- [ ] 导入(可选)
|
|
19
|
+
|
|
20
|
+
## 业务规则
|
|
21
|
+
1.
|
|
22
|
+
2.
|
|
23
|
+
|
|
24
|
+
## 字段清单
|
|
25
|
+
| 字段名 | 类型 | 必填 | 说明 |
|
|
26
|
+
|--------|------|------|------|
|
|
27
|
+
| | | | |
|
|
28
|
+
|
|
29
|
+
## 非目标
|
|
30
|
+
- 不包含:
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# CRUD 接口规范
|
|
2
|
+
|
|
3
|
+
## ADDED Requirements
|
|
4
|
+
|
|
5
|
+
### API-001: 分页查询
|
|
6
|
+
系统应当提供 `GET /api/{{entity}}` 接口,支持分页查询。
|
|
7
|
+
|
|
8
|
+
**验收标准:**
|
|
9
|
+
- **Given** 数据库中存在 {{entity}} 记录
|
|
10
|
+
- **When** 用户请求 `GET /api/{{entity}}?page=1&size=10`
|
|
11
|
+
- **Then** 返回分页数据,包含 total、list、page、size
|
|
12
|
+
|
|
13
|
+
### API-002: 详情查询
|
|
14
|
+
系统应当提供 `GET /api/{{entity}}/:id` 接口。
|
|
15
|
+
|
|
16
|
+
**验收标准:**
|
|
17
|
+
- **Given** 存在 ID 为 1 的记录
|
|
18
|
+
- **When** 用户请求 `GET /api/{{entity}}/1`
|
|
19
|
+
- **Then** 返回该记录详情
|
|
20
|
+
|
|
21
|
+
### API-003: 新增
|
|
22
|
+
系统应当提供 `POST /api/{{entity}}` 接口。
|
|
23
|
+
|
|
24
|
+
**验收标准:**
|
|
25
|
+
- **Given** 用户提供必填字段
|
|
26
|
+
- **When** 用户请求 `POST /api/{{entity}}`
|
|
27
|
+
- **Then** 创建记录并返回新 ID
|
|
28
|
+
|
|
29
|
+
### API-004: 修改
|
|
30
|
+
系统应当提供 `PUT /api/{{entity}}/:id` 接口。
|
|
31
|
+
|
|
32
|
+
### API-005: 删除
|
|
33
|
+
系统应当提供 `DELETE /api/{{entity}}/:id` 接口(逻辑删除)。
|