@hasna/terminal 1.2.0 → 1.2.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.
Files changed (3) hide show
  1. package/dist/ai.js +6 -0
  2. package/package.json +1 -1
  3. package/src/ai.ts +6 -0
package/dist/ai.js CHANGED
@@ -40,6 +40,9 @@ const IRREVERSIBLE_PATTERNS = [
40
40
  /\bkill\b/, /\bkillall\b/, /\bpkill\b/,
41
41
  // Git push/force operations
42
42
  /\bgit\s+push\b/, /\bgit\s+reset\s+--hard\b/, /\bgit\s+force\b/,
43
+ // Code modification / package installation (security risk)
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.*>/, /\bperl\s+-[pi]\b/,
43
46
  ];
44
47
  export function isIrreversible(command) {
45
48
  return IRREVERSIBLE_PATTERNS.some((r) => r.test(command));
@@ -160,6 +163,9 @@ RULES:
160
163
  - For text search in code, use grep -rn, NOT nm or objdump (those are for compiled binaries)
161
164
  - On macOS: for memory use vm_stat or top -l 1, for disk use df -h, for processes use ps aux
162
165
  - NEVER invent commands that don't exist. Stick to standard Unix/macOS commands.
166
+ - NEVER install packages (npx, npm install, pip install, brew install). This is a READ-ONLY terminal.
167
+ - NEVER modify source code (sed -i, codemod, awk with redirect). Only observe, never change.
168
+ - Search src/ directory, NOT dist/ or node_modules/ for code queries.
163
169
  cwd: ${process.cwd()}
164
170
  shell: zsh / macOS${projectContext}${restrictionBlock}${contextBlock}`;
165
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/terminal",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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
@@ -48,6 +48,9 @@ const IRREVERSIBLE_PATTERNS = [
48
48
  /\bkill\b/, /\bkillall\b/, /\bpkill\b/,
49
49
  // Git push/force operations
50
50
  /\bgit\s+push\b/, /\bgit\s+reset\s+--hard\b/, /\bgit\s+force\b/,
51
+ // Code modification / package installation (security risk)
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.*>/, /\bperl\s+-[pi]\b/,
51
54
  ];
52
55
 
53
56
  export function isIrreversible(command: string): boolean {
@@ -195,6 +198,9 @@ RULES:
195
198
  - For text search in code, use grep -rn, NOT nm or objdump (those are for compiled binaries)
196
199
  - On macOS: for memory use vm_stat or top -l 1, for disk use df -h, for processes use ps aux
197
200
  - NEVER invent commands that don't exist. Stick to standard Unix/macOS commands.
201
+ - NEVER install packages (npx, npm install, pip install, brew install). This is a READ-ONLY terminal.
202
+ - NEVER modify source code (sed -i, codemod, awk with redirect). Only observe, never change.
203
+ - Search src/ directory, NOT dist/ or node_modules/ for code queries.
198
204
  cwd: ${process.cwd()}
199
205
  shell: zsh / macOS${projectContext}${restrictionBlock}${contextBlock}`;
200
206
  }