fix(cli): plugins connect/install find plugins that plugins list shows
Links
- Issue: SUPER-3064
- Before/after, root cause: Paradev page
Summary
superset plugins connect <name>now finds a plugin that is installed on the account, which is whatplugins listshows, even when this machine'sinstalled_plugins.jsonnever recorded it.superset plugins install <name>now fetches a stale marketplace clone once before it reports that no installed marketplace has the plugin.
Why / Context
The commands read three different sources of truth:
| Command | Reads |
|---|---|
plugins list (and --available, marketplace list) | The account, through the plugins.list API |
plugins connect | Only this machine's ledger, installed_plugins.json |
plugins install | The local git clone of each marketplace. ensureDefaultMarketplace() clones superset once and never fetches it again. |
The desktop records the account install first, then shells out to the CLI to write the ledger. When that step fails or never runs, the account and the machine drift apart. connect then refuses to run, install cannot find the plugin in its old clone, and the user has no way to reconnect. In the report, that meant autumn's OAuth scopes could not be widened to add rewards:read.
How It Works
findConnectTarget()(lib/plugins/connect.ts) looks the plugin up in the catalog thatconnectalready fetched to get the connector slug. It matches entries that are installed on the account or present in the local ledger. If the same plugin is installed from two marketplaces, you must still name one.findAvailablePlugin()(lib/plugins/install.ts) is the lookup that used to be inline ininstallPlugin. If no candidate is found, it callsrefreshMarketplaces()one time and looks again. That function runs a shallowinstallMarketplacere-fetch for each known GitHub marketplace, or only for the one you named. If the fetch fails, the "No plugin" error now carries the reason.
Manual QA Checklist
I built the CLI from this branch and from main, and ran the same script with both. The script resets a fresh SUPERSET_HOME_DIR each time. In that home, the account has autumn installed and connected, the ledger is empty, and the superset marketplace clone has an older commit that does not list autumn. The full output is on the page.
-
plugins connect autumn --method oauth2. Before:"autumn" is not installed. After: returns the authorize URL. -
plugins connect autumn --marketplace supersetandconnect autumn@superset. Before:not installed from "superset". After: return the authorize URL. -
plugins install autumn --marketplace superset --no-wait. Before:No plugin "autumn" in any installed marketplace. After: installs autumn@1.0.2 and reuses the existing connection. The clone moved from the stale commit tomain, and the ledger now has autumn. -
plugins list,list --available, andmarketplace listgive the same output before and after.
Note: in a cloud workspace, connect and install are hidden (sandbox: false), and the CLI signs in through the sandbox there. To run them, I built with cli.config.ts's sandbox hook set to () => false, then restored the file. That change is not part of this PR.
Testing
bun testinpackages/cli: 473 pass, 0 failbunx tsc --noEmit -p packages/clibunx biome check packages/cli/src/lib/plugins packages/cli/src/commands/plugins/connect- New tests:
connect.test.tscovers four cases: account only, ledger only, installed nowhere, and installed from two marketplaces.install.test.tscovers three: a stale clone is refreshed and the plugin is found, no refresh happens when the clone has the plugin, and the error names a failed refresh. Review follow-up: a git-backed test (local remotes) shows that one broken marketplace does not keep the next one stale, and aconnecttest covers a local install and an account install from different marketplaces.
Known Limitations
install --update, which the desktop uses, still installs the version in the local clone without fetching first. A clone can therefore install an old version of a plugin it does know about. That is a separate problem from this bug.
Summary by CodeRabbit
- New Features
- Plugin discovery now refreshes marketplaces when a requested plugin isn’t found, then checks again. Refresh failures are reported without stopping attempts to refresh other marketplaces.
- Plugin connections can match plugins recorded as installed locally, even when they aren’t listed in the machine’s installation records.
- Bug Fixes
- When a plugin is available from multiple marketplaces, the CLI asks you to specify one.
- If a plugin remains unavailable after a refresh failure, the error includes details about the failure.