Skip to content

Commit 5898858

Browse files
zerone0xclaudefengmk2
authored
fix(cli): skip agent selector when AGENTS.md already exists (#937)
## Summary - When running `vp migrate`, the agent selector prompt is now skipped if agent instruction files (e.g. `AGENTS.md`, `CLAUDE.md`) already exist in the project root - Uses the existing `detectExistingAgentTargetPaths()` utility to check for files before showing the interactive multiselect - Adds an optional `projectRoot` parameter to `selectAgentTargetPaths()` to enable detection without breaking existing callers Fixes #903 ## Test plan - [ ] Run `vp migrate` in a project with an existing `AGENTS.md` — agent selector prompt should be skipped - [ ] Run `vp migrate` in a project without any agent files — agent selector prompt should appear as before - [ ] Run `vp migrate --no-agent` — should still skip agent setup entirely - [ ] Run `vp migrate --agent claude` — should still use the explicit agent selection 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
1 parent 3782ae1 commit 5898858

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

  • packages/cli/src/migration

packages/cli/src/migration/bin.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from '../types/index.js';
1515
import {
1616
detectAgentConflicts,
17+
detectExistingAgentTargetPaths,
1718
selectAgentTargetPaths,
1819
writeAgentInstructions,
1920
} from '../utils/agent.js';
@@ -339,12 +340,19 @@ async function collectMigrationPlan(
339340
}
340341
}
341342

342-
// 3. Agent selection
343-
const selectedAgentTargetPaths = await selectAgentTargetPaths({
344-
interactive: options.interactive,
345-
agent: options.agent,
346-
onCancel: () => cancelAndExit(),
347-
});
343+
// 3. Agent selection (auto-detect existing agent files to skip the selector prompt)
344+
const existingAgentTargetPaths =
345+
options.agent !== undefined || !options.interactive
346+
? undefined
347+
: detectExistingAgentTargetPaths(rootDir);
348+
const selectedAgentTargetPaths =
349+
existingAgentTargetPaths !== undefined
350+
? existingAgentTargetPaths
351+
: await selectAgentTargetPaths({
352+
interactive: options.interactive,
353+
agent: options.agent,
354+
onCancel: () => cancelAndExit(),
355+
});
348356

349357
// 4. Agent conflict detection + prompting
350358
const agentConflicts = await detectAgentConflicts({

0 commit comments

Comments
 (0)