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,420 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* scrub-user-wording.mjs —— 清理「用户沟通措辞」独立脚本(非插件入口,AI 可直调)。
|
|
4
|
+
*
|
|
5
|
+
* 背景:dsh-git-push v1.27~v1.44 曾内置 autoCleanCommentWording(提交前自动改写注释措辞),
|
|
6
|
+
* v1.45.0 因「commentStartOf 字符串不感知」三次静默篡改事故(把测试夹具字符串里的
|
|
7
|
+
* 沟通词示例当注释改掉)废除,确立「只警告不删改」总原则。本脚本是它的独立复活版:
|
|
8
|
+
* 插件**不注册任何入口**(不进 lib/、不注册工具/API/设置项),仅作为可执行脚本,
|
|
9
|
+
* 供 AI / 用户需要时手动调用。
|
|
10
|
+
*
|
|
11
|
+
* 相比旧实现的关键修复:
|
|
12
|
+
* 1) 词法感知:逐字符扫描区分「字符串字面量 / 注释 / 代码」,只改写注释段——
|
|
13
|
+
* 字符串里的沟通词示例不会被误伤(三次事故根因)。
|
|
14
|
+
* 2) md 文档跳过 ``` 围栏代码块(测试夹具/示例代码里的措辞是数据,不是沟通残留),
|
|
15
|
+
* 且 md 措辞可能是来源署名/名词用法,交互确认时会标注风险。
|
|
16
|
+
* 3) 先预览再删改:--apply 进入逐条确认(y/n/a/q),确认后才写盘(每文件 .bak 备份);
|
|
17
|
+
* --yes 跳过确认全改(供 AI/非交互场景);非交互环境无 --yes 拒绝写盘。
|
|
18
|
+
* 4) 与审计同规则豁免:文件头前 3 行含 dsh-skip-sensitive / dsh-skip-residue
|
|
19
|
+
* 整文件跳过;行尾含 dsh-skip-sensitive 本行跳过(故意示例/数据行)。
|
|
20
|
+
*
|
|
21
|
+
* 用法:
|
|
22
|
+
* node scripts/scrub-user-wording.mjs <路径...> # dry-run 报告(默认)
|
|
23
|
+
* node scripts/scrub-user-wording.mjs <路径...> --apply # 逐条预览确认后写盘
|
|
24
|
+
* node scripts/scrub-user-wording.mjs <路径...> --apply --yes # 非交互强制全改(.bak 备份)
|
|
25
|
+
* node scripts/scrub-user-wording.mjs --repo <git仓库路径> # 只处理未提交 diff 涉及的文件
|
|
26
|
+
* node scripts/scrub-user-wording.mjs --repo <仓库> --apply --yes
|
|
27
|
+
*
|
|
28
|
+
* 退出码:0=无命中或已处理;2=dry-run 有命中;3=非交互环境拒绝写盘。
|
|
29
|
+
*/
|
|
30
|
+
import { readFileSync, readdirSync, statSync, existsSync } from 'node:fs';
|
|
31
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
32
|
+
import { join, extname, basename, dirname } from 'node:path';
|
|
33
|
+
import { fileURLToPath } from 'node:url';
|
|
34
|
+
import { spawnSync } from 'node:child_process';
|
|
35
|
+
import { createInterface } from 'node:readline';
|
|
36
|
+
import { load as yamlLoad } from '../lib/vendor/js-yaml/js-yaml.mjs';
|
|
37
|
+
import { getSkipSet } from '../lib/skip-dirs.js';
|
|
38
|
+
|
|
39
|
+
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
40
|
+
const DEFAULT_REWRITE_YML = join(SCRIPT_DIR, '..', 'lib', 'audit-rules', 'audit-rules-comment.yml');
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 从 audit-rules-comment.yml 顶层 rewrites 装载改写表。
|
|
44
|
+
* 每条 { match, replace }:match=正则源码(加 g),replace 用 $1/$2 模板。
|
|
45
|
+
* @param {string} [ymlPath]
|
|
46
|
+
* @returns {Array<{re:RegExp, fn:Function}>}
|
|
47
|
+
*/
|
|
48
|
+
export function loadWordingRewrites(ymlPath = DEFAULT_REWRITE_YML) {
|
|
49
|
+
if (!existsSync(ymlPath)) throw new Error(`改写规则文件缺失: ${ymlPath}`);
|
|
50
|
+
const rewritesDoc = yamlLoad(readFileSync(ymlPath, 'utf8')) || {};
|
|
51
|
+
const rows = Array.isArray(rewritesDoc.rewrites) ? rewritesDoc.rewrites : [];
|
|
52
|
+
if (rows.length === 0) throw new Error(`${ymlPath} 缺少顶层 rewrites`);
|
|
53
|
+
return rows.map((row, i) => {
|
|
54
|
+
const src = String(row?.match || '');
|
|
55
|
+
if (!src) throw new Error(`rewrites[${i}] 缺 match`);
|
|
56
|
+
const re = new RegExp(src, 'g');
|
|
57
|
+
const tpl = row.replace == null ? '' : String(row.replace);
|
|
58
|
+
return { re, fn: (...a) => tpl.replace(/\$(\d+)/g, (_, n) => a[Number(n)] ?? '') };
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let WORDING_REWRITES = null;
|
|
63
|
+
function wordingRewrites() {
|
|
64
|
+
if (!WORDING_REWRITES) WORDING_REWRITES = loadWordingRewrites();
|
|
65
|
+
return WORDING_REWRITES;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 对单段文本应用全部改写规则,返回 { text, count }。 */
|
|
69
|
+
function scrubText(text) {
|
|
70
|
+
let scrubbed = text;
|
|
71
|
+
let count = 0;
|
|
72
|
+
for (const { re, fn } of wordingRewrites()) {
|
|
73
|
+
scrubbed = scrubbed.replace(re, (...a) => { count++; return fn(...a); });
|
|
74
|
+
}
|
|
75
|
+
return { text: scrubbed, count };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* ── 词法分段:只把「注释段」交给 scrub,字符串字面量一律跳过 ────────────── */
|
|
79
|
+
|
|
80
|
+
/** 代码文件注释语法选择(按扩展名)。 */
|
|
81
|
+
function commentSyntax(ext) {
|
|
82
|
+
const slash = ['js', 'mjs', 'cjs', 'ts', 'tsx', 'jsx', 'java', 'kt', 'swift', 'go', 'rs', 'php', 'css'];
|
|
83
|
+
const hash = ['py', 'sh', 'bash', 'rb', 'yaml', 'yml', 'conf', 'ini', 'toml', 'pl', 'lua'];
|
|
84
|
+
const html = ['html', 'htm', 'vue'];
|
|
85
|
+
return {
|
|
86
|
+
slash: slash.includes(ext),
|
|
87
|
+
hash: hash.includes(ext),
|
|
88
|
+
html: html.includes(ext),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 代码文件:返回注释段区间 [{start,end}](含注释标记)。
|
|
94
|
+
* 逐字符扫描:先认字符串字面量(' " `,处理 \ 转义),字符串内的 // # /* 不识别;
|
|
95
|
+
* 再认注释(// 行注释、块注释、<!-- -->、# 行注释须在行首/前导空白后)。
|
|
96
|
+
*/
|
|
97
|
+
/**
|
|
98
|
+
* 跳过正则字面量 `/…/flags`(须单行内闭合)。
|
|
99
|
+
*
|
|
100
|
+
* 为什么单独成函数:原 codeCommentRanges 把「正则/字符串两种整体跳过」与「三种注释识别」
|
|
101
|
+
* 混在一个 while 里(自审 max-cyclomatic-complexity 报 30)。两个跳过器各自有内层循环,
|
|
102
|
+
* 提出来既降复杂度,也让「什么算字面量」可单独阅读。
|
|
103
|
+
*
|
|
104
|
+
* @returns {number} 闭合时返回字面量之后的下标;不是正则或未闭合返回 -1(交给后续判定)
|
|
105
|
+
*/
|
|
106
|
+
function skipRegexLiteral(text, i, n) {
|
|
107
|
+
if (text[i] !== '/' || text[i + 1] === '/' || text[i + 1] === '*') return -1;
|
|
108
|
+
let j = i + 1;
|
|
109
|
+
while (j < n) {
|
|
110
|
+
if (text[j] === '\\') { j += 2; continue; }
|
|
111
|
+
if (text[j] === '/') return j + 1;
|
|
112
|
+
if (text[j] === '\n') return -1; // 正则须单行内闭合
|
|
113
|
+
j++;
|
|
114
|
+
}
|
|
115
|
+
return -1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** 跳过字符串/模板字面量(含转义)。@returns {number} 闭合处之后的下标(未闭合则到文末) */
|
|
119
|
+
function skipStringLiteral(text, i, n) {
|
|
120
|
+
const quoteChar = text[i];
|
|
121
|
+
let j = i + 1;
|
|
122
|
+
while (j < n) {
|
|
123
|
+
if (text[j] === '\\') { j += 2; continue; }
|
|
124
|
+
if (text[j] === quoteChar) return j + 1;
|
|
125
|
+
j++;
|
|
126
|
+
}
|
|
127
|
+
return n;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 识别当前位置是否是注释起点(行注释 `//` / 块注释 `/*` / HTML 注释 `<!--`),是则返回区间。
|
|
132
|
+
*
|
|
133
|
+
* 为什么单独成函数:三种注释判定原与两个字面量跳过器混在同一个 while 里,
|
|
134
|
+
* 是该函数圈复杂度偏高(自审报 30)的主因。
|
|
135
|
+
*
|
|
136
|
+
* @returns {{start:number,end:number}|null} 注释区间;未闭合的块注释/HTML 注释取到文末
|
|
137
|
+
*/
|
|
138
|
+
function matchCommentRange(text, i, n, syn) {
|
|
139
|
+
if (syn.slash && text.startsWith('//', i)) {
|
|
140
|
+
let j = text.indexOf('\n', i);
|
|
141
|
+
if (j < 0) j = n;
|
|
142
|
+
return { start: i, end: j };
|
|
143
|
+
}
|
|
144
|
+
if (syn.slash && text.startsWith('/*', i)) {
|
|
145
|
+
const end = text.indexOf('*/', i + 2);
|
|
146
|
+
return { start: i, end: end < 0 ? n : end + 2 };
|
|
147
|
+
}
|
|
148
|
+
if (syn.html && text.startsWith('<!--', i)) {
|
|
149
|
+
const end = text.indexOf('-->', i + 4);
|
|
150
|
+
return { start: i, end: end < 0 ? n : end + 3 };
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function codeCommentRanges(text, syn) {
|
|
156
|
+
const n = text.length;
|
|
157
|
+
const ranges = [];
|
|
158
|
+
let i = 0;
|
|
159
|
+
while (i < n) {
|
|
160
|
+
const ch = text[i];
|
|
161
|
+
// 正则字面量:整体跳过(/…/flags)——否则其中的引号(如 ['"])会把字符串配对搞乱,
|
|
162
|
+
// 吞掉后续注释起点(真实事故:plugin-gate.js 块注释因此漏识别)
|
|
163
|
+
const afterRegex = skipRegexLiteral(text, i, n);
|
|
164
|
+
if (afterRegex >= 0) { i = afterRegex; continue; }
|
|
165
|
+
// 字符串字面量:整体跳过
|
|
166
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
167
|
+
i = skipStringLiteral(text, i, n);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
// 注释:行注释 // 、块注释 /* 、HTML <!-- (判定见 matchCommentRange)
|
|
171
|
+
const comment = matchCommentRange(text, i, n, syn);
|
|
172
|
+
if (comment) { ranges.push(comment); i = comment.end; continue; }
|
|
173
|
+
// # 行注释:须在行首或前导空白后
|
|
174
|
+
if (syn.hash && ch === '#' && (i === 0 || /[\s]/.test(text[i - 1]))) {
|
|
175
|
+
let j = text.indexOf('\n', i);
|
|
176
|
+
if (j < 0) j = n;
|
|
177
|
+
ranges.push({ start: i, end: j });
|
|
178
|
+
i = j;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
i++;
|
|
182
|
+
}
|
|
183
|
+
return ranges;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** md/txt:返回围栏代码块行区间(跳过不 scrub)。支持 ``` 与 ~~~;未闭合按到文件尾。 */
|
|
187
|
+
function markupFenceLines(text) {
|
|
188
|
+
const lines = text.split('\n');
|
|
189
|
+
const fenceLines = new Set();
|
|
190
|
+
let fence = null;
|
|
191
|
+
let start = 0;
|
|
192
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
193
|
+
const match = lines[idx].match(/^[ \t]*(```+|~~~+)/);
|
|
194
|
+
if (match) {
|
|
195
|
+
if (fence === null) { fence = match[1][0]; start = idx; }
|
|
196
|
+
else if (match[1][0] === fence) {
|
|
197
|
+
for (let k = start; k <= idx; k++) fenceLines.add(k);
|
|
198
|
+
fence = null;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (fence !== null) for (let k = start; k < lines.length; k++) fenceLines.add(k);
|
|
203
|
+
return fenceLines;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** 文件头豁免:前 3 行含 dsh-skip-sensitive / dsh-skip-residue → 整文件跳过。 */
|
|
207
|
+
function fileHeaderExempt(text) {
|
|
208
|
+
const head = text.split('\n').slice(0, 3).join('\n');
|
|
209
|
+
return /dsh-skip-(?:sensitive|residue)/i.test(head);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** 行尾豁免:本行含 dsh-skip-sensitive → 本行跳过(故意示例/数据)。 */
|
|
213
|
+
function lineExempt(line) {
|
|
214
|
+
return /dsh-skip-sensitive/i.test(line);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const MARKUP_EXTS = ['md', 'markdown', 'txt'];
|
|
218
|
+
// 跳过目录统一走 lib/skip-dirs.js(node_modules/.git + yml 黑名单关键词),不再各自硬编码。
|
|
219
|
+
const SKIP_DIRS = getSkipSet();
|
|
220
|
+
const SKIP_FILES_RE = /\.(bak\d*|orig)$/i;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* 处理单个文件:返回
|
|
224
|
+
* { path, isMd, original, candidates: [{ n, before, after, start?, end? }], count }
|
|
225
|
+
* 或 null(跳过/无命中)。candidates 中 code 文件带原文件坐标 start/end(段级),
|
|
226
|
+
* md 文件只有行号 n(行级);before/after 仅用于预览。
|
|
227
|
+
*/
|
|
228
|
+
function processFile(filePath) {
|
|
229
|
+
let text;
|
|
230
|
+
try { text = readFileSync(filePath, 'utf8'); } catch { return null; }
|
|
231
|
+
if (fileHeaderExempt(text)) return null;
|
|
232
|
+
const ext = extname(filePath).slice(1).toLowerCase();
|
|
233
|
+
const candidates = [];
|
|
234
|
+
|
|
235
|
+
if (MARKUP_EXTS.includes(ext)) {
|
|
236
|
+
const fenceLines = markupFenceLines(text);
|
|
237
|
+
const lines = text.split('\n');
|
|
238
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
239
|
+
const line = lines[idx];
|
|
240
|
+
if (fenceLines.has(idx) || lineExempt(line)) continue;
|
|
241
|
+
const r = scrubText(line);
|
|
242
|
+
if (r.count > 0 && r.text !== line) {
|
|
243
|
+
candidates.push({ n: idx + 1, before: line, after: r.text });
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (candidates.length === 0) return null;
|
|
247
|
+
return { path: filePath, isMd: true, original: text, candidates, count: candidates.length };
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const syn = commentSyntax(ext);
|
|
251
|
+
if (!syn.slash && !syn.hash && !syn.html) return null; // 未知类型不处理
|
|
252
|
+
const ranges = codeCommentRanges(text, syn);
|
|
253
|
+
if (ranges.length === 0) return null;
|
|
254
|
+
for (const { start, end } of ranges) {
|
|
255
|
+
const seg = text.slice(start, end);
|
|
256
|
+
// 行尾豁免:该注释段所在行若含 dsh-skip-sensitive 则跳过本段
|
|
257
|
+
const lineStart = text.lastIndexOf('\n', start - 1) + 1;
|
|
258
|
+
const lineEnd = text.indexOf('\n', end);
|
|
259
|
+
const wholeLine = text.slice(lineStart, lineEnd < 0 ? text.length : lineEnd);
|
|
260
|
+
if (lineExempt(wholeLine)) continue;
|
|
261
|
+
const r = scrubText(seg);
|
|
262
|
+
if (r.count > 0) {
|
|
263
|
+
candidates.push({
|
|
264
|
+
n: text.slice(0, start).split('\n').length,
|
|
265
|
+
before: seg,
|
|
266
|
+
after: r.text,
|
|
267
|
+
start,
|
|
268
|
+
end,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (candidates.length === 0) return null;
|
|
273
|
+
return { path: filePath, isMd: false, original: text, candidates, count: candidates.length };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** 按确认的候选下标集合重建文件文本(code 段级替换 / md 行级替换)。 */
|
|
277
|
+
function applyConfirmed(file, confirmedSet) {
|
|
278
|
+
if (file.isMd) {
|
|
279
|
+
const lines = file.original.split('\n');
|
|
280
|
+
for (let i = 0; i < file.candidates.length; i++) {
|
|
281
|
+
if (confirmedSet.has(i)) lines[file.candidates[i].n - 1] = file.candidates[i].after;
|
|
282
|
+
}
|
|
283
|
+
return lines.join('\n');
|
|
284
|
+
}
|
|
285
|
+
let out = file.original;
|
|
286
|
+
const ordered = [...file.candidates].map((c, i) => ({ ...c, idx: i })).filter((c) => confirmedSet.has(c.idx));
|
|
287
|
+
// 从后往前替换,避免坐标漂移
|
|
288
|
+
for (const cand of ordered.sort((a, b) => b.start - a.start)) {
|
|
289
|
+
out = out.slice(0, cand.start) + cand.after + out.slice(cand.end);
|
|
290
|
+
}
|
|
291
|
+
return out;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** 递归收集可处理文件列表。 */
|
|
295
|
+
function collectFiles(root, out = []) {
|
|
296
|
+
let st;
|
|
297
|
+
try { st = statSync(root); } catch { return out; }
|
|
298
|
+
if (st.isFile()) {
|
|
299
|
+
if (!SKIP_FILES_RE.test(basename(root))) out.push(root);
|
|
300
|
+
return out;
|
|
301
|
+
}
|
|
302
|
+
for (const name of readdirSync(root)) {
|
|
303
|
+
if (SKIP_DIRS.has(name) || SKIP_FILES_RE.test(name)) continue;
|
|
304
|
+
collectFiles(join(root, name), out);
|
|
305
|
+
}
|
|
306
|
+
return out;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** --repo 模式:取未提交 diff 涉及的文件(含未跟踪文件)。 */
|
|
310
|
+
function repoDiffFiles(repoPath) {
|
|
311
|
+
const r1 = spawnSync('git', ['-C', repoPath, 'diff', '--name-only', '--diff-filter=ACMRT'], { encoding: 'utf8' });
|
|
312
|
+
const r2 = spawnSync('git', ['-C', repoPath, 'ls-files', '--others', '--exclude-standard'], { encoding: 'utf8' });
|
|
313
|
+
const set = new Set();
|
|
314
|
+
if (r1.status === 0) for (const f of r1.stdout.split('\n')) if (f.trim()) set.add(f.trim());
|
|
315
|
+
if (r2.status === 0) for (const f of r2.stdout.split('\n')) if (f.trim()) set.add(f.trim());
|
|
316
|
+
return [...set];
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async function main(argv) {
|
|
320
|
+
const args = argv.slice(2);
|
|
321
|
+
const apply = args.includes('--apply');
|
|
322
|
+
const yes = args.includes('--yes');
|
|
323
|
+
const paths = args.filter((a) => a !== '--apply' && a !== '--yes');
|
|
324
|
+
if (paths.length === 0) {
|
|
325
|
+
console.error('用法: node scripts/scrub-user-wording.mjs <路径...|--repo <仓库>> [--apply [--yes]]');
|
|
326
|
+
process.exit(1);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
let files = [];
|
|
330
|
+
if (paths[0] === '--repo' && paths[1]) {
|
|
331
|
+
const repo = paths[1];
|
|
332
|
+
const rels = repoDiffFiles(repo);
|
|
333
|
+
files = rels.map((f) => join(repo, f));
|
|
334
|
+
} else {
|
|
335
|
+
for (const p of paths) files = files.concat(collectFiles(p));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const report = [];
|
|
339
|
+
for (const f of files) {
|
|
340
|
+
const r = processFile(f);
|
|
341
|
+
if (r) report.push(r);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (report.length === 0) {
|
|
345
|
+
console.log('无命中:所有文件均无沟通措辞(或已豁免/已清理)。');
|
|
346
|
+
process.exit(0);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const totalCount = report.reduce((n, r) => n + r.count, 0);
|
|
350
|
+
for (const r of report) {
|
|
351
|
+
console.log(`\n${r.path}(${r.count} 处)`);
|
|
352
|
+
for (const cand of r.candidates.slice(0, 8)) {
|
|
353
|
+
console.log(` 行${cand.n}: ${(cand.before || '').trim().slice(0, 90)}`);
|
|
354
|
+
console.log(` → ${(cand.after || '').trim().slice(0, 90)}`);
|
|
355
|
+
}
|
|
356
|
+
if (r.candidates.length > 8) console.log(` …另有 ${r.candidates.length - 8} 处`);
|
|
357
|
+
}
|
|
358
|
+
console.log(`\n共 ${report.length} 文件、${totalCount} 处措辞命中。`);
|
|
359
|
+
|
|
360
|
+
if (!apply) {
|
|
361
|
+
console.log('(dry-run 未改任何文件;加 --apply 进入逐条确认,--apply --yes 强制全改)');
|
|
362
|
+
process.exit(2);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// ── 先预览再删改:逐条确认后才写盘 ──
|
|
366
|
+
if (!yes && !process.stdin.isTTY) {
|
|
367
|
+
console.error('非交互环境(stdin 非 TTY):--apply 需要逐条确认,已拒绝写盘。');
|
|
368
|
+
console.error('请用 --apply --yes 强制全改,或先不加 --apply 跑 dry-run 预览。');
|
|
369
|
+
process.exit(3);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
let written = 0;
|
|
373
|
+
let writtenCount = 0;
|
|
374
|
+
if (yes) {
|
|
375
|
+
for (const r of report) {
|
|
376
|
+
const all = new Set(r.candidates.map((_, i) => i));
|
|
377
|
+
const text = applyConfirmed(r, all);
|
|
378
|
+
await writeFile(r.path + '.bak', await readFile(r.path)); // 备份原文件
|
|
379
|
+
await writeFile(r.path, text);
|
|
380
|
+
written++;
|
|
381
|
+
writtenCount += r.count;
|
|
382
|
+
}
|
|
383
|
+
} else {
|
|
384
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
385
|
+
const ask = (q) => new Promise((res) => rl.question(q, res));
|
|
386
|
+
let allRemaining = false; // a=本文件及之后所有候选一律确认,跨文件生效
|
|
387
|
+
let quitAll = false; // q=退出确认,后续文件一律不写
|
|
388
|
+
for (const r of report) {
|
|
389
|
+
const confirmed = [];
|
|
390
|
+
for (let idx = 0; idx < r.candidates.length; idx++) {
|
|
391
|
+
const cand = r.candidates[idx];
|
|
392
|
+
if (allRemaining) { confirmed.push(idx); continue; }
|
|
393
|
+
const risk = r.isMd ? '(md 文档:措辞可能是来源署名/名词用法,注意人工复核)' : '';
|
|
394
|
+
console.log(`\n${r.path}:${cand.n}${risk}`);
|
|
395
|
+
console.log(` - ${(cand.before || '').trim().slice(0, 110)}`);
|
|
396
|
+
console.log(` + ${(cand.after || '').trim().slice(0, 110)}`);
|
|
397
|
+
const raw = await ask('改这条? [y改/n跳过/a改余下/q退出, 默认y] ');
|
|
398
|
+
const ans = (raw == null ? 'q' : String(raw)).trim().toLowerCase(); // EOF 视为退出
|
|
399
|
+
if (ans === 'n') continue;
|
|
400
|
+
if (ans === 'a') { allRemaining = true; confirmed.push(idx); continue; }
|
|
401
|
+
if (ans === 'q') { quitAll = true; break; }
|
|
402
|
+
confirmed.push(idx);
|
|
403
|
+
}
|
|
404
|
+
if (quitAll) break;
|
|
405
|
+
if (confirmed.length > 0) {
|
|
406
|
+
const text = applyConfirmed(r, new Set(confirmed));
|
|
407
|
+
await writeFile(r.path + '.bak', await readFile(r.path)); // 备份原文件
|
|
408
|
+
await writeFile(r.path, text);
|
|
409
|
+
written++;
|
|
410
|
+
writtenCount += confirmed.length;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
rl.close();
|
|
414
|
+
}
|
|
415
|
+
console.log(`已改写 ${written} 个文件、${writtenCount} 处(原文件备份为 *.bak,可还原)。`);
|
|
416
|
+
process.exit(0);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const isDirectRun = process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1];
|
|
420
|
+
if (isDirectRun) main(process.argv);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 跨文件符号索引 CLI —— 把 lib/ast/symbol-index.js 的能力做成可直接跑的命令。
|
|
3
|
+
*
|
|
4
|
+
* 用途:不用起插件/服务,直接对一个仓库出「符号索引 + 跨文件调用边 + 未使用导出候选 + 覆盖率」。
|
|
5
|
+
* 覆盖率 = 连边数 / 可解析调用数(成员调用 `x.y()` 已排除并单独计数),是判断静态分析
|
|
6
|
+
* 「到底解析到了多少」的置信度指标——只看命中数会被「其实没解析到」误导。
|
|
7
|
+
*
|
|
8
|
+
* 用法(在插件仓库根目录执行):
|
|
9
|
+
* node scripts/symbol-index.mjs <仓库目录> [--json] [--unused] [--top N] [--ext .js,.mjs]
|
|
10
|
+
* 例:
|
|
11
|
+
* node scripts/symbol-index.mjs ../dsh-git-push --unused
|
|
12
|
+
* node scripts/symbol-index.mjs ../dsh-codegraph --ext .ts --json > /tmp/idx.json
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
|
15
|
+
import { join, relative, resolve } from 'node:path';
|
|
16
|
+
|
|
17
|
+
import { buildSymbolIndex, indexSummary, unusedExportCandidates } from '../lib/ast/symbol-index.js';
|
|
18
|
+
|
|
19
|
+
const SKIP_DIRS = new Set(['.git', 'node_modules', '.trash', '.codegraph', 'dist', 'build', '__pycache__', '.archify']);
|
|
20
|
+
const DEFAULT_EXTS = ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx'];
|
|
21
|
+
|
|
22
|
+
/** 递归收集源码文件(相对路径,正斜杠)。 */
|
|
23
|
+
function collectFiles(root, exts, dir = root, out = []) {
|
|
24
|
+
let entries = [];
|
|
25
|
+
try { entries = readdirSync(dir); } catch { return out; }
|
|
26
|
+
for (const name of entries) {
|
|
27
|
+
if (SKIP_DIRS.has(name)) continue;
|
|
28
|
+
const full = join(dir, name);
|
|
29
|
+
let st = null;
|
|
30
|
+
try { st = statSync(full); } catch { continue; }
|
|
31
|
+
if (st.isDirectory()) collectFiles(root, exts, full, out);
|
|
32
|
+
else if (exts.some((x) => name.endsWith(x))) out.push(relative(root, full).replace(/\\/g, '/'));
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 解析命令行参数。 */
|
|
38
|
+
function parseArgs(argv) {
|
|
39
|
+
const args = { exts: DEFAULT_EXTS, json: false, unused: false, top: 8 };
|
|
40
|
+
const positional = [];
|
|
41
|
+
for (let i = 0; i < argv.length; i++) {
|
|
42
|
+
const a = argv[i];
|
|
43
|
+
if (a === '--json') args.json = true;
|
|
44
|
+
else if (a === '--unused') args.unused = true;
|
|
45
|
+
else if (a === '--top') args.top = Number(argv[++i] || 8);
|
|
46
|
+
else if (a === '--ext') args.exts = String(argv[++i] || '').split(',').map((s) => s.trim()).filter(Boolean);
|
|
47
|
+
else if (a.startsWith('--')) throw new Error(`未知参数: ${a}`);
|
|
48
|
+
else positional.push(a);
|
|
49
|
+
}
|
|
50
|
+
args.root = positional[0];
|
|
51
|
+
return args;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const args = parseArgs(process.argv.slice(2));
|
|
55
|
+
if (!args.root) {
|
|
56
|
+
console.error('用法: node scripts/symbol-index.mjs <仓库目录> [--json] [--unused] [--top N] [--ext .js,.mjs]');
|
|
57
|
+
process.exit(2);
|
|
58
|
+
}
|
|
59
|
+
const root = resolve(args.root);
|
|
60
|
+
const files = collectFiles(root, args.exts);
|
|
61
|
+
const index = buildSymbolIndex(files, { readFile: (rel) => readFileSync(join(root, rel), 'utf8') });
|
|
62
|
+
const unused = unusedExportCandidates(index);
|
|
63
|
+
|
|
64
|
+
if (args.json) {
|
|
65
|
+
console.log(JSON.stringify({
|
|
66
|
+
root, stats: index.stats, summary: indexSummary(index),
|
|
67
|
+
edges: index.edges, unresolved: index.unresolved, unusedExports: unused,
|
|
68
|
+
}, null, 2));
|
|
69
|
+
} else {
|
|
70
|
+
console.log(`仓库: ${root}`);
|
|
71
|
+
console.log(indexSummary(index));
|
|
72
|
+
console.log(`排除的成员调用: ${index.stats.skippedMemberCalls}(x.y() 这类不经符号索引解析)`);
|
|
73
|
+
const byReason = {};
|
|
74
|
+
for (const u of index.unresolved) byReason[u.reason] = (byReason[u.reason] || 0) + 1;
|
|
75
|
+
console.log(`未解析构成: ${JSON.stringify(byReason)}`);
|
|
76
|
+
const top = index.edges.filter((e) => e.via === 'import').slice(0, args.top);
|
|
77
|
+
if (top.length) {
|
|
78
|
+
console.log(`跨文件调用边(前 ${top.length} 条):`);
|
|
79
|
+
for (const e of top) console.log(` ${e.from}:${e.line} → ${e.to}`);
|
|
80
|
+
}
|
|
81
|
+
if (args.unused) {
|
|
82
|
+
console.log(`未使用导出候选(${unused.length} 个,动态访问/外部引用无法静态判定,仅作线索):`);
|
|
83
|
+
for (const u of unused.slice(0, args.top * 3)) console.log(` ${u.file}:${u.line} ${u.name}`);
|
|
84
|
+
}
|
|
85
|
+
}
|