ccperm 1.1.1 → 1.2.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.
- package/dist/cli.js +20 -0
- package/package.json +1 -1
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');
|