@tscircuit/cli 0.0.45 → 0.0.47
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/bun.lockb +0 -0
- package/dist/cli.js +49 -70
- package/lib/get-program.ts +97 -50
- package/package.json +2 -2
package/lib/get-program.ts
CHANGED
|
@@ -3,45 +3,42 @@ import packageJson from "../package.json"
|
|
|
3
3
|
import { AppContext } from "./util/app-context"
|
|
4
4
|
import * as CMDFN from "lib/cmd-fns"
|
|
5
5
|
|
|
6
|
-
// | Endpoint | Description |
|
|
7
|
-
// | ------------------------------------- | ---------------------------- |
|
|
8
|
-
// | /packages/search | Search for packages |
|
|
9
|
-
// | /packages/list | List packages with a filter |
|
|
10
|
-
// | /packages/get | Get a package by id or name |
|
|
11
|
-
// | /packages/create | Create a new package |
|
|
12
|
-
// | /package_releases/list | List package releases |
|
|
13
|
-
// | /package_releases/get | Get a package release by id |
|
|
14
|
-
// | /package_releases/create | Create a new package release |
|
|
15
|
-
// | /package_files/list | List package files |
|
|
16
|
-
// | /package_files/get | Get a package file by id |
|
|
17
|
-
// | /package_files/download | Download a package file |
|
|
18
|
-
// | /package_files/create | Create a new package file |
|
|
19
|
-
// | /package_examples/list | List package examples |
|
|
20
|
-
// | /package_examples/get | Get a package example by id |
|
|
21
|
-
// | /package_examples/create | Create a new package example |
|
|
22
|
-
|
|
23
6
|
export const getProgram = (ctx: AppContext) => {
|
|
24
|
-
const cmd = new Command("tsci")
|
|
7
|
+
const cmd = new Command("tsci").description(
|
|
8
|
+
"Develop, test and manage tscircuit packages"
|
|
9
|
+
)
|
|
25
10
|
|
|
26
|
-
const authCmd = cmd.command("auth")
|
|
27
|
-
authCmd
|
|
28
|
-
|
|
11
|
+
const authCmd = cmd.command("auth").description("Login/logout")
|
|
12
|
+
authCmd
|
|
13
|
+
.command("login")
|
|
14
|
+
.description("Authenticate CLI, login to registry")
|
|
15
|
+
.action((args) => CMDFN.authLogin(ctx, args))
|
|
16
|
+
authCmd
|
|
17
|
+
.command("logout")
|
|
18
|
+
.description("Clear local authentication")
|
|
19
|
+
.action((args) => CMDFN.authLogout(ctx, args))
|
|
29
20
|
|
|
30
|
-
const configCmd = cmd
|
|
21
|
+
const configCmd = cmd
|
|
22
|
+
.command("config")
|
|
23
|
+
.description("Manage the local tsci configuration")
|
|
31
24
|
|
|
32
25
|
configCmd
|
|
33
26
|
.command("reveal-location")
|
|
27
|
+
.description("Log the location of the config file")
|
|
34
28
|
.action((args) => CMDFN.configRevealLocation(ctx, args))
|
|
35
29
|
configCmd
|
|
36
30
|
.command("set-registry")
|
|
31
|
+
.description("Set the registry API url")
|
|
37
32
|
.requiredOption("--server <server>", "Registry URL")
|
|
38
33
|
.action((args) => CMDFN.configSetRegistry(ctx, args))
|
|
39
34
|
configCmd
|
|
40
35
|
.command("set-session")
|
|
36
|
+
.description("Set the session token manually")
|
|
41
37
|
.requiredOption("--session-token <session_token>", "Session Token")
|
|
42
38
|
.action((args) => CMDFN.configSetSession(ctx, args))
|
|
43
39
|
configCmd
|
|
44
40
|
.command("set-runtime")
|
|
41
|
+
.description("Set runtime to use, bun or node")
|
|
45
42
|
.requiredOption(
|
|
46
43
|
"--runtime <runtime>",
|
|
47
44
|
"Bun or node. Setting to bun generally doubles soupification speed."
|
|
@@ -49,35 +46,41 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
49
46
|
.action((args) => CMDFN.configSetRuntime(ctx, args))
|
|
50
47
|
configCmd
|
|
51
48
|
.command("set-log-requests")
|
|
49
|
+
.description("Set whether to log requests to registry (noisy)")
|
|
52
50
|
.requiredOption("--log-requests", "Should log requests to registry")
|
|
53
51
|
.action((args) => CMDFN.configSetLogRequests(ctx, args))
|
|
54
52
|
configCmd
|
|
55
53
|
.command("print-config")
|
|
54
|
+
.description("Print the current config")
|
|
56
55
|
.action((args) => CMDFN.configPrintConfig(ctx, args))
|
|
57
|
-
configCmd
|
|
56
|
+
configCmd
|
|
57
|
+
.command("clear")
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
.action((args) => CMDFN.configClear(ctx, args))
|
|
60
60
|
|
|
61
|
-
authSessionsCmd
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
// const authSessionsCmd = authCmd.command("sessions")
|
|
62
|
+
// authSessionsCmd
|
|
63
|
+
// .command("create")
|
|
64
|
+
// .action((args) => CMDFN.authSessionsCreate(ctx, args))
|
|
65
|
+
// authSessionsCmd
|
|
66
|
+
// .command("list")
|
|
67
|
+
// .action((args) => CMDFN.authSessionsList(ctx, args))
|
|
68
|
+
// authSessionsCmd
|
|
69
|
+
// .command("get")
|
|
70
|
+
// .action((args) => CMDFN.authSessionsGet(ctx, args))
|
|
70
71
|
|
|
71
|
-
const packagesCmd = cmd.command("packages")
|
|
72
|
+
const packagesCmd = cmd.command("packages").description("Manage packages")
|
|
72
73
|
|
|
73
74
|
packagesCmd.command("list").action((args) => CMDFN.packagesList(ctx, args))
|
|
74
75
|
packagesCmd
|
|
75
76
|
.command("get")
|
|
77
|
+
.description("Get information about a package")
|
|
76
78
|
.option("--package-id <package_id>", "Package Id")
|
|
77
79
|
.option("--name <name>", "Package name")
|
|
78
80
|
.action((args) => CMDFN.packagesGet(ctx, args))
|
|
79
81
|
packagesCmd
|
|
80
82
|
.command("create")
|
|
83
|
+
.description("Create a new package")
|
|
81
84
|
.requiredOption("--name <name>", "Package name")
|
|
82
85
|
.option("--author-id <author_account_id>", "Author Id")
|
|
83
86
|
.option("--description <description>", "Package description")
|
|
@@ -87,14 +90,17 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
87
90
|
|
|
88
91
|
packageReleases
|
|
89
92
|
.command("list")
|
|
93
|
+
.description("List all package releases for a package")
|
|
90
94
|
.requiredOption("--package-name <package_name>", "Package name")
|
|
91
95
|
.option("--verbose", "Verbose objects (includes uuids)")
|
|
92
96
|
.action((args) => CMDFN.packageReleasesList(ctx, args))
|
|
93
|
-
packageReleases
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
// packageReleases
|
|
98
|
+
// .command("get")
|
|
99
|
+
// .description("Get information about a package release")
|
|
100
|
+
// .action((args) => CMDFN.packageReleasesGet(ctx, args))
|
|
96
101
|
packageReleases
|
|
97
102
|
.command("create")
|
|
103
|
+
.description("Create a new package release")
|
|
98
104
|
.option(
|
|
99
105
|
"-p, --package-name-with-version <package_name_with_version>",
|
|
100
106
|
"Package name and version"
|
|
@@ -104,6 +110,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
104
110
|
.action((args) => CMDFN.packageReleasesCreate(ctx, args))
|
|
105
111
|
packageReleases
|
|
106
112
|
.command("update")
|
|
113
|
+
.description("Update a package release")
|
|
107
114
|
.option(
|
|
108
115
|
"-p, --package-name-with-version <package_name_with_version>",
|
|
109
116
|
"Package name and version"
|
|
@@ -112,10 +119,13 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
112
119
|
.option("--is-locked", "Lock the release")
|
|
113
120
|
.action((args) => CMDFN.packageReleasesUpdate(ctx, args))
|
|
114
121
|
|
|
115
|
-
const packageFiles = cmd
|
|
122
|
+
const packageFiles = cmd
|
|
123
|
+
.command("package_files")
|
|
124
|
+
.description("Manage package release files")
|
|
116
125
|
|
|
117
126
|
packageFiles
|
|
118
127
|
.command("list")
|
|
128
|
+
.description("List all files for a package release")
|
|
119
129
|
.option(
|
|
120
130
|
"--package-name-with-version <package_name_with_version>",
|
|
121
131
|
"Package name with version"
|
|
@@ -126,9 +136,10 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
126
136
|
)
|
|
127
137
|
.option("--package-release-id <package_release_id>", "Package Release Id")
|
|
128
138
|
.action((args) => CMDFN.packageFilesList(ctx, args))
|
|
129
|
-
packageFiles.command("get").action((args) => CMDFN.packageFilesGet(ctx, args))
|
|
139
|
+
// packageFiles.command("get").action((args) => CMDFN.packageFilesGet(ctx, args))
|
|
130
140
|
packageFiles
|
|
131
141
|
.command("download")
|
|
142
|
+
.description("Download a file from a package release")
|
|
132
143
|
.requiredOption(
|
|
133
144
|
"--package-name-with-version <package_name_with_version>",
|
|
134
145
|
"Package name and version"
|
|
@@ -141,6 +152,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
141
152
|
.action((args) => CMDFN.packageFilesDownload(ctx, args))
|
|
142
153
|
packageFiles
|
|
143
154
|
.command("create")
|
|
155
|
+
.description("Create/upload a new package file")
|
|
144
156
|
.option(
|
|
145
157
|
"-p, --package-release-id <package_release_id>",
|
|
146
158
|
"Package Release Id"
|
|
@@ -152,23 +164,29 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
152
164
|
.requiredOption("--file <file>", "File to upload")
|
|
153
165
|
.action((args) => CMDFN.packageFilesCreate(ctx, args))
|
|
154
166
|
|
|
155
|
-
packageFiles
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
167
|
+
// packageFiles
|
|
168
|
+
// .command("upload-directory")
|
|
169
|
+
// .description("Upload a directory of files to a package release")
|
|
170
|
+
// .requiredOption("--dir <dir>", "Directory to upload")
|
|
171
|
+
// .action((args) => CMDFN.packageFilesUploadDirectory(ctx, args))
|
|
159
172
|
|
|
160
|
-
const packageExamples = cmd
|
|
173
|
+
const packageExamples = cmd
|
|
174
|
+
.command("package_examples")
|
|
175
|
+
.description("Manage package release examples")
|
|
161
176
|
|
|
162
177
|
packageExamples
|
|
163
178
|
.command("list")
|
|
179
|
+
.description("List all examples for a package")
|
|
164
180
|
.requiredOption("--package-name-with-version <package_name_with_version>")
|
|
165
181
|
.action((args) => CMDFN.packageExamplesList(ctx, args))
|
|
166
182
|
packageExamples
|
|
167
183
|
.command("get")
|
|
184
|
+
.description("Get information about a package example")
|
|
168
185
|
.requiredOption("--package-example-id <package_example_id>")
|
|
169
186
|
.action((args) => CMDFN.packageExamplesGet(ctx, args))
|
|
170
187
|
packageExamples
|
|
171
188
|
.command("create")
|
|
189
|
+
.description("Create a new package example")
|
|
172
190
|
.requiredOption("--package-name-with-version <package_name_with_version>")
|
|
173
191
|
.requiredOption("--file <file>")
|
|
174
192
|
.option("--export <export>", "Name of export to soupify")
|
|
@@ -176,18 +194,29 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
176
194
|
|
|
177
195
|
cmd
|
|
178
196
|
.command("publish")
|
|
179
|
-
.
|
|
197
|
+
.description("Publish a package release to the tscircuit registry")
|
|
198
|
+
.option("--increment", "Increase patch version", true)
|
|
180
199
|
.option("--patch", "Increase patch version")
|
|
181
200
|
.option("--lock", "Lock the release after publishing to prevent changes")
|
|
182
201
|
.action((args) => CMDFN.publish(ctx, args))
|
|
183
202
|
|
|
184
|
-
cmd
|
|
203
|
+
cmd
|
|
204
|
+
.command("version")
|
|
205
|
+
.description("Print current version")
|
|
206
|
+
.action((args) => CMDFN.version(ctx, args))
|
|
185
207
|
|
|
186
|
-
cmd
|
|
187
|
-
|
|
208
|
+
cmd
|
|
209
|
+
.command("login")
|
|
210
|
+
.description("Authenticate CLI, login to registry")
|
|
211
|
+
.action((args) => CMDFN.authLogin(ctx, args))
|
|
212
|
+
cmd
|
|
213
|
+
.command("logout")
|
|
214
|
+
.description("Clear your local authentication")
|
|
215
|
+
.action((args) => CMDFN.authLogout(ctx, args))
|
|
188
216
|
|
|
189
217
|
cmd
|
|
190
218
|
.command("soupify")
|
|
219
|
+
.description("Convert an example file to tscircuit soup")
|
|
191
220
|
.requiredOption("--file <file>", "Input example files")
|
|
192
221
|
.option(
|
|
193
222
|
"--export <export_name>",
|
|
@@ -197,12 +226,14 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
197
226
|
|
|
198
227
|
cmd
|
|
199
228
|
.command("dev")
|
|
229
|
+
.description("Run development server in current directory")
|
|
200
230
|
.option("--cwd <cwd>", "Current working directory")
|
|
201
231
|
.option("--port <port>", "Port to run dev server on")
|
|
202
232
|
.action((args) => CMDFN.dev(ctx, args))
|
|
203
233
|
|
|
204
234
|
cmd
|
|
205
235
|
.command("init")
|
|
236
|
+
.description("Initialize a new tscircuit project")
|
|
206
237
|
.option("--name <name>", "Name of the project")
|
|
207
238
|
.option(
|
|
208
239
|
"--runtime <runtime>",
|
|
@@ -216,6 +247,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
216
247
|
|
|
217
248
|
cmd
|
|
218
249
|
.command("add")
|
|
250
|
+
.description("Add a package from the tscircuit registry")
|
|
219
251
|
.argument(
|
|
220
252
|
"<packages...>",
|
|
221
253
|
"Packages to install from registry.tscircuit.com, optionally with version"
|
|
@@ -225,11 +257,13 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
225
257
|
|
|
226
258
|
cmd
|
|
227
259
|
.command("remove")
|
|
260
|
+
.description("Remove/uninstall a package")
|
|
228
261
|
.argument("<packages...>", "Packages to remove")
|
|
229
262
|
.action((packages, flags) => CMDFN.remove(ctx, { packages, flags }))
|
|
230
263
|
|
|
231
264
|
cmd
|
|
232
265
|
.command("install")
|
|
266
|
+
.description("Install a package from the tscircuit registry")
|
|
233
267
|
.argument(
|
|
234
268
|
"<packages...>",
|
|
235
269
|
"Packages to install from registry.tscircuit.com, optionally with version"
|
|
@@ -239,13 +273,17 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
239
273
|
|
|
240
274
|
cmd
|
|
241
275
|
.command("uninstall")
|
|
276
|
+
.description("Uninstall a package")
|
|
242
277
|
.argument("<packages...>", "Packages to uninstall")
|
|
243
278
|
.action((packages, flags) => CMDFN.install(ctx, { packages, flags }))
|
|
244
279
|
|
|
245
|
-
const devServerCmd = cmd
|
|
280
|
+
const devServerCmd = cmd
|
|
281
|
+
.command("dev-server")
|
|
282
|
+
.description("(Advanced) Manage the development server")
|
|
246
283
|
|
|
247
284
|
devServerCmd
|
|
248
285
|
.command("upload")
|
|
286
|
+
.description("Upload a directory to the dev server")
|
|
249
287
|
.option(
|
|
250
288
|
"--dir <dir>",
|
|
251
289
|
"Directory to upload (defaults to current directory)"
|
|
@@ -254,7 +292,16 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
254
292
|
.option("-p, --port", "Port dev server is running on (default: 3020)")
|
|
255
293
|
.action((args) => CMDFN.devServerUpload(ctx, args))
|
|
256
294
|
|
|
257
|
-
cmd
|
|
295
|
+
cmd
|
|
296
|
+
.command("open")
|
|
297
|
+
.description("Open browser to package on tscircuit registry")
|
|
298
|
+
.action((args) => CMDFN.open(ctx, args))
|
|
299
|
+
|
|
300
|
+
function recursiveUnhelp(cmd: Command) {
|
|
301
|
+
cmd.helpCommand(false)
|
|
302
|
+
cmd.commands.forEach((c) => recursiveUnhelp(c))
|
|
303
|
+
}
|
|
304
|
+
recursiveUnhelp(cmd)
|
|
258
305
|
|
|
259
306
|
return cmd
|
|
260
307
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Command line tool for developing, publishing and installing tscircuit circuits",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"minimist": "^1.2.8",
|
|
58
58
|
"node-persist": "^4.0.1",
|
|
59
59
|
"open": "^10.1.0",
|
|
60
|
-
"perfect-cli": "
|
|
60
|
+
"perfect-cli": "1.0.20",
|
|
61
61
|
"prompts": "^2.4.2",
|
|
62
62
|
"react": "^18.2.0",
|
|
63
63
|
"semver": "^7.6.0",
|