@wipcomputer/wip-branch-guard 1.9.31 → 1.9.33

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/guard.mjs +10 -2
  2. package/package.json +1 -1
package/guard.mjs CHANGED
@@ -5,8 +5,16 @@
5
5
  // Agents must work on branches or worktrees. Never on main.
6
6
 
7
7
  import { execSync } from 'node:child_process';
8
- import { dirname } from 'node:path';
9
- import { statSync } from 'node:fs';
8
+ import { dirname, join } from 'node:path';
9
+ import { statSync, readFileSync } from 'node:fs';
10
+ import { fileURLToPath } from 'node:url';
11
+
12
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
15
+ console.log(pkg.version);
16
+ process.exit(0);
17
+ }
10
18
 
11
19
  // Tools that modify files or git state
12
20
  const WRITE_TOOLS = new Set(['Write', 'Edit', 'NotebookEdit']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-branch-guard",
3
- "version": "1.9.31",
3
+ "version": "1.9.33",
4
4
  "description": "PreToolUse hook that blocks all writes on main branch. Forces agents to work on branches or worktrees.",
5
5
  "type": "module",
6
6
  "main": "guard.mjs",