sillyspec 3.26.7 → 3.26.8

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.
@@ -24,6 +24,7 @@ import { openDatabase, pluckGet, pluckAll } from './db-engine.js';
24
24
  import { existsSync, statSync, readFileSync, readdirSync, mkdirSync, writeFileSync, unlinkSync } from 'fs';
25
25
  import { join } from 'path';
26
26
  import { CHECK_SEVERITY } from './constants.js';
27
+ import { checkPlatformManaged } from './run/shared.js';
27
28
 
28
29
  // db 角色标签
29
30
  const DB_ROLE = {
@@ -216,8 +217,28 @@ function detectMultiDb(cwd, pointer) {
216
217
 
217
218
  // ── D2 pointer 健康 ───────────────────────────────────────────────────
218
219
 
219
- function detectPointerHealth(pointer) {
220
+ function detectPointerHealth(pointer, cwd = null) {
220
221
  if (!pointer.present) {
222
+ // FR-06:指针缺失但接管声明存在 → 报 pointer_missing_but_managed(warning 非阻断)。
223
+ // 此状态 resolvePlatformSpecDir / runCommand 恢复链会 fail-closed 拒绝静默落本地,
224
+ // doctor 只读诊断给出同款恢复引导(不自动执行任何修复)。
225
+ if (cwd) {
226
+ const decl = checkPlatformManaged(cwd);
227
+ if (decl) {
228
+ return {
229
+ name: 'pointer_health',
230
+ label: '平台指针健康',
231
+ pass: false,
232
+ severity: CHECK_SEVERITY.WARNING,
233
+ findings: [
234
+ `pointer_missing_but_managed: 平台接管声明存在但恢复指针缺失(原 specRoot: ${decl.specRoot || '(未记录)'})——` +
235
+ `裸调命令将 fail-closed 拒绝静默落本地。恢复:① 重跑平台 scan/init(带 --spec-root)重建指针;` +
236
+ `② sillyspec platform disconnect(删除接管声明,彻底脱离平台);③ 显式 --spec-dir <路径> 临时指定。`,
237
+ ],
238
+ safe_actions: [{ dimension: 'pointer_health', action: 'recreate_pointer', risk: 'confirm_required', rationale: '接管声明存在但指针缺失,需重建指针或显式脱离平台', next_step: '重跑平台 scan(带 --spec-root)或 sillyspec platform disconnect' }],
239
+ };
240
+ }
241
+ }
221
242
  return {
222
243
  name: 'pointer_health',
223
244
  label: '平台指针健康',
@@ -489,7 +510,7 @@ function detectExecuteProgressPlanMismatch(authoritySpecRoot, authDb) {
489
510
  export async function runDoctorDiagnostics({ cwd }) {
490
511
  const pointer = resolvePointer(cwd);
491
512
  const multiDb = detectMultiDb(cwd, pointer);
492
- const pointerHealth = detectPointerHealth(pointer);
513
+ const pointerHealth = detectPointerHealth(pointer, cwd);
493
514
  const changesSplit = detectChangesSplit(cwd, pointer);
494
515
  const changeDb = detectChangeDbConsistency(cwd, pointer, multiDb);
495
516