ai-scriptify
Advanced tools
| # Analyze | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Analyze - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # 人物设定 | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| # 检查前置文件 | ||
| $specFile = Test-SpecExists | ||
| $ideaFile = Join-Path $projectDir "idea.md" | ||
| if (-not (Test-Path $ideaFile)) { | ||
| $error = @{ | ||
| status = "error" | ||
| message = "请先运行 /idea 完成故事构思" | ||
| } | ||
| Output-Json $error | ||
| exit 1 | ||
| } | ||
| $charactersFile = Join-Path $projectDir "characters.md" | ||
| # 读取已有内容 | ||
| $specContent = Get-Content $specFile | ConvertFrom-Json | ||
| $ideaContent = Get-Content $ideaFile -Raw | ||
| # 检查是否已有人物设定 | ||
| if (Test-Path $charactersFile) { | ||
| $existingCharacters = Get-Content $charactersFile -Raw | ||
| $wordCount = Count-ScriptWords -FilePath $charactersFile | ||
| $result = @{ | ||
| status = "success" | ||
| action = "review" | ||
| project_name = $projectName | ||
| characters_file = $charactersFile | ||
| spec = $specContent | ||
| idea_content = $ideaContent | ||
| existing_characters = $existingCharacters | ||
| word_count = $wordCount | ||
| message = "发现已有人物设定,AI 可引导用户审查或补充" | ||
| } | ||
| Output-Json $result | ||
| } else { | ||
| # 创建人物设定模板 | ||
| $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" | ||
| $template = @" | ||
| # 人物设定 | ||
| ## 主要角色 | ||
| ### 主角 | ||
| **姓名**: | ||
| **年龄**: | ||
| **职业**: | ||
| **性格**: | ||
| **外貌**: | ||
| **目标**: | ||
| **弱点**: | ||
| **成长弧线**: | ||
| ### 配角1 | ||
| **姓名**: | ||
| **年龄**: | ||
| **职业**: | ||
| **性格**: | ||
| **与主角关系**: | ||
| **在故事中的作用**: | ||
| ### 配角2 | ||
| **姓名**: | ||
| **年龄**: | ||
| **职业**: | ||
| **性格**: | ||
| **与主角关系**: | ||
| **在故事中的作用**: | ||
| ## 次要角色 | ||
| (根据需要添加) | ||
| --- | ||
| 创建时间: $timestamp | ||
| "@ | ||
| Set-Content -Path $charactersFile -Value $template | ||
| $result = @{ | ||
| status = "success" | ||
| action = "create" | ||
| project_name = $projectName | ||
| characters_file = $charactersFile | ||
| spec = $specContent | ||
| idea_content = $ideaContent | ||
| message = "已创建人物设定模板,AI 应引导用户填写" | ||
| } | ||
| Output-Json $result | ||
| } |
| # 通用函数库 - Scriptify (PowerShell) | ||
| # 获取 Scriptify 项目根目录 | ||
| function Get-ScriptifyRoot { | ||
| # 查找包含 .scriptify/config.json 的项目根目录 | ||
| if (Test-Path ".scriptify/config.json") { | ||
| return Get-Location | ||
| } | ||
| # 向上查找包含 .scriptify 的目录 | ||
| $current = Get-Location | ||
| while ($current.Path -ne $current.Root.Path) { | ||
| $configPath = Join-Path $current ".scriptify/config.json" | ||
| if (Test-Path $configPath) { | ||
| return $current | ||
| } | ||
| $current = Split-Path $current -Parent | ||
| } | ||
| Write-Error "错误: 未找到 scriptify 项目根目录" | ||
| Write-Error "提示: 请在 scriptify 项目目录内运行,或先运行 'scriptify init <项目名>' 创建项目" | ||
| exit 1 | ||
| } | ||
| # 获取当前剧本项目目录(就是工作区根目录) | ||
| function Get-CurrentProject { | ||
| return Get-ScriptifyRoot | ||
| } | ||
| # 获取项目名称(从配置文件读取) | ||
| function Get-ProjectName { | ||
| $scriptifyRoot = Get-ScriptifyRoot | ||
| $configPath = Join-Path $scriptifyRoot ".scriptify/config.json" | ||
| if (Test-Path $configPath) { | ||
| $config = Get-Content $configPath | ConvertFrom-Json | ||
| return $config.name | ||
| } else { | ||
| return Split-Path $scriptifyRoot -Leaf | ||
| } | ||
| } | ||
| # 创建带编号的目录 | ||
| function New-NumberedDirectory { | ||
| param( | ||
| [string]$BaseDir, | ||
| [string]$Prefix | ||
| ) | ||
| if (-not (Test-Path $BaseDir)) { | ||
| New-Item -ItemType Directory -Path $BaseDir -Force | Out-Null | ||
| } | ||
| # 找到最高编号 | ||
| $highest = 0 | ||
| Get-ChildItem -Path $BaseDir -Directory | ForEach-Object { | ||
| if ($_.Name -match '^(\d+)') { | ||
| $number = [int]$matches[1] | ||
| if ($number -gt $highest) { | ||
| $highest = $number | ||
| } | ||
| } | ||
| } | ||
| # 返回下一个编号 | ||
| $next = $highest + 1 | ||
| return "{0:D3}" -f $next | ||
| } | ||
| # 输出 JSON(用于与 AI 助手通信) | ||
| function Output-Json { | ||
| param([object]$Object) | ||
| if ($Object -is [string]) { | ||
| Write-Output $Object | ||
| } else { | ||
| $Object | ConvertTo-Json -Depth 10 -Compress | ||
| } | ||
| } | ||
| # 确保文件存在 | ||
| function Ensure-File { | ||
| param( | ||
| [string]$File, | ||
| [string]$Template | ||
| ) | ||
| if (-not (Test-Path $File)) { | ||
| if (Test-Path $Template) { | ||
| Copy-Item $Template $File | ||
| } else { | ||
| New-Item -ItemType File -Path $File -Force | Out-Null | ||
| } | ||
| } | ||
| } | ||
| # 准确的字数统计(支持剧本格式) | ||
| # 排除场景描述、人物名等格式标记,只统计对话和叙述内容 | ||
| function Count-ScriptWords { | ||
| param([string]$FilePath) | ||
| if (-not (Test-Path $FilePath)) { | ||
| return 0 | ||
| } | ||
| $content = Get-Content $FilePath -Raw | ||
| # 移除代码块 | ||
| $content = $content -replace '(?s)```.*?```', '' | ||
| # 移除 Markdown 标记 | ||
| $content = $content -replace '^#+\s*', '' | ||
| $content = $content -replace '\*\*', '' | ||
| $content = $content -replace '__', '' | ||
| $content = $content -replace '\*', '' | ||
| $content = $content -replace '_', '' | ||
| $content = $content -replace '\[', '' | ||
| $content = $content -replace '\]', '' | ||
| $content = $content -replace '\(http[^\)]*\)', '' | ||
| $content = $content -replace '^>\s*', '' | ||
| # 移除所有空白和标点 | ||
| $content = $content -replace '\s', '' | ||
| $content = $content -replace '[^\p{L}\p{N}]', '' | ||
| # 统计字符数 | ||
| return $content.Length | ||
| } | ||
| # 显示友好的字数信息 | ||
| function Show-WordCountInfo { | ||
| param( | ||
| [string]$FilePath, | ||
| [int]$MinWords = 0, | ||
| [int]$MaxWords = 999999 | ||
| ) | ||
| $actualWords = Count-ScriptWords -FilePath $FilePath | ||
| Write-Output "字数:$actualWords" | ||
| if ($MinWords -gt 0) { | ||
| if ($actualWords -lt $MinWords) { | ||
| Write-Output "⚠️ 未达到最低字数要求(最小:$MinWords)" | ||
| } elseif ($actualWords -gt $MaxWords) { | ||
| Write-Output "⚠️ 超过最大字数限制(最大:$MaxWords)" | ||
| } else { | ||
| Write-Output "✅ 符合字数要求($MinWords-$MaxWords)" | ||
| } | ||
| } | ||
| } | ||
| # 检查spec.json配置文件是否存在 | ||
| function Test-SpecExists { | ||
| $projectDir = Get-CurrentProject | ||
| $configFile = Join-Path $projectDir "spec.json" | ||
| if (-not (Test-Path $configFile)) { | ||
| $error = @{ | ||
| status = "error" | ||
| message = "项目配置文件不存在,请先运行 /spec 定义剧本规格" | ||
| } | ||
| Output-Json $error | ||
| exit 1 | ||
| } | ||
| return $configFile | ||
| } |
| # Compare | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Compare - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Compress | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Compress - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Diff | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Diff - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Explosion-density | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Explosion-density - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Export | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Export - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Externalize | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Externalize - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Extract | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Extract - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Fill | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Fill - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Hook-check | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Hook-check - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # 故事构思 | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| # 检查配置文件 | ||
| $specFile = Test-SpecExists | ||
| $ideaFile = Join-Path $projectDir "idea.md" | ||
| # 读取剧本规格 | ||
| $specContent = Get-Content $specFile | ConvertFrom-Json | ||
| # 检查是否已有创意文件 | ||
| if (Test-Path $ideaFile) { | ||
| $existingIdea = Get-Content $ideaFile -Raw | ||
| $wordCount = Count-ScriptWords -FilePath $ideaFile | ||
| $result = @{ | ||
| status = "success" | ||
| action = "review" | ||
| project_name = $projectName | ||
| idea_file = $ideaFile | ||
| spec = $specContent | ||
| existing_idea = $existingIdea | ||
| word_count = $wordCount | ||
| message = "发现已有创意,AI 可引导用户审查或修改" | ||
| } | ||
| Output-Json $result | ||
| } else { | ||
| # 创建创意模板 | ||
| $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" | ||
| $template = @" | ||
| # 故事创意 | ||
| ## 故事核心 | ||
| ### 主角 | ||
| - 姓名: | ||
| - 职业/身份: | ||
| - 年龄/性格: | ||
| - 核心特质: | ||
| ### 目标 | ||
| 主角想要达成什么? | ||
| ### 障碍 | ||
| 什么阻止主角达成目标? | ||
| ### 人物弧线 | ||
| 主角如何成长/转变?(从A点到B点) | ||
| ## 故事钩子 | ||
| 用一句话概括你的故事(30字以内): | ||
| ## 核心冲突 | ||
| ## 独特卖点 | ||
| 这个故事与众不同的地方: | ||
| --- | ||
| 创建时间: $timestamp | ||
| "@ | ||
| Set-Content -Path $ideaFile -Value $template | ||
| $result = @{ | ||
| status = "success" | ||
| action = "create" | ||
| project_name = $projectName | ||
| idea_file = $ideaFile | ||
| spec = $specContent | ||
| message = "已创建创意模板,AI 应引导用户思考并填写" | ||
| guidance = "通过提问引导用户思考,而不是替用户想创意" | ||
| } | ||
| Output-Json $result | ||
| } |
| # Import | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Import - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Optimize | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Optimize - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # 故事大纲 | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| # 检查前置文件 | ||
| $specFile = Test-SpecExists | ||
| $ideaFile = Join-Path $projectDir "idea.md" | ||
| if (-not (Test-Path $ideaFile)) { | ||
| $error = @{ | ||
| status = "error" | ||
| message = "请先运行 /idea 完成故事构思" | ||
| } | ||
| Output-Json $error | ||
| exit 1 | ||
| } | ||
| $outlineFile = Join-Path $projectDir "outline.md" | ||
| $progressFile = Join-Path $projectDir ".scriptify" "progress.json" | ||
| # 读取已有内容 | ||
| $specContent = Get-Content $specFile | ConvertFrom-Json | ||
| $ideaContent = Get-Content $ideaFile -Raw | ||
| # 检查进度文件 | ||
| $progressData = @{} | ||
| if (Test-Path $progressFile) { | ||
| $progress = Get-Content $progressFile | ConvertFrom-Json | ||
| if ($progress.PSObject.Properties.Name -contains "outline") { | ||
| $progressData = $progress.outline | ||
| } | ||
| } | ||
| # 检查是否已有大纲 | ||
| if (Test-Path $outlineFile) { | ||
| $existingOutline = Get-Content $outlineFile -Raw | ||
| $wordCount = Count-ScriptWords -FilePath $outlineFile | ||
| $result = @{ | ||
| status = "success" | ||
| action = "review" | ||
| project_name = $projectName | ||
| outline_file = $outlineFile | ||
| spec = $specContent | ||
| idea_content = $ideaContent | ||
| existing_outline = $existingOutline | ||
| word_count = $wordCount | ||
| progress = $progressData | ||
| message = "发现已有大纲,AI 可引导用户审查或修改" | ||
| } | ||
| Output-Json $result | ||
| } else { | ||
| # 创建大纲模板 | ||
| $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" | ||
| $template = @" | ||
| # 故事大纲 | ||
| ## 三幕结构 | ||
| ### 第一幕:建置 (Setup) | ||
| **目标**: 介绍世界观、主角、日常生活 | ||
| - 开场(Hook): | ||
| - 主角的日常世界: | ||
| - 激励事件(Inciting Incident): | ||
| - 第一幕转折点: | ||
| ### 第二幕:对抗 (Confrontation) | ||
| **目标**: 主角面对困难、成长、挣扎 | ||
| - 主角的计划: | ||
| - B故事线(副线): | ||
| - 中点(Midpoint)转折: | ||
| - 低谷时刻(All is Lost): | ||
| - 第二幕转折点: | ||
| ### 第三幕:解决 (Resolution) | ||
| **目标**: 高潮对决、解决问题、完成弧线 | ||
| - 主角的觉悟: | ||
| - 高潮对决: | ||
| - 结局: | ||
| - 尾声(如有): | ||
| ## 核心节拍(Beat Sheet) | ||
| 1. 开场画面: | ||
| 2. 主题陈述: | ||
| 3. 铺陈: | ||
| 4. 推动剂: | ||
| 5. 争论: | ||
| 6. 进入第二幕: | ||
| 7. B故事线: | ||
| 8. 娱乐时刻: | ||
| 9. 中点: | ||
| 10. 坏人逼近: | ||
| 11. 一无所有: | ||
| 12. 灵魂暗夜: | ||
| 13. 进入第三幕: | ||
| 14. 决战: | ||
| 15. 结局: | ||
| --- | ||
| 创建时间: $timestamp | ||
| "@ | ||
| Set-Content -Path $outlineFile -Value $template | ||
| $result = @{ | ||
| status = "success" | ||
| action = "create" | ||
| project_name = $projectName | ||
| outline_file = $outlineFile | ||
| spec = $specContent | ||
| idea_content = $ideaContent | ||
| progress = $progressData | ||
| message = "已创建大纲模板,AI 可根据模式引导用户填写" | ||
| } | ||
| Output-Json $result | ||
| } |
| # Platform-fit | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Platform-fit - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Polish | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Polish - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Review | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Review - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Scene (分场) | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| # 检查前置文件 | ||
| $specFile = Test-SpecExists | ||
| $outlineFile = Join-Path $projectDir "outline.md" | ||
| if (-not (Test-Path $outlineFile)) { | ||
| $error = @{ | ||
| status = "error" | ||
| message = "请先运行 /outline 完成故事大纲" | ||
| } | ||
| Output-Json $error | ||
| exit 1 | ||
| } | ||
| $sceneFile = Join-Path $projectDir "scene.md" | ||
| # 读取已有内容 | ||
| $specContent = Get-Content $specFile | ConvertFrom-Json | ||
| $outlineContent = Get-Content $outlineFile -Raw | ||
| # 检查是否已有分场大纲 | ||
| if (Test-Path $sceneFile) { | ||
| $existingScene = Get-Content $sceneFile -Raw | ||
| $wordCount = Count-ScriptWords -FilePath $sceneFile | ||
| $result = @{ | ||
| status = "success" | ||
| action = "review" | ||
| project_name = $projectName | ||
| scene_file = $sceneFile | ||
| spec = $specContent | ||
| outline_content = $outlineContent | ||
| existing_scene = $existingScene | ||
| word_count = $wordCount | ||
| message = "发现已有分场大纲,AI 可引导用户审查或修改" | ||
| } | ||
| Output-Json $result | ||
| } else { | ||
| # 创建分场模板 | ||
| $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" | ||
| $template = @" | ||
| # 分场大纲 | ||
| ## 场次列表 | ||
| ### 第1集 | ||
| **场1-1**: | ||
| - 地点: | ||
| - 时间:日/夜 | ||
| - 人物: | ||
| - 目的: | ||
| - 冲突: | ||
| **场1-2**: | ||
| - 地点: | ||
| - 时间:日/夜 | ||
| - 人物: | ||
| - 目的: | ||
| - 冲突: | ||
| --- | ||
| 创建时间: $timestamp | ||
| "@ | ||
| Set-Content -Path $sceneFile -Value $template | ||
| $result = @{ | ||
| status = "success" | ||
| action = "create" | ||
| project_name = $projectName | ||
| scene_file = $sceneFile | ||
| spec = $specContent | ||
| outline_content = $outlineContent | ||
| message = "已创建分场模板,AI 应引导用户填写" | ||
| } | ||
| Output-Json $result | ||
| } |
| # Script | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Script - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Shorten | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Shorten - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # 定义/更新剧本规格 | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $specFile = Join-Path $projectDir "spec.json" | ||
| $configFile = Join-Path $projectDir ".scriptify" "config.json" | ||
| # 读取 config.json 中的 defaultType (如果存在) | ||
| $defaultType = "" | ||
| if (Test-Path $configFile) { | ||
| $config = Get-Content $configFile | ConvertFrom-Json | ||
| if ($config.PSObject.Properties.Name -contains "defaultType") { | ||
| $defaultType = $config.defaultType | ||
| } | ||
| } | ||
| # 如果已有配置,读取现有配置 | ||
| if (Test-Path $specFile) { | ||
| $existingConfig = Get-Content $specFile | ConvertFrom-Json | ||
| $result = @{ | ||
| status = "success" | ||
| action = "update" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| spec_file = $specFile | ||
| existing_config = $existingConfig | ||
| message = "找到现有配置,AI 可引导用户更新" | ||
| } | ||
| Output-Json $result | ||
| } else { | ||
| # 创建初始配置模板 | ||
| $timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") | ||
| $initialConfig = @{ | ||
| project_name = $projectName | ||
| type = $defaultType | ||
| duration = "" | ||
| episodes = 0 | ||
| genre = "" | ||
| audience = @{ | ||
| age = "" | ||
| gender = "" | ||
| } | ||
| target_platform = @() | ||
| tone = "" | ||
| created_at = $timestamp | ||
| updated_at = $timestamp | ||
| } | ||
| $initialConfig | ConvertTo-Json -Depth 10 | Set-Content $specFile | ||
| $result = @{ | ||
| status = "success" | ||
| action = "create" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| spec_file = $specFile | ||
| default_type = $defaultType | ||
| message = "已创建配置模板,AI 应引导用户填写以下信息" | ||
| required_fields = @( | ||
| "type (类型): 短剧/短视频/长剧/电影", | ||
| "duration (时长): 如 '10分钟×10集' 或 '90分钟'", | ||
| "genre (题材): 悬疑/言情/职场/古装等", | ||
| "audience (受众): 年龄段和性别", | ||
| "target_platform (目标平台): 抖音/快手/B站/长视频平台等" | ||
| ) | ||
| } | ||
| Output-Json $result | ||
| } |
| # Viral-score | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Viral-score - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
| # Visualize | ||
| # 加载通用函数 | ||
| . "$PSScriptRoot\common.ps1" | ||
| # 获取项目路径 | ||
| $projectDir = Get-CurrentProject | ||
| $projectName = Get-ProjectName | ||
| $result = @{ | ||
| status = "success" | ||
| project_name = $projectName | ||
| project_path = $projectDir.Path | ||
| message = "Visualize - PowerShell 脚本已创建" | ||
| } | ||
| Output-Json $result |
+1
-1
| { | ||
| "name": "ai-scriptify", | ||
| "version": "0.4.3", | ||
| "version": "0.4.4", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "description": "AI 驱动的剧本创作工具 - 专注原创剧本、小说改编、短剧优化", |
787154
2.85%132
23.36%