mulmocast 0.0.5 → 0.0.6
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 +257 -39
- package/assets/audio/silent60sec.mp3 +0 -0
- package/assets/html/caption.html +45 -0
- package/assets/html/chart.html +1 -1
- package/assets/html/mermaid.html +6 -2
- package/assets/html/tailwind.html +13 -0
- package/assets/templates/business.json +57 -4
- package/assets/templates/comic_strips.json +35 -0
- package/assets/templates/ghibli_strips.json +35 -0
- package/lib/actions/audio.js +24 -11
- package/lib/actions/captions.d.ts +2 -0
- package/lib/actions/captions.js +62 -0
- package/lib/actions/images.js +3 -2
- package/lib/actions/index.d.ts +1 -0
- package/lib/actions/index.js +1 -0
- package/lib/actions/movie.js +78 -86
- package/lib/actions/pdf.js +15 -5
- package/lib/actions/translate.js +32 -26
- package/lib/agents/add_bgm_agent.js +15 -39
- package/lib/agents/combine_audio_files_agent.js +43 -36
- package/lib/agents/index.d.ts +2 -3
- package/lib/agents/index.js +2 -3
- package/lib/agents/tts_google_agent.d.ts +4 -0
- package/lib/agents/tts_google_agent.js +51 -0
- package/lib/agents/validate_schema_agent.d.ts +19 -0
- package/lib/agents/validate_schema_agent.js +36 -0
- package/lib/cli/args.d.ts +2 -0
- package/lib/cli/args.js +9 -2
- package/lib/cli/bin.d.ts +3 -0
- package/lib/cli/bin.js +38 -0
- package/lib/cli/cli.js +34 -7
- package/lib/cli/commands/audio/builder.d.ts +14 -0
- package/lib/cli/commands/audio/builder.js +6 -0
- package/lib/cli/commands/audio/handler.d.ts +4 -0
- package/lib/cli/commands/audio/handler.js +7 -0
- package/lib/cli/commands/audio/index.d.ts +4 -0
- package/lib/cli/commands/audio/index.js +4 -0
- package/lib/cli/commands/image/builder.d.ts +14 -0
- package/lib/cli/commands/image/builder.js +6 -0
- package/lib/cli/commands/image/handler.d.ts +4 -0
- package/lib/cli/commands/image/handler.js +7 -0
- package/lib/cli/commands/image/index.d.ts +4 -0
- package/lib/cli/commands/image/index.js +4 -0
- package/lib/cli/commands/movie/builder.d.ts +18 -0
- package/lib/cli/commands/movie/builder.js +19 -0
- package/lib/cli/commands/movie/handler.d.ts +6 -0
- package/lib/cli/commands/movie/handler.js +12 -0
- package/lib/cli/commands/movie/index.d.ts +4 -0
- package/lib/cli/commands/movie/index.js +4 -0
- package/lib/cli/commands/pdf/builder.d.ts +18 -0
- package/lib/cli/commands/pdf/builder.js +19 -0
- package/lib/cli/commands/pdf/handler.d.ts +6 -0
- package/lib/cli/commands/pdf/handler.js +8 -0
- package/lib/cli/commands/pdf/index.d.ts +4 -0
- package/lib/cli/commands/pdf/index.js +4 -0
- package/lib/cli/commands/tool/index.d.ts +6 -0
- package/lib/cli/commands/tool/index.js +8 -0
- package/lib/cli/commands/tool/prompt/builder.d.ts +4 -0
- package/lib/cli/commands/tool/prompt/builder.js +11 -0
- package/lib/cli/commands/tool/prompt/handler.d.ts +4 -0
- package/lib/cli/commands/tool/prompt/handler.js +14 -0
- package/lib/cli/commands/tool/prompt/index.d.ts +4 -0
- package/lib/cli/commands/tool/prompt/index.js +4 -0
- package/lib/cli/commands/tool/schema/builder.d.ts +2 -0
- package/lib/cli/commands/tool/schema/builder.js +3 -0
- package/lib/cli/commands/tool/schema/handler.d.ts +2 -0
- package/lib/cli/commands/tool/schema/handler.js +12 -0
- package/lib/cli/commands/tool/schema/index.d.ts +4 -0
- package/lib/cli/commands/tool/schema/index.js +4 -0
- package/lib/cli/commands/tool/scripting/builder.d.ts +20 -0
- package/lib/cli/commands/tool/scripting/builder.js +63 -0
- package/lib/cli/commands/tool/scripting/handler.d.ts +12 -0
- package/lib/cli/commands/tool/scripting/handler.js +36 -0
- package/lib/cli/commands/tool/scripting/index.d.ts +4 -0
- package/lib/cli/commands/tool/scripting/index.js +4 -0
- package/lib/cli/commands/tool/story_to_script/builder.d.ts +18 -0
- package/lib/cli/commands/tool/story_to_script/builder.js +53 -0
- package/lib/cli/commands/tool/story_to_script/handler.d.ts +11 -0
- package/lib/cli/commands/tool/story_to_script/handler.js +35 -0
- package/lib/cli/commands/tool/story_to_script/index.d.ts +4 -0
- package/lib/cli/commands/tool/story_to_script/index.js +4 -0
- package/lib/cli/commands/translate/builder.d.ts +14 -0
- package/lib/cli/commands/translate/builder.js +5 -0
- package/lib/cli/commands/translate/handler.d.ts +4 -0
- package/lib/cli/commands/translate/handler.js +6 -0
- package/lib/cli/commands/translate/index.d.ts +4 -0
- package/lib/cli/commands/translate/index.js +4 -0
- package/lib/cli/common.d.ts +6 -2
- package/lib/cli/common.js +18 -7
- package/lib/cli/helpers.d.ts +38 -0
- package/lib/cli/helpers.js +115 -0
- package/lib/cli/tool-args.d.ts +1 -0
- package/lib/cli/tool-args.js +1 -1
- package/lib/cli/tool-cli.js +8 -0
- package/lib/methods/mulmo_script.d.ts +0 -1
- package/lib/methods/mulmo_script.js +4 -7
- package/lib/methods/mulmo_script_template.js +2 -12
- package/lib/tools/create_mulmo_script_from_url.d.ts +1 -1
- package/lib/tools/create_mulmo_script_from_url.js +43 -14
- package/lib/tools/create_mulmo_script_interactively.js +14 -13
- package/lib/tools/dump_prompt.js +2 -0
- package/lib/tools/story_to_script.d.ts +10 -0
- package/lib/tools/story_to_script.js +201 -0
- package/lib/types/cli_types.d.ts +14 -0
- package/lib/types/cli_types.js +1 -0
- package/lib/types/schema.d.ts +493 -176
- package/lib/types/schema.js +37 -7
- package/lib/types/type.d.ts +6 -1
- package/lib/utils/const.d.ts +1 -0
- package/lib/utils/const.js +1 -0
- package/lib/utils/ffmpeg_utils.d.ts +12 -0
- package/lib/utils/ffmpeg_utils.js +63 -0
- package/lib/utils/file.d.ts +7 -3
- package/lib/utils/file.js +24 -5
- package/lib/utils/image_plugins/chart.js +6 -1
- package/lib/utils/image_plugins/html_tailwind.d.ts +3 -0
- package/lib/utils/image_plugins/html_tailwind.js +18 -0
- package/lib/utils/image_plugins/index.d.ts +2 -1
- package/lib/utils/image_plugins/index.js +2 -1
- package/lib/utils/image_plugins/mermaid.js +1 -1
- package/lib/utils/image_plugins/tailwind.d.ts +3 -0
- package/lib/utils/image_plugins/tailwind.js +18 -0
- package/lib/utils/image_plugins/text_slide.js +9 -2
- package/lib/utils/markdown.d.ts +1 -1
- package/lib/utils/markdown.js +8 -2
- package/lib/utils/preprocess.d.ts +23 -12
- package/lib/utils/preprocess.js +4 -0
- package/lib/utils/prompt.d.ts +15 -0
- package/lib/utils/prompt.js +57 -0
- package/lib/utils/utils.d.ts +2 -0
- package/lib/utils/utils.js +10 -0
- package/package.json +27 -23
|
@@ -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,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,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,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,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,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,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_agent: string | undefined;
|
|
18
|
+
} & {
|
|
19
|
+
llm_model: string | undefined;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { llmAgents } 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_agent", {
|
|
53
|
+
description: "llm agent",
|
|
54
|
+
demandOption: false,
|
|
55
|
+
choices: llmAgents,
|
|
56
|
+
type: "string",
|
|
57
|
+
})
|
|
58
|
+
.option("llm_model", {
|
|
59
|
+
description: "llm model",
|
|
60
|
+
demandOption: false,
|
|
61
|
+
type: "string",
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToolCliArgs } from "../../../../types/cli_types.js";
|
|
2
|
+
export declare const handler: (argv: ToolCliArgs<{
|
|
3
|
+
o?: string;
|
|
4
|
+
b?: string;
|
|
5
|
+
u?: string[];
|
|
6
|
+
i?: boolean;
|
|
7
|
+
t?: string;
|
|
8
|
+
c?: string;
|
|
9
|
+
s?: string;
|
|
10
|
+
llm_agent?: string;
|
|
11
|
+
llm_model?: string;
|
|
12
|
+
}>) => 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_agent, 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_agent,
|
|
26
|
+
llm_model,
|
|
27
|
+
});
|
|
28
|
+
const context = { outDirPath, templateName: template, urls, filename: filename, cacheDirPath, llm_model, llm_agent };
|
|
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,18 @@
|
|
|
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_agent: string | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
llm_model: string | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
file: string | undefined;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { getAvailableTemplates } from "../../../../utils/file.js";
|
|
2
|
+
import { llmAgents } from "../../../../utils/utils.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("t", {
|
|
19
|
+
alias: "template",
|
|
20
|
+
description: "Template name to use",
|
|
21
|
+
demandOption: false,
|
|
22
|
+
choices: availableTemplateNames,
|
|
23
|
+
type: "string",
|
|
24
|
+
})
|
|
25
|
+
.option("s", {
|
|
26
|
+
alias: "script",
|
|
27
|
+
description: "script filename",
|
|
28
|
+
demandOption: false,
|
|
29
|
+
default: "script",
|
|
30
|
+
type: "string",
|
|
31
|
+
})
|
|
32
|
+
.option("beats_per_scene", {
|
|
33
|
+
description: "beats per scene",
|
|
34
|
+
demandOption: false,
|
|
35
|
+
default: 3,
|
|
36
|
+
type: "number",
|
|
37
|
+
})
|
|
38
|
+
.option("llm_agent", {
|
|
39
|
+
description: "llm agent",
|
|
40
|
+
demandOption: false,
|
|
41
|
+
choices: llmAgents,
|
|
42
|
+
type: "string",
|
|
43
|
+
})
|
|
44
|
+
.option("llm_model", {
|
|
45
|
+
description: "llm model",
|
|
46
|
+
demandOption: false,
|
|
47
|
+
type: "string",
|
|
48
|
+
})
|
|
49
|
+
.positional("file", {
|
|
50
|
+
description: "story file path",
|
|
51
|
+
type: "string",
|
|
52
|
+
});
|
|
53
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ToolCliArgs } from "../../../../types/cli_types.js";
|
|
2
|
+
export declare const handler: (argv: ToolCliArgs<{
|
|
3
|
+
o?: string;
|
|
4
|
+
b?: string;
|
|
5
|
+
t?: string;
|
|
6
|
+
s?: string;
|
|
7
|
+
beats_per_scene?: number;
|
|
8
|
+
file?: string;
|
|
9
|
+
llm_agent?: string;
|
|
10
|
+
llm_model?: string;
|
|
11
|
+
}>) => Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { selectTemplate } from "../../../../utils/inquirer.js";
|
|
2
|
+
import { setGraphAILogger } from "../../../../cli/helpers.js";
|
|
3
|
+
import { storyToScript } from "../../../../tools/story_to_script.js";
|
|
4
|
+
import { mulmoStoryboardSchema } from "../../../../types/schema.js";
|
|
5
|
+
import { getBaseDirPath, getFullPath, readAndParseJson } from "../../../../utils/file.js";
|
|
6
|
+
import { outDirName } from "../../../../utils/const.js";
|
|
7
|
+
export const handler = async (argv) => {
|
|
8
|
+
const { v: verbose, s: filename, file, o: outdir, b: basedir, beats_per_scene, llm_agent, llm_model } = argv;
|
|
9
|
+
let { t: template } = argv;
|
|
10
|
+
const baseDirPath = getBaseDirPath(basedir);
|
|
11
|
+
const outDirPath = getFullPath(baseDirPath, outdir ?? outDirName);
|
|
12
|
+
if (!template) {
|
|
13
|
+
template = await selectTemplate();
|
|
14
|
+
}
|
|
15
|
+
setGraphAILogger(verbose, {
|
|
16
|
+
outdir: outDirPath,
|
|
17
|
+
basedir: baseDirPath,
|
|
18
|
+
template,
|
|
19
|
+
fileName: filename,
|
|
20
|
+
beatsPerScene: beats_per_scene,
|
|
21
|
+
storyFilePath: file,
|
|
22
|
+
llmAgent: llm_agent,
|
|
23
|
+
llmModel: llm_model,
|
|
24
|
+
});
|
|
25
|
+
const parsedStory = readAndParseJson(file, mulmoStoryboardSchema);
|
|
26
|
+
await storyToScript({
|
|
27
|
+
story: parsedStory,
|
|
28
|
+
beatsPerScene: beats_per_scene,
|
|
29
|
+
templateName: template,
|
|
30
|
+
outdir: outDirPath,
|
|
31
|
+
fileName: filename,
|
|
32
|
+
llmAgent: llm_agent,
|
|
33
|
+
llmModel: llm_model,
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Argv } from "yargs";
|
|
2
|
+
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{
|
|
3
|
+
o: string | undefined;
|
|
4
|
+
} & {
|
|
5
|
+
b: string | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
l: string | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
f: boolean;
|
|
10
|
+
} & {
|
|
11
|
+
file: string | undefined;
|
|
12
|
+
}, "file"> & {
|
|
13
|
+
file: string | undefined;
|
|
14
|
+
}>;
|
package/lib/cli/common.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { Argv } from "yargs";
|
|
2
2
|
export declare const commonOptions: (yargs: Argv) => Argv<{
|
|
3
|
-
v: boolean;
|
|
4
|
-
} & {
|
|
5
3
|
o: string | undefined;
|
|
6
4
|
} & {
|
|
7
5
|
b: string | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
l: string | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
f: boolean;
|
|
10
|
+
} & {
|
|
11
|
+
file: string | undefined;
|
|
8
12
|
}>;
|
package/lib/cli/common.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import { languages } from "../utils/const.js";
|
|
1
2
|
export const commonOptions = (yargs) => {
|
|
2
3
|
return yargs
|
|
3
|
-
.option("v", {
|
|
4
|
-
alias: "verbose",
|
|
5
|
-
describe: "verbose log",
|
|
6
|
-
demandOption: true,
|
|
7
|
-
default: false,
|
|
8
|
-
type: "boolean",
|
|
9
|
-
})
|
|
10
4
|
.option("o", {
|
|
11
5
|
alias: "outdir",
|
|
12
6
|
description: "output dir",
|
|
@@ -18,5 +12,22 @@ export const commonOptions = (yargs) => {
|
|
|
18
12
|
description: "base dir",
|
|
19
13
|
demandOption: false,
|
|
20
14
|
type: "string",
|
|
15
|
+
})
|
|
16
|
+
.option("l", {
|
|
17
|
+
alias: "lang",
|
|
18
|
+
description: "target language",
|
|
19
|
+
choices: languages,
|
|
20
|
+
demandOption: false,
|
|
21
|
+
type: "string",
|
|
22
|
+
})
|
|
23
|
+
.option("f", {
|
|
24
|
+
alias: "force",
|
|
25
|
+
describe: "Force regenerate",
|
|
26
|
+
type: "boolean",
|
|
27
|
+
default: false,
|
|
28
|
+
})
|
|
29
|
+
.positional("file", {
|
|
30
|
+
describe: "Mulmo Script File",
|
|
31
|
+
type: "string",
|
|
21
32
|
});
|
|
22
33
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MulmoStudioContext } from "../types/type.js";
|
|
2
|
+
import type { CliArgs } from "../types/cli_types.js";
|
|
3
|
+
export declare const setGraphAILogger: (verbose: boolean | undefined, logValues?: Record<string, unknown>) => void;
|
|
4
|
+
export interface FileObject {
|
|
5
|
+
baseDirPath: string;
|
|
6
|
+
mulmoFilePath: string;
|
|
7
|
+
mulmoFileDirPath: string;
|
|
8
|
+
outDirPath: string;
|
|
9
|
+
imageDirPath: string;
|
|
10
|
+
audioDirPath: string;
|
|
11
|
+
isHttpPath: boolean;
|
|
12
|
+
fileOrUrl: string;
|
|
13
|
+
outputStudioFilePath: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const getFileObject: (args: {
|
|
17
|
+
basedir?: string;
|
|
18
|
+
outdir?: string;
|
|
19
|
+
imagedir?: string;
|
|
20
|
+
audiodir?: string;
|
|
21
|
+
file: string;
|
|
22
|
+
}) => FileObject;
|
|
23
|
+
export declare const fetchScript: (isHttpPath: boolean, mulmoFilePath: string, fileOrUrl: string) => Promise<any>;
|
|
24
|
+
type InitOptions = {
|
|
25
|
+
b?: string;
|
|
26
|
+
o?: string;
|
|
27
|
+
i?: string;
|
|
28
|
+
a?: string;
|
|
29
|
+
file?: string;
|
|
30
|
+
l?: string;
|
|
31
|
+
c?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const initializeContext: (argv: CliArgs<InitOptions>) => Promise<MulmoStudioContext>;
|
|
34
|
+
export declare const runTranslateIfNeeded: (context: MulmoStudioContext, argv: {
|
|
35
|
+
l?: string;
|
|
36
|
+
c?: string;
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
export {};
|