@swirls/cli 0.0.15 → 0.0.16

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 CHANGED
@@ -4,7 +4,7 @@ Swirls command line application for authentication, project setup, code generati
4
4
 
5
5
  ## Usage
6
6
 
7
- The Swirls CLI can be executed remotely or installed on your machine.
7
+ The Swirls CLI can be executed remotely or installed on your machine. Use `swirls` or `npx @swirls/cli` depending on what you choose.
8
8
 
9
9
  ### Remote
10
10
 
@@ -15,7 +15,8 @@ npx @swirls/cli <command> [options]
15
15
 
16
16
  ### Local
17
17
 
18
- Install
18
+ Install globally with npm or Bun.
19
+
19
20
  ```sh
20
21
  npm install -g @swirls/cli
21
22
  # or
@@ -29,63 +30,47 @@ swirls <command> [options]
29
30
 
30
31
  ## Reference
31
32
 
32
- Use `--help` for a helpful reference guide on how to use the CLI. Use `-v` or `--version` to print the CLI version.
33
+ Run `--help` for a reference guide; use `-v` or `--version` to print the CLI version.
33
34
 
34
- ### Remote
35
- ```sh
36
- npx @swirls/cli --help
37
- ```
38
-
39
- ### Local
40
35
  ```sh
36
+ # local
41
37
  swirls --help
