@wipcomputer/wip-ai-devops-toolbox 1.9.60 → 1.9.61

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/CHANGELOG.md CHANGED
@@ -31,6 +31,29 @@
31
31
 
32
32
 
33
33
 
34
+
35
+ ## 1.9.61 (2026-03-29)
36
+
37
+ # Release Notes: wip-ai-devops-toolbox v1.9.61
38
+
39
+ **Add test script for branch guard. Fix node bypass regex.**
40
+
41
+ ## The story
42
+
43
+ Every guard bug this session (v1.9.56-59) would have been caught by running a test before merging. This release adds test.sh to the guard that pipes test JSON into guard.mjs and verifies allow/deny results. 30 test cases covering destructive commands, quoted strings (Bug 1/3), compound commands (Bug 2), safe commands, and plan files.
44
+
45
+ Also fixes the node bypass regex: `require('fs').writeFileSync` wasn't caught because the regex looked for `fs.writeFile` literally. Broadened to match `writeFile` after `node -e`.
46
+
47
+ ## Issues closed
48
+
49
+ - #232 (guard test coverage)
50
+
51
+ ## How to verify
52
+
53
+ ```bash
54
+ cd tools/wip-branch-guard && bash test.sh
55
+ # Should show: 30 passed, 0 failed, 3 skipped
56
+ ```
34
57
 
35
58
  ## 1.9.60 (2026-03-29)
36
59
 
package/SKILL.md CHANGED
@@ -5,7 +5,7 @@ license: MIT
5
5
  interface: [cli, module, mcp, skill, hook, plugin]
6
6
  metadata:
7
7
  display-name: "WIP AI DevOps Toolbox"
8
- version: "1.9.60"
8
+ version: "1.9.61"
9
9
  homepage: "https://github.com/wipcomputer/wip-ai-devops-toolbox"
10
10
  author: "Parker Todd Brooks"
11
11
  category: dev-tools
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-ai-devops-toolbox",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "type": "module",
5
5
  "description": "The complete AI DevOps toolkit for AI-assisted development teams.",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/deploy-public",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "description": "Private-to-public repo sync. Excludes ai/ folder, creates PR, merges, cleans up branches.",
