@tigrisdata/cli 2.14.0-beta.1 → 2.14.0

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.
Files changed (77) hide show
  1. package/dist/auth/s3-client.js +1 -1
  2. package/dist/chunk-2JHVFROL.js +2 -0
  3. package/dist/chunk-3B5GQHGD.js +8 -0
  4. package/dist/chunk-DV3LCXRH.js +1 -0
  5. package/dist/{chunk-UKNEQJZX.js → chunk-GHJJSJR6.js} +1 -1
  6. package/dist/chunk-IFEXFA2T.js +1 -0
  7. package/dist/chunk-LQ4BU234.js +4 -0
  8. package/dist/chunk-RJGUZ3B2.js +7 -0
  9. package/dist/chunk-SW6SNHOL.js +4 -0
  10. package/dist/cli-core.js +1 -1
  11. package/dist/cli.js +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/lib/access-keys/assign.js +3 -2
  14. package/dist/lib/access-keys/create.js +3 -2
  15. package/dist/lib/access-keys/delete.js +3 -2
  16. package/dist/lib/access-keys/get.js +3 -2
  17. package/dist/lib/access-keys/list.js +3 -2
  18. package/dist/lib/buckets/create.js +1 -1
  19. package/dist/lib/buckets/delete.js +1 -1
  20. package/dist/lib/buckets/get.js +1 -1
  21. package/dist/lib/buckets/list.js +1 -1
  22. package/dist/lib/buckets/set-cors.js +1 -1
  23. package/dist/lib/buckets/set-locations.js +1 -1
  24. package/dist/lib/buckets/set-migration.js +1 -1
  25. package/dist/lib/buckets/set-notifications.js +1 -1
  26. package/dist/lib/buckets/set-transition.js +1 -1
  27. package/dist/lib/buckets/set-ttl.js +1 -1
  28. package/dist/lib/buckets/set.js +1 -1
  29. package/dist/lib/configure/index.js +1 -1
  30. package/dist/lib/cp.js +1 -1
  31. package/dist/lib/credentials/test.js +1 -1
  32. package/dist/lib/forks/create.js +1 -1
  33. package/dist/lib/forks/list.js +1 -1
  34. package/dist/lib/iam/policies/create.js +3 -2
  35. package/dist/lib/iam/policies/delete.js +3 -2
  36. package/dist/lib/iam/policies/edit.js +3 -2
  37. package/dist/lib/iam/policies/get.js +3 -2
  38. package/dist/lib/iam/policies/list.js +3 -2
  39. package/dist/lib/iam/users/invite.js +4 -3
  40. package/dist/lib/iam/users/list.js +8 -7
  41. package/dist/lib/iam/users/remove.js +4 -3
  42. package/dist/lib/iam/users/revoke-invitation.js +4 -3
  43. package/dist/lib/iam/users/update-role.js +4 -3
  44. package/dist/lib/login/credentials.js +1 -1
  45. package/dist/lib/login/oauth.js +1 -1
  46. package/dist/lib/login/select.js +1 -1
  47. package/dist/lib/logout.js +1 -1
  48. package/dist/lib/ls.js +1 -1
  49. package/dist/lib/mk.js +1 -1
  50. package/dist/lib/mv.js +1 -1
  51. package/dist/lib/objects/delete.js +1 -1
  52. package/dist/lib/objects/get.js +1 -1
  53. package/dist/lib/objects/list.js +1 -1
  54. package/dist/lib/objects/put.js +1 -1
  55. package/dist/lib/objects/set.js +1 -1
  56. package/dist/lib/organizations/create.js +3 -3
  57. package/dist/lib/organizations/list.js +2 -2
  58. package/dist/lib/organizations/select.js +4 -4
  59. package/dist/lib/presign.js +1 -1
  60. package/dist/lib/rm.js +1 -1
  61. package/dist/lib/snapshots/list.js +1 -1
  62. package/dist/lib/snapshots/take.js +1 -1
  63. package/dist/lib/stat.js +1 -1
  64. package/dist/lib/touch.js +1 -1
  65. package/dist/lib/whoami.js +2 -2
  66. package/dist/specs.yaml +41 -0
  67. package/dist/utils/errors.js +1 -0
  68. package/dist/utils/exit.js +1 -0
  69. package/dist/utils/messages.js +1 -1
  70. package/dist/utils/update-check.js +1 -1
  71. package/package.json +1 -1
  72. package/dist/chunk-2F6KRYMD.js +0 -4
  73. package/dist/chunk-2HWTMFLS.js +0 -8
  74. package/dist/chunk-CQDWZKYG.js +0 -2
  75. package/dist/chunk-PUTZ24A6.js +0 -1
  76. package/dist/chunk-S7W2ICW6.js +0 -9
  77. /package/dist/{chunk-BQX7MWWL.js → chunk-SAPK5MRQ.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as m}from"../chunk-JRALYIRA.js";import{b as y}from"../chunk-BQX7MWWL.js";import{c as g,e as f,h as O}from"../chunk-CQDWZKYG.js";import"../chunk-BETAO4PB.js";import{b as j}from"../chunk-E4MLGABW.js";import{g as z,k as w,s as $}from"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{listOrganizations as S}from"@tigrisdata/iam";var a=O("whoami");async function k(h={}){try{let C=m(h,["json"])?"json":m(h,["format","f","F"],"table"),c=$(),p=w(),l,d;if(c==="oauth"){let t=j();if(!await t.isAuthenticated()){f(a);return}let s=await t.getIdTokenClaims();l=s.email,d=s.sub}else if(p)l=void 0,d=p.accessKeyId;else{f(a);return}let e=[];e.push(""),e.push("User Information:"),e.push(` Email: ${l||"N/A"}`),e.push(` User ID: ${d||"N/A"}`);let n=[],o;if(c==="oauth"){let t=await y();o=z();let{data:i,error:s}=await S({config:t});if(s&&(g(a,s.message),process.exit(1)),n=i?.organizations??[],n.length>0){if(e.push(""),e.push(`Organizations (${n.length}):`),n.forEach(r=>{let I=r.id===o?">":" ";e.push(` ${I} ${r.name} (${r.id})`)}),o){let r=n.find(A=>A.id===o);r&&(e.push(""),e.push(`Active: ${r.name}`))}}else e.push(""),e.push("Organizations: None")}else e.push(""),e.push("Login method: Access Key Credentials"),e.push(" (Organization listing requires OAuth login: tigris login)");if(C==="json"){let t={email:l,userId:d,loginMethod:c};if(c==="oauth"&&(t.organizations=n.map(i=>({id:i.id,name:i.name})),o)){let i=n.find(s=>s.id===o);i&&(t.activeOrganization=i.name)}console.log(JSON.stringify(t));return}e.push(""),console.log(e.join(`
2
- `))}catch(u){u instanceof Error?g(a,u.message):g(a),process.exit(1)}}export{k as default};
1
+ import{a as h}from"../chunk-JRALYIRA.js";import{b as C}from"../chunk-SAPK5MRQ.js";import{a as m}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import{d as u,f,i as z}from"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";import{b as y}from"../chunk-E4MLGABW.js";import{g as w,k as $,s as j}from"../chunk-DOUR5YEY.js";import"../chunk-KH63ANUX.js";import"../chunk-2XAO2OYD.js";import{listOrganizations as k}from"@tigrisdata/iam";var o=z("whoami");async function E(p={}){try{let I=h(p,["json"])?"json":h(p,["format","f","F"],"table"),l=j(),A=$(),d,g;if(l==="oauth"){let t=y();if(!await t.isAuthenticated()){f(o);return}let n=await t.getIdTokenClaims();d=n.email,g=n.sub}else if(A)d=void 0,g=A.accessKeyId;else{f(o);return}let e=[];e.push(""),e.push("User Information:"),e.push(` Email: ${d||"N/A"}`),e.push(` User ID: ${g||"N/A"}`);let s=[],r;if(l==="oauth"){let t=await C();r=w();let{data:i,error:n}=await k({config:t});if(n&&(u(o,n.message),m(n,o)),s=i?.organizations??[],s.length>0){if(e.push(""),e.push(`Organizations (${s.length}):`),s.forEach(a=>{let S=a.id===r?">":" ";e.push(` ${S} ${a.name} (${a.id})`)}),r){let a=s.find(O=>O.id===r);a&&(e.push(""),e.push(`Active: ${a.name}`))}}else e.push(""),e.push("Organizations: None")}else e.push(""),e.push("Login method: Access Key Credentials"),e.push(" (Organization listing requires OAuth login: tigris login)");if(I==="json"){let t={email:d,userId:g,loginMethod:l};if(l==="oauth"&&(t.organizations=s.map(i=>({id:i.id,name:i.name})),r)){let i=s.find(n=>n.id===r);i&&(t.activeOrganization=i.name)}console.log(JSON.stringify(t));return}e.push(""),console.log(e.join(`
2
+ `))}catch(c){c instanceof Error?u(o,c.message):u(o),m(c,o)}}export{E as default};
package/dist/specs.yaml CHANGED
@@ -101,6 +101,11 @@ commands:
101
101
  onStart: 'Saving credentials...'
102
102
  onSuccess: 'Credentials saved to ~/.tigris/config.json. You can now use all tigris commands.'
103
103
  onFailure: 'Failed to save credentials'
104
+ nextActions:
105
+ - command: 'tigris credentials test'
106
+ description: 'Verify your credentials are working'
107
+ - command: 'tigris ls'
108
+ description: 'List your buckets'
104
109
  arguments:
105
110
  - name: access-key
106
111
  description: Your Tigris access key ID
@@ -156,6 +161,11 @@ commands:
156
161
  onFailure: 'Authentication failed'
157
162
  onAlreadyDone: "Already logged in.\nRun \"tigris logout\" first to switch accounts."
158
163
  hint: "You have {{count}} organizations.\nRun \"tigris orgs list\" to switch."
164
+ nextActions:
165
+ - command: 'tigris orgs list'
166
+ description: 'List and switch organizations'
167
+ - command: 'tigris ls'
168
+ description: 'List your buckets'
159
169
  # credentials
160
170
  - name: credentials
161
171
  description: Login with an access key and secret. Creates a temporary session that is cleared on logout
@@ -167,6 +177,9 @@ commands:
167
177
  onStart: 'Authenticating...'
168
178
  onSuccess: 'Logged in with credentials'
169
179
  onFailure: 'Authentication failed'
180
+ nextActions:
181
+ - command: 'tigris ls'
182
+ description: 'List your buckets'
170
183
  arguments:
171
184
  - name: access-key
172
185
  description: Your access key ID (will prompt if not provided)
@@ -615,6 +628,9 @@ commands:
615
628
  onSuccess: "Organization '{{name}}' created successfully\nOrganization ID: {{id}}"
616
629
  onFailure: 'Failed to create organization'
617
630
  hint: "Next steps:\n - Select this organization: tigris orgs select {{name}}"
631
+ nextActions:
632
+ - command: 'tigris orgs select {{name}}'
633
+ description: 'Select this organization as active'
618
634
  arguments:
619
635
  - name: name
620
636
  type: positional
@@ -631,6 +647,11 @@ commands:
631
647
  onStart: ''
632
648
  onSuccess: "Organization '{{name}}' selected"
633
649
  onFailure: 'Failed to select organization'
650
+ nextActions:
651
+ - command: 'tigris ls'
652
+ description: 'List your buckets'
653
+ - command: 'tigris buckets create <name>'
654
+ description: 'Create a new bucket'
634
655
  arguments:
635
656
  - name: name
636
657
  type: positional
@@ -689,6 +710,11 @@ commands:
689
710
  onStart: 'Creating bucket...'
690
711
  onSuccess: "Bucket '{{name}}' created successfully"
691
712
  onFailure: 'Failed to create bucket'
713
+ nextActions:
714
+ - command: 'tigris access-keys create <name>'
715
+ description: 'Create an access key for programmatic access'
716
+ - command: 'tigris cp ./file t3://{{name}}/'
717
+ description: 'Upload files to the new bucket'
692
718
  arguments:
693
719
  - name: name
694
720
  description: Name of the bucket
@@ -779,6 +805,9 @@ commands:
779
805
  onStart: 'Deleting bucket...'
780
806
  onSuccess: "Bucket '{{name}}' deleted successfully"
781
807
  onFailure: "Failed to delete bucket '{{name}}'"
808
+ nextActions:
809
+ - command: 'tigris ls'
810
+ description: 'List remaining buckets'
782
811
  arguments:
783
812
  - name: name
784
813
  description: Name of the bucket or comma separated list of buckets
@@ -1289,6 +1318,9 @@ commands:
1289
1318
  onStart: 'Uploading object...'
1290
1319
  onSuccess: "Object '{{key}}' uploaded successfully"
1291
1320
  onFailure: 'Failed to upload object'
1321
+ nextActions:
1322
+ - command: 'tigris presign {{bucket}}/{{key}}'
1323
+ description: 'Generate a presigned URL for the uploaded object'
1292
1324
  arguments:
1293
1325
  - name: bucket
1294
1326
  description: Name of the bucket
@@ -1334,6 +1366,9 @@ commands:
1334
1366
  onStart: 'Deleting object...'
1335
1367
  onSuccess: "Object '{{key}}' deleted successfully"
1336
1368
  onFailure: 'Failed to delete object'
1369
+ nextActions:
1370
+ - command: 'tigris ls {{bucket}}'
1371
+ description: 'List remaining objects in the bucket'
1337
1372
  arguments:
1338
1373
  - name: bucket
1339
1374
  description: Name of the bucket
@@ -1435,6 +1470,9 @@ commands:
1435
1470
  onStart: 'Creating access key...'
1436
1471
  onSuccess: 'Access key created'
1437
1472
  onFailure: 'Failed to create access key'
1473
+ nextActions:
1474
+ - command: 'tigris access-keys assign {{id}} --bucket <bucket> --role Editor'
1475
+ description: 'Assign bucket roles to the new access key'
1438
1476
  arguments:
1439
1477
  - name: name
1440
1478
  description: Name for the access key
@@ -1513,6 +1551,9 @@ commands:
1513
1551
  onStart: 'Assigning bucket roles...'
1514
1552
  onSuccess: 'Bucket roles assigned'
1515
1553
  onFailure: 'Failed to assign bucket roles'
1554
+ nextActions:
1555
+ - command: 'tigris cp ./file t3://<bucket>/'
1556
+ description: 'Upload files using the assigned access key'
1516
1557
  arguments:
1517
1558
  - name: id
1518
1559
  description: Access key ID
@@ -0,0 +1 @@
1
+ import{a,b}from"../chunk-DV3LCXRH.js";export{a as ExitCode,b as classifyError};
@@ -0,0 +1 @@
1
+ import{a,b,c}from"../chunk-LQ4BU234.js";import"../chunk-DV3LCXRH.js";import"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";export{a as exitWithError,b as getSuccessNextActions,c as printNextActions};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h}from"../chunk-CQDWZKYG.js";import"../chunk-BETAO4PB.js";export{h as msg,e as printAlreadyDone,g as printDeprecated,d as printEmpty,c as printFailure,f as printHint,a as printStart,b as printSuccess};
1
+ import{a,b,c,d,e,f,g,h,i}from"../chunk-2JHVFROL.js";import"../chunk-BETAO4PB.js";export{a as interpolate,i as msg,f as printAlreadyDone,h as printDeprecated,e as printEmpty,d as printFailure,g as printHint,b as printStart,c as printSuccess};
@@ -1 +1 @@
1
- import{b as a,c as b}from"../chunk-2HWTMFLS.js";import"../chunk-2XAO2OYD.js";export{b as checkForUpdates,a as isNewerVersion};
1
+ import{b as a,c as b}from"../chunk-3B5GQHGD.js";import"../chunk-2XAO2OYD.js";export{b as checkForUpdates,a as isNewerVersion};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigrisdata/cli",
3
- "version": "2.14.0-beta.1",
3
+ "version": "2.14.0",
4
4
  "description": "Command line interface for Tigris object storage",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,4 +0,0 @@
1
- import{a as r,b as e,c as a,e as s,f as c,h as g}from"./chunk-CQDWZKYG.js";import{b as u}from"./chunk-E4MLGABW.js";import{f as l}from"./chunk-DOUR5YEY.js";var t=g("login","oauth");async function f(){r(t);try{let i=u();if(await i.isAuthenticated()){s(t);return}await i.login({onDeviceCode:(o,p)=>{console.log(`
2
- Your confirmation code: ${o}
3
- `),console.log(`If browser doesn't open, visit: ${p}`)},onWaiting:()=>console.log(`
4
- Waiting for authentication...`)});let n=await i.getOrganizations();if(n.length>0){let o=n[0];await l(o.id),e(t,{org:o.displayName||o.name}),n.length>1&&c(t,{count:n.length})}else e(t,{org:"none"})}catch{a(t),process.exit(1)}}var A=f;export{f as a,A as b};
@@ -1,8 +0,0 @@
1
- import{d as m,e as d,f}from"./chunk-2XAO2OYD.js";import{readFileSync as I,writeFileSync as T,mkdirSync as N}from"fs";import{join as g}from"path";import{homedir as h}from"os";import j from"https";var u="2.14.0-beta.1";var b=g(h(),".tigris","update-check.json");function y(){try{let t=I(b,"utf-8"),i=JSON.parse(t);return typeof i.latestVersion=="string"&&typeof i.lastChecked=="number"?i:null}catch{return null}}function v(t){try{N(g(h(),".tigris"),{recursive:!0}),T(b,JSON.stringify(t),"utf-8")}catch{}}function E(t,i){let a=o=>{let r=o.startsWith("v")?o.slice(1):o,c=null,l=r.indexOf("-");l!==-1&&(c=r.slice(l+1),r=r.slice(0,l));let p=r.split(".");if(p.length!==3)return null;let n=p.map(Number);return n.some(isNaN)?null:{major:n[0],minor:n[1],patch:n[2],prerelease:c}},e=a(t),s=a(i);return!e||!s?!1:s.major>e.major?!0:s.major<e.major?!1:s.minor>e.minor?!0:s.minor<e.minor?!1:s.patch>e.patch?!0:s.patch<e.patch?!1:e.prerelease&&!s.prerelease?!0:(!e.prerelease&&s.prerelease,!1)}function w(){try{let t=j.get(m,{timeout:5e3},i=>{let a="";i.on("data",e=>{a+=e}),i.on("end",()=>{try{let e=JSON.parse(a);if(typeof e.version=="string"){let s=y();v({...s,latestVersion:e.version,lastChecked:Date.now()})}}catch{}})});t.on("error",()=>{}),t.on("timeout",()=>{t.destroy()}),t.end(),t.on("socket",i=>{i.unref()})}catch{}}function V(){if(process.env.TIGRIS_NO_UPDATE_CHECK==="1"||!process.stdout.isTTY)return;let t=y(),i=Number(process.env.TIGRIS_UPDATE_NOTIFY_INTERVAL_MS)||216e5;if(t&&E(u,t.latestVersion)&&(!t.lastNotified||Date.now()-t.lastNotified>i)){let e=globalThis.__TIGRIS_BINARY===!0,s=process.platform==="win32",o=`Update available: ${u} \u2192 ${t.latestVersion}`,r;e?s?r="Run `irm https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.ps1 | iex`":r="Run `curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install.sh | sh`":r="Run `npm install -g @tigrisdata/cli` to upgrade.";let c=Math.max(o.length,r.length)+4,l="\u250C"+"\u2500".repeat(c-2)+"\u2510",p="\u2514"+"\u2500".repeat(c-2)+"\u2518",n=_=>"\u2502 "+_.padEnd(c-4)+" \u2502";console.log(`
2
- ${l}
3
- ${n("")}
4
- ${n(o)}
5
- ${n(r)}
6
- ${n("")}
7
- ${p}
8
- `),v({...t,lastNotified:Date.now()})}let a=Number(process.env.TIGRIS_UPDATE_CHECK_INTERVAL_MS)||864e5;(!t||Date.now()-t.lastChecked>a)&&w()}export{u as a,E as b,V as c};
@@ -1,2 +0,0 @@
1
- import{c as u}from"./chunk-BETAO4PB.js";var a={success:"\u2714",failure:"\u2716",hint:"\u2192"};function t(){return process.stdout.isTTY===!0}function o(s){let n=u(s.command,s.operation);if(n)return n.messages}function r(s,n){let e=s;return e=e.replace(/\\n/g,`
2
- `),n&&(e=e.replace(/\{\{(\w+)\}\}/g,(i,c)=>{let g=n[c];return g!==void 0?String(g):`{{${c}}}`})),e}function l(s,n){if(!t())return;let e=o(s);e?.onStart&&console.log(r(e.onStart,n))}function f(s,n){if(!t())return;let e=o(s);e?.onSuccess&&console.log(`${a.success} ${r(e.onSuccess,n)}`)}function d(s,n,e){let i=o(s);i?.onFailure&&console.error(`${a.failure} ${r(i.onFailure,e)}`),n&&console.error(` ${n}`)}function m(s,n){if(!t())return;let e=o(s);e?.onEmpty&&console.log(r(e.onEmpty,n))}function M(s,n){if(!t())return;let e=o(s);e?.onAlreadyDone&&console.log(r(e.onAlreadyDone,n))}function x(s,n){if(!t())return;let e=o(s);e?.hint&&console.log(`${a.hint} ${r(e.hint,n)}`)}function C(s){t()&&console.warn(`\u26A0 Deprecated: ${s}`)}function S(s,n){return{command:s,operation:n}}export{l as a,f as b,d as c,m as d,M as e,x as f,C as g,S as h};
@@ -1 +0,0 @@
1
- import{a as g}from"./chunk-S77OAN6Y.js";import{a as i,b as n,c as d,h as o}from"./chunk-CQDWZKYG.js";import{m as u,o as m,r as f}from"./chunk-DOUR5YEY.js";import{a as y}from"./chunk-2XAO2OYD.js";import S from"enquirer";var{prompt:l}=S,t=o("login","credentials");async function K(e){i(t);let s=e["access-key"]||e.accessKey||e.key||e.Key||e.accesskey,c=e["access-secret"]||e.accessSecret||e.secret||e.Secret||e.accesssecret;if(!s||!c){let r=[];s||r.push({type:"input",name:"accessKey",message:"Access Key ID:",required:!0}),c||r.push({type:"password",name:"accessSecret",message:"Secret Access Key:",required:!0}),g("Provide --access-key and --access-secret");let a=await l(r);s=s||a.accessKey,c=c||a.accessSecret}(!s||!c)&&(d(t,"Access key and secret are required"),process.exit(1));let p=u()?.endpoint||y;await m({accessKeyId:s,secretAccessKey:c,endpoint:p}),await f("credentials"),n(t)}export{K as a};
@@ -1,9 +0,0 @@
1
- import{g}from"./chunk-CQDWZKYG.js";import{Command as v}from"commander";function j(){process.on("unhandledRejection",e=>{(e===""||e===void 0)&&(console.error(`
2
- Operation cancelled`),process.exit(1)),console.error(`
3
- Error:`,e instanceof Error?e.message:e),process.exit(1)}),process.on("uncaughtException",e=>{console.error(`
4
- Error:`,e.message),process.exit(1)})}function b(e){return/^[a-zA-Z0-9_-]+$/.test(e)}function q(e){let t;e.type==="positional"?t=` ${e.name}`:(t=` --${e.name}`,e.alias&&typeof e.alias=="string"&&(t+=e.alias.length===1?`, -${e.alias}`:`, --${e.alias}`));let n=26,r=t.length>=n?t+" ":t.padEnd(n),o=e.description;return e.options&&(Array.isArray(e.options)&&typeof e.options[0]=="string"?o+=` (options: ${e.options.join(", ")})`:o+=` (options: ${e.options.map(a=>a.value).join(", ")})`),e.default&&(o+=` [default: ${e.default}]`),e.required&&(o+=" [required]"),e["required-when"]&&(o+=` [required when: ${e["required-when"]}]`),e.multiple&&(o+=" [multiple values: comma-separated]"),e.type==="positional"&&(o+=" [positional argument]"),e.examples&&e.examples.length>0&&(o+=` (examples: ${e.examples.join(", ")})`),`${r}${o}`}function f(e,t,n){return n(t)?!0:e.commands?e.commands.some(r=>f(r,[...t,r.name],n)):!1}function x(e,t,n,r){let o=n.join(" ");if(console.log(`
5
- ${e.name} ${o} - ${t.description}
6
- `),t.commands&&t.commands.length>0){let a=t.commands.filter(i=>f(i,[...n,i.name],r));a.length>0&&(console.log("Commands:"),a.forEach(i=>{let s=` ${i.name}`;if(i.alias){let l=Array.isArray(i.alias)?i.alias:[i.alias];s+=` (${l.join(", ")})`}let p=s.padEnd(24);console.log(`${p}${i.description}`)}),console.log())}t.arguments&&t.arguments.length>0&&(console.log("Arguments:"),t.arguments.forEach(a=>{console.log(q(a))}),console.log()),t.examples&&t.examples.length>0&&(console.log("Examples:"),t.examples.forEach(a=>{console.log(` ${a}`)}),console.log()),t.commands&&t.commands.length>0&&console.log(`Use "${e.name} ${o} <command> help" for more information about a command.`)}function A(e,t,n){console.log(`Tigris CLI Version: ${t}
7
- `),console.log(`Usage: tigris [command] [options]
8
- `),console.log("Commands:"),e.commands.filter(o=>f(o,[o.name],n)).forEach(o=>{let a=` ${o.name}`;if(o.alias){let s=Array.isArray(o.alias)?o.alias:[o.alias];a+=` (${s.join(", ")})`}let i=a.padEnd(24);console.log(`${i}${o.description}`)}),console.log(`
9
- Use "${e.name} <command> help" for more information about a command.`)}function C(e,t=[]){t.forEach(n=>{if(n.type==="positional"){let r=n.required?`<${n.name}>`:`[${n.name}]`;e.argument(r,n.description)}else{let r=n.alias&&typeof n.alias=="string"&&n.alias.length===1,o=n.alias&&typeof n.alias=="string"&&n.alias.length>1,a=r?`-${n.alias}, --${n.name}`:o?`--${n.alias}, --${n.name}`:`--${n.name}`;n.type==="flag"||(n.type==="boolean"?a+=" [value]":n.options?a+=" <value>":a+=n.required||n["required-when"]?" <value>":" [value]"),e.option(a,n.description,n.default)}})}function S(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function $(e,t,n){if(n){let o=n.find(a=>a.name===t);if(o&&o.alias&&typeof o.alias=="string"){let a=o.alias.charAt(0).toUpperCase()+o.alias.slice(1);if(e[a]!==void 0)return e[a]}}let r=[t,t.replace(/-/g,""),t.replace(/-/g,"").toLowerCase(),t.charAt(0).toUpperCase(),S(t)];for(let o of r)if(e[o]!==void 0)return e[o]}function w(e,t){for(let n of e){if(n["required-when"]){let[r,o]=n["required-when"].split("="),a=$(t,r,e),i=$(t,n.name,e);if(a===o&&!i)return console.error(`--${n.name} is required when --${r} is ${o}`),!1}if(n.required&&!$(t,n.name,e))return console.error(`--${n.name} is required`),!1}return!0}function u(e,t,n){let r;"optsWithGlobals"in n&&typeof n.optsWithGlobals=="function"?r=n.optsWithGlobals():"opts"in n&&typeof n.opts=="function"?r=n.opts():r=n;let o={...r};return e.filter(i=>i.type==="positional").forEach((i,s)=>{t[s]!==void 0&&(i.multiple?o[i.name]=t[s].split(",").map(p=>p.trim()):o[i.name]=t[s])}),e.forEach(i=>{i.multiple&&i.type!=="positional"&&o[i.name]&&typeof o[i.name]=="string"&&(o[i.name]=o[i.name].split(",").map(s=>s.trim()))}),o}async function E(e,t,n=[],r={}){let{module:o,error:a}=await e(t);(a||!o)&&(console.error(a),process.exit(1));let i=t[t.length-1],s=o.default||o[i];typeof s!="function"&&(console.error(`Command not implemented: ${t.join(" ")}`),process.exit(1)),await s({...r,_positional:n})}function k(e,t,n,r=[]){let{specs:o,loadModule:a,hasImplementation:i}=e;for(let s of n){b(s.name)||(console.error(`Invalid command name "${s.name}": only alphanumeric, hyphens, and underscores allowed`),process.exit(1));let p=[...r,s.name];if(!f(s,p,i))continue;let l=t.command(s.name).description(s.description);if(s.alias&&(Array.isArray(s.alias)?s.alias:[s.alias]).forEach(c=>l.alias(c)),s.commands&&s.commands.length>0)if(k(e,l,s.commands,p),s.default){let m=s.commands.find(c=>c.name===s.default);if(m){C(l,s.arguments),C(l,m.arguments);let c=[...s.arguments||[],...m.arguments||[]];l.action(async(...d)=>{let y=d.pop(),h=d;c.length>0&&!w(c,u(c,h,y))||(m.deprecated&&m.messages?.onDeprecated&&g(m.messages.onDeprecated),await E(a,[...p,m.name],h,u(c,h,y)))})}}else l.action(()=>{x(o,s,p,i)});else C(l,s.arguments),l.action(async(...m)=>{let c=m.pop(),d=m;s.arguments&&!w(s.arguments,u(s.arguments,d,c))||(s.deprecated&&s.messages?.onDeprecated&&g(s.messages.onDeprecated),await E(a,p,d,u(s.arguments||[],d,c)))});l.command("help").description("Show help for this command").action(()=>{x(o,s,p,i)})}}function L(e){let{specs:t,version:n,hasImplementation:r}=e,o=new v;return o.name(t.name).description(t.description).version(n),o.option("-y, --yes","Skip all confirmation prompts"),k(e,o,t.commands),o.command("help").description("Show general help").action(()=>{A(t,n,r)}),o.action(()=>{A(t,n,r)}),o}export{j as a,b,q as c,f as d,x as e,A as f,C as g,w as h,u as i,k as j,L as k};
File without changes