@lingjingai/scriptctl 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +72 -0
  2. package/dist/cli.js +309 -396
  3. package/dist/cli.js.map +1 -1
  4. package/dist/common.d.ts +9 -0
  5. package/dist/common.js.map +1 -1
  6. package/dist/domain/asset-registry.d.ts +141 -0
  7. package/dist/domain/asset-registry.js +318 -0
  8. package/dist/domain/asset-registry.js.map +1 -0
  9. package/dist/domain/collision-detector.d.ts +83 -0
  10. package/dist/domain/collision-detector.js +248 -0
  11. package/dist/domain/collision-detector.js.map +1 -0
  12. package/dist/domain/direct-core.d.ts +13 -1
  13. package/dist/domain/direct-core.js +19 -6
  14. package/dist/domain/direct-core.js.map +1 -1
  15. package/dist/domain/script-core.d.ts +11 -0
  16. package/dist/domain/script-core.js +34 -19
  17. package/dist/domain/script-core.js.map +1 -1
  18. package/dist/help-text.js +336 -4
  19. package/dist/help-text.js.map +1 -1
  20. package/dist/infra/converters.js +21 -7
  21. package/dist/infra/converters.js.map +1 -1
  22. package/dist/infra/default-writing-prompt.d.ts +31 -0
  23. package/dist/infra/default-writing-prompt.js +50 -0
  24. package/dist/infra/default-writing-prompt.js.map +1 -0
  25. package/dist/infra/default-writing-prompt.md +115 -0
  26. package/dist/infra/gemini-writer.d.ts +107 -0
  27. package/dist/infra/gemini-writer.js +207 -0
  28. package/dist/infra/gemini-writer.js.map +1 -0
  29. package/dist/infra/providers.d.ts +36 -0
  30. package/dist/infra/providers.js +186 -2
  31. package/dist/infra/providers.js.map +1 -1
  32. package/dist/output.js +26 -9
  33. package/dist/output.js.map +1 -1
  34. package/dist/usecases/episode.d.ts +48 -0
  35. package/dist/usecases/episode.js +1209 -0
  36. package/dist/usecases/episode.js.map +1 -0
  37. package/dist/usecases/script.d.ts +6 -2
  38. package/dist/usecases/script.js +49 -5
  39. package/dist/usecases/script.js.map +1 -1
  40. package/package.json +9 -5
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # @lingjingai/scriptctl
2
+
3
+ 剧本阶段统一 CLI:把外部素材(txt/md/docx/xlsx/pdf/json)直转为结构化 `script.json`,以及对当前最终剧本做读取、校验、原子编辑与批量 patch 精修。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add -g @lingjingai/scriptctl
9
+ ```
10
+
11
+ E2B agent-sandbox 镜像在 `template_bundle.py` 的 `NPM_GLOBAL_PACKAGES` 中已声明,无需手动安装。
12
+
13
+ ## 用法
14
+
15
+ ```bash
16
+ scriptctl --help # 顶层帮助
17
+ scriptctl doctor # 环境自检
18
+ scriptctl direct init --source-path <file>
19
+ scriptctl direct inspect --target review --episode 1,15,30
20
+ scriptctl direct validate
21
+ scriptctl direct export
22
+ scriptctl script patch --patch <patch.json>
23
+ ```
24
+
25
+ 详细子命令、参数与退出码以 `scriptctl <cmd> --help` 为准,agent 行为约定见
26
+ [`agent-sandbox-runtime` 中的 SKILL.md](https://gitcode.lingjingai.cn/algorithm/anime-agent/agent-sandbox-runtime/-/blob/main/templates/1_script/.claude/skills/scriptctl/SKILL.md)。
27
+
28
+ ## 退出码
29
+
30
+ | 码 | 含义 |
31
+ |---|---|
32
+ | 0 | success |
33
+ | 64 | usage / 参数错误 |
34
+ | 66 | input file unavailable |
35
+ | 70 | provider / runtime failure |
36
+ | 78 | validation failed; agent repair needed |
37
+
38
+ ## 环境变量
39
+
40
+ | 变量 | 作用 |
41
+ |---|---|
42
+ | `SCRIPTCTL_ANTHROPIC_API_KEY` | Anthropic key(仅 `--provider anthropic` 时需要) |
43
+ | `SCRIPTCTL_ANTHROPIC_BASE_URL` | 自定义 Anthropic gateway |
44
+ | `SCRIPTCTL_ANTHROPIC_MODEL` | 覆盖默认 model |
45
+ | `SCRIPTCTL_GATEWAY_URL` / `AWB_BASE_URL` | script-output gateway URL |
46
+ | `SCRIPTCTL_ACCESS_KEY` / `AWB_ACCESS_KEY` / `AWB_CODE` / `X_ACCESS_KEY` | gateway 访问凭证 |
47
+ | `SANDBOX_PROJECT_GROUP_NO` | 项目组号(也可用 `--project-group-no`) |
48
+ | `SCRIPTCTL_NO_DOTENV` | 设为 `1` 跳过 `.env` 加载 |
49
+ | `SCRIPTCTL_PROVIDER_ATTEMPTS` | provider 重试次数(默认 3,clamped 到 [1,6]) |
50
+
51
+ ## 开发
52
+
53
+ ```bash
54
+ pnpm install
55
+ pnpm run build # tsc → dist/
56
+ pnpm test # vitest run,含端到端 mock-flow(pretest 自动跑 build)
57
+ pnpm run test:coverage # 全量 + 输出 coverage/index.html
58
+ pnpm run typecheck # tsc --noEmit
59
+ ```
60
+
61
+ ## 发布
62
+
63
+ ```bash
64
+ # 改版本
65
+ pnpm version patch # 或 minor / major
66
+ pnpm publish # access=public,会自动跑 prepublishOnly
67
+ # 同步更新 agent-sandbox-runtime/template_bundle.py 里的 @lingjingai/scriptctl@<新版本>
68
+ ```
69
+
70
+ ## License
71
+
72
+ MIT