Skip to content

feat: add --config CLI flag for interactive provider/model setup#97

Closed
Hridoy Ahmed (hrid0yyy) wants to merge 2 commits into
langchain-ai:mainfrom
hrid0yyy:feat/provider-settings
Closed

feat: add --config CLI flag for interactive provider/model setup#97
Hridoy Ahmed (hrid0yyy) wants to merge 2 commits into
langchain-ai:mainfrom
hrid0yyy:feat/provider-settings

Conversation

@hrid0yyy

Copy link
Copy Markdown

Summary

Add --config CLI flag that opens an interactive wizard to change provider, model, and API key settings without running the main wiki session.

Changes

  • src/commands.ts — Added config command kind; parses --config flag; updated help text
  • src/credentials.tsx — Added forceConfig prop to InitSetup so it always starts from provider selection step
  • src/cli.tsx — Added ConfigView component that runs the wizard with forceConfig, shows a summary on completion, then auto-exits; wired up entry point to load env for config runs; fixed command.dryRun type guard

What --config does

Running openwiki --config launches an interactive wizard that walks you through configuring OpenWiki:

  1. Provider — Select from openrouter, baseten, fireworks, openai, or anthropic
  2. API key — Enter the API key for the chosen provider
  3. Model — Pick from the provider's preset models or type a custom model ID
  4. LangSmith — Optionally set up LangSmith tracing

Each step is skipped if already configured. Changes are saved to ~/.openwiki/.env and persist across sessions.

Usage

openwiki --config                           # configure from scratch
openwiki --config --modelId claude-sonnet-5  # pre-select a model

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a useful UX improvement with a relatively small, well-contained implementation.

Pros
✅ Adds a dedicated --config command for updating provider, model, and API keys without triggering a normal run.
✅ Reuses the existing InitSetup flow instead of duplicating logic.
✅ Keeps backward compatibility (--init, --update, normal runs unchanged).
✅ Updates CLI help and examples.
✅ forceConfig cleanly starts at the provider selection screen.
Things to verify before merge
Ensure --config cannot be combined with incompatible flags like --init, --update, or a prompt. If it can, the parser should reject conflicting combinations.
Confirm the new summary screen exits correctly on all terminals (auto-exit after 3s and key press both work).
Add CLI tests for:
openwiki --config
openwiki --config --modelId ...
invalid combinations (--config --update, --config "prompt" if unsupported).

@hrid0yyy

Copy link
Copy Markdown
Author

I've addressed the review feedback and pushed the requested changes. I'd appreciate another review when you have time. Thank you!

@colifran

Copy link
Copy Markdown
Contributor

Thanks for the PR! This is going to be superseded by #374 which makes init idempotent so re-running it allows you to reconfigure things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants