Repository navigation
Description
Background
stash is the CipherStash CLI, in languages/typescript/packages/cli. Most of its database commands take --database-url, to name the database for one run. A project can also name a database in stash.config.ts, with databaseUrl. The CLI looks for that file in the current folder and in every folder above it.
#1967 made --database-url win over the config in stash eql preflight, as it already did in stash eql verify, eql install, and eql repair.
Problem
Some commands still let a literal databaseUrl in stash.config.ts win over --database-url. The #1967 agent named three: eql upgrade, eql status, and schema build. Each loads the config, and uses its literal databaseUrl even when the user passes the flag.
Two more commands do the same: eql validate and db test-connection.
So a user who names database B with the flag, from inside a project whose config names database A, works on database A. For eql upgrade, that changes a database the user did not name.
The CLI now has two rules for the same flag. A user cannot tell which rule a command follows without reading its code.
eql validate and db test-connection also fail when there is no stash.config.ts. Each one stops with exit code 1, even when the user passes --database-url. eql verify uses the flag in that case.
Proposal
- List every command that takes
--database-url, and record which value wins in each today. - Decide, for each command, whether the flag should win. The flag winning everywhere is the simplest rule to explain.
- Change the commands that need it, with a test for each, and a
stashchangeset. This changes CLI behaviour, so say so in the changeset. - Make
eql validateanddb test-connectionuse--database-urlwhen there is nostash.config.ts, aseql verifydoes. - Update
skills/stash-cli/SKILL.mdand each command's help text.
Evidence
- From the fix(cli): let --database-url win in stash eql preflight #1967 agent's report, not checked here: the three commands above let the config win.
- Checked on
next:eql validateanddb test-connectionalso let the config win. Each passes--database-urlonly intoloadStashConfig, and then uses the config'sdatabaseUrl. The flag reaches that value only when the config callsresolveDatabaseUrl(), so a literaldatabaseUrlin the config wins.eql validate:languages/typescript/packages/cli/src/commands/eql/validate.ts:843-846loads the config with the flag, and line 858 usesconfig.databaseUrl.db test-connection:languages/typescript/packages/cli/src/commands/db/test-connection.ts:16loads the config with the flag, and line 19 connects toconfig.databaseUrl.loadStashConfig(languages/typescript/packages/cli/src/config/index.ts:109-148) passes the flag only toresolveDatabaseUrl()calls inside the config file.
- Checked on
next: with nostash.config.ts,loadStashConfigexits with code 1 (languages/typescript/packages/cli/src/config/index.ts:115-131). It does this even when--database-urlis given.eql verifyfalls back to the flag inresolve-diagnostic-url.ts:61. stash eql preflightignores--database-urlwhenstash.config.tssets a database — let the flag win #1966 asked whether other commands share preflight's old precedence. The answer is yes, for these five.
Activity
[-]`stash eql upgrade`, `eql status` and `schema build` ignore `--database-url` when `stash.config.ts` sets a database[/-][+]Five `stash` commands ignore `--database-url` when `stash.config.ts` sets a database[/+]