cc-workspace 4.0.0 → 4.0.2

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.
Files changed (2) hide show
  1. package/bin/cli.js +26 -11
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -203,8 +203,23 @@ function installGlobals(force) {
203
203
  }
204
204
 
205
205
  // ─── Generate settings.json with hooks ──────────────────────
206
+ // Claude Code hook format: { matcher: { tools: [...] }, hooks: [{ type: "command", command: "...", timeout: N }] }
207
+ // For hooks without tool matcher: { hooks: [{ type: "command", command: "...", timeout: N }] }
206
208
  function generateSettings(orchDir) {
207
209
  const hp = ".claude/hooks";
210
+
211
+ function hook(command, timeout) {
212
+ return { type: "command", command: `bash ${hp}/${command}`, timeout };
213
+ }
214
+
215
+ function withMatcher(matcher, command, timeout) {
216
+ return { matcher, hooks: [hook(command, timeout)] };
217
+ }
218
+
219
+ function withoutMatcher(command, timeout) {
220
+ return { hooks: [hook(command, timeout)] };
221
+ }
222
+
208
223
  const settings = {
209
224
  env: {
210
225
  CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1",
@@ -212,35 +227,35 @@ function generateSettings(orchDir) {
212
227
  },
213
228
  hooks: {
214
229
  PreToolUse: [
215
- { matcher: "Write|Edit|MultiEdit", command: `bash ${hp}/block-orchestrator-writes.sh`, timeout: 5 },
216
- { matcher: "Teammate", command: `bash ${hp}/validate-spawn-prompt.sh`, timeout: 5 }
230
+ withMatcher("Write|Edit|MultiEdit", "block-orchestrator-writes.sh", 5),
231
+ withMatcher("Teammate", "validate-spawn-prompt.sh", 5)
217
232
  ],
218
233
  SessionStart: [
219
- { command: `bash ${hp}/session-start-context.sh`, timeout: 10 }
234
+ withoutMatcher("session-start-context.sh", 10)
220
235
  ],
221
236
  UserPromptSubmit: [
222
- { command: `bash ${hp}/user-prompt-guard.sh`, timeout: 3 }
237
+ withoutMatcher("user-prompt-guard.sh", 3)
223
238
  ],
224
239
  SubagentStart: [
225
- { command: `bash ${hp}/subagent-start-context.sh`, timeout: 5 }
240
+ withoutMatcher("subagent-start-context.sh", 5)
226
241
  ],
227
242
  PermissionRequest: [
228
- { command: `bash ${hp}/permission-auto-approve.sh`, timeout: 3 }
243
+ withoutMatcher("permission-auto-approve.sh", 3)
229
244
  ],
230
245
  PostToolUse: [
231
- { matcher: "Write|Edit|MultiEdit", command: `bash ${hp}/track-file-modifications.sh`, timeout: 3 }
246
+ withMatcher("Write|Edit|MultiEdit", "track-file-modifications.sh", 3)
232
247
  ],
233
248
  TeammateIdle: [
234
- { command: `bash ${hp}/teammate-idle-check.sh`, timeout: 5 }
249
+ withoutMatcher("teammate-idle-check.sh", 5)
235
250
  ],
236
251
  TaskCompleted: [
237
- { command: `bash ${hp}/task-completed-check.sh`, timeout: 3 }
252
+ withoutMatcher("task-completed-check.sh", 3)
238
253
  ],
239
254
  WorktreeCreate: [
240
- { command: `bash ${hp}/worktree-create-context.sh`, timeout: 3 }
255
+ withoutMatcher("worktree-create-context.sh", 3)
241
256
  ],
242
257
  Notification: [
243
- { command: `bash ${hp}/notify-user.sh`, timeout: 5 }
258
+ withoutMatcher("notify-user.sh", 5)
244
259
  ]
245
260
  }
246
261
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-workspace",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Claude Code multi-workspace orchestrator — skills, hooks, agents, and templates for multi-service projects",
5
5
  "bin": {
6
6
  "cc-workspace": "./bin/cli.js"