pi-patch-keeper 1.3.8 → 1.3.9

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.
Files changed (2) hide show
  1. package/index.ts +11 -0
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -150,6 +150,15 @@ export function loadConfig(): PkConfig {
150
150
  try { const j = JSON.parse(raw) as PkConfig; return j && typeof j === "object" ? j : {}; } catch { return {}; }
151
151
  }
152
152
  /** force 型包列表(配置优先,缺省用内置两项)。 */
153
+ /** 配置里无代码消费的字段(2026-10-18:旧版遗留的 packages/defaultTools/enabledModels 等,改它们不生效——必须显式告知,否则用户以为在配置)。 */
154
+ export function unknownConfigKeys(cfg?: Record<string, unknown>): string[] {
155
+ try {
156
+ const known = new Set(["forceTail"]);
157
+ const obj = cfg ?? (loadConfig() as Record<string, unknown>);
158
+ return Object.keys(obj).filter((k) => !known.has(k));
159
+ } catch { return []; }
160
+ }
161
+
153
162
  export function forceTail(): string[] {
154
163
  const c = loadConfig();
155
164
  const list = Array.isArray(c.forceTail) ? c.forceTail.filter((x): x is string => typeof x === "string" && x.length > 0) : [];
@@ -285,6 +294,8 @@ export default function (pi: ExtensionAPI) {
285
294
  if (drift.length) msgs.push("patch-keeper: 环境指纹已变(" + drift.join(";") + ")—— 手册 / 上轮验证结论可能过期,按 08-台账核对纪律逐项重验");
286
295
  const md = manualDrift();
287
296
  if (md) msgs.push("patch-keeper: " + md);
297
+ const unk = unknownConfigKeys();
298
+ if (unk.length) msgs.push("patch-keeper: ~/.pi/patch-keeper.json 含无代码消费的字段(" + unk.join(", ") + ")—— 仅 forceTail 生效,其余可删(2026-10-18 起显式提示)");
288
299
  for (const m of msgs) ctx.ui.notify(m, "warning");
289
300
  } catch { /* 静默:检测不该影响会话 */ }
290
301
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-patch-keeper",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "pi config guards: codemode single-source check, force-order guard (auto-fix), settings fingerprint drift, injected-manual alignment. (PiDeck / third-party source patches are a local-only module, not bundled.)",
5
5
  "type": "module",
6
6
  "license": "MIT",