@gordon.gan/specflow 1.8.6-beta → 1.9.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -2
- package/dist/core/document/engine.js +62 -5
- package/dist/core/document/gates.js +20 -1
- package/dist/core/document/lint.d.ts +56 -0
- package/dist/core/document/lint.js +466 -1
- package/dist/core/document/review.d.ts +2 -0
- package/dist/core/document/review.js +10 -0
- package/package.json +2 -2
- package/prompts/apply/phase-a-plan.md +25 -13
- package/prompts/apply/phase-b-execute.md +43 -14
- package/prompts/apply/phase-b-review.md +20 -2
- package/prompts/apply/phase-b-worktree.md +25 -17
- package/prompts/document/map/acceptance.md +2 -6
- package/prompts/document/map/api-design.md +2 -6
- package/prompts/document/map/architecture.md +2 -6
- package/prompts/document/map/benchmark.md +2 -5
- package/prompts/document/map/closed-loop.md +2 -6
- package/prompts/document/map/compat-migration.md +2 -6
- package/prompts/document/map/component-design.md +2 -5
- package/prompts/document/map/config-runtime.md +2 -6
- package/prompts/document/map/core-flow.md +2 -5
- package/prompts/document/map/core-logic.md +2 -5
- package/prompts/document/map/data-model.md +9 -12
- package/prompts/document/map/deploy.md +2 -5
- package/prompts/document/map/fix.md +2 -6
- package/prompts/document/map/frontend-architecture.md +2 -5
- package/prompts/document/map/goal.md +2 -6
- package/prompts/document/map/impact.md +2 -6
- package/prompts/document/map/implementability.md +2 -6
- package/prompts/document/map/migration-guide.md +2 -5
- package/prompts/document/map/mvp-boundary.md +2 -6
- package/prompts/document/map/non-goals.md +2 -6
- package/prompts/document/map/ops.md +2 -5
- package/prompts/document/map/performance.md +2 -5
- package/prompts/document/map/poc-demo.md +2 -5
- package/prompts/document/map/regression.md +2 -6
- package/prompts/document/map/reproduce.md +2 -6
- package/prompts/document/map/requirement.md +2 -6
- package/prompts/document/map/research.md +2 -5
- package/prompts/document/map/root-cause.md +2 -6
- package/prompts/document/map/signoff.md +2 -6
- package/prompts/document/map/state-management.md +2 -5
- package/prompts/document/map/tech-selection.md +2 -6
- package/prompts/document/map/test-strategy.md +2 -6
- package/prompts/document/map/ui-design.md +2 -6
- package/prompts/document/outline/general.md +2 -5
- package/prompts/document/review/ai-review.md +4 -5
- package/prompts/document/shared/grounding.md +21 -27
- package/prompts/shared/artifact-language.md +5 -0
- package/prompts/shared/code-reviewer-prompt.md +2 -0
- package/prompts/shared/implementer-prompt.md +12 -2
- package/prompts/shared/spec-reviewer-prompt.md +2 -0
- package/skills/specflow-apply/SKILL.md +35 -13
- package/skills/specflow-techdoc/SKILL.md +23 -46
- package/skills/specflow-techdoc-synth/SKILL.md +19 -40
- package/templates/document/chapters/data-model.yaml +2 -0
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ explore(可选)→ propose → refine → apply → review → test → veri
|
|
|
50
50
|
| **多轮精化** | refine 内部循环(≥2 轮),攻击性审查假设、边界与 scope |
|
|
51
51
|
| **纪律化构建** | apply 先重写 tasks.md,再逐任务 TDD;design 有漏则回 refine |
|
|
52
52
|
| **`apply --yes`** | 当前调用内自动放行成功确认门禁,构建成功后串行 review → test → verify;不绕过 Block / 失败,不自动 archive |
|
|
53
|
+
| **`apply --yes-after-plan`** | 计划确认一次,之后自动执行任务;每个任务仍跑 TDD + spec/code review;Block / 设计缺口 / 测试红 / 高风险变更仍会停 |
|
|
53
54
|
| **语言感知审查** | apply 按 `go.mod` / `package.json` 等路由到 ECC reviewer(TS / Python / Go / Rust / Kotlin / Java) |
|
|
54
55
|
| **双重验收** | verify 对照 delta specs 与主 specs 做回归检查 |
|
|
55
56
|
| **变更归档** | archive 自动 merge delta、移入 archive、可做 git 分支清理 |
|
|
@@ -192,6 +193,19 @@ artifacts:
|
|
|
192
193
|
/specflow:archive
|
|
193
194
|
```
|
|
194
195
|
|
|
196
|
+
**计划确认一次,之后自动跑(`apply --yes-after-plan`):**
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
/specflow:propose "给用户管理模块加批量导入"
|
|
200
|
+
/specflow:refine
|
|
201
|
+
/specflow:apply --yes-after-plan
|
|
202
|
+
# Phase A 展示 tasks.md + 契约摘要,你确认一次
|
|
203
|
+
# Phase B 自动执行;每个任务仍跑 TDD + spec review + code review
|
|
204
|
+
# 遇到 Block / 设计缺口 / 测试红 / verify FAIL / 高风险变更会停
|
|
205
|
+
# 全部通过后你再手动:
|
|
206
|
+
/specflow:archive
|
|
207
|
+
```
|
|
208
|
+
|
|
195
209
|
`/specflow:apply --yes` 只影响**当前这一次**调用:
|
|
196
210
|
|
|
197
211
|
| 会自动做 | 不会自动做 / 仍会停下 |
|
|
@@ -201,7 +215,9 @@ artifacts:
|
|
|
201
215
|
| Phase B 成功后串行 review → test → verify | 自动 `/specflow:archive` |
|
|
202
216
|
| | CRITICAL / HIGH review、test 红、verify `FAIL` 时中断序列 |
|
|
203
217
|
|
|
204
|
-
|
|
218
|
+
`--yes-after-plan` 与 `--yes` 的区别:它**不会跳过 Gate A**。你仍然先看计划、风险和停止条件,确认一次后才自动执行。
|
|
219
|
+
|
|
220
|
+
Cursor:`specflow:apply --yes-after-plan`;Codex:`$specflow-apply --yes-after-plan`。
|
|
205
221
|
|
|
206
222
|
**需求模糊:**
|
|
207
223
|
|
|
@@ -285,7 +301,7 @@ specflow init
|
|
|
285
301
|
| **refine** | 内部多轮循环(≥2 轮,AI 判断收敛);可更新任意 artifact |
|
|
286
302
|
| **techdoc** | 可选:`specflow techdoc run <0to1|frontend-0to1|bugfix|feature|poc|migration>` 用**通用长文档引擎**生成方案文档——**场景轴 × 技术栈轴正交**:场景管「做什么」(0→1 / 加功能 / 修 bug / 预研选型 / 技术升级),输入特征(hasBackend / uiInScope / containsApiChange / hasPersistence)自动决定章节伸缩(纯逻辑功能 ~3 章,全栈功能 ~10 章)。两遍扫描(Pass 1 大纲冻结 → Pass 2 逐章按要点填空)+ 分层真源(契约实体 zod + 受控叙述)+ 四层上下文注入(大纲要点 + 依赖摘要 + 契约注入 + 本片片段,保证注意力不稀释 / token 不易打满)+ 覆盖双通道校验 + AI Review。审批文档走独立入口 `techdoc approve`(四件套 → 审批模式,非业务场景)。详见 `docs/GENERIC_LONGDOC_ENGINE_DESIGN.md` |
|
|
287
303
|
| **techdoc-synth** | 可选:`specflow techdoc synthesize --workspace-root <root>` 把多仓四件套合成**一份跨仓文档**(统一大纲 + **契约单一定义**(同一端点一个实体,`side`/`consumers`/`producers` 标注,`<repo>_<id>` 仅作追溯别名)+ **整体性组织**(每章按主题叙述,仓归属用 `[repo]` 标注,不按仓分节)+ 全局结论 + 完整性骨架(术语/非目标/风险,不设决策记录章));省略 `--profile` 时自动识别场景(`--text` 优先,其次四件套内容;不确定且有 `--text` 时确认,无 `--text` 时回退 approve)。带确定性质量门禁(validate 强制:全文级仓覆盖 `repo_coverage_missing` + 空壳小节 `repo_section_stub` + 契约质量 lint `duplicate_contract`/`request_example_missing`/`bare_identifier`/`text_heavy_no_diagram` 等)。区别于 `techdoc approve --bundle` 的物理拼接;原有多仓多产物不受影响。详见 `docs/DOCUMENT_SYNTH_HOLISTIC_REMEDIATION.md` |
|
|
288
|
-
| **apply** | Phase A 重写 tasks.md;Phase B 按语言路由 ECC 审查 + TDD 逐任务执行;可选 `--yes` |
|
|
304
|
+
| **apply** | Phase A 重写 tasks.md;Phase B 按语言路由 ECC 审查 + TDD 逐任务执行;可选 `--yes` / `--yes-after-plan` |
|
|
289
305
|
| **review** | 代码审查,对照 specs 检查回归 |
|
|
290
306
|
| **test** | 单元 + 集成 + E2E + 回归测试 |
|
|
291
307
|
| **verify** | Pass 1:delta specs 验收;Pass 2:主 specs 回归(无基线时显式 skipped);Web 另有安全 Pass |
|
|
@@ -345,6 +361,16 @@ specflow init --artifact-language zh-CN # 推荐国内团队
|
|
|
345
361
|
|
|
346
362
|
切换语言只影响**之后新建或主动重写**的内容,不会自动翻译历史产物。
|
|
347
363
|
|
|
364
|
+
### `apply --yes-after-plan`(计划确认一次,之后自动执行)
|
|
365
|
+
|
|
366
|
+
```text
|
|
367
|
+
/specflow:apply --yes-after-plan
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Phase A 仍然展示重写后的 `tasks.md` + 契约摘要(范围 / 风险 / 预算 / 停止条件),你确认一次后,Phase B 自动执行。每个任务仍然跑 TDD + spec review + code review;遇到 Block、设计缺口、测试红、verify `FAIL`、未声明的越界文件、迁移/鉴权/依赖变更等高风险项会停。Gate A 只授权摘要中明确列出的敏感区域,新发现的风险仍会中断。
|
|
371
|
+
|
|
372
|
+
适合“任务已经拆好,不想逐任务点,但要在开工前看一眼”的场景。
|
|
373
|
+
|
|
348
374
|
### `apply --yes`(非交互确认)
|
|
349
375
|
|
|
350
376
|
```text
|
|
@@ -12,12 +12,12 @@ import { generateOutline, lintOutline, outlineHasErrors, freezeOutline, readOutl
|
|
|
12
12
|
import { expandProfile } from './profiles.js';
|
|
13
13
|
import { generateDigest, extractConstraintList, lintDigest, deterministicDigest, recordDigestSources, affectedDownstream } from './digests.js';
|
|
14
14
|
import { fillChapter, fillOnce, shouldFillOnce } from './map.js';
|
|
15
|
-
import { buildReviewPacket, reviewWithAgent, checkReviewResult, writeReviewResult, computePartHashes, applyFindings, sha256 } from './review.js';
|
|
15
|
+
import { buildReviewPacket, reviewWithAgent, checkReviewResult, writeReviewResult, readReviewResult, computePartHashes, applyFindings, sha256 } from './review.js';
|
|
16
16
|
import { renderDocument, renderHtml } from './render.js';
|
|
17
17
|
import { runGates } from './gates.js';
|
|
18
18
|
import { resolvePaths, reposPath, chapterPath } from './paths.js';
|
|
19
19
|
import { parseEntitiesLenient } from './schemas.js';
|
|
20
|
-
import { lintNarrative, checkRepoCoverage, checkRepoSectionStub, checkDuplicateContract, checkExamplePresence, checkTableFieldsMissing, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram } from './lint.js';
|
|
20
|
+
import { lintNarrative, checkDiagramPresence, checkRepoCoverage, checkRepoSectionStub, checkDuplicateContract, checkExamplePresence, checkTableFieldsMissing, checkTableDdlColumns, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram, collectRegisteredTerms, checkUndefinedTerms, checkUndefinedRefs, checkCrossChapterDuplicate } from './lint.js';
|
|
21
21
|
import { checkStructuredCoverage } from './coverage.js';
|
|
22
22
|
import { resolveProjectConventionPaths } from '../project-conventions.js';
|
|
23
23
|
import { extractContracts, EMPTY_CONTRACTS } from './extract.js';
|
|
@@ -583,16 +583,16 @@ export function planSteps(options) {
|
|
|
583
583
|
required: true,
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
|
-
// Review (
|
|
586
|
+
// Review (required — L2 语义审查是质量链硬门禁,validate 会校验 review-result.json)。
|
|
587
587
|
steps.push({
|
|
588
588
|
id: 'review',
|
|
589
589
|
phase: 'review',
|
|
590
590
|
title: 'AI 审查',
|
|
591
|
-
description: '独立审查全部章节,产出 review-result.json(findings + part_hashes,R14
|
|
591
|
+
description: '独立审查全部章节,产出 review-result.json(findings + part_hashes,R14 覆盖核对;R15 禁止造词——未登记术语必须报告)。validate 强制校验该产物:缺失即失败。',
|
|
592
592
|
prompt: '.claude/specflow/prompts/document/review/ai-review.md',
|
|
593
593
|
inputFiles: expanded.chapters.map((c) => `chapters/${c}.md`),
|
|
594
594
|
outputFile: 'review-result.json',
|
|
595
|
-
required:
|
|
595
|
+
required: true,
|
|
596
596
|
});
|
|
597
597
|
// 附录(profile.appendices,§7.3):anti-ai 需要 LLM 条目;handoff 为确定性模板,无需步骤。
|
|
598
598
|
if (profile.appendices.includes('anti-ai')) {
|
|
@@ -674,6 +674,16 @@ export async function validateWork(options) {
|
|
|
674
674
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: chId });
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
|
+
// 图表门禁(与 runGates 一致,README §1.7):按章节组件 gates 要求 Mermaid/时序图/ER 图 + 文字说明。
|
|
678
|
+
// 合成 validate 走 validateWork,此前从未执行 checkDiagramPresence——数据模型章的 ER 图要求因此不被强制。
|
|
679
|
+
for (const [chId, narrative] of narrativeMap) {
|
|
680
|
+
const gates = options.library?.get(chId)?.gates;
|
|
681
|
+
if (gates && gates.length > 0) {
|
|
682
|
+
for (const d of checkDiagramPresence(chId, narrative, gates)) {
|
|
683
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: chId });
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
677
687
|
// Multi-repo synthesize quality gate: if repos.json exists (document synthesize wrote it),
|
|
678
688
|
// 整体性组织门禁——全文级仓覆盖(防某仓被概括掉)+ 空壳小节拦截(禁「某仓无 X」占位),
|
|
679
689
|
// 替代旧「每章必须 ### <repo> 分仓小节」;另附契约质量 lint(与 runGates 库模式一致)。
|
|
@@ -704,6 +714,9 @@ export async function validateWork(options) {
|
|
|
704
714
|
for (const d of checkTableFieldsMissing(allEntities.tables)) {
|
|
705
715
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
|
|
706
716
|
}
|
|
717
|
+
for (const d of checkTableDdlColumns(allEntities.tables)) {
|
|
718
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
|
|
719
|
+
}
|
|
707
720
|
for (const d of checkForwardDecisionRef(narrativeMap, allEntities.decisions)) {
|
|
708
721
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
|
|
709
722
|
}
|
|
@@ -718,6 +731,22 @@ export async function validateWork(options) {
|
|
|
718
731
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: chId });
|
|
719
732
|
}
|
|
720
733
|
}
|
|
734
|
+
// 禁止造词 lint(术语登记 · P9 首次定义后续引用确定性化):正文未登记代码标识符 → error;
|
|
735
|
+
// 疑似黑话专名 → warning;未定义编号引用 → warning;跨章重复 → warning。
|
|
736
|
+
const glossaryNarrative = [...narrativeMap.entries()]
|
|
737
|
+
.find(([chId]) => /term|glossary|约定|术语/i.test(chId))?.[1] ?? '';
|
|
738
|
+
const registered = collectRegisteredTerms(glossaryNarrative, allEntities);
|
|
739
|
+
for (const [chId, narrative] of narrativeMap) {
|
|
740
|
+
for (const d of checkUndefinedTerms(chId, narrative, registered)) {
|
|
741
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: chId });
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
for (const d of checkUndefinedRefs(narrativeMap, glossaryNarrative)) {
|
|
745
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
|
|
746
|
+
}
|
|
747
|
+
for (const d of checkCrossChapterDuplicate(narrativeMap)) {
|
|
748
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
|
|
749
|
+
}
|
|
721
750
|
if (synthRepos.length >= 2) {
|
|
722
751
|
for (const d of checkDataContractMapping(narrativeMap, allEntities)) {
|
|
723
752
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
|
|
@@ -730,6 +759,34 @@ export async function validateWork(options) {
|
|
|
730
759
|
// 附录覆盖校验(§7.3):anti-ai 自检条目为空/不足 → warning。
|
|
731
760
|
const appendixAntiAI = await readAppendix(workRoot, 'anti-ai');
|
|
732
761
|
diags.push(...appendixDiagnostics(profile, appendixAntiAI));
|
|
762
|
+
// AI review 必选门禁(review 语义审查是质量链 L2,禁止走空/缺失路径):
|
|
763
|
+
// review-result.json 缺失 → error(Agent 必须先完成 Pass 3 AI 审查再 validate);
|
|
764
|
+
// 存在 → 校验 verdict / findings 状态 / part_hashes 完整性 / 审查后篡改。
|
|
765
|
+
const review = await readReviewResult(workRoot);
|
|
766
|
+
if (!review) {
|
|
767
|
+
diags.push({
|
|
768
|
+
gate: 'review',
|
|
769
|
+
code: 'review_result_missing',
|
|
770
|
+
severity: 'error',
|
|
771
|
+
message: '缺少 review-result.json:AI 审查(Pass 3)为必选步骤,须先产出审查结果(findings + part_hashes)再 validate;空审查(findings=[] 且无 part_hashes)不算完成',
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
const r = await checkReviewResult(workRoot, review, outline);
|
|
776
|
+
for (const d of r.diagnostics) {
|
|
777
|
+
diags.push({ gate: 'review', code: d.code, severity: d.severity, message: d.message });
|
|
778
|
+
}
|
|
779
|
+
// 橡皮图章检测:大文档审查零发现 → warning 提示疑似走过场(R1-R14 至少应核对契约完整/枚举闭合/命名一致)。
|
|
780
|
+
const persistedChapters = outline.chapters.filter((c) => narrativeMap.has(c.id)).length;
|
|
781
|
+
if (review.findings.length === 0 && persistedChapters >= 5) {
|
|
782
|
+
diags.push({
|
|
783
|
+
gate: 'review',
|
|
784
|
+
code: 'review_rubber_stamp',
|
|
785
|
+
severity: 'warning',
|
|
786
|
+
message: `review-result.json findings 为空但文档有 ${persistedChapters} 章——若为真实审查请确保逐章核对 R1-R14;空 findings 可能表示审查走过场(合成文档至少应核对契约完整/跨章命名一致/术语登记)`,
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
}
|
|
733
790
|
const hasError = diags.some((d) => d.severity === 'error');
|
|
734
791
|
if (hasError) {
|
|
735
792
|
return { ok: false, diagnostics: diags };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Document Engine — gate orchestration (T10.4).
|
|
3
3
|
* Runs lint → structured coverage → review check → budget → zod, collecting diagnostics.
|
|
4
4
|
*/
|
|
5
|
-
import { lintNarrative, checkBudget, checkDiagramPresence, checkNumericPresence, checkGoldenSignals, checkRepoCoverage, checkRepoSectionStub, checkDuplicateContract, checkExamplePresence, checkTableFieldsMissing, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram, } from './lint.js';
|
|
5
|
+
import { lintNarrative, checkBudget, checkDiagramPresence, checkNumericPresence, checkGoldenSignals, checkRepoCoverage, checkRepoSectionStub, checkDuplicateContract, checkExamplePresence, checkTableFieldsMissing, checkTableDdlColumns, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram, collectRegisteredTerms, checkUndefinedTerms, checkUndefinedRefs, checkCrossChapterDuplicate, } from './lint.js';
|
|
6
6
|
import { checkStructuredCoverage } from './coverage.js';
|
|
7
7
|
import { checkReviewResult } from './review.js';
|
|
8
8
|
export async function runGates(input) {
|
|
@@ -70,6 +70,9 @@ export async function runGates(input) {
|
|
|
70
70
|
for (const d of checkTableFieldsMissing(input.entities.tables)) {
|
|
71
71
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
|
|
72
72
|
}
|
|
73
|
+
for (const d of checkTableDdlColumns(input.entities.tables)) {
|
|
74
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
|
|
75
|
+
}
|
|
73
76
|
for (const d of checkForwardDecisionRef(input.chapterNarratives, input.entities.decisions)) {
|
|
74
77
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
|
|
75
78
|
}
|
|
@@ -84,6 +87,22 @@ export async function runGates(input) {
|
|
|
84
87
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: chId });
|
|
85
88
|
}
|
|
86
89
|
}
|
|
90
|
+
// 禁止造词 lint(术语登记 · P9 首次定义后续引用确定性化):
|
|
91
|
+
// 正文未登记代码标识符 → error;疑似黑话专名 → warning;未定义编号引用 → warning;跨章重复 → warning。
|
|
92
|
+
const glossaryNarrative = [...input.chapterNarratives.entries()]
|
|
93
|
+
.find(([chId]) => /term|glossary|约定|术语/i.test(chId))?.[1] ?? '';
|
|
94
|
+
const registered = collectRegisteredTerms(glossaryNarrative, input.entities);
|
|
95
|
+
for (const [chId, narrative] of input.chapterNarratives) {
|
|
96
|
+
for (const d of checkUndefinedTerms(chId, narrative, registered)) {
|
|
97
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: chId });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
for (const d of checkUndefinedRefs(input.chapterNarratives, glossaryNarrative)) {
|
|
101
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
|
|
102
|
+
}
|
|
103
|
+
for (const d of checkCrossChapterDuplicate(input.chapterNarratives)) {
|
|
104
|
+
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
|
|
105
|
+
}
|
|
87
106
|
if (input.repos && input.repos.length >= 2) {
|
|
88
107
|
for (const d of checkDataContractMapping(input.chapterNarratives, input.entities)) {
|
|
89
108
|
diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
|
|
@@ -58,6 +58,14 @@ export declare function checkTableFieldsMissing(tables: ReadonlyArray<{
|
|
|
58
58
|
id: string;
|
|
59
59
|
fields?: unknown[];
|
|
60
60
|
}>): RepoSectionDiagnostic[];
|
|
61
|
+
/** DDL 全列门禁:每张表的 CREATE TABLE 必须包含字段说明中的全部列(禁止省略/截断)。 */
|
|
62
|
+
export declare function checkTableDdlColumns(tables: ReadonlyArray<{
|
|
63
|
+
id: string;
|
|
64
|
+
ddl?: string;
|
|
65
|
+
fields?: ReadonlyArray<{
|
|
66
|
+
name: string;
|
|
67
|
+
}>;
|
|
68
|
+
}>): RepoSectionDiagnostic[];
|
|
61
69
|
/** 前向决策引用:叙述引用 [D#] 但该决策未在 entities.decisions 定义 → warning(P6 决策位置前移辅助检查)。 */
|
|
62
70
|
export declare function checkForwardDecisionRef(narratives: ReadonlyMap<string, string>, decisions: ReadonlyArray<{
|
|
63
71
|
id: string;
|
|
@@ -78,3 +86,51 @@ export declare function checkBareIdentifiers(chapterId: string, narrative: strin
|
|
|
78
86
|
* 提示补充图(流程/状态/结构类内容必须配图 + 文字说明)。术语表放行。
|
|
79
87
|
*/
|
|
80
88
|
export declare function checkTextHeavyNoDiagram(chapterId: string, narrative: string, minProseLines?: number): RepoSectionDiagnostic[];
|
|
89
|
+
/**
|
|
90
|
+
* 从「术语与约定」章叙述 + 契约实体字段收集**已登记标识符**。
|
|
91
|
+
* - 术语表表格第二列(工程标识,容忍 `job_type=scenario` 取 `job_type`);
|
|
92
|
+
* - 实体字段名(接口请求/响应字段、表字段)与 DDL 反引号列名;
|
|
93
|
+
* - 实体自身 id 与 name(接口/表/决策——含 `<repo>_<id>` 追溯别名与表名);
|
|
94
|
+
* - 决策实体 id(D#)。
|
|
95
|
+
*/
|
|
96
|
+
export declare function collectRegisteredTerms(glossaryNarrative: string, entities?: {
|
|
97
|
+
interfaces?: ReadonlyArray<{
|
|
98
|
+
id?: string;
|
|
99
|
+
name?: string;
|
|
100
|
+
request_fields?: ReadonlyArray<{
|
|
101
|
+
name: string;
|
|
102
|
+
}>;
|
|
103
|
+
response_fields?: ReadonlyArray<{
|
|
104
|
+
name: string;
|
|
105
|
+
}>;
|
|
106
|
+
}>;
|
|
107
|
+
tables?: ReadonlyArray<{
|
|
108
|
+
id?: string;
|
|
109
|
+
name?: string;
|
|
110
|
+
fields?: ReadonlyArray<{
|
|
111
|
+
name: string;
|
|
112
|
+
}>;
|
|
113
|
+
ddl?: string;
|
|
114
|
+
}>;
|
|
115
|
+
decisions?: ReadonlyArray<{
|
|
116
|
+
id: string;
|
|
117
|
+
}>;
|
|
118
|
+
}): Set<string>;
|
|
119
|
+
/**
|
|
120
|
+
* 禁止造词(error/warning):正文叙述行(非表格/非代码/非标题)出现未登记标识符:
|
|
121
|
+
* - snake_case(含下划线,AI 造词强信号)未登记 → error「undefined_term」;
|
|
122
|
+
* - camelCase / PascalCase(品牌名与代码标识符有歧义)未登记 → warning「undefined_jargon」;
|
|
123
|
+
* - 长小写连写且不在常见英文词表(黑话专名如 oauthstart)→ warning「undefined_jargon」。
|
|
124
|
+
* 术语与约定章放行(它本就是登记处)。
|
|
125
|
+
*/
|
|
126
|
+
export declare function checkUndefinedTerms(chapterId: string, narrative: string, registered: ReadonlySet<string>): RepoSectionDiagnostic[];
|
|
127
|
+
/**
|
|
128
|
+
* 未定义编号引用(warning):正文出现 `第 N 条` / `G#` / `TALOS-…-N` 等编号引用,
|
|
129
|
+
* 但文档内无对应定义点(术语表登记或「第 N 条:…」定义句式)→ 提示补定义或指向既有文档。
|
|
130
|
+
*/
|
|
131
|
+
export declare function checkUndefinedRefs(narratives: ReadonlyMap<string, string>, glossaryNarrative: string): RepoSectionDiagnostic[];
|
|
132
|
+
/**
|
|
133
|
+
* 跨章重复(P9 首次定义后续引用,warning):同一正文行(归一化:去空白/小写/去标点)出现在
|
|
134
|
+
* ≥2 个不同章节 → 提示收敛为「首次定义 + 交叉引用」,禁止跨章重复整段。
|
|
135
|
+
*/
|
|
136
|
+
export declare function checkCrossChapterDuplicate(narratives: ReadonlyMap<string, string>): RepoSectionDiagnostic[];
|