import"../../errors-pXKbCKbL.js";import"../../runner-DYk4q6mP.js";import"../../utils-DMbpVz3Q.js";import"../../pr-DC2iMrPz.js";import"../../view-BZmgL-cB.js";import"../../worktree-DTI5xaFs.js";import"../../create-DiqmyIaU.js";import{t as e}from"../../dispatcher-Ci7OG66P.js";import{Command as t,Flags as n}from"@oclif/core";var r=class r extends t{static summary=`Add a new git worktree`;static description=`
    Create a new git worktree with automatic path generation.
    Defaults to main branch if not specified.
    Use --select to choose a branch from an interactive list.
  `;static examples=[{description:`Add worktree for main branch (default)`,command:`<%= config.bin %> <%= command.id %>`},{description:`Create a new feature branch from main in a new worktree`,command:`<%= config.bin %> <%= command.id %> -b feature/foo --base main`},{description:`Create a detached worktree on main even if main is in use`,command:`<%= config.bin %> <%= command.id %> --detach --base main`},{description:`Add worktree for specific branch`,command:`<%= config.bin %> <%= command.id %> -b feature/login`},{description:`Add worktree with custom path`,command:`<%= config.bin %> <%= command.id %> -b feature/login -p ../my-worktree`},{description:`Pick a branch interactively`,command:`<%= config.bin %> <%= command.id %> --select`}];static flags={branch:n.string({char:`b`,description:`Branch name (defaults to main)`}),path:n.string({char:`p`,description:`Custom worktree path (auto-generated if not specified)`}),force:n.boolean({char:`f`,description:`Force operation`,default:!1}),base:n.string({description:`Start point when creating a new branch (defaults to main or current HEAD)`}),create:n.boolean({description:`Create the branch if it does not exist (uses -b). Use --no-create to require existing branch.`,default:!0,allowNo:!0}),detach:n.boolean({description:`Detach HEAD in new worktree`,default:!1}),select:n.boolean({description:`Use an interactive selector to choose the branch`,default:!1})};async run(){let{flags:t}=await this.parse(r),n=new e,i={action:`add`,branch:t.branch,path:t.path,base:t.base,create:t.create,force:t.force,detach:t.detach,interactive:t.select};try{let e=await n.execute({command:`worktree`,cwd:process.cwd(),data:i});this.log(`✓ ${e.message}`),e.details?.output&&this.log(`
`+e.details.output)}catch(e){this.error(e.message,{exit:1})}}};export{r as default};