feat: add --config to reconfigure credentials without running the agent#24
Closed
Miller (bath-tub) wants to merge 1 commit into
Closed
feat: add --config to reconfigure credentials without running the agent#24Miller (bath-tub) wants to merge 1 commit into
--config to reconfigure credentials without running the agent#24Miller (bath-tub) wants to merge 1 commit into
Conversation
…gent Once `~/.openwiki/.env` holds a full set of credentials there is no way to change them from the CLI: `--init` skips setup and immediately runs the agent (so a dead/exhausted key just errors on boot), and interactive chat has no command to re-enter an API key. Add `openwiki --config`, a settings-only entry point that renders the setup flow in a new `reconfigure` mode and exits without ever invoking the agent. Reconfigure walks every step even when values already exist, but treats empty input on the API key / LangSmith prompts as "keep current" so untouched secrets are never overwritten. A saved custom model (not in the provider presets) is surfaced as a selectable option so pressing Enter keeps it. Closes langchain-ai#23 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Miller (bath-tub)
force-pushed
the
feat/config-command
branch
from
July 1, 2026 20:51
f21d2fa to
17afbd9
Compare
Contributor
|
Thanks for PR! This will be superseded by: #374 which makes init idempotent so re-running allows updating config. |
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.
Description
Adds
openwiki --config, a settings-only entry point for changing the provider, API key, model, or LangSmith key.Today, once
~/.openwiki/.envholds a complete set of credentials there is no way to change them from the CLI:--initmaps to a documentation run (shouldStart: true), so it invokes the agent on mount. A user whose key is dead (expired trial, exhausted quota, wrong tier) just gets an error on boot with no path to switch keys.needsCredentialSetup()is onlytruewhen a value is missing, soInitSetupis never reached when the file is complete./provideronly writes the provider + default model and prints "ensure KEY is set".This fixes #23
What changed
--configflag (commands.ts): new{ kind: "config" }command. It errors if combined with--init/--update/--print/a message, and requires a TTY.reconfiguremode inInitSetup(credentials.tsx): walks every step (provider → key → model → LangSmith) even when values already exist.completeSetuponly writes non-null fields, so untouched secrets are never cleared. A saved custom model that isn't one of the provider presets is surfaced as a selectable "current" option so pressing Enter keeps it instead of silently falling back to the first preset.cli.tsx): the config flow renders the outcome and exits; the agent-run effect is gated oncommand.kind === "run". Env is now loaded for--configtoo so existing values are detected.Testing
pnpm build,pnpm lint:check,pnpm format:checkall pass. Drove the interactive flow through a PTY against an isolatedHOMEwith a complete.env:OPENWIKI_MODEL_IDis preserved rather than overwritten.Follow-ups (not in this PR)
/key(or/login) slash command for the in-session case.insufficient_quotaerrors pointing at--config.loadOpenWikiEnvonly fillsprocess.envwhen unset, so an exported key wins over~/.openwiki/.envon the next shell).Made with Claude Code