feat(cli): suggest known instance URLs in workspace add (#12234)

* feat(cli): suggest known instance URLs in workspace add

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: retry bun setup in cli tests after a release download outage

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-05 13:01:05 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent c60384cde7
commit 294b7086aa
2 changed files with 88 additions and 3 deletions
+41
View File
@@ -47,7 +47,22 @@ jobs:
with:
node-version: "20"
# setup-bun downloads from GitHub releases on every run and gives up after
# ~40s of 504s; outages last longer, so each job retries once after a pause.
- name: Setup Bun
id: setup-bun
continue-on-error: true
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Wait before retrying Bun setup
if: steps.setup-bun.outcome == 'failure'
shell: bash
run: sleep 60
- name: Setup Bun (retry)
if: steps.setup-bun.outcome == 'failure'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
@@ -94,6 +109,19 @@ jobs:
node-version: "20"
- name: Setup Bun
id: setup-bun
continue-on-error: true
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Wait before retrying Bun setup
if: steps.setup-bun.outcome == 'failure'
shell: bash
run: sleep 60
- name: Setup Bun (retry)
if: steps.setup-bun.outcome == 'failure'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
@@ -148,6 +176,19 @@ jobs:
node-version: "20"
- name: Setup Bun
id: setup-bun
continue-on-error: true
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Wait before retrying Bun setup
if: steps.setup-bun.outcome == 'failure'
shell: bash
run: sleep 60
- name: Setup Bun (retry)
if: steps.setup-bun.outcome == 'failure'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
+47 -3
View File
@@ -184,6 +184,47 @@ export async function setActiveWorkspace(
await writeFile(file, workspaceName, "utf-8");
}
const CLOUD_REMOTE = "https://app.windmill.dev/";
// Cliffy's list only previews the highlighted entry: Enter submits the typed
// text (empty, so the default) unless Tab was pressed first.
class PickableInput extends Input {
protected override getValue(): string {
const highlighted = this.suggestions[this.suggestionsIndex];
if (!this.inputValue && highlighted !== undefined) {
return highlighted.toString();
}
return super.getValue();
}
}
async function knownRemotes(
opts: GlobalOptions
): Promise<{ suggestions: string[]; defaultRemote: string }> {
const remotes: string[] = [];
for (const w of await allWorkspaces(opts.configDir)) {
try {
const remote = new URL(w.remote).toString();
if (!remotes.includes(remote)) remotes.push(remote);
} catch {
// skip a malformed profile
}
}
const active = await getActiveWorkspace(opts);
let defaultRemote = CLOUD_REMOTE;
try {
if (active) defaultRemote = new URL(active.remote).toString();
} catch {
// keep the cloud default
}
const suggestions = [
defaultRemote,
...remotes.filter((r) => r !== defaultRemote),
];
if (!suggestions.includes(CLOUD_REMOTE)) suggestions.push(CLOUD_REMOTE);
return { suggestions, defaultRemote };
}
export async function add(
opts: GlobalOptions & {
create: boolean;
@@ -225,11 +266,14 @@ export async function add(
remote = url.toString();
} catch {
// not a url
const { suggestions, defaultRemote } = await knownRemotes(opts);
remote = new URL(
await Input.prompt({
await PickableInput.prompt({
message: "Enter the Remote URL",
suggestions: ["https://app.windmill.dev/"],
default: "https://app.windmill.dev/",
suggestions,
list: suggestions.length > 1,
info: suggestions.length > 1,
default: defaultRemote,
})
).toString();
}