cc-permissions 0.1.2

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 (85) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +230 -0
  3. package/dist/analyze.d.ts +10 -0
  4. package/dist/analyze.d.ts.map +1 -0
  5. package/dist/analyze.js +213 -0
  6. package/dist/analyze.js.map +1 -0
  7. package/dist/cli.d.ts +3 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +348 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/index.d.ts +7 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +14 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/output.d.ts +83 -0
  16. package/dist/output.d.ts.map +1 -0
  17. package/dist/output.js +178 -0
  18. package/dist/output.js.map +1 -0
  19. package/dist/permissions.d.ts +32 -0
  20. package/dist/permissions.d.ts.map +1 -0
  21. package/dist/permissions.js +98 -0
  22. package/dist/permissions.js.map +1 -0
  23. package/dist/templates/cache.d.ts +71 -0
  24. package/dist/templates/cache.d.ts.map +1 -0
  25. package/dist/templates/cache.js +137 -0
  26. package/dist/templates/cache.js.map +1 -0
  27. package/dist/templates/dotnet.d.ts +3 -0
  28. package/dist/templates/dotnet.d.ts.map +1 -0
  29. package/dist/templates/dotnet.js +76 -0
  30. package/dist/templates/dotnet.js.map +1 -0
  31. package/dist/templates/general.d.ts +3 -0
  32. package/dist/templates/general.d.ts.map +1 -0
  33. package/dist/templates/general.js +59 -0
  34. package/dist/templates/general.js.map +1 -0
  35. package/dist/templates/index.d.ts +32 -0
  36. package/dist/templates/index.d.ts.map +1 -0
  37. package/dist/templates/index.js +54 -0
  38. package/dist/templates/index.js.map +1 -0
  39. package/dist/templates/loader.d.ts +19 -0
  40. package/dist/templates/loader.d.ts.map +1 -0
  41. package/dist/templates/loader.js +221 -0
  42. package/dist/templates/loader.js.map +1 -0
  43. package/dist/templates/python.d.ts +3 -0
  44. package/dist/templates/python.d.ts.map +1 -0
  45. package/dist/templates/python.js +110 -0
  46. package/dist/templates/python.js.map +1 -0
  47. package/dist/templates/remote.d.ts +45 -0
  48. package/dist/templates/remote.d.ts.map +1 -0
  49. package/dist/templates/remote.js +147 -0
  50. package/dist/templates/remote.js.map +1 -0
  51. package/dist/templates/web.d.ts +3 -0
  52. package/dist/templates/web.d.ts.map +1 -0
  53. package/dist/templates/web.js +101 -0
  54. package/dist/templates/web.js.map +1 -0
  55. package/dist/types.d.ts +44 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +8 -0
  58. package/dist/types.js.map +1 -0
  59. package/dist/version.d.ts +53 -0
  60. package/dist/version.d.ts.map +1 -0
  61. package/dist/version.js +118 -0
  62. package/dist/version.js.map +1 -0
  63. package/package.json +54 -0
  64. package/templates/android.jsonc +99 -0
  65. package/templates/aws.jsonc +113 -0
  66. package/templates/azure.jsonc +103 -0
  67. package/templates/database.jsonc +133 -0
  68. package/templates/docker.jsonc +115 -0
  69. package/templates/dotnet.jsonc +80 -0
  70. package/templates/flutter.jsonc +106 -0
  71. package/templates/gcp.jsonc +110 -0
  72. package/templates/git.jsonc +52 -0
  73. package/templates/github.jsonc +132 -0
  74. package/templates/go.jsonc +75 -0
  75. package/templates/ios.jsonc +98 -0
  76. package/templates/java.jsonc +93 -0
  77. package/templates/kubernetes.jsonc +114 -0
  78. package/templates/nodejs.jsonc +105 -0
  79. package/templates/php.jsonc +107 -0
  80. package/templates/python.jsonc +114 -0
  81. package/templates/ruby.jsonc +99 -0
  82. package/templates/rust.jsonc +97 -0
  83. package/templates/shell.jsonc +73 -0
  84. package/templates/template.schema.json +102 -0
  85. package/templates/terraform.jsonc +96 -0
