claude-permissions-manager 0.6.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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +184 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/audit.d.ts +5 -0
  8. package/dist/commands/audit.d.ts.map +1 -0
  9. package/dist/commands/audit.js +46 -0
  10. package/dist/commands/audit.js.map +1 -0
  11. package/dist/commands/completion.d.ts +9 -0
  12. package/dist/commands/completion.d.ts.map +1 -0
  13. package/dist/commands/completion.js +269 -0
  14. package/dist/commands/completion.js.map +1 -0
  15. package/dist/commands/diff.d.ts +4 -0
  16. package/dist/commands/diff.d.ts.map +1 -0
  17. package/dist/commands/diff.js +161 -0
  18. package/dist/commands/diff.js.map +1 -0
  19. package/dist/commands/export.d.ts +6 -0
  20. package/dist/commands/export.d.ts.map +1 -0
  21. package/dist/commands/export.js +120 -0
  22. package/dist/commands/export.js.map +1 -0
  23. package/dist/commands/init.d.ts +10 -0
  24. package/dist/commands/init.d.ts.map +1 -0
  25. package/dist/commands/init.js +148 -0
  26. package/dist/commands/init.js.map +1 -0
  27. package/dist/commands/list.d.ts +5 -0
  28. package/dist/commands/list.d.ts.map +1 -0
  29. package/dist/commands/list.js +54 -0
  30. package/dist/commands/list.js.map +1 -0
  31. package/dist/commands/manage.d.ts +26 -0
  32. package/dist/commands/manage.d.ts.map +1 -0
  33. package/dist/commands/manage.js +144 -0
  34. package/dist/commands/manage.js.map +1 -0
  35. package/dist/commands/show.d.ts +4 -0
  36. package/dist/commands/show.d.ts.map +1 -0
  37. package/dist/commands/show.js +64 -0
  38. package/dist/commands/show.js.map +1 -0
  39. package/dist/commands/ui.d.ts +3 -0
  40. package/dist/commands/ui.d.ts.map +1 -0
  41. package/dist/commands/ui.js +10 -0
  42. package/dist/commands/ui.js.map +1 -0
  43. package/dist/core/discovery.d.ts +9 -0
  44. package/dist/core/discovery.d.ts.map +1 -0
  45. package/dist/core/discovery.js +152 -0
  46. package/dist/core/discovery.js.map +1 -0
  47. package/dist/core/merger.d.ts +5 -0
  48. package/dist/core/merger.d.ts.map +1 -0
  49. package/dist/core/merger.js +205 -0
  50. package/dist/core/merger.js.map +1 -0
  51. package/dist/core/parser.d.ts +13 -0
  52. package/dist/core/parser.d.ts.map +1 -0
  53. package/dist/core/parser.js +215 -0
  54. package/dist/core/parser.js.map +1 -0
  55. package/dist/core/schemas.d.ts +686 -0
  56. package/dist/core/schemas.d.ts.map +1 -0
  57. package/dist/core/schemas.js +77 -0
  58. package/dist/core/schemas.js.map +1 -0
  59. package/dist/core/types.d.ts +89 -0
  60. package/dist/core/types.d.ts.map +1 -0
  61. package/dist/core/types.js +2 -0
  62. package/dist/core/types.js.map +1 -0
  63. package/dist/core/writer.d.ts +25 -0
  64. package/dist/core/writer.d.ts.map +1 -0
  65. package/dist/core/writer.js +153 -0
  66. package/dist/core/writer.js.map +1 -0
  67. package/dist/tui/app.d.ts +7 -0
  68. package/dist/tui/app.d.ts.map +1 -0
  69. package/dist/tui/app.js +53 -0
  70. package/dist/tui/app.js.map +1 -0
  71. package/dist/tui/components/Badge.d.ts +8 -0
  72. package/dist/tui/components/Badge.d.ts.map +1 -0
  73. package/dist/tui/components/Badge.js +25 -0
  74. package/dist/tui/components/Badge.js.map +1 -0
  75. package/dist/tui/components/Header.d.ts +8 -0
  76. package/dist/tui/components/Header.d.ts.map +1 -0
  77. package/dist/tui/components/Header.js +6 -0
  78. package/dist/tui/components/Header.js.map +1 -0
  79. package/dist/tui/components/ScopePicker.d.ts +10 -0
  80. package/dist/tui/components/ScopePicker.d.ts.map +1 -0
  81. package/dist/tui/components/ScopePicker.js +34 -0
  82. package/dist/tui/components/ScopePicker.js.map +1 -0
  83. package/dist/tui/components/Spinner.d.ts +4 -0
  84. package/dist/tui/components/Spinner.d.ts.map +1 -0
  85. package/dist/tui/components/Spinner.js +15 -0
  86. package/dist/tui/components/Spinner.js.map +1 -0
  87. package/dist/tui/components/TextInput.d.ts +9 -0
  88. package/dist/tui/components/TextInput.d.ts.map +1 -0
  89. package/dist/tui/components/TextInput.js +27 -0
  90. package/dist/tui/components/TextInput.js.map +1 -0
  91. package/dist/tui/screens/Audit.d.ts +8 -0
  92. package/dist/tui/screens/Audit.d.ts.map +1 -0
  93. package/dist/tui/screens/Audit.js +60 -0
  94. package/dist/tui/screens/Audit.js.map +1 -0
  95. package/dist/tui/screens/Diff.d.ts +8 -0
  96. package/dist/tui/screens/Diff.d.ts.map +1 -0
  97. package/dist/tui/screens/Diff.js +134 -0
  98. package/dist/tui/screens/Diff.js.map +1 -0
  99. package/dist/tui/screens/ProjectDetail.d.ts +9 -0
  100. package/dist/tui/screens/ProjectDetail.d.ts.map +1 -0
  101. package/dist/tui/screens/ProjectDetail.js +188 -0
  102. package/dist/tui/screens/ProjectDetail.js.map +1 -0
  103. package/dist/tui/screens/ProjectList.d.ts +11 -0
  104. package/dist/tui/screens/ProjectList.d.ts.map +1 -0
  105. package/dist/tui/screens/ProjectList.js +65 -0
  106. package/dist/tui/screens/ProjectList.js.map +1 -0
  107. package/dist/utils/format.d.ts +7 -0
  108. package/dist/utils/format.d.ts.map +1 -0
  109. package/dist/utils/format.js +144 -0
  110. package/dist/utils/format.js.map +1 -0
  111. package/dist/utils/paths.d.ts +18 -0
  112. package/dist/utils/paths.d.ts.map +1 -0
  113. package/dist/utils/paths.js +82 -0
  114. package/dist/utils/paths.js.map +1 -0
  115. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 stofi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # claude-permissions-manager (`cpm`)
