docstar-cli 0.0.0 → 1.0.3

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
@@ -1,456 +1,109 @@
1
- docstar-cli
2
- =================
1
+ # docstar-cli
3
2
 
4
- A new CLI generated with oclif
3
+ A CLI for calling published DocStar API endpoints directly from your terminal, without leaving the shell to read docs. Point it at a DocStar docs site, pick which modules (e.g. "Slack") you want, and it turns each published endpoint into a real command you can run. You can install from multiple docs sites/collections at once — each is kept separate under its own **CLI name**.
5
4
 
5
+ ## Install
6
6
 
7
- [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
8
- [![Version](https://img.shields.io/npm/v/docstar-cli.svg)](https://npmjs.org/package/docstar-cli)
9
- [![Downloads/week](https://img.shields.io/npm/dw/docstar-cli.svg)](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
7
+ ```sh
8
+ npm install
9
+ npm run build
10
+ npm link
204
11
  ```
205
12
 
206
- ## `docstar-cli plugins:inspect PLUGIN...`
13
+ `npm link` puts `docstar-cli` on your PATH. Alternatively, run it without linking via `node ./bin/run.js <command>` from the repo root.
207
14
 
208
- Displays installation properties of a plugin.
15
+ ## Quick start
209
16
 
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.
17
+ ### 1. Discover and install modules
226
18
 
227
- EXAMPLES
228
- $ docstar-cli plugins inspect myplugin
19
+ ```sh
20
+ docstar-cli init docs.msg91.com
229
21
  ```
230
22
 
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.
23
+ For a local/non-custom-domain docs site, pass the collection id explicitly:
236
24
 
25
+ ```sh
26
+ docstar-cli init localhost:3000 --collectionId paM4R4A26Hvb
237
27
  ```
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
28
 
250
- GLOBAL FLAGS
251
- --json Format output as json.
29
+ This fetches the list of published modules for that collection, shows an interactive checklist (all modules pre-checked — press `space` to toggle, `enter` to confirm), and for each selected module:
252
30
 
253
- DESCRIPTION
254
- Installs a plugin into docstar-cli.
31
+ - saves its full endpoint contract to `~/.docstar/modules/<cli-name>/<module>.json`
32
+ - registers a real CLI command for every endpoint: `docstar-cli <cli-name> <module> <command>`
255
33
 
256
- Uses npm to install plugins.
34
+ The **CLI name** comes from the collection's settings (set it under the collection's Domain settings in the docs editor — lowercase letters, numbers, `-` and `_` only; auto-generated from the collection name if not set yet). Running `init` against a different domain/collection adds it alongside any others already installed — nothing gets overwritten.
257
35
 
258
- Installation of a user-installed plugin will override a core plugin.
36
+ Everything is saved to `~/.docstar/config.json`, grouped by collection.
259
37
 
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.
38
+ ### 2. See what's installed
262
39
 
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
40
+ ```sh
41
+ docstar-cli list # every installed collection
42
+ docstar-cli list msg91 # modules installed for the "msg91" collection
43
+ docstar-cli list msg91 slack # Slack's installed endpoints in "msg91"
278
44
  ```
279
45
 
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
46
  ```
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
47
+ send-message-1
48
+ send message
49
+ POST
50
+ required: message
378
51
  ```
379
52
 
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.
53
+ ### 3. Call an endpoint
385
54
 
55
+ ```sh
56
+ docstar-cli msg91 slack send-message-1 --message "hello from the CLI"
386
57
  ```
387
- USAGE
388
- $ docstar-cli plugins unlink [PLUGIN...] [-h] [-v]
389
-
390
- ARGUMENTS
391
- [PLUGIN...] plugin to uninstall
392
58
 
393
- FLAGS
394
- -h, --help Show CLI help.
395
- -v, --verbose
59
+ Or omit required parameters and answer the prompts instead:
396
60
 
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
61
+ ```sh
62
+ docstar-cli msg91 slack send-message-1
63
+ ? Enter value for message
406
64
  ```
407
65
 
408
- ## `docstar-cli plugins update`
66
+ The command prints the response status and body from the actual API call.
409
67
 
410
- Update installed plugins.
411
-
412
- ```
413
- USAGE
414
- $ docstar-cli plugins update [-h] [-v]
68
+ ## Use from an AI client (MCP)
415
69
 
416
- FLAGS
417
- -h, --help Show CLI help.
418
- -v, --verbose
70
+ `docstar-cli` can run as an [MCP](https://modelcontextprotocol.io) server, turning every installed
71
+ endpoint (across all installed collections) into a proper tool an AI client can call directly — no
72
+ shell access required.
419
73
 
420
- DESCRIPTION
421
- Update installed plugins.
74
+ ```sh
75
+ docstar-cli mcp
422
76
  ```
423
77
 
424
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/5.4.87/src/commands/plugins/update.ts)_
78
+ Register it with Claude Code (`.mcp.json`) or Claude Desktop (`claude_desktop_config.json`):
425
79
 
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
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "docstar": {
84
+ "command": "docstar-cli",
85
+ "args": ["mcp"]
86
+ }
87
+ }
88
+ }
436
89
  ```
437
90
 
438
- _See code: [src/commands/slack/list.ts](https://github.com/swayammaheshwari/docstar-cli/blob/v0.0.0/src/commands/slack/list.ts)_
91
+ Each installed endpoint becomes one tool named `<cli-name>__<module>__<command>` (e.g.
92
+ `msg91__slack__send-message-1`), with required/optional parameters exposed in its schema. A prompt
93
+ like "call the slack api and send a message saying hi" resolves directly to that tool call — the
94
+ AI client asks you for any required value it can't infer, exactly like any other MCP tool. Run
95
+ `docstar-cli init` first so there's at least one installed module for `mcp` to expose.
439
96
 
440
- ## `docstar-cli slack send-message-1`
97
+ ## How it works
441
98
 
442
- send message
99
+ - `docstar-cli init` talks to `GET /p/module.json?collectionId=...` (the collection's name, CLI name, and list of modules) and `GET /p/<module>/module.json?collectionId=...` (a module's endpoint contract) on the docs site.
100
+ - Each endpoint's contract (method, url, base url, headers, body, and CLI parameter names) is saved locally and used to build the real HTTP request when you run its command — no network round-trip to the docs site is needed to run a command once a module is installed.
101
+ - Commands are generated as real files on disk under this repo's `dist/commands/<cli-name>/<module>/`, which is why `npm run build` (it wipes `dist/`) requires re-running `docstar-cli init` for each installed collection afterwards to reinstall your modules.
443
102
 
444
- ```
445
- USAGE
446
- $ docstar-cli slack send-message-1 [--MY_SECRET_KEY <value>]
447
-
448
- FLAGS
449
- --MY_SECRET_KEY=<value> Required parameter
103
+ ## Development
450
104
 
451
- DESCRIPTION
452
- send message
105
+ ```sh
106
+ npm run build # compile TypeScript to dist/
107
+ npm run lint # eslint
108
+ npm test # mocha
453
109
  ```
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 -->
@@ -1,14 +1,14 @@
1
1
  import {Command, Flags} from '@oclif/core'
2
- import {executeCliCommand} from '../../lib/http.js'
3
- import {promptForMissingParams} from '../../lib/prompt.js'
2
+ import {executeCliCommand} from '../../../lib/http.js'
3
+ import {promptForMissingParams} from '../../../lib/prompt.js'
4
4
 
5
- const REQUIRED_PARAMS = ["MY_SECRET_KEY"]
5
+ const REQUIRED_PARAMS = ["message"]
6
6
 
7
7
  export default class Generated extends Command {
8
8
  static description = "send message"
9
9
  static aliases = []
10
10
  static flags = {
11
- 'MY_SECRET_KEY': Flags.string({description: 'Required parameter'}),
11
+ 'message': Flags.string({description: 'Required parameter'}),
12
12
  }
13
13
 
14
14
  async run() {
@@ -21,7 +21,7 @@ export default class Generated extends Command {
21
21
  Object.assign(params, await promptForMissingParams(REQUIRED_PARAMS, params))
22
22
 
23
23
  try {
24
- const result = await executeCliCommand('slack', 'send-message-1', params)
24
+ const result = await executeCliCommand('api-collection', 'slack', 'send-message-1', params)
25
25
  this.log(JSON.stringify(result, null, 2))
26
26
  } catch (error) {
27
27
  this.error(error.message)
@@ -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 = ["message"]
6
+
7
+ export default class Generated extends Command {
8
+ static description = "send alert"
9
+ static aliases = []
10
+ static flags = {
11
+ 'message': 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('api-collection-2', 'viasocket', 'send-alert', params)
25
+ this.log(JSON.stringify(result, null, 2))
26
+ } catch (error) {
27
+ this.error(error.message)
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,33 @@
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 = ["query","collectionIds","getUrl","allowNonDomain"]
6
+
7
+ export default class Generated extends Command {
8
+ static description = "Find matches"
9
+ static aliases = []
10
+ static flags = {
11
+ 'query': Flags.string({description: 'Required parameter'}),
12
+ 'collectionIds': Flags.string({description: 'Required parameter'}),
13
+ 'getUrl': Flags.string({description: 'Required parameter'}),
14
+ 'allowNonDomain': Flags.string({description: 'Required parameter'}),
15
+ }
16
+
17
+ async run() {
18
+ const {flags} = await this.parse(Generated)
19
+ const params = {}
20
+ for (const [key, value] of Object.entries(flags)) {
21
+ if (value !== undefined) params[key] = value
22
+ }
23
+
24
+ Object.assign(params, await promptForMissingParams(REQUIRED_PARAMS, params))
25
+
26
+ try {
27
+ const result = await executeCliCommand('docstar-apis', 'public-routes', 'find-matches-1', params)
28
+ this.log(JSON.stringify(result, null, 2))
29
+ } catch (error) {
30
+ this.error(error.message)
31
+ }
32
+ }
33
+ }