dsh-compound-engineering 0.1.1 → 0.1.3

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 (29) hide show
  1. package/README.md +4 -3
  2. package/README.zh.md +4 -3
  3. package/docs/releasing.md +361 -0
  4. package/package.json +4 -2
  5. package/skills/ce-babysit-pr/scripts/pr-snapshot +0 -0
  6. package/skills/ce-brainstorm/scripts/elevation-dispatch.sh +0 -0
  7. package/skills/ce-code-review/scripts/cross-model-adversarial-review.sh +0 -0
  8. package/skills/ce-compound/scripts/session-history/discover-sessions.sh +0 -0
  9. package/skills/ce-doc-review/scripts/cross-model-doc-review.sh +0 -0
  10. package/skills/ce-optimize/scripts/experiment-worktree.sh +0 -0
  11. package/skills/ce-optimize/scripts/measure.sh +0 -0
  12. package/skills/ce-optimize/scripts/parallel-probe.sh +0 -0
  13. package/skills/ce-plan/scripts/elevation-dispatch.sh +0 -0
  14. package/skills/ce-polish/scripts/detect-project-type.sh +0 -0
  15. package/skills/ce-polish/scripts/detect-riffrec.sh +0 -0
  16. package/skills/ce-polish/scripts/read-launch-json.sh +0 -0
  17. package/skills/ce-polish/scripts/resolve-package-manager.sh +0 -0
  18. package/skills/ce-polish/scripts/resolve-port.sh +0 -0
  19. package/skills/ce-pov/scripts/cross-model-pov.sh +0 -0
  20. package/skills/ce-resolve-pr-feedback/scripts/get-pr-comments +0 -0
  21. package/skills/ce-resolve-pr-feedback/scripts/get-thread-for-comment +0 -0
  22. package/skills/ce-resolve-pr-feedback/scripts/reply-to-pr-thread +0 -0
  23. package/skills/ce-resolve-pr-feedback/scripts/resolve-pr-thread +0 -0
  24. package/skills/ce-setup/scripts/check-health +0 -0
  25. package/skills/ce-test-browser/scripts/resolve-port.sh +0 -0
  26. package/skills/ce-work/scripts/cross-model-work.sh +0 -0
  27. package/skills/ce-compound/scripts/session-history/__pycache__/dsh_session.cpython-314.pyc +0 -0
  28. package/skills/ce-work/scripts/__pycache__/unit_workspace_jobs.cpython-314.pyc +0 -0
  29. package/skills/ce-work/scripts/__pycache__/unit_workspace_state.cpython-314.pyc +0 -0
package/README.md CHANGED
@@ -39,7 +39,7 @@ Or do it by hand: add the dependency to the profile's `package.json`, then list
39
39
 
40
40
  ```jsonc
41
41
  {
42
- "dependencies": { "dsh-compound-engineering": "^0.1.0" },
42
+ "dependencies": { "dsh-compound-engineering": "^0.1.1" },
43
43
  "dsh": { "profile": { "bundles": ["dsh-compound-engineering"] } }
44
44
  }
45
45
  ```
@@ -103,11 +103,12 @@ Upstream targets 14 hosts including Claude Code. The port does this:
103
103
 
104
104
  ```bash
105
105
  npm test # JS unit + integration, then the Python suites
106
- npm run test:smoke # three layers: provider / registry / plugin lifecycle
107
106
  npm run test:py # Python suites only (session reader, Windows compat)
108
107
  ```
109
108
 
110
- Integration tests need to find a DSH runtime: they import by package name first, then scan `~/.dsh/runtime/versions/*`. Point `DSH_RUNTIME` at it to override.
109
+ Integration tests need to find a DSH runtime: they import by package name first, then scan `~/.dsh/runtime/versions/*`. Point `DSH_RUNTIME` at it to override. When no runtime is found the whole group is skipped rather than failed.
110
+
111
+ Releasing is tag-driven: pushing a `v*` tag runs `.github/workflows/publish.yml`, which publishes through npm's OIDC trusted publisher (no local OTP, no stored token). See [docs/releasing.md](docs/releasing.md) for the full procedure and the failure modes already hit.
111
112
 
