dsh-git-push 0.0.0-stage → 2.8.6

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 (279) hide show
  1. package/.auditignore +30 -0
  2. package/.gitignore +39 -0
  3. package/LICENSE +21 -0
  4. package/README.md +1486 -2
  5. package/cli.mjs +360 -0
  6. package/cordis.patch.yml +14 -0
  7. package/lib/ARCHITECTURE.md +34 -0
  8. package/lib/BUGFIX-NOTES-2026-09-14.md +278 -0
  9. package/lib/app/apply.js +275 -0
  10. package/lib/app/audit-api.js +158 -0
  11. package/lib/app/command-registry.js +266 -0
  12. package/lib/app/constants.js +16 -0
  13. package/lib/app/handlers/account.js +166 -0
  14. package/lib/app/handlers/clone.js +168 -0
  15. package/lib/app/handlers/http-constants.js +9 -0
  16. package/lib/app/handlers/identity-rewrite.js +94 -0
  17. package/lib/app/handlers/meta.js +175 -0
  18. package/lib/app/handlers/npm.js +169 -0
  19. package/lib/app/handlers/repo-actions.js +143 -0
  20. package/lib/app/handlers/repos.js +231 -0
  21. package/lib/app/handlers/settings.js +62 -0
  22. package/lib/app/host-doc-checks.js +25 -0
  23. package/lib/app/http-handlers.js +131 -0
  24. package/lib/app/index.js +30 -0
  25. package/lib/app/inject-text.js +192 -0
  26. package/lib/app/scan-root.js +23 -0
  27. package/lib/app/schema.js +150 -0
  28. package/lib/app/settings-bridge.js +167 -0
  29. package/lib/app/slash-commands.js +395 -0
  30. package/lib/app/slot-stats.js +35 -0
  31. package/lib/app/tool-call.js +672 -0
  32. package/lib/app/tools.js +34 -0
  33. package/lib/ast/brace.js +105 -0
  34. package/lib/ast/callgraph.js +135 -0
  35. package/lib/ast/code-lines.js +114 -0
  36. package/lib/ast/consts.js +12 -0
  37. package/lib/ast/control-flow.js +461 -0
  38. package/lib/ast/credential.js +199 -0
  39. package/lib/ast/dataflow.js +274 -0
  40. package/lib/ast/dup-code.js +165 -0
  41. package/lib/ast/index.js +36 -0
  42. package/lib/ast/io-risk-const.js +95 -0
  43. package/lib/ast/io-risk-fn.js +208 -0
  44. package/lib/ast/io-risk-loop.js +308 -0
  45. package/lib/ast/io-risk.js +314 -0
  46. package/lib/ast/lang.js +156 -0
  47. package/lib/ast/line-count.js +52 -0
  48. package/lib/ast/magic-number.js +272 -0
  49. package/lib/ast/naming.js +284 -0
  50. package/lib/ast/perf.js +472 -0
  51. package/lib/ast/scope.js +241 -0
  52. package/lib/ast/shell.js +131 -0
  53. package/lib/ast/size.js +378 -0
  54. package/lib/ast/symbol-index.js +399 -0
  55. package/lib/ast/tokenizer.js +341 -0
  56. package/lib/audit/analysis-coverage.js +98 -0
  57. package/lib/audit/audit-file.js +182 -0
  58. package/lib/audit/checks.js +17 -0
  59. package/lib/audit/client-entry.js +93 -0
  60. package/lib/audit/collector.js +477 -0
  61. package/lib/audit/ext-runner.js +80 -0
  62. package/lib/audit/file-context.js +138 -0
  63. package/lib/audit/finding.js +50 -0
  64. package/lib/audit/gitignore-match.js +113 -0
  65. package/lib/audit/glob.js +63 -0
  66. package/lib/audit/history-report.js +100 -0
  67. package/lib/audit/history.js +126 -0
  68. package/lib/audit/ignore-blind.js +101 -0
  69. package/lib/audit/index.js +33 -0
  70. package/lib/audit/orchestrate.js +476 -0
  71. package/lib/audit/public.js +24 -0
  72. package/lib/audit/repo-level.js +30 -0
  73. package/lib/audit/report-yaml.js +86 -0
  74. package/lib/audit/slot.js +65 -0
  75. package/lib/audit-defaults.js +18 -0
  76. package/lib/audit-rules/audit-rules-comment.yml +247 -0
  77. package/lib/audit-rules/audit-rules-cpp.yml +22 -0
  78. package/lib/audit-rules/audit-rules-docs.yml +32 -0
  79. package/lib/audit-rules/audit-rules-dsh.yml +162 -0
  80. package/lib/audit-rules/audit-rules-filehealth.yml +42 -0
  81. package/lib/audit-rules/audit-rules-folder.yml +99 -0
  82. package/lib/audit-rules/audit-rules-frontend.yml +335 -0
  83. package/lib/audit-rules/audit-rules-go.yml +22 -0
  84. package/lib/audit-rules/audit-rules-i18n.yml +45 -0
  85. package/lib/audit-rules/audit-rules-java.yml +105 -0
  86. package/lib/audit-rules/audit-rules-nodejs.yml +647 -0
  87. package/lib/audit-rules/audit-rules-npm.yml +187 -0
  88. package/lib/audit-rules/audit-rules-paths.yml +92 -0
  89. package/lib/audit-rules/audit-rules-performance.yml +215 -0
  90. package/lib/audit-rules/audit-rules-php.yml +22 -0
  91. package/lib/audit-rules/audit-rules-private.yml +24 -0
  92. package/lib/audit-rules/audit-rules-python.yml +106 -0
  93. package/lib/audit-rules/audit-rules-robustness.yml +27 -0
  94. package/lib/audit-rules/audit-rules-rust.yml +22 -0
  95. package/lib/audit-rules/audit-rules-structure.yml +159 -0
  96. package/lib/audit-rules/audit-rules-swift.yml +22 -0
  97. package/lib/audit-rules/audit-rules-template.yml +108 -0
  98. package/lib/checks/button-bind.js +276 -0
  99. package/lib/checks/common.js +170 -0
  100. package/lib/checks/credential-file.js +43 -0
  101. package/lib/checks/dataflow.js +40 -0
  102. package/lib/checks/dispatch.js +112 -0
  103. package/lib/checks/dup-code.js +69 -0
  104. package/lib/checks/dup-const.js +232 -0
  105. package/lib/checks/file-health.js +150 -0
  106. package/lib/checks/filter.js +137 -0
  107. package/lib/checks/folder.js +173 -0
  108. package/lib/checks/hardcoded-path.js +98 -0
  109. package/lib/checks/index.js +46 -0
  110. package/lib/checks/io.js +66 -0
  111. package/lib/checks/magic-number.js +42 -0
  112. package/lib/checks/npm-json.js +273 -0
  113. package/lib/checks/private.js +63 -0
  114. package/lib/checks/regex.js +256 -0
  115. package/lib/checks/semantic.js +134 -0
  116. package/lib/checks/structural.js +274 -0
  117. package/lib/cli/commands-account.mjs +107 -0
  118. package/lib/cli/commands-audit.mjs +144 -0
  119. package/lib/cli/commands-doc.mjs +127 -0
  120. package/lib/cli/commands-vcs.mjs +175 -0
  121. package/lib/client/index.js +162 -0
  122. package/lib/client-parts/00-loader.js +33 -0
  123. package/lib/client-parts/01-const.js +207 -0
  124. package/lib/client-parts/02-utils.js +62 -0
  125. package/lib/client-parts/03-icons.js +12 -0
  126. package/lib/client-parts/10-account.js +83 -0
  127. package/lib/client-parts/11-browser.js +95 -0
  128. package/lib/client-parts/20-repo.js +374 -0
  129. package/lib/client-parts/21-audit.js +301 -0
  130. package/lib/client-parts/22-settings.js +146 -0
  131. package/lib/client-parts/23-npm.js +383 -0
  132. package/lib/client-parts/30-page.js +56 -0
  133. package/lib/client-parts/40-controller.js +1092 -0
  134. package/lib/client-parts/41-actions.js +279 -0
  135. package/lib/client-parts/99-apply.js +72 -0
  136. package/lib/client.js +3195 -0
  137. package/lib/commit-push.js +148 -0
  138. package/lib/context/index.js +363 -0
  139. package/lib/core/atomic-json.js +98 -0
  140. package/lib/core/config.js +40 -0
  141. package/lib/core/credentials.js +274 -0
  142. package/lib/core/endpoints.js +109 -0
  143. package/lib/core/exec.js +162 -0
  144. package/lib/exempt/index.js +292 -0
  145. package/lib/fs/edit-after-read.js +103 -0
  146. package/lib/fsx.js +87 -0
  147. package/lib/git/account-status.js +140 -0
  148. package/lib/git/account.js +233 -0
  149. package/lib/git/api.js +136 -0
  150. package/lib/git/atomic-json.js +6 -0
  151. package/lib/git/browse.js +38 -0
  152. package/lib/git/clone-download.js +397 -0
  153. package/lib/git/clone-history-mode.js +143 -0
  154. package/lib/git/clone-history.js +175 -0
  155. package/lib/git/clone-jobs.js +250 -0
  156. package/lib/git/clone-replay-io.js +172 -0
  157. package/lib/git/clone-replay.js +275 -0
  158. package/lib/git/clone.js +445 -0
  159. package/lib/git/cloud.js +46 -0
  160. package/lib/git/commit-message.js +141 -0
  161. package/lib/git/config.js +6 -0
  162. package/lib/git/cred-env.js +88 -0
  163. package/lib/git/credentials.js +6 -0
  164. package/lib/git/endpoints.js +6 -0
  165. package/lib/git/exec.js +6 -0
  166. package/lib/git/identity-rewrite.js +297 -0
  167. package/lib/git/identity.js +150 -0
  168. package/lib/git/ignore.js +69 -0
  169. package/lib/git/index.js +41 -0
  170. package/lib/git/module-splitter.js +47 -0
  171. package/lib/git/post-push.js +101 -0
  172. package/lib/git/push-diagnose.js +142 -0
  173. package/lib/git/push.js +476 -0
  174. package/lib/git/remote-resolve.js +146 -0
  175. package/lib/git/remote.js +128 -0
  176. package/lib/git/repo-index.js +512 -0
  177. package/lib/git/repos.js +235 -0
  178. package/lib/git/scan-runner.js +159 -0
  179. package/lib/git/sensitive.js +134 -0
  180. package/lib/git/transport.js +430 -0
  181. package/lib/git/visibility.js +35 -0
  182. package/lib/git/wrapped-git.js +68 -0
  183. package/lib/http/index.js +170 -0
  184. package/lib/index.js +24 -0
  185. package/lib/link-check/index.js +187 -0
  186. package/lib/npm/account.js +64 -0
  187. package/lib/npm/install.js +211 -0
  188. package/lib/npm/npmrc.js +56 -0
  189. package/lib/npm/publish.js +171 -0
  190. package/lib/npm/registry.js +168 -0
  191. package/lib/plugin/auto-detect.js +92 -0
  192. package/lib/plugin/auto-push.js +154 -0
  193. package/lib/plugin/index.js +250 -0
  194. package/lib/readme-templates/readme.yml +38 -0
  195. package/lib/rule/compilers/credential.js +62 -0
  196. package/lib/rule/compilers/dataflow.js +38 -0
  197. package/lib/rule/compilers/file-health.js +75 -0
  198. package/lib/rule/compilers/frontend.js +86 -0
  199. package/lib/rule/compilers/func.js +35 -0
  200. package/lib/rule/compilers/helpers.js +71 -0
  201. package/lib/rule/compilers/index.js +29 -0
  202. package/lib/rule/compilers/link-semantic.js +45 -0
  203. package/lib/rule/compilers/list-kinds.js +12 -0
  204. package/lib/rule/compilers/numeric-kinds.js +66 -0
  205. package/lib/rule/compilers/regex.js +78 -0
  206. package/lib/rule/compilers/structure.js +80 -0
  207. package/lib/rule/compilers.js +17 -0
  208. package/lib/rule/homoglyph.js +45 -0
  209. package/lib/rule/loader.js +270 -0
  210. package/lib/rule/registry.js +115 -0
  211. package/lib/rule/scope.js +67 -0
  212. package/lib/score/docs-score.js +166 -0
  213. package/lib/score/index.js +140 -0
  214. package/lib/self/index.js +196 -0
  215. package/lib/skip-dirs.js +64 -0
  216. package/lib/tool-probes.json +50 -0
  217. package/lib/user-requirements.json +14 -0
  218. package/lib/vendor/js-yaml/LICENSE +21 -0
  219. package/lib/vendor/js-yaml/js-yaml.mjs +3073 -0
  220. package/package.json +95 -4
  221. package/scripts/__pycache__/module-splitter.cpython-38.pyc +0 -0
  222. package/scripts/audit-ext/_example-readme-present.mjs +34 -0
  223. package/scripts/audit-ext/variable-min-length.mjs +102 -0
  224. package/scripts/audit-runner.mjs +35 -0
  225. package/scripts/audit-runtime-check.mjs +129 -0
  226. package/scripts/browser-page-probe.mjs +271 -0
  227. package/scripts/build-client.mjs +119 -0
  228. package/scripts/check.mjs +88 -0
  229. package/scripts/clean-date-comments.py +102 -0
  230. package/scripts/cpu-sample.mjs +188 -0
  231. package/scripts/doc-drift.mjs +200 -0
  232. package/scripts/doc-func.mjs +212 -0
  233. package/scripts/doc-tree.mjs +456 -0
  234. package/scripts/doc-version.mjs +220 -0
  235. package/scripts/frontend-preview-check.mjs +124 -0
  236. package/scripts/hot-path-probe-cjs.cjs +71 -0
  237. package/scripts/hot-path-probe-fs-shim.mjs +28 -0
  238. package/scripts/hot-path-probe-fsp-shim.mjs +31 -0
  239. package/scripts/hot-path-probe.mjs +153 -0
  240. package/scripts/module-splitter.py +800 -0
  241. package/scripts/platform-scan.mjs +168 -0
  242. package/scripts/preview-gen.mjs +489 -0
  243. package/scripts/preview-local-runner.mjs +55 -0
  244. package/scripts/preview-server-direct.mjs +116 -0
  245. package/scripts/preview-server.mjs +305 -0
  246. package/scripts/preview-slot-data.mjs +123 -0
  247. package/scripts/probe-recheck.mjs +47 -0
  248. package/scripts/readme-gen.mjs +268 -0
  249. package/scripts/rename-locator.mjs +97 -0
  250. package/scripts/rule-switch.mjs +97 -0
  251. package/scripts/rules-solo-audit.mjs +173 -0
  252. package/scripts/scan-file-io.mjs +713 -0
  253. package/scripts/scan-hardcoded-paths.mjs +125 -0
  254. package/scripts/scan-repos.mjs +167 -0
  255. package/scripts/scan-version.mjs +122 -0
  256. package/scripts/scrub-user-wording.mjs +420 -0
  257. package/scripts/symbol-index.mjs +85 -0
  258. package/scripts/sync-plugin-install.mjs +223 -0
  259. package/scripts/sync-plugin.mjs +279 -0
  260. package/scripts/verify-prestep.mjs +100 -0
  261. package/skills/dev/audit-rule-authoring.md +58 -0
  262. package/skills/dev/dsh-git-push.md +323 -0
  263. package/skills/dev/git-push-live-fix.md +45 -0
  264. package/skills/dsh-repo-index.md +35 -0
  265. package/skills/guide/guide-audit.md +167 -0
  266. package/skills/guide/guide-cli-scripts.md +104 -0
  267. package/skills/guide/guide-clone-repos.md +173 -0
  268. package/skills/guide/guide-commit-push.md +156 -0
  269. package/skills/guide/guide-inject-ui.md +166 -0
  270. package/skills/guide/guide-slash-completion.md +118 -0
  271. package/skills/workflow/README.md +21 -0
  272. package/skills/workflow/git-commit-discipline.md +68 -0
  273. package/skills/workflow/git-project-startup.md +85 -0
  274. package/skills/workflow/git-rebuild-process.md +57 -0
  275. package/skills/workflow/github-operations.md +91 -0
  276. package/skills/workflow/readme-sync-git-md.md +28 -0
  277. package/skills/workflow/task-completion-report.md +73 -0
  278. package/skills/workflow/tool-json-add-ask.md +35 -0
  279. package/skills/workflow/versioning-rule.md +211 -0
