Skip to content

Commit 1faabca

Browse files
zerone0xclaude
andcommitted
fix(cli): skip agent selector when AGENTS.md already exists
When running `vp migrate`, detect existing agent instruction files (AGENTS.md, CLAUDE.md, etc.) in the project root and reuse them instead of showing the interactive agent selector prompt. Fixes #903 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent db67e9b commit 1faabca

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

packages/cli/src/migration/bin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ async function collectMigrationPlan(
343343
const selectedAgentTargetPaths = await selectAgentTargetPaths({
344344
interactive: options.interactive,
345345
agent: options.agent,
346+
projectRoot: rootDir,
346347
onCancel: () => cancelAndExit(),
347348
});
348349

packages/cli/src/utils/agent.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,27 @@ const AGENT_INSTRUCTIONS_END_MARKER = '<!--VITE PLUS END-->';
196196
export async function selectAgentTargetPaths({
197197
interactive,
198198
agent,
199+
projectRoot,
199200
onCancel,
200201
}: {
201202
interactive: boolean;
202203
agent?: AgentSelection;
204+
projectRoot?: string;
203205
onCancel: () => void;
204206
}) {
205207
// Skip entirely if --no-agent is passed
206208
if (agent === false) {
207209
return undefined;
208210
}
209211

212+
// If agent files already exist in the project, reuse them instead of prompting
213+
if (interactive && !agent && projectRoot) {
214+
const existingPaths = detectExistingAgentTargetPaths(projectRoot);
215+
if (existingPaths) {
216+
return existingPaths;
217+
}
218+
}
219+
210220
if (interactive && !agent) {
211221
const selectedAgents = await prompts.multiselect({
212222
message: 'Which agents are you using?',

0 commit comments

Comments
 (0)