mulmocast 0.0.5 → 0.0.7

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 (140) hide show
  1. package/README.md +294 -39
  2. package/assets/audio/silent60sec.mp3 +0 -0
  3. package/assets/html/caption.html +45 -0
  4. package/assets/html/chart.html +1 -1
  5. package/assets/html/mermaid.html +6 -2
  6. package/assets/html/tailwind.html +13 -0
  7. package/assets/templates/business.json +2 -128
  8. package/assets/templates/children_book.json +1 -128
  9. package/assets/templates/coding.json +2 -136
  10. package/assets/templates/comic_strips.json +6 -0
  11. package/assets/templates/ghibli_strips.json +6 -0
  12. package/assets/templates/sensei_and_taro.json +1 -118
  13. package/lib/actions/audio.js +62 -39
  14. package/lib/actions/captions.d.ts +2 -0
  15. package/lib/actions/captions.js +75 -0
  16. package/lib/actions/images.js +34 -13
  17. package/lib/actions/index.d.ts +1 -0
  18. package/lib/actions/index.js +1 -0
  19. package/lib/actions/movie.js +102 -101
  20. package/lib/actions/pdf.js +26 -6
  21. package/lib/actions/translate.js +60 -39
  22. package/lib/agents/add_bgm_agent.js +15 -39
  23. package/lib/agents/combine_audio_files_agent.js +53 -35
  24. package/lib/agents/index.d.ts +2 -3
  25. package/lib/agents/index.js +2 -3
  26. package/lib/agents/tts_google_agent.d.ts +4 -0
  27. package/lib/agents/tts_google_agent.js +51 -0
  28. package/lib/agents/validate_schema_agent.d.ts +19 -0
  29. package/lib/agents/validate_schema_agent.js +36 -0
  30. package/lib/cli/args.d.ts +2 -0
  31. package/lib/cli/args.js +9 -2
  32. package/lib/cli/bin.d.ts +3 -0
  33. package/lib/cli/bin.js +38 -0
  34. package/lib/cli/cli.js +34 -7
  35. package/lib/cli/commands/audio/builder.d.ts +14 -0
  36. package/lib/cli/commands/audio/builder.js +6 -0
  37. package/lib/cli/commands/audio/handler.d.ts +4 -0
  38. package/lib/cli/commands/audio/handler.js +7 -0
  39. package/lib/cli/commands/audio/index.d.ts +4 -0
  40. package/lib/cli/commands/audio/index.js +4 -0
  41. package/lib/cli/commands/image/builder.d.ts +14 -0
  42. package/lib/cli/commands/image/builder.js +6 -0
  43. package/lib/cli/commands/image/handler.d.ts +4 -0
  44. package/lib/cli/commands/image/handler.js +7 -0
  45. package/lib/cli/commands/image/index.d.ts +4 -0
  46. package/lib/cli/commands/image/index.js +4 -0
  47. package/lib/cli/commands/movie/builder.d.ts +18 -0
  48. package/lib/cli/commands/movie/builder.js +19 -0
  49. package/lib/cli/commands/movie/handler.d.ts +6 -0
  50. package/lib/cli/commands/movie/handler.js +12 -0
  51. package/lib/cli/commands/movie/index.d.ts +4 -0
  52. package/lib/cli/commands/movie/index.js +4 -0
  53. package/lib/cli/commands/pdf/builder.d.ts +18 -0
  54. package/lib/cli/commands/pdf/builder.js +19 -0
  55. package/lib/cli/commands/pdf/handler.d.ts +6 -0
  56. package/lib/cli/commands/pdf/handler.js +8 -0
  57. package/lib/cli/commands/pdf/index.d.ts +4 -0
  58. package/lib/cli/commands/pdf/index.js +4 -0
  59. package/lib/cli/commands/tool/index.d.ts +6 -0
  60. package/lib/cli/commands/tool/index.js +8 -0
  61. package/lib/cli/commands/tool/prompt/builder.d.ts +4 -0
  62. package/lib/cli/commands/tool/prompt/builder.js +11 -0
  63. package/lib/cli/commands/tool/prompt/handler.d.ts +4 -0
  64. package/lib/cli/commands/tool/prompt/handler.js +14 -0
  65. package/lib/cli/commands/tool/prompt/index.d.ts +4 -0
  66. package/lib/cli/commands/tool/prompt/index.js +4 -0
  67. package/lib/cli/commands/tool/schema/builder.d.ts +2 -0
  68. package/lib/cli/commands/tool/schema/builder.js +3 -0
  69. package/lib/cli/commands/tool/schema/handler.d.ts +2 -0
  70. package/lib/cli/commands/tool/schema/handler.js +12 -0
  71. package/lib/cli/commands/tool/schema/index.d.ts +4 -0
  72. package/lib/cli/commands/tool/schema/index.js +4 -0
  73. package/lib/cli/commands/tool/scripting/builder.d.ts +20 -0
  74. package/lib/cli/commands/tool/scripting/builder.js +63 -0
  75. package/lib/cli/commands/tool/scripting/handler.d.ts +13 -0
  76. package/lib/cli/commands/tool/scripting/handler.js +36 -0
  77. package/lib/cli/commands/tool/scripting/index.d.ts +4 -0
  78. package/lib/cli/commands/tool/scripting/index.js +4 -0
  79. package/lib/cli/commands/tool/story_to_script/builder.d.ts +20 -0
  80. package/lib/cli/commands/tool/story_to_script/builder.js +61 -0
  81. package/lib/cli/commands/tool/story_to_script/handler.d.ts +13 -0
  82. package/lib/cli/commands/tool/story_to_script/handler.js +36 -0
  83. package/lib/cli/commands/tool/story_to_script/index.d.ts +4 -0
  84. package/lib/cli/commands/tool/story_to_script/index.js +4 -0
  85. package/lib/cli/commands/translate/builder.d.ts +14 -0
  86. package/lib/cli/commands/translate/builder.js +5 -0
  87. package/lib/cli/commands/translate/handler.d.ts +4 -0
  88. package/lib/cli/commands/translate/handler.js +6 -0
  89. package/lib/cli/commands/translate/index.d.ts +4 -0
  90. package/lib/cli/commands/translate/index.js +4 -0
  91. package/lib/cli/common.d.ts +6 -2
  92. package/lib/cli/common.js +18 -7
  93. package/lib/cli/helpers.d.ts +38 -0
  94. package/lib/cli/helpers.js +115 -0
  95. package/lib/cli/tool-args.d.ts +1 -0
  96. package/lib/cli/tool-args.js +1 -1
  97. package/lib/cli/tool-cli.js +8 -0
  98. package/lib/methods/mulmo_script.d.ts +0 -1
  99. package/lib/methods/mulmo_script.js +4 -7
  100. package/lib/methods/mulmo_script_template.d.ts +2 -2
  101. package/lib/methods/mulmo_script_template.js +3 -13
  102. package/lib/methods/mulmo_studio.d.ts +8 -0
  103. package/lib/methods/mulmo_studio.js +24 -0
  104. package/lib/tools/create_mulmo_script_from_url.d.ts +1 -1
  105. package/lib/tools/create_mulmo_script_from_url.js +43 -14
  106. package/lib/tools/create_mulmo_script_interactively.d.ts +1 -1
  107. package/lib/tools/create_mulmo_script_interactively.js +21 -20
  108. package/lib/tools/dump_prompt.js +2 -0
  109. package/lib/tools/story_to_script.d.ts +12 -0
  110. package/lib/tools/story_to_script.js +275 -0
  111. package/lib/types/cli_types.d.ts +14 -0
  112. package/lib/types/cli_types.js +1 -0
  113. package/lib/types/schema.d.ts +637 -1766
  114. package/lib/types/schema.js +77 -8
  115. package/lib/types/type.d.ts +10 -3
  116. package/lib/utils/const.d.ts +5 -0
  117. package/lib/utils/const.js +5 -0
  118. package/lib/utils/ffmpeg_utils.d.ts +12 -0
  119. package/lib/utils/ffmpeg_utils.js +63 -0
  120. package/lib/utils/file.d.ts +8 -3
  121. package/lib/utils/file.js +40 -9
  122. package/lib/utils/filters.js +16 -11
  123. package/lib/utils/image_plugins/chart.js +6 -1
  124. package/lib/utils/image_plugins/html_tailwind.d.ts +3 -0
  125. package/lib/utils/image_plugins/html_tailwind.js +18 -0
  126. package/lib/utils/image_plugins/index.d.ts +2 -1
  127. package/lib/utils/image_plugins/index.js +2 -1
  128. package/lib/utils/image_plugins/mermaid.js +1 -1
  129. package/lib/utils/image_plugins/tailwind.d.ts +3 -0
  130. package/lib/utils/image_plugins/tailwind.js +18 -0
  131. package/lib/utils/image_plugins/text_slide.js +9 -2
  132. package/lib/utils/markdown.d.ts +1 -1
  133. package/lib/utils/markdown.js +8 -4
  134. package/lib/utils/preprocess.d.ts +40 -10
  135. package/lib/utils/preprocess.js +7 -2
  136. package/lib/utils/prompt.d.ts +16 -0
  137. package/lib/utils/prompt.js +74 -0
  138. package/lib/utils/utils.d.ts +10 -5
  139. package/lib/utils/utils.js +37 -17
  140. package/package.json +27 -23
