@stackone/cli 1.13.5 → 1.13.7

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/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const e=require(`./cliCore-C1-E6aOI.cjs`);new e.t().run();
2
+ const e=require(`./cliCore-CbruuiwN.cjs`);new e.t().run();
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./cliCore-BmfsQBm6.mjs";new e().run();export{};
2
+ import{t as e}from"./cliCore-C9tEBCF2.mjs";new e().run();export{};
@@ -55,4 +55,4 @@ To create a profile, run "stackone init".`),process.exit(1)),h=await this.#o(e,m
55
55
  `))};if(r){try{te(r)}catch{b.error(`File or directory not found: ${r}`),process.exit(1)}if(n){let{watch:e}=await import(`chokidar`),n=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding(`utf8`);let o=()=>{console.info(t.grey(`
56
56
 
57
57
  Exiting watch mode...`)),s.close(),i.stop(),n.close(),process.exit(0)};a(),console.info(t.blue(`Running connector(s) validations...`)),await Rp(r),i.start();let s=e(r||`.`,{ignored:/(^|[/\\])\../,persistent:!0});s.on(`change`,async e=>{a(),i.stop(),console.info(t.blue(`File change detected. Running connector(s) validations...`)),await Rp(r),i.start()}),process.stdin.on(`data`,e=>{e.toString()===`q`&&o()}),process.on(`SIGINT`,()=>{o()})}else await Rp(r),process.exit(0)}}};const Rp=async e=>{let t=te(e);if(t.isDirectory()){let t=g(e).filter(e=>e.endsWith(`.s1.yaml`));if(t.length===0){b.error(`No StackOne connectors found in directory: ${e}. Connector files need to have the extension .s1.yaml.\n`);return}let n=0,r=0;for(let i of t){let t=`${e}/${i}`;te(t).isFile()&&(await zp(t)?n++:r++)}b.info(`Validation completed: ${n} valid, ${r} invalid connectors.\n`)}else t.isFile()&&e.endsWith(`s1.yaml`)?await zp(e):b.error(`No StackOne connector found: ${e}. Connector files need to have the extension .s1.yaml.\n`)},zp=async e=>{let n=he(pe(e)),r=n?.errors??[];if(n.success){let t=e.split(`/`).pop()||e;return b.success(`Connector ${t} is valid!\n`),!0}else if(r.length>0)return b.error(`Connector ${e} is not valid. Please fix the following errors:\n`),r.forEach(e=>{console.info(t.red(`- L${e.line}: ${e.message}`))}),console.info(`
58
- `),!1;else return b.error(`Connector ${e} is not valid. Please check the file for errors.`),!1},Bp=l(Ce(),`.stackone`),Vp=l(Bp,`version-check.json`),Hp=(e=!1)=>new Promise(t=>{try{e?(Up(e),t()):setImmediate(()=>{try{Up(e)}catch{}t()})}catch{t()}}),Up=(e=!1)=>{let t=Jp(),n=Date.now();if(!e&&t&&n-t.lastCheckTime<1728e5){t.latestVersion&&Gp(t.latestVersion)&&Kp(t.latestVersion);return}let r=Wp();r&&(Yp({lastCheckTime:n,latestVersion:r}),Gp(r)&&Kp(r))},Wp=()=>{try{return a(`npm view @stackone/cli version`,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim()}catch{return null}},Gp=e=>{try{let t=Fp();return xe.gt(e,t)}catch{return!1}},Kp=e=>{let n=Fp(),r=t.yellow(`┌`+`─`.repeat(68)+`┐`),i=t.yellow(`│`)+` `.repeat(68)+t.yellow(`│`),a=t.yellow(`└`+`─`.repeat(68)+`┘`),o=`Update available: ${t.dim(n)} → ${t.green(e)}`,s=`Run ${t.cyan(`stackone update`)} to update`,c=68-qp(o).length,l=68-qp(s).length;console.log(``),console.log(r),console.log(i),console.log(t.yellow(`│`)+` `.repeat(2)+o+` `.repeat(c-2)+t.yellow(`│`)),console.log(t.yellow(`│`)+` `.repeat(2)+s+` `.repeat(l-2)+t.yellow(`│`)),console.log(i),console.log(a),console.log(``)},qp=e=>e.replace(/\u001b\[[0-9;]*m/g,``),Jp=()=>{try{if(!_e(Vp))return null;let e=ye(Vp,`utf-8`);return JSON.parse(e)}catch{return null}},Yp=e=>{try{_e(Bp)||ve(Bp,{recursive:!0}),be(Vp,JSON.stringify(e,null,2),`utf-8`)}catch{}};var Xp=class{constructor(e=new r,t=Fp()){this.program=e,this.version=t,this.setupProgram(),this.registerCommands()}setupProgram(){this.program.name(`stackone`).description(`StackOne CLI`).version(this.version,`-v, --version`)}registerCommands(){let e=new wp,r=new Ep,i=new lt,a=new Cp,o=new Lp,s=new Ze,c=new tt,l=new qe,u=new Np,d=new Ip;this.program.configureOutput({writeOut:e=>process.stdout.write(e),writeErr:e=>process.stderr.write(e),outputError:(e,n)=>{n(t.red(e))}}),this.program.command(`init`).option(`-e, --env <environment>`,`Specify the environment for the configuration profile`).description(`Initialize & create a StackOne CLI configuration profile`).action(t=>{e.execute({environment:t.env})}),this.program.command(`push`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new n(`<path>`,`Connector file or directory to push`)).description(`Push a connector to the StackOne registry`).action((e,t)=>{r.execute({profile:t.profile,fileOrDir:e,apiUrl:t.apiUrl,apiKey:t.apiKey})}),this.program.command(`drop`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new n(`<connector>`,`Connector identifier in format provider_key@version`)).description(`Drop a connector from the StackOne registry`).action((e,t)=>{i.execute({profile:t.profile,connector:e,apiUrl:t.apiUrl,apiKey:t.apiKey})}),this.program.command(`get`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`--connector <connector>`,`Connector identifier in format provider_key@version`).option(`--account-id <account-id>`,`Account ID to fetch connector from`).option(`-f, --format <format>`,`Output format: yaml or json (default: yaml)`,`yaml`).option(`-o, --output-file <output-file>`,`File to write the output to`).description(`Get a connector from the StackOne registry`).action(e=>{a.execute({profile:e.profile,connector:e.connector,accountId:e.accountId,format:e.format,outputFile:e.outputFile,apiUrl:e.apiUrl,apiKey:e.apiKey})}),this.program.command(`validate`).option(`-w, --watch`,`Run in watch mode`).addArgument(new n(`<path>`,`Connector file or directory with connectors to validate`)).description(`Validate a StackOne connector`).action((e,t)=>{o.execute({watchMode:t.watch,fileOrDir:e})}),this.program.command(`run`).option(`--connector <connector>`,`Connector file to run (optional when using --account-id)`).option(`--action <action>`,`Action to execute on the connector (path to file or inline string action code)`).option(`--action-id <action-id>`,`Action ID to execute on the connector`).option(`--account <account>`,`Account details to use for running the connector (path to file or inline string account data)`).option(`--account-id <account-id>`,`Account ID to use for running the connector against (fetches connector from API if --connector not provided)`).option(`--params <params>`,`Action parameters (path to file or inline string with JSON parameters)`).option(`--credentials <credentials>`,`Credentials to use (path to file or inline string with JSON credentials)`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`-o, --output-file <output-file>`,`File to write the output to`).option(`-d, --debug`,`Enables debug mode to include more details in the action execution output`).description(`Run a connector action`).action(e=>{u.execute({connector:e.connector,action:e.action,actionId:e.actionId,account:e.account,accountId:e.accountId,params:e.params,credentials:e.credentials,profile:e.profile,outputFile:e.outputFile,debug:e.debug,apiUrl:e.apiUrl,apiKey:e.apiKey})});let f=this.program.command(`agent`).description(`StackOne agent commands`);f.command(`setup`).option(`-g, --global`,`Setup global configuration`).option(`-l, --local`,`Setup local project configuration`).description(`Setup StackOne agent (global or local)`).action(e=>{e.global?s.execute():c.execute()}),f.command(`cleanup`).description(`Remove all API keys and credentials from configurations`).action(()=>{l.execute()}),this.program.command(`update`).option(`-f, --force`,`Force reinstall even if already on latest version`).description(`Update the CLI to the latest version`).action(e=>{d.execute({force:e.force})}),this.program.command(`version`).description(`Show version information`).action(async()=>{console.info(`${t.greenBright(`StackOne`)} ${t.grey(`CLI`)} ${t.whiteBright(this.version)}`),await Hp(!0),process.exit(0)})}run(){process.argv.includes(`version`)||Hp(),this.program.parse(process.argv)}};export{Xp as t};
58
+ `),!1;else return b.error(`Connector ${e} is not valid. Please check the file for errors.`),!1},Bp=l(Ce(),`.stackone`),Vp=l(Bp,`version-check.json`),Hp=(e=!1)=>{let t=qp(),n=Date.now();if(e||!t||n-t.lastCheckTime>1728e5){let e=Up();e&&Wp(e)&&Gp(e),Jp({lastCheckTime:n})}},Up=()=>{try{return a(`npm view @stackone/cli version`,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:15e3}).trim()}catch{return null}},Wp=e=>{try{let t=Fp();return xe.gt(e,t)}catch{return!1}},Gp=e=>{let n=Fp(),r=t.yellow(`┌`+`─`.repeat(68)+`┐`),i=t.yellow(`│`)+` `.repeat(68)+t.yellow(`│`),a=t.yellow(`└`+`─`.repeat(68)+`┘`),o=`Update available: ${t.dim(n)} → ${t.green(e)}`,s=`Run ${t.cyan(`stackone update`)} to update`,c=68-Kp(o).length,l=68-Kp(s).length;console.log(``),console.log(r),console.log(i),console.log(t.yellow(`│`)+` `.repeat(2)+o+` `.repeat(c-2)+t.yellow(`│`)),console.log(t.yellow(`│`)+` `.repeat(2)+s+` `.repeat(l-2)+t.yellow(`│`)),console.log(i),console.log(a),console.log(``)},Kp=e=>e.replace(/\u001b\[[0-9;]*m/g,``),qp=()=>{try{if(!_e(Vp))return null;let e=ye(Vp,`utf-8`);return JSON.parse(e)}catch{return null}},Jp=e=>{try{_e(Bp)||ve(Bp,{recursive:!0}),be(Vp,JSON.stringify(e,null,2),`utf-8`)}catch{}};var Yp=class{constructor(e=new r,t=Fp()){this.program=e,this.version=t,this.setupProgram(),this.registerCommands()}setupProgram(){this.program.name(`stackone`).description(`StackOne CLI`).version(this.version,`-v, --version`)}registerCommands(){let e=new wp,r=new Ep,i=new lt,a=new Cp,o=new Lp,s=new Ze,c=new tt,l=new qe,u=new Np,d=new Ip;this.program.configureOutput({writeOut:e=>process.stdout.write(e),writeErr:e=>process.stderr.write(e),outputError:(e,n)=>{n(t.red(e))}}),this.program.command(`init`).option(`-e, --env <environment>`,`Specify the environment for the configuration profile`).description(`Initialize & create a StackOne CLI configuration profile`).action(t=>{e.execute({environment:t.env})}),this.program.command(`push`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new n(`<path>`,`Connector file or directory to push`)).description(`Push a connector to the StackOne registry`).action((e,t)=>{r.execute({profile:t.profile,fileOrDir:e,apiUrl:t.apiUrl,apiKey:t.apiKey})}),this.program.command(`drop`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new n(`<connector>`,`Connector identifier in format provider_key@version`)).description(`Drop a connector from the StackOne registry`).action((e,t)=>{i.execute({profile:t.profile,connector:e,apiUrl:t.apiUrl,apiKey:t.apiKey})}),this.program.command(`get`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`--connector <connector>`,`Connector identifier in format provider_key@version`).option(`--account-id <account-id>`,`Account ID to fetch connector from`).option(`-f, --format <format>`,`Output format: yaml or json (default: yaml)`,`yaml`).option(`-o, --output-file <output-file>`,`File to write the output to`).description(`Get a connector from the StackOne registry`).action(e=>{a.execute({profile:e.profile,connector:e.connector,accountId:e.accountId,format:e.format,outputFile:e.outputFile,apiUrl:e.apiUrl,apiKey:e.apiKey})}),this.program.command(`validate`).option(`-w, --watch`,`Run in watch mode`).addArgument(new n(`<path>`,`Connector file or directory with connectors to validate`)).description(`Validate a StackOne connector`).action((e,t)=>{o.execute({watchMode:t.watch,fileOrDir:e})}),this.program.command(`run`).option(`--connector <connector>`,`Connector file to run (optional when using --account-id)`).option(`--action <action>`,`Action to execute on the connector (path to file or inline string action code)`).option(`--action-id <action-id>`,`Action ID to execute on the connector`).option(`--account <account>`,`Account details to use for running the connector (path to file or inline string account data)`).option(`--account-id <account-id>`,`Account ID to use for running the connector against (fetches connector from API if --connector not provided)`).option(`--params <params>`,`Action parameters (path to file or inline string with JSON parameters)`).option(`--credentials <credentials>`,`Credentials to use (path to file or inline string with JSON credentials)`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`-o, --output-file <output-file>`,`File to write the output to`).option(`-d, --debug`,`Enables debug mode to include more details in the action execution output`).description(`Run a connector action`).action(e=>{u.execute({connector:e.connector,action:e.action,actionId:e.actionId,account:e.account,accountId:e.accountId,params:e.params,credentials:e.credentials,profile:e.profile,outputFile:e.outputFile,debug:e.debug,apiUrl:e.apiUrl,apiKey:e.apiKey})});let f=this.program.command(`agent`).description(`StackOne agent commands`);f.command(`setup`).option(`-g, --global`,`Setup global configuration`).option(`-l, --local`,`Setup local project configuration`).description(`Setup StackOne agent (global or local)`).action(e=>{e.global?s.execute():c.execute()}),f.command(`cleanup`).description(`Remove all API keys and credentials from configurations`).action(()=>{l.execute()}),this.program.command(`update`).option(`-f, --force`,`Force reinstall even if already on latest version`).description(`Update the CLI to the latest version`).action(e=>{d.execute({force:e.force})}),this.program.command(`version`).description(`Show version information`).action(async()=>{console.info(`${t.greenBright(`StackOne`)} ${t.grey(`CLI`)} ${t.whiteBright(this.version)}`),Hp(!0),process.exit(0)})}run(){process.argv.includes(`version`)||Hp(),this.program.parse(process.argv)}};export{Yp as t};
@@ -55,4 +55,4 @@ To create a profile, run "stackone init".`),process.exit(1)),m=await this.#o(e,p
55
55
  `))};if(n){try{(0,g.statSync)(n)}catch{S.error(`File or directory not found: ${n}`),process.exit(1)}if(t){let{watch:e}=await import(`chokidar`),t=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding(`utf8`);let a=()=>{console.info(l.default.grey(`
