Skip to content

TryWorld2026/paper-algorithm / skills/tryworld-koubo

tryworld-koubo

Verified

试界TryWorld AI 口播视频的统一定位入口,覆盖口播全流程(选题/写稿/优化/出片)。涉及口播的请求都应触发:做口播/口播视频/口播稿/写口播稿/帮我选题/口播选题/这周做什么口播/AI 资讯盘点,或直接粘贴口播稿要求优化出片。自动识别两种模式:①直接给稿 → $tryworld-paper 优化并出片;②要选题 → $tryworld-topics 拉 AIHOT 资讯产选题清单 → 挑选 → 写稿 → 优化 → 出片。子命令:只要选题/只要写稿/只优化不出片。交付附四平台推荐发布时间。无需同时引用其他技能。

FileKindSize
NOTICE.mdmarkdown551 B
SKILL.mdskill md7.6 KB
agents/openai.yamlconfig209 B
references/workflow.mdmarkdown10.3 KB
references/writing-methodology.mdmarkdown1.7 KB
scripts/notify_delivery.ps1script7.5 KB
scripts/notify_delivery.pyscript6.8 KB

scripts/notify_delivery.ps1

View on GitHub
# DEPRECATED: 保留作 Windows PowerShell 回退。规范路径为同名 .py(跨平台)
# skills/tryworld-koubo/scripts/notify_delivery.py,详见 README「Environment」。新功能不再同步到本脚本。
# tryworld-koubo · 成片交付邮件通知(Windows PowerShell)
# 用法: powershell -File scripts/notify_delivery.ps1 -ProjectDir <项目目录> [-ThemeFile <主题JSON路径>] [-DryRun]
param(
  [string]$ProjectDir = (Get-Location).Path,
  [string]$Recipient = "",
  [string]$ThemeFile = "",
  [switch]$DryRun
)
$ErrorActionPreference = "Stop"


# ---- 主题文件:品牌名与发布计划(可选;缺失时用硬编码默认值) ----
if ($ThemeFile -and -not (Test-Path -LiteralPath $ThemeFile)) { Write-Warning ("指定的主题文件不存在: " + $ThemeFile + ",使用默认品牌值") }
$defaultTheme = Join-Path $PSScriptRoot "..\..\tryworld-paper\themes\paper-algorithm.json"
$themePath = if ($ThemeFile) { $ThemeFile } elseif (Test-Path -LiteralPath $defaultTheme) { $defaultTheme } else { "" }
$brandName = "TryWorld"
$planTitle = "试界TryWorld · 平台发布计划"
$planLines = @("小红书:中午 12:30","抖音:晚上 19:30","B站:晚上 20:30","微信视频号:晚上 20:30")
if ($themePath -and (Test-Path -LiteralPath $themePath)) {
  try {
    $cfg = Get-Content -LiteralPath $themePath -Raw -Encoding UTF8 | ConvertFrom-Json
    if ($cfg.brand.platform_name) { $brandName = $cfg.brand.platform_name }
    if ($cfg.publish_plan.title) { $planTitle = $cfg.publish_plan.title }
    if ($cfg.publish_plan.platforms) {
      $planLines = @($cfg.publish_plan.platforms | ForEach-Object { "{0}:{1}" -f $_.name, $_.time })
    }
  } catch { Write-Warning "主题文件解析失败,使用默认品牌值: $themePath" }
}
$VideoAttachLimitMB = 35   # QQ 邮箱附件上限约 50MB,含 base64 开销,单文件安全阈值 35MB

# ---- 收集产物 ----
$out = Join-Path $ProjectDir "outputs"
if (-not (Test-Path -LiteralPath $out)) { Write-Warning ("未找到 outputs: " + $out); exit 0 }
$video = Get-ChildItem -LiteralPath $out -Filter *.mp4 -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $video) { Write-Warning ("outputs 中无成片 mp4,跳过邮件通知: " + $out); exit 0 }
$coverH = Get-ChildItem -LiteralPath $out -Filter "*cover_4x3*.png" -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $coverH) { $coverH = Get-ChildItem -LiteralPath $out -Filter "*封面*4x3*.png" -ErrorAction SilentlyContinue | Select-Object -First 1 }
$coverV = Get-ChildItem -LiteralPath $out -Filter "*cover_3x4*.png" -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $coverV) { $coverV = Get-ChildItem -LiteralPath $out -Filter "*封面*3x4*.png" -ErrorAction SilentlyContinue | Select-Object -First 1 }
if (-not $coverH -or -not $coverV) {
  $pngs = Get-ChildItem -LiteralPath $out -Filter *.png -ErrorAction SilentlyContinue | Select-Object -First 2
  $coverH = $pngs[0]; $coverV = $pngs[1]
}
$titles = Get-ChildItem -LiteralPath $out -Filter "titles.txt" -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $titles) { $titles = Get-ChildItem -LiteralPath $out -Filter "*标题*.txt" -ErrorAction SilentlyContinue | Select-Object -First 1 }

# 平台标题改为直接写进正文,不再作为附件
$titlesText = ""
if ($titles) { $titlesText = (Get-Content -LiteralPath $titles.FullName -Encoding UTF8 -Raw).Trim() }

