@swirls/cli 0.0.9 → 0.0.11
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 +1 -1
- package/dist/{chunk-LIZAQE7K.js → chunk-R3TGQKBD.js} +1 -1
- package/dist/{chunk-SIE25EU6.js → chunk-ZXQO53AU.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{create-project-ELA4VHQG.js → create-project-2CO4VDK2.js} +1 -1
- package/dist/{generate-code-2LPT3ZI6.js → generate-code-M57HI5UQ.js} +1 -1
- package/dist/{implementation-QPK3NH6Y.js → implementation-LPXYQAMF.js} +1 -1
- package/package.json +4 -3
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-ZXQO53AU.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*as o from"zod";async function l(t,r){await t.fsPromise.stat(r).then(()=>!0).catch(()=>!1)||await t.fsPromise.mkdir(r,{recursive:!0})}function a(t){if(!t.path)throw new Error("No `path` found in context.");if(!t.os)throw new Error("No `os` found in context.");let r=t.os.homedir();return t.path.join(r,".swirls")}var d=o.object({idToken:o.string(),jwt:o.string(),sessionId:o.string()});function c(t){return`${a(t)}/credentials`}async function R(t){let r=c(t);await t.fsPromise.stat(r).then(()=>!0).catch(()=>!1)&&await t.fsPromise.unlink(r)}async function f(t){let r=c(t),n=await t.fsPromise.readFile(r,"utf8");return o.parse(d,JSON.parse(n))}async function U(t,r,n,e){let s=c(t);await l(t,a(t)),await t.fsPromise.writeFile(s,JSON.stringify({idToken:r,jwt:n,sessionId:e}))}import*as i from"zod";var w=i.object({API_URL:i.string(),OAUTH_AUTHORIZE_URL:i.string()}),C={API_URL:"https://api.swirls.
|
|
1
|
+
import*as o from"zod";async function l(t,r){await t.fsPromise.stat(r).then(()=>!0).catch(()=>!1)||await t.fsPromise.mkdir(r,{recursive:!0})}function a(t){if(!t.path)throw new Error("No `path` found in context.");if(!t.os)throw new Error("No `os` found in context.");let r=t.os.homedir();return t.path.join(r,".swirls")}var d=o.object({idToken:o.string(),jwt:o.string(),sessionId:o.string()});function c(t){return`${a(t)}/credentials`}async function R(t){let r=c(t);await t.fsPromise.stat(r).then(()=>!0).catch(()=>!1)&&await t.fsPromise.unlink(r)}async function f(t){let r=c(t),n=await t.fsPromise.readFile(r,"utf8");return o.parse(d,JSON.parse(n))}async function U(t,r,n,e){let s=c(t);await l(t,a(t)),await t.fsPromise.writeFile(s,JSON.stringify({idToken:r,jwt:n,sessionId:e}))}import*as i from"zod";var w=i.object({API_URL:i.string(),OAUTH_AUTHORIZE_URL:i.string()}),C={API_URL:"https://api.swirls.ai",OAUTH_AUTHORIZE_URL:"https://clerk.swirls.ai/oauth/authorize"},m=i.parse(w,C);import{withResult as h}from"@byteslice/result";import{createORPCClient as x,onError as y}from"@orpc/client";import{RPCLink as L}from"@orpc/client/fetch";async function I(t){let r=new L({url:`${m.API_URL}/rpc`,headers:async()=>{let e=await h(()=>f(t),u=>new Error("Failed to read credentials file",{cause:u.message}));if(e.failure)return{};let{idToken:s,jwt:p}=e.data;return{Authorization:`Bearer ${p||s}`}},interceptors:[y(e=>{e instanceof Error&&e.name==="AbortError"||console.error(e)})]});return x(r)}export{a,R as b,f as c,U as d,m as e,I as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildInstallCommand as y,buildUninstallCommand as v}from"@stricli/auto-complete";import{buildApplication as w,buildRouteMap as x}from"@stricli/core";import{buildCommand as o,buildRouteMap as p}from"@stricli/core";var
|
|
1
|
+
import{buildInstallCommand as y,buildUninstallCommand as v}from"@stricli/auto-complete";import{buildApplication as w,buildRouteMap as x}from"@stricli/core";import{buildCommand as o,buildRouteMap as p}from"@stricli/core";var u=o({loader:async()=>{let{login:e}=await import("./implementation-LPXYQAMF.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),m=o({loader:async()=>{let{logout:e}=await import("./implementation-LPXYQAMF.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),i=p({routes:{login:u,logout:m},docs:{brief:"Auth commands"}});import{buildCommand as r,buildRouteMap as d}from"@stricli/core";var f=r({loader:async()=>{let{generateCode:e}=await import("./generate-code-M57HI5UQ.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Generate application code and types"}}),b=r({loader:async()=>{let{initializeConfig:e}=await import("./initialize-config-CQ27WZUI.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Initialize Swirls configuration file"}}),s=d({routes:{gen:f,init:b},docs:{brief:"Developer commands"}});import{buildCommand as g,buildRouteMap as h}from"@stricli/core";var C=g({loader:async()=>{let{createProject:e}=await import("./create-project-2CO4VDK2.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),n=h({routes:{create:C},docs:{brief:"Project commands"}});var a="@swirls/cli",c="0.0.11",l="Swirls command line application";var k=x({routes:{auth:i,dev:s,project:n,install:y("cli",{bash:"__cli_bash_complete"}),uninstall:v("cli",{bash:!0})},docs:{brief:l,hideRoute:{install:!0,uninstall:!0}}}),O=w(k,{name:a,versionInfo:{currentVersion:c}});import j from"fs";import R from"fs/promises";import S from"os";import _ from"path";function H(e){return{fs:j,fsPromise:R,os:S,path:_,process:e}}export{O as a,H 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-ZXQO53AU.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as o}from"./chunk-
|
|
1
|
+
import{f as o}from"./chunk-R3TGQKBD.js";import{a as c,b as i}from"./chunk-WT3YKOQJ.js";import{withResult as n}from"@byteslice/result";import{render as s}from"ink";import{jsx as a}from"react/jsx-runtime";async function j(p,t){let m=await o(this),e=await n(()=>m.projects.createProject({name:t}),r=>new Error(`Failed to create project: ${r.message}`,{cause:r}));e.failure&&(s(a(c,{message:e.failure.message})),process.exit(1)),s(a(i,{message:`Success! Created "${t}" project: ${e.data.id}`}))}export{j as createProject};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as w,b as F,d as A}from"./chunk-PL5KWBVQ.js";import{f as S}from"./chunk-
|
|
1
|
+
import{a as w,b as F,d as A}from"./chunk-PL5KWBVQ.js";import{f as S}from"./chunk-R3TGQKBD.js";import{a as y,b as P}from"./chunk-WT3YKOQJ.js";import C from"process";import{withResult as j}from"@byteslice/result";var O=(e,r)=>e.anyOf.length?e.anyOf.length===1?a(e.anyOf[0],{...r,path:[...r.path,"anyOf",0]}):`z.union([${e.anyOf.map((t,o)=>a(t,{...r,path:[...r.path,"anyOf",o]})).join(", ")}])`:"z.any()";var N=e=>"z.boolean()";var E=e=>"z.any()";var T=(e,r)=>`z.union([${e.type.map(t=>a({...e,type:t},{...r,withoutDefaults:!0})).join(", ")}])`;var I=(e,r)=>`z.any().refine((value) => !${a(e.not,{...r,path:[...r.path,"not"]})}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`;var J=e=>"z.null()";var L=e=>[e.slice(0,e.length/2),e.slice(e.length/2)];var c=Symbol("Original index"),ae=e=>{let r=[];for(let t=0;t<e.length;t++){let o=e[t];if(typeof o=="boolean")r.push(o?{[c]:t}:{[c]:t,not:{}});else{if(c in o)return e;r.push({...o,[c]:t})}}return r};function m(e,r){if(e.allOf.length===0)return"z.never()";if(e.allOf.length===1){let t=e.allOf[0];return a(t,{...r,path:[...r.path,"allOf",t[c]]})}else{let[t,o]=L(ae(e.allOf));return`z.intersection(${m({allOf:t},r)}, ${m({allOf:o},r)})`}}function u(e,r,t){let o=e[r],n="";if(o!==void 0){let s=t({value:o,json:JSON.stringify(o)});if(s){let i=s[0],p=s.length===3?s[1]:"",f=s.length===3?s[2]:s[1];n+=i,e.errorMessage?.[r]!==void 0&&(n+=p+JSON.stringify(e.errorMessage[r])),n+=f}}return n}var M=(e,r)=>{if(Array.isArray(e.items))return`z.tuple([${e.items.map((o,n)=>a(o,{...r,path:[...r.path,"items",n]}))}])`;let t=e.items?`z.array(${a(e.items,{...r,path:[...r.path,"items"]})})`:"z.array(z.any())";return t+=u(e,"minItems",({json:o})=>[`.min(${o}`,", ",")"]),t+=u(e,"maxItems",({json:o})=>[`.max(${o}`,", ",")"]),e.uniqueItems===!0&&(t+=u(e,"uniqueItems",()=>[".unique(","",")"])),t};var R=e=>`z.literal(${JSON.stringify(e.const)})`;var D=e=>e.enum.length===0?"z.never()":e.enum.length===1?`z.literal(${JSON.stringify(e.enum[0])})`:e.enum.every(r=>typeof r=="string")?`z.enum([${e.enum.map(r=>JSON.stringify(r))}])`:`z.union([${e.enum.map(r=>`z.literal(${JSON.stringify(r)})`).join(", ")}])`;var q=(e,r)=>{let t=a(e.if,{...r,path:[...r.path,"if"]}),o=a(e.then,{...r,path:[...r.path,"then"]}),n=a(e.else,{...r,path:[...r.path,"else"]});return`z.union([${o}, ${n}]).superRefine((value,ctx) => {
|
|
2
2
|
const result = ${t}.safeParse(value).success
|
|
3
3
|
? ${o}.safeParse(value)
|
|
4
4
|
: ${n}.safeParse(value);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k,b as v,c as C,d as w,e as b,f as m}from"./chunk-
|
|
1
|
+
import{a as k,b as v,c as C,d as w,e as b,f as m}from"./chunk-R3TGQKBD.js";import{a as p,b as g}from"./chunk-WT3YKOQJ.js";import{withResult as s}from"@byteslice/result";import{render as f}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>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swirls/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Swirls command line application",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Swirls",
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"prebuild": "tsc -p tsconfig.json",
|
|
20
|
-
"build": "if command -v op >/dev/null 2>&1; then op run --no-masking --env-file=.env.development -- tsup; else tsup; fi",
|
|
20
|
+
"build": "if [ \"$SWIRLS_ENV\" = 'production' ]; then tsup; elif command -v op >/dev/null 2>&1; then op run --no-masking --env-file=.env.development -- tsup; else tsup; fi",
|
|
21
21
|
"postbuild": "chmod +x ./dist/cli.js",
|
|
22
22
|
"dev": "op run --no-masking --env-file=.env.development -- tsup --watch",
|
|
23
|
-
"prepublishOnly": "bun run build"
|
|
23
|
+
"prepublishOnly": "SWIRLS_ENV=production bun run build",
|
|
24
|
+
"publish:cli": "bun publish"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@byteslice/result": "0.3.0",
|