@vint.tri/report_gen_mcp 1.0.43 → 1.0.46

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 (80) hide show
  1. package/README.md +8 -45
  2. package/detailed-debug.js +1 -1
  3. package/dist/charts/bar.js +22 -29
  4. package/dist/charts/line.js +22 -29
  5. package/dist/charts/pie.js +21 -28
  6. package/dist/index.js +79 -336
  7. package/dist/utils/reportGenerator.js +21 -28
  8. package/dollar_to_ruble_report.html +4 -55
  9. package/final-verification-test.js +112 -197
  10. package/package.json +11 -10
  11. package/src/charts/bar.ts +7 -20
  12. package/src/charts/line.ts +7 -20
  13. package/src/charts/pie.ts +7 -20
  14. package/src/index.ts +45 -330
  15. package/src/utils/reportGenerator.ts +6 -21
  16. package/COMPLETED_TASK_SUMMARY.md +0 -77
  17. package/FINAL_IMPLEMENTATION_SUMMARY.md +0 -54
  18. package/PUBLISH_SUMMARY.md +0 -46
  19. package/check-file-content.js +0 -94
  20. package/corrected-final-verification.js +0 -196
  21. package/demo-latest-features-report.html +0 -15
  22. package/demo-new-methods.js +0 -185
  23. package/demonstrate-all-features.js +0 -168
  24. package/demonstrate-latest-features.js +0 -146
  25. package/demonstrate-new-features.js +0 -205
  26. package/demonstrate-new-methods.js +0 -185
  27. package/detailed-file-opening-test.js +0 -212
  28. package/direct-test.js +0 -31
  29. package/dollar_rub_report.html +0 -51
  30. package/http_test_reports/http_test.html +0 -15
  31. package/large-test.html +0 -52
  32. package/manual-file-url-test.js +0 -89
  33. package/package/README.md +0 -445
  34. package/package/cwd-report.html +0 -18
  35. package/package/debug-report.html +0 -15
  36. package/package/demonstrate-reports-dir-feature.js +0 -70
  37. package/package/demonstration.js +0 -200
  38. package/package/detailed-debug.js +0 -36
  39. package/package/dist/charts/bar.js +0 -43
  40. package/package/dist/charts/line.js +0 -43
  41. package/package/dist/charts/pie.js +0 -42
  42. package/package/dist/index.js +0 -233
  43. package/package/dist/utils/reportGenerator.js +0 -59
  44. package/package/dollar_to_ruble_report.html +0 -15
  45. package/package/final-verification-test.js +0 -139
  46. package/package/fix-verification-report.html +0 -18
  47. package/package/package.json +0 -35
  48. package/package/random_report.html +0 -19
  49. package/package/simple-file-test.js +0 -60
  50. package/package/src/charts/bar.ts +0 -43
  51. package/package/src/charts/line.ts +0 -43
  52. package/package/src/charts/pie.ts +0 -42
  53. package/package/src/index.ts +0 -242
  54. package/package/src/utils/reportGenerator.ts +0 -60
  55. package/package/tsconfig.json +0 -14
  56. package/problematic-file-test.js +0 -105
  57. package/published-package-verification.js +0 -225
  58. package/simple-test-tools.js +0 -80
  59. package/simple-usage-demo.js +0 -94
  60. package/test-install/package-lock.json +0 -2265
  61. package/test-install/package.json +0 -15
  62. package/test-interactive-charts-report.html +0 -55
  63. package/test-similar-content.html +0 -14
  64. package/test.html +0 -1
  65. package/test_install/package-lock.json +0 -2264
  66. package/test_install/package.json +0 -15
  67. package/test_published/dollar_to_ruble_report.html +0 -15
  68. package/test_published/package-lock.json +0 -2264
  69. package/test_published/package.json +0 -15
  70. package/test_published/proper-test-published.js +0 -175
  71. package/test_published/simple-test-published.js +0 -84
  72. package/test_reports/cli_test.html +0 -14
  73. package/test_reports/comprehensive-test.html +0 -14
  74. package/test_reports/new-report.html +0 -12
  75. package/test_reports/simple-test.html +0 -1
  76. package/test_reports/test-file.html +0 -1
  77. package/test_reports/test-report-final.html +0 -13
  78. package/test_reports/test-report-fixed.html +0 -13
  79. package/test_reports/test-report-improved.html +0 -14
  80. package/test_reports/test-report-literal-fix.html +0 -14
