mulmocast-vision 1.0.2 → 1.0.3

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.
@@ -16,6 +16,7 @@ export declare class htmlPlugin {
16
16
  });
17
17
  callNamedFunction: (functionName: string, args: ToolArgs, options: PluginOptionParams) => Promise<any>;
18
18
  private generateHtml;
19
+ getHtml: (functionName: string, args: ToolArgs) => string;
19
20
  setDirectory: (args: ToolArgs, __options: PluginOptionParams) => Promise<{
20
21
  text: string;
21
22
  }>;
package/lib/html_class.js CHANGED
@@ -16,6 +16,7 @@ class htmlPlugin {
16
16
  htmlDir, // relative path
17
17
  templateDir, // absolute path
18
18
  }) {
19
+ // api for mcp
19
20
  this.callNamedFunction = async (functionName, args, options) => {
20
21
  const member = this[functionName];
21
22
  if (member && typeof member === "function") {
@@ -28,15 +29,20 @@ class htmlPlugin {
28
29
  if (!functionName) {
29
30
  throw new Error("functionName is required");
30
31
  }
31
- const templateFileName = (0, commons_1.functionNameToTemplateName)(functionName);
32
- const templateFilePath = path_1.default.resolve(this.templateDir ? this.templateDir : path_1.default.resolve(this.rootDir, "html", this.htmlDir), `${templateFileName}.html`);
32
+ const html = this.getHtml(functionName, args);
33
33
  const outfile = imageFilePath ?? path_1.default.resolve(this.outputDir, this.sessionDir, `${outputFileName}.png`);
34
34
  const htmlFile = htmlFilePath ?? path_1.default.resolve(this.outputDir, this.sessionDir, `${outputFileName}.html`);
35
- await (0, utils_1.createPage)(this.rootDir, outfile, nunjucks_1.default.render(templateFilePath, args), { htmlFile, ...this.templateOptions });
35
+ await (0, utils_1.createPage)(this.rootDir, outfile, html, { htmlFile, ...this.templateOptions });
36
36
  return {
37
37
  text: `html generated successfully to: ${outfile}`,
38
38
  };
39
39
  };
40
+ // for electron
41
+ this.getHtml = (functionName, args) => {
42
+ const templateFileName = (0, commons_1.functionNameToTemplateName)(functionName);
43
+ const templateFilePath = path_1.default.resolve(this.templateDir ? this.templateDir : path_1.default.resolve(this.rootDir, "html", this.htmlDir), `${templateFileName}.html`);
44
+ return nunjucks_1.default.render(templateFilePath, args);
45
+ };
40
46
  // for mcp
41
47
  this.setDirectory = async (args, __options) => {
42
48
  this.sessionDir = args.directoryName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast-vision",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Easy and stylish presentation slide generator",
5
5
  "mcpName": "io.github.isamu/mulmocast-vision",
6
6
  "main": "lib/index.js",
@@ -20,8 +20,7 @@
20
20
  "ai": "npx tsx ./old/presentation.ts",
21
21
  "generate_all_images": "npx tsx ./tests/test.ts",
22
22
  "design": "NODE_ENV=test npx tsx ./tests/design.ts",
23
- "ci_test": "NODE_ENV=test npx tsx ./tests/test.ts",
24
- "ci_test2": "NODE_ENV=test npx tsx ./tests/test2.ts"
23
+ "ci_test": "NODE_ENV=test npx tsx ./tests/test.ts"
25
24
  },
26
25
  "repository": {
27
26
  "type": "git",