dsh-git-push 2.8.6 → 2.9.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.
- package/README.md +24 -5
- package/assets/minihost.sh +35 -0
- package/assets/preview.html +36703 -0
- package/assets/start.sh +396 -0
- package/assets/tree-sitter/LICENSE +21 -0
- package/assets/tree-sitter/README.md +69 -0
- package/assets/tree-sitter/VERSIONS.txt +1 -0
- package/assets/tree-sitter/tree-sitter-javascript.wasm +0 -0
- package/assets/tree-sitter/tree-sitter-python.wasm +0 -0
- package/assets/tree-sitter/tree-sitter-typescript.wasm +0 -0
- package/assets/tree-sitter/tree-sitter.js +3980 -0
- package/assets/tree-sitter/tree-sitter.wasm +0 -0
- package/lib/app/apply.js +15 -2
- package/lib/app/command-registry.js +2 -1
- package/lib/app/handlers/workspace-paths.js +107 -0
- package/lib/app/http-handlers.js +19 -2
- package/lib/app/inject-text.js +1 -1
- package/lib/app/tool-call.js +60 -8
- package/lib/ast/code-lines.js +52 -0
- package/lib/ast/fs-hotspots.js +154 -0
- package/lib/ast/index.js +1 -1
- package/lib/ast/perf.js +26 -10
- package/lib/ast/tokenizer.js +7 -2
- package/lib/ast/treesitter.js +208 -0
- package/lib/audit/audit-file.js +3 -3
- package/lib/audit/collector.js +4 -0
- package/lib/audit/orchestrate.js +41 -1
- package/lib/audit-rules/audit-rules-cpp.yml +106 -14
- package/lib/audit-rules/audit-rules-go.yml +95 -14
- package/lib/audit-rules/audit-rules-nodejs.yml +2 -2
- package/lib/audit-rules/audit-rules-paths.yml +1 -1
- package/lib/audit-rules/audit-rules-performance.yml +39 -9
- package/lib/audit-rules/audit-rules-php.yml +93 -14
- package/lib/audit-rules/audit-rules-rust.yml +101 -14
- package/lib/audit-rules/audit-rules-swift.yml +91 -14
- package/lib/checks/dispatch.js +3 -3
- package/lib/checks/fs-scanner.js +57 -0
- package/lib/checks/index.js +1 -0
- package/lib/checks/regex.js +19 -4
- package/lib/core/workspace-paths.js +108 -0
- package/lib/fs/edit-after-read.js +39 -0
- package/lib/rule/compilers/numeric-kinds.js +7 -0
- package/lib/rule/registry.js +7 -0
- package/lib/self/index.js +1 -1
- package/lib/user-requirements.json +2 -1
- package/package.json +2 -1
- package/scripts/doc-version.mjs +19 -90
- package/scripts/readme-gen.mjs +72 -22
- package/scripts/scan-fs-hotspots.mjs +107 -0
- package/scripts/sync-plugin-install.mjs +84 -21
- package/scripts/sync-plugin.mjs +14 -9
- package/skills/dev/dsh-git-push.md +18 -1
- package/skills/guide/guide-cli-scripts.md +1 -1
- package/skills/guide/guide-commit-push.md +33 -0
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* applyInstall 按 on/off 执行安装形态动作(用改动本体的 sync 步骤落真实文件)
|
|
19
19
|
* depHints package.json 依赖声明是否还指向 node_modules / 绝对 link:
|
|
20
20
|
*/
|
|
21
|
-
import { existsSync, readdirSync, lstatSync,
|
|
21
|
+
import { existsSync, readdirSync, lstatSync, unlinkSync, mkdirSync, readFileSync } from 'node:fs';
|
|
22
22
|
import { join, resolve, sep } from 'node:path';
|
|
23
23
|
|
|
24
24
|
/** DSH 数据根(含 .dsh 的那一层)。兼容两种入参形态:
|
|
@@ -113,9 +113,78 @@ function lstatOrNull(p) {
|
|
|
113
113
|
try { return lstatSync(p); } catch { return null; }
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/** 读文本,失败返回 null(用于副本漂移判定)。 */
|
|
117
|
+
function readTextOrNull(p) {
|
|
118
|
+
try { return readFileSync(p, 'utf8'); } catch { return null; }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** 递归列目录内文件(相对路径;跳过 .git/node_modules/.trash 等非发布内容)。 */
|
|
122
|
+
function listFilesRecursive(dir, prefix = '', out = new Set()) {
|
|
123
|
+
try {
|
|
124
|
+
for (const e of readdirSync(join(dir, prefix), { withFileTypes: true })) {
|
|
125
|
+
const rel = prefix ? `${prefix}/${e.name}` : e.name;
|
|
126
|
+
if (['.git', 'node_modules', '.trash', '.DS_Store'].includes(e.name)) continue;
|
|
127
|
+
if (e.isDirectory()) listFilesRecursive(dir, rel, out);
|
|
128
|
+
else out.add(rel);
|
|
129
|
+
}
|
|
130
|
+
} catch { /* 读不到按空处理,由调用方据结果判断 */ }
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 判定 node_modules 那份副本是否与真源不一致(漂移)。**两类都要查**:
|
|
136
|
+
*
|
|
137
|
+
* ① **内容漂移**:已有文件内容与真源不同(旧副本顶掉真源 ⇒ 宿主跑旧代码)。
|
|
138
|
+
* 实测事故:GitHub tarball 旧版 2.6.9 顶掉 2.8.6 ⇒ 宿主自报 2.6.9、新工具整批消失。
|
|
139
|
+
* ② **文件清单漂移**:真源有、副本**缺** ✗ —— 硬链接孪生**不会自动带上新建文件**。
|
|
140
|
+
* 实测事故(2026-10-15 19:2x):新增 `lib/ast/treesitter.js` 只落 local-plugins,
|
|
141
|
+
* 而 node_modules 那份的 `lib/audit/orchestrate.js` 已经 import 它 ⇒ 副本 import 失败
|
|
142
|
+
* ⇒ 宿主日志 `dsh-git-push (dsh-git-push): failed to import`、**该插件全部工具消失** ✗✗。
|
|
143
|
+
* 本检查此前只比对内容 ⇒ 完全没发现这一类 ✗。
|
|
144
|
+
*
|
|
145
|
+
* 为什么不能按「是不是目录」报警:pnpm 的 `file:` 目录依赖落在 node_modules 时,
|
|
146
|
+
* 实测是**与 local-plugins 同 inode 的硬链接副本**(stat 同 inode、链接数 2),属正常安装产物 ✓。
|
|
147
|
+
*
|
|
148
|
+
* @param {string} localDir 真源(local-plugins/<插件>)
|
|
149
|
+
* @param {string} nmDir node_modules/<插件>
|
|
150
|
+
* @returns {string} '' = 一致(含硬链接同文件);否则是差异描述
|
|
151
|
+
*/
|
|
152
|
+
export function copyDrift(localDir, nmDir) {
|
|
153
|
+
// ② 文件清单漂移(先查:缺文件比内容不同更致命 ⇒ 直接 import 失败)。
|
|
154
|
+
// 只比**加载关键子集**:lib/ 与 assets/ 是 import 与运行必需的;
|
|
155
|
+
// scripts/ skills/ docs/ 等不参与加载,pnpm 对 file: 依赖的拷贝口径也可能不同 ⇒
|
|
156
|
+
// 全量比对会产生上百条噪音,把真信号(如缺 lib/ast/treesitter.js)淹掉 ✗
|
|
157
|
+
const localFiles = listFilesRecursive(localDir);
|
|
158
|
+
const nmFiles = listFilesRecursive(nmDir);
|
|
159
|
+
const CRITICAL = /^(lib\/|assets\/|package\.json$|cordis\.patch\.yml$)/;
|
|
160
|
+
if (localFiles.size && nmFiles.size) {
|
|
161
|
+
const missing = [...localFiles].filter((f) => CRITICAL.test(f) && !nmFiles.has(f));
|
|
162
|
+
if (missing.length) return `副本缺少 ${missing.length} 个加载必需文件(如 ${missing[0]})`;
|
|
163
|
+
}
|
|
164
|
+
// ① 内容漂移:判据取「版本三处 + 入口文件」这几个标记位,任一处不同即认为副本陈旧/被替换
|
|
165
|
+
for (const rel of ['package.json', 'lib/self/index.js', 'lib/app/command-registry.js']) {
|
|
166
|
+
const a = readTextOrNull(join(localDir, rel));
|
|
167
|
+
const b = readTextOrNull(join(nmDir, rel));
|
|
168
|
+
if (a === null) continue; // 真源里没有这个文件(插件结构变体)⇒ 跳过该标记
|
|
169
|
+
if (b === null) return `${rel} 在副本里缺失`;
|
|
170
|
+
if (a !== b) return `${rel} 内容不同`;
|
|
171
|
+
}
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
|
|
116
175
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
176
|
+
* 目标形态与现状的差异清单。默认只报告,不执行。
|
|
177
|
+
*
|
|
178
|
+
* 【2026-10-15 起】真源**只认** `<profile>/local-plugins/<插件>`(真实目录):
|
|
179
|
+
* `node_modules/<插件>` 的解析入口**不再由本脚本管理**(不建链、不改链)——它由
|
|
180
|
+
* DSH/pnpm 安装流程按 profile `package.json` 的 `file:local-plugins/<插件>` 声明自动生成,
|
|
181
|
+
* 安装位置就是 local-plugins。
|
|
182
|
+
*
|
|
183
|
+
* 为什么仍要报告 node_modules:实测事故(本机 2026-10-15)——node_modules 下留了一份
|
|
184
|
+
* **真实目录副本**(旧版 2.6.9,来自更早的 tarball 安装),它顶替 local-plugins 里的 2.8.6
|
|
185
|
+
* 成为宿主实际加载源,宿主 `git_api status` 报 2.6.9、`npm_publish` 等新工具整批消失。
|
|
186
|
+
* 更硬的证据:删掉该条目后,从 profile 根 `require.resolve('dsh-git-push')` 直接 MODULE_NOT_FOUND
|
|
187
|
+
* ⇒ **没有入口 = 解析不到 = 插件不加载**;入口必须存在,但该由安装流程生成,而非本脚本伪造。
|
|
119
188
|
* @returns {Array<{kind: string, path: string, desc: string}>}
|
|
120
189
|
*/
|
|
121
190
|
export function planInstall({ profileDir, pluginName }) {
|
|
@@ -127,19 +196,16 @@ export function planInstall({ profileDir, pluginName }) {
|
|
|
127
196
|
if (ls && ls.isSymbolicLink()) {
|
|
128
197
|
actions.push({ kind: 'delink-local', path: local, desc: 'local-plugins 下是软链:真实加载源应是**真实目录**(执行时会先删链再落一份真实副本)' });
|
|
129
198
|
} else if (!ls) {
|
|
130
|
-
actions.push({ kind: 'create-local', path: local, desc: 'local-plugins
|
|
199
|
+
actions.push({ kind: 'create-local', path: local, desc: 'local-plugins 下缺该插件:需先同步一份真实目录(真实加载源在这里)' });
|
|
131
200
|
}
|
|
132
201
|
const ns = lstatOrNull(nm);
|
|
133
|
-
if (ns && ns.isSymbolicLink()) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
202
|
+
if (ns && !ns.isSymbolicLink()) {
|
|
203
|
+
// 真实目录在 pnpm `file:` 目录依赖下是**正常产物**(实测与真源同 inode 的硬链接)⇒ 不能只看形态报警,
|
|
204
|
+
// 要比**内容**:只有副本与真源不一致(陈旧/被替换)才会顶掉真源、让宿主跑旧代码 ✓
|
|
205
|
+
const drift = copyDrift(local, nm);
|
|
206
|
+
if (drift) {
|
|
207
|
+
actions.push({ kind: 'nm-drift', path: nm, desc: `node_modules 下的副本与真源**内容不一致**(${drift}):它会顶掉 local-plugins 成为实际加载源(实测旧副本 2.6.9 顶掉 2.8.6、新工具整批消失)⇒ 应重装该依赖或删除此副本` });
|
|
138
208
|
}
|
|
139
|
-
} else if (!ns) {
|
|
140
|
-
actions.push({ kind: 'link-nm', path: nm, desc: `node_modules 下缺软链:应建相对链 ../local-plugins/${pluginName}` });
|
|
141
|
-
} else {
|
|
142
|
-
actions.push({ kind: 'dir-nm', path: nm, desc: 'node_modules 下是真实目录:按目标形态应让真实源落在 local-plugins、这里只留相对软链(本工具不自动搬移,避免动到既有数据)' });
|
|
143
209
|
}
|
|
144
210
|
return actions;
|
|
145
211
|
}
|
|
@@ -148,26 +214,23 @@ export function planInstall({ profileDir, pluginName }) {
|
|
|
148
214
|
* 执行安装形态动作(仅在调用方传入 on=true 时写盘)。
|
|
149
215
|
* delink-local:删软链(真实内容由后续同步步骤落进来)
|
|
150
216
|
* create-local:建目录(同上)
|
|
151
|
-
*
|
|
152
|
-
*
|
|
217
|
+
* nm-real-dir:只报告(删副本属破坏性动作,交人工或安装流程;本工具不动既有数据)
|
|
218
|
+
*
|
|
219
|
+
* 注:本工具**不建 node_modules 软链**(真源只认 local-plugins;解析入口由 DSH/pnpm 安装流程生成)。
|
|
153
220
|
* @returns {{done: string[], skipped: string[]}}
|
|
154
221
|
*/
|
|
155
222
|
export function applyInstall(actions, { on = false } = {}) {
|
|
156
223
|
const done = [];
|
|
157
224
|
const skipped = [];
|
|
158
225
|
for (const a of actions) {
|
|
159
|
-
|
|
226
|
+
// 只有「改 local-plugins 真实目录」是他的活;node_modules 相关一律只报告(不建链、不删数据)
|
|
227
|
+
if (!on || (a.kind !== 'delink-local' && a.kind !== 'create-local')) { skipped.push(a.kind); continue; }
|
|
160
228
|
try {
|
|
161
229
|
if (a.kind === 'delink-local') {
|
|
162
230
|
unlinkSync(a.path); // 只删软链本身,不触及它指向的任何内容
|
|
163
231
|
mkdirSync(a.path, { recursive: true });
|
|
164
232
|
} else if (a.kind === 'create-local') {
|
|
165
233
|
mkdirSync(a.path, { recursive: true });
|
|
166
|
-
} else if (a.kind === 'relink-nm') {
|
|
167
|
-
unlinkSync(a.path);
|
|
168
|
-
symlinkSync(join('..', 'local-plugins', a.path.split(sep).pop()), a.path);
|
|
169
|
-
} else if (a.kind === 'link-nm') {
|
|
170
|
-
symlinkSync(join('..', 'local-plugins', a.path.split(sep).pop()), a.path);
|
|
171
234
|
}
|
|
172
235
|
done.push(a.kind);
|
|
173
236
|
} catch (e) {
|
package/scripts/sync-plugin.mjs
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* 双副本同步脚本(1.0.0)
|
|
3
3
|
*
|
|
4
4
|
* 源 = 本仓库(脚本所在插件仓库根)
|
|
5
|
-
* 目标 = DSH
|
|
5
|
+
* 目标 = DSH 插件的**真实安装位置**:`.dsh/profiles/<profile>/local-plugins/<插件名>`
|
|
6
|
+
* (`node_modules/<插件名>` 只是**解析入口**,由 DSH/pnpm 安装流程按 profile
|
|
7
|
+
* `package.json` 的 `file:local-plugins/<插件>` 声明生成 —— 本脚本不建链、不改链)
|
|
6
8
|
*
|
|
7
9
|
* 默认 **dryRun**(只打印将要同步的差异,不写入);`--write` 才真同步。
|
|
8
10
|
* 同步内容:lib/** skills/** scripts/** cli.mjs package.json cordis.patch.yml README.md
|
|
@@ -120,14 +122,17 @@ export async function listSyncFiles(root = SOURCE_ROOT) {
|
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
/**
|
|
123
|
-
* 探测 DSH
|
|
125
|
+
* 探测 DSH 插件的部署位置。
|
|
124
126
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* 写的是 `"<插件名>": "file:./local-plugins/<插件名>"`,DSH 加载这里)
|
|
128
|
-
* 2) `<profile>/node_modules/<插件名>` ← npm link 产物(部分运行路径会解析到这里)
|
|
127
|
+
* **真实安装位置 = `<profile>/local-plugins/<插件名>`**(profile 的 package.json 写的是
|
|
128
|
+
* `"<插件名>": "file:local-plugins/<插件名>"`)—— 同步目标就是它。
|
|
129
129
|
*
|
|
130
|
-
*
|
|
130
|
+
* `<profile>/node_modules/<插件名>` 只作**解析入口**探测(部分解析路径经此;实测删掉条目后
|
|
131
|
+
* 从 profile 根 require.resolve 直接 MODULE_NOT_FOUND ⇒ 入口缺失 = 插件加载不到):
|
|
132
|
+
* 该入口由 DSH/pnpm 安装流程生成与维护,**本脚本不再创建/修补它**。
|
|
133
|
+
*
|
|
134
|
+
* 历史教训(2026-10-15):node_modules 下残留真实目录副本(旧版)会**顶替** local-plugins
|
|
135
|
+
* 成为实际加载源,宿主跑旧代码、新工具整批消失 —— 故 planInstall 会对这种形态报警。
|
|
131
136
|
* @param {string} [home] DSH_HOME(默认从环境变量推断)
|
|
132
137
|
* @param {string} [pluginName] 插件名
|
|
133
138
|
* @returns {string[]} 命中的目标目录(local-plugins 在前)
|
|
@@ -258,13 +263,13 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
258
263
|
console.log(` 免重启热重载:${verdict.hot ? '✅ 可(改代码后同步即生效)' : `❌ 不可 —— ${verdict.reason}`}`);
|
|
259
264
|
const actions = planInstall({ profileDir: pd, pluginName });
|
|
260
265
|
if (actions.length) {
|
|
261
|
-
console.log('
|
|
266
|
+
console.log(' 安装形态待办(真源 = local-plugins 真实目录;node_modules 入口由 DSH 安装流程生成,本脚本不建链):');
|
|
262
267
|
for (const a of actions) console.log(` · [${a.kind}] ${a.desc}`);
|
|
263
268
|
if (fix) {
|
|
264
269
|
const res = applyInstall(actions, { on: true });
|
|
265
270
|
console.log(` 已执行:${res.done.join(', ') || '(无)'}${res.skipped.length ? `|跳过:${res.skipped.join(', ')}` : ''}`);
|
|
266
271
|
} else {
|
|
267
|
-
console.log(' (加 --fix
|
|
272
|
+
console.log(' (加 --fix 才执行:解 local-plugins 软链 / 建真实目录;node_modules 相关只报告不动盘)');
|
|
268
273
|
}
|
|
269
274
|
}
|
|
270
275
|
for (const h of depHints(pd, pluginName)) console.log(` ⚠️ ${h}`);
|
|
@@ -31,7 +31,7 @@ generatedBy: deepseek-official/deepseek-v4-flash · EIGHTfs 2026-10-02
|
|
|
31
31
|
| `git_cred_env` | — | 输出凭据环境变量前缀(SSH `GIT_SSH_COMMAND` / HTTPS `GIT_ASKPASS`,不含明文) |
|
|
32
32
|
| `git_gen_ssh_key` | `email`(必填), `force?` | 生成 SSH 密钥对(写入插件配置目录;私钥不出本机,公钥整行回传) |
|
|
33
33
|
| `git_sluice` | `args`(必填) | git 命令透传(凭据自动注入;返回 status + stdout/stderr 原文) |
|
|
34
|
-
| `git_api` | `path?`, `method?`, `query?`, `body?` | **直接调用本插件
|
|
34
|
+
| `git_api` | `path?`, `method?`, `query?`, `body?` | **直接调用本插件 35 条 HTTP API**(内部走 `handleHttp` 同一条代码路径,不另写实现);不传 `path` 则列出全部接口 |
|
|
35
35
|
|
|
36
36
|
典型流程:`git_scan` 看改动 → `code_audit` 自查 → `git_commit_push`(审计通过才推)。
|
|
37
37
|
|
|
@@ -321,3 +321,20 @@ node scripts/readme-gen.mjs <repoPath> [--write <path>] [--template <path>]
|
|
|
321
321
|
| 函数/复杂度被报为 blocker | 规则 `severity` 是上限,检查器不越级;报 blocker 说明 yml 里写的就是 error/blocker |
|
|
322
322
|
| 克隆大文件反复失败 | 失败项的分片必须保留(`.dsh-parts`)才能跨轮 Range 续传;同轮清理分片会让大文件永远从 0 重来 |
|
|
323
323
|
| 建了远端但推送报「远端查不到分支 master(API 404 / ls-remote 无该分支)」 | `git_remote_create` 旧版把 origin 写成 **REST API 端点**(`https://api.github.com/repos/<o>/<r>` ✗ 那不是 git remote)⇒ `git push/fetch origin` 必然失败。2026-10-09 已修(`lib/git/remote.js`):origin 统一写 `https://github.com/<o>/<r>`,并**自愈**——仓库已存在但 origin 仍是 API 形态时 `set-url` 改回;返回体新增 `originAction`(`add`/`repair`/`keep`)。旧仓库手工修:`git remote set-url origin ssh://git@ssh.github.com:443/<o>/<r>.git` 再 `git push -u origin master`(凭据用插件 `id_rsa` + `-p 443`)。⚠️ `lib/git/clone.js` 仍写 API 形态 origin(设计如此,插件自身推送不受影响,但 `git push origin` 会失败) |
|
|
324
|
+
|
|
325
|
+
## 端点:AI 自设工作区路径(workspace-paths)
|
|
326
|
+
|
|
327
|
+
环境注入里的「当前工作目录 cwd」原先取自**会话文件**(`agent.session.header.cwd`),实测可能是**陈旧路径**
|
|
328
|
+
(本机注入过 `0.1.6-alpha.1` 的旧工作区 ⇒ 反而误导)⇒ 改为让 AI 自己登记真实工作区:
|
|
329
|
+
|
|
330
|
+
| 方法 | 路径 | 说明 |
|
|
331
|
+
|---|---|---|
|
|
332
|
+
| GET | `/api/git-push/workspace-paths` | 读清单 + 注入预览(`injection` / `injectionActive` / `file`) |
|
|
333
|
+
| POST | `/api/git-push/workspace-paths` | 写清单:`{paths:[…], mode:"set"\|"add"\|"remove"}`;`{clear:true}` 清空 |
|
|
334
|
+
|
|
335
|
+
- **校验**:只收**绝对路径**、必须**存在且是目录**、去重、上限 20;全被拒或缺参一律 **400**(不返回"成功但空")
|
|
336
|
+
- **存储**:`<配置目录>/workspace-paths.json`(`paths` / `updatedAt` / `updatedBy`,原子写入)
|
|
337
|
+
- **注入**:自设清单**优先显示**(逐条 + 修改入口),会话 cwd 降级标注为「仅兜底,可能陈旧」;
|
|
338
|
+
注入缓存键带上自设清单(否则改完不刷新)
|
|
339
|
+
- **调用**:`git_api({path:'workspace-paths', method:'POST', body:'{"paths":["/abs/path"]}'})`
|
|
340
|
+
- **回归**:`test/test-workspace-paths.mjs`(8 例,含「经 handleHttp 的 JSON 字符串 body」)
|
|
@@ -73,7 +73,7 @@ git-sluice self-check
|
|
|
73
73
|
| `scripts/readme-gen.mjs` | README 生成 |
|
|
74
74
|
| `scripts/preview-gen.mjs`(默认生成 / `--data-only` 只更数据段 / `check` 漂移门禁 / `--watch` 监听) / `scripts/preview-server.mjs`(默认反代真后端 / `--direct` 直连插件 / `--local` 免重启) | 界面预览页生成与漂移门禁、本地真实后端测试服务 |
|
|
75
75
|
| `scripts/browser-page-probe.mjs` | 无头浏览器探针:读页面真实渲染文本 + 抓前端运行时错误(零硬编码路径,自动探测环境) |
|
|
76
|
-
| `scripts/sync-plugin.mjs` |
|
|
76
|
+
| `scripts/sync-plugin.mjs` | 同步(工作区 → 安装副本;**安装位置 = local-plugins 真源**)+ 部署形态与免重启热重载自检:`--profile <名>` 指定 profile(多 profile 必给)、`--fix` 只修 local-plugins 侧形态(解软链 / 建真实目录)。node_modules 入口由 DSH 安装流程生成,本脚本不建链;若那里的副本**内容与真源不一致**会报警(实测会顶掉真源;同 inode 硬链接副本不报) |
|
|
77
77
|
| `scripts/sync-plugin-install.mjs` | 安装形态 / HMR 自检的实现模块(`sync-plugin.mjs` 引用,非独立入口) |
|
|
78
78
|
| `scripts/verify-prestep.mjs` | 上下文注入自检(真实触发 pre-step 校验注入内容) |
|
|
79
79
|
| `scripts/rename-locator.mjs` | 变量重命名位置定位(按作用域聚合) |
|
|
@@ -153,4 +153,37 @@ git_commit_push({ repo: "<仓库路径>", message: "chore: 重写历史后同步
|
|
|
153
153
|
| `git_set_visibility` | 切换 public/private;改 public 前先确认无私密内容 |
|
|
154
154
|
| `git_clone` | 从 GitHub 克隆仓库(Git Data API,不直连 github.com) |
|
|
155
155
|
| `git_sluice` | 浅包装 git 透传(log/diff/branch/tag 等只读或低频命令),凭据自动注入 |
|
|
156
|
+
|
|
157
|
+
## 推荐提交信息写法(结构化条目 `messageItems`)
|
|
158
|
+
|
|
159
|
+
**为什么需要它**:宿主在进插件前按工具 JSON schema 校验参数,`message` **只接受字符串**
|
|
160
|
+
(数组/对象会被直接拒 ✗,报 `invalid arguments: "message" must be a string`)。要写多条目,配 `messageItems`。
|
|
161
|
+
|
|
162
|
+
**推荐用法**:`message` 传标题字符串 + `messageItems` 传要点数组
|
|
163
|
+
(元素为字符串,或 `{what,type?,scope?,why?,verify?,refs?}`;**仅 what 必填**)。
|
|
164
|
+
|
|
165
|
+
```jsonc
|
|
166
|
+
{
|
|
167
|
+
"repo": "/path/to/repo",
|
|
168
|
+
"message": "fix(audit): 修 secret-email 把 @2x 资源名当邮箱的误报",
|
|
169
|
+
"messageItems": [
|
|
170
|
+
{ "what": "pattern 增加资源后缀负向前瞻", "type": "fix", "scope": "audit-rules",
|
|
171
|
+
"why": "视网膜文件名被当成 x@y.tld", "verify": "双向自测 6 例通过" },
|
|
172
|
+
"门禁四项绿;全量测试 0 失败"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**渲染结果**:标题(`message`)+ 逐条 `- 要点` + `why:` / `verify:` / `refs:` 脚注 ✓
|
|
178
|
+
|
|
179
|
+
**该用它的信号**(两个,满足任一即推荐):
|
|
180
|
+
1. 一次提交含**多个要点**(写成一个长句会难读 ✗)
|
|
181
|
+
2. 需要 **why / verify 溯源**(评审时要能看出「为什么改」与「怎么验证的」✓)
|
|
182
|
+
|
|
183
|
+
**不该硬用** ✗:一句话就能说清时用字符串即可 ✓(强行结构化只增加噪音)。
|
|
184
|
+
CLI(`git-sluice commit <仓库> -m "msg"`)只支持字符串 ✓;`messageItems` 走工具/HTTP API ✓。
|
|
185
|
+
|
|
186
|
+
**该用却没用会怎样**:不会失败 ✓;但当单串信息偏长(>150 字符或含换行)时,工具结果会带
|
|
187
|
+
`usageHint` 提醒改用 `messageItems` ✓;采用率留痕在 `<DSH_HOME>/git-push/commit-usage.log`
|
|
188
|
+
(每行一条 JSON:`structured` / `items` / `msgLen` / `repo` ✓,可据此统计实际采用率)。
|
|
156
189
|
| CLI | `git-sluice commit <仓库> -m "msg"` 与工具同源(审计门禁一致);CLI 默认只提交,加 `--push` 才推 |
|