feat(cmd): thread themeID through buildRegistry, rebuild post-wizard

Adds a themeID parameter to buildRegistry (unused in the body until
Task 7 wires neovim.New) and rebuilds the registry after the wizard
returns with finalState.ThemeID, so the dashboard runs against a
registry configured with the user's theme selection. The pre-wizard
call passes "" since only the dashboard path consumes theme-aware
modules.
This commit is contained in:
MDietermann
2026-04-14 10:03:19 +02:00
parent e2637bc093
commit e0c1fc3c5d

View File

@@ -37,7 +37,8 @@ var version = "dev"
// modules, wired against the provided config and platform dependencies. // modules, wired against the provided config and platform dependencies.
// It replaces the earlier init()-time hello-module registration now that // It replaces the earlier init()-time hello-module registration now that
// the real modules need runtime config to be instantiated. // the real modules need runtime config to be instantiated.
func buildRegistry(cfg config.Config) (*module.Registry, error) { func buildRegistry(cfg config.Config, themeID string) (*module.Registry, error) {
_ = themeID // reserved for Task 7 (neovim.New wiring); unused until then
reg := module.NewRegistry() reg := module.NewRegistry()
runner := platform.ExecRunner{} runner := platform.ExecRunner{}
pm := platform.NewPacman(runner) pm := platform.NewPacman(runner)
@@ -122,7 +123,7 @@ func newInstallCmd() *cobra.Command {
return err return err
} }
reg, err := buildRegistry(cfg) reg, err := buildRegistry(cfg, "")
if err != nil { if err != nil {
return fmt.Errorf("build registry: %w", err) return fmt.Errorf("build registry: %w", err)
} }
@@ -183,6 +184,13 @@ func newInstallCmd() *cobra.Command {
fmt.Fprintln(os.Stdout, "installation cancelled") fmt.Fprintln(os.Stdout, "installation cancelled")
return nil return nil
} }
// Rebuild the registry with the theme the user chose in the
// wizard so theme-aware modules (e.g. neovim in Task 7) pick
// up the selection instead of the empty pre-wizard default.
reg, err = buildRegistry(cfg, finalState.ThemeID)
if err != nil {
return fmt.Errorf("build registry: %w", err)
}
// Either the CLI flag or the wizard toggle can force halt-on-error. // Either the CLI flag or the wizard toggle can force halt-on-error.
sum, runErr = dashboard.Run(ctx, reg, finalState, halt || finalState.HaltOnError) sum, runErr = dashboard.Run(ctx, reg, finalState, halt || finalState.HaltOnError)
} }