package/lib/cli/cli.js CHANGED
@@ -6,18 +6,32 @@ import { GraphAILogger } from "graphai";
6
6
  import { getArgs } from "./args.js";
7
7
  import { createOrUpdateStudioData } from "../utils/preprocess.js";
8
8
  import { outDirName, imageDirName, audioDirName } from "../utils/const.js";
9
- import { translate, audio, images, movie, pdf } from "../actions/index.js";
10
- import { getBaseDirPath, getFullPath, readMulmoScriptFile, fetchMulmoScriptFile, getOutputStudioFilePath } from "../utils/file.js";
9
+ import { translate, audio, images, movie, pdf, captions } from "../actions/index.js";
10
+ import { getBaseDirPath, getFullPath, readMulmoScriptFile, fetchMulmoScriptFile, getOutputStudioFilePath, resolveDirPath } from "../utils/file.js";
11
11
  import { isHttp } from "../utils/utils.js";
12
+ import clipboardy from "clipboardy";
12
13
  export const getFileObject = (_args) => {
13
14
  const { basedir, file, outdir, imagedir, audiodir } = _args;
14
15
  const baseDirPath = getBaseDirPath(basedir);
15
- const fileOrUrl = file ?? "";
16
- const fileName = path.parse(fileOrUrl).name;
16
+ const outDirPath = getFullPath(baseDirPath, outdir ?? outDirName);
17
+ const { fileOrUrl, fileName } = (() => {
18
+ if (file === "__clipboard") {
19
+ // We generate a new unique script file from clipboard text in the output directory
20
+ const now = new Date();
21
+ const pad = (n) => n.toString().padStart(2, "0");
22
+ const fileName = `script_${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
23
+ const clipboardText = clipboardy.readSync();
24
+ const fileOrUrl = resolveDirPath(outDirPath, `${fileName}.json`);
25
+ fs.writeFileSync(fileOrUrl, clipboardText, "utf8");
26
+ return { fileOrUrl, fileName };
27
+ }
28
+ const fileOrUrl = file ?? "";
29
+ const fileName = path.parse(fileOrUrl).name;
30
+ return { fileOrUrl, fileName };
31
+ })();
17
32
  const isHttpPath = isHttp(fileOrUrl);
18
33
  const mulmoFilePath = isHttpPath ? "" : getFullPath(baseDirPath, fileOrUrl);
19
34
  const mulmoFileDirPath = path.dirname(isHttpPath ? baseDirPath : mulmoFilePath);
20
- const outDirPath = getFullPath(baseDirPath, outdir ?? outDirName);
21
35
  const imageDirPath = getFullPath(outDirPath, imagedir ?? imageDirName);
22
36
  const audioDirPath = getFullPath(outDirPath, audiodir ?? audioDirName);
23
37
  const outputStudioFilePath = getOutputStudioFilePath(outDirPath, fileName);
@@ -50,7 +64,7 @@ export const main = async () => {
50
64
  GraphAILogger.setLevelEnabled("log", false);
51
65
  GraphAILogger.setLevelEnabled("warn", false);
52
66
  }
53
- const { action, force, pdf_mode, pdf_size } = args;
67
+ const { action, f: force, pdf_mode, pdf_size, l: lang, c: caption } = args;
54
68
  const mulmoScript = await fetchScript(isHttpPath, mulmoFilePath, fileOrUrl);
55
69
  // Create or update MulmoStudio file with MulmoScript
56
70
  const currentStudio = readMulmoScriptFile(outputStudioFilePath);
@@ -68,8 +82,11 @@ export const main = async () => {
68
82
  studio,
69
83
  fileDirs: files,
70
84
  force: Boolean(force),
85
+ lang: lang,
86
+ caption: caption,
71
87
  };
72
- if (action === "translate") {
88
+ if (action === "translate" || lang || caption) {
89
+ GraphAILogger.log("run translate");
73
90
  await translate(context);
74
91
  }
75
92
  if (action === "audio") {
@@ -79,6 +96,9 @@ export const main = async () => {
79
96
  await images(context);
80
97
  }
81
98
  if (action === "movie") {
99
+ if (caption) {
100
+ await captions(context);
101
+ }
82
102
  await audio(context);
83
103
  await images(context);
84
104
  await movie(context);
@@ -87,4 +107,11 @@ export const main = async () => {
87
107
  await images(context);
88
108
  await pdf(context, pdf_mode, pdf_size);
89
109
  }
110
+ if (context.studio.script.title) {
111
+ GraphAILogger.info(context.studio.script.title);
112
+ }
113
+ if (context.studio.script.references) {
114
+ const textOutput = context.studio.script.references.map((reference) => `${reference.title}\n${reference.url}`).join("\n");
115
+ GraphAILogger.info(textOutput);
116
+ }
90
117
  };
@@ -0,0 +1,14 @@
1
+ import type { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ o: string | undefined;
4
+ } & {
5
+ b: string | undefined;
6
+ } & {
7
+ l: string | undefined;
8
+ } & {
9
+ f: boolean;
10
+ } & {
11
+ file: string | undefined;
12
+ } & {
13
+ a: string | undefined;
14
+ }>;
@@ -0,0 +1,6 @@
1
+ import { commonOptions } from "../../common.js";
2
+ export const builder = (yargs) => commonOptions(yargs).option("a", {
3
+ alias: "audiodir",
4
+ describe: "Audio output directory",
5
+ type: "string",
6
+ });
@@ -0,0 +1,4 @@
1
+ import { CliArgs } from "../../../types/cli_types.js";
2
+ export declare const handler: (argv: CliArgs<{
3
+ a?: string;
4
+ }>) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { audio } from "../../../actions/index.js";
2
+ import { initializeContext, runTranslateIfNeeded } from "../../../cli/helpers.js";
3
+ export const handler = async (argv) => {
4
+ const context = await initializeContext(argv);
5
+ await runTranslateIfNeeded(context, argv);
6
+ await audio(context);
7
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "audio <file>";
2
+ export declare const desc = "Generate audio files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "audio <file>";
2
+ export const desc = "Generate audio files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,14 @@
1
+ import type { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ o: string | undefined;
4
+ } & {
5
+ b: string | undefined;
6
+ } & {
7
+ l: string | undefined;
8
+ } & {
9
+ f: boolean;
10
+ } & {
11
+ file: string | undefined;
12
+ } & {
13
+ i: string | undefined;
14
+ }>;
@@ -0,0 +1,6 @@
1
+ import { commonOptions } from "../../common.js";
2
+ export const builder = (yargs) => commonOptions(yargs).option("i", {
3
+ alias: "imagedir",
4
+ describe: "Image output directory",
5
+ type: "string",
6
+ });
@@ -0,0 +1,4 @@
1
+ import { CliArgs } from "../../../types/cli_types.js";
2
+ export declare const handler: (argv: CliArgs<{
3
+ i?: string;
4
+ }>) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { images } from "../../../actions/index.js";
2
+ import { initializeContext, runTranslateIfNeeded } from "../../../cli/helpers.js";
3
+ export const handler = async (argv) => {
4
+ const context = await initializeContext(argv);
5
+ await runTranslateIfNeeded(context, argv);
6
+ await images(context);
7
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "images <file>";
2
+ export declare const desc = "Generate image files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "images <file>";
2
+ export const desc = "Generate image files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,18 @@
1
+ import type { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ o: string | undefined;
4
+ } & {
5
+ b: string | undefined;
6
+ } & {
7
+ l: string | undefined;
8
+ } & {
9
+ f: boolean;
10
+ } & {
11
+ file: string | undefined;
12
+ } & {
13
+ a: string | undefined;
14
+ } & {
15
+ i: string | undefined;
16
+ } & {
17
+ c: string | undefined;
18
+ }>;
@@ -0,0 +1,19 @@
1
+ import { commonOptions } from "../../common.js";
2
+ import { languages } from "../../../utils/const.js";
3
+ export const builder = (yargs) => commonOptions(yargs)
4
+ .option("a", {
5
+ alias: "audiodir",
6
+ describe: "Audio output directory",
7
+ type: "string",
8
+ })
9
+ .option("i", {
10
+ alias: "imagedir",
11
+ describe: "Image output directory",
12
+ type: "string",
13
+ })
14
+ .option("c", {
15
+ alias: "caption",
16
+ describe: "Video captions",
17
+ choices: languages,
18
+ type: "string",
19
+ });
@@ -0,0 +1,6 @@
1
+ import { CliArgs } from "../../../types/cli_types.js";
2
+ export declare const handler: (argv: CliArgs<{
3
+ a?: string;
4
+ i?: string;
5
+ c?: string;
6
+ }>) => Promise<void>;
@@ -0,0 +1,12 @@
1
+ import { audio, images, movie, captions } from "../../../actions/index.js";
2
+ import { initializeContext, runTranslateIfNeeded } from "../../../cli/helpers.js";
3
+ export const handler = async (argv) => {
4
+ const context = await initializeContext(argv);
5
+ await runTranslateIfNeeded(context, argv);
6
+ await audio(context);
7
+ await images(context);
8
+ if (context.caption) {
9
+ await captions(context);
10
+ }
11
+ await movie(context);
12
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "movie <file>";
2
+ export declare const desc = "Generate movie file";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "movie <file>";
2
+ export const desc = "Generate movie file";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,18 @@
1
+ import type { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ o: string | undefined;
4
+ } & {
5
+ b: string | undefined;
6
+ } & {
7
+ l: string | undefined;
8
+ } & {
9
+ f: boolean;
10
+ } & {
11
+ file: string | undefined;
12
+ } & {
13
+ i: string | undefined;
14
+ } & {
15
+ pdf_mode: string;
16
+ } & {
17
+ pdf_size: string;
18
+ }>;
@@ -0,0 +1,19 @@
1
+ import { commonOptions } from "../../common.js";
2
+ import { pdf_modes, pdf_sizes } from "../../../utils/const.js";
3
+ export const builder = (yargs) => commonOptions(yargs)
4
+ .option("i", {
5
+ alias: "imagedir",
6
+ describe: "Image output directory",
7
+ type: "string",
8
+ })
9
+ .option("pdf_mode", {
10
+ describe: "PDF mode",
11
+ choices: pdf_modes,
12
+ type: "string",
13
+ default: "slide",
14
+ })
15
+ .option("pdf_size", {
16
+ describe: "PDF paper size (default: letter)",
17
+ choices: pdf_sizes,
18
+ default: "letter",
19
+ });
@@ -0,0 +1,6 @@
1
+ import { CliArgs } from "../../../types/cli_types.js";
2
+ export declare const handler: (argv: CliArgs<{
3
+ i?: string;
4
+ pdf_mode: string;
5
+ pdf_size: string;
6
+ }>) => Promise<void>;
@@ -0,0 +1,8 @@
1
+ import { images, pdf } from "../../../actions/index.js";
2
+ import { initializeContext, runTranslateIfNeeded } from "../../../cli/helpers.js";
3
+ export const handler = async (argv) => {
4
+ const context = await initializeContext(argv);
5
+ await runTranslateIfNeeded(context, argv);
6
+ await images(context);
7
+ await pdf(context, argv.pdf_mode, argv.pdf_size);
8
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "pdf <file>";
2
+ export declare const desc = "Generate PDF files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "pdf <file>";
2
+ export const desc = "Generate PDF files";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,6 @@
1
+ import { ToolCliArgs } from "../../../types/cli_types.js";
2
+ import { Argv } from "yargs";
3
+ export declare const command = "tool <command>";
4
+ export declare const desc = "Generate Mulmo script and other tools";
5
+ export declare const builder: (y: Argv) => Argv<{}>;
6
+ export declare const handler: (__argv: ToolCliArgs) => void;
@@ -0,0 +1,8 @@
1
+ import * as scriptingCmd from "./scripting/index.js";
2
+ import * as promptCmd from "./prompt/index.js";
3
+ import * as schemaCmd from "./schema/index.js";
4
+ import * as storyToScriptCmd from "./story_to_script/index.js";
5
+ export const command = "tool <command>";
6
+ export const desc = "Generate Mulmo script and other tools";
7
+ export const builder = (y) => y.command(scriptingCmd).command(promptCmd).command(schemaCmd).command(storyToScriptCmd).demandCommand().strict();
8
+ export const handler = (__argv) => { };
@@ -0,0 +1,4 @@
1
+ import { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ t: string | undefined;
4
+ }>;
@@ -0,0 +1,11 @@
1
+ import { getAvailableTemplates } from "../../../../utils/file.js";
2
+ const availableTemplateNames = getAvailableTemplates().map((template) => template.filename);
3
+ export const builder = (yargs) => {
4
+ return yargs.option("t", {
5
+ alias: "template",
6
+ describe: "Template name to use",
7
+ demandOption: false,
8
+ choices: availableTemplateNames,
9
+ type: "string",
10
+ });
11
+ };
@@ -0,0 +1,4 @@
1
+ import { ToolCliArgs } from "../../../../types/cli_types.js";
2
+ export declare const handler: (argv: ToolCliArgs<{
3
+ template?: string;
4
+ }>) => Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { selectTemplate } from "../../../../utils/inquirer.js";
2
+ import { dumpPromptFromTemplate } from "../../../../tools/dump_prompt.js";
3
+ import { setGraphAILogger } from "../../../../cli/helpers.js";
4
+ export const handler = async (argv) => {
5
+ let { template } = argv;
6
+ const { v: verbose } = argv;
7
+ if (!template) {
8
+ template = await selectTemplate();
9
+ }
10
+ setGraphAILogger(verbose, {
11
+ template,
12
+ });
13
+ await dumpPromptFromTemplate({ templateName: template });
14
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "prompt";
2
+ export declare const desc = "Dump prompt from template";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "prompt";
2
+ export const desc = "Dump prompt from template";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,2 @@
1
+ import { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{}>;
@@ -0,0 +1,3 @@
1
+ export const builder = (yargs) => {
2
+ return yargs;
3
+ };
@@ -0,0 +1,2 @@
1
+ import { ToolCliArgs } from "../../../../types/cli_types.js";
2
+ export declare const handler: (argv: ToolCliArgs) => Promise<void>;
@@ -0,0 +1,12 @@
1
+ import { mulmoScriptSchema } from "../../../../types/schema.js";
2
+ import { zodToJsonSchema } from "zod-to-json-schema";
3
+ import { GraphAILogger } from "graphai";
4
+ import { setGraphAILogger } from "../../../../cli/helpers.js";
5
+ export const handler = async (argv) => {
6
+ const { v: verbose } = argv;
7
+ setGraphAILogger(verbose);
8
+ const defaultSchema = zodToJsonSchema(mulmoScriptSchema, {
9
+ strictUnions: true,
10
+ });
11
+ GraphAILogger.info(JSON.stringify(defaultSchema, null, 2));
12
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "schema";
2
+ export declare const desc = "Dump mulmocast schema";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "schema";
2
+ export const desc = "Dump mulmocast schema";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,20 @@
1
+ import { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ o: string | undefined;
4
+ } & {
5
+ b: string | undefined;
6
+ } & {
7
+ u: string[] | never[];
8
+ } & {
9
+ i: boolean | undefined;
10
+ } & {
11
+ t: string | undefined;
12
+ } & {
13
+ c: string | undefined;
14
+ } & {
15
+ s: string;
16
+ } & {
17
+ llm: "openAI" | "anthropic" | "gemini" | "groq" | undefined;
18
+ } & {
19
+ llm_model: string | undefined;
20
+ }>;
@@ -0,0 +1,63 @@
1
+ import { llm } from "../../../../utils/utils.js";
2
+ import { getAvailableTemplates } from "../../../../utils/file.js";
3
+ const availableTemplateNames = getAvailableTemplates().map((template) => template.filename);
4
+ export const builder = (yargs) => {
5
+ return yargs
6
+ .option("o", {
7
+ alias: "outdir",
8
+ description: "output dir",
9
+ demandOption: false,
10
+ type: "string",
11
+ })
12
+ .option("b", {
13
+ alias: "basedir",
14
+ description: "base dir",
15
+ demandOption: false,
16
+ type: "string",
17
+ })
18
+ .option("u", {
19
+ alias: "url",
20
+ description: "URLs to reference (required when not in interactive mode)",
21
+ demandOption: false,
22
+ default: [],
23
+ type: "array",
24
+ string: true,
25
+ })
26
+ .option("i", {
27
+ alias: "interactive",
28
+ description: "Generate script in interactive mode with user prompts",
29
+ demandOption: false,
30
+ type: "boolean",
31
+ })
32
+ .option("t", {
33
+ alias: "template",
34
+ description: "Template name to use",
35
+ demandOption: false,
36
+ choices: availableTemplateNames,
37
+ type: "string",
38
+ })
39
+ .option("c", {
40
+ alias: "cache",
41
+ description: "cache dir",
42
+ demandOption: false,
43
+ type: "string",
44
+ })
45
+ .option("s", {
46
+ alias: "script",
47
+ description: "script filename",
48
+ demandOption: false,
49
+ default: "script",
50
+ type: "string",
51
+ })
52
+ .option("llm", {
53
+ description: "llm",
54
+ demandOption: false,
55
+ choices: llm,
56
+ type: "string",
57
+ })
58
+ .option("llm_model", {
59
+ description: "llm model",
60
+ demandOption: false,
61
+ type: "string",
62
+ });
63
+ };
@@ -0,0 +1,13 @@
1
+ import { ToolCliArgs } from "../../../../types/cli_types.js";
2
+ import { LLM } from "../../../../utils/utils.js";
3
+ export declare const handler: (argv: ToolCliArgs<{
4
+ o?: string;
5
+ b?: string;
6
+ u?: string[];
7
+ i?: boolean;
8
+ t?: string;
9
+ c?: string;
10
+ s?: string;
11
+ llm?: LLM;
12
+ llm_model?: string;
13
+ }>) => Promise<void>;
@@ -0,0 +1,36 @@
1
+ import { getBaseDirPath, getFullPath } from "../../../../utils/file.js";
2
+ import { outDirName, cacheDirName } from "../../../../utils/const.js";
3
+ import { getUrlsIfNeeded, selectTemplate } from "../../../../utils/inquirer.js";
4
+ import { createMulmoScriptFromUrl } from "../../../../tools/create_mulmo_script_from_url.js";
5
+ import { createMulmoScriptInteractively } from "../../../../tools/create_mulmo_script_interactively.js";
6
+ import { setGraphAILogger } from "../../../../cli/helpers.js";
7
+ export const handler = async (argv) => {
8
+ const { o: outdir, b: basedir, v: verbose, i: interactive, c: cache, s: filename, llm, llm_model } = argv;
9
+ let { t: template } = argv;
10
+ const urls = argv.u || [];
11
+ const baseDirPath = getBaseDirPath(basedir);
12
+ const outDirPath = getFullPath(baseDirPath, outdir ?? outDirName);
13
+ const cacheDirPath = getFullPath(outDirPath, cache ?? cacheDirName);
14
+ if (!template) {
15
+ template = await selectTemplate();
16
+ }
17
+ setGraphAILogger(verbose, {
18
+ baseDirPath,
19
+ outDirPath,
20
+ cacheDirPath,
21
+ template,
22
+ urls,
23
+ interactive,
24
+ filename,
25
+ llm,
26
+ llm_model,
27
+ });
28
+ const context = { outDirPath, templateName: template, urls, filename: filename, cacheDirPath, llm_model, llm };
29
+ if (interactive) {
30
+ await createMulmoScriptInteractively(context);
31
+ }
32
+ else {
33
+ context.urls = await getUrlsIfNeeded(urls);
34
+ await createMulmoScriptFromUrl(context);
35
+ }
36
+ };
@@ -0,0 +1,4 @@
1
+ export declare const command = "scripting";
2
+ export declare const desc = "Generate mulmocast script";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,4 @@
1
+ export const command = "scripting";
2
+ export const desc = "Generate mulmocast script";
3
+ export { builder } from "./builder.js";
4
+ export { handler } from "./handler.js";
@@ -0,0 +1,20 @@
1
+ import { Argv } from "yargs";
2
+ export declare const builder: (yargs: Argv) => Argv<{
3
+ o: string | undefined;
4
+ } & {
5
+ b: string | undefined;
6
+ } & {
7
+ t: string | undefined;
8
+ } & {
9
+ s: string;
10
+ } & {
11
+ beats_per_scene: number;
12
+ } & {
13
+ llm: "openAI" | "anthropic" | "gemini" | "groq" | undefined;
14
+ } & {
15
+ llm_model: string | undefined;
16
+ } & {
17
+ mode: string;
18
+ } & {
19
+ file: string | undefined;
20
+ }>;