mcp-new 1.2.2 → 1.6.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.
Files changed (50) hide show
  1. package/README.md +33 -1
  2. package/dist/{chunk-3JG4FVS2.js → chunk-LJNMSDBU.js} +1157 -212
  3. package/dist/cli.js +1287 -18
  4. package/dist/index.d.ts +43 -10
  5. package/dist/index.js +22 -35
  6. package/package.json +4 -2
  7. package/templates/ci/circleci/config.yml.ejs +219 -0
  8. package/templates/ci/github/ci.yml.ejs +184 -0
  9. package/templates/ci/gitlab/.gitlab-ci.yml.ejs +233 -0
  10. package/templates/csharp/.env.example +6 -0
  11. package/templates/csharp/.gitignore.ejs +53 -0
  12. package/templates/csharp/McpServer.csproj.ejs +19 -0
  13. package/templates/csharp/README.md.ejs +136 -0
  14. package/templates/csharp/src/Program.cs.ejs +117 -0
  15. package/templates/elixir/.env.example +6 -0
  16. package/templates/elixir/.gitignore.ejs +33 -0
  17. package/templates/elixir/README.md.ejs +154 -0
  18. package/templates/elixir/config/config.exs.ejs +9 -0
  19. package/templates/elixir/config/dev.exs.ejs +3 -0
  20. package/templates/elixir/config/prod.exs.ejs +3 -0
  21. package/templates/elixir/lib/application.ex.ejs +19 -0
  22. package/templates/elixir/lib/cli.ex.ejs +17 -0
  23. package/templates/elixir/lib/server.ex.ejs +112 -0
  24. package/templates/elixir/mix.exs.ejs +32 -0
  25. package/templates/java/gradle/.env.example +6 -0
  26. package/templates/java/gradle/.gitignore.ejs +48 -0
  27. package/templates/java/gradle/README.md.ejs +132 -0
  28. package/templates/java/gradle/build.gradle.ejs +46 -0
  29. package/templates/java/gradle/settings.gradle.ejs +1 -0
  30. package/templates/java/gradle/src/main/java/com/example/mcp/McpServer.java.ejs +149 -0
  31. package/templates/java/gradle/src/main/resources/logback.xml +13 -0
  32. package/templates/java/maven/.env.example +6 -0
  33. package/templates/java/maven/.gitignore.ejs +53 -0
  34. package/templates/java/maven/README.md.ejs +131 -0
  35. package/templates/java/maven/pom.xml.ejs +86 -0
  36. package/templates/java/maven/src/main/java/com/example/mcp/McpServer.java.ejs +149 -0
  37. package/templates/java/maven/src/main/resources/logback.xml +13 -0
  38. package/templates/kotlin/gradle/.env.example +6 -0
  39. package/templates/kotlin/gradle/.gitignore.ejs +45 -0
  40. package/templates/kotlin/gradle/README.md.ejs +138 -0
  41. package/templates/kotlin/gradle/build.gradle.kts.ejs +48 -0
  42. package/templates/kotlin/gradle/settings.gradle.kts.ejs +1 -0
  43. package/templates/kotlin/gradle/src/main/kotlin/com/example/mcp/McpServer.kt.ejs +141 -0
  44. package/templates/kotlin/gradle/src/main/resources/logback.xml +13 -0
  45. package/templates/kotlin/maven/.env.example +6 -0
  46. package/templates/kotlin/maven/.gitignore.ejs +50 -0
  47. package/templates/kotlin/maven/README.md.ejs +96 -0
  48. package/templates/kotlin/maven/pom.xml.ejs +105 -0
  49. package/templates/kotlin/maven/src/main/kotlin/com/example/mcp/McpServer.kt.ejs +141 -0
  50. package/templates/kotlin/maven/src/main/resources/logback.xml +13 -0
package/dist/index.d.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const LanguageSchema: z.ZodEnum<["typescript", "python", "go", "rust"]>;
4
- type Language = z.infer<typeof LanguageSchema>;
3
+ declare const BuiltinLanguageSchema: z.ZodEnum<["typescript", "python", "go", "rust", "java", "kotlin", "csharp", "elixir"]>;
4
+ type BuiltinLanguage = z.infer<typeof BuiltinLanguageSchema>;
5
+ declare const LanguageSchema: z.ZodString;
6
+ type Language = string;
7
+ declare const BUILTIN_LANGUAGES: BuiltinLanguage[];
8
+ declare function isBuiltinLanguage(lang: string): lang is BuiltinLanguage;
9
+ declare const JavaBuildToolSchema: z.ZodEnum<["maven", "gradle"]>;
10
+ type JavaBuildTool = z.infer<typeof JavaBuildToolSchema>;
5
11
  declare const TransportSchema: z.ZodEnum<["stdio", "sse"]>;
6
12
  type Transport = z.infer<typeof TransportSchema>;
7
13
  declare const ToolParameterSchema: z.ZodObject<{
@@ -80,7 +86,7 @@ type ResourceConfig = z.infer<typeof ResourceConfigSchema>;
80
86
  declare const ProjectConfigSchema: z.ZodObject<{
81
87
  name: z.ZodString;
82
88
  description: z.ZodDefault<z.ZodString>;
83
- language: z.ZodEnum<["typescript", "python", "go", "rust"]>;
89
+ language: z.ZodString;
84
90
  transport: z.ZodEnum<["stdio", "sse"]>;
85
91
  tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
86
92
  name: z.ZodString;
@@ -139,10 +145,11 @@ declare const ProjectConfigSchema: z.ZodObject<{
139
145
  includeExampleTool: z.ZodDefault<z.ZodBoolean>;
140
146
  skipInstall: z.ZodDefault<z.ZodBoolean>;
141
147
  initGit: z.ZodDefault<z.ZodBoolean>;
148
+ javaBuildTool: z.ZodOptional<z.ZodEnum<["maven", "gradle"]>>;
142
149
  }, "strip", z.ZodTypeAny, {
143
150
  name: string;
144
151
  description: string;
145
- language: "typescript" | "python" | "go" | "rust";
152
+ language: string;
146
153
  transport: "stdio" | "sse";
147
154
  tools: {
148
155
  name: string;
@@ -163,9 +170,10 @@ declare const ProjectConfigSchema: z.ZodObject<{
163
170
  includeExampleTool: boolean;
164
171
  skipInstall: boolean;
165
172
  initGit: boolean;
173
+ javaBuildTool?: "maven" | "gradle" | undefined;
166
174
  }, {
167
175
  name: string;
168
- language: "typescript" | "python" | "go" | "rust";
176
+ language: string;
169
177
  transport: "stdio" | "sse";
170
178
  description?: string | undefined;
171
179
  tools?: {
@@ -187,6 +195,7 @@ declare const ProjectConfigSchema: z.ZodObject<{
187
195
  includeExampleTool?: boolean | undefined;
188
196
  skipInstall?: boolean | undefined;
189
197
  initGit?: boolean | undefined;
198
+ javaBuildTool?: "maven" | "gradle" | undefined;
190
199
  }>;
191
200
  type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
192
201
  interface GeneratorContext {
@@ -201,11 +210,18 @@ interface CLIOptions {
201
210
  python?: boolean;
202
211
  go?: boolean;
203
212
  rust?: boolean;
213
+ java?: boolean;
214
+ kotlin?: boolean;
215
+ csharp?: boolean;
216
+ elixir?: boolean;
217
+ maven?: boolean;
218
+ gradle?: boolean;
204
219
  skipInstall?: boolean;
205
220
  fromOpenapi?: string;
206
221
  fromPrompt?: boolean;
207
222
  preset?: string;
208
223
  yes?: boolean;
224
+ ci?: string;
209
225
  }
210
226
 
211
227
  interface MCPToolInputSchema {
@@ -357,10 +373,14 @@ declare abstract class BaseGenerator {
357
373
  protected renderTemplates(): Promise<void>;
358
374
  protected getTemplateData(): Record<string, unknown>;
359
375
  protected installDependencies(): Promise<void>;
376
+ private installPluginDependencies;
360
377
  private installNodeDependencies;
361
378
  private installPythonDependencies;
362
379
  private installGoDependencies;
363
380
  private installRustDependencies;
381
+ private installJavaDependencies;
382
+ private installDotnetDependencies;
383
+ private installElixirDependencies;
364
384
  private checkCommand;
365
385
  protected initializeGit(): Promise<void>;
366
386
  protected checkOutputDir(): Promise<boolean>;
@@ -397,12 +417,13 @@ declare class PresetGenerator extends BaseGenerator {
397
417
  }
398
418
  interface PresetGeneratorOptions {
399
419
  projectName?: string;
400
- presetId: PresetId;
420
+ presetId: string;
401
421
  language?: Language;
402
422
  skipInstall?: boolean;
403
423
  useDefaults?: boolean;
424
+ javaBuildTool?: JavaBuildTool;
404
425
  }
405
- declare function generateFromPreset(options: PresetGeneratorOptions): Promise<void>;
426
+ declare function generateFromPreset(options: PresetGeneratorOptions): Promise<ProjectConfig>;
406
427
  declare function validatePresetId(presetId: string): presetId is PresetId;
407
428
 
408
429
  declare function parseOpenAPISpec(content: string): Promise<ParsedEndpoint[]>;
@@ -432,7 +453,7 @@ declare const logger: {
432
453
  list: (items: string[]) => void;
433
454
  code: (code: string) => void;
434
455
  box: (title: string, content: string[]) => void;
435
- nextSteps: (projectName: string, language: string) => void;
456
+ nextSteps: (projectName: string, language: string, javaBuildTool?: string) => void;
436
457
  };
437
458
 
438
459
  interface SpinnerInstance {
@@ -486,6 +507,10 @@ declare function renderTemplate(templatePath: string, data: Record<string, unkno
486
507
  declare function renderTemplateToFile(templatePath: string, outputPath: string, data: Record<string, unknown>): Promise<void>;
487
508
  declare function walkDir(dirPath: string, callback: (filePath: string, isDir: boolean) => Promise<void>): Promise<void>;
488
509
  declare function getTemplateDir(): string;
510
+ /**
511
+ * Get the template directory for a language, supporting both built-in and plugin languages.
512
+ */
513
+ declare function getTemplateDirForLanguage(language: string, pluginTemplateDir?: string): string;
489
514
  declare function resolveOutputPath(basePath: string, ...segments: string[]): string;
490
515
 
491
516
  declare function isGitInstalled(): Promise<boolean>;
@@ -518,14 +543,22 @@ declare function promptGenerationMethod(): Promise<GenerationMethod>;
518
543
 
519
544
  declare function promptPreset(): Promise<PresetId>;
520
545
 
546
+ declare function promptJavaBuildTool(): Promise<JavaBuildTool>;
547
+
548
+ declare const CIProviderSchema: z.ZodEnum<["github", "gitlab", "circleci"]>;
549
+ type CIProvider = z.infer<typeof CIProviderSchema>;
550
+
551
+ declare function promptCIProvider(): Promise<CIProvider>;
552
+
521
553
  interface WizardOptions {
522
554
  defaultName?: string;
523
555
  skipDescription?: boolean;
524
556
  skipAdvanced?: boolean;
525
557
  presetLanguage?: Language;
558
+ presetJavaBuildTool?: JavaBuildTool;
526
559
  }
527
560
  declare function runWizard(options?: WizardOptions): Promise<ProjectConfig>;
528
- declare function runQuickWizard(defaultName?: string, presetLanguage?: Language): Promise<ProjectConfig>;
561
+ declare function runQuickWizard(defaultName?: string, presetLanguage?: Language, presetJavaBuildTool?: JavaBuildTool): Promise<ProjectConfig>;
529
562
 
530
563
  declare function createCommand(projectName: string | undefined, options: CLIOptions): Promise<void>;
531
564
 
@@ -544,4 +577,4 @@ interface AddToolOptions {
544
577
  }
545
578
  declare function addToolCommand(options: AddToolOptions): Promise<void>;
546
579
 
547
- export { BaseGenerator, type CLIOptions, type GenerationMethod, type GeneratorContext, type Language, LanguageSchema, type MCPPrompt, type MCPPromptArgument, type MCPPropertySchema, type MCPResource, type MCPServerCapabilities, type MCPServerInfo, type MCPTool, type MCPToolInputSchema, type OpenAPIComponents, OpenAPIGenerator, type OpenAPIInfo, type OpenAPIMediaType, type OpenAPIOperation, type OpenAPIParameter, type OpenAPIPathItem, type OpenAPIRequestBody, type OpenAPIResponse, type OpenAPISchema, type OpenAPIServer, type OpenAPISpec, type ParsedEndpoint, type ParsedParameter, type ParsedRequestBody, PresetGenerator, type PresetGeneratorOptions, type PresetId$1 as PresetId, PresetIdSchema, type ProjectConfig, ProjectConfigSchema, PromptGenerator, type ResourceConfig, ResourceConfigSchema, type SpinnerInstance, type ToolConfig, ToolConfigSchema, type ToolParameter, ToolParameterSchema, type Transport, TransportSchema, WizardGenerator, type WizardOptions, addToolCommand, copyDir, copyFile, createCommand, createGeneratorContext, createInitialCommit, createSpinner, endpointToMCPTool, ensureDir, exists, generateFromOpenAPI, generateFromPreset, generateFromPrompt, generateFromWizard, getGitUser, getTemplateDir, initCommand, initGitRepository, isDirectory, isGitInstalled, isInsideGitRepository, logger, parseAndValidate, parseOpenAPISpec, parsePostmanCollection, parseSwaggerSpec, projectNameRegex, promptAddResources, promptAddTools, promptGenerationMethod, promptIncludeExampleTool, promptLanguage, promptMultipleResources, promptMultipleTools, promptPreset, promptProjectDescription, promptProjectName, promptResourceConfig, promptToolConfig, promptTransport, readDir, readFile, remove, renderTemplate, renderTemplateToFile, resolveOutputPath, runQuickWizard, runWizard, safeParseAndValidate, selectEndpoints, validateFilePath, validatePresetId, validateProjectName, validateToolName, validateUrl, walkDir, withSpinner, writeFile };
580
+ export { BUILTIN_LANGUAGES, BaseGenerator, type BuiltinLanguage, BuiltinLanguageSchema, type CLIOptions, type GenerationMethod, type GeneratorContext, type JavaBuildTool, JavaBuildToolSchema, type Language, LanguageSchema, type MCPPrompt, type MCPPromptArgument, type MCPPropertySchema, type MCPResource, type MCPServerCapabilities, type MCPServerInfo, type MCPTool, type MCPToolInputSchema, type OpenAPIComponents, OpenAPIGenerator, type OpenAPIInfo, type OpenAPIMediaType, type OpenAPIOperation, type OpenAPIParameter, type OpenAPIPathItem, type OpenAPIRequestBody, type OpenAPIResponse, type OpenAPISchema, type OpenAPIServer, type OpenAPISpec, type ParsedEndpoint, type ParsedParameter, type ParsedRequestBody, PresetGenerator, type PresetGeneratorOptions, type PresetId$1 as PresetId, PresetIdSchema, type ProjectConfig, ProjectConfigSchema, PromptGenerator, type ResourceConfig, ResourceConfigSchema, type SpinnerInstance, type ToolConfig, ToolConfigSchema, type ToolParameter, ToolParameterSchema, type Transport, TransportSchema, WizardGenerator, type WizardOptions, addToolCommand, copyDir, copyFile, createCommand, createGeneratorContext, createInitialCommit, createSpinner, endpointToMCPTool, ensureDir, exists, generateFromOpenAPI, generateFromPreset, generateFromPrompt, generateFromWizard, getGitUser, getTemplateDir, getTemplateDirForLanguage, initCommand, initGitRepository, isBuiltinLanguage, isDirectory, isGitInstalled, isInsideGitRepository, logger, parseAndValidate, parseOpenAPISpec, parsePostmanCollection, parseSwaggerSpec, projectNameRegex, promptAddResources, promptAddTools, promptCIProvider, promptGenerationMethod, promptIncludeExampleTool, promptJavaBuildTool, promptLanguage, promptMultipleResources, promptMultipleTools, promptPreset, promptProjectDescription, promptProjectName, promptResourceConfig, promptToolConfig, promptTransport, readDir, readFile, remove, renderTemplate, renderTemplateToFile, resolveOutputPath, runQuickWizard, runWizard, safeParseAndValidate, selectEndpoints, validateFilePath, validatePresetId, validateProjectName, validateToolName, validateUrl, walkDir, withSpinner, writeFile };
package/dist/index.js CHANGED
@@ -1,8 +1,18 @@
1
1
  import {
2
+ BUILTIN_LANGUAGES,
2
3
  BaseGenerator,
4
+ BuiltinLanguageSchema,
5
+ JavaBuildToolSchema,
6
+ LanguageSchema,
3
7
  OpenAPIGenerator,
4
8
  PresetGenerator,
9
+ PresetIdSchema,
10
+ ProjectConfigSchema,
5
11
  PromptGenerator,
12
+ ResourceConfigSchema,
13
+ ToolConfigSchema,
14
+ ToolParameterSchema,
15
+ TransportSchema,
6
16
  WizardGenerator,
7
17
  addToolCommand,
8
18
  copyDir,
@@ -20,8 +30,10 @@ import {
20
30
  generateFromWizard,
21
31
  getGitUser,
22
32
  getTemplateDir,
33
+ getTemplateDirForLanguage,
23
34
  initCommand,
24
35
  initGitRepository,
36
+ isBuiltinLanguage,
25
37
  isDirectory,
26
38
  isGitInstalled,
27
39
  isInsideGitRepository,
@@ -31,8 +43,10 @@ import {
31
43
  projectNameRegex,
32
44
  promptAddResources,
33
45
  promptAddTools,
46
+ promptCIProvider,
34
47
  promptGenerationMethod,
35
48
  promptIncludeExampleTool,
49
+ promptJavaBuildTool,
36
50
  promptLanguage,
37
51
  promptMultipleResources,
38
52
  promptMultipleTools,
@@ -60,41 +74,7 @@ import {
60
74
  walkDir,
61
75
  withSpinner,
62
76
  writeFile
63
- } from "./chunk-3JG4FVS2.js";
64
-
65
- // src/types/config.ts
66
- import { z } from "zod";
67
- var LanguageSchema = z.enum(["typescript", "python", "go", "rust"]);
68
- var TransportSchema = z.enum(["stdio", "sse"]);
69
- var ToolParameterSchema = z.object({
70
- name: z.string(),
71
- type: z.enum(["string", "number", "boolean", "object", "array"]),
72
- description: z.string(),
73
- required: z.boolean().default(true)
74
- });
75
- var ToolConfigSchema = z.object({
76
- name: z.string(),
77
- description: z.string(),
78
- parameters: z.array(ToolParameterSchema).default([])
79
- });
80
- var ResourceConfigSchema = z.object({
81
- name: z.string(),
82
- uri: z.string(),
83
- description: z.string(),
84
- mimeType: z.string().optional()
85
- });
86
- var ProjectConfigSchema = z.object({
87
- name: z.string().min(1, "Project name is required"),
88
- description: z.string().default(""),
89
- language: LanguageSchema,
90
- transport: TransportSchema,
91
- tools: z.array(ToolConfigSchema).default([]),
92
- resources: z.array(ResourceConfigSchema).default([]),
93
- includeExampleTool: z.boolean().default(true),
94
- skipInstall: z.boolean().default(false),
95
- initGit: z.boolean().default(true)
96
- });
97
- var PresetIdSchema = z.enum(["database", "rest-api", "filesystem"]);
77
+ } from "./chunk-LJNMSDBU.js";
98
78
 
99
79
  // src/parsers/swagger.ts
100
80
  import YAML from "yaml";
@@ -290,7 +270,10 @@ function nameToOperationId(name) {
290
270
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
291
271
  }
292
272
  export {
273
+ BUILTIN_LANGUAGES,
293
274
  BaseGenerator,
275
+ BuiltinLanguageSchema,
276
+ JavaBuildToolSchema,
294
277
  LanguageSchema,
295
278
  OpenAPIGenerator,
296
279
  PresetGenerator,
@@ -318,8 +301,10 @@ export {
318
301
  generateFromWizard,
319
302
  getGitUser,
320
303
  getTemplateDir,
304
+ getTemplateDirForLanguage,
321
305
  initCommand,
322
306
  initGitRepository,
307
+ isBuiltinLanguage,
323
308
  isDirectory,
324
309
  isGitInstalled,
325
310
  isInsideGitRepository,
@@ -331,8 +316,10 @@ export {
331
316
  projectNameRegex,
332
317
  promptAddResources,
333
318
  promptAddTools,
319
+ promptCIProvider,
334
320
  promptGenerationMethod,
335
321
  promptIncludeExampleTool,
322
+ promptJavaBuildTool,
336
323
  promptLanguage,
337
324
  promptMultipleResources,
338
325
  promptMultipleTools,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-new",
3
- "version": "1.2.2",
3
+ "version": "1.6.0",
4
4
  "description": "CLI generator for MCP servers. Like create-react-app, but for MCP.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -53,7 +53,9 @@
53
53
  "execa": "^8.0.0",
54
54
  "fs-extra": "^11.2.0",
55
55
  "inquirer": "^9.2.0",
56
+ "marked": "^12.0.2",
56
57
  "ora": "^8.0.0",
58
+ "tar": "^7.5.6",
57
59
  "yaml": "^2.4.0",
58
60
  "zod": "^3.23.0"
59
61
  },
@@ -70,4 +72,4 @@
70
72
  "typescript": "^5.4.0",
71
73
  "vitest": "^1.6.0"
72
74
  }
73
- }
75
+ }
@@ -0,0 +1,219 @@
1
+ version: 2.1
2
+
3
+ <% if (language === 'typescript') { %>
4
+ orbs:
5
+ node: circleci/node@5
6
+
7
+ jobs:
8
+ build-and-test:
9
+ docker:
10
+ - image: cimg/node:<%= nodeVersion %>.0
11
+ steps:
12
+ - checkout
13
+ - node/install-packages:
14
+ pkg-manager: npm
15
+ <% if (buildCommand) { %>
16
+ - run:
17
+ name: Build
18
+ command: <%= buildCommand %>
19
+ <% } %>
20
+ <% if (testCommand) { %>
21
+ - run:
22
+ name: Test
23
+ command: <%= testCommand %>
24
+ <% } %>
25
+
26
+ workflows:
27
+ build-and-test:
28
+ jobs:
29
+ - build-and-test
30
+ <% } else if (language === 'python') { %>
31
+ orbs:
32
+ python: circleci/python@2
33
+
34
+ jobs:
35
+ build-and-test:
36
+ docker:
37
+ - image: cimg/python:<%= pythonVersion %>
38
+ steps:
39
+ - checkout
40
+ - python/install-packages:
41
+ pkg-manager: pip
42
+ pip-dependency-file: requirements.txt
43
+ <% if (testCommand) { %>
44
+ - run:
45
+ name: Test
46
+ command: |
47
+ pip install pytest
48
+ <%= testCommand %>
49
+ <% } %>
50
+
51
+ workflows:
52
+ build-and-test:
53
+ jobs:
54
+ - build-and-test
55
+ <% } else if (language === 'go') { %>
56
+ orbs:
57
+ go: circleci/go@1
58
+
59
+ jobs:
60
+ build-and-test:
61
+ docker:
62
+ - image: cimg/go:<%= goVersion %>
63
+ steps:
64
+ - checkout
65
+ - go/load-cache
66
+ - go/mod-download
67
+ - go/save-cache
68
+ <% if (buildCommand) { %>
69
+ - run:
70
+ name: Build
71
+ command: <%= buildCommand %>
72
+ <% } %>
73
+ <% if (testCommand) { %>
74
+ - run:
75
+ name: Test
76
+ command: <%= testCommand %>
77
+ <% } %>
78
+
79
+ workflows:
80
+ build-and-test:
81
+ jobs:
82
+ - build-and-test
83
+ <% } else if (language === 'rust') { %>
84
+ orbs:
85
+ rust: circleci/rust@1
86
+
87
+ jobs:
88
+ build-and-test:
89
+ docker:
90
+ - image: cimg/rust:<%= rustVersion %>
91
+ steps:
92
+ - checkout
93
+ - rust/clippy
94
+ <% if (buildCommand) { %>
95
+ - run:
96
+ name: Build
97
+ command: <%= buildCommand %>
98
+ <% } %>
99
+ <% if (testCommand) { %>
100
+ - run:
101
+ name: Test
102
+ command: <%= testCommand %>
103
+ <% } %>
104
+
105
+ workflows:
106
+ build-and-test:
107
+ jobs:
108
+ - build-and-test
109
+ <% } else if (language === 'java' || language === 'kotlin') { %>
110
+ jobs:
111
+ build-and-test:
112
+ docker:
113
+ - image: cimg/openjdk:<%= javaVersion %>.0
114
+ steps:
115
+ - checkout
116
+ <% if (installCommand.includes('gradle')) { %>
117
+ - restore_cache:
118
+ keys:
119
+ - gradle-{{ checksum "build.gradle" }}
120
+ - gradle-
121
+ <% if (buildCommand) { %>
122
+ - run:
123
+ name: Build
124
+ command: <%= buildCommand %>
125
+ <% } %>
126
+ <% if (testCommand) { %>
127
+ - run:
128
+ name: Test
129
+ command: <%= testCommand %>
130
+ <% } %>
131
+ - save_cache:
132
+ paths:
133
+ - ~/.gradle
134
+ key: gradle-{{ checksum "build.gradle" }}
135
+ <% } else { %>
136
+ - restore_cache:
137
+ keys:
138
+ - maven-{{ checksum "pom.xml" }}
139
+ - maven-
140
+ <% if (buildCommand) { %>
141
+ - run:
142
+ name: Build
143
+ command: <%= buildCommand %>
144
+ <% } %>
145
+ <% if (testCommand) { %>
146
+ - run:
147
+ name: Test
148
+ command: <%= testCommand %>
149
+ <% } %>
150
+ - save_cache:
151
+ paths:
152
+ - ~/.m2
153
+ key: maven-{{ checksum "pom.xml" }}
154
+ <% } %>
155
+
156
+ workflows:
157
+ build-and-test:
158
+ jobs:
159
+ - build-and-test
160
+ <% } else if (language === 'csharp') { %>
161
+ jobs:
162
+ build-and-test:
163
+ docker:
164
+ - image: mcr.microsoft.com/dotnet/sdk:<%= dotnetVersion %>
165
+ steps:
166
+ - checkout
167
+ - run:
168
+ name: Restore dependencies
169
+ command: <%= installCommand %>
170
+ <% if (buildCommand) { %>
171
+ - run:
172
+ name: Build
173
+ command: <%= buildCommand %>
174
+ <% } %>
175
+ <% if (testCommand) { %>
176
+ - run:
177
+ name: Test
178
+ command: <%= testCommand %>
179
+ <% } %>
180
+
181
+ workflows:
182
+ build-and-test:
183
+ jobs:
184
+ - build-and-test
185
+ <% } else if (language === 'elixir') { %>
186
+ jobs:
187
+ build-and-test:
188
+ docker:
189
+ - image: elixir:<%= elixirVersion %>
190
+ steps:
191
+ - checkout
192
+ - restore_cache:
193
+ keys:
194
+ - mix-{{ checksum "mix.lock" }}
195
+ - mix-
196
+ - run:
197
+ name: Install dependencies
198
+ command: <%= installCommand %>
199
+ <% if (buildCommand) { %>
200
+ - run:
201
+ name: Build
202
+ command: <%= buildCommand %>
203
+ <% } %>
204
+ <% if (testCommand) { %>
205
+ - run:
206
+ name: Test
207
+ command: <%= testCommand %>
208
+ <% } %>
209
+ - save_cache:
210
+ paths:
211
+ - deps
212
+ - _build
213
+ key: mix-{{ checksum "mix.lock" }}
214
+
215
+ workflows:
216
+ build-and-test:
217
+ jobs:
218
+ - build-and-test
219
+ <% } %>
@@ -0,0 +1,184 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ <% if (language === 'typescript') { %>
13
+ strategy:
14
+ matrix:
15
+ node-version: [<%= nodeVersion %>, 22]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'npm'
25
+
26
+ - name: Install dependencies
27
+ run: <%= installCommand %>
28
+ <% if (buildCommand) { %>
29
+ - name: Build
30
+ run: <%= buildCommand %>
31
+ <% } %>
32
+ <% if (testCommand) { %>
33
+ - name: Test
34
+ run: <%= testCommand %>
35
+ <% } %>
36
+ <% } else if (language === 'python') { %>
37
+ strategy:
38
+ matrix:
39
+ python-version: ['<%= pythonVersion %>', '3.12']
40
+
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+
44
+ - name: Set up Python ${{ matrix.python-version }}
45
+ uses: actions/setup-python@v5
46
+ with:
47
+ python-version: ${{ matrix.python-version }}
48
+ cache: 'pip'
49
+
50
+ - name: Install dependencies
51
+ run: |
52
+ python -m pip install --upgrade pip
53
+ <%= installCommand %>
54
+ <% if (testCommand) { %>
55
+ - name: Test
56
+ run: <%= testCommand %>
57
+ <% } %>
58
+ <% } else if (language === 'go') { %>
59
+ strategy:
60
+ matrix:
61
+ go-version: ['<%= goVersion %>', '1.22']
62
+
63
+ steps:
64
+ - uses: actions/checkout@v4
65
+
66
+ - name: Set up Go ${{ matrix.go-version }}
67
+ uses: actions/setup-go@v5
68
+ with:
69
+ go-version: ${{ matrix.go-version }}
70
+
71
+ - name: Install dependencies
72
+ run: <%= installCommand %>
73
+ <% if (buildCommand) { %>
74
+ - name: Build
75
+ run: <%= buildCommand %>
76
+ <% } %>
77
+ <% if (testCommand) { %>
78
+ - name: Test
79
+ run: <%= testCommand %>
80
+ <% } %>
81
+ <% } else if (language === 'rust') { %>
82
+ strategy:
83
+ matrix:
84
+ rust-version: [<%= rustVersion %>]
85
+
86
+ steps:
87
+ - uses: actions/checkout@v4
88
+
89
+ - name: Set up Rust
90
+ uses: dtolnay/rust-toolchain@master
91
+ with:
92
+ toolchain: ${{ matrix.rust-version }}
93
+
94
+ - name: Cache cargo
95
+ uses: Swatinem/rust-cache@v2
96
+
97
+ - name: Install dependencies
98
+ run: <%= installCommand %>
99
+ <% if (buildCommand) { %>
100
+ - name: Build
101
+ run: <%= buildCommand %>
102
+ <% } %>
103
+ <% if (testCommand) { %>
104
+ - name: Test
105
+ run: <%= testCommand %>
106
+ <% } %>
107
+ <% } else if (language === 'java' || language === 'kotlin') { %>
108
+ strategy:
109
+ matrix:
110
+ java-version: ['<%= javaVersion %>']
111
+
112
+ steps:
113
+ - uses: actions/checkout@v4
114
+
115
+ - name: Set up JDK ${{ matrix.java-version }}
116
+ uses: actions/setup-java@v4
117
+ with:
118
+ java-version: ${{ matrix.java-version }}
119
+ distribution: 'temurin'
120
+ <% if (installCommand.includes('gradle')) { %>
121
+ cache: 'gradle'
122
+ <% } else { %>
123
+ cache: 'maven'
124
+ <% } %>
125
+ <% if (buildCommand) { %>
126
+ - name: Build
127
+ run: <%= buildCommand %>
128
+ <% } %>
129
+ <% if (testCommand) { %>
130
+ - name: Test
131
+ run: <%= testCommand %>
132
+ <% } %>
133
+ <% } else if (language === 'csharp') { %>
134
+ steps:
135
+ - uses: actions/checkout@v4
136
+
137
+ - name: Set up .NET <%= dotnetVersion %>
138
+ uses: actions/setup-dotnet@v4
139
+ with:
140
+ dotnet-version: '<%= dotnetVersion %>.x'
141
+
142
+ - name: Restore dependencies
143
+ run: <%= installCommand %>
144
+ <% if (buildCommand) { %>
145
+ - name: Build
146
+ run: <%= buildCommand %>
147
+ <% } %>
148
+ <% if (testCommand) { %>
149
+ - name: Test
150
+ run: <%= testCommand %>
151
+ <% } %>
152
+ <% } else if (language === 'elixir') { %>
153
+ strategy:
154
+ matrix:
155
+ elixir-version: ['<%= elixirVersion %>']
156
+ otp-version: ['26']
157
+
158
+ steps:
159
+ - uses: actions/checkout@v4
160
+
161
+ - name: Set up Elixir
162
+ uses: erlef/setup-beam@v1
163
+ with:
164
+ elixir-version: ${{ matrix.elixir-version }}
165
+ otp-version: ${{ matrix.otp-version }}
166
+
167
+ - name: Restore dependencies cache
168
+ uses: actions/cache@v4
169
+ with:
170
+ path: deps
171
+ key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
172
+ restore-keys: ${{ runner.os }}-mix-
173
+
174
+ - name: Install dependencies
175
+ run: <%= installCommand %>
176
+ <% if (buildCommand) { %>
177
+ - name: Build
178
+ run: <%= buildCommand %>
179
+ <% } %>
180
+ <% if (testCommand) { %>
181
+ - name: Test
182
+ run: <%= testCommand %>
183
+ <% } %>
184
+ <% } %>