56
56
 
57
57
  Exiting watch mode...`)),o.close(),r.stop(),t.close(),process.exit(0)};i(),console.info(l.default.blue(`Running connector(s) validations...`)),await Bg(n),r.start();let o=e(n||`.`,{ignored:/(^|[/\\])\../,persistent:!0});o.on(`change`,async e=>{i(),r.stop(),console.info(l.default.blue(`File change detected. Running connector(s) validations...`)),await Bg(n),r.start()}),process.stdin.on(`data`,e=>{e.toString()===`q`&&a()}),process.on(`SIGINT`,()=>{a()})}else await Bg(n),process.exit(0)}}};const Bg=async e=>{let t=(0,g.statSync)(e);if(t.isDirectory()){let t=(0,g.readdirSync)(e).filter(e=>e.endsWith(`.s1.yaml`));if(t.length===0){S.error(`No StackOne connectors found in directory: ${e}. Connector files need to have the extension .s1.yaml.\n`);return}let n=0,r=0;for(let i of t){let t=`${e}/${i}`;(0,g.statSync)(t).isFile()&&(await Vg(t)?n++:r++)}S.info(`Validation completed: ${n} valid, ${r} invalid connectors.\n`)}else t.isFile()&&e.endsWith(`s1.yaml`)?await Vg(e):S.error(`No StackOne connector found: ${e}. Connector files need to have the extension .s1.yaml.\n`)},Vg=async e=>{let t=(0,b.validateYamlConnector)((0,b.loadConnector)(e)),n=t?.errors??[];if(t.success){let t=e.split(`/`).pop()||e;return S.success(`Connector ${t} is valid!\n`),!0}else if(n.length>0)return S.error(`Connector ${e} is not valid. Please fix the following errors:\n`),n.forEach(e=>{console.info(l.default.red(`- L${e.line}: ${e.message}`))}),console.info(`
58
- `),!1;else return S.error(`Connector ${e} is not valid. Please check the file for errors.`),!1},Hg=`@stackone/cli`,Ug=2880*60*1e3,Wg=(0,p.join)((0,ce.homedir)(),`.stackone`),Gg=(0,p.join)(Wg,`version-check.json`),Kg=(e=!1)=>new Promise(t=>{try{e?(qg(e),t()):setImmediate(()=>{try{qg(e)}catch{}t()})}catch{t()}}),qg=(e=!1)=>{let t=Qg(),n=Date.now();if(!e&&t&&n-t.lastCheckTime<1728e5){t.latestVersion&&Yg(t.latestVersion)&&Xg(t.latestVersion);return}let r=Jg();r&&($g({lastCheckTime:n,latestVersion:r}),Yg(r)&&Xg(r))},Jg=()=>{try{return(0,d.execSync)(`npm view @stackone/cli version`,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim()}catch{return null}},Yg=e=>{try{let t=Lg();return oe.default.gt(e,t)}catch{return!1}},Xg=e=>{let t=Lg(),n=l.default.yellow(`┌`+`─`.repeat(68)+`┐`),r=l.default.yellow(`│`)+` `.repeat(68)+l.default.yellow(`│`),i=l.default.yellow(`└`+`─`.repeat(68)+`┘`),a=`Update available: ${l.default.dim(t)} → ${l.default.green(e)}`,o=`Run ${l.default.cyan(`stackone update`)} to update`,s=68-Zg(a).length,c=68-Zg(o).length;console.log(``),console.log(n),console.log(r),console.log(l.default.yellow(`│`)+` `.repeat(2)+a+` `.repeat(s-2)+l.default.yellow(`│`)),console.log(l.default.yellow(`│`)+` `.repeat(2)+o+` `.repeat(c-2)+l.default.yellow(`│`)),console.log(r),console.log(i),console.log(``)},Zg=e=>e.replace(/\u001b\[[0-9;]*m/g,``),Qg=()=>{try{if(!(0,x.existsSync)(Gg))return null;let e=(0,x.readFileSync)(Gg,`utf-8`);return JSON.parse(e)}catch{return null}},$g=e=>{try{(0,x.existsSync)(Wg)||(0,x.mkdirSync)(Wg,{recursive:!0}),(0,x.writeFileSync)(Gg,JSON.stringify(e,null,2),`utf-8`)}catch{}};var e_=class{constructor(e=new u.Command,t=Lg()){this.program=e,this.version=t,this.setupProgram(),this.registerCommands()}setupProgram(){this.program.name(`stackone`).description(`StackOne CLI`).version(this.version,`-v, --version`)}registerCommands(){let e=new Eg,t=new Og,n=new He,r=new Sg,i=new zg,a=new Ae,o=new Pe,s=new Te,c=new Fg,d=new Rg;this.program.configureOutput({writeOut:e=>process.stdout.write(e),writeErr:e=>process.stderr.write(e),outputError:(e,t)=>{t(l.default.red(e))}}),this.program.command(`init`).option(`-e, --env <environment>`,`Specify the environment for the configuration profile`).description(`Initialize & create a StackOne CLI configuration profile`).action(t=>{e.execute({environment:t.env})}),this.program.command(`push`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new u.Argument(`<path>`,`Connector file or directory to push`)).description(`Push a connector to the StackOne registry`).action((e,n)=>{t.execute({profile:n.profile,fileOrDir:e,apiUrl:n.apiUrl,apiKey:n.apiKey})}),this.program.command(`drop`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new u.Argument(`<connector>`,`Connector identifier in format provider_key@version`)).description(`Drop a connector from the StackOne registry`).action((e,t)=>{n.execute({profile:t.profile,connector:e,apiUrl:t.apiUrl,apiKey:t.apiKey})}),this.program.command(`get`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`--connector <connector>`,`Connector identifier in format provider_key@version`).option(`--account-id <account-id>`,`Account ID to fetch connector from`).option(`-f, --format <format>`,`Output format: yaml or json (default: yaml)`,`yaml`).option(`-o, --output-file <output-file>`,`File to write the output to`).description(`Get a connector from the StackOne registry`).action(e=>{r.execute({profile:e.profile,connector:e.connector,accountId:e.accountId,format:e.format,outputFile:e.outputFile,apiUrl:e.apiUrl,apiKey:e.apiKey})}),this.program.command(`validate`).option(`-w, --watch`,`Run in watch mode`).addArgument(new u.Argument(`<path>`,`Connector file or directory with connectors to validate`)).description(`Validate a StackOne connector`).action((e,t)=>{i.execute({watchMode:t.watch,fileOrDir:e})}),this.program.command(`run`).option(`--connector <connector>`,`Connector file to run (optional when using --account-id)`).option(`--action <action>`,`Action to execute on the connector (path to file or inline string action code)`).option(`--action-id <action-id>`,`Action ID to execute on the connector`).option(`--account <account>`,`Account details to use for running the connector (path to file or inline string account data)`).option(`--account-id <account-id>`,`Account ID to use for running the connector against (fetches connector from API if --connector not provided)`).option(`--params <params>`,`Action parameters (path to file or inline string with JSON parameters)`).option(`--credentials <credentials>`,`Credentials to use (path to file or inline string with JSON credentials)`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`-o, --output-file <output-file>`,`File to write the output to`).option(`-d, --debug`,`Enables debug mode to include more details in the action execution output`).description(`Run a connector action`).action(e=>{c.execute({connector:e.connector,action:e.action,actionId:e.actionId,account:e.account,accountId:e.accountId,params:e.params,credentials:e.credentials,profile:e.profile,outputFile:e.outputFile,debug:e.debug,apiUrl:e.apiUrl,apiKey:e.apiKey})});let f=this.program.command(`agent`).description(`StackOne agent commands`);f.command(`setup`).option(`-g, --global`,`Setup global configuration`).option(`-l, --local`,`Setup local project configuration`).description(`Setup StackOne agent (global or local)`).action(e=>{e.global?a.execute():o.execute()}),f.command(`cleanup`).description(`Remove all API keys and credentials from configurations`).action(()=>{s.execute()}),this.program.command(`update`).option(`-f, --force`,`Force reinstall even if already on latest version`).description(`Update the CLI to the latest version`).action(e=>{d.execute({force:e.force})}),this.program.command(`version`).description(`Show version information`).action(async()=>{console.info(`${l.default.greenBright(`StackOne`)} ${l.default.grey(`CLI`)} ${l.default.whiteBright(this.version)}`),await Kg(!0),process.exit(0)})}run(){process.argv.includes(`version`)||Kg(),this.program.parse(process.argv)}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e_}});
58
+ `),!1;else return S.error(`Connector ${e} is not valid. Please check the file for errors.`),!1},Hg=`@stackone/cli`,Ug=2880*60*1e3,Wg=(0,p.join)((0,ce.homedir)(),`.stackone`),Gg=(0,p.join)(Wg,`version-check.json`),Kg=(e=!1)=>{let t=Zg(),n=Date.now();if(e||!t||n-t.lastCheckTime>1728e5){let e=qg();e&&Jg(e)&&Yg(e),Qg({lastCheckTime:n})}},qg=()=>{try{return(0,d.execSync)(`npm view @stackone/cli version`,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:15e3}).trim()}catch{return null}},Jg=e=>{try{let t=Lg();return oe.default.gt(e,t)}catch{return!1}},Yg=e=>{let t=Lg(),n=l.default.yellow(`┌`+`─`.repeat(68)+`┐`),r=l.default.yellow(`│`)+` `.repeat(68)+l.default.yellow(`│`),i=l.default.yellow(`└`+`─`.repeat(68)+`┘`),a=`Update available: ${l.default.dim(t)} → ${l.default.green(e)}`,o=`Run ${l.default.cyan(`stackone update`)} to update`,s=68-Xg(a).length,c=68-Xg(o).length;console.log(``),console.log(n),console.log(r),console.log(l.default.yellow(`│`)+` `.repeat(2)+a+` `.repeat(s-2)+l.default.yellow(`│`)),console.log(l.default.yellow(`│`)+` `.repeat(2)+o+` `.repeat(c-2)+l.default.yellow(`│`)),console.log(r),console.log(i),console.log(``)},Xg=e=>e.replace(/\u001b\[[0-9;]*m/g,``),Zg=()=>{try{if(!(0,x.existsSync)(Gg))return null;let e=(0,x.readFileSync)(Gg,`utf-8`);return JSON.parse(e)}catch{return null}},Qg=e=>{try{(0,x.existsSync)(Wg)||(0,x.mkdirSync)(Wg,{recursive:!0}),(0,x.writeFileSync)(Gg,JSON.stringify(e,null,2),`utf-8`)}catch{}};var $g=class{constructor(e=new u.Command,t=Lg()){this.program=e,this.version=t,this.setupProgram(),this.registerCommands()}setupProgram(){this.program.name(`stackone`).description(`StackOne CLI`).version(this.version,`-v, --version`)}registerCommands(){let e=new Eg,t=new Og,n=new He,r=new Sg,i=new zg,a=new Ae,o=new Pe,s=new Te,c=new Fg,d=new Rg;this.program.configureOutput({writeOut:e=>process.stdout.write(e),writeErr:e=>process.stderr.write(e),outputError:(e,t)=>{t(l.default.red(e))}}),this.program.command(`init`).option(`-e, --env <environment>`,`Specify the environment for the configuration profile`).description(`Initialize & create a StackOne CLI configuration profile`).action(t=>{e.execute({environment:t.env})}),this.program.command(`push`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new u.Argument(`<path>`,`Connector file or directory to push`)).description(`Push a connector to the StackOne registry`).action((e,n)=>{t.execute({profile:n.profile,fileOrDir:e,apiUrl:n.apiUrl,apiKey:n.apiKey})}),this.program.command(`drop`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).addArgument(new u.Argument(`<connector>`,`Connector identifier in format provider_key@version`)).description(`Drop a connector from the StackOne registry`).action((e,t)=>{n.execute({profile:t.profile,connector:e,apiUrl:t.apiUrl,apiKey:t.apiKey})}),this.program.command(`get`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`--connector <connector>`,`Connector identifier in format provider_key@version`).option(`--account-id <account-id>`,`Account ID to fetch connector from`).option(`-f, --format <format>`,`Output format: yaml or json (default: yaml)`,`yaml`).option(`-o, --output-file <output-file>`,`File to write the output to`).description(`Get a connector from the StackOne registry`).action(e=>{r.execute({profile:e.profile,connector:e.connector,accountId:e.accountId,format:e.format,outputFile:e.outputFile,apiUrl:e.apiUrl,apiKey:e.apiKey})}),this.program.command(`validate`).option(`-w, --watch`,`Run in watch mode`).addArgument(new u.Argument(`<path>`,`Connector file or directory with connectors to validate`)).description(`Validate a StackOne connector`).action((e,t)=>{i.execute({watchMode:t.watch,fileOrDir:e})}),this.program.command(`run`).option(`--connector <connector>`,`Connector file to run (optional when using --account-id)`).option(`--action <action>`,`Action to execute on the connector (path to file or inline string action code)`).option(`--action-id <action-id>`,`Action ID to execute on the connector`).option(`--account <account>`,`Account details to use for running the connector (path to file or inline string account data)`).option(`--account-id <account-id>`,`Account ID to use for running the connector against (fetches connector from API if --connector not provided)`).option(`--params <params>`,`Action parameters (path to file or inline string with JSON parameters)`).option(`--credentials <credentials>`,`Credentials to use (path to file or inline string with JSON credentials)`).option(`-p, --profile <label>`,`Configuration profile to use`).option(`--api-url <api url>`,`API URL`).option(`--api-key <api key>`,`API Key`).option(`-o, --output-file <output-file>`,`File to write the output to`).option(`-d, --debug`,`Enables debug mode to include more details in the action execution output`).description(`Run a connector action`).action(e=>{c.execute({connector:e.connector,action:e.action,actionId:e.actionId,account:e.account,accountId:e.accountId,params:e.params,credentials:e.credentials,profile:e.profile,outputFile:e.outputFile,debug:e.debug,apiUrl:e.apiUrl,apiKey:e.apiKey})});let f=this.program.command(`agent`).description(`StackOne agent commands`);f.command(`setup`).option(`-g, --global`,`Setup global configuration`).option(`-l, --local`,`Setup local project configuration`).description(`Setup StackOne agent (global or local)`).action(e=>{e.global?a.execute():o.execute()}),f.command(`cleanup`).description(`Remove all API keys and credentials from configurations`).action(()=>{s.execute()}),this.program.command(`update`).option(`-f, --force`,`Force reinstall even if already on latest version`).description(`Update the CLI to the latest version`).action(e=>{d.execute({force:e.force})}),this.program.command(`version`).description(`Show version information`).action(async()=>{console.info(`${l.default.greenBright(`StackOne`)} ${l.default.grey(`CLI`)} ${l.default.whiteBright(this.version)}`),Kg(!0),process.exit(0)})}run(){process.argv.includes(`version`)||Kg(),this.program.parse(process.argv)}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return $g}});
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./cliCore-C1-E6aOI.cjs`);exports.CLI=e.t;
1
+ const e=require(`./cliCore-CbruuiwN.cjs`);exports.CLI=e.t;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./cliCore-BmfsQBm6.mjs";export{e as CLI};
1
+ import{t as e}from"./cliCore-C9tEBCF2.mjs";export{e as CLI};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/cli",
3
- "version": "1.13.5",
3
+ "version": "1.13.7",
4
4
  "description": "StackOne Connect CLI tool",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -68,7 +68,7 @@
68
68
  "rimraf": "6.1.2",
69
69
  "ts-node": "10.9.2",
70
70
  "tsconfig-paths": "4.2.0",
71
- "tsdown": "0.17.2",
71
+ "tsdown": "0.17.3",
72
72
  "tslib": "2.8.1",
73
73
  "typescript": "5.9.3",
74
74
  "unplugin-swc": "1.5.9",