feat: port 11 LEM data management commands into core ml
Ports all remaining LEM pipeline commands from pkg/lem into core ml,
eliminating the standalone LEM CLI dependency. Each command is split
into reusable business logic (pkg/ml/) and a thin cobra wrapper
(internal/cmd/ml/).
New commands: query, inventory, metrics, ingest, normalize, seed-influx,
consolidate, import-all, approve, publish, coverage.
Adds Path(), Exec(), QueryRowScan() convenience methods to DB type.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 04:02:28 +00:00
|
|
|
package ml
|
|
|
|
|
|
|
|
|
|
import (
|
2026-02-16 14:22:18 +00:00
|
|
|
"forge.lthn.ai/core/go/pkg/cli"
|
|
|
|
|
"forge.lthn.ai/core/go/pkg/ml"
|
feat: port 11 LEM data management commands into core ml
Ports all remaining LEM pipeline commands from pkg/lem into core ml,
eliminating the standalone LEM CLI dependency. Each command is split
into reusable business logic (pkg/ml/) and a thin cobra wrapper
(internal/cmd/ml/).
New commands: query, inventory, metrics, ingest, normalize, seed-influx,
consolidate, import-all, approve, publish, coverage.
Adds Path(), Exec(), QueryRowScan() convenience methods to DB type.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 04:02:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
consolidateM3Host string
|
|
|
|
|
consolidateRemoteDir string
|
|
|
|
|
consolidatePattern string
|
|
|
|
|
consolidateOutputDir string
|
|
|
|
|
consolidateMergedOut string
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var consolidateCmd = &cli.Command{
|
|
|
|
|
Use: "consolidate",
|
|
|
|
|
Short: "Pull and merge response JSONL files from M3",
|
|
|
|
|
Long: "Pulls JSONL response files from M3 via SSH/SCP, merges them by idx, deduplicates, and writes a single merged JSONL output.",
|
|
|
|
|
RunE: runConsolidate,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
consolidateCmd.Flags().StringVar(&consolidateM3Host, "m3-host", "m3", "M3 SSH host")
|
|
|
|
|
consolidateCmd.Flags().StringVar(&consolidateRemoteDir, "remote", "/Volumes/Data/lem/responses", "Remote response directory")
|
|
|
|
|
consolidateCmd.Flags().StringVar(&consolidatePattern, "pattern", "gold*.jsonl", "File glob pattern")
|
|
|
|
|
consolidateCmd.Flags().StringVar(&consolidateOutputDir, "output", "", "Local output directory (default: responses)")
|
|
|
|
|
consolidateCmd.Flags().StringVar(&consolidateMergedOut, "merged", "", "Merged output path (default: gold-merged.jsonl in parent of output dir)")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func runConsolidate(cmd *cli.Command, args []string) error {
|
|
|
|
|
cfg := ml.ConsolidateConfig{
|
|
|
|
|
M3Host: consolidateM3Host,
|
|
|
|
|
RemoteDir: consolidateRemoteDir,
|
|
|
|
|
Pattern: consolidatePattern,
|
|
|
|
|
OutputDir: consolidateOutputDir,
|
|
|
|
|
MergedOut: consolidateMergedOut,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ml.Consolidate(cfg, cmd.OutOrStdout())
|
|
|
|
|
}
|