import"../../errors-pXKbCKbL.js";import"../../editor-BmJI32_P.js";import"../../fsStore-BzLA1cBc.js";import"../../base-xqced3zT.js";import"../../config-Bphz_1Sc.js";import"../../template-Cpbt9qy8.js";import"../../xling-DyktHkvX.js";import{n as e,t}from"../../types-DI1Q0wjk.js";import{t as n}from"../../runner-B6FwKadj.js";import{Args as r,Command as i,Flags as a}from"@oclif/core";import o from"cli-table3";var s=class s extends i{static summary=`Shortcut eXecute - run predefined command shortcuts`;static description=`
    Execute predefined command shortcuts configured in ~/.claude/xling.json.

    Shortcuts allow you to create custom aliases for frequently used xling commands
    with pre-configured arguments. This makes it easy to run complex commands without
    having to remember long argument lists.

    Use --list to see all available shortcuts.

    Pass additional arguments after the shortcut name to append them to the
    configured arguments.

    Configuration example in ~/.claude/xling.json:
    {
      "shortcuts": {
        "lc": {
          "command": "x",
          "args": ["-t", "claude", "-c"],
          "description": "Launch Claude and continue"
        },
        "gs": {
          "command": "settings:list",
          "args": ["--tool", "codex"],
          "description": "List Codex settings"
        }
      }
    }

    Examples:
      $ xling sx lc                    # Run shortcut "lc"
      $ xling sx --list                # List all shortcuts
      $ xling sx lc -- --no-yolo       # Run "lc" with extra args
  `;static examples=[{description:`List all available shortcuts`,command:`<%= config.bin %> <%= command.id %> --list`},{description:`Execute a shortcut`,command:`<%= config.bin %> <%= command.id %> lc`},{description:`Execute shortcut with additional arguments`,command:`<%= config.bin %> <%= command.id %> lc -- --no-yolo`}];static flags={list:a.boolean({char:`l`,description:`List all available shortcuts`,default:!1})};static args={name:r.string({description:`Shortcut name to execute`,required:!1})};static strict=!1;async run(){let{args:r,argv:i,flags:a}=await this.parse(s);try{let e=new n(this.config);if(a.list){let t=await e.list();if(t.length===0){this.log(`No shortcuts configured.`),this.log(`
Add shortcuts to ~/.claude/xling.json:
{
  "shortcuts": {
    "lc": {
      "command": "x",
      "args": ["-t", "claude", "-c"],
      "description": "Launch Claude and continue"
    }
  }
}`);return}let n=new o({head:[`Name`,`Type`,`Command`,`Description`],colWidths:[12,10,40,30],wordWrap:!0});for(let e of t)n.push([e.name,e.type,e.command,e.description||`-`]);this.log(n.toString());return}r.name||this.error(`Shortcut name required. Use --list to see available shortcuts.`,{exit:1});let t=i.indexOf(r.name),s=t>=0?i.slice(t+1):[];await e.run(r.name,s)}catch(n){throw(n instanceof e||n instanceof t)&&this.error(n.message,{exit:1}),n}}};export{s as default};