@@ -0,0 +1,97 @@
1
+ {
2
+ "$schema": "../template.schema.json",
3
+ "name": "rust",
4
+ "description": "Cargo, rustc, and rustup",
5
+ "category": "Languages & Runtimes",
6
+ "detection": {
7
+ "files": ["Cargo.toml", "Cargo.lock"]
8
+ },
9
+ "levels": {
10
+ "restrictive": [
11
+ // rust info
12
+ { "command": "rustc --version", "description": "Check rustc version" },
13
+ { "command": "rustc -V", "description": "Check rustc version" },
14
+ { "command": "rustc --print", "description": "Print compiler info" },
15
+ // cargo info
16
+ { "command": "cargo --version", "description": "Check Cargo version" },
17
+ { "command": "cargo -V", "description": "Check Cargo version" },
18
+ { "command": "cargo version", "description": "Check Cargo version" },
19
+ { "command": "cargo help", "description": "Cargo help" },
20
+ // cargo read-only
21
+ { "command": "cargo tree", "description": "Show dependency tree" },
22
+ { "command": "cargo metadata", "description": "Show package metadata" },
23
+ { "command": "cargo search", "description": "Search crates.io" },
24
+ { "command": "cargo locate-project", "description": "Locate Cargo.toml" },
25
+ { "command": "cargo read-manifest", "description": "Read package manifest" },
26
+ { "command": "cargo pkgid", "description": "Show package ID" },
27
+ // cargo audit
28
+ { "command": "cargo audit", "description": "Audit dependencies" },
29
+ { "command": "cargo outdated", "description": "Check outdated dependencies" },
30
+ { "command": "cargo deny check", "description": "Check dependency policies" },
31
+ // rustup info
32
+ { "command": "rustup --version", "description": "Check rustup version" },
33
+ { "command": "rustup show", "description": "Show installed toolchains" },
34
+ { "command": "rustup which", "description": "Show which binary will run" },
35
+ { "command": "rustup target list", "description": "List available targets" },
36
+ { "command": "rustup component list", "description": "List available components" }
37
+ ],
38
+ "standard": [
39
+ // cargo build (no install)
40
+ { "command": "cargo build", "description": "Build package" },
41
+ { "command": "cargo build --release", "description": "Build release" },
42
+ { "command": "cargo build --target", "description": "Build for target" },
43
+ // cargo check
44
+ { "command": "cargo check", "description": "Check package" },
45
+ { "command": "cargo check --all-targets", "description": "Check all targets" },
46
+ // cargo test
47
+ { "command": "cargo test", "description": "Run tests" },
48
+ { "command": "cargo test --release", "description": "Run release tests" },
49
+ { "command": "cargo test --doc", "description": "Run doc tests" },
50
+ { "command": "cargo bench", "description": "Run benchmarks" },
51
+ // cargo run
52
+ { "command": "cargo run", "description": "Run package" },
53
+ { "command": "cargo run --release", "description": "Run release build" },
54
+ { "command": "cargo run --example", "description": "Run example" },
55
+ // cargo formatting
56
+ { "command": "cargo fmt", "description": "Format code" },
57
+ { "command": "cargo fmt --check", "description": "Check formatting" },
58
+ // cargo linting
59
+ { "command": "cargo clippy", "description": "Run Clippy linter" },
60
+ { "command": "cargo clippy --fix", "description": "Apply Clippy fixes" },
61
+ // cargo doc
62
+ { "command": "cargo doc", "description": "Build documentation" },
63
+ { "command": "cargo doc --open", "description": "Build and open docs" },
64
+ // cargo fix
65
+ { "command": "cargo fix", "description": "Apply compiler fixes" }
66
+ ],
67
+ "permissive": [
68
+ // cargo install
69
+ { "command": "cargo install", "description": "Install binary" },
70
+ { "command": "cargo uninstall", "description": "Uninstall binary" },
71
+ // cargo publish
72
+ { "command": "cargo publish", "description": "Publish to crates.io" },
73
+ { "command": "cargo package", "description": "Package crate" },
74
+ { "command": "cargo yank", "description": "Yank published version" },
75
+ // cargo update
76
+ { "command": "cargo update", "description": "Update dependencies" },
77
+ { "command": "cargo add", "description": "Add dependency" },
78
+ { "command": "cargo remove", "description": "Remove dependency" },
79
+ // cargo clean
80
+ { "command": "cargo clean", "description": "Clean target directory" },
81
+ // cargo vendor
82
+ { "command": "cargo vendor", "description": "Vendor dependencies" },
83
+ // cargo new/init
84
+ { "command": "cargo new", "description": "Create new package" },
85
+ { "command": "cargo init", "description": "Initialize package" },
86
+ // rustup management
87
+ { "command": "rustup update", "description": "Update toolchains" },
88
+ { "command": "rustup default", "description": "Set default toolchain" },
89
+ { "command": "rustup toolchain install", "description": "Install toolchain" },
90
+ { "command": "rustup toolchain uninstall", "description": "Uninstall toolchain" },
91
+ { "command": "rustup target add", "description": "Add target" },
92
+ { "command": "rustup target remove", "description": "Remove target" },
93
+ { "command": "rustup component add", "description": "Add component" },
94
+ { "command": "rustup component remove", "description": "Remove component" }
95
+ ]
96
+ }
97
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "../template.schema.json",
3
+ "name": "shell",
4
+ "description": "Basic shell and filesystem commands",
5
+ "category": "General",
6
+ "detection": {
7
+ "always": true
8
+ },
9
+ "levels": {
10
+ "restrictive": [
11
+ { "command": "ls", "description": "List directory contents" },
12
+ { "command": "cat", "description": "View file contents" },
13
+ { "command": "head", "description": "View file beginning" },
14
+ { "command": "tail", "description": "View file end" },
15
+ { "command": "less", "description": "Page through file" },
16
+ { "command": "more", "description": "Page through file" },
17
+ { "command": "grep", "description": "Search file contents" },
18
+ { "command": "find", "description": "Find files" },
19
+ { "command": "wc", "description": "Count lines/words/chars" },
20
+ { "command": "tree", "description": "Display directory tree" },
21
+ { "command": "pwd", "description": "Print working directory" },
22
+ { "command": "which", "description": "Locate a command" },
23
+ { "command": "whereis", "description": "Locate binary/source/manual" },
24
+ { "command": "type", "description": "Describe command type" },
25
+ { "command": "file", "description": "Determine file type" },
26
+ { "command": "stat", "description": "Display file status" },
27
+ { "command": "du", "description": "Disk usage" },
28
+ { "command": "df", "description": "Disk free space" },
29
+ { "command": "echo", "description": "Print text" },
30
+ { "command": "printf", "description": "Format and print" },
31
+ { "command": "env", "description": "View environment variables" },
32
+ { "command": "printenv", "description": "Print environment variables" },
33
+ { "command": "date", "description": "Display date/time" },
34
+ { "command": "whoami", "description": "Print current user" },
35
+ { "command": "uname", "description": "System information" },
36
+ { "command": "hostname", "description": "Show hostname" }
37
+ ],
38
+ "standard": [
39
+ { "command": "mkdir", "description": "Create directories" },
40
+ { "command": "touch", "description": "Create empty files" },
41
+ { "command": "cp", "description": "Copy files" },
42
+ { "command": "mv", "description": "Move/rename files" },
43
+ { "command": "ln", "description": "Create links" },
44
+ { "command": "chmod", "description": "Change file permissions" },
45
+ { "command": "chown", "description": "Change file owner" },
46
+ { "command": "tar", "description": "Archive files" },
47
+ { "command": "zip", "description": "Compress files" },
48
+ { "command": "unzip", "description": "Extract zip files" },
49
+ { "command": "gzip", "description": "Compress files" },
50
+ { "command": "gunzip", "description": "Decompress files" },
51
+ { "command": "curl", "description": "Transfer data from URLs" },
52
+ { "command": "wget", "description": "Download files" },
53
+ { "command": "diff", "description": "Compare files" },
54
+ { "command": "sort", "description": "Sort lines" },
55
+ { "command": "uniq", "description": "Filter duplicate lines" },
56
+ { "command": "cut", "description": "Cut sections from lines" },
57
+ { "command": "awk", "description": "Pattern processing" },
58
+ { "command": "sed", "description": "Stream editor" },
59
+ { "command": "xargs", "description": "Build command lines" },
60
+ { "command": "tee", "description": "Read and write to files" }
61
+ ],
62
+ "permissive": [
63
+ { "command": "rm", "description": "Remove files" },
64
+ { "command": "rmdir", "description": "Remove directories" },
65
+ { "command": "rm -r", "description": "Remove recursively" },
66
+ { "command": "rm -rf", "description": "Force remove recursively" },
67
+ { "command": "sudo", "description": "Execute as superuser" },
68
+ { "command": "kill", "description": "Terminate processes" },
69
+ { "command": "pkill", "description": "Kill processes by name" },
70
+ { "command": "killall", "description": "Kill processes by name" }
71
+ ]
72
+ }
73
+ }
@@ -0,0 +1,102 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/DanielCarmingham/cc-permissions/blob/main/templates/template.schema.json",
4
+ "title": "CC-Permissions Template",
5
+ "description": "Schema for permission templates in cc-permissions",
6
+ "type": "object",
7
+ "required": ["name", "description", "levels"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": {
11
+ "type": "string",
12
+ "description": "JSON Schema reference"
13
+ },
14
+ "name": {
15
+ "type": "string",
16
+ "description": "Template identifier (lowercase, no spaces)",
17
+ "pattern": "^[a-z][a-z0-9-]*$"
18
+ },
19
+ "description": {
20
+ "type": "string",
21
+ "description": "Brief description of what this template covers"
22
+ },
23
+ "category": {
24
+ "type": "string",
25
+ "description": "Category for grouping templates in list output"
26
+ },
27
+ "detection": {
28
+ "type": "object",
29
+ "description": "Optional rules for auto-detecting when this template should be recommended",
30
+ "additionalProperties": false,
31
+ "properties": {
32
+ "files": {
33
+ "type": "array",
34
+ "description": "File patterns that indicate this template (supports globs like *.csproj)",
35
+ "items": { "type": "string" }
36
+ },
37
+ "directories": {
38
+ "type": "array",
39
+ "description": "Directory patterns that indicate this template (e.g., .git/, .github/workflows/)",
40
+ "items": { "type": "string" }
41
+ },
42
+ "contentPatterns": {
43
+ "type": "array",
44
+ "description": "File + content patterns for ambiguous detection",
45
+ "items": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "properties": {
49
+ "file": { "type": "string", "description": "File to check" },
50
+ "contains": { "type": "string", "description": "Text that must be present in the file" }
51
+ },
52
+ "required": ["file", "contains"]
53
+ }
54
+ },
55
+ "always": {
56
+ "type": "boolean",
57
+ "description": "If true, this template is always recommended (e.g., shell baseline)"
58
+ }
59
+ }
60
+ },
61
+ "levels": {
62
+ "type": "object",
63
+ "description": "Permission levels (cumulative: standard includes restrictive, permissive includes standard)",
64
+ "required": ["restrictive", "standard", "permissive"],
65
+ "additionalProperties": false,
66
+ "properties": {
67
+ "restrictive": {
68
+ "type": "array",
69
+ "description": "Read-only operations (exploration, status checks)",
70
+ "items": { "$ref": "#/$defs/permission" }
71
+ },
72
+ "standard": {
73
+ "type": "array",
74
+ "description": "Dev workflow commands (builds, tests, commits)",
75
+ "items": { "$ref": "#/$defs/permission" }
76
+ },
77
+ "permissive": {
78
+ "type": "array",
79
+ "description": "Commands with broader access (installs, publishes)",
80
+ "items": { "$ref": "#/$defs/permission" }
81
+ }
82
+ }
83
+ }
84
+ },
85
+ "$defs": {
86
+ "permission": {
87
+ "type": "object",
88
+ "required": ["command"],
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "command": {
92
+ "type": "string",
93
+ "description": "The command or pattern to allow"
94
+ },
95
+ "description": {
96
+ "type": "string",
97
+ "description": "Optional description for documentation"
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "$schema": "../template.schema.json",
3
+ "name": "terraform",
4
+ "description": "Terraform, Terragrunt, and tflint",
5
+ "category": "Container & Infrastructure",
6
+ "detection": {
7
+ "files": ["*.tf", ".terraform.lock.hcl", "terragrunt.hcl"]
8
+ },
9
+ "levels": {
10
+ "restrictive": [
11
+ // terraform info
12
+ { "command": "terraform version", "description": "Check Terraform version" },
13
+ { "command": "terraform -version", "description": "Check Terraform version" },
14
+ { "command": "terraform providers", "description": "List providers" },
15
+ { "command": "terraform providers schema", "description": "Show provider schema" },
16
+ // terraform read-only
17
+ { "command": "terraform fmt -check", "description": "Check formatting" },
18
+ { "command": "terraform fmt -diff", "description": "Show format diff" },
19
+ { "command": "terraform validate", "description": "Validate configuration" },
20
+ { "command": "terraform show", "description": "Show state or plan" },
21
+ { "command": "terraform output", "description": "Show outputs" },
22
+ { "command": "terraform graph", "description": "Generate graph" },
23
+ { "command": "terraform state list", "description": "List state resources" },
24
+ { "command": "terraform state show", "description": "Show state resource" },
25
+ // terraform workspace read
26
+ { "command": "terraform workspace list", "description": "List workspaces" },
27
+ { "command": "terraform workspace show", "description": "Show current workspace" },
28
+ // terragrunt info
29
+ { "command": "terragrunt --version", "description": "Check Terragrunt version" },
30
+ { "command": "terragrunt graph-dependencies", "description": "Show dependency graph" },
31
+ { "command": "terragrunt output", "description": "Show Terragrunt outputs" },
32
+ { "command": "terragrunt validate", "description": "Validate Terragrunt config" },
33
+ // tflint info
34
+ { "command": "tflint --version", "description": "Check tflint version" }
35
+ ],
36
+ "standard": [
37
+ // terraform format
38
+ { "command": "terraform fmt", "description": "Format configuration" },
39
+ // terraform init (downloads providers, no changes)
40
+ { "command": "terraform init", "description": "Initialize configuration" },
41
+ { "command": "terraform init -upgrade", "description": "Upgrade providers" },
42
+ { "command": "terraform get", "description": "Download modules" },
43
+ // terraform plan (no changes)
44
+ { "command": "terraform plan", "description": "Create execution plan" },
45
+ { "command": "terraform plan -out", "description": "Save plan to file" },
46
+ { "command": "terraform plan -target", "description": "Plan specific resource" },
47
+ // terraform workspace management
48
+ { "command": "terraform workspace select", "description": "Select workspace" },
49
+ { "command": "terraform workspace new", "description": "Create workspace" },
50
+ // terraform console
51
+ { "command": "terraform console", "description": "Interactive console" },
52
+ // terragrunt commands (no apply/destroy)
53
+ { "command": "terragrunt init", "description": "Initialize Terragrunt" },
54
+ { "command": "terragrunt plan", "description": "Plan with Terragrunt" },
55
+ { "command": "terragrunt plan-all", "description": "Plan all modules" },
56
+ { "command": "terragrunt run-all plan", "description": "Plan all modules" },
57
+ { "command": "terragrunt fmt", "description": "Format Terragrunt config" },
58
+ // tflint
59
+ { "command": "tflint", "description": "Run tflint" },
60
+ { "command": "tflint --init", "description": "Initialize tflint plugins" },
61
+ { "command": "tflint --fix", "description": "Fix tflint issues" }
62
+ ],
63
+ "permissive": [
64
+ // terraform apply
65
+ { "command": "terraform apply", "description": "Apply changes" },
66
+ { "command": "terraform apply -auto-approve", "description": "Apply without prompt" },
67
+ { "command": "terraform apply -target", "description": "Apply specific resource" },
68
+ // terraform destroy
69
+ { "command": "terraform destroy", "description": "Destroy infrastructure" },
70
+ { "command": "terraform destroy -auto-approve", "description": "Destroy without prompt" },
71
+ { "command": "terraform destroy -target", "description": "Destroy specific resource" },
72
+ // terraform state management
73
+ { "command": "terraform state mv", "description": "Move state resource" },
74
+ { "command": "terraform state rm", "description": "Remove from state" },
75
+ { "command": "terraform state pull", "description": "Pull remote state" },
76
+ { "command": "terraform state push", "description": "Push state" },
77
+ { "command": "terraform state replace-provider", "description": "Replace provider" },
78
+ // terraform import
79
+ { "command": "terraform import", "description": "Import resource" },
80
+ // terraform taint/untaint
81
+ { "command": "terraform taint", "description": "Mark resource for recreation" },
82
+ { "command": "terraform untaint", "description": "Unmark resource" },
83
+ // terraform workspace delete
84
+ { "command": "terraform workspace delete", "description": "Delete workspace" },
85
+ // terraform refresh
86
+ { "command": "terraform refresh", "description": "Refresh state" },
87
+ // terragrunt apply/destroy
88
+ { "command": "terragrunt apply", "description": "Apply with Terragrunt" },
89
+ { "command": "terragrunt destroy", "description": "Destroy with Terragrunt" },
90
+ { "command": "terragrunt apply-all", "description": "Apply all modules" },
91
+ { "command": "terragrunt destroy-all", "description": "Destroy all modules" },
92
+ { "command": "terragrunt run-all apply", "description": "Apply all modules" },
93
+ { "command": "terragrunt run-all destroy", "description": "Destroy all modules" }
94
+ ]
95
+ }
96
+ }