# 视频按大小决定是否附带(QQ 邮箱附件上限)
$videoAttach = $null
$videoNote = ""
if ($video.Length -le ($VideoAttachLimitMB * 1MB)) {
  $videoAttach = $video.FullName
} else {
  $videoNote = "主视频约 " + [math]::Round($video.Length / 1MB, 1) + " MB,超出邮箱附件上限,未随邮件发送(文件名: " + $video.Name + ")。"
}
$attachLabel = "横版封面 / 竖版封面"
if ($videoAttach) { $attachLabel = "主视频 / 横版封面 / 竖版封面" }
$attachments = @($videoAttach, $coverH.FullName, $coverV.FullName) | Where-Object { $_ -and (Test-Path -LiteralPath $_) }

$proj = Split-Path -Leaf $ProjectDir
$date = Get-Date -Format "yyyy-MM-dd"
$subject = "✅ $brandName 口播成片已交付 · $proj · $date"
$body = @"
成片已交付,产物已作为附件随邮件发送:

【附件】$attachLabel
$videoNote
【平台标题】
$titlesText

【发布计划】
$($planLines -join "`n")

—— tryworld-koubo 自动通知
"@

if ($DryRun) {
  Write-Output "===== DRY RUN: 邮件内容预览 ====="
  Write-Output ("收件人: " + $(if ($Recipient) { $Recipient } else { "<QQ_EMAIL_ACCOUNT>" }))
  Write-Output ("主题: " + $subject)
  Write-Output "----- 附件 -----"
  $attachments | ForEach-Object { Write-Output ("  - " + $_) }
  Write-Output "----- 正文 -----"
  Write-Output $body
  exit 0
}

$qqCandidates = @(
  (Join-Path $env:USERPROFILE ".agents\skills\qq-email"),
  (Join-Path $env:USERPROFILE ".codex\skills\qq-email")
)
$qqEmailSkill = $qqCandidates | Where-Object { Test-Path -LiteralPath (Join-Path $_ "scripts\send.js") } | Select-Object -First 1
if (-not $qqEmailSkill) {
  Write-Warning "未找到 qq-email 技能(请安装到 ~/.agents/skills 或 ~/.codex/skills),跳过邮件通知(不阻塞交付)。"
  exit 0
}
$sendJs = Join-Path $qqEmailSkill "scripts\send.js"

# ---- 凭证检查(进程环境变量 -> 注册表用户环境变量) ----
if (-not $env:QQ_EMAIL_ACCOUNT) {
  try { $reg = Get-ItemProperty -Path "HKCU:\Environment" -Name QQ_EMAIL_ACCOUNT -ErrorAction Stop; $env:QQ_EMAIL_ACCOUNT = $reg.QQ_EMAIL_ACCOUNT } catch { }
}
if (-not $env:QQ_EMAIL_AUTH_CODE) {
  try { $reg = Get-ItemProperty -Path "HKCU:\Environment" -Name QQ_EMAIL_AUTH_CODE -ErrorAction Stop; $env:QQ_EMAIL_AUTH_CODE = $reg.QQ_EMAIL_AUTH_CODE } catch { }
}
if (-not $env:QQ_EMAIL_ACCOUNT -or -not $env:QQ_EMAIL_AUTH_CODE) {
  Write-Warning "未配置 QQ_EMAIL_ACCOUNT / QQ_EMAIL_AUTH_CODE(环境变量或注册表均无),跳过邮件通知(不阻塞交付)。"
  Write-Warning "配置方法: setx QQ_EMAIL_ACCOUNT \"你的邮箱\" 和 setx QQ_EMAIL_AUTH_CODE \"IMAP/SMTP授权码\",重开终端生效。"
  exit 0
}
if (-not (Test-Path -LiteralPath $sendJs)) { Write-Warning ("qq-email send.js 不存在: " + $sendJs); exit 0 }
if ($Recipient -eq "") { $Recipient = $env:QQ_EMAIL_ACCOUNT }

Write-Output "正在发送成片通知邮件 ..."

# 用 .NET Process 直连 node:参数 UTF-16、正文 UTF-8 字节写 stdin、附件 --attach 传路径,避免 PowerShell 5.1 编码转换乱码
try { $node = (Get-Command node -ErrorAction Stop).Source } catch {
  Write-Warning "未找到 node(邮件通知依赖 qq-email 技能的 send.js),跳过邮件通知(不阻塞交付)。"
  exit 0
}
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = $node
$psi.UseShellExecute = $false
$psi.RedirectStandardInput = $true
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
$psi.StandardOutputEncoding = [System.Text.Encoding]::UTF8
$psi.StandardErrorEncoding = [System.Text.Encoding]::UTF8
$attachArgs = ""
foreach ($a in $attachments) { $attachArgs += ' --attach "' + $a + '"' }
$psi.Arguments = '"' + $sendJs + '" "' + $Recipient + '" "' + $subject + '" --stdin' + $attachArgs
$proc = [System.Diagnostics.Process]::Start($psi)
$bytes = [System.Text.Encoding]::UTF8.GetBytes($body)
$proc.StandardInput.BaseStream.Write($bytes, 0, $bytes.Length)
$proc.StandardInput.Close()
$stdout = $proc.StandardOutput.ReadToEnd()
$stderr = $proc.StandardError.ReadToEnd()
$proc.WaitForExit()
if ($proc.ExitCode -ne 0) { Write-Error ("邮件发送失败: " + $stderr.Trim()); exit 1 }
Write-Output $stdout.Trim()
Write-Output "邮件通知完成。"
add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution.Stars: 114kUpdated Claude CodeCodexVerifiedInstall
add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation.Stars: 114kUpdated Claude CodeCodexVerifiedInstall
diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope.Stars: 114kUpdated Claude CodeCodexVerifiedInstall
fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks.Stars: 114kUpdated Claude CodeCodexVerifiedInstall