Skip to content

Commit a6d94dd

Browse files
Akshat DubeyAkshat Dubey
authored andcommitted
feat(cli): add more details for arguments mcp description
GH-0
1 parent 758fd5d commit a6d94dd

5 files changed

Lines changed: 30 additions & 5 deletions

File tree

packages/cli/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ npm install -g @sourceloop/cli
2121
$ sl COMMAND
2222
running command...
2323
$ sl (-v|--version|version)
24-
@sourceloop/cli/10.0.0 darwin-arm64 node-v20.19.2
24+
@sourceloop/cli/10.0.0 linux-x64 node-v20.19.2
2525
$ sl --help [COMMAND]
2626
USAGE
2727
$ sl COMMAND
@@ -135,6 +135,16 @@ USAGE
135135
136136
OPTIONS
137137
--help show manual pages
138+
139+
DESCRIPTION
140+
Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by
141+
the MCP client to interact with the CLI commands.
142+
You can use it using the following MCP server configuration:
143+
"sourceloop": {
144+
"command": "npx",
145+
"args": ["@sourceloop/cli", "mcp"],
146+
"timeout": 300
147+
}
138148
```
139149

140150
_See code: [src/commands/mcp.ts](https://github.com/sourcefuse/loopback4-microservice-catalog/blob/v10.0.0/src/commands/mcp.ts)_

packages/cli/src/commands/cdk.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class Cdk extends Base<CdkOptions> {
1818
Use this command to add arc-cdk to your project.
1919
The arc-cdk is a library that provides a set of tools and utilities to help you build and deploy your applications on AWS using the AWS Cloud Development Kit (CDK).
2020
It provides a set of constructs that can be used to build and deploy your applications on AWS using the AWS CDK.
21+
Refer existing service if any for discovering the parameters not provided by the user, or ask the user directly
2122
`;
2223
static readonly flags = {
2324
help: flags.boolean({

packages/cli/src/commands/extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export class Extension extends Base<ExtensionOptions> {
1717
It can also be used to create reusable components that can be shared across multiple services or facades.
1818
The package will be created in the packages folder of the monorepo.
1919
You can use 'npm install @local/<package-name>' to install the package in other modules of the monorepo.
20+
You can not update existing packages using this.
21+
Refer existing packages if any for discovering the parameters not provided by the user, or ask the user directly
2022
`;
2123

2224
static readonly mcpFlags = {

packages/cli/src/commands/mcp.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@ export class Mcp extends Base<{}> {
3636
this.commands = [Cdk, Extension, Microservice, Scaffold, Update];
3737
}
3838
}
39-
static readonly description =
40-
'Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by the MCP client to interact with the CLI commands.';
39+
static readonly description = `
40+
Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by the MCP client to interact with the CLI commands.
41+
You can use it using the following MCP server configuration:
42+
"sourceloop": {
43+
"command": "npx",
44+
"args": ["@sourceloop/cli", "mcp"],
45+
"timeout": 300
46+
}
47+
`;
4148

4249
static readonly flags = {
4350
help: flags.boolean({
@@ -152,17 +159,20 @@ export class Mcp extends Base<{}> {
152159
switch (true) {
153160
case flag.type === 'boolean':
154161
option = z.boolean().optional();
162+
description += ` (ask user for this value if not provided)`;
155163
option = option.default((flag.default as boolean) ?? false);
156164
break;
157165
case this._isOptionFlag(flag) && flag.options !== undefined: {
166+
description += ` (ask user to provide an option if not provided when required, list the options as well)`;
158167
// typescript is not able to infer type
159168
const typedFlag = flag as IOptionFlag<T>;
160169
option = z.enum(typedFlag.options as [string, ...string[]]);
161170
description += ` (options: ${typedFlag.options?.join(', ')})`;
162171
break;
163172
}
164173
case this._isOptionFlag(flag) && flag.options === undefined:
165-
option = z.string();
174+
description += ` (ask user for this value if not provided)`;
175+
option = z.string().optional();
166176
break;
167177
default:
168178
throw new Error(

packages/cli/src/commands/microservice.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export class Microservice extends Base<MicroserviceOptions> {
1717
The generated microservice can be used as a standalone service or as a facade in the monorepo.
1818
It can also generate migrations for the same microservice.
1919
The microservice will be created in the services or facades folder of the monorepo depending on the options passed.
20-
It can also generate datasource and import migrations from the ARC services code.`;
20+
It can also generate datasource and import migrations from the ARC services code. It can not update existing services or facades,
21+
for example, you can not run it again just with migration option as it would fail, saying the service already exists.
22+
Refer existing service if any for discovering the parameters not provided by the user, or ask the user directly`;
2123
static readonly mcpFlags = {
2224
workingDir: flags.string({
2325
name: 'workingDir',

0 commit comments

Comments
 (0)