5
5
  "bin": {
6
6
  "deploy-public": "./deploy-public.sh"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/post-merge-rename",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "description": "Post-merge branch renaming. Appends --merged-YYYY-MM-DD to preserve history.",
5
5
  "bin": {
6
6
  "post-merge-rename": "./post-merge-rename.sh"
@@ -50,7 +50,7 @@ const DESTRUCTIVE_PATTERNS = [
50
50
  // the attack IS inside quotes (e.g. python -c "open('f').write('x')").
51
51
  const DESTRUCTIVE_CODE_PATTERNS = [
52
52
  /\bpython3?\s+-c\s+.*\bopen\s*\(/, // python -c "open().write()" bypass (#241)
53
- /\bnode\s+-e\s+.*\bfs\.\w*[Ww]rite/, // node -e "fs.writeFile()" bypass
53
+ /\bnode\s+-e\s+.*\bwriteFile/, // node -e "require('fs').writeFile()" or "fs.writeFile()" bypass
54
54
  ];
55
55
 
56
56
  // Strip quoted string contents to prevent regex matching inside data.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-branch-guard",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
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",
@@ -0,0 +1,117 @@
1
+ #!/bin/bash
2
+ # Guard test runner. Run from the guard directory before merging.
3
+ # Usage: bash test.sh
4
+ #
5
+ # Pipes test JSON into guard.mjs and checks if it allows or blocks.
6
+ # Exit 0 = all tests pass. Exit 1 = at least one failed.
7
+ #
8
+ # Note: compound command tests (Bug 2) and on-main tests need CWD
9
+ # to be in a repo on main. The script auto-detects and skips those
10
+ # tests if running from a branch/worktree.
11
+
12
+ GUARD="$(dirname "$0")/guard.mjs"
13
+ PASS=0
14
+ FAIL=0
15
+ SKIP=0
16
+
17
+ # Check if we're on main (for tests that need main-branch context)
18
+ ON_MAIN=false
19
+ BRANCH=$(git branch --show-current 2>/dev/null)
20
+ if [[ "$BRANCH" == "main" || "$BRANCH" == "master" ]]; then
21
+ ON_MAIN=true
22
+ fi
23
+
24
+ # Helper: build properly escaped JSON using node (avoids bash quote hell)
25
+ make_json() {
26
+ local tool="$1" key="$2" value="$3"
27
+ node -e "process.stdout.write(JSON.stringify({tool_name:'$tool',tool_input:{$key:process.argv[1]}}))" "$value"
28
+ }
29
+
30
+ # Helper: run a test case
31
+ # Args: description, expected (allow|deny), tool_name, command_or_filepath, [main_only]
32
+ test_case() {
33
+ local desc="$1" expected="$2" tool="$3" input="$4" main_only="${5:-false}"
34
+
35
+ if [[ "$main_only" == "true" && "$ON_MAIN" == "false" ]]; then
36
+ echo " SKIP: $desc (needs main branch)"
37
+ ((SKIP++))
38
+ return
39
+ fi
40
+
41
+ local json
42
+ if [[ "$tool" == "Bash" ]]; then
43
+ json=$(make_json Bash command "$input")
44
+ elif [[ "$tool" == "Write" || "$tool" == "Edit" ]]; then
45
+ json=$(make_json "$tool" file_path "$input")
46
+ fi
47
+
48
+ local output
49
+ output=$(echo "$json" | node "$GUARD" 2>/dev/null)
50
+
51
+ local actual="allow"
52
+ if echo "$output" | grep -q '"deny"' 2>/dev/null; then
53
+ actual="deny"
54
+ fi
55
+
56
+ if [[ "$actual" == "$expected" ]]; then
57
+ echo " PASS: $desc"
58
+ ((PASS++))
59
+ else
60
+ echo " FAIL: $desc (expected $expected, got $actual)"
61
+ ((FAIL++))
62
+ fi
63
+ }
64
+
65
+ echo "=== Branch Guard Tests ==="
66
+ echo ""
67
+ echo "--- Destructive commands (should DENY on any branch) ---"
68
+ test_case "git clean -fd" deny Bash "git clean -fd"
69
+ test_case "git checkout -- file.txt" deny Bash "git checkout -- file.txt"
70
+ test_case "git checkout ." deny Bash "git checkout ."
71
+ test_case "git stash drop" deny Bash "git stash drop"
72
+ test_case "git stash pop" deny Bash "git stash pop"
73
+ test_case "git stash clear" deny Bash "git stash clear"
74
+ test_case "git reset --hard" deny Bash "git reset --hard"
75
+ test_case "git restore file.txt" deny Bash "git restore file.txt"
76
+ test_case "python file write bypass" deny Bash "python3 -c \"open('f','w').write('x')\""
77
+ test_case "node file write bypass" deny Bash "node -e \"require('fs').writeFileSync('f','d')\""
78
+
79
+ echo ""
80
+ echo "--- Quoted strings: should NOT match inside quotes (Bug 1, 3) ---"
81
+ test_case "gh issue with git checkout in body" allow Bash "gh issue create --body 'use git checkout -- to fix'"
82
+ test_case "echo with git commit in quotes" allow Bash "echo 'dont run git commit on main'"
83
+ test_case "gh issue with git reset in body" allow Bash "gh issue create --body 'tried git reset --hard'"
84
+
85
+ echo ""
86
+ echo "--- Compound commands: each segment checked independently (Bug 2) ---"
87
+ echo " (These only run when CWD is on main branch)"
88
+ test_case "rm with echo should still block" deny Bash "rm -f file ; echo done" true
89
+ test_case "safe compound (ls && echo)" allow Bash "ls -la && echo done" true
90
+ test_case "cd then rm should block" deny Bash "cd /tmp && rm -rf somedir" true
91
+
92
+ echo ""
93
+ echo "--- Safe commands (should ALLOW) ---"
94
+ test_case "git status" allow Bash "git status"
95
+ test_case "git log" allow Bash "git log --oneline -5"
96
+ test_case "git diff" allow Bash "git diff"
97
+ test_case "git checkout branch" allow Bash "git checkout feature-branch"
98
+ test_case "git worktree add" allow Bash "git worktree add .worktrees/repo--branch -b feat"
99
+ test_case "git stash list" allow Bash "git stash list"
100
+ test_case "git stash show" allow Bash "git stash show"
101
+ test_case "git restore --staged" allow Bash "git restore --staged file.txt"
102
+ test_case "ls command" allow Bash "ls -la"
103
+ test_case "grep command" allow Bash "grep -r pattern ."
104
+ test_case "gh pr create" allow Bash "gh pr create --title test"
105
+ test_case "gh pr merge" allow Bash "gh pr merge 123 --merge"
106
+ test_case "echo" allow Bash "echo hello"
107
+ test_case "wip-release dry-run" allow Bash "wip-release patch --dry-run"
108
+ test_case "ldm install" allow Bash "ldm install"
109
+ test_case "mkdir .worktrees" allow Bash "mkdir -p .worktrees/repo--branch"
110
+
111
+ echo ""
112
+ echo "--- Plan files (should ALLOW Write/Edit) ---"
113
+ test_case "Edit plan file" allow Edit "/Users/lesa/.claude/plans/my-plan.md"
114
+
115
+ echo ""
116
+ echo "=== Results: $PASS passed, $FAIL failed, $SKIP skipped ==="
117
+ [[ $FAIL -eq 0 ]] && exit 0 || exit 1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-file-guard",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "type": "module",
5
5
  "description": "Hook that blocks destructive edits to protected identity files. For Claude Code CLI and OpenClaw.",
6
6
  "main": "guard.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-license-guard",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "description": "License compliance for your own repos. Ensures correct copyright, dual-license blocks, and LICENSE files.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-license-hook",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "description": "License rug-pull detection and dependency license compliance for open source projects",
5
5
  "type": "module",
6
6
  "main": "dist/cli/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-readme-format",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "description": "Reformat any repo's README to follow the WIP Computer standard. Agent-first, human-readable.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1235,6 +1235,44 @@ export async function release({ repoPath, level, notes, notesSource, dryRun, noP
1235
1235
  }
1236
1236
  }
1237
1237
 
1238
+ // 0.95. Run test scripts (if any exist)
1239
+ {
1240
+ const toolsDir = join(repoPath, 'tools');
1241
+ const testFiles = [];
1242
+ if (existsSync(toolsDir)) {
1243
+ for (const sub of readdirSync(toolsDir)) {
1244
+ const testPath = join(toolsDir, sub, 'test.sh');
1245
+ if (existsSync(testPath)) testFiles.push({ tool: sub, path: testPath });
1246
+ }
1247
+ }
1248
+ // Also check repo root test.sh
1249
+ const rootTest = join(repoPath, 'test.sh');
1250
+ if (existsSync(rootTest)) testFiles.push({ tool: '(root)', path: rootTest });
1251
+
1252
+ if (testFiles.length > 0) {
1253
+ let allPassed = true;
1254
+ for (const { tool, path } of testFiles) {
1255
+ try {
1256
+ execFileSync('bash', [path], { cwd: dirname(path), stdio: 'pipe', timeout: 30000 });
1257
+ console.log(` ✓ Tests passed: ${tool}`);
1258
+ } catch (e) {
1259
+ allPassed = false;
1260
+ console.log(` ✗ Tests FAILED: ${tool}`);
1261
+ const output = (e.stdout || '').toString().trim();
1262
+ if (output) {
1263
+ for (const line of output.split('\n').slice(-5)) console.log(` ${line}`);
1264
+ }
1265
+ }
1266
+ }
1267
+ if (!allPassed) {
1268
+ console.log('');
1269
+ console.log(' Fix failing tests before releasing.');
1270
+ console.log('');
1271
+ return { currentVersion, newVersion, dryRun: false, failed: true };
1272
+ }
1273
+ }
1274
+ }
1275
+
1238
1276
  if (dryRun) {
1239
1277
  // Product docs check (dry-run)
1240
1278
  if (!skipProductCheck) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-release",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "type": "module",
5
5
  "description": "One-command release pipeline. Bumps version, updates changelog + SKILL.md, publishes to npm + GitHub.",
6
6
  "main": "core.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-repo-init",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "description": "Scaffold the standard ai/ directory structure in any repo",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-repo-permissions-hook",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "type": "module",
5
5
  "description": "Repo visibility guard. Blocks repos from going public without a -private counterpart.",
6
6
  "main": "core.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-repos",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "type": "module",
5
5
  "description": "Repo manifest reconciler. Single source of truth for repo organization. Like prettier for folder structure.",
6
6
  "main": "core.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/universal-installer",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "type": "module",
5
5
  "description": "The Universal Interface specification for agent-native software. Teaches your AI how to build repos with every interface: CLI, Module, MCP Server, OpenClaw Plugin, Skill, Claude Code Hook.",
6
6
  "main": "detect.mjs",