112
113
  After pulling in upstream changes, re-run the two idempotent patch scripts:
113
114
 
package/README.zh.md CHANGED
@@ -39,7 +39,7 @@ dsh plugin --profile web add dsh-compound-engineering
39
39
 
40
40
  ```jsonc
41
41
  {
42
- "dependencies": { "dsh-compound-engineering": "^0.1.0" },
42
+ "dependencies": { "dsh-compound-engineering": "^0.1.1" },
43
43
  "dsh": { "profile": { "bundles": ["dsh-compound-engineering"] } }
44
44
  }
45
45
  ```
@@ -103,11 +103,12 @@ dsh plugin --profile web add dsh-compound-engineering
103
103
 
104
104
  ```bash
105
105
  npm test # JS 单元 + 集成测试,随后跑 Python 测试
106
- npm run test:smoke # 三层冒烟:provider / registry / 插件生命周期
107
106
  npm run test:py # 只跑 Python 测试(会话读取器、Windows 兼容)
108
107
  ```
109
108
 
110
- 集成测试需要能找到 DSH 运行时。默认从包名 import,失败则扫描 `~/.dsh/runtime/versions/*`;也可以用 `DSH_RUNTIME` 指过去。
109
+ 集成测试需要能找到 DSH 运行时。默认从包名 import,失败则扫描 `~/.dsh/runtime/versions/*`;也可以用 `DSH_RUNTIME` 指过去。找不到运行时时整组跳过,不会报失败。
110
+
111
+ 发版由 tag 驱动:推送 `v*` tag 会触发 `.github/workflows/publish.yml`,走 npm 的 OIDC trusted publisher 发布(无需本地 OTP、不在仓库里存 token)。完整流程与已踩过的坑见 [docs/releasing.md](docs/releasing.md)。
111
112
 
112
113
  改上游技能后,重新跑这两个幂等补丁脚本:
113
114
 
@@ -0,0 +1,361 @@
1
+ # 发版与推送流程
2
+
3
+ > 本文记录 `dsh-compound-engineering` 的完整发布链路。踩过的坑都写进来了,
4
+ > 遇到异常先来这里对照,不要凭直觉重试。
5
+
6
+ ## 0. 一页速查
7
+
8
+ ```bash
9
+ cd /e/project/dsh-compound-engineering
10
+
11
+ npm version patch --no-git-tag-version # 0.1.2 → 0.1.3
12
+ git commit -am "chore: 0.1.3"
13
+ git tag v0.1.3
14
+ git push origin main
15
+ git push origin v0.1.3 # 关键:tag 必须单独推
16
+ ```
17
+
18
+ 推完去看 <https://github.com/zzzhangy/dsh-compound-engineering/actions>,
19
+ `publish` workflow 跑绿即发版完成。
20
+
21
+ **`git push origin main` 不会带上 tag。** 忘了这一条,Actions 会显示
22
+ “This workflow has no runs yet”,很多人误以为 workflow 没配好。
23
+
24
+ ---
25
+
26
+ ## 1. 前置条件(只需配一次)
27
+
28
+ ### 1.1 npm 侧:登记 Trusted Publisher
29
+
30
+ <https://www.npmjs.com/package/dsh-compound-engineering/access> → **Trusted Publisher**
31
+
32
+ | 字段 | 值 |
33
+ | --- | --- |
34
+ | Publisher | GitHub Actions |
35
+ | Organization or user | `zzzhangy` |
36
+ | Repository | `dsh-compound-engineering` |
37
+ | Workflow filename | `publish.yml`(只填文件名,不要带 `.github/workflows/` 路径) |
38
+ | Environment name | 留空 |
39
+
40
+ Allowed actions 两个都勾:**Allow npm publish**、**Allow npm dist-tag**。
41
+
42
+ 配好后状态是 `Pending validation` —— **必须成功发布一次才会转正**。
43
+ npm 给的期限是配置后 7 天内。
44
+
45
+ ### 1.2 npm 侧:收紧发布策略
46
+
47
+ 同一个 Settings 页面的 **Publishing access**,选:
48
+
49
+ > Require two-factor authentication **and disallow bypass 2fa tokens**
50
+
51
+ 理由见 §4.1。改完点 **Update Package Settings**。
52
+
53
+ ### 1.3 仓库侧:workflow 文件存在
54
+
55
+ `.github/workflows/publish.yml` 必须在**默认分支**上,且文件名与 npm 后台
56
+ 填的完全一致(`publish.yml`)。OIDC 校验失败时 npm 的报错很模糊,通常是这里错了。
57
+
58
+ ---
59
+
60
+ ## 2. 发版步骤详解
61
+
62
+ ### 2.1 升版本号
63
+
64
+ ```bash
65
+ npm version patch --no-git-tag-version
66
+ ```
67
+
68
+ 用 `--no-git-tag-version` 是因为我们**想自己控制 tag 的创建时机和注解**。
69
+ `patch` / `minor` / `major` 按改动性质选。
70
+
71
+ ### 2.2 提交
72
+
73
+ ```bash
74
+ git commit -am "chore: 0.1.3"
75
+ ```
76
+
77
+ ### 2.3 打 tag
78
+
79
+ ```bash
80
+ git tag v0.1.3
81
+ ```
82
+
83
+ tag 名必须与 `package.json` 的 version 严格对应(`v` + 版本号)。
84
+ workflow 第一步就会校验,不一致直接失败:
85
+
86
+ ```
87
+ tag v0.1.3 与 package.json 的 0.1.2 不一致,中止发布
88
+ ```
89
+
90
+ 想带说明可以用注解 tag(此时 `--follow-tags` 才会认):
91
+
92
+ ```bash
93
+ git tag -a v0.1.3 -m "0.1.3"
94
+ ```
95
+
96
+ ### 2.4 推送分支和 tag
97
+
98
+ ```bash
99
+ git push origin main
100
+ git push origin v0.1.3
101
+ ```
102
+
103
+ **不要只推 main。** 触发条件是 `on: push: tags: ['v*']`,分支推送不触发。
104
+
105
+ `git push origin main --follow-tags` 看起来更省事,但 **`--follow-tags` 只推注解 tag**,
106
+ 轻量 tag(`git tag v0.1.3` 这种)会被静默跳过。分两条命令最稳。
107
+
108
+ ### 2.5 观察运行
109
+
110
+ <https://github.com/zzzhangy/dsh-compound-engineering/actions>
111
+
112
+ 成功会看到 7 个步骤全绿:
113
+
114
+ ```
115
+ ✓ checkout
116
+ ✓ setup-node
117
+ ✓ 校验 tag 与 package.json 版本一致
118
+ ✓ 确保 python 命令可用
119
+ ✓ 跑测试
120
+ ✓ 确认打包结果里没有 __pycache__
121
+ ✓ 发布到 npm
122
+ ```
123
+
124
+ 发布完成后 npm 页面上:
125
+
126
+ - Trusted Publisher 的黄色 `Pending validation` 变成绿勾
127
+ - 包名旁出现 **Provenance** 徽章(证明包来自该仓库的该 commit)
128
+
129
+ ---
130
+
131
+ ## 3. 发布前自检
132
+
133
+ workflow 会跑这些,本地最好先过一遍,省一轮 CI:
134
+
135
+ ```bash
136
+ npm test # 期望 JS 38 pass / 0 fail、py 33 OK
137
+ npm pack --dry-run # 看文件数和大小,期望 458 文件 / 1.8MB
138
+ git status --short # 期望干净
139
+ ```
140
+
141
+ 关于 `npm pack --dry-run` 的文件数:0.1.0 / 0.1.1 是 461(含 3 个 `.pyc`),
142
+ 加上 `prepack` 清理后是 458。**如果看到 461,说明 pyc 又混进来了。**
143
+
144
+ ---
145
+
146
+ ## 4. 踩过的坑
147
+
148
+ ### 4.1 bypass-2FA token 会强制走 staged publishing
149
+
150
+ **症状**(本项目首发时全套踩中):
151
+
152
+ ```
153
+ npm publish → + dsh-compound-engineering@0.1.0 (显示成功)
154
+ curl registry.npmjs.org/... → dist-tags: {"latest":"0.0.0-stage"} (只有占位包)
155
+ npm publish → 409 Cannot publish over previously staged version "0.1.0"
156
+ npm stage list → No staged versions.(空的)
157
+ npm stage publish → 409 Cannot stage previously published version "0.1.0"
158
+ ```
159
+
160
+ 服务端把版本记成“已暂存/已发布”,但 register 查不到、stage 列表为空 —— 版本进了黑洞。
161
+
162
+ **根因**:npm 11.x 对 bypass-2FA token 强制暂存发布,会先建 `0.0.0-stage`
163
+ 占位包再异步处理。这个流程在“首次发布 + 占位包”组合下有 bug。
164
+
165
+ **后果**:`0.1.0` 这个版本号被永久占用,无法重发,只能升到 `0.1.1`。
166
+
167
+ **解决**:不要用 bypass token 首发新包。改用 §4.2 的 OIDC 路线,或普通 token。
168
+
169
+ ### 4.2 普通 token 首发要浏览器授权(EOTP)
170
+
171
+ ```
172
+ npm error code EOTP
173
+ npm error This operation requires a one-time password.
174
+ npm error Open this URL in your browser to authenticate:
175
+ npm error https://www.npmjs.com/auth/cli/<uuid>
176
+ ```
177
+
178
+ 终端里那条 URL 在日志中被 `***` 遮蔽,**只出现在终端输出**。按 Enter 让 npm
179
+ 打开浏览器,点 Authorize 后发布会自动继续。这是绕过 staged publishing 的方式,
180
+ 但每次发版都要人工点一下 —— 所以才改用 OIDC。
181
+
182
+ ### 4.3 发布有 5 分钟传播延迟
183
+
184
+ 发布成功后立刻 `curl` 查 registry 可能查不到,tarball 返回 404。
185
+ **这是正常的**,等 5 分钟再查。当时我们误判成发布失败,白折腾了很久。
186
+
187
+ ### 4.4 国内镜像导致安装 404
188
+
189
+ `~/.npmrc` 里 `registry` 指向淘宝镜像时,npm 的 `replace-registry-host`
190
+ (默认值 `npmjs`)会把官方 tarball 地址也改写成镜像域名。镜像尚未同步新版本时:
191
+
192
+ ```
193
+ 404 https://cdn.npmmirror.com/packages/dsh-compound-engineering/0.1.1/...tgz
194
+ ```
195
+
196
+ 包本身没问题。装新包时显式指定:
197
+
198
+ ```bash
199
+ npm i dsh-compound-engineering --registry=https://registry.npmjs.org --replace-registry-host=never
200
+ ```
201
+
202
+ ### 4.5 `__pycache__` 混进发布包
203
+
204
+ **症状**:tarball 里出现 `skills/**/__pycache__/*.pyc`。
205
+
206
+ **根因**:`package.json` 的 `files` 白名单写了整个 `skills` 目录,而 npm 的规则是
207
+ —— **目录一旦被 `files` 收录,其中的忽略规则(`.npmignore` / `.gitignore`)全部失效**。
208
+ 实测在根目录写 `**/__pycache__/` 也拦不住。
209
+
210
+ **解决**:`prepack` 钩子在打包前从磁盘删除(`scripts/clean-pycache.mjs`):
211
+
212
+ ```json
213
+ "prepack": "node scripts/clean-pycache.mjs"
214
+ ```
215
+
216
+ ### 4.6 workflow 里用 `grep` 查 pyc 会必然误报
217
+
218
+ `prepack` 的日志本身就会打印 `prepack: 清理了 3 个 __pycache__ 目录`,
219
+ 所以下面这种写法**每次都会失败**:
220
+
221
+ ```bash
222
+ # ❌ 错误:日志命中
223
+ if npm pack --dry-run 2>&1 | grep -qE '__pycache__|\.pyc'; then exit 1; fi
224
+ ```
225
+
226
+ 正确做法是解析 `--json` 的文件清单。另外 `prepack` 的 stdout 会混在 JSON 之前,
227
+ 必须按行首的 `[` 定位数组起点:
228
+
229
+ ```bash
230
+ npm pack --dry-run --json > pack.json
231
+ node -e '
232
+ const raw = require("fs").readFileSync("pack.json", "utf8");
233
+ const m = raw.match(/^\[$/m);
234
+ ...'
235
+ ```
236
+
237
+ ### 4.7 ubuntu runner 没有 `python` 命令
238
+
239
+ `npm run test:py` 调的是 `python`,而 ubuntu-latest 默认只有 `python3`。
240
+ workflow 里补了一步软链(见 `.github/workflows/publish.yml`)。
241
+
242
+ ### 4.8 tag 推了但 Actions 没跑
243
+
244
+ 看远端到底有没有 tag:
245
+
246
+ ```bash
247
+ git ls-remote origin main refs/tags/v0.1.3
248
+ ```
249
+
250
+ 如果只有 `main` 没有 `refs/tags/...`,就是 tag 没推上去(最常见的原因)。
251
+ 再确认 tag 名匹配 `v*` 通配符。
252
+
253
+ ### 4.9 Windows 上 git push 挂起
254
+
255
+ **症状**:`git push` 长时间无输出,120s/150s 超时,`exit code 124`。
256
+
257
+ **根因**:卡在 `git credential-helper-selector get`(Windows Git 的凭据选择器弹窗),
258
+ 在无头/自动化环境里会一直阻塞。用 `GIT_TRACE=1 git push` 可以看到卡点。
259
+
260
+ **解决**:在真实终端里手动推一次,弹窗里选 GitHub 账号即可。之后的推送
261
+ 会用缓存的凭据,不再弹窗。
262
+
263
+ 排查时可以排除的因素(本次都验证过不是它们):
264
+
265
+ ```bash
266
+ git config --get http.proxy # 空
267
+ env | grep -i proxy # 有 127.0.0.1:7890,但绕过代理照样挂起
268
+ git config --get credential.helper # helper-selector ← 就是它
269
+ GIT_TERMINAL_PROMPT=0 git ls-remote origin main # 1.2s 返回,说明网络正常
270
+ ```
271
+
272
+ `ls-remote` 秒回而 `push` 挂起,说明卡在认证而非网络。
273
+
274
+ ### 4.10 GitHub 仓库建的时候勾了 Add README
275
+
276
+ 远端会有一个 `Initial commit`,与本地历史无共同祖先,push 直接被拒:
277
+
278
+ ```
279
+ ! [rejected] main -> main (fetch first)
280
+ ```
281
+
282
+ 解决:
283
+
284
+ ```bash
285
+ git fetch origin
286
+ git rebase origin/main # README.md 会有 add/add 冲突
287
+ # 解决冲突:保留本地完整 README,删掉 GitHub 生成的单行简介
288
+ git add README.md
289
+ GIT_EDITOR=true git rebase --continue
290
+ git push origin main
291
+ ```
292
+
293
+ 下次建仓库记得**不要勾 Add README**。
294
+
295
+ ---
296
+
297
+ ## 5. 回滚与补救
298
+
299
+ ### 5.1 想撤销一次发布
300
+
301
+ npm 不允许删除 24 小时内的版本,也不建议 `unpublish`。正确做法是**发布修复版本**,
302
+ 然后把 `latest` 指回稳定版:
303
+
304
+ ```bash
305
+ npm dist-tag add dsh-compound-engineering@0.1.2 latest
306
+ ```
307
+
308
+ 这也是为什么 Trusted Publisher 里要勾 **Allow npm dist-tag**。
309
+
310
+ ### 5.2 把包标记为废弃
311
+
312
+ ```bash
313
+ npm deprecate dsh-compound-engineering@0.1.3 "此版本有已知问题,请用 0.1.4"
314
+ ```
315
+
316
+ 用户安装时会看到警告,但已装的不会坏。
317
+
318
+ ### 5.3 版本号被黑洞占用
319
+
320
+ 如 §4.1 的 `0.1.0`:registry 查不到,但服务端记着“已发布”,无法重发。
321
+ 只能升版本号。要彻底清理可以去 <https://github.com/npm/feedback> 提 issue。
322
+
323
+ ---
324
+
325
+ ## 6. 本地开发与 profile 同步
326
+
327
+ 开发期把本地目录装进 DSH profile 调试:
328
+
329
+ ```bash
330
+ DSH=C:/Users/zhiAngZhang/.dsh/runtime/node_modules/.bin/dsh
331
+ "$DSH" plugin --profile web add "file:E:/project/dsh-compound-engineering"
332
+ ```
333
+
334
+ ⚠️ `file:` 安装走 pnpm directory 依赖,`node_modules/` 里是**实体拷贝不是软链**,
335
+ 且 pnpm 把内容记在 lockfile 里 —— **改完源码后 `pnpm install` / `plugin update`
336
+ 都不会刷新那份拷贝**,你会一直跑到旧代码。
337
+
338
+ 刷新办法:删掉再装。
339
+
340
+ ```bash
341
+ "$DSH" plugin --profile web remove dsh-compound-engineering
342
+ "$DSH" plugin --profile web add "file:E:/project/dsh-compound-engineering"
343
+ ```
344
+
345
+ 或者直接覆盖拷贝后比对:
346
+
347
+ ```bash
348
+ SRC=E:/project/dsh-compound-engineering
349
+ DST=C:/Users/zhiAngZhang/.dsh/profiles/web/node_modules/dsh-compound-engineering
350
+ cp -rf "$SRC/skills" "$SRC/lib" "$SRC/package.json" "$DST/"
351
+ diff -rq "$SRC/skills" "$DST/skills" && echo "一致"
352
+ ```
353
+
354
+ ---
355
+
356
+ ## 7. 待办
357
+
358
+ - [ ] Trusted Publisher 跑通一次,状态从 `Pending validation` 转正
359
+ - [ ] 把 `Publishing access` 改为 disallow bypass 2fa tokens
360
+ - [ ] 确认已删除临时 bypass token(<https://www.npmjs.com/settings/zhiangzhang1/tokens>)
361
+ - [ ] README 加 npm 徽章与 provenance 徽章
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-compound-engineering",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Every 的 compound-engineering 方法论技能包 —— brainstorm → plan → work → review → compound,让每一次改动都让下一次更容易。DeepSeek Harness 移植版。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -14,6 +14,7 @@
14
14
  "files": [
15
15
  "lib",
16
16
  "skills",
17
+ "docs",
17
18
  "cordis.patch.yml",
18
19
  "LICENSE",
19
20
  "README.md",
@@ -59,6 +60,7 @@
59
60
  },
60
61
  "scripts": {
61
62
  "test": "node --test \"test/*.test.mjs\" && npm run test:py",
62
- "test:py": "python -m unittest discover -s test -p \"test_*.py\""
63
+ "test:py": "python -m unittest discover -s test -p \"test_*.py\"",
64
+ "prepack": "node scripts/clean-pycache.mjs"
63
65
  }
64
66
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes