feat: Add an --agent flag and interactive prompt. - #431
Conversation
7a78d70 to
1fcfe6e
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds an --agent flag and interactive prompt to the new and migrate commands, allowing users to select their coding agent and automatically write agent instructions to the appropriate file. The prompts in the vite new command are also reordered for better user flow.
Changes:
- New agent utility module with support for multiple coding agents (ChatGPT, Claude, Copilot, Cursor, JetBrains, etc.)
- Interactive agent selection prompt with skip/append options for existing files
- Reordered
vite newprompts: template → name → package manager → agent → git repo
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/global/src/utils/agent.ts | New utility module for agent selection and file writing logic |
| packages/global/src/utils/index.ts | Exports the new agent utilities |
| packages/global/src/new/bin.ts | Integrates agent selection into the new command workflow |
| packages/global/src/new/discovery.ts | Exports inferParentDir function for reuse |
| packages/global/src/migration/bin.ts | Integrates agent selection into the migration command |
| packages/global/AGENTS.md | Placeholder agent instructions file |
| packages/global/package.json | Adds AGENTS.md to published files |
| README.md | Updates project tagline |
| packages/global/snap-tests/* | Updates snapshot tests to reflect new AGENTS.md file creation |
Comments suppressed due to low confidence (1)
packages/global/src/new/bin.ts:469
- This code block duplicates the logic from lines 363-375 for handling package name and target directory prompting. The duplication suggests this logic was moved earlier in the flow but not fully removed. This creates maintenance burden as changes to the prompting logic need to be made in two places.
let result: ExecutionResult;
if (templateInfo.type === TemplateType.builtin) {
// prompt for package name if not provided
if (!targetDir) {
let defaultPackageName = `vite-plus-${templateInfo.command.split(':')[1]}`;
if (workspaceInfo.monorepoScope) {
defaultPackageName = `${workspaceInfo.monorepoScope}/${defaultPackageName}`;
}
const selected = await promptPackageNameAndTargetDir(defaultPackageName, options.interactive);
packageName = selected.packageName;
targetDir = templateInfo.parentDir
? path.join(templateInfo.parentDir, selected.targetDir)
: selected.targetDir;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This PR adds an
--agentflag and an interactive "agent" prompt to thenewandmigratecommands. It allows selecting the coding agent that the user users, and will write theAGENT.mdfile from the package into the user's project using the name preferred by the selected agent.For migrate, it will propose appending to the file if it already exists.
The PR also reorders the
vite newprompts.Before: template, package manager, name, git repo
After: template, name, package manager, agent, git repo
I will add actual content into the AGENTS.md in a follow-up.