fullcourtdefense-cli 1.6.1 → 1.6.3
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.
|
@@ -109,7 +109,7 @@ async function installCursorHookCommand(args, config) {
|
|
|
109
109
|
const projectScope = args.project === 'true';
|
|
110
110
|
const shadow = args.shadow === 'true';
|
|
111
111
|
const file = hooksJsonPath(projectScope);
|
|
112
|
-
const requested = (args.events || '
|
|
112
|
+
const requested = (args.events || 'shell,mcp')
|
|
113
113
|
.split(/[\s,]+/).map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
114
114
|
const events = requested.filter((e) => EVENT_MAP[e]);
|
|
115
115
|
if (events.length === 0) {
|
|
@@ -123,19 +123,27 @@ async function installCursorHookCommand(args, config) {
|
|
|
123
123
|
});
|
|
124
124
|
const credFile = ensureHomeShield(creds);
|
|
125
125
|
const json = readHooksJson(file);
|
|
126
|
+
// Clear all previous FullCourtDefense-managed hooks first. This prevents old
|
|
127
|
+
// prompt/read/file entries from surviving when the installer narrows the event set.
|
|
128
|
+
for (const key of Object.keys(json.hooks)) {
|
|
129
|
+
const list = Array.isArray(json.hooks[key]) ? json.hooks[key] : [];
|
|
130
|
+
const kept = list.filter((x) => !isManaged(x));
|
|
131
|
+
if (kept.length)
|
|
132
|
+
json.hooks[key] = kept;
|
|
133
|
+
else
|
|
134
|
+
delete json.hooks[key];
|
|
135
|
+
}
|
|
126
136
|
for (const e of events) {
|
|
127
137
|
const { hookKey, flag, failClosedDefault, timeoutSec } = EVENT_MAP[e];
|
|
128
|
-
const failClosed = args.failClosed !== undefined ? args.failClosed === 'true' : failClosedDefault;
|
|
138
|
+
const failClosed = e === 'prompt' ? false : (args.failClosed !== undefined ? args.failClosed === 'true' : failClosedDefault);
|
|
129
139
|
const entry = {
|
|
130
|
-
command: buildHookCommand(flag, { shadow, failClosed }),
|
|
140
|
+
command: buildHookCommand(flag, { shadow: e === 'prompt' ? true : shadow, failClosed }),
|
|
131
141
|
timeout: timeoutSec,
|
|
132
142
|
};
|
|
133
143
|
if (failClosed)
|
|
134
144
|
entry.failClosed = true;
|
|
135
145
|
const list = Array.isArray(json.hooks[hookKey]) ? json.hooks[hookKey] : [];
|
|
136
|
-
|
|
137
|
-
const preserved = list.filter((x) => !isManaged(x));
|
|
138
|
-
json.hooks[hookKey] = [...preserved, entry];
|
|
146
|
+
json.hooks[hookKey] = [...list, entry];
|
|
139
147
|
}
|
|
140
148
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
141
149
|
fs.writeFileSync(file, JSON.stringify(json, null, 2) + '\n', 'utf8');
|
package/dist/version.json
CHANGED