ccperm 1.9.4 → 1.9.6
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/interactive.js +22 -6
- package/dist/renderer.js +1 -1
- package/package.json +1 -1
package/dist/interactive.js
CHANGED
|
@@ -7,6 +7,21 @@ exports.startInteractive = startInteractive;
|
|
|
7
7
|
const node_readline_1 = __importDefault(require("node:readline"));
|
|
8
8
|
const colors_js_1 = require("./colors.js");
|
|
9
9
|
const explain_js_1 = require("./explain.js");
|
|
10
|
+
// Clean up messy bash permission labels for display
|
|
11
|
+
function cleanLabel(label) {
|
|
12
|
+
let s = label;
|
|
13
|
+
// Strip __NEW_LINE_hash__ prefix
|
|
14
|
+
s = s.replace(/^__NEW_LINE_[a-f0-9]+__\s*/, '');
|
|
15
|
+
// Truncate heredoc content: "python3 << 'EOF'\nimport..." → "python3 (heredoc)"
|
|
16
|
+
if (s.includes('<<'))
|
|
17
|
+
s = s.replace(/\s*<<\s*['"]?\w+['"]?.*$/, ' (heredoc)');
|
|
18
|
+
// Truncate inline scripts with \n
|
|
19
|
+
if (s.includes('\\n'))
|
|
20
|
+
s = s.replace(/\\n.*$/, '…');
|
|
21
|
+
// Strip :* and trailing * suffix
|
|
22
|
+
s = s.replace(/:\*$/, ' *');
|
|
23
|
+
return s;
|
|
24
|
+
}
|
|
10
25
|
// strip ANSI escape codes for visible length
|
|
11
26
|
function visLen(s) {
|
|
12
27
|
return s.replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
@@ -143,7 +158,7 @@ function renderList(state, withPerms, emptyCount) {
|
|
|
143
158
|
const truncName = r.shortName.length > nameWidth ? r.shortName.slice(0, nameWidth - 1) + '…' : r.shortName;
|
|
144
159
|
const typeTag = r.isGlobal ? pad('', 7) : `${colors_js_1.DIM} ${pad(r.fileType, 6)}${colors_js_1.NC}`;
|
|
145
160
|
const marker = isCursor ? `${colors_js_1.CYAN}▸ ` : ' ';
|
|
146
|
-
const nameStyle = isCursor ? `${colors_js_1.BOLD}` :
|
|
161
|
+
const nameStyle = isCursor ? `${colors_js_1.BOLD}` : '';
|
|
147
162
|
const nameCol = `${marker}${nameStyle}${pad(truncName, nameWidth)}${colors_js_1.NC}${typeTag}`;
|
|
148
163
|
const catCols = catsPresent.map((c) => {
|
|
149
164
|
const count = r.groups.get(c) || 0;
|
|
@@ -183,18 +198,19 @@ function renderDetail(state, withPerms, results) {
|
|
|
183
198
|
navRows.push({ text: `${colors_js_1.YELLOW}${arrow} ${group.category}${colors_js_1.NC} ${colors_js_1.DIM}(${group.items.length})${colors_js_1.NC}`, key });
|
|
184
199
|
if (isOpen) {
|
|
185
200
|
for (const item of group.items) {
|
|
201
|
+
const clean = cleanLabel(item.name);
|
|
186
202
|
if (state.showInfo) {
|
|
187
203
|
const info = (0, explain_js_1.explain)(group.category, item.name);
|
|
188
204
|
const riskColor = info.risk === 'red' ? colors_js_1.RED : info.risk === 'yellow' ? colors_js_1.YELLOW : colors_js_1.GREEN;
|
|
189
205
|
const dot = `${riskColor}●${colors_js_1.NC}`;
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
navRows.push({ text: ` ${dot} ${name}${desc}`, perm: item.name });
|
|
206
|
+
const nameMax = Math.min(35, w - 10);
|
|
207
|
+
const name = clean.length > nameMax ? clean.slice(0, nameMax - 1) + '…' : clean;
|
|
208
|
+
const desc = info.description ? `${colors_js_1.DIM}${info.description}${colors_js_1.NC}` : '';
|
|
209
|
+
navRows.push({ text: ` ${dot} ${pad(name, nameMax)} ${desc}`, perm: item.name });
|
|
194
210
|
}
|
|
195
211
|
else {
|
|
196
212
|
const maxLen = w - 8;
|
|
197
|
-
const name =
|
|
213
|
+
const name = clean.length > maxLen ? clean.slice(0, maxLen - 1) + '…' : clean;
|
|
198
214
|
navRows.push({ text: ` ${colors_js_1.DIM}${name}${colors_js_1.NC}`, perm: item.name });
|
|
199
215
|
}
|
|
200
216
|
}
|
package/dist/renderer.js
CHANGED
|
@@ -29,7 +29,7 @@ function printCompact(entries, summary) {
|
|
|
29
29
|
const result = withPerms[i];
|
|
30
30
|
const truncName = result.shortName.length > nameWidth ? result.shortName.slice(0, nameWidth - 1) + '…' : result.shortName;
|
|
31
31
|
const typeTag = result.isGlobal ? pad('', 7) : `${colors_js_1.DIM} ${pad(result.fileType, 6)}${colors_js_1.NC}`;
|
|
32
|
-
const nameStyle =
|
|
32
|
+
const nameStyle = '';
|
|
33
33
|
const nameCol = ` ${nameStyle}${pad(truncName, nameWidth)}${colors_js_1.NC}${typeTag}`;
|
|
34
34
|
const catCols = catsPresent.map((c) => {
|
|
35
35
|
const count = result.groups.get(c) || 0;
|