Skip to content

feat: Add an --agent flag and interactive prompt. - #431

Merged
cpojer merged 1 commit into
mainfrom
agent-flag
Jan 15, 2026
Merged

cpojer merged 1 commit into
mainfrom
agent-flag

Conversation

@cpojer

@cpojer cpojer commented Jan 15, 2026

Copy link
Copy Markdown
Member

This PR adds an --agent flag and an interactive "agent" prompt to the new and migrate commands. It allows selecting the coding agent that the user users, and will write the AGENT.md file 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 new prompts.
Before: template, package manager, name, git repo
After: template, name, package manager, agent, git repo

CleanShot 2026-01-15 at 14.52.38@2x.png

I will add actual content into the AGENTS.md in a follow-up.

cpojer commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cpojer
cpojer force-pushed the agent-flag branch 2 times, most recently from 7a78d70 to 1fcfe6e Compare January 15, 2026 05:48
@cpojer
cpojer marked this pull request as ready for review January 15, 2026 05:57
Copilot AI review requested due to automatic review settings January 15, 2026 05:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 new prompts: 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.

Comment thread packages/global/src/utils/agent.ts Outdated
Comment thread packages/global/src/new/bin.ts
Comment thread packages/global/AGENTS.md
Comment thread packages/global/AGENTS.md
Copilot AI review requested due to automatic review settings January 15, 2026 06:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/global/src/utils/agent.ts
@cpojer
cpojer merged commit dcd6bf3 into main Jan 15, 2026
16 checks passed
@cpojer
cpojer deleted the agent-flag branch January 15, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants