@lingjingai/scriptctl 0.1.0 → 0.2.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 (36) hide show
  1. package/README.md +71 -0
  2. package/dist/cli.js +305 -396
  3. package/dist/cli.js.map +1 -1
  4. package/dist/domain/asset-registry.d.ts +141 -0
  5. package/dist/domain/asset-registry.js +318 -0
  6. package/dist/domain/asset-registry.js.map +1 -0
  7. package/dist/domain/collision-detector.d.ts +83 -0
  8. package/dist/domain/collision-detector.js +248 -0
  9. package/dist/domain/collision-detector.js.map +1 -0
  10. package/dist/domain/direct-core.d.ts +13 -1
  11. package/dist/domain/direct-core.js +14 -4
  12. package/dist/domain/direct-core.js.map +1 -1
  13. package/dist/domain/script-core.d.ts +11 -0
  14. package/dist/domain/script-core.js +34 -19
  15. package/dist/domain/script-core.js.map +1 -1
  16. package/dist/help-text.js +283 -0
  17. package/dist/help-text.js.map +1 -1
  18. package/dist/infra/converters.js +21 -7
  19. package/dist/infra/converters.js.map +1 -1
  20. package/dist/infra/default-writing-prompt.d.ts +31 -0
  21. package/dist/infra/default-writing-prompt.js +50 -0
  22. package/dist/infra/default-writing-prompt.js.map +1 -0
  23. package/dist/infra/default-writing-prompt.md +115 -0
  24. package/dist/infra/gemini-writer.d.ts +107 -0
  25. package/dist/infra/gemini-writer.js +207 -0
  26. package/dist/infra/gemini-writer.js.map +1 -0
  27. package/dist/infra/providers.d.ts +36 -0
  28. package/dist/infra/providers.js +186 -2
  29. package/dist/infra/providers.js.map +1 -1
  30. package/dist/usecases/episode.d.ts +47 -0
  31. package/dist/usecases/episode.js +1188 -0
  32. package/dist/usecases/episode.js.map +1 -0
  33. package/dist/usecases/script.d.ts +6 -2
  34. package/dist/usecases/script.js +4 -4
  35. package/dist/usecases/script.js.map +1 -1
  36. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # @lingjingai/scriptctl
2
+
3
+ 剧本阶段统一 CLI:把外部素材(txt/md/docx/xlsx/pdf/json)直转为结构化 `script.json`,以及对当前最终剧本做读取、校验、原子编辑与批量 patch 精修。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install -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
+ npm install
55
+ npm run build # tsc → dist/
56
+ npm test # vitest run,含端到端 mock-flow
57
+ npm run typecheck # tsc --noEmit
58
+ ```
59
+
60
+ ## 发布
61
+
62
+ ```bash
63
+ # 改版本
64
+ npm version patch # 或 minor / major
65
+ npm publish # access=public,会自动跑 prepublishOnly
66
+ # 同步更新 agent-sandbox-runtime/template_bundle.py 里的 @lingjingai/scriptctl@<新版本>
67
+ ```
68
+
69
+ ## License
70
+
71
+ MIT