2
+
3
+ [![CI](https://github.com/stofi/claude-permissions-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/stofi/claude-permissions-manager/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/claude-permissions-manager)](https://www.npmjs.com/package/claude-permissions-manager)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+
7
+ Discover, analyze, and manage [Claude Code](https://claude.ai/code) permissions across all your projects.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g claude-permissions-manager
13
+ # or run without installing:
14
+ npx claude-permissions-manager
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```bash
20
+ cpm # Launch interactive TUI (when stdout is a TTY)
21
+ cpm list # List all projects with their permission modes
22
+ cpm show # Show permissions for current project (cwd)
23
+ cpm show ~/my-project # Show detailed permissions for a specific project
24
+ cpm audit # Report risky permissions across all projects
25
+ cpm diff <path1> <path2> # Compare two projects side by side
26
+ cpm export # Dump all permissions as JSON (stdout)
27
+ cpm export --format csv # Dump as CSV
28
+ cpm export --output out.json # Write to file
29
+ ```
30
+
31
+ ### Initialize a project
32
+
33
+ ```bash
34
+ # Create a starter settings.json from a preset
35
+ cpm init --project ~/my-project --preset node # Node.js project
36
+ cpm init --project ~/my-project --preset safe # Read-only + safe git (default)
37
+ cpm init --project ~/my-project --preset strict # Highly restrictive
38
+
39
+ # Use --scope local to create a personal settings.local.json instead
40
+ cpm init --project ~/my-project --preset node --scope local
41
+ ```
42
+
43
+ ### Managing permissions
44
+
45
+ ```bash
46
+ # Add rules
47
+ cpm allow "Bash(npm run *)" --project ~/my-project --scope project
48
+ cpm deny "Read(**/.env)" --project ~/my-project --scope project
49
+ cpm ask "Bash(git push *)" --project ~/my-project --scope project
50
+ cpm allow "Read" --scope user # applies to all projects
51
+
52
+ # Remove a rule
53
+ cpm reset "Bash(npm run *)" --project ~/my-project --scope project
54
+
55
+ # Clear all rules (with confirmation)
56
+ cpm reset --all --yes --project ~/my-project --scope project
57
+
58
+ # Set permission mode
59
+ cpm mode acceptEdits --project ~/my-project --scope project
60
+ ```
61
+
62
+ ### Scope options
63
+
64
+ | Scope | File | Applies to |
65
+ |---|---|---|
66
+ | `local` | `.claude/settings.local.json` | You, this project (default) |
67
+ | `project` | `.claude/settings.json` | All collaborators (commit to git) |
68
+ | `user` | `~/.claude/settings.json` | You, all projects |
69
+
70
+ ### Flags
71
+
72
+ ```
73
+ --root <dir> Override scan root (default: ~)
74
+ --depth <n> Max directory depth for scanning (default: 8)
75
+ --json Output as JSON (list, show, audit, diff, export)
76
+ --no-global Skip user/managed global settings (list, audit, export)
77
+ ```
78
+
79
+ ## Shell completion
80
+
81
+ ```bash
82
+ # Bash — add to ~/.bashrc
83
+ eval "$(cpm completion bash)"
84
+
85
+ # Zsh — add to ~/.zshrc
86
+ eval "$(cpm completion zsh)"
87
+ ```
88
+
89
+ Tab-completes: commands, `--scope` values, `--format`, `--preset`, mode names, and directory paths.
90
+
91
+ ## Interactive TUI
92
+
93
+ Run `cpm` (or `cpm ui`) for the interactive terminal UI:
94
+
95
+ - `↑↓` / `j`/`k` — navigate projects
96
+ - `Enter` — view project details
97
+ - `a` — audit view (security issues)
98
+ - `d` — diff two projects
99
+ - `q` — quit
100
+
101
+ In project detail (permissions tab):
102
+ - `1` / `2` / `3` — switch tabs (permissions / MCP / warnings)
103
+ - `j`/`k` — move cursor through rules
104
+ - `a` — add allow rule, `d` — add deny rule, `s` — add ask rule
105
+ - `x` — delete selected rule
106
+ - `←` / `Esc` / `q` — back to list
107
+
108
+ ## What it reads
109
+
110
+ - `~/.claude/settings.json` — your personal global settings
111
+ - `.claude/settings.json` — project-level shared settings
112
+ - `.claude/settings.local.json` — project-level personal settings
113
+ - `/etc/claude-code/managed-settings.json` — enterprise managed settings
114
+ - `.mcp.json` — MCP server configurations
115
+ - `~/.claude.json` — Claude Code state (MCP approvals, per-project servers)
116
+
117
+ Values from all scopes are merged. Deny rules at any scope win absolutely.
118
+
119
+ ## Security
120
+
121
+ - Never displays environment variable values (only names)
122
+ - Never displays MCP header values (only names)
123
+ - Warns prominently for `bypassPermissions` mode
124
+ - Atomic file writes (write to temp file, then rename)
125
+ - No network access — fully local
126
+
127
+ ## Requirements
128
+
129
+ Node.js ≥ 18
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { listCommand } from "./commands/list.js";
4
+ import { showCommand } from "./commands/show.js";
5
+ import { auditCommand } from "./commands/audit.js";
6
+ import { homeDir } from "./utils/paths.js";
7
+ const program = new Command();
8
+ program
9
+ .name("cpm")
10
+ .description("Claude Permissions Manager — discover and manage Claude Code permissions")
11
+ .version("0.6.0");
12
+ // Default action: TUI when TTY, list otherwise
13
+ program.action(async () => {
14
+ // If any non-option args were passed, they didn't match a known subcommand
15
+ const unknownArgs = program.args.filter((a) => !a.startsWith("-"));
16
+ if (unknownArgs.length > 0) {
17
+ process.stderr.write(`Error: Unknown command '${unknownArgs[0]}'\nRun 'cpm --help' for usage.\n`);
18
+ process.exit(1);
19
+ }
20
+ if (process.stdout.isTTY) {
21
+ const { uiCommand } = await import("./commands/ui.js");
22
+ await uiCommand({ root: homeDir() });
23
+ }
24
+ else {
25
+ await listCommand({ root: homeDir() });
26
+ }
27
+ });
28
+ program
29
+ .command("ui")
30
+ .description("Launch interactive TUI")
31
+ .option("--root <dir>", "Root directory to scan from", homeDir())
32
+ .option("--depth <n>", "Max scan depth", "8")
33
+ .action(async (opts) => {
34
+ const { uiCommand } = await import("./commands/ui.js");
35
+ await uiCommand({
36
+ root: opts.root,
37
+ maxDepth: parseInt(opts.depth, 10),
38
+ });
39
+ });
40
+ program
41
+ .command("list")
42
+ .description("List all discovered Claude projects and their permissions")
43
+ .option("--root <dir>", "Root directory to scan from", homeDir())
44
+ .option("--depth <n>", "Max scan depth", "8")
45
+ .option("--json", "Output as JSON")
46
+ .option("--no-global", "Skip user and managed global settings")
47
+ .action(async (opts) => {
48
+ await listCommand({
49
+ root: opts.root,
50
+ maxDepth: parseInt(opts.depth, 10),
51
+ json: opts.json,
52
+ includeGlobal: opts.global !== false,
53
+ });
54
+ });
55
+ program
56
+ .command("show [path]")
57
+ .description("Show detailed permissions for a project (default: cwd)")
58
+ .option("--json", "Output as JSON")
59
+ .action(async (path, opts) => {
60
+ await showCommand(path, { json: opts.json });
61
+ });
62
+ program
63
+ .command("audit")
64
+ .description("Report risky or suspicious permissions across all projects")
65
+ .option("--root <dir>", "Root directory to scan from", homeDir())
66
+ .option("--depth <n>", "Max scan depth", "8")
67
+ .option("--json", "Output as JSON")
68
+ .option("--no-global", "Skip user and managed global settings")
69
+ .action(async (opts) => {
70
+ await auditCommand({
71
+ root: opts.root,
72
+ maxDepth: parseInt(opts.depth, 10),
73
+ json: opts.json,
74
+ includeGlobal: opts.global !== false,
75
+ });
76
+ });
77
+ program
78
+ .command("diff <path1> <path2>")
79
+ .description("Compare effective permissions between two projects")
80
+ .option("--json", "Output as JSON")
81
+ .action(async (path1, path2, opts) => {
82
+ const { diffCommand } = await import("./commands/diff.js");
83
+ await diffCommand(path1, path2, { json: opts.json });
84
+ });
85
+ program
86
+ .command("allow <rule>")
87
+ .description('Add a rule to the allow list (e.g. cpm allow "Bash(npm run *)")')
88
+ .option("--scope <scope>", "Settings scope: local|project|user (default: local)", "local")
89
+ .option("--project <path>", "Project path for local/project scope (default: cwd)")
90
+ .action(async (rule, opts) => {
91
+ const { allowCommand } = await import("./commands/manage.js");
92
+ await allowCommand(rule, opts);
93
+ });
94
+ program
95
+ .command("deny <rule>")
96
+ .description('Add a rule to the deny list (e.g. cpm deny "Read(**/.env)")')
97
+ .option("--scope <scope>", "Settings scope: local|project|user (default: local)", "local")
98
+ .option("--project <path>", "Project path for local/project scope (default: cwd)")
99
+ .action(async (rule, opts) => {
100
+ const { denyCommand } = await import("./commands/manage.js");
101
+ await denyCommand(rule, opts);
102
+ });
103
+ program
104
+ .command("ask <rule>")
105
+ .description('Add a rule to the ask list (always prompt for confirmation)')
106
+ .option("--scope <scope>", "Settings scope: local|project|user (default: local)", "local")
107
+ .option("--project <path>", "Project path for local/project scope (default: cwd)")
108
+ .action(async (rule, opts) => {
109
+ const { askCommand } = await import("./commands/manage.js");
110
+ await askCommand(rule, opts);
111
+ });
112
+ program
113
+ .command("reset [rule]")
114
+ .description("Remove a rule from all lists, or --all to clear all rules")
115
+ .option("--scope <scope>", "Settings scope: local|project|user (default: local)", "local")
116
+ .option("--project <path>", "Project path for local/project scope (default: cwd)")
117
+ .option("--all", "Clear all permission rules")
118
+ .option("--yes", "Skip confirmation prompt")
119
+ .action(async (rule, opts) => {
120
+ const { resetRuleCommand, resetAllCommand } = await import("./commands/manage.js");
121
+ if (opts.all) {
122
+ await resetAllCommand(opts);
123
+ }
124
+ else if (rule) {
125
+ await resetRuleCommand(rule, opts);
126
+ }
127
+ else {
128
+ console.error("Provide a rule to remove, or --all to clear everything");
129
+ process.exit(1);
130
+ }
131
+ });
132
+ program
133
+ .command("mode <mode>")
134
+ .description("Set defaultMode: default|acceptEdits|plan|auto|dontAsk|bypassPermissions")
135
+ .option("--scope <scope>", "Settings scope: local|project|user (default: local)", "local")
136
+ .option("--project <path>", "Project path for local/project scope (default: cwd)")
137
+ .action(async (mode, opts) => {
138
+ const { modeCommand } = await import("./commands/manage.js");
139
+ await modeCommand(mode, opts);
140
+ });
141
+ program
142
+ .command("export")
143
+ .description("Export all permissions data (JSON or CSV)")
144
+ .option("--root <dir>", "Root directory to scan from", homeDir())
145
+ .option("--depth <n>", "Max scan depth", "8")
146
+ .option("--format <fmt>", "Output format: json|csv", "json")
147
+ .option("--output <file>", "Write to file instead of stdout")
148
+ .option("--no-global", "Skip user and managed global settings")
149
+ .action(async (opts) => {
150
+ const { exportCommand } = await import("./commands/export.js");
151
+ await exportCommand({
152
+ root: opts.root,
153
+ maxDepth: parseInt(opts.depth, 10),
154
+ format: opts.format,
155
+ output: opts.output,
156
+ includeGlobal: opts.global !== false,
157
+ });
158
+ });
159
+ program
160
+ .command("init")
161
+ .description("Create a starter settings.json from a preset template")
162
+ .option("--project <path>", "Project path (default: current directory)")
163
+ .option("--scope <scope>", "Settings scope: local|project|user (default: project)", "project")
164
+ .option("--preset <preset>", "Template preset: safe|node|strict (default: safe)", "safe")
165
+ .option("--mode <mode>", "Override defaultMode")
166
+ .option("--yes", "Overwrite existing settings without prompting")
167
+ .action(async (opts) => {
168
+ const { initCommand } = await import("./commands/init.js");
169
+ await initCommand(opts);
170
+ });
171
+ program
172
+ .command("completion <shell>")
173
+ .description("Print shell completion script (bash or zsh). Add to shell profile:")
174
+ .addHelpText("after", "\n eval \"$(cpm completion bash)\" # ~/.bashrc\n eval \"$(cpm completion zsh)\" # ~/.zshrc")
175
+ .action(async (shell) => {
176
+ const { completionCommand } = await import("./commands/completion.js");
177
+ await completionCommand(shell);
178
+ });
179
+ program.parseAsync().catch((err) => {
180
+ const msg = err instanceof Error ? err.message : String(err);
181
+ process.stderr.write(`\nError: ${msg}\n`);
182
+ process.exit(1);
183
+ });
184
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,0EAA0E,CAAC;KACvF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,+CAA+C;AAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IACxB,2EAA2E;IAC3E,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,WAAW,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC;QAClG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,C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AAC;AAC1B,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,oBAAoB,CAAC;KAC7B,WAAW,CAAC,oEAAoE,CAAC;KACjF,WAAW,CAAC,OAAO,EAAE,iGAAiG,CAAC;KACvH,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IACtB,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;IACvE,MAAM,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC1C,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ScanOptions } from "../core/discovery.js";
2
+ export declare function auditCommand(options: ScanOptions & {
3
+ json?: boolean;
4
+ }): Promise<void>;
5
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,wBAAsB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmD3F"}
@@ -0,0 +1,46 @@
1
+ import chalk from "chalk";
2
+ import { scan } from "../core/discovery.js";
3
+ import { collapseHome } from "../utils/paths.js";
4
+ export async function auditCommand(options) {
5
+ process.stderr.write(chalk.gray("Scanning for Claude projects...\n"));
6
+ const result = await scan(options);
7
+ const allIssues = [];
8
+ for (const project of result.projects) {
9
+ for (const w of project.effectivePermissions.warnings) {
10
+ allIssues.push({
11
+ project: project.rootPath,
12
+ severity: w.severity,
13
+ message: w.message,
14
+ rule: w.rule,
15
+ });
16
+ }
17
+ }
18
+ if (options.json) {
19
+ console.log(JSON.stringify({ issues: allIssues, errors: result.errors }, null, 2));
20
+ return;
21
+ }
22
+ if (allIssues.length === 0) {
23
+ console.log(chalk.green(`\n✓ No issues found across ${result.projects.length} project(s).`));
24
+ return;
25
+ }
26
+ const bySeverity = {
27
+ critical: allIssues.filter((i) => i.severity === "critical"),
28
+ high: allIssues.filter((i) => i.severity === "high"),
29
+ medium: allIssues.filter((i) => i.severity === "medium"),
30
+ low: allIssues.filter((i) => i.severity === "low"),
31
+ };
32
+ console.log(`\nFound ${chalk.bold(allIssues.length)} issue(s) across ${result.projects.length} project(s):\n`);
33
+ for (const [severity, issues] of Object.entries(bySeverity)) {
34
+ if (issues.length === 0)
35
+ continue;
36
+ console.log(chalk.bold(`${severity.toUpperCase()} (${issues.length})`));
37
+ for (const issue of issues) {
38
+ console.log(` ${chalk.dim(collapseHome(issue.project))}`);
39
+ console.log(` ${issue.message}`);
40
+ if (issue.rule)
41
+ console.log(` Rule: ${chalk.italic(issue.rule)}`);
42
+ }
43
+ console.log("");
44
+ }
45
+ }
46
+ //# sourceMappingURL=audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAyC;IAC1E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAA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shell: string): Promise<void>;
9
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkQH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASpE"}