@hasna/terminal 1.6.5 → 1.6.7
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/README.md +35 -3
- package/dist/cli.js +14 -10
- package/package.json +1 -1
- package/src/cli.tsx +15 -11
package/README.md
CHANGED
|
@@ -183,12 +183,44 @@ Every command through `terminal exec` goes through:
|
|
|
183
183
|
6. **Structured Parsing** — JSON instead of text
|
|
184
184
|
- Git status/log, test results, build output, npm install, errors
|
|
185
185
|
|
|
186
|
+
## Best Practices for 95%+ Reliability
|
|
187
|
+
|
|
188
|
+
Tested across 149 queries by 3 independent agents on 3 different repos:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Session start (100% reliable)
|
|
192
|
+
terminal repo # Git status + recent commits
|
|
193
|
+
terminal "ls packages/" # Package overview (monorepo)
|
|
194
|
+
terminal symbols src/main.ts # Key file structure
|
|
195
|
+
|
|
196
|
+
# Code exploration (use path hints!)
|
|
197
|
+
terminal "in src/lib, what functions are exported" # Path hint = 80%+ reliability
|
|
198
|
+
terminal "grep -rn 'pattern' src/" # Command passthrough works too
|
|
199
|
+
terminal symbols src/db/tasks.ts # 100% reliable on valid files
|
|
200
|
+
|
|
201
|
+
# Git queries (100% reliable, any phrasing)
|
|
202
|
+
terminal "what changed in the last 3 commits"
|
|
203
|
+
terminal "who made the most recent change"
|
|
204
|
+
|
|
205
|
+
# System queries (100% reliable)
|
|
206
|
+
terminal "how many typescript files"
|
|
207
|
+
terminal "what testing framework is used"
|
|
208
|
+
terminal "show me the package.json scripts"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Key rules:**
|
|
212
|
+
- Include package/directory paths in your query for best results
|
|
213
|
+
- Use `terminal symbols <file>` for file outlines (100% reliable)
|
|
214
|
+
- Use `terminal repo` at session start (replaces 3 git commands)
|
|
215
|
+
- For literal commands: `terminal "grep -rn pattern src/"` works with answer framing
|
|
216
|
+
- Git and system queries work with any phrasing
|
|
217
|
+
|
|
186
218
|
## CLI Commands
|
|
187
219
|
|
|
188
220
|
```
|
|
189
|
-
terminal
|
|
190
|
-
terminal
|
|
191
|
-
terminal repo Git
|
|
221
|
+
terminal "your request" NL → AI runs command → smart answer
|
|
222
|
+
terminal Launch interactive NL terminal (TUI)
|
|
223
|
+
terminal repo Git status + diff + log in one call
|
|
192
224
|
terminal symbols <file> File outline (functions, classes, exports)
|
|
193
225
|
terminal stats Token economy dashboard
|
|
194
226
|
terminal sessions List recent sessions
|
package/dist/cli.js
CHANGED
|
@@ -421,20 +421,24 @@ else if (args.length > 0) {
|
|
|
421
421
|
command = await translateToCommand(prompt, perms, []);
|
|
422
422
|
}
|
|
423
423
|
catch (e) {
|
|
424
|
-
// If BLOCKED, try
|
|
424
|
+
// If BLOCKED, try README fallback ONLY for conceptual questions (not file access)
|
|
425
425
|
if (e.message?.startsWith("BLOCKED:")) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
if (
|
|
432
|
-
|
|
433
|
-
|
|
426
|
+
const isConceptual = /\b(explain|why|what does|how does|describe|architecture|overview|summary)\b/i.test(prompt);
|
|
427
|
+
const isFileAccess = /\b(cat|show|read|find|ls|list)\b.*\b(\.\w+\/|src\/|packages\/)/i.test(prompt);
|
|
428
|
+
if (isConceptual && !isFileAccess) {
|
|
429
|
+
try {
|
|
430
|
+
const { existsSync, readFileSync } = await import("fs");
|
|
431
|
+
if (existsSync("README.md")) {
|
|
432
|
+
const readme = readFileSync("README.md", "utf8").slice(0, 3000);
|
|
433
|
+
const processed = await processOutput("cat README.md", readme, prompt);
|
|
434
|
+
if (processed.aiProcessed) {
|
|
435
|
+
console.log(processed.summary);
|
|
436
|
+
process.exit(0);
|
|
437
|
+
}
|
|
434
438
|
}
|
|
435
439
|
}
|
|
440
|
+
catch { }
|
|
436
441
|
}
|
|
437
|
-
catch { }
|
|
438
442
|
}
|
|
439
443
|
console.error(e.message);
|
|
440
444
|
process.exit(1);
|
package/package.json
CHANGED
package/src/cli.tsx
CHANGED
|
@@ -402,19 +402,23 @@ else if (args.length > 0) {
|
|
|
402
402
|
try {
|
|
403
403
|
command = await translateToCommand(prompt, perms, []);
|
|
404
404
|
} catch (e: any) {
|
|
405
|
-
// If BLOCKED, try
|
|
405
|
+
// If BLOCKED, try README fallback ONLY for conceptual questions (not file access)
|
|
406
406
|
if (e.message?.startsWith("BLOCKED:")) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
|
|
407
|
+
const isConceptual = /\b(explain|why|what does|how does|describe|architecture|overview|summary)\b/i.test(prompt);
|
|
408
|
+
const isFileAccess = /\b(cat|show|read|find|ls|list)\b.*\b(\.\w+\/|src\/|packages\/)/i.test(prompt);
|
|
409
|
+
if (isConceptual && !isFileAccess) {
|
|
410
|
+
try {
|
|
411
|
+
const { existsSync, readFileSync } = await import("fs");
|
|
412
|
+
if (existsSync("README.md")) {
|
|
413
|
+
const readme = readFileSync("README.md", "utf8").slice(0, 3000);
|
|
414
|
+
const processed = await processOutput("cat README.md", readme, prompt);
|
|
415
|
+
if (processed.aiProcessed) {
|
|
416
|
+
console.log(processed.summary);
|
|
417
|
+
process.exit(0);
|
|
418
|
+
}
|
|
415
419
|
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
420
|
+
} catch {}
|
|
421
|
+
}
|
|
418
422
|
}
|
|
419
423
|
console.error(e.message);
|
|
420
424
|
process.exit(1);
|