feat(onboard): add optional --model flag to quick setup and channels-only guard
This commit is contained in:
parent
ff254b4bb3
commit
3c60b6bc2d
3 changed files with 23 additions and 10 deletions
|
|
@ -189,7 +189,7 @@ cd zeroclaw
|
|||
./bootstrap.sh --install-system-deps --install-rust
|
||||
|
||||
# Optional: run onboarding in the same flow
|
||||
./bootstrap.sh --onboard --api-key "sk-..." --provider openrouter
|
||||
./bootstrap.sh --onboard --api-key "sk-..." --provider openrouter [--model "openrouter/auto"]
|
||||
```
|
||||
|
||||
Remote one-liner (review first in security-sensitive environments):
|
||||
|
|
@ -209,8 +209,8 @@ cargo install --path . --force --locked
|
|||
# Ensure ~/.cargo/bin is in your PATH
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
|
||||
# Quick setup (no prompts)
|
||||
zeroclaw onboard --api-key sk-... --provider openrouter
|
||||
# Quick setup (no prompts, optional model specification)
|
||||
zeroclaw onboard --api-key sk-... --provider openrouter [--model "openrouter/auto"]
|
||||
|
||||
# Or interactive wizard
|
||||
zeroclaw onboard --interactive
|
||||
|
|
|
|||
20
src/main.rs
20
src/main.rs
|
|
@ -120,7 +120,9 @@ enum Commands {
|
|||
/// Provider name (used in quick mode, default: openrouter)
|
||||
#[arg(long)]
|
||||
provider: Option<String>,
|
||||
|
||||
/// Model ID override (used in quick mode)
|
||||
#[arg(long)]
|
||||
model: Option<String>,
|
||||
/// Memory backend (sqlite, lucid, markdown, none) - used in quick mode, default: sqlite
|
||||
#[arg(long)]
|
||||
memory: Option<String>,
|
||||
|
|
@ -532,6 +534,7 @@ async fn main() -> Result<()> {
|
|||
channels_only,
|
||||
api_key,
|
||||
provider,
|
||||
model,
|
||||
memory,
|
||||
} = &cli.command
|
||||
{
|
||||
|
|
@ -539,22 +542,29 @@ async fn main() -> Result<()> {
|
|||
let channels_only = *channels_only;
|
||||
let api_key = api_key.clone();
|
||||
let provider = provider.clone();
|
||||
let model = model.clone();
|
||||
let memory = memory.clone();
|
||||
|
||||
if interactive && channels_only {
|
||||
bail!("Use either --interactive or --channels-only, not both");
|
||||
}
|
||||
if channels_only && (api_key.is_some() || provider.is_some() || memory.is_some()) {
|
||||
bail!("--channels-only does not accept --api-key, --provider, or --memory");
|
||||
if channels_only
|
||||
&& (api_key.is_some() || provider.is_some() || model.is_some() || memory.is_some())
|
||||
{
|
||||
bail!("--channels-only does not accept --api-key, --provider, --model, or --memory");
|
||||
}
|
||||
|
||||
let config = tokio::task::spawn_blocking(move || {
|
||||
if channels_only {
|
||||
onboard::run_channels_repair_wizard()
|
||||
} else if interactive {
|
||||
onboard::run_wizard()
|
||||
} else {
|
||||
onboard::run_quick_setup(api_key.as_deref(), provider.as_deref(), memory.as_deref())
|
||||
onboard::run_quick_setup(
|
||||
api_key.as_deref(),
|
||||
provider.as_deref(),
|
||||
model.as_deref(),
|
||||
memory.as_deref(),
|
||||
)
|
||||
}
|
||||
})
|
||||
.await??;
|
||||
|
|
|
|||
|
|
@ -324,6 +324,7 @@ fn memory_config_defaults_for_backend(backend: &str) -> MemoryConfig {
|
|||
pub fn run_quick_setup(
|
||||
credential_override: Option<&str>,
|
||||
provider: Option<&str>,
|
||||
model_override: Option<&str>,
|
||||
memory_backend: Option<&str>,
|
||||
) -> Result<Config> {
|
||||
println!("{}", style(BANNER).cyan().bold());
|
||||
|
|
@ -345,7 +346,9 @@ pub fn run_quick_setup(
|
|||
fs::create_dir_all(&workspace_dir).context("Failed to create workspace directory")?;
|
||||
|
||||
let provider_name = provider.unwrap_or("openrouter").to_string();
|
||||
let model = default_model_for_provider(&provider_name);
|
||||
let model = model_override
|
||||
.map(str::to_string)
|
||||
.unwrap_or_else(|| default_model_for_provider(&provider_name));
|
||||
let memory_backend_name = memory_backend
|
||||
.unwrap_or(default_memory_backend_key())
|
||||
.to_string();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue