Skip to content

refactor!: rebuild on the Helmcode CLI structure - #49

Open
crstian19 wants to merge 3 commits into
mainfrom
port/charm-v2
Open

crstian19 wants to merge 3 commits into
mainfrom
port/charm-v2

Conversation

@crstian19

Copy link
Copy Markdown

What

nan-cli rebuilt on the same structure, Charm stack and tooling as the Helmcode CLI, so both are maintained the same way. Every feature of nan stays; the session file, the commands, their flags, output and exit codes, and what each tool writer puts into a config are unchanged.

Structure

  • cmd/nan for the entry point, and internal/{build,api,session,tools,models,flow,pulse,cli,runs,ui,update}, as in the Helmcode CLI.
  • Bubble Tea v2, Bubbles v2, Lip Gloss v2, huh and fang, replacing Bubble Tea v1 and the single internal/tui/tui.go.
  • golangci-lint with the shared config (new CI job), lefthook, mise and a justfile.

Dashboard

  • Seven numbered areas, always on screen: Home, Profile, Usage, Models, Costs, Harnesses, About. 1-7/tab move, enter opens a menu of what a row allows, / finds anything, t takes a short tour.
  • Home says what needs attention: not signed in, an expired session, a missing or refused key, a tool installed but not pointed at NaN, a newer release. Models new to your key show there too.
  • The NaN identity stays: violet palette, wordmark and the mascot, whose face follows what the dashboard is doing.
  • Sign-in, key and tool setup are huh forms. s signs in, o signs out (twice), e opens the setup from any area.

Commands

  • run, runs, automations, approvals, secrets, me, metrics and auth keep their flags, output and exit codes (0-4, 10, 64, 65, 69, 75). Their code moved as it was and its tests pass.
  • New: nan setup, nan setup status, nan setup remove.
  • Errors are framed by fang but printed as written (fang's default title-cases the first word, which turned not-an-id into Not-An-Id). To a pipe, only the message, as before.
  • A newer release is mentioned after a command, at most once a day, from the public GitHub releases.

Compatibility notes

  • ~/.config/nan/session.json keeps its path on every OS and its fields.
  • Each tool writer (Factory, OpenCode, Pi, Codex, Hermes) moved unchanged; all of its tests pass.
  • Behaviour change: a key the cluster refuses is no longer saved. One that cannot be checked because the cluster is unreachable is still accepted, and the screen says it was not checked.
  • THIRD-PARTY-NOTICES.txt now ships inside every archive (cobra is Apache-2.0). The installer extracts the archive and installs nan by name, so it is unaffected.
  • internal/build.Version is 0.2.0: merging this publishes v0.2.0 through tag.yml.

Open PRs

#32, #34 and #40 touch the files this replaces and will need rebasing onto the new layout; the theme toggle in #40 maps onto internal/ui/theme.go.

Checked

  • go test -race ./..., golangci-lint run (0 issues), golangci-lint fmt --diff, govulncheck.
  • Driven by hand in a terminal against a local stand-in (NAN_API_URL): every area, the first run, the sign-in, the errors and exit codes.

The same layout, Charm stack and tooling as the Helmcode CLI, so the two
are maintained the same way. Every feature of nan stays.

Structure
- cmd/nan for the entry point; internal/{build,api,session,tools,models,
  flow,pulse,cli,runs,ui,update}, as in the Helmcode CLI
- Bubble Tea v2, Bubbles v2, Lip Gloss v2, huh forms and fang for the
  command tree, replacing Bubble Tea v1 and the single internal/tui/tui.go
- golangci-lint with the shared config, lefthook, mise and a justfile
- the version lives in internal/build; tag.yml and release.yml read it there

Dashboard
- seven numbered areas always on screen: Home, Profile, Usage, Models,
  Costs, Harnesses and About, with lazygit-style verbs, an enter menu per
  row, / to find anything and a short guided tour
- Home says what needs you (sign in, a missing or refused key, a tool not
  pointed at NaN, a newer release) and shows models new to your key
- the NaN identity stays: violet palette, wordmark and the mascot, whose
  face follows what the dashboard is doing
- sign-in, key and tool setup are huh forms; s signs in, o signs out twice,
  e opens the setup from anywhere

Commands
- run, runs, automations, approvals, secrets, me, metrics and auth keep
  their flags, output and exit codes (0-4, 10, 64, 65, 69, 75)
- new: nan setup, nan setup status and nan setup remove
- errors are framed by fang but printed as written: its default title-cased
  the first word, which turned a run id into a different one
- a newer release is said after a command, once a day at most

Compatibility
- session.json stays at ~/.config/nan with the same fields
- every tool writer is moved as it was, and its tests pass unchanged
- a key the cluster refuses is no longer saved; one that cannot be checked
  because the cluster is unreachable still is, and that is said

Also: THIRD-PARTY-NOTICES.txt ships in every archive (cobra is Apache-2.0),
and the version moves to 0.2.0.
Runs the working tree against production with a throwaway HOME, so
Setup never writes into the real tool configs.
nan has always shown its areas as tabs in a row. The side column is gone,
the content takes the full width, and a narrow terminal drops the counts,
then the numbers, so the row never wraps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant