shiva-code 0.2.0 → 0.2.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/dist/index.js +25 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1138,7 +1138,15 @@ function saveClaudeSettings(settings) {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
function hasShivaHook(hooks, event) {
|
|
1140
1140
|
if (!hooks || !hooks[event]) return false;
|
|
1141
|
-
|
|
1141
|
+
const eventHooks = hooks[event];
|
|
1142
|
+
return eventHooks.some(
|
|
1143
|
+
(entry) => entry.hooks?.some((h) => h.command?.includes("shiva"))
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
function removeShivaHooks(eventHooks) {
|
|
1147
|
+
return eventHooks.filter(
|
|
1148
|
+
(entry) => !entry.hooks?.some((h) => h.command?.includes("shiva"))
|
|
1149
|
+
);
|
|
1142
1150
|
}
|
|
1143
1151
|
var hookCommand = new Command9("hook").description("Claude Code Hook Integration verwalten");
|
|
1144
1152
|
hookCommand.command("install").description("SHIVA Hooks in Claude Code installieren").action(() => {
|
|
@@ -1169,15 +1177,25 @@ hookCommand.command("install").description("SHIVA Hooks in Claude Code installie
|
|
|
1169
1177
|
settings.hooks.SessionStart = [];
|
|
1170
1178
|
}
|
|
1171
1179
|
settings.hooks.SessionStart.push({
|
|
1172
|
-
|
|
1173
|
-
|
|
1180
|
+
matcher: {},
|
|
1181
|
+
hooks: [
|
|
1182
|
+
{
|
|
1183
|
+
type: "command",
|
|
1184
|
+
command: "shiva sync --pull --quiet"
|
|
1185
|
+
}
|
|
1186
|
+
]
|
|
1174
1187
|
});
|
|
1175
1188
|
if (!settings.hooks.Stop) {
|
|
1176
1189
|
settings.hooks.Stop = [];
|
|
1177
1190
|
}
|
|
1178
1191
|
settings.hooks.Stop.push({
|
|
1179
|
-
|
|
1180
|
-
|
|
1192
|
+
matcher: {},
|
|
1193
|
+
hooks: [
|
|
1194
|
+
{
|
|
1195
|
+
type: "command",
|
|
1196
|
+
command: "shiva sync --push --quiet"
|
|
1197
|
+
}
|
|
1198
|
+
]
|
|
1181
1199
|
});
|
|
1182
1200
|
saveClaudeSettings(settings);
|
|
1183
1201
|
log.success("SHIVA Hooks installiert!");
|
|
@@ -1201,17 +1219,13 @@ hookCommand.command("uninstall").description("SHIVA Hooks aus Claude Code entfer
|
|
|
1201
1219
|
let removed = false;
|
|
1202
1220
|
if (settings.hooks.SessionStart) {
|
|
1203
1221
|
const before = settings.hooks.SessionStart.length;
|
|
1204
|
-
settings.hooks.SessionStart = settings.hooks.SessionStart
|
|
1205
|
-
(h) => !h.command.includes("shiva")
|
|
1206
|
-
);
|
|
1222
|
+
settings.hooks.SessionStart = removeShivaHooks(settings.hooks.SessionStart);
|
|
1207
1223
|
if (settings.hooks.SessionStart.length < before) removed = true;
|
|
1208
1224
|
if (settings.hooks.SessionStart.length === 0) delete settings.hooks.SessionStart;
|
|
1209
1225
|
}
|
|
1210
1226
|
if (settings.hooks.Stop) {
|
|
1211
1227
|
const before = settings.hooks.Stop.length;
|
|
1212
|
-
settings.hooks.Stop = settings.hooks.Stop
|
|
1213
|
-
(h) => !h.command.includes("shiva")
|
|
1214
|
-
);
|
|
1228
|
+
settings.hooks.Stop = removeShivaHooks(settings.hooks.Stop);
|
|
1215
1229
|
if (settings.hooks.Stop.length < before) removed = true;
|
|
1216
1230
|
if (settings.hooks.Stop.length === 0) delete settings.hooks.Stop;
|
|
1217
1231
|
}
|