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
|
|
@ -188,8 +188,8 @@ cd zeroclaw
|
||||||
# Optional: bootstrap dependencies + Rust on fresh machines
|
# Optional: bootstrap dependencies + Rust on fresh machines
|
||||||
./bootstrap.sh --install-system-deps --install-rust
|
./bootstrap.sh --install-system-deps --install-rust
|
||||||
|
|
||||||
# Optional: run onboarding in the same flow
|
# 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):
|
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
|
# Ensure ~/.cargo/bin is in your PATH
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
|
||||||
# Quick setup (no prompts)
|
# Quick setup (no prompts, optional model specification)
|
||||||
zeroclaw onboard --api-key sk-... --provider openrouter
|
zeroclaw onboard --api-key sk-... --provider openrouter [--model "openrouter/auto"]
|
||||||
|
|
||||||
# Or interactive wizard
|
# Or interactive wizard
|
||||||
zeroclaw onboard --interactive
|
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)
|
/// Provider name (used in quick mode, default: openrouter)
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
provider: Option<String>,
|
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
|
/// Memory backend (sqlite, lucid, markdown, none) - used in quick mode, default: sqlite
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
memory: Option<String>,
|
memory: Option<String>,
|
||||||
|
|
@ -532,6 +534,7 @@ async fn main() -> Result<()> {
|
||||||
channels_only,
|
channels_only,
|
||||||
api_key,
|
api_key,
|
||||||
provider,
|
provider,
|
||||||
|
model,
|
||||||
memory,
|
memory,
|
||||||
} = &cli.command
|
} = &cli.command
|
||||||
{
|
{
|
||||||
|
|
@ -539,22 +542,29 @@ async fn main() -> Result<()> {
|
||||||
let channels_only = *channels_only;
|
let channels_only = *channels_only;
|
||||||
let api_key = api_key.clone();
|
let api_key = api_key.clone();
|
||||||
let provider = provider.clone();
|
let provider = provider.clone();
|
||||||
|
let model = model.clone();
|
||||||
let memory = memory.clone();
|
let memory = memory.clone();
|
||||||
|
|
||||||
if interactive && channels_only {
|
if interactive && channels_only {
|
||||||
bail!("Use either --interactive or --channels-only, not both");
|
bail!("Use either --interactive or --channels-only, not both");
|
||||||
}
|
}
|
||||||
if channels_only && (api_key.is_some() || provider.is_some() || memory.is_some()) {
|
if channels_only
|
||||||
bail!("--channels-only does not accept --api-key, --provider, or --memory");
|
&& (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 || {
|
let config = tokio::task::spawn_blocking(move || {
|
||||||
if channels_only {
|
if channels_only {
|
||||||
onboard::run_channels_repair_wizard()
|
onboard::run_channels_repair_wizard()
|
||||||
} else if interactive {
|
} else if interactive {
|
||||||
onboard::run_wizard()
|
onboard::run_wizard()
|
||||||
} else {
|
} 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??;
|
.await??;
|
||||||
|
|
|
||||||
|
|
@ -324,6 +324,7 @@ fn memory_config_defaults_for_backend(backend: &str) -> MemoryConfig {
|
||||||
pub fn run_quick_setup(
|
pub fn run_quick_setup(
|
||||||
credential_override: Option<&str>,
|
credential_override: Option<&str>,
|
||||||
provider: Option<&str>,
|
provider: Option<&str>,
|
||||||
|
model_override: Option<&str>,
|
||||||
memory_backend: Option<&str>,
|
memory_backend: Option<&str>,
|
||||||
) -> Result<Config> {
|
) -> Result<Config> {
|
||||||
println!("{}", style(BANNER).cyan().bold());
|
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")?;
|
fs::create_dir_all(&workspace_dir).context("Failed to create workspace directory")?;
|
||||||
|
|
||||||
let provider_name = provider.unwrap_or("openrouter").to_string();
|
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
|
let memory_backend_name = memory_backend
|
||||||
.unwrap_or(default_memory_backend_key())
|
.unwrap_or(default_memory_backend_key())
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue