@hasna/terminal 1.2.1 → 1.2.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 +5 -3
  2. package/package.json +1 -1
  3. package/src/ai.ts +5 -3
package/dist/ai.js CHANGED
@@ -109,12 +109,12 @@ function detectProjectContext() {
109
109
  // Top-level dirs
110
110
  const topLevel = execSync("ls -1", { cwd, encoding: "utf8", timeout: 2000 }).trim();
111
111
  parts.push(`Top-level: ${topLevel.split("\n").join(", ")}`);
112
- // src/ structure (2 levels deep, most important for path resolution)
112
+ // src/ structure include FILES so AI knows exact filenames + extensions
113
113
  for (const srcDir of ["src", "lib", "app"]) {
114
114
  if (existsSync(join(cwd, srcDir))) {
115
- const tree = execSync(`find ${srcDir} -maxdepth 2 -type d -not -path '*/node_modules/*' 2>/dev/null | head -30`, { cwd, encoding: "utf8", timeout: 2000 }).trim();
115
+ const tree = execSync(`find ${srcDir} -maxdepth 3 -not -path '*/node_modules/*' -not -path '*/dist/*' -not -name '*.test.*' -not -name '*.spec.*' 2>/dev/null | sort | head -60`, { cwd, encoding: "utf8", timeout: 2000 }).trim();
116
116
  if (tree)
117
- parts.push(`Directories in ${srcDir}/:\n${tree}`);
117
+ parts.push(`Files in ${srcDir}/:\n${tree}`);
118
118
  break;
119
119
  }
120
120
  }
@@ -166,6 +166,8 @@ RULES:
166
166
  - NEVER install packages (npx, npm install, pip install, brew install). This is a READ-ONLY terminal.
167
167
  - NEVER modify source code (sed -i, codemod, awk with redirect). Only observe, never change.
168
168
  - Search src/ directory, NOT dist/ or node_modules/ for code queries.
169
+ - For compound questions ("how many X and are they Y"), prefer ONE command that captures all info. Do NOT chain with &&.
170
+ - Use exact file paths from the project context below. Do NOT guess paths.
169
171
  cwd: ${process.cwd()}
170
172
  shell: zsh / macOS${projectContext}${restrictionBlock}${contextBlock}`;
171
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/terminal",
3
- "version": "1.2.1",
3
+ "version": "1.2.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
@@ -138,14 +138,14 @@ function detectProjectContext(): string {
138
138
  const topLevel = execSync("ls -1", { cwd, encoding: "utf8", timeout: 2000 }).trim();
139
139
  parts.push(`Top-level: ${topLevel.split("\n").join(", ")}`);
140
140
 
141
- // src/ structure (2 levels deep, most important for path resolution)
141
+ // src/ structure include FILES so AI knows exact filenames + extensions
142
142
  for (const srcDir of ["src", "lib", "app"]) {
143
143
  if (existsSync(join(cwd, srcDir))) {
144
144
  const tree = execSync(
145
- `find ${srcDir} -maxdepth 2 -type d -not -path '*/node_modules/*' 2>/dev/null | head -30`,
145
+ `find ${srcDir} -maxdepth 3 -not -path '*/node_modules/*' -not -path '*/dist/*' -not -name '*.test.*' -not -name '*.spec.*' 2>/dev/null | sort | head -60`,
146
146
  { cwd, encoding: "utf8", timeout: 2000 }
147
147
  ).trim();
148
- if (tree) parts.push(`Directories in ${srcDir}/:\n${tree}`);
148
+ if (tree) parts.push(`Files in ${srcDir}/:\n${tree}`);
149
149
  break;
150
150
  }
151
151
  }
@@ -201,6 +201,8 @@ RULES:
201
201
  - NEVER install packages (npx, npm install, pip install, brew install). This is a READ-ONLY terminal.
202
202
  - NEVER modify source code (sed -i, codemod, awk with redirect). Only observe, never change.
203
203
  - Search src/ directory, NOT dist/ or node_modules/ for code queries.
204
+ - For compound questions ("how many X and are they Y"), prefer ONE command that captures all info. Do NOT chain with &&.
205
+ - Use exact file paths from the project context below. Do NOT guess paths.
204
206
  cwd: ${process.cwd()}
205
207
  shell: zsh / macOS${projectContext}${restrictionBlock}${contextBlock}`;
206
208
  }