@gordon.gan/specflow 1.8.5-beta → 1.8.6-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 CHANGED
@@ -284,7 +284,7 @@ specflow init
284
284
  | **propose** | 一次产出 proposal、delta specs、design、tasks(第一轮深度思考,非占位骨架);叙述语言跟 `artifacts.language` |
285
285
  | **refine** | 内部多轮循环(≥2 轮,AI 判断收敛);可更新任意 artifact |
286
286
  | **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
- | **techdoc-synth** | 可选:`specflow techdoc synthesize --workspace-root <root>` 把多仓四件套合成**一份跨仓文档**(统一大纲 + 契约实体命名空间 `<repo>_<id>` + 每章按仓分节 + 全局结论);省略 `--profile` 时自动识别场景(`--text` 优先,其次四件套内容;不确定且有 `--text` 时确认,无 `--text` 时回退 approve)。带确定性质量门禁(validate 强制每必选章含所有仓 `### <repo>` 小节)。区别于 `techdoc approve --bundle` 的物理拼接;原有多仓多产物不受影响 |
287
+ | **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
288
  | **apply** | Phase A 重写 tasks.md;Phase B 按语言路由 ECC 审查 + TDD 逐任务执行;可选 `--yes` |
289
289
  | **review** | 代码审查,对照 specs 检查回归 |
290
290
  | **test** | 单元 + 集成 + E2E + 回归测试 |
@@ -17,7 +17,7 @@ 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, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram } from './lint.js';
20
+ import { lintNarrative, checkRepoCoverage, checkRepoSectionStub, checkDuplicateContract, checkExamplePresence, checkTableFieldsMissing, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram } 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';
@@ -701,6 +701,9 @@ export async function validateWork(options) {
701
701
  for (const d of checkExamplePresence(allEntities.interfaces)) {
702
702
  diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
703
703
  }
704
+ for (const d of checkTableFieldsMissing(allEntities.tables)) {
705
+ diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
706
+ }
704
707
  for (const d of checkForwardDecisionRef(narrativeMap, allEntities.decisions)) {
705
708
  diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
706
709
  }
@@ -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, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram, } from './lint.js';
5
+ import { lintNarrative, checkBudget, checkDiagramPresence, checkNumericPresence, checkGoldenSignals, checkRepoCoverage, checkRepoSectionStub, checkDuplicateContract, checkExamplePresence, checkTableFieldsMissing, checkForwardDecisionRef, checkUnverifiedNumber, checkDataContractMapping, checkBareIdentifiers, checkTextHeavyNoDiagram, } from './lint.js';
6
6
  import { checkStructuredCoverage } from './coverage.js';
7
7
  import { checkReviewResult } from './review.js';
8
8
  export async function runGates(input) {
@@ -67,6 +67,9 @@ export async function runGates(input) {
67
67
  for (const d of checkExamplePresence(input.entities.interfaces)) {
68
68
  diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
69
69
  }
70
+ for (const d of checkTableFieldsMissing(input.entities.tables)) {
71
+ diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message });
72
+ }
70
73
  for (const d of checkForwardDecisionRef(input.chapterNarratives, input.entities.decisions)) {
71
74
  diags.push({ gate: 'lint', code: d.code, severity: d.severity, message: d.message, chapter: d.chapter });
72
75
  }
@@ -53,6 +53,11 @@ export declare function checkExamplePresence(interfaces: ReadonlyArray<{
53
53
  response_fields?: unknown[];
54
54
  success_response_example?: string;
55
55
  }>): RepoSectionDiagnostic[];
56
+ /** 数据表字段说明(data-model 组件要求):每张表必须给出字段说明(字段/类型/必填/本迭代用法)。 */
57
+ export declare function checkTableFieldsMissing(tables: ReadonlyArray<{
58
+ id: string;
59
+ fields?: unknown[];
60
+ }>): RepoSectionDiagnostic[];
56
61
  /** 前向决策引用:叙述引用 [D#] 但该决策未在 entities.decisions 定义 → warning(P6 决策位置前移辅助检查)。 */
