xling 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{backend-router-aOcWH4J_.js → backend-router-BVglKdTL.js} +1 -1
- package/dist/{base-Cb8gvSZx.js → base-ES3hc6uu.js} +1 -1
- package/dist/{claude-CgDMZ5NR.js → claude-BJ1kVclm.js} +1 -1
- package/dist/{codex-Czpk7Br1.js → codex-DO3xGhyb.js} +1 -1
- package/dist/commands/git/prc.js +1 -1
- package/dist/commands/git/prr.js +1 -1
- package/dist/commands/git/prv.js +1 -1
- package/dist/commands/git/worktree.js +1 -1
- package/dist/commands/git/wta.js +1 -1
- package/dist/commands/git/wtl.js +1 -1
- package/dist/commands/git/wtp.js +1 -1
- package/dist/commands/git/wtr.js +1 -1
- package/dist/commands/git/wts.js +1 -1
- package/dist/commands/p/index.js +1 -1
- package/dist/commands/version/index.js +1 -1
- package/dist/commands/x/index.js +1 -1
- package/dist/{create-C3P6UYhE.js → create-CoP40LJP.js} +1 -1
- package/dist/{dispatcher-KWhvzTOg.js → dispatcher-CrrrsRFX.js} +1 -1
- package/dist/{dispatcher-CPtFZ27f.js → dispatcher-gwnQwr6V.js} +1 -1
- package/dist/{gemini-Bf13TKO0.js → gemini-DjOdjVmz.js} +1 -1
- package/dist/{pr-BNviK79Q.js → pr-B-Wvra01.js} +1 -1
- package/dist/runner-DfsWnEWI.js +1 -0
- package/dist/services/git/create.js +1 -1
- package/dist/services/git/dispatcher.js +1 -1
- package/dist/services/git/pr.js +1 -1
- package/dist/services/git/utils.js +1 -1
- package/dist/services/git/view.js +1 -1
- package/dist/services/git/worktree.js +1 -1
- package/dist/services/launch/adapters/base.js +1 -1
- package/dist/services/launch/adapters/claude.js +1 -1
- package/dist/services/launch/adapters/codex.js +1 -1
- package/dist/services/launch/adapters/gemini.js +1 -1
- package/dist/services/launch/dispatcher.js +1 -1
- package/dist/services/p/backend-router.js +1 -1
- package/dist/utils/runner.d.ts +14 -1
- package/dist/utils/runner.js +1 -1
- package/dist/{utils-DugkWRYo.js → utils-7jommWkE.js} +1 -1
- package/dist/{view-zF4lc17m.js → view-D96BK69H.js} +1 -1
- package/dist/{worktree-CrkzOfkB.js → worktree-D9lv01RB.js} +1 -1
- package/package.json +1 -1
- package/dist/runner-QW_B2Hqh.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,t}from"./runner-DfsWnEWI.js";async function n(e){return t(r(e))}function r(e){return e===`codex`?`codex`:e===`gemini`?`gemini`:`claude`}function i(e,t,n){let i=r(e),o=e===`codex`?[`exec`,t]:[`-p`,t];return e===`gemini`&&n.model&&o.unshift(`-m`,n.model),{executable:i,baseArgs:o,yoloArgs:a(e,n.yolo)}}function a(e,t){if(t)switch(e){case`codex`:return[`--dangerously-bypass-approvals-and-sandbox`];case`gemini`:return[`-y`];case`claude`:return[`--dangerously-skip-permissions`]}}async function o(t,n,r){await e(i(t,n,r))}export{r as i,n,o as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./runner-
|
|
1
|
+
import{n as e,t}from"./runner-DfsWnEWI.js";var n=class{async validateAvailability(){return t(this.executable)}async getVersion(){try{return await e(this.executable)}catch{return`unknown`}}};export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./base-
|
|
1
|
+
import{t as e}from"./base-ES3hc6uu.js";import*as t from"node:fs";import*as n from"node:path";import*as r from"node:os";var i=class extends e{toolId=`claude`;executable=`claude`;buildCommandSpec(e){let t=[];if(e.continue?t.push(`-c`):e.resume&&t.push(`-r`),e.settings){let n=this.#e(e.settings);t.push(`--settings`,n)}return{executable:this.executable,baseArgs:t,yoloArgs:e.yolo?[`--dangerously-skip-permissions`]:void 0}}#e(e){if(e.trim().startsWith(`{`)||n.isAbsolute(e)||e.endsWith(`.json`))return e;let i=n.join(r.homedir(),`.claude`),a=n.join(i,`settings.${e}.json`);if(t.existsSync(a))return a;let o=n.join(i,`settings-${e}.json`);return t.existsSync(o)?o:a}};export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./base-
|
|
1
|
+
import{t as e}from"./base-ES3hc6uu.js";var t=class extends e{toolId=`codex`;executable=`codex`;buildCommandSpec(e){let t=[];if(e.settings){let n=this.#e(e.settings);t.push(...n)}return e.continue?t.push(`resume`,`--last`):e.resume&&t.push(`resume`),{executable:this.executable,baseArgs:t,yoloArgs:e.yolo?[`--dangerously-bypass-approvals-and-sandbox`]:void 0}}#e(e){let t=[];if(e.includes(`=`)){let n=e.split(`;`).map(e=>e.trim());for(let e of n)e&&t.push(`-c`,e)}else t.push(`-c`,`model=${e}`);return t}};export{t};
|
package/dist/commands/git/prc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"../../git-DrTSFbmV.js";import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import{t as e}from"../../git-DrTSFbmV.js";import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t}from"../../dispatcher-gwnQwr6V.js";import{Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Create a pull request (PR Create)`;static description=`
|
|
2
2
|
Create a pull request using GitHub CLI.
|
|
3
3
|
Supports automatic browser preview with customizable browser selection.
|
|
4
4
|
`;static examples=[{description:`Create PR interactively`,command:`<%= config.bin %> <%= command.id %>`},{description:`Create PR with title and body`,command:`<%= config.bin %> <%= command.id %> --title "Feature X" --body "Implements feature X"`},{description:`Create PR and open in browser`,command:`<%= config.bin %> <%= command.id %> --web`},{description:`Create PR and preview in Safari`,command:`<%= config.bin %> <%= command.id %> --web --browser safari`},{description:`Create draft PR`,command:`<%= config.bin %> <%= command.id %> --draft --title "WIP: Feature X"`},{description:`Create PR with reviewers and labels`,command:`<%= config.bin %> <%= command.id %> --reviewer user1 --reviewer user2 --label bug --label urgent`}];static flags={title:r.string({char:`t`,description:`PR title`}),body:r.string({char:`b`,description:`PR body/description`}),base:r.string({description:`Base branch (default: repository default branch)`}),head:r.string({description:`Head branch (default: current branch)`}),draft:r.boolean({char:`d`,description:`Create as draft PR`,default:!1}),web:r.boolean({char:`w`,description:`Open PR in browser after creation`,default:!1}),browser:r.string({description:`Browser to use when --web is enabled`,options:[...e],default:`chrome`}),assignee:r.string({char:`a`,description:`Assign user(s) (can be used multiple times)`,multiple:!0}),reviewer:r.string({char:`r`,description:`Request reviewer(s) (can be used multiple times)`,multiple:!0}),label:r.string({char:`l`,description:`Add label(s) (can be used multiple times)`,multiple:!0})};async run(){let{flags:e}=await this.parse(i),n=new t,r={title:e.title,body:e.body,base:e.base,head:e.head,draft:e.draft,web:e.web,browser:e.browser,assignee:e.assignee,reviewer:e.reviewer,label:e.label};try{let e=await n.execute({command:`prc`,cwd:process.cwd(),data:r});this.log(`✓ ${e.message}`),e.details?.draft&&this.log(` Type: Draft PR`),e.details?.base&&this.log(` Base: ${e.details.base}`),e.details?.head&&this.log(` Head: ${e.details.head}`)}catch(e){this.error(e.message,{exit:1})}}};export{i as default};
|
package/dist/commands/git/prr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.js";import{Args as t,Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Checkout a PR branch (PR Read/Retrieve)`;static description=`
|
|
2
2
|
Checkout a pull request branch using GitHub CLI (gh) or git fallback.
|
|
3
3
|
Automatically detects gh availability and falls back to git fetch if needed.
|
|
4
4
|
`;static examples=[{description:`Checkout PR using gh or git fallback`,command:`<%= config.bin %> <%= command.id %> 123`},{description:`Checkout PR to specific branch`,command:`<%= config.bin %> <%= command.id %> 456 --branch my-pr-branch`},{description:`Force git fallback with custom remote`,command:`<%= config.bin %> <%= command.id %> 789 --no-gh --remote upstream`},{description:`Checkout a PR from another repo (owner:repo#id)`,command:`<%= config.bin %> <%= command.id %> octo/demo-repo#321 --branch demo-pr`}];static args={id:t.string({description:`PR number or owner:repo#123 format`,required:!0})};static flags={branch:r.string({char:`b`,description:`Branch name (default: pr/<id>)`}),remote:r.string({char:`r`,description:`Remote name`,default:`origin`}),"no-gh":r.boolean({description:`Skip GitHub CLI, use git directly`,default:!1})};async run(){let{args:t,flags:n}=await this.parse(i),r=new e,a={id:t.id,branch:n.branch,strategy:n[`no-gh`]?`git`:`gh`,remote:n.remote};try{let e=await r.execute({command:`prr`,cwd:process.cwd(),data:a});this.log(`✓ ${e.message}`),e.details&&(this.log(` Strategy: ${e.details.strategy}`),this.log(` Branch: ${e.details.branch}`))}catch(e){this.error(e.message,{exit:1})}}};export{i as default};
|
package/dist/commands/git/prv.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"../../git-DrTSFbmV.js";import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import{t as e}from"../../git-DrTSFbmV.js";import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t}from"../../dispatcher-gwnQwr6V.js";import{Args as n,Command as r,Flags as i}from"@oclif/core";var a=class a extends r{static summary=`Open PR in web browser (PR View)`;static description=`
|
|
2
2
|
Open a pull request in your web browser using GitHub CLI.
|
|
3
3
|
Supports multiple browsers: Chrome (default), Safari, Firefox, Arc, Edge, Dia.
|
|
4
4
|
`;static examples=[{description:`Open PR in Chrome (default)`,command:`<%= config.bin %> <%= command.id %> 123`},{description:`Open PR in Safari`,command:`<%= config.bin %> <%= command.id %> 456 --browser safari`},{description:`Open PR in Firefox`,command:`<%= config.bin %> <%= command.id %> 789 --browser firefox`},{description:`Open PR in Arc`,command:`<%= config.bin %> <%= command.id %> 999 --browser arc`},{description:`Open a PR from another repo in Edge`,command:`<%= config.bin %> <%= command.id %> octo/demo-repo#42 --browser edge`}];static args={id:n.string({description:`PR number`,required:!0})};static flags={browser:i.string({char:`b`,description:`Browser to use`,options:[...e],default:`chrome`})};async run(){let{args:e,flags:n}=await this.parse(a),r=new t,i={id:e.id,browser:n.browser};try{let e=await r.execute({command:`prv`,cwd:process.cwd(),data:i});this.log(`✓ ${e.message}`)}catch(e){this.error(e.message,{exit:1})}}};export{a as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.js";import{Command as t,Flags as n}from"@oclif/core";var r=class r extends t{static summary=`Manage git worktrees`;static description=`
|
|
2
2
|
Manage git worktrees: list existing worktrees, add new ones, remove, or prune stale entries.
|
|
3
3
|
Git worktrees allow multiple working directories from a single repository.
|
|
4
4
|
`;static examples=[{description:`List all worktrees in friendly format`,command:`<%= config.bin %> <%= command.id %> --list`},{description:`Add new worktree with auto-generated path`,command:`<%= config.bin %> <%= command.id %> --add --branch feature/login`},{description:`Add worktree with custom path`,command:`<%= config.bin %> <%= command.id %> -a -p ../repo-feature -b feature/login`},{description:`Switch to main worktree (outputs path for cd)`,command:`cd $(<%= config.bin %> <%= command.id %> -s)`},{description:`Switch to specific worktree by branch name`,command:`cd $(<%= config.bin %> <%= command.id %> -s -b feature/login)`},{description:`Remove worktree by branch name`,command:`<%= config.bin %> <%= command.id %> -r -b main`},{description:`Remove worktree by directory name`,command:`<%= config.bin %> <%= command.id %> -r -b xling-feature`},{description:`Remove worktree by path`,command:`<%= config.bin %> <%= command.id %> -r -p ../repo-feature`},{description:`Prune stale worktrees`,command:`<%= config.bin %> <%= command.id %> --prune`}];static flags={list:n.boolean({char:`l`,description:`List worktrees (default)`,default:!1}),add:n.boolean({char:`a`,description:`Add new worktree (auto-generates path if not specified)`,default:!1}),switch:n.boolean({char:`s`,description:`Get worktree path (outputs path only, use with: cd $(xling git:worktree -s -b <branch>))`,default:!1}),remove:n.boolean({char:`r`,description:`Remove worktree`,default:!1}),prune:n.boolean({description:`Prune stale worktrees`,default:!1}),path:n.string({char:`p`,description:`Worktree path (e.g., '../repo-feature' or absolute path). Auto-generated if not specified with --add.`}),branch:n.string({char:`b`,description:`Branch or worktree name. Defaults to main for --add and --switch. For --remove, intelligently matches branch or directory name.`}),force:n.boolean({char:`f`,description:`Force operation`,default:!1}),detach:n.boolean({description:`Detach HEAD in new worktree`,default:!1})};async run(){let{flags:t}=await this.parse(r),n=`list`;t.add?n=`add`:t.switch?n=`switch`:t.remove?n=`remove`:t.prune&&(n=`prune`);let i=new e,a={action:n,path:t.path,branch:t.branch,force:t.force,detach:t.detach};try{let e=await i.execute({command:`worktree`,cwd:process.cwd(),data:a});if(n===`switch`){this.log(e.message);return}this.log(`✓ ${e.message}`),e.details?.output&&this.log(`
|
package/dist/commands/git/wta.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.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=`
|
|
2
2
|
Create a new git worktree with automatic path generation.
|
|
3
3
|
Defaults to main branch if not specified.
|
|
4
4
|
Use --select to choose a branch from an interactive list.
|
package/dist/commands/git/wtl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.js";import{Command as t}from"@oclif/core";var n=class extends t{static summary=`List git worktrees`;static description=`
|
|
2
2
|
List all git worktrees in a friendly format.
|
|
3
3
|
Shows the path and branch for each worktree.
|
|
4
4
|
`;static examples=[{description:`List all worktrees`,command:`<%= config.bin %> <%= command.id %>`},{description:`List worktrees and filter for feature branches`,command:`<%= config.bin %> <%= command.id %> | grep feature/`},{description:`List worktrees from another repo directory`,command:`cd ~/projects/my-repo && <%= config.bin %> <%= command.id %>`}];async run(){let t=new e,n={action:`list`};try{let e=await t.execute({command:`worktree`,cwd:process.cwd(),data:n});this.log(`✓ ${e.message}`),e.details?.output&&this.log(`
|
package/dist/commands/git/wtp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.js";import{Command as t}from"@oclif/core";var n=class extends t{static summary=`Prune stale git worktrees`;static description=`
|
|
2
2
|
Remove stale worktree administrative files.
|
|
3
3
|
This cleans up worktrees that have been manually deleted from the filesystem.
|
|
4
4
|
`;static examples=[{description:`Prune stale worktrees`,command:`<%= config.bin %> <%= command.id %>`},{description:`Clean up after manually deleting a worktree folder`,command:`cd ~/repo && <%= config.bin %> <%= command.id %>`},{description:`Prune then list worktrees to verify`,command:`<%= config.bin %> <%= command.id %> && <%= config.bin %> git:wtl`}];async run(){let t=new e,n={action:`prune`};try{let e=await t.execute({command:`worktree`,cwd:process.cwd(),data:n});this.log(`✓ ${e.message}`),e.details?.output&&this.log(`
|
package/dist/commands/git/wtr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.js";import{Command as t,Flags as n}from"@oclif/core";var r=class r extends t{static summary=`Remove a git worktree`;static description=`
|
|
2
2
|
Remove a git worktree by branch name, directory name, or path.
|
|
3
3
|
Intelligently matches branch or directory names.
|
|
4
4
|
Use --select to pick which worktree to remove from an interactive list.
|
package/dist/commands/git/wts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.js";import{Command as t,Flags as n}from"@oclif/core";import{spawn as r}from"node:child_process";var i=class i extends t{static summary=`Switch to a git worktree (opens subshell by default)`;static description=`
|
|
2
2
|
Find a matching worktree, then start a subshell rooted there.
|
|
3
3
|
Defaults to the main branch if no branch/directory is provided.
|
|
4
4
|
Use --path-only for scripting (outputs the path for cd $(...)).
|
package/dist/commands/p/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-x3Es7YJ3.js";import"../../editor-DUx1Sby2.js";import"../../runner-
|
|
1
|
+
import"../../errors-x3Es7YJ3.js";import"../../editor-DUx1Sby2.js";import"../../runner-DfsWnEWI.js";import"../../config-D0b5Ceh4.js";import"../../fsStore-D1omjK0d.js";import"../../base-Dv8Ajp1w.js";import"../../template-DtJFiC8I.js";import{t as e}from"../../xling-DxPgM9hF.js";import"../../providerRegistry-Cioo_VTs.js";import"../../client-BklkqGNW.js";import{n as t,t as n}from"../../types-CDh8FKyF.js";import"../../loadBalancer-DNwUsuJG.js";import"../../errorClassifier-mZXKjKvv.js";import{n as r}from"../../router-DfJrwCH_.js";import{t as i}from"../../prompt-builder-CPDeJ-iv.js";import{i as a,n as o,r as s}from"../../backend-router-BVglKdTL.js";import{n as c,r as l,t as u}from"../../interactive-mode-CeP7yLWk.js";import{Args as d,Command as f,Flags as p}from"@oclif/core";import*as m from"node:fs";var h=class h extends f{static summary=`Execute prompts via xling router or AI CLI tools`;static description=`
|
|
2
2
|
Send prompts to AI models using xling's built-in router (default) or
|
|
3
3
|
delegate to CLI tools like codex exec, claude -p, or gemini.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Command as e}from"@oclif/core";var t=`0.11.
|
|
1
|
+
import{Command as e}from"@oclif/core";var t=`0.11.1`,n=class extends e{static summary=`Show the current xling version`;static description=`Displays the version from package.json.`;static examples=[{description:`Print the installed CLI version`,command:`<%= config.bin %> <%= command.id %>`},{description:`Shortcut using the built-in flag`,command:`<%= config.bin %> --version`}];async run(){this.log(t??`unknown`)}};export{n as default};
|
package/dist/commands/x/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../base-ES3hc6uu.js";import"../../claude-BJ1kVclm.js";import"../../codex-DO3xGhyb.js";import"../../gemini-DjOdjVmz.js";import{t as e}from"../../dispatcher-CrrrsRFX.js";import{Command as t,Flags as n}from"@oclif/core";var r=class r extends t{static summary=`eXecute AI CLI tools (defaults to Claude Code with yolo)`;static description=`
|
|
2
2
|
Quick launcher for Claude Code, Codex, or Gemini CLI with yolo mode enabled by default.
|
|
3
3
|
|
|
4
4
|
Just run "xling x" to start Claude Code instantly!
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./errors-x3Es7YJ3.js";import{r as t}from"./runner-
|
|
1
|
+
import{a as e}from"./errors-x3Es7YJ3.js";import{r as t}from"./runner-DfsWnEWI.js";import{t as n}from"./utils-7jommWkE.js";const r={chrome:{darwin:`Google Chrome`,linux:`google-chrome`,win32:`chrome`},safari:{darwin:`Safari`},firefox:{darwin:`Firefox`,linux:`firefox`,win32:`firefox`},arc:{darwin:`Arc`,win32:`Arc`},edge:{darwin:`Microsoft Edge`,linux:`microsoft-edge`,win32:`msedge`},dia:{darwin:`Dia`,linux:`dia`,win32:`dia`}};function i(e){let t=process.platform,n=r[e]?.[t];return n?t===`darwin`?`open -a "${n}"`:n:null}async function a(r,a){let{title:o,body:s,base:c,head:l,draft:u=!1,web:d=!1,browser:f=`chrome`,assignee:p=[],reviewer:m=[],label:h=[]}=r;if(!await n())throw new e(`gh`,`Install GitHub CLI: https://cli.github.com/`);let g=[`pr`,`create`];o&&g.push(`--title`,o),s&&g.push(`--body`,s),c&&g.push(`--base`,c),l&&g.push(`--head`,l),u&&g.push(`--draft`);for(let e of p)g.push(`--assignee`,e);for(let e of m)g.push(`--reviewer`,e);for(let e of h)g.push(`--label`,e);let _;if(d){g.push(`--web`);let e=i(f);if(!e)throw Error(`Browser "${f}" is not available on ${process.platform}. Supported browsers: chrome, safari (macOS only), firefox, arc, edge, dia`);_={GH_BROWSER:e}}let v=await t(`gh`,g,{cwd:a,env:_,throwOnError:!1});if(!v.success)throw Error(`Failed to create PR: ${v.stderr}`);return{success:!0,message:d?`Created PR and opened in ${f}`:`Created PR successfully`,details:{title:o,base:c,head:l,draft:u,web:d,browser:d?f:void 0,platform:process.platform}}}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./errors-x3Es7YJ3.js";import{
|
|
1
|
+
import{h as e}from"./errors-x3Es7YJ3.js";import{a as t}from"./runner-DfsWnEWI.js";import{t as n}from"./claude-BJ1kVclm.js";import{t as r}from"./codex-DO3xGhyb.js";import{t as i}from"./gemini-DjOdjVmz.js";var a=class{#e;constructor(){this.#e=new Map,this.#e.set(`claude`,new n),this.#e.set(`codex`,new r),this.#e.set(`gemini`,new i)}async execute(e){let n=this.#t(e.tool);if(!await n.validateAvailability())return{success:!1,message:`Tool "${e.tool}" is not installed or not found in PATH`};let r=e.yolo??!0,i=n.buildCommandSpec({yolo:r,resume:e.resume,continue:e.continue,settings:e.settings});try{let{pid:n,command:a}=await t(i,{cwd:e.cwd,args:e.args}),o={tool:e.tool,yolo:r,args:e.args??[]};return e.resume!==void 0&&(o.resume=e.resume),e.continue!==void 0&&(o.continue=e.continue),e.cwd&&(o.cwd=e.cwd),{success:!0,pid:n,command:a,message:`Launched ${e.tool} successfully (PID: ${n})`,data:o}}catch(t){return{success:!1,message:`Failed to launch ${e.tool}: ${t.message}`}}}#t(t){let n=this.#e.get(t);if(!n)throw new e(t);return n}registerAdapter(e){this.#e.set(e.toolId,e)}getSupportedTools(){return Array.from(this.#e.keys())}};export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./utils-
|
|
1
|
+
import{n as e}from"./utils-7jommWkE.js";import{t}from"./pr-B-Wvra01.js";import{t as n}from"./view-D96BK69H.js";import{t as r}from"./worktree-D9lv01RB.js";import{t as i}from"./create-CoP40LJP.js";var a=class{async execute(a){if(a.command!==`prv`&&await e(a.cwd),a.command===`worktree`)return r(a.data,a.cwd);if(a.command===`prr`)return t(a.data,a.cwd);if(a.command===`prv`)return n(a.data,a.cwd);if(a.command===`prc`)return i(a.data,a.cwd);throw Error(`Unknown git command: ${a.command}`)}};export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./base-
|
|
1
|
+
import{t as e}from"./base-ES3hc6uu.js";var t=class extends e{toolId=`gemini`;executable=`gemini`;buildCommandSpec(e){let t=[];if(e.continue?t.push(`--resume`,`latest`):e.resume&&t.push(`--list-sessions`),e.settings){let n=e.settings.split(`;`).map(e=>e.trim())[0];n&&t.push(`-m`,n)}return{executable:this.executable,baseArgs:t,yoloArgs:e.yolo?[`-y`]:void 0}}};export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e}from"./validators-kRNHvOZQ.js";import{s as t}from"./errors-x3Es7YJ3.js";import{r as n}from"./runner-
|
|
1
|
+
import{d as e}from"./validators-kRNHvOZQ.js";import{s as t}from"./errors-x3Es7YJ3.js";import{r as n}from"./runner-DfsWnEWI.js";import{t as r}from"./utils-7jommWkE.js";async function i(i,o){e(i.id);let s=i.id,c=a(s),l=i.branch??`pr/${c}`,{strategy:u,remote:d=`origin`}=i;if(u!==`git`&&await r())try{if((await n(`gh`,[`pr`,`checkout`,s],{cwd:o,throwOnError:!1})).success)return{success:!0,message:`Checked out PR #${s} using GitHub CLI`,details:{strategy:`gh`,branch:l}}}catch{}let f=`pull/${c}/head:${l}`,p=await n(`git`,[`fetch`,d,f],{cwd:o,throwOnError:!1});if(!p.success)throw new t(`git fetch ${d} ${f}`,p.stderr);let m=await n(`git`,[`switch`,l],{cwd:o,throwOnError:!1});if(!m.success)throw new t(`git switch ${l}`,m.stderr);return{success:!0,message:`Checked out PR #${s} to branch '${l}' using git`,details:{strategy:`git`,branch:l,remote:d}}}function a(e){let t=e.match(/(\d+)$/);return t?t[1]:e}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawn as e}from"node:child_process";import*as t from"node:path";function n(e){let t=e.map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;for(let e of[`.exe`,`.com`,`.cmd`,`.bat`]){let n=t.find(t=>t.toLowerCase().endsWith(e));if(n)return n}return t[0]??null}async function r(e){if(process.platform!==`win32`||t.isAbsolute(e)||t.extname(e))return e;let r=await s(`where`,[e],{silent:!0,throwOnError:!1});return!r.success||!r.stdout?e:n(r.stdout.split(/\r?\n/))??e}async function i(t,n){let i=[...t.baseArgs];t.yoloArgs&&i.push(...t.yoloArgs),n?.args&&i.push(...n.args);let a={...process.env,...t.envVars,...n?.env},o=await r(t.executable),s=e(o,i,{cwd:n?.cwd??process.cwd(),env:a,stdio:`inherit`,detached:!1}),c=`${o.includes(` `)?`"${o}"`:o} ${i.join(` `)}`;return new Promise((e,t)=>{s.on(`error`,e=>{t(Error(`Failed to spawn process: ${e.message}`))}),s.on(`spawn`,()=>{e({pid:s.pid,command:c})}),s.on(`exit`,e=>{e!==0&&e!==null&&t(Error(`Process exited with code ${e}`))})})}async function a(t){if(process.platform===`win32`){let e=await s(`where`,[t],{silent:!0,throwOnError:!1});return!e.success||!e.stdout?!1:n(e.stdout.split(/\r?\n/))!==null}return new Promise(n=>{let r=e(`which`,[t],{stdio:`ignore`});r.on(`error`,()=>n(!1)),r.on(`exit`,e=>n(e===0))})}async function o(t,n=[`--version`]){return new Promise((i,a)=>{let o=``;(async()=>{let s=e(await r(t),n,{stdio:[`ignore`,`pipe`,`pipe`]});s.stdout?.on(`data`,e=>{o+=e.toString()}),s.stderr?.on(`data`,e=>{o+=e.toString()}),s.on(`error`,e=>{a(Error(`Failed to get version: ${e.message}`))}),s.on(`exit`,e=>{e===0?i(o.trim()):a(Error(`Failed to get version`))})})().catch(e=>{a(e instanceof Error?e:Error(`Failed to get version`))})})}async function s(t,n,r={}){let{cwd:i=process.cwd(),env:a={},silent:o=!1,throwOnError:s=!0}=r;return new Promise((r,c)=>{let l=``,u=``,d=e(t,n,{cwd:i,env:{...process.env,...a},stdio:o?[`ignore`,`pipe`,`pipe`]:[`inherit`,`pipe`,`pipe`]});d.stdout?.on(`data`,e=>{l+=e.toString(),o||process.stdout.write(e)}),d.stderr?.on(`data`,e=>{u+=e.toString(),o||process.stderr.write(e)}),d.on(`error`,e=>{let t={stdout:l.trim(),stderr:e.message,exitCode:1,success:!1};s?c(t):r(t)}),d.on(`exit`,e=>{let t=e??1,n={stdout:l.trim(),stderr:u.trim(),exitCode:t,success:t===0};s&&!n.success?c(n):r(n)})})}export{i as a,n as i,o as n,s as r,a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import{t as e}from"../../create-CoP40LJP.js";export{e as createPr};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import"../../pr-B-Wvra01.js";import"../../view-D96BK69H.js";import"../../worktree-D9lv01RB.js";import"../../create-CoP40LJP.js";import{t as e}from"../../dispatcher-gwnQwr6V.js";export{e as GitDispatcher};
|
package/dist/services/git/pr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../validators-kRNHvOZQ.js";import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import{t as e}from"../../pr-B-Wvra01.js";export{e as checkoutPr};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import{n as e,t}from"../../utils-7jommWkE.js";export{t as detectGhCli,e as ensureGitRepo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../utils-7jommWkE.js";import{t as e}from"../../view-D96BK69H.js";export{e as viewPr};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import{t as e}from"../../worktree-D9lv01RB.js";export{e as manageWorktree};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../../runner-
|
|
1
|
+
import"../../../runner-DfsWnEWI.js";import{t as e}from"../../../base-ES3hc6uu.js";export{e as BaseLaunchAdapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../../runner-
|
|
1
|
+
import"../../../runner-DfsWnEWI.js";import"../../../base-ES3hc6uu.js";import{t as e}from"../../../claude-BJ1kVclm.js";export{e as ClaudeLaunchAdapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../../runner-
|
|
1
|
+
import"../../../runner-DfsWnEWI.js";import"../../../base-ES3hc6uu.js";import{t as e}from"../../../codex-DO3xGhyb.js";export{e as CodexLaunchAdapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../../runner-
|
|
1
|
+
import"../../../runner-DfsWnEWI.js";import"../../../base-ES3hc6uu.js";import{t as e}from"../../../gemini-DjOdjVmz.js";export{e as GeminiLaunchAdapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../errors-x3Es7YJ3.js";import"../../runner-
|
|
1
|
+
import"../../errors-x3Es7YJ3.js";import"../../runner-DfsWnEWI.js";import"../../base-ES3hc6uu.js";import"../../claude-BJ1kVclm.js";import"../../codex-DO3xGhyb.js";import"../../gemini-DjOdjVmz.js";import{t as e}from"../../dispatcher-CrrrsRFX.js";export{e as LaunchDispatcher};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../runner-
|
|
1
|
+
import"../../runner-DfsWnEWI.js";import{i as e,n as t,r as n,t as r}from"../../backend-router-BVglKdTL.js";export{r as buildCommandSpec,t as checkBackendAvailable,n as executeViaCli,e as getExecutable};
|
package/dist/utils/runner.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { o as LaunchCommandSpec } from "../types-B6FSmoLE.js";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/runner.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Pick a spawnable Windows executable from `where <name>` output.
|
|
7
|
+
*
|
|
8
|
+
* On Windows, package managers often generate multiple shims:
|
|
9
|
+
* - `<name>` (no extension) for Git Bash/MSYS
|
|
10
|
+
* - `<name>.cmd` for cmd.exe
|
|
11
|
+
* - or a real `<name>.exe`
|
|
12
|
+
*
|
|
13
|
+
* Bun's `child_process.spawn()` does not reliably resolve PATHEXT shims when
|
|
14
|
+
* you pass the bare command name (e.g. `codex`), so we prefer explicit paths.
|
|
15
|
+
*/
|
|
16
|
+
declare function selectWindowsWhereCandidate(whereLines: readonly string[]): string | null;
|
|
4
17
|
interface SpawnOptions {
|
|
5
18
|
cwd?: string;
|
|
6
19
|
env?: Record<string, string>;
|
|
@@ -49,4 +62,4 @@ interface RunCommandResult {
|
|
|
49
62
|
*/
|
|
50
63
|
declare function runCommand(command: string, args: string[], options?: RunCommandOptions): Promise<RunCommandResult>;
|
|
51
64
|
//#endregion
|
|
52
|
-
export { RunCommandOptions, RunCommandResult, SpawnOptions, SpawnResult, checkExecutable, getExecutableVersion, runCommand, spawnProcess };
|
|
65
|
+
export { RunCommandOptions, RunCommandResult, SpawnOptions, SpawnResult, checkExecutable, getExecutableVersion, runCommand, selectWindowsWhereCandidate, spawnProcess };
|
package/dist/utils/runner.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"../runner-DfsWnEWI.js";export{i as checkExecutable,n as getExecutableVersion,r as runCommand,t as selectWindowsWhereCandidate,e as spawnProcess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./errors-x3Es7YJ3.js";import{r as t,t as n}from"./runner-
|
|
1
|
+
import{c as e}from"./errors-x3Es7YJ3.js";import{r as t,t as n}from"./runner-DfsWnEWI.js";async function r(n=process.cwd()){try{let r=await t(`git`,[`rev-parse`,`--is-inside-work-tree`],{cwd:n,silent:!0,throwOnError:!1});if(!r.success||r.stdout.trim()!==`true`)throw new e(n)}catch{throw new e(n)}}async function i(){return await n(`gh`)}export{r as n,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./errors-x3Es7YJ3.js";import{r as t}from"./runner-
|
|
1
|
+
import{a as e}from"./errors-x3Es7YJ3.js";import{r as t}from"./runner-DfsWnEWI.js";import{t as n}from"./utils-7jommWkE.js";const r={chrome:{darwin:`Google Chrome`,linux:`google-chrome`,win32:`chrome`},safari:{darwin:`Safari`},firefox:{darwin:`Firefox`,linux:`firefox`,win32:`firefox`},arc:{darwin:`Arc`,win32:`Arc`},edge:{darwin:`Microsoft Edge`,linux:`microsoft-edge`,win32:`msedge`},dia:{darwin:`Dia`,linux:`dia`,win32:`dia`}};function i(e){let t=process.platform,n=r[e]?.[t];return n?t===`darwin`?`open -a "${n}"`:n:null}async function a(r,a){let{id:o,browser:s=`chrome`,openFlags:c=[]}=r;if(!await n())throw new e(`gh`,`Install GitHub CLI: https://cli.github.com/`);let l=i(s);if(!l)throw Error(`Browser "${s}" is not available on ${process.platform}. Supported browsers: chrome, safari (macOS only), firefox, arc, edge, dia`);let u={GH_BROWSER:l},d=await t(`gh`,[`pr`,`view`,o,`--web`,...c],{cwd:a,env:u,throwOnError:!1});if(!d.success)throw Error(`Failed to open PR #${o}: ${d.stderr}`);return{success:!0,message:`Opened PR #${o} in ${s}`,details:{id:o,browser:s,platform:process.platform}}}export{a as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e}from"./errors-x3Es7YJ3.js";import{r as t}from"./runner-
|
|
1
|
+
import{s as e}from"./errors-x3Es7YJ3.js";import{r as t}from"./runner-DfsWnEWI.js";import n from"node:readline";import{existsSync as r}from"node:fs";import i from"node:path";function a(e){return i.basename(e)}function o(e,t){let n=a(e),r=t.replace(/\//g,`-`);return i.join(e,`..`,`${n}-${r}`)}function s(e,t){t.path&&e.push({path:t.path,branch:t.branch,head:t.head})}function c(e){let t=[],n=e.trim().split(`
|
|
2
2
|
`),r={};for(let e of n)e.startsWith(`worktree `)?(s(t,r),r={path:e.substring(9)}):e.startsWith(`HEAD `)?r.head=e.substring(5):e.startsWith(`branch `)?r.branch=e.substring(7).replace(`refs/heads/`,``):e===``&&(s(t,r),r={});return s(t,r),t}async function l(n){let r=await t(`git`,[`worktree`,`list`,`--porcelain`],{cwd:n,throwOnError:!1});if(!r.success)throw new e(`git worktree list`,r.stderr);return c(r.stdout)}async function u(n){let r=await t(`git`,[`branch`,`--format=%(refname:short)`,`--sort=-committerdate`],{cwd:n,throwOnError:!1});if(!r.success)throw new e(`git branch --format=%(refname:short)`,r.stderr);return r.stdout.split(`
|
|
3
3
|
`).map(e=>e.trim()).filter(Boolean)}async function d(e,n){return(await t(`git`,[`rev-parse`,`--verify`,`--quiet`,n],{cwd:e,throwOnError:!1,silent:!0})).success}async function f(e,t,r=0){if(t.length===0)throw Error(`No options available for selection.`);let i=process.stdin,a=process.stdout;if(!i.isTTY||!a.isTTY)throw Error(`Interactive selection requires a TTY. Remove --select to continue.`);n.emitKeypressEvents(i),i.resume();let o=!!i.isRaw;i.setRawMode&&i.setRawMode(!0);let s=Math.min(Math.max(r,0),t.length-1),c=0,l=()=>{a.moveCursor(0,-c),a.clearScreenDown();let n=[e,`Use ↑/↓ then Enter to confirm. Press q or Ctrl+C to cancel.`,...t.map((e,t)=>{let n=`${t===s?`➜`:` `} ${e.label}`;return t===s?`\x1B[36m${n}\x1B[0m`:n})];a.write(n.join(`
|
|
4
4
|
`)+`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xling",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Unified CLI for AI tools: settings management, API proxy with load balancing, multi-model discussions",
|
|
5
5
|
"homepage": "https://github.com/kingsword09/xling/tree/main#readme",
|
|
6
6
|
"bugs": {
|
package/dist/runner-QW_B2Hqh.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{spawn as e}from"node:child_process";async function t(t,n){let r=[...t.baseArgs];t.yoloArgs&&r.push(...t.yoloArgs),n?.args&&r.push(...n.args);let i={...process.env,...t.envVars,...n?.env},a=e(t.executable,r,{cwd:n?.cwd??process.cwd(),env:i,stdio:`inherit`,detached:!1}),o=`${t.executable} ${r.join(` `)}`;return new Promise((e,t)=>{a.on(`error`,e=>{t(Error(`Failed to spawn process: ${e.message}`))}),a.on(`spawn`,()=>{e({pid:a.pid,command:o})}),a.on(`exit`,e=>{e!==0&&e!==null&&t(Error(`Process exited with code ${e}`))})})}async function n(t){return new Promise(n=>{let r=e(process.platform===`win32`?`where`:`which`,[t],{stdio:`ignore`});r.on(`error`,()=>n(!1)),r.on(`exit`,e=>n(e===0))})}async function r(t,n=[`--version`]){return new Promise((r,i)=>{let a=``,o=e(t,n,{stdio:[`ignore`,`pipe`,`pipe`]});o.stdout?.on(`data`,e=>{a+=e.toString()}),o.stderr?.on(`data`,e=>{a+=e.toString()}),o.on(`error`,e=>{i(Error(`Failed to get version: ${e.message}`))}),o.on(`exit`,e=>{e===0?r(a.trim()):i(Error(`Failed to get version`))})})}async function i(t,n,r={}){let{cwd:i=process.cwd(),env:a={},silent:o=!1,throwOnError:s=!0}=r;return new Promise((r,c)=>{let l=``,u=``,d=e(t,n,{cwd:i,env:{...process.env,...a},stdio:o?[`ignore`,`pipe`,`pipe`]:[`inherit`,`pipe`,`pipe`]});d.stdout?.on(`data`,e=>{l+=e.toString(),o||process.stdout.write(e)}),d.stderr?.on(`data`,e=>{u+=e.toString(),o||process.stderr.write(e)}),d.on(`error`,e=>{let t={stdout:l.trim(),stderr:e.message,exitCode:1,success:!1};s?c(t):r(t)}),d.on(`exit`,e=>{let t=e??1,n={stdout:l.trim(),stderr:u.trim(),exitCode:t,success:t===0};s&&!n.success?c(n):r(n)})})}export{t as i,r as n,i as r,n as t};
|