claude-token-saver 3.5.0 → 3.5.1
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/installer.js +10 -0
package/package.json
CHANGED
package/src/installer.js
CHANGED
|
@@ -223,6 +223,11 @@ export function installSessionStartHook() {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
settings.hooks = settings.hooks || {};
|
|
226
|
+
// A present-but-non-array value is schema-invalid, but it's the user's
|
|
227
|
+
// data — back off instead of silently replacing it.
|
|
228
|
+
if (settings.hooks.SessionStart !== undefined && !Array.isArray(settings.hooks.SessionStart)) {
|
|
229
|
+
return { path: file, action: 'skipped', reason: 'hooks.SessionStart is not an array — fix settings.json manually' };
|
|
230
|
+
}
|
|
226
231
|
const list = Array.isArray(settings.hooks.SessionStart) ? settings.hooks.SessionStart : [];
|
|
227
232
|
const already = list.some((m) =>
|
|
228
233
|
Array.isArray(m?.hooks) && m.hooks.some((h) => typeof h?.command === 'string' && h.command.includes('route-scan --hook')),
|
|
@@ -260,6 +265,11 @@ export function installBriefHook() {
|
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
settings.hooks = settings.hooks || {};
|
|
268
|
+
// A present-but-non-array value is schema-invalid, but it's the user's
|
|
269
|
+
// data — back off instead of silently replacing it.
|
|
270
|
+
if (settings.hooks.UserPromptSubmit !== undefined && !Array.isArray(settings.hooks.UserPromptSubmit)) {
|
|
271
|
+
return { path: file, action: 'skipped', reason: 'hooks.UserPromptSubmit is not an array — fix settings.json manually' };
|
|
272
|
+
}
|
|
263
273
|
const list = Array.isArray(settings.hooks.UserPromptSubmit) ? settings.hooks.UserPromptSubmit : [];
|
|
264
274
|
const already = list.some((m) =>
|
|
265
275
|
Array.isArray(m?.hooks) && m.hooks.some((h) => typeof h?.command === 'string' && h.command.includes('brief --hook')),
|