feat: D24 fact intervals (--as-of) and bin/stack assistant helpers.
Store valid_from/valid_to on leafs and filter search by calendar day without overloading D16 source staleness; stack start/start-assistant wires brain + PicoClaw.
This commit is contained in:
@@ -5,10 +5,11 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/eSlider/2dph/internal/cli"
|
||||
"github.com/eSlider/2dph/internal/facts"
|
||||
"github.com/integrii/flaggy"
|
||||
)
|
||||
|
||||
const Usage = `usage: bin/brain/search.go "query" [--root facts|info] [--repo REPO] [-n N] [--hop N] [--json] [--no-web]
|
||||
const Usage = `usage: bin/brain/search.go "query" [--root facts|info] [--repo REPO] [-n N] [--hop N] [--as-of YYYY-MM-DD] [--json] [--no-web]
|
||||
bin/brain/search.go serve [port]
|
||||
bin/brain/search.go --list-model
|
||||
source <(./bin/cli/complete.go bash)`
|
||||
@@ -19,6 +20,7 @@ type Options struct {
|
||||
Repo string
|
||||
Limit int
|
||||
Hop int
|
||||
AsOf string
|
||||
JSONOut bool
|
||||
ListModel bool
|
||||
NoWeb bool
|
||||
@@ -35,6 +37,7 @@ func NewParser(opt *Options) *flaggy.Parser {
|
||||
p.String(&opt.Repo, "", "repo", "filter by repo")
|
||||
p.Int(&opt.Limit, "n", "n", "max hits")
|
||||
p.Int(&opt.Hop, "", "hop", "walk FROM_FILE depth 1-3")
|
||||
p.String(&opt.AsOf, "", "as-of", "keep facts active on YYYY-MM-DD (D24)")
|
||||
p.Bool(&opt.JSONOut, "", "json", "JSON output")
|
||||
p.Bool(&opt.NoWeb, "", "no-web", "stay local")
|
||||
p.Bool(&opt.ListModel, "", "list-model", "print embedding model")
|
||||
@@ -64,6 +67,13 @@ func ParseArgs(args []string) (Options, error) {
|
||||
if opt.Hop > 3 {
|
||||
return opt, fmt.Errorf("--hop max is 3 (File → Commit → Person)")
|
||||
}
|
||||
if opt.AsOf != "" {
|
||||
day := facts.NormalizeDay(opt.AsOf)
|
||||
if len(day) != 10 || day[4] != '-' || day[7] != '-' {
|
||||
return opt, fmt.Errorf("--as-of must be YYYY-MM-DD, got %q", opt.AsOf)
|
||||
}
|
||||
opt.AsOf = day
|
||||
}
|
||||
if opt.Query == "" && !opt.ListModel {
|
||||
return opt, fmt.Errorf("no query given")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user