38
+ # remote
39
+ npx @swirls/cli --help
42
40
  ```
43
41
 
44
42
  ## Commands
45
43
 
46
- > In the command tables below, replace `swirls` with `npx @swirls/cli` when running remotely.
44
+ The Swirls CLI provides the following namespaces. For each, run its `--help` to see commands and options (examples below).
47
45
 
48
46
  ### Auth
49
47
 
50
48
  Log in and out of Swirls.
51
49
 
52
- | Command | Description |
53
- |---------|-------------|
54
- | `swirls auth login` | Log in with an existing account |
55
- | `swirls auth logout` | Log out |
50
+ ```sh
51
+ swirls auth --help
52
+ ```
56
53
 
57
54
  ### Dev
58
55
 
59
56
  Configure Swirls and generate code.
60
57
 
61
- | Command | Description |
62
- |---------|-------------|
63
- | `swirls dev init` | Initialize Swirls configuration file (`swirls.config.ts`) |
64
- | `swirls dev gen` | Generate application code and types from your Swirls project |
58
+ ```sh
59
+ swirls dev --help
60
+ ```
65
61
 
66
62
  ### Project
67
63
 
68
64
  Create and manage Swirls projects.
69
65
 
70
- | Command | Description |
71
- |---------|-------------|
72
- | `swirls project create <name>` | Create a new project |
66
+ ```sh
67
+ swirls project --help
68
+ ```
73
69
 
74
70
  ### Storage
75
71
 
76
72
  Manage file storage for your Swirls project.
77
73
 
78
- | Command | Description |
79
- |---------|-------------|
80
- | `swirls storage list [path]` | List files in storage (optional path) |
81
- | `swirls storage upload <file> [dest]` | Upload a file to storage |
82
- | `swirls storage download <path> <dest>` | Download a file from storage |
83
- | `swirls storage delete <path>` | Delete a file from storage |
84
- | `swirls storage url [--expires value] <path>` | Get a signed URL for a file |
85
-
86
- ### Storage Flags
87
-
88
- | Flag | Description |
89
- |------|-------------|
90
- | `--project <value>` | Project to use (optional; applies to all storage commands) |
91
- | `--expires <value>` | Expiration for the signed URL (optional; for `swirls storage url` only) |
74
+ ```sh
75
+ swirls storage --help
76
+ ```
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as o,b as s}from"./chunk-X3Q63YSL.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}
2
+ import{a as o,b as s}from"./chunk-ICDIBMSW.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{}
@@ -0,0 +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-26623XVE.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-26623XVE.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.16",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};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-RJOLKCKW.js";import{render as t}from"ink";import n from"open";import{jsx as i}from"react/jsx-runtime";var s="https://swirls.ai/projects";async function a(e){let r=`${s}/${e.id}`;await n(r),t(i(o,{message:`Opened project "${e.name}" in browser.`}))}export{a};
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-X3Q63YSL.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
2
+ import{a as r,b as o}from"./chunk-ICDIBMSW.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
@@ -0,0 +1 @@
1
+ import{a as u}from"./chunk-KCGRSAKR.js";import{a as f}from"./chunk-RJOLKCKW.js";import{f as c}from"./chunk-R3TGQKBD.js";import{a as p}from"./chunk-OEQFVEK4.js";import{withResult as j}from"@byteslice/result";import{render as b}from"ink";import{Box as i,render as w,Text as x}from"ink";import P from"ink-text-input";import{useState as y}from"react";import{jsx as m,jsxs as a}from"react/jsx-runtime";function C(r){let[o,n]=y(""),e=s=>{let t=s.trim().toLowerCase(),g=t===""||t==="y"||t==="yes";setImmediate(()=>r.onAnswer(g))};return m(i,{flexDirection:"column",children:a(i,{children:[a(x,{children:[r.message," "]}),m(P,{value:o,onChange:n,onSubmit:e})]})})}async function l(r){let{above:o}=r??{};return new Promise(n=>{let e=w(a(i,{flexDirection:"column",children:[o,m(C,{message:"Open project in browser? (Y/n)",onAnswer:s=>{e.unmount(),n(s)}})]}))})}import{jsx as d}from"react/jsx-runtime";async function I(r,o){let n=await c(this),e=await j(()=>n.projects.createProject({name:o}),t=>new Error(`Failed to create project: ${t.message}`,{cause:t}));e.failure&&(b(d(p,{message:e.failure.message})),process.exit(1)),await l({above:d(f,{message:`Success! Created "${o}" project: ${e.data.id}`})})&&await u(e.data)}export{I as createProject};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-KCGRSAKR.js";import"./chunk-RJOLKCKW.js";import{f as r}from"./chunk-R3TGQKBD.js";import{a as e}from"./chunk-OEQFVEK4.js";import{withResult as m}from"@byteslice/result";import{render as a}from"ink";import{jsx as n}from"react/jsx-runtime";async function d(p,s){let c=await r(this),t=await m(()=>c.projects.getProject({projectId:s}),o=>new Error(`Failed to get project: ${o.message}`,{cause:o}));t.failure&&(a(n(e,{message:t.failure.message})),process.exit(1)),t.data||(a(n(e,{message:"Project not found."})),process.exit(1)),await i(t.data)}export{d as openProject};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swirls/cli",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Swirls command line application",
5
5
  "author": {
6
6
  "name": "Swirls",
@@ -1 +0,0 @@
1
- import{buildInstallCommand as R,buildUninstallCommand as L}from"@stricli/auto-complete";import{buildApplication as D,buildRouteMap as I}from"@stricli/core";import{buildCommand as r,buildRouteMap as u}from"@stricli/core";var m=r({loader:async()=>{let{login:e}=await import("./implementation-26623XVE.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log in with an existing account"}}),f=r({loader:async()=>{let{logout:e}=await import("./implementation-26623XVE.js");return e},parameters:{positional:{kind:"tuple",parameters:[]}},docs:{brief:"Log out of an existing account"}}),i=u({routes:{login:m,logout:f},docs:{brief:"Auth commands"}});import{buildCommand as a,buildRouteMap as g}from"@stricli/core";var b=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"}}),h=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=g({routes:{gen:b,init:h},docs:{brief:"Developer commands"}});import{buildCommand as k,buildRouteMap as C}from"@stricli/core";var w=k({loader:async()=>{let{createProject:e}=await import("./create-project-HOGHQFPY.js");return e},parameters:{positional:{kind:"tuple",parameters:[{brief:"Project name",parse:String,placeholder:"name"}]}},docs:{brief:"Create a new project"}}),n=C({routes:{create:w},docs:{brief:"Project commands"}});import{buildCommand as t,buildRouteMap as j}from"@stricli/core";var S=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"}}),y=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"}}),x=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"}}),P=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"}}),p=j({routes:{list:S,upload:y,download:x,delete:v,url:P},docs:{brief:"Storage commands"}});var l="@swirls/cli",c="0.0.15",d="Swirls command line application";var _=I({routes:{auth:i,dev:s,project:n,storage:p,install:R("cli",{bash:"__cli_bash_complete"}),uninstall:L("cli",{bash:!0})},docs:{brief:d,hideRoute:{install:!0,uninstall:!0}}}),Y=D(_,{name:l,versionInfo:{currentVersion:c}});import z from"fs";import M from"fs/promises";import N from"os";import A from"path";function ie(e){return{fs:z,fsPromise:M,os:N,path:A,process:e}}export{Y as a,ie as b};
@@ -1 +0,0 @@
1
- import{a as i}from"./chunk-RJOLKCKW.js";import{f as o}from"./chunk-R3TGQKBD.js";import{a as c}from"./chunk-OEQFVEK4.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};