Repository navigation
Commit 770c563
fix(events): leave JSON hook configs untouched when nothing is owned (#5017)
`specify extension add`, `remove`, `enable`, `disable` and `update`,
`specify init` with extensions, and integration setup all refresh
runtime events. With no events configured, the refresh takes
install_integration_events()'s empty-map branch into
_remove_native_event_hooks(), and its JSON removal helpers rewrote the
agent's native config even when it held no Specify-owned entries.
In a plain Claude project (likewise Gemini, Qwen, Tabnine, Cursor,
Copilot, Devin and opencode), adding an extension that declares no
events re-indented the user's .claude/settings.json or opencode.json,
dropped empty values such as "hooks": {"Notification": []} or
"plugin": [], and deleted a config whose whole content was {}.
#4563 fixed the same defect for Codex's TOML in _remove_toml_entries().
Give the JSON helpers the matching guard: _remove_json_entries(),
_remove_copilot_entries() and _remove_json_root_entries() return early
when no Specify-marked entry is present, and _remove_opencode_entries()
returns early when opencode.json does not reference the Spec Kit plugin.
Files that do hold owned entries are still stripped, rewritten or
deleted as before.
Assisted-by: Claude Code (model: Claude Opus 5.5, autonomous)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 244e752 commit 770c563
2 files changed
Lines changed: 122 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
2153 | 2155 | | |
2154 | 2156 | | |
2155 | 2157 | | |
2156 | | - | |
2157 | | - | |
2158 | | - | |
2159 | | - | |
2160 | | - | |
2161 | | - | |
2162 | | - | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
2163 | 2167 | | |
2164 | 2168 | | |
2165 | 2169 | | |
| |||
2376 | 2380 | | |
2377 | 2381 | | |
2378 | 2382 | | |
2379 | | - | |
2380 | | - | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
2381 | 2386 | | |
2382 | 2387 | | |
2383 | 2388 | | |
| |||
2505 | 2510 | | |
2506 | 2511 | | |
2507 | 2512 | | |
2508 | | - | |
| 2513 | + | |
| 2514 | + | |
2509 | 2515 | | |
2510 | 2516 | | |
2511 | 2517 | | |
| |||
2627 | 2633 | | |
2628 | 2634 | | |
2629 | 2635 | | |
2630 | | - | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
2631 | 2640 | | |
2632 | 2641 | | |
2633 | 2642 | | |
| |||
2671 | 2680 | | |
2672 | 2681 | | |
2673 | 2682 | | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
2674 | 2693 | | |
2675 | 2694 | | |
2676 | 2695 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1171 | 1171 | | |
1172 | 1172 | | |
1173 | 1173 | | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
1174 | 1266 | | |
1175 | 1267 | | |
1176 | 1268 | | |
| |||
0 commit comments