@hasna/terminal 1.6.1 → 1.6.2

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.
Files changed (3) hide show
  1. package/dist/ai.js +4 -0
  2. package/package.json +1 -1
  3. package/src/ai.ts +4 -0
package/dist/ai.js CHANGED
@@ -50,6 +50,10 @@ const IRREVERSIBLE_PATTERNS = [
50
50
  const SAFE_OVERRIDES = [
51
51
  /^\s*git\s+(log|show|diff|branch|status|blame|tag|remote|stash\s+list)\b/,
52
52
  /^\s*git\s+log\b/,
53
+ // find -exec with read-only tools is safe
54
+ /\bfind\b.*-exec\s+(wc|cat|head|tail|grep|stat|file|du|ls)\b/,
55
+ // find without -exec is always safe
56
+ /^\s*find\b(?!.*-exec\s+(rm|mv|chmod|chown|sed))/,
53
57
  ];
54
58
  export function isIrreversible(command) {
55
59
  // Safe overrides take priority
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/terminal",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Smart terminal wrapper for AI agents and humans — structured output, token compression, MCP server, natural language",
5
5
  "type": "module",
6
6
  "bin": {
package/src/ai.ts CHANGED
@@ -59,6 +59,10 @@ const IRREVERSIBLE_PATTERNS = [
59
59
  const SAFE_OVERRIDES = [
60
60
  /^\s*git\s+(log|show|diff|branch|status|blame|tag|remote|stash\s+list)\b/,
61
61
  /^\s*git\s+log\b/,
62
+ // find -exec with read-only tools is safe
63
+ /\bfind\b.*-exec\s+(wc|cat|head|tail|grep|stat|file|du|ls)\b/,
64
+ // find without -exec is always safe
65
+ /^\s*find\b(?!.*-exec\s+(rm|mv|chmod|chown|sed))/,
62
66
  ];
63
67
 
64
68
  export function isIrreversible(command: string): boolean {