@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
|
@@ -60,13 +60,16 @@ function freshMermaidRE() { return /```mermaid\s*[\s\S]*?```/gi; }
|
|
|
60
60
|
// 允许 `%%` 注释 / `%%{init:{...}}%%` 指令出现在 sequenceDiagram 之前(P2:合法的 mermaid 时序图
|
|
61
61
|
// 常以 init 指令开头,之前会被误报 sequence_diagram_missing)。
|
|
62
62
|
function freshSequenceRE() { return /```mermaid\s*(?:%%[^\n]*\n|\s)*sequenceDiagram[\s\S]*?```/gi; }
|
|
63
|
+
// ER 图(数据模型章 · 表关系):同样容忍 `%%` 注释/init 指令出现在 erDiagram 之前。
|
|
64
|
+
function freshErRE() { return /```mermaid\s*(?:%%[^\n]*\n|\s)*erDiagram[\s\S]*?```/gi; }
|
|
63
65
|
/** Check that a chapter's narrative satisfies its diagram gates (README §1.7). */
|
|
64
66
|
export function checkDiagramPresence(chapterId, narrative, gates = []) {
|
|
65
67
|
const diags = [];
|
|
66
68
|
const joinedGates = gates.join(' ');
|
|
67
69
|
const wantsMermaid = /mermaid/i.test(joinedGates);
|
|
68
70
|
const wantsSequence = /时序图|sequence/i.test(joinedGates);
|
|
69
|
-
|
|
71
|
+
const wantsEr = /ER 图|erDiagram/i.test(joinedGates);
|
|
72
|
+
if (!wantsMermaid && !wantsSequence && !wantsEr)
|
|
70
73
|
return diags; // no diagram gate → no check
|
|
71
74
|
const hasMermaidBlock = freshMermaidRE().test(narrative);
|
|
72
75
|
if (wantsMermaid && !hasMermaidBlock) {
|
|
@@ -78,6 +81,14 @@ export function checkDiagramPresence(chapterId, narrative, gates = []) {
|
|
|
78
81
|
});
|
|
79
82
|
return diags;
|
|
80
83
|
}
|
|
84
|
+
if (wantsEr && !freshErRE().test(narrative)) {
|
|
85
|
+
diags.push({
|
|
86
|
+
code: 'er_diagram_missing',
|
|
87
|
+
severity: 'error',
|
|
88
|
+
chapter: chapterId,
|
|
89
|
+
message: `Chapter "${chapterId}" gates require an ER diagram (mermaid \`erDiagram\`:表关系/主外键) but none found`,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
81
92
|
if (wantsSequence && !freshSequenceRE().test(narrative)) {
|
|
82
93
|
diags.push({
|
|
83
94
|
code: 'sequence_diagram_missing',
|
|
@@ -225,6 +236,138 @@ export function checkTableFieldsMissing(tables) {
|
|
|
225
236
|
}
|
|
226
237
|
return diags;
|
|
227
238
|
}
|
|
239
|
+
// ============= DDL 全列 lint(数据模型章 · 合成时强制「完整 CREATE TABLE 全列」) =============
|
|
240
|
+
//
|
|
241
|
+
// 「有字段说明」(table_fields_missing)只保证字段描述存在,不保证 DDL 与之一致:
|
|
242
|
+
// - 截断检测:DDL 含 …/.../省略/同上 等省略标记 → ddl_truncated error;
|
|
243
|
+
// - 列对齐:DDL 必须包含字段说明中的每个字段(大小写不敏感),缺失 → ddl_column_missing error;
|
|
244
|
+
// - 解析兜底:声明了字段但 DDL 解析不出任何列(非 CREATE TABLE 形态)→ ddl_column_missing error。
|
|
245
|
+
/** 提取 CREATE TABLE 的列名集合(支持反引号/裸标识符,跳过约束行与括号/引号嵌套)。 */
|
|
246
|
+
function extractDdlColumns(ddl) {
|
|
247
|
+
const cols = [];
|
|
248
|
+
const m = /CREATE\s+TABLE/i.exec(ddl);
|
|
249
|
+
if (!m)
|
|
250
|
+
return cols;
|
|
251
|
+
const open = ddl.indexOf('(', m.index);
|
|
252
|
+
if (open === -1)
|
|
253
|
+
return cols;
|
|
254
|
+
let depth = 0;
|
|
255
|
+
let inQuote = null;
|
|
256
|
+
let end = -1;
|
|
257
|
+
for (let i = open; i < ddl.length; i++) {
|
|
258
|
+
const c = ddl[i];
|
|
259
|
+
if (inQuote) {
|
|
260
|
+
if (c === inQuote && ddl[i - 1] !== '\\')
|
|
261
|
+
inQuote = null;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (c === "'" || c === '"' || c === '`') {
|
|
265
|
+
inQuote = c;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (c === '(')
|
|
269
|
+
depth++;
|
|
270
|
+
else if (c === ')') {
|
|
271
|
+
depth--;
|
|
272
|
+
if (depth === 0) {
|
|
273
|
+
end = i;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (end === -1)
|
|
279
|
+
return cols;
|
|
280
|
+
const body = ddl.slice(open + 1, end);
|
|
281
|
+
for (const seg of splitTopLevel(body)) {
|
|
282
|
+
const s = seg.trim();
|
|
283
|
+
if (!s)
|
|
284
|
+
continue;
|
|
285
|
+
const up = s.toUpperCase();
|
|
286
|
+
if (/^(PRIMARY|UNIQUE|KEY|INDEX|CONSTRAINT|FOREIGN|CHECK|FULLTEXT|SPATIAL|EXCLUDE|LIKE|PARTITION)\b/.test(up))
|
|
287
|
+
continue;
|
|
288
|
+
const idm = s.match(/^`([^`]+)`|^([A-Za-z_][A-Za-z0-9_]*)/);
|
|
289
|
+
if (idm)
|
|
290
|
+
cols.push((idm[1] ?? idm[2]).toLowerCase());
|
|
291
|
+
}
|
|
292
|
+
return cols;
|
|
293
|
+
}
|
|
294
|
+
/** 按顶层逗号切分列定义(忽略引号/括号内的逗号)。 */
|
|
295
|
+
function splitTopLevel(s) {
|
|
296
|
+
const parts = [];
|
|
297
|
+
let cur = '';
|
|
298
|
+
let depth = 0;
|
|
299
|
+
let inQuote = null;
|
|
300
|
+
for (let i = 0; i < s.length; i++) {
|
|
301
|
+
const c = s[i];
|
|
302
|
+
if (inQuote) {
|
|
303
|
+
cur += c;
|
|
304
|
+
if (c === inQuote && s[i - 1] !== '\\')
|
|
305
|
+
inQuote = null;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (c === "'" || c === '"' || c === '`') {
|
|
309
|
+
inQuote = c;
|
|
310
|
+
cur += c;
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
if (c === '(') {
|
|
314
|
+
depth++;
|
|
315
|
+
cur += c;
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (c === ')') {
|
|
319
|
+
depth--;
|
|
320
|
+
cur += c;
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (c === ',' && depth === 0) {
|
|
324
|
+
parts.push(cur);
|
|
325
|
+
cur = '';
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
cur += c;
|
|
329
|
+
}
|
|
330
|
+
if (cur.trim())
|
|
331
|
+
parts.push(cur);
|
|
332
|
+
return parts;
|
|
333
|
+
}
|
|
334
|
+
/** DDL 全列门禁:每张表的 CREATE TABLE 必须包含字段说明中的全部列(禁止省略/截断)。 */
|
|
335
|
+
export function checkTableDdlColumns(tables) {
|
|
336
|
+
const diags = [];
|
|
337
|
+
for (const t of tables) {
|
|
338
|
+
const fields = t.fields ?? [];
|
|
339
|
+
if (fields.length === 0)
|
|
340
|
+
continue; // 无字段说明由 table_fields_missing 处理
|
|
341
|
+
const ddl = t.ddl ?? '';
|
|
342
|
+
if (/\.\.\.|…|省略|同上/.test(ddl)) {
|
|
343
|
+
diags.push({
|
|
344
|
+
code: 'ddl_truncated',
|
|
345
|
+
severity: 'error',
|
|
346
|
+
message: `数据表 ${t.id} 的 DDL 疑似被截断(含省略标记 …/.../省略/同上)——必须给出完整 CREATE TABLE 全列`,
|
|
347
|
+
});
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
const columns = extractDdlColumns(ddl);
|
|
351
|
+
if (columns.length === 0) {
|
|
352
|
+
diags.push({
|
|
353
|
+
code: 'ddl_column_missing',
|
|
354
|
+
severity: 'error',
|
|
355
|
+
message: `数据表 ${t.id} 声明了 ${fields.length} 个字段但 DDL 解析不出任何列(需完整 CREATE TABLE 全列,禁止省略)`,
|
|
356
|
+
});
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const colSet = new Set(columns);
|
|
360
|
+
const missing = fields.filter((f) => !colSet.has(f.name.toLowerCase())).map((f) => f.name);
|
|
361
|
+
if (missing.length > 0) {
|
|
362
|
+
diags.push({
|
|
363
|
+
code: 'ddl_column_missing',
|
|
364
|
+
severity: 'error',
|
|
365
|
+
message: `数据表 ${t.id} 的 DDL 缺少字段说明中的列:${missing.join('、')}——DDL 必须包含全部列(DDL 全列与字段说明对齐)`,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return diags;
|
|
370
|
+
}
|
|
228
371
|
/** 前向决策引用:叙述引用 [D#] 但该决策未在 entities.decisions 定义 → warning(P6 决策位置前移辅助检查)。 */
|
|
229
372
|
export function checkForwardDecisionRef(narratives, decisions) {
|
|
230
373
|
const defined = new Set(decisions.map((d) => d.id));
|
|
@@ -351,6 +494,328 @@ export function checkTextHeavyNoDiagram(chapterId, narrative, minProseLines = 30
|
|
|
351
494
|
}
|
|
352
495
|
return [];
|
|
353
496
|
}
|
|
497
|
+
// ============= 禁止造词 lint(术语登记 · 首次定义后续引用确定性化) =============
|
|
498
|
+
//
|
|
499
|
+
// 核心规则(对应 grounding.md §七「禁止造词(术语登记)」与 P9「首次定义、后续引用」):
|
|
500
|
+
// 1. 正文(非表格/非代码块/非标题/非空行)出现的**代码标识符**(snake_case / camelCase)
|
|
501
|
+
// 必须已登记(术语与约定章术语表 / 实体字段名 / 技术白名单),否则 error「未登记术语/疑似造词」;
|
|
502
|
+
// 2. 疑似专名(长小写连写、不在常见英文词表)→ warning「疑似造词,建议登记或中文化」;
|
|
503
|
+
// 3. 编号引用(`第 N 条` / `G#` / `TALOS-…-N` 等)必须有定义点,否则 warning(讲解性障碍)。
|
|
504
|
+
/** 常见英文业务词(正文允许裸用,不视为代码标识符)。 */
|
|
505
|
+
const COMMON_EN_WORDS = new Set([
|
|
506
|
+
'worker', 'debug', 'test', 'setup', 'teardown', 'serial', 'parallel', 'enabled', 'copy', 'inline',
|
|
507
|
+
'origin', 'wipe', 'reclaim', 'leased', 'ingest', 'upsert', 'publish', 'snapshot', 'variables',
|
|
508
|
+
'progress', 'step', 'job', 'execution', 'plan', 'project', 'environment', 'case', 'scenario',
|
|
509
|
+
'ref', 'schema', 'fixture', 'lease', 'epoch', 'queue', 'executor', 'payload', 'envelope', 'status',
|
|
510
|
+
'error', 'warning', 'info', 'ping', 'event', 'data', 'summary', 'percent', 'total', 'page', 'size',
|
|
511
|
+
'items', 'meta', 'count', 'name', 'type', 'required', 'desc', 'condition', 'note', 'kind', 'method',
|
|
512
|
+
'path', 'request', 'response', 'example', 'success', 'failure', 'missing', 'invalid', 'accepted',
|
|
513
|
+
'cancel', 'cancelled', 'running', 'passed', 'skipped', 'failed', 'queued', 'ready', 'draft',
|
|
514
|
+
'deprecated', 'stable', 'regression', 'disabled', 'manual', 'console', 'internal', 'gateway',
|
|
515
|
+
'scheduler', 'result', 'testcase', 'worker', 'pack', 'debug', 'default', 'header', 'body', 'token',
|
|
516
|
+
'bearer', 'authorization', 'login', 'logout', 'retry', 'timeout', 'snapshot', 'fixture', 'schema',
|
|
517
|
+
'template', 'variable', 'value', 'key', 'role', 'mode', 'type', 'group', 'list', 'detail', 'page',
|
|
518
|
+
'tab', 'tree', 'table', 'row', 'column', 'index', 'key', 'queue', 'channel', 'topic', 'frame',
|
|
519
|
+
'ping', 'event', 'endpoint', 'route', 'api', 'http', 'json', 'sql', 'sse', 'rpc', 'grpc', 'proto',
|
|
520
|
+
'redis', 'mysql', 'go', 'vue', 'pinia', 'tailwind', 'element', 'plus', 'vitest', 'playwright',
|
|
521
|
+
'goose', 'k8s', 'jwt', 'casbin', 'mermaid', 'openapi', 'swagger', 'eventsource', 'fetch',
|
|
522
|
+
'readablestream', 'mock', 'rest', 'uri', 'url', 'id', 'uid', 'config', 'version', 'trigger',
|
|
523
|
+
'triggered', 'extractor', 'assertion', 'assert', 'script', 'pre', 'post', 'source', 'target',
|
|
524
|
+
'origin', 'host', 'scheme', 'port', 'ssl', 'tls', 'gateway', 'proxy', 'buffer', 'stream',
|
|
525
|
+
'realtime', 'channel', 'publish', 'subscribe', 'snapshot', 'delta', 'incremental', 'full',
|
|
526
|
+
'retryable', 'durable', 'transient', 'ephemeral', 'persistent', 'atomic', 'consistent', 'leak',
|
|
527
|
+
'reap', 'expire', 'renew', 'renewal', 'grace', 'period', 'window', 'limit', 'cap', 'ceiling',
|
|
528
|
+
'floor', 'threshold', 'ratio', 'rate', 'latency', 'throughput', 'qps', 'rps', 'p95', 'p99',
|
|
529
|
+
'lcp', 'fcp', 'cls', 'inp', 'tti', 'tbt', 'web', 'vite', 'ts', 'js', 'css', 'html', 'yaml',
|
|
530
|
+
'yml', 'env', 'prod', 'stage', 'dev', 'local', 'remote', 'cluster', 'node', 'pod', 'container',
|
|
531
|
+
'image', 'deploy', 'rollback', 'release', 'branch', 'commit', 'merge', 'pr', 'issue', 'ticket',
|
|
532
|
+
'user', 'role', 'group', 'team', 'owner', 'creator', 'editor', 'viewer', 'admin', 'audit',
|
|
533
|
+
'log', 'metric', 'trace', 'span', 'profile', 'benchmark', 'baseline', 'target', 'goal', 'scope',
|
|
534
|
+
'boundary', 'constraint', 'assumption', 'risk', 'mitigation', 'fallback', 'degradation',
|
|
535
|
+
'compat', 'migration', 'legacy', 'new', 'old', 'existing', 'current', 'future', 'next', 'prev',
|
|
536
|
+
// 普通英语词(正文常见,非项目专名,不应触发黑话告警)
|
|
537
|
+
'client', 'server', 'domain', 'infra', 'logic', 'model', 'import', 'history', 'check', 'change',
|
|
538
|
+
'generic', 'guard', 'backend', 'frontend', 'false', 'true', 'headers', 'localhost', 'scenarios',
|
|
539
|
+
'testing', 'verify', 'typecheck', 'sidecar', 'pack', 'executor', 'request', 'response', 'configs',
|
|
540
|
+
'endpoints', 'framework', 'state', 'styling', 'metadata', 'payload', 'entry', 'trace', 'span',
|
|
541
|
+
'scheduler', 'gateway', 'runner', 'pack', 'endpoint', 'params', 'param', 'args', 'arg', 'opt',
|
|
542
|
+
'options', 'flag', 'flags', 'envs', 'vars', 'variable', 'variables', 'scripts', 'script',
|
|
543
|
+
'assertions', 'assertion', 'extractors', 'extractor', 'snapshot', 'delta', 'events', 'event',
|
|
544
|
+
'channel', 'topic', 'queue', 'queues', 'worker', 'workers', 'cluster', 'clusters', 'node', 'nodes',
|
|
545
|
+
'pod', 'pods', 'container', 'containers', 'image', 'images', 'deploy', 'rollback', 'release',
|
|
546
|
+
'branch', 'commit', 'merge', 'pr', 'issue', 'ticket', 'user', 'users', 'role', 'roles', 'group',
|
|
547
|
+
'groups', 'team', 'teams', 'owner', 'owners', 'creator', 'creators', 'editor', 'editors',
|
|
548
|
+
'viewer', 'viewers', 'admin', 'admins', 'audit', 'logs', 'log', 'metrics', 'metric', 'traces',
|
|
549
|
+
'profiles', 'profile', 'benchmark', 'benchmarks', 'baseline', 'baselines', 'target', 'targets',
|
|
550
|
+
'goal', 'goals', 'scope', 'boundary', 'constraint', 'constraints', 'assumption', 'assumptions',
|
|
551
|
+
'risk', 'risks', 'mitigation', 'fallback', 'degradation', 'compat', 'migration', 'legacy',
|
|
552
|
+
'signal', 'signals', 'latency', 'throughput', 'qps', 'rps', 'p95', 'p99', 'lcp', 'fcp', 'cls',
|
|
553
|
+
'inp', 'tti', 'tbt', 'web', 'vite', 'ts', 'js', 'css', 'html', 'yaml', 'yml', 'env', 'prod',
|
|
554
|
+
'stage', 'dev', 'local', 'remote', 'host', 'hosts', 'port', 'ports', 'ssl', 'tls', 'proxy',
|
|
555
|
+
'buffer', 'stream', 'streams', 'realtime', 'publish', 'subscribe', 'subscriber', 'publisher',
|
|
556
|
+
'incremental', 'full', 'retryable', 'durable', 'transient', 'ephemeral', 'persistent', 'atomic',
|
|
557
|
+
'consistent', 'leak', 'reap', 'expire', 'renew', 'renewal', 'grace', 'period', 'window', 'limit',
|
|
558
|
+
'limits', 'cap', 'ceiling', 'floor', 'threshold', 'thresholds', 'ratio', 'rate', 'rates',
|
|
559
|
+
'order', 'orders', 'serial', 'parallel', 'enabled', 'disabled', 'copy', 'inline', 'origin',
|
|
560
|
+
'wipe', 'reclaim', 'leased', 'ingest', 'ingested', 'upsert', 'upserted', 'publish', 'published',
|
|
561
|
+
'snapshot', 'snapshots', 'progress', 'progresses', 'step', 'steps', 'job', 'jobs', 'execution',
|
|
562
|
+
'executions', 'plan', 'plans', 'project', 'projects', 'environment', 'environments', 'case',
|
|
563
|
+
'cases', 'scenario', 'scenarios', 'ref', 'refs', 'schema', 'schemas', 'fixture', 'fixtures',
|
|
564
|
+
'lease', 'leases', 'epoch', 'epochs', 'queue', 'queues', 'payload', 'payloads', 'envelope',
|
|
565
|
+
'envelopes', 'status', 'statuses', 'error', 'errors', 'warning', 'warnings', 'info', 'ping',
|
|
566
|
+
'pings', 'event', 'events', 'data', 'summary', 'percent', 'total', 'page', 'pages', 'size',
|
|
567
|
+
'sizes', 'items', 'item', 'meta', 'count', 'counts', 'name', 'names', 'type', 'types',
|
|
568
|
+
'required', 'desc', 'description', 'condition', 'conditions', 'note', 'notes', 'kind', 'kinds',
|
|
569
|
+
'method', 'methods', 'path', 'paths', 'example', 'examples', 'success', 'failure', 'failures',
|
|
570
|
+
'missing', 'invalid', 'accepted', 'cancel', 'cancelled', 'running', 'passed', 'skipped',
|
|
571
|
+
'failed', 'queued', 'ready', 'draft', 'deprecated', 'stable', 'regression', 'disabled', 'manual',
|
|
572
|
+
'console', 'internal', 'worker', 'pack', 'debug', 'default', 'header', 'headers', 'body',
|
|
573
|
+
'token', 'bearer', 'authorization', 'login', 'logout', 'retry', 'timeout', 'template',
|
|
574
|
+
'templates', 'key', 'keys', 'value', 'values', 'role', 'mode', 'modes', 'group', 'list',
|
|
575
|
+
'lists', 'detail', 'details', 'tab', 'tabs', 'tree', 'tables', 'table', 'row', 'rows', 'column',
|
|
576
|
+
'columns', 'index', 'indexes', 'queue', 'channel', 'channels', 'topic', 'topics', 'frame',
|
|
577
|
+
'frames', 'endpoint', 'route', 'routes', 'api', 'http', 'json', 'sql', 'sse', 'rpc', 'grpc',
|
|
578
|
+
'proto', 'redis', 'mysql', 'go', 'vue', 'pinia', 'tailwind', 'element', 'plus', 'vitest',
|
|
579
|
+
'playwright', 'goose', 'k8s', 'jwt', 'casbin', 'mermaid', 'openapi', 'swagger', 'eventsource',
|
|
580
|
+
'fetch', 'readablestream', 'mock', 'mocks', 'rest', 'uri', 'url', 'id', 'ids', 'config',
|
|
581
|
+
'configs', 'version', 'versions', 'trigger', 'triggers', 'triggered', 'extractor', 'extractors',
|
|
582
|
+
'assertion', 'assertions', 'assert', 'asserts', 'source', 'target', 'targets', 'scheme',
|
|
583
|
+
'schemes', 'host', 'hosts', 'port', 'ports', 'gateway', 'proxy', 'buffering', 'stream',
|
|
584
|
+
'streams', 'realtime', 'channel', 'channels', 'publish', 'subscribe', 'subscriber', 'publisher',
|
|
585
|
+
'incremental', 'full', 'retryable', 'durable', 'transient', 'ephemeral', 'persistent', 'atomic',
|
|
586
|
+
'consistent', 'leak', 'reap', 'expire', 'renew', 'renewal', 'grace', 'period', 'window',
|
|
587
|
+
'window', 'limit', 'limits', 'cap', 'ceiling', 'floor', 'threshold', 'thresholds', 'ratio',
|
|
588
|
+
'rate', 'rates', 'latency', 'throughput', 'qps', 'rps', 'p95', 'p99', 'lcp', 'fcp', 'cls',
|
|
589
|
+
'inp', 'tti', 'tbt', 'web', 'vite', 'ts', 'js', 'css', 'html', 'yaml', 'yml', 'env', 'prod',
|
|
590
|
+
'stage', 'dev', 'local', 'remote', 'cluster', 'node', 'pod', 'container', 'image', 'deploy',
|
|
591
|
+
'rollback', 'release', 'branch', 'commit', 'merge', 'pr', 'issue', 'ticket', 'user', 'role',
|
|
592
|
+
'group', 'team', 'owner', 'creator', 'editor', 'viewer', 'admin', 'audit', 'log', 'metric',
|
|
593
|
+
'trace', 'span', 'profile', 'benchmark', 'baseline', 'target', 'goal', 'scope', 'boundary',
|
|
594
|
+
'constraint', 'assumption', 'risk', 'mitigation', 'fallback', 'degradation', 'compat',
|
|
595
|
+
'migration', 'legacy', 'new', 'old', 'existing', 'current', 'future', 'next', 'prev',
|
|
596
|
+
// 类型名与协议/BDD 术语(正文常见,非造词)
|
|
597
|
+
'proto', 'proto3', 'string', 'int32', 'int64', 'number', 'array', 'object', 'boolean', 'bool',
|
|
598
|
+
'given', 'when', 'then', 'and', 'but', 'given-when-then', 'gwt',
|
|
599
|
+
]);
|
|
600
|
+
/**
|
|
601
|
+
* 技术白名单:通用技术词(混合大小写、isAllUpper 漏网者)与框架标准 API。
|
|
602
|
+
* 只放行**通用**技术标识符;项目专属配置/字段/系统名(inline_snapshot_bytes、
|
|
603
|
+
* report_timeout_ms、oauthstart、TALOS-WORK-1 等)必须登记进术语表,不放白名单——
|
|
604
|
+
* 那正是「禁止造词」要拦截的。
|
|
605
|
+
*/
|
|
606
|
+
const TECH_IDENTIFIER_WHITELIST = new Set([
|
|
607
|
+
'gRPC', 'WebSocket', 'EventSource', 'ReadableStream', 'OpenAPI', 'MySQL', 'AddRoute',
|
|
608
|
+
'ensureCaseResult', 'ingestScenarioStepResult',
|
|
609
|
+
]);
|
|
610
|
+
/** 识别「代码标识符」:含下划线(snake_case)或非首字母大写(camelCase)。 */
|
|
611
|
+
function looksLikeCodeIdentifier(id) {
|
|
612
|
+
if (id.includes('_'))
|
|
613
|
+
return true;
|
|
614
|
+
// camelCase:首字母小写且中间有大写;PascalCase(首字母大写)如 ListExecutions 也计。
|
|
615
|
+
return /[a-z][A-Z]/.test(id) || /^[A-Z][a-z]+[A-Z]/.test(id);
|
|
616
|
+
}
|
|
617
|
+
function isAllUpper(id) {
|
|
618
|
+
return /^[A-Z0-9_]{2,}$/.test(id);
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* 从「术语与约定」章叙述 + 契约实体字段收集**已登记标识符**。
|
|
622
|
+
* - 术语表表格第二列(工程标识,容忍 `job_type=scenario` 取 `job_type`);
|
|
623
|
+
* - 实体字段名(接口请求/响应字段、表字段)与 DDL 反引号列名;
|
|
624
|
+
* - 实体自身 id 与 name(接口/表/决策——含 `<repo>_<id>` 追溯别名与表名);
|
|
625
|
+
* - 决策实体 id(D#)。
|
|
626
|
+
*/
|
|
627
|
+
export function collectRegisteredTerms(glossaryNarrative, entities = {}) {
|
|
628
|
+
const terms = new Set(TECH_IDENTIFIER_WHITELIST);
|
|
629
|
+
// 术语表表格行:`| 中文 | 工程标识 | 说明 |` → 第二列。
|
|
630
|
+
for (const line of glossaryNarrative.split('\n')) {
|
|
631
|
+
const m = line.match(/^\|\s*[^|]+\s*\|\s*`?([A-Za-z_][A-Za-z0-9_=./-]*)`?\s*\|/);
|
|
632
|
+
if (m) {
|
|
633
|
+
const raw = m[1];
|
|
634
|
+
for (const part of raw.split(/[=/]/)) {
|
|
635
|
+
const t = part.trim();
|
|
636
|
+
if (/^[A-Za-z_][A-Za-z0-9_]*$/.test(t))
|
|
637
|
+
terms.add(t);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
for (const it of entities.interfaces ?? []) {
|
|
642
|
+
if (it.id)
|
|
643
|
+
terms.add(it.id);
|
|
644
|
+
if (it.name)
|
|
645
|
+
terms.add(it.name);
|
|
646
|
+
for (const f of it.request_fields ?? [])
|
|
647
|
+
terms.add(f.name);
|
|
648
|
+
for (const f of it.response_fields ?? [])
|
|
649
|
+
terms.add(f.name);
|
|
650
|
+
}
|
|
651
|
+
for (const t of entities.tables ?? []) {
|
|
652
|
+
if (t.id)
|
|
653
|
+
terms.add(t.id);
|
|
654
|
+
if (t.name)
|
|
655
|
+
terms.add(t.name);
|
|
656
|
+
for (const f of t.fields ?? [])
|
|
657
|
+
terms.add(f.name);
|
|
658
|
+
const ddl = t.ddl ?? '';
|
|
659
|
+
for (const m of ddl.matchAll(/`([a-z_][a-z0-9_]*)`/g))
|
|
660
|
+
terms.add(m[1]);
|
|
661
|
+
}
|
|
662
|
+
for (const d of entities.decisions ?? [])
|
|
663
|
+
terms.add(d.id);
|
|
664
|
+
return terms;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* 禁止造词(error/warning):正文叙述行(非表格/非代码/非标题)出现未登记标识符:
|
|
668
|
+
* - snake_case(含下划线,AI 造词强信号)未登记 → error「undefined_term」;
|
|
669
|
+
* - camelCase / PascalCase(品牌名与代码标识符有歧义)未登记 → warning「undefined_jargon」;
|
|
670
|
+
* - 长小写连写且不在常见英文词表(黑话专名如 oauthstart)→ warning「undefined_jargon」。
|
|
671
|
+
* 术语与约定章放行(它本就是登记处)。
|
|
672
|
+
*/
|
|
673
|
+
export function checkUndefinedTerms(chapterId, narrative, registered) {
|
|
674
|
+
if (/term|glossary|约定|术语/i.test(chapterId))
|
|
675
|
+
return [];
|
|
676
|
+
const diags = [];
|
|
677
|
+
const seen = new Set();
|
|
678
|
+
let inFence = false;
|
|
679
|
+
for (const raw of narrative.split('\n')) {
|
|
680
|
+
const line = raw.trimStart();
|
|
681
|
+
if (line.startsWith('```')) {
|
|
682
|
+
inFence = !inFence;
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
if (inFence)
|
|
686
|
+
continue;
|
|
687
|
+
if (line.startsWith('|'))
|
|
688
|
+
continue; // 表格行(字段表)保留原名
|
|
689
|
+
if (/^#{1,6}\s/.test(line))
|
|
690
|
+
continue; // 标题
|
|
691
|
+
if (line.startsWith('<!--'))
|
|
692
|
+
continue; // 注释
|
|
693
|
+
// 剥离括号标注([repo] 仓归属、[D#] 决策引用、[I1]/[T1] 实体引用都是约定语法,非造词)。
|
|
694
|
+
const prose = line.replace(/\[[^\]\n]+\]/g, ' ');
|
|
695
|
+
const idRe = /[A-Za-z_][A-Za-z0-9_]{2,}/g;
|
|
696
|
+
let m;
|
|
697
|
+
while ((m = idRe.exec(prose)) !== null) {
|
|
698
|
+
const id = m[0];
|
|
699
|
+
if (seen.has(id))
|
|
700
|
+
continue;
|
|
701
|
+
if (isAllUpper(id))
|
|
702
|
+
continue; // HTTP/JSON/SSE 等技术缩写
|
|
703
|
+
if (registered.has(id) || TECH_IDENTIFIER_WHITELIST.has(id))
|
|
704
|
+
continue; // 已登记 / 技术白名单
|
|
705
|
+
if (id.includes('_')) {
|
|
706
|
+
// snake_case 是代码标识符的强信号:未登记 → error(禁止造词主门禁)。
|
|
707
|
+
seen.add(id);
|
|
708
|
+
diags.push({
|
|
709
|
+
code: 'undefined_term',
|
|
710
|
+
severity: 'error',
|
|
711
|
+
chapter: chapterId,
|
|
712
|
+
message: `Chapter "${chapterId}" 正文出现未登记代码标识符「${id}」——疑似 AI 造词:术语/标识符必须先登记进「术语与约定」章(中文名 ↔ 工程标识),或改用中文业务术语;标识符只允许出现在术语表、字段表、JSON/HTTP 示例与代码块中`,
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
else if (/[a-z][A-Z]/.test(id) || /^[A-Z][a-z]+[A-Z]/.test(id)) {
|
|
716
|
+
// camelCase/PascalCase:品牌名(GitHub/MacBook)与代码标识符(ListExecutions)有歧义 → warning。
|
|
717
|
+
seen.add(id);
|
|
718
|
+
diags.push({
|
|
719
|
+
code: 'undefined_jargon',
|
|
720
|
+
severity: 'warning',
|
|
721
|
+
chapter: chapterId,
|
|
722
|
+
message: `Chapter "${chapterId}" 出现疑似未定义标识符「${id}」——若为代码标识符请登记进「术语与约定」章或改用中文业务术语;若为品牌/产品名(如 GitHub、MacBook)可忽略`,
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
else if (id.length >= 5 && !COMMON_EN_WORDS.has(id.toLowerCase())) {
|
|
726
|
+
// 长小写连写且非英文常见词:疑似专名/黑话(如 oauthstart)。
|
|
727
|
+
seen.add(id);
|
|
728
|
+
diags.push({
|
|
729
|
+
code: 'undefined_jargon',
|
|
730
|
+
severity: 'warning',
|
|
731
|
+
chapter: chapterId,
|
|
732
|
+
message: `Chapter "${chapterId}" 出现疑似未定义专名「${id}」——请确认其已在术语表登记或指向既有文档,避免阅读障碍(黑话/造词)`,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return diags;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* 未定义编号引用(warning):正文出现 `第 N 条` / `G#` / `TALOS-…-N` 等编号引用,
|
|
741
|
+
* 但文档内无对应定义点(术语表登记或「第 N 条:…」定义句式)→ 提示补定义或指向既有文档。
|
|
742
|
+
*/
|
|
743
|
+
export function checkUndefinedRefs(narratives, glossaryNarrative) {
|
|
744
|
+
const diags = [];
|
|
745
|
+
// 定义点来源:术语表登记(`第 N 条` / `G#` / `XXX-N` 编号出现在术语表即视为已定义)+ 各章「第 N 条:」定义句式。
|
|
746
|
+
const defined = new Set();
|
|
747
|
+
for (const m of glossaryNarrative.matchAll(/第\s*(\d+)\s*条/g))
|
|
748
|
+
defined.add(`第${m[1]}条`);
|
|
749
|
+
for (const m of glossaryNarrative.matchAll(/G(\d+)/g))
|
|
750
|
+
defined.add(`G${m[1]}`);
|
|
751
|
+
for (const m of glossaryNarrative.matchAll(/([A-Z][A-Z-]*)-\d+/g))
|
|
752
|
+
defined.add(m[1]);
|
|
753
|
+
for (const [chId, narrative] of narratives) {
|
|
754
|
+
if (/term|glossary|约定|术语/i.test(chId))
|
|
755
|
+
continue; // 术语表自身是登记处,不查
|
|
756
|
+
const refRe = /第\s*(\d+)\s*条|G(\d+)|([A-Z][A-Z-]*)-\d+/g;
|
|
757
|
+
let m;
|
|
758
|
+
while ((m = refRe.exec(narrative)) !== null) {
|
|
759
|
+
const key = m[1] ? `第${m[1]}条` : m[2] ? `G${m[2]}` : m[3];
|
|
760
|
+
if (defined.has(key))
|
|
761
|
+
continue;
|
|
762
|
+
diags.push({
|
|
763
|
+
code: 'undefined_ref',
|
|
764
|
+
severity: 'warning',
|
|
765
|
+
chapter: chId,
|
|
766
|
+
message: `Chapter "${chId}" 引用了未定义的编号「${m[0]}」——请在术语表登记其含义或指向既有文档(如 Worker 契约第 N 条),避免读者无法定位`,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return diags;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* 跨章重复(P9 首次定义后续引用,warning):同一正文行(归一化:去空白/小写/去标点)出现在
|
|
774
|
+
* ≥2 个不同章节 → 提示收敛为「首次定义 + 交叉引用」,禁止跨章重复整段。
|
|
775
|
+
*/
|
|
776
|
+
export function checkCrossChapterDuplicate(narratives) {
|
|
777
|
+
const diags = [];
|
|
778
|
+
const seen = new Map(); // normLine -> chapterId
|
|
779
|
+
const reported = new Set();
|
|
780
|
+
for (const [chId, narrative] of narratives) {
|
|
781
|
+
if (/term|glossary|约定|术语/i.test(chId))
|
|
782
|
+
continue; // 术语表天然罗列
|
|
783
|
+
let inFence = false;
|
|
784
|
+
for (const raw of narrative.split('\n')) {
|
|
785
|
+
const line = raw.trim();
|
|
786
|
+
if (line.startsWith('```')) {
|
|
787
|
+
inFence = !inFence;
|
|
788
|
+
continue;
|
|
789
|
+
}
|
|
790
|
+
if (inFence)
|
|
791
|
+
continue;
|
|
792
|
+
if (line.startsWith('|') || /^#{1,6}\s/.test(line) || line === '')
|
|
793
|
+
continue;
|
|
794
|
+
if (line.startsWith('<!--'))
|
|
795
|
+
continue;
|
|
796
|
+
const norm = line.replace(/[\s,。;:、,.;:()[\]{}'"“”‘’`]/g, '').toLowerCase();
|
|
797
|
+
if (norm.length < 12)
|
|
798
|
+
continue; // 过短行不判(列表项/短句)
|
|
799
|
+
const prev = seen.get(norm);
|
|
800
|
+
if (prev !== undefined && prev !== chId) {
|
|
801
|
+
const reportKey = `${prev}->${chId}:${norm}`;
|
|
802
|
+
if (!reported.has(reportKey)) {
|
|
803
|
+
reported.add(reportKey);
|
|
804
|
+
diags.push({
|
|
805
|
+
code: 'cross_chapter_duplicate',
|
|
806
|
+
severity: 'warning',
|
|
807
|
+
chapter: chId,
|
|
808
|
+
message: `Chapter "${chId}" 与 "${prev}" 存在重复叙述「${line.slice(0, 40)}…」——P9 首次定义后续引用:请保留一处定义,其余改为交叉引用(如「失败分叉见主业务流程·失败路径决策图」)`,
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
else if (prev === undefined) {
|
|
813
|
+
seen.set(norm, chId);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return diags;
|
|
818
|
+
}
|
|
354
819
|
function escapeRegExp(s) {
|
|
355
820
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
356
821
|
}
|
|
@@ -55,3 +55,5 @@ export declare function checkReviewResult(workRoot: string, review: ReviewResult
|
|
|
55
55
|
sha256: string;
|
|
56
56
|
}>): Promise<ReviewCheckResult>;
|
|
57
57
|
export declare function writeReviewResult(workRoot: string, review: ReviewResult): Promise<void>;
|
|
58
|
+
/** 读取 workRoot 下的 review-result.json;缺失或非法 → null(调用方决定是否报 review_result_missing)。 */
|
|
59
|
+
export declare function readReviewResult(workRoot: string): Promise<ReviewResult | null>;
|
|
@@ -200,3 +200,13 @@ export async function checkReviewResult(workRoot, review, outline, currentHashes
|
|
|
200
200
|
export async function writeReviewResult(workRoot, review) {
|
|
201
201
|
await fs.writeFile(join(workRoot, 'review-result.json'), JSON.stringify(review, null, 2), 'utf-8');
|
|
202
202
|
}
|
|
203
|
+
/** 读取 workRoot 下的 review-result.json;缺失或非法 → null(调用方决定是否报 review_result_missing)。 */
|
|
204
|
+
export async function readReviewResult(workRoot) {
|
|
205
|
+
try {
|
|
206
|
+
const raw = JSON.parse(await fs.readFile(join(workRoot, 'review-result.json'), 'utf-8'));
|
|
207
|
+
return parseReviewResult(raw);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gordon.gan/specflow",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-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": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"url": "https://github.com/Gordon-Gan-Jiang/specflow/issues"
|
|
28
28
|
},
|
|
29
29
|
"bin": {
|
|
30
|
-
"specflow": "
|
|
30
|
+
"specflow": "bin/specflow.js"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=20.19.0"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
> **HARD GATE**: User must confirm the rewritten propose before Phase B execution begins. Do NOT proceed to implementation until the user has reviewed and approved the rewritten tasks.md.
|
|
1
|
+
> **HARD GATE (default / yes-after-plan)**: User must confirm the rewritten propose before Phase B execution begins. Do NOT proceed to implementation until the user has reviewed and approved the rewritten tasks.md.
|
|
2
|
+
> **Yes mode**: A successful rewrite may be auto-accepted, but gaps and reorganization choices still stop the run. Never proceed on a missing design decision.
|
|
2
3
|
|
|
3
4
|
<!-- SOURCE: skills/writing-plans/SKILL.md (with build Phase A rewrite semantics) -->
|
|
4
5
|
|
|
@@ -16,6 +17,14 @@
|
|
|
16
17
|
**Plan location (input and output):** `specflow/changes/<change-name>/tasks.md`
|
|
17
18
|
- (User preferences for propose location override this default)
|
|
18
19
|
|
|
20
|
+
## Confirmation Mode (inherited from SKILL.md)
|
|
21
|
+
|
|
22
|
+
- `default`: Gate A waits for user confirmation; Gate B waits after each task.
|
|
23
|
+
- `yes`: Gate A auto-accepts a successful rewrite; Gate B auto-continues after `Approve`/`Warning`.
|
|
24
|
+
- `yes-after-plan`: Gate A waits for one confirmation; after confirmation, Gate B auto-continues.
|
|
25
|
+
|
|
26
|
+
In every mode, stop on a design gap, reorganization choice, review `Block`, failing baseline/tests, verify `FAIL`, unresolved `BLOCKED`/`NEEDS_CONTEXT`, unexplained out-of-scope file changes, or a sensitive-area change without explicit approval.
|
|
27
|
+
|
|
19
28
|
## Artifact Language
|
|
20
29
|
|
|
21
30
|
Before rewriting, resolve `artifacts.language` from the active planning root's `specflow/config.yaml` (see shared `artifact-language.md`). Rewrite **group titles and task description prose** in that language (`zh-CN` → Simplified Chinese; `en` → English). Keep file paths, commands, code blocks, symbols, and Verify command text unchanged. Do not switch business narrative to English when `zh-CN` is configured. zh-CN: 叙述简要;怎么做用 1. 2. 3.。
|
|
@@ -50,6 +59,7 @@ This is the standard path. When design.md is finalized and existing groups are w
|
|
|
50
59
|
- Full code block or exact diff instructions (no "similar to above")
|
|
51
60
|
- `Verify:` line with the command to run AND the expected output or exit condition
|
|
52
61
|
- Produce the rewritten tasks.md in place (overwrite the coarse version).
|
|
62
|
+
- If tasks.md is already rewritten and contains `[x]` progress, preserve those checked tasks and continue from the first `[ ]`; do not reset completed work.
|
|
53
63
|
- Proceed to the Before/After Audit (see later section).
|
|
54
64
|
|
|
55
65
|
---
|
|
@@ -271,22 +281,24 @@ Rewrite summary:
|
|
|
271
281
|
|
|
272
282
|
This audit lets the user spot structural surprises (e.g., a group that exploded from 2 to 20 atomic tasks suggests it should have been split).
|
|
273
283
|
|
|
274
|
-
##
|
|
284
|
+
## Gate A Contract Summary
|
|
275
285
|
|
|
276
|
-
|
|
286
|
+
Before Gate A confirmation, present:
|
|
277
287
|
|
|
278
|
-
**
|
|
288
|
+
- **Scope:** task groups, task count, files/directories to modify.
|
|
289
|
+
- **Non-goals:** what this run will not change.
|
|
290
|
+
- **Risk:** migrations, auth/security, payments, public API/schema, dependency manifests, CI/deploy config, secrets, and any files that would widen the declared scope.
|
|
291
|
+
- **Budget:** task count from `tasks.md`, declared file/directory scope, and per-task retry cap (default: 3 implement → review rounds). If design or tasks specify a stricter budget, use it.
|
|
292
|
+
- **Stop conditions:** the hard stops and sensitive areas in this contract.
|
|
279
293
|
|
|
280
|
-
|
|
294
|
+
Gate A confirmation approves only the sensitive areas explicitly named in this summary. A newly discovered sensitive area or an unexplained out-of-scope file change is a hard stop in every mode.
|
|
281
295
|
|
|
282
|
-
|
|
296
|
+
## Execution Handoff
|
|
283
297
|
|
|
284
|
-
**Which approach?"
|
|
298
|
+
After the rewrite and audit, the default execution mode is **Subagent-Driven**. Do not ask "Which approach?" unless the user explicitly requested inline execution.
|
|
285
299
|
|
|
286
|
-
**
|
|
287
|
-
- **
|
|
288
|
-
-
|
|
300
|
+
- **default:** present the plan/audit + contract summary and wait for Gate A confirmation.
|
|
301
|
+
- **yes-after-plan:** present the plan/audit + contract summary and wait for one confirmation; after confirmation, continue to Phase B in auto mode.
|
|
302
|
+
- **yes:** record the audit as automatically accepted and continue to Phase B.
|
|
289
303
|
|
|
290
|
-
|
|
291
|
-
- **REQUIRED SUB-SKILL:** Use specflow:apply Phase B (inline mode)
|
|
292
|
-
- Batch execution with checkpoints for review
|
|
304
|
+
Phase B uses `specflow:apply` Phase B (subagent-driven). Inline execution is only used when the user explicitly asks for it.
|