ccperm 1.1.1 → 1.2.1

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/dist/cli.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const node_os_1 = __importDefault(require("node:os"));
7
+ const node_child_process_1 = require("node:child_process");
7
8
  const colors_js_1 = require("./colors.js");
8
9
  const scanner_js_1 = require("./scanner.js");
9
10
  const fixer_js_1 = require("./fixer.js");
@@ -11,6 +12,7 @@ const updater_js_1 = require("./updater.js");
11
12
  const aggregator_js_1 = require("./aggregator.js");
12
13
  const renderer_js_1 = require("./renderer.js");
13
14
  const interactive_js_1 = require("./interactive.js");
15
+ const KNOWN_FLAGS = new Set(['--cwd', '--verbose', '--static', '--fix', '--update', '--help', '-h', '--version', '-v']);
14
16
  const HELP = `${colors_js_1.CYAN}ccperm${colors_js_1.NC} — Audit Claude Code permissions across projects
15
17
 
16
18
  ${colors_js_1.YELLOW}Usage:${colors_js_1.NC}
@@ -21,6 +23,7 @@ ${colors_js_1.YELLOW}Options:${colors_js_1.NC}
21
23
  --cwd Scan current directory only (default: all)
22
24
  --verbose Show all permissions per project (static)
23
25
  --static Force static output (default in non-TTY)
26
+ --update Update ccperm to latest version
24
27
  --help, -h Show this help
25
28
  --version, -v Show version
26
29
 
@@ -37,6 +40,23 @@ async function main() {
37
40
  console.log((0, updater_js_1.getVersion)());
38
41
  return;
39
42
  }
43
+ if (args.includes('--update')) {
44
+ console.log(` Updating ccperm...\n`);
45
+ try {
46
+ (0, node_child_process_1.execFileSync)('npm', ['install', '-g', 'ccperm@latest'], { stdio: 'inherit' });
47
+ }
48
+ catch {
49
+ console.error(`\n ${colors_js_1.RED}Update failed. Try manually: npm install -g ccperm@latest${colors_js_1.NC}\n`);
50
+ process.exit(1);
51
+ }
52
+ return;
53
+ }
54
+ const unknown = args.filter((a) => !KNOWN_FLAGS.has(a));
55
+ if (unknown.length > 0) {
56
+ console.error(` ${colors_js_1.RED}Unknown option: ${unknown.join(', ')}${colors_js_1.NC}\n`);
57
+ console.log(HELP);
58
+ process.exit(1);
59
+ }
40
60
  const isCwd = args.includes('--cwd');
41
61
  const isFix = args.includes('--fix');
42
62
  const isVerbose = args.includes('--verbose');
@@ -44,7 +64,17 @@ async function main() {
44
64
  console.log(`\n ${colors_js_1.CYAN}${colors_js_1.BOLD}ccperm${colors_js_1.NC} ${colors_js_1.DIM}v${(0, updater_js_1.getVersion)()}${colors_js_1.NC} — Claude Code Permission Audit\n`);
45
65
  const searchDir = isCwd ? process.cwd() : node_os_1.default.homedir();
46
66
  console.log(` Scope: ${colors_js_1.YELLOW}${isCwd ? searchDir : '~ (all projects)'}${colors_js_1.NC}`);
47
- const files = (0, scanner_js_1.findSettingsFiles)(searchDir);
67
+ const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
68
+ let frame = 0;
69
+ const isTTY = process.stdout.isTTY;
70
+ const spinner = isTTY ? setInterval(() => {
71
+ process.stdout.write(`\r ${colors_js_1.CYAN}${frames[frame++ % frames.length]}${colors_js_1.NC} Scanning...`);
72
+ }, 80) : null;
73
+ const files = await (0, scanner_js_1.findSettingsFiles)(searchDir);
74
+ if (spinner) {
75
+ clearInterval(spinner);
76
+ process.stdout.write('\r\x1b[K');
77
+ }
48
78
  if (files.length === 0) {
49
79
  console.log(` ${colors_js_1.GREEN}✔ No settings files found.${colors_js_1.NC}\n`);
50
80
  return;
package/dist/scanner.js CHANGED
@@ -17,30 +17,24 @@ function findSettingsFiles(searchDir) {
17
17
  'snap', '.vscode', '.docker', '.cargo', '.rustup', 'go', '.gradle', '.m2',
18
18
  'Library', '.Trash', 'Pictures', 'Music', 'Videos', 'Downloads'];
19
19
  const pruneArgs = prune.flatMap((d) => ['-name', d, '-o']).slice(0, -1);
20
- let lines;
21
- try {
22
- const out = (0, node_child_process_1.execFileSync)('find', [
20
+ return new Promise((resolve) => {
21
+ (0, node_child_process_1.execFile)('find', [
23
22
  searchDir,
24
23
  '(', ...pruneArgs, ')', '-prune',
25
24
  '-o', '-path', '*/.claude/settings*.json', '-type', 'f', '-print',
26
- ], {
27
- encoding: 'utf8',
28
- stdio: ['pipe', 'pipe', 'pipe'],
29
- timeout: 10000,
25
+ ], { encoding: 'utf8', timeout: 15000 }, (err, stdout) => {
26
+ const out = (stdout || err?.stdout || '').trim();
27
+ const lines = out ? out.split('\n').filter(Boolean) : [];
28
+ resolve(lines.filter((f) => {
29
+ try {
30
+ node_fs_1.default.accessSync(f, node_fs_1.default.constants.W_OK);
31
+ return true;
32
+ }
33
+ catch {
34
+ return false;
35
+ }
36
+ }));
30
37
  });
31
- lines = out.trim().split('\n').filter(Boolean);
32
- }
33
- catch (e) {
34
- lines = (e.stdout || '').trim().split('\n').filter(Boolean);
35
- }
36
- return lines.filter((f) => {
37
- try {
38
- node_fs_1.default.accessSync(f, node_fs_1.default.constants.W_OK);
39
- return true;
40
- }
41
- catch {
42
- return false;
43
- }
44
38
  });
45
39
  }
46
40
  function scanFile(filePath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccperm",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "Audit Claude Code permissions across all your projects",
5
5
  "bin": {
6
6
  "ccperm": "bin/ccperm.js"