dsh-offhours 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -26,9 +26,12 @@ npx dsh-offhours init --repo . --name myapp
26
26
  # 2) 体检(依赖、路径、worker 权限)
27
27
  npx dsh-offhours doctor
28
28
 
29
- # 3) 建一张卡(自动盖当前会话;没有 session 的卡跑批不会捡)
29
+ # 3) 建一张卡(必须在 dsh 会话里,或显式传当前会话 id)
30
+ # 最省事:在 dsh 里对 agent 说「用 offhours 技能建一张卡:给登录页补错误提示」。
31
+ # 终端命令需要带 --session;没有 sourceSessionId 的卡跑批永远不会捡。
30
32
  npx dsh-offhours card add "给登录页补错误提示" \
31
- --summary "目标:登录失败有提示。判据:npm test 通过。不做什么:不改后端。"
33
+ --summary "目标:登录失败有提示。判据:npm test 通过。不做什么:不改后端。" \
34
+ --session <当前 dsh 会话 id>
32
35
  ```
33
36
 
34
37
  之后低谷时段自动跑;也可以用面板「立即跑」或 `npx dsh-offhours run --once`。
@@ -70,7 +73,7 @@ npx dsh-offhours card add "给登录页补错误提示" \
70
73
  |---|---|
71
74
  | `npx dsh-offhours init --repo .` | 初始化配置/看板/特性 |
72
75
  | `npx dsh-offhours doctor` | 依赖与权限体检(失败退出非 0) |
73
- | `npx dsh-offhours card add "<标题>" --summary "<目标/判据/边界>"` | 建卡并盖章当前会话 |
76
+ | `npx dsh-offhours card add "<标题>" --summary "<目标/判据/边界>" [--session <id>]` | 建卡并盖章会话(无 session 不会跑) |
74
77
  | `npx dsh-offhours card list` | 列卡 |
75
78
  | `npx dsh-offhours run --once` / `--dry-run` | 手动跑一轮 / 只看会挑哪张 |
76
79
  | `npx dsh-offhours status` | 看板计数、心跳、最近状态(JSON) |
package/bin/offhours.mjs CHANGED
@@ -198,14 +198,17 @@ function cmdCard(args, flags) {
198
198
  if (sub !== 'add') die('用法:offhours card add "<标题>" --summary "..."')
199
199
  const title = args.slice(1).join(' ').trim()
200
200
  if (!title) die('card add 需要一个标题')
201
- const pyArgs = [nsPy(cfg), 'card-add', board.file, title,
202
- '--session', String(flags.session || process.env.DSH_SESSION_ID || ''),
203
- ]
201
+ const sessionId = String(flags.session || process.env.DSH_SESSION_ID || '')
202
+ if (!sessionId && !flags['allow-no-session']) {
203
+ die('缺少会话 id:在 dsh 会话里运行,或显式加 --session <sessionId>。\n' +
204
+ '没有 sourceSessionId 的卡不会被跑批捡起;确需建无主卡(只人工看)时加 --allow-no-session。')
205
+ }
206
+ const pyArgs = [nsPy(cfg), 'card-add', board.file, title, '--session', sessionId]
204
207
  for (const k of ['summary', 'description', 'rationale', 'rejected', 'tags', 'status', 'run-timeout']) {
205
208
  if (flags[k] !== undefined) pyArgs.push(`--${k}`, String(flags[k]))
206
209
  }
207
210
  if (flags['no-explain']) pyArgs.push('--no-explain')
208
- const env = { ...process.env, DSH_SESSION_ID: String(flags.session || process.env.DSH_SESSION_ID || '') }
211
+ const env = { ...process.env, DSH_SESSION_ID: sessionId }
209
212
  const r = spawnSync('python3', pyArgs, { env, encoding: 'utf8' })
210
213
  process.stdout.write(r.stdout || '')
211
214
  process.stderr.write(r.stderr || '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-offhours",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "DSH 社区插件:把看板待办在低谷/夜间自动做掉(挑卡 → 独占 worktree → worker → 证据 → 合并回收),只依赖配置里的 git 仓库。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,6 +22,7 @@ npx dsh-offhours card add "<标题>" --summary "<目标 + 判据(命令) + 涉
22
22
 
23
23
  - 必须在 dsh 会话里执行:它会用 `DSH_SESSION_ID` 盖章 `sourceSessionId`;
24
24
  - CLI 没进全局 PATH:统一用 `npx dsh-offhours ...`(或 profile 里的 `node_modules/.bin/offhours`)。
25
+ - 不在 dsh 会话里时,`card add` 必须加 `--session <id>`;无 session 的卡不会被跑批捡。
25
26
  **没有 sourceSessionId 的卡跑批永远不会捡**(不是 bug,是隔离要求)。
26
27
  - 用 dsh-kanban 的 `board_add` 建的卡不带 session,只适合人工看板,不适合跑批。
27
28
  - 判据必须是命令,不是形容词;一张卡 = 一个可独立合并的成果。