Files
kb/client/cmd/root.go
T
steve 9aab79d49b v2 restructure: Go client, Docker engine, release tooling
- Remove v1 Python CLI (src/kb_search/, tests/, root pyproject.toml, uv.lock, .venv)
- Add Go client with cross-platform build (client/)
- Add FastAPI engine with NVIDIA and multi-stage ROCm Dockerfiles (engine/)
- Add VERSION files for client and engine, wired into builds
- Add release.sh for automated build, tag, release, and Docker push
- Update README with build/release docs and ROCm migration note
- Clean up .gitignore for v2 project structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 21:52:25 +00:00

47 lines
1.0 KiB
Go

package cmd
import (
"fmt"
"os"
"github.com/kb-search/kb/internal/config"
"github.com/spf13/cobra"
)
// Version is set at build time via -ldflags.
var Version = "dev"
var (
flagEngine string
flagFormat string
flagAPIKey string
)
var rootCmd = &cobra.Command{
Use: "kb",
Short: "kb-search CLI client",
Long: "A CLI client for the kb-search v2 engine API.",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if err := config.Load(); err != nil {
return err
}
config.ApplyFlags(flagEngine, flagFormat, flagAPIKey)
return nil
},
}
func init() {
rootCmd.Version = Version
rootCmd.PersistentFlags().StringVar(&flagEngine, "engine", "", "engine API URL")
rootCmd.PersistentFlags().StringVar(&flagFormat, "format", "", "output format (human|json)")
rootCmd.PersistentFlags().StringVar(&flagAPIKey, "api-key", "", "API key for authentication")
}
// Execute runs the root command.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}