weekly-cockpit 0.3.1 → 0.3.2

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 CHANGED
@@ -16,6 +16,8 @@ description: 部门周报驾驶舱编辑能力 Skill——本地 Agent 通过 we
16
16
  ## 能力发现(唯一事实源)
17
17
  `weekly-cockpit capabilities --json` 返回全部契约(命令/端点/风险级/幂等/输入字段)。**先发现后使用,不凭记忆猜命令。**
18
18
 
19
+ 版本/探活:`weekly-cockpit health`(零凭证可用,返回服务端 `{status, version, time}`——排查「线上跑的哪个版本」不需要登录)。
20
+
19
21
  ## 常用工作流
20
22
  - 看现状:`ledger show --json`——输出含每行 `version`,后续编辑必须带 `--base-version`
21
23
  - 改项目:`project edit 01.01.01 --status 阻塞 --base-version 3`
package/api.js CHANGED
@@ -28,9 +28,11 @@ export async function resolveToken(env) {
28
28
  export async function callApi({ method, path, body, env = process.env, token }) {
29
29
  const base = resolveBase(env);
30
30
  if (!base) throw new ApiFail('USAGE', '缺少服务端地址:设 COCKPIT_API_URL 或先 weekly-cockpit login', 2);
31
- // token: null = 显式无凭证(login / Z2 换发自身);undefined = 走 resolveToken 三档解析
31
+ // token: null = 显式无凭证(login / Z2 换发自身 / health 探活);undefined = 走 resolveToken 三档解析
32
32
  const t = token !== undefined ? token : await resolveToken(env);
33
- if (!t && path !== '/api/v1/auth/token') throw new ApiFail('USAGE', '缺少凭证:weekly-cockpit login,或设 COCKPIT_TOKEN / COCKPIT_USERNAME+COCKPIT_PASSWORD', 2);
33
+ // 无鉴权路径(探活/换发):凭证缺失不拦——health 语义本就是零凭证可达
34
+ const PUBLIC_PATHS = new Set(['/api/v1/auth/token', '/api/health']);
35
+ if (!t && !PUBLIC_PATHS.has(path)) throw new ApiFail('USAGE', '缺少凭证:weekly-cockpit login,或设 COCKPIT_TOKEN / COCKPIT_USERNAME+COCKPIT_PASSWORD', 2);
34
36
  // I4 终审:本次凭证来自 Z2 中间档换发(token 未显式给定、账号密码在场且无直连 token)→
35
37
  // 主调用结束后(finally 语义,成败皆回收)best-effort DELETE 该换发 token——90 天长效凭证
36
38
  // 不能每条命令泄漏一枚。回收失败静默忽略,不得掩主结果/主错误。
package/commands.js CHANGED
@@ -44,6 +44,8 @@ export const COMMANDS = {
44
44
  } },
45
45
  'whoami': { run: ({ env }) => callApi({ method: 'GET', path: '/api/v1/auth/whoami', env }) },
46
46
  'capabilities': { run: ({ env }) => callApi({ method: 'GET', path: '/api/v1/capabilities', env }) },
47
+ // 运维探活:零凭证可用(服务端公开端点);不入 CAPABILITIES 编辑能力清单(consistency 测试豁免)
48
+ 'health': { run: ({ env }) => callApi({ method: 'GET', path: '/api/health', env, token: null }) },
47
49
  'ledger show': { run: ({ flags, env }) => callApi({ method: 'GET', path: `/api/v1/ledger${flags.board ? `?board=${encodeURIComponent(String(flags.board))}` : ''}`, env }) },
48
50
  'audit list': { run: ({ flags, env }) => {
49
51
  const q = new URLSearchParams();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weekly-cockpit",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "部门周报驾驶舱 CLI:读写台账(板块/方向/项目/目标)、垃圾箱与撤销,供 Agent 通过 /api/v1 安全编辑",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",