chore(go): sweep dead code from the CLI, TUI, agent, and pkg - #64
Merged
Merged
Conversation
Delete Go code that has no callers and no remaining contract. Each item was
checked with deadcode plus repo-wide greps of its name and route (Go, web,
TUI, CLI registration, tests, scripts, docs, Nix).
TUI and CLI
- internal/tui/views and views/secrets: nothing imports them. Their only
entry point, cmd/cli/secrets.go, was never registered (commented out in
root.go). Also drop internal/tui/REFACTOR_PLAN.md.
- tui/daemon.go: DaemonMode, DefaultDaemonMode, DaemonProgramOptions,
NewProgram, LogWriter and IsTTY have no callers. The --daemon flag stays
because `stack setup --experimental-agent` reads it and every CLI page
documents it.
- tui/output: CaptureWithWriters, TeeBuffer, RunViewer*, SimpleViewer.
- tui/healthcheck_runner.go: the TTL cache path (LoadHealthcheckCache,
RunOrLoadHealthchecks). The MOTD and `stack healthcheck` read the cache
without a TTL.
- tui/status.go: drop the "Deprecated: use views.StatusView" note. The
model backs `stack status`.
- cmd/cli/templates.go and its *.tmpl files: byte-identical copies of
internal/docgen/templates, with no callers.
- usersCmd was registered in both root.go and users.go, so `users` showed
up twice in help and in the generated CLI index.
- setup.go: drop the `var _ = fileops.Manifest{}` keep-alive.
Packages
- internal/config: an unused twin of internal/agent/config.
- internal/util: the test scaffolding helpers have no importers.
- pkg/common/logger.go was the only user of zap and charmbracelet/log.
Its one call site, a Debug line in deploy.go, never printed anything
because the charm logger defaults to Info, so the line is deleted
rather than ported. go.mod, go.sum and gomod2nix.toml now match
`go mod tidy` and the devshell's `gomod2nix generate`. Tidy also wants
to promote x/ansi, termenv and go-toml/v2 to direct requirements. That
drift predates this change and is left as is.
- pkg/nixeval: the unused With* options and the Evaluator fields that only
they set, NewWatchConfig, the Evaluator's own file watcher (the agent's
FlakeWatcher watches files and calls Invalidate), evalNixConfig, the
Must* helpers, and presets that have no callers.
- docgen CLICommand/CLIFlag and the deprecated Run; fileops
loadJSONObject/describeCodec; reconcile sha256File; pkg/nix NixPath
(replaced by flakeedit.PatchNixPath); pkg/services GlobalBaseDir and
IsInitialized; pkg/exec ClearDevshellEnv, SetProjectRoot, ProjectRoot;
pkg/nixdata Store.WriteEntityJSON (no callers since stackpanel-thq.8.2).
- A stray debug AST dump test under apps/stackpanel-go/apps/stackpanel-go/.
Agent
- Routes that no client calls: /ws (the WebSocket upgrader stays because
the process-compose log stream uses it), /api/nix/ui/{runtime,extensions},
/api/project/{resolve,default}, /api/nixpkgs/meta.
- json_transform.go and the unused nix_data.go aliases; project.go
ValidateProjectStrict/Fast, QuickValidationOptions, the thin
checkFlake*ForStackpanel wrappers, GetValidationWarnings; the agenix.go
.age leftovers; runHealthchecksParallel and InvalidateHealthcheckCache.
- project_context.go was never mounted. Per-request project selection now
lives in the v1 Connect interceptor (connect_v1_project.go). The
`stack project` help and its docs now say that v1 API requests select
their project with X-Stackpanel-Project. They no longer claim a
?project= query parameter.
Kept
- The registry.go fallback modules, because removing them changes what
users see.
- connect_service.go, connect_handlers.go and generated code, which are
changing on stackpanel-thq.8.1.2.
- /api/sst/config, /api/process-compose/process/info/, /api/sops/list and
/api/secrets/list, because apps/web/src/lib/agent.ts still has client
methods for them (those methods have no callers yet).
Refs: stackpanel-thq.10
cooper (czxtm)
had a problem deploying
to
docs-preview
September 23, 2026 15:59 — with
GitHub Actions
Failure
Contributor
|
Preview |
Contributor
|
Docs preview |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This sweeps dead Go code: 67 files, +69/-7,294 (Go alone is -6,425). Each item was checked with
deadcodeplus repo-wide greps of its name and route across Go, web, TUI, CLI registration, tests, scripts, docs and Nix.Removed:
/ws,/api/nix/ui/*,/api/project/{resolve,default}and/api/nixpkgs/meta. The WebSocket upgrader stays, because the process-compose log stream uses it.project_context.go,json_transform.go, unused validators and aliases, and leftovers from the old.agesecrets formatsecretscommand, which was never registered, and duplicated templatespkg/nixevalAPIinternal/configandinternal/utilpkg/common/logger.go, the only user of zap and charmbracelet/log.go.mod,go.sumandgomod2nix.tomlare tidy, andgomod2nix generateis a no-op.X-Stackpanel-Project.Verification by the implementer, in the devshell on the rebased commit:
go buildandgo vetpass.go testshows the 5 failures that already happen on main, plusTestHealthcheckScriptCancellationAndInheritedPipes. That test is a timing flake: it passed 13 of 13 runs on its own, and in a side-by-side run under full-suite load it also failed on origin/main.Refs stackpanel-thq.10