ccperm 1.3.2 → 1.3.3
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 +3 -2
- package/dist/scanner.js +38 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ const updater_js_1 = require("./updater.js");
|
|
|
12
12
|
const aggregator_js_1 = require("./aggregator.js");
|
|
13
13
|
const renderer_js_1 = require("./renderer.js");
|
|
14
14
|
const interactive_js_1 = require("./interactive.js");
|
|
15
|
-
const KNOWN_FLAGS = new Set(['--cwd', '--verbose', '--static', '--update', '--fix', '--help', '-h', '--version', '-v']);
|
|
15
|
+
const KNOWN_FLAGS = new Set(['--cwd', '--verbose', '--static', '--update', '--fix', '--debug', '--help', '-h', '--version', '-v']);
|
|
16
16
|
const HELP = `${colors_js_1.CYAN}ccperm${colors_js_1.NC} — Audit Claude Code permissions across projects
|
|
17
17
|
|
|
18
18
|
${colors_js_1.YELLOW}Usage:${colors_js_1.NC}
|
|
@@ -75,8 +75,9 @@ async function main() {
|
|
|
75
75
|
const countText = fileCount > 0 ? ` ${colors_js_1.BOLD}${fileCount}${colors_js_1.NC} found` : '';
|
|
76
76
|
process.stdout.write(`\r ${colors_js_1.CYAN}${frames[frame++ % frames.length]}${colors_js_1.NC} Scanning...${countText}`);
|
|
77
77
|
}, 80) : null;
|
|
78
|
+
const isDebug = args.includes('--debug');
|
|
78
79
|
const onProgress = (count) => { fileCount = count; };
|
|
79
|
-
const files = await (0, scanner_js_1.findSettingsFiles)(searchDir, onProgress);
|
|
80
|
+
const files = await (0, scanner_js_1.findSettingsFiles)(searchDir, onProgress, isDebug);
|
|
80
81
|
if (spinner) {
|
|
81
82
|
clearInterval(spinner);
|
|
82
83
|
process.stdout.write('\r\x1b[K');
|
package/dist/scanner.js
CHANGED
|
@@ -36,19 +36,37 @@ function isWritable(f) {
|
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function findSettingsFiles(searchDir, onProgress) {
|
|
40
|
-
const prune = [
|
|
41
|
-
|
|
42
|
-
'
|
|
39
|
+
function findSettingsFiles(searchDir, onProgress, debug = false) {
|
|
40
|
+
const prune = [
|
|
41
|
+
// common
|
|
42
|
+
'node_modules', '.git', '.cache', '.local', '.npm', '.nvm', '.bun',
|
|
43
|
+
'.vscode', '.docker', '.cargo', '.rustup', 'go', '.gradle', '.m2',
|
|
44
|
+
'.Trash', 'Pictures', 'Music', 'Videos', 'Downloads',
|
|
45
|
+
// linux
|
|
46
|
+
'snap', '.snap',
|
|
47
|
+
// macOS
|
|
48
|
+
'Library', 'Applications', '.Spotlight-V100', '.fseventsd',
|
|
49
|
+
'Movies', 'Photos', '.iCloud',
|
|
50
|
+
];
|
|
43
51
|
const pruneArgs = prune.flatMap((d) => ['-name', d, '-o']).slice(0, -1);
|
|
52
|
+
const findArgs = [
|
|
53
|
+
searchDir,
|
|
54
|
+
'(', ...pruneArgs, ')', '-prune',
|
|
55
|
+
'-o', '-path', '*/.claude/settings*.json', '-type', 'f', '-print',
|
|
56
|
+
];
|
|
57
|
+
if (debug) {
|
|
58
|
+
console.error(`\n [debug] find ${findArgs.join(' ')}`);
|
|
59
|
+
console.error(` [debug] prune: ${prune.join(', ')}`);
|
|
60
|
+
}
|
|
61
|
+
const t0 = Date.now();
|
|
44
62
|
return new Promise((resolve) => {
|
|
45
63
|
const results = [];
|
|
46
64
|
let buf = '';
|
|
47
|
-
const child = (0, node_child_process_1.execFile)('find',
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
const child = (0, node_child_process_1.execFile)('find', findArgs, { encoding: 'utf8', timeout: 30000 });
|
|
66
|
+
child.stderr?.on('data', (chunk) => {
|
|
67
|
+
if (debug)
|
|
68
|
+
process.stderr.write(` [debug] stderr: ${chunk}`);
|
|
69
|
+
});
|
|
52
70
|
child.stdout?.on('data', (chunk) => {
|
|
53
71
|
buf += chunk;
|
|
54
72
|
const lines = buf.split('\n');
|
|
@@ -59,13 +77,22 @@ function findSettingsFiles(searchDir, onProgress) {
|
|
|
59
77
|
}
|
|
60
78
|
onProgress?.(results.length);
|
|
61
79
|
});
|
|
62
|
-
child.on('close', () => {
|
|
80
|
+
child.on('close', (code) => {
|
|
63
81
|
if (buf && isWritable(buf))
|
|
64
82
|
results.push(buf);
|
|
65
83
|
onProgress?.(results.length);
|
|
84
|
+
if (debug) {
|
|
85
|
+
console.error(` [debug] find exited with code ${code} in ${Date.now() - t0}ms`);
|
|
86
|
+
console.error(` [debug] found ${results.length} files`);
|
|
87
|
+
results.forEach((f) => console.error(` [debug] ${f}`));
|
|
88
|
+
}
|
|
89
|
+
resolve(results);
|
|
90
|
+
});
|
|
91
|
+
child.on('error', (err) => {
|
|
92
|
+
if (debug)
|
|
93
|
+
console.error(` [debug] find error: ${err.message}`);
|
|
66
94
|
resolve(results);
|
|
67
95
|
});
|
|
68
|
-
child.on('error', () => resolve(results));
|
|
69
96
|
});
|
|
70
97
|
}
|
|
71
98
|
function scanFile(filePath) {
|