sillyspec 3.29.0 → 3.29.2
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/package.json +1 -1
- package/src/agent-session-log.js +54 -0
- package/src/config-schema.js +1 -1
- package/src/fr-index.js +219 -11
- package/src/handoff.js +113 -0
- package/src/index.js +52 -0
- package/src/redlines.js +195 -0
- package/src/run/command.js +32 -0
- package/src/run/complete.js +60 -2
- package/src/run/gate-snapshot.js +54 -3
- package/src/run/prompt.js +2 -2
- package/src/run/quick-audit.js +12 -2
- package/src/run/verify-quality-scan.js +1 -1
- package/src/stages/brainstorm-auto.js +1 -1
- package/src/stages/brainstorm.js +7 -4
- package/src/stages/execute.js +2 -2
- package/src/stages/plan.js +16 -12
- package/src/stages/scan.js +1 -1
- package/src/verify-probes.js +77 -0
- package/src/worktree-apply.js +1 -1
- package/src/worktree.js +1 -1
package/src/verify-probes.js
CHANGED
|
@@ -39,6 +39,9 @@ import { verifyApiParity, _readWorktreeMeta } from './contract-matrix.js'
|
|
|
39
39
|
import { RECEIPT_SOURCE_CROSS_LAYER_RE as RECEIPT_CROSS_LAYER_RE, RECEIPT_SOURCE_UNIT_RE as RECEIPT_UNIT_RE, CLI_SMOKE_SOURCE_MARK as SMOKE_RECEIPT_SOURCE_MARK } from './change-risk-profile.js'
|
|
40
40
|
import { splitOwnVsForeignDiffFiles } from './foreign-declared.js'
|
|
41
41
|
import { resolveSpecDir, resolveRuntimeRoot, detectWorktreeSpecDrift } from './run/shared.js'
|
|
42
|
+
// 探针 11(2026-09-20-redline-machine-check):红线机检评估器——纯函数模块,依赖
|
|
43
|
+
// (fs/js-yaml)已在模块图内,静态导入零增量开销;评估器异常由探针 fail-soft 捕获。
|
|
44
|
+
import { parseRedlines, evaluateRedlines } from './redlines.js'
|
|
42
45
|
|
|
43
46
|
// 探针1 未实现标记匹配(坑 probe1-literal-false-positive,2026-09-15 复盘实证:16 命中全
|
|
44
47
|
// 字面误报——TODO_FLAG_TODO 业务常量、「XXX完成处置」中文占位模板)。口径分三级:
|
|
@@ -2229,6 +2232,17 @@ export function runVerifyProbes({ cwd, changeName, specDir = null }) {
|
|
|
2229
2232
|
probe10.notes = [`探针 10 执行失败(fail-soft 跳过):${e && e.message ? e.message : e}`]
|
|
2230
2233
|
}
|
|
2231
2234
|
|
|
2235
|
+
// ── 探针 11:红线一致性(advisory;2026-09-20-redline-machine-check——对撞实验核心
|
|
2236
|
+
// 教训转化:语义红线活在散文里无机器可查形态)。消费者仓自持 .sillyspec/redlines.yaml
|
|
2237
|
+
// (缺=不适用零打扰,D-002);forbid 命中 ❌/⚠️(severity 驱动)、require 缺失 ⚠️,渲染进
|
|
2238
|
+
// 骨架供裁定;不进 PASS 封顶(D-003:攒误报率后另案升硬门)。fail-soft 同 8/9/10。──
|
|
2239
|
+
let probe11 = { applicable: false, entryCount: 0, findings: [], warnings: [] }
|
|
2240
|
+
try {
|
|
2241
|
+
probe11 = runRedlineConsistencyProbe({ specBase, cwd, wtRoot, changeName })
|
|
2242
|
+
} catch (e) {
|
|
2243
|
+
probe11.warnings = [`探针 11 执行失败(fail-soft 跳过):${e && e.message ? e.message : e}`]
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2232
2246
|
// ── 接口面 + 消费端归类(task-04 / FR-05 / D-005~D-007):design.md 接口段 tolerant
|
|
2233
2247
|
// 解析 + 清单消费端归类——骨架「## 接口验证覆盖矩阵」段预填与 facts 落盘
|
|
2234
2248
|
// (backfillFactsFromMdAndTests)共用同一解析器(单一产物源,不各读各的)。fail-soft:
|
|
@@ -2352,6 +2366,8 @@ export function renderVerifyProbesReport(result) {
|
|
|
2352
2366
|
// 探针 10 紧随探针 9;旧 result 无 probe10 键(存量调用方/合成 result)→ applicable=false
|
|
2353
2367
|
// 渲染「不适用」行 + notes,零回归(探针 8/9 兜底口径同款)。
|
|
2354
2368
|
L.push(...(renderProbe10Lines(result.probe10 || { applicable: false, checkedFiles: 0, unclearedFiles: [], notes: [] })))
|
|
2369
|
+
// 探针 11 紧随 10;旧 result 无 probe11 键 → 不适用兜底(8/9/10 同款零回归口径)。
|
|
2370
|
+
L.push(...(renderProbe11Lines(result.probe11 || { applicable: false, entryCount: 0, findings: [], warnings: [] })))
|
|
2355
2371
|
return L.join('\n')
|
|
2356
2372
|
}
|
|
2357
2373
|
|
|
@@ -2463,6 +2479,67 @@ function renderProbe10Lines(p10) {
|
|
|
2463
2479
|
return L
|
|
2464
2480
|
}
|
|
2465
2481
|
|
|
2482
|
+
// ── 探针 11:红线一致性(2026-09-20-redline-machine-check,advisory)──────────────
|
|
2483
|
+
|
|
2484
|
+
const PROBE11_HEADING = '#### 探针 11:红线一致性(advisory)'
|
|
2485
|
+
|
|
2486
|
+
/**
|
|
2487
|
+
* 红线一致性探针(advisory / fail-open 全链,D-003/D-004):
|
|
2488
|
+
* 读 <specBase>/redlines.yaml(消费者仓自持,缺=不适用零打扰),调 redlines.js
|
|
2489
|
+
* 评估器(纯函数,root=wtRoot||cwd 定位 scope 文件)。坏 yaml → 不适用 + 注记;
|
|
2490
|
+
* 不进 PASS 封顶(D-003:攒误报率后另案升硬门)。
|
|
2491
|
+
*/
|
|
2492
|
+
export function runRedlineConsistencyProbe({ specBase, cwd, wtRoot = null }) {
|
|
2493
|
+
const yamlPath = join(specBase, 'redlines.yaml')
|
|
2494
|
+
if (!existsSync(yamlPath)) {
|
|
2495
|
+
return { applicable: false, entryCount: 0, findings: [], warnings: [] }
|
|
2496
|
+
}
|
|
2497
|
+
let yamlText
|
|
2498
|
+
try {
|
|
2499
|
+
yamlText = readFileSync(yamlPath, 'utf8')
|
|
2500
|
+
} catch (e) {
|
|
2501
|
+
return { applicable: false, entryCount: 0, findings: [], warnings: [`redlines.yaml 读取失败(不适用):${e && e.code ? e.code : 'error'}`] }
|
|
2502
|
+
}
|
|
2503
|
+
let parsed
|
|
2504
|
+
try {
|
|
2505
|
+
parsed = parseRedlines(yamlText)
|
|
2506
|
+
} catch (e) {
|
|
2507
|
+
return { applicable: false, entryCount: 0, findings: [], warnings: [`redlines.yaml 解析失败(不适用):${e && e.message ? e.message : e}`] }
|
|
2508
|
+
}
|
|
2509
|
+
const root = wtRoot || cwd
|
|
2510
|
+
const result = evaluateRedlines({ entries: parsed.entries, root })
|
|
2511
|
+
return {
|
|
2512
|
+
applicable: true,
|
|
2513
|
+
entryCount: result.entryCount,
|
|
2514
|
+
findings: result.findings,
|
|
2515
|
+
warnings: [...(parsed.warnings || []), ...(result.warnings || [])],
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/** renderProbe11Lines:不适用 / 命中逐条(severity 驱动 ❌/⚠️ + statement + origin)/ ✅ 计数。 */
|
|
2520
|
+
function renderProbe11Lines(p11) {
|
|
2521
|
+
const L = [PROBE11_HEADING]
|
|
2522
|
+
if (!p11 || !p11.applicable) {
|
|
2523
|
+
L.push('- 不适用(仓未配置 .sillyspec/redlines.yaml——红线机检零打扰,D-002)')
|
|
2524
|
+
for (const w of (p11 && p11.warnings) || []) L.push(`- ℹ️ ${w}`)
|
|
2525
|
+
return L
|
|
2526
|
+
}
|
|
2527
|
+
L.push('<!-- 口径注记:模式级断言(正则×scope,人写人负责)非语义审计——命中是「定向复核提示」;advisory 不阻断(D-003:误报率数据攒够后另案升硬门)。命中处置:真违规则修代码或升红线版本;正则过宽则收窄条目。 -->')
|
|
2528
|
+
const findings = p11.findings || []
|
|
2529
|
+
if (findings.length === 0) {
|
|
2530
|
+
L.push(`- ✅ 红线全过(${p11.entryCount ?? 0} 条断言,0 命中 0 缺失)`)
|
|
2531
|
+
} else {
|
|
2532
|
+
for (const f of findings) {
|
|
2533
|
+
const marker = f.kind === 'forbid' && f.severity === 'error' ? '❌' : '⚠️'
|
|
2534
|
+
const where = f.file ? `\`${f.file}:${f.line}\`` : 'scope 全集'
|
|
2535
|
+
L.push(`- ${marker} ${f.id}(${f.kind === 'forbid' ? '禁式命中' : '要求缺失'})@ ${where}${f.snippet ? `:\`${mdEscapeCell(f.snippet, 100)}\`` : f.detail ? `:${f.detail}` : ''}`)
|
|
2536
|
+
if (f.statement) L.push(` - 红线:${f.statement}${f.origin ? `(溯源:${f.origin})` : ''}`)
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
for (const w of p11.warnings || []) L.push(`- ℹ️ ${w}`)
|
|
2540
|
+
return L
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2466
2543
|
// ── 接口验证覆盖矩阵段渲染(task-04 / FR-05 / D-005~D-007)──
|
|
2467
2544
|
// 骨架新写路径(generateVerifyResultSkeleton)与缺段补齐(ensureApiCoverageMatrixSection)
|
|
2468
2545
|
// 共用单一实现——renderProbe7Lines 先例。不动 probe7 既有矩阵(独立 ## 章节并行存在,口径
|
package/src/worktree-apply.js
CHANGED
|
@@ -1519,7 +1519,7 @@ export function applyWorktree(changeName, { cwd, checkOnly = false, merge = fals
|
|
|
1519
1519
|
if (derivedRisk.length > 0) {
|
|
1520
1520
|
result.warnings = (result.warnings || []).concat([
|
|
1521
1521
|
`${derivedRisk.length} 个变更文件在 worktree 基线后主仓已有新提交(并行变更可能已合入):${derivedRisk.slice(0, 5).join(', ')}${derivedRisk.length > 5 ? ' 等' : ''}` +
|
|
1522
|
-
|
|
1522
|
+
`——若其中含生成产物(类型生成/代码生成产物等),本次 apply 可能以旧基线内容覆盖已合入的新内容;apply 后在新基线重跑生成命令再验证`
|
|
1523
1523
|
]);
|
|
1524
1524
|
}
|
|
1525
1525
|
}
|
package/src/worktree.js
CHANGED
|
@@ -1751,7 +1751,7 @@ export class WorktreeManager {
|
|
|
1751
1751
|
const escapes = detectEditableInstallEscape(wtPath);
|
|
1752
1752
|
if (escapes.length > 0) {
|
|
1753
1753
|
issues.push({ type: 'editable-install-escape', name, fixable: false,
|
|
1754
|
-
detail: `worktree venv 含 ${escapes.length} 个 editable install 指向 worktree 外(${escapes.slice(0, 5).map(e => `${e.pkg}→${e.target}`).join(', ')}${escapes.length > 5 ? ' 等' : ''}
|
|
1754
|
+
detail: `worktree venv 含 ${escapes.length} 个 editable install 指向 worktree 外(${escapes.slice(0, 5).map(e => `${e.pkg}→${e.target}`).join(', ')}${escapes.length > 5 ? ' 等' : ''})——生成链/后端命令会静默加载 worktree 外旧代码。轻量出口:跑生成链前设 PYTHONPATH=<worktree>/<项目源码根>(PYTHONPATH 优先于 .pth);彻底修复:worktree 内重装(uv sync / uv pip install -e .)` });
|
|
1755
1755
|
}
|
|
1756
1756
|
} catch { /* 探测失败不阻断 doctor */ }
|
|
1757
1757
|
}
|