claude-warden 2.3.1 → 2.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.
@@ -8,7 +8,7 @@
8
8
  {
9
9
  "name": "warden",
10
10
  "description": "Auto-approves safe commands, blocks dangerous ones, prompts for the rest",
11
- "version": "1.0.1",
11
+ "version": "2.4.0",
12
12
  "author": {
13
13
  "name": "banyudu"
14
14
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warden",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "Smart command safety filter for Claude Code — parses shell pipelines and evaluates per-command safety rules to auto-approve safe commands and block dangerous ones",
5
5
  "author": {
6
6
  "name": "banyudu"
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "preToolUse": [
5
+ {
6
+ "type": "command",
7
+ "bash": "node node_modules/claude-warden/dist/copilot.cjs",
8
+ "timeoutSec": 5
9
+ }
10
+ ]
11
+ }
12
+ }
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![GitHub stars](https://img.shields.io/github/stars/banyudu/claude-warden)](https://github.com/banyudu/claude-warden/stargazers)
7
7
  [![CI](https://img.shields.io/github/actions/workflow/status/banyudu/claude-warden/ci.yml?label=CI)](https://github.com/banyudu/claude-warden/actions)
8
8
 
9
- Smart command safety filter for [Claude Code](https://claude.ai/code). Parses shell commands, evaluates each against configurable safety rules, and returns allow/deny/ask decisions — eliminating unnecessary permission prompts while blocking dangerous commands.
9
+ Smart command safety filter for [Claude Code](https://claude.ai/code), [GitHub Copilot CLI](https://docs.github.com/en/copilot/how-tos/customize-copilot-cli/use-hooks), and other AI coding agents. Parses shell commands, evaluates each against configurable safety rules, and returns allow/deny/ask decisions — eliminating unnecessary permission prompts while blocking dangerous commands.
10
10
 
11
11
  ## The problem
12
12
 
@@ -75,6 +75,20 @@ Two commands inside Claude Code:
75
75
 
76
76
  That's it. Restart Claude Code and Warden is active.
77
77
 
78
+ ### Update
79
+
80
+ ```
81
+ claude plugin update warden@claude-warden
82
+ ```
83
+
84
+ If the update command reports you're already at the latest version but you know a newer version exists, the local marketplace cache may be stale. Force a refresh:
85
+
86
+ ```bash
87
+ cd ~/.claude/plugins/marketplaces/claude-warden && git pull
88
+ ```
89
+
90
+ Then run the update command again.
91
+
78
92
  ### Alternative: install from npm
79
93
 
80
94
  ```bash
@@ -111,6 +125,49 @@ Example:
111
125
  node dist/codex-export.cjs --cwd . --out .codex/rules/warden.rules
112
126
  ```
113
127
 
128
+ ## GitHub Copilot CLI
129
+
130
+ Warden supports GitHub Copilot CLI's [preToolUse hook](https://docs.github.com/en/copilot/reference/hooks-configuration) natively.
131
+
132
+ ### Setup
133
+
134
+ 1. Install Warden in your project:
135
+
136
+ ```bash
137
+ npm install claude-warden
138
+ ```
139
+
140
+ 2. Copy the hook config to your repo:
141
+
142
+ ```bash
143
+ cp node_modules/claude-warden/.github/hooks/warden.json .github/hooks/warden.json
144
+ ```
145
+
146
+ 3. Commit `.github/hooks/warden.json` to your default branch. Copilot CLI loads hooks from your current working directory automatically.
147
+
148
+ That's it. Copilot CLI will now evaluate bash commands through Warden's rule engine before execution.
149
+
150
+ ### How it works
151
+
152
+ Copilot CLI sends a `preToolUse` event with `{"toolName": "bash", "toolArgs": "{\"command\": \"...\"}"}` on stdin. Warden's Copilot adapter (`dist/copilot.cjs`) parses this, runs the command through the same AST-based evaluation pipeline used for Claude Code, and returns `{"permissionDecision": "allow|deny|ask", "permissionDecisionReason": "..."}` on stdout.
153
+
154
+ The same `~/.claude/warden.yaml` and `.claude/warden.yaml` config files are used for both Claude Code and Copilot CLI.
155
+
156
+ ## Generic CLI
157
+
158
+ Warden also provides a standalone CLI for use with any tool or shell script:
159
+
160
+ ```bash
161
+ npx claude-warden eval "ls -la" # → allow
162
+ npx claude-warden eval "shutdown -h now" # → deny (exit code 2)
163
+ npx claude-warden eval --json "git push --force" # → JSON output
164
+ npx claude-warden eval --cwd /path/to/project "rm -rf dist"
165
+ ```
166
+
167
+ Exit codes: `0` = allow, `1` = ask, `2` = deny.
168
+
169
+ Use `--json` for machine-readable output suitable for scripting.
170
+
114
171
  ## Configure
115
172
 
116
173
  Warden works out of the box with sensible defaults. To customize, create a config file: