ccperm 1.14.1 → 1.15.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/explain.js +12 -1
- package/package.json +1 -1
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)
|