@swirls/cli 0.0.16 → 0.0.17
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/bash-complete.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as o,b as s}from"./chunk-
|
|
2
|
+
import{a as o,b as s}from"./chunk-JDIQSBDJ.js";import{proposeCompletions as r}from"@stricli/core";var t=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&t.push("");await r(o,t,s(process));try{for(let{completion:p}of await r(o,t,s(process)))process.stdout.write(`${p}
|
|
3
3
|
`)}catch{}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildInstallCommand as D,buildUninstallCommand as L}from"@stricli/auto-complete";import{buildApplication as I,buildRouteMap as _}from"@stricli/core";import{buildCommand as r,buildRouteMap as m}from"@stricli/core";var f=r({loader:async()=>{let{login:e}=await import("./implementation-
|
|
1
|
+
import{buildInstallCommand as D,buildUninstallCommand as L}from"@stricli/auto-complete";import{buildApplication as I,buildRouteMap as _}from"@stricli/core";import{buildCommand as r,buildRouteMap as m}from"@stricli/core";var f=r({loader:async()=>{let{login:e}=await import("./implementation-4HV52VC3.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),g=r({loader:async()=>{let{logout:e}=await import("./implementation-4HV52VC3.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),i=m({routes:{login:f,logout:g},docs:{brief:"Auth commands"}});import{buildCommand as a,buildRouteMap as b}from"@stricli/core";var h=a({loader:async()=>{let{generateCode:e}=await import("./generate-code-OKMZDZXA.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Generate application code and types"}}),k=a({loader:async()=>{let{initializeConfig:e}=await import("./initialize-config-DKTZP3W4.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Initialize Swirls configuration file"}}),s=b({routes:{gen:h,init:k},docs:{brief:"Developer commands"}});import{buildCommand as n,buildRouteMap as j}from"@stricli/core";var w=n({loader:async()=>{let{createProject:e}=await import("./create-project-47TMORAD.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),C=n({loader:async()=>{let{openProject:e}=await import("./open-project-7EVLSYKP.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project ID",parse:String,placeholder:"project-id"}]}},docs:{brief:"Open project in browser"}}),p=j({routes:{create:w,open:C},docs:{brief:"Project commands"}});import{buildCommand as t,buildRouteMap as S}from"@stricli/core";var y=t({loader:async()=>{let{list:e}=await import("./list-O3YBIAFJ.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to list (optional)",parse:String,placeholder:"path",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"List files in storage"}}),x=t({loader:async()=>{let{upload:e}=await import("./upload-L5G6SWZJ.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Local file path to upload",parse:String,placeholder:"file"},{brief:"Destination path in storage (optional)",parse:String,placeholder:"dest",optional:!0}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Upload a file to storage"}}),P=t({loader:async()=>{let{download:e}=await import("./download-3FOT4FPQ.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"},{brief:"Local destination path",parse:String,placeholder:"dest"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Download a file from storage"}}),v=t({loader:async()=>{let{deleteFile:e}=await import("./delete-RSC6OYLX.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0}}},docs:{brief:"Delete a file from storage"}}),R=t({loader:async()=>{let{url:e}=await import("./url-LHTDDDUD.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Path to file in storage",parse:String,placeholder:"path"}]},flags:{project:{kind:"parsed",brief:"Project ID (uses config if not specified)",parse:String,optional:!0},expires:{kind:"parsed",brief:"Expiration time in seconds (default: 86400 = 24 hours)",parse:Number,optional:!0}}},docs:{brief:"Get a signed URL for a file"}}),l=S({routes:{list:y,upload:x,download:P,delete:v,url:R},docs:{brief:"Storage commands"}});var c="@swirls/cli",d="0.0.17",u="Swirls command line application";var z=_({routes:{auth:i,dev:s,project:p,storage:l,install:D("cli",{bash:"__cli_bash_complete"}),uninstall:L("cli",{bash:!0})},docs:{brief:u,hideRoute:{install:!0,uninstall:!0}}}),Z=I(z,{name:c,versionInfo:{currentVersion:d}});import M from"fs";import N from"fs/promises";import A from"os";import E from"path";function ae(e){return{fs:M,fsPromise:N,os:A,path:E,process:e}}export{Z as a,ae as b};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r,b as o}from"./chunk-
|
|
2
|
+
import{a as r,b as o}from"./chunk-JDIQSBDJ.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as p}from"./chunk-RJOLKCKW.js";import{a as k,b as v,c as C,d as w,e as b,f as g}from"./chunk-R3TGQKBD.js";import{a as h}from"./chunk-OEQFVEK4.js";import{withResult as n}from"@byteslice/result";import{render as u}from"ink";import R from"http";import{withResult as P}from"@byteslice/result";import*as l from"zod";var A=8765,y=`http://localhost:${A}`,j=l.object({code:l.string(),state:l.string()}),O=`
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
@@ -37,4 +37,4 @@ import{a as g}from"./chunk-RJOLKCKW.js";import{a as k,b as v,c as C,d as w,e as
|
|
|
37
37
|
</div>
|
|
38
38
|
</body>
|
|
39
39
|
</html>
|
|
40
|
-
`;function Y(e){if(!e.url)throw new Error("No URL found in callback response.");let t=new URL(e.url,y);return l.parse(j,Object.fromEntries(t.searchParams.entries()))}function S(e){e.writeHead(400,{"Content-Type":"text/html"}),e.end(_)}function B(e){e.writeHead(200,{"Content-Type":"text/html"}),e.end(O)}function
|
|
40
|
+
`;function Y(e){if(!e.url)throw new Error("No URL found in callback response.");let t=new URL(e.url,y);return l.parse(j,Object.fromEntries(t.searchParams.entries()))}function S(e){e.writeHead(400,{"Content-Type":"text/html"}),e.end(_)}function B(e){e.writeHead(200,{"Content-Type":"text/html"}),e.end(O)}function F(e){return new Promise((t,r)=>{let i=R.createServer(async(a,o)=>{let c=await P(()=>Y(a),f=>f);if(c.failure){S(o),r(c.failure);return}let m=await P(()=>e(c.data),f=>f);if(m.failure){S(o),r(m.failure);return}B(o),i.close(()=>{t()})});i.listen(A)})}import H from"@clerk/clerk-js/headless/index.js";var D=H.Clerk;async function I(e){let t=new D(e);return await t.load({standardBrowser:!1}),t}async function L(e,t){let r=await e.client?.signIn.create({ticket:t,strategy:"ticket"});if(!r||!r.createdSessionId)throw new Error("Failed to sign in.");return{createdSessionId:r.createdSessionId}}import K from"open";function U(e=32){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let i="";for(let a of r)i+=t[a%t.length];return i}function T(e){let t=new URLSearchParams({client_id:e.clientId,redirect_uri:e.redirectUri,response_type:"code",scope:"openid profile email",state:e.state});K(`${e.authorizeUri}?${t}`)}import{Text as M}from"ink";import{jsx as J}from"react/jsx-runtime";function E(e){return J(M,{color:"yellow",children:e.message})}function W(e){return`${k(e)}/project`}async function z(e){let t=W(e);await e.fsPromise.stat(t).then(()=>!0).catch(()=>!1)&&await e.fsPromise.unlink(t)}import{jsx as d}from"react/jsx-runtime";async function $(e,t,r){let i=await n(async()=>await(await g(e)).cli.exchangeToken({code:r.code}),s=>new Error("Failed to exchange callback code for token",{cause:s.message}));if(i.failure)throw i.failure;await w(e,i.data.idToken,"","");let a=await n(async()=>await(await g(e)).cli.createSignInTicket(),s=>new Error("Failed to exchange ID token code for a sign-in ticket",{cause:s.message}));if(a.failure)throw a.failure;let o=await I(t.clerkPublishableKey),c=await n(()=>L(o,a.data.token),s=>new Error("Failed to create a new sign-in for this device",{cause:s.message}));if(c.failure)throw c.failure;let m=await n(async()=>await(await g(e)).cli.createJwt({sessionId:c.data.createdSessionId}),s=>new Error("Failed to create a session JWT",{cause:s.message}));if(m.failure)throw m.failure;let f=await n(()=>w(e,i.data.idToken,m.data,c.data.createdSessionId),s=>new Error("Failed to save your credentials to disk",{cause:s.message}));if(f.failure)throw f.failure}async function ye(){let e=await g(this),t=U(),r=await n(()=>e.cli.getConfig(),a=>new Error("Failed to retrieve authentication configuration",{cause:a.message}));r.failure&&(u(d(h,{message:r.failure.message})),process.exit(1)),T({authorizeUri:b.OAUTH_AUTHORIZE_URL,clientId:r.data.clientId,redirectUri:y,state:t});let i=await n(()=>F(async a=>{if(a.state!==t)throw new Error("Invalid state.");await $(this,r.data,a)}),a=>a);i.failure&&(u(d(h,{message:i.failure.message})),process.exit(1)),u(d(p,{message:"Success! You are now logged in."}))}async function xe(){let e=await n(()=>C(this),o=>o);e.failure&&(u(d(h,{message:"There was an issue reading your credentials. You are probably already logged out."})),process.exit(1));let t=await g(this),r=await n(()=>t.cli.getConfig(),o=>new Error("Failed to retrieve authentication configuration",{cause:o.message}));r.failure&&(u(d(h,{message:r.failure.message})),process.exit(1)),(await n(async()=>t.cli.revokeSession({sessionId:e.data.sessionId}),o=>o)).failure&&u(d(E,{message:"There was an issue revoking your session. You are probably already logged out. Purging credentials file..."}));let a=await n(async()=>{await v(this),await z(this)},o=>o);if(a.failure)throw a.failure;u(d(p,{message:"Success! You are now logged out."}))}export{ye as login,xe as logout};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swirls/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Swirls command line application",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Swirls",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@orpc/contract": "1.12.2",
|
|
32
32
|
"@stricli/auto-complete": "1.2.4",
|
|
33
33
|
"@stricli/core": "1.2.4",
|
|
34
|
-
"@swirls/sdk": "0.0.
|
|
34
|
+
"@swirls/sdk": "0.0.4",
|
|
35
35
|
"ink": "6.4.0",
|
|
36
36
|
"ink-select-input": "6.2.0",
|
|
37
37
|
"ink-spinner": "5.0.0",
|