Skip to content

fix(config): drop --base-url flag and MINIMAX_BASE_URL env - #211

Open
AndersHsueh wants to merge 1 commit into
MiniMax-AI:mainfrom
AndersHsueh:fix/remove-base-url-flag-env-upstream
Open

fix(config): drop --base-url flag and MINIMAX_BASE_URL env#211
AndersHsueh wants to merge 1 commit into
MiniMax-AI:mainfrom
AndersHsueh:fix/remove-base-url-flag-env-upstream

Conversation

@AndersHsueh

@AndersHsueh AndersHsueh commented Aug 1, 2026

Copy link
Copy Markdown

What

Drop the --base-url global flag and the MINIMAX_BASE_URL env var. baseUrl is now sourced only from config.json's base_url field (or, after OAuth login, the oauth.resource_url field stored alongside it).

Why

An external tool was setting MINIMAX_BASE_URL in the user's shell, expecting mmx to leave it alone. mmx was intercepting it and breaking that tool's own routing. base_url is also fully redundant with mmx config set --key base_url --value <url>, so the explicit overrides are removed.

Changes

  • src/command.ts — drop --base-url from GLOBAL_OPTIONS
  • src/registry.ts — drop --base-url line from help text
  • src/types/flags.ts — drop baseUrl? field from GlobalFlags
  • src/config/loader.ts — shorten baseUrl chain to file.base_url || file.oauth?.resource_url || REGIONS[region] || REGIONS.global
  • src/args.ts — explicitly reject --base-url with a CLIError(USAGE) pointing at mmx config set --key base_url, so users no longer see their input silently dropped
  • src/errors/handler.ts — refresh stale MINIMAX_BASE_URL example in the fetch failed branch comment

Tests

  • test/config/loader.test.ts — 7 new cases for the baseUrl source chain (file wins, region fallback, env ignored, malformed URL fallback). Uses MMX_CONFIG_DIR for cross-platform isolation.
  • test/args.test.ts — 3 new cases for the --base-url rejection (space form, = form, and a happy-path smoke test).

bun test: 358/358 non-SDK tests pass. The 14 SDK failures are pre-existing and unrelated (live API integration tests that need network + a valid key).
bun run lint: clean.
bun run typecheck: clean.

Side effects

  • mmx search query --base-url https://... now errors with Flag --base-url was removed. and a migration hint.
  • export MINIMAX_BASE_URL=... is silently ignored — the user's ~/.mmx/config.json (or region default) wins. No warning by design.
  • To set a custom base URL: mmx config set --key base_url --value <url>.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

baseUrl is now sourced from config.json's base_url field (or, after
OAuth login, the oauth.resource_url field stored alongside it). The
--base-url global flag and the MINIMAX_BASE_URL env var are no longer
honored.

Background: an external tool setting MINIMAX_BASE_URL was getting
intercepted by mmx and breaking its own routing. base_url is also
fully redundant with mmx config set --key base_url, so the explicit
overrides are removed.

- src/command.ts: drop --base-url from GLOBAL_OPTIONS
- src/registry.ts: drop --base-url line from help text
- src/types/flags.ts: drop baseUrl? field from GlobalFlags
- src/config/loader.ts: shorten baseUrl chain to file.base_url ||
  file.oauth?.resource_url || REGIONS[region] || REGIONS.global
- src/args.ts: explicitly reject --base-url with a CLIError(USAGE)
  pointing at `mmx config set --key base_url`, so users no longer
  see their input silently dropped
- src/errors/handler.ts: refresh stale MINIMAX_BASE_URL example in
  the "fetch failed" branch comment
- test/config/loader.test.ts: add 7 cases for the baseUrl source
  chain (file wins, region fallback, env ignored, malformed URL
  fallback). Uses MMX_CONFIG_DIR for cross-platform isolation.
- test/args.test.ts: add 3 cases for the --base-url rejection
  (space form, = form, and a happy-path smoke test)

Verified: 358 non-SDK tests pass; 14 pre-existing SDK failures are
unrelated (network-dependent integration tests). bun run lint and
bun run typecheck both clean.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant