feat: bootstrap goaichat CLI and config system

This commit is contained in:
2025-10-01 14:47:32 +02:00
parent 12a65231ef
commit 0fd24a5cfb
14 changed files with 1082 additions and 3 deletions

34
cmd/goaichat/main.go Normal file
View File

@@ -0,0 +1,34 @@
package main
import (
"context"
"flag"
"log/slog"
"os"
"github.com/stig/goaichat/internal/app"
"github.com/stig/goaichat/internal/config"
)
func main() {
var configPath string
flag.StringVar(&configPath, "config", "", "Path to configuration file")
flag.Parse()
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelInfo}))
cfg, err := config.Load(configPath)
if err != nil {
logger.Error("failed to load configuration", "error", err)
os.Exit(1)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
application := app.New(logger, cfg)
if err := application.Run(ctx); err != nil {
logger.Error("application terminated with error", "error", err)
os.Exit(1)
}
}