cc-permissions 0.1.2 → 0.1.11

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 (65) hide show
  1. package/README.md +126 -153
  2. package/dist/analyze.d.ts.map +1 -1
  3. package/dist/analyze.js +304 -28
  4. package/dist/analyze.js.map +1 -1
  5. package/dist/cli.js +120 -14
  6. package/dist/cli.js.map +1 -1
  7. package/dist/permissions.d.ts +9 -0
  8. package/dist/permissions.d.ts.map +1 -1
  9. package/dist/permissions.js +17 -1
  10. package/dist/permissions.js.map +1 -1
  11. package/dist/templates/loader.d.ts.map +1 -1
  12. package/dist/templates/loader.js +41 -1
  13. package/dist/templates/loader.js.map +1 -1
  14. package/dist/types.d.ts +12 -0
  15. package/dist/types.d.ts.map +1 -1
  16. package/package.json +3 -2
  17. package/templates/android.jsonc +1 -1
  18. package/templates/aws.jsonc +1 -1
  19. package/templates/azure.jsonc +3 -3
  20. package/templates/database.jsonc +5 -1
  21. package/templates/docker.jsonc +1 -1
  22. package/templates/dotnet.jsonc +3 -2
  23. package/templates/flutter.jsonc +1 -1
  24. package/templates/gcp.jsonc +1 -1
  25. package/templates/git.jsonc +3 -2
  26. package/templates/gitea.jsonc +206 -0
  27. package/templates/github.jsonc +4 -3
  28. package/templates/gitlab.jsonc +182 -0
  29. package/templates/go.jsonc +1 -1
  30. package/templates/ios.jsonc +1 -1
  31. package/templates/java.jsonc +1 -1
  32. package/templates/kubernetes.jsonc +2 -3
  33. package/templates/nodejs.jsonc +1 -1
  34. package/templates/php.jsonc +1 -1
  35. package/templates/playwright.jsonc +61 -0
  36. package/templates/python.jsonc +1 -1
  37. package/templates/ruby.jsonc +1 -1
  38. package/templates/rust.jsonc +1 -1
  39. package/templates/shell.jsonc +2 -4
  40. package/templates/template.schema.json +20 -0
  41. package/templates/terraform.jsonc +1 -1
  42. package/dist/templates/cache.d.ts +0 -71
  43. package/dist/templates/cache.d.ts.map +0 -1
  44. package/dist/templates/cache.js +0 -137
  45. package/dist/templates/cache.js.map +0 -1
  46. package/dist/templates/dotnet.d.ts +0 -3
  47. package/dist/templates/dotnet.d.ts.map +0 -1
  48. package/dist/templates/dotnet.js +0 -76
  49. package/dist/templates/dotnet.js.map +0 -1
  50. package/dist/templates/general.d.ts +0 -3
  51. package/dist/templates/general.d.ts.map +0 -1
  52. package/dist/templates/general.js +0 -59
  53. package/dist/templates/general.js.map +0 -1
  54. package/dist/templates/python.d.ts +0 -3
  55. package/dist/templates/python.d.ts.map +0 -1
  56. package/dist/templates/python.js +0 -110
  57. package/dist/templates/python.js.map +0 -1
  58. package/dist/templates/remote.d.ts +0 -45
  59. package/dist/templates/remote.d.ts.map +0 -1
  60. package/dist/templates/remote.js +0 -147
  61. package/dist/templates/remote.js.map +0 -1
  62. package/dist/templates/web.d.ts +0 -3
  63. package/dist/templates/web.d.ts.map +0 -1
  64. package/dist/templates/web.js +0 -101
  65. package/dist/templates/web.js.map +0 -1
package/README.md CHANGED
@@ -2,228 +2,201 @@
2
2
 
3
3
  **Thoughtful permission configs for Claude Code without the container overhead.**
4
4
 
5
- ## The Problem
5
+ Claude Code users face a frustrating choice: run in a Docker sandbox with `--dangerously-skip-permissions` for convenience, or run natively and deal with constant permission prompts.
6
6
 
