weekly-cockpit 0.3.9 → 0.3.11
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/SKILL.md +1 -0
- package/commands.js +10 -0
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -27,6 +27,7 @@ description: 部门周报驾驶舱编辑能力 Skill——本地 Agent 通过 we
|
|
|
27
27
|
- 排序:`project reorder 01.01.01 --up --base-version 3`(`--down` 同理;direction/board reorder 同构)
|
|
28
28
|
- 删除=进垃圾箱:`project delete 01.01.01`;找回:`trash list` → `trash restore project 01.01.01`(父方向若在箱会自动出箱)
|
|
29
29
|
- 审计:`audit list --limit 50`(翻页用返回的 `next_cursor`)
|
|
30
|
+
- 周报更新(每周期一次):解析周报 xlsx 生成 JSON `{staff, periodStart, periodEnd, sourceFile, items:[{name, status, progress:[…], projectCodes:[…]}]}` → `weekly-cockpit report import --file <json>`。同人同周期重复导入=**覆盖更新**(对应「更新版」场景);`projectCodes` 校验台账未删项目(不存在 400 带纠正建议);空 codes 的事项计「台账外」;xlsx 原文件不存服务端
|
|
30
31
|
|
|
31
32
|
## 风险与批准(L2)
|
|
32
33
|
`trash clear --confirm` 与 `undo --confirm`(**单步**;连续撤销=多次调用)为 L2:默认交人确认后再加 `--confirm`;undo 只撤**本人**栈顶一步(栈深 5)且带版本守卫——他人插写会 409;链被打断后更早还原点可能失效(fail-closed,重新 show 后重做)。
|
package/commands.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { callApi } from './api.js';
|
|
2
2
|
import { readConfig, writeConfig } from './config.js';
|
|
3
3
|
import readline from 'node:readline/promises';
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
4
5
|
|
|
5
6
|
const str = (v) => (v === undefined || v === true ? undefined : String(v));
|
|
6
7
|
const num = (v) => (v === undefined || v === true ? undefined : Number(v));
|
|
@@ -72,6 +73,15 @@ export const COMMANDS = {
|
|
|
72
73
|
'goal delete': { run: ({ p, env }) => callApi({ method: 'DELETE', path: `/api/v1/ledger/goals/${p[0]}`, env }) },
|
|
73
74
|
'report-item delete': { run: ({ p, env }) => callApi({ method: 'DELETE', path: `/api/v1/ledger/report-items/${p[0]}`, env }) },
|
|
74
75
|
'report-item restore': { run: ({ p, env }) => callApi({ method: 'POST', path: `/api/v1/ledger/report-items/${p[0]}/restore`, env }) },
|
|
76
|
+
// 周报导入(用户定调 2026-11-10:动作写入走 CLI,不再 SQL 直插;xlsx 原文件不存)
|
|
77
|
+
'report import': { async run({ flags, env }) {
|
|
78
|
+
const file = str(flags.file);
|
|
79
|
+
if (!file) throw Object.assign(new Error('report import 需 --file <json>(内容:staff/periodStart/periodEnd/items[],每条 item 含 name/status/progress[]/projectCodes[])'), { exit: 2 });
|
|
80
|
+
let body;
|
|
81
|
+
try { body = JSON.parse(readFileSync(file, 'utf8')); }
|
|
82
|
+
catch (e) { throw Object.assign(new Error(`--file 读取/解析失败:${e.message}`), { exit: 2 }); }
|
|
83
|
+
return callApi({ method: 'POST', path: '/api/v1/reports/import', body, env });
|
|
84
|
+
} },
|
|
75
85
|
'trash list': { run: ({ env }) => callApi({ method: 'GET', path: '/api/v1/ledger/trash', env }) },
|
|
76
86
|
'trash restore': { run: ({ p, env }) => callApi({ method: 'POST', path: `/api/v1/ledger/trash/${p[0]}/${p[1]}/restore`, env }) },
|
|
77
87
|
'trash clear': { l2: true, run: ({ env }) => callApi({ method: 'DELETE', path: '/api/v1/ledger/trash', body: { confirm: true }, env }) },
|