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