7
- Claude Code users face a frustrating choice:
7
+ This tool offers a middle ground. Generate permission configurations tailored to your workflow, reducing prompt fatigue while maintaining control over what Claude Code can do.
8
8
 
9
- - **Docker sandbox + `--dangerously-skip-permissions`**: Safe and convenient, but requires container setup and deals with overhead
10
- - **Native execution**: No containers, but constant permission prompts interrupt your workflow
9
+ > ⚠️ **Warning:** This approach is inherently less safe than a fully isolated environment. You're trading sandbox protection for convenience. ⚠️
11
10
 
12
- Neither option is ideal for users who want native performance with intentional control.
11
+ ## Getting started
13
12
 
14
- ## Our Solution
13
+ The fastest way to get going:
15
14
 
16
- A middle ground: generate thoughtful permission configurations that reduce prompt fatigue while maintaining deliberate control over what Claude Code can do.
15
+ ```bash
16
+ npx cc-permissions apply
17
+ ```
17
18
 
18
- **Important**: This approach is inherently less safe than a fully isolated environment—there's no sandbox. Users accept this tradeoff in exchange for avoiding container overhead while having more control than `--dangerously-skip-permissions` alone.
19
+ This analyzes your project, detects relevant templates, and applies permissions to `.claude/settings.json`.
19
20
 
20
- ## Installation
21
+ Want to see what would be applied first?
21
22
 
22
23
  ```bash
23
- # Run directly with npx (no install needed)
24
24
  npx cc-permissions
25
-
26
- # Or install globally
27
- npm install -g cc-permissions
28
25
  ```
29
26
 
30
- ### Claude Code Plugin
27
+ Or install globally to use without npx:
31
28
 
32
- Install as a Claude Code plugin for integrated commands:
33
-
34
- ```
35
- /plugin install DanielCarmingham/cc-permissions
29
+ ```bash
30
+ npm install -g cc-permissions
36
31
  ```
32
+ Then run: `cc-permissions apply`
37
33
 
38
- Then use:
39
- - `/cc-permissions:analyze` - Scan project and recommend templates
40
- - `/cc-permissions:template nodejs,python` - Generate from specific templates
41
- - `/cc-permissions:list` - List available templates
42
- - `/cc-permissions:apply` - Apply permissions to settings
34
+ Or use as slash command via a Claude Code plugin:
43
35
 
44
- ## Usage
36
+ ```bash
37
+ # Add the marketplace
38
+ claude plugin marketplace add DanielCarmingham/cc-permissions
45
39
 
46
- ### Quick Start
40
+ # Install the plugin
41
+ claude plugin install cc-permissions@DanielCarmingham-cc-permissions
47
42
 
48
- ```bash
49
- # Analyze your project and apply recommended permissions
50
- cc-permissions --apply
43
+ # Update to latest version
44
+ claude plugin update cc-permissions@DanielCarmingham-cc-permissions
51
45
 
52
- # Or be more specific
53
- cc-permissions --apply --level permissive
46
+ # Uninstall
47
+ claude plugin uninstall cc-permissions@DanielCarmingham-cc-permissions
54
48
  ```
55
49
 
56
- ### Generate Permissions from a Template
50
+ Then use `/cc-permissions:analyze`, `/cc-permissions:apply`, and other slash commands directly in Claude Code.
57
51
 
58
- ```bash
59
- # Generate standard web development permissions
60
- cc-permissions template nodejs --level standard
52
+ Note: Third-party plugins don't auto-update by default. Run `claude plugin update` from your terminal to get new versions, or enable auto-update via `/plugin` → Marketplaces → select marketplace → Enable auto-update.
61
53
 
62
- # Combine multiple templates
63
- cc-permissions template nodejs,python --level standard
54
+ ## How it works
64
55
 
65
- # Apply directly to .claude/settings.json (creates backup)
66
- cc-permissions template nodejs --apply
67
- ```
68
-
69
- ### Analyze Your Project
56
+ Permissions are organized into **templates** and **levels**.
70
57
 
