Follow-up from #28
Idea: when the program can solve a problem, it should — not the user.
~/.mapbox can be a leftover file, not a directory. Today the CLI asks the user to move it by hand. Proposal: fall back to ~/.mapbox-cli automatically instead.
Order matters. If we just pick whichever path is free, this trap appears: login while ~/.mapbox is blocked → credentials go to ~/.mapbox-cli. User later deletes the stray file. Next run sees ~/.mapbox free, uses it, and the user looks logged out — credentials stranded in ~/.mapbox-cli.
So: prefer whichever directory already holds a valid credential store, not whichever is free.
~/.mapbox has a valid store → use it.
- Else
~/.mapbox-cli has a valid store → use it.
- Else (neither set up yet) → default to
~/.mapbox if usable, else ~/.mapbox-cli.
- Both valid (edge case) →
~/.mapbox wins, and the CLI says so.
Do not read the legacy file's contents as a token. Unlike MAPBOX_ACCESS_TOKEN, the user never gave it to us on purpose — it could be stale or from another tool.
MAPBOX_CONFIG_DIR stays as-is: an explicit override, no fallback.
Follow-up from #28
Idea: when the program can solve a problem, it should — not the user.
~/.mapboxcan be a leftover file, not a directory. Today the CLI asks the user to move it by hand. Proposal: fall back to~/.mapbox-cliautomatically instead.Order matters. If we just pick whichever path is free, this trap appears: login while
~/.mapboxis blocked → credentials go to~/.mapbox-cli. User later deletes the stray file. Next run sees~/.mapboxfree, uses it, and the user looks logged out — credentials stranded in~/.mapbox-cli.So: prefer whichever directory already holds a valid credential store, not whichever is free.
~/.mapboxhas a valid store → use it.~/.mapbox-clihas a valid store → use it.~/.mapboxif usable, else~/.mapbox-cli.~/.mapboxwins, and the CLI says so.Do not read the legacy file's contents as a token. Unlike
MAPBOX_ACCESS_TOKEN, the user never gave it to us on purpose — it could be stale or from another tool.MAPBOX_CONFIG_DIRstays as-is: an explicit override, no fallback.