Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: CI
name: CI

# 每次 push 到主分支、以及任何 PR 包括来自 fork 的 PR 都自动跑完整检查。
# PR 检查即「PR 通过的门禁」:typecheck / test / build 三者全绿才允许合并。
# 每次 push 到主分支、任何 PR 包括来自 fork 的 PR 都自动跑完整检查。
# 本插件是构建型:src/ 是源码,lib/ 是产物且不入库,因此 CI 必须装依赖再构建。
# PR 检查即门禁:typecheck / test / build / 产物校验全绿才允许合并。
on:
push:
branches:
Expand All @@ -11,7 +12,7 @@ on:
branches:
- main

# 同一分支/PR 上排队的新提交会取消正在跑的旧任务,避免资源浪费。
# 同一分支或 PR 上排队的新提交会取消正在跑的旧任务,避免资源浪费。
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -20,25 +21,21 @@ jobs:
check:
name: typecheck · test · build
runs-on: ubuntu-latest
strategy:
matrix:
# 本地与线上主推的运行时;也覆盖 engines 未声明时的默认行为。
node:
- 22
- 26
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
# 版本必须与 package.json 的 packageManager 完全一致,否则 action-setup 会报 Multiple versions of pnpm specified。
version: 9.15.9

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# 与本地 node -v 锁死同一版本,见工作区 AGENTS.md 的 Node 版本约定。
node-version: 26.3.1
cache: pnpm

- name: Install dependencies
Expand All @@ -53,11 +50,11 @@ jobs:
- name: Build
run: pnpm build

# 让 PR 作者与评审一眼看到构建产物是否齐全,产物缺失会在此失败。
# 注意 client.tsdown 配置 dts:false,因此只产出 client.js,不产出 client.d.ts。
# 本插件是双半身且产出 dts,产物缺失会在此失败。
- name: Verify build outputs
run: |
test -f lib/index.js
test -f lib/client.js
test -f lib/index.d.ts
echo lib/ 产物齐全:index.js / client.js / index.d.ts
test -f cordis.patch.yml
echo "构建产物齐全:lib/index.js · lib/client.js · lib/index.d.ts · cordis.patch.yml"
39 changes: 26 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Release
name: Release

# 推送形如 vX.Y.Z 如 v0.3.0 的 tag 时自动发版:
# 凭 tag 号更新 package.json 版本并提交回 main → 测试 → 构建 → 发布 npm
# → 生成 GitHub Release draft。人只需打一个 tag,其余自动衔接。
# 推送形如 vX.Y.Z 如 v0.1.0 的 tag 时自动发版:先把 package.json 版本兜底对齐到 tag 号,不一致才提交回 main → 类型检查 → 构建 → 发布 npm → 生成 GitHub Release draft。
# 人只需打一个 tag,其余自动衔接。
# 注意:npm 发布走 Trusted Publishing,无需 NPM_TOKEN;未在 npm 侧绑定信任关系时发布会失败。
on:
push:
Expand Down Expand Up @@ -36,8 +35,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

# 前置守卫:仅当该 tag 版本尚未发布到 npm 时才继续发版。
# 补历史 tag 时对应版本早已在 npm 上,重复 publish 会报错,且版本回写会把 main 改回旧号;
# 故已发布则跳过后续所有步骤。npm view 只读 registry,无需凭证。
# 补历史 tag 时对应版本早已在 npm 上,重复 publish 会报错,且版本回写会把 main 改回旧号,故已发布则跳过后续所有步骤。
# npm view 只读 registry,无需凭证。
- name: Skip when tag version already published
id: published
run: |
Expand All @@ -52,12 +51,13 @@ jobs:
echo "published=false" >> "$GITHUB_OUTPUT"
fi

# 版本号仅凭 tag 号决定,写入 package.json 并提交回 main。
# 版本号以源码里的 package.json 为准,正常随改动一起提交,发版前与将要打的 tag 对齐。
# 这一步只是兜底:忘改或写错时在此对齐 tag 号,再提交回 main。
- name: Sync version to main
if: steps.published.outputs.published != 'true'
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME#v}" # 去 v 前缀得版本号,如 0.3.0
TAG="${GITHUB_REF_NAME#v}" # 去 v 前缀得版本号,如 0.1.0
echo "target version = $TAG"

