pi-patch-keeper 1.3.7 → 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.
- package/README.md +2 -2
- package/index.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ pi install npm:pi-patch-keeper
|
|
|
27
27
|
|
|
28
28
|
## 配置
|
|
29
29
|
|
|
30
|
-
配置文件 `~/.pi/patch-keeper.json
|
|
30
|
+
配置文件 `~/.pi/patch-keeper.json`(可省略);无环境变量。**只支持 `forceTail` 一个键**——旧版遗留的 `packages` / `defaultTools` / `enabledModels` 等字段无代码消费,改它们不生效;启动时若检测到未知键会明确告知(2026-10-18 起)。
|
|
31
31
|
|
|
32
32
|
| 键 | 类型 | 默认 | 说明 |
|
|
33
33
|
| --- | --- | --- | --- |
|
|
@@ -123,7 +123,7 @@ pi install npm:pi-patch-keeper
|
|
|
123
123
|
|
|
124
124
|
## Configuration
|
|
125
125
|
|
|
126
|
-
Config file `~/.pi/patch-keeper.json` (optional); no environment variables.
|
|
126
|
+
Config file `~/.pi/patch-keeper.json` (optional); no environment variables. **Only `forceTail` is read** — legacy keys such as `packages` / `defaultTools` / `enabledModels` have no consumer, so editing them does nothing; unknown keys are reported at startup.
|
|
127
127
|
|
|
128
128
|
| Key | Type | Default | Description |
|
|
129
129
|
| --- | --- | --- | --- |
|
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.
|
|
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",
|