{"owner":"krillinai","repo":"KrillinAI","hasSkills":true,"totalSkillsCount":8,"totalTokensCount":5053,"categories":["anthropic-skill"],"hasMcp":false,"mcpConfig":null,"found":["skills/krillinai-pipeline/SKILL.md","skills/krillinai-render-horizontal/SKILL.md","skills/krillinai-tts/SKILL.md","skills/krillinai-subtitle/SKILL.md","skills/krillinai-render-vertical/SKILL.md","skills/krillinai-cover/SKILL.md","skills/krillinai-cli/SKILL.md","skills/krillinai-cli/references/cli-contract.md"],"skills":{"skills/krillinai-pipeline/SKILL.md":"---\nname: krillinai-pipeline\ndescription: Use when validating or documenting a multi-stage KrillinAI CLI output plan; the current pipeline command supports dry-run planning only, not end-to-end execution.\n---\n\n# KrillinAI Pipeline\n\nUse this skill to validate a requested stage plan. Run real work through the individual stage commands because non-dry-run `pipeline` execution returns `unsupported_command`.\n\n## Plan Validation\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" pipeline \\\n  --outputs \"subtitle,tts,vertical-bilingual\" \\\n  --dry-run)\n```\n\n## Outputs Values\n\n| Output | Stage |\n|---|---|\n| `subtitle` | Generate subtitle files |\n| `tts` | Generate dubbing |\n| `horizontal-bilingual` | Render landscape bilingual video |\n| `horizontal-dubbed` | Render landscape dubbed video |\n| `vertical-bilingual` | Render portrait bilingual video |\n| `vertical-dubbed` | Render portrait dubbed video |\n| `cover` | Generate cover |\n\nThe dry-run validates output names and returns a successful pipeline-stage JSON response. It does not execute stages or write a task manifest.\n\n## Execute The Plan\n\nMap the validated outputs to `subtitle`, `tts`, `render-horizontal`, `render-vertical`, and `cover`. Run each required command independently and use the same absolute `--workdir`.\n\n## Recovery Strategy\n\n- If `subtitle` succeeds and render fails, rerun only render with the same `--workdir`.\n- If TTS fails, keep subtitle outputs and rerun `tts` after fixing provider config.\n- Read `krillinai_manifest.json` before rerunning to avoid repeating expensive work.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true` for dry-run validation.\n- For real work, confirm every independently executed stage succeeded.\n- Confirm manifest stages and requested output files, not just the plan response.\n- Inspect final requested media/cover files, not only intermediate outputs.\n- For shared CLI details, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-render-horizontal/SKILL.md":"---\nname: krillinai-render-horizontal\ndescription: Use when rendering landscape videos with KrillinAI CLI, including original video plus bilingual subtitles or dubbed video plus target-language subtitles.\n---\n\n# KrillinAI Render Horizontal\n\nUse this skill for `render-horizontal`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/bilingual_srt.srt\")\n```\n\n## Dubbed Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed)\n```\n\n## Inputs\n\n- `--video`: source video, or omit when manifest has the correct input.\n- `--audio`: optional replacement audio.\n- `--subtitle`: usually `bilingual_srt.srt` for bilingual, `target_language_srt.srt` for dubbed.\n- `--workdir`: directory containing `krillinai_manifest.json`.\n- `--subtitle-style-file`: optional JSON override merged with the default subtitle style.\n\n## Outputs\n\n- `horizontal_bilingual.mp4` for the default variant.\n- `horizontal_dubbed.mp4` with `--dubbed`.\n- Both variants are reported through the manifest key `horizontal_video`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm output video exists and has video/audio streams.\n- Extract a preview frame when checking subtitle placement.\n- For manifest and error handling, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-tts/SKILL.md":"---\nname: krillinai-tts\ndescription: Use when generating target-language dubbing with KrillinAI CLI from SRT subtitles, including TTS audio creation and optional dubbed video generation.\n---\n\n# KrillinAI TTS\n\nUse this skill for the `tts` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" tts \\\n  --workdir \"$WORKDIR\" \\\n  --input-srt \"$WORKDIR/target_language_srt.srt\" \\\n  --line-mode target-only \\\n  --video \"$WORKDIR/origin_video.mp4\")\n```\n\n## Inputs\n\n- `--input-srt` is required. Usually use `target_language_srt.srt`.\n- `--video` is optional but needed when generating `video_with_tts.mp4`.\n- TTS provider must be configured in `<execution-cwd>/config/config.toml`.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--input-srt` | SRT to synthesize |\n| `--line-mode target-only` | Use target-language lines only |\n| `--line-mode bilingual-target-top` | Bilingual mode with target on top |\n| `--line-mode bilingual-target-bottom` | Bilingual mode with target on bottom |\n| `--voice` | Provider-specific voice |\n| `--voice-clone-source` | Voice clone source audio URL/path when supported |\n| `--dry-run` | Validate command shape |\n\n## Outputs\n\nRead paths from manifest:\n\n- `tts_final_audio.wav`\n- `video_with_tts.mp4` when a video input is available\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `tts_final_audio.wav` exists and has non-zero size.\n- If `video_with_tts.mp4` is produced, inspect duration and audio stream with `ffprobe`.\n- For JSON/error contract, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-subtitle/SKILL.md":"---\nname: krillinai-subtitle\ndescription: Use when generating subtitles with KrillinAI CLI from a YouTube link, Bilibili/local video, or existing media, including platform caption download, Whisper fallback, translation, bilingual SRT, and short vertical subtitle output.\n---\n\n# KrillinAI Subtitle\n\nUse this skill for the `subtitle` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle \"<input>\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n```\n\n## Inputs\n\n- YouTube URL: prefer `--caption-source any`; platform captions are used first, then Whisper fallback.\n- Local file: use `local:/abs/path/video.mp4` or a path accepted by the CLI.\n- Bilibili or other yt-dlp supported links: use when media download works; platform caption behavior may differ, so expect transcription fallback.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--origin-lang` | Source language, such as `en`, `zh`, `ja` |\n| `--target-lang` | Target language, such as `zh_cn` |\n| `--workdir` | Dedicated task directory |\n| `--caption-source any` | Prefer platform captions, fallback to transcription |\n| `--caption-source whisper` | Force transcription |\n| `--prepare-video` | Require the original video for later render stages |\n| `--bilingual-top=true` | Put target language on top in bilingual SRT |\n| `--subtitle-style-file` | Merge a JSON subtitle-style override |\n| `--dry-run` | Validate without downloads or AI calls |\n\n## Outputs\n\nAfter a real run, read paths from `krillinai_manifest.json`. Main files:\n\n- `origin_language_srt.srt`\n- `target_language_srt.srt`\n- `bilingual_srt.srt`\n- `short_origin_mixed_srt.srt`\n- `origin_video.mp4` when media preparation produced or required video\n- `origin_audio.mp3` when transcription preparation produced audio\n\n`subtitle --dry-run` validates command shape but does not write a manifest or output files.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `krillinai_manifest.json` exists under `--workdir`.\n- Spot-check `bilingual_srt.srt` ordering and `short_origin_mixed_srt.srt` readability.\n- When `--prepare-video` was requested, require a non-empty `origin_video` output.\n- For Agent integration details, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-render-vertical/SKILL.md":"---\nname: krillinai-render-vertical\ndescription: Use when rendering portrait videos with KrillinAI CLI, including converting source video to vertical format, adding short bilingual subtitles, rendering dubbed vertical videos, and checking vertical subtitle readability.\n---\n\n# KrillinAI Render Vertical\n\nUse this skill for `render-vertical`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Short-Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/short_origin_mixed_srt.srt\" \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Dubbed Vertical Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Subtitle Behavior\n\nThe Go renderer follows the good behavior from `vertical_srt.py`:\n\n- Chinese uses word segmentation before line decisions.\n- Display width is used for line splitting: Chinese counts as width 2, other text as width 1.\n- Long Chinese subtitles are split across time into multiple `Dialogue` entries instead of stacked with `\\N`.\n- The goal is to keep the screen to one English line plus one Chinese line when possible.\n\n## Outputs\n\n- `transferred_vertical_video.mp4`: source converted to portrait format.\n- `vertical_bilingual.mp4`: default final vertical video.\n- `vertical_dubbed.mp4`: final video with `--dubbed`.\n- Final variants are reported through the manifest key `vertical_video`.\n\n## Verification\n\nUse text and visual checks:\n\n```bash\nrg -n -F '\\\\N' \"$WORKDIR/formatted_vertical_bilingual.ass\"\nffmpeg -y -ss 00:00:01 -i \"$WORKDIR/vertical_bilingual.mp4\" \\\n  -frames:v 1 \"$WORKDIR/vertical_preview_%03d.jpg\"\n```\n\nAlso require terminal JSON with `\"ok\": true`, valid video/audio streams, readable subtitles, and non-garbled titles.\n","skills/krillinai-cover/SKILL.md":"---\nname: krillinai-cover\ndescription: Use when generating a cover image with the KrillinAI CLI from a complete image prompt, including validating image-provider configuration and inspecting the generated image and saved prompt.\n---\n\n# KrillinAI Cover\n\nUse this skill for the implemented `cover` command. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" cover \\\n  --workdir \"$WORKDIR\" \\\n  --prompt \"$COVER_PROMPT\" \\\n  --size 1536x1024)\n```\n\nThe prompt must already contain the desired title text, language, composition, visual style, and any useful source-video context. The current CLI does not expose a reference-image argument and does not automatically send `origin_cover.jpg` to the image model.\n\n## Inputs\n\n- `--workdir`: an existing or new task directory.\n- `--prompt`: required final prompt sent to the configured image model.\n- `--size`: optional image size; the default is `1024x1024`.\n- `[image]` configuration in `<execution-cwd>/config/config.toml`.\n\n## Outputs\n\n- `generated_cover.png`\n- `cover_prompt.final.txt`\n- `krillinai_manifest.json`\n\n## Dry Run\n\n`cover --dry-run` validates the command and writes a manifest, but it does not call the image model or create `generated_cover.png`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Read output paths from the terminal response or manifest.\n- Confirm `generated_cover.png` is non-empty and decodable as an image.\n- Confirm `cover_prompt.final.txt` exactly records the submitted prompt.\n- If provider configuration is missing or generation fails, report the returned error rather than treating the manifest alone as success.\n","skills/krillinai-cli/SKILL.md":"---\nname: krillinai-cli\ndescription: Use when an agent needs to build or operate the embedded KrillinAI CLI, choose a supported command, or interpret its JSON, manifest, subtitle, dubbing, render, cover, speech, and voice outputs.\n---\n\n# KrillinAI CLI\n\nUse this as the top-level routing skill for KrillinAI command-line work.\n\n## Build And Locate The Binary\n\nBuild both KrillinAI binaries through the repository script:\n\n```bash\npnpm krillinai:build\n```\n\nFor the current machine, locate the CLI without assuming a platform or architecture:\n\n```bash\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$PWD/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\ntest -f \"$KRILLINAI_CLI\"\n```\n\nThe CLI loads `config/config.toml` relative to its process working directory. For real runs from a source checkout, use `runtime/krillinai` as the process working directory and create its ignored `config/config.toml` from `config/config-example.toml` without overwriting an existing file. A release archive should be run from its unpacked package root.\n\nFor build layout, configuration, JSON, manifest, output, and error details, read:\n\n```text\nskills/krillinai-cli/references/cli-contract.md\n```\n\n## Choose The Command\n\n| User intent | Command / skill |\n|---|---|\n| Generate source, target, bilingual, and short vertical subtitles | `subtitle`; use `krillinai-subtitle` |\n| Generate target-language dubbing from subtitles | `tts`; use `krillinai-tts` |\n| Create landscape videos | `render-horizontal`; use `krillinai-render-horizontal` |\n| Create portrait/short-form videos | `render-vertical`; use `krillinai-render-vertical` |\n| Generate a cover from a complete image prompt | `cover`; use `krillinai-cover` |\n| Generate speech from plain text | `speech` |\n| List provider voice codes for Aliyun, OpenAI, or MiniMax | `voices` |\n| Validate a requested multi-stage output plan | `pipeline --dry-run`; use `krillinai-pipeline` |\n\n`pipeline` only validates plans in dry-run mode; non-dry-run execution returns `unsupported_command`. `status` is reserved and unsupported.\n\n## Operating Rules For Agents\n\n- Use a dedicated `--workdir`; do not scatter outputs in the repo root.\n- Use `--dry-run` for command-shape validation before external calls.\n- Parse stdout as JSON lines. The terminal response is the object containing `ok`; OpenCreator mode may emit progress frames first.\n- Treat `krillinai_manifest.json` and actual output files as the source of truth after a real stage.\n- Reuse manifest outputs for later stages instead of guessing filenames.\n- If a command fails, classify by `error.kind`: `usage`, `retryable`, `dependency`, or `internal`.\n- Avoid rerunning expensive stages if the manifest already has valid upstream outputs.\n- Do not claim that `cover` consumed a reference image: the current CLI accepts a complete text prompt and size only.\n- Do not request an Edge TTS voice catalog: `voices` currently supports `aliyun`, `openai`, and `minimax`.\n\n## Minimal Workflow\n\n```bash\nREPO_ROOT=\"$PWD\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\nmkdir -p \"$WORKDIR\"\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" subtitle \\\n  \"https://www.youtube.com/watch?v=VIDEO_ID\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\")\n```\n","skills/krillinai-cli/references/cli-contract.md":"# KrillinAI CLI Contract\n\n## Build And Binary\n\nUse the repository build script from the OpenCreator root:\n\n```bash\npnpm krillinai:build\n```\n\nIt builds `runtime/krillinai/cmd/cli` and `runtime/krillinai/cmd/server`. Native binaries and a manifest are written under:\n\n```text\n.runtime/build/krillinai/<platform>-<arch>/\n├── bin/krillinai-cli[.exe]\n├── bin/krillinai-server[.exe]\n└── manifest.json\n```\n\nSet reusable absolute paths from the repository root:\n\n```bash\nREPO_ROOT=\"$PWD\"\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$REPO_ROOT/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\nKRILLINAI_CWD=\"$REPO_ROOT/runtime/krillinai\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\ntest -f \"$KRILLINAI_CLI\"\nmkdir -p \"$WORKDIR\"\n```\n\n## Execution Working Directory\n\nThe CLI loads `config/config.toml` relative to the process working directory.\n\n- Source checkout: run real commands with `runtime/krillinai` as the working directory. Create the ignored `runtime/krillinai/config/config.toml` from `config-example.toml` and configure only the providers needed by the requested stage.\n- Release archive: run from the unpacked package root after creating `config/config.toml` from `config/config-example.toml`.\n- OpenCreator: the Daemon prepares an isolated launcher directory and configuration automatically; do not replace that flow with a source-tree config.\n\nUse absolute `--workdir`, input, subtitle, audio, and output paths when changing the process working directory.\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `subtitle` | Generate source-language, target-language, bilingual, and short vertical subtitles |\n| `tts` | Generate TTS audio and optional dubbed video |\n| `speech` | Generate one audio file from text or a UTF-8 text file |\n| `render-horizontal` | Render landscape subtitle/dubbed videos |\n| `render-vertical` | Render portrait subtitle/dubbed videos |\n| `cover` | Generate a cover image from a complete text prompt |\n| `voices` | List voice codes for `aliyun`, `openai`, or `minimax`; Edge TTS has no CLI voice catalog |\n| `pipeline` | Validate output plans with `--dry-run`; non-dry-run execution is unsupported |\n| `status` | Reserved and unsupported |\n\n## Manifest\n\nEvery working directory should contain:\n\n```text\nkrillinai_manifest.json\n```\n\nRead this file to locate stage outputs. Important default paths:\n\n| Output key | Default path |\n|---|---|\n| `origin_video` | `<workdir>/origin_video.mp4` |\n| `origin_audio` | `<workdir>/origin_audio.mp3` |\n| `origin_srt` | `<workdir>/origin_language_srt.srt` |\n| `target_srt` | `<workdir>/target_language_srt.srt` |\n| `bilingual_srt` | `<workdir>/bilingual_srt.srt` |\n| `short_origin_mixed_srt` | `<workdir>/short_origin_mixed_srt.srt` |\n| `tts_audio` | `<workdir>/tts_final_audio.wav` |\n| `video_with_tts` | `<workdir>/video_with_tts.mp4` |\n| `horizontal_video` | `<workdir>/horizontal_bilingual.mp4` |\n| `vertical_video` | `<workdir>/vertical_bilingual.mp4` |\n| `transferred_vertical_video` | `<workdir>/transferred_vertical_video.mp4` |\n| `origin_cover` | `<workdir>/origin_cover.jpg` |\n| `generated_cover` | `<workdir>/generated_cover.png` |\n| `cover_prompt` | `<workdir>/cover_prompt.final.txt` |\n\nHorizontal and vertical dubbed variants use `horizontal_dubbed.mp4` and `vertical_dubbed.mp4`; their manifest keys remain `horizontal_video` and `vertical_video`.\n\n## JSON Lines\n\nParse stdout one line at a time as JSON. The terminal response is the object containing `ok`.\n\nWhen `OPENCREATOR_KRILLINAI_CLI=1`, `subtitle` and `tts` can emit progress frames before the terminal response:\n\n```json\n{\"type\":\"progress\",\"phase\":\"translating_subtitles\",\"percent\":50,\"message\":\"正在翻译字幕\"}\n```\n\nSuccess shape:\n\n```json\n{\n  \"ok\": true,\n  \"stage\": \"subtitle\",\n  \"workdir\": \"tasks/demo\",\n  \"task_id\": \"demo\",\n  \"outputs\": {}\n}\n```\n\nFailure shape:\n\n```json\n{\n  \"ok\": false,\n  \"error\": {\n    \"kind\": \"retryable\",\n    \"code\": \"audio_transcription_failed\",\n    \"message\": \"connection timeout\",\n    \"retryable\": true\n  }\n}\n```\n\n## Exit Codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | Usage error |\n| `2` | Retryable error |\n| `3` | Dependency error |\n\nInternal errors currently also exit with code `1`, so use `error.kind` rather than the exit code alone for classification.\n\n## Error Handling\n\n- `usage`: fix flags or missing input.\n- `retryable`: retry after delay or switch provider/source.\n- `dependency`: install or expose `ffmpeg`, `ffprobe`, or `yt-dlp`.\n- `internal`: inspect logs and generated files.\n\n## Dry Run\n\n- `subtitle`, `render-horizontal`, `render-vertical`, `speech`, and `pipeline` validate without writing a task manifest.\n- `tts` and `cover` dry-runs apply default outputs and write `krillinai_manifest.json`, but do not produce media.\n- `voices --dry-run` returns the same local voice list without an external provider call; use `aliyun`, `openai`, or `minimax`.\n\n## Command-Shape Verification\n\nThis check does not need provider credentials or media dependencies:\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle local:demo.mp4 \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --dry-run)\n```\n\nFor rendered media, inspect the output file and optionally extract preview frames with `ffmpeg`.\n"},"files":{"skills/krillinai-pipeline/SKILL.md":"---\nname: krillinai-pipeline\ndescription: Use when validating or documenting a multi-stage KrillinAI CLI output plan; the current pipeline command supports dry-run planning only, not end-to-end execution.\n---\n\n# KrillinAI Pipeline\n\nUse this skill to validate a requested stage plan. Run real work through the individual stage commands because non-dry-run `pipeline` execution returns `unsupported_command`.\n\n## Plan Validation\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" pipeline \\\n  --outputs \"subtitle,tts,vertical-bilingual\" \\\n  --dry-run)\n```\n\n## Outputs Values\n\n| Output | Stage |\n|---|---|\n| `subtitle` | Generate subtitle files |\n| `tts` | Generate dubbing |\n| `horizontal-bilingual` | Render landscape bilingual video |\n| `horizontal-dubbed` | Render landscape dubbed video |\n| `vertical-bilingual` | Render portrait bilingual video |\n| `vertical-dubbed` | Render portrait dubbed video |\n| `cover` | Generate cover |\n\nThe dry-run validates output names and returns a successful pipeline-stage JSON response. It does not execute stages or write a task manifest.\n\n## Execute The Plan\n\nMap the validated outputs to `subtitle`, `tts`, `render-horizontal`, `render-vertical`, and `cover`. Run each required command independently and use the same absolute `--workdir`.\n\n## Recovery Strategy\n\n- If `subtitle` succeeds and render fails, rerun only render with the same `--workdir`.\n- If TTS fails, keep subtitle outputs and rerun `tts` after fixing provider config.\n- Read `krillinai_manifest.json` before rerunning to avoid repeating expensive work.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true` for dry-run validation.\n- For real work, confirm every independently executed stage succeeded.\n- Confirm manifest stages and requested output files, not just the plan response.\n- Inspect final requested media/cover files, not only intermediate outputs.\n- For shared CLI details, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-render-horizontal/SKILL.md":"---\nname: krillinai-render-horizontal\ndescription: Use when rendering landscape videos with KrillinAI CLI, including original video plus bilingual subtitles or dubbed video plus target-language subtitles.\n---\n\n# KrillinAI Render Horizontal\n\nUse this skill for `render-horizontal`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/bilingual_srt.srt\")\n```\n\n## Dubbed Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed)\n```\n\n## Inputs\n\n- `--video`: source video, or omit when manifest has the correct input.\n- `--audio`: optional replacement audio.\n- `--subtitle`: usually `bilingual_srt.srt` for bilingual, `target_language_srt.srt` for dubbed.\n- `--workdir`: directory containing `krillinai_manifest.json`.\n- `--subtitle-style-file`: optional JSON override merged with the default subtitle style.\n\n## Outputs\n\n- `horizontal_bilingual.mp4` for the default variant.\n- `horizontal_dubbed.mp4` with `--dubbed`.\n- Both variants are reported through the manifest key `horizontal_video`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm output video exists and has video/audio streams.\n- Extract a preview frame when checking subtitle placement.\n- For manifest and error handling, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-tts/SKILL.md":"---\nname: krillinai-tts\ndescription: Use when generating target-language dubbing with KrillinAI CLI from SRT subtitles, including TTS audio creation and optional dubbed video generation.\n---\n\n# KrillinAI TTS\n\nUse this skill for the `tts` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" tts \\\n  --workdir \"$WORKDIR\" \\\n  --input-srt \"$WORKDIR/target_language_srt.srt\" \\\n  --line-mode target-only \\\n  --video \"$WORKDIR/origin_video.mp4\")\n```\n\n## Inputs\n\n- `--input-srt` is required. Usually use `target_language_srt.srt`.\n- `--video` is optional but needed when generating `video_with_tts.mp4`.\n- TTS provider must be configured in `<execution-cwd>/config/config.toml`.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--input-srt` | SRT to synthesize |\n| `--line-mode target-only` | Use target-language lines only |\n| `--line-mode bilingual-target-top` | Bilingual mode with target on top |\n| `--line-mode bilingual-target-bottom` | Bilingual mode with target on bottom |\n| `--voice` | Provider-specific voice |\n| `--voice-clone-source` | Voice clone source audio URL/path when supported |\n| `--dry-run` | Validate command shape |\n\n## Outputs\n\nRead paths from manifest:\n\n- `tts_final_audio.wav`\n- `video_with_tts.mp4` when a video input is available\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `tts_final_audio.wav` exists and has non-zero size.\n- If `video_with_tts.mp4` is produced, inspect duration and audio stream with `ffprobe`.\n- For JSON/error contract, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-subtitle/SKILL.md":"---\nname: krillinai-subtitle\ndescription: Use when generating subtitles with KrillinAI CLI from a YouTube link, Bilibili/local video, or existing media, including platform caption download, Whisper fallback, translation, bilingual SRT, and short vertical subtitle output.\n---\n\n# KrillinAI Subtitle\n\nUse this skill for the `subtitle` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle \"<input>\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n```\n\n## Inputs\n\n- YouTube URL: prefer `--caption-source any`; platform captions are used first, then Whisper fallback.\n- Local file: use `local:/abs/path/video.mp4` or a path accepted by the CLI.\n- Bilibili or other yt-dlp supported links: use when media download works; platform caption behavior may differ, so expect transcription fallback.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--origin-lang` | Source language, such as `en`, `zh`, `ja` |\n| `--target-lang` | Target language, such as `zh_cn` |\n| `--workdir` | Dedicated task directory |\n| `--caption-source any` | Prefer platform captions, fallback to transcription |\n| `--caption-source whisper` | Force transcription |\n| `--prepare-video` | Require the original video for later render stages |\n| `--bilingual-top=true` | Put target language on top in bilingual SRT |\n| `--subtitle-style-file` | Merge a JSON subtitle-style override |\n| `--dry-run` | Validate without downloads or AI calls |\n\n## Outputs\n\nAfter a real run, read paths from `krillinai_manifest.json`. Main files:\n\n- `origin_language_srt.srt`\n- `target_language_srt.srt`\n- `bilingual_srt.srt`\n- `short_origin_mixed_srt.srt`\n- `origin_video.mp4` when media preparation produced or required video\n- `origin_audio.mp3` when transcription preparation produced audio\n\n`subtitle --dry-run` validates command shape but does not write a manifest or output files.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `krillinai_manifest.json` exists under `--workdir`.\n- Spot-check `bilingual_srt.srt` ordering and `short_origin_mixed_srt.srt` readability.\n- When `--prepare-video` was requested, require a non-empty `origin_video` output.\n- For Agent integration details, read `skills/krillinai-cli/references/cli-contract.md`.\n","skills/krillinai-render-vertical/SKILL.md":"---\nname: krillinai-render-vertical\ndescription: Use when rendering portrait videos with KrillinAI CLI, including converting source video to vertical format, adding short bilingual subtitles, rendering dubbed vertical videos, and checking vertical subtitle readability.\n---\n\n# KrillinAI Render Vertical\n\nUse this skill for `render-vertical`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Short-Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/short_origin_mixed_srt.srt\" \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Dubbed Vertical Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Subtitle Behavior\n\nThe Go renderer follows the good behavior from `vertical_srt.py`:\n\n- Chinese uses word segmentation before line decisions.\n- Display width is used for line splitting: Chinese counts as width 2, other text as width 1.\n- Long Chinese subtitles are split across time into multiple `Dialogue` entries instead of stacked with `\\N`.\n- The goal is to keep the screen to one English line plus one Chinese line when possible.\n\n## Outputs\n\n- `transferred_vertical_video.mp4`: source converted to portrait format.\n- `vertical_bilingual.mp4`: default final vertical video.\n- `vertical_dubbed.mp4`: final video with `--dubbed`.\n- Final variants are reported through the manifest key `vertical_video`.\n\n## Verification\n\nUse text and visual checks:\n\n```bash\nrg -n -F '\\\\N' \"$WORKDIR/formatted_vertical_bilingual.ass\"\nffmpeg -y -ss 00:00:01 -i \"$WORKDIR/vertical_bilingual.mp4\" \\\n  -frames:v 1 \"$WORKDIR/vertical_preview_%03d.jpg\"\n```\n\nAlso require terminal JSON with `\"ok\": true`, valid video/audio streams, readable subtitles, and non-garbled titles.\n","skills/krillinai-cover/SKILL.md":"---\nname: krillinai-cover\ndescription: Use when generating a cover image with the KrillinAI CLI from a complete image prompt, including validating image-provider configuration and inspecting the generated image and saved prompt.\n---\n\n# KrillinAI Cover\n\nUse this skill for the implemented `cover` command. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" cover \\\n  --workdir \"$WORKDIR\" \\\n  --prompt \"$COVER_PROMPT\" \\\n  --size 1536x1024)\n```\n\nThe prompt must already contain the desired title text, language, composition, visual style, and any useful source-video context. The current CLI does not expose a reference-image argument and does not automatically send `origin_cover.jpg` to the image model.\n\n## Inputs\n\n- `--workdir`: an existing or new task directory.\n- `--prompt`: required final prompt sent to the configured image model.\n- `--size`: optional image size; the default is `1024x1024`.\n- `[image]` configuration in `<execution-cwd>/config/config.toml`.\n\n## Outputs\n\n- `generated_cover.png`\n- `cover_prompt.final.txt`\n- `krillinai_manifest.json`\n\n## Dry Run\n\n`cover --dry-run` validates the command and writes a manifest, but it does not call the image model or create `generated_cover.png`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Read output paths from the terminal response or manifest.\n- Confirm `generated_cover.png` is non-empty and decodable as an image.\n- Confirm `cover_prompt.final.txt` exactly records the submitted prompt.\n- If provider configuration is missing or generation fails, report the returned error rather than treating the manifest alone as success.\n","skills/krillinai-cli/SKILL.md":"---\nname: krillinai-cli\ndescription: Use when an agent needs to build or operate the embedded KrillinAI CLI, choose a supported command, or interpret its JSON, manifest, subtitle, dubbing, render, cover, speech, and voice outputs.\n---\n\n# KrillinAI CLI\n\nUse this as the top-level routing skill for KrillinAI command-line work.\n\n## Build And Locate The Binary\n\nBuild both KrillinAI binaries through the repository script:\n\n```bash\npnpm krillinai:build\n```\n\nFor the current machine, locate the CLI without assuming a platform or architecture:\n\n```bash\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$PWD/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\ntest -f \"$KRILLINAI_CLI\"\n```\n\nThe CLI loads `config/config.toml` relative to its process working directory. For real runs from a source checkout, use `runtime/krillinai` as the process working directory and create its ignored `config/config.toml` from `config/config-example.toml` without overwriting an existing file. A release archive should be run from its unpacked package root.\n\nFor build layout, configuration, JSON, manifest, output, and error details, read:\n\n```text\nskills/krillinai-cli/references/cli-contract.md\n```\n\n## Choose The Command\n\n| User intent | Command / skill |\n|---|---|\n| Generate source, target, bilingual, and short vertical subtitles | `subtitle`; use `krillinai-subtitle` |\n| Generate target-language dubbing from subtitles | `tts`; use `krillinai-tts` |\n| Create landscape videos | `render-horizontal`; use `krillinai-render-horizontal` |\n| Create portrait/short-form videos | `render-vertical`; use `krillinai-render-vertical` |\n| Generate a cover from a complete image prompt | `cover`; use `krillinai-cover` |\n| Generate speech from plain text | `speech` |\n| List provider voice codes for Aliyun, OpenAI, or MiniMax | `voices` |\n| Validate a requested multi-stage output plan | `pipeline --dry-run`; use `krillinai-pipeline` |\n\n`pipeline` only validates plans in dry-run mode; non-dry-run execution returns `unsupported_command`. `status` is reserved and unsupported.\n\n## Operating Rules For Agents\n\n- Use a dedicated `--workdir`; do not scatter outputs in the repo root.\n- Use `--dry-run` for command-shape validation before external calls.\n- Parse stdout as JSON lines. The terminal response is the object containing `ok`; OpenCreator mode may emit progress frames first.\n- Treat `krillinai_manifest.json` and actual output files as the source of truth after a real stage.\n- Reuse manifest outputs for later stages instead of guessing filenames.\n- If a command fails, classify by `error.kind`: `usage`, `retryable`, `dependency`, or `internal`.\n- Avoid rerunning expensive stages if the manifest already has valid upstream outputs.\n- Do not claim that `cover` consumed a reference image: the current CLI accepts a complete text prompt and size only.\n- Do not request an Edge TTS voice catalog: `voices` currently supports `aliyun`, `openai`, and `minimax`.\n\n## Minimal Workflow\n\n```bash\nREPO_ROOT=\"$PWD\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\nmkdir -p \"$WORKDIR\"\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" subtitle \\\n  \"https://www.youtube.com/watch?v=VIDEO_ID\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\")\n```\n","skills/krillinai-cli/references/cli-contract.md":"# KrillinAI CLI Contract\n\n## Build And Binary\n\nUse the repository build script from the OpenCreator root:\n\n```bash\npnpm krillinai:build\n```\n\nIt builds `runtime/krillinai/cmd/cli` and `runtime/krillinai/cmd/server`. Native binaries and a manifest are written under:\n\n```text\n.runtime/build/krillinai/<platform>-<arch>/\n├── bin/krillinai-cli[.exe]\n├── bin/krillinai-server[.exe]\n└── manifest.json\n```\n\nSet reusable absolute paths from the repository root:\n\n```bash\nREPO_ROOT=\"$PWD\"\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$REPO_ROOT/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\nKRILLINAI_CWD=\"$REPO_ROOT/runtime/krillinai\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\ntest -f \"$KRILLINAI_CLI\"\nmkdir -p \"$WORKDIR\"\n```\n\n## Execution Working Directory\n\nThe CLI loads `config/config.toml` relative to the process working directory.\n\n- Source checkout: run real commands with `runtime/krillinai` as the working directory. Create the ignored `runtime/krillinai/config/config.toml` from `config-example.toml` and configure only the providers needed by the requested stage.\n- Release archive: run from the unpacked package root after creating `config/config.toml` from `config/config-example.toml`.\n- OpenCreator: the Daemon prepares an isolated launcher directory and configuration automatically; do not replace that flow with a source-tree config.\n\nUse absolute `--workdir`, input, subtitle, audio, and output paths when changing the process working directory.\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `subtitle` | Generate source-language, target-language, bilingual, and short vertical subtitles |\n| `tts` | Generate TTS audio and optional dubbed video |\n| `speech` | Generate one audio file from text or a UTF-8 text file |\n| `render-horizontal` | Render landscape subtitle/dubbed videos |\n| `render-vertical` | Render portrait subtitle/dubbed videos |\n| `cover` | Generate a cover image from a complete text prompt |\n| `voices` | List voice codes for `aliyun`, `openai`, or `minimax`; Edge TTS has no CLI voice catalog |\n| `pipeline` | Validate output plans with `--dry-run`; non-dry-run execution is unsupported |\n| `status` | Reserved and unsupported |\n\n## Manifest\n\nEvery working directory should contain:\n\n```text\nkrillinai_manifest.json\n```\n\nRead this file to locate stage outputs. Important default paths:\n\n| Output key | Default path |\n|---|---|\n| `origin_video` | `<workdir>/origin_video.mp4` |\n| `origin_audio` | `<workdir>/origin_audio.mp3` |\n| `origin_srt` | `<workdir>/origin_language_srt.srt` |\n| `target_srt` | `<workdir>/target_language_srt.srt` |\n| `bilingual_srt` | `<workdir>/bilingual_srt.srt` |\n| `short_origin_mixed_srt` | `<workdir>/short_origin_mixed_srt.srt` |\n| `tts_audio` | `<workdir>/tts_final_audio.wav` |\n| `video_with_tts` | `<workdir>/video_with_tts.mp4` |\n| `horizontal_video` | `<workdir>/horizontal_bilingual.mp4` |\n| `vertical_video` | `<workdir>/vertical_bilingual.mp4` |\n| `transferred_vertical_video` | `<workdir>/transferred_vertical_video.mp4` |\n| `origin_cover` | `<workdir>/origin_cover.jpg` |\n| `generated_cover` | `<workdir>/generated_cover.png` |\n| `cover_prompt` | `<workdir>/cover_prompt.final.txt` |\n\nHorizontal and vertical dubbed variants use `horizontal_dubbed.mp4` and `vertical_dubbed.mp4`; their manifest keys remain `horizontal_video` and `vertical_video`.\n\n## JSON Lines\n\nParse stdout one line at a time as JSON. The terminal response is the object containing `ok`.\n\nWhen `OPENCREATOR_KRILLINAI_CLI=1`, `subtitle` and `tts` can emit progress frames before the terminal response:\n\n```json\n{\"type\":\"progress\",\"phase\":\"translating_subtitles\",\"percent\":50,\"message\":\"正在翻译字幕\"}\n```\n\nSuccess shape:\n\n```json\n{\n  \"ok\": true,\n  \"stage\": \"subtitle\",\n  \"workdir\": \"tasks/demo\",\n  \"task_id\": \"demo\",\n  \"outputs\": {}\n}\n```\n\nFailure shape:\n\n```json\n{\n  \"ok\": false,\n  \"error\": {\n    \"kind\": \"retryable\",\n    \"code\": \"audio_transcription_failed\",\n    \"message\": \"connection timeout\",\n    \"retryable\": true\n  }\n}\n```\n\n## Exit Codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | Usage error |\n| `2` | Retryable error |\n| `3` | Dependency error |\n\nInternal errors currently also exit with code `1`, so use `error.kind` rather than the exit code alone for classification.\n\n## Error Handling\n\n- `usage`: fix flags or missing input.\n- `retryable`: retry after delay or switch provider/source.\n- `dependency`: install or expose `ffmpeg`, `ffprobe`, or `yt-dlp`.\n- `internal`: inspect logs and generated files.\n\n## Dry Run\n\n- `subtitle`, `render-horizontal`, `render-vertical`, `speech`, and `pipeline` validate without writing a task manifest.\n- `tts` and `cover` dry-runs apply default outputs and write `krillinai_manifest.json`, but do not produce media.\n- `voices --dry-run` returns the same local voice list without an external provider call; use `aliyun`, `openai`, or `minimax`.\n\n## Command-Shape Verification\n\nThis check does not need provider credentials or media dependencies:\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle local:demo.mp4 \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --dry-run)\n```\n\nFor rendered media, inspect the output file and optionally extract preview frames with `ffmpeg`.\n"},"items":[{"name":"cli-contract.md","path":"skills/krillinai-cli/references/cli-contract.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-cli/references/cli-contract.md","title":"References Skill","category":"anthropic-skill","format":"markdown","content":"# KrillinAI CLI Contract\n\n## Build And Binary\n\nUse the repository build script from the OpenCreator root:\n\n```bash\npnpm krillinai:build\n```\n\nIt builds `runtime/krillinai/cmd/cli` and `runtime/krillinai/cmd/server`. Native binaries and a manifest are written under:\n\n```text\n.runtime/build/krillinai/<platform>-<arch>/\n├── bin/krillinai-cli[.exe]\n├── bin/krillinai-server[.exe]\n└── manifest.json\n```\n\nSet reusable absolute paths from the repository root:\n\n```bash\nREPO_ROOT=\"$PWD\"\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$REPO_ROOT/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\nKRILLINAI_CWD=\"$REPO_ROOT/runtime/krillinai\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\ntest -f \"$KRILLINAI_CLI\"\nmkdir -p \"$WORKDIR\"\n```\n\n## Execution Working Directory\n\nThe CLI loads `config/config.toml` relative to the process working directory.\n\n- Source checkout: run real commands with `runtime/krillinai` as the working directory. Create the ignored `runtime/krillinai/config/config.toml` from `config-example.toml` and configure only the providers needed by the requested stage.\n- Release archive: run from the unpacked package root after creating `config/config.toml` from `config/config-example.toml`.\n- OpenCreator: the Daemon prepares an isolated launcher directory and configuration automatically; do not replace that flow with a source-tree config.\n\nUse absolute `--workdir`, input, subtitle, audio, and output paths when changing the process working directory.\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `subtitle` | Generate source-language, target-language, bilingual, and short vertical subtitles |\n| `tts` | Generate TTS audio and optional dubbed video |\n| `speech` | Generate one audio file from text or a UTF-8 text file |\n| `render-horizontal` | Render landscape subtitle/dubbed videos |\n| `render-vertical` | Render portrait subtitle/dubbed videos |\n| `cover` | Generate a cover image from a complete text prompt |\n| `voices` | List voice codes for `aliyun`, `openai`, or `minimax`; Edge TTS has no CLI voice catalog |\n| `pipeline` | Validate output plans with `--dry-run`; non-dry-run execution is unsupported |\n| `status` | Reserved and unsupported |\n\n## Manifest\n\nEvery working directory should contain:\n\n```text\nkrillinai_manifest.json\n```\n\nRead this file to locate stage outputs. Important default paths:\n\n| Output key | Default path |\n|---|---|\n| `origin_video` | `<workdir>/origin_video.mp4` |\n| `origin_audio` | `<workdir>/origin_audio.mp3` |\n| `origin_srt` | `<workdir>/origin_language_srt.srt` |\n| `target_srt` | `<workdir>/target_language_srt.srt` |\n| `bilingual_srt` | `<workdir>/bilingual_srt.srt` |\n| `short_origin_mixed_srt` | `<workdir>/short_origin_mixed_srt.srt` |\n| `tts_audio` | `<workdir>/tts_final_audio.wav` |\n| `video_with_tts` | `<workdir>/video_with_tts.mp4` |\n| `horizontal_video` | `<workdir>/horizontal_bilingual.mp4` |\n| `vertical_video` | `<workdir>/vertical_bilingual.mp4` |\n| `transferred_vertical_video` | `<workdir>/transferred_vertical_video.mp4` |\n| `origin_cover` | `<workdir>/origin_cover.jpg` |\n| `generated_cover` | `<workdir>/generated_cover.png` |\n| `cover_prompt` | `<workdir>/cover_prompt.final.txt` |\n\nHorizontal and vertical dubbed variants use `horizontal_dubbed.mp4` and `vertical_dubbed.mp4`; their manifest keys remain `horizontal_video` and `vertical_video`.\n\n## JSON Lines\n\nParse stdout one line at a time as JSON. The terminal response is the object containing `ok`.\n\nWhen `OPENCREATOR_KRILLINAI_CLI=1`, `subtitle` and `tts` can emit progress frames before the terminal response:\n\n```json\n{\"type\":\"progress\",\"phase\":\"translating_subtitles\",\"percent\":50,\"message\":\"正在翻译字幕\"}\n```\n\nSuccess shape:\n\n```json\n{\n  \"ok\": true,\n  \"stage\": \"subtitle\",\n  \"workdir\": \"tasks/demo\",\n  \"task_id\": \"demo\",\n  \"outputs\": {}\n}\n```\n\nFailure shape:\n\n```json\n{\n  \"ok\": false,\n  \"error\": {\n    \"kind\": \"retryable\",\n    \"code\": \"audio_transcription_failed\",\n    \"message\": \"connection timeout\",\n    \"retryable\": true\n  }\n}\n```\n\n## Exit Codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | Usage error |\n| `2` | Retryable error |\n| `3` | Dependency error |\n\nInternal errors currently also exit with code `1`, so use `error.kind` rather than the exit code alone for classification.\n\n## Error Handling\n\n- `usage`: fix flags or missing input.\n- `retryable`: retry after delay or switch provider/source.\n- `dependency`: install or expose `ffmpeg`, `ffprobe`, or `yt-dlp`.\n- `internal`: inspect logs and generated files.\n\n## Dry Run\n\n- `subtitle`, `render-horizontal`, `render-vertical`, `speech`, and `pipeline` validate without writing a task manifest.\n- `tts` and `cover` dry-runs apply default outputs and write `krillinai_manifest.json`, but do not produce media.\n- `voices --dry-run` returns the same local voice list without an external provider call; use `aliyun`, `openai`, or `minimax`.\n\n## Command-Shape Verification\n\nThis check does not need provider credentials or media dependencies:\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle local:demo.mp4 \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --dry-run)\n```\n\nFor rendered media, inspect the output file and optionally extract preview frames with `ffmpeg`.\n","isInternal":false,"tokens":1396,"sizeBytes":5327},{"name":"SKILL.md","path":"skills/krillinai-cli/SKILL.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-cli/SKILL.md","title":"krillinai-cli","category":"anthropic-skill","format":"markdown","content":"---\nname: krillinai-cli\ndescription: Use when an agent needs to build or operate the embedded KrillinAI CLI, choose a supported command, or interpret its JSON, manifest, subtitle, dubbing, render, cover, speech, and voice outputs.\n---\n\n# KrillinAI CLI\n\nUse this as the top-level routing skill for KrillinAI command-line work.\n\n## Build And Locate The Binary\n\nBuild both KrillinAI binaries through the repository script:\n\n```bash\npnpm krillinai:build\n```\n\nFor the current machine, locate the CLI without assuming a platform or architecture:\n\n```bash\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$PWD/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\ntest -f \"$KRILLINAI_CLI\"\n```\n\nThe CLI loads `config/config.toml` relative to its process working directory. For real runs from a source checkout, use `runtime/krillinai` as the process working directory and create its ignored `config/config.toml` from `config/config-example.toml` without overwriting an existing file. A release archive should be run from its unpacked package root.\n\nFor build layout, configuration, JSON, manifest, output, and error details, read:\n\n```text\nskills/krillinai-cli/references/cli-contract.md\n```\n\n## Choose The Command\n\n| User intent | Command / skill |\n|---|---|\n| Generate source, target, bilingual, and short vertical subtitles | `subtitle`; use `krillinai-subtitle` |\n| Generate target-language dubbing from subtitles | `tts`; use `krillinai-tts` |\n| Create landscape videos | `render-horizontal`; use `krillinai-render-horizontal` |\n| Create portrait/short-form videos | `render-vertical`; use `krillinai-render-vertical` |\n| Generate a cover from a complete image prompt | `cover`; use `krillinai-cover` |\n| Generate speech from plain text | `speech` |\n| List provider voice codes for Aliyun, OpenAI, or MiniMax | `voices` |\n| Validate a requested multi-stage output plan | `pipeline --dry-run`; use `krillinai-pipeline` |\n\n`pipeline` only validates plans in dry-run mode; non-dry-run execution returns `unsupported_command`. `status` is reserved and unsupported.\n\n## Operating Rules For Agents\n\n- Use a dedicated `--workdir`; do not scatter outputs in the repo root.\n- Use `--dry-run` for command-shape validation before external calls.\n- Parse stdout as JSON lines. The terminal response is the object containing `ok`; OpenCreator mode may emit progress frames first.\n- Treat `krillinai_manifest.json` and actual output files as the source of truth after a real stage.\n- Reuse manifest outputs for later stages instead of guessing filenames.\n- If a command fails, classify by `error.kind`: `usage`, `retryable`, `dependency`, or `internal`.\n- Avoid rerunning expensive stages if the manifest already has valid upstream outputs.\n- Do not claim that `cover` consumed a reference image: the current CLI accepts a complete text prompt and size only.\n- Do not request an Edge TTS voice catalog: `voices` currently supports `aliyun`, `openai`, and `minimax`.\n\n## Minimal Workflow\n\n```bash\nREPO_ROOT=\"$PWD\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\nmkdir -p \"$WORKDIR\"\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" subtitle \\\n  \"https://www.youtube.com/watch?v=VIDEO_ID\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\")\n```\n","frontmatter":{"name":"krillinai-cli","description":"Use when an agent needs to build or operate the embedded KrillinAI CLI, choose a supported command, or interpret its JSON, manifest, subtitle, dubbing, render, cover, speech, and voice outputs."},"isInternal":false,"tokens":846,"sizeBytes":3474},{"name":"SKILL.md","path":"skills/krillinai-cover/SKILL.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-cover/SKILL.md","title":"krillinai-cover","category":"anthropic-skill","format":"markdown","content":"---\nname: krillinai-cover\ndescription: Use when generating a cover image with the KrillinAI CLI from a complete image prompt, including validating image-provider configuration and inspecting the generated image and saved prompt.\n---\n\n# KrillinAI Cover\n\nUse this skill for the implemented `cover` command. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" cover \\\n  --workdir \"$WORKDIR\" \\\n  --prompt \"$COVER_PROMPT\" \\\n  --size 1536x1024)\n```\n\nThe prompt must already contain the desired title text, language, composition, visual style, and any useful source-video context. The current CLI does not expose a reference-image argument and does not automatically send `origin_cover.jpg` to the image model.\n\n## Inputs\n\n- `--workdir`: an existing or new task directory.\n- `--prompt`: required final prompt sent to the configured image model.\n- `--size`: optional image size; the default is `1024x1024`.\n- `[image]` configuration in `<execution-cwd>/config/config.toml`.\n\n## Outputs\n\n- `generated_cover.png`\n- `cover_prompt.final.txt`\n- `krillinai_manifest.json`\n\n## Dry Run\n\n`cover --dry-run` validates the command and writes a manifest, but it does not call the image model or create `generated_cover.png`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Read output paths from the terminal response or manifest.\n- Confirm `generated_cover.png` is non-empty and decodable as an image.\n- Confirm `cover_prompt.final.txt` exactly records the submitted prompt.\n- If provider configuration is missing or generation fails, report the returned error rather than treating the manifest alone as success.\n","frontmatter":{"name":"krillinai-cover","description":"Use when generating a cover image with the KrillinAI CLI from a complete image prompt, including validating image-provider configuration and inspecting the generated image and saved prompt."},"isInternal":false,"tokens":397,"sizeBytes":1763},{"name":"SKILL.md","path":"skills/krillinai-pipeline/SKILL.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-pipeline/SKILL.md","title":"krillinai-pipeline","category":"anthropic-skill","format":"markdown","content":"---\nname: krillinai-pipeline\ndescription: Use when validating or documenting a multi-stage KrillinAI CLI output plan; the current pipeline command supports dry-run planning only, not end-to-end execution.\n---\n\n# KrillinAI Pipeline\n\nUse this skill to validate a requested stage plan. Run real work through the individual stage commands because non-dry-run `pipeline` execution returns `unsupported_command`.\n\n## Plan Validation\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" pipeline \\\n  --outputs \"subtitle,tts,vertical-bilingual\" \\\n  --dry-run)\n```\n\n## Outputs Values\n\n| Output | Stage |\n|---|---|\n| `subtitle` | Generate subtitle files |\n| `tts` | Generate dubbing |\n| `horizontal-bilingual` | Render landscape bilingual video |\n| `horizontal-dubbed` | Render landscape dubbed video |\n| `vertical-bilingual` | Render portrait bilingual video |\n| `vertical-dubbed` | Render portrait dubbed video |\n| `cover` | Generate cover |\n\nThe dry-run validates output names and returns a successful pipeline-stage JSON response. It does not execute stages or write a task manifest.\n\n## Execute The Plan\n\nMap the validated outputs to `subtitle`, `tts`, `render-horizontal`, `render-vertical`, and `cover`. Run each required command independently and use the same absolute `--workdir`.\n\n## Recovery Strategy\n\n- If `subtitle` succeeds and render fails, rerun only render with the same `--workdir`.\n- If TTS fails, keep subtitle outputs and rerun `tts` after fixing provider config.\n- Read `krillinai_manifest.json` before rerunning to avoid repeating expensive work.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true` for dry-run validation.\n- For real work, confirm every independently executed stage succeeded.\n- Confirm manifest stages and requested output files, not just the plan response.\n- Inspect final requested media/cover files, not only intermediate outputs.\n- For shared CLI details, read `skills/krillinai-cli/references/cli-contract.md`.\n","frontmatter":{"name":"krillinai-pipeline","description":"Use when validating or documenting a multi-stage KrillinAI CLI output plan; the current pipeline command supports dry-run planning only, not end-to-end execution."},"isInternal":false,"tokens":434,"sizeBytes":1952},{"name":"SKILL.md","path":"skills/krillinai-render-horizontal/SKILL.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-render-horizontal/SKILL.md","title":"krillinai-render-horizontal","category":"anthropic-skill","format":"markdown","content":"---\nname: krillinai-render-horizontal\ndescription: Use when rendering landscape videos with KrillinAI CLI, including original video plus bilingual subtitles or dubbed video plus target-language subtitles.\n---\n\n# KrillinAI Render Horizontal\n\nUse this skill for `render-horizontal`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/bilingual_srt.srt\")\n```\n\n## Dubbed Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed)\n```\n\n## Inputs\n\n- `--video`: source video, or omit when manifest has the correct input.\n- `--audio`: optional replacement audio.\n- `--subtitle`: usually `bilingual_srt.srt` for bilingual, `target_language_srt.srt` for dubbed.\n- `--workdir`: directory containing `krillinai_manifest.json`.\n- `--subtitle-style-file`: optional JSON override merged with the default subtitle style.\n\n## Outputs\n\n- `horizontal_bilingual.mp4` for the default variant.\n- `horizontal_dubbed.mp4` with `--dubbed`.\n- Both variants are reported through the manifest key `horizontal_video`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm output video exists and has video/audio streams.\n- Extract a preview frame when checking subtitle placement.\n- For manifest and error handling, read `skills/krillinai-cli/references/cli-contract.md`.\n","frontmatter":{"name":"krillinai-render-horizontal","description":"Use when rendering landscape videos with KrillinAI CLI, including original video plus bilingual subtitles or dubbed video plus target-language subtitles."},"isInternal":false,"tokens":412,"sizeBytes":1687},{"name":"SKILL.md","path":"skills/krillinai-render-vertical/SKILL.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-render-vertical/SKILL.md","title":"krillinai-render-vertical","category":"anthropic-skill","format":"markdown","content":"---\nname: krillinai-render-vertical\ndescription: Use when rendering portrait videos with KrillinAI CLI, including converting source video to vertical format, adding short bilingual subtitles, rendering dubbed vertical videos, and checking vertical subtitle readability.\n---\n\n# KrillinAI Render Vertical\n\nUse this skill for `render-vertical`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Short-Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/short_origin_mixed_srt.srt\" \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Dubbed Vertical Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Subtitle Behavior\n\nThe Go renderer follows the good behavior from `vertical_srt.py`:\n\n- Chinese uses word segmentation before line decisions.\n- Display width is used for line splitting: Chinese counts as width 2, other text as width 1.\n- Long Chinese subtitles are split across time into multiple `Dialogue` entries instead of stacked with `\\N`.\n- The goal is to keep the screen to one English line plus one Chinese line when possible.\n\n## Outputs\n\n- `transferred_vertical_video.mp4`: source converted to portrait format.\n- `vertical_bilingual.mp4`: default final vertical video.\n- `vertical_dubbed.mp4`: final video with `--dubbed`.\n- Final variants are reported through the manifest key `vertical_video`.\n\n## Verification\n\nUse text and visual checks:\n\n```bash\nrg -n -F '\\\\N' \"$WORKDIR/formatted_vertical_bilingual.ass\"\nffmpeg -y -ss 00:00:01 -i \"$WORKDIR/vertical_bilingual.mp4\" \\\n  -frames:v 1 \"$WORKDIR/vertical_preview_%03d.jpg\"\n```\n\nAlso require terminal JSON with `\"ok\": true`, valid video/audio streams, readable subtitles, and non-garbled titles.\n","frontmatter":{"name":"krillinai-render-vertical","description":"Use when rendering portrait videos with KrillinAI CLI, including converting source video to vertical format, adding short bilingual subtitles, rendering dubbed vertical videos, and checking vertical subtitle readability."},"isInternal":false,"tokens":529,"sizeBytes":2122},{"name":"SKILL.md","path":"skills/krillinai-subtitle/SKILL.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-subtitle/SKILL.md","title":"krillinai-subtitle","category":"anthropic-skill","format":"markdown","content":"---\nname: krillinai-subtitle\ndescription: Use when generating subtitles with KrillinAI CLI from a YouTube link, Bilibili/local video, or existing media, including platform caption download, Whisper fallback, translation, bilingual SRT, and short vertical subtitle output.\n---\n\n# KrillinAI Subtitle\n\nUse this skill for the `subtitle` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle \"<input>\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n```\n\n## Inputs\n\n- YouTube URL: prefer `--caption-source any`; platform captions are used first, then Whisper fallback.\n- Local file: use `local:/abs/path/video.mp4` or a path accepted by the CLI.\n- Bilibili or other yt-dlp supported links: use when media download works; platform caption behavior may differ, so expect transcription fallback.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--origin-lang` | Source language, such as `en`, `zh`, `ja` |\n| `--target-lang` | Target language, such as `zh_cn` |\n| `--workdir` | Dedicated task directory |\n| `--caption-source any` | Prefer platform captions, fallback to transcription |\n| `--caption-source whisper` | Force transcription |\n| `--prepare-video` | Require the original video for later render stages |\n| `--bilingual-top=true` | Put target language on top in bilingual SRT |\n| `--subtitle-style-file` | Merge a JSON subtitle-style override |\n| `--dry-run` | Validate without downloads or AI calls |\n\n## Outputs\n\nAfter a real run, read paths from `krillinai_manifest.json`. Main files:\n\n- `origin_language_srt.srt`\n- `target_language_srt.srt`\n- `bilingual_srt.srt`\n- `short_origin_mixed_srt.srt`\n- `origin_video.mp4` when media preparation produced or required video\n- `origin_audio.mp3` when transcription preparation produced audio\n\n`subtitle --dry-run` validates command shape but does not write a manifest or output files.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `krillinai_manifest.json` exists under `--workdir`.\n- Spot-check `bilingual_srt.srt` ordering and `short_origin_mixed_srt.srt` readability.\n- When `--prepare-video` was requested, require a non-empty `origin_video` output.\n- For Agent integration details, read `skills/krillinai-cli/references/cli-contract.md`.\n","frontmatter":{"name":"krillinai-subtitle","description":"Use when generating subtitles with KrillinAI CLI from a YouTube link, Bilibili/local video, or existing media, including platform caption download, Whisper fallback, translation, bilingual SRT, and short vertical subtitle output."},"isInternal":false,"tokens":597,"sizeBytes":2449},{"name":"SKILL.md","path":"skills/krillinai-tts/SKILL.md","rawUrl":"https://raw.githubusercontent.com/krillinai/KrillinAI/HEAD/skills/krillinai-tts/SKILL.md","title":"krillinai-tts","category":"anthropic-skill","format":"markdown","content":"---\nname: krillinai-tts\ndescription: Use when generating target-language dubbing with KrillinAI CLI from SRT subtitles, including TTS audio creation and optional dubbed video generation.\n---\n\n# KrillinAI TTS\n\nUse this skill for the `tts` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" tts \\\n  --workdir \"$WORKDIR\" \\\n  --input-srt \"$WORKDIR/target_language_srt.srt\" \\\n  --line-mode target-only \\\n  --video \"$WORKDIR/origin_video.mp4\")\n```\n\n## Inputs\n\n- `--input-srt` is required. Usually use `target_language_srt.srt`.\n- `--video` is optional but needed when generating `video_with_tts.mp4`.\n- TTS provider must be configured in `<execution-cwd>/config/config.toml`.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--input-srt` | SRT to synthesize |\n| `--line-mode target-only` | Use target-language lines only |\n| `--line-mode bilingual-target-top` | Bilingual mode with target on top |\n| `--line-mode bilingual-target-bottom` | Bilingual mode with target on bottom |\n| `--voice` | Provider-specific voice |\n| `--voice-clone-source` | Voice clone source audio URL/path when supported |\n| `--dry-run` | Validate command shape |\n\n## Outputs\n\nRead paths from manifest:\n\n- `tts_final_audio.wav`\n- `video_with_tts.mp4` when a video input is available\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `tts_final_audio.wav` exists and has non-zero size.\n- If `video_with_tts.mp4` is produced, inspect duration and audio stream with `ffprobe`.\n- For JSON/error contract, read `skills/krillinai-cli/references/cli-contract.md`.\n","frontmatter":{"name":"krillinai-tts","description":"Use when generating target-language dubbing with KrillinAI CLI from SRT subtitles, including TTS audio creation and optional dubbed video generation."},"isInternal":false,"tokens":442,"sizeBytes":1709}],"systemPromptSnippet":"<yakaai_skills repo=\"krillinai/KrillinAI\">\n<!-- File: skills/krillinai-cli/references/cli-contract.md (Tokens: ~1396 | Category: anthropic-skill) -->\n# KrillinAI CLI Contract\n\n## Build And Binary\n\nUse the repository build script from the OpenCreator root:\n\n```bash\npnpm krillinai:build\n```\n\nIt builds `runtime/krillinai/cmd/cli` and `runtime/krillinai/cmd/server`. Native binaries and a manifest are written under:\n\n```text\n.runtime/build/krillinai/<platform>-<arch>/\n├── bin/krillinai-cli[.exe]\n├── bin/krillinai-server[.exe]\n└── manifest.json\n```\n\nSet reusable absolute paths from the repository root:\n\n```bash\nREPO_ROOT=\"$PWD\"\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$REPO_ROOT/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\nKRILLINAI_CWD=\"$REPO_ROOT/runtime/krillinai\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\ntest -f \"$KRILLINAI_CLI\"\nmkdir -p \"$WORKDIR\"\n```\n\n## Execution Working Directory\n\nThe CLI loads `config/config.toml` relative to the process working directory.\n\n- Source checkout: run real commands with `runtime/krillinai` as the working directory. Create the ignored `runtime/krillinai/config/config.toml` from `config-example.toml` and configure only the providers needed by the requested stage.\n- Release archive: run from the unpacked package root after creating `config/config.toml` from `config/config-example.toml`.\n- OpenCreator: the Daemon prepares an isolated launcher directory and configuration automatically; do not replace that flow with a source-tree config.\n\nUse absolute `--workdir`, input, subtitle, audio, and output paths when changing the process working directory.\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `subtitle` | Generate source-language, target-language, bilingual, and short vertical subtitles |\n| `tts` | Generate TTS audio and optional dubbed video |\n| `speech` | Generate one audio file from text or a UTF-8 text file |\n| `render-horizontal` | Render landscape subtitle/dubbed videos |\n| `render-vertical` | Render portrait subtitle/dubbed videos |\n| `cover` | Generate a cover image from a complete text prompt |\n| `voices` | List voice codes for `aliyun`, `openai`, or `minimax`; Edge TTS has no CLI voice catalog |\n| `pipeline` | Validate output plans with `--dry-run`; non-dry-run execution is unsupported |\n| `status` | Reserved and unsupported |\n\n## Manifest\n\nEvery working directory should contain:\n\n```text\nkrillinai_manifest.json\n```\n\nRead this file to locate stage outputs. Important default paths:\n\n| Output key | Default path |\n|---|---|\n| `origin_video` | `<workdir>/origin_video.mp4` |\n| `origin_audio` | `<workdir>/origin_audio.mp3` |\n| `origin_srt` | `<workdir>/origin_language_srt.srt` |\n| `target_srt` | `<workdir>/target_language_srt.srt` |\n| `bilingual_srt` | `<workdir>/bilingual_srt.srt` |\n| `short_origin_mixed_srt` | `<workdir>/short_origin_mixed_srt.srt` |\n| `tts_audio` | `<workdir>/tts_final_audio.wav` |\n| `video_with_tts` | `<workdir>/video_with_tts.mp4` |\n| `horizontal_video` | `<workdir>/horizontal_bilingual.mp4` |\n| `vertical_video` | `<workdir>/vertical_bilingual.mp4` |\n| `transferred_vertical_video` | `<workdir>/transferred_vertical_video.mp4` |\n| `origin_cover` | `<workdir>/origin_cover.jpg` |\n| `generated_cover` | `<workdir>/generated_cover.png` |\n| `cover_prompt` | `<workdir>/cover_prompt.final.txt` |\n\nHorizontal and vertical dubbed variants use `horizontal_dubbed.mp4` and `vertical_dubbed.mp4`; their manifest keys remain `horizontal_video` and `vertical_video`.\n\n## JSON Lines\n\nParse stdout one line at a time as JSON. The terminal response is the object containing `ok`.\n\nWhen `OPENCREATOR_KRILLINAI_CLI=1`, `subtitle` and `tts` can emit progress frames before the terminal response:\n\n```json\n{\"type\":\"progress\",\"phase\":\"translating_subtitles\",\"percent\":50,\"message\":\"正在翻译字幕\"}\n```\n\nSuccess shape:\n\n```json\n{\n  \"ok\": true,\n  \"stage\": \"subtitle\",\n  \"workdir\": \"tasks/demo\",\n  \"task_id\": \"demo\",\n  \"outputs\": {}\n}\n```\n\nFailure shape:\n\n```json\n{\n  \"ok\": false,\n  \"error\": {\n    \"kind\": \"retryable\",\n    \"code\": \"audio_transcription_failed\",\n    \"message\": \"connection timeout\",\n    \"retryable\": true\n  }\n}\n```\n\n## Exit Codes\n\n| Code | Meaning |\n|---|---|\n| `0` | Success |\n| `1` | Usage error |\n| `2` | Retryable error |\n| `3` | Dependency error |\n\nInternal errors currently also exit with code `1`, so use `error.kind` rather than the exit code alone for classification.\n\n## Error Handling\n\n- `usage`: fix flags or missing input.\n- `retryable`: retry after delay or switch provider/source.\n- `dependency`: install or expose `ffmpeg`, `ffprobe`, or `yt-dlp`.\n- `internal`: inspect logs and generated files.\n\n## Dry Run\n\n- `subtitle`, `render-horizontal`, `render-vertical`, `speech`, and `pipeline` validate without writing a task manifest.\n- `tts` and `cover` dry-runs apply default outputs and write `krillinai_manifest.json`, but do not produce media.\n- `voices --dry-run` returns the same local voice list without an external provider call; use `aliyun`, `openai`, or `minimax`.\n\n## Command-Shape Verification\n\nThis check does not need provider credentials or media dependencies:\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle local:demo.mp4 \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --dry-run)\n```\n\nFor rendered media, inspect the output file and optionally extract preview frames with `ffmpeg`.\n\n<!-- File: skills/krillinai-cli/SKILL.md (Tokens: ~846 | Category: anthropic-skill) -->\n---\nname: krillinai-cli\ndescription: Use when an agent needs to build or operate the embedded KrillinAI CLI, choose a supported command, or interpret its JSON, manifest, subtitle, dubbing, render, cover, speech, and voice outputs.\n---\n\n# KrillinAI CLI\n\nUse this as the top-level routing skill for KrillinAI command-line work.\n\n## Build And Locate The Binary\n\nBuild both KrillinAI binaries through the repository script:\n\n```bash\npnpm krillinai:build\n```\n\nFor the current machine, locate the CLI without assuming a platform or architecture:\n\n```bash\nTARGET=\"$(node -p \"process.platform + '-' + process.arch\")\"\nSUFFIX=\"$(node -p \"process.platform === 'win32' ? '.exe' : ''\")\"\nKRILLINAI_CLI=\"$PWD/.runtime/build/krillinai/$TARGET/bin/krillinai-cli$SUFFIX\"\ntest -f \"$KRILLINAI_CLI\"\n```\n\nThe CLI loads `config/config.toml` relative to its process working directory. For real runs from a source checkout, use `runtime/krillinai` as the process working directory and create its ignored `config/config.toml` from `config/config-example.toml` without overwriting an existing file. A release archive should be run from its unpacked package root.\n\nFor build layout, configuration, JSON, manifest, output, and error details, read:\n\n```text\nskills/krillinai-cli/references/cli-contract.md\n```\n\n## Choose The Command\n\n| User intent | Command / skill |\n|---|---|\n| Generate source, target, bilingual, and short vertical subtitles | `subtitle`; use `krillinai-subtitle` |\n| Generate target-language dubbing from subtitles | `tts`; use `krillinai-tts` |\n| Create landscape videos | `render-horizontal`; use `krillinai-render-horizontal` |\n| Create portrait/short-form videos | `render-vertical`; use `krillinai-render-vertical` |\n| Generate a cover from a complete image prompt | `cover`; use `krillinai-cover` |\n| Generate speech from plain text | `speech` |\n| List provider voice codes for Aliyun, OpenAI, or MiniMax | `voices` |\n| Validate a requested multi-stage output plan | `pipeline --dry-run`; use `krillinai-pipeline` |\n\n`pipeline` only validates plans in dry-run mode; non-dry-run execution returns `unsupported_command`. `status` is reserved and unsupported.\n\n## Operating Rules For Agents\n\n- Use a dedicated `--workdir`; do not scatter outputs in the repo root.\n- Use `--dry-run` for command-shape validation before external calls.\n- Parse stdout as JSON lines. The terminal response is the object containing `ok`; OpenCreator mode may emit progress frames first.\n- Treat `krillinai_manifest.json` and actual output files as the source of truth after a real stage.\n- Reuse manifest outputs for later stages instead of guessing filenames.\n- If a command fails, classify by `error.kind`: `usage`, `retryable`, `dependency`, or `internal`.\n- Avoid rerunning expensive stages if the manifest already has valid upstream outputs.\n- Do not claim that `cover` consumed a reference image: the current CLI accepts a complete text prompt and size only.\n- Do not request an Edge TTS voice catalog: `voices` currently supports `aliyun`, `openai`, and `minimax`.\n\n## Minimal Workflow\n\n```bash\nREPO_ROOT=\"$PWD\"\nWORKDIR=\"$REPO_ROOT/tasks/demo\"\nmkdir -p \"$WORKDIR\"\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" subtitle \\\n  \"https://www.youtube.com/watch?v=VIDEO_ID\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n\n(cd \"$REPO_ROOT/runtime/krillinai\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\")\n```\n\n<!-- File: skills/krillinai-cover/SKILL.md (Tokens: ~397 | Category: anthropic-skill) -->\n---\nname: krillinai-cover\ndescription: Use when generating a cover image with the KrillinAI CLI from a complete image prompt, including validating image-provider configuration and inspecting the generated image and saved prompt.\n---\n\n# KrillinAI Cover\n\nUse this skill for the implemented `cover` command. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" cover \\\n  --workdir \"$WORKDIR\" \\\n  --prompt \"$COVER_PROMPT\" \\\n  --size 1536x1024)\n```\n\nThe prompt must already contain the desired title text, language, composition, visual style, and any useful source-video context. The current CLI does not expose a reference-image argument and does not automatically send `origin_cover.jpg` to the image model.\n\n## Inputs\n\n- `--workdir`: an existing or new task directory.\n- `--prompt`: required final prompt sent to the configured image model.\n- `--size`: optional image size; the default is `1024x1024`.\n- `[image]` configuration in `<execution-cwd>/config/config.toml`.\n\n## Outputs\n\n- `generated_cover.png`\n- `cover_prompt.final.txt`\n- `krillinai_manifest.json`\n\n## Dry Run\n\n`cover --dry-run` validates the command and writes a manifest, but it does not call the image model or create `generated_cover.png`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Read output paths from the terminal response or manifest.\n- Confirm `generated_cover.png` is non-empty and decodable as an image.\n- Confirm `cover_prompt.final.txt` exactly records the submitted prompt.\n- If provider configuration is missing or generation fails, report the returned error rather than treating the manifest alone as success.\n\n<!-- File: skills/krillinai-pipeline/SKILL.md (Tokens: ~434 | Category: anthropic-skill) -->\n---\nname: krillinai-pipeline\ndescription: Use when validating or documenting a multi-stage KrillinAI CLI output plan; the current pipeline command supports dry-run planning only, not end-to-end execution.\n---\n\n# KrillinAI Pipeline\n\nUse this skill to validate a requested stage plan. Run real work through the individual stage commands because non-dry-run `pipeline` execution returns `unsupported_command`.\n\n## Plan Validation\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" pipeline \\\n  --outputs \"subtitle,tts,vertical-bilingual\" \\\n  --dry-run)\n```\n\n## Outputs Values\n\n| Output | Stage |\n|---|---|\n| `subtitle` | Generate subtitle files |\n| `tts` | Generate dubbing |\n| `horizontal-bilingual` | Render landscape bilingual video |\n| `horizontal-dubbed` | Render landscape dubbed video |\n| `vertical-bilingual` | Render portrait bilingual video |\n| `vertical-dubbed` | Render portrait dubbed video |\n| `cover` | Generate cover |\n\nThe dry-run validates output names and returns a successful pipeline-stage JSON response. It does not execute stages or write a task manifest.\n\n## Execute The Plan\n\nMap the validated outputs to `subtitle`, `tts`, `render-horizontal`, `render-vertical`, and `cover`. Run each required command independently and use the same absolute `--workdir`.\n\n## Recovery Strategy\n\n- If `subtitle` succeeds and render fails, rerun only render with the same `--workdir`.\n- If TTS fails, keep subtitle outputs and rerun `tts` after fixing provider config.\n- Read `krillinai_manifest.json` before rerunning to avoid repeating expensive work.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true` for dry-run validation.\n- For real work, confirm every independently executed stage succeeded.\n- Confirm manifest stages and requested output files, not just the plan response.\n- Inspect final requested media/cover files, not only intermediate outputs.\n- For shared CLI details, read `skills/krillinai-cli/references/cli-contract.md`.\n\n<!-- File: skills/krillinai-render-horizontal/SKILL.md (Tokens: ~412 | Category: anthropic-skill) -->\n---\nname: krillinai-render-horizontal\ndescription: Use when rendering landscape videos with KrillinAI CLI, including original video plus bilingual subtitles or dubbed video plus target-language subtitles.\n---\n\n# KrillinAI Render Horizontal\n\nUse this skill for `render-horizontal`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/bilingual_srt.srt\")\n```\n\n## Dubbed Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-horizontal \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed)\n```\n\n## Inputs\n\n- `--video`: source video, or omit when manifest has the correct input.\n- `--audio`: optional replacement audio.\n- `--subtitle`: usually `bilingual_srt.srt` for bilingual, `target_language_srt.srt` for dubbed.\n- `--workdir`: directory containing `krillinai_manifest.json`.\n- `--subtitle-style-file`: optional JSON override merged with the default subtitle style.\n\n## Outputs\n\n- `horizontal_bilingual.mp4` for the default variant.\n- `horizontal_dubbed.mp4` with `--dubbed`.\n- Both variants are reported through the manifest key `horizontal_video`.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm output video exists and has video/audio streams.\n- Extract a preview frame when checking subtitle placement.\n- For manifest and error handling, read `skills/krillinai-cli/references/cli-contract.md`.\n\n<!-- File: skills/krillinai-render-vertical/SKILL.md (Tokens: ~529 | Category: anthropic-skill) -->\n---\nname: krillinai-render-vertical\ndescription: Use when rendering portrait videos with KrillinAI CLI, including converting source video to vertical format, adding short bilingual subtitles, rendering dubbed vertical videos, and checking vertical subtitle readability.\n---\n\n# KrillinAI Render Vertical\n\nUse this skill for `render-vertical`. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Bilingual Short-Subtitle Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/origin_video.mp4\" \\\n  --subtitle \"$WORKDIR/short_origin_mixed_srt.srt\" \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Dubbed Vertical Video\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" render-vertical \\\n  --workdir \"$WORKDIR\" \\\n  --video \"$WORKDIR/video_with_tts.mp4\" \\\n  --subtitle \"$WORKDIR/target_language_srt.srt\" \\\n  --dubbed \\\n  --major-title \"今日话题\" \\\n  --minor-title \"AI Video\")\n```\n\n## Subtitle Behavior\n\nThe Go renderer follows the good behavior from `vertical_srt.py`:\n\n- Chinese uses word segmentation before line decisions.\n- Display width is used for line splitting: Chinese counts as width 2, other text as width 1.\n- Long Chinese subtitles are split across time into multiple `Dialogue` entries instead of stacked with `\\N`.\n- The goal is to keep the screen to one English line plus one Chinese line when possible.\n\n## Outputs\n\n- `transferred_vertical_video.mp4`: source converted to portrait format.\n- `vertical_bilingual.mp4`: default final vertical video.\n- `vertical_dubbed.mp4`: final video with `--dubbed`.\n- Final variants are reported through the manifest key `vertical_video`.\n\n## Verification\n\nUse text and visual checks:\n\n```bash\nrg -n -F '\\\\N' \"$WORKDIR/formatted_vertical_bilingual.ass\"\nffmpeg -y -ss 00:00:01 -i \"$WORKDIR/vertical_bilingual.mp4\" \\\n  -frames:v 1 \"$WORKDIR/vertical_preview_%03d.jpg\"\n```\n\nAlso require terminal JSON with `\"ok\": true`, valid video/audio streams, readable subtitles, and non-garbled titles.\n\n<!-- File: skills/krillinai-subtitle/SKILL.md (Tokens: ~597 | Category: anthropic-skill) -->\n---\nname: krillinai-subtitle\ndescription: Use when generating subtitles with KrillinAI CLI from a YouTube link, Bilibili/local video, or existing media, including platform caption download, Whisper fallback, translation, bilingual SRT, and short vertical subtitle output.\n---\n\n# KrillinAI Subtitle\n\nUse this skill for the `subtitle` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" subtitle \"<input>\" \\\n  --origin-lang en \\\n  --target-lang zh_cn \\\n  --workdir \"$WORKDIR\" \\\n  --caption-source any \\\n  --prepare-video)\n```\n\n## Inputs\n\n- YouTube URL: prefer `--caption-source any`; platform captions are used first, then Whisper fallback.\n- Local file: use `local:/abs/path/video.mp4` or a path accepted by the CLI.\n- Bilibili or other yt-dlp supported links: use when media download works; platform caption behavior may differ, so expect transcription fallback.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--origin-lang` | Source language, such as `en`, `zh`, `ja` |\n| `--target-lang` | Target language, such as `zh_cn` |\n| `--workdir` | Dedicated task directory |\n| `--caption-source any` | Prefer platform captions, fallback to transcription |\n| `--caption-source whisper` | Force transcription |\n| `--prepare-video` | Require the original video for later render stages |\n| `--bilingual-top=true` | Put target language on top in bilingual SRT |\n| `--subtitle-style-file` | Merge a JSON subtitle-style override |\n| `--dry-run` | Validate without downloads or AI calls |\n\n## Outputs\n\nAfter a real run, read paths from `krillinai_manifest.json`. Main files:\n\n- `origin_language_srt.srt`\n- `target_language_srt.srt`\n- `bilingual_srt.srt`\n- `short_origin_mixed_srt.srt`\n- `origin_video.mp4` when media preparation produced or required video\n- `origin_audio.mp3` when transcription preparation produced audio\n\n`subtitle --dry-run` validates command shape but does not write a manifest or output files.\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `krillinai_manifest.json` exists under `--workdir`.\n- Spot-check `bilingual_srt.srt` ordering and `short_origin_mixed_srt.srt` readability.\n- When `--prepare-video` was requested, require a non-empty `origin_video` output.\n- For Agent integration details, read `skills/krillinai-cli/references/cli-contract.md`.\n\n<!-- File: skills/krillinai-tts/SKILL.md (Tokens: ~442 | Category: anthropic-skill) -->\n---\nname: krillinai-tts\ndescription: Use when generating target-language dubbing with KrillinAI CLI from SRT subtitles, including TTS audio creation and optional dubbed video generation.\n---\n\n# KrillinAI TTS\n\nUse this skill for the `tts` stage. Read `skills/krillinai-cli/references/cli-contract.md` first for binary location, execution working directory, configuration, and JSON behavior.\n\n## Command\n\n```bash\n(cd \"$KRILLINAI_CWD\" && \"$KRILLINAI_CLI\" tts \\\n  --workdir \"$WORKDIR\" \\\n  --input-srt \"$WORKDIR/target_language_srt.srt\" \\\n  --line-mode target-only \\\n  --video \"$WORKDIR/origin_video.mp4\")\n```\n\n## Inputs\n\n- `--input-srt` is required. Usually use `target_language_srt.srt`.\n- `--video` is optional but needed when generating `video_with_tts.mp4`.\n- TTS provider must be configured in `<execution-cwd>/config/config.toml`.\n\n## Important Flags\n\n| Flag | Use |\n|---|---|\n| `--input-srt` | SRT to synthesize |\n| `--line-mode target-only` | Use target-language lines only |\n| `--line-mode bilingual-target-top` | Bilingual mode with target on top |\n| `--line-mode bilingual-target-bottom` | Bilingual mode with target on bottom |\n| `--voice` | Provider-specific voice |\n| `--voice-clone-source` | Voice clone source audio URL/path when supported |\n| `--dry-run` | Validate command shape |\n\n## Outputs\n\nRead paths from manifest:\n\n- `tts_final_audio.wav`\n- `video_with_tts.mp4` when a video input is available\n\n## Verification\n\n- Require terminal JSON with `\"ok\": true`.\n- Confirm `tts_final_audio.wav` exists and has non-zero size.\n- If `video_with_tts.mp4` is produced, inspect duration and audio stream with `ffprobe`.\n- For JSON/error contract, read `skills/krillinai-cli/references/cli-contract.md`.\n</yakaai_skills>"}