package/README.md CHANGED
@@ -17,13 +17,13 @@ A powerful CLI tool for generating HTML reports with embedded charts, designed t
17
17
  ### Global Installation (Recommended)
18
18
 
19
19
  ```bash
20
- npm install -g @vint.tri/report_gen_mcp@1.0.39
20
+ npm install -g @vint.tri/report_gen_mcp@1.0.45
21
21
  ```
22
22
 
23
23
  ### Direct Execution with npx
24
24
 
25
25
  ```bash
26
- REPORTS_DIR=./reports npx @vint.tri/report_gen_mcp@1.0.39
26
+ REPORTS_DIR=./reports npx @vint.tri/report_gen_mcp@1.0.45
27
27
  ```
28
28
 
29
29
  ## Usage
@@ -80,7 +80,7 @@ To use this tool with Claude Desktop, add the following configuration to your Cl
80
80
  "REPORTS_DIR": "./reports"
81
81
  },
82
82
  "args": [
83
- "@vint.tri/report_gen_mcp@1.0.39"
83
+ "@vint.tri/report_gen_mcp@1.0.45"
84
84
  ]
85
85
  }
86
86
  }
@@ -366,10 +366,9 @@ npm test
366
366
  ### Methods
367
367
 
368
368
  1. `generate-report`: Creates an HTML report with embedded charts
369
- 2. `get-report-url`: Returns a clickable URL for a generated report file and shows all available formats
370
- 3. `get-report-file`: Returns the content of a generated report file
371
- 4. `health`: Checks if the tool is running correctly
372
- 5. `mcp:list-tools`: Returns available tools (used by Claude Desktop)
369
+ 2. `get-report-url`: Returns a clickable URL for a generated report file
370
+ 3. `health`: Checks if the tool is running correctly
371
+ 4. `mcp:list-tools`: Returns available tools (used by Claude Desktop)
373
372
 
374
373
  ### Method Details
375
374
 
@@ -394,7 +393,7 @@ npm test
394
393
 
395
394
  #### get-report-url
396
395
 
397
- **Description:** Get information about a generated report file including a clickable URL and file statistics
396
+ **Description:** Get a clickable URL for a generated report file
398
397
 
399
398
  **Parameters:**
400
399
  - `filePath` (string): Full path to the report file
@@ -403,48 +402,12 @@ npm test
403
402
  ```json
404
403
  {
405
404
  "success": true,
406
- "message": "Report file information retrieved successfully",
407
- "filePath": "/absolute/path/to/report.html",
408
- "relativePath": "report.html",
409
405
  "fileUrl": "file:///absolute/path/to/report.html",
410
- "fileStats": {
411
- "size": 12345,
412
- "created": "2023-01-01T00:00:00.000Z",
413
- "modified": "2023-01-01T00:00:00.000Z"
414
- }
415
- }
416
- ```
417
-
418
- **Note:** This method only returns metadata about the file, not the file content itself. Use `get-report-file` to retrieve the actual file content.
419
-
420
- #### get-report-file
421
-
422
- **Description:** Get the content of a generated report file
423
-
424
- **Parameters:**
425
- - `filePath` (string): Full path to the report file
426
-
427
- **Response:**
428
- ```json
429
- {
430
- "success": true,
431
- "message": "Report file content retrieved successfully",
406
+ "message": "Click the URL to open the report",
432
407
  "filePath": "/absolute/path/to/report.html"
433
408
  }
434
409
  ```
435
410
 
436
- The file content is returned as a resource attachment in the response with the following structure:
437
- ```json
438
- {
439
- "type": "resource",
440
- "resource": {
441
- "uri": "file:///absolute/path/to/report.html",
442
- "mimeType": "text/html",
443
- "text": "<!DOCTYPE html><html>...</html>"
444
- }
445
- }
446
- ```
447
-
448
411
  #### health
449
412
 
450
413
  **Response:**
package/detailed-debug.js CHANGED
@@ -2,7 +2,7 @@ const { spawn } = require('child_process');
2
2
 
3
3
  console.log('Detailed debug test...\n');
4
4
 