# 切到 main 分支再改版本,避免在 detached tag 上提交。
Expand All @@ -73,7 +73,7 @@ jobs:
fs.writeFileSync('./package.json', JSON.stringify(p, null, 2) + '\n');
" "$TAG"

# 已是最新版本则无改动,跳过提交;否则提交并推回 main。
# 兜底对齐后与 package.json 已一致则无改动,跳过提交;否则提交并推回 main。
git diff --quiet package.json || {
git add package.json
git commit -m "chore: release $TAG 同步 package.json 版本 [skip ci]"
Expand All @@ -84,22 +84,26 @@ jobs:
if: steps.published.outputs.published != 'true'
uses: pnpm/action-setup@v4
with:
version: 9
version: 9.15.9

# setup-node 的 registry-url 告知 npm 向哪个 registry 换 Trusted Publishing 临时凭证。
# node-version 必须大于等于 24,捆绑的 npm 才大于等于 11.5.1,这是 npm 官方 Trusted Publishing 硬性要求;低于该版本 npm CLI 无法做 OIDC 自动换权,会回退用失效 token 导致 PUT 404 is not in registry。
# node-version 与本地 node -v 锁死同一版本。它同时满足 npm 官方 Trusted Publishing 的下限:捆绑 npm 需大于等于 11.5.1,否则 npm CLI 无法做 OIDC 自动换权,会回退用失效 token 导致 PUT 404 is not in registry。
- name: Setup Node
if: steps.published.outputs.published != 'true'
uses: actions/setup-node@v4
with:
node-version: 24
node-version: 26.3.1
cache: pnpm
registry-url: https://registry.npmjs.org

- name: Install dependencies
if: steps.published.outputs.published != 'true'
run: pnpm install --frozen-lockfile

- name: Typecheck
if: steps.published.outputs.published != 'true'
run: pnpm typecheck

- name: Test
if: steps.published.outputs.published != 'true'
run: pnpm test
Expand All @@ -108,8 +112,17 @@ jobs:
if: steps.published.outputs.published != 'true'
run: pnpm build

# 本插件是双半身且产出 dts,产物缺失会在此失败。
- name: Verify build outputs
if: steps.published.outputs.published != 'true'
run: |
test -f lib/index.js
test -f lib/client.js
test -f lib/index.d.ts
test -f cordis.patch.yml
echo "构建产物齐全:lib/index.js · lib/client.js · lib/index.d.ts · cordis.patch.yml"

# Trusted Publishing:npm 凭 workflow 的 OIDC 身份直接授权,无需 NPM_TOKEN;--provenance 会在 npm 上附构建来源证明。
# node-version 24 保证捆绑 npm>=11.5.1,npm CLI 才能做 OIDC 自动换权发布。
- name: Publish to npm
if: steps.published.outputs.published != 'true'
run: npm publish --provenance --access public
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=false
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"name": "dsh-pause",
"version": "0.1.1",
"version": "0.1.2",
"packageManager": "pnpm@9.15.9",
"engines": {
"node": ">=26.3.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/better-er/dsh-pause.git"
},
"description": "DSH Web 暂停插件:agent 完成一轮工具交互、正要发出下一次模型请求之前暂停,保持 composer 输入框可用,人类以回车/发送放行并可携带补充文字;此暂停不打断任何在途 API 调用,模型上下文始终完整、无感知。纯插件自包含,不改 DSH 源码。",
"description": "「DSH·暂停」:agent 完成一轮工具交互、正要发出下一次模型请求之前暂停,保持 composer 输入框可用,人类以回车/发送放行并可携带补充文字;此暂停不打断任何在途 API 调用,模型上下文始终完整、无感知。纯插件自包含,不改 DSH 源码。",
"keywords": [
"deepseek-harness",
"dsh",
Expand Down Expand Up @@ -49,6 +53,7 @@
},
"peerDependencies": {
"@deepseek-ai/cordis": ">=4.0.0",
"@deepseek-ai/dsh": "^0.1.7-rc.2",
"react": "^18.2.0"
},
"dependencies": {
Expand Down
Loading
Loading