From 31cb095435ef325d676014f549c6005b5223068d Mon Sep 17 00:00:00 2001 From: Snider Date: Sun, 22 Feb 2026 23:45:58 +0000 Subject: [PATCH] docs: archive completed CLI migration plans with summaries Move completed CLI migration design and plan to docs/plans/completed/ with a concise completion summary alongside the originals. Co-Authored-By: Claude Opus 4.6 --- ...26-02-22-cli-migration-design-original.md} | 0 ...2026-02-22-cli-migration-plan-original.md} | 0 docs/plans/completed/cli-migration.md | 49 +++++++++++++++++++ 3 files changed, 49 insertions(+) rename docs/plans/{2026-02-22-cli-migration-design.md => completed/2026-02-22-cli-migration-design-original.md} (100%) rename docs/plans/{2026-02-22-cli-migration-plan.md => completed/2026-02-22-cli-migration-plan-original.md} (100%) create mode 100644 docs/plans/completed/cli-migration.md diff --git a/docs/plans/2026-02-22-cli-migration-design.md b/docs/plans/completed/2026-02-22-cli-migration-design-original.md similarity index 100% rename from docs/plans/2026-02-22-cli-migration-design.md rename to docs/plans/completed/2026-02-22-cli-migration-design-original.md diff --git a/docs/plans/2026-02-22-cli-migration-plan.md b/docs/plans/completed/2026-02-22-cli-migration-plan-original.md similarity index 100% rename from docs/plans/2026-02-22-cli-migration-plan.md rename to docs/plans/completed/2026-02-22-cli-migration-plan-original.md diff --git a/docs/plans/completed/cli-migration.md b/docs/plans/completed/cli-migration.md new file mode 100644 index 0000000..9e53b3f --- /dev/null +++ b/docs/plans/completed/cli-migration.md @@ -0,0 +1,49 @@ +# CLI Migration: Manual Switch to Core Framework + +**Completed:** 22 Feb 2026 +**Commit:** `094e457` (refactor: migrate CLI imports from core/go to core/cli) + +## What Was Done + +Replaced LEM's `main.go` — a 296-line manual `switch os.Args[1]` with per-command `flag.FlagSet` — with the Core Go framework's `cli.Main()` + `cli.WithCommands()` pattern. + +### Changes + +- `main.go` reduced from 296 lines to 11 lines +- New `cmd/lemcmd/` package created with 7 files: + - `lem.go` — root registration (`AddLEMCommands`) + - `score.go` — score, probe, compare, tier, agent (5 commands) + - `gen.go` — distill, expand, conv (3 commands) + - `data.go` — import-all, consolidate, normalize, approve (4 commands) + - `export.go` — jsonl, parquet, publish, convert (4 commands) + - `mon.go` — status, expand-status, inventory, coverage, metrics (5 commands) + - `infra.go` — ingest, seed-influx, query, worker (4 commands) +- `runScore` and `runProbe` moved from `main.go` to `pkg/lem/score_cmd.go` (exported) +- Import paths updated from `forge.lthn.ai/core/go/pkg/cli` to `forge.lthn.ai/core/cli/pkg/cli` +- `core/cli` added as direct dependency; `core/go` becomes indirect + +### Command Restructuring + +All 25 flat commands reorganised into 6 groups: + +| Group | Commands | +|-------|----------| +| `lem score` | run, probe, compare, tier, agent | +| `lem gen` | distill, expand, conv | +| `lem data` | import-all, consolidate, normalize, approve | +| `lem export` | jsonl, parquet, publish, convert | +| `lem mon` | status, expand-status, inventory, coverage, metrics | +| `lem infra` | ingest, seed-influx, query, worker | + +### What Was Not Changed + +- All `pkg/lem/Run*` functions — untouched +- All business logic in `pkg/lem/` — untouched +- Config loading, probe loading, scoring — unchanged + +## Key Outcomes + +- LEM now matches the Core fleet pattern (go-ml, go-devops, cli/) +- Signal handling, shell completion, grouped `--help`, and TUI primitives available +- Pass-through architecture: each cobra command rebuilds `[]string` args and calls existing `lem.Run*()` — zero business logic changes +- Phase 2 (native cobra flags per command) remains optional, can be done incrementally