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
30 changes: 16 additions & 14 deletions packages/create-nx-workspace/src/internal-utils/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,22 @@ export async function determineAiAgents(
}

async function aiAgentsPrompt(): Promise<Agent[]> {
return (
await enquirer.prompt<{ agents: Agent[] }>([
{
name: 'agents',
message:
'Which AI agents would you like to set up? (space to select, enter to confirm)',
type: 'multiselect',
choices: supportedAgents.map((a) => ({
name: a,
message: agentDisplayMap[a],
})),
},
])
).agents;
const promptConfig: Parameters<typeof enquirer.prompt>[0] & {
footer: () => void;
} = {
name: 'agents',
message: 'Which AI agents, if any, would you like to set up?',
type: 'multiselect',
choices: supportedAgents.map((a) => ({
name: a,
message: agentDisplayMap[a],
})),
footer: () =>
chalk.dim(
'Multiple selections possible. <Space> to select. <Enter> to confirm.'
),
};
return (await enquirer.prompt<{ agents: Agent[] }>([promptConfig])).agents;
}

export async function determineDefaultBase(
Expand Down
31 changes: 17 additions & 14 deletions packages/nx/src/command-line/init/ai-agent-prompts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { prompt } from 'enquirer';
import { isCI } from '../../utils/is-ci';
import { Agent, agentDisplayMap, supportedAgents } from '../../ai/utils';
import chalk = require('chalk');

export async function determineAiAgents(
aiAgents?: Agent[],
Expand All @@ -17,18 +18,20 @@ export async function determineAiAgents(
}

async function aiAgentsPrompt(): Promise<Agent[]> {
return (
await prompt<{ agents: Agent[] }>([
{
name: 'agents',
message:
'Which AI agents would you like to set up? (space to select, enter to confirm)',
type: 'multiselect',
choices: supportedAgents.map((a) => ({
name: a,
message: agentDisplayMap[a],
})),
},
])
).agents;
const promptConfig: Parameters<typeof prompt>[0] & {
footer: () => void;
} = {
name: 'agents',
message: 'Which AI agents, if any, would you like to set up?',
type: 'multiselect',
choices: supportedAgents.map((a) => ({
name: a,
message: agentDisplayMap[a],
})),
footer: () =>
chalk.dim(
'Multiple selections possible. <Space> to select. <Enter> to confirm.'
),
};
return (await prompt<{ agents: Agent[] }>([promptConfig])).agents;
}
Loading