5
- const child = spawn('npx', ['-y', '@vint.tri/report_gen_mcp@1.0.14'], {
5
+ const child = spawn('npx', ['-y', '@vint.tri/report_gen_mcp@1.0.45'], {
6
6
  stdio: ['pipe', 'pipe', 'pipe']
7
7
  });
8
8
 
@@ -1,21 +1,23 @@
1
- import { z } from 'zod';
2
- export const barSchema = z.object({
3
- labels: z.array(z.string()),
4
- datasets: z.array(z.object({
5
- label: z.string(),
6
- data: z.array(z.number()),
7
- backgroundColor: z.array(z.string()).optional(),
8
- borderColor: z.array(z.string()).optional(),
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.barSchema = void 0;
4
+ exports.renderBarChart = renderBarChart;
5
+ const zod_1 = require("zod");
6
+ const chartjs_node_canvas_1 = require("chartjs-node-canvas");
7
+ exports.barSchema = zod_1.z.object({
8
+ labels: zod_1.z.array(zod_1.z.string()),
9
+ datasets: zod_1.z.array(zod_1.z.object({
10
+ label: zod_1.z.string(),
11
+ data: zod_1.z.array(zod_1.z.number()),
12
+ backgroundColor: zod_1.z.array(zod_1.z.string()).optional(),
13
+ borderColor: zod_1.z.array(zod_1.z.string()).optional(),
9
14
  })),
10
- options: z.object({
11
- title: z.string().optional(),
15
+ options: zod_1.z.object({
16
+ title: zod_1.z.string().optional(),
12
17
  // Add more Chart.js options as needed
13
18
  }).optional(),
14
19
  });
15
- export async function renderBarChart(config) {
16
- // Generate a unique ID for the canvas element
17
- const chartId = `bar-chart-${Math.random().toString(36).substr(2, 9)}`;
18
- // Prepare the chart configuration as a JSON string
20
+ async function renderBarChart(config) {
19
21
  const chartConfig = {
20
22
  type: 'bar',
21
23
  data: {
@@ -32,19 +34,10 @@ export async function renderBarChart(config) {
32
34
  }
33
35
  },
34
36
  };
35
- // Convert the chart configuration to a JSON string
36
- const chartConfigJson = JSON.stringify(chartConfig);
37
- // Return HTML with canvas element and JavaScript to render the chart
38
- return `
39
- <div>
40
- <canvas id="${chartId}"></canvas>
41
- <script>
42
- document.addEventListener('DOMContentLoaded', function() {
43
- var ctx = document.getElementById('${chartId}').getContext('2d');
44
- var chartConfig = ${chartConfigJson};
45
- new Chart(ctx, chartConfig);
46
- });
47
- </script>
48
- </div>
49
- `.trim();
37
+ const width = 800;
38
+ const height = 600;
39
+ const chartJSNodeCanvas = new chartjs_node_canvas_1.ChartJSNodeCanvas({ width, height });
40
+ const buffer = await chartJSNodeCanvas.renderToBuffer(chartConfig);
41
+ const base64Image = buffer.toString('base64');
42
+ return `<img src="data:image/png;base64,${base64Image}" alt="Chart" />`;
50
43
  }
@@ -1,21 +1,23 @@
1
- import { z } from 'zod';
2
- export const lineSchema = z.object({
3
- labels: z.array(z.string()),
4
- datasets: z.array(z.object({
5
- label: z.string(),
6
- data: z.array(z.number()),
7
- borderColor: z.array(z.string()).optional(),
8
- fill: z.boolean().optional(),
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lineSchema = void 0;
4
+ exports.renderLineChart = renderLineChart;
5
+ const zod_1 = require("zod");
6
+ const chartjs_node_canvas_1 = require("chartjs-node-canvas");
7
+ exports.lineSchema = zod_1.z.object({
8
+ labels: zod_1.z.array(zod_1.z.string()),
9
+ datasets: zod_1.z.array(zod_1.z.object({
10
+ label: zod_1.z.string(),
11
+ data: zod_1.z.array(zod_1.z.number()),
12
+ borderColor: zod_1.z.array(zod_1.z.string()).optional(),
13
+ fill: zod_1.z.boolean().optional(),
9
14
  })),
10
- options: z.object({
11
- title: z.string().optional(),
15
+ options: zod_1.z.object({
16
+ title: zod_1.z.string().optional(),
12
17
  // Add more Chart.js options as needed
13
18
  }).optional(),
14
19
  });
15
- export async function renderLineChart(config) {
16
- // Generate a unique ID for the canvas element
17
- const chartId = `line-chart-${Math.random().toString(36).substr(2, 9)}`;
18
- // Prepare the chart configuration as a JSON string
20
+ async function renderLineChart(config) {
19
21
  const chartConfig = {
20
22
  type: 'line',
21
23
  data: {
@@ -32,19 +34,10 @@ export async function renderLineChart(config) {
32
34
  }
33
35
  },
34
36
  };
35
- // Convert the chart configuration to a JSON string
36
- const chartConfigJson = JSON.stringify(chartConfig);
37
- // Return HTML with canvas element and JavaScript to render the chart
38
- return `
39
- <div>
40
- <canvas id="${chartId}"></canvas>
41
- <script>
42
- document.addEventListener('DOMContentLoaded', function() {
43
- var ctx = document.getElementById('${chartId}').getContext('2d');
44
- var chartConfig = ${chartConfigJson};
45
- new Chart(ctx, chartConfig);
46
- });
47
- </script>
48
- </div>
49
- `.trim();
37
+ const width = 800;
38
+ const height = 600;
39
+ const chartJSNodeCanvas = new chartjs_node_canvas_1.ChartJSNodeCanvas({ width, height });
40
+ const buffer = await chartJSNodeCanvas.renderToBuffer(chartConfig);
41
+ const base64Image = buffer.toString('base64');
42
+ return `<img src="data:image/png;base64,${base64Image}" alt="Chart" />`;
50
43
  }
@@ -1,20 +1,22 @@
1
- import { z } from 'zod';
2
- export const pieSchema = z.object({
3
- labels: z.array(z.string()),
4
- datasets: z.array(z.object({
5
- data: z.array(z.number()),
6
- backgroundColor: z.array(z.string()).optional(),
7
- borderColor: z.array(z.string()).optional(),
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pieSchema = void 0;
4
+ exports.renderPieChart = renderPieChart;
5
+ const zod_1 = require("zod");
6
+ const chartjs_node_canvas_1 = require("chartjs-node-canvas");
7
+ exports.pieSchema = zod_1.z.object({
8
+ labels: zod_1.z.array(zod_1.z.string()),
9
+ datasets: zod_1.z.array(zod_1.z.object({
10
+ data: zod_1.z.array(zod_1.z.number()),
11
+ backgroundColor: zod_1.z.array(zod_1.z.string()).optional(),
12
+ borderColor: zod_1.z.array(zod_1.z.string()).optional(),
8
13
  })),
9
- options: z.object({
10
- title: z.string().optional(),
14
+ options: zod_1.z.object({
15
+ title: zod_1.z.string().optional(),
11
16
  // Add more Chart.js options as needed
12
17
  }).optional(),
13
18
  });
14
- export async function renderPieChart(config) {
15
- // Generate a unique ID for the canvas element
16
- const chartId = `pie-chart-${Math.random().toString(36).substr(2, 9)}`;
17
- // Prepare the chart configuration as a JSON string
19
+ async function renderPieChart(config) {
18
20
  const chartConfig = {
19
21
  type: 'pie',
20
22
  data: {
@@ -31,19 +33,10 @@ export async function renderPieChart(config) {
31
33
  }
32
34
  },
33
35
  };
34
- // Convert the chart configuration to a JSON string
35
- const chartConfigJson = JSON.stringify(chartConfig);
36
- // Return HTML with canvas element and JavaScript to render the chart
37
- return `
38
- <div>
39
- <canvas id="${chartId}"></canvas>
40
- <script>
41
- document.addEventListener('DOMContentLoaded', function() {
42
- var ctx = document.getElementById('${chartId}').getContext('2d');
43
- var chartConfig = ${chartConfigJson};
44
- new Chart(ctx, chartConfig);
45
- });
46
- </script>
47
- </div>
48
- `.trim();
36
+ const width = 800;
37
+ const height = 600;
38
+ const chartJSNodeCanvas = new chartjs_node_canvas_1.ChartJSNodeCanvas({ width, height });
39
+ const buffer = await chartJSNodeCanvas.renderToBuffer(chartConfig);
40
+ const base64Image = buffer.toString('base64');
41
+ return `<img src="data:image/png;base64,${base64Image}" alt="Chart" />`;
49
42
  }