ccperm 1.14.1 → 1.15.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/demo.gif +0 -0
- package/dist/cli.js +5 -2
- package/dist/explain.js +12 -1
- package/dist/interactive.js +8 -6
- package/package.json +1 -1
package/demo.gif
CHANGED
|
Binary file
|
package/dist/cli.js
CHANGED
|
@@ -93,8 +93,11 @@ async function main() {
|
|
|
93
93
|
console.log(` ${colors_js_1.GREEN}✔ No settings files found.${colors_js_1.NC}\n`);
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
const
|
|
96
|
+
const results0 = files.map(scanner_js_1.scanFile).filter((r) => r !== null);
|
|
97
|
+
const totalPerms = results0.reduce((sum, r) => sum + r.totalCount, 0);
|
|
98
|
+
const projects = new Set(results0.map(r => r.display.replace(/\/\.claude\/.*$/, ''))).size;
|
|
99
|
+
console.log(` ${colors_js_1.GREEN}✔${colors_js_1.NC} Found ${colors_js_1.CYAN}${files.length}${colors_js_1.NC} settings files · ${colors_js_1.CYAN}${projects}${colors_js_1.NC} projects · ${colors_js_1.CYAN}${totalPerms}${colors_js_1.NC} permissions\n`);
|
|
100
|
+
const results = results0;
|
|
98
101
|
if (args.includes('--hey-claude-witness-me')) {
|
|
99
102
|
console.log((0, advisor_js_1.analyze)(results));
|
|
100
103
|
return;
|
package/dist/explain.js
CHANGED
|
@@ -215,13 +215,24 @@ const TOOL_DESCRIPTIONS = {
|
|
|
215
215
|
'Grep': ['Search file contents', 'low'],
|
|
216
216
|
'WebSearch': ['Web search', 'low'],
|
|
217
217
|
};
|
|
218
|
+
// Shell keywords that are not real commands — skip to find the actual command
|
|
219
|
+
const SHELL_KEYWORDS = new Set([
|
|
220
|
+
'do', 'done', 'then', 'else', 'elif', 'fi', 'for', 'while', 'until',
|
|
221
|
+
'if', 'case', 'esac', 'in', 'select',
|
|
222
|
+
]);
|
|
218
223
|
// Extract first command word from a bash label
|
|
219
224
|
function extractCmd(label) {
|
|
220
225
|
const clean = label
|
|
221
226
|
.replace(/__NEW_LINE_[a-f0-9]+__\s*/, '')
|
|
222
227
|
.replace(/[:]\*.*$/, '')
|
|
223
228
|
.replace(/\s\*.*$/, '');
|
|
224
|
-
|
|
229
|
+
const words = clean.split(/[\s(]/);
|
|
230
|
+
// Skip shell keywords to find the real command
|
|
231
|
+
for (const w of words) {
|
|
232
|
+
if (w && !SHELL_KEYWORDS.has(w))
|
|
233
|
+
return w;
|
|
234
|
+
}
|
|
235
|
+
return words[0];
|
|
225
236
|
}
|
|
226
237
|
function explainBash(label) {
|
|
227
238
|
// Check critical patterns first (full string match)
|
package/dist/interactive.js
CHANGED
|
@@ -61,7 +61,11 @@ function boxBottom(hint, width) {
|
|
|
61
61
|
return `${colors_js_1.DIM}└${'─'.repeat(fill)}${hintPart}┘${colors_js_1.NC}`;
|
|
62
62
|
}
|
|
63
63
|
function boxBottom2(line1, line2, width) {
|
|
64
|
-
|
|
64
|
+
const inner = width - 2;
|
|
65
|
+
const hintPart = ` ${line1} `;
|
|
66
|
+
const fill = Math.max(0, inner - visLen(hintPart));
|
|
67
|
+
const top = `${colors_js_1.DIM}│${colors_js_1.NC}${' '.repeat(fill)}${hintPart}${colors_js_1.DIM}│${colors_js_1.NC}`;
|
|
68
|
+
return top + '\n' + boxBottom(line2, width);
|
|
65
69
|
}
|
|
66
70
|
function boxSep(width) {
|
|
67
71
|
return `${colors_js_1.DIM}├${'─'.repeat(width - 2)}┤${colors_js_1.NC}`;
|
|
@@ -445,15 +449,13 @@ function renderList(state, withPerms, emptyCount, riskMap, depMap, dupMap) {
|
|
|
445
449
|
legendParts.push(`${colors_js_1.DIM}†${colors_js_1.NC} deprecated`);
|
|
446
450
|
if (hasDup)
|
|
447
451
|
legendParts.push(`${colors_js_1.YELLOW}G${colors_js_1.NC} in global`);
|
|
452
|
+
const hint = '[↑↓] navigate [Enter] detail [/] search [q] quit';
|
|
448
453
|
if (legendParts.length > 0) {
|
|
449
454
|
const legendStr = legendParts.join(' ');
|
|
450
|
-
|
|
451
|
-
const padLeft = Math.max(0, w - 4 - legendVisLen);
|
|
452
|
-
lines.push(boxLine(`${' '.repeat(padLeft)}${legendStr}`, w));
|
|
453
|
-
lines.push(boxBottom('[↑↓] navigate [Enter] detail [/] search [q] quit', w));
|
|
455
|
+
lines.push(boxBottom2(legendStr, hint, w));
|
|
454
456
|
}
|
|
455
457
|
else {
|
|
456
|
-
lines.push(boxBottom(
|
|
458
|
+
lines.push(boxBottom(hint, w));
|
|
457
459
|
}
|
|
458
460
|
process.stdout.write(lines.join('\n') + '\n');
|
|
459
461
|
}
|