@github/copilot
Advanced tools
+11
-11
@@ -9,6 +9,6 @@ #!/usr/bin/env node | ||
| import Ae from"node:module";import{spawn as ke}from"node:child_process";import{chmodSync as Q,copyFileSync as X,mkdirSync as $e,readFileSync as z,realpathSync as Le,rmSync as _,statSync as Re,writeFileSync as Z,writeSync as Ne}from"node:fs";import{basename as $,dirname as He,join as a,resolve as oe,sep as k}from"node:path";import{createInterface as Ce}from"node:readline";import*as ie from"node:sea";import{fileURLToPath as ce,pathToFileURL as A}from"node:url";var de=new Set;function R(e,r){let n=Object.create(null);if(e)for(let[c,t]of Object.entries(e))n[c]=t;let i=r??de;return new Proxy(process.env,{get(c,t){if(typeof t=="string"){if(Object.hasOwn(n,t))return n[t];if(!i.has(t))return process.env[t]}},set(c,t,o){return n[t]=o,!0},has(c,t){return typeof t!="string"?!1:Object.hasOwn(n,t)?n[t]!==void 0:i.has(t)?!1:t in process.env},ownKeys(c){let t=new Set(Object.keys(process.env));for(let o of i)t.delete(o);for(let o of Object.keys(n))n[o]!==void 0?t.add(o):t.delete(o);return[...t]},getOwnPropertyDescriptor(c,t){if(typeof t!="string")return;let o;if(Object.hasOwn(n,t))o=n[t];else{if(i.has(t))return;o=process.env[t]}if(o!==void 0)return{value:o,writable:!0,enumerable:!0,configurable:!0}},deleteProperty(c,t){return n[t]=void 0,!0}})}var pe=new Set(["--server","--headless","--acp"]);function le(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function fe(e){return e.some(r=>pe.has(r)||le(r))}function N(e){return fe(e)}import{readdir as ge,access as me,constants as he}from"node:fs/promises";import{join as p,basename as H}from"node:path";import{homedir as S}from"node:os";function F(){return process.env.XDG_CACHE_HOME||p(S(),".cache")}function j(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function M(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function be(){if(process.platform==="darwin")return p(S(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||p(S(),".cache");return p(e,"copilot")}return p(F(),"copilot")}function U(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(p(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(p(be(),"pkg")),e.push(p(F(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(p(process.env.COPILOT_HOME,"pkg")),e.push(p(S(),".copilot","pkg")),[...new Set(e)]}function C(e){let r=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(r)return[Number(r[1]),Number(r[2]),Number(r[3])]}function ve(e,r){let n=C(e),i=C(r);if(!n&&!i)return 0;if(!n)return-1;if(!i)return 1;for(let o=0;o<3;o++)if(n[o]!==i[o])return n[o]-i[o];let c=e.includes("-"),t=r.includes("-");return c!==t?c?-1:1:e.localeCompare(r)}async function D(e,...r){let n=[];for(let i of r){let c;try{c=await ge(i)}catch{continue}for(let t of c){let o=p(i,t);try{await me(p(o,e),he.R_OK),n.push(o)}catch{continue}}}return n.sort((i,c)=>{let t=ve(H(c),H(i));return t!==0?t:i.localeCompare(c)}),n}import B from"node:path";import{fileURLToPath as Ie}from"node:url";function Oe(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let r=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),n=e.substring(0,r).trim();return n?`${n} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function G(e){let r;if(e instanceof Error)r=String(e);else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else r=String(e);return Oe(r)}import{existsSync as Y}from"node:fs";import{createRequire as Se}from"node:module";import{join as q,resolve as Pe}from"node:path";import{fileURLToPath as Ee}from"node:url";import{existsSync as we,readFileSync as ye}from"node:fs";function I(){if(process.platform!=="linux")return"gnu";let e=process.report.excludeNetwork;try{process.report.excludeNetwork=!0;let r=process.report?.getReport?.();if(r?.header?.glibcVersionRuntime)return"gnu";if(Array.isArray(r?.sharedObjects))return r.sharedObjects.some(i=>i.includes("libc.musl-")||i.includes("ld-musl-"))?"musl":"gnu"}catch{}finally{process.report.excludeNetwork=e}try{if(we("/usr/bin/ldd")&&ye("/usr/bin/ldd","utf8").includes("musl"))return"musl"}catch{}return"gnu"}function W(e=process.platform,r){let n=r??(e==="linux"?I():"gnu");return e==="linux"&&n==="musl"?"linuxmusl":e}function Te(){return`${W()}-${process.arch}`}function xe(){let{platform:e,arch:r}=process;switch(e){case"win32":return`win32-${r}-msvc`;case"darwin":return`darwin-${r}`;case"linux":return`linux-${r}-${I()}`;default:throw new Error(`Unsupported platform: ${e}/${r}`)}}function V(e,r){let n=Te(),i=`${e}.node`,c=`${e}.${xe()}.node`;for(let t of r){let o=Pe(t),w=q(o,"prebuilds",n,i);if(Y(w))return J(w);let v=q(o,c);if(Y(v))return J(v)}throw new Error(`Native addon "${e}" not found for ${n}.`)}function J(e){return Se(Ee(import.meta.url))(e)}var O;function K(){if(process.platform==="win32"){if(O){if(O.kind==="ok")return O.addon;throw O.error}try{let e=_e();return O={kind:"ok",addon:e},e}catch(e){let r=e instanceof Error?e:new Error(`Failed to load Win32 native addon: ${G(e)}`);throw O={kind:"error",error:r},r}}}function _e(){let e=B.dirname(Ie(import.meta.url));return V("win32-native",[e,B.resolve(e,"..","native","win32")])}try{Ae.enableCompileCache?.()}catch{}var Fe=75;function ee(){if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}if(process.stdout.isTTY)try{Ne(1,"\x1B[<u\x1B[?1049h\x1B[?1049l\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?2004l\x1B[?1004l\x1B[?25h\x1B[?2026l"+(process.env.TERM!=="dumb"?"\x1B[23;2t":""))}catch{}}var ae=He(ce(import.meta.url)),re=ie.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=K();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var P=process.argv.find(e=>$(e).startsWith("conpty_console_list_agent")),te=process.argv.find(e=>$(e)==="extension_bootstrap.mjs"),ne=te?oe(te):void 0,se=ne?.startsWith(oe(ae,"preloads")+k)?ne:void 0;if(P){let e=P.endsWith(".js")?P:P+".js";await import(A(e).href)}else if(se)await import(A(se).href);else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:r,body:n}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:r,body:n,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else if(process.env.COPILOT_RUN_APP==="1"||N(process.argv.slice(2))){let e=a(ae,"app.js"),r=M();if(re&&(j()||r)){let n=U().flatMap(c=>[a(c,"universal"),a(c,`${process.platform}-${process.arch}`)]),i=await D("app.js",...n);if(r){let c=i.find(t=>$(t)===r);c?e=a(c,"app.js"):process.stderr.write(`Warning: preferred version ${r} not found in package cache, using built-in version | ||
| `)}else i.length>0&&(e=a(i[0],"app.js"))}await import(A(e).href)}else{let r=function(){let s=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(s,"restart",`${e}.json`)},n=function(){let s=r();try{let u=z(s,"utf-8");return _(s,{force:!0}),JSON.parse(u)}catch{return}},i=function(){try{_(r(),{force:!0})}catch{}},c=function(){let s=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(s,"crash-context",`${e}.json`)},t=function(){try{let s=z(c(),"utf-8");return JSON.parse(s)}catch{return}},o=function(){try{_(c(),{force:!0})}catch{}},w=function(s,u){return new Promise(g=>{let l=Ce({input:process.stdin,output:process.stdout}),d=s.toString(16).toUpperCase();if(process.stdout.write(` | ||
| *** Copilot exited unexpectedly (exit code ${s} = 0x${d}) *** | ||
| `),u){let m=u.length>200?u.slice(0,200)+"\u2026":u;process.stdout.write(`Error: ${m} | ||
| var Ze=Object.create;var Y=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var K=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var st=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of tt(t))!nt.call(e,s)&&s!==r&&Y(e,s,{get:()=>t[s],enumerable:!(o=et(t,s))||o.enumerable});return e};var ot=(e,t,r)=>(r=e!=null?Ze(rt(e)):{},st(t||!e||!e.__esModule?Y(r,"default",{value:e,enumerable:!0}):r,e));var ae=_((fr,ce)=>{"use strict";var ie=()=>process.platform==="linux",A=null,ht=()=>{if(!A)if(ie()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,A=process.report.getReport(),process.report.excludeNetwork=e}else A={};return A};ce.exports={isLinux:ie,getReport:ht}});var le=_((pr,ue)=>{"use strict";var I=K("fs"),yt="/usr/bin/ldd",bt="/proc/self/exe",R=2048,vt=e=>{let t=I.openSync(e,"r"),r=Buffer.alloc(R),o=I.readSync(t,r,0,R,0);return I.close(t,()=>{}),r.subarray(0,o)},St=e=>new Promise((t,r)=>{I.open(e,"r",(o,s)=>{if(o)r(o);else{let n=Buffer.alloc(R);I.read(s,n,0,R,0,(i,m)=>{t(n.subarray(0,m)),I.close(s,()=>{})})}})});ue.exports={LDD_PATH:yt,SELF_PATH:bt,readFileSync:vt,readFile:St}});var fe=_((mr,de)=>{"use strict";var wt=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),o=e.readUInt16LE(56);for(let s=0;s<o;s++){let n=t+s*r;if(e.readUInt32LE(n)===3){let m=e.readUInt32LE(n+8),P=e.readUInt32LE(n+32);return e.subarray(m,m+P).toString().replace(/\0.*$/g,"")}}return null};de.exports={interpreterPath:wt}});var Ce=_((gr,_e)=>{"use strict";var me=K("child_process"),{isLinux:T,getReport:ge}=ae(),{LDD_PATH:N,SELF_PATH:he,readFile:D,readFileSync:j}=le(),{interpreterPath:ye}=fe(),h,y,b,be="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",O="",ve=()=>O||new Promise(e=>{me.exec(be,(t,r)=>{O=t?" ":r,e(O)})}),Se=()=>{if(!O)try{O=me.execSync(be,{encoding:"utf8"})}catch{O=" "}return O},w="glibc",we=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,x="musl",Pt=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),Pe=()=>{let e=ge();return e.header&&e.header.glibcVersionRuntime?w:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(Pt)?x:null},Ee=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(w)?w:r&&r.includes(x)?x:null},Oe=e=>{if(e){if(e.includes("/ld-musl-"))return x;if(e.includes("/ld-linux-"))return w}return null},xe=e=>(e=e.toString(),e.includes("musl")?x:e.includes("GNU C Library")?w:null),Et=async()=>{if(y!==void 0)return y;y=null;try{let e=await D(N);y=xe(e)}catch{}return y},Ot=()=>{if(y!==void 0)return y;y=null;try{let e=j(N);y=xe(e)}catch{}return y},xt=async()=>{if(h!==void 0)return h;h=null;try{let e=await D(he),t=ye(e);h=Oe(t)}catch{}return h},It=()=>{if(h!==void 0)return h;h=null;try{let e=j(he),t=ye(e);h=Oe(t)}catch{}return h},Ie=async()=>{let e=null;if(T()&&(e=await xt(),!e&&(e=await Et(),e||(e=Pe()),!e))){let t=await ve();e=Ee(t)}return e},Te=()=>{let e=null;if(T()&&(e=It(),!e&&(e=Ot(),e||(e=Pe()),!e))){let t=Se();e=Ee(t)}return e},Tt=async()=>T()&&await Ie()!==w,Lt=()=>T()&&Te()!==w,Ft=async()=>{if(b!==void 0)return b;b=null;try{let t=(await D(N)).match(we);t&&(b=t[1])}catch{}return b},_t=()=>{if(b!==void 0)return b;b=null;try{let t=j(N).match(we);t&&(b=t[1])}catch{}return b},Le=()=>{let e=ge();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},pe=e=>e.trim().split(/\s+/)[1],Fe=e=>{let[t,r,o]=e.split(/[\r\n]+/);return t&&t.includes(w)?pe(t):r&&o&&r.includes(x)?pe(o):null},Ct=async()=>{let e=null;if(T()&&(e=await Ft(),e||(e=Le()),!e)){let t=await ve();e=Fe(t)}return e},At=()=>{let e=null;if(T()&&(e=_t(),e||(e=Le()),!e)){let t=Se();e=Fe(t)}return e};_e.exports={GLIBC:w,MUSL:x,family:Ie,familySync:Te,isNonGlibcLinux:Tt,isNonGlibcLinuxSync:Lt,version:Ct,versionSync:At}});import Dt from"node:module";import{spawn as jt}from"node:child_process";import{chmodSync as Me,copyFileSync as De,mkdirSync as Gt,readFileSync as je,realpathSync as Wt,rmSync as W,statSync as Bt,writeFileSync as Ge,writeSync as qt}from"node:fs";import{basename as V,dirname as Vt,join as a,resolve as Ye,sep as q}from"node:path";import{createInterface as Jt}from"node:readline";import*as Ke from"node:sea";import{fileURLToPath as Qe,pathToFileURL as B}from"node:url";var it=new Set;function Q(e,t){let r=Object.create(null);if(e)for(let[s,n]of Object.entries(e))r[s]=n;let o=t??it;return new Proxy(process.env,{get(s,n){if(typeof n=="string"){if(Object.hasOwn(r,n))return r[n];if(!o.has(n))return process.env[n]}},set(s,n,i){return r[n]=i,!0},has(s,n){return typeof n!="string"?!1:Object.hasOwn(r,n)?r[n]!==void 0:o.has(n)?!1:n in process.env},ownKeys(s){let n=new Set(Object.keys(process.env));for(let i of o)n.delete(i);for(let i of Object.keys(r))r[i]!==void 0?n.add(i):n.delete(i);return[...n]},getOwnPropertyDescriptor(s,n){if(typeof n!="string")return;let i;if(Object.hasOwn(r,n))i=r[n];else{if(o.has(n))return;i=process.env[n]}if(i!==void 0)return{value:i,writable:!0,enumerable:!0,configurable:!0}},deleteProperty(s,n){return r[n]=void 0,!0}})}var ct=new Set(["--server","--headless","--acp"]);function at(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function ut(e){return e.some(t=>ct.has(t)||at(t))}function z(e){return ut(e)}import{readdir as lt,access as dt,constants as ft}from"node:fs/promises";import{join as d,basename as X}from"node:path";import{homedir as C}from"node:os";function ee(){return process.env.XDG_CACHE_HOME||d(C(),".cache")}function te(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function re(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function pt(){if(process.platform==="darwin")return d(C(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||d(C(),".cache");return d(e,"copilot")}return d(ee(),"copilot")}function ne(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(d(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(d(pt(),"pkg")),e.push(d(ee(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(d(process.env.COPILOT_HOME,"pkg")),e.push(d(C(),".copilot","pkg")),[...new Set(e)]}function Z(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(t)return[Number(t[1]),Number(t[2]),Number(t[3])]}function mt(e,t){let r=Z(e),o=Z(t);if(!r&&!o)return 0;if(!r)return-1;if(!o)return 1;for(let i=0;i<3;i++)if(r[i]!==o[i])return r[i]-o[i];let s=e.includes("-"),n=t.includes("-");return s!==n?s?-1:1:e.localeCompare(t)}async function se(e,...t){let r=[];for(let o of t){let s;try{s=await lt(o)}catch{continue}for(let n of s){let i=d(o,n);try{await dt(d(i,e),ft.R_OK),r.push(i)}catch{continue}}}return r.sort((o,s)=>{let n=mt(X(s),X(o));return n!==0?n:o.localeCompare(s)}),r}import $e from"node:path";import{fileURLToPath as kt}from"node:url";function gt(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let t=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),r=e.substring(0,t).trim();return r?`${r} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function oe(e){let t;if(e instanceof Error)t=String(e);else if(typeof e=="object"&&e!==null)try{t=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else t=String(e);return gt(t)}import{existsSync as Re}from"node:fs";import{createRequire as Rt}from"node:module";import{join as Ne,resolve as Nt}from"node:path";import{fileURLToPath as Ht}from"node:url";var H=ot(Ce(),1);function G(e={}){return(e.platform??process.platform)!=="linux"?"gnu":(e.detectLibcFamily??H.familySync)()===H.MUSL?"musl":"gnu"}function Ae(e=process.platform,t){let r=t??(e==="linux"?G():"gnu");return e==="linux"&&r==="musl"?"linuxmusl":e}function Ut(){return`${Ae()}-${process.arch}`}function $t(){let{platform:e,arch:t}=process;switch(e){case"win32":return`win32-${t}-msvc`;case"darwin":return`darwin-${t}`;case"linux":return`linux-${t}-${G()}`;default:throw new Error(`Unsupported platform: ${e}/${t}`)}}function Ue(e,t){let r=Ut(),o=`${e}.node`,s=`${e}.${$t()}.node`;for(let n of t){let i=Nt(n),m=Ne(i,"prebuilds",r,o);if(Re(m))return He(m);let P=Ne(i,s);if(Re(P))return He(P)}throw new Error(`Native addon "${e}" not found for ${r}.`)}function He(e){return Rt(Ht(import.meta.url))(e)}var L;function ke(){if(process.platform==="win32"){if(L){if(L.kind==="ok")return L.addon;throw L.error}try{let e=Mt();return L={kind:"ok",addon:e},e}catch(e){let t=e instanceof Error?e:new Error(`Failed to load Win32 native addon: ${oe(e)}`);throw L={kind:"error",error:t},t}}}function Mt(){let e=$e.dirname(kt(import.meta.url));return Ue("win32-native",[e,$e.resolve(e,"..","native","win32")])}try{Dt.enableCompileCache?.()}catch{}var Yt=75;function We(){if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}if(process.stdout.isTTY)try{qt(1,"\x1B[<u\x1B[?1049h\x1B[?1049l\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?2004l\x1B[?1004l\x1B[?25h\x1B[?2026l"+(process.env.TERM!=="dumb"?"\x1B[23;2t":""))}catch{}}var ze=Vt(Qe(import.meta.url)),Be=Ke.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=ke();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var U=process.argv.find(e=>V(e).startsWith("conpty_console_list_agent")),qe=process.argv.find(e=>V(e)==="extension_bootstrap.mjs"),Ve=qe?Ye(qe):void 0,Je=Ve?.startsWith(Ye(ze,"preloads")+q)?Ve:void 0;if(U){let e=U.endsWith(".js")?U:U+".js";await import(B(e).href)}else if(Je)await import(B(Je).href);else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:t,body:r}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:t,body:r,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else if(process.env.COPILOT_RUN_APP==="1"||z(process.argv.slice(2))){let e=a(ze,"app.js"),t=re();if(Be&&(te()||t)){let r=ne().flatMap(s=>[a(s,"universal"),a(s,`${process.platform}-${process.arch}`)]),o=await se("app.js",...r);if(t){let s=o.find(n=>V(n)===t);s?e=a(s,"app.js"):process.stderr.write(`Warning: preferred version ${t} not found in package cache, using built-in version | ||
| `)}else o.length>0&&(e=a(o[0],"app.js"))}await import(B(e).href)}else{let t=function(){let c=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(c,"restart",`${e}.json`)},r=function(){let c=t();try{let u=je(c,"utf-8");return W(c,{force:!0}),JSON.parse(u)}catch{return}},o=function(){try{W(t(),{force:!0})}catch{}},s=function(){let c=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(c,"crash-context",`${e}.json`)},n=function(){try{let c=je(s(),"utf-8");return JSON.parse(c)}catch{return}},i=function(){try{W(s(),{force:!0})}catch{}},m=function(c,u){return new Promise(g=>{let f=Jt({input:process.stdin,output:process.stdout}),l=c.toString(16).toUpperCase();if(process.stdout.write(` | ||
| *** Copilot exited unexpectedly (exit code ${c} = 0x${l}) *** | ||
| `),u){let v=u.length>200?u.slice(0,200)+"\u2026":u;process.stdout.write(`Error: ${v} | ||
| `)}process.stdout.write(` | ||
@@ -19,13 +19,13 @@ A crash report can be saved locally. | ||
| `),l.question("Save crash report? [y/N] ",m=>{l.close(),g(m.trim().toLowerCase()==="y")})})},v=function(s,u){try{let g=Le(s);return g.startsWith(u+k)?Re(g).isFile():!1}catch{return!1}},y=function(s,u){let g=re?s:[...process.execArgv,ce(import.meta.url),...s],l=ke(process.execPath,g,{stdio:"inherit",cwd:u,env:R({COPILOT_RUN_APP:"1",COPILOT_LOADER_PID:e})});process.env.COPILOT_LOADER_DEBUG&&process.stderr.write(`[loader] spawned app child: pid=${l.pid} (loader pid=${e}) | ||
| `);let d=f=>{try{l.kill(f)}catch{}},m=()=>d("SIGINT"),h=()=>d("SIGTERM"),E=()=>d("SIGHUP"),T=()=>d("SIGQUIT");process.on("SIGINT",m),process.on("SIGTERM",h),process.on("SIGHUP",E),process.on("SIGQUIT",T),l.on("error",f=>{process.off("SIGINT",m),process.off("SIGTERM",h),process.off("SIGHUP",E),process.off("SIGQUIT",T),i(),process.stderr.write(`Failed to start: ${f.message} | ||
| `),process.exit(1)}),l.on("exit",(f,L)=>{if(process.off("SIGINT",m),process.off("SIGTERM",h),process.off("SIGHUP",E),process.off("SIGQUIT",T),f===Fe){let b=n();if(b){let x=[...b.argv,"--resume",b.sessionId];y(x,b.cwd||u)}else y(s,u);return}if(i(),L)o(),ee(),process.kill(process.pid,L);else if(f!==0){ee();let b=t();b&&process.stdin.isTTY?w(f??1,b.lastError).then(async x=>{x&&await ue(b,f??1),o(),process.exit(f??1)}).catch(()=>{o(),process.exit(f??1)}):(o(),process.exit(f??1))}else o(),process.exit(0)})};je=r,Me=n,Ue=i,De=c,Ge=t,We=o,Ye=w,qe=v,Je=y;let e=String(process.pid);async function ue(s,u){try{let g=new Date().toISOString().replace(/[:.]/g,"-"),l=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot"),d=a(l,"crash-reports",`crash-${s.sessionId}-${g}`);$e(d,{recursive:!0,mode:448}),Z(a(d,"crash-context.json"),JSON.stringify(s,null,2),{mode:384});let m=["# Crash Report","",`**Exit code**: ${u}`,s.errorType?`**Error type**: ${s.errorType}`:"",s.lastError?`**Error**: ${s.lastError}`:"",`**Timestamp**: ${new Date().toISOString()}`,`**Session ID**: ${s.sessionId}`,`**Working directory**: ${s.cwd}`,s.stackTrace?` | ||
| `),f.question("Save crash report? [y/N] ",v=>{f.close(),g(v.trim().toLowerCase()==="y")})})},P=function(c,u){try{let g=Wt(c);return g.startsWith(u+q)?Bt(g).isFile():!1}catch{return!1}},F=function(c,u){let g=Be?c:[...process.execArgv,Qe(import.meta.url),...c],f=jt(process.execPath,g,{stdio:"inherit",cwd:u,env:Q({COPILOT_RUN_APP:"1",COPILOT_LOADER_PID:e})});process.env.COPILOT_LOADER_DEBUG&&process.stderr.write(`[loader] spawned app child: pid=${f.pid} (loader pid=${e}) | ||
| `);let l=p=>{try{f.kill(p)}catch{}},v=()=>l("SIGINT"),S=()=>l("SIGTERM"),$=()=>l("SIGHUP"),k=()=>l("SIGQUIT");process.on("SIGINT",v),process.on("SIGTERM",S),process.on("SIGHUP",$),process.on("SIGQUIT",k),f.on("error",p=>{process.off("SIGINT",v),process.off("SIGTERM",S),process.off("SIGHUP",$),process.off("SIGQUIT",k),o(),process.stderr.write(`Failed to start: ${p.message} | ||
| `),process.exit(1)}),f.on("exit",(p,J)=>{if(process.off("SIGINT",v),process.off("SIGTERM",S),process.off("SIGHUP",$),process.off("SIGQUIT",k),p===Yt){let E=r();if(E){let M=[...E.argv,"--resume",E.sessionId];F(M,E.cwd||u)}else F(c,u);return}if(o(),J)i(),We(),process.kill(process.pid,J);else if(p!==0){We();let E=n();E&&process.stdin.isTTY?m(p??1,E.lastError).then(async M=>{M&&await Xe(E,p??1),i(),process.exit(p??1)}).catch(()=>{i(),process.exit(p??1)}):(i(),process.exit(p??1))}else i(),process.exit(0)})};Kt=t,Qt=r,zt=o,Xt=s,Zt=n,er=i,tr=m,rr=P,nr=F;let e=String(process.pid);async function Xe(c,u){try{let g=new Date().toISOString().replace(/[:.]/g,"-"),f=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot"),l=a(f,"crash-reports",`crash-${c.sessionId}-${g}`);Gt(l,{recursive:!0,mode:448}),Ge(a(l,"crash-context.json"),JSON.stringify(c,null,2),{mode:384});let v=["# Crash Report","",`**Exit code**: ${u}`,c.errorType?`**Error type**: ${c.errorType}`:"",c.lastError?`**Error**: ${c.lastError}`:"",`**Timestamp**: ${new Date().toISOString()}`,`**Session ID**: ${c.sessionId}`,`**Working directory**: ${c.cwd}`,c.stackTrace?` | ||
| ## Stack Trace | ||
| \`\`\` | ||
| ${s.stackTrace} | ||
| ${c.stackTrace} | ||
| \`\`\``:"",""].filter(Boolean).join(` | ||
| `);if(Z(a(d,"feedback.md"),m,{mode:384}),s.sessionFilePath&&v(s.sessionFilePath,l))try{let h=a(d,"events.jsonl");X(s.sessionFilePath,h),Q(h,384)}catch{}if(s.logFilePath&&v(s.logFilePath,l))try{let h=a(d,"process.log");X(s.logFilePath,h),Q(h,384)}catch{}process.stdout.write(` | ||
| Crash report saved to: ${d}${k} | ||
| `);if(Ge(a(l,"feedback.md"),v,{mode:384}),c.sessionFilePath&&P(c.sessionFilePath,f))try{let S=a(l,"events.jsonl");De(c.sessionFilePath,S),Me(S,384)}catch{}if(c.logFilePath&&P(c.logFilePath,f))try{let S=a(l,"process.log");De(c.logFilePath,S),Me(S,384)}catch{}process.stdout.write(` | ||
| Crash report saved to: ${l}${q} | ||
| `)}catch(g){process.stderr.write(`Failed to create crash report: ${String(g)} | ||
| `)}}y(process.argv.slice(2),process.cwd())}var je,Me,Ue,De,Ge,We,Ye,qe,Je; | ||
| `)}}F(process.argv.slice(2),process.cwd())}var Kt,Qt,zt,Xt,Zt,er,tr,rr,nr; |
+1
-1
@@ -7,2 +7,2 @@ #!/usr/bin/env node | ||
| import{spawnSync as o}from"node:child_process";import{fileURLToPath as i}from"node:url";async function n(){for(const r of c())try{const t=i(import.meta.resolve(`@github/copilot-${r}-${process.arch}`)),s=o(t,process.argv.slice(2),{stdio:"inherit"});if(s.error)throw s.error;process.exit(s.status??1)}catch{}parseInt(process.versions.node.split(".")[0],10)<24&&(console.error(`GitHub Copilot CLI requires Node.js v24 or higher. Currently using v${process.versions.node}.`),process.exit(1));try{await import("./index.js")}catch(r){console.error("Failed to load GitHub Copilot CLI:",r),process.exit(1)}}n().catch(()=>{});function c(){return process.platform==="linux"?a()?["linuxmusl","linux"]:["linux"]:[process.platform]}function a(){if(process.platform!=="linux")return!1;try{const e=process.report?.getReport?.();return e?.header?.glibcVersionRuntime?!1:Array.isArray(e?.sharedObjects)?e.sharedObjects.some(r=>r.includes("libc.musl-")||r.includes("ld-musl-")):!0}catch{return!0}} | ||
| import{spawnSync as e}from"node:child_process";import{fileURLToPath as s}from"node:url";import{isNonGlibcLinuxSync as i}from"detect-libc";async function n(){for(const r of c())try{const t=s(import.meta.resolve(`@github/copilot-${r}-${process.arch}`)),o=e(t,process.argv.slice(2),{stdio:"inherit"});if(o.error)throw o.error;process.exit(o.status??1)}catch{}parseInt(process.versions.node.split(".")[0],10)<24&&(console.error(`GitHub Copilot CLI requires Node.js v24 or higher. Currently using v${process.versions.node}.`),process.exit(1));try{await import("./index.js")}catch(r){console.error("Failed to load GitHub Copilot CLI:",r),process.exit(1)}}n().catch(()=>{});function c(){return process.platform==="linux"?a()?["linuxmusl","linux"]:["linux"]:[process.platform]}function a(){return i()} |
+13
-10
| { | ||
| "name": "@github/copilot", | ||
| "description": "GitHub Copilot CLI brings the power of Copilot coding agent directly to your terminal.", | ||
| "version": "1.0.51-1", | ||
| "version": "1.0.51-2", | ||
| "license": "SEE LICENSE IN LICENSE.md", | ||
@@ -19,2 +19,5 @@ "type": "module", | ||
| }, | ||
| "dependencies": { | ||
| "detect-libc": "^2.1.2" | ||
| }, | ||
| "exports": { | ||
@@ -71,14 +74,14 @@ "./sdk": { | ||
| "buildMetadata": { | ||
| "gitCommit": "d92148a" | ||
| "gitCommit": "d185bd8" | ||
| }, | ||
| "optionalDependencies": { | ||
| "@github/copilot-linux-x64": "1.0.51-1", | ||
| "@github/copilot-linux-arm64": "1.0.51-1", | ||
| "@github/copilot-linuxmusl-x64": "1.0.51-1", | ||
| "@github/copilot-linuxmusl-arm64": "1.0.51-1", | ||
| "@github/copilot-darwin-x64": "1.0.51-1", | ||
| "@github/copilot-darwin-arm64": "1.0.51-1", | ||
| "@github/copilot-win32-x64": "1.0.51-1", | ||
| "@github/copilot-win32-arm64": "1.0.51-1" | ||
| "@github/copilot-linux-x64": "1.0.51-2", | ||
| "@github/copilot-linux-arm64": "1.0.51-2", | ||
| "@github/copilot-linuxmusl-x64": "1.0.51-2", | ||
| "@github/copilot-linuxmusl-arm64": "1.0.51-2", | ||
| "@github/copilot-darwin-x64": "1.0.51-2", | ||
| "@github/copilot-darwin-arm64": "1.0.51-2", | ||
| "@github/copilot-win32-x64": "1.0.51-2", | ||
| "@github/copilot-win32-arm64": "1.0.51-2" | ||
| } | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 22 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 22 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
275805966
0178350
0.03%9
12.5%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed