@scheduler-systems/gal-cli 0.1.13-beta.2-alpha.pr74 → 0.1.13
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/README.md +11 -33
- package/dist/index.cjs +2 -2
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,51 +1,29 @@
|
|
|
1
1
|
# GAL CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sync your organization's approved AI agent configurations.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
pnpm install
|
|
10
|
-
pnpm build
|
|
11
|
-
npm link
|
|
8
|
+
npm install -g @scheduler-systems/gal-cli
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
gal --version
|
|
17
|
-
```
|
|
11
|
+
## Usage
|
|
18
12
|
|
|
19
|
-
After changes, rebuild:
|
|
20
13
|
```bash
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Production Install
|
|
14
|
+
# Login with GitHub
|
|
15
|
+
gal auth login
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
# Pull approved configs
|
|
18
|
+
gal sync --pull
|
|
28
19
|
```
|
|
29
20
|
|
|
30
|
-
##
|
|
21
|
+
## Help
|
|
31
22
|
|
|
32
23
|
```bash
|
|
33
|
-
gal
|
|
34
|
-
gal sync --push # Push local config to org
|
|
24
|
+
gal --help
|
|
35
25
|
```
|
|
36
26
|
|
|
37
27
|
## Documentation
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
- [Headless Execution](../../docs/guides/cli-headless-execution.md)
|
|
41
|
-
- [Hook Integration](../../docs/features/gal/convenience/10-cli-hook.md)
|
|
42
|
-
|
|
43
|
-
## Telemetry
|
|
44
|
-
|
|
45
|
-
GAL CLI collects anonymous usage telemetry to improve the tool. Opt out via:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
gal config set telemetry false
|
|
49
|
-
# or
|
|
50
|
-
export GAL_TELEMETRY=false
|
|
51
|
-
```
|
|
29
|
+
https://gal.run/docs
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ Expecting one of '${o.join("', '")}'`);let s=`${e}Help`;return this.on(s,r=>{let
|
|
|
27
27
|
`:`
|
|
28
28
|
`)+n,s=o+1,o=t.indexOf(`
|
|
29
29
|
`,s)}while(o!==-1);return r+=t.slice(s),r}var{stdout:Cn,stderr:En}=pn,Xe=Symbol("GENERATOR"),z=Symbol("STYLER"),te=Symbol("IS_EMPTY"),yn=["ansi","ansi","ansi256","ansi16m"],Y=Object.create(null),as=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=Cn?Cn.level:0;t.level=e.level===void 0?n:e.level};var ls=t=>{let e=(...n)=>n.join(" ");return as(e,t),Object.setPrototypeOf(e,ne.prototype),e};function ne(t){return ls(t)}Object.setPrototypeOf(ne.prototype,Function.prototype);for(let[t,e]of Object.entries(L))Y[t]={get(){let n=Fe(this,et(e.open,e.close,this[z]),this[te]);return Object.defineProperty(this,t,{value:n}),n}};Y.visible={get(){let t=Fe(this,this[z],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var Ze=(t,e,n,...o)=>t==="rgb"?e==="ansi16m"?L[n].ansi16m(...o):e==="ansi256"?L[n].ansi256(L.rgbToAnsi256(...o)):L[n].ansi(L.rgbToAnsi(...o)):t==="hex"?Ze("rgb",e,n,...L.hexToRgb(...o)):L[n][t](...o),cs=["rgb","hex","ansi256"];for(let t of cs){Y[t]={get(){let{level:n}=this;return function(...o){let s=et(Ze(t,yn[n],"color",...o),L.color.close,this[z]);return Fe(this,s,this[te])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);Y[e]={get(){let{level:n}=this;return function(...o){let s=et(Ze(t,yn[n],"bgColor",...o),L.bgColor.close,this[z]);return Fe(this,s,this[te])}}}}var fs=Object.defineProperties(()=>{},{...Y,level:{enumerable:!0,get(){return this[Xe].level},set(t){this[Xe].level=t}}}),et=(t,e,n)=>{let o,s;return n===void 0?(o=t,s=e):(o=n.openAll+t,s=e+n.closeAll),{open:t,close:e,openAll:o,closeAll:s,parent:n}},Fe=(t,e,n)=>{let o=(...s)=>Ds(o,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(o,fs),o[Xe]=t,o[z]=e,o[te]=n,o},Ds=(t,e)=>{if(t.level<=0||!e)return t[te]?"":e;let n=t[z];if(n===void 0)return e;let{openAll:o,closeAll:s}=n;if(e.includes("\x1B"))for(;n!==void 0;)e=gn(e,n.close,n.open),n=n.parent;let r=e.indexOf(`
|
|
30
|
-
`);return r!==-1&&(e=Fn(e,s,o,r)),o+e+s};Object.defineProperties(ne.prototype,Y);var hs=ne(),Mr=ne({level:En?En.level:0});var u=hs;var Pn=require("crypto");var N=require("fs"),An=require("os"),K=require("path"),vn=require("url"),ms={},tt=(0,K.join)((0,An.homedir)(),".gal"),Ce=(0,K.join)(tt,"config.json"),ds={development:"http://localhost:3000",staging:"https://gal-api-staging-s3pvf4isfa-uc.a.run.app",production:"https://gal-api-s3pvf4isfa-uc.a.run.app"};function _n(){let t=process.env.GAL_ENV?.toLowerCase();if(t==="development"||t==="dev"||t==="local")return"development";if(t==="staging"||t==="stg"||t==="beta")return"staging";if(t==="production"||t==="prod")return"production";if(process.argv[1]?.includes("tsx")||process.argv[1]?.includes("ts-node")||process.argv[1]?.endsWith(".ts")||process.env.npm_lifecycle_event==="dev"||process.env.NODE_ENV==="development")return"development";try{let n="0.1.13
|
|
30
|
+
`);return r!==-1&&(e=Fn(e,s,o,r)),o+e+s};Object.defineProperties(ne.prototype,Y);var hs=ne(),Mr=ne({level:En?En.level:0});var u=hs;var Pn=require("crypto");var N=require("fs"),An=require("os"),K=require("path"),vn=require("url"),ms={},tt=(0,K.join)((0,An.homedir)(),".gal"),Ce=(0,K.join)(tt,"config.json"),ds={development:"http://localhost:3000",staging:"https://gal-api-staging-s3pvf4isfa-uc.a.run.app",production:"https://gal-api-s3pvf4isfa-uc.a.run.app"};function _n(){let t=process.env.GAL_ENV?.toLowerCase();if(t==="development"||t==="dev"||t==="local")return"development";if(t==="staging"||t==="stg"||t==="beta")return"staging";if(t==="production"||t==="prod")return"production";if(process.argv[1]?.includes("tsx")||process.argv[1]?.includes("ts-node")||process.argv[1]?.endsWith(".ts")||process.env.npm_lifecycle_event==="dev"||process.env.NODE_ENV==="development")return"development";try{let n="0.1.13";if(n&&(n.includes("-beta")||n.includes("-rc")||n.includes("-alpha")))return"staging";if(!n||n==="0.0.0-dev"){let o=(0,vn.fileURLToPath)(ms.url),s=(0,K.dirname)(o),r=(0,K.join)(s,"..","package.json");if((0,N.existsSync)(r)){let a=JSON.parse((0,N.readFileSync)(r,"utf-8")).version||"";if(a.includes("-beta")||a.includes("-rc")||a.includes("-alpha"))return"staging"}}}catch{}return"production"}var g=class{static getEnvironment(){return _n()}static load(){let e=_n(),n=ds[e];if(!(0,N.existsSync)(Ce))return{apiUrl:n};try{let o=(0,N.readFileSync)(Ce,"utf-8"),s=JSON.parse(o);return s.apiUrl||(s.apiUrl=n),e!=="development"&&s.apiUrl.includes("localhost")&&(s.apiUrl=n),s}catch(o){return console.error("Error loading config:",o),{apiUrl:n}}}static save(e){(0,N.existsSync)(tt)||(0,N.mkdirSync)(tt,{recursive:!0}),(0,N.writeFileSync)(Ce,JSON.stringify(e,null,2),"utf-8")}static set(e,n){let o=this.load();o[e]=n,this.save(o)}static get(e){return this.load()[e]}static getConfigPath(){return Ce}};var $=require("fs"),ot=require("path"),bn=require("os"),Sn=require("crypto"),nt=(0,ot.join)((0,bn.homedir)(),".gal"),Ee=(0,ot.join)(nt,"installation-id");function wn(){try{if((0,$.existsSync)(Ee)){let e=(0,$.readFileSync)(Ee,"utf-8").trim();if(e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))return e}}catch{}let t=(0,Sn.randomUUID)();try{(0,$.existsSync)(nt)||(0,$.mkdirSync)(nt,{recursive:!0}),(0,$.writeFileSync)(Ee,t,"utf-8")}catch{}return t}function On(){return!(0,$.existsSync)(Ee)}var k=require("fs"),Ae=require("path"),xn=require("os"),ye=(0,Ae.join)((0,xn.homedir)(),".gal"),oe=(0,Ae.join)(ye,"telemetry-queue.json"),st=(0,Ae.join)(ye,"telemetry-pending-events.json"),kn=100,ps=7,gs=ps*24*60*60*1e3,_e=class{queue=[];flushCallback=null;constructor(){this.loadOfflineQueue(),this.loadPendingEvents()}setFlushCallback(e){this.flushCallback=e}async addEvent(e){let n={...e,queuedAt:Date.now()};this.queue.push(n),this.queue.length>=kn&&await this.flush()}async flush(){if(this.queue.length===0)return;if(!this.flushCallback){this.saveOfflineQueue();return}if(this.pruneExpiredEvents(),this.queue.length===0)return;let e=this.queue.slice(0,kn),n=e.map(({queuedAt:o,...s})=>s);try{await this.flushCallback(n)?(this.queue=this.queue.slice(e.length),this.queue.length>0?this.saveOfflineQueue():this.clearOfflineQueue()):this.saveOfflineQueue()}catch{this.saveOfflineQueue()}}getQueueLength(){return this.queue.length}loadOfflineQueue(){try{if((0,k.existsSync)(oe)){let e=(0,k.readFileSync)(oe,"utf-8"),n=JSON.parse(e);Array.isArray(n)&&(this.queue=n,this.pruneExpiredEvents())}}catch{}}loadPendingEvents(){try{if((0,k.existsSync)(st)){let e=(0,k.readFileSync)(st,"utf-8"),n=JSON.parse(e);if(Array.isArray(n))for(let o of n)o.queuedAt||(o.queuedAt=Date.now()),this.queue.push(o);(0,k.writeFileSync)(st,"[]","utf-8")}}catch{}}saveOfflineQueue(){try{(0,k.existsSync)(ye)||(0,k.mkdirSync)(ye,{recursive:!0}),(0,k.writeFileSync)(oe,JSON.stringify(this.queue),"utf-8")}catch{}}clearOfflineQueue(){try{(0,k.existsSync)(oe)&&(0,k.writeFileSync)(oe,"[]","utf-8")}catch{}}pruneExpiredEvents(){let e=Date.now();this.queue=this.queue.filter(n=>e-n.queuedAt<gs)}};var ve=class{baseUrl;constructor(e){this.baseUrl=e}async sendEvents(e){if(e.length===0)return!0;try{let n=new AbortController,o=setTimeout(()=>n.abort(),5e3),s=await fetch(`${this.baseUrl}/telemetry/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:e}),signal:n.signal});return clearTimeout(o),s.ok?(await s.json()).accepted===!0:s.status===202}catch{return!1}}async sendFeedback(e,n){try{let o=new AbortController,s=setTimeout(()=>o.abort(),5e3),r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);let i=await fetch(`${this.baseUrl}/telemetry/feedback`,{method:"POST",headers:r,body:JSON.stringify(e),signal:o.signal});return clearTimeout(s),i.ok?(await i.json()).accepted===!0:i.status===202}catch{return!1}}setBaseUrl(e){this.baseUrl=e}};var rt=O(require("readline"),1);var Bn=0;function it(){Bn++}async function se(t,e){if(!lt()||!process.stdin.isTTY||!process.stdout.isTTY||!Tn("error"))return;let n=rt.createInterface({input:process.stdin,output:process.stdout}),o=s=>new Promise(r=>{n.question(s,r)});try{console.log(),console.log(u.yellow("\u2501".repeat(50))),console.log(u.yellow(" Help us improve GAL CLI")),console.log(u.yellow("\u2501".repeat(50))),console.log();let s=await o(u.dim("Would you like to report this error? (y/N): "));if(s.toLowerCase()!=="y"&&s.toLowerCase()!=="yes"){n.close();return}let r=await o(u.dim("Any additional context? (press Enter to skip): "));n.close(),await at(1,r||`Error in ${t}: ${e.message}`,{command:t,errorType:e.name,errorMessage:e.message.substring(0,200)})&&console.log(u.green("\u2713 Thanks for your feedback!")),In("error")}catch{n.close()}}async function ut(){if(!lt()||!process.stdin.isTTY||!process.stdout.isTTY||Bn<10||!Tn("session"))return;let t=rt.createInterface({input:process.stdin,output:process.stdout}),e=n=>new Promise(o=>{t.question(n,o)});try{console.log(),console.log(u.blue("\u2501".repeat(50))),console.log(u.blue(" Quick feedback (1 question)")),console.log(u.blue("\u2501".repeat(50))),console.log();let n=await e(u.dim("How would you rate GAL CLI? (1-5, or press Enter to skip): "));if(!n){t.close();return}let o=parseInt(n,10);if(isNaN(o)||o<1||o>5){console.log(u.dim("Invalid rating, skipping...")),t.close();return}let s;o<=3&&(s=await e(u.dim("What could we improve? (press Enter to skip): "))),t.close(),await at(o,s||void 0,{command:"session_feedback"})&&console.log(u.green("\u2713 Thanks for your feedback!")),In("session")}catch{t.close()}}function Tn(t){try{let e=g.load(),n=Date.now(),o=24*60*60*1e3,s=7*o;if(t==="error"){let r=e.lastErrorFeedback||0;return n-r>o}else{let r=e.lastSessionFeedback||0;return n-r>s}}catch{return!0}}function In(t){try{let e=t==="error"?"lastErrorFeedback":"lastSessionFeedback";g.set(e,Date.now())}catch{}}var Ln="0.1.13",W=null,Nn=!1;function ft(){let t=process.env.GAL_TELEMETRY?.toLowerCase();if(t==="false"||t==="0"||t==="no"||t==="off")return!0;try{if(g.load().telemetry===!1)return!0}catch{}return!1}var ct=class{queue;client;installationId;exitHandlersRegistered=!1;constructor(e){this.installationId=wn(),this.queue=new _e,this.client=new ve(e),this.queue.setFlushCallback(n=>this.client.sendEvents(n)),this.registerExitHandlers()}async trackEvent(e,n){let o={id:(0,Pn.randomUUID)(),installationId:this.installationId,timestamp:new Date().toISOString(),eventType:e,payload:{...n,cliVersion:Ln,platform:process.platform,nodeVersion:process.version}};await this.queue.addEvent(o)}async flush(){await this.queue.flush()}async sendFeedback(e,n,o){let s={installationId:this.installationId,rating:e,comment:n,context:{...o,cliVersion:Ln,platform:process.platform}},r=g.load();return this.client.sendFeedback(s,r.authToken)}registerExitHandlers(){if(this.exitHandlersRegistered)return;let e=async()=>{await this.flush()};process.on("beforeExit",e),process.on("SIGINT",async()=>{await e(),process.exit(130)}),process.on("SIGTERM",async()=>{await e(),process.exit(143)}),this.exitHandlersRegistered=!0}};function Rn(){if(Nn||(Nn=!0,ft()))return;let e=g.load().apiUrl||"https://gal-api-s3pvf4isfa-uc.a.run.app";W=new ct(e)}function $n(){if(!(ft()||g.load().telemetryNoticeShown)){if(!On()){g.set("telemetryNoticeShown","true");return}console.log(u.blue("\u2501".repeat(60))),console.log(u.blue.bold(" GAL CLI Telemetry")),console.log(u.blue("\u2501".repeat(60))),console.log(),console.log(" GAL collects anonymous usage data to improve the CLI."),console.log(" This helps us diagnose issues and understand which"),console.log(" features are most valuable to developers."),console.log(),console.log(u.dim(" No personal information or code is collected.")),console.log(),console.log(" To opt out:"),console.log(u.cyan(" gal config set telemetry false")),console.log(" Or set environment variable:"),console.log(u.cyan(" export GAL_TELEMETRY=false")),console.log(),console.log(u.blue("\u2501".repeat(60))),console.log(),g.set("telemetryNoticeShown","true")}}function Dt(t,e){W&&W.trackEvent("auth_login",{success:t,errorType:e?e.name:void 0})}function ht(t,e,n){W&&W.trackEvent("sync_pull",{filesTracked:t,success:e,syncAgeHours:n})}async function at(t,e,n){return W?W.sendFeedback(t,e,n):!1}function lt(){return!ft()&&W!==null}var ae=O(require("node:process"),1);var yt=O(require("node:process"),1);var re=O(require("node:process"),1);var Fs=(t,e,n,o)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let s=Object.getOwnPropertyDescriptor(t,n),r=Object.getOwnPropertyDescriptor(e,n);!Cs(s,r)&&o||Object.defineProperty(t,n,r)},Cs=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Es=(t,e)=>{let n=Object.getPrototypeOf(e);n!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,n)},ys=(t,e)=>`/* Wrapped ${t}*/
|
|
31
31
|
${e}`,_s=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),As=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),vs=(t,e,n)=>{let o=n===""?"":`with ${n.trim()}() `,s=ys.bind(null,o,e.toString());Object.defineProperty(s,"name",As);let{writable:r,enumerable:i,configurable:a}=_s;Object.defineProperty(t,"toString",{value:s,writable:r,enumerable:i,configurable:a})};function dt(t,e,{ignoreNonConfigurable:n=!1}={}){let{name:o}=t;for(let s of Reflect.ownKeys(e))Fs(t,e,s,n);return Es(t,e),vs(t,e,o),t}var be=new WeakMap,Gn=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let n,o=0,s=t.displayName||t.name||"<anonymous>",r=function(...i){if(be.set(r,++o),o===1)n=t.apply(this,i),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return n};return dt(r,t),be.set(r,o),r};Gn.callCount=t=>{if(!be.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return be.get(t)};var jn=Gn;var J=[];J.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&J.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&J.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Se=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",mt=Symbol.for("signal-exit emitter"),pt=globalThis,bs=Object.defineProperty.bind(Object),gt=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(pt[mt])return pt[mt];bs(pt,mt,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){let o=this.listeners[e],s=o.indexOf(n);s!==-1&&(s===0&&o.length===1?o.length=0:o.splice(s,1))}emit(e,n,o){if(this.emitted[e])return!1;this.emitted[e]=!0;let s=!1;for(let r of this.listeners[e])s=r(n,o)===!0||s;return e==="exit"&&(s=this.emit("afterExit",n,o)||s),s}},we=class{},Ss=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}}),Ft=class extends we{onExit(){return()=>{}}load(){}unload(){}},Ct=class extends we{#i=Et.platform==="win32"?"SIGINT":"SIGHUP";#n=new gt;#e;#s;#D;#t={};#r=!1;constructor(e){super(),this.#e=e,this.#t={};for(let n of J)this.#t[n]=()=>{let o=this.#e.listeners(n),{count:s}=this.#n,r=e;if(typeof r.__signal_exit_emitter__=="object"&&typeof r.__signal_exit_emitter__.count=="number"&&(s+=r.__signal_exit_emitter__.count),o.length===s){this.unload();let i=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#i:n;i||e.kill(e.pid,a)}};this.#D=e.reallyExit,this.#s=e.emit}onExit(e,n){if(!Se(this.#e))return()=>{};this.#r===!1&&this.load();let o=n?.alwaysLast?"afterExit":"exit";return this.#n.on(o,e),()=>{this.#n.removeListener(o,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#n.count+=1;for(let e of J)try{let n=this.#t[e];n&&this.#e.on(e,n)}catch{}this.#e.emit=(e,...n)=>this.#h(e,...n),this.#e.reallyExit=e=>this.#o(e)}}unload(){this.#r&&(this.#r=!1,J.forEach(e=>{let n=this.#t[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,n)}catch{}}),this.#e.emit=this.#s,this.#e.reallyExit=this.#D,this.#n.count-=1)}#o(e){return Se(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#D.call(this.#e,this.#e.exitCode)):0}#h(e,...n){let o=this.#s;if(e==="exit"&&Se(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let s=o.call(this.#e,e,...n);return this.#n.emit("exit",this.#e.exitCode,null),s}else return o.call(this.#e,e,...n)}},Et=globalThis.process,{onExit:Un,load:hi,unload:di}=Ss(Se(Et)?new Ct(Et):new Ft);var Hn=re.default.stderr.isTTY?re.default.stderr:re.default.stdout.isTTY?re.default.stdout:void 0,ws=Hn?jn(()=>{Un(()=>{Hn.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Vn=ws;var Oe=!1,Q={};Q.show=(t=yt.default.stderr)=>{t.isTTY&&(Oe=!1,t.write("\x1B[?25h"))};Q.hide=(t=yt.default.stderr)=>{t.isTTY&&(Vn(),Oe=!0,t.write("\x1B[?25l"))};Q.toggle=(t,e)=>{t!==void 0&&(Oe=t),Oe?Q.show(e):Q.hide(e)};var _t=Q;var le=O(At(),1);var I=O(require("node:process"),1);function vt(){return I.default.platform!=="win32"?I.default.env.TERM!=="linux":!!I.default.env.CI||!!I.default.env.WT_SESSION||!!I.default.env.TERMINUS_SUBLIME||I.default.env.ConEmuTask==="{cmd::Cmder}"||I.default.env.TERM_PROGRAM==="Terminus-Sublime"||I.default.env.TERM_PROGRAM==="vscode"||I.default.env.TERM==="xterm-256color"||I.default.env.TERM==="alacritty"||I.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ks={info:u.blue("\u2139"),success:u.green("\u2714"),warning:u.yellow("\u26A0"),error:u.red("\u2716")},xs={info:u.blue("i"),success:u.green("\u221A"),warning:u.yellow("\u203C"),error:u.red("\xD7")},Bs=vt()?ks:xs,ie=Bs;function bt({onlyFirst:t=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,t?void 0:"g")}var Ts=bt();function ue(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Ts,"")}function Jn(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function zn(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function Yn(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function Is(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function Kn(t,{ambiguousAsWide:e=!1}={}){return Is(t),zn(t)||Yn(t)||e&&Jn(t)?2:1}var Zn=O(Xn(),1),Ls=new Intl.Segmenter,Ns=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function St(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:o=!1}=e;if(o||(t=ue(t)),t.length===0)return 0;let s=0,r={ambiguousAsWide:!n};for(let{segment:i}of Ls.segment(t)){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!Ns.test(i)){if((0,Zn.default)().test(i)){s+=2;continue}s+=Kn(a,r)}}return s}function wt({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var Ot=O(require("node:process"),1);function kt(){let{env:t}=Ot.default,{TERM:e,TERM_PROGRAM:n}=t;return Ot.default.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var P=O(require("node:process"),1),Ps=3,xt=class{#i=0;start(){this.#i++,this.#i===1&&this.#n()}stop(){if(this.#i<=0)throw new Error("`stop` called more times than `start`");this.#i--,this.#i===0&&this.#e()}#n(){P.default.platform==="win32"||!P.default.stdin.isTTY||(P.default.stdin.setRawMode(!0),P.default.stdin.on("data",this.#s),P.default.stdin.resume())}#e(){P.default.stdin.isTTY&&(P.default.stdin.off("data",this.#s),P.default.stdin.pause(),P.default.stdin.setRawMode(!1))}#s(e){e[0]===Ps&&P.default.emit("SIGINT")}},Rs=new xt,Bt=Rs;var $s=O(At(),1),Tt=class{#i=0;#n=!1;#e=0;#s=-1;#D=0;#t;#r;#o;#h;#m;#l;#c;#f;#p;#u;#a;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:ae.default.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#m=this.#t.interval,this.#o=this.#t.stream,this.#l=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:wt({stream:this.#o}),this.#c=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,ae.default.env.NODE_ENV==="test"&&(this._stream=this.#o,this._isEnabled=this.#l,Object.defineProperty(this,"_linesToClear",{get(){return this.#i},set(n){this.#i=n}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#f}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#f=e,this.#d()}get interval(){return this.#m??this.#r.interval??100}get spinner(){return this.#r}set spinner(e){if(this.#s=-1,this.#m=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#r=e}else if(!kt())this.#r=le.default.line;else if(e===void 0)this.#r=le.default.dots;else if(e!=="default"&&le.default[e])this.#r=le.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#p}set text(e=""){this.#p=e,this.#d()}get prefixText(){return this.#u}set prefixText(e=""){this.#u=e,this.#d()}get suffixText(){return this.#a}set suffixText(e=""){this.#a=e,this.#d()}get isSpinning(){return this.#h!==void 0}#g(e=this.#u,n=" "){return typeof e=="string"&&e!==""?e+n:typeof e=="function"?e()+n:""}#F(e=this.#a,n=" "){return typeof e=="string"&&e!==""?n+e:typeof e=="function"?n+e():""}#d(){let e=this.#o.columns??80,n=this.#g(this.#u,"-"),o=this.#F(this.#a,"-"),s=" ".repeat(this.#f)+n+"--"+this.#p+"--"+o;this.#e=0;for(let r of ue(s).split(`
|
|
32
32
|
`))this.#e+=Math.max(1,Math.ceil(St(r,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#l&&!this.#c}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#l=e}get isSilent(){return this.#c}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#c=e}frame(){let e=Date.now();(this.#s===-1||e-this.#D>=this.interval)&&(this.#s=++this.#s%this.#r.frames.length,this.#D=e);let{frames:n}=this.#r,o=n[this.#s];this.color&&(o=u[this.color](o));let s=typeof this.#u=="string"&&this.#u!==""?this.#u+" ":"",r=typeof this.text=="string"?" "+this.text:"",i=typeof this.#a=="string"&&this.#a!==""?" "+this.#a:"";return s+o+r+i}clear(){if(!this.#l||!this.#o.isTTY)return this;this.#o.cursorTo(0);for(let e=0;e<this.#i;e++)e>0&&this.#o.moveCursor(0,-1),this.#o.clearLine(1);return(this.#f||this.lastIndent!==this.#f)&&this.#o.cursorTo(this.#f),this.lastIndent=this.#f,this.#i=0,this}render(){return this.#c?this:(this.clear(),this.#o.write(this.frame()),this.#i=this.#e,this)}start(e){return e&&(this.text=e),this.#c?this:this.#l?this.isSpinning?this:(this.#t.hideCursor&&_t.hide(this.#o),this.#t.discardStdin&&ae.default.stdin.isTTY&&(this.#n=!0,Bt.start()),this.render(),this.#h=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#o.write(`- ${this.text}
|
|
33
33
|
`),this)}stop(){return this.#l?(clearInterval(this.#h),this.#h=void 0,this.#s=0,this.clear(),this.#t.hideCursor&&_t.show(this.#o),this.#t.discardStdin&&ae.default.stdin.isTTY&&this.#n&&(Bt.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:ie.success,text:e})}fail(e){return this.stopAndPersist({symbol:ie.error,text:e})}warn(e){return this.stopAndPersist({symbol:ie.warning,text:e})}info(e){return this.stopAndPersist({symbol:ie.info,text:e})}stopAndPersist(e={}){if(this.#c)return this;let n=e.prefixText??this.#u,o=this.#g(n," "),s=e.symbol??" ",r=e.text??this.text,a=typeof r=="string"?(s?" ":"")+r:"",l=e.suffixText??this.#a,c=this.#F(l," "),f=o+s+a+c+`
|
|
@@ -455,7 +455,7 @@ Removing files...`));let r=ir(s,!1);if(console.log(),r.removed.length>0){console
|
|
|
455
455
|
\u2717 Failed to remove ${r.errors.length} item(s):`));for(let i of r.errors)console.log(u.dim(` - ${i}`))}console.log(u.blue(`
|
|
456
456
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`)),console.log(u.blue(" GAL has been uninstalled.")),console.log(u.blue(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
457
457
|
`)),console.log(u.dim("To reinstall, run: gal sync --pull")),console.log(u.dim(`To completely remove the CLI: npm uninstall -g @scheduler-systems/gal-cli
|
|
458
|
-
`))}),t}var Te="0.1.13
|
|
458
|
+
`))}),t}var Te="0.1.13",Lt="https://gal-api-s3pvf4isfa-uc.a.run.app",Rt=(0,Gt.join)((0,mo.homedir)(),".gal"),$t=(0,Gt.join)(Rt,"update-cache.json"),ur=24*60*60*1e3;function ar(t,e){let n=t.replace(/^v/,"").split(".").map(Number),o=e.replace(/^v/,"").split(".").map(Number);for(let s=0;s<3;s++){if((n[s]||0)<(o[s]||0))return-1;if((n[s]||0)>(o[s]||0))return 1}return 0}function lr(){try{if((0,M.existsSync)($t))return JSON.parse((0,M.readFileSync)($t,"utf-8"))}catch{}return null}function cr(t){try{(0,M.existsSync)(Rt)||(0,M.mkdirSync)(Rt,{recursive:!0}),(0,M.writeFileSync)($t,JSON.stringify(t))}catch{}}function fr(t,e){let n=["",u.bgYellow.black(" UPDATE AVAILABLE "),"",` ${u.dim(t)} \u2192 ${u.green(e)}`,"",` Run: ${u.cyan("npm update -g @scheduler-systems/gal-cli")}`,""].join(`
|
|
459
459
|
`),s=u.yellow("\u2500".repeat(50));console.log(`
|
|
460
460
|
`+s),console.log(n),console.log(s+`
|
|
461
461
|
`)}function Dr(t){return/-(alpha|beta|pr|rc|dev)/i.test(t)}function hr(){if(Dr(Te))return;let t=lr(),e=!t||Date.now()-t.lastCheck>ur;if(t?.latestVersion&&ar(Te,t.latestVersion)<0&&process.on("exit",()=>{fr(Te,t.latestVersion)}),e){let n=ho.default.get("https://registry.npmjs.org/@scheduler-systems/gal-cli/latest",{timeout:3e3},o=>{let s="";o.on("data",r=>s+=r),o.on("end",()=>{try{let r=JSON.parse(s);cr({lastCheck:Date.now(),latestVersion:r.version})}catch{}})});n.on("error",()=>{}),n.on("timeout",()=>n.destroy())}}hr();$n();Rn();it();process.on("beforeExit",async()=>{await ut()});Do.default.config();var X=new R;X.name("gal").description("GAL - Governance Agentic Layer CLI").version(Te);X.addCommand(so());X.addCommand(uo());X.addCommand(ao());X.addCommand(fo());X.parse();0&&(module.exports={DEFAULT_API_URL});
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scheduler-systems/gal-cli",
|
|
3
|
-
"version": "0.1.13
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "GAL CLI - Command-line tool for managing AI agent configurations across your organization",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org",
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
7
11
|
"type": "module",
|
|
8
12
|
"main": "./dist/index.cjs",
|
|
9
13
|
"bin": {
|
|
@@ -76,4 +80,4 @@
|
|
|
76
80
|
"typescript": "^5.7.2",
|
|
77
81
|
"vitest": "^1.0.0"
|
|
78
82
|
}
|
|
79
|
-
}
|
|
83
|
+
}
|