Skip to content

fix(onboard): wire auxiliary provider auth flags to non-interactive onboarding #478

@alexey-pelykh

Description

@alexey-pelykh

Problem

ONBOARD_PROVIDER_AUTH_FLAGS in src/commands/onboard-provider-auth-flags.ts defines 25 auxiliary provider CLI flags (e.g., --mistral-api-key, --openrouter-api-key, --kilocode-api-key, etc.) that are:

  • ✅ Registered as CLI options via the loop in src/cli/program/register.onboard.ts (lines 63-65)
  • ✅ Typed in OnboardOptions (e.g., mistralApiKey?: string)
  • ✅ Have credential setters in src/commands/onboard-auth.credentials.ts (e.g., setMistralApiKey())
  • Never consumed during non-interactive onboarding

applyNonInteractiveRuntimeAuth() in src/commands/onboard-non-interactive/local.ts only handles the 4 runtime providers (claude, gemini, codex, opencode). The 25 auxiliary provider keys passed via CLI flags are silently ignored.

Evidence

// src/commands/onboard-non-interactive/local.ts — applyNonInteractiveRuntimeAuth
// Only processes: anthropicApiKey, geminiApiKey, codexApiKey, openaiApiKey, authToken
// Never reads: mistralApiKey, openrouterApiKey, kilocodeApiKey, etc.

Credential setters like setMistralApiKey() exist but have zero callers outside their definition module.

Proposed fix

After runtime auth is applied, iterate over ONBOARD_PROVIDER_AUTH_FLAGS and call the corresponding setter for any auxiliary key provided:

// After applyNonInteractiveRuntimeAuth:
for (const flag of ONBOARD_PROVIDER_AUTH_FLAGS) {
  const value = opts[flag.optionKey];
  if (value) {
    const setter = auxiliarySetterMap[flag.optionKey];
    if (setter) await setter(value);
  }
}

This also unblocks adding --elevenlabs-api-key for TTS credential onboarding.

Scope

File Change
src/commands/onboard-non-interactive/local.ts Wire auxiliary flags to credential setters
src/commands/onboard-provider-auth-flags.ts Add elevenlabs entry
src/commands/onboard-types.ts Add elevenlabsApiKey to OnboardOptions

Origin

This is an upstream OpenClaw pattern — the flags were scaffolded but never wired. Fixing this is a RemoteClaw improvement.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions