@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.
- package/dist/ai.js +5 -3
- package/package.json +1 -1
- 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
|
|
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
|
|
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(`
|
|
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
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
|
|
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
|
|
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(`
|
|
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
|
}
|