Add grep and server read/write/edit tools for agents

This commit is contained in:
Ian Gulliver
2026-10-20 20:22:54 -07:00
parent 35f59246f7
commit 6ec3cafde5
9 changed files with 717 additions and 66 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"context"
"flag"
"fmt"
"g.fc.run/ai/byre/internal/grep"
)
func grepCmd(args []string) {
fs := flag.NewFlagSet("grep", flag.ExitOnError)
opts := grep.Options{}
fs.StringVar(&opts.Glob, "glob", "", "search only files whose names match this glob")
fs.BoolVar(&opts.IgnoreCase, "ignore-case", false, "match case-insensitively")
fs.BoolVar(&opts.FilesOnly, "files-only", false, "list matching files, not lines")
fs.Parse(args)
if fs.NArg() != 2 {
usage()
}
out, err := grep.Search(context.Background(), fs.Arg(0), "", fs.Arg(1), opts)
if err != nil {
fatal("grep failed", "err", err)
}
fmt.Print(out)
}
+3 -1
View File
@@ -22,13 +22,15 @@ func main() {
runCmd(os.Args[2:])
case "signing":
signingCmd(os.Args[2:])
case "grep":
grepCmd(os.Args[2:])
default:
usage()
}
}
func usage() {
fmt.Fprintln(os.Stderr, "usage: byre serve | byre install | byre check | byre run [--resume ID] | byre signing CHECKOUT")
fmt.Fprintln(os.Stderr, "usage: byre serve | byre install | byre check | byre run [--resume ID] | byre signing CHECKOUT | byre grep [--glob GLOB] [--ignore-case] [--files-only] PATTERN PATH")
os.Exit(2)
}