57
62
  export declare function checkForwardDecisionRef(narratives: ReadonlyMap<string, string>, decisions: ReadonlyArray<{
58
63
  id: string;
@@ -211,6 +211,20 @@ export function checkExamplePresence(interfaces) {
211
211
  }
212
212
  return diags;
213
213
  }
214
+ /** 数据表字段说明(data-model 组件要求):每张表必须给出字段说明(字段/类型/必填/本迭代用法)。 */
215
+ export function checkTableFieldsMissing(tables) {
216
+ const diags = [];
217
+ for (const t of tables) {
218
+ if (!t.fields || t.fields.length === 0) {
219
+ diags.push({
220
+ code: 'table_fields_missing',
221
+ severity: 'error',
222
+ message: `数据表 ${t.id} 缺少「字段说明」(字段/类型/必填/本迭代用法)——data-model 章节组件要求逐表给出字段说明,禁止只有建表语句`,
223
+ });
224
+ }
225
+ }
226
+ return diags;
227
+ }
214
228
  /** 前向决策引用:叙述引用 [D#] 但该决策未在 entities.decisions 定义 → warning(P6 决策位置前移辅助检查)。 */
215
229
  export function checkForwardDecisionRef(narratives, decisions) {
216
230
  const defined = new Set(decisions.map((d) => d.id));
@@ -72,6 +72,16 @@ export function renderInterface(i) {
72
72
  return [...meta, ...fieldTables, ...examples, ...errors].join('\n');
73
73
  }
74
74
  export function renderTable(t) {
75
+ const fields = (t.fields ?? []).length > 0
76
+ ? [
77
+ '**字段说明**',
78
+ '',
79
+ '| 字段 | 类型 | 必填 | 说明 |',
80
+ '|------|------|------|------|',
81
+ ...(t.fields ?? []).map((f) => `| ${escapeTableCell(f.name)} | ${escapeTableCell(f.type)} | ${f.required ? '是' : '否'} | ${escapeTableCell(f.desc ?? '')} |`),
82
+ '',
83
+ ]
84
+ : [];
75
85
  return [
76
86
  `##### ${t.id} · ${escapeInline(t.name)}`,
77
87
  '',
@@ -79,6 +89,7 @@ export function renderTable(t) {
79
89
  escapeFenceContent(t.ddl),
80
90
  '```',
81
91
  '',
92
+ ...fields,
82
93
  ...(t.migration ? ['**存量填充策略**', '', t.migration, ''] : []),
83
94
  ...(t.rollback ? ['**回滚兼容**', '', t.rollback, ''] : []),
84
95
  ].join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gordon.gan/specflow",
3
- "version": "1.8.5-beta",
3
+ "version": "1.8.6-beta",
4
4
  "type": "module",
5
5
  "description": "SpecFlow — unified spec-driven development: OpenSpec planning + Superpowers execution in one CLI and cross-IDE workflow",
6
6
  "keywords": [
@@ -13,7 +13,7 @@
13
13
 
14
14
  1. **先探测项目 DB 栈**:读项目规约 `conventions.database` + 现网 DDL/迁移文件,判断 MySQL/PostgreSQL/SQLite/Redis/ES 等。命中本地 guidance 则遵循,未命中 LLM fallback。
15
15
  2. **总则必须写明**:数据库迁移、新建表、增删列、新增索引、DDL 来源、项目约定(路径或「未发现」)。
16
- 3. **每张表必须**:完整 CREATE TABLE(含 ENGINE/CHARSET/索引)+ 字段说明(类型/本迭代用法)。
16
+ 3. **每张表必须**:完整 CREATE TABLE(含 ENGINE/CHARSET/索引)+ **字段说明表(字段/类型/必填/本迭代用法,validate 以 `table_fields_missing` 拦截缺字段说明)**。
17
17
  4. **G3 存量填充**:JSON 形状变更或新增列时必须写存量默认值填充策略(回填 SQL/读时默认值/禁止空读/上线顺序)。
18
18
  5. **G4 回滚兼容**:回滚后旧版本能否安全跳过/忽略新数据?写明机制(omitempty/忽略未知键/version 分派)。禁止只写「回滚应用」。
19
19
  6. **零 DDL 迭代**:仍须展示现网 DDL,禁止假装「不涉及数据库」。
@@ -79,7 +79,7 @@ run [--workspace-root <root>]
79
79
  ├─ ④ 生成 你(Agent)用当前模型按跨仓合成规则逐项执行:
80
80
  │ ├─ 0. 按仓工程数据源扫描 + 跨仓缺口询问(见下「跨仓 grounding」)
81
81
  │ ├─ outline(统一大纲,章节覆盖所有仓)
82
- │ ├─ 逐章填空(每章按仓分节 `### <repo>` + 契约实体 `<repo>_<id>` 命名空间)
82
+ │ ├─ 逐章填空(整体性组织:每章按主题叙述 + 仓归属 `[repo]` 标注;契约单一定义 `side`/`consumers`/`producers`;接口明细内联「接口与数据设计」章、数据库表由「数据模型」章承载;正文中文化;叙述分条 + 图文结合;不设决策记录章)
83
83
  │ └─ review(可选)
84
84
  └─ ⑤ 校验 specflow techdoc validate --work-root <path>
85
85
  └─ 通过 → 输出 document.md;失败 → 修正产物后重跑
@@ -21,6 +21,7 @@ narratives:
21
21
  data_notes: required
22
22
  gates:
23
23
  - 每张表必须有完整 CREATE TABLE(含 ENGINE/CHARSET)
24
+ - 每张表必须给出「字段说明」(字段/类型/必填/本迭代用法),禁止只有建表语句(validate 以 table_fields_missing 拦截)
24
25
  - 有接口实体时必须给出「契约-表映射」(每接口 ↔ 读写表/列),禁止接口讲接口、表讲表
25
26
  - JSON/新列必须有存量填充策略(G3)
26
27
  - 必须有回滚数据兼容说明(G4)