package main

// Thin CLI wrapper around kjol/bundler. The bundler wires its own Go-native
// Solid JSX compiler (see bundler.Build), so this wrapper carries no build logic.

import (
	"flag"
	"fmt"
	"os"

	"kjol/bundler"
)

func main() {
	app := flag.String("app", "frontend", "App frontend source root (relative to cwd).")
	web := flag.String("web", "kjol/web", "Path to the kjol web tree (kit, runtime, icons, styles).")
	out := flag.String("out", "wwwroot", "Build output directory.")
	genGo := flag.String("gen-go", "internal/handlers", "Directory for generated Go files.")
	genTS := flag.String("gen-ts", "", "Directory for the generated TS icon registry (default <app>/src/ui/generated).")
	flag.Parse()

	cfg := bundler.Config{
		AppFrontend: *app,
		WebDir:      *web,
		Output:      *out,
		GenGoDir:    *genGo,
		GenTSDir:    *genTS,
	}
	if err := bundler.Build(cfg); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}