qiaomu-cut
Verified把一句话需求转成可复现、可验收视频工程的乔木智能剪辑导演。Use when the user asks to create, plan, edit, remix, explain, narrate, subtitle, animate, composite, or render a video—including one-line requests such as “制作一个科普视频:介绍 LLM 中的 RL”. Builds English-learning movie mixes, person profiles, explainers, code-drawn motion graphics (UI morph loops, showreels, kinetic-type promos, line-art/pixel/Three.js animation, lyric MVs), product launch videos, cinematic shorts, social clips, course/PPT videos, AI image/video/TTS/music-assisted stories, stock-footage stories, or multi-source montage. Routes across 33台词, ClipSeek/open media, local files, ListenHub, image generation, HTML/SVG/Canvas motion graphics with beat-grid storyboards and determinism probes, Manim, ffmpeg-full, captions, sound design, frame-0 video covers with YouTube thumbnails, and release checks.
scripts/adapters/33tc_cli.js
View on GitHub#!/usr/bin/env node
'use strict';
// Public boundary: qiaomu-cut delegates to an independently installed 33tc
// adapter. It intentionally does not redistribute 33TaiCi's private protocol,
// signing, token, or media-URL implementation.
const fs = require('fs');
const path = require('path');
const { spawnSync } = require('child_process');
const { minimalEnvironment, sanitizeOutput } = require('./listenhub');
function executable(file) {
if (!file) return null;
try {
fs.accessSync(file, fs.constants.X_OK);
return path.resolve(file);
} catch {
return null;
}
}
function commandPath(command) {
const result = spawnSync('which', [command], { encoding: 'utf8' });
if (result.status !== 0 || !result.stdout.trim()) return null;
return executable(result.stdout.trim());
}
function resolveAdapter() {
const explicit = executable(process.env.QIAOMU_33TC_CLI);
const discovered = commandPath('33tc');
const current = path.resolve(__filename);
return [explicit, discovered].find((candidate) => candidate && candidate !== current) || null;
}
function preferredFfmpeg() {
const explicit = executable(process.env.QIAOMU_FFMPEG);
const preferred = executable('/opt/homebrew/opt/ffmpeg-full/bin/ffmpeg');
const discovered = commandPath('ffmpeg');
return explicit || preferred || discovered || null;
}
function adapterEnvironment(command) {
const environment = minimalEnvironment();
if (!['pick', 'cut', 'download'].includes(command) || process.env.QIAOMU_33TC_FFMPEG_RETRY === 'off') {
return environment;
}
const shim = path.join(__dirname, '..', 'shims', 'ffmpeg');
const ffmpeg = preferredFfmpeg();
// File sync tools (Nutstore, some zip extractors) can strip the exec bit; restore it.
if (!executable(shim)) { try { fs.chmodSync(shim, 0o755); } catch (_) {} }
if (!executable(shim) || !ffmpeg) return environment;
environment.PATH = `${path.dirname(shim)}${path.delimiter}${environment.PATH || ''}`;
environment.QIAOMU_FFMPEG = ffmpeg;
environment.QIAOMU_FFMPEG_RETRIES = String(Math.max(1, Math.min(5, Number(process.env.QIAOMU_FFMPEG_RETRIES || 5) || 5)));
return environment;
}
function createdTaskId(stdout, stderr) {
const match = `${stdout || ''}\n${stderr || ''}`.match(/Created cut task:\s*(\d+)/i);
return match ? match[1] : null;
}
const { hasPersistentCreditAuthorization, preferencePath } = require('../local_preferences');
function main(argv = process.argv.slice(2)) {
const command = String(argv[0] || '').toLowerCase();
const changesCredits = ['pick', 'cut'].includes(command);
const explicitYes = argv.includes('--yes');
const explicitNo = argv.includes('--yes=false');
const persistentAuthorization = changesCredits && !explicitYes && !explicitNo && hasPersistentCreditAuthorization('33tc');
if (changesCredits && !explicitYes && !persistentAuthorization) {
process.stderr.write(`33tc ${command} may create a remote task or consume credits. Review the selection and re-run with a bare --yes.\n`);
return 1;
}
const forwardedArgs = persistentAuthorization ? [...argv, '--yes'] : argv;
if (persistentAuthorization) {
process.stderr.write('qiaomu-cut: applied the local user persistent authorization for 33tc credits; no repeated prompt was required.\n');
}
const adapter = resolveAdapter();
if (!adapter) {
process.stderr.write(
'33tc adapter not found. Install an authorized 33tc CLI adapter, then set QIAOMU_33TC_CLI or place 33tc on PATH.\n' +
'The 33TaiCi desktop app must also be installed and logged in. qiaomu-cut does not bundle private app protocols.\n'
);
return 1;
}
const result = spawnSync(adapter, forwardedArgs, {
encoding: 'utf8',
env: adapterEnvironment(command),
maxBuffer: 64 * 1024 * 1024,
stdio: ['inherit', 'pipe', 'pipe']
});
if (result.error) {
process.stderr.write(`${result.error.message}\n`);
return 1;
}
if (result.stdout) process.stdout.write(sanitizeOutput(result.stdout, { urls: 'display' }));
if (result.stderr) process.stderr.write(sanitizeOutput(result.stderr, { urls: 'display' }));
const taskId = result.status === 0 ? null : createdTaskId(result.stdout, result.stderr);
if (taskId) {
process.stderr.write(
`qiaomu-cut recovery: remote cut task ${taskId} already exists. Do not submit another paid cut. ` +
`Retry the existing task with: qcut 33tc download ${taskId} --no-status [--output <dir>]\n`
);
}
return result.status == null ? 1 : result.status;
}
module.exports = {
adapterEnvironment,
createdTaskId,
// Re-exported for callers and smoke tests that predate scripts/local_preferences.js.
hasPersistentCreditAuthorization: () => hasPersistentCreditAuthorization('33tc'),
localPreferencePath: preferencePath,
main,
preferredFfmpeg,
resolveAdapter
};
if (require.main === module) process.exitCode = main();
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |