context-mapper-mcp 1.0.0 → 1.1.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 (56) hide show
  1. package/README.md +13 -14
  2. package/dist/generators/builtin/plantuml-adapter.d.ts +60 -0
  3. package/dist/generators/builtin/plantuml-adapter.d.ts.map +1 -0
  4. package/dist/generators/builtin/plantuml-adapter.js +119 -0
  5. package/dist/generators/builtin/plantuml-adapter.js.map +1 -0
  6. package/dist/generators/cli/config.d.ts +105 -0
  7. package/dist/generators/cli/config.d.ts.map +1 -0
  8. package/dist/generators/cli/config.js +168 -0
  9. package/dist/generators/cli/config.js.map +1 -0
  10. package/dist/generators/cli/context-map.d.ts +26 -0
  11. package/dist/generators/cli/context-map.d.ts.map +1 -0
  12. package/dist/generators/cli/context-map.js +124 -0
  13. package/dist/generators/cli/context-map.js.map +1 -0
  14. package/dist/generators/cli/executor.d.ts +95 -0
  15. package/dist/generators/cli/executor.d.ts.map +1 -0
  16. package/dist/generators/cli/executor.js +277 -0
  17. package/dist/generators/cli/executor.js.map +1 -0
  18. package/dist/generators/cli/generic.d.ts +54 -0
  19. package/dist/generators/cli/generic.d.ts.map +1 -0
  20. package/dist/generators/cli/generic.js +224 -0
  21. package/dist/generators/cli/generic.js.map +1 -0
  22. package/dist/generators/cli/manager.d.ts +83 -0
  23. package/dist/generators/cli/manager.d.ts.map +1 -0
  24. package/dist/generators/cli/manager.js +281 -0
  25. package/dist/generators/cli/manager.js.map +1 -0
  26. package/dist/generators/cli/mdsl.d.ts +26 -0
  27. package/dist/generators/cli/mdsl.d.ts.map +1 -0
  28. package/dist/generators/cli/mdsl.js +118 -0
  29. package/dist/generators/cli/mdsl.js.map +1 -0
  30. package/dist/generators/interfaces.d.ts +144 -0
  31. package/dist/generators/interfaces.d.ts.map +1 -0
  32. package/dist/generators/interfaces.js +59 -0
  33. package/dist/generators/interfaces.js.map +1 -0
  34. package/dist/generators/registry.d.ts +100 -0
  35. package/dist/generators/registry.d.ts.map +1 -0
  36. package/dist/generators/registry.js +169 -0
  37. package/dist/generators/registry.js.map +1 -0
  38. package/dist/index.js +180 -3
  39. package/dist/index.js.map +1 -1
  40. package/dist/tools/cli-tools.d.ts +103 -0
  41. package/dist/tools/cli-tools.d.ts.map +1 -0
  42. package/dist/tools/cli-tools.js +220 -0
  43. package/dist/tools/cli-tools.js.map +1 -0
  44. package/dist/tools/generation-tools.d.ts +73 -1
  45. package/dist/tools/generation-tools.d.ts.map +1 -1
  46. package/dist/tools/generation-tools.js +160 -1
  47. package/dist/tools/generation-tools.js.map +1 -1
  48. package/dist/utils/temp-files.d.ts +77 -0
  49. package/dist/utils/temp-files.d.ts.map +1 -0
  50. package/dist/utils/temp-files.js +164 -0
  51. package/dist/utils/temp-files.js.map +1 -0
  52. package/package.json +4 -1
  53. package/src/templates/FullReportTemplate.md.ftl +297 -0
  54. package/src/templates/GlossaryTemplate.md.ftl +132 -0
  55. package/src/templates/JHipster-Microservices.jdl.ftl +139 -0
  56. package/src/templates/JHipster-Monolith.jdl.ftl +159 -0
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Context Mapper MCP Server
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/context-mapper-mcp.svg)](https://www.npmjs.com/package/context-mapper-mcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
3
6
  An MCP (Model Context Protocol) server that enables AI assistants to work with Domain-Driven Design models using Context Mapper's CML (Context Mapping Language).
4
7
 
5
8
  ## Features
@@ -35,14 +38,13 @@ The server validates models in real-time to prevent common CML errors:
35
38
 
36
39
  ## Installation
37
40
 
41
+ ### Claude Code
42
+
38
43
  ```bash
39
- npm install
40
- npm run build
44
+ claude mcp add context-mapper -- npx -y context-mapper-mcp
41
45
  ```
42
46
 
43
- ## Usage
44
-
45
- ### As MCP Server
47
+ ### Claude Desktop
46
48
 
47
49
  Add to your Claude Desktop configuration (`claude_desktop_config.json`):
48
50
 
@@ -50,8 +52,8 @@ Add to your Claude Desktop configuration (`claude_desktop_config.json`):
50
52
  {
51
53
  "mcpServers": {
52
54
  "context-mapper": {
53
- "command": "node",
54
- "args": ["/path/to/context_mapper_mcp/dist/index.js"]
55
+ "command": "npx",
56
+ "args": ["-y", "context-mapper-mcp"]
55
57
  }
56
58
  }
57
59
  }
@@ -215,14 +217,11 @@ BoundedContext CustomerManagement {
215
217
  ## Development
216
218
 
217
219
  ```bash
218
- # Build
220
+ git clone https://github.com/thijs-hakkenberg/contextmapper_mcp.git
221
+ cd contextmapper_mcp
222
+ npm install
219
223
  npm run build
220
-
221
- # Watch mode
222
- npm run dev
223
-
224
- # Run tests
225
- node test-run.mjs
224
+ npm test
226
225
  ```
227
226
 
228
227
  ## Architecture
@@ -0,0 +1,60 @@
1
+ /**
2
+ * PlantUML Adapter
3
+ * Wraps the existing PlantUML generator to implement the IGenerator interface
4
+ */
5
+ import type { CMLModel } from '../../model/types.js';
6
+ import type { IGenerator, GeneratorResult, GeneratorOptions } from '../interfaces.js';
7
+ /**
8
+ * Options for PlantUML Context Map generator
9
+ */
10
+ export interface PlantUMLContextMapOptions extends GeneratorOptions {
11
+ /** Include aggregates in the diagram */
12
+ includeAggregates?: boolean;
13
+ }
14
+ /**
15
+ * Options for PlantUML Aggregate generator
16
+ */
17
+ export interface PlantUMLAggregateOptions extends GeneratorOptions {
18
+ /** Name of the bounded context */
19
+ contextName: string;
20
+ /** Name of the aggregate */
21
+ aggregateName: string;
22
+ }
23
+ /**
24
+ * PlantUML Context Map Generator
25
+ * Generates PlantUML syntax for context map diagrams
26
+ */
27
+ export declare class PlantUMLContextMapGenerator implements IGenerator {
28
+ name: string;
29
+ description: string;
30
+ requiresCLI: boolean;
31
+ outputFormats: string[];
32
+ generate(model: CMLModel, options?: PlantUMLContextMapOptions): Promise<GeneratorResult>;
33
+ }
34
+ /**
35
+ * PlantUML Aggregate Generator
36
+ * Generates PlantUML syntax for aggregate class diagrams
37
+ */
38
+ export declare class PlantUMLAggregateGenerator implements IGenerator {
39
+ name: string;
40
+ description: string;
41
+ requiresCLI: boolean;
42
+ outputFormats: string[];
43
+ generate(model: CMLModel, options?: PlantUMLAggregateOptions): Promise<GeneratorResult>;
44
+ }
45
+ /**
46
+ * PlantUML Full Model Generator
47
+ * Generates PlantUML syntax for the complete domain model
48
+ */
49
+ export declare class PlantUMLFullModelGenerator implements IGenerator {
50
+ name: string;
51
+ description: string;
52
+ requiresCLI: boolean;
53
+ outputFormats: string[];
54
+ generate(model: CMLModel, options?: GeneratorOptions): Promise<GeneratorResult>;
55
+ }
56
+ /**
57
+ * Create all PlantUML generators
58
+ */
59
+ export declare function createPlantUMLGenerators(): IGenerator[];
60
+ //# sourceMappingURL=plantuml-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plantuml-adapter.d.ts","sourceRoot":"","sources":["../../../src/generators/builtin/plantuml-adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAa,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAEjB,MAAM,kBAAkB,CAAC;AAQ1B;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,qBAAa,2BAA4B,YAAW,UAAU;IAC5D,IAAI,SAA0B;IAC9B,WAAW,SAAsF;IACjG,WAAW,UAAS;IACpB,aAAa,WAAgB;IAEvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,eAAe,CAAC;CAoB/F;AAED;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,UAAU;IAC3D,IAAI,SAAwB;IAC5B,WAAW,SAA8D;IACzE,WAAW,UAAS;IACpB,aAAa,WAAgB;IAEvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC;CAmE9F;AAED;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,UAAU;IAC3D,IAAI,SAAyB;IAC7B,WAAW,SAA4D;IACvE,WAAW,UAAS;IACpB,aAAa,WAAgB;IAEvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;CAmBtF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,UAAU,EAAE,CAMvD"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * PlantUML Adapter
3
+ * Wraps the existing PlantUML generator to implement the IGenerator interface
4
+ */
5
+ import { createSuccessResult, createErrorResult } from '../interfaces.js';
6
+ import { generateContextMapDiagram, generateAggregateDiagram, generateFullModelDiagram, } from '../plantuml.js';
7
+ /**
8
+ * PlantUML Context Map Generator
9
+ * Generates PlantUML syntax for context map diagrams
10
+ */
11
+ export class PlantUMLContextMapGenerator {
12
+ name = 'plantuml-context-map';
13
+ description = 'Generate PlantUML context map diagram showing bounded contexts and relationships';
14
+ requiresCLI = false;
15
+ outputFormats = ['plantuml'];
16
+ async generate(model, options) {
17
+ try {
18
+ const includeAggregates = options?.includeAggregates ?? false;
19
+ const plantuml = generateContextMapDiagram(model, includeAggregates);
20
+ const output = {
21
+ type: 'content',
22
+ content: plantuml,
23
+ format: 'plantuml',
24
+ description: 'Context map diagram in PlantUML format',
25
+ };
26
+ return createSuccessResult([output]);
27
+ }
28
+ catch (error) {
29
+ return createErrorResult('INTERNAL_ERROR', error instanceof Error ? error.message : 'Unknown error generating context map diagram');
30
+ }
31
+ }
32
+ }
33
+ /**
34
+ * PlantUML Aggregate Generator
35
+ * Generates PlantUML syntax for aggregate class diagrams
36
+ */
37
+ export class PlantUMLAggregateGenerator {
38
+ name = 'plantuml-aggregate';
39
+ description = 'Generate PlantUML class diagram for a specific aggregate';
40
+ requiresCLI = false;
41
+ outputFormats = ['plantuml'];
42
+ async generate(model, options) {
43
+ if (!options?.contextName) {
44
+ return createErrorResult('INTERNAL_ERROR', 'contextName is required', 'Provide the name of the bounded context containing the aggregate');
45
+ }
46
+ if (!options?.aggregateName) {
47
+ return createErrorResult('INTERNAL_ERROR', 'aggregateName is required', 'Provide the name of the aggregate to generate the diagram for');
48
+ }
49
+ try {
50
+ // Find the bounded context
51
+ const bc = model.boundedContexts.find((c) => c.name === options.contextName);
52
+ if (!bc) {
53
+ return createErrorResult('INTERNAL_ERROR', `Bounded context '${options.contextName}' not found`);
54
+ }
55
+ // Find the aggregate
56
+ let aggregate = bc.aggregates.find((a) => a.name === options.aggregateName);
57
+ // Also check modules
58
+ if (!aggregate) {
59
+ for (const mod of bc.modules) {
60
+ const found = mod.aggregates.find((a) => a.name === options.aggregateName);
61
+ if (found) {
62
+ aggregate = found;
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ if (!aggregate) {
68
+ return createErrorResult('INTERNAL_ERROR', `Aggregate '${options.aggregateName}' not found in context '${options.contextName}'`);
69
+ }
70
+ const plantuml = generateAggregateDiagram(aggregate);
71
+ const output = {
72
+ type: 'content',
73
+ content: plantuml,
74
+ format: 'plantuml',
75
+ description: `Class diagram for aggregate '${options.aggregateName}'`,
76
+ };
77
+ return createSuccessResult([output]);
78
+ }
79
+ catch (error) {
80
+ return createErrorResult('INTERNAL_ERROR', error instanceof Error ? error.message : 'Unknown error generating aggregate diagram');
81
+ }
82
+ }
83
+ }
84
+ /**
85
+ * PlantUML Full Model Generator
86
+ * Generates PlantUML syntax for the complete domain model
87
+ */
88
+ export class PlantUMLFullModelGenerator {
89
+ name = 'plantuml-full-model';
90
+ description = 'Generate PlantUML diagram of the complete domain model';
91
+ requiresCLI = false;
92
+ outputFormats = ['plantuml'];
93
+ async generate(model, options) {
94
+ try {
95
+ const plantuml = generateFullModelDiagram(model);
96
+ const output = {
97
+ type: 'content',
98
+ content: plantuml,
99
+ format: 'plantuml',
100
+ description: 'Full domain model diagram in PlantUML format',
101
+ };
102
+ return createSuccessResult([output]);
103
+ }
104
+ catch (error) {
105
+ return createErrorResult('INTERNAL_ERROR', error instanceof Error ? error.message : 'Unknown error generating full model diagram');
106
+ }
107
+ }
108
+ }
109
+ /**
110
+ * Create all PlantUML generators
111
+ */
112
+ export function createPlantUMLGenerators() {
113
+ return [
114
+ new PlantUMLContextMapGenerator(),
115
+ new PlantUMLAggregateGenerator(),
116
+ new PlantUMLFullModelGenerator(),
117
+ ];
118
+ }
119
+ //# sourceMappingURL=plantuml-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plantuml-adapter.js","sourceRoot":"","sources":["../../../src/generators/builtin/plantuml-adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAoBxB;;;GAGG;AACH,MAAM,OAAO,2BAA2B;IACtC,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAAG,kFAAkF,CAAC;IACjG,WAAW,GAAG,KAAK,CAAC;IACpB,aAAa,GAAG,CAAC,UAAU,CAAC,CAAC;IAE7B,KAAK,CAAC,QAAQ,CAAC,KAAe,EAAE,OAAmC;QACjE,IAAI,CAAC;YACH,MAAM,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,KAAK,CAAC;YAC9D,MAAM,QAAQ,GAAG,yBAAyB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;YAErE,MAAM,MAAM,GAAoB;gBAC9B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AAG,KAAK,CAAC;IACpB,aAAa,GAAG,CAAC,UAAU,CAAC,CAAC;IAE7B,KAAK,CAAC,QAAQ,CAAC,KAAe,EAAE,OAA0B;QACxD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;YAEjD,MAAM,MAAM,GAAoB;gBAC9B,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,QAAQ;gBACjB,MAAM,EAAE,UAAU;gBAClB,WAAW,EAAE,8CAA8C;aAC5D,CAAC;YAEF,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,iBAAiB,CACtB,gBAAgB,EAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,6CAA6C,CACvF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,IAAI,2BAA2B,EAAE;QACjC,IAAI,0BAA0B,EAAE;QAChC,IAAI,0BAA0B,EAAE;KACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * CLI Configuration
3
+ * Manages paths, versions, and settings for the Context Mapper CLI
4
+ */
5
+ /**
6
+ * Default CLI version to use
7
+ */
8
+ export declare const DEFAULT_CLI_VERSION = "6.12.0";
9
+ /**
10
+ * Maven Central base URL for CLI downloads
11
+ */
12
+ export declare const MAVEN_BASE_URL = "https://repo1.maven.org/maven2/org/contextmapper/context-mapper-cli";
13
+ /**
14
+ * Minimum required Java version
15
+ */
16
+ export declare const MIN_JAVA_VERSION = 17;
17
+ /**
18
+ * Default timeout for CLI operations (5 minutes)
19
+ */
20
+ export declare const DEFAULT_CLI_TIMEOUT: number;
21
+ /**
22
+ * CLI Configuration interface
23
+ */
24
+ export interface CLIConfig {
25
+ /** Directory where CLI is installed */
26
+ cliDir: string;
27
+ /** CLI version to use */
28
+ version: string;
29
+ /** Path to java executable (or null to auto-detect) */
30
+ javaHome: string | null;
31
+ /** Default output directory for generated files */
32
+ outputDir: string;
33
+ /** Default timeout for CLI operations in milliseconds */
34
+ timeout: number;
35
+ /** Directory containing bundled templates */
36
+ templatesDir: string;
37
+ }
38
+ /**
39
+ * Get the default CLI installation directory
40
+ */
41
+ export declare function getDefaultCLIDir(): string;
42
+ /**
43
+ * Get the default output directory
44
+ */
45
+ export declare function getDefaultOutputDir(): string;
46
+ /**
47
+ * Get the bundled templates directory
48
+ */
49
+ export declare function getTemplatesDir(): string;
50
+ /**
51
+ * Get the current CLI configuration
52
+ */
53
+ export declare function getCLIConfig(): CLIConfig;
54
+ /**
55
+ * Update CLI configuration
56
+ * @param updates Partial configuration to merge
57
+ */
58
+ export declare function setCLIConfig(updates: Partial<CLIConfig>): CLIConfig;
59
+ /**
60
+ * Reset CLI configuration to defaults
61
+ */
62
+ export declare function resetCLIConfig(): CLIConfig;
63
+ /**
64
+ * Get the directory for a specific CLI version
65
+ */
66
+ export declare function getCLIVersionDir(version?: string): string;
67
+ /**
68
+ * Get the CLI executable path
69
+ */
70
+ export declare function getCLIExecutablePath(version?: string): string;
71
+ /**
72
+ * Get the Java executable path
73
+ */
74
+ export declare function getJavaExecutablePath(): string;
75
+ /**
76
+ * Get download URL for CLI archive
77
+ * @param version CLI version
78
+ */
79
+ export declare function getCLIDownloadUrl(version?: string): string;
80
+ /**
81
+ * Get the current platform type
82
+ */
83
+ export declare function getPlatformType(): 'windows' | 'unix';
84
+ /**
85
+ * Check if we're running on Windows
86
+ */
87
+ export declare function isWindows(): boolean;
88
+ /**
89
+ * Configuration for bundled template lookup
90
+ */
91
+ export interface BundledTemplateInfo {
92
+ name: string;
93
+ path: string;
94
+ description: string;
95
+ outputExtension: string;
96
+ }
97
+ /**
98
+ * Get information about bundled templates
99
+ */
100
+ export declare function getBundledTemplates(): BundledTemplateInfo[];
101
+ /**
102
+ * Get a bundled template by name
103
+ */
104
+ export declare function getBundledTemplate(name: string): BundledTemplateInfo | undefined;
105
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/generators/cli/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;GAEG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc,wEAAwE,CAAC;AAEpG;;GAEG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAgB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAcD;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAGnE;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,SAAS,CAU1C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,MAA8B,GAAG,MAAM,CAEhF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,MAA8B,GAAG,MAAM,CAIpF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAO9C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAA8B,GAAG,MAAM,CAGjF;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,SAAS,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,mBAAmB,EAAE,CA4B3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAEhF"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * CLI Configuration
3
+ * Manages paths, versions, and settings for the Context Mapper CLI
4
+ */
5
+ import { homedir, platform } from 'os';
6
+ import { join, dirname } from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ // Get package root directory
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const PACKAGE_ROOT = join(__dirname, '..', '..', '..');
12
+ /**
13
+ * Default CLI version to use
14
+ */
15
+ export const DEFAULT_CLI_VERSION = '6.12.0';
16
+ /**
17
+ * Maven Central base URL for CLI downloads
18
+ */
19
+ export const MAVEN_BASE_URL = 'https://repo1.maven.org/maven2/org/contextmapper/context-mapper-cli';
20
+ /**
21
+ * Minimum required Java version
22
+ */
23
+ export const MIN_JAVA_VERSION = 17;
24
+ /**
25
+ * Default timeout for CLI operations (5 minutes)
26
+ */
27
+ export const DEFAULT_CLI_TIMEOUT = 5 * 60 * 1000;
28
+ /**
29
+ * Get the default CLI installation directory
30
+ */
31
+ export function getDefaultCLIDir() {
32
+ return join(homedir(), '.context-mapper-mcp', 'cli');
33
+ }
34
+ /**
35
+ * Get the default output directory
36
+ */
37
+ export function getDefaultOutputDir() {
38
+ return join(process.cwd(), 'generated');
39
+ }
40
+ /**
41
+ * Get the bundled templates directory
42
+ */
43
+ export function getTemplatesDir() {
44
+ return join(PACKAGE_ROOT, 'src', 'templates');
45
+ }
46
+ /**
47
+ * Current CLI configuration (singleton)
48
+ */
49
+ let currentConfig = {
50
+ cliDir: getDefaultCLIDir(),
51
+ version: DEFAULT_CLI_VERSION,
52
+ javaHome: process.env.JAVA_HOME || null,
53
+ outputDir: getDefaultOutputDir(),
54
+ timeout: DEFAULT_CLI_TIMEOUT,
55
+ templatesDir: getTemplatesDir(),
56
+ };
57
+ /**
58
+ * Get the current CLI configuration
59
+ */
60
+ export function getCLIConfig() {
61
+ return { ...currentConfig };
62
+ }
63
+ /**
64
+ * Update CLI configuration
65
+ * @param updates Partial configuration to merge
66
+ */
67
+ export function setCLIConfig(updates) {
68
+ currentConfig = { ...currentConfig, ...updates };
69
+ return getCLIConfig();
70
+ }
71
+ /**
72
+ * Reset CLI configuration to defaults
73
+ */
74
+ export function resetCLIConfig() {
75
+ currentConfig = {
76
+ cliDir: getDefaultCLIDir(),
77
+ version: DEFAULT_CLI_VERSION,
78
+ javaHome: process.env.JAVA_HOME || null,
79
+ outputDir: getDefaultOutputDir(),
80
+ timeout: DEFAULT_CLI_TIMEOUT,
81
+ templatesDir: getTemplatesDir(),
82
+ };
83
+ return getCLIConfig();
84
+ }
85
+ /**
86
+ * Get the directory for a specific CLI version
87
+ */
88
+ export function getCLIVersionDir(version = currentConfig.version) {
89
+ return join(currentConfig.cliDir, version);
90
+ }
91
+ /**
92
+ * Get the CLI executable path
93
+ */
94
+ export function getCLIExecutablePath(version = currentConfig.version) {
95
+ const versionDir = getCLIVersionDir(version);
96
+ const executable = platform() === 'win32' ? 'cm.bat' : 'cm';
97
+ return join(versionDir, 'bin', executable);
98
+ }
99
+ /**
100
+ * Get the Java executable path
101
+ */
102
+ export function getJavaExecutablePath() {
103
+ if (currentConfig.javaHome) {
104
+ const executable = platform() === 'win32' ? 'java.exe' : 'java';
105
+ return join(currentConfig.javaHome, 'bin', executable);
106
+ }
107
+ // Fall back to PATH
108
+ return 'java';
109
+ }
110
+ /**
111
+ * Get download URL for CLI archive
112
+ * @param version CLI version
113
+ */
114
+ export function getCLIDownloadUrl(version = currentConfig.version) {
115
+ const extension = platform() === 'win32' ? 'zip' : 'tar';
116
+ return `${MAVEN_BASE_URL}/${version}/context-mapper-cli-${version}.${extension}`;
117
+ }
118
+ /**
119
+ * Get the current platform type
120
+ */
121
+ export function getPlatformType() {
122
+ return platform() === 'win32' ? 'windows' : 'unix';
123
+ }
124
+ /**
125
+ * Check if we're running on Windows
126
+ */
127
+ export function isWindows() {
128
+ return platform() === 'win32';
129
+ }
130
+ /**
131
+ * Get information about bundled templates
132
+ */
133
+ export function getBundledTemplates() {
134
+ const templatesDir = currentConfig.templatesDir;
135
+ return [
136
+ {
137
+ name: 'glossary',
138
+ path: join(templatesDir, 'GlossaryTemplate.md.ftl'),
139
+ description: 'Ubiquitous language glossary',
140
+ outputExtension: 'md',
141
+ },
142
+ {
143
+ name: 'jhipster-microservices',
144
+ path: join(templatesDir, 'JHipster-Microservices.jdl.ftl'),
145
+ description: 'JHipster microservices architecture',
146
+ outputExtension: 'jdl',
147
+ },
148
+ {
149
+ name: 'jhipster-monolith',
150
+ path: join(templatesDir, 'JHipster-Monolith.jdl.ftl'),
151
+ description: 'JHipster monolithic application',
152
+ outputExtension: 'jdl',
153
+ },
154
+ {
155
+ name: 'full-report',
156
+ path: join(templatesDir, 'FullReportTemplate.md.ftl'),
157
+ description: 'Comprehensive domain documentation',
158
+ outputExtension: 'md',
159
+ },
160
+ ];
161
+ }
162
+ /**
163
+ * Get a bundled template by name
164
+ */
165
+ export function getBundledTemplate(name) {
166
+ return getBundledTemplates().find(t => t.name === name);
167
+ }
168
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"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E,2BAA2B,CAAC;YACrD,WAAW,EAAE,iCAAiC;YAC9C,eAAe,EAAE,KAAK;SACvB;QACD;YACE,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,2BAA2B,CAAC;YACrD,WAAW,EAAE,oCAAoC;YACjD,eAAe,EAAE,IAAI;SACtB;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,mBAAmB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Context Map CLI Generator
3
+ * Generates Context Map graphics (PNG/SVG) using the Context Mapper CLI
4
+ */
5
+ import type { CMLModel } from '../../model/types.js';
6
+ import type { IGenerator, GeneratorResult, ContextMapGeneratorOptions } from '../interfaces.js';
7
+ /**
8
+ * Context Map Image Generator
9
+ * Uses CLI to generate PNG or SVG context map visualizations
10
+ */
11
+ export declare class ContextMapImageGenerator implements IGenerator {
12
+ name: string;
13
+ description: string;
14
+ requiresCLI: boolean;
15
+ outputFormats: string[];
16
+ generate(model: CMLModel, options?: ContextMapGeneratorOptions): Promise<GeneratorResult>;
17
+ /**
18
+ * Find generated files in the output directory
19
+ */
20
+ private findGeneratedFiles;
21
+ }
22
+ /**
23
+ * Create the Context Map image generator
24
+ */
25
+ export declare function createContextMapImageGenerator(): IGenerator;
26
+ //# sourceMappingURL=context-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-map.d.ts","sourceRoot":"","sources":["../../../src/generators/cli/context-map.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAc1B;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,UAAU;IACzD,IAAI,SAAuB;IAC3B,WAAW,SAA2E;IACtF,WAAW,UAAQ;IACnB,aAAa,WAAkB;IAEzB,QAAQ,CACZ,KAAK,EAAE,QAAQ,EACf,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,eAAe,CAAC;IA4G3B;;OAEG;YACW,kBAAkB;CAyBjC;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,UAAU,CAE3D"}