Skip to content

Commit 1f0fe2e

Browse files
authored
When only one agent is available, directly use it (#58)
1 parent e655143 commit 1f0fe2e

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

packages/spark/src/clack-wizard.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,10 @@ async function selectBuiltInCodingTool(
529529
throw new Error(COPY.instrumentation.builtIn.noUsableToolsError);
530530
}
531531

532+
if (usable.length === 1) {
533+
return usable[0]!;
534+
}
535+
532536
const value = unwrap(
533537
prompts,
534538
await prompts.select<CodingToolStatus>({

packages/spark/test/clack-wizard.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ function createBraintrustCliStub(
353353
describe("runClackWizard", () => {
354354
it("walks through the happy path with one usable coding tool", async () => {
355355
const { prompts, events } = createPrompts({
356-
selects: ["yes", "no", "first", "first", "production-done"],
356+
selects: ["yes", "no", "first", "production-done"],
357357
});
358358
const deps = buildDeps({ prompts });
359359

@@ -367,7 +367,7 @@ describe("runClackWizard", () => {
367367
expect(events).toContain(`select:${ACCOUNT_QUESTION}`);
368368
expect(events).toContain(`select:${CLI_INSTALL_MESSAGE}`);
369369
expect(events).toContain(`select:${INSTRUMENTATION_MODE_MESSAGE}`);
370-
expect(events).toContain(`select:${TOOL_SELECT_MESSAGE}`);
370+
expect(events).not.toContain(`select:${TOOL_SELECT_MESSAGE}`);
371371
expect(events.some((event) => event.startsWith("info:Sign in:"))).toBe(
372372
true,
373373
);

0 commit comments

Comments
 (0)