dislop 0.9.1 → 1.0.1
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/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +2 -2
- package/.codex-plugin/plugin.json +7 -8
- package/.cursor-plugin/plugin.json +2 -3
- package/.pre-commit-hooks.yaml +5 -12
- package/PRODUCT.md +19 -63
- package/README.md +360 -252
- package/README.zh-CN.md +390 -240
- package/action.yml +30 -39
- package/bin/dislop-mcp.mjs +3 -4
- package/bin/dislop.mjs +4 -4594
- package/gemini-extension.json +2 -2
- package/llms-install.md +68 -0
- package/package.json +17 -63
- package/packs/common/artifact-qa/pack.json +5 -0
- package/packs/common/artifact-qa/prompts/rules.md +11 -0
- package/packs/common/artifact-qa/scripts/index.mjs +173 -0
- package/packs/common/slide-deck/pack.json +6 -0
- package/packs/common/slide-deck/prompts/rules.md +11 -0
- package/packs/common/slide-deck/scripts/index.mjs +62 -0
- package/packs/common/web-ui/pack.json +6 -0
- package/packs/common/web-ui/prompts/rules.md +11 -0
- package/packs/common/web-ui/scripts/index.mjs +80 -0
- package/packs/en/artifact-qa/pack.json +6 -0
- package/packs/en/artifact-qa/prompts/rules.md +14 -0
- package/packs/en/artifact-qa/scripts/index.mjs +90 -0
- package/packs/en/prose/pack.json +7 -0
- package/packs/en/prose/prompts/rules.md +26 -0
- package/packs/en/prose/scripts/index.mjs +290 -0
- package/packs/en/slide-deck/pack.json +7 -0
- package/packs/en/slide-deck/prompts/rules.md +17 -0
- package/packs/en/slide-deck/scripts/index.mjs +81 -0
- package/packs/en/web-ui/pack.json +7 -0
- package/packs/en/web-ui/prompts/rules.md +20 -0
- package/packs/en/web-ui/scripts/index.mjs +103 -0
- package/packs/zh/artifact-qa/pack.json +6 -0
- package/packs/zh/artifact-qa/prompts/rules.md +14 -0
- package/packs/zh/artifact-qa/scripts/index.mjs +89 -0
- package/packs/zh/prose/pack.json +7 -0
- package/packs/zh/prose/prompts/rules.md +26 -0
- package/packs/zh/prose/scripts/index.mjs +305 -0
- package/packs/zh/slide-deck/pack.json +7 -0
- package/packs/zh/slide-deck/prompts/rules.md +17 -0
- package/packs/zh/slide-deck/scripts/index.mjs +75 -0
- package/packs/zh/web-ui/pack.json +7 -0
- package/packs/zh/web-ui/prompts/rules.md +20 -0
- package/packs/zh/web-ui/scripts/index.mjs +98 -0
- package/plugin.json +5 -6
- package/server.json +2 -2
- package/skills/deslop-docs/SKILL.md +10 -8
- package/skills/deslop-slides-docx/SKILL.md +7 -8
- package/skills/deslop-verify/SKILL.md +7 -8
- package/skills/deslop-web-ui/SKILL.md +7 -8
- package/skills/dislop/SKILL.md +16 -28
- package/skills/dislop/references/essay.md +1 -1
- package/skills/dislop/references/essay.zh-CN.md +1 -1
- package/skills/dislop/references/office.md +1 -1
- package/skills/dislop/references/office.zh-CN.md +1 -1
- package/skills/dislop/references/web-ui.md +1 -1
- package/skills/dislop/references/web-ui.zh-CN.md +1 -1
- package/skills/dislop/references/work-docs.md +1 -1
- package/skills/dislop/references/work-docs.zh-CN.md +1 -1
- package/src/cli-main.mjs +210 -0
- package/src/commands/check-fix.mjs +169 -0
- package/src/commands/doctor.mjs +110 -0
- package/src/commands/init.mjs +49 -0
- package/src/commands/login.mjs +82 -0
- package/src/commands/model.mjs +130 -0
- package/src/commands/packs.mjs +44 -0
- package/src/commands/verify.mjs +133 -0
- package/src/commands/voice.mjs +84 -0
- package/src/kernel/config.mjs +232 -0
- package/src/kernel/document-model.mjs +1412 -0
- package/src/kernel/fact-gate.mjs +615 -0
- package/src/kernel/file-discovery.mjs +139 -0
- package/src/{binary-node.mjs → kernel/ooxml-binary.mjs} +532 -893
- package/src/kernel/pack-loader.mjs +715 -0
- package/src/kernel/patcher.mjs +341 -0
- package/src/kernel/pipeline.mjs +267 -0
- package/src/kernel/prompt-assembler.mjs +307 -0
- package/src/kernel/voice-profile.mjs +177 -0
- package/src/mcp/stdio-server.mjs +372 -0
- package/src/runners/auto-fix.mjs +59 -0
- package/src/runners/interactive-tty.mjs +461 -0
- package/src/runners/reporters.mjs +256 -0
- package/src/runtime/chunker.mjs +87 -0
- package/src/runtime/json-extract.mjs +144 -0
- package/src/runtime/privacy-gate.mjs +97 -0
- package/src/runtime/providers/anthropic.mjs +65 -0
- package/src/runtime/providers/cloud.mjs +136 -0
- package/src/runtime/providers/gemini.mjs +91 -0
- package/src/runtime/providers/local-model.mjs +139 -0
- package/src/runtime/providers/openai-compat.mjs +130 -0
- package/src/runtime/router.mjs +315 -0
- package/src/sdk/index.mjs +137 -0
- package/models/manifest.json +0 -90
- package/models/pocket-slop-v1.json +0 -1
- package/packs/business-brief/pack.json +0 -937
- package/packs/core/pack.json +0 -209
- package/packs/deck-and-ui/pack.json +0 -539
- package/packs/engineering-spec/pack.json +0 -144
- package/packs/executive-deck/pack.json +0 -98
- package/packs/literary-essay/pack.json +0 -344
- package/packs/regulated-comms/pack.json +0 -99
- package/patterns/ai-tic-rubric.json +0 -252
- package/patterns/banks/composite-fusion.json +0 -48
- package/patterns/banks/discourse-rhythm.json +0 -95
- package/patterns/banks/lexical-signals.json +0 -92
- package/patterns/banks/syntactic-frames.json +0 -52
- package/patterns/banks/visual-deck.json +0 -44
- package/patterns/dimensions/artifacts.json +0 -121
- package/patterns/dimensions/discourse.json +0 -438
- package/patterns/dimensions/lexical.json +0 -198
- package/patterns/dimensions/rhythm.json +0 -258
- package/patterns/dimensions/syntactic.json +0 -285
- package/patterns/dimensions/visual-and-deck.json +0 -530
- package/patterns/taxonomy.json +0 -112
- package/src/core.mjs +0 -5497
- package/src/dislop/review-picker.vim +0 -114
- package/src/local-model.mjs +0 -997
- package/src/pattern-engine.mjs +0 -1003
- package/src/pocket-model.mjs +0 -729
- package/src/review-apply.mjs +0 -151
- package/src/review-client.mjs +0 -1073
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
roleHint: "适用范围:绕过固定括号正则的中文对话交差痕迹、作者自留备忘指令与测试假名残留。"
|
|
3
|
+
rules:
|
|
4
|
+
- id: implicit-assistant-framing
|
|
5
|
+
priority: strong
|
|
6
|
+
- id: disguised-placeholder-prose
|
|
7
|
+
priority: strong
|
|
8
|
+
- id: synthetic-example-entity
|
|
9
|
+
priority: moderate
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
1. **implicit-assistant-framing**: 当句意面向提示词提问者而非最终读者、属于助手交差开场或客套收尾时触发(例如“根据您提供的会议纪要,现为您梳理如下:”、“以上文稿已按要求压减字数,供您审阅。”)。作者面向真实读者的正常第一人称引言不触发。修改建议:移除该交差过渡句,直接保留正文主体。
|
|
13
|
+
2. **disguised-placeholder-prose**: 当正文中混入写给作者自己的待办备忘而非成品叙述时触发(例如“此处后续补上法务确认后的违约金比例”、“这里需要贴一张压测监控截图”)。修改建议:发稿前补齐真实确认信息,或移除尚未定稿的占位句。
|
|
14
|
+
3. **synthetic-example-entity**: 当正式交付文稿(非接口教学示例)中出现未替换的“某某公司 / 某知名企业 / 张三李四 / 某部门”假名时触发。教学文档或测试规范中的有意示例不触发。修改建议:替换为真实的机构、项目或责任人名称。
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { definePackScripts, maskInlineCode } from "dislop/sdk";
|
|
2
|
+
|
|
3
|
+
const ZH_PLACEHOLDER_PATTERNS = [
|
|
4
|
+
/\[(?:待补充|待填写|此处插入|请填写|占位符|待确认|公司名称|项目名称|姓名|日期)(?:[::\s][^\][\n]{0,40})?\](?!\s*\()/,
|
|
5
|
+
/【[^】\n]{0,20}(?:待补充|待填写|此处插入|请填写|请替换|占位符)[^】\n]{0,20}】/,
|
|
6
|
+
/(?:单击此处添加(?:标题|副标题|文本|备注)|点击此处输入(?:标题|正文|内容))/,
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
const ZH_CHATBOT_WRAPPER_SENTENCES = [
|
|
10
|
+
/^(?:好的|当然|当然可以|没问题)[,,!!]?\s*(?:以下是|下面是|这是为您|这里为您|我已经为您)[\s\S]*$/,
|
|
11
|
+
/^(?:以下是|下面是)(?:为您)?(?:整理|修改|润色|优化|重写|起草)后的?[\s\S]*[::。]$/,
|
|
12
|
+
/^作为一(?:名|个)(?:人工智能|大语言模型|语言模型)[\s\S]*$/,
|
|
13
|
+
/^希望(?:以上|这份|这些|上述|这)(?:内容|方案|回答|总结|信息)?对(?:您|你)有(?:所)?帮助[\s\S]*$/,
|
|
14
|
+
/^如果(?:您|你)(?:还有其他问题|需要进一步(?:修改|调整|补充|展开))[\s\S]*(?:告诉我|提问)[。!!]?$/,
|
|
15
|
+
/^需要我为(?:您|你)进一步(?:展开|细化|调整)[\s\S]*[??]$/,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const ZH_CUTOFF_OR_REFUSAL_RE =
|
|
19
|
+
/(?:截至我的知识截止(?:日期|时间)|很抱歉[,,]作为一(?:名|个)人工智能|我无法满足该请求)/;
|
|
20
|
+
|
|
21
|
+
const ZH_WRAPPER_REGRESSION_RE =
|
|
22
|
+
/^(?:好的[,,!!]|以下是为您|希望以上内容对您)/;
|
|
23
|
+
|
|
24
|
+
export default definePackScripts({
|
|
25
|
+
check(doc, ctx) {
|
|
26
|
+
for (const seg of doc.segments) {
|
|
27
|
+
const text = seg.text.trim();
|
|
28
|
+
const proseOnly = maskInlineCode(text);
|
|
29
|
+
|
|
30
|
+
for (const re of ZH_PLACEHOLDER_PATTERNS) {
|
|
31
|
+
const m = proseOnly.match(re);
|
|
32
|
+
if (m) {
|
|
33
|
+
const hitQuote = text.slice(m.index, m.index + m[0].length);
|
|
34
|
+
ctx.reportDefect({
|
|
35
|
+
ruleId: "unfilled-placeholder",
|
|
36
|
+
severity: "error",
|
|
37
|
+
targetId: seg.id,
|
|
38
|
+
line: seg.line,
|
|
39
|
+
originalQuote: hitQuote,
|
|
40
|
+
fixSafety: "manual",
|
|
41
|
+
actionType: "prompt",
|
|
42
|
+
reason: "正文中存在未替换的中文模板占位符或默认假文。",
|
|
43
|
+
rewritePrompt: `发稿前请将“${hitQuote}”替换为真实信息,或直接删去该未完成句。`,
|
|
44
|
+
});
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (ZH_CHATBOT_WRAPPER_SENTENCES.some((re) => re.test(proseOnly))) {
|
|
50
|
+
ctx.reportDefect({
|
|
51
|
+
ruleId: "chatbot-artifact",
|
|
52
|
+
severity: "error",
|
|
53
|
+
targetId: seg.id,
|
|
54
|
+
line: seg.line,
|
|
55
|
+
originalQuote: seg.text,
|
|
56
|
+
fixSafety: "safe",
|
|
57
|
+
actionType: "delete",
|
|
58
|
+
suggestedReplacement: "",
|
|
59
|
+
reason: "正文中遗留了 AI 对话寒暄开场或客套收尾壳,可直接安全删除。",
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (ZH_CUTOFF_OR_REFUSAL_RE.test(proseOnly)) {
|
|
65
|
+
ctx.reportDefect({
|
|
66
|
+
ruleId: "chatbot-cutoff-leak",
|
|
67
|
+
severity: "error",
|
|
68
|
+
targetId: seg.id,
|
|
69
|
+
line: seg.line,
|
|
70
|
+
originalQuote: seg.text,
|
|
71
|
+
fixSafety: "manual",
|
|
72
|
+
actionType: "prompt",
|
|
73
|
+
reason: "正文中遗留了大模型知识截止说明或拒答套话。",
|
|
74
|
+
rewritePrompt: "删除粘贴进文稿的模型免责声明,并补入经核实的最新事实。",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
verifyFix(_issue, candidateText) {
|
|
81
|
+
if (candidateText && ZH_WRAPPER_REGRESSION_RE.test(candidateText.trim())) {
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
reason: "改写文本中仍残留了面向提问者的 AI 助手寒暄交差句式。",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return { ok: true };
|
|
88
|
+
},
|
|
89
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
roleHint: "适用范围:克制的中文书面语去 AI 味识别。普通业务陈述句即使包含常见抽象动词也不得误报。"
|
|
3
|
+
rules:
|
|
4
|
+
- id: unprompted-negation
|
|
5
|
+
priority: strong
|
|
6
|
+
- id: hollow-transition
|
|
7
|
+
priority: strong
|
|
8
|
+
- id: throat-clearing
|
|
9
|
+
priority: moderate
|
|
10
|
+
- id: moralizing-closer
|
|
11
|
+
priority: moderate
|
|
12
|
+
- id: rhetorical-self-qa
|
|
13
|
+
priority: hint
|
|
14
|
+
- id: stealth-vapor
|
|
15
|
+
priority: moderate
|
|
16
|
+
- id: cooccurrence-padding
|
|
17
|
+
priority: moderate
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
1. **unprompted-negation**: 当上文从未提及或暗示对立面 A,却生硬套用“不是 A,而是 B”或“并非单纯的 A,而是一场 B”伪深刻对比句壳时触发。前文确实存在旧观念或误解需澄清时不触发。修改建议:去掉虚设的对立否定壳,仅用句中既有事实直接陈述 B。
|
|
21
|
+
2. **hollow-transition**: 当段落出现零信息增量的宏大叙事背景套话(如“在当今…浪潮下”、“随着…的不断深入”)或纯形式过渡空句、且去掉后不影响任何事实与因果衔接时触发。修改建议:移除空话铺垫,从具体事实、问题或结论直接切入。
|
|
22
|
+
3. **throat-clearing**: 当小标题或上下文已经明确范围,句首仍堆叠“在本节中我们将探讨”、“值得注意的是”等元叙事赘语时触发。修改建议:去掉元叙事起手式,保留核心陈述。
|
|
23
|
+
4. **moralizing-closer**: 当段尾或文末出现无实质信息的口号表态或价值拔高收尾(如“展望未来,我们将砥砺前行”)时触发。修改建议:移除口号式收尾,在最后一项具体结论或行动安排处自然收束。
|
|
24
|
+
5. **rhetorical-self-qa**: 当使用机械的助手式自问自答过渡(如“为什么这很重要?因为…”)时触发。技术方案中真实待讨论的开放问题不触发。修改建议:将刻意拆开的自问自答合并为自然直述句。
|
|
25
|
+
6. **stealth-vapor**: 当整段话通顺无明显套话词,但通篇没有任何具体名词、数值、文件、命令、机制或可验证主语(如空泛讨论“建立清晰的信息同步节奏、保持平稳有序推进”)时触发。具体技术说明、个人叙事场景与克制幽默不触发。修改建议:请作者替换为具体机制、约束或真实事例,或删去该空段。
|
|
26
|
+
7. **cooccurrence-padding**: 当单句或单段连续堆叠 3 个及以上空泛管理/渲染动词(如“有效推动”“持续优化”“深度融合”“充分释放”“精细化运营”“全面助力”)而未交代具体技术手段或指标边界时触发。仅出现单个常规动词的技术陈述不触发。修改建议:改写为具体输入、动作与实测结果。
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { definePackScripts, maskInlineCode } from "dislop/sdk";
|
|
2
|
+
|
|
3
|
+
const PURE_FILLER_ZH_SENTENCES = [
|
|
4
|
+
/^在当今[^,。!?\n]{2,20}的(?:时代)?(?:浪潮|背景|时代|大背景|趋势)下[,,]\s*(?:这一举措|这|它)?(?:无疑)?具有[^。!?\n]{2,24}[。!?]$/,
|
|
5
|
+
/^随着[^,。!?\n]{2,18}的(?:不断深入|飞速发展|持续演进|日益普及)[,,]\s*[^。!?\n]{2,24}已成(?:为)?必然趋势[。!?]$/,
|
|
6
|
+
/^展望未来[,,]\s*我们将继续[^。!?\n]{2,30}[。!?]$/,
|
|
7
|
+
/^总而言之[,,]\s*这不仅标志着新的起点[,,]\s*更为未来[^。!?\n]{2,24}[。!?]$/,
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
const THROAT_CLEARING_ZH_PREFIXES = [
|
|
11
|
+
/^(?:值得注意的是[,,]\s*|需要指出的是[,,]\s*|毋庸置疑[,,]\s*|众所周知[,,]\s*)/,
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const STANDALONE_SELF_QA_ZH_RE =
|
|
15
|
+
/^(?:为什么这(?:一点|件事)?(?:如此|这么)?重要[??]|这意味着什么[??]|背后原因是什么[??])$/;
|
|
16
|
+
|
|
17
|
+
const MECHANICAL_SELF_QA_ZH_RE =
|
|
18
|
+
/^(?:答案很简单[::—-]\s*|究其原因[,,::]\s*|简而言之[,,]\s*答案就是)/;
|
|
19
|
+
|
|
20
|
+
const SINGLE_SEG_SELF_QA_ZH_RE =
|
|
21
|
+
/^这意味着什么[??]\s*(?:意味着|说明)?(.+)$/;
|
|
22
|
+
|
|
23
|
+
const FOUR_CHAR_TRIAD_RE =
|
|
24
|
+
/(?:精准高效|安全可靠|灵活易用|全面赋能|协同联动|稳步推进|持续优化|深度融合|多维驱动|闭环管理)(?:[、,,]\s*(?:精准高效|安全可靠|灵活易用|全面赋能|协同联动|稳步推进|持续优化|深度融合|多维驱动|闭环管理)){2,}/;
|
|
25
|
+
|
|
26
|
+
const ZH_MORALIZING_CLOSER_RE =
|
|
27
|
+
/^(?:这或许就是[^。!?\n]{2,24}在[^。!?\n]{2,16}时代真正的意义所在|归根结底[,,]\s*[^,。!?\n]{2,18}从来不是[^,。!?\n]{2,18}[,,]\s*而是[^。!?\n]{2,24})[。!?]$/;
|
|
28
|
+
|
|
29
|
+
const ZH_BUZZWORD_POOL = [
|
|
30
|
+
"抓手",
|
|
31
|
+
"赋能",
|
|
32
|
+
"闭环",
|
|
33
|
+
"底座",
|
|
34
|
+
"心智",
|
|
35
|
+
"组合拳",
|
|
36
|
+
"跃迁",
|
|
37
|
+
"破局",
|
|
38
|
+
"矩阵",
|
|
39
|
+
"势能",
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const ZH_HALFWIDTH_CJK_PUNCT_RE = /(?<=[\u4e00-\u9fff])([,;])(?=[\u4e00-\u9fff])/g;
|
|
43
|
+
|
|
44
|
+
const SECOND_ORDER_ZH_SLOGAN_RE =
|
|
45
|
+
/(?:不是|并非)(?:单纯的?|简单的?)?[^,。;\n]{1,20}[,,]\s*而是(?:一场|一次)?[^。!?\n]{1,28}/;
|
|
46
|
+
|
|
47
|
+
function maskInlineAndUrls(text) {
|
|
48
|
+
return maskInlineCode(text).replace(/https?:\/\/[^\s)>\]"']+/gi, (m) => " ".repeat(m.length));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default definePackScripts({
|
|
52
|
+
check(doc, ctx) {
|
|
53
|
+
let consecutiveBoldListItems = 0;
|
|
54
|
+
let boldWallAnchorSeg = null;
|
|
55
|
+
|
|
56
|
+
for (const seg of doc.segments) {
|
|
57
|
+
const text = seg.text.trim();
|
|
58
|
+
const masked = maskInlineCode(text);
|
|
59
|
+
const isHeading = seg.blockKind === "heading";
|
|
60
|
+
|
|
61
|
+
if (!isHeading && PURE_FILLER_ZH_SENTENCES.some((re) => re.test(masked))) {
|
|
62
|
+
ctx.reportSuggestion({
|
|
63
|
+
ruleId: "hollow-transition",
|
|
64
|
+
priority: "strong",
|
|
65
|
+
fixSafety: "safe",
|
|
66
|
+
actionType: "delete",
|
|
67
|
+
targetId: seg.id,
|
|
68
|
+
line: seg.line,
|
|
69
|
+
originalQuote: seg.text,
|
|
70
|
+
suggestedReplacement: "",
|
|
71
|
+
reason: "零信息增量的宏大叙事套话,执行破坏性删除测试后不影响上下文事实与因果推进。",
|
|
72
|
+
});
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!isHeading) {
|
|
77
|
+
for (const prefixRe of THROAT_CLEARING_ZH_PREFIXES) {
|
|
78
|
+
const m = masked.match(prefixRe);
|
|
79
|
+
if (m && text.length > m[0].length + 6) {
|
|
80
|
+
ctx.reportSuggestion({
|
|
81
|
+
ruleId: "throat-clearing",
|
|
82
|
+
priority: "moderate",
|
|
83
|
+
fixSafety: "safe",
|
|
84
|
+
actionType: "replace",
|
|
85
|
+
targetId: seg.id,
|
|
86
|
+
line: seg.line,
|
|
87
|
+
originalQuote: seg.text,
|
|
88
|
+
suggestedReplacement: text.slice(m[0].length),
|
|
89
|
+
reason: "删去无实质信息的句首套话铺垫,直接进入具体陈述。",
|
|
90
|
+
});
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!isHeading && STANDALONE_SELF_QA_ZH_RE.test(masked)) {
|
|
97
|
+
ctx.reportSuggestion({
|
|
98
|
+
ruleId: "rhetorical-self-qa",
|
|
99
|
+
priority: "moderate",
|
|
100
|
+
fixSafety: "review",
|
|
101
|
+
actionType: "delete",
|
|
102
|
+
targetId: seg.id,
|
|
103
|
+
line: seg.line,
|
|
104
|
+
originalQuote: seg.text,
|
|
105
|
+
suggestedReplacement: "",
|
|
106
|
+
reason: "移除机械的助手式自问过渡句,让后一句直接给出结论。",
|
|
107
|
+
});
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!isHeading && MECHANICAL_SELF_QA_ZH_RE.test(masked) && text.length > 8) {
|
|
112
|
+
const stripped = text.replace(MECHANICAL_SELF_QA_ZH_RE, "");
|
|
113
|
+
if (stripped && stripped !== text) {
|
|
114
|
+
ctx.reportSuggestion({
|
|
115
|
+
ruleId: "rhetorical-self-qa",
|
|
116
|
+
priority: "moderate",
|
|
117
|
+
fixSafety: "review",
|
|
118
|
+
actionType: "replace",
|
|
119
|
+
targetId: seg.id,
|
|
120
|
+
line: seg.line,
|
|
121
|
+
originalQuote: seg.text,
|
|
122
|
+
suggestedReplacement: stripped,
|
|
123
|
+
reason: "去掉机械的助手式自问自答过渡壳,直接陈述结论。",
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
} else if (!isHeading) {
|
|
127
|
+
const singleQa = masked.match(SINGLE_SEG_SELF_QA_ZH_RE);
|
|
128
|
+
if (singleQa) {
|
|
129
|
+
const rhsStart = masked.length - singleQa[1].length;
|
|
130
|
+
ctx.reportSuggestion({
|
|
131
|
+
ruleId: "rhetorical-self-qa",
|
|
132
|
+
priority: "moderate",
|
|
133
|
+
fixSafety: "review",
|
|
134
|
+
actionType: "replace",
|
|
135
|
+
targetId: seg.id,
|
|
136
|
+
line: seg.line,
|
|
137
|
+
originalQuote: seg.text,
|
|
138
|
+
suggestedReplacement: text.slice(rhsStart),
|
|
139
|
+
reason: "去掉机械的“这意味着什么?”自问自答壳,直接写出具体影响。",
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const pivotMatch = masked.match(
|
|
145
|
+
/^这(?:不是|并非|绝非)(?:一次|一场)?(?:单纯的?|简单的?|普通的?|仅仅)[^,,;\n]{1,24}[,,]\s*而是(.+)$/,
|
|
146
|
+
);
|
|
147
|
+
if (pivotMatch) {
|
|
148
|
+
const rhsStart = masked.length - pivotMatch[1].length;
|
|
149
|
+
const rhs = text.slice(rhsStart).trim();
|
|
150
|
+
const startsWithVerb = /^(?:说明|意味着|代表|要求|体现|把|将|让)/.test(rhs);
|
|
151
|
+
ctx.reportSuggestion({
|
|
152
|
+
ruleId: "unprompted-negation",
|
|
153
|
+
priority: "strong",
|
|
154
|
+
fixSafety: "review",
|
|
155
|
+
actionType: "replace",
|
|
156
|
+
targetId: seg.id,
|
|
157
|
+
line: seg.line,
|
|
158
|
+
originalQuote: seg.text,
|
|
159
|
+
suggestedReplacement: startsWithVerb ? rhs : `这是${rhs}`,
|
|
160
|
+
reason: "移除无前文语境支撑的“不是…而是…”伪深刻对比壳,直接陈述后半句内容。",
|
|
161
|
+
});
|
|
162
|
+
} else {
|
|
163
|
+
const aphorismPivot = masked.match(
|
|
164
|
+
/[^,。;\n]{2,28}(?:不是|并非|绝非)[^,,;\n]{2,18}[,,]\s*而是[^。!?\n]*(?:跃迁|重塑|重构|革命|范式|新纪元|蜕变|升华|真正的意义|岁月里的尊严)[^。!?\n]*[。!?]?$/,
|
|
165
|
+
);
|
|
166
|
+
if (aphorismPivot) {
|
|
167
|
+
ctx.reportSuggestion({
|
|
168
|
+
ruleId: "unprompted-negation",
|
|
169
|
+
priority: "strong",
|
|
170
|
+
fixSafety: "manual",
|
|
171
|
+
actionType: "prompt",
|
|
172
|
+
targetId: seg.id,
|
|
173
|
+
line: seg.line,
|
|
174
|
+
originalQuote: seg.text,
|
|
175
|
+
reason: "“不是 A,而是 B(拔高/跃迁)”属于典型模板化金句转折,建议改为具体事实陈述。",
|
|
176
|
+
rewritePrompt: "删去“不是…而是…”抽象升华对比,改为具体细节或可验证事实。",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!isHeading && ZH_MORALIZING_CLOSER_RE.test(masked)) {
|
|
182
|
+
ctx.reportSuggestion({
|
|
183
|
+
ruleId: "moralizing-closer",
|
|
184
|
+
priority: "moderate",
|
|
185
|
+
fixSafety: "review",
|
|
186
|
+
actionType: "delete",
|
|
187
|
+
targetId: seg.id,
|
|
188
|
+
line: seg.line,
|
|
189
|
+
originalQuote: seg.text,
|
|
190
|
+
suggestedReplacement: "",
|
|
191
|
+
reason: "文末说教或拔高式感叹收尾未补充具体信息或行动建议,删去更利落。",
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const triadMatch = masked.match(FOUR_CHAR_TRIAD_RE);
|
|
196
|
+
if (triadMatch) {
|
|
197
|
+
const hitQuote = text.slice(triadMatch.index, triadMatch.index + triadMatch[0].length);
|
|
198
|
+
ctx.reportSuggestion({
|
|
199
|
+
ruleId: "four-char-slogan-triad",
|
|
200
|
+
priority: "moderate",
|
|
201
|
+
fixSafety: "manual",
|
|
202
|
+
actionType: "prompt",
|
|
203
|
+
targetId: seg.id,
|
|
204
|
+
line: seg.line,
|
|
205
|
+
originalQuote: hitQuote,
|
|
206
|
+
reason: "连续堆砌三个及以上空洞四字套话排比,缺乏具体动作或边界信息。",
|
|
207
|
+
rewritePrompt: "删去四字口号排比串,保留或改写为原文中实际发生的具体改动:[填入具体机制或动作]",
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const punctMasked = maskInlineAndUrls(text);
|
|
212
|
+
const halfwidthHits = punctMasked.match(ZH_HALFWIDTH_CJK_PUNCT_RE);
|
|
213
|
+
if (halfwidthHits && halfwidthHits.length >= 2) {
|
|
214
|
+
let fixed = "";
|
|
215
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
216
|
+
if (
|
|
217
|
+
(text[i] === "," || text[i] === ";") &&
|
|
218
|
+
punctMasked[i] === text[i] &&
|
|
219
|
+
i > 0 &&
|
|
220
|
+
i + 1 < text.length &&
|
|
221
|
+
/[\u4e00-\u9fff]/.test(text[i - 1]) &&
|
|
222
|
+
/[\u4e00-\u9fff]/.test(text[i + 1])
|
|
223
|
+
) {
|
|
224
|
+
fixed += text[i] === "," ? "\uff0c" : "\uff1b";
|
|
225
|
+
} else {
|
|
226
|
+
fixed += text[i];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (fixed !== text) {
|
|
230
|
+
ctx.reportSuggestion({
|
|
231
|
+
ruleId: "halfwidth-cjk-punctuation",
|
|
232
|
+
priority: "moderate",
|
|
233
|
+
fixSafety: "safe",
|
|
234
|
+
actionType: "replace",
|
|
235
|
+
targetId: seg.id,
|
|
236
|
+
line: seg.line,
|
|
237
|
+
originalQuote: seg.text,
|
|
238
|
+
suggestedReplacement: fixed,
|
|
239
|
+
reason: "中文正文句子间混用了半角英文逗号或分号,统一为全角中文标点。",
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (seg.id.endsWith("-S1") && seg.blockKind === "list-item") {
|
|
245
|
+
const boldMatch = text.match(/^\*\*([\u4e00-\u9fff]{2,6})\*\*\s*[::—-]/);
|
|
246
|
+
const hasConcreteAnchors = /(?:--|`|\d|[「『“”]|[??]$)/.test(text);
|
|
247
|
+
if (boldMatch && !hasConcreteAnchors) {
|
|
248
|
+
consecutiveBoldListItems += 1;
|
|
249
|
+
if (consecutiveBoldListItems === 1) boldWallAnchorSeg = seg;
|
|
250
|
+
if (consecutiveBoldListItems === 5 && boldWallAnchorSeg) {
|
|
251
|
+
ctx.reportSuggestion({
|
|
252
|
+
ruleId: "bold-lead-list-wall",
|
|
253
|
+
priority: "hint",
|
|
254
|
+
fixSafety: "manual",
|
|
255
|
+
actionType: "prompt",
|
|
256
|
+
targetId: boldWallAnchorSeg.id,
|
|
257
|
+
line: boldWallAnchorSeg.line,
|
|
258
|
+
originalQuote: boldWallAnchorSeg.text,
|
|
259
|
+
reason: "连续五条及以上使用“**抽象词**:说明”机械加粗列表,呈现明显助手生成模板感。",
|
|
260
|
+
rewritePrompt: "去掉重复的加粗前缀标签,改写为直接陈述事实的普通列表或自然段落。",
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
consecutiveBoldListItems = 0;
|
|
265
|
+
boldWallAnchorSeg = null;
|
|
266
|
+
}
|
|
267
|
+
} else if (seg.id.endsWith("-S1")) {
|
|
268
|
+
consecutiveBoldListItems = 0;
|
|
269
|
+
boldWallAnchorSeg = null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
for (const para of doc.paragraphs || []) {
|
|
274
|
+
// Mask inline code and quoted specimen spans ("..." / 「...」) so citing negative examples never fires
|
|
275
|
+
const unquotedPara = maskInlineCode(para.text)
|
|
276
|
+
.replace(/“[^”\n]{1,40}”/g, " ")
|
|
277
|
+
.replace(/「[^」\n]{1,40}」/g, " ");
|
|
278
|
+
const hitTerms = ZH_BUZZWORD_POOL.filter((term) => unquotedPara.includes(term));
|
|
279
|
+
if (hitTerms.length >= 3) {
|
|
280
|
+
const anchorSegId = para.segmentIds?.[0] || null;
|
|
281
|
+
ctx.reportSuggestion({
|
|
282
|
+
ruleId: "buzzword-cluster",
|
|
283
|
+
priority: "moderate",
|
|
284
|
+
fixSafety: "manual",
|
|
285
|
+
actionType: "prompt",
|
|
286
|
+
targetId: anchorSegId,
|
|
287
|
+
line: para.line,
|
|
288
|
+
originalQuote: para.text.slice(0, 120),
|
|
289
|
+
reason: `同一段落密集堆砌了 ${hitTerms.length} 个空泛黑话词(${hitTerms.join("、")}),挤占了具体机制描述。`,
|
|
290
|
+
rewritePrompt: "去掉黑话词,改用具体动作、模块名称或可验证结果描述改动。",
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
verifyFix(_issue, candidateText) {
|
|
297
|
+
if (candidateText && SECOND_ORDER_ZH_SLOGAN_RE.test(candidateText)) {
|
|
298
|
+
return {
|
|
299
|
+
ok: false,
|
|
300
|
+
reason: "改写结果引入了“不是…而是…”二阶口号转折句式。",
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return { ok: true };
|
|
304
|
+
},
|
|
305
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
roleHint: "适用范围:中文商业汇报与技术演示幻灯片(检测页数:{{slideCount}})。"
|
|
3
|
+
rules:
|
|
4
|
+
- id: vague-slide-headline
|
|
5
|
+
priority: strong
|
|
6
|
+
- id: slide-prose-dump
|
|
7
|
+
priority: strong
|
|
8
|
+
- id: bullet-jargon-padding
|
|
9
|
+
priority: moderate
|
|
10
|
+
- id: unanchored-slide-multiplier
|
|
11
|
+
priority: moderate
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
1. **vague-slide-headline**: 当内容页的要点已经给出明确的数据结果或业务决策,而该页标题仍是抽象口号或空泛目录词(如“多维赋能促增长”、“项目整体概况”)时触发。封面页与章节过渡页不触发。修改建议:基于当页既有事实,将标题提炼为一句话核心结论。
|
|
15
|
+
2. **slide-prose-dump**: 当幻灯片文本框直接照搬长篇书面报告段落、被铺垫从句和连接虚词淹没扫读重点时触发。修改建议:凝练掉过渡虚词以利投影扫读,同时完整保留所有原始数值、单位、主体与限定口径。
|
|
16
|
+
3. **bullet-jargon-padding**: 当同一页多条要点连续以“着力打造 / 全面筑牢 / 深度赋能 / 持续夯实”等重复公文套话前缀起头时触发。修改建议:去掉重复套话前缀,直接写出具体动作与量化结果。
|
|
17
|
+
4. **unanchored-slide-multiplier**: 当幻灯片中出现缺少对比基线或统计周期的悬空倍数与模糊增幅(如“效能提升数倍”、“响应速度大幅跃升”)时触发。修改建议:补充具体的对比基线与统计时间窗口。
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { definePackScripts, maskInlineCode } from "dislop/sdk";
|
|
2
|
+
|
|
3
|
+
const ZH_LEAKED_SLIDE_DIRECTIVE_RE =
|
|
4
|
+
/^(?:\[(?:第\s*\d+\s*页|配图(?:建议)?|视觉(?:呈现|建议)|画面描述|图表建议|演讲者?备注)[::][^\]]*\]|【(?:配图(?:建议)?|视觉建议|此处放[^】]{1,16}|演讲者?备注)[::]?[^】]*】|演讲者?备注[::]\s+)/;
|
|
5
|
+
|
|
6
|
+
const ZH_BUZZWORD_SLIDE_HEADLINE_RE =
|
|
7
|
+
/^(?:顶层设计与生态赋能|多维驱动与闭环抓手|破局立新[,,、]?\s*智赢未来|构建全方位协同矩阵|全面赋能业务高质量发展|三大核心抓手与生态闭环)$/;
|
|
8
|
+
|
|
9
|
+
const ZH_CLOSING_SLOGAN_RE =
|
|
10
|
+
/^(?:携手并进[,,]\s*共创(?:辉煌)?未来|凝心聚力[,,]\s*再谱(?:新篇|华章)|不忘初心[,,]\s*砥砺前行)[。!!]?$/;
|
|
11
|
+
|
|
12
|
+
const ZH_SLIDE_REGRESSION_RE =
|
|
13
|
+
/(?:生态闭环|核心抓手|智赢未来|多维赋能|(?:不是|并非)[^,。]{1,16}[,,]\s*而是)/;
|
|
14
|
+
|
|
15
|
+
export default definePackScripts({
|
|
16
|
+
check(doc, ctx) {
|
|
17
|
+
for (const seg of doc.segments) {
|
|
18
|
+
const text = seg.text.trim();
|
|
19
|
+
const masked = maskInlineCode(text);
|
|
20
|
+
|
|
21
|
+
if (ZH_LEAKED_SLIDE_DIRECTIVE_RE.test(masked)) {
|
|
22
|
+
ctx.reportDefect({
|
|
23
|
+
ruleId: "leaked-slide-directive",
|
|
24
|
+
severity: "error",
|
|
25
|
+
targetId: seg.id,
|
|
26
|
+
line: seg.line,
|
|
27
|
+
originalQuote: seg.text,
|
|
28
|
+
fixSafety: "manual",
|
|
29
|
+
actionType: "prompt",
|
|
30
|
+
reason: "幻灯片画面正文中遗留了 AI 生成时的配图提示指令或演讲者备注标签。",
|
|
31
|
+
rewritePrompt: "将演讲词移入幻灯片备注栏,并将配图提示替换为真实图表或直接删除。",
|
|
32
|
+
});
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (ZH_BUZZWORD_SLIDE_HEADLINE_RE.test(masked)) {
|
|
37
|
+
ctx.reportSuggestion({
|
|
38
|
+
ruleId: "buzzword-slide-headline",
|
|
39
|
+
priority: "moderate",
|
|
40
|
+
fixSafety: "manual",
|
|
41
|
+
actionType: "prompt",
|
|
42
|
+
targetId: seg.id,
|
|
43
|
+
line: seg.line,
|
|
44
|
+
originalQuote: seg.text,
|
|
45
|
+
reason: "空洞的汇报黑话页标题没有传递任何当页业务结论或具体进展。",
|
|
46
|
+
rewritePrompt: "直接用一句话写出当页核心结论或关键指标变化:[填入当页结论或指标结果]",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (ZH_CLOSING_SLOGAN_RE.test(masked)) {
|
|
51
|
+
ctx.reportSuggestion({
|
|
52
|
+
ruleId: "closing-slide-slogan",
|
|
53
|
+
priority: "hint",
|
|
54
|
+
fixSafety: "safe",
|
|
55
|
+
actionType: "delete",
|
|
56
|
+
targetId: seg.id,
|
|
57
|
+
line: seg.line,
|
|
58
|
+
originalQuote: seg.text,
|
|
59
|
+
suggestedReplacement: "",
|
|
60
|
+
reason: "模板化的表态口号式幻灯片结尾,可直接删除并保留具体下一步计划或答疑信息。",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
verifyFix(_issue, candidateText) {
|
|
67
|
+
if (candidateText && ZH_SLIDE_REGRESSION_RE.test(candidateText)) {
|
|
68
|
+
return {
|
|
69
|
+
ok: false,
|
|
70
|
+
reason: "幻灯片改写结果引入了“生态闭环 / 核心抓手 / 智赢未来 / 多维赋能 / 不是…而是…”套话口号。",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { ok: true };
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
roleHint: "适用范围:中文网页界面微文案、首屏标语、操作按钮文案与落地页客户背书。"
|
|
3
|
+
rules:
|
|
4
|
+
- id: prompt-echo-copy
|
|
5
|
+
priority: strong
|
|
6
|
+
- id: redundant-card-subcopy
|
|
7
|
+
priority: moderate
|
|
8
|
+
- id: verbose-cta-label
|
|
9
|
+
priority: moderate
|
|
10
|
+
- id: synthetic-social-proof
|
|
11
|
+
priority: moderate
|
|
12
|
+
- id: emoji-feature-grid
|
|
13
|
+
priority: hint
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
1. **prompt-echo-copy**: 当首屏主副标题或徽章堆砌“开启新纪元”、“全方位赋能”、“一站式重塑”、“极智体验”等生成式营销套话,而未能说明产品实际用途时触发。修改建议:基于页面已有的具体功能,改用平实直白的语言写明支持的任务或使用效果。
|
|
17
|
+
2. **redundant-card-subcopy**: 当特性卡片正文只是把卡片小标题加几个修饰词重复一遍(例如标题“实时同步”,描述“为您带来无感的多端实时数据同步体验”)而无新增信息时触发。修改建议:去掉同义重复词,补充具体支持范围、工作机制或性能边界。
|
|
18
|
+
3. **verbose-cta-label**: 当按钮、导航或空状态控件使用冗长客套的助手腔句子(如“立即点击开启您的专属智能体验之旅”)、超出紧凑界面槽位时触发。修改建议:收敛为 2 至 6 字的明确动宾短语(如“免费试用”、“查看文档”)。
|
|
19
|
+
4. **synthetic-social-proof**: 当落地页出现无真实客户署名或无统计口径的模板化背书(如“已助力 10,000+ 行业领军企业降本增效”)时触发。已标明真实客户名称或统计来源的数据不触发。修改建议:补充真实署名案例与可核实口径,或移除模板背书。
|
|
20
|
+
5. **emoji-feature-grid**: 当多个特性卡片标题或导航入口依赖前置装饰性 Emoji 充当图标时触发。修改建议:移除标题前的装饰 Emoji,改用纯文字排版或统一图标组件。
|