Preprocessor for MulmoScript
npm install mulmocast-preprocessorPreprocessor for MulmoScript that enables generating multiple variations (full, summary, teaser, etc.) from a single script.
``bash`
npm install mulmocast-preprocessor
- Profile-based variants: Generate different versions (summary, teaser) from one script
- Section filtering: Extract beats by section
- Tag filtering: Extract beats by tags
- Profile listing: List available profiles with beat counts
- AI Summarization: Generate summaries using LLM (OpenAI, Anthropic, Groq, Gemini)
- AI Query: Ask questions about script content with interactive mode
- CLI tool: Command-line interface for processing scripts
`bashProcess script with profile
mulmocast-preprocessor script.json --profile summary -o summary.json
$3
| Option | Alias | Description |
|--------|-------|-------------|
|
--profile | -p | Profile name to apply (default: "default") |
| --output | -o | Output file path (default: stdout) |
| --section | -s | Filter by section name |
| --tags | -t | Filter by tags (comma-separated) |
| --help | -h | Show help |
| --version | -v | Show version |$3
| Option | Alias | Description |
|--------|-------|-------------|
|
--provider | | LLM provider: openai, anthropic, groq, gemini (default: openai) |
| --model | -m | Model name |
| --format | -f | Output format: text, markdown (default: text) |
| --lang | -l | Output language (e.g., ja, en, zh) |
| --target-length | | Target summary length in characters |
| --system-prompt | | Custom system prompt |
| --verbose | | Show detailed progress |
| --section | -s | Filter by section name |
| --tags | -t | Filter by tags (comma-separated) |$3
| Option | Alias | Description |
|--------|-------|-------------|
|
--interactive | -i | Start interactive query mode |
| --provider | | LLM provider: openai, anthropic, groq, gemini (default: openai) |
| --model | -m | Model name |
| --lang | -l | Output language (e.g., ja, en, zh) |
| --system-prompt | | Custom system prompt |
| --verbose | | Show detailed progress |
| --section | -s | Filter by section name |
| --tags | -t | Filter by tags (comma-separated) |$3
| Command | Description |
|---------|-------------|
|
/clear | Clear conversation history |
| /history | Show conversation history |
| /exit | Exit interactive mode |Programmatic Usage
$3
`typescript
import { processScript, listProfiles, applyProfile } from "mulmocast-preprocessor";
import type { ExtendedScript } from "mulmocast-preprocessor";const script: ExtendedScript = {
title: "My Presentation",
beats: [
{
text: "Full introduction text here...",
variants: {
summary: { text: "Brief intro" },
teaser: { skip: true }
},
meta: { section: "intro", tags: ["important"] }
},
{
text: "Main content...",
meta: { section: "main", tags: ["core"] }
}
]
};
// List available profiles
const profiles = listProfiles(script);
// [{ name: "default", beatCount: 2 }, { name: "summary", beatCount: 2 }, { name: "teaser", beatCount: 1, skippedCount: 1 }]
// Generate summary version
const summary = applyProfile(script, "summary");
// First beat's text is replaced with "Brief intro"
// Process with multiple options
const result = processScript(script, {
profile: "summary",
section: "intro"
});
`API
$3
Main processing function that applies profile and filters.
Parameters:
-
script: ExtendedScript - Input script with variants/meta
- options: ProcessOptions - Processing options
- profile?: string - Profile name to apply
- section?: string - Filter by section
- tags?: string[] - Filter by tags (OR logic)Returns:
MulmoScript - Standard MulmoScript with variants/meta stripped$3
Apply a profile to the script, replacing text/image and skipping marked beats.
Parameters:
-
script: ExtendedScript - Input script
- profileName: string - Profile nameReturns:
MulmoScript - Processed script$3
Get list of available profiles from script.
Parameters:
-
script: ExtendedScript - Input scriptReturns:
ProfileInfo[] - Array of profile info with beat counts$3
Filter beats by section.
$3
Filter beats by tags (extracts beats that have any of the specified tags).
$3
Generate a summary of the script content using LLM.
Parameters:
-
script: ExtendedScript - Input script
- options: SummarizeOptions - Summarization options
- provider?: LLMProvider - LLM provider (default: "openai")
- model?: string - Model name
- format?: "text" | "markdown" - Output format
- lang?: string - Output language code
- targetLengthChars?: number - Target length
- systemPrompt?: string - Custom system promptReturns:
Promise - Summary result with text and metadata$3
Ask a question about the script content.
Parameters:
-
script: ExtendedScript - Input script
- question: string - Question to ask
- options: QueryOptions - Query options (same as summarize)Returns:
Promise - Answer with question and metadata$3
Create an interactive query session for follow-up questions.
Parameters:
-
script: ExtendedScript - Input script
- options: QueryOptions - Query optionsReturns: Session object with
sendInteractiveQuery() methodEnvironment Variables
For AI features (summarize, query), set the API key for your LLM provider:
| Provider | Environment Variable |
|----------|---------------------|
| OpenAI |
OPENAI_API_KEY |
| Anthropic | ANTHROPIC_API_KEY |
| Groq | GROQ_API_KEY |
| Gemini | GEMINI_API_KEY |Extended Schema
$3
`typescript
interface ExtendedBeat extends MulmoBeat {
variants?: Record;
meta?: BeatMeta;
}
`$3
`typescript
interface BeatVariant {
text?: string; // Override text
skip?: boolean; // Skip this beat
image?: MulmoImage; // Override image
imagePrompt?: string; // Override imagePrompt
}
`$3
`typescript
interface BeatMeta {
tags?: string[];
section?: string;
context?: string;
keywords?: string[];
expectedQuestions?: string[];
}
``MIT