@ssamurias/dsh-fish 0.9.8 → 1.0.0
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/AGENTS.md +58 -24
- package/CHANGELOG.md +178 -15
- package/README.md +56 -159
- package/RELEASE-NOTES-0.9.9.md +135 -0
- package/RELEASE-NOTES-1.0.0.md +137 -0
- package/lib/appoint.js +26 -11
- package/lib/ask.js +4 -3
- package/lib/askinchat.js +6 -1
- package/lib/at.js +241 -0
- package/lib/backup.js +15 -2
- package/lib/bili.js +37 -1
- package/lib/browse.js +29 -7
- package/lib/capture.js +36 -6
- package/lib/cardanswer.js +12 -2
- package/lib/client.js +135 -12
- package/lib/comment.js +27 -9
- package/lib/compact.js +36 -8
- package/lib/contract.js +266 -0
- package/lib/curiosity.js +6 -5
- package/lib/deliver.js +6 -3
- package/lib/derive.js +293 -18
- package/lib/desk.js +4 -3
- package/lib/dream.js +3 -1
- package/lib/echo.js +75 -0
- package/lib/events.js +124 -36
- package/lib/gapwall.js +3 -1
- package/lib/generator.js +10 -0
- package/lib/grant.js +3 -2
- package/lib/guard.js +184 -184
- package/lib/guardlog.js +58 -0
- package/lib/health.js +138 -0
- package/lib/herdiary.js +27 -8
- package/lib/home.js +49 -2
- package/lib/hook.js +1 -1
- package/lib/identity.js +71 -5
- package/lib/import.js +302 -302
- package/lib/index.js +67 -16
- package/lib/intent.js +5 -3
- package/lib/keep.js +3 -2
- package/lib/keepsake.js +3 -2
- package/lib/letter.js +3 -3
- package/lib/locate.js +40 -1
- package/lib/log.js +58 -4
- package/lib/look.js +15 -1
- package/lib/material.js +57 -1
- package/lib/move.js +147 -14
- package/lib/note.js +113 -31
- package/lib/observe.js +76 -27
- package/lib/pair.js +95 -0
- package/lib/persona.js +217 -70
- package/lib/pocket.js +2 -2
- package/lib/proactive.js +7 -6
- package/lib/pronoun.js +160 -0
- package/lib/pronounask.js +210 -0
- package/lib/quality.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/recall.js +187 -29
- package/lib/restrict.js +28 -1
- package/lib/say.js +19 -13
- package/lib/scheduler.js +187 -13
- package/lib/schema.js +57 -0
- package/lib/selfdoc.js +36 -10
- package/lib/sessionnote.js +111 -37
- package/lib/settings.js +75 -6
- package/lib/sources.js +99 -0
- package/lib/speak.js +7 -2
- package/lib/speechanchor.js +132 -0
- package/lib/stance.js +36 -6
- package/lib/store.js +89 -10
- package/lib/sub.js +387 -0
- package/lib/talkmem.js +40 -8
- package/lib/tenant.js +236 -36
- package/lib/turns.js +165 -40
- package/lib/unlock.js +30 -9
- package/lib/use.js +21 -1
- package/lib/watch.js +4 -0
- package/lib/wish.js +13 -3
- package/package.json +3 -3
- package/tools/check-install.mjs +237 -0
- package/RELEASE.md +0 -154
- package/media/principle-loop-2x.png +0 -0
- package/media/principle-memory-2x.png +0 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// 安装自查:插件没跑起来的时候用这个。
|
|
3
|
+
//
|
|
4
|
+
// 为什么需要它:DSH 加载的是 node_modules 里那份**副本**,不是 profile 里写的那条源目录;
|
|
5
|
+
// 而 pnpm 装到一半失败时,副本可能是个空目录。插件自己这时候根本没被执行,
|
|
6
|
+
// 所以它「自检」看不见自己没装进来——只能从外面查。
|
|
7
|
+
//
|
|
8
|
+
// 用法(零依赖,node 18+ 就能跑,不需要插件已加载):
|
|
9
|
+
// node check-install.mjs
|
|
10
|
+
// node check-install.mjs --home D:/DSH --profile desktop
|
|
11
|
+
//
|
|
12
|
+
// 退出码:0 = 看着没问题;1 = 查到不对劲;2 = 参数/环境问题。
|
|
13
|
+
|
|
14
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
|
|
15
|
+
import { homedir } from 'node:os'
|
|
16
|
+
import { join, posix, resolve } from 'node:path'
|
|
17
|
+
|
|
18
|
+
export const PKG_NAME = 'dsh-fish'
|
|
19
|
+
const DEP_FIELDS = ['dependencies', 'devDependencies', 'optionalDependencies']
|
|
20
|
+
|
|
21
|
+
/** 形如 `D:/x`、`D:\x`、`\\server\share` 的 Windows 绝对路径 */
|
|
22
|
+
function isWinAbs(p) {
|
|
23
|
+
return /^[A-Za-z]:[\\/]/.test(p) || /^\\\\/.test(p)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 按 Windows 语义拼相对路径——POSIX 上的 path.resolve 认不得盘符 */
|
|
27
|
+
function winResolve(base, rel) {
|
|
28
|
+
const b = base.replace(/\\/g, '/')
|
|
29
|
+
const drive = /^([A-Za-z]:)/.exec(b)?.[1] ?? ''
|
|
30
|
+
const rest = b.slice(drive.length) || '/'
|
|
31
|
+
return drive + posix.resolve(rest, rel.replace(/\\/g, '/'))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** `file:D:/x` / `file:/d/x` / `file:../../x` → 绝对路径;`link:` 和其它协议返回 ''。 */
|
|
35
|
+
export function parseFileDep(spec, profileDir) {
|
|
36
|
+
if (typeof spec !== 'string') return ''
|
|
37
|
+
const m = /^file:(.+)$/.exec(spec.trim())
|
|
38
|
+
if (!m) return ''
|
|
39
|
+
const raw = m[1].trim()
|
|
40
|
+
if (!raw) return ''
|
|
41
|
+
// Windows 绝对路径(`D:/x`、`D:\x`、`\\server\share`)在 POSIX 上也必须原样保留:
|
|
42
|
+
// `path.resolve('/home/runner', 'D:/x')` 会把它当成相对路径,拼成
|
|
43
|
+
// `/home/runner/D:/x`(CI 上 3 个 ubuntu job 就是这么红的,2026-10-30)。
|
|
44
|
+
if (isWinAbs(raw)) return raw.replace(/\\/g, '/')
|
|
45
|
+
// profile 目录本身是 Windows 路径(Windows 上跑、或在 Linux 上核对 Windows 的配置):
|
|
46
|
+
// 按 Windows 语义拼,否则 POSIX 的 resolve 会把 `C:/p/desktop` 也当相对路径。
|
|
47
|
+
if (isWinAbs(String(profileDir ?? ''))) return winResolve(String(profileDir), raw)
|
|
48
|
+
return resolve(profileDir, raw)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** 从 package.json 文本里取 dsh-fish 的依赖写法;坏 JSON 返回 null。 */
|
|
52
|
+
export function readDep(text) {
|
|
53
|
+
let pkg
|
|
54
|
+
try {
|
|
55
|
+
pkg = JSON.parse(text)
|
|
56
|
+
} catch {
|
|
57
|
+
return null
|
|
58
|
+
}
|
|
59
|
+
for (const f of DEP_FIELDS) {
|
|
60
|
+
const v = pkg?.[f]?.[PKG_NAME]
|
|
61
|
+
if (typeof v === 'string') return v
|
|
62
|
+
}
|
|
63
|
+
return ''
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** 读一个目录里 package.json 的版本号;读不到返回 ''。 */
|
|
67
|
+
export function versionOf(dir) {
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'))?.version ?? ''
|
|
70
|
+
} catch {
|
|
71
|
+
return ''
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** 数一个目录里 .js 文件的个数(副本是空的 / 只落了一半,这个数字会明显偏低)。 */
|
|
76
|
+
export function countJs(dir) {
|
|
77
|
+
let n = 0
|
|
78
|
+
const walk = (d, depth) => {
|
|
79
|
+
if (depth > 3) return
|
|
80
|
+
let items = []
|
|
81
|
+
try {
|
|
82
|
+
items = readdirSync(d, { withFileTypes: true })
|
|
83
|
+
} catch {
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
for (const it of items) {
|
|
87
|
+
if (it.name === 'node_modules') continue
|
|
88
|
+
if (it.isDirectory()) walk(join(d, it.name), depth + 1)
|
|
89
|
+
else if (it.name.endsWith('.js') || it.name.endsWith('.mjs')) n += 1
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
walk(dir, 0)
|
|
93
|
+
return n
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 查一个 profile。
|
|
98
|
+
* 返回 {profile, source, sourceVersion, copy, copyVersion, sourceJs, copyJs, verdict, why}
|
|
99
|
+
* verdict: ok | empty-copy | stale-copy | no-dep | no-profile
|
|
100
|
+
*/
|
|
101
|
+
export function inspectProfile(profileDir) {
|
|
102
|
+
const pkgFile = join(profileDir, 'package.json')
|
|
103
|
+
const out = {
|
|
104
|
+
profile: profileDir,
|
|
105
|
+
source: '',
|
|
106
|
+
sourceVersion: '',
|
|
107
|
+
copy: join(profileDir, 'node_modules', PKG_NAME),
|
|
108
|
+
copyVersion: '',
|
|
109
|
+
sourceJs: 0,
|
|
110
|
+
copyJs: 0,
|
|
111
|
+
verdict: 'no-profile',
|
|
112
|
+
why: '',
|
|
113
|
+
}
|
|
114
|
+
if (!existsSync(pkgFile)) {
|
|
115
|
+
out.why = '这个 profile 里没有 package.json'
|
|
116
|
+
return out
|
|
117
|
+
}
|
|
118
|
+
let text
|
|
119
|
+
try {
|
|
120
|
+
text = readFileSync(pkgFile, 'utf8')
|
|
121
|
+
} catch (err) {
|
|
122
|
+
out.why = `package.json 读不了:${err?.message ?? err}`
|
|
123
|
+
return out
|
|
124
|
+
}
|
|
125
|
+
const dep = readDep(text)
|
|
126
|
+
if (dep === null) {
|
|
127
|
+
out.why = 'package.json 不是合法 JSON'
|
|
128
|
+
return out
|
|
129
|
+
}
|
|
130
|
+
if (!dep) {
|
|
131
|
+
out.verdict = 'no-dep'
|
|
132
|
+
out.why = 'profile 的 dependencies 里没有 dsh-fish'
|
|
133
|
+
return out
|
|
134
|
+
}
|
|
135
|
+
out.verdict = 'no-dep'
|
|
136
|
+
out.why = `依赖写法是 ${dep}`
|
|
137
|
+
if (dep.startsWith('link:')) {
|
|
138
|
+
out.why = `依赖写法是 ${dep}(软链安装,没有副本,不需要比对)`
|
|
139
|
+
return out
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
out.source = parseFileDep(dep, profileDir)
|
|
143
|
+
if (!out.source) {
|
|
144
|
+
out.why = `依赖写法是 ${dep}(不是 file:,没法定位源目录)`
|
|
145
|
+
return out
|
|
146
|
+
}
|
|
147
|
+
out.sourceVersion = versionOf(out.source)
|
|
148
|
+
out.copyVersion = versionOf(out.copy)
|
|
149
|
+
out.sourceJs = countJs(out.source)
|
|
150
|
+
out.copyJs = countJs(out.copy)
|
|
151
|
+
|
|
152
|
+
if (!existsSync(out.copy)) {
|
|
153
|
+
out.verdict = 'empty-copy'
|
|
154
|
+
out.why = 'node_modules 里没有 dsh-fish:pnpm 根本没装成功'
|
|
155
|
+
} else if (!out.copyVersion) {
|
|
156
|
+
out.verdict = 'empty-copy'
|
|
157
|
+
out.why = 'node_modules/dsh-fish 里没有能读的 package.json:副本是空的或只落了一半'
|
|
158
|
+
} else if (out.copyJs < out.sourceJs * 0.8) {
|
|
159
|
+
out.verdict = 'empty-copy'
|
|
160
|
+
out.why = `副本只有 ${out.copyJs} 个 js 文件,源目录有 ${out.sourceJs} 个:装了一半`
|
|
161
|
+
} else if (out.copyVersion !== out.sourceVersion) {
|
|
162
|
+
out.verdict = 'stale-copy'
|
|
163
|
+
out.why = `源目录是 ${out.sourceVersion || '?'},跑的是 ${out.copyVersion}(副本没跟上)`
|
|
164
|
+
} else {
|
|
165
|
+
out.verdict = 'ok'
|
|
166
|
+
out.why = `副本与源目录都是 ${out.copyVersion}(${out.copyJs} 个 js 文件)`
|
|
167
|
+
}
|
|
168
|
+
return out
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** 找出一个 DSH_HOME 下所有装过 dsh-fish 的 profile。 */
|
|
172
|
+
export function findProfiles(home = join(homedir(), '.dsh')) {
|
|
173
|
+
const root = join(home, 'profiles')
|
|
174
|
+
if (!existsSync(root)) return []
|
|
175
|
+
const out = []
|
|
176
|
+
for (const name of readdirSync(root)) {
|
|
177
|
+
const dir = join(root, name)
|
|
178
|
+
try {
|
|
179
|
+
if (!statSync(dir).isDirectory()) continue
|
|
180
|
+
} catch {
|
|
181
|
+
continue
|
|
182
|
+
}
|
|
183
|
+
if (!existsSync(join(dir, 'package.json'))) continue
|
|
184
|
+
const dep = readDep(readFileSync(join(dir, 'package.json'), 'utf8'))
|
|
185
|
+
if (dep) out.push(dir)
|
|
186
|
+
}
|
|
187
|
+
return out
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const LABEL = {
|
|
191
|
+
ok: '正常',
|
|
192
|
+
'stale-copy': '装的是旧副本',
|
|
193
|
+
'empty-copy': '副本空的/装了一半',
|
|
194
|
+
'no-dep': '不是这套装法',
|
|
195
|
+
'no-profile': '没找到 profile',
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function main(argv = process.argv.slice(2)) {
|
|
199
|
+
const arg = (name, dflt = '') => {
|
|
200
|
+
const i = argv.indexOf(`--${name}`)
|
|
201
|
+
return i >= 0 && argv[i + 1] ? argv[i + 1] : dflt
|
|
202
|
+
}
|
|
203
|
+
const home = arg('home', join(homedir(), '.dsh'))
|
|
204
|
+
const only = arg('profile', '').toLowerCase()
|
|
205
|
+
let dirs = findProfiles(home)
|
|
206
|
+
if (only) {
|
|
207
|
+
dirs = dirs.filter((d) => d.split(/[\\/]/).pop().toLowerCase() === only)
|
|
208
|
+
if (!dirs.length) {
|
|
209
|
+
console.error(`在 ${home} 里没找到 profile「${only}」,或者它没装 dsh-fish`)
|
|
210
|
+
return 2
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (!dirs.length) {
|
|
214
|
+
console.error(`在 ${home}\\profiles 里没找到任何装过 dsh-fish 的 profile`)
|
|
215
|
+
return 2
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
let bad = 0
|
|
219
|
+
for (const dir of dirs) {
|
|
220
|
+
const r = inspectProfile(dir)
|
|
221
|
+
const name = dir.split(/[\\/]/).pop()
|
|
222
|
+
console.log(`\n[${name}] ${LABEL[r.verdict] ?? r.verdict}`)
|
|
223
|
+
if (r.source) console.log(` 源目录 ${r.source}`)
|
|
224
|
+
if (r.copy) console.log(` 实际跑 ${r.copy}`)
|
|
225
|
+
console.log(` 说明 ${r.why}`)
|
|
226
|
+
if (r.verdict === 'empty-copy' || r.verdict === 'stale-copy') {
|
|
227
|
+
bad += 1
|
|
228
|
+
console.log(' 修法 关掉 DSH → 在 profile 目录里 pnpm install --force(或删掉 node_modules/dsh-fish)→ 再启动')
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
console.log(bad ? '\n有问题:上面标出来的那几条按「修法」重装一次。' : '\n看着没问题。')
|
|
232
|
+
return bad ? 1 : 0
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (import.meta.url === `file://${process.argv[1]?.replace(/\\/g, '/')}` || process.argv[1]?.endsWith('check-install.mjs')) {
|
|
236
|
+
process.exitCode = main()
|
|
237
|
+
}
|
package/RELEASE.md
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# 发版流程(dsh-fish)
|
|
2
|
-
|
|
3
|
-
> 适用 0.9.1 之后。本仓库的规矩是**先改在本地、后发布**:本地 `main` 改完、测试全绿,等维护者明确说「发」再执行第 3 步起的命令。没点头就只做到第 2 步。
|
|
4
|
-
>
|
|
5
|
-
> 本机环境:Windows + Git Bash;仓库在 `D:/deepseekagent/02-我的项目/大肥鱼/plugin`;`gh` 在 `/c/Users/DANG/bin/gh`(登录名 `ssamurias`);npm 账号同名。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 0. 发布前先确认三件事
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
cd "D:/deepseekagent/02-我的项目/大肥鱼/plugin"
|
|
13
|
-
git status --short # 必须是空的
|
|
14
|
-
git log --oneline origin/main..HEAD # 看看这次要发几个提交
|
|
15
|
-
npm whoami --registry=https://registry.npmjs.org/ # 必须是 ssamurias;报 E401 就先 npm login(见第 4 步)
|
|
16
|
-
gh auth status # 必须是 ssamurias
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
- 发布本身**不碰本地 profile**,不用关 DSH Desktop。
|
|
20
|
-
- 只有「发完在本地装一遍验证」时才要先关应用——运行中替换已加载的包会 `ERR_PNPM_EPERM`(避坑指南第 3 节)。
|
|
21
|
-
- 本机 npm 账号开了 2FA 的话,`npm publish` 会要 6 位验证码,见第 4 步。
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 1. 发布前自检(每次都要跑,别跳)
|
|
26
|
-
|
|
27
|
-
- [ ] `package.json` 的 `version` 就是要发的号(修 bug 发 patch,如 `0.9.3`;一批改动发 minor,如 `0.9.6`)
|
|
28
|
-
- [ ] `node --test` 全绿(当前基线见 `AGENTS.md` 第 6 节;现在是 \*\*2202 pass / 0 fail\\*\\*,约 28 秒)
|
|
29
|
-
- [ ] `CHANGELOG.md` 顶部有本节,条目按 issue 编号写全
|
|
30
|
-
- [ ] `RELEASE-NOTES-x.y.z.md` 已写,且与 `CHANGELOG.md` 口径一致(issue 条数、PR 编号、日期)
|
|
31
|
-
- [ ] `README.md` 顶部「当前版本」段已换成这一版
|
|
32
|
-
- [ ] 升级路径有变化时,`README.md`「从旧版升到 0.9.x」表补了行,`AGENTS.md`「包名与装法」补了守门条目
|
|
33
|
-
- [ ] `npm pack --dry-run` 的文件清单对:`lib/`、`media/`、`scripts/`、`cordis.patch.yml`、`README.md`、`AGENTS.md`、`CHANGELOG.md`、`RELEASE-NOTES-*.md`、`RELEASE.md`;**不含 `test/`**
|
|
34
|
-
- [ ] 包里没有敏感文件(`.env`、profile、cookie、备份档)
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
node --test
|
|
38
|
-
npm pack --dry-run
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
`npm pack --dry-run` 只打印清单、不真打包;看完记得确认没有 `test/`、没有 `~/.dsh-fish` 相关的东西。
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## 2. 本地提交(不 push)
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
git add -A
|
|
49
|
-
git commit -m "0.9.x:<一句话说清这一版>"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
- 0.9.1 就是这么发出去的:先在本地攒了 10 个提交(含四个社区 PR 的合并提交),维护者说「发」之后才推。之后同样先攒、别边改边推。
|
|
53
|
-
- 没点头就停在这里。下面每一步都会动线上(GitHub / npm),发布出去基本收不回。
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 3. 推代码上 GitHub
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
git push origin main
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
- 若 `github.com:443` 不通(本机常见),改用 Git Data API 推:`node D:/deepseekagent/04-小工具/fish-push-generic.mjs`(逐提交建树、建 commit,并断言树 SHA 与本地一致),成功后 `node D:/deepseekagent/04-小工具/fish-realign-shas.mjs`(按 `.git/push-map.json` 把本地 SHA 对齐成服务端版本,同时更新 `origin/main`)。原理与三个坑见避坑指南第 27 节。
|
|
64
|
-
- **不要** `git push --force` / `git push --delete`:会被 CC Safety Net 拦下。确需删远端引用,用 `gh api -X DELETE /repos/ssamurias/dsh-fish/git/refs/<ref>`。
|
|
65
|
-
- 推完去 Actions 看一眼三档 Node(20 / 22 / 24)是否全绿:`gh run list --limit 3`。
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## 4. 发 npm 包(需要你手动跑,可整段复制)
|
|
70
|
-
|
|
71
|
-
> 这一段是给维护者本人执行的:登录和 2FA 都在你的终端里完成,agent 不代跑发布。
|
|
72
|
-
> **本机的 2FA 是 Windows 系统密钥(安全密钥)**,所以每次发布都要走一遍完整登录流程;发完后 npm 的 CDN 大约要 **3 分钟** 才看得到新版本,核对命令等一会儿再跑。
|
|
73
|
-
> **本机 npm 默认 registry 是 `https://registry.npmmirror.com`,所以每条命令都必须显式带 `--registry=https://registry.npmjs.org/`**,否则会得到看似「包不存在 / 没权限」的 E404。
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
cd "D:/deepseekagent/02-我的项目/大肥鱼/plugin"
|
|
77
|
-
|
|
78
|
-
# 0) 确认身份:返回 ssamurias 就说明本机已经登录,可以跳过第 1 步
|
|
79
|
-
npm whoami --registry=https://registry.npmjs.org/
|
|
80
|
-
|
|
81
|
-
# 1) 只有第 0 步报 E401 / 不是 ssamurias 时才需要:浏览器登录
|
|
82
|
-
npm login --registry=https://registry.npmjs.org/
|
|
83
|
-
npm whoami --registry=https://registry.npmjs.org/
|
|
84
|
-
|
|
85
|
-
# 2) 发布(开了 2FA 就在末尾加 --otp=123456)
|
|
86
|
-
npm publish --registry=https://registry.npmjs.org/
|
|
87
|
-
|
|
88
|
-
# 3) 核对:等约 3 分钟再跑,应为 0.9.x 和 latest -> 0.9.x
|
|
89
|
-
npm view @ssamurias/dsh-fish version dist-tags --registry=https://registry.npmjs.org/
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
- **不想每条都带参数**:`npm config set registry https://registry.npmjs.org/`,发完再改回 `npm config set registry https://registry.npmmirror.com/`。
|
|
93
|
-
- **scoped 包没有写权限时 npm 故意返回 404(不是 403)**:看到 E404 先查 `npm whoami`,别怀疑包名或网络。
|
|
94
|
-
- 本包已经是公开包,**不需要** `--access public`(只有首次发布才要)。
|
|
95
|
-
- 常见报错:
|
|
96
|
-
- `E401`:没登录 / token 过期 → `npm logout --registry=...` 再 `npm login --registry=...`
|
|
97
|
-
- `E403`:账号没有 `@ssamurias` scope 写权限,或开了 2FA 没给 `--otp`
|
|
98
|
-
- `EPUBLISHCONFLICT`:这个版本号已经发过 → 已发布版本不能覆盖,升 patch 号重来
|
|
99
|
-
- `npm publish --dry-run` 可以先看会打进去哪些文件,不会真的发。
|
|
100
|
-
- 用户端注意:pnpm 的 `minimumReleaseAge`(默认 24 小时)会把「太新」的版本回滚掉;本机 profile 已设 `minimumReleaseAge: 0`(避坑指南第 3 节)。
|
|
101
|
-
|
|
102
|
-
## 5. 打 tag + 建 GitHub Release
|
|
103
|
-
|
|
104
|
-
**npm 发布成功之后**再做这一步,npm 失败就停住、别打 tag(免得留一个指向没发出去的版本的悬空 tag)。
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
git tag -a v0.9.x -m "0.9.x"
|
|
108
|
-
git push origin v0.9.x
|
|
109
|
-
export PATH="/c/Users/DANG/bin:$PATH"
|
|
110
|
-
gh release create v0.9.x -F RELEASE-NOTES-0.9.x.md --title "0.9.x"
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
- Release 正文直接用仓库里的 `RELEASE-NOTES-*.md`(`-F` 读文件),不要在网页上手打——两边会不一致。
|
|
114
|
-
- 想先存草稿:`gh release create v0.9.x -F RELEASE-NOTES-0.9.x.md --draft`,检查完再 `gh release edit v0.9.x --draft=false`。
|
|
115
|
-
- `git push origin v0.9.x` 若也卡在 443:用 `gh api -X POST repos/ssamurias/dsh-fish/git/tags` 在服务端建 tag 对象,再 `gh api -X POST repos/ssamurias/dsh-fish/git/refs -f ref=refs/tags/v0.9.x -f sha=<tag对象sha>`。
|
|
116
|
-
- 兜底也可以在网页上建 Release(会自动建 tag),但正文仍以 `RELEASE-NOTES-*.md` 为准,别手打。
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## 6. 发布后验证
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
npm view @ssamurias/dsh-fish version dist-tags
|
|
124
|
-
npm view @ssamurias/dsh-fish@0.9.x dist.tarball
|
|
125
|
-
gh release view v0.9.x
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
- `dist-tags.latest` 要指向新版本;`dist.tarball` 能取到 URL 就说明包在。
|
|
129
|
-
- 想真装一遍:**先关 DSH Desktop**,用临时 profile 试装(不要直接动 `desktop` profile)——`bundles` 与 `dependencies` 必须一一对应,先只改依赖、装包,再用目录联接的临时 profile 跑 `--dump-config` 预演(避坑指南第 1 节)。
|
|
130
|
-
- 回 issue:这一版修到的每条 issue 各回一条「x.y.z 已发布,装法见 README,有问题随时回」,等作者确认后再关。
|
|
131
|
-
- 给这一版合入的 PR 作者留一句「已随 x.y.z 发布」;PR 没合并的不要在 GitHub 上点 merge,在回帖里说清「以提交形式合入」。
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## 7. 出问题时怎么回滚
|
|
136
|
-
|
|
137
|
-
| 对象 | 命令 | 说明 |
|
|
138
|
-
| --- | --- | --- |
|
|
139
|
-
| npm 版本 | `npm unpublish @ssamurias/dsh-fish@0.9.x` | 72 小时内可撤;超过 72 小时改用 `npm deprecate @ssamurias/dsh-fish@0.9.x "原因,请装 x.y.z"`,不要再发同名版本 |
|
|
140
|
-
| git tag | `git tag -d v0.9.x` 然后 `git push --delete origin v0.9.x` | `--delete` 被拦时用 `gh api -X DELETE /repos/ssamurias/dsh-fish/git/refs/tags/v0.9.x` |
|
|
141
|
-
| GitHub Release | `gh release delete v0.9.x` | 加 `--cleanup-tag` 连 tag 一起删 |
|
|
142
|
-
| 代码 | 用 `git revert <提交>` 再正常 push | **不要** force push `main` |
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## 8. 这个项目特有的坑(发布前扫一眼)
|
|
147
|
-
|
|
148
|
-
- **包名 / 迁移脚本别动**:`@ssamurias/dsh-fish`、`cordis.patch.yml` 的 `id: dsh-fish`、`lib/selfupdate.js` 的 `normalizeScript()` 三条都在 `AGENTS.md` 的「包名与装法」,发布前改它们等于给自己造升级事故。
|
|
149
|
-
- **升级说明要和脚本一致**:`scripts/fix-legacy-link.mjs` 现在认三种依赖写法(`link:` / `file:` tgz / 版本号)。改了它,`README.md` 升级表与 `RELEASE-NOTES-*.md` 必须同步改,否则用户照文档做还是会崩。
|
|
150
|
-
- **`desktop` profile 被应用独占**:`dsh plugin --profile desktop ...` 会被拒,验证要用别的 profile。
|
|
151
|
-
- **别在应用运行时替换已加载的包**:`ERR_PNPM_EPERM`,包目录会被留成「已删除」。
|
|
152
|
-
- 备份照旧放 `D:/deepseekagent/dsh-fix-backup/`,不要放进仓库。
|
|
153
|
-
|
|
154
|
-
|
|
Binary file
|
|
Binary file
|