docstar-cli 0.0.0
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 +456 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/hello/index.d.ts +12 -0
- package/dist/commands/hello/index.js +19 -0
- package/dist/commands/hello/world.d.ts +8 -0
- package/dist/commands/hello/world.js +14 -0
- package/dist/commands/init.d.ts +12 -0
- package/dist/commands/init.js +79 -0
- package/dist/commands/slack/list.js +20 -0
- package/dist/commands/slack/send-message-1.js +30 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/codegen.d.ts +3 -0
- package/dist/lib/codegen.js +78 -0
- package/dist/lib/http.d.ts +8 -0
- package/dist/lib/http.js +62 -0
- package/dist/lib/paths.d.ts +4 -0
- package/dist/lib/paths.js +6 -0
- package/dist/lib/prompt.d.ts +1 -0
- package/dist/lib/prompt.js +11 -0
- package/dist/lib/types.d.ts +49 -0
- package/dist/lib/types.js +1 -0
- package/oclif.manifest.json +157 -0
- package/package.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
docstar-cli
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
A new CLI generated with oclif
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
[](https://oclif.io)
|
|
8
|
+
[](https://npmjs.org/package/docstar-cli)
|
|
9
|
+
[](https://npmjs.org/package/docstar-cli)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<!-- toc -->
|
|
13
|
+
* [Usage](#usage)
|
|
14
|
+
* [Commands](#commands)
|
|
15
|
+
<!-- tocstop -->
|
|
16
|
+
# Usage
|
|
17
|
+
<!-- usage -->
|
|
18
|
+
```sh-session
|
|
19
|
+
$ npm install -g docstar-cli
|
|
20
|
+
$ docstar-cli COMMAND
|
|
21
|
+
running command...
|
|
22
|
+
$ docstar-cli (--version)
|
|
23
|
+
docstar-cli/0.0.0 darwin-arm64 node-v22.22.3
|
|
24
|
+
$ docstar-cli --help [COMMAND]
|
|
25
|
+
USAGE
|
|
26
|
+
$ docstar-cli COMMAND
|
|
27
|
+
...
|
|
28
|
+
```
|
|
29
|
+
<!-- usagestop -->
|
|
30
|
+
# Commands
|
|
31
|
+
<!-- commands -->
|
|
32
|
+
* [`docstar-cli hello PERSON`](#docstar-cli-hello-person)
|
|
33
|
+
* [`docstar-cli hello world`](#docstar-cli-hello-world)
|
|
34
|
+
* [`docstar-cli help [COMMAND]`](#docstar-cli-help-command)
|
|
35
|
+
* [`docstar-cli init DOMAIN`](#docstar-cli-init-domain)
|
|
36
|
+
* [`docstar-cli plugins`](#docstar-cli-plugins)
|
|
37
|
+
* [`docstar-cli plugins add PLUGIN`](#docstar-cli-plugins-add-plugin)
|
|
38
|
+
* [`docstar-cli plugins:inspect PLUGIN...`](#docstar-cli-pluginsinspect-plugin)
|
|
39
|
+
* [`docstar-cli plugins install PLUGIN`](#docstar-cli-plugins-install-plugin)
|
|
40
|
+
* [`docstar-cli plugins link PATH`](#docstar-cli-plugins-link-path)
|
|
41
|
+
* [`docstar-cli plugins remove [PLUGIN]`](#docstar-cli-plugins-remove-plugin)
|
|
42
|
+
* [`docstar-cli plugins reset`](#docstar-cli-plugins-reset)
|
|
43
|
+
* [`docstar-cli plugins uninstall [PLUGIN]`](#docstar-cli-plugins-uninstall-plugin)
|
|
44
|
+
* [`docstar-cli plugins unlink [PLUGIN]`](#docstar-cli-plugins-unlink-plugin)
|
|
45
|
+
* [`docstar-cli plugins update`](#docstar-cli-plugins-update)
|
|
46
|
+
* [`docstar-cli slack list`](#docstar-cli-slack-list)
|
|
47
|
+
* [`docstar-cli slack send-message-1`](#docstar-cli-slack-send-message-1)
|
|
48
|
+
|
|
49
|
+
## `docstar-cli hello PERSON`
|
|
50
|
+
|
|
51
|
+
Say hello
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
USAGE
|
|
55
|
+
$ docstar-cli hello PERSON -f <value>
|
|
56
|
+
|
|
57
|
+
ARGUMENTS
|
|
58
|
+
PERSON Person to say hello to
|
|
59
|
+
|
|
60
|
+
FLAGS
|
|
61
|
+
-f, --from=<value> (required) Who is saying hello
|
|
62
|
+
|
|
63
|
+
DESCRIPTION
|
|
64
|
+
Say hello
|
|
65
|
+
|
|
66
|
+
EXAMPLES
|
|
67
|
+
$ docstar-cli hello friend --from oclif
|
|
68
|
+
hello friend from oclif! (./src/commands/hello/index.ts)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
_See code: [src/commands/hello/index.ts](https://github.com/swayammaheshwari/docstar-cli/blob/v0.0.0/src/commands/hello/index.ts)_
|
|
72
|
+
|
|
73
|
+
## `docstar-cli hello world`
|
|
74
|
+
|
|
75
|
+
Say hello world
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
USAGE
|
|
79
|
+
$ docstar-cli hello world
|
|
80
|
+
|
|
81
|
+
DESCRIPTION
|
|
82
|
+
Say hello world
|
|
83
|
+
|
|
84
|
+
EXAMPLES
|
|
85
|
+
$ docstar-cli hello world
|
|
86
|
+
hello world! (./src/commands/hello/world.ts)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
_See code: [src/commands/hello/world.ts](https://github.com/swayammaheshwari/docstar-cli/blob/v0.0.0/src/commands/hello/world.ts)_
|
|
90
|
+
|
|
91
|
+
## `docstar-cli help [COMMAND]`
|
|
92
|
+
|
|
93
|
+
Display help for docstar-cli.
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
USAGE
|
|
97
|
+
$ docstar-cli help [COMMAND...] [-n]
|
|
98
|
+
|
|
99
|
+
ARGUMENTS
|
|
100
|
+
[COMMAND...] Command to show help for.
|
|
101
|
+
|
|
102
|
+
FLAGS
|
|
103
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
104
|
+
|
|
105
|
+
DESCRIPTION
|
|
106
|
+
Display help for docstar-cli.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.58/src/commands/help.ts)_
|
|
110
|
+
|
|
111
|
+
## `docstar-cli init DOMAIN`
|
|
112
|
+
|
|
113
|
+
Discover published modules for a DocStar docs site, pick which ones to install, and register their CLI commands
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
USAGE
|
|
117
|
+
$ docstar-cli init DOMAIN [--collectionId <value>]
|
|
118
|
+
|
|
119
|
+
ARGUMENTS
|
|
120
|
+
DOMAIN DocStar docs domain, e.g. docs.msg91.com or localhost:3000
|
|
121
|
+
|
|
122
|
+
FLAGS
|
|
123
|
+
--collectionId=<value> Collection id (required when the domain is not a custom domain, e.g. localhost)
|
|
124
|
+
|
|
125
|
+
DESCRIPTION
|
|
126
|
+
Discover published modules for a DocStar docs site, pick which ones to install, and register their CLI commands
|
|
127
|
+
|
|
128
|
+
EXAMPLES
|
|
129
|
+
$ docstar-cli init docs.msg91.com
|
|
130
|
+
|
|
131
|
+
$ docstar-cli init localhost:3000 --collectionId paM4R4A26Hvb
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
_See code: [src/commands/init.ts](https://github.com/swayammaheshwari/docstar-cli/blob/v0.0.0/src/commands/init.ts)_
|
|
135
|
+
|
|
136
|
+
## `docstar-cli plugins`
|
|
137
|
+
|
|
138
|
+
List installed plugins.
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
USAGE
|
|
142
|
+
$ docstar-cli plugins [--json] [--core]
|
|
143
|
+
|
|
144
|
+
FLAGS
|
|
145
|
+
--core Show core plugins.
|
|
146
|
+
|
|
147
|
+
GLOBAL FLAGS
|
|
148
|
+
--json Format output as json.
|
|
149
|
+
|
|
150
|
+
DESCRIPTION
|
|
151
|
+
List installed plugins.
|
|
152
|
+
|
|
153
|
+
EXAMPLES
|
|
154
|
+
$ docstar-cli plugins
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/index.ts)_
|
|
158
|
+
|
|
159
|
+
## `docstar-cli plugins add PLUGIN`
|
|
160
|
+
|
|
161
|
+
Installs a plugin into docstar-cli.
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
USAGE
|
|
165
|
+
$ docstar-cli plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
166
|
+
|
|
167
|
+
ARGUMENTS
|
|
168
|
+
PLUGIN... Plugin to install.
|
|
169
|
+
|
|
170
|
+
FLAGS
|
|
171
|
+
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
|
172
|
+
-h, --help Show CLI help.
|
|
173
|
+
-s, --silent Silences npm output.
|
|
174
|
+
-v, --verbose Show verbose npm output.
|
|
175
|
+
|
|
176
|
+
GLOBAL FLAGS
|
|
177
|
+
--json Format output as json.
|
|
178
|
+
|
|
179
|
+
DESCRIPTION
|
|
180
|
+
Installs a plugin into docstar-cli.
|
|
181
|
+
|
|
182
|
+
Uses npm to install plugins.
|
|
183
|
+
|
|
184
|
+
Installation of a user-installed plugin will override a core plugin.
|
|
185
|
+
|
|
186
|
+
Use the DOCSTAR_CLI_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
|
187
|
+
Use the DOCSTAR_CLI_NPM_REGISTRY environment variable to set the npm registry.
|
|
188
|
+
|
|
189
|
+
ALIASES
|
|
190
|
+
$ docstar-cli plugins add
|
|
191
|
+
|
|
192
|
+
EXAMPLES
|
|
193
|
+
Install a plugin from npm registry.
|
|
194
|
+
|
|
195
|
+
$ docstar-cli plugins add myplugin
|
|
196
|
+
|
|
197
|
+
Install a plugin from a github url.
|
|
198
|
+
|
|
199
|
+
$ docstar-cli plugins add https://github.com/someuser/someplugin
|
|
200
|
+
|
|
201
|
+
Install a plugin from a github slug.
|
|
202
|
+
|
|
203
|
+
$ docstar-cli plugins add someuser/someplugin
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## `docstar-cli plugins:inspect PLUGIN...`
|
|
207
|
+
|
|
208
|
+
Displays installation properties of a plugin.
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
USAGE
|
|
212
|
+
$ docstar-cli plugins inspect PLUGIN...
|
|
213
|
+
|
|
214
|
+
ARGUMENTS
|
|
215
|
+
PLUGIN... [default: .] Plugin to inspect.
|
|
216
|
+
|
|
217
|
+
FLAGS
|
|
218
|
+
-h, --help Show CLI help.
|
|
219
|
+
-v, --verbose
|
|
220
|
+
|
|
221
|
+
GLOBAL FLAGS
|
|
222
|
+
--json Format output as json.
|
|
223
|
+
|
|
224
|
+
DESCRIPTION
|
|
225
|
+
Displays installation properties of a plugin.
|
|
226
|
+
|
|
227
|
+
EXAMPLES
|
|
228
|
+
$ docstar-cli plugins inspect myplugin
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/inspect.ts)_
|
|
232
|
+
|
|
233
|
+
## `docstar-cli plugins install PLUGIN`
|
|
234
|
+
|
|
235
|
+
Installs a plugin into docstar-cli.
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
USAGE
|
|
239
|
+
$ docstar-cli plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
|
|
240
|
+
|
|
241
|
+
ARGUMENTS
|
|
242
|
+
PLUGIN... Plugin to install.
|
|
243
|
+
|
|
244
|
+
FLAGS
|
|
245
|
+
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
|
|
246
|
+
-h, --help Show CLI help.
|
|
247
|
+
-s, --silent Silences npm output.
|
|
248
|
+
-v, --verbose Show verbose npm output.
|
|
249
|
+
|
|
250
|
+
GLOBAL FLAGS
|
|
251
|
+
--json Format output as json.
|
|
252
|
+
|
|
253
|
+
DESCRIPTION
|
|
254
|
+
Installs a plugin into docstar-cli.
|
|
255
|
+
|
|
256
|
+
Uses npm to install plugins.
|
|
257
|
+
|
|
258
|
+
Installation of a user-installed plugin will override a core plugin.
|
|
259
|
+
|
|
260
|
+
Use the DOCSTAR_CLI_NPM_LOG_LEVEL environment variable to set the npm loglevel.
|
|
261
|
+
Use the DOCSTAR_CLI_NPM_REGISTRY environment variable to set the npm registry.
|
|
262
|
+
|
|
263
|
+
ALIASES
|
|
264
|
+
$ docstar-cli plugins add
|
|
265
|
+
|
|
266
|
+
EXAMPLES
|
|
267
|
+
Install a plugin from npm registry.
|
|
268
|
+
|
|
269
|
+
$ docstar-cli plugins install myplugin
|
|
270
|
+
|
|
271
|
+
Install a plugin from a github url.
|
|
272
|
+
|
|
273
|
+
$ docstar-cli plugins install https://github.com/someuser/someplugin
|
|
274
|
+
|
|
275
|
+
Install a plugin from a github slug.
|
|
276
|
+
|
|
277
|
+
$ docstar-cli plugins install someuser/someplugin
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/install.ts)_
|
|
281
|
+
|
|
282
|
+
## `docstar-cli plugins link PATH`
|
|
283
|
+
|
|
284
|
+
Links a plugin into the CLI for development.
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
USAGE
|
|
288
|
+
$ docstar-cli plugins link PATH [-h] [--install] [-v]
|
|
289
|
+
|
|
290
|
+
ARGUMENTS
|
|
291
|
+
PATH [default: .] path to plugin
|
|
292
|
+
|
|
293
|
+
FLAGS
|
|
294
|
+
-h, --help Show CLI help.
|
|
295
|
+
-v, --verbose
|
|
296
|
+
--[no-]install Install dependencies after linking the plugin.
|
|
297
|
+
|
|
298
|
+
DESCRIPTION
|
|
299
|
+
Links a plugin into the CLI for development.
|
|
300
|
+
|
|
301
|
+
Installation of a linked plugin will override a user-installed or core plugin.
|
|
302
|
+
|
|
303
|
+
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
|
304
|
+
command will override the user-installed or core plugin implementation. This is useful for development work.
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
EXAMPLES
|
|
308
|
+
$ docstar-cli plugins link myplugin
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/link.ts)_
|
|
312
|
+
|
|
313
|
+
## `docstar-cli plugins remove [PLUGIN]`
|
|
314
|
+
|
|
315
|
+
Removes a plugin from the CLI.
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
USAGE
|
|
319
|
+
$ docstar-cli plugins remove [PLUGIN...] [-h] [-v]
|
|
320
|
+
|
|
321
|
+
ARGUMENTS
|
|
322
|
+
[PLUGIN...] plugin to uninstall
|
|
323
|
+
|
|
324
|
+
FLAGS
|
|
325
|
+
-h, --help Show CLI help.
|
|
326
|
+
-v, --verbose
|
|
327
|
+
|
|
328
|
+
DESCRIPTION
|
|
329
|
+
Removes a plugin from the CLI.
|
|
330
|
+
|
|
331
|
+
ALIASES
|
|
332
|
+
$ docstar-cli plugins unlink
|
|
333
|
+
$ docstar-cli plugins remove
|
|
334
|
+
|
|
335
|
+
EXAMPLES
|
|
336
|
+
$ docstar-cli plugins remove myplugin
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## `docstar-cli plugins reset`
|
|
340
|
+
|
|
341
|
+
Remove all user-installed and linked plugins.
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
USAGE
|
|
345
|
+
$ docstar-cli plugins reset [--hard] [--reinstall]
|
|
346
|
+
|
|
347
|
+
FLAGS
|
|
348
|
+
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
|
|
349
|
+
--reinstall Reinstall all plugins after uninstalling.
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/reset.ts)_
|
|
353
|
+
|
|
354
|
+
## `docstar-cli plugins uninstall [PLUGIN]`
|
|
355
|
+
|
|
356
|
+
Removes a plugin from the CLI.
|
|
357
|
+
|
|
358
|
+
```
|
|
359
|
+
USAGE
|
|
360
|
+
$ docstar-cli plugins uninstall [PLUGIN...] [-h] [-v]
|
|
361
|
+
|
|
362
|
+
ARGUMENTS
|
|
363
|
+
[PLUGIN...] plugin to uninstall
|
|
364
|
+
|
|
365
|
+
FLAGS
|
|
366
|
+
-h, --help Show CLI help.
|
|
367
|
+
-v, --verbose
|
|
368
|
+
|
|
369
|
+
DESCRIPTION
|
|
370
|
+
Removes a plugin from the CLI.
|
|
371
|
+
|
|
372
|
+
ALIASES
|
|
373
|
+
$ docstar-cli plugins unlink
|
|
374
|
+
$ docstar-cli plugins remove
|
|
375
|
+
|
|
376
|
+
EXAMPLES
|
|
377
|
+
$ docstar-cli plugins uninstall myplugin
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/uninstall.ts)_
|
|
381
|
+
|
|
382
|
+
## `docstar-cli plugins unlink [PLUGIN]`
|
|
383
|
+
|
|
384
|
+
Removes a plugin from the CLI.
|
|
385
|
+
|
|
386
|
+
```
|
|
387
|
+
USAGE
|
|
388
|
+
$ docstar-cli plugins unlink [PLUGIN...] [-h] [-v]
|
|
389
|
+
|
|
390
|
+
ARGUMENTS
|
|
391
|
+
[PLUGIN...] plugin to uninstall
|
|
392
|
+
|
|
393
|
+
FLAGS
|
|
394
|
+
-h, --help Show CLI help.
|
|
395
|
+
-v, --verbose
|
|
396
|
+
|
|
397
|
+
DESCRIPTION
|
|
398
|
+
Removes a plugin from the CLI.
|
|
399
|
+
|
|
400
|
+
ALIASES
|
|
401
|
+
$ docstar-cli plugins unlink
|
|
402
|
+
$ docstar-cli plugins remove
|
|
403
|
+
|
|
404
|
+
EXAMPLES
|
|
405
|
+
$ docstar-cli plugins unlink myplugin
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## `docstar-cli plugins update`
|
|
409
|
+
|
|
410
|
+
Update installed plugins.
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
USAGE
|
|
414
|
+
$ docstar-cli plugins update [-h] [-v]
|
|
415
|
+
|
|
416
|
+
FLAGS
|
|
417
|
+
-h, --help Show CLI help.
|
|
418
|
+
-v, --verbose
|
|
419
|
+
|
|
420
|
+
DESCRIPTION
|
|
421
|
+
Update installed plugins.
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/update.ts)_
|
|
425
|
+
|
|
426
|
+
## `docstar-cli slack list`
|
|
427
|
+
|
|
428
|
+
List installed APIs for the slack module
|
|
429
|
+
|
|
430
|
+
```
|
|
431
|
+
USAGE
|
|
432
|
+
$ docstar-cli slack list
|
|
433
|
+
|
|
434
|
+
DESCRIPTION
|
|
435
|
+
List installed APIs for the slack module
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
_See code: [src/commands/slack/list.ts](https://github.com/swayammaheshwari/docstar-cli/blob/v0.0.0/src/commands/slack/list.ts)_
|
|
439
|
+
|
|
440
|
+
## `docstar-cli slack send-message-1`
|
|
441
|
+
|
|
442
|
+
send message
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
USAGE
|
|
446
|
+
$ docstar-cli slack send-message-1 [--MY_SECRET_KEY <value>]
|
|
447
|
+
|
|
448
|
+
FLAGS
|
|
449
|
+
--MY_SECRET_KEY=<value> Required parameter
|
|
450
|
+
|
|
451
|
+
DESCRIPTION
|
|
452
|
+
send message
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
_See code: [src/commands/slack/send-message-1.ts](https://github.com/swayammaheshwari/docstar-cli/blob/v0.0.0/src/commands/slack/send-message-1.ts)_
|
|
456
|
+
<!-- commandsstop -->
|
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
package/bin/run.cmd
ADDED
package/bin/run.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Hello extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
person: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
from: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
export default class Hello extends Command {
|
|
3
|
+
static args = {
|
|
4
|
+
person: Args.string({ description: 'Person to say hello to', required: true }),
|
|
5
|
+
};
|
|
6
|
+
static description = 'Say hello';
|
|
7
|
+
static examples = [
|
|
8
|
+
`<%= config.bin %> <%= command.id %> friend --from oclif
|
|
9
|
+
hello friend from oclif! (./src/commands/hello/index.ts)
|
|
10
|
+
`,
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
from: Flags.string({ char: 'f', description: 'Who is saying hello', required: true }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(Hello);
|
|
17
|
+
this.log(`hello ${args.person} from ${flags.from}! (./src/commands/hello/index.ts)`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class World extends Command {
|
|
3
|
+
static args = {};
|
|
4
|
+
static description = 'Say hello world';
|
|
5
|
+
static examples = [
|
|
6
|
+
`<%= config.bin %> <%= command.id %>
|
|
7
|
+
hello world! (./src/commands/hello/world.ts)
|
|
8
|
+
`,
|
|
9
|
+
];
|
|
10
|
+
static flags = {};
|
|
11
|
+
async run() {
|
|
12
|
+
this.log('hello world! (./src/commands/hello/world.ts)');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Init extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
domain: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
collectionId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { checkbox } from '@inquirer/prompts';
|
|
2
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { generateCommandFile, generateListCommandFile } from '../lib/codegen.js';
|
|
5
|
+
import { configDir, configPath, modulePath } from '../lib/paths.js';
|
|
6
|
+
const buildBaseUrl = (domain) => {
|
|
7
|
+
if (domain.startsWith('http://') || domain.startsWith('https://'))
|
|
8
|
+
return domain.replace(/\/$/, '');
|
|
9
|
+
const isLocal = domain.includes('localhost') || domain.includes('127.0.0.1');
|
|
10
|
+
return `${isLocal ? 'http' : 'https'}://${domain}`;
|
|
11
|
+
};
|
|
12
|
+
const fetchJson = async (url) => {
|
|
13
|
+
const response = await fetch(url);
|
|
14
|
+
if (!response.ok)
|
|
15
|
+
throw new Error(`Request to ${url} failed (${response.status} ${response.statusText})`);
|
|
16
|
+
return (await response.json());
|
|
17
|
+
};
|
|
18
|
+
export default class Init extends Command {
|
|
19
|
+
static args = {
|
|
20
|
+
domain: Args.string({ description: 'DocStar docs domain, e.g. docs.msg91.com or localhost:3000', required: true }),
|
|
21
|
+
};
|
|
22
|
+
static description = 'Discover published modules for a DocStar docs site, pick which ones to install, and register their CLI commands';
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %> docs.msg91.com',
|
|
25
|
+
'<%= config.bin %> <%= command.id %> localhost:3000 --collectionId paM4R4A26Hvb',
|
|
26
|
+
];
|
|
27
|
+
static flags = {
|
|
28
|
+
collectionId: Flags.string({ description: 'Collection id (required when the domain is not a custom domain, e.g. localhost)' }),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { args, flags } = await this.parse(Init);
|
|
32
|
+
const baseUrl = buildBaseUrl(args.domain);
|
|
33
|
+
const listUrl = new URL('/p/module.json', baseUrl);
|
|
34
|
+
if (flags.collectionId)
|
|
35
|
+
listUrl.searchParams.set('collectionId', flags.collectionId);
|
|
36
|
+
this.log(`Fetching modules from ${listUrl.toString()} ...`);
|
|
37
|
+
const listResponse = await fetchJson(listUrl.toString());
|
|
38
|
+
if (!listResponse.modules || listResponse.modules.length === 0) {
|
|
39
|
+
this.log('No published modules found.');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const selectedPaths = await checkbox({
|
|
43
|
+
choices: listResponse.modules.map((module) => ({ checked: true, name: `${module.name} (${module.path})`, value: module.path })),
|
|
44
|
+
message: 'Select modules to install (space to toggle, enter to confirm)',
|
|
45
|
+
});
|
|
46
|
+
if (selectedPaths.length === 0) {
|
|
47
|
+
this.log('No modules selected, nothing installed.');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
await mkdir(configDir(), { recursive: true });
|
|
51
|
+
const selectedModules = [];
|
|
52
|
+
for (const path of selectedPaths) {
|
|
53
|
+
const moduleUrl = new URL(`/p/${path}/module.json`, baseUrl);
|
|
54
|
+
if (flags.collectionId)
|
|
55
|
+
moduleUrl.searchParams.set('collectionId', flags.collectionId);
|
|
56
|
+
this.log(`Fetching ${path} ...`);
|
|
57
|
+
const moduleJson = await fetchJson(moduleUrl.toString());
|
|
58
|
+
await mkdir(configDir() + '/modules', { recursive: true });
|
|
59
|
+
await writeFile(modulePath(path), JSON.stringify(moduleJson, null, 2));
|
|
60
|
+
for (const endpoint of moduleJson.endpoints) {
|
|
61
|
+
const filePath = await generateCommandFile(this.config.root, path, endpoint);
|
|
62
|
+
this.log(` registered command: ${this.config.bin} ${path} ${endpoint.cli.command.name} -> ${filePath}`);
|
|
63
|
+
}
|
|
64
|
+
await generateListCommandFile(this.config.root, path);
|
|
65
|
+
this.log(` registered command: ${this.config.bin} ${path} list`);
|
|
66
|
+
selectedModules.push({ name: moduleJson.module.name, path });
|
|
67
|
+
}
|
|
68
|
+
const savedConfig = {
|
|
69
|
+
baseUrl,
|
|
70
|
+
collection: listResponse.collection ?? null,
|
|
71
|
+
collectionId: flags.collectionId ?? null,
|
|
72
|
+
domain: args.domain,
|
|
73
|
+
modules: selectedModules,
|
|
74
|
+
updatedAt: new Date().toISOString(),
|
|
75
|
+
};
|
|
76
|
+
await writeFile(configPath(), JSON.stringify(savedConfig, null, 2));
|
|
77
|
+
this.log(`\nInstalled ${selectedModules.length} module(s). Config saved to ${configPath()}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {Command} from '@oclif/core'
|
|
2
|
+
import {loadModule} from '../../lib/http.js'
|
|
3
|
+
|
|
4
|
+
export default class GeneratedList extends Command {
|
|
5
|
+
static description = 'List installed APIs for the slack module'
|
|
6
|
+
|
|
7
|
+
async run() {
|
|
8
|
+
const moduleJson = await loadModule('slack')
|
|
9
|
+
|
|
10
|
+
for (const endpoint of moduleJson.endpoints) {
|
|
11
|
+
const {cli} = endpoint
|
|
12
|
+
this.log(`${cli.command.name}${cli.command.aliases.filter((alias) => alias !== cli.command.name).length > 0 ? ` (aliases: ${cli.command.aliases.filter((alias) => alias !== cli.command.name).join(', ')})` : ''}`)
|
|
13
|
+
if (cli.description) this.log(` ${cli.description}`)
|
|
14
|
+
this.log(` ${endpoint.method}`)
|
|
15
|
+
if (cli.parameters.required.length > 0) this.log(` required: ${cli.parameters.required.join(', ')}`)
|
|
16
|
+
if (cli.parameters.optional.length > 0) this.log(` optional: ${cli.parameters.optional.join(', ')}`)
|
|
17
|
+
this.log('')
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {Command, Flags} from '@oclif/core'
|
|
2
|
+
import {executeCliCommand} from '../../lib/http.js'
|
|
3
|
+
import {promptForMissingParams} from '../../lib/prompt.js'
|
|
4
|
+
|
|
5
|
+
const REQUIRED_PARAMS = ["MY_SECRET_KEY"]
|
|
6
|
+
|
|
7
|
+
export default class Generated extends Command {
|
|
8
|
+
static description = "send message"
|
|
9
|
+
static aliases = []
|
|
10
|
+
static flags = {
|
|
11
|
+
'MY_SECRET_KEY': Flags.string({description: 'Required parameter'}),
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async run() {
|
|
15
|
+
const {flags} = await this.parse(Generated)
|
|
16
|
+
const params = {}
|
|
17
|
+
for (const [key, value] of Object.entries(flags)) {
|
|
18
|
+
if (value !== undefined) params[key] = value
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Object.assign(params, await promptForMissingParams(REQUIRED_PARAMS, params))
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const result = await executeCliCommand('slack', 'send-message-1', params)
|
|
25
|
+
this.log(JSON.stringify(result, null, 2))
|
|
26
|
+
} catch (error) {
|
|
27
|
+
this.error(error.message)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EndpointContract } from './types.js';
|
|
2
|
+
export declare const generateCommandFile: (cliRoot: string, modulePathSegment: string, endpoint: EndpointContract) => Promise<string>;
|
|
3
|
+
export declare const generateListCommandFile: (cliRoot: string, modulePathSegment: string) => Promise<string>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const flagLine = (name, required) =>
|
|
4
|
+
// Required params are collected interactively when missing, so the flag itself stays optional to oclif.
|
|
5
|
+
` '${name}': Flags.string({description: '${required ? 'Required' : 'Optional'} parameter'}),`;
|
|
6
|
+
const commandFileContent = (modulePathSegment, endpoint) => {
|
|
7
|
+
const { cli } = endpoint;
|
|
8
|
+
const flagLines = [
|
|
9
|
+
...cli.parameters.required.map((name) => flagLine(name, true)),
|
|
10
|
+
...cli.parameters.optional.map((name) => flagLine(name, false)),
|
|
11
|
+
].join('\n');
|
|
12
|
+
return `import {Command, Flags} from '@oclif/core'
|
|
13
|
+
import {executeCliCommand} from '../../lib/http.js'
|
|
14
|
+
import {promptForMissingParams} from '../../lib/prompt.js'
|
|
15
|
+
|
|
16
|
+
const REQUIRED_PARAMS = ${JSON.stringify(cli.parameters.required)}
|
|
17
|
+
|
|
18
|
+
export default class Generated extends Command {
|
|
19
|
+
static description = ${JSON.stringify(cli.description || `${cli.name} (${modulePathSegment})`)}
|
|
20
|
+
static aliases = ${JSON.stringify(cli.command.aliases.filter((alias) => alias !== cli.name))}
|
|
21
|
+
static flags = {
|
|
22
|
+
${flagLines}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async run() {
|
|
26
|
+
const {flags} = await this.parse(Generated)
|
|
27
|
+
const params = {}
|
|
28
|
+
for (const [key, value] of Object.entries(flags)) {
|
|
29
|
+
if (value !== undefined) params[key] = value
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Object.assign(params, await promptForMissingParams(REQUIRED_PARAMS, params))
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const result = await executeCliCommand('${modulePathSegment}', '${cli.command.name}', params)
|
|
36
|
+
this.log(JSON.stringify(result, null, 2))
|
|
37
|
+
} catch (error) {
|
|
38
|
+
this.error(error.message)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
};
|
|
44
|
+
const listCommandFileContent = (modulePathSegment) => `import {Command} from '@oclif/core'
|
|
45
|
+
import {loadModule} from '../../lib/http.js'
|
|
46
|
+
|
|
47
|
+
export default class GeneratedList extends Command {
|
|
48
|
+
static description = 'List installed APIs for the ${modulePathSegment} module'
|
|
49
|
+
|
|
50
|
+
async run() {
|
|
51
|
+
const moduleJson = await loadModule('${modulePathSegment}')
|
|
52
|
+
|
|
53
|
+
for (const endpoint of moduleJson.endpoints) {
|
|
54
|
+
const {cli} = endpoint
|
|
55
|
+
this.log(\`\${cli.command.name}\${cli.command.aliases.filter((alias) => alias !== cli.command.name).length > 0 ? \` (aliases: \${cli.command.aliases.filter((alias) => alias !== cli.command.name).join(', ')})\` : ''}\`)
|
|
56
|
+
if (cli.description) this.log(\` \${cli.description}\`)
|
|
57
|
+
this.log(\` \${endpoint.method}\`)
|
|
58
|
+
if (cli.parameters.required.length > 0) this.log(\` required: \${cli.parameters.required.join(', ')}\`)
|
|
59
|
+
if (cli.parameters.optional.length > 0) this.log(\` optional: \${cli.parameters.optional.join(', ')}\`)
|
|
60
|
+
this.log('')
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
export const generateCommandFile = async (cliRoot, modulePathSegment, endpoint) => {
|
|
66
|
+
const dir = join(cliRoot, 'dist', 'commands', modulePathSegment);
|
|
67
|
+
await mkdir(dir, { recursive: true });
|
|
68
|
+
const filePath = join(dir, `${endpoint.cli.command.name}.js`);
|
|
69
|
+
await writeFile(filePath, commandFileContent(modulePathSegment, endpoint));
|
|
70
|
+
return filePath;
|
|
71
|
+
};
|
|
72
|
+
export const generateListCommandFile = async (cliRoot, modulePathSegment) => {
|
|
73
|
+
const dir = join(cliRoot, 'dist', 'commands', modulePathSegment);
|
|
74
|
+
await mkdir(dir, { recursive: true });
|
|
75
|
+
const filePath = join(dir, 'list.js');
|
|
76
|
+
await writeFile(filePath, listCommandFileContent(modulePathSegment));
|
|
77
|
+
return filePath;
|
|
78
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EndpointContract, ModuleJson } from './types.js';
|
|
2
|
+
export declare const stripHtml: (value: string | null | undefined) => string;
|
|
3
|
+
export declare const loadModule: (modulePathSegment: string) => Promise<ModuleJson>;
|
|
4
|
+
export declare const findEndpoint: (moduleJson: ModuleJson, commandName: string) => EndpointContract | undefined;
|
|
5
|
+
export declare const executeCliCommand: (modulePathSegment: string, commandName: string, params: Record<string, string>) => Promise<{
|
|
6
|
+
status: number;
|
|
7
|
+
body: unknown;
|
|
8
|
+
}>;
|
package/dist/lib/http.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { modulePath } from './paths.js';
|
|
3
|
+
// Endpoint fields come from a rich-text editor and may be wrapped in
|
|
4
|
+
// `<span text-block="true">...</span>`-style markup; unwrap to the raw value.
|
|
5
|
+
export const stripHtml = (value) => (value ?? '').replaceAll(/<[^>]*>/g, '');
|
|
6
|
+
const substitutePlaceholders = (template, params) => Object.entries(params).reduce((result, [key, value]) => result.replaceAll(`:${key}`, value).replaceAll(`{${key}}`, value).replaceAll(`{{${key}}}`, value), template);
|
|
7
|
+
export const loadModule = async (modulePathSegment) => {
|
|
8
|
+
const raw = await readFile(modulePath(modulePathSegment), 'utf8');
|
|
9
|
+
return JSON.parse(raw);
|
|
10
|
+
};
|
|
11
|
+
export const findEndpoint = (moduleJson, commandName) => moduleJson.endpoints.find((endpoint) => endpoint.cli.command.name === commandName || endpoint.cli.command.aliases.includes(commandName));
|
|
12
|
+
const buildUrl = (endpoint, params) => {
|
|
13
|
+
const baseUrl = stripHtml(endpoint.baseUrl);
|
|
14
|
+
const path = substitutePlaceholders(stripHtml(endpoint.url), params);
|
|
15
|
+
if (/^https?:\/\//.test(path))
|
|
16
|
+
return path;
|
|
17
|
+
return `${baseUrl}${path}`;
|
|
18
|
+
};
|
|
19
|
+
const buildHeaders = (endpoint, params) => {
|
|
20
|
+
const headers = {};
|
|
21
|
+
for (const [rawKey, rawValue] of Object.entries(endpoint.headers || {})) {
|
|
22
|
+
const key = stripHtml(rawKey);
|
|
23
|
+
const value = stripHtml(rawValue?.value ?? rawValue);
|
|
24
|
+
headers[key] = params[key] ?? value;
|
|
25
|
+
}
|
|
26
|
+
return headers;
|
|
27
|
+
};
|
|
28
|
+
const buildBody = (endpoint, params) => {
|
|
29
|
+
const rawValue = endpoint.body?.raw?.value;
|
|
30
|
+
if (endpoint.body?.type !== 'JSON' || !rawValue)
|
|
31
|
+
return undefined;
|
|
32
|
+
let parsed;
|
|
33
|
+
try {
|
|
34
|
+
parsed = JSON.parse(rawValue);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return rawValue;
|
|
38
|
+
}
|
|
39
|
+
for (const [key, value] of Object.entries(params)) {
|
|
40
|
+
if (key in parsed)
|
|
41
|
+
parsed[key] = value;
|
|
42
|
+
}
|
|
43
|
+
return JSON.stringify(parsed);
|
|
44
|
+
};
|
|
45
|
+
export const executeCliCommand = async (modulePathSegment, commandName, params) => {
|
|
46
|
+
const moduleJson = await loadModule(modulePathSegment);
|
|
47
|
+
const endpoint = findEndpoint(moduleJson, commandName);
|
|
48
|
+
if (!endpoint) {
|
|
49
|
+
throw new Error(`No endpoint found for command "${commandName}" in module "${modulePathSegment}"`);
|
|
50
|
+
}
|
|
51
|
+
const url = buildUrl(endpoint, params);
|
|
52
|
+
const headers = buildHeaders(endpoint, params);
|
|
53
|
+
const body = buildBody(endpoint, params);
|
|
54
|
+
const response = await fetch(url, {
|
|
55
|
+
body,
|
|
56
|
+
headers,
|
|
57
|
+
method: endpoint.method,
|
|
58
|
+
});
|
|
59
|
+
const contentType = response.headers.get('content-type') || '';
|
|
60
|
+
const responseBody = contentType.includes('application/json') ? await response.json() : await response.text();
|
|
61
|
+
return { body: responseBody, status: response.status };
|
|
62
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
export const configDir = () => join(homedir(), '.docstar');
|
|
4
|
+
export const configPath = () => join(configDir(), 'config.json');
|
|
5
|
+
export const modulesDir = () => join(configDir(), 'modules');
|
|
6
|
+
export const modulePath = (modulePathSegment) => join(modulesDir(), `${modulePathSegment}.json`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const promptForMissingParams: (required: string[], provided: Record<string, string>) => Promise<Record<string, string>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { input } from '@inquirer/prompts';
|
|
2
|
+
export const promptForMissingParams = async (required, provided) => {
|
|
3
|
+
const collected = {};
|
|
4
|
+
for (const key of required) {
|
|
5
|
+
if (provided[key] !== undefined)
|
|
6
|
+
continue;
|
|
7
|
+
// eslint-disable-next-line no-await-in-loop
|
|
8
|
+
collected[key] = await input({ message: `Enter value for ${key}` });
|
|
9
|
+
}
|
|
10
|
+
return collected;
|
|
11
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type CliCommandMeta = {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
command: {
|
|
5
|
+
name: string;
|
|
6
|
+
aliases: string[];
|
|
7
|
+
};
|
|
8
|
+
version: number;
|
|
9
|
+
parameters: {
|
|
10
|
+
required: string[];
|
|
11
|
+
optional: string[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type EndpointContract = {
|
|
15
|
+
cli: CliCommandMeta;
|
|
16
|
+
method: string;
|
|
17
|
+
url: string;
|
|
18
|
+
baseUrl: string | null;
|
|
19
|
+
headers: Record<string, any>;
|
|
20
|
+
params: Record<string, any>;
|
|
21
|
+
pathVariables: Record<string, any>;
|
|
22
|
+
body: any;
|
|
23
|
+
authentication: Record<string, any>;
|
|
24
|
+
description: string;
|
|
25
|
+
sampleResponse: any;
|
|
26
|
+
};
|
|
27
|
+
export type ModuleJson = {
|
|
28
|
+
module: {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
};
|
|
33
|
+
endpoints: EndpointContract[];
|
|
34
|
+
};
|
|
35
|
+
export type ModuleSummary = {
|
|
36
|
+
name: string;
|
|
37
|
+
path: string;
|
|
38
|
+
};
|
|
39
|
+
export type SavedConfig = {
|
|
40
|
+
baseUrl: string;
|
|
41
|
+
domain: string;
|
|
42
|
+
collectionId: string | null;
|
|
43
|
+
collection: {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
} | null;
|
|
47
|
+
modules: ModuleSummary[];
|
|
48
|
+
updatedAt: string;
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commands": {
|
|
3
|
+
"init": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {
|
|
6
|
+
"domain": {
|
|
7
|
+
"description": "DocStar docs domain, e.g. docs.msg91.com or localhost:3000",
|
|
8
|
+
"name": "domain",
|
|
9
|
+
"required": true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"description": "Discover published modules for a DocStar docs site, pick which ones to install, and register their CLI commands",
|
|
13
|
+
"examples": [
|
|
14
|
+
"<%= config.bin %> <%= command.id %> docs.msg91.com",
|
|
15
|
+
"<%= config.bin %> <%= command.id %> localhost:3000 --collectionId paM4R4A26Hvb"
|
|
16
|
+
],
|
|
17
|
+
"flags": {
|
|
18
|
+
"collectionId": {
|
|
19
|
+
"description": "Collection id (required when the domain is not a custom domain, e.g. localhost)",
|
|
20
|
+
"name": "collectionId",
|
|
21
|
+
"hasDynamicHelp": false,
|
|
22
|
+
"multiple": false,
|
|
23
|
+
"type": "option"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"hasDynamicHelp": false,
|
|
27
|
+
"hiddenAliases": [],
|
|
28
|
+
"id": "init",
|
|
29
|
+
"pluginAlias": "docstar-cli",
|
|
30
|
+
"pluginName": "docstar-cli",
|
|
31
|
+
"pluginType": "core",
|
|
32
|
+
"strict": true,
|
|
33
|
+
"enableJsonFlag": false,
|
|
34
|
+
"isESM": true,
|
|
35
|
+
"relativePath": [
|
|
36
|
+
"dist",
|
|
37
|
+
"commands",
|
|
38
|
+
"init.js"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"slack:list": {
|
|
42
|
+
"aliases": [],
|
|
43
|
+
"args": {},
|
|
44
|
+
"description": "List installed APIs for the slack module",
|
|
45
|
+
"flags": {},
|
|
46
|
+
"hasDynamicHelp": false,
|
|
47
|
+
"hiddenAliases": [],
|
|
48
|
+
"id": "slack:list",
|
|
49
|
+
"pluginAlias": "docstar-cli",
|
|
50
|
+
"pluginName": "docstar-cli",
|
|
51
|
+
"pluginType": "core",
|
|
52
|
+
"strict": true,
|
|
53
|
+
"enableJsonFlag": false,
|
|
54
|
+
"isESM": true,
|
|
55
|
+
"relativePath": [
|
|
56
|
+
"dist",
|
|
57
|
+
"commands",
|
|
58
|
+
"slack",
|
|
59
|
+
"list.js"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"slack:send-message-1": {
|
|
63
|
+
"aliases": [],
|
|
64
|
+
"args": {},
|
|
65
|
+
"description": "send message",
|
|
66
|
+
"flags": {
|
|
67
|
+
"MY_SECRET_KEY": {
|
|
68
|
+
"description": "Required parameter",
|
|
69
|
+
"name": "MY_SECRET_KEY",
|
|
70
|
+
"hasDynamicHelp": false,
|
|
71
|
+
"multiple": false,
|
|
72
|
+
"type": "option"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"hasDynamicHelp": false,
|
|
76
|
+
"hiddenAliases": [],
|
|
77
|
+
"id": "slack:send-message-1",
|
|
78
|
+
"pluginAlias": "docstar-cli",
|
|
79
|
+
"pluginName": "docstar-cli",
|
|
80
|
+
"pluginType": "core",
|
|
81
|
+
"strict": true,
|
|
82
|
+
"enableJsonFlag": false,
|
|
83
|
+
"isESM": true,
|
|
84
|
+
"relativePath": [
|
|
85
|
+
"dist",
|
|
86
|
+
"commands",
|
|
87
|
+
"slack",
|
|
88
|
+
"send-message-1.js"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"hello": {
|
|
92
|
+
"aliases": [],
|
|
93
|
+
"args": {
|
|
94
|
+
"person": {
|
|
95
|
+
"description": "Person to say hello to",
|
|
96
|
+
"name": "person",
|
|
97
|
+
"required": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"description": "Say hello",
|
|
101
|
+
"examples": [
|
|
102
|
+
"<%= config.bin %> <%= command.id %> friend --from oclif\nhello friend from oclif! (./src/commands/hello/index.ts)\n"
|
|
103
|
+
],
|
|
104
|
+
"flags": {
|
|
105
|
+
"from": {
|
|
106
|
+
"char": "f",
|
|
107
|
+
"description": "Who is saying hello",
|
|
108
|
+
"name": "from",
|
|
109
|
+
"required": true,
|
|
110
|
+
"hasDynamicHelp": false,
|
|
111
|
+
"multiple": false,
|
|
112
|
+
"type": "option"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"hasDynamicHelp": false,
|
|
116
|
+
"hiddenAliases": [],
|
|
117
|
+
"id": "hello",
|
|
118
|
+
"pluginAlias": "docstar-cli",
|
|
119
|
+
"pluginName": "docstar-cli",
|
|
120
|
+
"pluginType": "core",
|
|
121
|
+
"strict": true,
|
|
122
|
+
"enableJsonFlag": false,
|
|
123
|
+
"isESM": true,
|
|
124
|
+
"relativePath": [
|
|
125
|
+
"dist",
|
|
126
|
+
"commands",
|
|
127
|
+
"hello",
|
|
128
|
+
"index.js"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"hello:world": {
|
|
132
|
+
"aliases": [],
|
|
133
|
+
"args": {},
|
|
134
|
+
"description": "Say hello world",
|
|
135
|
+
"examples": [
|
|
136
|
+
"<%= config.bin %> <%= command.id %>\nhello world! (./src/commands/hello/world.ts)\n"
|
|
137
|
+
],
|
|
138
|
+
"flags": {},
|
|
139
|
+
"hasDynamicHelp": false,
|
|
140
|
+
"hiddenAliases": [],
|
|
141
|
+
"id": "hello:world",
|
|
142
|
+
"pluginAlias": "docstar-cli",
|
|
143
|
+
"pluginName": "docstar-cli",
|
|
144
|
+
"pluginType": "core",
|
|
145
|
+
"strict": true,
|
|
146
|
+
"enableJsonFlag": false,
|
|
147
|
+
"isESM": true,
|
|
148
|
+
"relativePath": [
|
|
149
|
+
"dist",
|
|
150
|
+
"commands",
|
|
151
|
+
"hello",
|
|
152
|
+
"world.js"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"version": "0.0.0"
|
|
157
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docstar-cli",
|
|
3
|
+
"description": "A new CLI generated with oclif",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"author": "Swayam Maheshwari",
|
|
6
|
+
"bin": {
|
|
7
|
+
"docstar-cli": "./bin/run.js"
|
|
8
|
+
},
|
|
9
|
+
"bugs": "https://github.com/swayammaheshwari/docstar-cli/issues",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@inquirer/prompts": "^8.5.2",
|
|
12
|
+
"@oclif/core": "^4",
|
|
13
|
+
"@oclif/plugin-help": "^6",
|
|
14
|
+
"@oclif/plugin-plugins": "^5"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@eslint/compat": "^1",
|
|
18
|
+
"@oclif/prettier-config": "^0.2.1",
|
|
19
|
+
"@oclif/test": "^4",
|
|
20
|
+
"@types/chai": "^4",
|
|
21
|
+
"@types/mocha": "^10",
|
|
22
|
+
"@types/node": "^18",
|
|
23
|
+
"chai": "^4",
|
|
24
|
+
"eslint": "^9",
|
|
25
|
+
"eslint-config-oclif": "^6",
|
|
26
|
+
"eslint-config-prettier": "^10",
|
|
27
|
+
"mocha": "^11",
|
|
28
|
+
"oclif": "^4",
|
|
29
|
+
"shx": "^0.3.3",
|
|
30
|
+
"ts-node": "^10",
|
|
31
|
+
"typescript": "^5"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.0.0"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"./bin",
|
|
38
|
+
"./dist",
|
|
39
|
+
"./oclif.manifest.json"
|
|
40
|
+
],
|
|
41
|
+
"homepage": "https://github.com/swayammaheshwari/docstar-cli",
|
|
42
|
+
"keywords": [
|
|
43
|
+
"oclif"
|
|
44
|
+
],
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"main": "dist/index.js",
|
|
47
|
+
"type": "module",
|
|
48
|
+
"oclif": {
|
|
49
|
+
"bin": "docstar-cli",
|
|
50
|
+
"dirname": "docstar-cli",
|
|
51
|
+
"commands": "./dist/commands",
|
|
52
|
+
"plugins": [
|
|
53
|
+
"@oclif/plugin-help",
|
|
54
|
+
"@oclif/plugin-plugins"
|
|
55
|
+
],
|
|
56
|
+
"topicSeparator": " ",
|
|
57
|
+
"topics": {
|
|
58
|
+
"hello": {
|
|
59
|
+
"description": "Say hello to the world and others"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"repository": "swayammaheshwari/docstar-cli",
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "shx rm -rf dist && tsc -b",
|
|
66
|
+
"lint": "eslint",
|
|
67
|
+
"postpack": "shx rm -f oclif.manifest.json",
|
|
68
|
+
"posttest": "npm run lint",
|
|
69
|
+
"prepack": "oclif manifest && oclif readme",
|
|
70
|
+
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
71
|
+
"version": "oclif readme && git add README.md"
|
|
72
|
+
},
|
|
73
|
+
"types": "dist/index.d.ts"
|
|
74
|
+
}
|