@@ -0,0 +1,127 @@
1
+ /**
2
+ * CLI 命令 · 文档/工具域(file-io/tree-doc/functions/module-splitter)(从 cli.mjs 抽出)
3
+ *
4
+ * 为什么拆出来:cli.mjs 578 行代码超单文件阈值(400),本组 4 个命令是
5
+ * 「文档生成与代码工具」域(扫描文件 I/O / README 目录树 / 函数索引 / 巨型文件拆分),
6
+ * 与审计/账号/VCS 域无共享状态。
7
+ *
8
+ * 保持薄引用:逻辑在 scripts/* 与 lib/git/module-splitter.js(与插件工具同源)。
9
+ */
10
+
11
+ import { scanFileIo, summarize } from '../../scripts/scan-file-io.mjs';
12
+ import { runModuleSplitter } from '../git/module-splitter.js';
13
+ import { spawnSync } from 'node:child_process';
14
+ import { fileURLToPath } from 'node:url';
15
+ import { join } from 'node:path';
16
+
17
+ /** 子进程最大等待时长(ms,tree-doc/functions 共用)。 */
18
+ const SUBPROC_TIMEOUT_MS = 120_000;
19
+
20
+ /**
21
+ * file-io —— 文件读写调用扫描(三标签:类型/操作/上下文)。
22
+ * 输出每条命中带 sync|async、read|write|delete|rename、以及「是否在 async 函数内 /
23
+ * 循环内 / 请求处理路径上」,用于判断同步 I/O 会不会阻塞其他请求、写操作是否高风险。
24
+ * @param {string[]} targets 扫描目标(文件或目录;空=默认 lib/ scripts/ cli.mjs)
25
+ * @param {object} flags { json, summary, write, op, kind, type, risk }
26
+ */
27
+ export function cmdFileIo(targets = [], flags = {}) {
28
+ const splitMulti = (v) => String(v || '').split(',').map((x) => x.trim()).filter(Boolean);
29
+ const hits = scanFileIo({
30
+ targets,
31
+ opFilter: splitMulti(flags.op),
32
+ kindFilter: splitMulti(flags.kind),
33
+ typeFilter: splitMulti(flags.type),
34
+ riskOnly: flags.risk || '',
35
+ writeOnly: !!flags.write,
36
+ });
37
+ if (flags.json) {
38
+ console.log(JSON.stringify({ ok: true, count: hits.length, hits }, null, 2));
39
+ return hits;
40
+ }
41
+ if (flags.summary) { summarize(hits); return hits; }
42
+ if (!hits.length) { console.log('(未命中任何文件操作)'); return hits; }
43
+ // 按文件分组输出(组内按行号,风险降序已由 scanFileIo 排好)
44
+ const byFile = new Map();
45
+ for (const hit of hits) {
46
+ if (!byFile.has(hit.file)) byFile.set(hit.file, []);
47
+ byFile.get(hit.file).push(hit);
48
+ }
49
+ const riskMark = (r) => (r === 'high' ? '🔴' : r === 'medium' ? '🟠' : '·');
50
+ const tagsOf = (hit) => {
51
+ const t = [hit.type === 'sync' ? '同步' : '异步', hit.kind];
52
+ if (hit.inAsync) t.push('async内');
53
+ if (hit.inLoop) t.push('循环内');
54
+ if (hit.inRequest) t.push('请求路径');
55
+ return t.join('·');
56
+ };
57
+ for (const [file, hs] of [...byFile.entries()].sort()) {
58
+ console.log(`\n── ${file} (${hs.length}) ──`);
59
+ for (const hit of hs.sort((a, b) => a.line - b.line)) {
60
+ console.log(` ${riskMark(hit.risk)} L${String(hit.line).padEnd(4)} ${hit.op.padEnd(14)} ${tagsOf(hit)}`);
61
+ console.log(` ${hit.path}`);
62
+ }
63
+ }
64
+ console.log(`\n合计 ${hits.length} 处文件操作(🔴high=写/删且并发路径 · 🟠medium=同步阻塞或写类 · ·low=普通读)`);
65
+ return hits;
66
+ }
67
+
68
+ /** 子命令:tree-doc — README 目录结构维护(封装 scripts/tree-doc.mjs:sync/gen/check/apply)。 */
69
+ export async function cmdTreeDoc(sub, flags) {
70
+ if (!['sync', 'gen', 'check', 'apply'].includes(sub)) {
71
+ console.error(`tree-doc 子命令应为 sync|gen|check|apply(得「${sub || '(空)'}」)`);
72
+ return 1;
73
+ }
74
+ const script = fileURLToPath(new URL('../../scripts/tree-doc.mjs', import.meta.url));
75
+ const args = [script, sub];
76
+ if (flags.root) args.push('--root', String(flags.root));
77
+ if (flags.readme) args.push('--readme', String(flags.readme));
78
+ if (flags.write) args.push('--write');
79
+ const r = spawnSync(process.execPath, args, { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, timeout: SUBPROC_TIMEOUT_MS, stdio: 'inherit' });
80
+ return r.status === 0 ? 0 : 1;
81
+ }
82
+
83
+ /** 子命令:functions — 函数索引(analyze)与函数文档(apply,复用 scripts/func-index.js / functions-doc.mjs)。 */
84
+ export async function cmdFunctions(op, target, flags) {
85
+ if (!['analyze', 'apply'].includes(op)) {
86
+ console.error(`functions 子命令应为 analyze|apply(得「${op || '(空)'}」)`);
87
+ return 1;
88
+ }
89
+ if (op === 'analyze') {
90
+ const dir = target || '.';
91
+ // 输出统一落到当前目录(cwd)根,与 apply 读取位置一致(scan 目标只影响扫描范围)
92
+ const outFile = join(process.cwd(), 'functions-index.json');
93
+ const script = fileURLToPath(new URL('../../scripts/func-index.js', import.meta.url));
94
+ const r = spawnSync(process.execPath, [script, dir, '--out', outFile], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, timeout: SUBPROC_TIMEOUT_MS });
95
+ if (r.error) { console.error(`❌ analyze 失败: ${r.error.message}`); return 1; }
96
+ if (flags.json) { console.log(JSON.stringify({ ok: true, outFile }, null, 2)); return 0; }
97
+ console.log(`✅ 函数索引已生成 → ${outFile}`);
98
+ return 0;
99
+ }
100
+ const { applyFunctionsDocs } = await import('../../scripts/functions-doc.mjs');
101
+ const r = applyFunctionsDocs(process.cwd(), { skipEmpty: flags.skipEmpty === true });
102
+ if (!r.ok) { console.error(`❌ ${r.error}`); return 1; }
103
+ if (flags.json) { console.log(JSON.stringify(r, null, 2)); return 0; }
104
+ console.log(`✅ 函数文档已生成:${r.written.length} 个文件${r.archived?.length ? `(归档 ${r.archived.length})` : ''} → ${r.outDir}`);
105
+ return 0;
106
+ }
107
+
108
+ /** 子命令:module-splitter — 巨型单文件按职责拆分(复用 scripts/module-splitter.py,python3 零依赖)。 */
109
+ export async function cmdModuleSplitter(positional = [], flags = {}) {
110
+ // python3 调用逻辑抽到 lib/git/module-splitter.js(与工具 module_splitter 共用),
111
+ // 此处只做传参与输出格式化(此前两份相同实现,改一处漏一处)。
112
+ const r = runModuleSplitter({
113
+ sub: String(positional[0] || '').trim(),
114
+ target: String(positional[1] || '').trim(),
115
+ dryRun: flags.dryRun === true,
116
+ });
117
+ if (!r.ok) {
118
+ console.error(r.error);
119
+ return { ok: false, error: r.error };
120
+ }
121
+ if (flags.json) {
122
+ console.log(JSON.stringify({ ok: true, command: r.sub, target: r.target, output: r.output }, null, 2));
123
+ } else {
124
+ console.log(r.output);
125
+ }
126
+ return { ok: true, command: r.sub, target: r.target, output: r.output };
127
+ }
@@ -0,0 +1,175 @@
1
+ /**
2
+ * CLI 命令 · VCS 域(仓库扫描/索引/git 透传/提交/链接/克隆)(从 cli.mjs 抽出)
3
+ *
4
+ * 为什么拆出来:cli.mjs 578 行代码超单文件阈值(400),本组 6 个命令是独立的
5
+ * 「版本控制操作」域(repos/index/git/commit/link-check/clone),与审计/文档/账号域
6
+ * 无共享状态(仅依赖 cliPluginConfig 读插件配置)。
7
+ *
8
+ * 保持薄引用:命令只做「传参 + 格式化输出」,逻辑在 lib/git/* 与 lib/commit-push.js
9
+ * (与插件工具同源)。
10
+ */
11
+
12
+ import { scanRepos } from '../git/repos.js';
13
+ import { updateRepoIndex } from '../git/repo-index.js';
14
+ import { runWrappedGit } from '../git/wrapped-git.js';
15
+ import { commitWithAudit } from '../commit-push.js';
16
+ import { checkLinks, sumLinkPenalty } from '../link-check/index.js';
17
+ import { collectTextFiles, readText } from '../audit/collector.js';
18
+ import { cloneViaApi, previewClone } from '../git/clone.js';
19
+ import { DEFAULT_MAX_FILE_MB } from '../git/clone-download.js';
20
+ import { resolveToken } from '../git/credentials.js';
21
+ import { access } from 'node:fs/promises';
22
+ import { join } from 'node:path';
23
+ import { cliPluginConfig } from './commands-audit.mjs';
24
+
25
+ /** git-sluice repos 子命令默认列出上限。 */
26
+ const REPOS_DEFAULT_MAX = 200;
27
+ /** --json 输出截断长度(防大对象刷屏)。 */
28
+ const JSON_PRINT_SNIPPET = 2000;
29
+ /** cmdIndex 默认下钻深度。 */
30
+ const INDEX_DEPTH_DEFAULT = 20;
31
+
32
+ /** 路径是否存在(异步,避免在 async 命令里做同步 I/O)。 */
33
+ async function pathExists(p) {
34
+ try { await access(p); return true; } catch { return false; }
35
+ }
36
+
37
+ /** 子命令:repos — 扫描本地 git 仓库(尊重 .gitignore)。 */
38
+ export function cmdRepos(root, flags) {
39
+ const depth = flags.depth ?? 10;
40
+ const max = flags.max ?? REPOS_DEFAULT_MAX;
41
+ const list = scanRepos(root || '.', { depth, maxRepos: max });
42
+ if (flags.json) {
43
+ console.log(JSON.stringify({ ok: true, root, count: list.length, repos: list }, null, 2));
44
+ return;
45
+ }
46
+ console.log(`扫描 ${root || '.'}(depth=${depth}, max=${max})→ ${list.length} 个仓库:`);
47
+ for (const r of list) {
48
+ const br = r.branch ? ` [${r.branch}]` : '';
49
+ const remote = r.remote ? ` ← ${r.remote}` : ' (无远端)';
50
+ const dirty = r.changed ? ` · 未提交 ${r.changed}` : '';
51
+ console.log(` ${r.name}${br}${dirty}${remote}`);
52
+ console.log(` ${r.path}`);
53
+ }
54
+ console.log(`(被 .gitignore 忽略的目录已整棵跳过,不当独立仓库)`);
55
+ }
56
+
57
+ /** 子命令:index — 重建仓库索引 dsh-repo-index.json。 */
58
+ export async function cmdIndex(root, flags) {
59
+ const depth = flags.depth ?? INDEX_DEPTH_DEFAULT;
60
+ const max = flags.max ?? REPOS_DEFAULT_MAX;
61
+ const owner = flags.owner || 'EIGHTfs';
62
+ // 统一走 updateRepoIndex(mode='rebuild' 读-改-写合并不全量覆盖)
63
+ const r = await updateRepoIndex({
64
+ workspaceRoot: root || '.',
65
+ owner,
66
+ depth,
67
+ maxRepos: max,
68
+ offline: flags.offline === true, // --offline=纯离线(不查 GitHub API)
69
+ mode: 'rebuild',
70
+ });
71
+ if (flags.json) { console.log(JSON.stringify({ ...r, root, owner, offline: !!flags.offline }, null, 2)); return r.ok ? 0 : 1; }
72
+ if (!r.ok) { console.error(`❌ 索引重建失败: ${r.error || ''}`); return 1; }
73
+ console.log(`✅ 索引已更新:${r.target || ''}(新增/更新 ${r.updated ?? 0} 条,indexUpdated=${r.indexUpdated === true})`);
74
+ console.log(` 扫描根 ${root || '.'}(owner=${owner}, depth=${depth}, max=${max}${flags.offline ? ', offline' : ''})`);
75
+ return 0;
76
+ }
77
+
78
+ /** 子命令:git <args> —— 浅包装 git(自动注入插件凭据:SSH 私钥 / HTTPS token),参数与 git 完全一致(1.9.0)。 */
79
+ export async function cmdGit(args = []) {
80
+ if (!args.length || ['-h', '--help', 'help', '--version'].includes(args[0])) {
81
+ console.log('用法: git-sluice git <git 参数> 例: git-sluice git pull / git clone owner/repo / git fetch --all');
82
+ console.log('凭据自动注入(插件 SSH 私钥 / config.json token),无需传 token 参数;退出码与 git 一致。');
83
+ return 0;
84
+ }
85
+ const r = runWrappedGit(args);
86
+ return r.ok ? 0 : (typeof r.status === 'number' ? r.status : 1);
87
+ }
88
+
89
+ /** 子命令:commit — 审计门禁 → 提交(默认只 commit 不 push;--push 推远端;--force 强推)。 */
90
+ export async function cmdCommit(root, flags) {
91
+ const repo = root || '';
92
+ if (!repo || !(await pathExists(join(repo, '.git')))) { console.error(`不是 git 仓库: ${repo || '(空)'}`); return 1; }
93
+ if (!String(flags.message || '').trim()) { console.error('缺少 -m <commit message>'); return 1; }
94
+ // 推送门禁开关取插件配置(config.json pushGate,与侧边栏同一真源);CLI 未确认时会被拦截
95
+ const cfg = cliPluginConfig();
96
+ // 审计门禁:blocker 拦截(v2 审计独立调用——与 DSH 工具 git_commit_push 同一实现 commitWithAudit)
97
+ const commitOutcome = await commitWithAudit({
98
+ repoPath: repo,
99
+ message: flags.message,
100
+ push: flags.push === true,
101
+ dryRun: flags.dryRun === true,
102
+ requirementsConfirmed: flags.reqConfirm === true,
103
+ force: flags.force === true,
104
+ // 推送门禁(设置侧边栏开关)——CLI 对应 --push-gate-confirmed(用户已确认)
105
+ pushGate: cfg.pushGate === true,
106
+ pushConfirmed: flags.pushGateConfirmed === true,
107
+ // 精确 add 路径(逗号分隔,相对 repo);空 = git add -A
108
+ paths: String(flags.paths || ''),
109
+ });
110
+ if (commitOutcome.blocked) {
111
+ console.error(`审计拦截(${commitOutcome.error || 'blocker'}),提交中止:`);
112
+ if (commitOutcome.audit) console.error(` summary: ${JSON.stringify(commitOutcome.audit.summary)}`);
113
+ return 2;
114
+ }
115
+ if (flags.json) console.log(JSON.stringify(commitOutcome, null, 2));
116
+ else {
117
+ if (!commitOutcome.ok && commitOutcome.error) console.error(`提交失败: ${typeof commitOutcome.error === 'string' ? commitOutcome.error : JSON.stringify(commitOutcome.error)}`);
118
+ console.log(JSON.stringify(commitOutcome, null, 2).slice(0, JSON_PRINT_SNIPPET));
119
+ }
120
+ return commitOutcome.ok ? 0 : 2;
121
+ }
122
+
123
+ /** 子命令:link-check — 检查文本文件的链接有效性(只 warning,不拦提交)。 */
124
+ export async function cmdLinkCheck(root = '.') {
125
+ const files = (await collectTextFiles(root, { depth: 5 })).filter((f) => /\.(md|markdown|txt)$/i.test(f.path));
126
+ const all = [];
127
+ for (const f of files) {
128
+ const findings = await checkLinks({ file: f.path, text: readText(f.full) });
129
+ if (findings.length) all.push(...findings);
130
+ }
131
+ console.log(`链接检查 ${root}(${files.length} 个文档)`);
132
+ for (const x of all) console.log(` ${x.file}:${x.line} [${x.linkLevel}${x.flaky ? '/flaky' : ''}] ${x.message}`);
133
+ console.log(`共 ${all.length} 个问题,扣分合计 ${sumLinkPenalty(all)}(只 warning,不拦提交)`);
134
+ }
135
+
136
+ /** clone --preview 预演下载清单(不写盘)。拆分自 cmdClone(降圈复杂度)。 */
137
+ async function runClonePreview(target, flags) {
138
+ // previewClone 不自己解析 token(内部无 resolveToken),私有仓不传就是 404
139
+ const tk = flags.token || resolveToken({ tokenPath: process.env.DSH_GIT_PUSH_TOKEN ? undefined : '', repoPath: '' }).token;
140
+ const pr = await previewClone({ target, token: tk, branch: flags.branch || '' });
141
+ if (flags.json) { console.log(JSON.stringify(pr, null, 2)); return pr.ok ? 0 : 1; }
142
+ if (!pr.ok) { console.error(`❌ 预演失败: ${pr.error || ''}`); return 1; }
143
+ console.log(`预演 ${target}(分支 ${pr.branch || '(默认)'})`);
144
+ // 字段名以 previewClone 实际返回为准:totalFiles/downloadCount/downloadBytes/skipped
145
+ console.log(` 共 ${pr.totalFiles ?? 0} 个文件,将下载 ${pr.downloadCount ?? 0} 个`
146
+ + `(${((pr.downloadBytes || 0) / 1048576).toFixed(1)} MB)`);
147
+ if (pr.skipped?.length) console.log(` ⚠️ 超限跳过 ${pr.skipped.length} 个(> ${flags.maxFileMB ?? DEFAULT_MAX_FILE_MB} MB)`);
148
+ if (pr.empty) console.log(' ⚠️ 全部文件均超限,无内容可下载');
149
+ return 0;
150
+ }
151
+
152
+ /** clone 结果输出(成功/失败/跳过清单)。拆分自 cmdClone(降圈复杂度)。 */
153
+ function printCloneResult(r, flags, target, dest) {
154
+ if (flags.json) { console.log(JSON.stringify(r, null, 2)); return r.ok ? 0 : 1; }
155
+ if (!r.ok) {
156
+ console.error(`\n❌ 克隆未完成:${r.error || ''}`);
157
+ if (r.notFound) console.error(' 目标仓库不存在或无权限(检查 owner/repo 拼写与 token)');
158
+ return 1;
159
+ }
160
+ console.log(`✅ 克隆完成:${target} → ${dest}`);
161
+ if (r.totalFiles != null) console.log(` 文件 ${r.totalFiles} 个(${((r.totalBytes || 0) / 1048576).toFixed(1)} MB)`);
162
+ if (Array.isArray(r.skipped) && r.skipped.length) console.log(` ⚠️ 超限跳过 ${r.skipped.length} 个(> ${flags.maxFileMB ?? DEFAULT_MAX_FILE_MB} MB)`);
163
+ if (r.warnings?.length) for (const w of r.warnings) console.log(` ⚠️ ${w}`);
164
+ return 0;
165
+ }
166
+
167
+ /** 子命令:clone — 从 GitHub 克隆仓库(Git Data API 通道,不直连 github.com)。 */
168
+ export async function cmdClone(flags, positional) {
169
+ const target = String(positional[0] || '').trim();
170
+ if (!target) { console.error('缺少 <owner/repo>(用法: git-sluice clone <owner/repo> [--dest <dir>] [--branch <b>])'); return 1; }
171
+ const dest = flags.dest ? String(flags.dest) : '';
172
+ if (flags.preview === true) return runClonePreview(target, flags);
173
+ const r = await cloneViaApi({ target, dest, branch: flags.branch || '', maxFileMB: flags.maxFileMB ?? DEFAULT_MAX_FILE_MB, concurrency: flags.concurrency });
174
+ return printCloneResult(r, flags, target, dest);
175
+ }
@@ -0,0 +1,162 @@
1
+ /**
2
+ * dsh-git-push 侧边栏(设置 UI)总入口
3
+ * dsh-skip-i18n: 插件为中文零依赖 CLI(无 i18n 框架需求),用户可见文案硬编码为产品设计
4
+ *
5
+ * 0.1.8:手写 createElement(**不用 JSX**,无需构建步骤);**零外部资源**
6
+ * (不引 CDN / 外部字体 / 图片 / 图标字体,图标走 DSH primitives)。
7
+ * 审计开关**默认关**(permitPush 默认关:AI 回复推送许可需用户显式开启)。
8
+ * 配置即时生效:setConfig 立即写回并在同一次 tick 内反映到 UI 模型。
9
+ *
10
+ * 本模块为纯逻辑 + 组件工厂(可注入 mock react 单测,不依赖真实 DOM):
11
+ * - SETTINGS_SCHEMA:设置项声明(键/类型/默认值/文案)——UI 与配置的单一事实源
12
+ * - defaultConfig():默认配置(含审计开关默认关)
13
+ * - resolveConfig(patch):合并用户配置(即时生效)
14
+ * - createSettingsCard(react, ctx):用 createElement 组装设置卡片(无 JSX)
15
+ * - collectExternalRefs():零外部资源自检(列出所有外链引用,应为空)
16
+ */
17
+
18
+ /** 审计/推送开关默认值(关键:默认关)。 */
19
+ const MAX_SCAN_FILES_DEFAULT = 3000; // 全量审计文件数上限默认值
20
+
21
+ export const DEFAULT_CONFIG = {
22
+ auditEnabled: false, // 审计开关默认关
23
+ injectSystemPrompt: true, // 注入总开关:系统提示词(用法/提醒)+ 上下文(环境信息;默认开)
24
+ auditScanScope: 'diff', // diff | full
25
+ maxScanFiles: MAX_SCAN_FILES_DEFAULT, // 全量审计文件数上限(0=不限);超限按变动优先截断,弱机防卡死
26
+ maxCloneFileMB: 10, // clone 单文件体积上限(MB);超过则跳过并如实告知(0=不限制)
27
+ cloneConcurrency: 6, // clone 并发下载数;1=串行最慢,过高会撞 GitHub 风控
28
+ auditRuleOrder: [], // 槽位加载顺序(空=默认偏好顺序;private 恒末尾强制)
29
+ weightOverrides: '', // 权重覆盖 JSON(空=默认权重表)
30
+ pushMethod: 'ssh', // 推送通道:ssh(默认)| api | auto
31
+ // defaultScanRoot/commitMessage 设置移除——默认扫描路径复用本地仓库列表
32
+ // 选择路径(前端 localStorage dshgp-scan-path → repos-local?path=),提交信息留空由调用方生成。
33
+ };
34
+
35
+ /** 设置项声明(UI 单一事实源:侧边栏与配置读写共用)。 */
36
+ export const SETTINGS_SCHEMA = [
37
+ { key: 'auditEnabled', type: 'boolean', default: false, label: '审计开关', hint: '开启后提交前自动审计(默认关)' },
38
+ // 任务完成自动推送:开关默认为关,检测文本可自定义(门禁开关旁)。
39
+ { key: 'autoPushEnabled', type: 'boolean', default: false, label: '自动推送(✅任务完成)', hint: '开启后 AI 回复含指定完成文案即自动 commit+push(复用审计门禁,默认关;建议与审计开关同开)' },
40
+ { key: 'autoPushTriggerText', type: 'string', default: '✅任务完成', label: '自动推送触发文本', hint: '检测「任务完成」的文本/正则(默认「✅任务完成」),可自定义如 ✅(任务完成|已解答);在门禁开关旁设置' },
41
+ { key: 'autoPushScope', type: 'enum', values: ['session', 'all'], default: 'session', label: '自动推送范围', hint: 'session=仅会话 cwd 所在仓库(默认,最安全);all=workspace 全部有变更仓库' },
42
+ { key: 'injectSystemPrompt', type: 'boolean', default: true, label: '注入系统提示词/上下文', hint: '系统提示词:插件功能用法/README 提醒/要求清单(每步);上下文:工作区目录 + 工具安装路径 + skill 总入口(每个 agent 首次 step 注入一次;工具按 lib/tool-probes.json 模板探测,路径生成到 <配置目录>/tools.json)。关=完全不注入。修改即时保存' },
43
+ { key: 'auditScanScope', type: 'enum', values: ['diff', 'full'], default: 'diff', label: '审计扫描范围', hint: 'diff=仅本次变动;full=全量' },
44
+ { key: 'pushMethod', type: 'enum', values: ['ssh', 'api', 'auto'], default: 'ssh', label: '推送通道', hint: 'ssh=推本地 HEAD(远端 sha 与本地一致,默认);api=Git Data API 重建提交(远端 sha 与本地不同);auto=有私钥走 ssh' },
45
+ { key: 'maxScanFiles', type: 'number', default: MAX_SCAN_FILES_DEFAULT, label: '全量扫描文件上限', hint: '全量审计最多扫多少个文件(0=不限);超限时按「变动文件优先」截断,避免弱机扫几万文件卡死' },
46
+ { key: 'maxCloneFileMB', type: 'number', default: 10, label: 'clone 单文件上限(MB)', hint: '克隆时跳过超过该大小的文件并在结果中列出(0=不限制)。仓库里的二进制/媒体大文件常达几十 MB,逐个下载会把请求拖到超时' },
47
+ { key: 'cloneConcurrency', type: 'number', default: 6, label: 'clone 并发数', hint: '同时下载的文件数。1=串行(最慢但最温和);过高会触发 GitHub 风控。受限网络建议 3~6' },
48
+ { key: 'auditRuleOrder', type: 'list', default: [], label: '槽位加载顺序', hint: '逗号分隔槽位名;后加载覆盖先加载;private 恒末尾强制;空=默认偏好顺序' },
49
+ { key: 'auditDisabledSlots', type: 'list', default: [], label: '禁用的规则包', hint: '逗号分隔槽位名;nodejs/private 不可禁用' },
50
+ { key: 'weightOverrides', type: 'string', default: '', label: '权重覆盖 JSON', hint: '如 {"安全性":100};空=默认权重表' },
51
+ ];
52
+
53
+ /** 默认配置(由 SETTINGS_SCHEMA 派生,保证 UI 与默认值永不脱节)。 */
54
+ export function defaultConfig() {
55
+ const out = { ...DEFAULT_CONFIG };
56
+ for (const schemaEntry of SETTINGS_SCHEMA) out[schemaEntry.key] = schemaEntry.default;
57
+ return out;
58
+ }
59
+
60
+ /**
61
+ * 合并用户配置(即时生效:未知键丢弃,类型按 schema 校正)。
62
+ * @param {object} patch 用户配置片段
63
+ * @param {object} [base] 基线(默认 defaultConfig)
64
+ * @returns {object} 合并后配置
65
+ */
66
+ export function resolveConfig(patch = {}, base = defaultConfig()) {
67
+ const out = { ...base };
68
+ const byKey = new Map(SETTINGS_SCHEMA.map((s) => [s.key, s]));
69
+ for (const [k, v] of Object.entries(patch || {})) {
70
+ const schema = byKey.get(k);
71
+ if (!schema) continue; // 未知键丢弃
72
+ if (schema.type === 'boolean') out[k] = v === true;
73
+ else if (schema.type === 'enum') out[k] = schema.values.includes(v) ? v : schema.default;
74
+ else if (schema.type === 'list') out[k] = Array.isArray(v) ? v : String(v ?? '').split(',').map((s) => s.trim()).filter(Boolean);
75
+ else out[k] = String(v ?? '');
76
+ }
77
+ return out;
78
+ }
79
+
80
+ /**
81
+ * 组装设置卡片元素树(手写 createElement,无 JSX)。
82
+ * @param {object} react React 兼容对象(需有 createElement;测试可注入 mock)
83
+ * @param {object} [opts] { config, onChange, labels }
84
+ * @returns {object} React 元素(mock 下为 {type,props} 形状)
85
+ */
86
+ export function createSettingsCard(react, { config = defaultConfig(), onChange = () => {}, labels = {} } = {}) {
87
+ if (!react || typeof react.createElement !== 'function') {
88
+ throw new Error('createSettingsCard 需要 react.createElement(不支持 JSX 构建)');
89
+ }
90
+ const createEl = react.createElement;
91
+ const rows = SETTINGS_SCHEMA.map((item) => {
92
+ if (item.type === 'boolean') {
93
+ return createEl('label', { key: item.key, className: 'dsh-git-push-row' }, [
94
+ createEl('input', {
95
+ key: 'input', type: 'checkbox', checked: config[item.key] === true,
96
+ onChange: (e) => onChange(item.key, e?.target?.checked === true),
97
+ }),
98
+ createEl('span', { key: 'label' }, labels[item.key] || item.label),
99
+ ]);
100
+ }
101
+ if (item.type === 'enum') {
102
+ return createEl('label', { key: item.key, className: 'dsh-git-push-row' }, [
103
+ createEl('select', {
104
+ key: 'input', value: config[item.key],
105
+ onChange: (e) => onChange(item.key, e?.target?.value),
106
+ }, item.values.map((v) => createEl('option', { key: v, value: v }, v))),
107
+ createEl('span', { key: 'label' }, labels[item.key] || item.label),
108
+ ]);
109
+ }
110
+ if (item.type === 'list') {
111
+ return createEl('label', { key: item.key, className: 'dsh-git-push-row' }, [
112
+ createEl('input', {
113
+ key: 'input', type: 'text', value: Array.isArray(config[item.key]) ? config[item.key].join(', ') : '',
114
+ onChange: (e) => onChange(item.key, e?.target?.value ?? ''),
115
+ }),
116
+ createEl('span', { key: 'label' }, labels[item.key] || item.label),
117
+ ]);
118
+ }
119
+ return createEl('label', { key: item.key, className: 'dsh-git-push-row' }, [
120
+ createEl('input', {
121
+ key: 'input', type: 'text', value: config[item.key] ?? '',
122
+ onChange: (e) => onChange(item.key, e?.target?.value ?? ''),
123
+ }),
124
+ createEl('span', { key: 'label' }, labels[item.key] || item.label),
125
+ ]);
126
+ });
127
+ return createEl('div', { className: 'dsh-git-push-settings' }, rows);
128
+ }
129
+
130
+ /**
131
+ * 零外部资源自检:收集设置 UI 中引用的外部资源(http(s):// / //cdn / url(...))。
132
+ * 应为空数组(不引 CDN、外部字体/图片);测试断言用。
133
+ * @param {string} [css] 内联样式文本(可选)
134
+ * @returns {string[]} 命中的外部引用
135
+ */
136
+ export function collectExternalRefs(css = '') {
137
+ const out = [];
138
+ const re = /(https?:\/\/[^\s'")]+|\/\/[a-z0-9.-]+\/[^\s'")]*|url\([^)]*\))/gi;
139
+ for (const match of String(css).matchAll(re)) out.push(match[0]);
140
+ return out;
141
+ }
142
+
143
+ /** 侧边栏内联样式(零外部资源:纯内联 CSS,无 @import / 无外链)。 */
144
+ export const INLINE_CSS = `
145
+ .dsh-git-push-settings { display: flex; flex-direction: column; gap: 8px; }
146
+ .dsh-git-push-row { display: flex; align-items: center; gap: 8px; }
147
+ .dsh-git-push-row span { font-size: 13px; }
148
+ `;
149
+
150
+ /** 导出模块描述(DSH 客户端插件接线用,1.0.0 接线时消费)。 */
151
+ export function clientModuleInfo() {
152
+ return {
153
+ id: 'dsh-git-push',
154
+ settingsNamespace: 'git-push',
155
+ // 只保留 settings.section(设置左侧栏独立页)。
156
+ // settings.plugin.item(插件配置卡)已删除(只保留 settings.section 独立页)。
157
+ slots: ['settings.section'],
158
+ jsx: false,
159
+ externalResources: collectExternalRefs(INLINE_CSS),
160
+ defaultConfig: defaultConfig(),
161
+ };
162
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * dsh-git-push v2 设置侧边栏(settings.section 独立页)
3
+ * ============================================================================
4
+ * 重写(三选项卡版):
5
+ * - 纯中文:删 zh/en 键值对字典,用户可见文案直接硬编码中文(产品设计)。
6
+ * - 三选项卡(对齐插件市场 .tabs/.tab/.on 样式,参考 skill 记分板):
7
+ * ① 账号信息(纯展示):token/SSH 公钥检测 → GitHub 登录态/用户名/套餐
8
+ * ② 审计:审计开关 + 10 维度权重 + 规则包列表(上下调次序、下覆盖上、
9
+ * 动态加载全部 yml(模板不显示)、规则名后直接显示 描述/作者/拦截/警告/通过 数量、
10
+ * 单击整行切换禁用/启用(auditDisabledSlots,nodejs/private 安全红线不可禁用))
11
+ * ③ 设置:token / sshkey / 邮箱 + 一键生成(保存按钮在标题右侧、放弃已删)
12
+ * - 只保留 settings.section 注册;settings.plugin.item(插件配置卡)已删除。
13
+ *
14
+ * ⛔ 形态铁律(client-modules 聚合 bundle 兼容):
15
+ * 1. window.__ModuleLoader__.load 必须在文件第 1 行。
16
+ * 2. 全部代码在 factory 函数体内,文件顶层【零声明】(防 combo 拼接撞名)。
17
+ * 3. 内部命名专属前缀 dshgp_(防与其他插件同名声明撞名)。
18
+ * 4. 手写 jsx-runtime(jsx/jsxs),禁止 JSX 构建步骤;零外部资源。
19
+ * ============================================================================
20
+ */
21
+ window.__ModuleLoader__.load({
22
+ id: 'dsh-git-push',
23
+ factory: (require) => {
24
+ var module = { exports: {} };
25
+ var exports = module.exports;
26
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
27
+ const jsx = require('react/jsx-runtime');
28
+ const react = require('react');
29
+ const store = require('@deepseek-ai/dsh-client-store');
30
+
31
+ const NS = 'git-push';
32
+ const SETTINGS_NS = 'git-push';
33
+