@hasna/terminal 1.6.3 → 1.6.5
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/ai.js +4 -1
- package/package.json +1 -1
- package/src/ai.ts +4 -1
package/dist/ai.js
CHANGED
|
@@ -42,7 +42,7 @@ const IRREVERSIBLE_PATTERNS = [
|
|
|
42
42
|
/\bgit\s+push\b/, /\bgit\s+reset\s+--hard\b/, /\bgit\s+force\b/,
|
|
43
43
|
// Code modification / package installation (security risk)
|
|
44
44
|
/\bnpx\s+\S+/, /\bnpm\s+install\b/, /\bbun\s+add\b/, /\bpip\s+install\b/,
|
|
45
|
-
/\bcodemod\b/, /\bsed\s+-i\b/, /\bawk\s
|
|
45
|
+
/\bcodemod\b/, /\bsed\s+-i\b/, /\bawk\s.*>\s*\S+\.\w+/, /\bperl\s+-[pi]\b/,
|
|
46
46
|
// File creation/modification (READ-ONLY terminal)
|
|
47
47
|
/\btouch\b/, /\bmkdir\b/, /\becho\s.*>/, /\btee\b/, /\bcp\b/, /\bmv\b/,
|
|
48
48
|
];
|
|
@@ -54,6 +54,9 @@ const SAFE_OVERRIDES = [
|
|
|
54
54
|
/\bfind\b.*-exec\s+(wc|cat|head|tail|grep|stat|file|du|ls)\b/,
|
|
55
55
|
// find without -exec is always safe
|
|
56
56
|
/^\s*find\b(?!.*-exec\s+(rm|mv|chmod|chown|sed))/,
|
|
57
|
+
// xargs with read-only tools is safe
|
|
58
|
+
/\bxargs\s+(wc|cat|head|tail|grep|stat|file|du|ls|git\s+log|git\s+show|git\s+blame)\b/,
|
|
59
|
+
/\bxargs\s+-I\s*\S+\s+(wc|cat|head|tail|grep|stat|git)\b/,
|
|
57
60
|
];
|
|
58
61
|
export function isIrreversible(command) {
|
|
59
62
|
// Safe overrides take priority
|
package/package.json
CHANGED
package/src/ai.ts
CHANGED
|
@@ -50,7 +50,7 @@ const IRREVERSIBLE_PATTERNS = [
|
|
|
50
50
|
/\bgit\s+push\b/, /\bgit\s+reset\s+--hard\b/, /\bgit\s+force\b/,
|
|
51
51
|
// Code modification / package installation (security risk)
|
|
52
52
|
/\bnpx\s+\S+/, /\bnpm\s+install\b/, /\bbun\s+add\b/, /\bpip\s+install\b/,
|
|
53
|
-
/\bcodemod\b/, /\bsed\s+-i\b/, /\bawk\s
|
|
53
|
+
/\bcodemod\b/, /\bsed\s+-i\b/, /\bawk\s.*>\s*\S+\.\w+/, /\bperl\s+-[pi]\b/,
|
|
54
54
|
// File creation/modification (READ-ONLY terminal)
|
|
55
55
|
/\btouch\b/, /\bmkdir\b/, /\becho\s.*>/, /\btee\b/, /\bcp\b/, /\bmv\b/,
|
|
56
56
|
];
|
|
@@ -63,6 +63,9 @@ const SAFE_OVERRIDES = [
|
|
|
63
63
|
/\bfind\b.*-exec\s+(wc|cat|head|tail|grep|stat|file|du|ls)\b/,
|
|
64
64
|
// find without -exec is always safe
|
|
65
65
|
/^\s*find\b(?!.*-exec\s+(rm|mv|chmod|chown|sed))/,
|
|
66
|
+
// xargs with read-only tools is safe
|
|
67
|
+
/\bxargs\s+(wc|cat|head|tail|grep|stat|file|du|ls|git\s+log|git\s+show|git\s+blame)\b/,
|
|
68
|
+
/\bxargs\s+-I\s*\S+\s+(wc|cat|head|tail|grep|stat|git)\b/,
|
|
66
69
|
];
|
|
67
70
|
|
|
68
71
|
export function isIrreversible(command: string): boolean {
|