71
- Scan your project and get template recommendations:
58
+ **Templates** group commands by technology. Use `nodejs` for npm/yarn/pnpm commands, `python` for pip and pytest, `docker` for container operations, and so on. Combine them freely:
72
59
 
73
60
  ```bash
74
- cc-permissions analyze
75
- cc-permissions analyze ./path/to/project
61
+ cc-permissions apply nodejs,python,docker
76
62
  ```
77
63
 
78
- ### List Available Templates
64
+ **Levels** control how permissive each template is:
79
65
 
80
- ```bash
81
- cc-permissions list
82
- ```
66
+ | Level | What it allows |
67
+ |-------|----------------|
68
+ | `restrictive` | Read-only operations (list, status, info) |
69
+ | `standard` | Development workflow (run, build, test) |
70
+ | `permissive` | Broader access (install, publish, remove) |
83
71
 
84
- ### Check Version
72
+ Levels are cumulative. `standard` includes everything from `restrictive`, and `permissive` includes everything from `standard`.
85
73
 
86
74
  ```bash
87
- cc-permissions -v # or --version
75
+ # Safe exploration mode
76
+ cc-permissions apply nodejs --level restrictive
77
+
78
+ # Normal development (default)
79
+ cc-permissions apply nodejs
80
+
81
+ # Trusted project, full access
82
+ cc-permissions apply nodejs --level permissive
88
83
  ```
89
84
 
90
- ## Permission Levels
85
+ ## Templates
91
86
 
92
- Levels are cumulative—each level includes everything from the previous level:
87
+ ### General
93
88
 
94
- | Level | Description | Use Case |
95
- |-------|-------------|----------|
96
- | `restrictive` | Read-only operations (git status, npm list, etc.) | Code review, exploration |
97
- | `standard` | Dev workflow (+ git commit/push, npm run/build/test) | Day-to-day development |
98
- | `permissive` | Few guardrails (+ npm install, most commands except banned) | Trusted projects, greenfield |
89
+ | Template | Description |
90
+ |----------|-------------|
91
+ | [shell](docs/templates/shell.md) | Basic shell and filesystem commands |
99
92
 
100
- ## Available Templates
93
+ ### Version Control
101
94
 
102
95
  | Template | Description |
103
96
  |----------|-------------|
104
- | `shell` | Git and common CLI tools (ls, cat, grep, find, etc.) |
105
- | `nodejs` | Node.js, npm, and common frontend tooling |
106
- | `python` | pip, python, venv, pytest, and common data tools |
107
- | `dotnet` | dotnet CLI, NuGet, MSBuild |
97
+ | [git](docs/templates/git.md) | Git version control |
98
+ | [gitea](docs/templates/gitea.md) | Gitea CLI (tea) and MCP server for repository and workflow management |
99
+ | [github](docs/templates/github.md) | GitHub CLI (gh) for repository and workflow management |
100
+ | [gitlab](docs/templates/gitlab.md) | GitLab CLI (glab) and MCP server for repository and workflow management |
108
101
 
109
- Combine templates with commas: `cc-permissions template shell,nodejs,python`
102
+ ### Languages & Runtimes
110
103
 
111
- Run `cc-permissions list` to see all available templates.
104
+ | Template | Description |
105
+ |----------|-------------|
106
+ | [dotnet](docs/templates/dotnet.md) | dotnet CLI, NuGet, MSBuild |
107
+ | [go](docs/templates/go.md) | Go development and golangci-lint |
108
+ | [java](docs/templates/java.md) | Maven, Gradle, Java, and JVM development |
109
+ | [nodejs](docs/templates/nodejs.md) | Node.js, npm, pnpm, yarn, and bun |
110
+ | [php](docs/templates/php.md) | PHP, Composer, and Laravel Artisan |
111
+ | [python](docs/templates/python.md) | pip, python, venv, pytest, and common data tools |
112
+ | [ruby](docs/templates/ruby.md) | Ruby, Bundler, Rails, and Rake |
113
+ | [rust](docs/templates/rust.md) | Cargo, rustc, and rustup |
112
114
 
