Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/cli/src/features/prompts/prompt-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
select,
text,
} from "@clack/prompts";
import { renderCliMutedText } from "../../utils/terminal-format";
import type {
ConfirmPromptOptions,
PasswordPromptOptions,
Expand Down Expand Up @@ -67,8 +68,7 @@ function withPromptDescription<
if (!description) return options;
return {
...options,
message: `${options.message}\n${description}`,
description: undefined,
description: renderCliMutedText(description),
};
}

Expand Down
29 changes: 22 additions & 7 deletions packages/cli/tests/prompt-adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@ import type {
PromptBackend,
SelectPromptOptions,
} from "../src/features/prompts";
import { renderCliMutedText } from "../src/utils/terminal-format";

describe("prompt adapter", () => {
it("renders prompt descriptions after the question", async () => {
const messages: string[] = [];
it("passes prompt descriptions separately with the muted CLI style", async () => {
const prompts: Array<{ message: string; description?: string }> = [];
const adapter = createPromptAdapter(
backend({
text: async (options) => {
messages.push(options.message);
prompts.push({
message: options.message,
description: options.description,
});
return "answered";
},
confirm: async (options) => {
messages.push(options.message);
prompts.push({
message: options.message,
description: options.description,
});
return true;
},
}),
Expand All @@ -33,9 +40,17 @@ describe("prompt adapter", () => {
description: "Keeps agent changes out of the main checkout.",
});

expect(messages).toEqual([
"Workspace name\nNames this local devos workspace.",
"Use isolated worktrees?\nKeeps agent changes out of the main checkout.",
expect(prompts).toEqual([
{
message: "Workspace name",
description: renderCliMutedText("Names this local devos workspace."),
},
{
message: "Use isolated worktrees?",
description: renderCliMutedText(
"Keeps agent changes out of the main checkout.",
),
},
]);
});

Expand Down
Loading