Skip to content

Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.

refactor: MCP workflow hints, re-encode for accuracy, split data from config

Nika Siradze9d7ba1e023fe
diff --git a/.gitignore b/.gitignore
index 2004503..f66b2c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,9 @@ __pycache__/
*.egg-info/
.pytest_cache/
+# DNN models (large binaries, downloaded by setup.sh)
+backend/models/*.caffemodel
+
# Media & temp files
*.mp4
*.mp3
diff --git a/README.md b/README.md
index b3a60d6..d1dfbb1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,14 @@
-# podcli
-
-AI-powered podcast clip generator. Takes a long-form podcast video, identifies viral moments, and exports upload-ready TikTok / YouTube Shorts (1080x1920, 9:16, burned captions, normalized audio).
+<p align="center">
+ <img src="public/podcli-icon.png" width="80" alt="podcli icon" />
+</p>
+<p align="center">
+ <img src="public/podcli-logo-transparent.png" height="36" alt="podcli" />
+</p>
+<p align="center">
+ AI-powered podcast clip generator. Takes a long-form podcast video, identifies viral moments, and exports upload-ready TikTok / YouTube Shorts (1080x1920, 9:16, burned captions, normalized audio).
+</p>
+
+---
## Features
diff --git a/backend/models/deploy.prototxt b/backend/models/deploy.prototxt
new file mode 100644
index 0000000..a128515
--- /dev/null
+++ b/backend/models/deploy.prototxt
@@ -0,0 +1,1790 @@
+input: "data"
+input_shape {
+ dim: 1
+ dim: 3
+ dim: 300
+ dim: 300
+}
+
+layer {
+ name: "data_bn"
+ type: "BatchNorm"
+ bottom: "data"
+ top: "data_bn"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "data_scale"
+ type: "Scale"
+ bottom: "data_bn"
+ top: "data_bn"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "conv1_h"
+ type: "Convolution"
+ bottom: "data_bn"
+ top: "conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 32
+ pad: 3
+ kernel_size: 7
+ stride: 2
+ weight_filler {
+ type: "msra"
+ variance_norm: FAN_OUT
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "conv1_bn_h"
+ type: "BatchNorm"
+ bottom: "conv1_h"
+ top: "conv1_h"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "conv1_scale_h"
+ type: "Scale"
+ bottom: "conv1_h"
+ top: "conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "conv1_relu"
+ type: "ReLU"
+ bottom: "conv1_h"
+ top: "conv1_h"
+}
+layer {
+ name: "conv1_pool"
+ type: "Pooling"
+ bottom: "conv1_h"
+ top: "conv1_pool"
+ pooling_param {
+ kernel_size: 3
+ stride: 2
+ }
+}
+layer {
+ name: "layer_64_1_conv1_h"
+ type: "Convolution"
+ bottom: "conv1_pool"
+ top: "layer_64_1_conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 32
+ bias_term: false
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_64_1_bn2_h"
+ type: "BatchNorm"
+ bottom: "layer_64_1_conv1_h"
+ top: "layer_64_1_conv1_h"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "layer_64_1_scale2_h"
+ type: "Scale"
+ bottom: "layer_64_1_conv1_h"
+ top: "layer_64_1_conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "layer_64_1_relu2"
+ type: "ReLU"
+ bottom: "layer_64_1_conv1_h"
+ top: "layer_64_1_conv1_h"
+}
+layer {
+ name: "layer_64_1_conv2_h"
+ type: "Convolution"
+ bottom: "layer_64_1_conv1_h"
+ top: "layer_64_1_conv2_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 32
+ bias_term: false
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_64_1_sum"
+ type: "Eltwise"
+ bottom: "layer_64_1_conv2_h"
+ bottom: "conv1_pool"
+ top: "layer_64_1_sum"
+}
+layer {
+ name: "layer_128_1_bn1_h"
+ type: "BatchNorm"
+ bottom: "layer_64_1_sum"
+ top: "layer_128_1_bn1_h"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "layer_128_1_scale1_h"
+ type: "Scale"
+ bottom: "layer_128_1_bn1_h"
+ top: "layer_128_1_bn1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "layer_128_1_relu1"
+ type: "ReLU"
+ bottom: "layer_128_1_bn1_h"
+ top: "layer_128_1_bn1_h"
+}
+layer {
+ name: "layer_128_1_conv1_h"
+ type: "Convolution"
+ bottom: "layer_128_1_bn1_h"
+ top: "layer_128_1_conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 128
+ bias_term: false
+ pad: 1
+ kernel_size: 3
+ stride: 2
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_128_1_bn2"
+ type: "BatchNorm"
+ bottom: "layer_128_1_conv1_h"
+ top: "layer_128_1_conv1_h"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "layer_128_1_scale2"
+ type: "Scale"
+ bottom: "layer_128_1_conv1_h"
+ top: "layer_128_1_conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "layer_128_1_relu2"
+ type: "ReLU"
+ bottom: "layer_128_1_conv1_h"
+ top: "layer_128_1_conv1_h"
+}
+layer {
+ name: "layer_128_1_conv2"
+ type: "Convolution"
+ bottom: "layer_128_1_conv1_h"
+ top: "layer_128_1_conv2"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 128
+ bias_term: false
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_128_1_conv_expand_h"
+ type: "Convolution"
+ bottom: "layer_128_1_bn1_h"
+ top: "layer_128_1_conv_expand_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 128
+ bias_term: false
+ pad: 0
+ kernel_size: 1
+ stride: 2
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_128_1_sum"
+ type: "Eltwise"
+ bottom: "layer_128_1_conv2"
+ bottom: "layer_128_1_conv_expand_h"
+ top: "layer_128_1_sum"
+}
+layer {
+ name: "layer_256_1_bn1"
+ type: "BatchNorm"
+ bottom: "layer_128_1_sum"
+ top: "layer_256_1_bn1"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "layer_256_1_scale1"
+ type: "Scale"
+ bottom: "layer_256_1_bn1"
+ top: "layer_256_1_bn1"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "layer_256_1_relu1"
+ type: "ReLU"
+ bottom: "layer_256_1_bn1"
+ top: "layer_256_1_bn1"
+}
+layer {
+ name: "layer_256_1_conv1"
+ type: "Convolution"
+ bottom: "layer_256_1_bn1"
+ top: "layer_256_1_conv1"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 256
+ bias_term: false
+ pad: 1
+ kernel_size: 3
+ stride: 2
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_256_1_bn2"
+ type: "BatchNorm"
+ bottom: "layer_256_1_conv1"
+ top: "layer_256_1_conv1"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "layer_256_1_scale2"
+ type: "Scale"
+ bottom: "layer_256_1_conv1"
+ top: "layer_256_1_conv1"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "layer_256_1_relu2"
+ type: "ReLU"
+ bottom: "layer_256_1_conv1"
+ top: "layer_256_1_conv1"
+}
+layer {
+ name: "layer_256_1_conv2"
+ type: "Convolution"
+ bottom: "layer_256_1_conv1"
+ top: "layer_256_1_conv2"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 256
+ bias_term: false
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_256_1_conv_expand"
+ type: "Convolution"
+ bottom: "layer_256_1_bn1"
+ top: "layer_256_1_conv_expand"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 256
+ bias_term: false
+ pad: 0
+ kernel_size: 1
+ stride: 2
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_256_1_sum"
+ type: "Eltwise"
+ bottom: "layer_256_1_conv2"
+ bottom: "layer_256_1_conv_expand"
+ top: "layer_256_1_sum"
+}
+layer {
+ name: "layer_512_1_bn1"
+ type: "BatchNorm"
+ bottom: "layer_256_1_sum"
+ top: "layer_512_1_bn1"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "layer_512_1_scale1"
+ type: "Scale"
+ bottom: "layer_512_1_bn1"
+ top: "layer_512_1_bn1"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "layer_512_1_relu1"
+ type: "ReLU"
+ bottom: "layer_512_1_bn1"
+ top: "layer_512_1_bn1"
+}
+layer {
+ name: "layer_512_1_conv1_h"
+ type: "Convolution"
+ bottom: "layer_512_1_bn1"
+ top: "layer_512_1_conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 128
+ bias_term: false
+ pad: 1
+ kernel_size: 3
+ stride: 1 # 2
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_512_1_bn2_h"
+ type: "BatchNorm"
+ bottom: "layer_512_1_conv1_h"
+ top: "layer_512_1_conv1_h"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "layer_512_1_scale2_h"
+ type: "Scale"
+ bottom: "layer_512_1_conv1_h"
+ top: "layer_512_1_conv1_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "layer_512_1_relu2"
+ type: "ReLU"
+ bottom: "layer_512_1_conv1_h"
+ top: "layer_512_1_conv1_h"
+}
+layer {
+ name: "layer_512_1_conv2_h"
+ type: "Convolution"
+ bottom: "layer_512_1_conv1_h"
+ top: "layer_512_1_conv2_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 256
+ bias_term: false
+ pad: 2 # 1
+ kernel_size: 3
+ stride: 1
+ dilation: 2
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_512_1_conv_expand_h"
+ type: "Convolution"
+ bottom: "layer_512_1_bn1"
+ top: "layer_512_1_conv_expand_h"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ convolution_param {
+ num_output: 256
+ bias_term: false
+ pad: 0
+ kernel_size: 1
+ stride: 1 # 2
+ weight_filler {
+ type: "msra"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0.0
+ }
+ }
+}
+layer {
+ name: "layer_512_1_sum"
+ type: "Eltwise"
+ bottom: "layer_512_1_conv2_h"
+ bottom: "layer_512_1_conv_expand_h"
+ top: "layer_512_1_sum"
+}
+layer {
+ name: "last_bn_h"
+ type: "BatchNorm"
+ bottom: "layer_512_1_sum"
+ top: "layer_512_1_sum"
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+ param {
+ lr_mult: 0.0
+ }
+}
+layer {
+ name: "last_scale_h"
+ type: "Scale"
+ bottom: "layer_512_1_sum"
+ top: "layer_512_1_sum"
+ param {
+ lr_mult: 1.0
+ decay_mult: 1.0
+ }
+ param {
+ lr_mult: 2.0
+ decay_mult: 1.0
+ }
+ scale_param {
+ bias_term: true
+ }
+}
+layer {
+ name: "last_relu"
+ type: "ReLU"
+ bottom: "layer_512_1_sum"
+ top: "fc7"
+}
+
+layer {
+ name: "conv6_1_h"
+ type: "Convolution"
+ bottom: "fc7"
+ top: "conv6_1_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 128
+ pad: 0
+ kernel_size: 1
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv6_1_relu"
+ type: "ReLU"
+ bottom: "conv6_1_h"
+ top: "conv6_1_h"
+}
+layer {
+ name: "conv6_2_h"
+ type: "Convolution"
+ bottom: "conv6_1_h"
+ top: "conv6_2_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 256
+ pad: 1
+ kernel_size: 3
+ stride: 2
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv6_2_relu"
+ type: "ReLU"
+ bottom: "conv6_2_h"
+ top: "conv6_2_h"
+}
+layer {
+ name: "conv7_1_h"
+ type: "Convolution"
+ bottom: "conv6_2_h"
+ top: "conv7_1_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 64
+ pad: 0
+ kernel_size: 1
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv7_1_relu"
+ type: "ReLU"
+ bottom: "conv7_1_h"
+ top: "conv7_1_h"
+}
+layer {
+ name: "conv7_2_h"
+ type: "Convolution"
+ bottom: "conv7_1_h"
+ top: "conv7_2_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 128
+ pad: 1
+ kernel_size: 3
+ stride: 2
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv7_2_relu"
+ type: "ReLU"
+ bottom: "conv7_2_h"
+ top: "conv7_2_h"
+}
+layer {
+ name: "conv8_1_h"
+ type: "Convolution"
+ bottom: "conv7_2_h"
+ top: "conv8_1_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 64
+ pad: 0
+ kernel_size: 1
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv8_1_relu"
+ type: "ReLU"
+ bottom: "conv8_1_h"
+ top: "conv8_1_h"
+}
+layer {
+ name: "conv8_2_h"
+ type: "Convolution"
+ bottom: "conv8_1_h"
+ top: "conv8_2_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 128
+ pad: 0
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv8_2_relu"
+ type: "ReLU"
+ bottom: "conv8_2_h"
+ top: "conv8_2_h"
+}
+layer {
+ name: "conv9_1_h"
+ type: "Convolution"
+ bottom: "conv8_2_h"
+ top: "conv9_1_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 64
+ pad: 0
+ kernel_size: 1
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv9_1_relu"
+ type: "ReLU"
+ bottom: "conv9_1_h"
+ top: "conv9_1_h"
+}
+layer {
+ name: "conv9_2_h"
+ type: "Convolution"
+ bottom: "conv9_1_h"
+ top: "conv9_2_h"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 128
+ pad: 0
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv9_2_relu"
+ type: "ReLU"
+ bottom: "conv9_2_h"
+ top: "conv9_2_h"
+}
+layer {
+ name: "conv4_3_norm"
+ type: "Normalize"
+ bottom: "layer_256_1_bn1"
+ top: "conv4_3_norm"
+ norm_param {
+ across_spatial: false
+ scale_filler {
+ type: "constant"
+ value: 20
+ }
+ channel_shared: false
+ }
+}
+layer {
+ name: "conv4_3_norm_mbox_loc"
+ type: "Convolution"
+ bottom: "conv4_3_norm"
+ top: "conv4_3_norm_mbox_loc"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 16
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv4_3_norm_mbox_loc_perm"
+ type: "Permute"
+ bottom: "conv4_3_norm_mbox_loc"
+ top: "conv4_3_norm_mbox_loc_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv4_3_norm_mbox_loc_flat"
+ type: "Flatten"
+ bottom: "conv4_3_norm_mbox_loc_perm"
+ top: "conv4_3_norm_mbox_loc_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv4_3_norm_mbox_conf"
+ type: "Convolution"
+ bottom: "conv4_3_norm"
+ top: "conv4_3_norm_mbox_conf"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 8 # 84
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv4_3_norm_mbox_conf_perm"
+ type: "Permute"
+ bottom: "conv4_3_norm_mbox_conf"
+ top: "conv4_3_norm_mbox_conf_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv4_3_norm_mbox_conf_flat"
+ type: "Flatten"
+ bottom: "conv4_3_norm_mbox_conf_perm"
+ top: "conv4_3_norm_mbox_conf_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv4_3_norm_mbox_priorbox"
+ type: "PriorBox"
+ bottom: "conv4_3_norm"
+ bottom: "data"
+ top: "conv4_3_norm_mbox_priorbox"
+ prior_box_param {
+ min_size: 30.0
+ max_size: 60.0
+ aspect_ratio: 2
+ flip: true
+ clip: false
+ variance: 0.1
+ variance: 0.1
+ variance: 0.2
+ variance: 0.2
+ step: 8
+ offset: 0.5
+ }
+}
+layer {
+ name: "fc7_mbox_loc"
+ type: "Convolution"
+ bottom: "fc7"
+ top: "fc7_mbox_loc"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 24
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "fc7_mbox_loc_perm"
+ type: "Permute"
+ bottom: "fc7_mbox_loc"
+ top: "fc7_mbox_loc_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "fc7_mbox_loc_flat"
+ type: "Flatten"
+ bottom: "fc7_mbox_loc_perm"
+ top: "fc7_mbox_loc_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "fc7_mbox_conf"
+ type: "Convolution"
+ bottom: "fc7"
+ top: "fc7_mbox_conf"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 12 # 126
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "fc7_mbox_conf_perm"
+ type: "Permute"
+ bottom: "fc7_mbox_conf"
+ top: "fc7_mbox_conf_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "fc7_mbox_conf_flat"
+ type: "Flatten"
+ bottom: "fc7_mbox_conf_perm"
+ top: "fc7_mbox_conf_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "fc7_mbox_priorbox"
+ type: "PriorBox"
+ bottom: "fc7"
+ bottom: "data"
+ top: "fc7_mbox_priorbox"
+ prior_box_param {
+ min_size: 60.0
+ max_size: 111.0
+ aspect_ratio: 2
+ aspect_ratio: 3
+ flip: true
+ clip: false
+ variance: 0.1
+ variance: 0.1
+ variance: 0.2
+ variance: 0.2
+ step: 16
+ offset: 0.5
+ }
+}
+layer {
+ name: "conv6_2_mbox_loc"
+ type: "Convolution"
+ bottom: "conv6_2_h"
+ top: "conv6_2_mbox_loc"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 24
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv6_2_mbox_loc_perm"
+ type: "Permute"
+ bottom: "conv6_2_mbox_loc"
+ top: "conv6_2_mbox_loc_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv6_2_mbox_loc_flat"
+ type: "Flatten"
+ bottom: "conv6_2_mbox_loc_perm"
+ top: "conv6_2_mbox_loc_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv6_2_mbox_conf"
+ type: "Convolution"
+ bottom: "conv6_2_h"
+ top: "conv6_2_mbox_conf"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 12 # 126
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv6_2_mbox_conf_perm"
+ type: "Permute"
+ bottom: "conv6_2_mbox_conf"
+ top: "conv6_2_mbox_conf_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv6_2_mbox_conf_flat"
+ type: "Flatten"
+ bottom: "conv6_2_mbox_conf_perm"
+ top: "conv6_2_mbox_conf_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv6_2_mbox_priorbox"
+ type: "PriorBox"
+ bottom: "conv6_2_h"
+ bottom: "data"
+ top: "conv6_2_mbox_priorbox"
+ prior_box_param {
+ min_size: 111.0
+ max_size: 162.0
+ aspect_ratio: 2
+ aspect_ratio: 3
+ flip: true
+ clip: false
+ variance: 0.1
+ variance: 0.1
+ variance: 0.2
+ variance: 0.2
+ step: 32
+ offset: 0.5
+ }
+}
+layer {
+ name: "conv7_2_mbox_loc"
+ type: "Convolution"
+ bottom: "conv7_2_h"
+ top: "conv7_2_mbox_loc"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 24
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv7_2_mbox_loc_perm"
+ type: "Permute"
+ bottom: "conv7_2_mbox_loc"
+ top: "conv7_2_mbox_loc_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv7_2_mbox_loc_flat"
+ type: "Flatten"
+ bottom: "conv7_2_mbox_loc_perm"
+ top: "conv7_2_mbox_loc_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv7_2_mbox_conf"
+ type: "Convolution"
+ bottom: "conv7_2_h"
+ top: "conv7_2_mbox_conf"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 12 # 126
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv7_2_mbox_conf_perm"
+ type: "Permute"
+ bottom: "conv7_2_mbox_conf"
+ top: "conv7_2_mbox_conf_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv7_2_mbox_conf_flat"
+ type: "Flatten"
+ bottom: "conv7_2_mbox_conf_perm"
+ top: "conv7_2_mbox_conf_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv7_2_mbox_priorbox"
+ type: "PriorBox"
+ bottom: "conv7_2_h"
+ bottom: "data"
+ top: "conv7_2_mbox_priorbox"
+ prior_box_param {
+ min_size: 162.0
+ max_size: 213.0
+ aspect_ratio: 2
+ aspect_ratio: 3
+ flip: true
+ clip: false
+ variance: 0.1
+ variance: 0.1
+ variance: 0.2
+ variance: 0.2
+ step: 64
+ offset: 0.5
+ }
+}
+layer {
+ name: "conv8_2_mbox_loc"
+ type: "Convolution"
+ bottom: "conv8_2_h"
+ top: "conv8_2_mbox_loc"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 16
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv8_2_mbox_loc_perm"
+ type: "Permute"
+ bottom: "conv8_2_mbox_loc"
+ top: "conv8_2_mbox_loc_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv8_2_mbox_loc_flat"
+ type: "Flatten"
+ bottom: "conv8_2_mbox_loc_perm"
+ top: "conv8_2_mbox_loc_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv8_2_mbox_conf"
+ type: "Convolution"
+ bottom: "conv8_2_h"
+ top: "conv8_2_mbox_conf"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 8 # 84
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv8_2_mbox_conf_perm"
+ type: "Permute"
+ bottom: "conv8_2_mbox_conf"
+ top: "conv8_2_mbox_conf_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv8_2_mbox_conf_flat"
+ type: "Flatten"
+ bottom: "conv8_2_mbox_conf_perm"
+ top: "conv8_2_mbox_conf_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv8_2_mbox_priorbox"
+ type: "PriorBox"
+ bottom: "conv8_2_h"
+ bottom: "data"
+ top: "conv8_2_mbox_priorbox"
+ prior_box_param {
+ min_size: 213.0
+ max_size: 264.0
+ aspect_ratio: 2
+ flip: true
+ clip: false
+ variance: 0.1
+ variance: 0.1
+ variance: 0.2
+ variance: 0.2
+ step: 100
+ offset: 0.5
+ }
+}
+layer {
+ name: "conv9_2_mbox_loc"
+ type: "Convolution"
+ bottom: "conv9_2_h"
+ top: "conv9_2_mbox_loc"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 16
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv9_2_mbox_loc_perm"
+ type: "Permute"
+ bottom: "conv9_2_mbox_loc"
+ top: "conv9_2_mbox_loc_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv9_2_mbox_loc_flat"
+ type: "Flatten"
+ bottom: "conv9_2_mbox_loc_perm"
+ top: "conv9_2_mbox_loc_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv9_2_mbox_conf"
+ type: "Convolution"
+ bottom: "conv9_2_h"
+ top: "conv9_2_mbox_conf"
+ param {
+ lr_mult: 1
+ decay_mult: 1
+ }
+ param {
+ lr_mult: 2
+ decay_mult: 0
+ }
+ convolution_param {
+ num_output: 8 # 84
+ pad: 1
+ kernel_size: 3
+ stride: 1
+ weight_filler {
+ type: "xavier"
+ }
+ bias_filler {
+ type: "constant"
+ value: 0
+ }
+ }
+}
+layer {
+ name: "conv9_2_mbox_conf_perm"
+ type: "Permute"
+ bottom: "conv9_2_mbox_conf"
+ top: "conv9_2_mbox_conf_perm"
+ permute_param {
+ order: 0
+ order: 2
+ order: 3
+ order: 1
+ }
+}
+layer {
+ name: "conv9_2_mbox_conf_flat"
+ type: "Flatten"
+ bottom: "conv9_2_mbox_conf_perm"
+ top: "conv9_2_mbox_conf_flat"
+ flatten_param {
+ axis: 1
+ }
+}
+layer {
+ name: "conv9_2_mbox_priorbox"
+ type: "PriorBox"
+ bottom: "conv9_2_h"
+ bottom: "data"
+ top: "conv9_2_mbox_priorbox"
+ prior_box_param {
+ min_size: 264.0
+ max_size: 315.0
+ aspect_ratio: 2
+ flip: true
+ clip: false
+ variance: 0.1
+ variance: 0.1
+ variance: 0.2
+ variance: 0.2
+ step: 300
+ offset: 0.5
+ }
+}
+layer {
+ name: "mbox_loc"
+ type: "Concat"
+ bottom: "conv4_3_norm_mbox_loc_flat"
+ bottom: "fc7_mbox_loc_flat"
+ bottom: "conv6_2_mbox_loc_flat"
+ bottom: "conv7_2_mbox_loc_flat"
+ bottom: "conv8_2_mbox_loc_flat"
+ bottom: "conv9_2_mbox_loc_flat"
+ top: "mbox_loc"
+ concat_param {
+ axis: 1
+ }
+}
+layer {
+ name: "mbox_conf"
+ type: "Concat"
+ bottom: "conv4_3_norm_mbox_conf_flat"
+ bottom: "fc7_mbox_conf_flat"
+ bottom: "conv6_2_mbox_conf_flat"
+ bottom: "conv7_2_mbox_conf_flat"
+ bottom: "conv8_2_mbox_conf_flat"
+ bottom: "conv9_2_mbox_conf_flat"
+ top: "mbox_conf"
+ concat_param {
+ axis: 1
+ }
+}
+layer {
+ name: "mbox_priorbox"
+ type: "Concat"
+ bottom: "conv4_3_norm_mbox_priorbox"
+ bottom: "fc7_mbox_priorbox"
+ bottom: "conv6_2_mbox_priorbox"
+ bottom: "conv7_2_mbox_priorbox"
+ bottom: "conv8_2_mbox_priorbox"
+ bottom: "conv9_2_mbox_priorbox"
+ top: "mbox_priorbox"
+ concat_param {
+ axis: 2
+ }
+}
+
+layer {
+ name: "mbox_conf_reshape"
+ type: "Reshape"
+ bottom: "mbox_conf"
+ top: "mbox_conf_reshape"
+ reshape_param {
+ shape {
+ dim: 0
+ dim: -1
+ dim: 2
+ }
+ }
+}
+layer {
+ name: "mbox_conf_softmax"
+ type: "Softmax"
+ bottom: "mbox_conf_reshape"
+ top: "mbox_conf_softmax"
+ softmax_param {
+ axis: 2
+ }
+}
+layer {
+ name: "mbox_conf_flatten"
+ type: "Flatten"
+ bottom: "mbox_conf_softmax"
+ top: "mbox_conf_flatten"
+ flatten_param {
+ axis: 1
+ }
+}
+
+layer {
+ name: "detection_out"
+ type: "DetectionOutput"
+ bottom: "mbox_loc"
+ bottom: "mbox_conf_flatten"
+ bottom: "mbox_priorbox"
+ top: "detection_out"
+ include {
+ phase: TEST
+ }
+ detection_output_param {
+ num_classes: 2
+ share_location: true
+ background_label_id: 0
+ nms_param {
+ nms_threshold: 0.45
+ top_k: 400
+ }
+ code_type: CENTER_SIZE
+ keep_top_k: 200
+ confidence_threshold: 0.01
+ clip: 1
+ }
+}
diff --git a/backend/services/caption_renderer.py b/backend/services/caption_renderer.py
index a8b843b..b8177c2 100644
--- a/backend/services/caption_renderer.py
+++ b/backend/services/caption_renderer.py
@@ -259,6 +259,10 @@ def _render_branded(words: list[dict], style: dict, offset: float) -> str:
Branded style — large bold text, dark rounded box on the active word.
Each chunk shows ~4 words. For each word's duration, that word gets a
dark background box (BorderStyle=3) while the others stay plain white.
+
+ IMPORTANT: Dialogue lines are made contiguous — each word's display extends
+ to the next word's start (not its own end). This prevents flashing/gaps
+ between words that cause the entire text to disappear and reappear.
"""
header = generate_branded_header(style)
events = []
@@ -289,12 +293,21 @@ def _render_branded(words: list[dict], style: dict, offset: float) -> str:
normalized.append(text)
# For each word in the chunk, emit a dialogue line for its active window
- # where THAT word has a dark box and the rest are plain
+ # where THAT word has a dark box and the rest are plain.
+ # Key: each word's display extends to the NEXT word's start (contiguous)
+ # to prevent flashing/gaps between words.
for wi, w in enumerate(chunk):
w_start = max(0, w["start"] - offset)
- w_end = max(0, w["end"] - offset)
+
+ # End at next word's start (contiguous) instead of this word's end (gaps)
+ if wi < len(chunk) - 1:
+ w_end = max(0, chunk[wi + 1]["start"] - offset)
+ else:
+ # Last word in chunk: extend to chunk end
+ w_end = chunk_end
+
if w_end <= w_start:
- continue
+ w_end = w_start + 0.1 # minimum display time
# Build line: all words visible, active one gets box override
parts = []
@@ -303,8 +316,9 @@ def _render_branded(words: list[dict], style: dict, offset: float) -> str:
# Active word: dark rounded box background, white text
# BorderStyle=3: \4c = box fill color, \3c = box border
# \xbord/\ybord = horizontal/vertical padding around text
+ # \bord with higher value creates visible rounded-ish box
parts.append(
- f"{{\\4c{box_color}\\3c{box_color}\\xbord14\\ybord8\\bord1\\shad0}}{text}{{\\4c&H00000000&\\3c&H00000000&\\xbord0\\ybord0\\bord0}}"
+ f"{{\\4c{box_color}\\3c{box_color}\\xbord18\\ybord10\\bord4\\shad0}}{text}{{\\4c&H00000000&\\3c&H00000000&\\xbord0\\ybord0\\bord0}}"
)
else:
parts.append(text)
@@ -318,7 +332,4 @@ def _render_branded(words: list[dict], style: dict, offset: float) -> str:
f"Dialogue: 0,{start_ts},{end_ts},BrandedNormal,,0,0,0,,{line_text}"
)
- # Also show the chunk text in the gap between chunks (if any)
- # This ensures words stay visible for the full chunk duration
-
return header + "\n".join(events) + "\n"
diff --git a/backend/services/clip_generator.py b/backend/services/clip_generator.py
index a91df77..aabdfcf 100644
--- a/backend/services/clip_generator.py
+++ b/backend/services/clip_generator.py
@@ -32,17 +32,11 @@ _FILLER_WORDS = frozenset([
def _clean_transcript_words(words: list[dict]) -> list[dict]:
"""
- Remove filler words and trim large gaps from transcript.
+ Remove filler words from transcript captions.
- Strips obvious filler words (um, uh, hmm, etc.) so they don't appear in captions.
- - Caps gaps between consecutive words: if a gap exceeds MAX_GAP, the next word's
- start is pulled forward so captions don't hang on empty silence.
- - Not aggressive — only removes standalone fillers, preserves natural pacing.
+ - Does NOT shift timestamps — word timing must match the actual audio exactly.
"""
- MAX_GAP = 1.5 # seconds — gaps larger than this get compressed
- COMPRESSED_GAP = 0.3 # seconds — what large gaps shrink to
-
- # Step 1: Remove filler words
cleaned = []
for w in words:
text = w.get("word", "").strip()
@@ -52,30 +46,7 @@ def _clean_transcript_words(words: list[dict]) -> list[dict]:
continue
cleaned.append(w)
- if not cleaned:
- return cleaned
-
- # Step 2: Compress large gaps by shifting timestamps forward
- # This tightens the caption timing without affecting the video itself
- result = [cleaned[0]]
- time_shift = 0.0
-
- for i in range(1, len(cleaned)):
- prev_end = cleaned[i - 1]["end"]
- curr_start = cleaned[i]["start"]
- gap = curr_start - prev_end
-
- if gap > MAX_GAP:
- # Compress this gap — shift everything after it forward
- time_shift += gap - COMPRESSED_GAP
-
- result.append({
- **cleaned[i],
- "start": cleaned[i]["start"] - time_shift,
- "end": cleaned[i]["end"] - time_shift,
- })
-
- return result
+ return cleaned
def generate_clip(
diff --git a/backend/services/video_processor.py b/backend/services/video_processor.py
index 36e6e9e..66a14ce 100644
--- a/backend/services/video_processor.py
+++ b/backend/services/video_processor.py
@@ -73,7 +73,10 @@ def cut_segment(
) -> str:
"""
Extract a time segment from a video file.
- Uses -ss before -i for fast seeking.
+ Uses -ss before -i with re-encoding for frame-accurate timestamps.
+ Stream-copy (-c copy) snaps to keyframes which can be seconds off,
+ causing caption-audio desync. Re-encoding with ultrafast is still
+ fast and guarantees the output starts at exactly the requested time.
"""
duration = end_second - start_second
@@ -82,7 +85,8 @@ def cut_segment(
"-ss", str(start_second),
"-i", input_path,
"-t", str(duration),
- "-c", "copy", # No re-encoding for speed
+ "-c:v", "libx264", "-crf", "18", "-preset", "ultrafast",
+ "-c:a", "aac", "-b:a", "192k",
"-avoid_negative_ts", "make_zero",
output_path,
]
@@ -454,10 +458,20 @@ def _detect_face_offset(
# Try DNN detector first (much more robust than Haar cascades)
dnn_detector = None
- proto_path = os.path.join(os.path.dirname(cv2.__file__), "data",
- "deploy.prototxt")
- model_path = os.path.join(os.path.dirname(cv2.__file__), "data",
- "res10_300x300_ssd_iter_140000.caffemodel")
+
+ # Look for bundled DNN model first, then fall back to OpenCV's data dir
+ backend_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ bundled_proto = os.path.join(backend_dir, "models", "deploy.prototxt")
+ bundled_model = os.path.join(backend_dir, "models",
+ "res10_300x300_ssd_iter_140000.caffemodel")
+ cv2_proto = os.path.join(os.path.dirname(cv2.__file__), "data",
+ "deploy.prototxt")
+ cv2_model = os.path.join(os.path.dirname(cv2.__file__), "data",
+ "res10_300x300_ssd_iter_140000.caffemodel")
+
+ proto_path = bundled_proto if os.path.exists(bundled_proto) else cv2_proto
+ model_path = bundled_model if os.path.exists(bundled_model) else cv2_model
+
if os.path.exists(proto_path) and os.path.exists(model_path):
dnn_detector = cv2.dnn.readNetFromCaffe(proto_path, model_path)
@@ -494,10 +508,16 @@ def _detect_face_offset(
best_cx = None
for i in range(detections.shape[2]):
confidence = detections[0, 0, i, 2]
- if confidence > 0.3:
+ if confidence > 0.5: # Higher threshold to reduce false positives
x1 = int(detections[0, 0, i, 3] * w)
+ y1 = int(detections[0, 0, i, 4] * h)
x2 = int(detections[0, 0, i, 5] * w)
+ y2 = int(detections[0, 0, i, 6] * h)
face_w = x2 - x1
+ face_h = y2 - y1
+ # Skip tiny detections (likely false positives)
+ if face_w < w * 0.05 or face_h < h * 0.05:
+ continue
# Quadratic face-size weighting: strongly favor larger/closer faces
score = confidence * (face_w ** 2)
if score > best_score:
@@ -553,15 +573,10 @@ def _detect_face_offset(
# Sort clusters by size (largest first)
clusters.sort(key=lambda c: len(c), reverse=True)
- # If top cluster is clearly dominant (>50% more detections), use it
- # Otherwise pick the cluster whose center is closest to frame center
- if len(clusters) == 1 or len(clusters[0]) > len(clusters[1]) * 1.5:
- best_cluster = clusters[0]
- else:
- # Two roughly equal clusters = two speakers.
- # Pick the one closer to frame center for a safer crop.
- frame_center = width / 2
- best_cluster = min(clusters[:2], key=lambda c: abs(np.median(c) - frame_center))
+ # Always pick the largest cluster (most frequently detected face).
+ # This ensures we lock onto the dominant speaker rather than
+ # splitting the crop between two equally-visible speakers.
+ best_cluster = clusters[0]
avg_face_x = int(np.median(best_cluster))
diff --git a/public/podcli-icon-transparent.png b/public/podcli-icon-transparent.png
new file mode 100644
index 0000000..8420b9b
Binary files /dev/null and b/public/podcli-icon-transparent.png differ
diff --git a/public/podcli-icon.png b/public/podcli-icon.png
new file mode 100644
index 0000000..609d086
Binary files /dev/null and b/public/podcli-icon.png differ
diff --git a/public/podcli-logo-full.png b/public/podcli-logo-full.png
new file mode 100644
index 0000000..dabe271
Binary files /dev/null and b/public/podcli-logo-full.png differ
diff --git a/public/podcli-logo-transparent.png b/public/podcli-logo-transparent.png
new file mode 100644
index 0000000..e5ad86a
Binary files /dev/null and b/public/podcli-logo-transparent.png differ
diff --git a/setup.sh b/setup.sh
index ef6cac1..0bb3358 100755
--- a/setup.sh
+++ b/setup.sh
@@ -60,8 +60,25 @@ install() {
echo ""
echo "━━━ [2/6] Creating directories ━━━"
CLIPPER_HOME="${PODCLI_HOME:-$SCRIPT_DIR/.podcli}"
- mkdir -p "$CLIPPER_HOME"/{cache/transcripts,working,working/uploads,output,logs,assets,history,knowledge}
- echo " ✓ $CLIPPER_HOME"
+ DATA_DIR="${PODCLI_DATA:-$SCRIPT_DIR/data}"
+ mkdir -p "$CLIPPER_HOME"/{assets,history,knowledge}
+ mkdir -p "$DATA_DIR"/{cache/transcripts,working,working/uploads,output,logs}
+ echo " ✓ $CLIPPER_HOME (internal)"
+ echo " ✓ $DATA_DIR (output & cache)"
+
+ # Download DNN face detection model if missing
+ MODEL_DIR="$SCRIPT_DIR/backend/models"
+ mkdir -p "$MODEL_DIR"
+ if [ ! -f "$MODEL_DIR/res10_300x300_ssd_iter_140000.caffemodel" ]; then
+ echo " ↓ Downloading face detection model..."
+ curl -sL -o "$MODEL_DIR/deploy.prototxt" \
+ "https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt"
+ curl -sL -o "$MODEL_DIR/res10_300x300_ssd_iter_140000.caffemodel" \
+ "https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20170830/res10_300x300_ssd_iter_140000.caffemodel"
+ echo " ✓ Face detection model ready"
+ else
+ echo " ✓ Face detection model exists"
+ fi
echo ""
echo "━━━ [3/6] Python virtual environment ━━━"
diff --git a/src/config/paths.ts b/src/config/paths.ts
index b84d1d5..04c5df8 100644
--- a/src/config/paths.ts
+++ b/src/config/paths.ts
@@ -3,18 +3,23 @@ import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
-// Project-local .podcli directory (next to package.json)
+// Project root (next to package.json)
const projectRoot = join(__dirname, "..", "..");
-const home =
- process.env.PODCLI_HOME || join(projectRoot, ".podcli");
+
+// Visible data/ directory for outputs and user-facing data
+const dataDir = process.env.PODCLI_DATA || join(projectRoot, "data");
+
+// Internal .podcli directory for caches, state, and config
+const home = process.env.PODCLI_HOME || join(projectRoot, ".podcli");
export const paths = {
home,
- cache: join(home, "cache"),
- transcripts: join(home, "cache", "transcripts"),
- working: join(home, "working"),
- output: join(home, "output"),
- logs: join(home, "logs"),
+ projectRoot,
+ cache: join(dataDir, "cache"),
+ transcripts: join(dataDir, "cache", "transcripts"),
+ working: join(dataDir, "working"),
+ output: join(dataDir, "output"),
+ logs: join(dataDir, "logs"),
assets: join(home, "assets"),
assetsRegistry: join(home, "assets", "registry.json"),
history: join(home, "history"),
diff --git a/src/handlers/batch-clips.handler.ts b/src/handlers/batch-clips.handler.ts
index 4586461..c30e12e 100644
--- a/src/handlers/batch-clips.handler.ts
+++ b/src/handlers/batch-clips.handler.ts
@@ -18,10 +18,11 @@ function loadState(): Record<string, unknown> | null {
export const batchClipsToolDef = {
name: "batch_create_clips",
description:
- "Create multiple short-form clips in one batch.\n\n" +
- "EASIEST: pass export_selected=true to export all selected clips, " +
- "or clip_numbers=[1, 3, 5] for specific clips — " +
- "everything is loaded from session state automatically.",
+ "STEP 3 — Export multiple clips at once as finished vertical shorts.\n\n" +
+ "EASIEST: pass export_selected=true to export all selected clips in one go.\n" +
+ "Alternative: pass clip_numbers=[1, 3, 5] for specific ones.\n" +
+ "Everything (video, timestamps, settings) auto-loads from session state.\n\n" +
+ "Each clip gets: 9:16 vertical crop, burned-in captions, normalized audio, H.264 MP4.",
inputSchema: {
type: "object" as const,
properties: {
diff --git a/src/handlers/create-clip.handler.ts b/src/handlers/create-clip.handler.ts
index 39abf67..f2b2739 100644
--- a/src/handlers/create-clip.handler.ts
+++ b/src/handlers/create-clip.handler.ts
@@ -19,11 +19,12 @@ function loadState(): Record<string, unknown> | null {
export const createClipToolDef = {
name: "create_clip",
description:
- "Create a finished short-form video clip ready for TikTok/YouTube Shorts. " +
- "Crops to 9:16 vertical (1080x1920), burns styled captions, normalizes audio to -14 LUFS, exports H.264 MP4.\n\n" +
- "EASIEST: just pass clip_number (e.g. 3) to export a suggested clip — " +
- "video_path, timestamps, transcript_words, and title are all loaded from session state automatically.\n\n" +
- "You can also pass explicit start_second/end_second/video_path/transcript_words to override.",
+ "STEP 3 — Export a single clip as a finished vertical short (1080x1920, 9:16).\n\n" +
+ "EASIEST: just pass clip_number (e.g. 3) — everything else auto-loads from session state.\n" +
+ "Output: H.264 MP4 with burned-in captions, normalized audio (-14 LUFS).\n\n" +
+ "For batch export, use batch_create_clips instead.\n" +
+ "Caption styles: branded (professional), hormozi (bold/yellow), karaoke (progressive highlight), subtle (minimal).\n" +
+ "Crop modes: face (follows the speaker), center (fixed center crop).",
inputSchema: {
type: "object" as const,
properties: {
diff --git a/src/handlers/suggest-clips.handler.ts b/src/handlers/suggest-clips.handler.ts
index bf93499..16e119b 100644
--- a/src/handlers/suggest-clips.handler.ts
+++ b/src/handlers/suggest-clips.handler.ts
@@ -10,10 +10,13 @@ import { randomUUID } from "crypto";
export const suggestClipsToolDef = {
name: "suggest_clips",
description:
- "Store and structure clip suggestions from transcript analysis. " +
- "Use after analyzing a transcript to format suggested viral moments " +
- "with timestamps, titles, and reasoning. Claude should analyze the " +
- "transcript first, then call this tool to present suggestions to the user.",
+ "STEP 2 — Submit your clip suggestions after analyzing the transcript.\n\n" +
+ "Before calling this: read the transcript via get_ui_state(include_transcript: true) " +
+ "and identify the best viral moments.\n\n" +
+ "What it does: Stores your suggestions, assigns clip numbers (#1, #2, etc.), " +
+ "and pushes them to the Web UI for the user to review.\n\n" +
+ "After this: the user reviews in the UI. Then export with " +
+ "batch_create_clips(export_selected: true) or create_clip(clip_number: N).",
inputSchema: {
type: "object" as const,
properties: {
diff --git a/src/handlers/transcribe.handler.ts b/src/handlers/transcribe.handler.ts
index 72026f6..5ba4ab0 100644
--- a/src/handlers/transcribe.handler.ts
+++ b/src/handlers/transcribe.handler.ts
@@ -8,10 +8,13 @@ const cache = new TranscriptCache();
export const transcribeToolDef = {
name: "transcribe_podcast",
description:
- "Transcribe a podcast video/audio file with word-level timestamps and automatic " +
- "speaker detection. Identifies who is speaking when (supports 2-5 speakers). " +
- "Returns structured transcript with word timing and speaker labels. " +
- "Supports MP4, MOV, WebM, MKV, MP3, WAV.",
+ "STEP 1 — Transcribe a podcast video/audio file. This is typically the first tool you call.\n\n" +
+ "What it does: Uses Whisper AI for word-level timestamps + pyannote for speaker detection (who said what).\n" +
+ "Returns: Full transcript with word timing, speaker labels, and segments.\n" +
+ "Caching: Results are cached by file hash — same file won't be re-transcribed.\n" +
+ "Supported formats: MP4, MOV, WebM, MKV, MP3, WAV.\n\n" +
+ "After transcription: call get_ui_state(include_transcript: true) to read the transcript, " +
+ "then analyze it for viral moments and call suggest_clips.",
inputSchema: {
type: "object" as const,
properties: {
diff --git a/src/server.ts b/src/server.ts
index a19f750..0906de9 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -27,6 +27,95 @@ async function withKnowledge(result: string): Promise<string> {
}
}
+/** Append a workflow next-step hint to a tool result. */
+function withNextStep(result: string, nextStep: string): string {
+ return `${result}\n\n---\n[Next Step] ${nextStep}`;
+}
+
+/** Read UI state from the web server, returns null if unavailable. */
+async function readUIState(): Promise<Record<string, unknown> | null> {
+ try {
+ const res = await fetch("http://localhost:3847/api/ui-state");
+ if (!res.ok) return null;
+ return await res.json() as Record<string, unknown>;
+ } catch {
+ return null;
+ }
+}
+
+/** Generate workflow guidance based on current state. */
+async function getWorkflowGuidance(): Promise<string> {
+ const state = await readUIState();
+ if (!state) {
+ return (
+ "WORKFLOW — Start from scratch:\n" +
+ "1. Set the video: use set_video or transcribe_podcast with a file path\n" +
+ "2. Get a transcript: use transcribe_podcast (auto) or import_transcript / parse_transcript\n" +
+ "3. Read the transcript: use get_ui_state(include_transcript: true)\n" +
+ "4. Suggest clips: analyze the transcript yourself, then call suggest_clips with your picks\n" +
+ "5. Export: use batch_create_clips(export_selected: true) or create_clip(clip_number: N)\n\n" +
+ "Note: The Web UI is not running. Start it with: npm run ui"
+ );
+ }
+
+ const phase = state.phase as string || "idle";
+ const hasVideo = !!(state.videoPath || state.filePath);
+ const wordCount = state.transcriptWordCount as number || 0;
+ const hasTranscript = wordCount > 0;
+ const rawText = state.rawTranscriptText as string || "";
+ const hasRawTranscript = rawText.length > 0;
+ const suggestions = (state.suggestions as unknown[]) || [];
+ const deselected = (state.deselectedIndices as number[]) || [];
+ const selectedCount = suggestions.length - deselected.length;
+
+ const lines: string[] = [];
+
+ if (!hasVideo) {
+ lines.push(
+ "NEXT: No video loaded yet. To begin:\n" +
+ " → Use transcribe_podcast(file_path: \"/path/to/episode.mp4\") to transcribe and set the video in one step\n" +
+ " → Or use set_video(file_path: ...) if you'll import a transcript separately"
+ );
+ } else if (!hasTranscript && !hasRawTranscript) {
+ lines.push(
+ `NEXT: Video is loaded but no transcript yet.\n` +
+ ` → Use transcribe_podcast(file_path: \"${state.videoPath}\") to auto-transcribe with Whisper\n` +
+ ` → Or the user can paste a transcript in the Web UI and you can read it with get_ui_state(include_transcript: true)`
+ );
+ } else if (hasRawTranscript && !hasTranscript) {
+ lines.push(
+ "NEXT: Raw transcript text is available but not yet parsed.\n" +
+ " → Use get_ui_state(include_transcript: true) to read the raw text\n" +
+ " → Then use parse_transcript to get word-level timestamps\n" +
+ " → Or analyze the text directly and call suggest_clips with your findings"
+ );
+ } else if (hasTranscript && suggestions.length === 0) {
+ lines.push(
+ `NEXT: Transcript is ready (${wordCount} words). Time to find viral moments!\n` +
+ " → Use get_ui_state(include_transcript: true) to read the full transcript\n" +
+ " → Analyze it for the most engaging, viral-worthy moments\n" +
+ " → Then call suggest_clips with your suggestions (title, start_second, end_second, reasoning)"
+ );
+ } else if (phase === "review" && selectedCount > 0) {
+ lines.push(
+ `NEXT: ${selectedCount} clips are ready for export!\n` +
+ " → Use batch_create_clips(export_selected: true) to export all selected clips at once\n" +
+ " → Or use create_clip(clip_number: N) to export a specific one\n" +
+ " → Use modify_clip to adjust timing or titles before export\n" +
+ " → Use toggle_clip to select/deselect clips"
+ );
+ } else if (phase === "done" || phase === "idle" && suggestions.length > 0) {
+ lines.push(
+ "DONE: Clips have been exported!\n" +
+ " → Use list_outputs to see all rendered clips\n" +
+ " → Use get_ui_state(include_transcript: true) to find more moments\n" +
+ " → Try different caption styles (hormozi, karaoke, subtle, branded) for variety"
+ );
+ }
+
+ return lines.join("\n");
+}
+
export function createServer(): McpServer {
const server = new McpServer({
name: "podcli",
@@ -60,7 +149,28 @@ export function createServer(): McpServer {
async ({ file_path, model_size, language, enable_diarization, num_speakers }) => {
try {
const result = await handleTranscribe({ file_path, model_size, language, enable_diarization, num_speakers });
- return { content: [{ type: "text" as const, text: await withKnowledge(result) }] };
+
+ // Push transcript to Web UI state
+ try {
+ const parsed = JSON.parse(result);
+ await fetch("http://localhost:3847/api/ui-state", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ videoPath: file_path,
+ filePath: file_path,
+ transcript: parsed,
+ phase: "idle",
+ }),
+ });
+ } catch {}
+
+ const text = withNextStep(
+ await withKnowledge(result),
+ "Transcript is ready! Now read it with get_ui_state(include_transcript: true), " +
+ "analyze it for viral moments, then call suggest_clips with your findings."
+ );
+ return { content: [{ type: "text" as const, text }] };
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
return {
@@ -116,6 +226,17 @@ export function createServer(): McpServer {
).join("\n");
text += `\n\n[Previously Created Clips — avoid duplicates]\n${summary}`;
}
+
+ const parsed2 = JSON.parse(result);
+ const clipCount = parsed2.clip_count || 0;
+ text = withNextStep(
+ text,
+ `${clipCount} clips suggested and sent to the UI! The user can review them in the Web UI.\n` +
+ " → To export all at once: batch_create_clips(export_selected: true)\n" +
+ " → To export specific ones: create_clip(clip_number: 1) or batch_create_clips(clip_numbers: [1, 3, 5])\n" +
+ " → To adjust: modify_clip(clip_number: N, updates: {start_second: ..., end_second: ...})\n" +
+ " → To remove one: toggle_clip(clip_number: N, selected: false)"
+ );
return { content: [{ type: "text" as const, text }] };
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
@@ -197,24 +318,99 @@ export function createServer(): McpServer {
};
}
- const result = await handleCreateClip(params);
- const parsed = JSON.parse(result);
-
- // Record to history
- await history.record({
- source_video: params.video_path as string,
- start_second: params.start_second as number,
- end_second: params.end_second as number,
- caption_style: (params.caption_style || "hormozi") as string,
- crop_strategy: (params.crop_strategy || "face") as string,
- logo_path: params.logo_path as string | undefined,
- title: (params.title || "clip") as string,
- output_path: parsed.output_path,
- file_size_mb: parsed.file_size_mb,
- duration: parsed.duration,
- });
+ // Route through web server for real-time UI progress tracking
+ let usedWebServer = false;
+ let finalResult = "";
+ try {
+ const webRes = await fetch("http://localhost:3847/api/mcp/export", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ video_path: params.video_path,
+ clips: [{
+ start_second: params.start_second,
+ end_second: params.end_second,
+ title: (params.title || "clip") as string,
+ caption_style: params.caption_style || "hormozi",
+ crop_strategy: params.crop_strategy || "face",
+ }],
+ transcript_words: params.transcript_words,
+ logo_path: params.logo_path || null,
+ outro_path: params.outro_path || null,
+ }),
+ });
+ if (webRes.ok) {
+ const webData = await webRes.json() as any;
+ const jobId = webData.job_id;
+
+ // Poll the job until completion
+ while (true) {
+ await new Promise((r) => setTimeout(r, 2000));
+ const pollRes = await fetch(`http://localhost:3847/api/job/${jobId}`);
+ if (!pollRes.ok) break;
+ const job = await pollRes.json() as any;
+ if (job.status === "done") {
+ usedWebServer = true;
+ finalResult = JSON.stringify(job.result, null, 2);
+ break;
+ }
+ if (job.status === "error") {
+ throw new Error(job.error || "Job failed");
+ }
+ }
+ }
+ } catch (webErr: unknown) {
+ const webMsg = webErr instanceof Error ? webErr.message : String(webErr);
+ if (!webMsg.includes("ECONNREFUSED") && !webMsg.includes("fetch failed")) {
+ // Unexpected error — still try direct fallback
+ }
+ }
+
+ if (!usedWebServer) {
+ // Notify UI that export is starting
+ try {
+ await fetch("http://localhost:3847/api/ui-state", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ phase: "exporting" }),
+ });
+ } catch {}
+
+ finalResult = await handleCreateClip(params);
+ const parsed = JSON.parse(finalResult);
+
+ // Record to history
+ await history.record({
+ source_video: params.video_path as string,
+ start_second: params.start_second as number,
+ end_second: params.end_second as number,
+ caption_style: (params.caption_style || "hormozi") as string,
+ crop_strategy: (params.crop_strategy || "face") as string,
+ logo_path: params.logo_path as string | undefined,
+ title: (params.title || "clip") as string,
+ output_path: parsed.output_path,
+ file_size_mb: parsed.file_size_mb,
+ duration: parsed.duration,
+ });
+
+ // Notify UI that export is done
+ try {
+ await fetch("http://localhost:3847/api/ui-state", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ phase: "done" }),
+ });
+ } catch {}
+ }
- return { content: [{ type: "text" as const, text: result }] };
+ const clipText = withNextStep(
+ finalResult,
+ "Clip exported to data/output/! You can:\n" +
+ " → Export more: create_clip(clip_number: N) or batch_create_clips(export_selected: true)\n" +
+ " → List all outputs: list_outputs\n" +
+ " → Try a different style: create_clip(clip_number: N, caption_style: \"karaoke\")"
+ );
+ return { content: [{ type: "text" as const, text: clipText }] };
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
return {
@@ -258,7 +454,9 @@ export function createServer(): McpServer {
async (params) => {
try {
// Try routing through web server for real-time UI progress
+ // The web server handles SSE broadcasts (export-started, job-update, job-complete)
let usedWebServer = false;
+ let finalResult: string = "";
try {
const webRes = await fetch("http://localhost:3847/api/mcp/export", {
method: "POST",
@@ -274,37 +472,40 @@ export function createServer(): McpServer {
const jobId = webData.job_id;
// Poll the job until completion
- let jobResult: any = null;
while (true) {
await new Promise((r) => setTimeout(r, 2000));
const pollRes = await fetch(`http://localhost:3847/api/job/${jobId}`);
if (!pollRes.ok) break;
const job = await pollRes.json() as any;
if (job.status === "done") {
- jobResult = job.result;
+ usedWebServer = true;
+ finalResult = JSON.stringify(job.result, null, 2);
break;
}
if (job.status === "error") {
throw new Error(job.error || "Job failed");
}
}
-
- if (jobResult) {
- usedWebServer = true;
- return { content: [{ type: "text" as const, text: JSON.stringify(jobResult, null, 2) }] };
- }
}
} catch (webErr: unknown) {
- // Web server not running or errored — fall back to direct execution
const webMsg = webErr instanceof Error ? webErr.message : String(webErr);
if (!webMsg.includes("ECONNREFUSED") && !webMsg.includes("fetch failed")) {
- // Unexpected error from web server, still try fallback
+ // Unexpected error — still try fallback
}
}
if (!usedWebServer) {
- const result = await handleBatchClips(params);
- const parsed = JSON.parse(result);
+ // Fallback: run directly without web server (no UI progress)
+ try {
+ await fetch("http://localhost:3847/api/ui-state", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ phase: "exporting" }),
+ });
+ } catch {}
+
+ finalResult = await handleBatchClips(params);
+ const parsed = JSON.parse(finalResult);
// Record each successful clip
if (parsed.results) {
@@ -325,11 +526,32 @@ export function createServer(): McpServer {
}
}
- return { content: [{ type: "text" as const, text: result }] };
+ try {
+ await fetch("http://localhost:3847/api/ui-state", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ phase: "done" }),
+ });
+ } catch {}
}
- return { content: [{ type: "text" as const, text: "Export completed via web server." }] };
+ const batchText = withNextStep(
+ finalResult,
+ "Batch export complete! Clips are in data/output/. You can:\n" +
+ " → Use list_outputs to see all rendered clips with file sizes\n" +
+ " → Find more moments: get_ui_state(include_transcript: true) and suggest_clips again\n" +
+ " → Re-export with different styles: update_settings then batch_create_clips(export_selected: true)"
+ );
+ return { content: [{ type: "text" as const, text: batchText }] };
} catch (err: unknown) {
+ // Notify UI of error
+ try {
+ await fetch("http://localhost:3847/api/ui-state", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ phase: "review" }),
+ });
+ } catch {}
const msg = err instanceof Error ? err.message : String(err);
return {
content: [{ type: "text" as const, text: `Error: ${msg}` }],
@@ -484,13 +706,15 @@ export function createServer(): McpServer {
// =============================================
server.tool(
"get_ui_state",
- "Read the current podcli session state — clips, video path, settings, phase. " +
+ "Read the current podcli session state and get guidance on what to do next. " +
+ "Returns: video path, transcript status, clip suggestions, settings, and workflow next steps.\n\n" +
+ "IMPORTANT: Call this FIRST when starting a new conversation to understand the current state.\n" +
"Clips are numbered #1, #2, etc. Use these numbers with create_clip(clip_number), " +
"batch_create_clips(clip_numbers), modify_clip, and toggle_clip.\n\n" +
- "Set include_transcript=true only when you need to analyze transcript content (e.g. for suggesting clips).",
+ "Set include_transcript=true when you need to analyze transcript content (e.g. for suggesting clips).",
{
include_transcript: z.boolean().optional().default(false).describe(
- "Include full transcript segments in the response. Only set true when analyzing content for clip suggestions."
+ "Include full transcript segments in the response. Set true when analyzing content for clip suggestions."
),
},
async ({ include_transcript }) => {
@@ -526,11 +750,6 @@ export function createServer(): McpServer {
const tag = deselected.includes(i) ? " [DESELECTED]" : "";
lines.push(` #${num}: "${title}" (${start}s–${end}s, ${duration}) [${style}]${tag}`);
}
- lines.push("");
- lines.push(`To export: create_clip(clip_number: N) or batch_create_clips(clip_numbers: [1, 3, 5])`);
- if (selectedCount > 0 && selectedCount < allSuggestions.length) {
- lines.push(`To export all selected: batch_create_clips(export_selected: true)`);
- }
}
if (include_transcript) {
@@ -554,12 +773,19 @@ export function createServer(): McpServer {
}
}
+ // Append workflow guidance
+ const guidance = await getWorkflowGuidance();
+ lines.push("");
+ lines.push("---");
+ lines.push(guidance);
+
return { content: [{ type: "text" as const, text: lines.join("\n") }] };
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
if (msg.includes("ECONNREFUSED") || msg.includes("fetch failed")) {
+ const guidance = await getWorkflowGuidance();
return {
- content: [{ type: "text" as const, text: "Web UI is not running. Start with: npm run ui" }],
+ content: [{ type: "text" as const, text: `Web UI is not running. Start with: npm run ui\n\n${guidance}` }],
};
}
return {
@@ -575,7 +801,8 @@ export function createServer(): McpServer {
// =============================================
server.tool(
"modify_clip",
- "Modify or delete a suggested clip by clip_number. Use action='delete' to remove a clip entirely.",
+ "Adjust a suggested clip before exporting. Change timing, title, or caption style. " +
+ "Use action='delete' to remove a clip entirely. Reference clips by clip_number (from get_ui_state).",
{
clip_number: z.number().optional().describe("Clip number (1-based, from get_ui_state)"),
clip_id: z.string().optional().describe("UUID of the clip (alternative to clip_number)"),
@@ -971,7 +1198,8 @@ export function createServer(): McpServer {
// =============================================
server.tool(
"set_video",
- "Set the working video file in the UI without transcribing it. Validates the file exists and updates the UI state.",
+ "Set the working video file without transcribing. Use this when you'll import a transcript separately. " +
+ "After this, either transcribe_podcast or import a transcript via import_transcript / parse_transcript.",
{
file_path: z.string().describe("Absolute path to the video file"),
},
@@ -996,12 +1224,12 @@ export function createServer(): McpServer {
body: JSON.stringify({ videoPath: file_path, filePath: file_path }),
});
- return {
- content: [{
- type: "text" as const,
- text: `Video set: ${fileInfo.filename} (${fileInfo.size_mb} MB). Use transcribe_podcast to transcribe it.`,
- }],
- };
+ const setText = withNextStep(
+ `Video set: ${fileInfo.filename} (${fileInfo.size_mb} MB)`,
+ `Now transcribe it: transcribe_podcast(file_path: "${file_path}")\n` +
+ " Or if the user pastes a transcript in the UI, read it with get_ui_state(include_transcript: true)"
+ );
+ return { content: [{ type: "text" as const, text: setText }] };
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
if (msg.includes("ECONNREFUSED") || msg.includes("fetch failed")) {
@@ -1066,12 +1294,12 @@ export function createServer(): McpServer {
const wordCount = result.data?.words?.length || 0;
const duration = result.data?.duration || 0;
- return {
- content: [{
- type: "text" as const,
- text: `Transcript imported: ${wordCount} words, ${Math.round(duration)}s duration. UI updated to review phase.`,
- }],
- };
+ const importText = withNextStep(
+ `Transcript imported: ${wordCount} words, ${Math.round(duration)}s duration.`,
+ "Now read the transcript with get_ui_state(include_transcript: true), " +
+ "analyze it for viral moments, then call suggest_clips with your picks."
+ );
+ return { content: [{ type: "text" as const, text: importText }] };
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
if (msg.includes("ECONNREFUSED") || msg.includes("fetch failed")) {
@@ -1122,12 +1350,12 @@ export function createServer(): McpServer {
const wordCount = result.data?.words?.length || 0;
const segCount = result.data?.segments?.length || 0;
- return {
- content: [{
- type: "text" as const,
- text: `Transcript parsed: ${wordCount} words, ${segCount} segments. UI updated to review phase.`,
- }],
- };
+ const parseText = withNextStep(
+ `Transcript parsed: ${wordCount} words, ${segCount} segments.`,
+ "Now read the transcript with get_ui_state(include_transcript: true), " +
+ "analyze it for viral moments, then call suggest_clips with your picks."
+ );
+ return { content: [{ type: "text" as const, text: parseText }] };
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
if (msg.includes("ECONNREFUSED") || msg.includes("fetch failed")) {
@@ -1138,5 +1366,65 @@ export function createServer(): McpServer {
}
);
+ // =============================================
+ // MCP Prompt: workflow guide
+ // =============================================
+ server.prompt(
+ "workflow",
+ "Complete podcli workflow guide — from podcast file to finished clips",
+ async () => ({
+ messages: [{
+ role: "user" as const,
+ content: {
+ type: "text" as const,
+ text: [
+ "You are a podcast clip extraction assistant using podcli MCP tools.",
+ "Follow this workflow to create viral short-form clips from podcasts:",
+ "",
+ "## Step 1: Check current state",
+ "Call get_ui_state() to see what's already loaded (video, transcript, clips).",
+ "",
+ "## Step 2: Load the podcast",
+ "If no video is set, use transcribe_podcast(file_path: \"/path/to/file.mp4\") to transcribe.",
+ "This both sets the video AND generates a transcript with word-level timestamps.",
+ "If the user already pasted a transcript in the UI, you can skip to Step 3.",
+ "",
+ "## Step 3: Read the transcript",
+ "Call get_ui_state(include_transcript: true) to read the full transcript.",
+ "Also check if there's a knowledge base with podcast context (host names, show style, etc).",
+ "",
+ "## Step 4: Analyze and suggest clips",
+ "Read through the transcript carefully. Look for:",
+ "- Controversial or surprising statements",
+ "- Strong emotional moments (laughter, passion, anger)",
+ "- Clear actionable advice or insights",
+ "- Story hooks and cliffhangers",
+ "- Quotable one-liners",
+ "- Questions that hook the viewer",
+ "",
+ "For each moment, note the start/end timestamps and craft a catchy title.",
+ "Aim for 30-90 second clips. Then call suggest_clips with your picks.",
+ "",
+ "## Step 5: Export",
+ "Call batch_create_clips(export_selected: true) to render all clips.",
+ "Or use create_clip(clip_number: N) for individual clips.",
+ "",
+ "## Available caption styles:",
+ "- branded: Professional look with dark highlight box, gradient, optional logo",
+ "- hormozi: Bold uppercase, yellow highlight, high energy pop-on reveal",
+ "- karaoke: Full sentence visible, words progressively highlight",
+ "- subtle: Clean minimal white text, no effects",
+ "",
+ "## Tips:",
+ "- Use modify_clip to adjust timing before export",
+ "- Use toggle_clip to select/deselect clips",
+ "- Use update_settings to change the default caption style or crop strategy",
+ "- The user can review and adjust clips in the Web UI at http://localhost:3847",
+ ].join("\n"),
+ },
+ }],
+ })
+ );
+
return server;
}
diff --git a/src/ui/public/css/styles.css b/src/ui/public/css/styles.css
new file mode 100644
index 0000000..8c99a4c
--- /dev/null
+++ b/src/ui/public/css/styles.css
@@ -0,0 +1,584 @@
+/* ─── podcli — Shared Styles ─── */
+
+:root {
+ --bg: #0b0b0d;
+ --surface: #131316;
+ --surface2: #1b1b20;
+ --border: #252530;
+ --border-hover: #35354a;
+ --text: #e8e8e2;
+ --text2: #77776f;
+ --text3: #4e4e48;
+ --accent: #d4874a;
+ --accent-hover: #e09860;
+ --accent-subtle: rgba(212, 135, 74, 0.10);
+ --accent-glow: rgba(212, 135, 74, 0.25);
+ --green: #4ade80;
+ --green-subtle: rgba(74, 222, 128, 0.07);
+ --green-border: rgba(74, 222, 128, 0.18);
+ --red: #f87171;
+ --red-subtle: rgba(248, 113, 113, 0.07);
+ --red-border: rgba(248, 113, 113, 0.18);
+ --blue: #60a5fa;
+ --blue-subtle: rgba(96, 165, 250, 0.08);
+ --blue-border: rgba(96, 165, 250, 0.18);
+ --radius: 12px;
+ --radius-sm: 8px;
+ --ease: cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+* { margin: 0; padding: 0; box-sizing: border-box; }
+
+body {
+ font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
+ background: var(--bg); color: var(--text); min-height: 100vh;
+ -webkit-font-smoothing: antialiased;
+}
+
+/* ─── Layout ─── */
+.app { max-width: 1080px; margin: 0 auto; padding: 48px 32px 96px; }
+.header { margin-bottom: 36px; }
+.logo { font-size: 13px; font-weight: 700; letter-spacing: 1.2px; color: var(--text3); margin-bottom: 10px; text-transform: uppercase; text-decoration: none; }
+.logo span { color: var(--accent); }
+h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
+.layout { display: grid; grid-template-columns: 1fr 340px; gap: 40px; align-items: start; }
+.main-col { min-width: 0; }
+.preview-col { position: relative; }
+
+/* ─── Preview Panel ─── */
+.preview-panel { position: sticky; top: 32px; }
+.preview-player {
+ background: #000; border: 1px solid var(--border);
+ border-radius: var(--radius); overflow: hidden; position: relative;
+}
+.preview-player video {
+ width: 100%; display: block; background: #000;
+}
+.preview-player video.vertical {
+ max-height: 480px; width: auto; margin: 0 auto;
+}
+.preview-empty {
+ aspect-ratio: 16/9; display: flex; flex-direction: column;
+ align-items: center; justify-content: center; gap: 8px;
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius); color: var(--text3); font-size: 13px;
+}
+.preview-empty .pe-icon { font-size: 28px; opacity: 0.3; }
+
+/* ─── Style Preview (vertical phone mockup) ─── */
+.style-preview {
+ aspect-ratio: 9/16; width: 100%;
+ background: #111114; border: 1px solid var(--border);
+ border-radius: var(--radius); overflow: hidden;
+ position: relative; user-select: none;
+}
+.style-preview .sp-bg {
+ position: absolute; inset: 0;
+ background:
+ radial-gradient(ellipse at 35% 30%, rgba(80,60,40,0.18) 0%, transparent 60%),
+ radial-gradient(ellipse at 65% 55%, rgba(50,50,70,0.12) 0%, transparent 50%),
+ linear-gradient(180deg, #16161a 0%, #111114 100%);
+}
+.style-preview .sp-person {
+ position: absolute; top: 18%; left: 50%; transform: translateX(-50%);
+ width: 55%; aspect-ratio: 3/4;
+ background: radial-gradient(ellipse at 50% 35%, rgba(140,120,100,0.15) 0%, rgba(80,70,60,0.06) 60%, transparent 80%);
+ border-radius: 50% 50% 44% 44%;
+}
+.style-preview .sp-gradient {
+ position: absolute; bottom: 0; left: 0; right: 0; height: 55%;
+ background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
+ pointer-events: none;
+}
+.style-preview .sp-captions {
+ position: absolute; left: 0; right: 0;
+ display: flex; flex-direction: column; align-items: center;
+ padding: 0 20px; text-align: center;
+ font-family: Arial, Helvetica, sans-serif;
+ line-height: 1.35; transition: all 0.3s var(--ease);
+}
+.style-preview .sp-word {
+ display: inline; transition: all 0.25s var(--ease);
+}
+.style-preview .sp-logo {
+ position: absolute; top: 14px; left: 14px;
+ width: 32px; height: 32px; border-radius: 7px;
+ overflow: hidden;
+}
+.preview-clip-range {
+ padding: 8px 12px; background: var(--surface);
+ border-top: 1px solid var(--border);
+ font-size: 12px; color: var(--text2);
+ display: flex; align-items: center; justify-content: space-between;
+}
+.preview-clip-range .clip-name {
+ font-weight: 600; color: var(--text);
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
+ max-width: 200px;
+}
+.preview-back {
+ padding: 0; background: none; border: none; color: var(--accent);
+ font-family: inherit; font-size: 12px; font-weight: 600;
+ cursor: pointer; transition: opacity 0.15s;
+}
+.preview-back:hover { opacity: 0.7; }
+.preview-settings {
+ margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px;
+}
+.preview-tag {
+ display: inline-flex; align-items: center; gap: 5px;
+ padding: 5px 10px; background: var(--surface);
+ border: 1px solid var(--border); border-radius: 8px;
+ font-size: 11px; color: var(--text2); font-weight: 500;
+ transition: all 0.2s var(--ease);
+}
+.preview-tag strong { color: var(--text); font-weight: 600; text-transform: capitalize; }
+.preview-tag.changed { border-color: var(--accent); background: var(--accent-subtle); }
+
+/* ─── Sections ─── */
+.section { margin-bottom: 24px; }
+.section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; color: var(--text2); margin-bottom: 10px; text-transform: uppercase; }
+
+/* ─── Form Elements ─── */
+input[type="text"], input[type="number"], select, textarea {
+ width: 100%; background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius); padding: 11px 14px;
+ color: var(--text); font-family: inherit; font-size: 14px;
+ outline: none; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
+}
+input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
+ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle);
+}
+textarea {
+ font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
+ font-size: 12px; resize: vertical; min-height: 120px; line-height: 1.7;
+}
+select {
+ appearance: none; cursor: pointer; padding-right: 34px;
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2377776f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
+ background-repeat: no-repeat; background-position: right 14px center;
+}
+
+/* ─── Buttons ─── */
+.btn {
+ padding: 10px 18px; border-radius: var(--radius); font-family: inherit;
+ font-size: 13px; font-weight: 600; cursor: pointer; border: none;
+ transition: all 0.15s var(--ease); display: inline-flex;
+ align-items: center; justify-content: center; gap: 6px; text-decoration: none;
+}
+.btn:active:not(:disabled) { transform: scale(0.97); }
+.btn-primary { background: var(--accent); color: #fff; }
+.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
+.btn-primary:disabled { opacity: 0.25; cursor: not-allowed; }
+.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
+.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }
+.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
+.btn-go {
+ width: 100%; padding: 14px; font-size: 15px; justify-content: center;
+ background: var(--accent); color: #fff; border-radius: var(--radius);
+}
+.btn-go:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 4px 24px var(--accent-glow); }
+.btn-go:disabled { opacity: 0.25; cursor: not-allowed; }
+.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
+.pill-blue { background: var(--accent-subtle); color: var(--accent); }
+
+/* ─── Drop Zone ─── */
+.drop-zone {
+ border: 1.5px dashed var(--border); border-radius: var(--radius);
+ padding: 32px 20px; text-align: center; cursor: pointer;
+ transition: all 0.2s var(--ease); position: relative; overflow: hidden;
+}
+.drop-zone:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.012); }
+.drop-zone.drag-over { border-color: var(--accent); background: var(--accent-subtle); box-shadow: 0 0 0 4px var(--accent-subtle); }
+.drop-zone.uploading { border-color: var(--accent); border-style: solid; pointer-events: none; }
+.drop-zone .icon { font-size: 28px; margin-bottom: 8px; opacity: 0.35; line-height: 1; }
+.drop-zone .label { font-size: 13px; color: var(--text2); line-height: 1.5; }
+.drop-zone .label strong { color: var(--accent); font-weight: 600; }
+.drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
+.upload-bar { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--accent); border-radius: 0 2px 2px 0; transition: width 0.25s var(--ease); }
+.drop-zone .dz-icon { font-size: 28px; opacity: 0.3; margin-bottom: 8px; }
+.drop-zone .dz-text { font-size: 13px; color: var(--text2); line-height: 1.5; }
+.drop-zone .dz-text strong { color: var(--accent); font-weight: 600; }
+
+/* ─── File Badge ─── */
+.file-badge {
+ display: flex; align-items: center; gap: 10px;
+ padding: 10px 14px; background: var(--green-subtle);
+ border: 1px solid var(--green-border); border-radius: var(--radius);
+}
+.file-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
+.file-badge .name { font-size: 13px; color: var(--green); font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.file-badge .meta { font-size: 11px; color: var(--text2); flex-shrink: 0; }
+
+/* ─── Tabs ─── */
+.tabs { display: flex; gap: 2px; background: var(--surface); border-radius: var(--radius); padding: 3px; margin-bottom: 14px; }
+.tab {
+ flex: 1; text-align: center; padding: 8px 12px;
+ border-radius: calc(var(--radius) - 3px); font-size: 13px;
+ font-weight: 600; color: var(--text2); cursor: pointer;
+ transition: all 0.2s var(--ease); user-select: none;
+}
+.tab:hover:not(.active) { color: var(--text); }
+.tab.active { background: var(--accent); color: #fff; }
+
+/* ─── Settings ─── */
+.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
+.field-label { font-size: 11px; color: var(--text2); font-weight: 600; display: block; margin-bottom: 6px; }
+.row { display: flex; gap: 10px; align-items: flex-end; }
+.row > * { flex: 1; }
+
+/* ─── Asset pills ─── */
+.asset-pill {
+ display: inline-flex; align-items: center; gap: 6px;
+ padding: 5px 8px 5px 10px; background: var(--surface2);
+ border: 1px solid var(--border); border-radius: 20px;
+ font-size: 12px; color: var(--text); max-width: 200px;
+}
+.asset-pill-icon { display: flex; align-items: center; flex-shrink: 0; color: var(--text2); }
+.asset-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
+.asset-pill-x {
+ display: flex; align-items: center; justify-content: center;
+ width: 18px; height: 18px; border-radius: 50%; border: none;
+ background: transparent; color: var(--text3); font-size: 14px;
+ cursor: pointer; flex-shrink: 0; padding: 0; line-height: 1;
+ transition: all 0.15s var(--ease);
+}
+.asset-pill-x:hover { background: var(--surface); color: var(--red); }
+.asset-add {
+ display: inline-flex; align-items: center; gap: 4px;
+ padding: 5px 12px; background: transparent;
+ border: 1px dashed var(--border); border-radius: 20px;
+ font-size: 12px; color: var(--text3); cursor: pointer;
+ font-family: inherit; font-weight: 500;
+ transition: all 0.15s var(--ease);
+}
+.asset-add:hover:not(:disabled) { border-color: var(--border-hover); color: var(--text2); }
+
+/* ─── Overflow menu ─── */
+.overflow-menu {
+ position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
+ background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
+ padding: 4px; min-width: 120px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
+}
+.overflow-menu-label {
+ padding: 6px 10px 4px; font-size: 10px; font-weight: 600;
+ color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px;
+}
+.overflow-menu-item {
+ display: block; width: 100%; text-align: left; padding: 6px 10px;
+ background: none; border: none; color: var(--text2); font-size: 12px;
+ font-family: inherit; cursor: pointer; border-radius: 6px;
+ transition: all 0.1s var(--ease);
+}
+.overflow-menu-item:hover { background: var(--surface2); color: var(--text); }
+
+/* ─── Progress ─── */
+.progress-track { background: var(--surface2); border-radius: 4px; height: 4px; overflow: hidden; margin: 8px 0; }
+.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s var(--ease); }
+.progress-fill.indeterminate { width: 35% !important; animation: shimmer 1.4s ease-in-out infinite; }
+.status-line { font-size: 13px; color: var(--text2); display: flex; justify-content: space-between; }
+.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; flex-shrink: 0; }
+.spinner.sm { width: 14px; height: 14px; border-width: 1.5px; }
+
+/* ─── Clip List ─── */
+.clip-item {
+ display: flex; align-items: center; gap: 12px;
+ padding: 12px 14px; margin-bottom: 4px;
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius); transition: all 0.15s var(--ease);
+ cursor: pointer;
+}
+.clip-item:hover { border-color: var(--border-hover); }
+.clip-item.dimmed { opacity: 0.35; }
+.clip-item.active-clip { border-color: rgba(212, 135, 74, 0.3); background: rgba(212, 135, 74, 0.03); }
+.clip-item.selected { border-color: var(--accent); background: rgba(212, 135, 74, 0.04); }
+.checkbox {
+ width: 20px; height: 20px; border-radius: 6px;
+ border: 1.5px solid var(--border); display: flex;
+ align-items: center; justify-content: center;
+ cursor: pointer; transition: all 0.15s var(--ease); flex-shrink: 0;
+}
+.checkbox:hover { border-color: var(--accent); }
+.checkbox.checked { background: var(--accent); border-color: var(--accent); }
+.clip-info { flex: 1; min-width: 0; }
+.clip-title { font-size: 13px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.clip-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
+.clip-meta .err { color: var(--red); }
+.clip-actions { display: flex; gap: 4px; flex-shrink: 0; }
+.clip-status { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 700; }
+.clip-status.pending { border: 1.5px dashed var(--border); }
+.clip-status.rendering { border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.6s linear infinite; }
+.clip-status.exported { background: var(--green-subtle); color: var(--green); }
+.status-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; }
+.status-dot.ok { background: var(--green-subtle); color: var(--green); }
+.status-dot.fail { background: var(--red-subtle); color: var(--red); }
+
+/* ─── Error ─── */
+.error-bar { padding: 12px 16px; background: var(--red-subtle); border: 1px solid var(--red-border); border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; color: var(--red); display: flex; align-items: center; gap: 10px; }
+.error-bar span { flex: 1; }
+.spacer { height: 1px; background: var(--border); margin: 28px 0; opacity: 0.4; }
+
+/* ─── Modal ─── */
+.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 1000; display: flex; align-items: center; justify-content: center; cursor: pointer; animation: fadeIn 0.15s var(--ease); }
+.modal-body { max-width: 380px; width: 92%; cursor: default; animation: scaleIn 0.2s var(--ease); }
+.modal-body video { width: 100%; border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,0.5); }
+
+/* ─── Animations ─── */
+.fade-in { animation: fadeIn 0.3s var(--ease); }
+@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
+@keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(4px); } to { opacity: 1; transform: none; } }
+@keyframes spin { to { transform: rotate(360deg); } }
+@keyframes shimmer { 0% { transform: translateX(-120%); } 100% { transform: translateX(350%); } }
+@keyframes clipReveal { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
+.clip-reveal { animation: clipReveal 0.35s var(--ease) both; }
+@keyframes tagFlash { 0% { border-color: var(--accent); background: var(--accent-subtle); } 100% { border-color: var(--border); background: var(--surface); } }
+
+/* ─── MCP Hints ─── */
+.mcp-hints {
+ margin-top: 20px;
+ padding: 16px; background: var(--surface);
+ border: 1px solid var(--border); border-radius: var(--radius);
+ animation: fadeIn 0.3s var(--ease);
+}
+.mcp-hints-header {
+ display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
+}
+.mcp-hints-icon {
+ width: 20px; height: 20px; border-radius: 6px;
+ background: linear-gradient(135deg, #7c5ae0 0%, #a855f7 100%);
+ display: flex; align-items: center; justify-content: center;
+ font-size: 10px; color: #fff; font-weight: 800; flex-shrink: 0;
+}
+.mcp-hints-title {
+ font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
+ color: var(--text2); text-transform: uppercase;
+}
+.mcp-hints-subtitle {
+ font-size: 11px; color: var(--text3); margin-left: auto;
+}
+.mcp-hint-list {
+ display: flex; flex-direction: column; gap: 6px;
+}
+.mcp-hint {
+ display: flex; align-items: center; gap: 10px;
+ padding: 9px 12px; background: var(--bg);
+ border: 1px solid var(--border); border-radius: var(--radius-sm);
+ cursor: pointer; transition: all 0.15s var(--ease);
+ user-select: none;
+}
+.mcp-hint:hover {
+ border-color: #7c5ae055; background: rgba(124, 90, 224, 0.04);
+}
+.mcp-hint:active { transform: scale(0.99); }
+.mcp-hint.copied {
+ border-color: var(--green-border); background: var(--green-subtle);
+}
+.mcp-hint-prompt {
+ flex: 1; font-size: 13px; font-weight: 600; color: var(--text);
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
+}
+.mcp-hint-desc {
+ font-size: 11px; color: var(--text3); white-space: nowrap; flex-shrink: 0;
+}
+.mcp-hint-copy {
+ display: flex; align-items: center; justify-content: center;
+ width: 24px; height: 24px; border-radius: 6px;
+ background: transparent; border: none; color: var(--text3);
+ cursor: pointer; flex-shrink: 0; font-size: 12px;
+ transition: all 0.15s var(--ease);
+}
+.mcp-hint-copy:hover { background: var(--surface2); color: var(--text); }
+.mcp-hint-category {
+ display: inline-block; padding: 2px 6px; border-radius: 4px;
+ font-size: 9px; font-weight: 700; text-transform: uppercase;
+ letter-spacing: 0.5px; flex-shrink: 0;
+}
+.mcp-hint-category.analyze { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
+.mcp-hint-category.create { background: rgba(74, 222, 128, 0.1); color: #4ade80; }
+.mcp-hint-category.refine { background: var(--accent-subtle); color: var(--accent); }
+.mcp-hint-category.export { background: rgba(251, 191, 36, 0.1); color: #fbbf24; }
+
+/* ─── Nav (knowledge, integration pages) ─── */
+.nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
+.nav .logo { margin-bottom: 0; }
+.nav-link {
+ font-size: 13px; font-weight: 600; color: var(--text2);
+ text-decoration: none; padding: 6px 14px;
+ border-radius: var(--radius-sm); border: 1px solid var(--border);
+ transition: all 0.15s var(--ease);
+}
+.nav-link:hover { border-color: var(--border-hover); color: var(--text); }
+.subtitle { font-size: 14px; color: var(--text2); margin-top: 8px; line-height: 1.6; }
+
+/* ─── Knowledge page ─── */
+.dir-path {
+ display: inline-flex; align-items: center; gap: 6px;
+ margin-top: 10px; padding: 5px 12px;
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius-sm);
+ font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text2);
+}
+.file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
+.file-card {
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius); padding: 16px; cursor: pointer;
+ transition: all 0.15s var(--ease); position: relative;
+}
+.file-card:hover { border-color: var(--border-hover); }
+.file-card.active { border-color: var(--accent); background: var(--accent-subtle); }
+.file-name {
+ font-family: 'JetBrains Mono', monospace; font-size: 13px;
+ font-weight: 600; color: var(--text); margin-bottom: 4px;
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
+}
+.file-meta { font-size: 11px; color: var(--text3); }
+.file-preview { font-size: 12px; color: var(--text2); margin-top: 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
+.file-delete {
+ position: absolute; top: 10px; right: 10px;
+ width: 22px; height: 22px; border-radius: 6px;
+ background: transparent; border: 1px solid transparent;
+ color: var(--text3); cursor: pointer; font-size: 13px;
+ display: flex; align-items: center; justify-content: center;
+ transition: all 0.15s var(--ease); opacity: 0;
+}
+.file-card:hover .file-delete { opacity: 1; }
+.file-delete:hover { border-color: var(--red-border); color: var(--red); background: var(--red-subtle); }
+.editor-panel {
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius); overflow: hidden; margin-top: 20px;
+}
+.editor-header {
+ display: flex; align-items: center; justify-content: space-between;
+ padding: 10px 16px; background: var(--surface2);
+ border-bottom: 1px solid var(--border);
+}
+.editor-filename {
+ font-family: 'JetBrains Mono', monospace; font-size: 12px;
+ font-weight: 600; color: var(--text);
+}
+.editor-actions { display: flex; gap: 6px; }
+.editor-textarea {
+ width: 100%; min-height: 320px; padding: 16px;
+ background: transparent; border: none; color: var(--text);
+ font-family: 'JetBrains Mono', monospace; font-size: 13px;
+ line-height: 1.7; resize: vertical; outline: none;
+}
+.new-file-row { display: flex; gap: 8px; margin-top: 16px; }
+.new-file-input {
+ flex: 1; padding: 8px 14px;
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius-sm); color: var(--text);
+ font-family: 'JetBrains Mono', monospace; font-size: 13px;
+ outline: none;
+}
+.new-file-input:focus { border-color: var(--accent); }
+.new-file-input::placeholder { color: var(--text3); }
+.toast {
+ position: fixed; bottom: 24px; right: 24px;
+ padding: 10px 18px; border-radius: var(--radius-sm);
+ background: var(--green-subtle); border: 1px solid var(--green-border);
+ color: var(--green); font-size: 13px; font-weight: 600;
+ animation: fadeIn 0.2s var(--ease);
+}
+.empty-state { text-align: center; padding: 48px 20px; color: var(--text3); font-size: 13px; }
+
+/* ─── Integration page ─── */
+.status-bar {
+ display: flex; align-items: center; gap: 10px;
+ padding: 12px 16px; border-radius: var(--radius);
+ font-size: 13px; font-weight: 500; margin-bottom: 32px;
+}
+.status-bar.ok { background: var(--green-subtle); border: 1px solid var(--green-border); color: var(--green); }
+.status-bar.err { background: var(--red-subtle); border: 1px solid var(--red-border); color: var(--red); }
+.status-bar.warn { background: var(--blue-subtle); border: 1px solid var(--blue-border); color: var(--blue); }
+.status-bar .status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
+.status-bar.ok .status-dot { background: var(--green); }
+.status-bar.err .status-dot { background: var(--red); }
+.status-bar.warn .status-dot { background: var(--blue); }
+.card {
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
+ transition: border-color 0.2s var(--ease);
+}
+.card:hover { border-color: var(--border-hover); }
+.card-label {
+ font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
+ color: var(--text2); text-transform: uppercase; margin-bottom: 16px;
+}
+.card-title {
+ font-size: 16px; font-weight: 700; margin-bottom: 6px; display: flex;
+ align-items: center; gap: 8px;
+}
+.card-desc { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 16px; }
+.code-block {
+ position: relative; background: #0a0a0c; border: 1px solid var(--border);
+ border-radius: var(--radius-sm); overflow: hidden;
+}
+.code-header {
+ display: flex; align-items: center; justify-content: space-between;
+ padding: 8px 14px; background: var(--surface2);
+ border-bottom: 1px solid var(--border);
+}
+.code-filename { font-size: 11px; font-weight: 600; color: var(--text2); font-family: 'JetBrains Mono', monospace; }
+.copy-btn {
+ padding: 4px 10px; font-size: 11px; font-weight: 600;
+ font-family: inherit; color: var(--text2); background: transparent;
+ border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
+ transition: all 0.15s var(--ease);
+}
+.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
+.copy-btn.copied { border-color: var(--green); color: var(--green); }
+pre {
+ padding: 16px; overflow-x: auto; font-family: 'JetBrains Mono', monospace;
+ font-size: 12.5px; line-height: 1.7; color: var(--text); tab-size: 2;
+}
+pre .key { color: #60a5fa; }
+pre .str { color: #4ade80; }
+pre .comment { color: var(--text3); font-style: italic; }
+pre .punct { color: var(--text2); }
+.steps { counter-reset: step; }
+.step {
+ position: relative; padding-left: 40px; margin-bottom: 24px;
+ counter-increment: step;
+}
+.step::before {
+ content: counter(step);
+ position: absolute; left: 0; top: 1px;
+ width: 26px; height: 26px; border-radius: 50%;
+ background: var(--surface2); border: 1px solid var(--border);
+ display: flex; align-items: center; justify-content: center;
+ font-size: 12px; font-weight: 700; color: var(--text2);
+}
+.step-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
+.step-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }
+.step-desc code {
+ background: var(--surface2); padding: 2px 7px; border-radius: 5px;
+ font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
+ color: var(--accent); border: 1px solid var(--border);
+}
+.tool-grid { display: grid; gap: 8px; }
+.tool-item {
+ display: flex; align-items: flex-start; gap: 12px;
+ padding: 14px 16px; background: var(--surface2);
+ border-radius: var(--radius-sm); border: 1px solid transparent;
+ transition: border-color 0.15s var(--ease);
+}
+.tool-item:hover { border-color: var(--border); }
+.tool-name {
+ font-family: 'JetBrains Mono', monospace; font-size: 12.5px;
+ font-weight: 600; color: var(--accent); white-space: nowrap;
+}
+.tool-desc { font-size: 12.5px; color: var(--text2); line-height: 1.5; }
+.divider { height: 1px; background: var(--border); margin: 32px 0; opacity: 0.4; }
+
+/* ─── Responsive ─── */
+@media (max-width: 920px) {
+ .app { padding: 36px 20px 80px; }
+ .layout { grid-template-columns: 1fr; gap: 0; }
+ .preview-col { display: none; }
+ .mcp-hint-desc { display: none; }
+}
+@media (max-width: 640px) {
+ .app { padding: 28px 16px 64px; }
+ .file-grid { grid-template-columns: 1fr; }
+}
diff --git a/src/ui/public/index.html b/src/ui/public/index.html
index fe25735..b83b153 100644
--- a/src/ui/public/index.html
+++ b/src/ui/public/index.html
@@ -4,347 +4,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>podcli</title>
+ <link rel="icon" type="image/png" href="/podcli-icon-transparent.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.23.9/babel.min.js"></script>
- <style>
- :root {
- --bg: #0b0b0d;
- --surface: #131316;
- --surface2: #1b1b20;
- --border: #252530;
- --border-hover: #35354a;
- --text: #e8e8e2;
- --text2: #77776f;
- --text3: #4e4e48;
- --accent: #d4874a;
- --accent-hover: #e09860;
- --accent-subtle: rgba(212, 135, 74, 0.10);
- --accent-glow: rgba(212, 135, 74, 0.25);
- --green: #4ade80;
- --green-subtle: rgba(74, 222, 128, 0.07);
- --green-border: rgba(74, 222, 128, 0.18);
- --red: #f87171;
- --red-subtle: rgba(248, 113, 113, 0.07);
- --red-border: rgba(248, 113, 113, 0.18);
- --radius: 12px;
- --radius-sm: 8px;
- --ease: cubic-bezier(0.4, 0, 0.2, 1);
- }
-
- * { margin: 0; padding: 0; box-sizing: border-box; }
-
- body {
- font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
- background: var(--bg); color: var(--text); min-height: 100vh;
- -webkit-font-smoothing: antialiased;
- }
-
- /* ─── Layout ─── */
- .app { max-width: 1080px; margin: 0 auto; padding: 48px 32px 96px; }
- .header { margin-bottom: 36px; }
- .logo { font-size: 13px; font-weight: 700; letter-spacing: 1.2px; color: var(--text3); margin-bottom: 10px; text-transform: uppercase; }
- .logo span { color: var(--accent); }
- h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
- .layout { display: grid; grid-template-columns: 1fr 340px; gap: 40px; align-items: start; }
- .main-col { min-width: 0; }
- .preview-col { position: relative; }
-
- /* ─── Preview Panel ─── */
- .preview-panel { position: sticky; top: 32px; }
- .preview-player {
- background: #000; border: 1px solid var(--border);
- border-radius: var(--radius); overflow: hidden; position: relative;
- }
- .preview-player video {
- width: 100%; display: block; background: #000;
- }
- .preview-player video.vertical {
- max-height: 480px; width: auto; margin: 0 auto;
- }
- .preview-empty {
- aspect-ratio: 16/9; display: flex; flex-direction: column;
- align-items: center; justify-content: center; gap: 8px;
- background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius); color: var(--text3); font-size: 13px;
- }
- .preview-empty .pe-icon { font-size: 28px; opacity: 0.3; }
-
- /* ─── Style Preview (vertical phone mockup) ─── */
- .style-preview {
- aspect-ratio: 9/16; width: 100%;
- background: #111114; border: 1px solid var(--border);
- border-radius: var(--radius); overflow: hidden;
- position: relative; user-select: none;
- }
- .style-preview .sp-bg {
- position: absolute; inset: 0;
- background:
- radial-gradient(ellipse at 35% 30%, rgba(80,60,40,0.18) 0%, transparent 60%),
- radial-gradient(ellipse at 65% 55%, rgba(50,50,70,0.12) 0%, transparent 50%),
- linear-gradient(180deg, #16161a 0%, #111114 100%);
- }
- .style-preview .sp-person {
- position: absolute; top: 18%; left: 50%; transform: translateX(-50%);
- width: 55%; aspect-ratio: 3/4;
- background: radial-gradient(ellipse at 50% 35%, rgba(140,120,100,0.15) 0%, rgba(80,70,60,0.06) 60%, transparent 80%);
- border-radius: 50% 50% 44% 44%;
- }
- .style-preview .sp-gradient {
- position: absolute; bottom: 0; left: 0; right: 0; height: 55%;
- background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
- pointer-events: none;
- }
- .style-preview .sp-captions {
- position: absolute; left: 0; right: 0;
- display: flex; flex-direction: column; align-items: center;
- padding: 0 20px; text-align: center;
- font-family: Arial, Helvetica, sans-serif;
- line-height: 1.35; transition: all 0.3s var(--ease);
- }
- .style-preview .sp-word {
- display: inline; transition: all 0.25s var(--ease);
- }
- .style-preview .sp-logo {
- position: absolute; top: 14px; left: 14px;
- width: 32px; height: 32px; border-radius: 7px;
- overflow: hidden;
- }
- .preview-clip-range {
- padding: 8px 12px; background: var(--surface);
- border-top: 1px solid var(--border);
- font-size: 12px; color: var(--text2);
- display: flex; align-items: center; justify-content: space-between;
- }
- .preview-clip-range .clip-name {
- font-weight: 600; color: var(--text);
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
- max-width: 200px;
- }
- .preview-back {
- padding: 0; background: none; border: none; color: var(--accent);
- font-family: inherit; font-size: 12px; font-weight: 600;
- cursor: pointer; transition: opacity 0.15s;
- }
- .preview-back:hover { opacity: 0.7; }
- .preview-settings {
- margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px;
- }
- .preview-tag {
- display: inline-flex; align-items: center; gap: 5px;
- padding: 5px 10px; background: var(--surface);
- border: 1px solid var(--border); border-radius: 8px;
- font-size: 11px; color: var(--text2); font-weight: 500;
- transition: all 0.2s var(--ease);
- }
- .preview-tag strong { color: var(--text); font-weight: 600; text-transform: capitalize; }
- .preview-tag.changed { border-color: var(--accent); background: var(--accent-subtle); }
-
- /* ─── Sections ─── */
- .section { margin-bottom: 24px; }
- .section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; color: var(--text2); margin-bottom: 10px; text-transform: uppercase; }
-
- /* ─── Form Elements ─── */
- input[type="text"], input[type="number"], select, textarea {
- width: 100%; background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius); padding: 11px 14px;
- color: var(--text); font-family: inherit; font-size: 14px;
- outline: none; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
- }
- input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
- border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle);
- }
- textarea {
- font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
- font-size: 12px; resize: vertical; min-height: 120px; line-height: 1.7;
- }
- select {
- appearance: none; cursor: pointer; padding-right: 34px;
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2377776f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
- background-repeat: no-repeat; background-position: right 14px center;
- }
-
- /* ─── Buttons ─── */
- .btn {
- padding: 10px 18px; border-radius: var(--radius); font-family: inherit;
- font-size: 13px; font-weight: 600; cursor: pointer; border: none;
- transition: all 0.15s var(--ease); display: inline-flex;
- align-items: center; justify-content: center; gap: 6px; text-decoration: none;
- }
- .btn:active:not(:disabled) { transform: scale(0.97); }
- .btn-primary { background: var(--accent); color: #fff; }
- .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
- .btn-primary:disabled { opacity: 0.25; cursor: not-allowed; }
- .btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
- .btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }
- .btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
- .btn-go {
- width: 100%; padding: 14px; font-size: 15px; justify-content: center;
- background: var(--accent); color: #fff; border-radius: var(--radius);
- }
- .btn-go:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 4px 24px var(--accent-glow); }
- .btn-go:disabled { opacity: 0.25; cursor: not-allowed; }
- .pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
- .pill-blue { background: var(--accent-subtle); color: var(--accent); }
-
- /* ─── Drop Zone ─── */
- .drop-zone {
- border: 1.5px dashed var(--border); border-radius: var(--radius);
- padding: 32px 20px; text-align: center; cursor: pointer;
- transition: all 0.2s var(--ease); position: relative; overflow: hidden;
- }
- .drop-zone:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.012); }
- .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-subtle); box-shadow: 0 0 0 4px var(--accent-subtle); }
- .drop-zone.uploading { border-color: var(--accent); border-style: solid; pointer-events: none; }
- .drop-zone .icon { font-size: 28px; margin-bottom: 8px; opacity: 0.35; line-height: 1; }
- .drop-zone .label { font-size: 13px; color: var(--text2); line-height: 1.5; }
- .drop-zone .label strong { color: var(--accent); font-weight: 600; }
- .drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
- .upload-bar { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--accent); border-radius: 0 2px 2px 0; transition: width 0.25s var(--ease); }
-
- /* ─── File Badge ─── */
- .file-badge {
- display: flex; align-items: center; gap: 10px;
- padding: 10px 14px; background: var(--green-subtle);
- border: 1px solid var(--green-border); border-radius: var(--radius);
- }
- .file-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
- .file-badge .name { font-size: 13px; color: var(--green); font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- .file-badge .meta { font-size: 11px; color: var(--text2); flex-shrink: 0; }
-
- /* ─── Tabs ─── */
- .tabs { display: flex; gap: 2px; background: var(--surface); border-radius: var(--radius); padding: 3px; margin-bottom: 14px; }
- .tab {
- flex: 1; text-align: center; padding: 8px 12px;
- border-radius: calc(var(--radius) - 3px); font-size: 13px;
- font-weight: 600; color: var(--text2); cursor: pointer;
- transition: all 0.2s var(--ease); user-select: none;
- }
- .tab:hover:not(.active) { color: var(--text); }
- .tab.active { background: var(--accent); color: #fff; }
-
- /* ─── Settings ─── */
- .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
- .field-label { font-size: 11px; color: var(--text2); font-weight: 600; display: block; margin-bottom: 6px; }
- .row { display: flex; gap: 10px; align-items: flex-end; }
- .row > * { flex: 1; }
-
- /* ─── Asset pills ─── */
- .asset-pill {
- display: inline-flex; align-items: center; gap: 6px;
- padding: 5px 8px 5px 10px; background: var(--surface2);
- border: 1px solid var(--border); border-radius: 20px;
- font-size: 12px; color: var(--text); max-width: 200px;
- }
- .asset-pill-icon { display: flex; align-items: center; flex-shrink: 0; color: var(--text2); }
- .asset-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
- .asset-pill-x {
- display: flex; align-items: center; justify-content: center;
- width: 18px; height: 18px; border-radius: 50%; border: none;
- background: transparent; color: var(--text3); font-size: 14px;
- cursor: pointer; flex-shrink: 0; padding: 0; line-height: 1;
- transition: all 0.15s var(--ease);
- }
- .asset-pill-x:hover { background: var(--surface); color: var(--red); }
- .asset-add {
- display: inline-flex; align-items: center; gap: 4px;
- padding: 5px 12px; background: transparent;
- border: 1px dashed var(--border); border-radius: 20px;
- font-size: 12px; color: var(--text3); cursor: pointer;
- font-family: inherit; font-weight: 500;
- transition: all 0.15s var(--ease);
- }
- .asset-add:hover:not(:disabled) { border-color: var(--border-hover); color: var(--text2); }
-
- /* ─── Overflow menu ─── */
- .overflow-menu {
- position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
- background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
- padding: 4px; min-width: 120px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
- }
- .overflow-menu-label {
- padding: 6px 10px 4px; font-size: 10px; font-weight: 600;
- color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px;
- }
- .overflow-menu-item {
- display: block; width: 100%; text-align: left; padding: 6px 10px;
- background: none; border: none; color: var(--text2); font-size: 12px;
- font-family: inherit; cursor: pointer; border-radius: 6px;
- transition: all 0.1s var(--ease);
- }
- .overflow-menu-item:hover { background: var(--surface2); color: var(--text); }
-
- /* ─── Progress ─── */
- .progress-track { background: var(--surface2); border-radius: 4px; height: 4px; overflow: hidden; margin: 8px 0; }
- .progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s var(--ease); }
- .progress-fill.indeterminate { width: 35% !important; animation: shimmer 1.4s ease-in-out infinite; }
- .status-line { font-size: 13px; color: var(--text2); display: flex; justify-content: space-between; }
- .spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; flex-shrink: 0; }
- .spinner.sm { width: 14px; height: 14px; border-width: 1.5px; }
-
- /* ─── Clip List ─── */
- .clip-item {
- display: flex; align-items: center; gap: 12px;
- padding: 12px 14px; margin-bottom: 4px;
- background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius); transition: all 0.15s var(--ease);
- cursor: pointer;
- }
- .clip-item:hover { border-color: var(--border-hover); }
- .clip-item.dimmed { opacity: 0.35; }
- .clip-item.active-clip { border-color: rgba(212, 135, 74, 0.3); background: rgba(212, 135, 74, 0.03); }
- .clip-item.selected { border-color: var(--accent); background: rgba(212, 135, 74, 0.04); }
- .checkbox {
- width: 20px; height: 20px; border-radius: 6px;
- border: 1.5px solid var(--border); display: flex;
- align-items: center; justify-content: center;
- cursor: pointer; transition: all 0.15s var(--ease); flex-shrink: 0;
- }
- .checkbox:hover { border-color: var(--accent); }
- .checkbox.checked { background: var(--accent); border-color: var(--accent); }
- .clip-info { flex: 1; min-width: 0; }
- .clip-title { font-size: 13px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- .clip-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
- .clip-meta .err { color: var(--red); }
- .clip-actions { display: flex; gap: 4px; flex-shrink: 0; }
- .clip-status { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 700; }
- .clip-status.pending { border: 1.5px dashed var(--border); }
- .clip-status.rendering { border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.6s linear infinite; }
- .clip-status.exported { background: var(--green-subtle); color: var(--green); }
- .status-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; }
- .status-dot.ok { background: var(--green-subtle); color: var(--green); }
- .status-dot.fail { background: var(--red-subtle); color: var(--red); }
-
- /* ─── Error ─── */
- .error-bar { padding: 12px 16px; background: var(--red-subtle); border: 1px solid var(--red-border); border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; color: var(--red); display: flex; align-items: center; gap: 10px; }
- .error-bar span { flex: 1; }
- .spacer { height: 1px; background: var(--border); margin: 28px 0; opacity: 0.4; }
-
- /* ─── Modal ─── */
- .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 1000; display: flex; align-items: center; justify-content: center; cursor: pointer; animation: fadeIn 0.15s var(--ease); }
- .modal-body { max-width: 380px; width: 92%; cursor: default; animation: scaleIn 0.2s var(--ease); }
- .modal-body video { width: 100%; border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,0.5); }
-
- /* ─── Animations ─── */
- .fade-in { animation: fadeIn 0.3s var(--ease); }
- @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
- @keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(4px); } to { opacity: 1; transform: none; } }
- @keyframes spin { to { transform: rotate(360deg); } }
- @keyframes shimmer { 0% { transform: translateX(-120%); } 100% { transform: translateX(350%); } }
- @keyframes clipReveal { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
- .clip-reveal { animation: clipReveal 0.35s var(--ease) both; }
- @keyframes tagFlash { 0% { border-color: var(--accent); background: var(--accent-subtle); } 100% { border-color: var(--border); background: var(--surface); } }
-
- /* ─── Responsive ─── */
- @media (max-width: 920px) {
- .app { padding: 36px 20px 80px; }
- .layout { grid-template-columns: 1fr; gap: 0; }
- .preview-col { display: none; }
- }
- </style>
+ <link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div id="root"></div>
@@ -380,44 +47,6 @@
return state;
}
- function suggestClips(segments, energyScores) {
- if (!segments?.length) return [];
- const clips = [];
- const kw = ['secret','mistake','important','never','always','best','how to','why','story','amazing','changed','money','learn','truth','actually','problem','solution','believe','crazy','number one','biggest','first thing','listen','here\'s the thing','let me tell you','the key','game changer','nobody talks about','most people','don\'t realize'];
- const winSizes = [6, 8, 10, 12];
- for (const winSize of winSizes) {
- const step = Math.max(1, Math.floor(winSize * 0.6));
- for (let i = 0; i < segments.length - winSize; i += step) {
- const win = segments.slice(i, i+winSize);
- const text = win.map(s=>s.text).join(' ');
- const start = win[0].start, end = win[win.length-1].end, dur = end-start;
- if (dur < 20 || dur > 90) continue;
- let score = 0;
- const lower = text.toLowerCase();
- if (text.includes('?')) score+=3;
- if (text.includes('!')) score+=2;
- if (text.length>200) score+=1;
- const firstText = (win[0].text||'').trim();
- if (firstText && firstText[0] === firstText[0].toUpperCase()) score+=1;
- kw.forEach(k=>{ if(lower.includes(k)) score+=2; });
- if (energyScores?.length) {
- const segE = energyScores.slice(i, i+winSize).filter(e => e > 0);
- if (segE.length) { const avg = segE.reduce((a,b)=>a+b,0)/segE.length; const peak = Math.max(...segE); score += avg*0.5 + peak*0.3; }
- }
- if (score >= 3) clips.push({ title: text.slice(0,55).trim()+'...', start_second: Math.floor(start), end_second: Math.ceil(end), duration: Math.round(dur), preview: text.slice(0,100).trim(), score });
- }
- }
- clips.sort((a,b)=>b.score-a.score);
- const selected = [];
- for (const clip of clips) {
- const overlap = selected.some(sel => { const o = Math.min(clip.end_second, sel.end_second) - Math.max(clip.start_second, sel.start_second); return o > clip.duration * 0.5; });
- if (!overlap) selected.push(clip);
- if (selected.length >= 8) break;
- }
- selected.sort((a,b)=>a.start_second-b.start_second);
- return selected;
- }
-
// --- MCP ↔ UI Bridge: SSE hook ---
function useSSE() {
const [lastEvent, setLastEvent] = useState(null);
@@ -513,6 +142,62 @@
);
}
+ /* ── MCP Hints Component ── */
+ function McpHints({ phase, videoPath, transcript, transcriptText, suggestions, mcpConnected }) {
+ const [hints, setHints] = useState([]);
+ const [copied, setCopied] = useState(null);
+ const [collapsed, setCollapsed] = useState(false);
+
+ // Fetch hints whenever state changes
+ useEffect(() => {
+ if (!mcpConnected) return;
+ fetch('/api/mcp-hints').then(r => r.json()).then(d => {
+ if (d.hints) setHints(d.hints);
+ }).catch(() => {});
+ }, [phase, videoPath, !!transcript, !!transcriptText, suggestions?.length, mcpConnected]);
+
+ const copyPrompt = (prompt, idx) => {
+ navigator.clipboard.writeText(prompt).then(() => {
+ setCopied(idx);
+ setTimeout(() => setCopied(null), 1500);
+ }).catch(() => {});
+ };
+
+ // Only show when MCP is connected AND there are actionable hints
+ if (!mcpConnected || hints.length === 0) return null;
+
+ return (
+ <div className="mcp-hints">
+ <div className="mcp-hints-header" style={{cursor:'pointer'}} onClick={() => setCollapsed(!collapsed)}>
+ <div className="mcp-hints-icon">AI</div>
+ <div className="mcp-hints-title">MCP Prompts</div>
+ <div className="mcp-hints-subtitle">
+ {collapsed ? `${hints.length} prompts` : 'click to copy'}
+ </div>
+ <span style={{fontSize:10,color:'var(--text3)',transition:'transform 0.2s',transform:collapsed?'rotate(-90deg)':'rotate(0)',marginLeft:4}}>{'\u25BC'}</span>
+ </div>
+ {!collapsed && (
+ <div className="mcp-hint-list">
+ {hints.slice(0, 5).map((hint, i) => (
+ <div key={i}
+ className={`mcp-hint ${copied === i ? 'copied' : ''}`}
+ onClick={() => copyPrompt(hint.prompt, i)}>
+ <span className={`mcp-hint-category ${hint.category}`}>{hint.category}</span>
+ <span className="mcp-hint-prompt">
+ {copied === i ? 'Copied!' : hint.prompt}
+ </span>
+ <span className="mcp-hint-desc">{hint.description}</span>
+ <button className="mcp-hint-copy" onClick={e => { e.stopPropagation(); copyPrompt(hint.prompt, i); }} title="Copy prompt">
+ {copied === i ? '\u2713' : '\u2398'}
+ </button>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+ }
+
function App() {
const [videoPath, setVideoPath] = useState('');
const [transcriptMode, setTranscriptMode] = useState('import');
@@ -541,8 +226,6 @@
const [error, setError] = useState(null);
const [previewFile, setPreviewFile] = useState(null);
- const [whisperJobId, setWhisperJobId] = useState(null);
- const whisperStream = useJob(whisperJobId);
const [retryIdx, setRetryIdx] = useState(null);
const [retryJobId, setRetryJobId] = useState(null);
const retryStream = useJob(retryJobId);
@@ -553,6 +236,7 @@
const [historyOpen, setHistoryOpen] = useState(false);
const [encoderInfo, setEncoderInfo] = useState(null);
+ const [generateCopied, setGenerateCopied] = useState(false);
useEffect(() => { api('/encoder-info').then(d => { if(d.best) setEncoderInfo(d); }).catch(()=>{}); }, []);
// Fetch clip history on mount and after exports
@@ -631,9 +315,16 @@
} else if (sseEvent.type === 'export-started') {
setBatchJobId(sseEvent.data.jobId);
setPhase('exporting');
- } else if (sseEvent.type === 'job-complete' && phase === 'exporting') {
- setPhase('done');
- setResults(sseEvent.data.result?.results || []);
+ } else if (sseEvent.type === 'job-complete') {
+ if (phase === 'exporting' || sseEvent.data.result?.results) {
+ setPhase('done');
+ setResults(sseEvent.data.result?.results || []);
+ }
+ } else if (sseEvent.type === 'job-error') {
+ if (phase === 'exporting') {
+ setError('Export failed: ' + (sseEvent.data.error || 'Unknown error'));
+ setPhase('review');
+ }
}
}, [sseEvent]);
@@ -694,68 +385,12 @@
finally { setBrowsing(false); }
}, []);
- // Pipeline
- const startPipeline = async () => {
- setError(null); setResults([]); setSuggestions([]); setDeselected(new Set());
- setBatchJobId(null); setActiveClipIdx(null); setPreviewSrc(null);
- setPhase('parsing');
- const fileData = await api('/select-file', { method:'POST', body: JSON.stringify({ file_path: videoPath.trim() }) });
- if (fileData.error) { setError(fileData.error); setPhase('idle'); return; }
- setFile(fileData);
- let t = null;
- if (transcriptMode === 'import') {
- const text = transcriptText.trim();
- if (!text) { setError('Paste your transcript'); setPhase('idle'); return; }
- const isJson = text.startsWith('{') || text.startsWith('[');
- if (isJson) {
- const parsed = JSON.parse(text);
- const tr = Array.isArray(parsed) ? { words: parsed } : parsed;
- const data = await api('/import-transcript', { method:'POST', body: JSON.stringify({ file_path: videoPath.trim(), transcript: tr }) });
- if (data.error) { setError(data.error); setPhase('idle'); return; }
- t = data.data;
- } else {
- const data = await api('/parse-transcript', { method:'POST', body: JSON.stringify({ file_path: videoPath.trim(), raw_text: text, time_adjust: timeAdjust }) });
- if (data.error) { setError(data.error); setPhase('idle'); return; }
- t = data.data;
- }
- } else {
- const data = await api('/transcribe', { method:'POST', body: JSON.stringify({ file_path: videoPath.trim(), model_size: whisperModel }) });
- if (data.cached) { t = data.data; }
- else { setWhisperJobId(data.job_id); return; }
- }
- continueWithTranscript(t, fileData);
- };
-
- const continueWithTranscript = async (t, f) => {
- setTranscript(t); setPhase('suggesting'); setSuggestions([]);
- let energyScores = null;
- const vp = f?.file_path || videoPath.trim();
- if (vp && t?.segments?.length) {
- try {
- const eData = await api('/analyze-energy', { method:'POST', body: JSON.stringify({ video_path: vp, segments: t.segments }) });
- if (eData.segment_scores) energyScores = eData.segment_scores;
- } catch(e) {}
- }
- const allClips = suggestClips(t?.segments || [], energyScores);
- if (allClips.length === 0) { setError('No clip suggestions found.'); setPhase('idle'); return; }
- for (let i = 0; i < allClips.length; i++) {
- await new Promise(r => setTimeout(r, i === 0 ? 150 : 250));
- setSuggestions(prev => [...prev, allClips[i]]);
- }
- await new Promise(r => setTimeout(r, 300));
- setPhase('review');
- };
-
- useEffect(() => {
- if (whisperStream?.status === 'done' && whisperStream.result) { setWhisperJobId(null); continueWithTranscript(whisperStream.result, file); }
- if (whisperStream?.status === 'error') { setError('Transcription failed: ' + whisperStream.error); setPhase('idle'); }
- }, [whisperStream?.status]);
-
const startExport = async () => {
setPhase('exporting'); setResults([]);
const sc = suggestions.filter((_,i) => !deselected.has(i));
+ const vp = file?.file_path || videoPath.trim();
const data = await api('/batch-clips', { method:'POST', body: JSON.stringify({
- video_path: file.file_path,
+ video_path: vp,
clips: sc.map(c => ({ start_second: c.start_second, end_second: c.end_second, title: c.title.slice(0,40), caption_style: captionStyle, crop_strategy: cropStrategy })),
transcript_words: transcript?.words || [], logo_path: logoPath || undefined, outro_path: outroPath || undefined,
})});
@@ -770,8 +405,9 @@
const retryClip = async (idx) => {
const sc = suggestions.filter((_,i) => !deselected.has(i));
const c = sc[idx]; setRetryIdx(idx); setRetryJobId(null);
+ const vp = file?.file_path || videoPath.trim();
const data = await api('/create-clip', { method:'POST', body: JSON.stringify({
- video_path: file.file_path, start_second: c.start_second, end_second: c.end_second,
+ video_path: vp, start_second: c.start_second, end_second: c.end_second,
title: c.title.slice(0,40), caption_style: captionStyle, crop_strategy: cropStrategy,
transcript_words: transcript?.words || [], logo_path: logoPath || undefined, outro_path: outroPath || undefined,
})});
@@ -799,7 +435,92 @@
catch(e) { setError('Outro upload failed'); }
finally { setOutroUploading(false); }
};
- const isProcessing = phase === 'parsing' || phase === 'suggesting' || phase === 'exporting' || whisperJobId;
+ const buildLocalPrompt = () => {
+ const parts = [];
+ const hasTranscriptReady = transcript || transcriptText.trim();
+ if (transcriptMode === 'whisper' && !hasTranscriptReady) {
+ parts.push(`Transcribe the podcast at ${videoPath} using transcribe_podcast with model_size="${whisperModel}".`);
+ parts.push('Then find the 5-8 best viral-worthy moments and call suggest_clips.');
+ } else {
+ parts.push('Use get_ui_state with include_transcript=true to read the full transcript.');
+ parts.push('Find the 5-8 best viral-worthy moments — hot takes, strong opinions, funny moments, actionable advice, and emotional stories.');
+ parts.push('Then call suggest_clips with your suggestions.');
+ }
+ const settings = [];
+ if (videoPath) settings.push(`Video: ${videoPath.split('/').pop()}`);
+ settings.push(`Style: ${captionStyle}`);
+ settings.push(`Crop: ${cropStrategy}`);
+ if (logoPath) settings.push(`Logo: set`);
+ if (outroPath) settings.push(`Outro: set`);
+ parts.push(`Current settings: ${settings.join(', ')}`);
+ return parts.join('\n');
+ };
+
+ const copyGeneratePrompt = async () => {
+ // If user has pasted a transcript but it hasn't been parsed yet, parse it first
+ if (transcriptMode === 'import' && transcriptText.trim() && !transcript) {
+ setError(null);
+ setPhase('parsing');
+ const fileData = await api('/select-file', { method:'POST', body: JSON.stringify({ file_path: videoPath.trim() }) });
+ if (fileData.error) { setError(fileData.error); setPhase('idle'); return; }
+ setFile(fileData);
+ const text = transcriptText.trim();
+ const isJson = text.startsWith('{') || text.startsWith('[');
+ let t = null;
+ if (isJson) {
+ const parsed = JSON.parse(text);
+ const tr = Array.isArray(parsed) ? { words: parsed } : parsed;
+ const data = await api('/import-transcript', { method:'POST', body: JSON.stringify({ file_path: videoPath.trim(), transcript: tr }) });
+ if (data.error) { setError(data.error); setPhase('idle'); return; }
+ t = data.data;
+ } else {
+ const data = await api('/parse-transcript', { method:'POST', body: JSON.stringify({ file_path: videoPath.trim(), raw_text: text, time_adjust: timeAdjust }) });
+ if (data.error) { setError(data.error); setPhase('idle'); return; }
+ t = data.data;
+ }
+ setTranscript(t);
+ // Sync transcript + video to server immediately (don't wait for React useEffect)
+ await fetch('/api/ui-state', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ _source: 'ui', transcript: t, videoPath: videoPath.trim(), filePath: fileData.file_path }),
+ }).catch(() => {});
+ setPhase('idle');
+ }
+
+ // Ensure video path is synced even without transcript parsing
+ if (videoPath.trim()) {
+ await fetch('/api/ui-state', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ _source: 'ui',
+ videoPath: videoPath.trim(),
+ rawTranscriptText: transcriptText.trim() || undefined,
+ settings: { captionStyle, cropStrategy, logoPath, outroPath },
+ }),
+ }).catch(() => {});
+ }
+
+ let prompt;
+ try {
+ const res = await fetch('/api/generate-prompt', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ action: 'suggest' }),
+ });
+ const data = await res.json();
+ prompt = data.prompt || buildLocalPrompt();
+ } catch {
+ prompt = buildLocalPrompt();
+ }
+ navigator.clipboard.writeText(prompt).then(() => {
+ setGenerateCopied(true);
+ setTimeout(() => setGenerateCopied(false), 2000);
+ }).catch(() => {});
+ };
+
+ const isProcessing = phase === 'parsing' || phase === 'suggesting' || phase === 'exporting';
const selectedClips = suggestions.filter((_,i) => !deselected.has(i));
const getExportStatus = (resultIdx) => {
@@ -823,7 +544,7 @@
<div className="app">
<div className="header">
<div style={{ display:'flex', justifyContent:'space-between', alignItems:'center' }}>
- <div className="logo">pod<span>cli</span></div>
+ <img src="/podcli-logo-transparent.png" alt="podcli" style={{ height: 22 }} />
<div style={{ display:'flex', alignItems:'center', gap: 8 }}>
{mcpConnected && (
<span className="pill" style={{ fontSize:10, letterSpacing:'0.5px', background:'var(--green-subtle)', color:'var(--green)', border:'1px solid var(--green-border)' }}>
@@ -991,31 +712,20 @@
{/* Generate */}
{phase === 'idle' && (
<div>
- <button className="btn btn-go" disabled={!videoPath.trim()||(transcriptMode==='import'&&!transcriptText.trim())||browsing} onClick={startPipeline}>
- Generate Clips
+ <button className="btn btn-go"
+ disabled={!videoPath.trim()||(transcriptMode==='import'&&!transcriptText.trim())||browsing}
+ onClick={copyGeneratePrompt}
+ style={generateCopied ? {background:'var(--green)',transition:'background 0.2s'} : {}}>
+ {generateCopied ? 'Copied — paste in Claude' : 'Generate Clips'}
</button>
- {mcpConnected && videoPath && transcriptText.trim() && (
- <div className="fade-in" style={{ textAlign:'center', marginTop:10, fontSize:12, color:'var(--text3)' }}>
- or ask Claude to find the best moments — your video and transcript are synced
- </div>
+ {videoPath.trim() && (transcriptText.trim() || transcript) && (
+ <McpHints phase={phase} videoPath={videoPath} transcript={transcript} transcriptText={transcriptText} suggestions={suggestions} mcpConnected={mcpConnected} />
)}
</div>
)}
- {/* Whisper progress */}
- {whisperJobId && whisperStream && (
- <div className="fade-in" style={{marginTop:20}}>
- <div className="status-line">
- <span style={{display:'flex',alignItems:'center',gap:8}}><div className="spinner sm"/>Transcribing{'\u2026'}</span>
- <span style={{fontWeight:600,fontVariantNumeric:'tabular-nums'}}>{whisperStream.progress||0}%</span>
- </div>
- <div className="progress-track"><div className="progress-fill" style={{width:`${whisperStream.progress||0}%`}}/></div>
- <div style={{fontSize:12,color:'var(--text3)',marginTop:4}}>{whisperStream.message}</div>
- </div>
- )}
-
{/* Parsing */}
- {phase === 'parsing' && !whisperJobId && (
+ {phase === 'parsing' && (
<div className="fade-in" style={{marginTop:20}}>
<div className="status-line"><span style={{display:'flex',alignItems:'center',gap:8}}><div className="spinner sm"/>Processing transcript{'\u2026'}</span></div>
<div className="progress-track"><div className="progress-fill indeterminate"/></div>
@@ -1139,12 +849,17 @@
</div>
)}
- {phase === 'done' && (
+ {(phase === 'done' || phase === 'review' || phase === 'exporting') && (
<div style={{display:'flex',gap:10,justifyContent:'center',marginTop:24}}>
- <button className="btn btn-ghost" onClick={()=>{setPhase('idle');setResults([]);setSuggestions([]);setBatchJobId(null);setFile(null);setTranscript(null);setActiveClipIdx(null);setPreviewSrc(null);}}>Start Over</button>
- <button className="btn btn-ghost" onClick={()=>{setPhase('review');setResults([]);setBatchJobId(null);}}>Re-export</button>
+ <button className="btn btn-ghost" onClick={()=>{setPhase('idle');setResults([]);setSuggestions([]);setBatchJobId(null);setFile(null);setTranscript(null);setActiveClipIdx(null);setPreviewSrc(null);
+ fetch('/api/ui-state',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({_source:'ui',phase:'idle',suggestions:[],deselectedIndices:[]})}).catch(()=>{});
+ }}>Start Over</button>
+ {phase === 'done' && <button className="btn btn-ghost" onClick={()=>{setPhase('review');setResults([]);setBatchJobId(null);}}>Re-export</button>}
</div>
)}
+ {(phase === 'review' || phase === 'done') && (
+ <McpHints phase={phase} videoPath={videoPath} transcript={transcript} transcriptText={transcriptText} suggestions={suggestions} mcpConnected={mcpConnected} />
+ )}
</div>
)}
{/* ═══════════ CLIP HISTORY ═══════════ */}
diff --git a/src/ui/public/integration.html b/src/ui/public/integration.html
index 8c856db..e2d1168 100644
--- a/src/ui/public/integration.html
+++ b/src/ui/public/integration.html
@@ -4,169 +4,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>podcli — Integration</title>
+ <link rel="icon" type="image/png" href="/podcli-icon-transparent.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
+ <link rel="stylesheet" href="css/styles.css">
<style>
- :root {
- --bg: #0b0b0d;
- --surface: #131316;
- --surface2: #1b1b20;
- --border: #252530;
- --border-hover: #35354a;
- --text: #e8e8e2;
- --text2: #77776f;
- --text3: #4e4e48;
- --accent: #d4874a;
- --accent-hover: #e09860;
- --accent-subtle: rgba(212, 135, 74, 0.10);
- --accent-glow: rgba(212, 135, 74, 0.25);
- --green: #4ade80;
- --green-subtle: rgba(74, 222, 128, 0.07);
- --green-border: rgba(74, 222, 128, 0.18);
- --red: #f87171;
- --red-subtle: rgba(248, 113, 113, 0.07);
- --red-border: rgba(248, 113, 113, 0.18);
- --blue: #60a5fa;
- --blue-subtle: rgba(96, 165, 250, 0.08);
- --blue-border: rgba(96, 165, 250, 0.18);
- --radius: 12px;
- --radius-sm: 8px;
- --ease: cubic-bezier(0.4, 0, 0.2, 1);
- }
-
- * { margin: 0; padding: 0; box-sizing: border-box; }
-
- body {
- font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
- background: var(--bg); color: var(--text); min-height: 100vh;
- -webkit-font-smoothing: antialiased;
- }
-
- .app { max-width: 780px; margin: 0 auto; padding: 48px 32px 96px; }
-
- /* ─── Header ─── */
+ .app { max-width: 780px; }
.header { margin-bottom: 40px; }
- .nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
- .logo { font-size: 13px; font-weight: 700; letter-spacing: 1.2px; color: var(--text3); text-transform: uppercase; text-decoration: none; }
- .logo span { color: var(--accent); }
- .nav-link {
- font-size: 13px; font-weight: 600; color: var(--text2);
- text-decoration: none; padding: 6px 14px;
- border-radius: var(--radius-sm); border: 1px solid var(--border);
- transition: all 0.15s var(--ease);
- }
- .nav-link:hover { border-color: var(--border-hover); color: var(--text); }
- h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
- .subtitle { font-size: 14px; color: var(--text2); margin-top: 8px; line-height: 1.6; }
-
- /* ─── Status Bar ─── */
- .status-bar {
- display: flex; align-items: center; gap: 10px;
- padding: 12px 16px; border-radius: var(--radius);
- font-size: 13px; font-weight: 500; margin-bottom: 32px;
- }
- .status-bar.ok { background: var(--green-subtle); border: 1px solid var(--green-border); color: var(--green); }
- .status-bar.err { background: var(--red-subtle); border: 1px solid var(--red-border); color: var(--red); }
- .status-bar.warn { background: var(--blue-subtle); border: 1px solid var(--blue-border); color: var(--blue); }
- .status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
- .status-bar.ok .status-dot { background: var(--green); }
- .status-bar.err .status-dot { background: var(--red); }
- .status-bar.warn .status-dot { background: var(--blue); }
-
- /* ─── Card ─── */
- .card {
- background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
- transition: border-color 0.2s var(--ease);
- }
- .card:hover { border-color: var(--border-hover); }
- .card-label {
- font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
- color: var(--text2); text-transform: uppercase; margin-bottom: 16px;
- }
- .card-title {
- font-size: 16px; font-weight: 700; margin-bottom: 6px; display: flex;
- align-items: center; gap: 8px;
- }
- .card-desc { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 16px; }
-
- /* ─── Code Block ─── */
- .code-block {
- position: relative; background: #0a0a0c; border: 1px solid var(--border);
- border-radius: var(--radius-sm); overflow: hidden;
- }
- .code-header {
- display: flex; align-items: center; justify-content: space-between;
- padding: 8px 14px; background: var(--surface2);
- border-bottom: 1px solid var(--border);
- }
- .code-filename { font-size: 11px; font-weight: 600; color: var(--text2); font-family: 'JetBrains Mono', monospace; }
- .copy-btn {
- padding: 4px 10px; font-size: 11px; font-weight: 600;
- font-family: inherit; color: var(--text2); background: transparent;
- border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
- transition: all 0.15s var(--ease);
- }
- .copy-btn:hover { border-color: var(--accent); color: var(--accent); }
- .copy-btn.copied { border-color: var(--green); color: var(--green); }
- pre {
- padding: 16px; overflow-x: auto; font-family: 'JetBrains Mono', monospace;
- font-size: 12.5px; line-height: 1.7; color: var(--text); tab-size: 2;
- }
- pre .key { color: #60a5fa; }
- pre .str { color: #4ade80; }
- pre .comment { color: var(--text3); font-style: italic; }
- pre .punct { color: var(--text2); }
-
- /* ─── Steps ─── */
- .steps { counter-reset: step; }
- .step {
- position: relative; padding-left: 40px; margin-bottom: 24px;
- counter-increment: step;
- }
- .step::before {
- content: counter(step);
- position: absolute; left: 0; top: 1px;
- width: 26px; height: 26px; border-radius: 50%;
- background: var(--surface2); border: 1px solid var(--border);
- display: flex; align-items: center; justify-content: center;
- font-size: 12px; font-weight: 700; color: var(--text2);
- }
- .step-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
- .step-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }
- .step-desc code {
- background: var(--surface2); padding: 2px 7px; border-radius: 5px;
- font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
- color: var(--accent); border: 1px solid var(--border);
- }
-
- /* ─── Tool List ─── */
- .tool-grid { display: grid; gap: 8px; }
- .tool-item {
- display: flex; align-items: flex-start; gap: 12px;
- padding: 14px 16px; background: var(--surface2);
- border-radius: var(--radius-sm); border: 1px solid transparent;
- transition: border-color 0.15s var(--ease);
- }
- .tool-item:hover { border-color: var(--border); }
- .tool-name {
- font-family: 'JetBrains Mono', monospace; font-size: 12.5px;
- font-weight: 600; color: var(--accent); white-space: nowrap;
- }
- .tool-desc { font-size: 12.5px; color: var(--text2); line-height: 1.5; }
-
- /* ─── Divider ─── */
- .divider { height: 1px; background: var(--border); margin: 32px 0; opacity: 0.4; }
-
- /* ─── Animations ─── */
- .fade-in { animation: fadeIn 0.3s var(--ease); }
- @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
-
- /* ─── Responsive ─── */
- @media (max-width: 640px) {
- .app { padding: 28px 16px 64px; }
- }
</style>
</head>
<body>
@@ -174,7 +19,7 @@
<!-- Nav -->
<div class="nav">
- <a href="/" class="logo">pod<span>cli</span></a>
+ <a href="/"><img src="/podcli-logo-transparent.png" alt="podcli" style="height:22px"></a>
<a href="/" class="nav-link">Back to app</a>
</div>
diff --git a/src/ui/public/knowledge.html b/src/ui/public/knowledge.html
index 1428817..9be7fad 100644
--- a/src/ui/public/knowledge.html
+++ b/src/ui/public/knowledge.html
@@ -4,169 +4,18 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>podcli — Knowledge Base</title>
+ <link rel="icon" type="image/png" href="/podcli-icon-transparent.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.23.9/babel.min.js"></script>
+ <link rel="stylesheet" href="css/styles.css">
<style>
- :root {
- --bg: #0b0b0d;
- --surface: #131316;
- --surface2: #1b1b20;
- --border: #252530;
- --border-hover: #35354a;
- --text: #e8e8e2;
- --text2: #77776f;
- --text3: #4e4e48;
- --accent: #d4874a;
- --accent-hover: #e09860;
- --accent-subtle: rgba(212, 135, 74, 0.10);
- --accent-glow: rgba(212, 135, 74, 0.25);
- --green: #4ade80;
- --green-subtle: rgba(74, 222, 128, 0.07);
- --green-border: rgba(74, 222, 128, 0.18);
- --red: #f87171;
- --red-subtle: rgba(248, 113, 113, 0.07);
- --red-border: rgba(248, 113, 113, 0.18);
- --radius: 12px;
- --radius-sm: 8px;
- --ease: cubic-bezier(0.4, 0, 0.2, 1);
- }
-
- * { margin: 0; padding: 0; box-sizing: border-box; }
- body {
- font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
- background: var(--bg); color: var(--text); min-height: 100vh;
- -webkit-font-smoothing: antialiased;
- }
-
- .app { max-width: 860px; margin: 0 auto; padding: 48px 32px 96px; }
- .nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
- .logo { font-size: 13px; font-weight: 700; letter-spacing: 1.2px; color: var(--text3); text-transform: uppercase; text-decoration: none; }
- .logo span { color: var(--accent); }
- .nav-link {
- font-size: 13px; font-weight: 600; color: var(--text2);
- text-decoration: none; padding: 6px 14px;
- border-radius: var(--radius-sm); border: 1px solid var(--border);
- transition: all 0.15s var(--ease);
- }
- .nav-link:hover { border-color: var(--border-hover); color: var(--text); }
-
+ .app { max-width: 860px; }
.header { margin-bottom: 32px; }
- h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
- .subtitle { font-size: 14px; color: var(--text2); margin-top: 8px; line-height: 1.6; }
- .dir-path {
- display: inline-flex; align-items: center; gap: 6px;
- margin-top: 10px; padding: 5px 12px;
- background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text2);
- }
-
- /* ─── Drop Zone ─── */
- .drop-zone {
- border: 1.5px dashed var(--border); border-radius: var(--radius);
- padding: 36px 24px; text-align: center; cursor: pointer;
- transition: all 0.2s var(--ease); position: relative; margin-bottom: 24px;
- }
- .drop-zone:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.012); }
- .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-subtle); box-shadow: 0 0 0 4px var(--accent-subtle); }
- .drop-zone .dz-icon { font-size: 28px; opacity: 0.3; margin-bottom: 8px; }
- .drop-zone .dz-text { font-size: 13px; color: var(--text2); line-height: 1.5; }
- .drop-zone .dz-text strong { color: var(--accent); font-weight: 600; }
- .drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
-
- /* ─── File Grid ─── */
- .file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
- .file-card {
- background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius); padding: 16px; cursor: pointer;
- transition: all 0.15s var(--ease); position: relative;
- }
- .file-card:hover { border-color: var(--border-hover); }
- .file-card.active { border-color: var(--accent); background: var(--accent-subtle); }
- .file-name {
- font-family: 'JetBrains Mono', monospace; font-size: 13px;
- font-weight: 600; color: var(--text); margin-bottom: 4px;
- overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
- }
- .file-meta { font-size: 11px; color: var(--text3); }
- .file-preview { font-size: 12px; color: var(--text2); margin-top: 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
- .file-delete {
- position: absolute; top: 10px; right: 10px;
- width: 22px; height: 22px; border-radius: 6px;
- background: transparent; border: 1px solid transparent;
- color: var(--text3); cursor: pointer; font-size: 13px;
- display: flex; align-items: center; justify-content: center;
- transition: all 0.15s var(--ease); opacity: 0;
- }
- .file-card:hover .file-delete { opacity: 1; }
- .file-delete:hover { border-color: var(--red-border); color: var(--red); background: var(--red-subtle); }
-
- /* ─── Editor ─── */
- .editor-panel {
- background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius); overflow: hidden; margin-top: 20px;
- }
- .editor-header {
- display: flex; align-items: center; justify-content: space-between;
- padding: 10px 16px; background: var(--surface2);
- border-bottom: 1px solid var(--border);
- }
- .editor-filename {
- font-family: 'JetBrains Mono', monospace; font-size: 12px;
- font-weight: 600; color: var(--text);
- }
- .editor-actions { display: flex; gap: 6px; }
- .btn {
- padding: 6px 14px; border-radius: var(--radius-sm); font-family: inherit;
- font-size: 12px; font-weight: 600; cursor: pointer; border: none;
- transition: all 0.15s var(--ease); display: inline-flex;
- align-items: center; gap: 5px;
- }
- .btn-primary { background: var(--accent); color: #fff; }
- .btn-primary:hover { background: var(--accent-hover); }
- .btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
- .btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }
- .editor-textarea {
- width: 100%; min-height: 320px; padding: 16px;
- background: transparent; border: none; color: var(--text);
- font-family: 'JetBrains Mono', monospace; font-size: 13px;
- line-height: 1.7; resize: vertical; outline: none;
- }
-
- /* ─── New File ─── */
- .new-file-row {
- display: flex; gap: 8px; margin-top: 16px;
- }
- .new-file-input {
- flex: 1; padding: 8px 14px;
- background: var(--surface); border: 1px solid var(--border);
- border-radius: var(--radius-sm); color: var(--text);
- font-family: 'JetBrains Mono', monospace; font-size: 13px;
- outline: none;
- }
- .new-file-input:focus { border-color: var(--accent); }
- .new-file-input::placeholder { color: var(--text3); }
-
- /* ─── Toast ─── */
- .toast {
- position: fixed; bottom: 24px; right: 24px;
- padding: 10px 18px; border-radius: var(--radius-sm);
- background: var(--green-subtle); border: 1px solid var(--green-border);
- color: var(--green); font-size: 13px; font-weight: 600;
- animation: fadeIn 0.2s var(--ease);
- }
-
- .empty-state { text-align: center; padding: 48px 20px; color: var(--text3); font-size: 13px; }
-
- @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
- @media (max-width: 640px) {
- .app { padding: 28px 16px 64px; }
- .file-grid { grid-template-columns: 1fr; }
- }
+ .drop-zone { padding: 36px 24px; margin-bottom: 24px; }
</style>
</head>
<body>
@@ -273,7 +122,7 @@
return (
<div className="app">
<div className="nav">
- <a href="/" className="logo">pod<span>cli</span></a>
+ <a href="/"><img src="/podcli-logo-transparent.png" alt="podcli" style={{ height: 22 }} /></a>
<a href="/" className="nav-link">Back to app</a>
</div>
diff --git a/src/ui/public/podcli-icon-transparent.png b/src/ui/public/podcli-icon-transparent.png
new file mode 100644
index 0000000..8420b9b
Binary files /dev/null and b/src/ui/public/podcli-icon-transparent.png differ
diff --git a/src/ui/public/podcli-icon.png b/src/ui/public/podcli-icon.png
new file mode 100644
index 0000000..609d086
Binary files /dev/null and b/src/ui/public/podcli-icon.png differ
diff --git a/src/ui/public/podcli-logo-transparent.png b/src/ui/public/podcli-logo-transparent.png
new file mode 100644
index 0000000..e5ad86a
Binary files /dev/null and b/src/ui/public/podcli-logo-transparent.png differ
diff --git a/src/ui/web-server.ts b/src/ui/web-server.ts
index 46adc76..4cf4754 100644
--- a/src/ui/web-server.ts
+++ b/src/ui/web-server.ts
@@ -1029,6 +1029,122 @@ app.delete("/api/knowledge/:filename", async (req, res) => {
}
});
+// --- Prompt Builder (shared by /api/generate-prompt and /api/mcp-hints) ---
+
+function getStateContext() {
+ const hasVideo = !!uiState.videoPath;
+ const hasTranscript = Array.isArray((uiState.transcript as any)?.words) && (uiState.transcript as any).words.length > 0;
+ const hasRawTranscript = !!uiState.rawTranscriptText?.trim();
+ const hasSuggestions = uiState.suggestions.length > 0;
+ const selectedCount = uiState.suggestions.length - uiState.deselectedIndices.length;
+ return { hasVideo, hasTranscript, hasRawTranscript, hasSuggestions, selectedCount, phase: uiState.phase };
+}
+
+function buildPromptForAction(action: "suggest" | "export" | "restyle"): string {
+ const ctx = getStateContext();
+ const parts: string[] = [];
+
+ const settingsSummary = [
+ uiState.videoPath ? `Video: ${uiState.videoPath.split("/").pop()}` : null,
+ `Style: ${uiState.settings.captionStyle}`,
+ `Crop: ${uiState.settings.cropStrategy}`,
+ uiState.settings.logoPath ? `Logo: set` : null,
+ uiState.settings.outroPath ? `Outro: set` : null,
+ ].filter(Boolean).join(", ");
+
+ if (action === "suggest") {
+ if (!ctx.hasTranscript && !ctx.hasRawTranscript) {
+ // No transcript yet — prompt includes transcribe step
+ if (uiState.videoPath) {
+ parts.push(`Transcribe the podcast at ${uiState.videoPath} using transcribe_podcast.`);
+ } else {
+ parts.push("Set a video path first, then transcribe it using transcribe_podcast.");
+ }
+ parts.push("Then find the 5-8 best viral-worthy moments and call suggest_clips.");
+ } else {
+ parts.push("Use get_ui_state with include_transcript=true to read the full transcript.");
+ parts.push("Find the 5-8 best viral-worthy moments — hot takes, strong opinions, funny moments, actionable advice, and emotional stories.");
+ parts.push("Then call suggest_clips with your suggestions.");
+ }
+ parts.push(`Current settings: ${settingsSummary}`);
+ } else if (action === "export") {
+ parts.push("Use get_ui_state to read the selected clips.");
+ parts.push(`Export all ${ctx.selectedCount} selected clip${ctx.selectedCount !== 1 ? "s" : ""} using batch_create_clips.`);
+ parts.push(`Current settings: ${settingsSummary}`);
+ } else if (action === "restyle") {
+ parts.push("Use get_ui_state to read the current clips.");
+ parts.push("Re-export all clips with the updated style settings.");
+ parts.push(`Current settings: ${settingsSummary}`);
+ }
+
+ return parts.join("\n");
+}
+
+// --- MCP Prompt Hints ---
+
+/**
+ * GET /api/mcp-hints — Returns contextual MCP prompt suggestions based on current state.
+ * Prompts are practical clip-generation actions, not generic help.
+ * Phrased generically (not Claude-specific) since any MCP client can use them.
+ */
+app.get("/api/mcp-hints", (_req, res) => {
+ const ctx = getStateContext();
+
+ interface Hint {
+ prompt: string;
+ description: string;
+ category: "analyze" | "create" | "refine" | "export";
+ }
+
+ const hints: Hint[] = [];
+
+ // The UI handles video upload and transcript input directly.
+ // MCP hints only appear once there's something to work with.
+
+ if ((ctx.hasRawTranscript || ctx.hasTranscript) && !ctx.hasSuggestions) {
+ // Transcript is ready — suggest clip-finding prompts
+ hints.push(
+ { prompt: "Find the 5 best viral moments from this podcast", description: "Clips optimized for TikTok/Shorts", category: "analyze" },
+ { prompt: "Find moments with hot takes and strong opinions", description: "Controversial, high-engagement clips", category: "analyze" },
+ { prompt: "Find funny moments and quotable one-liners", description: "Entertainment-focused clips", category: "analyze" },
+ { prompt: "Find actionable advice and key insights", description: "Value-driven educational clips", category: "analyze" },
+ );
+ } else if (ctx.phase === "review" && ctx.hasSuggestions && ctx.selectedCount > 0) {
+ // Clips suggested, ready for action
+ hints.push(
+ { prompt: "Export all selected clips", description: `Render ${ctx.selectedCount} clip${ctx.selectedCount !== 1 ? "s" : ""} as vertical shorts`, category: "export" },
+ { prompt: "Export clip #1", description: "Render just the first clip", category: "export" },
+ { prompt: "Change all clips to hormozi style", description: "Bold uppercase, yellow highlight", category: "refine" },
+ { prompt: "Extend clip #1 by 10 seconds", description: "Adjust timing before export", category: "refine" },
+ { prompt: "Find 5 more moments", description: "Additional clips from the transcript", category: "analyze" },
+ );
+ } else if (ctx.phase === "done") {
+ hints.push(
+ { prompt: "Find more viral moments from the transcript", description: "Get another batch of clips", category: "analyze" },
+ { prompt: "Re-export all clips with karaoke style", description: "Try a different caption look", category: "refine" },
+ { prompt: "Save these settings as a preset called 'myshow'", description: "Reuse this config next time", category: "refine" },
+ );
+ }
+
+ res.json({ hints, phase: ctx.phase, hasVideo: ctx.hasVideo, hasTranscript: ctx.hasTranscript, hasSuggestions: ctx.hasSuggestions, selectedCount: ctx.selectedCount });
+});
+
+/**
+ * POST /api/generate-prompt — Build an MCP prompt for the given action using authoritative server state.
+ * Body: { action: "suggest" | "export" | "restyle" }
+ * Returns: { prompt, action, context }
+ */
+app.post("/api/generate-prompt", (req, res) => {
+ const action = req.body.action || "suggest";
+ if (!["suggest", "export", "restyle"].includes(action)) {
+ res.status(400).json({ error: "action must be 'suggest', 'export', or 'restyle'" });
+ return;
+ }
+ const prompt = buildPromptForAction(action);
+ const ctx = getStateContext();
+ res.json({ prompt, action, context: ctx });
+});
+
// --- MCP ↔ UI Bridge Endpoints ---
/**