LEM/cmd/lemcmd/lem.go
Snider 061dd4cedd feat: wire 'lem setup --data' CLI command
Register setup group with data subcommand that hydrates cold
compressed JSONL.zst training data into warm DuckDB tables.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-28 12:20:28 +00:00

56 lines
1.2 KiB
Go

// Package lemcmd provides CLI commands for the LEM binary.
// Commands register through the Core framework's cli.WithCommands lifecycle.
package lemcmd
import (
"fmt"
"os"
"path/filepath"
"strings"
"forge.lthn.ai/core/cli/pkg/cli"
)
// AddLEMCommands registers all LEM command groups on the root command.
func AddLEMCommands(root *cli.Command) {
addScoreCommands(root)
addGenCommands(root)
addDataCommands(root)
addExportCommands(root)
addMonCommands(root)
addInfraCommands(root)
addSetupCommands(root)
}
// envOr returns the environment variable value, or the fallback if not set.
func envOr(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v
}
return fallback
}
// intEnvOr returns the environment variable value parsed as int, or the fallback.
func intEnvOr(key string, fallback int) int {
v := os.Getenv(key)
if v == "" {
return fallback
}
var n int
fmt.Sscanf(v, "%d", &n)
if n == 0 {
return fallback
}
return n
}
// expandHome expands a leading ~/ to the user's home directory.
func expandHome(path string) string {
if strings.HasPrefix(path, "~/") {
home, err := os.UserHomeDir()
if err == nil {
return filepath.Join(home, path[2:])
}
}
return path
}