113
- ## Apply Options
115
+ ### Cloud Providers
114
116
 
115
- Control where permissions are written with `--scope` or `--output`:
117
+ | Template | Description |
118
+ |----------|-------------|
119
+ | [aws](docs/templates/aws.md) | AWS CLI, SAM, CDK, Amplify, and Elastic Beanstalk |
120
+ | [azure](docs/templates/azure.md) | Azure CLI, Functions, Bicep, and Azure Developer CLI |
121
+ | [gcp](docs/templates/gcp.md) | Google Cloud CLI, gsutil, Firebase, and BigQuery |
116
122
 
117
- ```bash
118
- # Project settings (default) - .claude/settings.json
119
- cc-permissions --apply --scope project
123
+ ### Container & Infrastructure
120
124
 
121
- # User/global settings - ~/.claude/settings.json
122
- cc-permissions --apply --scope user
125
+ | Template | Description |
126
+ |----------|-------------|
127
+ | [docker](docs/templates/docker.md) | Docker, Docker Compose, and Buildx |
128
+ | [kubernetes](docs/templates/kubernetes.md) | kubectl, Helm, k9s, and Minikube |
129
+ | [terraform](docs/templates/terraform.md) | Terraform, Terragrunt, and tflint |
123
130
 
124
- # Local settings (gitignored) - .claude/settings.local.json
125
- cc-permissions --apply --scope local
131
+ ### Testing
126
132
 
127
- # Custom file path
128
- cc-permissions --apply --output ./my-permissions.json
129
- ```
133
+ | Template | Description |
134
+ |----------|-------------|
135
+ | [playwright](docs/templates/playwright.md) | Playwright testing framework |
130
136
 
131
- | Scope | File | Use Case |
132
- |-------|------|----------|
133
- | `project` | `.claude/settings.json` | Shared team settings (commit to repo) |
134
- | `user` / `global` | `~/.claude/settings.json` | Personal defaults across all projects |
135
- | `local` | `.claude/settings.local.json` | Personal overrides (gitignored) |
137
+ ### Mobile Development
136
138
 
137
- **Tip:** Options support prefix matching—use `-l r` for `--level restrictive` or `-s u` for `--scope user`.
139
+ | Template | Description |
140
+ |----------|-------------|
141
+ | [android](docs/templates/android.md) | Gradle, ADB, and Android development |
142
+ | [flutter](docs/templates/flutter.md) | Flutter SDK and Dart development |
143
+ | [ios](docs/templates/ios.md) | Xcode, Swift, CocoaPods, and iOS development |
138
144
 
139
- ## Output Formats
145
+ ### Utilities
140
146
 
141
- ```bash
142
- # JSON only (default) - pipe to .claude/settings.json
143
- cc-permissions template nodejs --format json
147
+ | Template | Description |
148
+ |----------|-------------|
149
+ | [database](docs/templates/database.md) | PostgreSQL, MySQL, MongoDB, and Redis CLI tools |
144
150
 
145
- # Human-readable summary
146
- cc-permissions template nodejs --format summary
151
+ Click any template to see the full list of commands at each level.
147
152
 
148
- # Both JSON and summary
149
- cc-permissions template nodejs --format both
150
- ```
153
+ ## Where permissions are saved
151
154
 
