diff --git a/internal/helpers/edu_family_group_test.go b/internal/helpers/edu_family_group_test.go index 59d7eb2c..8d25c149 100644 --- a/internal/helpers/edu_family_group_test.go +++ b/internal/helpers/edu_family_group_test.go @@ -5,6 +5,7 @@ package helpers import ( "io" + "reflect" "strings" "testing" ) @@ -283,4 +284,35 @@ func TestCrossPlatformCoverageEduFamilyGroupDispatch(t *testing.T) { t.Fatalf("input[\"open\"] = %#v, want true", input["open"]) } }) + + t.Run("add-child", func(t *testing.T) { + caller := withEduFamilyGroupDispatchCaller(t) + cmd := newEduFamilyGroupCommand() + cmd.SetArgs([]string{"manage", "add-child", "--org-id", "12345", "--uid", "67890", + "--name", "小明", "--mobile", "13900139000", + "--students", `[{"schoolOrgId":111,"studentStaffId":"stu001"}]`}) + if err := cmd.Execute(); err != nil { + t.Fatalf("Execute() = %v", err) + } + if caller.productID != "edu-familygroup" { + t.Fatalf("productID = %q, want %q", caller.productID, "edu-familygroup") + } + if caller.tool != "add_child_to_family_group" { + t.Fatalf("tool = %q, want %q", caller.tool, "add_child_to_family_group") + } + want := map[string]any{ + "input": map[string]any{ + "orgId": int64(12345), + "uid": int64(67890), + "name": "小明", + "mobile": "13900139000", + "students": []any{ + map[string]any{"schoolOrgId": float64(111), "studentStaffId": "stu001"}, + }, + }, + } + if !reflect.DeepEqual(caller.args, want) { + t.Fatalf("args = %#v, want %#v", caller.args, want) + } + }) } diff --git a/internal/helpers/run_all_edu_commands_test.go b/internal/helpers/run_all_edu_commands_test.go index 3c645141..35c6ef77 100644 --- a/internal/helpers/run_all_edu_commands_test.go +++ b/internal/helpers/run_all_edu_commands_test.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cobra" ) -// TestRunAllEduCommands 逐条执行 5 个教育产品的全部 153 条叶子命令(dry-run 模式), +// TestRunAllEduCommands 逐条执行 5 个教育产品的全部 156 条叶子命令(dry-run 模式), // 并打印每条命令对应的 MCP 工具名和参数。相当于在终端逐一执行 dws --dry-run。 func TestRunAllEduCommands(t *testing.T) { type cmdCase struct { @@ -19,7 +19,7 @@ func TestRunAllEduCommands(t *testing.T) { allCmds := []cmdCase{ // ═══════════════════════════════════════════════════════════ - // edu-contact: 26 commands + // edu-contact: 29 commands // ═══════════════════════════════════════════════════════════ // school (6) {"edu-contact", []string{"school", "roles"}}, @@ -28,7 +28,7 @@ func TestRunAllEduCommands(t *testing.T) { {"edu-contact", []string{"school", "type"}}, {"edu-contact", []string{"school", "stats", "--statistics-type", "1"}}, {"edu-contact", []string{"school", "class-list"}}, - // class (18) + // class (19) {"edu-contact", []string{"class", "detail", "--dept-id", "12345"}}, {"edu-contact", []string{"class", "students", "--dept-id", "12345"}}, {"edu-contact", []string{"class", "teachers", "--dept-id", "12345"}}, diff --git a/skills/mono/references/products/edu-app.md b/skills/mono/references/products/edu-app.md index 22349119..e310a079 100644 --- a/skills/mono/references/products/edu-app.md +++ b/skills/mono/references/products/edu-app.md @@ -35,7 +35,17 @@ | 命令 | 用途 | 必填参数 | |------|------|----------| +| `notice create` | 创建并发布通知 | `--identifer`, `--content` | +| `notice get` | 查询通知详情 | `--notice-id` | +| `notice list-by-teacher` | 查询老师发布的通知列表 | 无(均可选) | +| `notice list-by-student` | 查询学生通知列表 | `--student-id`, `--class-id` | | `notice confirm` | 确认收到通知 | `--notice-id`, `--student-id` | +| `notice confirm-status` | 查询通知确认状态 | `--notice-id`, `--class-id` | +| `notice delete` | 删除通知(破坏性,需 `--yes`) | `--notice-id` | + +> `notice create` 的幂等字段拼写为 `--identifer`(少一个 i),与上游字段 `input.identifer` 一致,不要写成 `--identifier`;建议格式 `orgId-staffId-UUID` +> `notice create --target-role`: guardian / student;`--is-signed true` 表示需要签收 +> `notice list-by-teacher --status` / `notice list-by-student --status` 用于筛选通知状态 ### circle (班级圈) @@ -61,17 +71,69 @@ > `card finish-info --target-role`: teacher / headmaster / guardian / student,未传时按 uid 真实身份自动推断 > `card finish-info` 当 `targetRole=guardian` 时,可传 `--student-id` 指定查看某个孩子的进度 +### homework (作业管理) + +| 命令 | 用途 | 必填参数 | +|------|------|----------| +| `homework create` | 创建并发布作业 | `--identifier`, `--hw-content` | +| `homework get` | 查询作业详情 | `--homework-id` | +| `homework list-by-teacher` | 查询老师作业列表 | 无(均可选) | +| `homework list-by-student` | 查询学生作业列表 | `--student-id`, `--class-id`, `--user-name` | +| `homework class-by-homework` | 查询作业的班级提交情况 | `--homework-id` | +| `homework class-detail` | 查询班级作业详情 | `--homework-id`, `--class-id`, `--user-name` | +| `homework submit-statistics` | 查询作业提交统计 | `--homework-id`, `--class-id` | +| `homework student-detail` | 查询学生作业详情 | `--homework-id`, `--student-id`, `--class-id` | +| `homework submit` | 提交作业 | `--hw-content-detail-id` | +| `homework create-comment` | 创建作业评语 | `--comment`, `--hw-content-detail-id` | +| `homework delete` | 删除作业(破坏性,需 `--yes`) | `--homework-id` | + +> 作业正文用 `--hw-content`(不是 `--content`);`--hw-title` 为可选标题 +> `--submit-types` / `--hw-type` / `--publish-type` 控制提交方式与作业类型 +> `homework submit` 与 `homework create-comment` 定位到具体作业内容用 `--hw-content-detail-id` + +### diploma (奖状管理) + +| 命令 | 用途 | 必填参数 | +|------|------|----------| +| `diploma create` | 创建并颁发奖状 | `--identifier`, `--content`, `--user-name` | +| `diploma get` | 查询奖状详情 | `--diploma-id` | +| `diploma list-by-teacher` | 查询老师创建的奖状列表 | 无(均可选) | +| `diploma list-by-student` | 查询学生收到的奖状列表 | `--student-id`, `--class-id` | +| `diploma detail` | 查询奖状接收详情 | `--diploma-id` | +| `diploma student-detail` | 查询学生奖状接收详情 | `--diploma-id`, `--student-id`, `--class-id` | +| `diploma statistics` | 查询奖状阅读统计 | `--diploma-id` | +| `diploma read` | 标记奖状为已读 | `--diploma-id` | +| `diploma delete` | 删除奖状(破坏性,需 `--yes`) | `--diploma-id` | + +> diploma 是「奖状」,不是毕业证书;`--tag` 用于奖状类别,`--template-url` 指定奖状模板 + +## 危险操作 + +以下三条为 `user_required` 破坏性命令,不加 `--yes` 会被确认门禁拦下(`category: validation`, `code: 3`, `reason: confirmation_required`,退出码 3): + +| 命令 | 后果 | +|------|------| +| `notice delete --notice-id --yes` | 删除通知,家长/学生侧不可恢复 | +| `homework delete --homework-id --yes` | 删除作业及其提交记录 | +| `diploma delete --diploma-id --yes` | 删除已颁发的奖状 | + +其余命令均为读或普通写操作,不需要 `--yes`。 + ## 意图判断 用户说"消息/消息摘要" → message summary-list -用户说"作业/任务/打卡/家校任务" → task 子命令 +用户说"家校任务/待办任务" → task 子命令 +用户说"作业" → homework 子命令(发布→create,查详情→get,批改评语→create-comment,提交→submit,删除→delete + `--yes`) 用户说"成绩/成绩单" → report 子命令 -用户说"通知/确认通知" → notice confirm +用户说"通知" → notice 子命令(发通知→create,查详情→get,签收/确认→confirm,查签收情况→confirm-status,删除→delete + `--yes`) +用户说"奖状/表彰/颁奖" → diploma 子命令(颁发→create,查详情→get,阅读统计→statistics,删除→delete + `--yes`) 用户说"班级圈/成长记录/学生动态" → circle posts 用户说"打卡/打卡任务/打卡完成情况/卡片完成情况" → card 子命令 -关键区分: task(家校任务/作业) vs report(成绩单) +关键区分: homework(作业,独立命令组) vs task(家校任务聚合列表,含作业/打卡/通知/奖状等来源) 关键区分: circle(班级圈动态/成长记录) vs message(AI消息总结) +关键区分: diploma(奖状/表彰) vs report(成绩单) +老师视角用 `list-by-teacher`,学生/家长视角用 `list-by-student`,homework / notice / diploma 三组同构。 ## 核心工作流 @@ -85,25 +147,45 @@ 7. 查看某班打卡完成情况 → `card user-statistic --card-id --task-code --class-id --finish` 8. 查看某班未打卡人员 → `card user-statistic --card-id --task-code --class-id ` 9. 查看某打卡完成进度 → `card finish-info --card-id --card-biz-id ` +10. 发布作业 → `homework create --identifier --hw-content "第三章习题" --class-ids ` +11. 查看作业提交统计 → `homework submit-statistics --homework-id --class-id ` +12. 批改作业写评语 → `homework create-comment --hw-content-detail-id --comment "写得很好"` +13. 删除作业 → `homework delete --homework-id --yes` +14. 发布通知 → `notice create --identifer --content "明天放假" --class-ids --is-signed true` +15. 查看通知签收情况 → `notice confirm-status --notice-id --class-id ` +16. 删除通知 → `notice delete --notice-id --yes` +17. 颁发奖状 → `diploma create --identifier --content "三好学生" --user-name <老师姓名> --class-ids ` +18. 查看奖状阅读统计 → `diploma statistics --diploma-id ` +19. 删除奖状 → `diploma delete --diploma-id --yes` ### 家长场景 1. 查看孩子待办 → `task student-list --students '[{"userId":"","bizId":""}]'` 2. 确认通知 → `notice confirm --notice-id --student-id ` -3. 查看孩子班级圈动态 → `circle posts --class-id --student-id --target-role guardian` -4. 查看孩子进行中打卡 → `card list --status UNFINISH` -5. 查看孩子某打卡进度 → `card finish-info --card-id --card-biz-id ` +3. 查看孩子收到的通知 → `notice list-by-student --student-id --class-id ` +4. 查看孩子班级圈动态 → `circle posts --class-id --student-id --target-role guardian` +5. 查看孩子进行中打卡 → `card list --status UNFINISH` +6. 查看孩子某打卡进度 → `card finish-info --card-id --card-biz-id ` +7. 查看孩子作业列表 → `homework list-by-student --student-id --class-id --user-name <家长姓名>` +8. 查看孩子收到的奖状 → `diploma list-by-student --student-id --class-id ` ### 学生场景 1. 查看自己的班级圈动态 → `circle posts --class-id --student-id --target-role student` +2. 提交作业 → `homework submit --hw-content-detail-id --content "已完成"` +3. 查看某份作业详情 → `homework student-detail --homework-id --student-id --class-id ` +4. 标记奖状已读 → `diploma read --diploma-id ` ## 上下文传递表 | 操作 | 从返回中提取 | 用于 | |------|-------------|------| -| `edu-contact school class-list` | `deptId` | task all-list 的 --biz-id | -| `edu-contact class students` | `userId` | task student-list 的 students.userId | -| `edu-group class-group conversation-id` | `conversationId` | message summary-list 的 --cid | +| `dws edu-contact school class-list` | `deptId` | task all-list 的 --biz-id | +| `dws edu-contact class students` | `userId` | task student-list 的 students.userId | +| `dws edu-group class-group conversation-id` | `conversationId` | message summary-list 的 --cid | | `report by-teacher` | `schoolReportId` | report get/by-class/by-student-detail 的 --report-id | -| `edu-contact family children` | `studentUserId`, `classId` | circle posts 的 --student-id, --class-id | -| `task publish-list` | `cardId` | card update/end/finish-info` 的 --card-id | +| `dws edu-contact family children` | `studentUserId`, `classId` | circle posts 的 --student-id, --class-id | +| `task publish-list` | `cardId` | card update/end/finish-info 的 --card-id | | `task publish-list` | `taskCode` | card user-statistic 的 --task-code | +| `homework list-by-teacher` | `homeworkId` | homework get/delete/submit-statistics 的 --homework-id | +| `homework class-detail` | `hwContentDetailId` | homework submit / create-comment 的 --hw-content-detail-id | +| `notice list-by-teacher` | `noticeId` | notice get/confirm/confirm-status/delete 的 --notice-id | +| `diploma list-by-teacher` | `diplomaId` | diploma get/detail/statistics/delete 的 --diploma-id | diff --git a/skills/mono/references/products/edu-familygroup.md b/skills/mono/references/products/edu-familygroup.md index 82ec8631..cf49b4ae 100644 --- a/skills/mono/references/products/edu-familygroup.md +++ b/skills/mono/references/products/edu-familygroup.md @@ -65,4 +65,4 @@ |------|-------------|------| | `manage create` | `orgId`, `cid` | invite-parent / add-child 的 --org-id | | `group list-children` | 孩子 staffId | toggle-app 的 --child-staff-id | -| `edu-contact family list` | 家长 uid | 所有 edu-familygroup 命令的 --uid | +| `dws edu-contact family parents` | 家长 uid | 所有 edu-familygroup 命令的 --uid | diff --git a/skills/multi/dingtalk-misc/references/edu-app.md b/skills/multi/dingtalk-misc/references/edu-app.md index 256bffd7..0a5cf3da 100644 --- a/skills/multi/dingtalk-misc/references/edu-app.md +++ b/skills/multi/dingtalk-misc/references/edu-app.md @@ -35,7 +35,16 @@ | 命令 | 用途 | 必填参数 | |------|------|----------| +| `notice create` | 创建并发布通知 | `--identifer`, `--content` | +| `notice get` | 查询通知详情 | `--notice-id` | +| `notice list-by-teacher` | 查询老师发布的通知列表 | 无(均可选) | +| `notice list-by-student` | 查询学生通知列表 | `--student-id`, `--class-id` | | `notice confirm` | 确认收到通知 | `--notice-id`, `--student-id` | +| `notice confirm-status` | 查询通知确认状态 | `--notice-id`, `--class-id` | +| `notice delete` | 删除通知(破坏性,需 `--yes`) | `--notice-id` | + +> `notice create` 的幂等字段拼写为 `--identifer`(少一个 i),与上游字段 `input.identifer` 一致,不要写成 `--identifier` +> `notice create --target-role`: guardian / student;`--is-signed true` 表示需要签收 ### circle (班级圈) @@ -60,17 +69,68 @@ > `card finish-info --target-role`: teacher / headmaster / guardian / student,未传时按 uid 真实身份自动推断 > `card finish-info --student-id`: 当 targetRole 为 guardian 时,用于指定查看某个孩子的进度 +### homework (作业管理) + +| 命令 | 用途 | 必填参数 | +|------|------|----------| +| `homework create` | 创建并发布作业 | `--identifier`, `--hw-content` | +| `homework get` | 查询作业详情 | `--homework-id` | +| `homework list-by-teacher` | 查询老师作业列表 | 无(均可选) | +| `homework list-by-student` | 查询学生作业列表 | `--student-id`, `--class-id`, `--user-name` | +| `homework class-by-homework` | 查询作业的班级提交情况 | `--homework-id` | +| `homework class-detail` | 查询班级作业详情 | `--homework-id`, `--class-id`, `--user-name` | +| `homework submit-statistics` | 查询作业提交统计 | `--homework-id`, `--class-id` | +| `homework student-detail` | 查询学生作业详情 | `--homework-id`, `--student-id`, `--class-id` | +| `homework submit` | 提交作业 | `--hw-content-detail-id` | +| `homework create-comment` | 创建作业评语 | `--comment`, `--hw-content-detail-id` | +| `homework delete` | 删除作业(破坏性,需 `--yes`) | `--homework-id` | + +> 作业正文用 `--hw-content`(不是 `--content`);`--hw-title` 为可选标题 +> `homework submit` 与 `homework create-comment` 定位到具体作业内容用 `--hw-content-detail-id` + +### diploma (奖状管理) + +| 命令 | 用途 | 必填参数 | +|------|------|----------| +| `diploma create` | 创建并颁发奖状 | `--identifier`, `--content`, `--user-name` | +| `diploma get` | 查询奖状详情 | `--diploma-id` | +| `diploma list-by-teacher` | 查询老师创建的奖状列表 | 无(均可选) | +| `diploma list-by-student` | 查询学生收到的奖状列表 | `--student-id`, `--class-id` | +| `diploma detail` | 查询奖状接收详情 | `--diploma-id` | +| `diploma student-detail` | 查询学生奖状接收详情 | `--diploma-id`, `--student-id`, `--class-id` | +| `diploma statistics` | 查询奖状阅读统计 | `--diploma-id` | +| `diploma read` | 标记奖状为已读 | `--diploma-id` | +| `diploma delete` | 删除奖状(破坏性,需 `--yes`) | `--diploma-id` | + +> diploma 是「奖状」,不是毕业证书;`--tag` 用于奖状类别,`--template-url` 指定奖状模板 + +## 危险操作 + +以下三条为 `user_required` 破坏性命令,不加 `--yes` 会被确认门禁拦下(`category: validation`, `code: 3`, `reason: confirmation_required`,退出码 3): + +| 命令 | 后果 | +|------|------| +| `notice delete --notice-id --yes` | 删除通知,家长/学生侧不可恢复 | +| `homework delete --homework-id --yes` | 删除作业及其提交记录 | +| `diploma delete --diploma-id --yes` | 删除已颁发的奖状 | + +其余命令均为读或普通写操作,不需要 `--yes`。 + ## 意图判断 用户说"消息/消息摘要" → message summary-list -用户说"作业/任务/打卡/家校任务" → task 子命令 +用户说"家校任务/待办任务" → task 子命令 +用户说"作业" → homework 子命令(发布→create,查详情→get,批改评语→create-comment,提交→submit,删除→delete + `--yes`) 用户说"成绩/成绩单" → report 子命令 -用户说"通知/确认通知" → notice confirm +用户说"通知" → notice 子命令(发通知→create,查详情→get,签收/确认→confirm,查签收情况→confirm-status,删除→delete + `--yes`) +用户说"奖状/表彰/颁奖" → diploma 子命令(颁发→create,查详情→get,阅读统计→statistics,删除→delete + `--yes`) 用户说"班级圈/成长记录/学生动态" → circle posts -用户说"打卡/打卡列表/打卡进度/打卡统计/卡片完成情况" → card 子命令 +用户说"打卡/打卡任务/打卡完成情况/卡片完成情况" → card 子命令 -关键区分: task(家校任务/作业) vs report(成绩单) +关键区分: homework(作业,独立命令组) vs task(家校任务聚合列表,含作业/打卡/通知/奖状等来源) 关键区分: circle(班级圈动态/成长记录) vs message(AI消息总结) +关键区分: diploma(奖状/表彰) vs report(成绩单) +老师视角用 `list-by-teacher`,学生/家长视角用 `list-by-student`,homework / notice / diploma 三组同构。 ## 核心工作流 @@ -79,24 +139,47 @@ 2. 查看某班全部任务 → `task all-list --biz-id ` 3. 查看成绩单 → `report by-teacher --status 1` 4. 查看班级成绩明细 → `report by-class --report-id --class-id ` +5. 查看某班打卡完成情况 → `card user-statistic --card-id --task-code --class-id --finish` +6. 发布作业 → `homework create --identifier --hw-content "第三章习题" --class-ids ` +7. 查看作业提交统计 → `homework submit-statistics --homework-id --class-id ` +8. 批改作业写评语 → `homework create-comment --hw-content-detail-id --comment "写得很好"` +9. 删除作业 → `homework delete --homework-id --yes` +10. 发布通知 → `notice create --identifer --content "明天放假" --class-ids --is-signed true` +11. 查看通知签收情况 → `notice confirm-status --notice-id --class-id ` +12. 删除通知 → `notice delete --notice-id --yes` +13. 颁发奖状 → `diploma create --identifier --content "三好学生" --user-name <老师姓名> --class-ids ` +14. 查看奖状阅读统计 → `diploma statistics --diploma-id ` +15. 删除奖状 → `diploma delete --diploma-id --yes` ### 家长场景 1. 查看孩子待办 → `task student-list --students '[{"userId":"","bizId":""}]'` 2. 确认通知 → `notice confirm --notice-id --student-id ` -3. 查看孩子班级圈动态 → `circle posts --class-id --student-id --target-role guardian` +3. 查看孩子收到的通知 → `notice list-by-student --student-id --class-id ` +4. 查看孩子班级圈动态 → `circle posts --class-id --student-id --target-role guardian` +5. 查看孩子进行中打卡 → `card list --status UNFINISH` +6. 查看孩子作业列表 → `homework list-by-student --student-id --class-id --user-name <家长姓名>` +7. 查看孩子收到的奖状 → `diploma list-by-student --student-id --class-id ` ### 学生场景 1. 查看自己的班级圈动态 → `circle posts --class-id --student-id --target-role student` +2. 提交作业 → `homework submit --hw-content-detail-id --content "已完成"` +3. 标记奖状已读 → `diploma read --diploma-id ` ## 上下文传递表 | 操作 | 从返回中提取 | 用于 | |------|-------------|------| -| `edu-contact school class-list` | `deptId` | task all-list 的 --biz-id | -| `edu-contact class students` | `userId` | task student-list 的 students.userId | -| `edu-group class-group conversation-id` | `conversationId` | message summary-list 的 --cid | +| `dws edu-contact school class-list` | `deptId` | task all-list 的 --biz-id | +| `dws edu-contact class students` | `userId` | task student-list 的 students.userId | +| `dws edu-group class-group conversation-id` | `conversationId` | message summary-list 的 --cid | | `report by-teacher` | `schoolReportId` | report get/by-class/by-student-detail 的 --report-id | -| `edu-contact family children` | `studentUserId`, `classId` | circle posts 的 --student-id, --class-id | +| `dws edu-contact family children` | `studentUserId`, `classId` | circle posts 的 --student-id, --class-id | +| `task publish-list` | `cardId` | card update/end/finish-info 的 --card-id | +| `task publish-list` | `taskCode` | card user-statistic 的 --task-code | +| `homework list-by-teacher` | `homeworkId` | homework get/delete/submit-statistics 的 --homework-id | +| `homework class-detail` | `hwContentDetailId` | homework submit / create-comment 的 --hw-content-detail-id | +| `notice list-by-teacher` | `noticeId` | notice get/confirm/confirm-status/delete 的 --notice-id | +| `diploma list-by-teacher` | `diplomaId` | diploma get/detail/statistics/delete 的 --diploma-id | --- diff --git a/skills/multi/dingtalk-misc/references/edu-familygroup.md b/skills/multi/dingtalk-misc/references/edu-familygroup.md index 82ec8631..cf49b4ae 100644 --- a/skills/multi/dingtalk-misc/references/edu-familygroup.md +++ b/skills/multi/dingtalk-misc/references/edu-familygroup.md @@ -65,4 +65,4 @@ |------|-------------|------| | `manage create` | `orgId`, `cid` | invite-parent / add-child 的 --org-id | | `group list-children` | 孩子 staffId | toggle-app 的 --child-staff-id | -| `edu-contact family list` | 家长 uid | 所有 edu-familygroup 命令的 --uid | +| `dws edu-contact family parents` | 家长 uid | 所有 edu-familygroup 命令的 --uid |