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.
- package/.auditignore +30 -0
- package/.gitignore +39 -0
- package/LICENSE +21 -0
- package/README.md +1486 -2
- package/cli.mjs +360 -0
- package/cordis.patch.yml +14 -0
- package/lib/ARCHITECTURE.md +34 -0
- package/lib/BUGFIX-NOTES-2026-09-14.md +278 -0
- package/lib/app/apply.js +275 -0
- package/lib/app/audit-api.js +158 -0
- package/lib/app/command-registry.js +266 -0
- package/lib/app/constants.js +16 -0
- package/lib/app/handlers/account.js +166 -0
- package/lib/app/handlers/clone.js +168 -0
- package/lib/app/handlers/http-constants.js +9 -0
- package/lib/app/handlers/identity-rewrite.js +94 -0
- package/lib/app/handlers/meta.js +175 -0
- package/lib/app/handlers/npm.js +169 -0
- package/lib/app/handlers/repo-actions.js +143 -0
- package/lib/app/handlers/repos.js +231 -0
- package/lib/app/handlers/settings.js +62 -0
- package/lib/app/host-doc-checks.js +25 -0
- package/lib/app/http-handlers.js +131 -0
- package/lib/app/index.js +30 -0
- package/lib/app/inject-text.js +192 -0
- package/lib/app/scan-root.js +23 -0
- package/lib/app/schema.js +150 -0
- package/lib/app/settings-bridge.js +167 -0
- package/lib/app/slash-commands.js +395 -0
- package/lib/app/slot-stats.js +35 -0
- package/lib/app/tool-call.js +672 -0
- package/lib/app/tools.js +34 -0
- package/lib/ast/brace.js +105 -0
- package/lib/ast/callgraph.js +135 -0
- package/lib/ast/code-lines.js +114 -0
- package/lib/ast/consts.js +12 -0
- package/lib/ast/control-flow.js +461 -0
- package/lib/ast/credential.js +199 -0
- package/lib/ast/dataflow.js +274 -0
- package/lib/ast/dup-code.js +165 -0
- package/lib/ast/index.js +36 -0
- package/lib/ast/io-risk-const.js +95 -0
- package/lib/ast/io-risk-fn.js +208 -0
- package/lib/ast/io-risk-loop.js +308 -0
- package/lib/ast/io-risk.js +314 -0
- package/lib/ast/lang.js +156 -0
- package/lib/ast/line-count.js +52 -0
- package/lib/ast/magic-number.js +272 -0
- package/lib/ast/naming.js +284 -0
- package/lib/ast/perf.js +472 -0
- package/lib/ast/scope.js +241 -0
- package/lib/ast/shell.js +131 -0
- package/lib/ast/size.js +378 -0
- package/lib/ast/symbol-index.js +399 -0
- package/lib/ast/tokenizer.js +341 -0
- package/lib/audit/analysis-coverage.js +98 -0
- package/lib/audit/audit-file.js +182 -0
- package/lib/audit/checks.js +17 -0
- package/lib/audit/client-entry.js +93 -0
- package/lib/audit/collector.js +477 -0
- package/lib/audit/ext-runner.js +80 -0
- package/lib/audit/file-context.js +138 -0
- package/lib/audit/finding.js +50 -0
- package/lib/audit/gitignore-match.js +113 -0
- package/lib/audit/glob.js +63 -0
- package/lib/audit/history-report.js +100 -0
- package/lib/audit/history.js +126 -0
- package/lib/audit/ignore-blind.js +101 -0
- package/lib/audit/index.js +33 -0
- package/lib/audit/orchestrate.js +476 -0
- package/lib/audit/public.js +24 -0
- package/lib/audit/repo-level.js +30 -0
- package/lib/audit/report-yaml.js +86 -0
- package/lib/audit/slot.js +65 -0
- package/lib/audit-defaults.js +18 -0
- package/lib/audit-rules/audit-rules-comment.yml +247 -0
- package/lib/audit-rules/audit-rules-cpp.yml +22 -0
- package/lib/audit-rules/audit-rules-docs.yml +32 -0
- package/lib/audit-rules/audit-rules-dsh.yml +162 -0
- package/lib/audit-rules/audit-rules-filehealth.yml +42 -0
- package/lib/audit-rules/audit-rules-folder.yml +99 -0
- package/lib/audit-rules/audit-rules-frontend.yml +335 -0
- package/lib/audit-rules/audit-rules-go.yml +22 -0
- package/lib/audit-rules/audit-rules-i18n.yml +45 -0
- package/lib/audit-rules/audit-rules-java.yml +105 -0
- package/lib/audit-rules/audit-rules-nodejs.yml +647 -0
- package/lib/audit-rules/audit-rules-npm.yml +187 -0
- package/lib/audit-rules/audit-rules-paths.yml +92 -0
- package/lib/audit-rules/audit-rules-performance.yml +215 -0
- package/lib/audit-rules/audit-rules-php.yml +22 -0
- package/lib/audit-rules/audit-rules-private.yml +24 -0
- package/lib/audit-rules/audit-rules-python.yml +106 -0
- package/lib/audit-rules/audit-rules-robustness.yml +27 -0
- package/lib/audit-rules/audit-rules-rust.yml +22 -0
- package/lib/audit-rules/audit-rules-structure.yml +159 -0
- package/lib/audit-rules/audit-rules-swift.yml +22 -0
- package/lib/audit-rules/audit-rules-template.yml +108 -0
- package/lib/checks/button-bind.js +276 -0
- package/lib/checks/common.js +170 -0
- package/lib/checks/credential-file.js +43 -0
- package/lib/checks/dataflow.js +40 -0
- package/lib/checks/dispatch.js +112 -0
- package/lib/checks/dup-code.js +69 -0
- package/lib/checks/dup-const.js +232 -0
- package/lib/checks/file-health.js +150 -0
- package/lib/checks/filter.js +137 -0
- package/lib/checks/folder.js +173 -0
- package/lib/checks/hardcoded-path.js +98 -0
- package/lib/checks/index.js +46 -0
- package/lib/checks/io.js +66 -0
- package/lib/checks/magic-number.js +42 -0
- package/lib/checks/npm-json.js +273 -0
- package/lib/checks/private.js +63 -0
- package/lib/checks/regex.js +256 -0
- package/lib/checks/semantic.js +134 -0
- package/lib/checks/structural.js +274 -0
- package/lib/cli/commands-account.mjs +107 -0
- package/lib/cli/commands-audit.mjs +144 -0
- package/lib/cli/commands-doc.mjs +127 -0
- package/lib/cli/commands-vcs.mjs +175 -0
- package/lib/client/index.js +162 -0
- package/lib/client-parts/00-loader.js +33 -0
- package/lib/client-parts/01-const.js +207 -0
- package/lib/client-parts/02-utils.js +62 -0
- package/lib/client-parts/03-icons.js +12 -0
- package/lib/client-parts/10-account.js +83 -0
- package/lib/client-parts/11-browser.js +95 -0
- package/lib/client-parts/20-repo.js +374 -0
- package/lib/client-parts/21-audit.js +301 -0
- package/lib/client-parts/22-settings.js +146 -0
- package/lib/client-parts/23-npm.js +383 -0
- package/lib/client-parts/30-page.js +56 -0
- package/lib/client-parts/40-controller.js +1092 -0
- package/lib/client-parts/41-actions.js +279 -0
- package/lib/client-parts/99-apply.js +72 -0
- package/lib/client.js +3195 -0
- package/lib/commit-push.js +148 -0
- package/lib/context/index.js +363 -0
- package/lib/core/atomic-json.js +98 -0
- package/lib/core/config.js +40 -0
- package/lib/core/credentials.js +274 -0
- package/lib/core/endpoints.js +109 -0
- package/lib/core/exec.js +162 -0
- package/lib/exempt/index.js +292 -0
- package/lib/fs/edit-after-read.js +103 -0
- package/lib/fsx.js +87 -0
- package/lib/git/account-status.js +140 -0
- package/lib/git/account.js +233 -0
- package/lib/git/api.js +136 -0
- package/lib/git/atomic-json.js +6 -0
- package/lib/git/browse.js +38 -0
- package/lib/git/clone-download.js +397 -0
- package/lib/git/clone-history-mode.js +143 -0
- package/lib/git/clone-history.js +175 -0
- package/lib/git/clone-jobs.js +250 -0
- package/lib/git/clone-replay-io.js +172 -0
- package/lib/git/clone-replay.js +275 -0
- package/lib/git/clone.js +445 -0
- package/lib/git/cloud.js +46 -0
- package/lib/git/commit-message.js +141 -0
- package/lib/git/config.js +6 -0
- package/lib/git/cred-env.js +88 -0
- package/lib/git/credentials.js +6 -0
- package/lib/git/endpoints.js +6 -0
- package/lib/git/exec.js +6 -0
- package/lib/git/identity-rewrite.js +297 -0
- package/lib/git/identity.js +150 -0
- package/lib/git/ignore.js +69 -0
- package/lib/git/index.js +41 -0
- package/lib/git/module-splitter.js +47 -0
- package/lib/git/post-push.js +101 -0
- package/lib/git/push-diagnose.js +142 -0
- package/lib/git/push.js +476 -0
- package/lib/git/remote-resolve.js +146 -0
- package/lib/git/remote.js +128 -0
- package/lib/git/repo-index.js +512 -0
- package/lib/git/repos.js +235 -0
- package/lib/git/scan-runner.js +159 -0
- package/lib/git/sensitive.js +134 -0
- package/lib/git/transport.js +430 -0
- package/lib/git/visibility.js +35 -0
- package/lib/git/wrapped-git.js +68 -0
- package/lib/http/index.js +170 -0
- package/lib/index.js +24 -0
- package/lib/link-check/index.js +187 -0
- package/lib/npm/account.js +64 -0
- package/lib/npm/install.js +211 -0
- package/lib/npm/npmrc.js +56 -0
- package/lib/npm/publish.js +171 -0
- package/lib/npm/registry.js +168 -0
- package/lib/plugin/auto-detect.js +92 -0
- package/lib/plugin/auto-push.js +154 -0
- package/lib/plugin/index.js +250 -0
- package/lib/readme-templates/readme.yml +38 -0
- package/lib/rule/compilers/credential.js +62 -0
- package/lib/rule/compilers/dataflow.js +38 -0
- package/lib/rule/compilers/file-health.js +75 -0
- package/lib/rule/compilers/frontend.js +86 -0
- package/lib/rule/compilers/func.js +35 -0
- package/lib/rule/compilers/helpers.js +71 -0
- package/lib/rule/compilers/index.js +29 -0
- package/lib/rule/compilers/link-semantic.js +45 -0
- package/lib/rule/compilers/list-kinds.js +12 -0
- package/lib/rule/compilers/numeric-kinds.js +66 -0
- package/lib/rule/compilers/regex.js +78 -0
- package/lib/rule/compilers/structure.js +80 -0
- package/lib/rule/compilers.js +17 -0
- package/lib/rule/homoglyph.js +45 -0
- package/lib/rule/loader.js +270 -0
- package/lib/rule/registry.js +115 -0
- package/lib/rule/scope.js +67 -0
- package/lib/score/docs-score.js +166 -0
- package/lib/score/index.js +140 -0
- package/lib/self/index.js +196 -0
- package/lib/skip-dirs.js +64 -0
- package/lib/tool-probes.json +50 -0
- package/lib/user-requirements.json +14 -0
- package/lib/vendor/js-yaml/LICENSE +21 -0
- package/lib/vendor/js-yaml/js-yaml.mjs +3073 -0
- package/package.json +95 -4
- package/scripts/__pycache__/module-splitter.cpython-38.pyc +0 -0
- package/scripts/audit-ext/_example-readme-present.mjs +34 -0
- package/scripts/audit-ext/variable-min-length.mjs +102 -0
- package/scripts/audit-runner.mjs +35 -0
- package/scripts/audit-runtime-check.mjs +129 -0
- package/scripts/browser-page-probe.mjs +271 -0
- package/scripts/build-client.mjs +119 -0
- package/scripts/check.mjs +88 -0
- package/scripts/clean-date-comments.py +102 -0
- package/scripts/cpu-sample.mjs +188 -0
- package/scripts/doc-drift.mjs +200 -0
- package/scripts/doc-func.mjs +212 -0
- package/scripts/doc-tree.mjs +456 -0
- package/scripts/doc-version.mjs +220 -0
- package/scripts/frontend-preview-check.mjs +124 -0
- package/scripts/hot-path-probe-cjs.cjs +71 -0
- package/scripts/hot-path-probe-fs-shim.mjs +28 -0
- package/scripts/hot-path-probe-fsp-shim.mjs +31 -0
- package/scripts/hot-path-probe.mjs +153 -0
- package/scripts/module-splitter.py +800 -0
- package/scripts/platform-scan.mjs +168 -0
- package/scripts/preview-gen.mjs +489 -0
- package/scripts/preview-local-runner.mjs +55 -0
- package/scripts/preview-server-direct.mjs +116 -0
- package/scripts/preview-server.mjs +305 -0
- package/scripts/preview-slot-data.mjs +123 -0
- package/scripts/probe-recheck.mjs +47 -0
- package/scripts/readme-gen.mjs +268 -0
- package/scripts/rename-locator.mjs +97 -0
- package/scripts/rule-switch.mjs +97 -0
- package/scripts/rules-solo-audit.mjs +173 -0
- package/scripts/scan-file-io.mjs +713 -0
- package/scripts/scan-hardcoded-paths.mjs +125 -0
- package/scripts/scan-repos.mjs +167 -0
- package/scripts/scan-version.mjs +122 -0
- package/scripts/scrub-user-wording.mjs +420 -0
- package/scripts/symbol-index.mjs +85 -0
- package/scripts/sync-plugin-install.mjs +223 -0
- package/scripts/sync-plugin.mjs +279 -0
- package/scripts/verify-prestep.mjs +100 -0
- package/skills/dev/audit-rule-authoring.md +58 -0
- package/skills/dev/dsh-git-push.md +323 -0
- package/skills/dev/git-push-live-fix.md +45 -0
- package/skills/dsh-repo-index.md +35 -0
- package/skills/guide/guide-audit.md +167 -0
- package/skills/guide/guide-cli-scripts.md +104 -0
- package/skills/guide/guide-clone-repos.md +173 -0
- package/skills/guide/guide-commit-push.md +156 -0
- package/skills/guide/guide-inject-ui.md +166 -0
- package/skills/guide/guide-slash-completion.md +118 -0
- package/skills/workflow/README.md +21 -0
- package/skills/workflow/git-commit-discipline.md +68 -0
- package/skills/workflow/git-project-startup.md +85 -0
- package/skills/workflow/git-rebuild-process.md +57 -0
- package/skills/workflow/github-operations.md +91 -0
- package/skills/workflow/readme-sync-git-md.md +28 -0
- package/skills/workflow/task-completion-report.md +73 -0
- package/skills/workflow/tool-json-add-ask.md +35 -0
- package/skills/workflow/versioning-rule.md +211 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/* ─────────────────── [7] 审计 Tab(WeightRows/RuleRow/AuditSwitchBlock/InjectPromptSwitchBlock/CommentWordingBlock/AuditAdvancedBlock/RuleListBlock/AuditTab) ─────────────────── */
|
|
2
|
+
/** 10 维度权重行(值来自 state.weightValues,改即写回 weightOverrides JSON)。 */
|
|
3
|
+
function dshgp_WeightRows(props) {
|
|
4
|
+
const s = props.state;
|
|
5
|
+
const rows = dshgp_DIMENSIONS.map((d) => jsx.jsxs('div', {
|
|
6
|
+
key: d.key,
|
|
7
|
+
className: 'dshgp_weightrow',
|
|
8
|
+
children: [
|
|
9
|
+
jsx.jsx('span', { className: 'dshgp_weightkey', children: d.key }),
|
|
10
|
+
jsx.jsx('input', {
|
|
11
|
+
type: 'number', min: 0, max: 100,
|
|
12
|
+
className: 'dshgp_weightinput',
|
|
13
|
+
value: s.weightValues[d.key] != null ? s.weightValues[d.key] : d.def,
|
|
14
|
+
onChange: (ev) => props.editWeight(d.key, Number(ev.target.value) || 0),
|
|
15
|
+
}),
|
|
16
|
+
jsx.jsx('span', { className: 'dshgp_rulemeta', children: '默认 ' + d.def }),
|
|
17
|
+
],
|
|
18
|
+
}));
|
|
19
|
+
const total = dshgp_DIMENSIONS.reduce((a, d) => a + (s.weightValues[d.key] != null ? s.weightValues[d.key] : d.def), 0);
|
|
20
|
+
return jsx.jsxs('div', {
|
|
21
|
+
children: [
|
|
22
|
+
rows,
|
|
23
|
+
jsx.jsx('p', { className: 'dshgp_weighttotal', children: '合计 ' + total + '(建议 100;保存后下次审计生效)' }),
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 规则包行(交互改版):
|
|
30
|
+
* ① 详细信息改为**悬停浮层**(.dshgp_hovercard,悬停行内信息区显示描述/作者/统计口径),
|
|
31
|
+
* 常显只留「名称 + 拦截/警告/通过」——不再占用行高、不推挤列表。
|
|
32
|
+
* ② 启用/禁用**只由行尾的启停按钮**触发(.dshgp_powerBtn);整行不再可点击切换,
|
|
33
|
+
* 避免想拖选/看详情时误触状态。
|
|
34
|
+
* ③ 状态底色:启用 = 绿底 + 绿左条,禁用 = 红底 + 红左条(见 CSS .dshgp_rowOn/.dshgp_rowOff)。
|
|
35
|
+
* 其余:↑↓ 调次序;nodejs/private 为安全红线锁定不可禁用。
|
|
36
|
+
*/
|
|
37
|
+
function dshgp_RuleRow(props, slot, idx, len) {
|
|
38
|
+
const s = props.state;
|
|
39
|
+
const meta = (s.slotMeta && s.slotMeta[slot]) || {};
|
|
40
|
+
const name = meta.name || slot;
|
|
41
|
+
const author = meta.author || '';
|
|
42
|
+
const stats = (meta && meta.stats) || { blocker: 0, warning: 0, pass: 0, total: 0, source: 'rules' };
|
|
43
|
+
// 口径统一为 yml 规则条数:三个数字是「该规则包里各严重级的规则条数」,
|
|
44
|
+
// 不是审计命中数。此前后端在跑过审计时改显命中数,而命中数按**次数**累加、规则数是**条数**,
|
|
45
|
+
// 同排对比会出现「245 警告 / 37 总规则」这类越界假数据;现固定为条数口径,不再分支。
|
|
46
|
+
const countTitle = (kind) => {
|
|
47
|
+
const n = kind === '拦截' ? stats.blocker : (kind === '警告' ? stats.warning : stats.pass);
|
|
48
|
+
return `${name}:${kind}级规则 ${n} 条(共 ${stats.total} 条规则)`;
|
|
49
|
+
};
|
|
50
|
+
// 禁用态 = yml 顶层 disabled(后端 listRuleSlots 解析);点击即时反馈靠 toggleDisabled
|
|
51
|
+
// 本地翻转 slotMeta,loadSlots 对账 yml 真实状态。
|
|
52
|
+
const disabled = !!meta.disabled;
|
|
53
|
+
const locked = slot === 'nodejs' || slot === 'private';
|
|
54
|
+
const move = (dir) => props.moveSlot(slot, dir);
|
|
55
|
+
// 悬停浮层内容:描述/作者/统计口径说明(原常显 meta 行移到这里)
|
|
56
|
+
const hoverCard = jsx.jsxs('div', {
|
|
57
|
+
className: 'dshgp_hovercard',
|
|
58
|
+
children: [
|
|
59
|
+
jsx.jsx('div', { className: 'dshgp_hoverTitle', children: name }),
|
|
60
|
+
author ? jsx.jsx('div', { className: 'dshgp_hoverRow', children: '作者: ' + author }) : null,
|
|
61
|
+
meta.description ? jsx.jsx('div', { className: 'dshgp_hoverRow', children: meta.description }) : null,
|
|
62
|
+
jsx.jsx('div', {
|
|
63
|
+
className: 'dshgp_hoverRow',
|
|
64
|
+
children: `规则条数:拦截级 ${stats.blocker} 条 · 警告级 ${stats.warning} 条 · 提示级 ${stats.pass} 条(共 ${stats.total} 条规则)`,
|
|
65
|
+
}),
|
|
66
|
+
jsx.jsx('div', { className: 'dshgp_hoverRow', children: locked ? '安全红线:nodejs/private 不可禁用' : (disabled ? '当前禁用——点右侧按钮启用' : '当前启用——点右侧按钮禁用') }),
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
// 启停按钮:行内唯一可切换状态的位置(整行 onClick 已移除)
|
|
70
|
+
const powerBtn = jsx.jsx('button', {
|
|
71
|
+
type: 'button',
|
|
72
|
+
className: 'dshgp_powerBtn ' + (disabled ? 'dshgp_powerOff' : 'dshgp_powerOn'),
|
|
73
|
+
disabled: locked,
|
|
74
|
+
onClick: (ev) => { ev.stopPropagation(); props.toggleDisabled(slot); },
|
|
75
|
+
title: locked ? 'nodejs/private 安全红线,不可禁用' : (disabled ? '点击启用该规则包' : '点击禁用该规则包'),
|
|
76
|
+
'aria-label': (disabled ? '启用规则包 ' : '禁用规则包 ') + name,
|
|
77
|
+
'aria-pressed': !disabled,
|
|
78
|
+
children: disabled ? '禁用' : '启用',
|
|
79
|
+
});
|
|
80
|
+
return jsx.jsxs('li', {
|
|
81
|
+
key: slot,
|
|
82
|
+
className: 'dshgp_rulerow ' + (disabled ? 'dshgp_rowOff' : 'dshgp_rowOn'),
|
|
83
|
+
children: [
|
|
84
|
+
jsx.jsx('button', { type: 'button', className: 'dshgp_mini', disabled: idx === 0, onClick: (ev) => { ev.stopPropagation(); move(-1); }, 'aria-label': name + ' 上移', children: '↑' }),
|
|
85
|
+
jsx.jsx('button', { type: 'button', className: 'dshgp_mini', disabled: idx === len - 1, onClick: (ev) => { ev.stopPropagation(); move(1); }, 'aria-label': name + ' 下移', children: '↓' }),
|
|
86
|
+
jsx.jsxs('div', {
|
|
87
|
+
className: 'dshgp_ruleinfo',
|
|
88
|
+
children: [
|
|
89
|
+
jsx.jsx('span', { className: 'dshgp_rulename', children: name }),
|
|
90
|
+
hoverCard,
|
|
91
|
+
],
|
|
92
|
+
}),
|
|
93
|
+
jsx.jsx('span', { className: 'dshgp_rulecountRed', title: countTitle('拦截'), children: String(stats.blocker) }),
|
|
94
|
+
jsx.jsx('span', { className: 'dshgp_rulecountYellow', title: countTitle('警告'), children: String(stats.warning) }),
|
|
95
|
+
jsx.jsx('span', { className: 'dshgp_rulecountGreen', title: countTitle('通过'), children: String(stats.pass) }),
|
|
96
|
+
jsx.jsx('span', { className: 'dshgp_rulebadge', children: powerBtn }),
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** 审计开关块:提交前自动审计 + 注入开发者要求清单子开关。 */
|
|
102
|
+
function dshgp_AuditSwitchBlock(props) {
|
|
103
|
+
const s = props.state;
|
|
104
|
+
return jsx.jsxs('div', {
|
|
105
|
+
className: 'dshgp_block',
|
|
106
|
+
children: [
|
|
107
|
+
jsx.jsxs('div', {
|
|
108
|
+
className: 'dshgp_switchrow',
|
|
109
|
+
children: [
|
|
110
|
+
jsx.jsx('span', { className: 'dshgp_switchlabel', children: '提交前自动审计' }),
|
|
111
|
+
jsx.jsx('input', { type: 'checkbox', checked: !!s.auditEnabled, onChange: (ev) => props.toggleAudit(ev.target.checked), 'aria-label': '提交前自动审计' }),
|
|
112
|
+
],
|
|
113
|
+
}),
|
|
114
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: '开启后 git_commit_push 提交前自动跑 L0 静态检查 + 10 维度质量评分;有 blocker 拦截提交。' }),
|
|
115
|
+
/* 审计扫描范围单按钮:**一个按钮单击切换** diff/full,状态体现在
|
|
116
|
+
按钮标题 + 颜色(diff=绿色「部分」,full=黄色「全量」)。父开关关闭时置灰
|
|
117
|
+
(不生效但保留选择)。持久化走 host HTTP(persistence=memory 陷阱绕开方案)。 */
|
|
118
|
+
jsx.jsxs('div', {
|
|
119
|
+
className: 'dshgp_scanrow' + (s.auditEnabled ? '' : ' dshgp_subswitchOff'),
|
|
120
|
+
children: [
|
|
121
|
+
jsx.jsx('span', { className: 'dshgp_switchlabel', children: '审计扫描范围' }),
|
|
122
|
+
jsx.jsx('button', {
|
|
123
|
+
type: 'button',
|
|
124
|
+
className: 'dshgp_scanbtn '
|
|
125
|
+
+ (s.auditScanScope === 'full' ? 'dshgp_scanbtnFull' : 'dshgp_scanbtnDiff')
|
|
126
|
+
+ (s.auditEnabled ? '' : ' dshgp_scanbtnOff'),
|
|
127
|
+
onClick: () => props.toggleAuditScanScope(s.auditScanScope === 'full' ? 'diff' : 'full'),
|
|
128
|
+
children: s.auditScanScope === 'full' ? '🔴 全量(auditFull)' : '🟢 部分(本次变动)',
|
|
129
|
+
'aria-label': '审计扫描范围:' + (s.auditScanScope === 'full' ? '全量' : '仅本次变动') + '(单击切换)',
|
|
130
|
+
title: s.auditScanScope === 'full'
|
|
131
|
+
? '当前:全量扫描(auditFull)——单击切回「部分」(仅本次变动,快)'
|
|
132
|
+
: '当前:仅本次变动(auditChanged,diff)——单击切换「全量」(慢但彻底)',
|
|
133
|
+
disabled: !s.auditEnabled,
|
|
134
|
+
}),
|
|
135
|
+
],
|
|
136
|
+
}),
|
|
137
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: s.auditScanScope === 'full'
|
|
138
|
+
? '全量扫描(auditFull):涵括历史遗留文件与全仓 js-yaml 引用证据;大仓库耗时明显。'
|
|
139
|
+
: '部分扫描(auditChanged,diff):只审提交相关的文件,最快(默认)。' }),
|
|
140
|
+
/* 子开关:注入开发者要求清单。
|
|
141
|
+
2026-09-13 交互修正:原来父开关关闭时 `disabled` + toggle 直接 return,等于
|
|
142
|
+
「点不动、点了也没反应」,必须先点一次父开关再点它(两遍)。现改为:
|
|
143
|
+
**一遍即可勾选并保留**(勾选是偏好,与父开关无关),父开关关闭时只把整行置灰
|
|
144
|
+
(dshgp_subswitchOff)表示「暂不生效」,host 侧注入本身由
|
|
145
|
+
`cfg.auditEnabled && cfg.injectRequirements` 门控,不会真的注入。 */
|
|
146
|
+
jsx.jsxs('div', {
|
|
147
|
+
className: 'dshgp_switchrow dshgp_subswitch' + (s.auditEnabled ? '' : ' dshgp_subswitchOff'),
|
|
148
|
+
children: [
|
|
149
|
+
jsx.jsx('span', { className: 'dshgp_switchlabel', children: '↳ 注入开发者要求清单到系统提示词' }),
|
|
150
|
+
jsx.jsx('input', {
|
|
151
|
+
type: 'checkbox',
|
|
152
|
+
checked: !!s.injectRequirements,
|
|
153
|
+
onChange: (ev) => props.toggleInjectRequirements(ev.target.checked),
|
|
154
|
+
'aria-label': '注入开发者要求清单到系统提示词',
|
|
155
|
+
title: s.auditEnabled ? '' : '已勾选但暂不生效:需开启上方「提交前自动审计」',
|
|
156
|
+
}),
|
|
157
|
+
],
|
|
158
|
+
}),
|
|
159
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: s.auditEnabled
|
|
160
|
+
? '开启后把「开发者特殊要求」清单注入系统提示词,AI 常驻可见、不必等提交被拦截才去读清单(省一次失败的工具往返)。'
|
|
161
|
+
: (s.injectRequirements
|
|
162
|
+
? '已勾选,但上方「提交前自动审计」未开启 → 暂不注入(勾选已保留,开启父开关即生效)。'
|
|
163
|
+
: '可直接勾选;「提交前自动审计」未开启时置灰、暂不注入。') }),
|
|
164
|
+
],
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** 注入总开关块(新增, 语义扩展):控制 systemPrompt 段 + 上下文注入启停。 */
|
|
169
|
+
function dshgp_InjectPromptSwitchBlock(props) {
|
|
170
|
+
const s = props.state;
|
|
171
|
+
return jsx.jsxs('div', {
|
|
172
|
+
className: 'dshgp_block',
|
|
173
|
+
children: [
|
|
174
|
+
jsx.jsxs('div', {
|
|
175
|
+
className: 'dshgp_switchrow',
|
|
176
|
+
children: [
|
|
177
|
+
jsx.jsx('span', { className: 'dshgp_switchlabel', children: '注入系统提示词/上下文' }),
|
|
178
|
+
jsx.jsx('input', {
|
|
179
|
+
type: 'checkbox',
|
|
180
|
+
checked: s.injectSystemPrompt !== false,
|
|
181
|
+
onChange: (ev) => props.toggleInjectSystemPrompt(ev.target.checked),
|
|
182
|
+
'aria-label': '注入系统提示词/上下文',
|
|
183
|
+
}),
|
|
184
|
+
],
|
|
185
|
+
}),
|
|
186
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: s.injectSystemPrompt !== false
|
|
187
|
+
? '系统提示词:①插件功能用法(每个工具怎么用 + 凭据由插件托管,避免 AI 绕开插件到处找 token)③提交前 README 核对提醒 + 要求清单。上下文:②环境(工作区目录映射 + 工具安装路径 + skill 总入口一行,每个 agent 首次 step 注入一次;工具按 lib/tool-probes.json 模板探测,路径生成到运行目录 tools.json)。只注入目录/路径级信息,不注入 skill 正文。'
|
|
188
|
+
: '已关闭:不注入任何系统提示词段落与上下文环境信息(AI 仍可调用插件工具,但看不到功能用法与环境目录)。' }),
|
|
189
|
+
],
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** 代码禁用户沟通词开关块(控制 comment 槽位启停)。 */
|
|
194
|
+
function dshgp_CommentWordingBlock(props) {
|
|
195
|
+
const s = props.state;
|
|
196
|
+
return jsx.jsxs('div', {
|
|
197
|
+
className: 'dshgp_block',
|
|
198
|
+
children: [
|
|
199
|
+
jsx.jsxs('div', {
|
|
200
|
+
className: 'dshgp_switchrow',
|
|
201
|
+
children: [
|
|
202
|
+
jsx.jsx('span', { className: 'dshgp_switchlabel', children: '代码禁用户沟通词(命中 Block 提交)' }),
|
|
203
|
+
jsx.jsx('input', { type: 'checkbox', checked: !((s.slotMeta && s.slotMeta['comment']) || {}).disabled, onChange: () => props.toggleDisabled('comment'), 'aria-label': '代码禁用户沟通词' }),
|
|
204
|
+
],
|
|
205
|
+
}),
|
|
206
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: '代码注释/文档出现沟通残留措辞(见 comment 规则包黑名单)→ blocker 拦截提交;白名单业务词(用户ID/用户登录等)自动豁免。' }),
|
|
207
|
+
],
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** 审计进阶设置块(收敛:只剩「全量扫描文件上限」)。 */
|
|
212
|
+
function dshgp_AuditAdvancedBlock(props) {
|
|
213
|
+
const s = props.state;
|
|
214
|
+
// 修复:React 的 jsx(type, props, key) 第三参数是 **key 不是 children**——
|
|
215
|
+
// 此前写成 jsx('select', props, options.map(...)) 导致 children 丢失、下拉框渲染为空
|
|
216
|
+
// (页面只剩一个空 <select>,用户看到「下拉没有那三种」)。children 必须放进 props。
|
|
217
|
+
const sel = (key, values) => jsx.jsx('select', {
|
|
218
|
+
className: 'dshgp_input dshgp_inputInline',
|
|
219
|
+
value: s[key],
|
|
220
|
+
onChange: (ev) => props.setAdvanced(key, ev.target.value),
|
|
221
|
+
children: values.map((v) => jsx.jsx('option', { key: v, value: v, children: v })),
|
|
222
|
+
});
|
|
223
|
+
return jsx.jsxs('div', {
|
|
224
|
+
className: 'dshgp_block',
|
|
225
|
+
children: [
|
|
226
|
+
jsx.jsx('p', { className: 'dshgp_h2', children: '审计进阶设置' }),
|
|
227
|
+
// 本块只保留「全量扫描文件上限」一项。
|
|
228
|
+
// 删除项(均为 AI 擅自添加、非用户可配):审计强度(固定完整流程)、自定规则目录、
|
|
229
|
+
// 硬编码全量扫(该项其实从未接上审计实现,是空开关)。
|
|
230
|
+
// 硬编码扫描范围随审计范围走——审计扫多少,硬编码就扫多少,不再单独控制。
|
|
231
|
+
jsx.jsxs('div', { className: 'dshgp_field', children: [
|
|
232
|
+
jsx.jsx('label', { className: 'dshgp_label', htmlFor: 'dshgp-maxfiles', children: '全量扫描文件上限' }),
|
|
233
|
+
jsx.jsx('input', { id: 'dshgp-maxfiles', type: 'number', min: 0, className: 'dshgp_input', value: s.maxScanFiles, onChange: (ev) => props.setAdvanced('maxScanFiles', ev.target.value) }),
|
|
234
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: '全量审计最多扫多少个文件(0=不限);超限按「变动优先」截断,弱机防卡死。硬编码检查随此范围一并进行。' }),
|
|
235
|
+
] }),
|
|
236
|
+
],
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** 规则包列表块:列表容器 + 榜单表头 + 逐行渲染(dshgp_RuleRow)。 */
|
|
241
|
+
function dshgp_RuleListBlock(props) {
|
|
242
|
+
const s = props.state;
|
|
243
|
+
const order = Array.isArray(s.ruleOrder) ? s.ruleOrder : [];
|
|
244
|
+
return jsx.jsxs('div', {
|
|
245
|
+
className: 'dshgp_block',
|
|
246
|
+
children: [
|
|
247
|
+
jsx.jsx('p', { className: 'dshgp_h2', children: '规则包列表(↑↓ 调整次序,单击切换启用/禁用)' }),
|
|
248
|
+
s.statusMsg ? jsx.jsx('p', { className: 'dshgp_saved', children: s.statusMsg }) : null,
|
|
249
|
+
order.length === 0
|
|
250
|
+
? jsx.jsx('div', { className: 'dshgp_loading', children: s.slotLoading ? '加载中…' : '(无规则包)' })
|
|
251
|
+
: jsx.jsxs('ul', {
|
|
252
|
+
className: 'dshgp_rulenext',
|
|
253
|
+
children: [
|
|
254
|
+
/* 榜单表头(模仿 skill 记分榜) */
|
|
255
|
+
jsx.jsxs('li', {
|
|
256
|
+
className: 'dshgp_ruleheadrow',
|
|
257
|
+
children: [
|
|
258
|
+
jsx.jsx('span', { className: 'dshgp_ruleheadrowinfo', children: '规则包' }),
|
|
259
|
+
jsx.jsx('span', { className: 'dshgp_rulecountRed', title: '该规则包内拦截级(blocker/error)的规则条数', children: '拦截级' }),
|
|
260
|
+
jsx.jsx('span', { className: 'dshgp_rulecountYellow', title: '该规则包内警告级(warning)的规则条数', children: '警告级' }),
|
|
261
|
+
jsx.jsx('span', { className: 'dshgp_rulecountGreen', title: '该规则包内提示级(info/notice 等其余严重级)的规则条数', children: '提示级' }),
|
|
262
|
+
jsx.jsx('span', { className: 'dshgp_rulebadge', children: '状态' }),
|
|
263
|
+
],
|
|
264
|
+
}),
|
|
265
|
+
order.map((slot, idx) => dshgp_RuleRow(props, slot, idx, order.length)),
|
|
266
|
+
],
|
|
267
|
+
}),
|
|
268
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: '数字含义:三个数字是该规则包内各严重级的**规则条数**(拦截级 + 警告级 + 提示级 = 规则总数),取自 yml 规则文件,与是否跑过审计无关。想知道实际命中情况请看审计报告。' }),
|
|
269
|
+
s.slotError ? jsx.jsx('p', { className: 'dshgp_error', children: s.slotError }) : null,
|
|
270
|
+
],
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 选项卡二:审计(块组合)。
|
|
276
|
+
* 原单函数 122 行(超可读性阈值 max-function-length)拆为四个块组件 + 权重块;
|
|
277
|
+
* **渲染输出零变化**——拆分前后同一预览页审计 tab 的 DOM 逐字节比对为空。
|
|
278
|
+
*/
|
|
279
|
+
function dshgp_AuditTab(props) {
|
|
280
|
+
return jsx.jsxs('div', {
|
|
281
|
+
className: 'dshgp_section',
|
|
282
|
+
children: [
|
|
283
|
+
jsx.jsx(dshgp_AuditSwitchBlock, props),
|
|
284
|
+
jsx.jsx(dshgp_InjectPromptSwitchBlock, props),
|
|
285
|
+
jsx.jsx(dshgp_CommentWordingBlock, props),
|
|
286
|
+
/* ② 审计权重(10 维度) */
|
|
287
|
+
jsx.jsxs('div', {
|
|
288
|
+
className: 'dshgp_block',
|
|
289
|
+
children: [
|
|
290
|
+
jsx.jsx('p', { className: 'dshgp_h2', children: '审计权重(10 维度)' }),
|
|
291
|
+
jsx.jsx(dshgp_WeightRows, { state: props.state, editWeight: props.editWeight }),
|
|
292
|
+
],
|
|
293
|
+
}),
|
|
294
|
+
/* ③ 审计进阶(补齐 UI) */
|
|
295
|
+
jsx.jsx(dshgp_AuditAdvancedBlock, props),
|
|
296
|
+
jsx.jsx(dshgp_RuleListBlock, props),
|
|
297
|
+
],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* ═══════════════════ 选项卡三:设置 ═══════════════════ */
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* ─────────────────── [8] 设置 Tab(SettingsTab) ─────────────────── */
|
|
2
|
+
function dshgp_CredentialBlock(props) {
|
|
3
|
+
const s = props.state;
|
|
4
|
+
return jsx.jsxs('div', {
|
|
5
|
+
className: 'dshgp_block',
|
|
6
|
+
children: [
|
|
7
|
+
// 保存按钮放「凭据与密钥」标题后面(右侧);放弃按钮已删
|
|
8
|
+
jsx.jsxs('div', {
|
|
9
|
+
style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '8px', marginBottom: '8px' },
|
|
10
|
+
children: [
|
|
11
|
+
jsx.jsx('p', { className: 'dshgp_h2', style: { margin: 0 }, children: '凭据与密钥' }),
|
|
12
|
+
jsx.jsx('button', { type: 'button', className: 'dshgp_btn', disabled: !s.dirty || s.saving, onClick: props.save, children: s.saving ? '保存中…' : '保存' }),
|
|
13
|
+
],
|
|
14
|
+
}),
|
|
15
|
+
jsx.jsx('div', {
|
|
16
|
+
className: 'dshgp_field',
|
|
17
|
+
children: [
|
|
18
|
+
jsx.jsxs('label', { className: 'dshgp_label', htmlFor: 'dshgp-token', children: ['GitHub token', s.tokenConfigured ? jsx.jsx('span', { className: 'dshgp_configured', children: '已填写' }) : null] }),
|
|
19
|
+
jsx.jsx('input', {
|
|
20
|
+
// token 编辑框改为**普通编辑框**(原 type=password 掩码显示,
|
|
21
|
+
// 粘贴长 token 时无法核对是否粘全/粘对;改为可见后可直接比对)。
|
|
22
|
+
// 明文仍只在输入态存在:保存后落 config.json(0600),接口不回传明文。
|
|
23
|
+
id: 'dshgp-token', type: 'text', autoComplete: 'off', className: 'dshgp_input',
|
|
24
|
+
placeholder: 'ghp_… 或 github_pat_…', spellCheck: false,
|
|
25
|
+
value: s.text, disabled: !s.writable || s.saving,
|
|
26
|
+
onChange: (ev) => props.edit(ev.target.value),
|
|
27
|
+
}),
|
|
28
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: 'ghp_ / github_pat_ 开头。保存后写入插件配置目录的 config.json(0600),不回传明文、不在设置页留存。' }),
|
|
29
|
+
],
|
|
30
|
+
}),
|
|
31
|
+
jsx.jsx('div', {
|
|
32
|
+
className: 'dshgp_field',
|
|
33
|
+
children: [
|
|
34
|
+
jsx.jsxs('label', { className: 'dshgp_label', htmlFor: 'dshgp-ssh', children: ['SSH 公钥', s.sshConfigured ? jsx.jsx('span', { className: 'dshgp_configured', children: '已填写' }) : null] }),
|
|
35
|
+
jsx.jsx('textarea', {
|
|
36
|
+
id: 'dshgp-ssh', className: 'dshgp_textarea', rows: 3,
|
|
37
|
+
value: s.sshPub, disabled: !s.writable || s.saving,
|
|
38
|
+
onChange: (ev) => props.editSsh(ev.target.value),
|
|
39
|
+
}),
|
|
40
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: 'ssh-ed25519 / ssh-rsa 整行。保存后写入 config.json(与 token 同份配置,互不覆盖),不回传明文。' }),
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
// npm 凭据(token / registry):自包含字段,直接 POST /settings-set,不依赖设置快照
|
|
44
|
+
jsx.jsx(dshgp_NpmCredFields, {}),
|
|
45
|
+
// 邮箱 + 一键生成同一行(编辑框宽度减少,按钮放编辑框后面)
|
|
46
|
+
jsx.jsxs('div', {
|
|
47
|
+
className: 'dshgp_field',
|
|
48
|
+
children: [
|
|
49
|
+
jsx.jsx('label', { className: 'dshgp_label', htmlFor: 'dshgp-email', children: 'SSH 邮箱(一键生成用)' }),
|
|
50
|
+
jsx.jsxs('div', {
|
|
51
|
+
style: { display: 'flex', alignItems: 'center', gap: '8px' },
|
|
52
|
+
children: [
|
|
53
|
+
jsx.jsx('input', {
|
|
54
|
+
id: 'dshgp-email', type: 'text', autoComplete: 'off', className: 'dshgp_input',
|
|
55
|
+
style: { flex: '1 1 40%', maxWidth: '200px', minWidth: '120px' },
|
|
56
|
+
value: s.sshEmail, disabled: s.genKeying,
|
|
57
|
+
onChange: (ev) => props.editEmail(ev.target.value),
|
|
58
|
+
}),
|
|
59
|
+
jsx.jsx('button', { type: 'button', className: 'dshgp_btn dshgp_btnPrimary', disabled: s.genKeying || !s.sshEmail.trim(), onClick: props.genKey, children: s.genKeying ? '生成中…' : '一键生成并复制' }),
|
|
60
|
+
],
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
s.failed ? jsx.jsx('p', { className: 'dshgp_error', children: '保存失败:请检查格式后重试。' }) : null,
|
|
65
|
+
s.savedMsg ? jsx.jsx('p', { className: 'dshgp_saved', children: s.savedMsg }) : null,
|
|
66
|
+
s.genKeyError ? jsx.jsx('p', { className: 'dshgp_error', children: s.genKeyError }) : null,
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** 推送与默认值区块(收敛:只保留推送通道;默认扫描路径复用本地仓库列表选择路径)。 */
|
|
72
|
+
function dshgp_PushDefaultsBlock(props) {
|
|
73
|
+
const s = props.state;
|
|
74
|
+
return jsx.jsxs('div', {
|
|
75
|
+
className: 'dshgp_block',
|
|
76
|
+
children: [
|
|
77
|
+
jsx.jsx('p', { className: 'dshgp_h2', children: '推送与默认值' }),
|
|
78
|
+
jsx.jsxs('div', { className: 'dshgp_field', children: [
|
|
79
|
+
jsx.jsx('label', { className: 'dshgp_label', htmlFor: 'dshgp-pushmethod', children: '推送通道' }),
|
|
80
|
+
// 下拉标签带括号注释(选项 value 仍是 ssh/api/auto,不改值——
|
|
81
|
+
// 兼容 config.json 已保存的 pushMethod;对外显示用「token」称 api 通道)。
|
|
82
|
+
jsx.jsx('select', {
|
|
83
|
+
id: 'dshgp-pushmethod', className: 'dshgp_input dshgp_inputInline',
|
|
84
|
+
value: s.pushMethod, onChange: (ev) => props.setAdvanced('pushMethod', ev.target.value),
|
|
85
|
+
children: [
|
|
86
|
+
{ value: 'ssh', label: 'ssh(默认)' },
|
|
87
|
+
{ value: 'api', label: 'token' },
|
|
88
|
+
{ value: 'auto', label: 'auto(先 ssh 再 token)' },
|
|
89
|
+
].map((o) => jsx.jsx('option', { key: o.value, value: o.value, children: o.label })),
|
|
90
|
+
}),
|
|
91
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: 'ssh = 只走 SSH 私钥(默认);token = 先走 Git Data API(用 token 推),失败回落 SSH;auto = 先 ssh、失败再回落 token。远端分叉时不静默回落,如实报错。' }),
|
|
92
|
+
] }),
|
|
93
|
+
// 推送门禁(类似会话指挥家写操作拦截)——开启后 AI 推送必须
|
|
94
|
+
// 先取得显式放行(带 pushConfirmed:true 重推),否则推送步骤被拦截。
|
|
95
|
+
jsx.jsxs('div', { className: 'dshgp_field', children: [
|
|
96
|
+
jsx.jsx('label', { className: 'dshgp_label', htmlFor: 'dshgp-pushgate', children: '推送门禁' }),
|
|
97
|
+
jsx.jsx('input', {
|
|
98
|
+
id: 'dshgp-pushgate', type: 'checkbox', className: 'dshgp_check',
|
|
99
|
+
checked: !!s.pushGate, onChange: (ev) => props.setAdvanced('pushGate', ev.target.checked),
|
|
100
|
+
}),
|
|
101
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: '开启后:commit 可正常提交,但 push 前必须显式传 pushConfirmed:true 放行——未放行的推送被拦截并提示「推送门禁已开启,需确认后重试」。用于防止未经放行直接推远端。' }),
|
|
102
|
+
] }),
|
|
103
|
+
// 任务完成自动推送(内置自 dsh-task-completion):开关 + 自定义触发文本 + 范围。
|
|
104
|
+
jsx.jsxs('div', { className: 'dshgp_field', children: [
|
|
105
|
+
jsx.jsx('label', { className: 'dshgp_label', htmlFor: 'dshgp-autopush', children: '自动推送(✅任务完成)' }),
|
|
106
|
+
jsx.jsx('input', {
|
|
107
|
+
id: 'dshgp-autopush', type: 'checkbox', className: 'dshgp_check',
|
|
108
|
+
checked: !!s.autoPushEnabled, onChange: (ev) => props.setAdvanced('autoPushEnabled', ev.target.checked),
|
|
109
|
+
}),
|
|
110
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: '开启后:AI 回复含指定完成文案(默认「✅任务完成」,可自定义)自动 commit+push——复用审计门禁(blocker 拦截、requirements 核对、pushGate 放行),不裸提交;默认关。' }),
|
|
111
|
+
] }),
|
|
112
|
+
jsx.jsxs('div', { className: 'dshgp_field', children: [
|
|
113
|
+
jsx.jsx('label', { className: 'dshgp_label', htmlFor: 'dshgp-autopush-trigger', children: '自动推送触发文本' }),
|
|
114
|
+
jsx.jsx('input', {
|
|
115
|
+
id: 'dshgp-autopush-trigger', type: 'text', className: 'dshgp_input',
|
|
116
|
+
value: s.autoPushTriggerText ?? '✅任务完成', onChange: (ev) => props.setAdvanced('autoPushTriggerText', ev.target.value),
|
|
117
|
+
}),
|
|
118
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: '检测「任务完成」的文本/正则(默认「✅任务完成」),可写成 ✅(任务完成|已解答) 等' }),
|
|
119
|
+
] }),
|
|
120
|
+
jsx.jsxs('div', { className: 'dshgp_field', children: [
|
|
121
|
+
jsx.jsx('label', { className: 'dshgp_label', htmlFor: 'dshgp-autopush-scope', children: '自动推送范围' }),
|
|
122
|
+
// 修复:jsx(type, props, key) 第三参数是 key 不是 children——
|
|
123
|
+
// 此前把 options 数组放第三参数导致 children 丢失、下拉渲染为空(与 2026-09-16 同坑)。
|
|
124
|
+
// children 必须放进 props,与 pushMethod/审计进阶 sel 的写法对齐。
|
|
125
|
+
jsx.jsx('select', {
|
|
126
|
+
id: 'dshgp-autopush-scope', className: 'dshgp_input',
|
|
127
|
+
value: s.autoPushScope ?? 'session', onChange: (ev) => props.setAdvanced('autoPushScope', ev.target.value),
|
|
128
|
+
children: ['session', 'all'].map((v) => jsx.jsx('option', { key: v, value: v, children: String(v) })),
|
|
129
|
+
}),
|
|
130
|
+
jsx.jsx('p', { className: 'dshgp_hint', children: 'session=仅会话 cwd 所在仓库(默认,最安全);all=workspace 全部有变更仓库' }),
|
|
131
|
+
] }),
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function dshgp_SettingsTab(props) {
|
|
137
|
+
const s = props.state;
|
|
138
|
+
return jsx.jsxs('div', {
|
|
139
|
+
className: 'dshgp_section',
|
|
140
|
+
children: [
|
|
141
|
+
jsx.jsx(dshgp_CredentialBlock, Object.assign({}, props)),
|
|
142
|
+
jsx.jsx(dshgp_PushDefaultsBlock, Object.assign({}, props)),
|
|
143
|
+
],
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|