kasaframe 0.0.0-stage → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +148 -0
- package/README.md +92 -2
- package/app/package.json +12 -0
- package/app/server/engine.ts +533 -0
- package/app/server/main.ts +209 -0
- package/app/web/env.d.ts +2 -0
- package/app/web/icons.ts +31 -0
- package/app/web/index.html +21 -0
- package/app/web/main.ts +1195 -0
- package/app/web/style.css +463 -0
- package/bin/hooks.mjs +64 -0
- package/bin/kf.mjs +32 -0
- package/docs/AGENTS.md +286 -0
- package/music/README.md +37 -0
- package/package.json +44 -4
- package/packages/adapters/package.json +36 -0
- package/packages/adapters/src/css.ts +11 -0
- package/packages/adapters/src/gsap.ts +26 -0
- package/packages/adapters/src/index.ts +9 -0
- package/packages/adapters/src/lottie.ts +22 -0
- package/packages/adapters/src/media.ts +59 -0
- package/packages/adapters/src/page.ts +229 -0
- package/packages/adapters/src/project.ts +214 -0
- package/packages/adapters/src/react.ts +36 -0
- package/packages/adapters/src/svelte.ts +22 -0
- package/packages/adapters/src/three.ts +18 -0
- package/packages/adapters/src/vue.ts +27 -0
- package/packages/check/package.json +19 -0
- package/packages/check/src/check.ts +280 -0
- package/packages/check/src/cli.ts +70 -0
- package/packages/check/src/image.ts +146 -0
- package/packages/check/src/index.ts +9 -0
- package/packages/check/src/ocr.swift +37 -0
- package/packages/check/src/probe.ts +328 -0
- package/packages/check/src/report.ts +44 -0
- package/packages/check/src/rules/assets.ts +45 -0
- package/packages/check/src/rules/beats.ts +212 -0
- package/packages/check/src/rules/camera.ts +217 -0
- package/packages/check/src/rules/captions.ts +49 -0
- package/packages/check/src/rules/flash.ts +235 -0
- package/packages/check/src/rules/frames.ts +136 -0
- package/packages/check/src/rules/layout.ts +281 -0
- package/packages/check/src/rules/page.ts +87 -0
- package/packages/check/src/rules/runs.ts +20 -0
- package/packages/check/src/rules/text.ts +326 -0
- package/packages/check/src/scan.ts +240 -0
- package/packages/check/src/serve.ts +67 -0
- package/packages/check/src/types.ts +80 -0
- package/packages/check/src/video.ts +137 -0
- package/packages/cli/package.json +30 -0
- package/packages/cli/src/blur.ts +80 -0
- package/packages/cli/src/browser.ts +203 -0
- package/packages/cli/src/command.ts +44 -0
- package/packages/cli/src/commands/app.ts +25 -0
- package/packages/cli/src/commands/beats.ts +36 -0
- package/packages/cli/src/commands/bench.ts +123 -0
- package/packages/cli/src/commands/blender.ts +293 -0
- package/packages/cli/src/commands/check.ts +25 -0
- package/packages/cli/src/commands/direct.ts +210 -0
- package/packages/cli/src/commands/doctor.ts +30 -0
- package/packages/cli/src/commands/gen.ts +173 -0
- package/packages/cli/src/commands/look.ts +46 -0
- package/packages/cli/src/commands/lyrics.ts +157 -0
- package/packages/cli/src/commands/make.ts +1121 -0
- package/packages/cli/src/commands/music.ts +78 -0
- package/packages/cli/src/commands/narrate.ts +238 -0
- package/packages/cli/src/commands/new.ts +185 -0
- package/packages/cli/src/commands/preview.ts +43 -0
- package/packages/cli/src/commands/render.ts +250 -0
- package/packages/cli/src/commands/series.ts +110 -0
- package/packages/cli/src/commands/setup.ts +102 -0
- package/packages/cli/src/commands/sheet.ts +114 -0
- package/packages/cli/src/commands/skill.ts +43 -0
- package/packages/cli/src/commands/still.ts +40 -0
- package/packages/cli/src/commands/theme.ts +172 -0
- package/packages/cli/src/commands/transitions.ts +40 -0
- package/packages/cli/src/deps.ts +122 -0
- package/packages/cli/src/ffmpeg.ts +81 -0
- package/packages/cli/src/index.ts +8 -0
- package/packages/cli/src/kf.ts +64 -0
- package/packages/cli/src/lock.ts +72 -0
- package/packages/cli/src/mix.ts +131 -0
- package/packages/cli/src/out.ts +13 -0
- package/packages/cli/src/pool.ts +34 -0
- package/packages/cli/src/segments.ts +402 -0
- package/packages/cli/src/serve.ts +124 -0
- package/packages/clock/package.json +14 -0
- package/packages/clock/src/index.ts +25 -0
- package/packages/clock/src/install.ts +351 -0
- package/packages/clock/src/types.ts +45 -0
- package/packages/core/package.json +9 -0
- package/packages/core/src/beats.ts +283 -0
- package/packages/core/src/ease.ts +87 -0
- package/packages/core/src/frame.ts +99 -0
- package/packages/core/src/index.ts +27 -0
- package/packages/core/src/project.ts +157 -0
- package/packages/core/src/rand.ts +56 -0
- package/packages/core/src/spring.ts +52 -0
- package/packages/core/src/style.ts +100 -0
- package/packages/core/src/time.ts +88 -0
- package/packages/director/package.json +23 -0
- package/packages/director/src/assemble.ts +361 -0
- package/packages/director/src/brief.ts +122 -0
- package/packages/director/src/catalog.ts +49 -0
- package/packages/director/src/content.ts +343 -0
- package/packages/director/src/fallback.ts +58 -0
- package/packages/director/src/index.ts +13 -0
- package/packages/director/src/pattern.ts +90 -0
- package/packages/director/src/patterns/fill/cells.ts +115 -0
- package/packages/director/src/patterns/formula/stack.ts +93 -0
- package/packages/director/src/patterns/util.ts +58 -0
- package/packages/director/src/scene.ts +62 -0
- package/packages/director/src/select.ts +163 -0
- package/packages/director/src/transitions.ts +115 -0
- package/packages/gen/PROVIDERS.md +90 -0
- package/packages/gen/package.json +9 -0
- package/packages/gen/src/ask.ts +132 -0
- package/packages/gen/src/audio.ts +91 -0
- package/packages/gen/src/blender.ts +54 -0
- package/packages/gen/src/capabilities.ts +151 -0
- package/packages/gen/src/generate.ts +206 -0
- package/packages/gen/src/image/codex.ts +117 -0
- package/packages/gen/src/image/og.ts +133 -0
- package/packages/gen/src/index.ts +26 -0
- package/packages/gen/src/keys.ts +86 -0
- package/packages/gen/src/media.ts +150 -0
- package/packages/gen/src/music/elevenlabs.ts +41 -0
- package/packages/gen/src/music/index.ts +120 -0
- package/packages/gen/src/music/library.ts +73 -0
- package/packages/gen/src/music/lyria.ts +52 -0
- package/packages/gen/src/music/types.ts +28 -0
- package/packages/gen/src/plan.ts +106 -0
- package/packages/gen/src/registry.ts +54 -0
- package/packages/gen/src/seam.ts +103 -0
- package/packages/gen/src/tts/dashscope.ts +64 -0
- package/packages/gen/src/tts/elevenlabs.ts +84 -0
- package/packages/gen/src/tts/gemini.ts +73 -0
- package/packages/gen/src/tts/index.ts +241 -0
- package/packages/gen/src/tts/local.ts +42 -0
- package/packages/gen/src/tts/types.ts +44 -0
- package/packages/gen/src/types.ts +90 -0
- package/packages/gen/src/video/fal.ts +140 -0
- package/packages/gen/src/video/h3.ts +112 -0
- package/packages/gen/src/video/http.ts +44 -0
- package/packages/gen/src/video/ltx.ts +60 -0
- package/packages/gen/src/video/minimax.ts +55 -0
- package/packages/gen/src/video/veo.ts +71 -0
- package/packages/jizura/package.json +16 -0
- package/packages/jizura/src/deny.ts +73 -0
- package/packages/jizura/src/index.ts +7 -0
- package/packages/jizura/src/install.ts +269 -0
- package/packages/jizura/src/layer.ts +325 -0
- package/packages/jizura/src/lyrics.ts +81 -0
- package/packages/jizura/src/pin.ts +8 -0
- package/packages/jizura/src/vendor.ts +140 -0
- package/packages/jizura/src/vite.ts +63 -0
- package/packages/jizura/vendor/JIZURA_LICENSE.txt +21 -0
- package/packages/jizura/vendor/NOTICE +43 -0
- package/packages/jizura/vendor/engine.json +47 -0
- package/packages/jizura/vendor/fonts/BlackHanSans-Regular.woff2 +0 -0
- package/packages/jizura/vendor/fonts/DotGothic16-Regular.woff2 +0 -0
- package/packages/jizura/vendor/fonts/GowunBatang-Bold.woff2 +0 -0
- package/packages/jizura/vendor/fonts/IBMPlexMono-Medium.ttf +0 -0
- package/packages/jizura/vendor/fonts/IBMPlexMono-SemiBold.ttf +0 -0
- package/packages/jizura/vendor/fonts/NotoSansKR-VF.woff2 +0 -0
- package/packages/jizura/vendor/fonts/NotoSerifKR-VF.woff2 +0 -0
- package/packages/jizura/vendor/fonts/OFL-blackhansans.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-dotgothic16.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-gowunbatang.txt +94 -0
- package/packages/jizura/vendor/fonts/OFL-ibmplexmono.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-notosanskr.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-notoserifkr.txt +94 -0
- package/packages/jizura/vendor/fonts/fonts.json +52 -0
- package/packages/jizura/vendor/jizura_engine.js +35024 -0
- package/packages/motion/README.md +153 -0
- package/packages/motion/package.json +30 -0
- package/packages/motion/src/camera.ts +97 -0
- package/packages/motion/src/captions.ts +487 -0
- package/packages/motion/src/enter.ts +128 -0
- package/packages/motion/src/hangul.ts +129 -0
- package/packages/motion/src/impact.ts +100 -0
- package/packages/motion/src/index.ts +17 -0
- package/packages/motion/src/moves/brushWipe.ts +103 -0
- package/packages/motion/src/moves/cloneArray.ts +111 -0
- package/packages/motion/src/moves/curtains.ts +81 -0
- package/packages/motion/src/moves/dress.ts +191 -0
- package/packages/motion/src/moves/echoStack.ts +70 -0
- package/packages/motion/src/moves/fit.ts +70 -0
- package/packages/motion/src/moves/flood.ts +61 -0
- package/packages/motion/src/moves/ghostStack.ts +88 -0
- package/packages/motion/src/moves/gridFloor.ts +100 -0
- package/packages/motion/src/moves/imageSwarm.ts +113 -0
- package/packages/motion/src/moves/index.ts +38 -0
- package/packages/motion/src/moves/irisBlades.ts +113 -0
- package/packages/motion/src/moves/karaokeLine.ts +108 -0
- package/packages/motion/src/moves/ledBoard.ts +94 -0
- package/packages/motion/src/moves/liquidTab.ts +72 -0
- package/packages/motion/src/moves/markerWrite.ts +63 -0
- package/packages/motion/src/moves/menu.ts +138 -0
- package/packages/motion/src/moves/morphBox.ts +96 -0
- package/packages/motion/src/moves/neonSign.ts +78 -0
- package/packages/motion/src/moves/panelPop.ts +78 -0
- package/packages/motion/src/moves/paperTear.ts +75 -0
- package/packages/motion/src/moves/path.ts +64 -0
- package/packages/motion/src/moves/pathText.ts +107 -0
- package/packages/motion/src/moves/pointSphere.ts +109 -0
- package/packages/motion/src/moves/ransomLetters.ts +73 -0
- package/packages/motion/src/moves/shapeMorph.ts +143 -0
- package/packages/motion/src/moves/slamWords.ts +96 -0
- package/packages/motion/src/moves/sparkTrail.ts +130 -0
- package/packages/motion/src/moves/speedLines.ts +91 -0
- package/packages/motion/src/moves/splitFlap.ts +149 -0
- package/packages/motion/src/moves/stepWords.ts +128 -0
- package/packages/motion/src/moves/strikeOut.ts +98 -0
- package/packages/motion/src/moves/sunburst.ts +58 -0
- package/packages/motion/src/moves/tickerRows.ts +91 -0
- package/packages/motion/src/moves/tokenPicker.ts +115 -0
- package/packages/motion/src/moves/truchet.ts +85 -0
- package/packages/motion/src/moves/wordWall.ts +78 -0
- package/packages/motion/src/moves/worldRoll.ts +32 -0
- package/packages/motion/src/particles.ts +102 -0
- package/packages/motion/src/react/index.tsx +21 -0
- package/packages/motion/src/react/parts.tsx +431 -0
- package/packages/motion/src/react/time.tsx +97 -0
- package/packages/motion/src/text.ts +103 -0
- package/packages/motion/src/transition.ts +82 -0
- package/packages/motion/src/transition3d/cards.ts +65 -0
- package/packages/motion/src/transition3d/chain.ts +84 -0
- package/packages/motion/src/transition3d/dive.ts +181 -0
- package/packages/motion/src/transition3d/fold.ts +110 -0
- package/packages/motion/src/transition3d/gl.ts +219 -0
- package/packages/motion/src/transition3d/index.ts +235 -0
- package/packages/motion/src/transition3d/live.ts +70 -0
- package/packages/motion/src/transition3d/portal.ts +115 -0
- package/packages/motion/src/transition3d/react.tsx +29 -0
- package/packages/motion/src/transition3d/rig.ts +600 -0
- package/packages/motion/src/transition3d/shatter.ts +104 -0
- package/packages/motion/src/transition3d/space.ts +173 -0
- package/packages/motion/src/transition3d/whip.ts +78 -0
- package/packages/motion/src/transition3d/world.ts +737 -0
- package/packages/motion/src/transition3d/zoomOut.ts +114 -0
- package/packages/motion/src/transitions2d/catalog.ts +127 -0
- package/packages/motion/src/transitions2d/css.d.ts +2 -0
- package/packages/motion/src/transitions2d/cult-ui/LICENSE.md +9 -0
- package/packages/motion/src/transitions2d/cult-ui/RollingNumber.tsx +43 -0
- package/packages/motion/src/transitions2d/gl-transitions/LICENSE +25 -0
- package/packages/motion/src/transitions2d/gl-transitions/shaders.ts +1931 -0
- package/packages/motion/src/transitions2d/index.ts +2 -0
- package/packages/motion/src/transitions2d/kokonutui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/kokonutui/MatrixText.css +16 -0
- package/packages/motion/src/transitions2d/kokonutui/MatrixText.tsx +94 -0
- package/packages/motion/src/transitions2d/magicui/HyperText.css +15 -0
- package/packages/motion/src/transitions2d/magicui/HyperText.tsx +115 -0
- package/packages/motion/src/transitions2d/magicui/LICENSE.md +21 -0
- package/packages/motion/src/transitions2d/magicui/MorphingText.css +25 -0
- package/packages/motion/src/transitions2d/magicui/MorphingText.tsx +130 -0
- package/packages/motion/src/transitions2d/magicui/WordRotate.tsx +42 -0
- package/packages/motion/src/transitions2d/react.ts +13 -0
- package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.css +39 -0
- package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.tsx +32 -0
- package/packages/motion/src/transitions2d/smoothui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/smoothui/SharedAxisY.tsx +50 -0
- package/packages/motion/src/transitions2d/smoothui/TextMorph.tsx +90 -0
- package/packages/motion/src/transitions2d/smoothui/shaders.ts +223 -0
- package/packages/motion/src/transitions2d/unlumen/LICENSE +21 -0
- package/packages/motion/src/transitions2d/unlumen/ScrambleText.tsx +114 -0
- package/packages/motion/src/transitions2d/vengeance-ui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/vengeance-ui/MorphText.css +69 -0
- package/packages/motion/src/transitions2d/vengeance-ui/MorphText.tsx +45 -0
- package/packages/motion/src/type.ts +131 -0
- package/packages/motion/src/ui.ts +172 -0
- package/packages/patterns/package.json +15 -0
- package/packages/patterns/src/bars/rank.ts +119 -0
- package/packages/patterns/src/before-after/shrink.ts +127 -0
- package/packages/patterns/src/before-after/strike.ts +125 -0
- package/packages/patterns/src/code/terminal.ts +133 -0
- package/packages/patterns/src/compare/bars.ts +142 -0
- package/packages/patterns/src/compare/duel.ts +103 -0
- package/packages/patterns/src/end/lockup.ts +85 -0
- package/packages/patterns/src/end/slam.ts +91 -0
- package/packages/patterns/src/flow/graph.ts +250 -0
- package/packages/patterns/src/hook-number/counter.ts +101 -0
- package/packages/patterns/src/hook-number/roll.ts +179 -0
- package/packages/patterns/src/hook-number/slam.ts +91 -0
- package/packages/patterns/src/index.ts +38 -0
- package/packages/patterns/src/kit.ts +449 -0
- package/packages/patterns/src/limit/gauge.ts +117 -0
- package/packages/patterns/src/list/cards.ts +131 -0
- package/packages/patterns/src/list/cycle.ts +22 -0
- package/packages/patterns/src/media/panels.ts +100 -0
- package/packages/patterns/src/objects.ts +234 -0
- package/packages/patterns/src/quote/karaoke.ts +126 -0
- package/packages/patterns/src/quote/slam.ts +22 -0
- package/packages/patterns/src/screen/focus.ts +85 -0
- package/packages/patterns/src/steps/path.ts +137 -0
- package/packages/patterns/src/steps/stack.ts +111 -0
- package/packages/patterns/src/term-reveal/chips.ts +92 -0
- package/packages/patterns/src/term-reveal/expand.ts +127 -0
- package/packages/patterns/src/timeline/axis.ts +144 -0
- package/packages/patterns/src/title/mask.ts +85 -0
- package/packages/patterns/src/title/slam.ts +23 -0
- package/packages/patterns/src/toggle-sim/switch.ts +92 -0
- package/packages/patterns/src/trend/columns.ts +108 -0
- package/packages/patterns/src/trend/draw.ts +140 -0
- package/packages/patterns/src/types.ts +67 -0
- package/packages/patterns/src/words/moves.ts +42 -0
- package/packages/patterns/src/words/slam.ts +4 -0
- package/packages/plan/package.json +15 -0
- package/packages/plan/src/asks.ts +256 -0
- package/packages/plan/src/brief.ts +383 -0
- package/packages/plan/src/captions.ts +78 -0
- package/packages/plan/src/detect.ts +93 -0
- package/packages/plan/src/index.ts +27 -0
- package/packages/plan/src/layout.ts +176 -0
- package/packages/plan/src/llm.ts +172 -0
- package/packages/plan/src/look.ts +222 -0
- package/packages/plan/src/plan.ts +179 -0
- package/packages/plan/src/request.ts +55 -0
- package/packages/plan/src/series.ts +76 -0
- package/packages/plan/src/studio.ts +53 -0
- package/packages/plan/src/templates.ts +42 -0
- package/packages/plan/src/themes.ts +48 -0
- package/packages/plan/src/types.ts +157 -0
- package/packages/studio/package.json +12 -0
- package/packages/studio/src/index.ts +1 -0
- package/packages/studio/src/plugin.ts +236 -0
- package/packages/studio/src/ui/main.ts +503 -0
- package/packages/studio/src/ui/studio.css +165 -0
- package/packages/studio/src/ui/timeline.ts +317 -0
- package/packages/themes/kit/THEME-MAKE.md +68 -0
- package/packages/themes/kit/THEME.md +30 -0
- package/packages/themes/kit/briefs/og-intro-15s/brief.json +16 -0
- package/packages/themes/kit/briefs/og-intro-15s/facts.ts +29 -0
- package/packages/themes/kit/briefs/og-intro-15s/logo.svg +12 -0
- package/packages/themes/kit/effects.ts +5 -0
- package/packages/themes/kit/sample/index.html +11 -0
- package/packages/themes/kit/sample/main.ts +9 -0
- package/packages/themes/kit/sample/scenes/scene.ts +15 -0
- package/packages/themes/package.json +19 -0
- package/packages/themes/src/factory.ts +296 -0
- package/packages/themes/src/fx.ts +14 -0
- package/packages/themes/src/index.ts +114 -0
- package/packages/themes/src/slotkit.ts +79 -0
- package/packages/themes/src/slots.ts +46 -0
- package/packages/themes/src/stage3d.ts +197 -0
- package/packages/themes/src/types.ts +58 -0
- package/presets/kawaii-pastel.json +94 -0
- package/presets/neutral-dark.json +82 -0
- package/presets/og.json +98 -0
- package/series/og-shorts.json +14 -0
- package/skills/kasaframe/SKILL.md +33 -0
- package/templates/_shared/project/index.html +11 -0
- package/templates/_shared/project/lib/react.ts +22 -0
- package/templates/_shared/project/lib/stage.ts +292 -0
- package/templates/_shared/project/main.ts +9 -0
- package/templates/_shared/scenes/default.ts +21 -0
- package/templates/_shared/scenes/drop.ts +33 -0
- package/templates/_shared/scenes/end.ts +26 -0
- package/templates/_shared/scenes/hook.ts +18 -0
- package/templates/_shared/scenes/seam.ts +41 -0
- package/templates/_shared/scenes/step.ts +49 -0
- package/templates/ad/preview.png +0 -0
- package/templates/ad/template.json +151 -0
- package/templates/demo/preview.png +0 -0
- package/templates/demo/template.json +141 -0
- package/templates/explainer/preview.png +0 -0
- package/templates/explainer/template.json +193 -0
- package/templates/launch/preview.png +0 -0
- package/templates/launch/template.json +163 -0
- package/templates/mv/preview.png +0 -0
- package/templates/mv/scenes/default.ts +98 -0
- package/templates/mv/template.json +178 -0
- package/templates/promo/preview.png +0 -0
- package/templates/promo/template.json +185 -0
- package/templates/shorts/preview.png +0 -0
- package/templates/shorts/scenes/hook.ts +37 -0
- package/templates/shorts/template.json +196 -0
- package/templates/square/preview.png +0 -0
- package/templates/square/template.json +133 -0
- package/themes/debug-hud/THEME.md +39 -0
- package/themes/debug-hud/effects.ts +389 -0
- package/themes/debug-hud/sample/assets/og/logo.svg +12 -0
- package/themes/debug-hud/sample/beats.json +1 -0
- package/themes/debug-hud/sample/index.html +11 -0
- package/themes/debug-hud/sample/kf.json +59 -0
- package/themes/debug-hud/sample/lib/hudkit.ts +49 -0
- package/themes/debug-hud/sample/lib/og.ts +29 -0
- package/themes/debug-hud/sample/main.ts +9 -0
- package/themes/debug-hud/sample/scenes/end.ts +62 -0
- package/themes/debug-hud/sample/scenes/gather.ts +67 -0
- package/themes/debug-hud/sample/scenes/models.ts +70 -0
- package/themes/debug-hud/sample/scenes/price.ts +79 -0
- package/themes/debug-hud/sample/style.json +91 -0
- package/themes/debug-hud/slots.ts +99 -0
- package/themes/debug-hud/still.png +0 -0
- package/themes/debug-hud/style.json +91 -0
- package/themes/debug-hud/theme.json +68 -0
- package/themes/og-measure/THEME.md +47 -0
- package/themes/og-measure/effects.ts +432 -0
- package/themes/og-measure/sample/assets/brand/og-logo-full.svg +12 -0
- package/themes/og-measure/sample/assets/brand/og-logo.svg +12 -0
- package/themes/og-measure/sample/assets/data/measure.json +353 -0
- package/themes/og-measure/sample/beats.json +1 -0
- package/themes/og-measure/sample/index.html +11 -0
- package/themes/og-measure/sample/kf.json +66 -0
- package/themes/og-measure/sample/lib/data.ts +62 -0
- package/themes/og-measure/sample/main.ts +9 -0
- package/themes/og-measure/sample/measure.ts +78 -0
- package/themes/og-measure/sample/scenes/end.ts +47 -0
- package/themes/og-measure/sample/scenes/gather.ts +51 -0
- package/themes/og-measure/sample/scenes/models.ts +34 -0
- package/themes/og-measure/sample/scenes/one.ts +39 -0
- package/themes/og-measure/sample/scenes/price.ts +56 -0
- package/themes/og-measure/sample/style.json +97 -0
- package/themes/og-measure/slots.ts +88 -0
- package/themes/og-measure/still.png +0 -0
- package/themes/og-measure/style.json +97 -0
- package/themes/og-measure/theme.json +79 -0
- package/themes/riso-zine/THEME.md +43 -0
- package/themes/riso-zine/effects.ts +321 -0
- package/themes/riso-zine/sample/assets/og/logo.svg +12 -0
- package/themes/riso-zine/sample/beats.json +1 -0
- package/themes/riso-zine/sample/index.html +11 -0
- package/themes/riso-zine/sample/kf.json +59 -0
- package/themes/riso-zine/sample/lib/og.ts +29 -0
- package/themes/riso-zine/sample/lib/shot.ts +86 -0
- package/themes/riso-zine/sample/lib/zine.ts +42 -0
- package/themes/riso-zine/sample/main.ts +9 -0
- package/themes/riso-zine/sample/scenes/end.ts +61 -0
- package/themes/riso-zine/sample/scenes/gather.ts +62 -0
- package/themes/riso-zine/sample/scenes/models.ts +52 -0
- package/themes/riso-zine/sample/scenes/price.ts +82 -0
- package/themes/riso-zine/sample/style.json +99 -0
- package/themes/riso-zine/slots.ts +81 -0
- package/themes/riso-zine/still.png +0 -0
- package/themes/riso-zine/style.json +99 -0
- package/themes/riso-zine/theme.json +75 -0
- package/tools/beats/beats.py +372 -0
- package/tools/beats/requirements.txt +3 -0
- package/tools/lyrics/align.py +164 -0
- package/tools/lyrics/requirements.txt +9 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { basename, extname, join, resolve } from "node:path";
|
|
3
|
+
import type { Command } from "../command.ts";
|
|
4
|
+
import { num, parseFlags } from "../command.ts";
|
|
5
|
+
import { openSession, type Tab } from "../browser.ts";
|
|
6
|
+
import { concat, encoder, type VideoFormat } from "../ffmpeg.ts";
|
|
7
|
+
import { acquireRenderLock } from "../lock.ts";
|
|
8
|
+
import { blurOpts, captureBlurred, projectBlur, rgbaToPng } from "../blur.ts";
|
|
9
|
+
import { outPath } from "../out.ts";
|
|
10
|
+
import { cachedSegment, collectEvents, type KeyOpts, type MotionEvent, pruneSegments, renderSegments, sceneKeys, sceneSpans, type SegmentReport, type SegmentWork, variantOf } from "../segments.ts";
|
|
11
|
+
import { mixAudio, mixSettings } from "../mix.ts";
|
|
12
|
+
|
|
13
|
+
const MAX_TABS = 3;
|
|
14
|
+
|
|
15
|
+
interface Chunk {
|
|
16
|
+
index: number;
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function split(start: number, end: number, n: number): Chunk[] {
|
|
22
|
+
const total = end - start;
|
|
23
|
+
const out: Chunk[] = [];
|
|
24
|
+
for (let i = 0; i < n; i++) {
|
|
25
|
+
const a = start + Math.floor((total * i) / n);
|
|
26
|
+
const b = start + Math.floor((total * (i + 1)) / n);
|
|
27
|
+
if (b > a) out.push({ index: i, start: a, end: b });
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function findMusic(dir: string, given: string | boolean | undefined, metaMusic?: string): string | undefined {
|
|
33
|
+
if (given === false || given === "none") return undefined;
|
|
34
|
+
if (typeof given === "string") return resolve(given);
|
|
35
|
+
if (metaMusic) {
|
|
36
|
+
const p = resolve(dir, metaMusic);
|
|
37
|
+
if (existsSync(p)) return p;
|
|
38
|
+
console.error(`곡을 못 찾았다: ${p} — 소리 없이 굽는다`);
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// beats.json 의 from = 곡에서 잘라 쓴 시작. 영상 0초가 곡의 from 초라서, 곡을 얹을 때 그만큼 더 건너뛴다.
|
|
44
|
+
function musicFrom(dir: string): number {
|
|
45
|
+
try {
|
|
46
|
+
const kf = JSON.parse(readFileSync(join(dir, "kf.json"), "utf8")) as { beats?: string };
|
|
47
|
+
if (!kf.beats) return 0;
|
|
48
|
+
const beats = JSON.parse(readFileSync(resolve(dir, kf.beats), "utf8")) as { from?: number };
|
|
49
|
+
return Number(beats.from) || 0;
|
|
50
|
+
} catch {
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// x.mp4 → x-자막.mp4 · frames → frames-자막
|
|
56
|
+
function withSuffix(p: string, suffix: string): string {
|
|
57
|
+
if (!suffix) return p;
|
|
58
|
+
const ext = extname(p);
|
|
59
|
+
return ext ? `${p.slice(0, -ext.length)}${suffix}${ext}` : `${p}${suffix}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const cmd: Command = {
|
|
63
|
+
summary: "MP4(또는 ProRes·PNG 묶음)로 굽기 — 탭 병렬, 곡 얹기, 잠금",
|
|
64
|
+
usage: `kf render <폴더> [--out x.mp4] [--scenes a,b] [--from 초 --to 초] [--tabs 3] [--prores | --png] [--music 곡 | --no-music] [--captions on|off|fit [--suffix]]
|
|
65
|
+
--out 기본 <폴더>/out/render.mp4 (--prores 면 .mov, --png 면 폴더)
|
|
66
|
+
seek 모드는 장면 조각으로 굽는다 — 장면마다 out/segments/<장면>-<해시>.mp4(해시: 그 장면이 실제로 불러온 모듈·kf.json 그 장면 칸·
|
|
67
|
+
자산·자막 줄·굽기 설정, 이음매는 앞뒤 장면까지). 해시가 같은 조각은 다시 찍지 않고 이어 붙인 뒤 곡·목소리를 전체로 얹는다
|
|
68
|
+
--scenes a,b 그 장면 조각만 굽고 잇지 않는다(조각 경로를 찍는다). 다음 kf render 가 그 조각을 그대로 쓴다
|
|
69
|
+
--fresh 조각 캐시를 안 보고 다시 찍는다 · --no-segments 조각 없이 탭 몫으로 나눠 한 번에(예전 길)
|
|
70
|
+
--from/--to 구간만 굽는다. 곡도 그 구간만 잘라 얹는다(조각 없이)
|
|
71
|
+
--tabs 크롬 탭 수(최대 ${MAX_TABS}). seek 모드는 구간을 나눠 찍고, step 모드는 탭마다 구간 앞까지 빨리 돌린 뒤 찍는다
|
|
72
|
+
--music 기본은 페이지 meta.music(kf.json 의 music). 곡은 beats.json 의 from 초부터 얹는다
|
|
73
|
+
--music-from 곡에서 시작할 초를 직접 준다(--music 으로 다른 곡을 줄 때)
|
|
74
|
+
--crf H.264 화질(기본 16, 낮을수록 좋다)
|
|
75
|
+
--motion-blur N 한 프레임을 하위 프레임 N 장(예 8)으로 찍어 평균 — 빠른 것만 번진다. 3D 전환은 같은 평균으로 피사계 심도도. seek 모드만, N 배 느리다.
|
|
76
|
+
안 주면 kf.json 의 render.motionBlur(쇼츠·홍보 틀은 켜 둔다), 0 이면 끈다
|
|
77
|
+
--shutter 모션 블러 셔터 각도(기본 180 — 프레임 간격의 절반). 360 이면 다음 프레임까지 이어 번진다
|
|
78
|
+
--captions on|off|fit 화면 자막을 이 판만 켜거나 끈다(kf.json 의 captions 는 그대로). on 이면 captions.json 을 화면 아래 판에 얹고
|
|
79
|
+
안전 영역 아래쪽 자막 띠를 비운다(무대가 그 위로 배치) · fit 은 장면을 띠 위로 줄여 올린다(픽셀을 박아 둔 장면용)
|
|
80
|
+
--suffix [글] 결과 이름 뒤에 붙인다 — 값 없이 주면 --captions 에 따라 -자막 · -자막없음. 원본을 덮지 않고 둘 다 남길 때
|
|
81
|
+
--lock-wait 다른 렌더가 잠금을 쥐고 있을 때 기다릴 초(기본 900)
|
|
82
|
+
--no-lock 잠금 없이(시험용 짧은 구간)
|
|
83
|
+
끝나면 같은 이름의 .json(png 는 폴더 안 render.json)에 meta·구간·걸린 시간·markers·움직임 events 를 남긴다.`,
|
|
84
|
+
async run(argv) {
|
|
85
|
+
const { args, opts } = parseFlags(argv);
|
|
86
|
+
const dir = args[0];
|
|
87
|
+
if (!dir) {
|
|
88
|
+
console.error("kf render: 폴더를 줘라 — kf render <폴더> --out x.mp4");
|
|
89
|
+
return 2;
|
|
90
|
+
}
|
|
91
|
+
const format: VideoFormat | "png" = opts.png ? "png" : opts.prores ? "prores" : "h264";
|
|
92
|
+
const ext = format === "prores" ? ".mov" : format === "png" ? "" : ".mp4";
|
|
93
|
+
const captions = opts.captions === undefined ? undefined : String(opts.captions);
|
|
94
|
+
if (captions !== undefined && captions !== "on" && captions !== "off" && captions !== "fit") throw new Error(`--captions 는 on·off·fit: ${captions}`);
|
|
95
|
+
const suffix = typeof opts.suffix === "string" ? opts.suffix : opts.suffix ? (captions === "off" ? "-자막없음" : "-자막") : "";
|
|
96
|
+
const out = withSuffix(outPath(dir, opts.out, format === "png" ? "frames/x" : `render${ext}`).replace(/\/x$/, ""), suffix);
|
|
97
|
+
if (format !== "png" && extname(out) === "") throw new Error(`--out 에 확장자가 없다: ${out}`);
|
|
98
|
+
|
|
99
|
+
const release = opts["no-lock"] ? () => {} : await acquireRenderLock(resolve(dir), num(opts["lock-wait"], 900));
|
|
100
|
+
const started = Date.now();
|
|
101
|
+
const s = await openSession(dir, { query: captions ? `captions=${captions}` : undefined });
|
|
102
|
+
const tmp = join(resolve(dir), "out", `.kf-render-${process.pid}`);
|
|
103
|
+
try {
|
|
104
|
+
const { meta, mode } = s.info;
|
|
105
|
+
const { fps } = meta;
|
|
106
|
+
const total = Math.round(meta.duration * fps);
|
|
107
|
+
const startF = Math.max(0, Math.floor(num(opts.from, 0) * fps + 1e-6));
|
|
108
|
+
const endF = Math.min(total, Math.ceil(num(opts.to, meta.duration) * fps - 1e-6));
|
|
109
|
+
if (endF <= startF) throw new Error(`굽을 프레임이 없다 (${startF}..${endF})`);
|
|
110
|
+
const frames = endF - startF;
|
|
111
|
+
const tabs = Math.max(1, Math.min(MAX_TABS, num(opts.tabs, MAX_TABS), Math.ceil(frames / fps)));
|
|
112
|
+
const chunks = split(startF, endF, tabs);
|
|
113
|
+
const music = format === "png" ? undefined : findMusic(dir, opts["no-music"] ? false : opts.music, meta.music);
|
|
114
|
+
let blur = blurOpts(opts, projectBlur(resolve(dir)));
|
|
115
|
+
if (blur && mode === "step") {
|
|
116
|
+
console.error("모션 블러는 seek 모드만 — step 모드는 뒤로 못 가서 끈다");
|
|
117
|
+
blur = null;
|
|
118
|
+
}
|
|
119
|
+
const songFrom = opts["music-from"] !== undefined ? num(opts["music-from"], 0) : opts.music ? 0 : musicFrom(resolve(dir));
|
|
120
|
+
|
|
121
|
+
// seek 모드 통짜 굽기는 장면 조각으로 — 바뀐 장면만 다시 찍고 잇는다. --no-segments 면 예전처럼 탭 몫으로 나눠 한 번에
|
|
122
|
+
const segmented = !opts["no-segments"] && mode === "seek" && format !== "png" && opts.from === undefined && opts.to === undefined;
|
|
123
|
+
const only = typeof opts.scenes === "string" ? opts.scenes.split(",").map((x) => x.trim()).filter(Boolean) : null;
|
|
124
|
+
if (only && !segmented) throw new Error("--scenes 는 seek 모드 영상 굽기에서만 — --from/--to·--png·--no-segments·step 모드와 같이 못 쓴다");
|
|
125
|
+
const crf = opts.crf ? num(opts.crf, 16) : undefined;
|
|
126
|
+
|
|
127
|
+
console.error(
|
|
128
|
+
`${meta.width}x${meta.height} ${fps}fps ${mode} 모드 · 프레임 ${startF}..${endF - 1} (${frames}장) · 탭 ${segmented ? tabs : chunks.length}` +
|
|
129
|
+
(music ? ` · 곡 ${music}${songFrom ? ` (${songFrom}초부터)` : ""}` : "") +
|
|
130
|
+
(blur ? ` · 모션 블러 ${blur.count}장·셔터 ${blur.shutter}°` : ""),
|
|
131
|
+
);
|
|
132
|
+
mkdirSync(tmp, { recursive: true });
|
|
133
|
+
if (format === "png") mkdirSync(out, { recursive: true });
|
|
134
|
+
|
|
135
|
+
let done = 0;
|
|
136
|
+
let todo = frames;
|
|
137
|
+
const progress = setInterval(() => {
|
|
138
|
+
const sec = (Date.now() - started) / 1000;
|
|
139
|
+
console.error(` ${done}/${todo} (${((done / Math.max(1, todo)) * 100).toFixed(0)}%) ${(done / sec).toFixed(1)} 장/초`);
|
|
140
|
+
}, 5000);
|
|
141
|
+
|
|
142
|
+
let segFiles: string[] = [];
|
|
143
|
+
let events: MotionEvent[] = [];
|
|
144
|
+
let segments: { rendered: string[]; reused: string[] } | undefined;
|
|
145
|
+
try {
|
|
146
|
+
if (segmented) {
|
|
147
|
+
const root = s.project.dir;
|
|
148
|
+
const keyOpts: KeyOpts = { width: meta.width, height: meta.height, fps, format, crf, blur, captions, browser: s.browser.version() };
|
|
149
|
+
const keys = sceneKeys(s.project.server, root, keyOpts);
|
|
150
|
+
const spans = sceneSpans(JSON.parse(readFileSync(join(root, "kf.json"), "utf8")).scenes, fps, total);
|
|
151
|
+
const missing = only?.filter((id) => !spans.some((sp) => sp.id === id)) ?? [];
|
|
152
|
+
if (missing.length) throw new Error(`kf.json 에 없는 장면: ${missing.join(", ")}`);
|
|
153
|
+
const reused = new Map<string, SegmentReport>();
|
|
154
|
+
const work: SegmentWork[] = [];
|
|
155
|
+
for (const span of only ? spans.filter((sp) => only.includes(sp.id)) : spans) {
|
|
156
|
+
const { key, inputs } = keys.get(span.id)!;
|
|
157
|
+
const hit = opts.fresh ? null : cachedSegment(root, span.id, key, ext);
|
|
158
|
+
if (!hit) work.push({ span, key, inputs });
|
|
159
|
+
else {
|
|
160
|
+
reused.set(span.id, hit);
|
|
161
|
+
console.error(`장면 ${span.id}: 그대로 — ${basename(hit.file)}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
todo = work.reduce((n, w) => n + w.span.end - w.span.start, 0);
|
|
165
|
+
console.error(`조각 ${work.length + reused.size} — 다시 찍기 ${work.length}(${todo}장) · 그대로 ${reused.size}`);
|
|
166
|
+
const made = work.length ? await renderSegments({ session: s, root, work, tabs, format, ext, crf, blur, tmp, onFrame: () => done++ }) : [];
|
|
167
|
+
const all = new Map<string, SegmentReport>([...reused, ...made.map((m) => [m.id, m] as const)]);
|
|
168
|
+
if (only) {
|
|
169
|
+
for (const id of only) console.log(all.get(id)!.file);
|
|
170
|
+
console.error(`조각만 ${((Date.now() - started) / 1000).toFixed(1)}초 — 잇기는 kf render ${dir}`);
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
segFiles = spans.map((sp) => all.get(sp.id)!.file);
|
|
174
|
+
events = spans.flatMap((sp) => all.get(sp.id)!.events);
|
|
175
|
+
segments = { rendered: made.map((m) => m.id), reused: [...reused.keys()] };
|
|
176
|
+
pruneSegments(root, variantOf(keyOpts), Object.fromEntries(spans.map((sp) => [sp.id, keys.get(sp.id)!.key])));
|
|
177
|
+
} else {
|
|
178
|
+
const usedTabs: Tab[] = [];
|
|
179
|
+
await Promise.all(
|
|
180
|
+
chunks.map(async (c) => {
|
|
181
|
+
const tab: Tab = c.index === 0 ? s.first : await s.tab();
|
|
182
|
+
usedTabs.push(tab);
|
|
183
|
+
const seg = join(tmp, `seg-${String(c.index).padStart(2, "0")}${ext}`);
|
|
184
|
+
segFiles[c.index] = seg;
|
|
185
|
+
const raw = blur ? { width: meta.width, height: meta.height } : undefined;
|
|
186
|
+
const enc = format === "png" ? null : encoder(seg, fps, format, crf, raw);
|
|
187
|
+
for (let f = c.start; f < c.end; f++) {
|
|
188
|
+
let frame: Buffer;
|
|
189
|
+
if (blur) {
|
|
190
|
+
const img = await captureBlurred(tab, s.info, f / fps, blur);
|
|
191
|
+
frame = enc ? img.data : rgbaToPng(img);
|
|
192
|
+
} else {
|
|
193
|
+
await tab.seek(f / fps);
|
|
194
|
+
frame = await tab.capture();
|
|
195
|
+
}
|
|
196
|
+
if (enc) await enc.write(frame);
|
|
197
|
+
else writeFileSync(join(out, `${String(f).padStart(6, "0")}.png`), frame);
|
|
198
|
+
done++;
|
|
199
|
+
}
|
|
200
|
+
await enc?.end();
|
|
201
|
+
}),
|
|
202
|
+
);
|
|
203
|
+
events = await collectEvents(usedTabs);
|
|
204
|
+
}
|
|
205
|
+
} finally {
|
|
206
|
+
clearInterval(progress);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (format !== "png") {
|
|
210
|
+
const list = join(tmp, "list.txt");
|
|
211
|
+
writeFileSync(list, segFiles.map((f) => `file '${f.replace(/'/g, "'\\''")}'`).join("\n") + "\n");
|
|
212
|
+
// kf.json 에 audio(섞기 값)가 있으면 내레이션·곡을 섞은 소리를 얹는다(덕킹·끝 페이드·LUFS) — 없으면 곡만
|
|
213
|
+
const mix = opts["no-music"] ? null : mixSettings(resolve(dir));
|
|
214
|
+
const mixed = mix && (mix.voice || music)
|
|
215
|
+
? await mixAudio({ voice: mix.voice, music, musicFrom: songFrom }, { audio: mix.audio, from: startF / fps, dur: frames / fps, total: meta.duration, out: join(tmp, "mix.wav") })
|
|
216
|
+
: undefined;
|
|
217
|
+
await concat({ list, out, format, music: mixed ?? music, from: mixed ? 0 : songFrom + startF / fps, dur: frames / fps });
|
|
218
|
+
if (mixed) console.error(`소리: ${mix!.voice ? "내레이션" : ""}${mix!.voice && music ? " + " : ""}${music ? "곡" : ""} → ${mix!.audio.lufs} LUFS`);
|
|
219
|
+
}
|
|
220
|
+
const sec = (Date.now() - started) / 1000;
|
|
221
|
+
const report = {
|
|
222
|
+
out,
|
|
223
|
+
meta,
|
|
224
|
+
mode,
|
|
225
|
+
from: startF / fps,
|
|
226
|
+
to: endF / fps,
|
|
227
|
+
frames,
|
|
228
|
+
tabs: segmented ? tabs : chunks.length,
|
|
229
|
+
format,
|
|
230
|
+
motionBlur: blur,
|
|
231
|
+
captions: captions ?? null,
|
|
232
|
+
music: music ?? null,
|
|
233
|
+
seconds: Math.round(sec * 10) / 10,
|
|
234
|
+
...(segments ? { segments } : {}),
|
|
235
|
+
markers: s.info.markers,
|
|
236
|
+
events,
|
|
237
|
+
};
|
|
238
|
+
const reportFile = format === "png" ? join(out, "render.json") : out.replace(/\.[^.]+$/, ".json");
|
|
239
|
+
writeFileSync(reportFile, JSON.stringify(report, null, 1));
|
|
240
|
+
console.error(`${todo}장 ${sec.toFixed(1)}초 (${(todo / sec).toFixed(1)} 장/초)${segments ? ` · 조각 다시 ${segments.rendered.length}·그대로 ${segments.reused.length}` : ""} · 보고서 ${reportFile}`);
|
|
241
|
+
console.log(out);
|
|
242
|
+
return 0;
|
|
243
|
+
} finally {
|
|
244
|
+
await s.close();
|
|
245
|
+
if (existsSync(tmp) && !opts["keep-tmp"]) rmSync(tmp, { recursive: true, force: true });
|
|
246
|
+
release();
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
export default cmd;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, relative, resolve } from "node:path";
|
|
3
|
+
import { listSeries, loadSeries, type Purpose, type Series, seriesDir, writeSeries } from "@kasaframe/plan";
|
|
4
|
+
import { loadTheme } from "@kasaframe/themes";
|
|
5
|
+
import type { Command } from "../command.ts";
|
|
6
|
+
import { parseFlags } from "../command.ts";
|
|
7
|
+
|
|
8
|
+
const USAGE = `kf series list
|
|
9
|
+
kf series show <id>
|
|
10
|
+
kf series new <id> --label "OG 쇼츠" --match "OG 쇼츠,OG shorts" --purpose shorts [--theme og-measure] [--voice gemini:Charon]
|
|
11
|
+
[--mood deep | --music music/x.mp3] [--captions on|off|none] [--duration 45-60] [--end-title 이름] [--end-line 한 줄]
|
|
12
|
+
[--answers image=og-gpt-image-2.5-sunburst,video=none] [--from <잘 나온 프로젝트 폴더>] [--force]
|
|
13
|
+
|
|
14
|
+
시리즈 묶음(series/<id>.json, KF_SERIES_DIR 로 바꿈) — 요청이 match 의 말을 짚으면 kf make 가 묻지 않고 이 묶음대로 간다:
|
|
15
|
+
용도·테마·목소리·곡(파일이면 늘 그 곡, 분위기면 곡 모음의 같은 곡)·자막·길이·끝 카드·생성 질문 답. 용도 규칙은 그 용도 틀이 정한다.
|
|
16
|
+
--from 은 그 프로젝트의 plan.json·kf.json(용도·테마·목소리·곡·자막·길이·이름·고른 답)을 묶음으로 옮긴다 — 플래그가 이긴다.`;
|
|
17
|
+
|
|
18
|
+
function range(v: string): { min: number; max: number; default: number } {
|
|
19
|
+
const m = /^(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?$/.exec(v);
|
|
20
|
+
if (!m) throw new Error(`--duration 은 45 또는 45-60 — ${v}`);
|
|
21
|
+
const min = Number(m[1]);
|
|
22
|
+
const max = Number(m[2] ?? m[1]);
|
|
23
|
+
return { min, max, default: min };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function fromProject(dir: string): Partial<Series> {
|
|
27
|
+
const plan = JSON.parse(readFileSync(join(dir, "plan.json"), "utf8"));
|
|
28
|
+
const kf = existsSync(join(dir, "kf.json")) ? JSON.parse(readFileSync(join(dir, "kf.json"), "utf8")) : {};
|
|
29
|
+
const answers: Record<string, string> = Object.fromEntries(Object.entries(plan.answers ?? {}).filter(([k, v]) => k !== "voice" && k !== "music" && typeof v === "string") as [string, string][]);
|
|
30
|
+
return {
|
|
31
|
+
purpose: plan.purpose,
|
|
32
|
+
...(plan.theme ? { theme: plan.theme } : { style: plan.style }),
|
|
33
|
+
...(plan.voice ? { voice: plan.voice } : {}),
|
|
34
|
+
...(plan.mood ? { music: { mood: plan.mood } } : {}),
|
|
35
|
+
captions: kf.captions ?? plan.captions,
|
|
36
|
+
duration: { min: plan.duration, max: plan.duration, default: plan.duration },
|
|
37
|
+
end: { title: plan.title },
|
|
38
|
+
...(Object.keys(answers).length ? { answers } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function show(s: Series): string {
|
|
43
|
+
const warn: string[] = [];
|
|
44
|
+
if (s.theme) {
|
|
45
|
+
try {
|
|
46
|
+
const t = loadTheme(s.theme);
|
|
47
|
+
if (t.status !== "approved") warn.push(`테마 ${s.theme} 는 ${t.status} — 승인 전`);
|
|
48
|
+
if (!t.purposes.includes(s.purpose)) warn.push(`테마 ${s.theme} 의 용도에 ${s.purpose} 가 없다`);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
warn.push(`테마 ${s.theme}: ${e instanceof Error ? e.message : e}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [JSON.stringify(s, null, 2), ...warn.map((w) => `주의: ${w}`)].join("\n");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const cmd: Command = {
|
|
57
|
+
summary: "시리즈 묶음 — 짚으면 묻지 않고 매번 같은 용도·테마·목소리·곡·자막·길이·끝 카드",
|
|
58
|
+
usage: USAGE,
|
|
59
|
+
async run(argv) {
|
|
60
|
+
const [sub, ...rest] = argv;
|
|
61
|
+
const { args, opts } = parseFlags(rest);
|
|
62
|
+
const str = (k: string) => (typeof opts[k] === "string" ? (opts[k] as string) : undefined);
|
|
63
|
+
if (sub === "list") {
|
|
64
|
+
const all = listSeries();
|
|
65
|
+
if (!all.length) console.log(`시리즈 없음 — kf series new 로 (${seriesDir()})`);
|
|
66
|
+
for (const s of all) console.log(`${s.id.padEnd(16)} ${s.label} · ${s.purpose}${s.theme ? ` · 테마 ${s.theme}` : ""}${s.voice ? ` · ${s.voice}` : ""} — 「${s.match.join("」「")}」`);
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
if (sub === "show" && args[0]) {
|
|
70
|
+
console.log(show(loadSeries(args[0])));
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
if (sub === "new" && args[0]) {
|
|
74
|
+
const id = args[0];
|
|
75
|
+
if (existsSync(join(seriesDir(), `${id}.json`)) && !opts.force) {
|
|
76
|
+
console.error(`kf series new: ${id} 가 이미 있다 — 덮으려면 --force`);
|
|
77
|
+
return 2;
|
|
78
|
+
}
|
|
79
|
+
const base: Partial<Series> = str("from") ? fromProject(resolve(str("from")!)) : {};
|
|
80
|
+
const answers = str("answers") ? Object.fromEntries(str("answers")!.split(",").map((kv) => kv.split("=").map((x) => x.trim()) as [string, string])) : undefined;
|
|
81
|
+
const s: Series = {
|
|
82
|
+
...base,
|
|
83
|
+
id,
|
|
84
|
+
label: str("label") ?? base.label ?? id,
|
|
85
|
+
match: str("match") ? str("match")!.split(",").map((x) => x.trim()).filter(Boolean) : (base.match ?? []),
|
|
86
|
+
purpose: (str("purpose") ?? base.purpose) as Purpose,
|
|
87
|
+
...(str("theme") ? { theme: str("theme") } : {}),
|
|
88
|
+
...(str("voice") ? { voice: str("voice") } : {}),
|
|
89
|
+
...(str("music") ? { music: { file: str("music") } } : str("mood") ? { music: { mood: str("mood") } } : {}),
|
|
90
|
+
...(str("captions") ? { captions: str("captions") as Series["captions"] } : {}),
|
|
91
|
+
...(str("duration") ? { duration: range(str("duration")!) } : {}),
|
|
92
|
+
...(str("end-title") || str("end-line") ? { end: { ...base.end, ...(str("end-title") ? { title: str("end-title") } : {}), ...(str("end-line") ? { line: str("end-line") } : {}) } } : {}),
|
|
93
|
+
...(answers ? { answers: { ...base.answers, ...answers } } : {}),
|
|
94
|
+
};
|
|
95
|
+
try {
|
|
96
|
+
// 사람이 열어 볼 파일이라 이름·짚는 말·용도를 맨 위에
|
|
97
|
+
const { id: _, label, match, purpose, ...rest } = s;
|
|
98
|
+
const file = writeSeries({ id, label, match, purpose, ...rest });
|
|
99
|
+
console.log(`${relative(process.cwd(), file) || file}\n${show(s)}`);
|
|
100
|
+
return 0;
|
|
101
|
+
} catch (e) {
|
|
102
|
+
console.error(`kf series new: ${e instanceof Error ? e.message : e}`);
|
|
103
|
+
return 2;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
console.error(USAGE);
|
|
107
|
+
return 2;
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
export default cmd;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import { createInterface } from "node:readline";
|
|
5
|
+
import { keyFile } from "@kasaframe/gen";
|
|
6
|
+
import { platform } from "node:os";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { beatsVenv, checks, playwrightCli, report, requirements, venvPython } from "../deps.ts";
|
|
9
|
+
import { type Command, parseFlags } from "../command.ts";
|
|
10
|
+
import { setupLyrics } from "./lyrics.ts";
|
|
11
|
+
|
|
12
|
+
function step(label: string, cmd: string, args: string[]): boolean {
|
|
13
|
+
console.log(`\n${label}: ${cmd} ${args.join(" ")}`);
|
|
14
|
+
const r = spawnSync(cmd, args, { stdio: "inherit" });
|
|
15
|
+
if (r.status === 0) return true;
|
|
16
|
+
console.error(`${label} 실패(${r.error?.message ?? `종료 ${r.status}`})`);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function chrome(): boolean {
|
|
21
|
+
// 리눅스 root 면 크롬이 쓰는 시스템 라이브러리까지 — 아니면 sudo 가 필요해 명령만 알린다
|
|
22
|
+
const withDeps = platform() === "linux" && process.getuid?.() === 0;
|
|
23
|
+
const ok = step("크롬", process.execPath, [playwrightCli(), "install", ...(withDeps ? ["--with-deps"] : []), "chromium"]);
|
|
24
|
+
if (platform() === "linux" && !withDeps) console.log(` 라이브러리가 없어 크롬이 안 뜨면: sudo ${process.execPath} ${playwrightCli()} install-deps chromium`);
|
|
25
|
+
return ok;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function beats(): boolean {
|
|
29
|
+
if (process.env.KF_PYTHON) return step("librosa", process.env.KF_PYTHON, ["-m", "pip", "install", "-r", requirements]);
|
|
30
|
+
if (!existsSync(beatsVenv) && !step("파이썬 venv", "python3", ["-m", "venv", beatsVenv])) return false;
|
|
31
|
+
return step("librosa", venvPython(beatsVenv), ["-m", "pip", "install", "-r", requirements]);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 엔진·자주 쓰는 한글 글꼴은 패키지에 실려 있어 받을 것은 나머지 얼굴뿐이다(처음 쓸 때도 받는다 — 오프라인으로 구울 기계면 미리). 일본어 가사는 node packages/jizura/src/install.ts --lang ko,ja
|
|
35
|
+
const jizura = () => step("JIZURA", process.execPath, [fileURLToPath(import.meta.resolve("@kasaframe/jizura/install")), "--lang", "ko"]);
|
|
36
|
+
|
|
37
|
+
// 이름 하나 = 깔 것 하나. 이름 없이 부르면 DEFAULT 만
|
|
38
|
+
const STEPS: Record<string, { what: string; run: () => boolean }> = {
|
|
39
|
+
chrome: { what: "Playwright 크롬(chromium) — 렌더·검사", run: chrome },
|
|
40
|
+
beats: { what: `librosa(${beatsVenv}) — 곡 분석 kf beats`, run: beats },
|
|
41
|
+
jizura: { what: "JIZURA 가사 층의 나머지 한국어 글꼴 17MB(~/.cache/kasaframe/jizura) — 엔진·자주 쓰는 글꼴은 실려 있고 이것도 처음 쓸 때 받는다, 오프라인으로 구울 기계면 미리", run: jizura },
|
|
42
|
+
lyrics: { what: "demucs·stable-ts(~/.cache/kasaframe/py/lyrics, 2GB 안팎) — kf lyrics align", run: setupLyrics },
|
|
43
|
+
};
|
|
44
|
+
const DEFAULT = ["chrome", "beats"];
|
|
45
|
+
|
|
46
|
+
// 키는 화면·셸 기록에 남지 않게 — 터미널이면 입력을 가리고, 아니면 표준 입력 한 줄로 받는다. 값은 찍지 않는다
|
|
47
|
+
function readSecret(prompt: string): Promise<string> {
|
|
48
|
+
return new Promise((done) => {
|
|
49
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr, terminal: !!process.stdin.isTTY });
|
|
50
|
+
if (process.stdin.isTTY) {
|
|
51
|
+
process.stderr.write(prompt);
|
|
52
|
+
(rl as unknown as { _writeToOutput: (s: string) => void })._writeToOutput = () => {};
|
|
53
|
+
}
|
|
54
|
+
rl.once("line", (line) => {
|
|
55
|
+
rl.close();
|
|
56
|
+
if (process.stdin.isTTY) process.stderr.write("\n");
|
|
57
|
+
done(line.trim());
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function key(name: string | undefined): Promise<number> {
|
|
63
|
+
if (!name || !/^[a-z0-9-]+$/.test(name)) {
|
|
64
|
+
console.error("kf setup key <이름> — opengateway · fal · gemini · minimax · ltx · elevenlabs · dashscope (kf doctor 「생성 능력」이 무엇이 없는지 알려 준다)");
|
|
65
|
+
return 2;
|
|
66
|
+
}
|
|
67
|
+
const value = await readSecret(`${name} 키(입력은 안 보인다): `);
|
|
68
|
+
if (!value) {
|
|
69
|
+
console.error("kf setup key: 빈 값 — 아무것도 쓰지 않았다");
|
|
70
|
+
return 2;
|
|
71
|
+
}
|
|
72
|
+
const file = keyFile(name);
|
|
73
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
74
|
+
writeFileSync(file, `${value}\n`, { mode: 0o600 });
|
|
75
|
+
chmodSync(file, 0o600);
|
|
76
|
+
console.log(`${file} 에 썼다(600). 확인: kf doctor`);
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const cmd: Command = {
|
|
81
|
+
summary: "바깥 도구 깔기 — Playwright 크롬·librosa. ffmpeg 는 시스템 패키지라 깔 명령만 알린다",
|
|
82
|
+
usage: `kf setup [이름…] 이름 없이: ${DEFAULT.join(" ")}
|
|
83
|
+
kf setup key <이름> 생성 공급자 키를 숨겨 받아 ~/.config/kasaframe/keys/<이름>(600)에 — 값은 찍지 않는다
|
|
84
|
+
${Object.entries(STEPS).map(([k, s]) => ` ${k.padEnd(8)} ${s.what}`).join("\n")}
|
|
85
|
+
kf beats 는 KF_PYTHON 이 없으면 위 venv 를 먼저 쓴다. 끝에 kf doctor 와 같은 표를 찍는다`,
|
|
86
|
+
async run(argv) {
|
|
87
|
+
const { args } = parseFlags(argv);
|
|
88
|
+
if (args[0] === "key") return key(args[1]);
|
|
89
|
+
const names = args.length ? args : DEFAULT;
|
|
90
|
+
const unknown = names.filter((n) => !STEPS[n]);
|
|
91
|
+
if (unknown.length) {
|
|
92
|
+
console.error(`kf setup: 모르는 이름 ${unknown.join(" ")} — 있는 것: ${Object.keys(STEPS).join(" ")}`);
|
|
93
|
+
return 2;
|
|
94
|
+
}
|
|
95
|
+
const failed = names.filter((n) => !STEPS[n].run());
|
|
96
|
+
console.log("");
|
|
97
|
+
const list = await checks();
|
|
98
|
+
report(list);
|
|
99
|
+
return failed.length || list.some((c) => c.required && !c.ok) ? 1 : 0;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
export default cmd;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import type { Command } from "../command.ts";
|
|
4
|
+
import { num, parseFlags } from "../command.ts";
|
|
5
|
+
import { openSession, type PageInfo } from "../browser.ts";
|
|
6
|
+
import { fmtTime, outPath } from "../out.ts";
|
|
7
|
+
import { acquireRenderLock } from "../lock.ts";
|
|
8
|
+
|
|
9
|
+
interface Shot {
|
|
10
|
+
t: number;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function scenesOf(info: PageInfo): { label: string; from: number; to: number }[] {
|
|
15
|
+
const starts = info.markers.filter((m) => m.kind === "scene").sort((a, b) => a.t - b.t);
|
|
16
|
+
return starts.map((m, i) => ({ label: m.label, from: m.t, to: starts[i + 1]?.t ?? info.meta.duration }));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function pickTimes(info: PageInfo, opts: Record<string, string | boolean | undefined>): Shot[] {
|
|
20
|
+
const { duration, fps } = info.meta;
|
|
21
|
+
const last = (Math.round(duration * fps) - 1) / fps;
|
|
22
|
+
const scenes = scenesOf(info);
|
|
23
|
+
const sceneAt = (t: number) => scenes.findLast((s) => s.from <= t)?.label ?? "";
|
|
24
|
+
if (typeof opts.at === "string") {
|
|
25
|
+
return opts.at.split(",").map((x) => {
|
|
26
|
+
const t = Math.min(last, Number(x));
|
|
27
|
+
return { t, label: sceneAt(t) };
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const per = num(opts["per-scene"], 1);
|
|
31
|
+
if (scenes.length && opts.count === undefined) {
|
|
32
|
+
return scenes.flatMap((s) =>
|
|
33
|
+
Array.from({ length: per }, (_, i) => {
|
|
34
|
+
const t = Math.min(last, s.from + ((s.to - s.from) * (i + 1)) / (per + 1));
|
|
35
|
+
return { t: Math.round(t * fps) / fps, label: s.label };
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const n = num(opts.count, 12);
|
|
40
|
+
return Array.from({ length: n }, (_, i) => {
|
|
41
|
+
const t = Math.round(((last * (i + 0.5)) / n) * fps) / fps;
|
|
42
|
+
return { t, label: sceneAt(t) };
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function sheetHtml(shots: { png: Buffer; t: number; label: string }[], cols: number, w: number, h: number): string {
|
|
47
|
+
const cells = shots
|
|
48
|
+
.map(
|
|
49
|
+
(s) =>
|
|
50
|
+
`<figure><img src="data:image/png;base64,${s.png.toString("base64")}"><figcaption><b>${fmtTime(s.t)}s</b>${s.label ? ` · ${s.label}` : ""}</figcaption></figure>`,
|
|
51
|
+
)
|
|
52
|
+
.join("");
|
|
53
|
+
return `<!doctype html><meta charset="utf-8"><style>
|
|
54
|
+
body { margin: 0; padding: 16px; background: #111; font: 15px/1.3 -apple-system, "Apple SD Gothic Neo", sans-serif; color: #ddd; }
|
|
55
|
+
main { display: grid; grid-template-columns: repeat(${cols}, ${w}px); gap: 12px; }
|
|
56
|
+
figure { margin: 0; }
|
|
57
|
+
img { display: block; width: ${w}px; height: ${h}px; outline: 1px solid #333; }
|
|
58
|
+
figcaption { padding: 4px 2px 0; }
|
|
59
|
+
</style><main>${cells}</main>`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const cmd: Command = {
|
|
63
|
+
summary: "장면 모음 한 장(PNG) — 그림 보는 모델에 넘길 것",
|
|
64
|
+
usage: `kf sheet <폴더> [--out 파일.png] [--per-scene 1] [--count N | --at 1,5.5,12] [--cols 4] [--width 480]
|
|
65
|
+
기본은 장면마다 가운데 한 장. 장면 표시가 없으면 고르게 12 장.
|
|
66
|
+
--per-scene 장면마다 몇 장(장면을 n+1 등분한 자리)
|
|
67
|
+
--count 장면과 상관없이 고르게 N 장
|
|
68
|
+
--at 찍을 시각(초)을 쉼표로
|
|
69
|
+
--lock-wait 다른 렌더가 잠금을 쥐고 있을 때 기다릴 초(기본 900)
|
|
70
|
+
--no-lock 잠금 없이(한두 장 시험용)`,
|
|
71
|
+
async run(argv) {
|
|
72
|
+
const { args, opts } = parseFlags(argv);
|
|
73
|
+
const dir = args[0];
|
|
74
|
+
if (!dir) {
|
|
75
|
+
console.error("kf sheet: 폴더를 줘라 — kf sheet <폴더>");
|
|
76
|
+
return 2;
|
|
77
|
+
}
|
|
78
|
+
// 여러 장 찍는 무거운 일이라 render·check 와 같이 레포 전체에서 하나씩
|
|
79
|
+
const release = opts["no-lock"] ? () => {} : await acquireRenderLock(resolve(dir), num(opts["lock-wait"], 900));
|
|
80
|
+
try {
|
|
81
|
+
return await shoot(dir, opts);
|
|
82
|
+
} finally {
|
|
83
|
+
release();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
export default cmd;
|
|
88
|
+
|
|
89
|
+
async function shoot(dir: string, opts: Record<string, string | boolean | undefined>): Promise<number> {
|
|
90
|
+
const s = await openSession(dir);
|
|
91
|
+
try {
|
|
92
|
+
const shots = pickTimes(s.info, opts);
|
|
93
|
+
// step 모드는 뒤로 못 가므로 시각 순서로 찍는다.
|
|
94
|
+
const order = [...shots].sort((a, b) => a.t - b.t);
|
|
95
|
+
const taken: { png: Buffer; t: number; label: string }[] = [];
|
|
96
|
+
for (const shot of order) {
|
|
97
|
+
await s.first.seek(shot.t);
|
|
98
|
+
taken.push({ ...shot, png: await s.first.capture() });
|
|
99
|
+
}
|
|
100
|
+
const { width, height } = s.info.meta;
|
|
101
|
+
const w = num(opts.width, height > width ? 270 : 480);
|
|
102
|
+
const h = Math.round((w * height) / width);
|
|
103
|
+
const cols = num(opts.cols, height > width ? 6 : 4);
|
|
104
|
+
const page = await s.context.newPage();
|
|
105
|
+
await page.setViewportSize({ width: 32 + cols * w + (cols - 1) * 12, height: 400 });
|
|
106
|
+
await page.setContent(sheetHtml(taken, cols, w, h), { waitUntil: "load" });
|
|
107
|
+
const file = outPath(dir, opts.out, "sheet.png");
|
|
108
|
+
writeFileSync(file, await page.screenshot({ fullPage: true, type: "png" }));
|
|
109
|
+
console.log(file);
|
|
110
|
+
return 0;
|
|
111
|
+
} finally {
|
|
112
|
+
await s.close();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { existsSync, lstatSync, mkdirSync, readlinkSync, symlinkSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { type Command, parseFlags } from "../command.ts";
|
|
6
|
+
|
|
7
|
+
const source = fileURLToPath(new URL("../../../../skills/kasaframe", import.meta.url));
|
|
8
|
+
|
|
9
|
+
const cmd: Command = {
|
|
10
|
+
summary: "Claude Code 스킬 — 말로 「영상 만들어」 하면 kasaframe 으로 가게 ~/.claude/skills/kasaframe 에 링크",
|
|
11
|
+
usage: `kf skill install [--to <스킬 폴더>] ~/.claude/skills/kasaframe → 레포 skills/kasaframe 링크(이미 있으면 덮지 않고 알린다)
|
|
12
|
+
kf skill path 스킬 원본 자리`,
|
|
13
|
+
async run(argv) {
|
|
14
|
+
const { args, opts } = parseFlags(argv);
|
|
15
|
+
if (args[0] === "path") {
|
|
16
|
+
console.log(source);
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
if (args[0] !== "install") {
|
|
20
|
+
console.error("kf skill install | path — kf skill --help");
|
|
21
|
+
return 2;
|
|
22
|
+
}
|
|
23
|
+
const to = typeof opts.to === "string" ? opts.to : join(homedir(), ".claude", "skills", "kasaframe");
|
|
24
|
+
if (existsSync(to) || isLink(to)) {
|
|
25
|
+
const what = isLink(to) ? `링크(${readlinkSync(to)})` : "폴더";
|
|
26
|
+
console.error(`${to} 가 이미 있다 — ${what}. 덮지 않는다. 바꾸려면 지우고 다시 kf skill install`);
|
|
27
|
+
return isLink(to) && readlinkSync(to) === source ? 0 : 1;
|
|
28
|
+
}
|
|
29
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
30
|
+
symlinkSync(source, to);
|
|
31
|
+
console.log(`${to} → ${source}\n새 Claude Code 세션부터 「영상 만들어」 같은 말에 kasaframe 스킬이 뜬다.`);
|
|
32
|
+
return 0;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function isLink(p: string): boolean {
|
|
37
|
+
try {
|
|
38
|
+
return lstatSync(p).isSymbolicLink();
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default cmd;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
import type { Command } from "../command.ts";
|
|
3
|
+
import { num, parseFlags } from "../command.ts";
|
|
4
|
+
import { openSession } from "../browser.ts";
|
|
5
|
+
import { fmtTime, outPath } from "../out.ts";
|
|
6
|
+
import { blurOpts, captureBlurred, rgbaToPng } from "../blur.ts";
|
|
7
|
+
|
|
8
|
+
const cmd: Command = {
|
|
9
|
+
summary: "한 시각을 PNG 한 장으로",
|
|
10
|
+
usage: `kf still <폴더> --t <초> [--out 파일.png]
|
|
11
|
+
--t 찍을 시각(초). --frame N 으로 프레임 번호를 줘도 된다
|
|
12
|
+
--out 기본 <폴더>/out/still-<t>.png
|
|
13
|
+
--motion-blur N --shutter 180 렌더와 같은 모션 블러(하위 프레임 N 장 평균)로 한 장
|
|
14
|
+
step 모드 페이지는 0 초부터 그 시각까지 돌린 뒤 찍는다.`,
|
|
15
|
+
async run(argv) {
|
|
16
|
+
const { args, opts } = parseFlags(argv);
|
|
17
|
+
const dir = args[0];
|
|
18
|
+
if (!dir) {
|
|
19
|
+
console.error("kf still: 폴더를 줘라 — kf still <폴더> --t 12.3");
|
|
20
|
+
return 2;
|
|
21
|
+
}
|
|
22
|
+
const s = await openSession(dir);
|
|
23
|
+
try {
|
|
24
|
+
const { fps } = s.info.meta;
|
|
25
|
+
const t = opts.frame !== undefined ? num(opts.frame, 0) / fps : num(opts.t, 0);
|
|
26
|
+
const file = outPath(dir, opts.out, `still-${fmtTime(t)}.png`);
|
|
27
|
+
const blur = blurOpts(opts);
|
|
28
|
+
if (blur && s.info.mode === "seek") writeFileSync(file, rgbaToPng(await captureBlurred(s.first, s.info, t, blur)));
|
|
29
|
+
else {
|
|
30
|
+
await s.first.seek(t);
|
|
31
|
+
writeFileSync(file, await s.first.capture());
|
|
32
|
+
}
|
|
33
|
+
console.log(file);
|
|
34
|
+
return 0;
|
|
35
|
+
} finally {
|
|
36
|
+
await s.close();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default cmd;
|