@crypto512/jicon-mcp 0.7.1 → 1.0.1
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,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions and Zod schemas for XHTML buffer editing
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import type { Document, Element } from "linkedom";
|
|
6
|
+
export declare const PositionSchema: z.ZodEnum<["before", "after", "inside-start", "inside-end"]>;
|
|
7
|
+
export type Position = z.infer<typeof PositionSchema>;
|
|
8
|
+
export declare const SemanticPositionSchema: z.ZodEnum<["after-title", "after-heading", "before-content", "end", "after-toc"]>;
|
|
9
|
+
export type SemanticPosition = z.infer<typeof SemanticPositionSchema>;
|
|
10
|
+
export declare const OperationSchema: z.ZodEnum<["insert", "insert-plantuml", "update", "update-plantuml", "remove", "move", "wrap"]>;
|
|
11
|
+
export type Operation = z.infer<typeof OperationSchema>;
|
|
12
|
+
export declare const BufferEditXhtmlSchema: z.ZodObject<{
|
|
13
|
+
bufferId: z.ZodString;
|
|
14
|
+
operation: z.ZodEnum<["insert", "insert-plantuml", "update", "update-plantuml", "remove", "move", "wrap"]>;
|
|
15
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
16
|
+
position: z.ZodOptional<z.ZodEnum<["before", "after", "inside-start", "inside-end"]>>;
|
|
17
|
+
semanticPosition: z.ZodOptional<z.ZodEnum<["after-title", "after-heading", "before-content", "end", "after-toc"]>>;
|
|
18
|
+
content: z.ZodOptional<z.ZodString>;
|
|
19
|
+
plantuml: z.ZodOptional<z.ZodString>;
|
|
20
|
+
macroId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
22
|
+
targetSelector: z.ZodOptional<z.ZodString>;
|
|
23
|
+
matchIndex: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
matchAll: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
25
|
+
validate: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
bufferId: string;
|
|
28
|
+
operation: "update" | "insert" | "insert-plantuml" | "update-plantuml" | "remove" | "move" | "wrap";
|
|
29
|
+
matchAll: boolean;
|
|
30
|
+
validate: boolean;
|
|
31
|
+
content?: string | undefined;
|
|
32
|
+
attributes?: Record<string, string> | undefined;
|
|
33
|
+
selector?: string | undefined;
|
|
34
|
+
position?: "before" | "after" | "inside-start" | "inside-end" | undefined;
|
|
35
|
+
semanticPosition?: "after-title" | "after-heading" | "before-content" | "end" | "after-toc" | undefined;
|
|
36
|
+
plantuml?: string | undefined;
|
|
37
|
+
macroId?: string | undefined;
|
|
38
|
+
targetSelector?: string | undefined;
|
|
39
|
+
matchIndex?: number | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
bufferId: string;
|
|
42
|
+
operation: "update" | "insert" | "insert-plantuml" | "update-plantuml" | "remove" | "move" | "wrap";
|
|
43
|
+
content?: string | undefined;
|
|
44
|
+
attributes?: Record<string, string> | undefined;
|
|
45
|
+
selector?: string | undefined;
|
|
46
|
+
position?: "before" | "after" | "inside-start" | "inside-end" | undefined;
|
|
47
|
+
semanticPosition?: "after-title" | "after-heading" | "before-content" | "end" | "after-toc" | undefined;
|
|
48
|
+
plantuml?: string | undefined;
|
|
49
|
+
macroId?: string | undefined;
|
|
50
|
+
targetSelector?: string | undefined;
|
|
51
|
+
matchIndex?: number | undefined;
|
|
52
|
+
matchAll?: boolean | undefined;
|
|
53
|
+
validate?: boolean | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export type BufferEditXhtmlArgs = z.infer<typeof BufferEditXhtmlSchema>;
|
|
56
|
+
export interface ValidationError {
|
|
57
|
+
type: "parse_error" | "structure_error" | "invalid_element" | "missing_attribute" | "plantuml_error";
|
|
58
|
+
message: string;
|
|
59
|
+
location?: {
|
|
60
|
+
line?: number;
|
|
61
|
+
column?: number;
|
|
62
|
+
context?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface ValidationWarning {
|
|
66
|
+
type: "deprecated" | "best_practice" | "unknown_element";
|
|
67
|
+
message: string;
|
|
68
|
+
location?: {
|
|
69
|
+
line?: number;
|
|
70
|
+
column?: number;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface ValidationResult {
|
|
74
|
+
valid: boolean;
|
|
75
|
+
errors: ValidationError[];
|
|
76
|
+
warnings: ValidationWarning[];
|
|
77
|
+
}
|
|
78
|
+
export interface XhtmlEditSuccess {
|
|
79
|
+
bufferId: string;
|
|
80
|
+
success: true;
|
|
81
|
+
operation: Operation;
|
|
82
|
+
matchCount: number;
|
|
83
|
+
oldSize: number;
|
|
84
|
+
newSize: number;
|
|
85
|
+
affectedElements?: string[];
|
|
86
|
+
}
|
|
87
|
+
export interface XhtmlEditError {
|
|
88
|
+
error: true;
|
|
89
|
+
message: string;
|
|
90
|
+
details?: {
|
|
91
|
+
selector?: string;
|
|
92
|
+
matchCount?: number;
|
|
93
|
+
parseError?: string;
|
|
94
|
+
validationErrors?: ValidationError[];
|
|
95
|
+
plantumlError?: {
|
|
96
|
+
line?: number;
|
|
97
|
+
column?: number;
|
|
98
|
+
expected?: string[];
|
|
99
|
+
found?: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export type XhtmlEditResult = XhtmlEditSuccess | XhtmlEditError;
|
|
104
|
+
export interface PlantUmlValidationResult {
|
|
105
|
+
valid: boolean;
|
|
106
|
+
normalizedCode: string;
|
|
107
|
+
error?: {
|
|
108
|
+
message: string;
|
|
109
|
+
line?: number;
|
|
110
|
+
column?: number;
|
|
111
|
+
expected?: string[];
|
|
112
|
+
found?: string;
|
|
113
|
+
suggestion?: string;
|
|
114
|
+
};
|
|
115
|
+
diagramType?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface ParseResult {
|
|
118
|
+
document: Document | null;
|
|
119
|
+
error: {
|
|
120
|
+
message: string;
|
|
121
|
+
line?: number;
|
|
122
|
+
column?: number;
|
|
123
|
+
context?: string;
|
|
124
|
+
} | null;
|
|
125
|
+
}
|
|
126
|
+
export interface SelectorMatch {
|
|
127
|
+
element: Element;
|
|
128
|
+
index: number;
|
|
129
|
+
}
|
|
130
|
+
export interface SelectorResult {
|
|
131
|
+
matches: SelectorMatch[];
|
|
132
|
+
totalCount: number;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/xhtml/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,cAAc,8DAKzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAGtD,eAAO,MAAM,sBAAsB,mFAMjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGtE,eAAO,MAAM,eAAe,iGAQ1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAGxD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEhC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGxE,MAA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AM,CAAC,EAAE,MAAM,CAAC;YAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;YACpB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;KACH,CAAC;CACH;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAGhE,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;CACV;AAGD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions and Zod schemas for XHTML buffer editing
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
// Position for insert operations
|
|
6
|
+
export const PositionSchema = z.enum([
|
|
7
|
+
"before", // Insert as previous sibling
|
|
8
|
+
"after", // Insert as next sibling
|
|
9
|
+
"inside-start", // Insert as first child
|
|
10
|
+
"inside-end", // Insert as last child (append)
|
|
11
|
+
]);
|
|
12
|
+
// Semantic positions for easy PlantUML insertion
|
|
13
|
+
export const SemanticPositionSchema = z.enum([
|
|
14
|
+
"after-title", // After first h1 or h2
|
|
15
|
+
"after-heading", // After first heading (h1-h6)
|
|
16
|
+
"before-content", // At start of document body
|
|
17
|
+
"end", // At end of document
|
|
18
|
+
"after-toc", // After table of contents macro (if present)
|
|
19
|
+
]);
|
|
20
|
+
// Operation types
|
|
21
|
+
export const OperationSchema = z.enum([
|
|
22
|
+
"insert", // Add new element at position relative to target
|
|
23
|
+
"insert-plantuml", // Insert PlantUML with validation + macro wrapping
|
|
24
|
+
"update", // Replace element content or attributes
|
|
25
|
+
"update-plantuml", // Update PlantUML code with validation
|
|
26
|
+
"remove", // Delete element(s) from document
|
|
27
|
+
"move", // Move element to new location
|
|
28
|
+
"wrap", // Wrap element with new parent
|
|
29
|
+
]);
|
|
30
|
+
// Main tool input schema
|
|
31
|
+
export const BufferEditXhtmlSchema = z.object({
|
|
32
|
+
bufferId: z.string().describe("Buffer ID containing XHTML content"),
|
|
33
|
+
operation: OperationSchema.describe("The operation to perform"),
|
|
34
|
+
selector: z.string().optional().describe(`CSS-like selector to target elements. Required unless semanticPosition is used. Supports:
|
|
35
|
+
- Tag name: 'p', 'h1', 'table'
|
|
36
|
+
- Namespaced: 'ac:structured-macro', 'ri:page'
|
|
37
|
+
- Attributes: '[ac:name="plantuml"]', 'ac:structured-macro[ac:name="code"]'
|
|
38
|
+
- Pseudo-selectors: ':nth-child(2)', ':first-child', ':last-child', ':contains("text")'
|
|
39
|
+
- Descendants: 'table tbody tr'
|
|
40
|
+
- Direct children: 'ul > li'`),
|
|
41
|
+
// For insert/move operations
|
|
42
|
+
position: PositionSchema.optional().describe("Position relative to selected element (required for insert/move)"),
|
|
43
|
+
// For PlantUML insertion - semantic position (alternative to selector)
|
|
44
|
+
semanticPosition: SemanticPositionSchema.optional().describe(`Semantic position for PlantUML insertion (alternative to selector):
|
|
45
|
+
- 'after-title': After first h1 or h2
|
|
46
|
+
- 'after-heading': After first heading (h1-h6)
|
|
47
|
+
- 'before-content': At start of document body
|
|
48
|
+
- 'end': At end of document
|
|
49
|
+
- 'after-toc': After table of contents macro`),
|
|
50
|
+
// For insert/update/wrap operations
|
|
51
|
+
content: z.string().optional().describe("XHTML content to insert, or new content for update, or wrapper element for wrap"),
|
|
52
|
+
// For PlantUML operations
|
|
53
|
+
plantuml: z.string().optional().describe("Raw PlantUML code (with or without @startuml/@enduml markers)"),
|
|
54
|
+
// For PlantUML operations - custom macro ID
|
|
55
|
+
macroId: z.string().optional().describe("Optional custom macro ID for PlantUML (auto-generated if not provided)"),
|
|
56
|
+
// For update operations - update attributes only (no content change)
|
|
57
|
+
attributes: z.record(z.string()).optional().describe("Attributes to set/update on selected element (for update operation)"),
|
|
58
|
+
// For move operation
|
|
59
|
+
targetSelector: z.string().optional().describe("Target element selector for move operation (element moves relative to this)"),
|
|
60
|
+
// Options
|
|
61
|
+
matchIndex: z.number().optional().describe("When selector matches multiple elements, operate on this index (0-based). Omit to require unique match."),
|
|
62
|
+
matchAll: z.boolean().optional().default(false).describe("Apply operation to all matching elements (for remove/update)"),
|
|
63
|
+
validate: z.boolean().optional().default(true).describe("Validate XHTML structure after edit (default: true)"),
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/xhtml/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,iCAAiC;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,QAAQ,EAAQ,6BAA6B;IAC7C,OAAO,EAAS,yBAAyB;IACzC,cAAc,EAAE,wBAAwB;IACxC,YAAY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AE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACtC,+DAA+D,CAChE;IAED,4CAA4C;IAC5C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACrC,wEAAwE,CACzE;IAED,qEAAqE;IACrE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAClD,qEAAqE,CACtE;IAED,qBAAqB;IACrB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAC5C,6EAA6E,CAC9E;IAED,UAAU;IACV,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACxC,yGAAyG,CAC1G;IAED,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CACtD,8DAA8D,CAC/D;IAED,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CACrD,qDAAqD,CACtD;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XHTML and Confluence Storage Format Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates:
|
|
5
|
+
* - XML well-formedness
|
|
6
|
+
* - Confluence-specific elements and attributes
|
|
7
|
+
* - Required attributes
|
|
8
|
+
* - Valid attribute values
|
|
9
|
+
* - PlantUML syntax (via Docker service)
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationResult, ValidationError, ValidationWarning } from "./types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Validate XHTML content
|
|
14
|
+
*
|
|
15
|
+
* @param content - XHTML string to validate
|
|
16
|
+
* @returns ValidationResult with errors and warnings
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateXhtml(content: string): ValidationResult;
|
|
19
|
+
/**
|
|
20
|
+
* Quick check if content is valid (no detailed errors)
|
|
21
|
+
*/
|
|
22
|
+
export declare function isValid(content: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Format validation errors for display
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatValidationErrors(errors: ValidationError[]): string;
|
|
27
|
+
/**
|
|
28
|
+
* Format validation warnings for display
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatValidationWarnings(warnings: ValidationWarning[]): string;
|
|
31
|
+
/**
|
|
32
|
+
* PlantUML validation info returned by async validation
|
|
33
|
+
*/
|
|
34
|
+
export interface PlantUmlValidationInfo {
|
|
35
|
+
macroIndex: number;
|
|
36
|
+
valid: boolean;
|
|
37
|
+
diagramType?: string;
|
|
38
|
+
errors?: Array<{
|
|
39
|
+
line?: number;
|
|
40
|
+
column?: number;
|
|
41
|
+
message: string;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extended validation result with PlantUML info
|
|
46
|
+
*/
|
|
47
|
+
export interface AsyncValidationResult extends ValidationResult {
|
|
48
|
+
plantuml?: PlantUmlValidationInfo[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validate XHTML content asynchronously with PlantUML validation
|
|
52
|
+
*
|
|
53
|
+
* This performs all synchronous validation plus:
|
|
54
|
+
* - PlantUML syntax validation via Docker service (if available)
|
|
55
|
+
*
|
|
56
|
+
* @param content - XHTML string to validate
|
|
57
|
+
* @param options - Validation options
|
|
58
|
+
* @returns AsyncValidationResult with errors, warnings, and PlantUML info
|
|
59
|
+
*/
|
|
60
|
+
export declare function validateXhtmlAsync(content: string, options?: {
|
|
61
|
+
validatePlantUml?: boolean;
|
|
62
|
+
}): Promise<AsyncValidationResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Validate and return detailed report
|
|
65
|
+
*/
|
|
66
|
+
export declare function getValidationReport(content: string): string;
|
|
67
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/utils/xhtml/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAiGvF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAoC/D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAqBxE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAc9E;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,QAAQ,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAoBD;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3C,OAAO,CAAC,qBAAqB,CAAC,CA4FhC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAsB3D"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XHTML and Confluence Storage Format Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates:
|
|
5
|
+
* - XML well-formedness
|
|
6
|
+
* - Confluence-specific elements and attributes
|
|
7
|
+
* - Required attributes
|
|
8
|
+
* - Valid attribute values
|
|
9
|
+
* - PlantUML syntax (via Docker service)
|
|
10
|
+
*/
|
|
11
|
+
import { parseXhtml, getContentRoot } from "./parser.js";
|
|
12
|
+
import { isConfluenceElement, isStandardHtmlElement, isKnownMacro, getElementDef, getRequiredAttributes, } from "./confluence-schema.js";
|
|
13
|
+
import { extractPlantUmlFromMacroWithError } from "./plantuml.js";
|
|
14
|
+
import { validate as validatePlantUmlWithDocker, isAvailable as isPlantUmlServiceAvailable } from "../plantuml/service.js";
|
|
15
|
+
/**
|
|
16
|
+
* Validate an element recursively
|
|
17
|
+
*/
|
|
18
|
+
function validateElement(element, errors, warnings) {
|
|
19
|
+
const tagName = element.tagName.toLowerCase();
|
|
20
|
+
// Skip our wrapper element
|
|
21
|
+
if (tagName === "xhtml-root") {
|
|
22
|
+
for (const child of element.children) {
|
|
23
|
+
validateElement(child, errors, warnings);
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// Check if element is known
|
|
28
|
+
if (!isConfluenceElement(tagName) && !isStandardHtmlElement(tagName)) {
|
|
29
|
+
// Unknown element - add warning
|
|
30
|
+
warnings.push({
|
|
31
|
+
type: "unknown_element",
|
|
32
|
+
message: `Unknown element: <${tagName}>`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// For Confluence elements, check required attributes
|
|
36
|
+
if (isConfluenceElement(tagName)) {
|
|
37
|
+
const requiredAttrs = getRequiredAttributes(tagName);
|
|
38
|
+
for (const attr of requiredAttrs) {
|
|
39
|
+
if (!element.hasAttribute(attr)) {
|
|
40
|
+
errors.push({
|
|
41
|
+
type: "missing_attribute",
|
|
42
|
+
message: `Element <${tagName}> is missing required attribute: ${attr}`,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Validate attribute values
|
|
47
|
+
const def = getElementDef(tagName);
|
|
48
|
+
if (def?.validValues) {
|
|
49
|
+
for (const [attrName, validValues] of Object.entries(def.validValues)) {
|
|
50
|
+
if (attrName === "_text") {
|
|
51
|
+
// Validate text content
|
|
52
|
+
const textContent = element.textContent?.trim();
|
|
53
|
+
if (textContent && !validValues.includes(textContent)) {
|
|
54
|
+
errors.push({
|
|
55
|
+
type: "invalid_element",
|
|
56
|
+
message: `Invalid value "${textContent}" for <${tagName}>. Valid values: ${validValues.join(", ")}`,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Validate attribute value
|
|
62
|
+
const attrValue = element.getAttribute(attrName);
|
|
63
|
+
if (attrValue && !validValues.includes(attrValue)) {
|
|
64
|
+
errors.push({
|
|
65
|
+
type: "invalid_element",
|
|
66
|
+
message: `Invalid value "${attrValue}" for attribute ${attrName} on <${tagName}>. Valid values: ${validValues.join(", ")}`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Special validation for structured macros
|
|
73
|
+
if (tagName === "ac:structured-macro") {
|
|
74
|
+
const macroName = element.getAttribute("ac:name");
|
|
75
|
+
if (macroName && !isKnownMacro(macroName)) {
|
|
76
|
+
warnings.push({
|
|
77
|
+
type: "unknown_element",
|
|
78
|
+
message: `Unknown macro: "${macroName}". This may still work if the macro is installed on your Confluence instance.`,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Recursively validate children
|
|
84
|
+
for (const child of element.children) {
|
|
85
|
+
validateElement(child, errors, warnings);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Validate XHTML content
|
|
90
|
+
*
|
|
91
|
+
* @param content - XHTML string to validate
|
|
92
|
+
* @returns ValidationResult with errors and warnings
|
|
93
|
+
*/
|
|
94
|
+
export function validateXhtml(content) {
|
|
95
|
+
const errors = [];
|
|
96
|
+
const warnings = [];
|
|
97
|
+
// Try to parse
|
|
98
|
+
const parseResult = parseXhtml(content);
|
|
99
|
+
if (!parseResult.document) {
|
|
100
|
+
// Parse error
|
|
101
|
+
errors.push({
|
|
102
|
+
type: "parse_error",
|
|
103
|
+
message: parseResult.error?.message || "Failed to parse XHTML",
|
|
104
|
+
location: {
|
|
105
|
+
line: parseResult.error?.line,
|
|
106
|
+
column: parseResult.error?.column,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
valid: false,
|
|
111
|
+
errors,
|
|
112
|
+
warnings,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// Validate structure
|
|
116
|
+
const root = getContentRoot(parseResult.document);
|
|
117
|
+
if (root) {
|
|
118
|
+
validateElement(root, errors, warnings);
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
valid: errors.length === 0,
|
|
122
|
+
errors,
|
|
123
|
+
warnings,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Quick check if content is valid (no detailed errors)
|
|
128
|
+
*/
|
|
129
|
+
export function isValid(content) {
|
|
130
|
+
return validateXhtml(content).valid;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Format validation errors for display
|
|
134
|
+
*/
|
|
135
|
+
export function formatValidationErrors(errors) {
|
|
136
|
+
if (errors.length === 0) {
|
|
137
|
+
return "No errors";
|
|
138
|
+
}
|
|
139
|
+
return errors
|
|
140
|
+
.map((e) => {
|
|
141
|
+
let msg = `[${e.type}] ${e.message}`;
|
|
142
|
+
if (e.location?.line) {
|
|
143
|
+
msg += ` (line ${e.location.line}`;
|
|
144
|
+
if (e.location.column) {
|
|
145
|
+
msg += `:${e.location.column}`;
|
|
146
|
+
}
|
|
147
|
+
msg += ")";
|
|
148
|
+
}
|
|
149
|
+
if (e.location?.context) {
|
|
150
|
+
msg += `\n Near: ${e.location.context}`;
|
|
151
|
+
}
|
|
152
|
+
return msg;
|
|
153
|
+
})
|
|
154
|
+
.join("\n");
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Format validation warnings for display
|
|
158
|
+
*/
|
|
159
|
+
export function formatValidationWarnings(warnings) {
|
|
160
|
+
if (warnings.length === 0) {
|
|
161
|
+
return "No warnings";
|
|
162
|
+
}
|
|
163
|
+
return warnings
|
|
164
|
+
.map((w) => {
|
|
165
|
+
let msg = `[${w.type}] ${w.message}`;
|
|
166
|
+
if (w.location?.line) {
|
|
167
|
+
msg += ` (line ${w.location.line})`;
|
|
168
|
+
}
|
|
169
|
+
return msg;
|
|
170
|
+
})
|
|
171
|
+
.join("\n");
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Collect all PlantUML macros from the document
|
|
175
|
+
*/
|
|
176
|
+
function collectPlantUmlMacros(element) {
|
|
177
|
+
const macros = [];
|
|
178
|
+
const tagName = element.tagName.toLowerCase();
|
|
179
|
+
if (tagName === "ac:structured-macro" && element.getAttribute("ac:name") === "plantuml") {
|
|
180
|
+
macros.push(element);
|
|
181
|
+
}
|
|
182
|
+
for (const child of element.children) {
|
|
183
|
+
macros.push(...collectPlantUmlMacros(child));
|
|
184
|
+
}
|
|
185
|
+
return macros;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Validate XHTML content asynchronously with PlantUML validation
|
|
189
|
+
*
|
|
190
|
+
* This performs all synchronous validation plus:
|
|
191
|
+
* - PlantUML syntax validation via Docker service (if available)
|
|
192
|
+
*
|
|
193
|
+
* @param content - XHTML string to validate
|
|
194
|
+
* @param options - Validation options
|
|
195
|
+
* @returns AsyncValidationResult with errors, warnings, and PlantUML info
|
|
196
|
+
*/
|
|
197
|
+
export async function validateXhtmlAsync(content, options = {}) {
|
|
198
|
+
// Start with synchronous validation
|
|
199
|
+
const syncResult = validateXhtml(content);
|
|
200
|
+
// If basic validation failed or PlantUML validation not requested, return early
|
|
201
|
+
if (!syncResult.valid || options.validatePlantUml === false) {
|
|
202
|
+
return syncResult;
|
|
203
|
+
}
|
|
204
|
+
// Parse again to collect PlantUML macros
|
|
205
|
+
const parseResult = parseXhtml(content);
|
|
206
|
+
if (!parseResult.document) {
|
|
207
|
+
return syncResult;
|
|
208
|
+
}
|
|
209
|
+
const root = getContentRoot(parseResult.document);
|
|
210
|
+
if (!root) {
|
|
211
|
+
return syncResult;
|
|
212
|
+
}
|
|
213
|
+
// Collect PlantUML macros
|
|
214
|
+
const plantUmlMacros = collectPlantUmlMacros(root);
|
|
215
|
+
if (plantUmlMacros.length === 0) {
|
|
216
|
+
return syncResult;
|
|
217
|
+
}
|
|
218
|
+
// Check if PlantUML service is available
|
|
219
|
+
const serviceAvailable = isPlantUmlServiceAvailable();
|
|
220
|
+
// Validate each PlantUML macro
|
|
221
|
+
const plantumlResults = [];
|
|
222
|
+
const errors = [...syncResult.errors];
|
|
223
|
+
const warnings = [...syncResult.warnings];
|
|
224
|
+
for (let i = 0; i < plantUmlMacros.length; i++) {
|
|
225
|
+
const macro = plantUmlMacros[i];
|
|
226
|
+
const extractionResult = extractPlantUmlFromMacroWithError(macro);
|
|
227
|
+
if (!extractionResult.code) {
|
|
228
|
+
const errorMsg = extractionResult.error || "No diagram code found";
|
|
229
|
+
errors.push({
|
|
230
|
+
type: "invalid_element",
|
|
231
|
+
message: `PlantUML macro #${i + 1}: ${errorMsg}`,
|
|
232
|
+
});
|
|
233
|
+
plantumlResults.push({ macroIndex: i, valid: false, errors: [{ message: errorMsg }] });
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
const code = extractionResult.code;
|
|
237
|
+
if (!serviceAvailable) {
|
|
238
|
+
// Service not running - add warning but don't fail
|
|
239
|
+
warnings.push({
|
|
240
|
+
type: "unknown_element",
|
|
241
|
+
message: `PlantUML macro #${i + 1} not validated (Docker service not running). Use plantuml_validate or plantuml_render to start the service.`,
|
|
242
|
+
});
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
const result = await validatePlantUmlWithDocker(code);
|
|
247
|
+
plantumlResults.push({
|
|
248
|
+
macroIndex: i,
|
|
249
|
+
valid: result.valid,
|
|
250
|
+
diagramType: result.diagramType,
|
|
251
|
+
errors: result.errors,
|
|
252
|
+
});
|
|
253
|
+
if (!result.valid) {
|
|
254
|
+
const errorMsg = result.errors?.[0]?.message || "Unknown syntax error";
|
|
255
|
+
const lineInfo = result.errors?.[0]?.line ? ` at line ${result.errors[0].line}` : "";
|
|
256
|
+
errors.push({
|
|
257
|
+
type: "invalid_element",
|
|
258
|
+
message: `PlantUML macro #${i + 1}: ${errorMsg}${lineInfo}`,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
// Docker error - add warning but don't fail
|
|
264
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
265
|
+
warnings.push({
|
|
266
|
+
type: "unknown_element",
|
|
267
|
+
message: `PlantUML macro #${i + 1} validation failed: ${errMsg}`,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
valid: errors.length === 0,
|
|
273
|
+
errors,
|
|
274
|
+
warnings,
|
|
275
|
+
plantuml: plantumlResults.length > 0 ? plantumlResults : undefined,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Validate and return detailed report
|
|
280
|
+
*/
|
|
281
|
+
export function getValidationReport(content) {
|
|
282
|
+
const result = validateXhtml(content);
|
|
283
|
+
const lines = [];
|
|
284
|
+
if (result.valid) {
|
|
285
|
+
lines.push("✓ XHTML is valid");
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
lines.push("✗ XHTML validation failed");
|
|
289
|
+
}
|
|
290
|
+
if (result.errors.length > 0) {
|
|
291
|
+
lines.push("\nErrors:");
|
|
292
|
+
lines.push(formatValidationErrors(result.errors));
|
|
293
|
+
}
|
|
294
|
+
if (result.warnings.length > 0) {
|
|
295
|
+
lines.push("\nWarnings:");
|
|
296
|
+
lines.push(formatValidationWarnings(result.warnings));
|
|
297
|
+
}
|
|
298
|
+
return lines.join("\n");
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/utils/xhtml/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,QAAQ,IAAI,0BAA0B,EAAE,WAAW,IAAI,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG3H;;GAEG;AACH,SAAS,eAAe,CACtB,OAAgB,EAChB,MAAyB,EACzB,QAA6B;IAE7B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAE9C,2BAA2B;IAC3B,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QAC7B,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrC,eAAe,CAAC,KAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACtD,CAAC;QACD,OAAO;IACT,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACrE,gCAAgC;QAChC,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,i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C,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crypto512/jicon-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Model Context Protocol server for Jira, Confluence, and Tempo integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,8 +28,12 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
31
|
+
"@types/dockerode": "^3.3.47",
|
|
31
32
|
"axios": "^1.7.0",
|
|
33
|
+
"dockerode": "^4.0.9",
|
|
32
34
|
"form-data": "^4.0.0",
|
|
35
|
+
"get-port": "^7.1.0",
|
|
36
|
+
"linkedom": "^0.18.12",
|
|
33
37
|
"zod": "^3.23.0"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|