kronk-cli 0.6.0 → 0.6.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools.js +22 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kronk-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "A Claude-Code-style terminal agent for local models served by Kronk.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/tools.js CHANGED
@@ -561,13 +561,31 @@ export async function runTool(name, args, opts = {}) {
561
561
  // Went straight to ripgrep unchecked, so `search` with an absolute path
562
562
  // read anything on the machine while read_file was busy refusing to.
563
563
  const where = safe(args.path ?? '.');
564
+ // Both tools exit 1 to mean "nothing matched", which is an answer and
565
+ // not a failure. Reported as an error the model stops believing the
566
+ // tool, and spends its step budget re-phrasing and re-reading rather
567
+ // than using the fact it was just handed.
568
+ const NOTHING = '(no matches)';
564
569
  try {
565
570
  const { stdout } = await exec('rg', ['-n', '--no-heading', '-m', '200', args.pattern, where]);
566
- return clip(stdout) || '(no matches)';
571
+ return clip(stdout) || NOTHING;
567
572
  } catch (e) {
568
- if (e.code === 1) return '(no matches)';
569
- const { stdout } = await exec('grep', ['-rn', '-m', '200', args.pattern, where]);
570
- return clip(stdout) || '(no matches)';
573
+ if (e.code === 1) return NOTHING;
574
+ // No ripgrep on this machine, or it refused the pattern. grep is the
575
+ // floor, and it needs the same exit-1 reading the call above has —
576
+ // this is the branch CI never reaches, because its images ship rg.
577
+ try {
578
+ // -E because this tool advertises ripgrep-style patterns, and basic
579
+ // grep reads `a|b` as the three literal characters. -H because GNU
580
+ // grep drops the filename when it is given exactly one file, and
581
+ // this tool promises `file:line` prefixes — BSD grep prints them
582
+ // either way, which is why a macOS-only check would not see it.
583
+ const { stdout } = await exec('grep', ['-rn', '-H', '-E', '-m', '200', args.pattern, where]);
584
+ return clip(stdout) || NOTHING;
585
+ } catch (err) {
586
+ if (err.code === 1) return NOTHING;
587
+ throw err;
588
+ }
571
589
  }
572
590
  }
573
591