@vint.tri/report_gen_mcp 1.5.25 → 1.5.27

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/dist/index.js CHANGED
@@ -109,7 +109,7 @@ if (process.argv.length === 2) {
109
109
  // No command specified, run in stdio mode using MCP SDK
110
110
  const mcpServer = new McpServer({
111
111
  name: "report_gen_mcp",
112
- version: "1.5.25"
112
+ version: "1.5.27"
113
113
  }, {
114
114
  // Disable health check to prevent automatic calls
115
115
  capabilities: {
@@ -1 +1 @@
1
- {"version":3,"file":"reportGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/reportGenerator.ts"],"names":[],"mappings":"AAoHA,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM;;;GAoInB"}
1
+ {"version":3,"file":"reportGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/reportGenerator.ts"],"names":[],"mappings":"AAuHA,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM;;;GA4InB"}
@@ -10,6 +10,7 @@ import { radarSchema, renderRadarChart } from '../charts/radar.js';
10
10
  import { polarAreaSchema, renderPolarAreaChart } from '../charts/polarArea.js';
11
11
  import { urlImageSchema, renderUrlImage } from '../images/urlImages.js';
12
12
  async function extractElementsFromMarkdown(markdown) {
13
+ console.log("Starting extractElementsFromMarkdown...");
13
14
  const elements = {};
14
15
  let elementCount = 0;
15
16
  // Regex to find <canvas data-chart="...">
@@ -22,6 +23,7 @@ async function extractElementsFromMarkdown(markdown) {
22
23
  if (config && typeof config === 'object' && config.type) {
23
24
  const id = `chart-${elementCount++}`;
24
25
  elements[id] = { type: config.type, config: config };
26
+ console.log(`Extracted chart: ${id}, type: ${config.type}`);
25
27
  // Replace the original canvas tag with a placeholder
26
28
  markdown = markdown.replace(chartMatch[0], `[[chart:${id}]]`);
27
29
  }
@@ -39,9 +41,11 @@ async function extractElementsFromMarkdown(markdown) {
39
41
  const alt = imageMatch[2] || '';
40
42
  const id = `image-${elementCount++}`;
41
43
  elements[id] = { type: 'url', config: { url: src, alt: alt } };
44
+ console.log(`Extracted image: ${id}, src: ${src}`);
42
45
  // Replace the original img tag with a placeholder
43
46
  markdown = markdown.replace(imageMatch[0], `[[image:${id}]]`);
44
47
  }
48
+ console.log("Finished extractElementsFromMarkdown. Extracted elements:", Object.keys(elements));
45
49
  return elements;
46
50
  }
47
51
  const chartRenderers = {
@@ -83,10 +87,13 @@ function normalizeChartConfig(config) {
83
87
  return normalizedConfig;
84
88
  }
85
89
  export async function generateReport(document, outputFile) {
90
+ console.log("Starting generateReport...");
86
91
  const extractedElements = await extractElementsFromMarkdown(document);
87
92
  const elements = extractedElements; // Use the extracted elements
93
+ console.log("Elements after extraction:", Object.keys(elements));
88
94
  // Validate elements
89
95
  for (const [id, element] of Object.entries(elements)) {
96
+ console.log(`Validating element: ${id}, type: ${element.type}`);
90
97
  if (element.type in chartRenderers) {
91
98
  // Это диаграмма
92
99
  const chartElement = element;
@@ -98,6 +105,7 @@ export async function generateReport(document, outputFile) {
98
105
  schema.parse(normalizedConfig);
99
106
  // Update the element with normalized config for rendering
100
107
  element.config = normalizedConfig;
108
+ console.log(`Validated chart: ${id}`);
101
109
  }
102
110
  else if (element.type in imageRenderers) {
103
111
  // Это изображение
@@ -106,6 +114,7 @@ export async function generateReport(document, outputFile) {
106
114
  if (!schema)
107
115
  throw new Error(`Unsupported image type: ${imageElement.type}`);
108
116
  schema.parse(imageElement.config);
117
+ console.log(`Validated image: ${id}`);
109
118
  }
110
119
  else {
111
120
  throw new Error(`Unsupported element type: ${element.type}`);
@@ -114,17 +123,20 @@ export async function generateReport(document, outputFile) {
114
123
  // Render elements to interactive HTML
115
124
  const renderedElements = {};
116
125
  for (const [id, element] of Object.entries(elements)) {
126
+ console.log(`Rendering element: ${id}, type: ${element.type}`);
117
127
  if (element.type in chartRenderers) {
118
128
  // Это диаграмма
119
129
  const chartElement = element;
120
130
  const htmlChart = await chartRenderers[chartElement.type].renderer(chartElement.config);
121
131
  renderedElements[id] = htmlChart;
132
+ console.log(`Rendered chart: ${id}`);
122
133
  }
123
134
  else if (element.type in imageRenderers) {
124
135
  // Это изображение
125
136
  const imageElement = element;
126
137
  const htmlImage = await imageRenderers[imageElement.type].renderer(imageElement.config);
127
138
  renderedElements[id] = htmlImage;
139
+ console.log(`Rendered image: ${id}`);
128
140
  }
129
141
  }
130
142
  // Replace placeholders in Markdown, e.g., [[chart:id]] or [[image:id]]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vint.tri/report_gen_mcp",
3
- "version": "1.5.25",
3
+ "version": "1.5.27",
4
4
  "description": "CLI tool for generating HTML reports with embedded charts and images",
5
5
  "main": "dist/index.js",
6
6
  "bin": {