152
- ## Who This Is For
153
-
154
- - Developers who prefer native execution over containers
155
- - Users tired of repetitive permission prompts
156
- - Teams wanting consistent permission policies across projects
157
-
158
- ## Contributing Templates
159
-
160
- Templates are located in the `templates/` directory.
161
-
162
- ### Template Structure
163
-
164
- Each template is a `.jsonc` file with comments allowed:
165
-
166
- ```jsonc
167
- {
168
- "$schema": "./template.schema.json",
169
- "name": "my-template",
170
- "description": "Brief description of what this template covers",
171
- "levels": {
172
- "restrictive": [
173
- // Read-only commands (exploration, status checks)
174
- { "command": "mytool status", "description": "Check status" }
175
- ],
176
- "standard": [
177
- // Dev workflow commands (builds, tests, commits)
178
- { "command": "mytool build", "description": "Build project" }
179
- ],
180
- "permissive": [
181
- // Commands with broader access (installs, publishes)
182
- { "command": "mytool install *", "description": "Install packages" }
183
- ]
184
- }
185
- }
186
- ```
155
+ By default, permissions go to `.claude/settings.json` (project scope). You can change this:
187
156
 
188
- ### Permission Level Guidelines
157
+ ```bash
158
+ # Personal defaults across all projects
159
+ cc-permissions apply --scope user
189
160
 
190
- | Level | Purpose | Examples |
191
- |-------|---------|----------|
192
- | `restrictive` | Read-only, safe to run anytime | `git status`, `npm list`, `cargo check` |
193
- | `standard` | Normal dev workflow | `git commit`, `npm test`, `cargo build` |
194
- | `permissive` | Broader access, use with caution | `npm install`, `cargo publish` |
161
+ # Project-specific overrides (gitignored)
162
+ cc-permissions apply --scope local
195
163
 
196
- Each level is cumulative—`standard` includes everything from `restrictive`, and `permissive` includes everything from `standard`.
164
+ # Custom file
165
+ cc-permissions apply --output ./my-permissions.json
166
+ ```
197
167
 
198
- ## Safety
168
+ | Scope | File | Use case |
169
+ |-------|------|----------|
170
+ | `project` | `.claude/settings.json` | Team settings, commit to repo |
171
+ | `user` | `~/.claude/settings.json` | Personal defaults |
172
+ | `local` | `.claude/settings.local.json` | Personal overrides, gitignored |
199
173
 
200
- All generated configs include a deny list of dangerous patterns:
201
- - `rm -rf` - Recursive force delete
202
- - `sudo` - Privilege escalation
203
- - `curl | bash` / `wget | sh` - Remote code execution
204
- - And more...
174
+ ## Safety
205
175
 
206
- ## Publishing (for maintainers)
176
+ All generated configs include a deny list blocking dangerous patterns like `rm -rf /`, `sudo`, and piped remote execution (`curl | bash`). You can still shoot yourself in the foot, but the obvious hazards are blocked.
207
177
 
208
- Version management is done through npm scripts:
178
+ ## Other commands
209
179
 
210
180
  ```bash
211
- npm run version:show # Show current version
212
- npm run version:bump patch # 0.1.0 → 0.1.1
213
- npm run version:bump minor # 0.1.0 → 0.2.0
214
- npm run version:bump major # 0.1.0 → 1.0.0
215
- npm run version:set 2.0.0 # Set exact version
216
- ```
181
+ # See what would be applied (same as cc-permissions analyze)
182
+ cc-permissions
217
183
 
218
- To publish:
184
+ # List available templates
185
+ cc-permissions list
219
186
 
220
- ```bash
221
- npm login # first time only
222
- npm run version:bump patch # bump version (also: minor, major)
223
- npm publish # publishes to npm
187
+ # View template permissions without applying
188
+ cc-permissions template nodejs
189
+
190
+ # Output as JSON only
191
+ cc-permissions template nodejs --format json
192
+
193
+ # Output with summary
194
+ cc-permissions template nodejs --format both
224
195
  ```
225
196
 
226
- A prepublish check automatically prevents publishing a version that already exists on npm.
197
+ ## Contributing
198
+
199
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on adding new templates and development setup.
227
200
 
228
201
  ## License
229
202
 
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../src/analyze.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,YAAY,CAAC;AA8HnF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA8D5D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA8BnE"}
1
+ {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../src/analyze.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAsE,MAAM,YAAY,CAAC;AAoWrH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA4E5D;AAyDD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAyDnE"}