@hasna/terminal 1.6.6 → 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/dist/cli.js +14 -10
- package/package.json +1 -1
- package/src/cli.tsx +15 -11
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);
|