vps-work 1.0.0

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.
Files changed (84) hide show
  1. package/.well-known/skills/index.json +203 -0
  2. package/README.md +315 -0
  3. package/USAGE.md +289 -0
  4. package/dist/vps-work.cjs +64206 -0
  5. package/examples/README.md +94 -0
  6. package/package.json +76 -0
  7. package/scripts/install-onboard-skill.ps1 +77 -0
  8. package/scripts/install-onboard-skill.sh +66 -0
  9. package/scripts/test-local-tenant-services.mjs +21 -0
  10. package/skills/README.md +53 -0
  11. package/skills/sale-performance-query/SKILL.md +210 -0
  12. package/skills/sale-performance-query/references/vps-sales-account-orders.md +48 -0
  13. package/skills/sale-performance-query/references/vps-sales-agent-five-suite.md +55 -0
  14. package/skills/sale-performance-query/references/vps-sales-customer-mix.md +47 -0
  15. package/skills/sale-performance-query/references/vps-sales-customer-region.md +70 -0
  16. package/skills/sale-performance-query/references/vps-sales-daily-trend.md +44 -0
  17. package/skills/sale-performance-query/references/vps-sales-dealer-orders.md +47 -0
  18. package/skills/sale-performance-query/references/vps-sales-dealer-performance.md +49 -0
  19. package/skills/sale-performance-query/references/vps-sales-deposit-breakdown.md +16 -0
  20. package/skills/sale-performance-query/references/vps-sales-dept-breakdown.md +32 -0
  21. package/skills/sale-performance-query/references/vps-sales-dept-comparison.md +24 -0
  22. package/skills/sale-performance-query/references/vps-sales-entities.md +25 -0
  23. package/skills/sale-performance-query/references/vps-sales-headline-kpi.md +26 -0
  24. package/skills/sale-performance-query/references/vps-sales-invoice-attachments.md +37 -0
  25. package/skills/sale-performance-query/references/vps-sales-invoice-status.md +37 -0
  26. package/skills/sale-performance-query/references/vps-sales-order-finance.md +29 -0
  27. package/skills/sale-performance-query/references/vps-sales-order-logistics.md +50 -0
  28. package/skills/sale-performance-query/references/vps-sales-per-person-kpi.md +24 -0
  29. package/skills/sale-performance-query/references/vps-sales-personal-okr.md +40 -0
  30. package/skills/sale-performance-query/references/vps-sales-ranking.md +25 -0
  31. package/skills/sale-performance-query/references/vps-sales-reconciled-receipts.md +46 -0
  32. package/skills/sale-performance-query/references/vps-sales-refund-summary.md +20 -0
  33. package/skills/sale-performance-query/references/vps-sales-service-sales.md +23 -0
  34. package/skills/sale-performance-query/references/vps-sales-shared-params.md +68 -0
  35. package/skills/sale-performance-query/references/vps-sales-target-achievement.md +47 -0
  36. package/skills/sale-performance-query/references/vps-sales-team-pk.md +23 -0
  37. package/skills/vps-approval/SKILL.md +20 -0
  38. package/skills/vps-calendar/SKILL.md +64 -0
  39. package/skills/vps-calendar/agents/openai.yaml +4 -0
  40. package/skills/vps-corporate/SKILL.md +84 -0
  41. package/skills/vps-creative/SKILL.md +66 -0
  42. package/skills/vps-current-user-identity/SKILL.md +138 -0
  43. package/skills/vps-current-user-identity/reference.md +79 -0
  44. package/skills/vps-daily-report-assistant/SKILL.md +180 -0
  45. package/skills/vps-daily-sales-report/SKILL.md +124 -0
  46. package/skills/vps-daily-sales-report/reference.md +188 -0
  47. package/skills/vps-device-abnormal-statistics/SKILL.md +52 -0
  48. package/skills/vps-device-abnormal-statistics/agents/openai.yaml +4 -0
  49. package/skills/vps-device-abnormal-statistics/references/api.md +134 -0
  50. package/skills/vps-documents/SKILL.md +77 -0
  51. package/skills/vps-documents/agents/openai.yaml +4 -0
  52. package/skills/vps-documents/references/api.md +106 -0
  53. package/skills/vps-hr/SKILL.md +50 -0
  54. package/skills/vps-hr-compensation-documents/SKILL.md +61 -0
  55. package/skills/vps-hr-compensation-documents/reference.md +68 -0
  56. package/skills/vps-hr-compensation-documents/references/+payslip.md +29 -0
  57. package/skills/vps-hr-compensation-documents/references/runtime-and-helpers.md +24 -0
  58. package/skills/vps-im/SKILL.md +154 -0
  59. package/skills/vps-im/references/vps-im-bots.md +25 -0
  60. package/skills/vps-im/references/vps-im-calls.md +28 -0
  61. package/skills/vps-im/references/vps-im-channels.md +32 -0
  62. package/skills/vps-im/references/vps-im-read.md +105 -0
  63. package/skills/vps-im/references/vps-im-send.md +57 -0
  64. package/skills/vps-im/references/vps-im-shared-params.md +42 -0
  65. package/skills/vps-mail/SKILL.md +17 -0
  66. package/skills/vps-meeting/SKILL.md +42 -0
  67. package/skills/vps-okr/SKILL.md +22 -0
  68. package/skills/vps-okr-management-assistant/SKILL.md +45 -0
  69. package/skills/vps-okr-management-assistant/reference.md +84 -0
  70. package/skills/vps-pending-approval-assistant/SKILL.md +66 -0
  71. package/skills/vps-pending-approval-assistant/reference.md +55 -0
  72. package/skills/vps-product/SKILL.md +221 -0
  73. package/skills/vps-sale-personnel-efficiency/SKILL.md +124 -0
  74. package/skills/vps-sale-personnel-efficiency/reference.md +139 -0
  75. package/skills/vps-shared/SKILL.md +72 -0
  76. package/skills/vps-store-management/SKILL.md +35 -0
  77. package/skills/vps-store-management/references/store-reception.md +40 -0
  78. package/skills/vps-task-management-assistant/SKILL.md +140 -0
  79. package/skills/vps-tools/SKILL.md +73 -0
  80. package/skills/vps-tools/agents/openai.yaml +4 -0
  81. package/skills/vps-v-drive/SKILL.md +82 -0
  82. package/skills/vps-vemory/SKILL.md +33 -0
  83. package/skills/vps-work/SKILL.md +366 -0
  84. package/skills/vps-work-onboard/SKILL.md +53 -0
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: vps-current-user-identity
3
+ description: |
4
+ 适用场景:用户提到「我」「我的」「本人」「我自己」「我们部门」「本部门」「我的上级」「我的领导」「汇报对象」「我的销售订单 / 采购 / 审批 / 任务」「我创建的」「我负责的」「以我的名义」等任何一人称指代时使用。提供 3 条等价路径取当前身份:(1) CLI vps-work hr +me 一次性返回 user_id / employee_id / department_id / department_chain / manager_user_id;(2) Domain DSL 宏 @me / @my_partner / @my_employee / @my_department / @company / @companies 可在各域命令的 domain 参数中直接用,无需先取身份;(3) vps-work auth status --json 极简身份(uid / login)。常见误区:禁止把 partner_id 当 user_id、禁止扫 res.users 找自己、禁止重复取身份。触发词:我、我的、本人、我自己、我们部门、本部门、我上级、我领导、汇报对象、当前用户、current user、@me、auth status、self identity、me。
5
+ ---
6
+
7
+ # 当前用户身份与组织信息
8
+
9
+ # 当前用户身份与组织信息
10
+
11
+ > **本技能是"参数型"skill,不是查询终点。**
12
+ > 它只负责回答"我=哪个 user / partner / employee / 部门 / 公司",**不负责"查我的转正日期 / 我的销售单 / 我的待办"这类业务取数**。
13
+ > **取完身份/宏后,把 `@me` 等宏配合对应域命令(`vps-work <域> +…`)继续取数。**
14
+
15
+ ## 何时使用
16
+
17
+ 凡用户表达涉及**第一人称**就走这份技能,**不要再去猜或试**:
18
+
19
+ - 「**我的**销售订单 / 采购单 / 待办 / 审批 / 任务 / 日报 / OKR」
20
+ - 「**我创建的** / **我负责的** / **我审批过的** / **我跟进的**」
21
+ - 「**我们部门** / **本部门** / **我下属** / **我管的人**」
22
+ - 「**我的上级** / **我的领导** / **汇报对象**」
23
+ - 「**以我的名义**发消息 / 代我转告」
24
+ - 任何 `user_id == ?` / `partner_id == ?` / `employee_id == ?` 需要填「自己」的位置
25
+
26
+ > 90% 的场景下,你**根本不需要**先 `vps-work hr +me`——只要把 `@me` / `@my_partner` / `@my_employee` / `@my_department` 写进 domain 即可(详见下方场景 A)。把身份当"业务模型上的一个参数"理解,不要把它当成独立任务。
27
+
28
+ ## Golden path(按场景选最短路径)
29
+
30
+ ### 场景 A:写 domain / 过滤条件 — 直接用宏,**不要**先取身份
31
+
32
+ | 业务表达 | DSL 宏 | 等价 JSON |
33
+ |---|---|---|
34
+ | 我创建/我负责/我登录 | `@me` | `env.uid` |
35
+ | 我作为联系人 | `@my_partner` | `env.user.partner_id.id` |
36
+ | 我作为员工 | `@my_employee` | `hr.employee.user_id == env.uid` |
37
+ | 我所在部门 | `@my_department` | 当前员工的 `department_id.id` |
38
+ | 当前公司 | `@company` | `env.company.id` |
39
+ | 我可访问的所有公司 | `@companies` | `env.companies.ids`(list) |
40
+
41
+ 把宏直接写进对应域命令的 domain 参数(PowerShell 外双内单是硬规矩):
42
+
43
+ ```text
44
+ --domain "user_id = @me AND state = 'sale'"
45
+ ```
46
+
47
+ ### 场景 B:需要把身份字段**回传给 UI / 摘要** — 一次性取全
48
+
49
+ ```bash
50
+ vps-work hr +me
51
+ ```
52
+
53
+ 返回(节选):
54
+
55
+ ```json
56
+ {
57
+ "user_id": 12, "login": "lihua", "name": "李华",
58
+ "employee_id": 305, "job_title": "销售经理",
59
+ "department_id": 17, "department_name": "海外销售部",
60
+ "department_chain": ["销售中心", "海外销售部"],
61
+ "manager_id": 220, "manager_name": "张总", "manager_user_id": 9,
62
+ "source": "vertu"
63
+ }
64
+ ```
65
+
66
+ > 一次任务**只调一次**,把结果缓存起来后续复用。
67
+
68
+ ### 场景 C:只要一个 uid(极简)
69
+
70
+ ```bash
71
+ vps-work auth status --json
72
+ → {"auth_mode": "user|agent", "uid": 12, "login": "lihua", ...}
73
+ ```
74
+
75
+ 仅当不需要 partner / employee / 部门时才用。
76
+
77
+ ---
78
+
79
+ ## 下一步:身份取到之后(**强制**)
80
+
81
+ 身份/宏拿到后,**把控制权交给对应业务域 skill**:
82
+
83
+ 1. **匹配** — 扫一遍可用 skill,看是否有专项技能对应用户的业务意图(如 `sale-performance-query` / `vps-product` / `vps-okr-management-assistant` / `vps-pending-approval-assistant` / `vps-daily-report-assistant`)
84
+ 2. **用对应域命令取数** — 把 `@me` / `@my_employee` / `@my_department` 等宏写进对应 `vps-work <域> +…` 的 domain 参数;字段/模型/业务实体未知时只读 `skills/` 文档,不要凭直觉拼未文档化的字段。员工姓名 → ID 的解析能力已不再提供,需由调用方给定 `employee_id` 或用 `vps-work hr +me` 取本人。
85
+
86
+ | 反面例子 | 应改为 |
87
+ |---|---|
88
+ | 取到 `department_id=2124` → 在 domain 里硬编码 `department_id=2124` | 直接用宏:`--domain "department_id = @my_department"`(可移植、显式、无需先 me) |
89
+
90
+ ## 硬约束
91
+
92
+ - **不是查询终点**:本 skill 只产出"身份/宏",取到后交给对应业务域 skill(`vps-work <域> +…`)继续取数,字段只来自 `skills/` 文档。
93
+ - **禁止**把 `partner_id` 当 `user_id` 用:sale.order / purchase.order / project.task 上的 `user_id` 是 `res.users.id`,**不是** `res.partner.id`。
94
+ - **禁止**用 `search res.users` + `[('login', '=', ...)]` 「找我自己」:当前请求已是登录用户上下文,直接用 `env.uid` / `vps-work hr +me` 即可。
95
+ - **禁止**在同一任务里**反复**调 `vps-work hr +me`:第一次调用后缓存复用;身份在一次任务期间不会变。
96
+ - **禁止**在能用宏的场景下绕路先取身份。例如「列我本月的订单」直接 `user_id = @me AND date_order >= @month_start`,不要先 `vps-work hr +me`、再用 `user_id = 12`。
97
+ - **禁止**虚构 `manager_user_id` / `department_chain`:模型上没有就是没有,必要时重跑 `vps-work hr +me` 看真实输出。
98
+ - **禁止**凭直觉拼业务字段名(`date_of_joining` / `hire_date` 等):字段只取自对应域 skill 的 `reference.md` / `references`,禁止凭空猜测或 schema 嗅探。
99
+
100
+ ## 常见坑点
101
+
102
+ | 现象 | 根因 | 正确做法 |
103
+ |---|---|---|
104
+ | 身份取到就直接对业务模型拼字段,结果 `Invalid field` 反复报错 | 把本 skill 当查询终点,跳过专项文档 | 交给对应域 skill(`vps-work <域> +…`);字段只来自 `skills/` 文档 |
105
+ | 拿到 `employee_id` 后写 `domain "id = 6941"` | 把宏当成"取完就丢",反而硬编码了 ID | 用 `domain "id = @my_employee"`(更可移植,宏会在 DSL 编译期校验) |
106
+ | `user_id` 过滤不出结果但本人确实有数据 | 业务模型上 `user_id` 是 `res.users`,被填成了 `partner_id` | 用 `@me`(=`env.uid`);如必须用 ID,从 `vps-work hr +me` 取 `user_id` |
107
+ | 「我们部门」过滤少人 | 直接用了员工自己的 `department_id`,未递归子部门 | domain 里改用 `department_id child_of @my_department` |
108
+ | 多公司环境少数据 | 默认上下文只看了 `@company` 一个 | 用 `company_id IN @companies` |
109
+ | `vps-work hr +me` 没返回 `employee_id` | 当前用户在 HR 库里没有员工档案(外协 / 系统账号) | 退化路径:仅用 `user_id` / `partner_id` 维度过滤;不要假设 `employee_id` 一定存在 |
110
+
111
+ ## 关联技能
112
+
113
+ - 未知字段先读对应专项 skill 文档,不做运行时字段嗅探。
114
+ - **vps-pending-approval-assistant** / **vps-okr-management-assistant** — 都默认「我=登录用户」,遇到下属/转告/部门过滤时先回到本技能确认 ID。
115
+
116
+ ---
117
+
118
+ ## Feedback protocol (mandatory before answering)
119
+
120
+ After you finish the user's task with this skill (success or partial failure),
121
+ **write exactly one feedback row** so we can improve docs and parameter schemas:
122
+
123
+ ```
124
+ POST /ai/skills/v1/feedback
125
+ {
126
+ "skill_key": "<this skill's slug>",
127
+ "severity": "warn",
128
+ "tag": "detour",
129
+ "summary": "<≤200-char one-liner in business language>",
130
+ "proposed_fix": "<optional: where to fix in SKILL.md / reference.md>"
131
+ }
132
+ ```
133
+
134
+ Severity: `info` / `warn` / `blocker`. Tag: `detour` / `missing_doc` /
135
+ `wrong_schema` / `runtime_error` / `unfit_skill` / `slow` / `other`.
136
+
137
+ Skip the call only when the task ran perfectly and matched docs exactly.
138
+ 发现口径或参数问题时,直接更新对应 skill/reference 文档。
@@ -0,0 +1,79 @@
1
+
2
+ # reference.md — 当前用户身份与组织信息
3
+
4
+ ## 1. 3 条路径技术细节
5
+
6
+ | 路径 | 实现位置 | 鉴权要求 | 返回粒度 |
7
+ |---|---|---|---|
8
+ | **`vps-work hr +me`** / `vps-work hr +me` | Vertu 服务 `/v1/auth/me` + `hr-personnel-directory` | 已登录(user 或 bot) | 全字段(user / employee / department_chain / manager) |
9
+ | Domain DSL 宏 `@me` 系列 | `vertu_addons/vt_ai_domain_dsl/services/macros.py` `expand_macro_token` | 已登录 + 装了 `vt_ai_domain_dsl` | 直接展开为 ID / list |
10
+ | `vps-work auth status --json` | 当前会话状态 | 已登录 | 仅 uid / login / auth_mode |
11
+
12
+ ## 2. `vps-work hr +me` 字段表(来自 Vertu 服务身份与 HR 人员目录)
13
+
14
+ | 字段 | 类型 | 说明 | 可能为空的情形 |
15
+ |---|---|---|---|
16
+ | `user_id` | int | `res.users.id` | 不会 |
17
+ | `login` | str | 登录名 | 不会 |
18
+ | `name` | str | 用户显示名 | 不会 |
19
+ | `email` | str | 邮箱(无邮箱时回落到 `login`) | 不会 |
20
+ | `lang` | str | 用户语言代码 | 未设语言 |
21
+ | `tz` | str | 用户时区 | 未设时区 |
22
+ | `employee_id` | int | `hr.employee.id` | 没有员工档案 / 未装 HR 模块 |
23
+ | `employee_name` | str | 员工姓名 | 同上 |
24
+ | `job_title` | str | 自由文本职位 | 字段为空 |
25
+ | `job_id` / `job_name` | int / str | 职位档案 | 字段为空 |
26
+ | `mobile_phone` / `work_email` | str | 工作联系方式 | 字段为空 |
27
+ | `department_id` | int | 当前部门 ID | 员工无部门 |
28
+ | `department_name` | str | 当前部门名 | 同上 |
29
+ | `department_chain` | string[] | 从一级部门到当前部门的名称链路 | 同上 |
30
+ | `manager_id` | int | 从员工所在部门向上解析到的最近有效部门负责人员工 ID(排除本人) | 没有可用部门负责人 |
31
+ | `manager_name` | str | 上级姓名 | 同上 |
32
+ | `manager_user_id` | int | 上级关联的 `res.users.id`(**用它做"我上级"过滤**) | 上级是无系统账号的纯员工 |
33
+ | `employment_started_at` | str | Odoo 入职日期换算的上海时区起始边界(ISO 8601) | 员工档案未维护入职日期 |
34
+ | `employment_ended_at` | str | Odoo 离职日期换算的就业有效期结束边界(ISO 8601) | 仍在职或员工档案未维护离职日期 |
35
+ | `profile_unavailable` | str | 仅当 HR 人员目录(VPS 原生 HR 档案视图)在当前环境返回 503 不可用时出现,值为服务端原因 | 正常环境不出现 |
36
+
37
+ > 当出现 `profile_unavailable` 时,`user_id` / `employee_id` / `department_id` / `department_path` / `department_chain`(按 `department_path` 拆分)仍来自平台会话且可用;`manager_*`、`job_*`、入离职日期等档案补充字段为空,不要因此重试。
38
+
39
+ ## 3. Domain DSL 宏对照表
40
+
41
+ | 宏 | 展开为 | 适用模型 / 字段类型 |
42
+ |---|---|---|
43
+ | `@me` | `env.uid`(int) | 任何 `Many2one('res.users')` 字段,例如 `sale.order.user_id` / `crm.lead.user_id` / `project.task.user_ids` |
44
+ | `@my_partner` / `@user_partner` | `env.user.partner_id.id`(int) | 任何 `Many2one('res.partner')` 字段,例如 `mail.message.author_id`、`sale.order.partner_id`(语义上"我作为联系人") |
45
+ | `@my_employee` / `@employee` | 当前 `hr.employee.id` | `hr.attendance.employee_id` / `hr.leave.employee_id` 等 |
46
+ | `@my_department` | 当前员工的 `department_id.id` | `hr.employee.department_id` / `account.analytic.account.department_id` 等;可配 `child_of` 递归 |
47
+ | `@company` | `env.company.id` | `Many2one('res.company')` |
48
+ | `@companies` | `env.companies.ids`(list) | `Many2many('res.company')` 或 `IN` 操作 |
49
+
50
+ > **缺失对应数据**时(如未配 HR 员工),DSL 编译期会抛 `DSLParseError(phase='macro')`,提示 hint:把过滤改成 `user_id = @me` 等不依赖 HR 的写法。
51
+
52
+ ## 4. PowerShell 引号规则速查
53
+
54
+ ```powershell
55
+ # 正确:外双内单(宏写进对应域命令的 domain 参数)
56
+ --domain "user_id = @me AND date_order >= @month_start"
57
+
58
+ # 错误:外单内双(CJK / 引号会被吞)
59
+ --domain '"user_id = @me"'
60
+ ```
61
+
62
+ ## 5. 反面教材回放(实际碰到过的试错链)
63
+
64
+ | LLM 错误做法 | 错误原因 | 正确做法 |
65
+ |---|---|---|
66
+ | 拿到 `employee_id` 后**直接**对 `hr.employee` 拼猜测的字段(如 `date_of_joining`)→ `Invalid field` | 把本 skill 当查询终点,字段名是猜的 | 字段只取自对应域 skill 的 `reference.md` / `references`;员工字段未知时由调用方给定或交给 HR 域 skill,不要猜字段名 |
67
+ | 凭直觉猜业务字段名而非查文档 | 字段口径未知 | 字段只取自 `skills/` 文档;缺口 `POST /ai/skills/v1/feedback` |
68
+ | `search res.users [('login','=','...')]` 找自己 | 拿不到 `login`、即便拿到也是多此一举 | 直接用 `@me` 宏或 `vps-work hr +me` |
69
+ | `domain=[('partner_id','=', uid)]` 过滤"我的订单" | 模型上 `user_id` 才是 `res.users`,`partner_id` 是客户 | `domain="user_id = @me"` |
70
+ | 先 `vps-work hr +me` 取 `department_id=17`,再 domain 写 `department_id = 17` | 失去递归子部门能力,下属团队数据漏掉 | `domain="department_id child_of @my_department"` |
71
+ | 用 `manager_id` 当过滤,期望"我上级审过的单子" | `manager_id` 是 `hr.employee.id`,不是 `res.users.id` | 用 `manager_user_id`(res.users.id);或显式 `domain="user_id = <manager_user_id>"` |
72
+ | 多公司环境只看到一个公司的数据 | 当前请求只激活了 `env.company` | `domain="company_id IN @companies"` |
73
+
74
+ ## 6. 关联
75
+
76
+ - 顶层 CLI 命令注册:`src/commands/hr/shortcuts.ts` 的 `+me`。
77
+ - 宏定义源码:`vertu_addons/vt_ai_domain_dsl/services/macros.py`。
78
+ - 极简身份:`vps-work auth status --json` 的 `uid` / `login` 字段。
79
+ - 反向查询「下属/上级链」:见 `vps-okr-management-assistant` 中的 `child_of` 递归用法。
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: vps-daily-report-assistant
3
+ description: |
4
+ 面向 Vertu 日报系统的查询与提交。用户要查每日应填未交或打卡未交日报名单、本部门日报、员工日报、自己的日报、可汇报任务、提交今日日报、管理员删除当日日报测试数据、同步日报助手卡片时使用。入口 CLI 为 `vps-work report +…`,当前提供 `+missing-daily-reports`、`+checkin-missing`、`+mine`、`+department`、`+tasks`、`+submit`、`+delete-today`、`+sync`。触发词:日报、部门日报、应填未交、未交日报、打卡未交、员工日报、我的日报、日报任务、提交日报、删除今日日报、同步日报助手、daily report。
5
+ metadata:
6
+ requires:
7
+ bins: ['vps-work']
8
+ cliHelp: 'vps-work report --help'
9
+ ---
10
+
11
+ # 日报助理(未交比对 / 员工日报 / 自助提交)
12
+
13
+ **开始前 Read [`../vps-shared/SKILL.md`](../vps-shared/SKILL.md)。**
14
+
15
+ 统一入口是 `vps-work report +…`。自助查询与提交走本项目 Vertu 服务的 `/v1/daily-report/*` REST;打卡未交比对与员工日报汇总走本项目 Vertu 服务的日报查询脚本。`+submit` 默认把日报消息写入本系统 IM 的当前用户部门组织群;只有显式传 `--legacy-push` 时才走旧 PMS/小小V IM 推送接口。
16
+
17
+ ## 何时使用
18
+
19
+ - 查每日应填但没有提交日报的名单:`+missing-daily-reports`。
20
+ - 查打卡了但没提交日报的名单:`+checkin-missing`。
21
+ - 查某员工或自己的日报记录:`+mine`。
22
+ - 查当前登录用户所在部门及子部门成员日报:`+department`。
23
+ - 查我可以填写日报的未完成研发任务:`+tasks`。
24
+ - 提交今日日报并推送当前用户部门群:`+submit`。
25
+ - 管理员删除今天的日报测试数据:`+delete-today`。
26
+ - 同步日报助手会话与今日日报卡片:`+sync`。
27
+
28
+ 用户明确说“每日应填但未提交”时使用 `+missing-daily-reports`。用户说“打卡但未交”时使用 `+checkin-missing`;后者不会把请假、出差未打卡、离职等本来不应提交的人混入。
29
+
30
+ ## 命令清单
31
+
32
+ | 命令 | 服务接口 | 说明 |
33
+ |------|----------|------|
34
+ | `+missing-daily-reports --date YYYY-MM-DD` | `GET /api/v1/tasks/tasks/export-missing-daily-reports` | 每日应填但未提交日报名单 |
35
+ | `+checkin-missing --date YYYY-MM-DD` | 日报查询脚本 `checkin_missing` | 打卡但未提交日报名单;可选 `--department-id` `--limit` |
36
+ | `+mine --user-id N --start-time YYYY-MM-DD --end-time YYYY-MM-DD` | `GET /v1/daily-report/mine` | 统一日报列表;省略 `--user-id` 时查当前登录用户,日期省略默认今天 |
37
+ | `+department --date YYYY-MM-DD --limit 500` | `GET /v1/daily-report/department` | 默认查当前用户部门树;`--department-path` 需要指定部门权限,`--all-departments` 需要全公司权限 |
38
+ | `+tasks --limit 50` | `GET /v1/daily-report/tasks` | 我的可汇报研发任务 |
39
+ | `+submit` | `POST /v1/daily-report/submit` | 提交今日日报,更新任务进度并推送本系统 IM 当前用户部门群 |
40
+ | `+delete-today --confirm` | `POST /v1/daily-report/admin/delete-today` | 管理员删除今天的日报提交记录;默认撤回本系统 IM 日报消息 |
41
+ | `+sync` | `POST /v1/daily-report/sync` | 同步日报助手会话与今日日报卡片 |
42
+
43
+ ## 提交日报
44
+
45
+ 单任务提交:
46
+
47
+ ```bash
48
+ vps-work report +submit \
49
+ --task-id 2454 \
50
+ --progress 80 \
51
+ --spent-hours 6 \
52
+ --content "今日进展" \
53
+ --tomorrow "明日计划"
54
+ ```
55
+
56
+ 多任务提交可用 `--items-json` 或 `--params` 传 `items`:
57
+
58
+ ```bash
59
+ vps-work report +submit \
60
+ --items-json '[{"task_id":2454,"progress":80,"spent_hours":3,"content":"接口联调"},{"task_id":2455,"progress":60,"spent_hours":3,"content":"问题修复"}]' \
61
+ --tomorrow "继续联调并补充测试"
62
+ ```
63
+
64
+ `items[]` 元素字段:
65
+
66
+ | 字段 | 说明 |
67
+ |------|------|
68
+ | `task_id` | PMS 任务数字 ID |
69
+ | `progress` | 目标进度,0-100,必须高于当前进度 |
70
+ | `spent_hours` | 今日投入小时数,(0, 24] |
71
+ | `content` | 今日工作内容;多行会拆成多条进度 |
72
+
73
+ 可选字段:
74
+
75
+ | 字段 | 说明 |
76
+ |------|------|
77
+ | `im_channel_id` | 本系统 IM 会话 id;省略时优先推送当前用户所在的日报群,没有日报群时按当前用户部门路径复用或创建组织群 |
78
+ | `legacy_push` | 设为 `true` 时改走旧 PMS/小小V IM 推送接口;默认 `false` |
79
+ | `channel_id` | 旧 IM channel_id;仅 `legacy_push=true` 时有效 |
80
+ | `chat_group_name` | 旧 IM 群名称;仅 `legacy_push=true` 时有效 |
81
+
82
+ ## 管理员删除今日日报
83
+
84
+ 用于测试当日日报提交。只允许管理员执行,且必须显式传 `--confirm`:
85
+
86
+ ```bash
87
+ vps-work report +delete-today --confirm
88
+ ```
89
+
90
+ 默认行为:
91
+
92
+ | 项 | 说明 |
93
+ |----|------|
94
+ | 删除对象 | 当前登录用户今天的 `daily_report_push_records` |
95
+ | 本系统 IM | 撤回当前用户今天由 `+submit` 发出的本系统 IM 日报消息 |
96
+ | 任务进度 | 默认不删除任务进度记录,不回滚任务当前 progress |
97
+
98
+ 可选项:
99
+
100
+ | 参数 | 说明 |
101
+ |------|------|
102
+ | `--user-id N` | 管理员指定要删除日报的用户;省略为当前登录用户 |
103
+ | `--with-progress` | 同时删除日报 payload 中引用的今日任务进度,并按剩余进度记录回算任务 progress;测试重放时才使用 |
104
+ | `--keep-im-message` | 不撤回本系统 IM 日报消息 |
105
+
106
+ ## 工作流
107
+
108
+ 1. 用户问“每日应填但谁没交日报”时,用 `vps-work report +missing-daily-reports --date YYYY-MM-DD`;用户明确说“打卡没写日报”时用 `+checkin-missing`。日期缺失先确认或按自然语言解析。
109
+ 2. 用户查询自己的日报时用 `vps-work report +mine`;查询本部门成员日报时用 `vps-work report +department --date YYYY-MM-DD`;管理员点名查某员工时传 `--user-id`。
110
+ 3. 用户要填日报但没给任务 ID 时,先用 `vps-work report +tasks --limit 50` 列出可汇报任务。
111
+ 4. 提交日报前检查 `task_id`、`progress`、`spent_hours`、`content`、`tomorrow` 是否齐全;信息不全先追问。
112
+ 5. 用户要“删除今天的日报/重测提交”时,仅管理员可用 `vps-work report +delete-today --confirm`;除非明确要求重放进度,否则不要加 `--with-progress`。
113
+ 6. 提交后如需要刷新卡片,调用 `vps-work report +sync`。
114
+ 7. 输出时先说明结论,再列日期、人员、部门、任务 ID、项目、进度等关键字段。
115
+
116
+ ## 硬约束
117
+
118
+ - 以 `vps-work report --help` 列出的命令为准。
119
+ - `+missing-daily-reports` 是“每日应填但未交”口径;`+checkin-missing` 是“打卡但未交”口径,二者不可混用。
120
+ - `+mine` 的 `--user-id` 是 `res.users.id`,仅管理员可查询其他用户;姓名解析不在本命令内完成。
121
+ - `+department` 默认范围由当前登录用户决定;`--department-path` 需要 `daily_report.departments.selected:read`,`--all-departments` 需要 `daily_report.departments.all:read`,两者不能同时使用。
122
+ - `task_id` 是 PMS 任务数字 ID,不是 task-center UUID。
123
+ - `+delete-today` 是管理员测试命令,必须带 `--confirm`;默认不删除任务进度,`--with-progress` 只在明确需要重放提交进度时使用。
124
+ - 写操作前若用户意图不明确或字段缺失,先确认再提交。
125
+ - 日期参数使用 `YYYY-MM-DD`。
126
+
127
+ ## 常见场景
128
+
129
+ ```bash
130
+ # 查某天每日应填但未提交日报名单
131
+ vps-work report +missing-daily-reports --date 2026-07-13
132
+
133
+ # 查某天打卡但未提交日报名单
134
+ vps-work report +checkin-missing --date 2026-06-19
135
+
136
+ # 查某员工本月日报(管理员)
137
+ vps-work report +mine --user-id 12837 --start-time 2026-06-01 --end-time 2026-06-19
138
+
139
+ # 查我本月日报
140
+ vps-work report +mine --start-time 2026-06-01 --end-time 2026-06-19
141
+
142
+ # 查本部门及子部门成员某天日报
143
+ vps-work report +department --date 2026-06-19
144
+
145
+ # 查指定其他部门(需要指定部门权限)
146
+ vps-work report +department --date 2026-06-19 --department-path "销售中心 / 华东区"
147
+
148
+ # 查所有部门(需要全公司权限)
149
+ vps-work report +department --date 2026-06-19 --all-departments
150
+
151
+ # 查可汇报任务
152
+ vps-work report +tasks --limit 50
153
+
154
+ # 同步日报助手卡片
155
+ vps-work report +sync
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Feedback protocol (mandatory before answering)
161
+
162
+ After you finish the user's task with this skill (success or partial failure),
163
+ **write exactly one feedback row** so we can improve docs and parameter schemas:
164
+
165
+ ```
166
+ POST /ai/skills/v1/feedback
167
+ {
168
+ "skill_key": "<this skill's slug>",
169
+ "severity": 'warn',
170
+ "tag": 'detour',
171
+ "summary": '<≤200-char one-liner in business language>',
172
+ "proposed_fix": '<optional: where to fix in SKILL.md / reference.md / schema>'
173
+ }
174
+ ```
175
+
176
+ Severity: `info` / `warn` / `blocker`. Tag: `detour` / `missing_doc` /
177
+ `wrong_schema` / `runtime_error` / `unfit_skill` / `slow` / `other`.
178
+
179
+ Skip the call only when the task ran perfectly and matched docs exactly.
180
+ 发现口径或参数问题时,直接更新对应 skill/reference 文档。
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: vps-daily-sales-report
3
+ description: |
4
+ 公司级全部门销售总览,含销售额/销量、新老客销售占比、环比/同比、商品系列周月趋势、IOT 商品页订单数、已对账销售收款明细、销售单开票申请状态、正式发票、会计凭证与付款状态、含/不含代理折扣、最新组织渠道、高定销售、智能穿戴、大折叠黄金3/黄金4/金钻、部门目标达成率。支持任意时间窗口(CLI: period 枚举或 YYYY-MM-DD、--start-date/--end-date;execute/API: start_date/end_date),数据基于代码化销售行口径 + 管理端同源的部门目标,通过 `vps-work sales +…` 取数。本技能面向公司全部门汇总,并有新客/老客结构、环比/同比/目标达成。触发词:总销日报、公司日销、日报、今日销售、本月销售、已对账收款、销售收款明细、申请开票、开票状态、开票审批、正式发票、会计凭证、付款状态、商品趋势、IOT、商品订单数、商品折扣、含代理、不含代理、高定、智能穿戴、大折叠、黄金3、黄金4、金钻、新客销售、上月、上周、环比、同比、部门达成率、全部门销售。
5
+ ---
6
+
7
+ # 公司总销日报
8
+
9
+ # 公司总销日报
10
+
11
+ ## 何时使用
12
+
13
+ 用户要查公司级全部门销售总览:今日/本月/上月/任意时间段销售额/量、部门排名、环比同比、目标达成。销售实际走代码化销售行口径,部门目标默认来自管理端“部门业绩目标”同源的 `部门OKR_1`,统一通过 `vps-work sales +…` 取数。
14
+
15
+ ## 业绩口径
16
+
17
+ 下列脚本**默认不含定金**:`LEFT JOIN mv_product` 过滤 `"定金"='是'` 的 SKU:
18
+
19
+ - `headline_kpi` / `dept_breakdown` / `customer_sales_mix` / `dept_comparison` / `dept_target_achievement` / `monthly_daily_trend` / `employee_ranking_top_bottom`
20
+ - `refund_summary`(业绩侧退款,剔除定金退款)
21
+
22
+ 需含定金口径时显式传 `include_deposit=true`。`with_without_deposit_breakdown` 本身双口径展示。
23
+
24
+ ## 公司OKR计算规则
25
+
26
+ - **公司OKR = 所有部门OKR之和**:默认汇总 `部门OKR_1`,与管理端“部门业绩目标”页面一致;不传 dept_l1 时默认涵盖所有公司
27
+ - **零销售部门仍计入公司OKR**:`sales_amount=0` 且 `target_amount>0` 的部门不能被静默排除;公司整体目标必须对全部目标行求和
28
+ - **Postgres 新表用于核对**:需要检查迁移后的部门目标数据时显式传 `--okr-source postgres` / `okr_source=postgres`
29
+ - **达成率** = 实际销额 / 期间目标 × 100
30
+
31
+ ## 工作流
32
+
33
+ 1. **澄清** — 时间窗口(CLI 用 `--period` 枚举/日期或 `--start-date`/`--end-date`)、部门层级(一级/二级/三级/四级)、聚合维度
34
+ 2. **选择脚本** — 对照 reference.md 脚本一览表选择:headline_kpi / dept_breakdown / customer_sales_mix / dept_comparison / dept_target_achievement / order_finance / sales_invoice_status / reconciled_sales_receipts / with_without_deposit_breakdown / refund_summary / service_dept_sales_summary
35
+ 3. **执行** — 使用 `vps-work sales +headline-kpi` / `+dept-breakdown` / …(见 `reference.md`);复杂参数用各快捷上的 `--params` 或 `--params-file` 合并 JSON。
36
+ 4. **解读** — 先给核心数字(窗口总额 + 环比/同比),再列部门 Top N
37
+
38
+ 商品销售必须使用精确维度:大折叠=`product_subcategory=VERTU ALPHAFOLD`,高定=`product_style=高定`,黄金3/黄金4/金钻=`product_style_details`;智能穿戴使用 `smart_wearable=true`。不得用商品名模糊搜索代替聚合口径。
39
+
40
+ 用户说“全公司渠道/最新架构”时使用 `group_by=org_channel`;周/月趋势使用 `monthly_daily_trend` 的 `grain=week/month`,款式明细加 `breakdown_by=product_style1`。
41
+
42
+ IOT 用 `product_category=IOT配件`,分类包含手链。`monthly_daily_trend` 的 `orders` 是去重销售单数,`product_order_count` 才是与 vps-ep 商品页一致的销售/分摊明细行数;折扣同时返回 `incl_agent` / `excl_agent`,均排除置换。完整字段公式读取 `vps-product`。
43
+
44
+ ## 时间窗口(统一约定)
45
+
46
+ 所有脚本统一接受下列时间参数(优先级由高到低):
47
+
48
+ 1. `--start-date` + `--end-date`(YYYY-MM-DD,闭区间;execute/API 为 `start_date` + `end_date`)— 完全自定义
49
+ 2. `--period YYYY-MM-DD` 或单独 `--start-date YYYY-MM-DD` — 单日查询
50
+ 2. `period` 枚举 — `today / yesterday / this_week / last_week / this_month / last_month / this_quarter / last_quarter / this_year / last_year / last_n_days / custom`
51
+ 3. `days`(仅当 `period=last_n_days` 时使用)
52
+ 4. 默认 `this_month`
53
+
54
+ `period=custom` 必须同时提供 CLI `--start-date` 与 `--end-date`(execute/API 为 `start_date` 与 `end_date`),否则报错。
55
+
56
+ ## 部门过滤(统一约定)
57
+
58
+ 所有脚本统一接受 `dept_l1 / dept_l2 / dept_l3 / dept_l4 / dept_l5`,全部可选,按 AND 拼接。空串等同于不过滤。
59
+
60
+ 不要使用 `dept`、`department`、`dept_name`、`department_name` 表示销售部门;这些字段无法区分一级/二级/三级/四级部门,服务端会拒绝。用户只说“部门”时,先确认层级或用组织结构查询定位。
61
+
62
+ ## 硬约束
63
+
64
+ - **中文标识符双引号**:销售结果中的 `"销售日期"`、`"一级部门"` 等中文字段按 PostgreSQL 规则处理
65
+ - **取数走 CLI 封装**:脚本通过 `vps-work sales +…` 直连规范视图执行,无需手写连接
66
+ - **行数控制**:可在 SQL 内自由使用 `LIMIT n`、`LIMIT n OFFSET m`、`OFFSET m LIMIT n`、`LIMIT %s`、`FETCH FIRST n ROWS ONLY` 等任一标准写法;若末尾未写,服务端按 `default_sql_limit`(500)追加默认上限,并以 `max_sql_rows`(2000)做硬截断兜底
67
+ - **OKR JOIN 必须先缩销售**:禁止目标明细直连未聚合销售行;必须先按 部门 × 月份 聚合销售,再与目标合并
68
+ - **列表必须翻页**:返回 `pagination.has_more=true` 时,用 `page=next_page` 继续查询,不能把第一页 `rows` 当全量
69
+ - **排除项必须披露**:凡使用默认或显式排除(包括不含定金、部门/人员/商品过滤、仅保留有实绩行),回答必须逐项说明;分页、Top N、权限范围造成的非全量覆盖也必须说明。若计算排除后指标,必须同时给出排除项及排除前后的口径,不能把它称为未加限定的“公司整体”。
70
+
71
+ ## 常见坑点
72
+
73
+ | 现象 | 根因 | 正确做法 |
74
+ |------|------|---------|
75
+ | 环比/同比为空 | 上期/去年同期数据不存在(新部门) | 脚本用 COALESCE 处理 NULL,展示时标注"无同期数据" |
76
+ | 目标达成率异常高/低 | `部门OKR_1` 目标部门名与销售匹配部门不一致 | 先查 `+dept-monthly-okr` 核对管理端同源目标;必要时用 `--okr-source postgres` 对比迁移后的新表 |
77
+ | 部门销售为空 | 使用了 `匹配部门` 而非 `一级部门` | odoo_sale 视图直接用 `一级部门`~`四级部门` |
78
+ | `period=custom` 报错 | 必填 `--start-date/--end-date`(execute/API: `start_date/end_date`) | 同时提供两个日期,或者改用枚举 period / `--period YYYY-MM-DD` |
79
+
80
+ ## 关联技能
81
+
82
+ - **vps-sale-personnel-efficiency** — 人效 / 个人业绩 / 个人 OKR / PK 榜
83
+ - **sale-performance-query** — 销售业绩聚合入口
84
+
85
+ ---
86
+
87
+ ## Extension fallback path (when current shortcuts don't cover the question)
88
+
89
+ If none of this skill's `vps-work sales +…` shortcuts answers the user's question,
90
+ **do not fabricate a query path**:
91
+
92
+ 1. 取数只走 CLI 封装:用本 skill `reference.md` / `references/*.md` 已列的 `vps-work sales +…`
93
+ 快捷命令;高级参数走 `--params` 或 `/v1/execute` 的 `script_key`。
94
+
95
+ 2. 嵌在本 skill 脚本里的销售行、商品定金与 Postgres OKR 目标源承载了规范业务口径;
96
+ 不要绕过封装自行拼接原始字段,以免丢失校准。
97
+
98
+ 3. 字段 / 模型 / 业务实体语义只取自本 skill 的 `reference.md` / `references/*.md`、`skills/` 下兄弟
99
+ skill,或 `vps-work sales +…` 快捷命令。缺口 → `POST /ai/skills/v1/feedback`。
100
+
101
+
102
+ ---
103
+
104
+ ## Feedback protocol (mandatory before answering)
105
+
106
+ After you finish the user's task with this skill (success or partial failure),
107
+ **write exactly one feedback row** so we can improve docs and parameter schemas:
108
+
109
+ ```
110
+ POST /ai/skills/v1/feedback
111
+ {
112
+ "skill_key": "<this skill's slug>",
113
+ "severity": 'warn',
114
+ "tag": 'detour',
115
+ "summary": '<≤200-char one-liner in business language>',
116
+ "proposed_fix": '<optional: where to fix in SKILL.md / reference.md / schema>'
117
+ }
118
+ ```
119
+
120
+ Severity: `info` / `warn` / `blocker`. Tag: `detour` / `missing_doc` /
121
+ `wrong_schema` / `runtime_error` / `unfit_skill` / `slow` / `other`.
122
+
123
+ Skip the call only when the task ran perfectly and matched docs exactly.
124
+ 发现口径或参数问题时,直接更新对应 skill/reference 文档。