@tsed/cli 7.0.0-beta.2 → 7.0.0-beta.4
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/lib/esm/bin/tsed.js +3 -1
- package/lib/esm/commands/add/AddCmd.js +2 -1
- package/lib/esm/commands/generate/GenerateCmd.js +2 -1
- package/lib/esm/commands/index.js +3 -1
- package/lib/esm/commands/init/InitCmd.js +16 -109
- package/lib/esm/commands/init/InitOptionsCmd.js +17 -0
- package/lib/esm/commands/init/config/FeaturesPrompt.js +29 -29
- package/lib/esm/commands/init/config/InitSchema.js +308 -0
- package/lib/esm/commands/mcp/McpCommand.js +15 -0
- package/lib/esm/commands/mcp/resources/index.js +3 -0
- package/lib/esm/commands/mcp/resources/projectInfoResource.js +43 -0
- package/lib/esm/commands/mcp/resources/serverInfoResource.js +40 -0
- package/lib/esm/commands/mcp/schema/InitMCPSchema.js +9 -0
- package/lib/esm/commands/mcp/schema/ProjectPreferencesSchema.js +16 -0
- package/lib/esm/commands/mcp/tools/generateTool.js +105 -0
- package/lib/esm/commands/mcp/tools/getTemplateTool.js +47 -0
- package/lib/esm/commands/mcp/tools/index.js +7 -0
- package/lib/esm/commands/mcp/tools/initProjectTool.js +65 -0
- package/lib/esm/commands/mcp/tools/listTemplatesTool.js +37 -0
- package/lib/esm/commands/mcp/tools/setWorkspaceTool.js +64 -0
- package/lib/esm/commands/run/RunCmd.js +2 -1
- package/lib/esm/commands/template/CreateTemplateCommand.js +2 -1
- package/lib/esm/commands/update/UpdateCmd.js +3 -4
- package/lib/esm/index.js +3 -0
- package/lib/esm/services/CliProjectService.js +4 -2
- package/lib/esm/services/CliStats.js +45 -0
- package/lib/esm/services/CliTemplatesService.js +10 -3
- package/lib/esm/templates/asyncFactory.template.js +4 -3
- package/lib/esm/templates/barrels.template.js +0 -3
- package/lib/esm/templates/command.template.js +1 -0
- package/lib/esm/templates/controller.template.js +7 -0
- package/lib/esm/templates/decorator.template.js +22 -11
- package/lib/esm/templates/dockerfile.template.js +5 -0
- package/lib/esm/templates/exception-filter.template.js +1 -0
- package/lib/esm/templates/factory.template.js +4 -3
- package/lib/esm/templates/index.logger.template.js +0 -1
- package/lib/esm/templates/interceptor.template.js +1 -0
- package/lib/esm/templates/interface.template.js +1 -0
- package/lib/esm/templates/middleware.template.js +14 -4
- package/lib/esm/templates/model.template.js +1 -0
- package/lib/esm/templates/module.template.js +1 -0
- package/lib/esm/templates/pipe.template.js +1 -0
- package/lib/esm/templates/prisma.service.template.js +1 -0
- package/lib/esm/templates/repository.template.js +1 -0
- package/lib/esm/templates/response-filter.template.js +1 -0
- package/lib/esm/templates/service.template.js +1 -0
- package/lib/esm/templates/value.template.js +1 -0
- package/lib/esm/utils/resolveSchema.js +17 -0
- package/lib/esm/utils/summarizeSchema.js +24 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/commands/generate/GenerateCmd.d.ts +38 -1
- package/lib/types/commands/index.d.ts +103 -1
- package/lib/types/commands/init/InitCmd.d.ts +1 -4
- package/lib/types/commands/init/InitOptionsCmd.d.ts +52 -0
- package/lib/types/commands/init/config/FeaturesPrompt.d.ts +25 -25
- package/lib/types/commands/init/config/InitSchema.d.ts +18 -0
- package/lib/types/commands/mcp/McpCommand.d.ts +52 -0
- package/lib/types/commands/mcp/resources/index.d.ts +2 -0
- package/lib/types/commands/mcp/resources/projectInfoResource.d.ts +1 -0
- package/lib/types/commands/mcp/resources/serverInfoResource.d.ts +1 -0
- package/lib/types/commands/mcp/schema/InitMCPSchema.d.ts +5 -0
- package/lib/types/commands/mcp/schema/ProjectPreferencesSchema.d.ts +9 -0
- package/lib/types/commands/mcp/tools/generateTool.d.ts +94 -0
- package/lib/types/commands/mcp/tools/getTemplateTool.d.ts +92 -0
- package/lib/types/commands/mcp/tools/index.d.ts +2 -0
- package/lib/types/commands/mcp/tools/initProjectTool.d.ts +94 -0
- package/lib/types/commands/mcp/tools/listTemplatesTool.d.ts +92 -0
- package/lib/types/commands/mcp/tools/setWorkspaceTool.d.ts +97 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/interfaces/InitCmdOptions.d.ts +1 -1
- package/lib/types/pipes/SymbolNamePipe.d.ts +1 -1
- package/lib/types/services/CliStats.d.ts +36 -0
- package/lib/types/services/CliTemplatesService.d.ts +5 -4
- package/lib/types/templates/asyncFactory.template.d.ts +1 -0
- package/lib/types/templates/barrels.template.d.ts +1 -0
- package/lib/types/templates/command.template.d.ts +1 -0
- package/lib/types/templates/config.template.d.ts +1 -0
- package/lib/types/templates/controller.template.d.ts +1 -0
- package/lib/types/templates/decorator.template.d.ts +1 -0
- package/lib/types/templates/docker-compose.template.d.ts +1 -0
- package/lib/types/templates/exception-filter.template.d.ts +1 -0
- package/lib/types/templates/factory.template.d.ts +1 -0
- package/lib/types/templates/index.command.template.d.ts +1 -0
- package/lib/types/templates/index.config.utils.template.d.ts +1 -0
- package/lib/types/templates/index.controller.template.d.ts +1 -0
- package/lib/types/templates/index.logger.template.d.ts +3 -2
- package/lib/types/templates/index.template.d.ts +1 -0
- package/lib/types/templates/interceptor.template.d.ts +1 -0
- package/lib/types/templates/interface.template.d.ts +1 -0
- package/lib/types/templates/middleware.template.d.ts +1 -0
- package/lib/types/templates/model.template.d.ts +1 -0
- package/lib/types/templates/module.template.d.ts +1 -0
- package/lib/types/templates/pipe.template.d.ts +1 -0
- package/lib/types/templates/prisma.service.template.d.ts +1 -0
- package/lib/types/templates/readme.template.d.ts +1 -0
- package/lib/types/templates/repository.template.d.ts +1 -0
- package/lib/types/templates/response-filter.template.d.ts +1 -0
- package/lib/types/templates/server.template.d.ts +1 -0
- package/lib/types/templates/service.template.d.ts +1 -0
- package/lib/types/templates/tsconfig.spec.template.d.ts +1 -0
- package/lib/types/templates/value.template.d.ts +1 -0
- package/lib/types/utils/defineTemplate.d.ts +11 -0
- package/lib/types/utils/resolveSchema.d.ts +2 -0
- package/lib/types/utils/summarizeSchema.d.ts +8 -0
- package/package.json +12 -11
- package/lib/esm/commands/init/config/InitFileSchema.js +0 -49
- package/lib/types/commands/init/config/InitFileSchema.d.ts +0 -49
|
@@ -9,6 +9,7 @@ declare const _default: import("@tsed/di").FactoryTokenProvider<{
|
|
|
9
9
|
hidden?: boolean;
|
|
10
10
|
preserveCase?: boolean;
|
|
11
11
|
preserveDirectory?: boolean;
|
|
12
|
+
schema?: import("@tsed/schema").JsonSchema;
|
|
12
13
|
render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
|
|
13
14
|
prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
|
|
14
15
|
hooks?: import("@tsed/di").ProviderOpts["hooks"];
|
|
@@ -9,6 +9,7 @@ declare const _default: import("@tsed/di").FactoryTokenProvider<{
|
|
|
9
9
|
hidden?: boolean;
|
|
10
10
|
preserveCase?: boolean;
|
|
11
11
|
preserveDirectory?: boolean;
|
|
12
|
+
schema?: import("@tsed/schema").JsonSchema;
|
|
12
13
|
render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
|
|
13
14
|
prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
|
|
14
15
|
hooks?: import("@tsed/di").ProviderOpts["hooks"];
|
|
@@ -9,6 +9,7 @@ declare const _default: import("@tsed/di").FactoryTokenProvider<{
|
|
|
9
9
|
hidden?: boolean;
|
|
10
10
|
preserveCase?: boolean;
|
|
11
11
|
preserveDirectory?: boolean;
|
|
12
|
+
schema?: import("@tsed/schema").JsonSchema;
|
|
12
13
|
render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
|
|
13
14
|
prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
|
|
14
15
|
hooks?: import("@tsed/di").ProviderOpts["hooks"];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ProviderOpts, type QuestionOptions } from "@tsed/cli-core";
|
|
2
|
+
import type { JsonSchema } from "@tsed/schema";
|
|
2
3
|
import type { GenerateCmdContext } from "../interfaces/index.js";
|
|
3
4
|
import type { TemplateRenderReturnType } from "../services/CliTemplatesService.js";
|
|
4
5
|
export type DefineTemplateOptions = {
|
|
@@ -31,6 +32,11 @@ export type DefineTemplateOptions = {
|
|
|
31
32
|
* If `true` the directory structure will be preserved when generating the file.
|
|
32
33
|
*/
|
|
33
34
|
preserveDirectory?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Optional Ts.ED Schema describing template-specific arguments (exclude global fields like `type` and `name`).
|
|
37
|
+
* Can be provided as a JsonSchema builder result (from @tsed/schema DSL) or any object exposing `toJSON()` to JSON Schema.
|
|
38
|
+
*/
|
|
39
|
+
schema?: JsonSchema;
|
|
34
40
|
render(symbolName: string, data: GenerateCmdContext): Promise<string | undefined | TemplateRenderReturnType> | string | undefined | TemplateRenderReturnType;
|
|
35
41
|
prompts?(data: GenerateCmdContext): QuestionOptions<GenerateCmdContext>[] | Promise<QuestionOptions<GenerateCmdContext>[]>;
|
|
36
42
|
hooks?: ProviderOpts["hooks"];
|
|
@@ -61,6 +67,11 @@ export declare function defineTemplate(opts: DefineTemplateOptions): import("@ts
|
|
|
61
67
|
* If `true` the directory structure will be preserved when generating the file.
|
|
62
68
|
*/
|
|
63
69
|
preserveDirectory?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Optional Ts.ED Schema describing template-specific arguments (exclude global fields like `type` and `name`).
|
|
72
|
+
* Can be provided as a JsonSchema builder result (from @tsed/schema DSL) or any object exposing `toJSON()` to JSON Schema.
|
|
73
|
+
*/
|
|
74
|
+
schema?: JsonSchema;
|
|
64
75
|
render(symbolName: string, data: GenerateCmdContext): Promise<string | undefined | TemplateRenderReturnType> | string | undefined | TemplateRenderReturnType;
|
|
65
76
|
prompts?(data: GenerateCmdContext): QuestionOptions<GenerateCmdContext>[] | Promise<QuestionOptions<GenerateCmdContext>[]>;
|
|
66
77
|
hooks?: ProviderOpts["hooks"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DefineTemplateOptions } from "./defineTemplate.js";
|
|
2
|
+
export declare const summarizeSchema: (tpl: DefineTemplateOptions) => {
|
|
3
|
+
required?: undefined;
|
|
4
|
+
properties?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
required: any;
|
|
7
|
+
properties: Record<string, any> | undefined;
|
|
8
|
+
} | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli",
|
|
3
3
|
"description": "CLI to bootstrap your Ts.ED project",
|
|
4
|
-
"version": "7.0.0-beta.
|
|
4
|
+
"version": "7.0.0-beta.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"source": "./src/index.ts",
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
23
23
|
},
|
|
24
24
|
"bin": {
|
|
25
|
-
"tsed": "lib/esm/bin/tsed.js"
|
|
26
|
-
"tsed-mcp": "lib/esm/bin/tsed-mcp.js"
|
|
25
|
+
"tsed": "lib/esm/bin/tsed.js"
|
|
27
26
|
},
|
|
28
27
|
"files": [
|
|
29
28
|
"lib/esm/bin/tsed.js",
|
|
@@ -46,19 +45,21 @@
|
|
|
46
45
|
"node": ">=14"
|
|
47
46
|
},
|
|
48
47
|
"dependencies": {
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
49
49
|
"@npmcli/run-script": "9.0.0",
|
|
50
50
|
"@swc-node/register": "^1.10.9",
|
|
51
51
|
"@swc/core": "1.7.26",
|
|
52
52
|
"@swc/helpers": "^0.5.13",
|
|
53
|
-
"@tsed/cli-core": "7.0.0-beta.
|
|
54
|
-
"@tsed/
|
|
55
|
-
"@tsed/
|
|
56
|
-
"@tsed/
|
|
53
|
+
"@tsed/cli-core": "7.0.0-beta.4",
|
|
54
|
+
"@tsed/cli-mcp": "7.0.0-beta.4",
|
|
55
|
+
"@tsed/core": ">=8.21.0",
|
|
56
|
+
"@tsed/di": ">=8.21.0",
|
|
57
|
+
"@tsed/hooks": ">=8.21.0",
|
|
57
58
|
"@tsed/logger": ">=8.0.3",
|
|
58
59
|
"@tsed/logger-std": ">=8.0.3",
|
|
59
|
-
"@tsed/normalize-path": ">=8.
|
|
60
|
-
"@tsed/openspec": ">=8.
|
|
61
|
-
"@tsed/schema": ">=8.
|
|
60
|
+
"@tsed/normalize-path": ">=8.21.0",
|
|
61
|
+
"@tsed/openspec": ">=8.21.0",
|
|
62
|
+
"@tsed/schema": ">=8.21.0",
|
|
62
63
|
"chalk": "^5.3.0",
|
|
63
64
|
"change-case": "^5.4.4",
|
|
64
65
|
"consolidate": "^1.0.4",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"tslib": "^2.7.0"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
|
-
"@tsed/typescript": "7.0.0-beta.
|
|
77
|
+
"@tsed/typescript": "7.0.0-beta.4",
|
|
77
78
|
"@types/change-case": "^2.3.1",
|
|
78
79
|
"@types/consolidate": "0.14.4",
|
|
79
80
|
"cross-env": "7.0.3",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
-
import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces/index.js";
|
|
3
|
-
import { FeatureType } from "./FeaturesPrompt.js";
|
|
4
|
-
export const InitFileSchema = {
|
|
5
|
-
type: "object",
|
|
6
|
-
properties: {
|
|
7
|
-
tsedVersion: {
|
|
8
|
-
type: "string"
|
|
9
|
-
},
|
|
10
|
-
projectName: {
|
|
11
|
-
type: "string",
|
|
12
|
-
maxLength: 100
|
|
13
|
-
},
|
|
14
|
-
platform: {
|
|
15
|
-
type: "string",
|
|
16
|
-
description: "The project name. By default, the project is the same as the name directory.",
|
|
17
|
-
enum: Object.values(PlatformType),
|
|
18
|
-
default: PlatformType.EXPRESS
|
|
19
|
-
},
|
|
20
|
-
architecture: {
|
|
21
|
-
type: "string",
|
|
22
|
-
enum: Object.values(ArchitectureConvention),
|
|
23
|
-
default: ArchitectureConvention.DEFAULT
|
|
24
|
-
},
|
|
25
|
-
convention: {
|
|
26
|
-
type: "string",
|
|
27
|
-
enum: Object.values(ProjectConvention),
|
|
28
|
-
default: ProjectConvention.DEFAULT
|
|
29
|
-
},
|
|
30
|
-
features: {
|
|
31
|
-
type: "array",
|
|
32
|
-
items: {
|
|
33
|
-
type: "string",
|
|
34
|
-
enum: Object.values(FeatureType)
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
packageManager: {
|
|
38
|
-
type: "string",
|
|
39
|
-
enum: Object.values(PackageManager),
|
|
40
|
-
default: PackageManager.YARN
|
|
41
|
-
},
|
|
42
|
-
skipPrompt: {
|
|
43
|
-
type: "boolean",
|
|
44
|
-
default: false
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
required: ["features"],
|
|
48
|
-
additionalProperties: true
|
|
49
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
-
import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces/index.js";
|
|
3
|
-
import { FeatureType } from "./FeaturesPrompt.js";
|
|
4
|
-
export declare const InitFileSchema: {
|
|
5
|
-
type: string;
|
|
6
|
-
properties: {
|
|
7
|
-
tsedVersion: {
|
|
8
|
-
type: string;
|
|
9
|
-
};
|
|
10
|
-
projectName: {
|
|
11
|
-
type: string;
|
|
12
|
-
maxLength: number;
|
|
13
|
-
};
|
|
14
|
-
platform: {
|
|
15
|
-
type: string;
|
|
16
|
-
description: string;
|
|
17
|
-
enum: PlatformType[];
|
|
18
|
-
default: PlatformType;
|
|
19
|
-
};
|
|
20
|
-
architecture: {
|
|
21
|
-
type: string;
|
|
22
|
-
enum: ArchitectureConvention[];
|
|
23
|
-
default: ArchitectureConvention;
|
|
24
|
-
};
|
|
25
|
-
convention: {
|
|
26
|
-
type: string;
|
|
27
|
-
enum: ProjectConvention[];
|
|
28
|
-
default: ProjectConvention;
|
|
29
|
-
};
|
|
30
|
-
features: {
|
|
31
|
-
type: string;
|
|
32
|
-
items: {
|
|
33
|
-
type: string;
|
|
34
|
-
enum: FeatureType[];
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
packageManager: {
|
|
38
|
-
type: string;
|
|
39
|
-
enum: PackageManager[];
|
|
40
|
-
default: PackageManager;
|
|
41
|
-
};
|
|
42
|
-
skipPrompt: {
|
|
43
|
-
type: string;
|
|
44
|
-
default: boolean;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
required: string[];
|
|
48
|
-
additionalProperties: boolean;
|
|
49
|
-
};
|