@crypto512/jicon-mcp 0.7.1 → 1.0.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.
- package/README.md +128 -395
- package/TOOL_LIST.md +810 -120
- package/dist/config/constants.d.ts +1 -0
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +1 -0
- package/dist/config/constants.js.map +1 -1
- package/dist/config/loader.d.ts +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +27 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/types.d.ts +8 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -1
- package/dist/confluence/client.d.ts +38 -0
- package/dist/confluence/client.d.ts.map +1 -1
- package/dist/confluence/client.js +117 -0
- package/dist/confluence/client.js.map +1 -1
- package/dist/confluence/tools.d.ts +102 -75
- package/dist/confluence/tools.d.ts.map +1 -1
- package/dist/confluence/tools.js +510 -151
- package/dist/confluence/tools.js.map +1 -1
- package/dist/confluence/types.d.ts +55 -1
- package/dist/confluence/types.d.ts.map +1 -1
- package/dist/index.js +88 -2
- package/dist/index.js.map +1 -1
- package/dist/jira/tools.d.ts +0 -5
- package/dist/jira/tools.d.ts.map +1 -1
- package/dist/jira/tools.js +40 -87
- package/dist/jira/tools.js.map +1 -1
- package/dist/permissions/filter.d.ts +5 -0
- package/dist/permissions/filter.d.ts.map +1 -1
- package/dist/permissions/filter.js +29 -12
- package/dist/permissions/filter.js.map +1 -1
- package/dist/permissions/tool-registry.d.ts +23 -25
- package/dist/permissions/tool-registry.d.ts.map +1 -1
- package/dist/permissions/tool-registry.js +41 -45
- package/dist/permissions/tool-registry.js.map +1 -1
- package/dist/permissions/write-home-validator.d.ts +35 -0
- package/dist/permissions/write-home-validator.d.ts.map +1 -0
- package/dist/permissions/write-home-validator.js +140 -0
- package/dist/permissions/write-home-validator.js.map +1 -0
- package/dist/tempo/tools.d.ts.map +1 -1
- package/dist/tempo/tools.js +43 -44
- package/dist/tempo/tools.js.map +1 -1
- package/dist/utils/buffer-tools.d.ts +119 -1
- package/dist/utils/buffer-tools.d.ts.map +1 -1
- package/dist/utils/buffer-tools.js +610 -3
- package/dist/utils/buffer-tools.js.map +1 -1
- package/dist/utils/content-buffer.d.ts +34 -0
- package/dist/utils/content-buffer.d.ts.map +1 -1
- package/dist/utils/content-buffer.js +79 -0
- package/dist/utils/content-buffer.js.map +1 -1
- package/dist/utils/http-client.d.ts.map +1 -1
- package/dist/utils/http-client.js +4 -4
- package/dist/utils/http-client.js.map +1 -1
- package/dist/utils/jicon-help.d.ts +29 -0
- package/dist/utils/jicon-help.d.ts.map +1 -0
- package/dist/utils/jicon-help.js +873 -0
- package/dist/utils/jicon-help.js.map +1 -0
- package/dist/utils/plantuml/client.d.ts +40 -0
- package/dist/utils/plantuml/client.d.ts.map +1 -0
- package/dist/utils/plantuml/client.js +306 -0
- package/dist/utils/plantuml/client.js.map +1 -0
- package/dist/utils/plantuml/docker-manager.d.ts +35 -0
- package/dist/utils/plantuml/docker-manager.d.ts.map +1 -0
- package/dist/utils/plantuml/docker-manager.js +280 -0
- package/dist/utils/plantuml/docker-manager.js.map +1 -0
- package/dist/utils/plantuml/index.d.ts +11 -0
- package/dist/utils/plantuml/index.d.ts.map +1 -0
- package/dist/utils/plantuml/index.js +16 -0
- package/dist/utils/plantuml/index.js.map +1 -0
- package/dist/utils/plantuml/service.d.ts +46 -0
- package/dist/utils/plantuml/service.d.ts.map +1 -0
- package/dist/utils/plantuml/service.js +96 -0
- package/dist/utils/plantuml/service.js.map +1 -0
- package/dist/utils/plantuml/tools.d.ts +65 -0
- package/dist/utils/plantuml/tools.d.ts.map +1 -0
- package/dist/utils/plantuml/tools.js +272 -0
- package/dist/utils/plantuml/tools.js.map +1 -0
- package/dist/utils/plantuml/types.d.ts +130 -0
- package/dist/utils/plantuml/types.d.ts.map +1 -0
- package/dist/utils/plantuml/types.js +66 -0
- package/dist/utils/plantuml/types.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +14 -0
- package/dist/utils/response-formatter.d.ts.map +1 -1
- package/dist/utils/response-formatter.js +84 -1
- package/dist/utils/response-formatter.js.map +1 -1
- package/dist/utils/url-tools.d.ts +49 -0
- package/dist/utils/url-tools.d.ts.map +1 -0
- package/dist/utils/url-tools.js +141 -0
- package/dist/utils/url-tools.js.map +1 -0
- package/dist/utils/xhtml/confluence-schema.d.ts +55 -0
- package/dist/utils/xhtml/confluence-schema.d.ts.map +1 -0
- package/dist/utils/xhtml/confluence-schema.js +215 -0
- package/dist/utils/xhtml/confluence-schema.js.map +1 -0
- package/dist/utils/xhtml/index.d.ts +17 -0
- package/dist/utils/xhtml/index.d.ts.map +1 -0
- package/dist/utils/xhtml/index.js +21 -0
- package/dist/utils/xhtml/index.js.map +1 -0
- package/dist/utils/xhtml/operations.d.ts +100 -0
- package/dist/utils/xhtml/operations.d.ts.map +1 -0
- package/dist/utils/xhtml/operations.js +596 -0
- package/dist/utils/xhtml/operations.js.map +1 -0
- package/dist/utils/xhtml/parser.d.ts +64 -0
- package/dist/utils/xhtml/parser.d.ts.map +1 -0
- package/dist/utils/xhtml/parser.js +180 -0
- package/dist/utils/xhtml/parser.js.map +1 -0
- package/dist/utils/xhtml/plantuml.d.ts +112 -0
- package/dist/utils/xhtml/plantuml.d.ts.map +1 -0
- package/dist/utils/xhtml/plantuml.js +251 -0
- package/dist/utils/xhtml/plantuml.js.map +1 -0
- package/dist/utils/xhtml/selector.d.ts +35 -0
- package/dist/utils/xhtml/selector.d.ts.map +1 -0
- package/dist/utils/xhtml/selector.js +358 -0
- package/dist/utils/xhtml/selector.js.map +1 -0
- package/dist/utils/xhtml/serializer.d.ts +26 -0
- package/dist/utils/xhtml/serializer.d.ts.map +1 -0
- package/dist/utils/xhtml/serializer.js +170 -0
- package/dist/utils/xhtml/serializer.js.map +1 -0
- package/dist/utils/xhtml/types.d.ts +134 -0
- package/dist/utils/xhtml/types.d.ts.map +1 -0
- package/dist/utils/xhtml/types.js +65 -0
- package/dist/utils/xhtml/types.js.map +1 -0
- package/dist/utils/xhtml/validator.d.ts +67 -0
- package/dist/utils/xhtml/validator.d.ts.map +1 -0
- package/dist/utils/xhtml/validator.js +300 -0
- package/dist/utils/xhtml/validator.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jicon-help.js","sourceRoot":"","sources":["../../src/utils/jicon-help.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAErE,mBAAmB;AACnB,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAU,CAAC;AAG9D,yDAAyD;AACzD,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuJtB,CAAC;AAEF,mBAAmB;AACnB,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEA4CsD,CAAC;AAExE,mBAAmB;AACnB,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEAmDwD,CAAC;AAE1E,sCAAsC;AACtC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8EA6IkD,CAAC;AAE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AE,CAAC;oBAC3B,OAAO,aAAa,CAAC;wBACnB,KAAK;wBACL,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC;qBAC5B,CAAC,CAAC;gBACL,CAAC;gBAED,yEAAyE;gBACzE,OAAO,WAAW,CAAC;oBACjB,KAAK,EAAE,IAAI;oBACX,OAAO,EAAE,mBAAmB,KAAK,wBAAwB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBAC5E,UAAU,EAAE,GAAG;iBAChB,CAAC,CAAC;YACL,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,0BAA0B;AAC1B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,CAAU,CAAC;AAElD,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PlantUML HTTP Client
|
|
3
|
+
*
|
|
4
|
+
* HTTP client for communicating with PlantUML server.
|
|
5
|
+
* Handles encoding, request/response parsing, and error extraction.
|
|
6
|
+
*/
|
|
7
|
+
import type { PlantUmlValidationResult, PlantUmlRenderResult, RenderFormat, DiagramType } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Encode PlantUML code for URL
|
|
10
|
+
*/
|
|
11
|
+
export declare function encodePlantUml(code: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Normalize PlantUML code by ensuring @startuml/@enduml markers
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizePlantUml(code: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Detect diagram type from PlantUML code
|
|
18
|
+
*/
|
|
19
|
+
export declare function detectDiagramType(code: string): DiagramType;
|
|
20
|
+
/**
|
|
21
|
+
* PlantUML HTTP Client
|
|
22
|
+
*/
|
|
23
|
+
export declare class PlantUmlClient {
|
|
24
|
+
private baseUrl;
|
|
25
|
+
private timeoutMs;
|
|
26
|
+
constructor(baseUrl: string, timeoutMs?: number);
|
|
27
|
+
/**
|
|
28
|
+
* Validate PlantUML syntax by attempting to render it
|
|
29
|
+
*/
|
|
30
|
+
validate(code: string): Promise<PlantUmlValidationResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Render PlantUML diagram to specified format
|
|
33
|
+
*/
|
|
34
|
+
render(code: string, format: RenderFormat): Promise<PlantUmlRenderResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Check if server is healthy
|
|
37
|
+
*/
|
|
38
|
+
healthCheck(): Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/utils/plantuml/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EAEpB,YAAY,EACZ,WAAW,EACZ,MAAM,YAAY,CAAC;AAmCpB;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAetD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CA8E3D;AA6DD;;GAEG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,OAAO;IAAU,OAAO,CAAC,SAAS;gBAAlC,OAAO,EAAE,MAAM,EAAU,SAAS,GAAE,MAAc;IAEtE;;OAEG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAmE/D;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA4C/E;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAWtC"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PlantUML HTTP Client
|
|
3
|
+
*
|
|
4
|
+
* HTTP client for communicating with PlantUML server.
|
|
5
|
+
* Handles encoding, request/response parsing, and error extraction.
|
|
6
|
+
*/
|
|
7
|
+
import { deflateSync } from "zlib";
|
|
8
|
+
/**
|
|
9
|
+
* PlantUML text encoding - uses deflate + custom base64
|
|
10
|
+
* Based on: https://plantuml.com/text-encoding
|
|
11
|
+
*/
|
|
12
|
+
function encode64(data) {
|
|
13
|
+
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
|
|
14
|
+
let result = "";
|
|
15
|
+
for (let i = 0; i < data.length; i += 3) {
|
|
16
|
+
const b1 = data[i] || 0;
|
|
17
|
+
const b2 = data[i + 1] || 0;
|
|
18
|
+
const b3 = data[i + 2] || 0;
|
|
19
|
+
const c1 = b1 >> 2;
|
|
20
|
+
const c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
|
|
21
|
+
const c3 = ((b2 & 0xf) << 2) | (b3 >> 6);
|
|
22
|
+
const c4 = b3 & 0x3f;
|
|
23
|
+
result += chars[c1];
|
|
24
|
+
result += chars[c2];
|
|
25
|
+
if (i + 1 < data.length) {
|
|
26
|
+
result += chars[c3];
|
|
27
|
+
}
|
|
28
|
+
if (i + 2 < data.length) {
|
|
29
|
+
result += chars[c4];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Encode PlantUML code for URL
|
|
36
|
+
*/
|
|
37
|
+
export function encodePlantUml(code) {
|
|
38
|
+
const deflated = deflateSync(Buffer.from(code, "utf-8"), { level: 9 });
|
|
39
|
+
return encode64(deflated);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Normalize PlantUML code by ensuring @startuml/@enduml markers
|
|
43
|
+
*/
|
|
44
|
+
export function normalizePlantUml(code) {
|
|
45
|
+
let normalized = code.trim();
|
|
46
|
+
const hasStart = /^@startuml\b/im.test(normalized);
|
|
47
|
+
const hasEnd = /@enduml\s*$/im.test(normalized);
|
|
48
|
+
if (!hasStart) {
|
|
49
|
+
normalized = "@startuml\n" + normalized;
|
|
50
|
+
}
|
|
51
|
+
if (!hasEnd) {
|
|
52
|
+
normalized = normalized + "\n@enduml";
|
|
53
|
+
}
|
|
54
|
+
return normalized;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Detect diagram type from PlantUML code
|
|
58
|
+
*/
|
|
59
|
+
export function detectDiagramType(code) {
|
|
60
|
+
const patterns = [
|
|
61
|
+
// Explicit diagram types
|
|
62
|
+
{ pattern: /@startmindmap/i, type: "mindmap" },
|
|
63
|
+
{ pattern: /@startgantt/i, type: "gantt" },
|
|
64
|
+
{ pattern: /@startwbs/i, type: "wbs" },
|
|
65
|
+
{ pattern: /@startjson/i, type: "json" },
|
|
66
|
+
{ pattern: /@startyaml/i, type: "yaml" },
|
|
67
|
+
// C4 Model diagram indicators (check early - uses include directive and special macros)
|
|
68
|
+
{ pattern: /!include.*C4_Context\.puml/i, type: "c4" },
|
|
69
|
+
{ pattern: /!include.*C4_Container\.puml/i, type: "c4" },
|
|
70
|
+
{ pattern: /!include.*C4_Component\.puml/i, type: "c4" },
|
|
71
|
+
{ pattern: /!include.*C4_Dynamic\.puml/i, type: "c4" },
|
|
72
|
+
{ pattern: /!include.*C4_Deployment\.puml/i, type: "c4" },
|
|
73
|
+
{ pattern: /\bPerson\s*\(/i, type: "c4" },
|
|
74
|
+
{ pattern: /\bPerson_Ext\s*\(/i, type: "c4" },
|
|
75
|
+
{ pattern: /\bSystem\s*\(/i, type: "c4" },
|
|
76
|
+
{ pattern: /\bSystem_Ext\s*\(/i, type: "c4" },
|
|
77
|
+
{ pattern: /\bSystem_Boundary\s*\(/i, type: "c4" },
|
|
78
|
+
{ pattern: /\bContainer\s*\(/i, type: "c4" },
|
|
79
|
+
{ pattern: /\bContainer_Ext\s*\(/i, type: "c4" },
|
|
80
|
+
{ pattern: /\bContainer_Boundary\s*\(/i, type: "c4" },
|
|
81
|
+
{ pattern: /\bComponent\s*\(/i, type: "c4" },
|
|
82
|
+
{ pattern: /\bComponent_Ext\s*\(/i, type: "c4" },
|
|
83
|
+
{ pattern: /\bRel\s*\(/i, type: "c4" },
|
|
84
|
+
{ pattern: /\bRel_Back\s*\(/i, type: "c4" },
|
|
85
|
+
{ pattern: /\bRel_Neighbor\s*\(/i, type: "c4" },
|
|
86
|
+
// Class diagram indicators
|
|
87
|
+
{ pattern: /\bclass\s+\w+/i, type: "class" },
|
|
88
|
+
{ pattern: /\binterface\s+\w+/i, type: "class" },
|
|
89
|
+
{ pattern: /\babstract\s+class/i, type: "class" },
|
|
90
|
+
{ pattern: /\benum\s+\w+/i, type: "class" },
|
|
91
|
+
// Sequence diagram indicators
|
|
92
|
+
{ pattern: /\bparticipant\s+/i, type: "sequence" },
|
|
93
|
+
{ pattern: /\bactor\s+.*:/i, type: "sequence" },
|
|
94
|
+
{ pattern: /\b\w+\s*->>?\s*\w+\s*:/i, type: "sequence" },
|
|
95
|
+
// Activity diagram indicators
|
|
96
|
+
{ pattern: /\bstart\s*$/im, type: "activity" },
|
|
97
|
+
{ pattern: /:.*;\s*$/m, type: "activity" },
|
|
98
|
+
{ pattern: /\bif\s*\(.*\)\s*then/i, type: "activity" },
|
|
99
|
+
// State diagram indicators
|
|
100
|
+
{ pattern: /\bstate\s+/i, type: "state" },
|
|
101
|
+
{ pattern: /\[\*\]\s*-->/i, type: "state" },
|
|
102
|
+
{ pattern: /-->\s*\[\*\]/i, type: "state" },
|
|
103
|
+
// Component diagram indicators
|
|
104
|
+
{ pattern: /\bcomponent\s+/i, type: "component" },
|
|
105
|
+
{ pattern: /\[.*\]\s*-->/i, type: "component" },
|
|
106
|
+
{ pattern: /\bpackage\s+"[^"]+"\s*\{/i, type: "component" },
|
|
107
|
+
// Use case diagram indicators
|
|
108
|
+
{ pattern: /\busecase\s+/i, type: "usecase" },
|
|
109
|
+
{ pattern: /\bactor\s+\w+\s*$/im, type: "usecase" },
|
|
110
|
+
// Object diagram indicators
|
|
111
|
+
{ pattern: /\bobject\s+/i, type: "object" },
|
|
112
|
+
// Deployment diagram indicators
|
|
113
|
+
{ pattern: /\bnode\s+/i, type: "deployment" },
|
|
114
|
+
{ pattern: /\bdatabase\s+/i, type: "deployment" },
|
|
115
|
+
// Timing diagram indicators
|
|
116
|
+
{ pattern: /\bconcise\s+/i, type: "timing" },
|
|
117
|
+
{ pattern: /\brobust\s+/i, type: "timing" },
|
|
118
|
+
];
|
|
119
|
+
for (const { pattern, type } of patterns) {
|
|
120
|
+
if (pattern.test(code)) {
|
|
121
|
+
return type;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return "unknown";
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Parse error message from PlantUML server response
|
|
128
|
+
*/
|
|
129
|
+
function parseErrors(errorText, code) {
|
|
130
|
+
const errors = [];
|
|
131
|
+
const lines = code.split("\n");
|
|
132
|
+
// PlantUML error patterns:
|
|
133
|
+
// "Syntax Error?" followed by line content
|
|
134
|
+
// "Error line X" pattern
|
|
135
|
+
// Or just the error message
|
|
136
|
+
const errorLinePattern = /error\s+(?:at\s+)?line\s+(\d+)/i;
|
|
137
|
+
const syntaxErrorPattern = /syntax error/i;
|
|
138
|
+
const lineMatch = errorText.match(errorLinePattern);
|
|
139
|
+
if (lineMatch) {
|
|
140
|
+
const lineNum = parseInt(lineMatch[1], 10);
|
|
141
|
+
errors.push({
|
|
142
|
+
line: lineNum,
|
|
143
|
+
message: errorText.trim(),
|
|
144
|
+
suggestion: lineNum <= lines.length ? `Check line: "${lines[lineNum - 1]?.trim()}"` : undefined,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else if (syntaxErrorPattern.test(errorText)) {
|
|
148
|
+
// Try to find the problematic line from error text
|
|
149
|
+
// PlantUML often includes the problematic text in the error
|
|
150
|
+
errors.push({
|
|
151
|
+
line: 1,
|
|
152
|
+
message: errorText.trim(),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
// Generic error
|
|
157
|
+
errors.push({
|
|
158
|
+
line: 1,
|
|
159
|
+
message: errorText.trim(),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return errors;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Format mapping for PlantUML endpoints
|
|
166
|
+
*/
|
|
167
|
+
const FORMAT_ENDPOINTS = {
|
|
168
|
+
ascii: "/txt",
|
|
169
|
+
png: "/png",
|
|
170
|
+
svg: "/svg",
|
|
171
|
+
eps: "/eps",
|
|
172
|
+
};
|
|
173
|
+
const FORMAT_CONTENT_TYPES = {
|
|
174
|
+
ascii: "text/plain",
|
|
175
|
+
png: "image/png",
|
|
176
|
+
svg: "image/svg+xml",
|
|
177
|
+
eps: "application/postscript",
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* PlantUML HTTP Client
|
|
181
|
+
*/
|
|
182
|
+
export class PlantUmlClient {
|
|
183
|
+
baseUrl;
|
|
184
|
+
timeoutMs;
|
|
185
|
+
constructor(baseUrl, timeoutMs = 30000) {
|
|
186
|
+
this.baseUrl = baseUrl;
|
|
187
|
+
this.timeoutMs = timeoutMs;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Validate PlantUML syntax by attempting to render it
|
|
191
|
+
*/
|
|
192
|
+
async validate(code) {
|
|
193
|
+
const normalizedCode = normalizePlantUml(code);
|
|
194
|
+
const diagramType = detectDiagramType(normalizedCode);
|
|
195
|
+
const encoded = encodePlantUml(normalizedCode);
|
|
196
|
+
try {
|
|
197
|
+
// Use TXT endpoint for validation - returns plain text errors (not SVG)
|
|
198
|
+
const response = await fetch(`${this.baseUrl}/txt/${encoded}`, {
|
|
199
|
+
method: "GET",
|
|
200
|
+
signal: AbortSignal.timeout(this.timeoutMs),
|
|
201
|
+
});
|
|
202
|
+
const body = await response.text();
|
|
203
|
+
// Check for error markers in plain text response
|
|
204
|
+
if (body.includes("Syntax Error") ||
|
|
205
|
+
body.includes("No @startuml") ||
|
|
206
|
+
body.includes("Error line")) {
|
|
207
|
+
const errors = parseErrors(body, normalizedCode);
|
|
208
|
+
return {
|
|
209
|
+
valid: false,
|
|
210
|
+
normalizedCode,
|
|
211
|
+
diagramType,
|
|
212
|
+
errors,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
// Valid diagram (TXT endpoint returns ASCII art representation)
|
|
216
|
+
if (response.ok) {
|
|
217
|
+
return {
|
|
218
|
+
valid: true,
|
|
219
|
+
normalizedCode,
|
|
220
|
+
diagramType,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// Unexpected response
|
|
224
|
+
return {
|
|
225
|
+
valid: false,
|
|
226
|
+
normalizedCode,
|
|
227
|
+
diagramType,
|
|
228
|
+
errors: [
|
|
229
|
+
{
|
|
230
|
+
line: 1,
|
|
231
|
+
message: `Unexpected response from PlantUML server: ${response.status}`,
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
238
|
+
return {
|
|
239
|
+
valid: false,
|
|
240
|
+
normalizedCode,
|
|
241
|
+
diagramType,
|
|
242
|
+
errors: [
|
|
243
|
+
{
|
|
244
|
+
line: 1,
|
|
245
|
+
message: `PlantUML server error: ${message}`,
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Render PlantUML diagram to specified format
|
|
253
|
+
*/
|
|
254
|
+
async render(code, format) {
|
|
255
|
+
const normalizedCode = normalizePlantUml(code);
|
|
256
|
+
const encoded = encodePlantUml(normalizedCode);
|
|
257
|
+
const endpoint = FORMAT_ENDPOINTS[format];
|
|
258
|
+
const contentType = FORMAT_CONTENT_TYPES[format];
|
|
259
|
+
const response = await fetch(`${this.baseUrl}${endpoint}/${encoded}`, {
|
|
260
|
+
method: "GET",
|
|
261
|
+
signal: AbortSignal.timeout(this.timeoutMs),
|
|
262
|
+
});
|
|
263
|
+
if (!response.ok) {
|
|
264
|
+
throw new Error(`PlantUML render failed: ${response.status} ${response.statusText}`);
|
|
265
|
+
}
|
|
266
|
+
// For text formats, return content directly
|
|
267
|
+
if (format === "ascii" || format === "svg") {
|
|
268
|
+
const content = await response.text();
|
|
269
|
+
// Check for error in response
|
|
270
|
+
if (content.includes("Syntax Error")) {
|
|
271
|
+
throw new Error(`PlantUML syntax error: ${content}`);
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
format,
|
|
275
|
+
content,
|
|
276
|
+
contentType,
|
|
277
|
+
size: Buffer.byteLength(content, "utf-8"),
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
// For binary formats, return as base64
|
|
281
|
+
const buffer = await response.arrayBuffer();
|
|
282
|
+
const content = Buffer.from(buffer).toString("base64");
|
|
283
|
+
return {
|
|
284
|
+
format,
|
|
285
|
+
content,
|
|
286
|
+
contentType,
|
|
287
|
+
size: buffer.byteLength,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Check if server is healthy
|
|
292
|
+
*/
|
|
293
|
+
async healthCheck() {
|
|
294
|
+
try {
|
|
295
|
+
const response = await fetch(this.baseUrl, {
|
|
296
|
+
method: "GET",
|
|
297
|
+
signal: AbortSignal.timeout(2000),
|
|
298
|
+
});
|
|
299
|
+
return response.ok;
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/utils/plantuml/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,M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AM,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE;gBACzC,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;aAClC,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,EAAE,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PlantUML Docker Container Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages the lifecycle of PlantUML server Docker containers.
|
|
5
|
+
* - Lazy initialization on first use
|
|
6
|
+
* - Dynamic port allocation
|
|
7
|
+
* - Graceful shutdown on process exit
|
|
8
|
+
* - Multi-instance support (each MCP gets unique container)
|
|
9
|
+
*/
|
|
10
|
+
import type { ContainerState, PlantUmlConfig } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Start a new PlantUML container
|
|
13
|
+
*/
|
|
14
|
+
export declare function startContainer(config?: PlantUmlConfig): Promise<ContainerState>;
|
|
15
|
+
/**
|
|
16
|
+
* Get current container state (if running)
|
|
17
|
+
*/
|
|
18
|
+
export declare function getContainerState(): ContainerState | null;
|
|
19
|
+
/**
|
|
20
|
+
* Check if container is running and healthy
|
|
21
|
+
*/
|
|
22
|
+
export declare function isContainerHealthy(): Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Stop and remove the container
|
|
25
|
+
*/
|
|
26
|
+
export declare function stopContainer(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Ensure container is running (start if needed)
|
|
29
|
+
*/
|
|
30
|
+
export declare function ensureContainer(config?: PlantUmlConfig): Promise<ContainerState>;
|
|
31
|
+
/**
|
|
32
|
+
* Clean up any orphaned Jicon PlantUML containers from previous runs
|
|
33
|
+
*/
|
|
34
|
+
export declare function cleanupOrphanedContainers(): Promise<number>;
|
|
35
|
+
//# sourceMappingURL=docker-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-manager.d.ts","sourceRoot":"","sources":["../../../src/utils/plantuml/docker-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmHjE;;GAEG;AACH,wBAAsB,cAAc,CAClC,MAAM,GAAE,cAAmB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAoFzB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAEzD;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAc3D;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAenD;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CAazB;AAED;;GAEG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CAiCjE"}
|