@lingjingai/scriptctl
v0.34.0
Published
剧本阶段统一 CLI:直转外部素材到 script.json,以及当前最终剧本的读取、校验、原子编辑与批量 patch 精修。
Downloads
5,878
Readme
@lingjingai/scriptctl
剧本阶段统一 CLI:把外部素材(txt/md/docx/xlsx/pdf/json)直转为结构化 script.json,以及对当前最终剧本做读取、校验、原子编辑与批量 patch 精修。
安装
npm install -g @lingjingai/scriptctlE2B agent-sandbox 镜像在 template_bundle.py 的 NPM_GLOBAL_PACKAGES 中已声明,无需手动安装。
用法
scriptctl --help # 顶层帮助
scriptctl doctor # 环境自检
scriptctl update # 更新全局安装的 scriptctl
scriptctl changelog # 查看当前版本功能变更
scriptctl direct init --source-path <file>
scriptctl direct validate
scriptctl direct export
scriptctl patch <patch.json>详细子命令、参数与退出码以 scriptctl <cmd> --help 为准,agent 行为约定见
agent-sandbox-runtime 中的 SKILL.md。
退出码
| 码 | 含义 | |---|---| | 0 | success | | 64 | usage / 参数错误 | | 66 | input file unavailable | | 70 | provider / runtime failure | | 78 | validation failed; agent repair needed |
环境变量
| 变量 | 作用 |
|---|---|
| PROJECT_LITELLM_GATEWAY_API_KEY | Anthropic key(仅 --provider anthropic 时需要) |
| PROJECT_LITELLM_GATEWAY_BASE_URL | 自定义 Anthropic gateway |
| SCRIPTCTL_ANTHROPIC_MODEL | 覆盖默认 model(默认 claude-sonnet-4-6-packy) |
| AWB_BASE_URL | script-output gateway URL |
| LINGJING_AWB_ACCESS_KEY | gateway 访问凭证 |
| SANDBOX_PROJECT_GROUP_NO | 项目组号(也可用 --project-group-no) |
| SCRIPTCTL_NO_DOTENV | 设为 1 跳过 .env 加载 |
| SCRIPTCTL_PROVIDER_ATTEMPTS | provider 重试次数(默认 3,clamped 到 [1,6]) |
开发
pnpm install
pnpm run build # tsc → dist/
pnpm test # vitest run,含端到端 mock-flow(pretest 自动跑 build)
pnpm run test:coverage # 全量 + 输出 coverage/index.html
pnpm run typecheck # tsc --noEmitChangelog
功能变更记录在 changes/:
- 开发中改动写入
changes/unreleased.md - 发版时把
unreleased.md固化为changes/<version>.md scriptctl changelog查询当前版本scriptctl changelog --unreleased查询开发中变更scriptctl changelog --from <version> [--to <version>]查询版本区间
发布
# 改版本
pnpm version patch # 或 minor / major
# 把 changes/unreleased.md 固化为 changes/<新版本>.md,并重置 unreleased 模板
pnpm publish # access=public,会自动跑 prepublishOnly
# 同步更新 agent-sandbox-runtime/template_bundle.py 里的 @lingjingai/scriptctl@<新版本>License
MIT
