@brainervirus/workit-claude-code 8.2.0 → 8.4.0

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "workit",
3
3
  "displayName": "Workit",
4
- "version": "8.2.0",
4
+ "version": "8.4.0",
5
5
  "description": "Workflow rails for agentic coding: task context on every session, branch policy on shell commands, and the workit method skills",
6
6
  "author": {
7
7
  "name": "BrainerVirus"
@@ -32,14 +32,16 @@ const failOpen = (reason) => {
32
32
  };
33
33
 
34
34
  // Every Bash/PowerShell call and every file edit reaches this hook (branch
35
- // policy and the before-write gate). Two fast paths answer `{}` before the
36
- // runtime loads: a shell command with no git, no redirect and no writing verb
37
- // can need neither; and with no Workit task store for the checkout there is
38
- // no task to gate a non-git edit on.
35
+ // policy, raw git/forge steering and the before-write gate). Fast paths
36
+ // answer `{}` before the runtime loads: a shell command with no git/gh/glab,
37
+ // no redirect and no writing verb can need none of them; with no Workit task
38
+ // store for the checkout there is no task to gate a non-git edit on; and a
39
+ // PostToolUse only matters after a `git commit`.
39
40
  let payload = "";
40
41
  for await (const chunk of process.stdin) payload += String(chunk);
42
+ const RAW_TOOLS = /\b(?:git|gh|glab)\b/;
41
43
  const MAYBE_GATED =
42
- /\bgit\b|>|\b(?:tee|touch|mkdir|rm|rmdir|mv|cp|truncate|install|ln|patch|dd|sed|perl|set-content|add-content|out-file|new-item|ni|remove-item|del|copy-item|move-item)\b/i;
44
+ /\b(?:git|gh|glab)\b|>|\b(?:tee|touch|mkdir|rm|rmdir|mv|cp|truncate|install|ln|patch|dd|sed|perl|set-content|add-content|out-file|new-item|ni|remove-item|del|copy-item|move-item)\b/i;
43
45
  const SHELLS = new Set(["Bash", "PowerShell"]);
44
46
  const EDITS = new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
45
47
 
@@ -74,11 +76,13 @@ const hasTaskStore = (cwd) => {
74
76
  const fastAllow = (() => {
75
77
  try {
76
78
  const value = JSON.parse(payload);
77
- if (value?.hook_event_name !== "PreToolUse") return false;
78
79
  const command = value?.tool_input?.command;
80
+ if (value?.hook_event_name === "PostToolUse")
81
+ return typeof command === "string" && !/\bcommit\b/.test(command);
82
+ if (value?.hook_event_name !== "PreToolUse") return false;
79
83
  if (SHELLS.has(value.tool_name) && typeof command === "string") {
80
84
  if (!MAYBE_GATED.test(command)) return true;
81
- return !/\bgit\b/.test(command) && !hasTaskStore(String(value.cwd ?? "."));
85
+ return !RAW_TOOLS.test(command) && !hasTaskStore(String(value.cwd ?? "."));
82
86
  }
83
87
  return EDITS.has(value.tool_name) && !hasTaskStore(String(value.cwd ?? "."));
84
88
  } catch {