feat: wizard entry points — /setup command, claw setup subcommand, and Ctrl+P provider swap#3218
Open
TheArchitectit wants to merge 1 commit into
Open
Conversation
…nd RuntimeProviderConfig The setup wizard was merged in PR ultraworkers#3017 but was orphaned -- it was not declared as a module in main.rs, making it unreachable. Additionally, the setup_wizard.rs imports RuntimeProviderConfig which did not exist on upstream/main. This commit makes the wizard accessible and adds the necessary RuntimeProviderConfig type. Changes: - Add RuntimeProviderConfig struct to runtime/src/config.rs with kind(), api_key(), base_url(), model() accessors. This represents the "provider" section in ~/.claw/settings.json and supports the 3-tier credential resolution: env var > .env file > stored config. - Add parse_optional_provider_config() to parse the provider object from merged settings JSON. - Add provider() method to RuntimeConfig and RuntimeFeatureConfig. - Export RuntimeProviderConfig, save_user_provider_settings, clear_user_provider_settings, and default_config_home from runtime crate public API (runtime/src/lib.rs). - Add "mod setup_wizard;" to rusty-claude-cli/src/main.rs to activate the previously orphaned setup wizard module. - Add "claw setup" CLI subcommand: runs the interactive provider setup wizard from the terminal. - Add "/setup" slash command: runs the wizard inside the REPL. - Add Setup variant to SlashCommand enum with /setup spec entry. - Add Setup to LocalHelpTopic enum with help text. - Add "setup" to diagnostic subcommand matching, local-help topic routes, suggest_similar_subcommand list, and all parse dispatches. - Add "subagentModel" to TOP_LEVEL_FIELDS in config_validate.rs so that the setup wizard's fast-model setting is recognized as a valid settings key instead of causing an "unknown key" error. Note: Ctrl+P provider swap in the TUI input loop is deferred to a follow-up as it requires deeper integration with the TUI state machine (see reference commit 99351d4 from feat-tui). [depends on ultraworkers#3211 for 3-tier credential resolution] Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9 tasks
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.
Problem
The setup wizard was merged in PR #3017 but is completely orphaned — it's not declared as a module in
main.rs, so users cannot reach it via any entry point. Additionally,setup_wizard.rsimportsRuntimeProviderConfigwhich did not exist onupstream/main, so the module cannot even compile without the type definition.Solution
This PR activates the setup wizard by adding the three key pieces:
RuntimeProviderConfigtype — Adds theprovidersection parser toruntime/src/config.rssoConfigLoader::load().provider()returns structured provider settings (kind, apiKey, baseUrl, model). This is the same type that PR feat: 3-tier provider credential resolution (env var → .env → stored config) #3211 introduces for 3-tier credential resolution.claw setupsubcommand — Wires the wizard as a standalone CLI subcommand so users can run it from the terminal without entering the REPL./setupslash command — Adds/setupas a recognized slash command that runs the wizard inside the REPL session.Also includes a minor fix: adds
subagentModelto the settings validator'sTOP_LEVEL_FIELDSallowlist so that the wizard's fast-model persistence doesn't trigger an "unknown key" validation error.Changes
rust/crates/runtime/src/config.rs— AddRuntimeProviderConfigstruct withkind(),api_key(),base_url(),model()accessors. Addparse_optional_provider_config()parser. Wireproviderfield intoRuntimeFeatureConfigand addprovider()methods toRuntimeConfigandRuntimeFeatureConfig.rust/crates/runtime/src/lib.rs— ExportRuntimeProviderConfig,save_user_provider_settings,clear_user_provider_settings, anddefault_config_homefrom the runtime crate public API.rust/crates/runtime/src/config_validate.rs— AddsubagentModeltoTOP_LEVEL_FIELDSso the wizard's fast-model setting passes validation.rust/crates/commands/src/lib.rs— AddSetupvariant toSlashCommandenum. Add/setupspec entry inSLASH_COMMAND_SPECS. Add"setup"parsing invalidate_slash_command_input(). Add"setup"to Config category and exhaustive matches.rust/crates/rusty-claude-cli/src/main.rs— Addmod setup_wizard;. AddCliAction::Setupvariant. AddLocalHelpTopic::Setupwith help text. Add"setup"subcommand parsing with argument validation. AddSlashCommand::SetupREPL dispatch callingsetup_wizard::run_setup_wizard(). Addrun_setup()function. Wire"setup"into all dispatch tables (local-help, single-word-alias, similar-subcommand suggestions).rust/crates/rusty-claude-cli/src/setup_wizard.rs— Formatting-only changes fromcargo fmt(the module was already present on upstream/main but orphaned).Diff verification
All changes are feature-only additions. The 27 deletions in
setup_wizard.rsare formatting fixes fromcargo fmt, not functionality removals. No upstream commits were reverted.Testing
cargo check --workspace— passescargo test -p api -p runtime -p tools— all 102 tools tests pass, all api/runtime tests passcargo fmt -p api -p runtime -p tools -p commands -p rusty-claude-cli— no changes neededclaw setupruns the interactive wizard/setupis recognized as a valid slash commandclaw setup --helpshows the setup help topicclaw help setupshows the setup help topicRelated upstream PR: #3211 (3-tier credential resolution, which introduces the same
RuntimeProviderConfigtype)