@playcraft/cli 0.1.42 → 0.1.44-beta

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 (390) hide show
  1. package/README.md +62 -3
  2. package/SKILLS_REGISTRY.md +149 -0
  3. package/dist/agent/local-backend.js +1 -1
  4. package/dist/auth/account-activation.js +157 -0
  5. package/dist/auth/messages.js +30 -0
  6. package/dist/cli-root-help.js +2 -0
  7. package/dist/commands/build-all.js +5 -19
  8. package/dist/commands/build-temp.js +26 -0
  9. package/dist/commands/build.js +15 -28
  10. package/dist/commands/create.js +26 -33
  11. package/dist/commands/image.js +2 -6
  12. package/dist/commands/login.js +84 -42
  13. package/dist/commands/platform-skills.generated.js +19 -0
  14. package/dist/commands/playable.js +53 -0
  15. package/dist/commands/skills.js +4 -0
  16. package/dist/commands/tools-3d.js +11 -0
  17. package/dist/commands/tools-batch.js +105 -0
  18. package/dist/commands/tools-generation.js +69 -137
  19. package/dist/commands/tools-utils.js +0 -12
  20. package/dist/commands/tools.js +2 -2
  21. package/dist/commands/video.js +122 -0
  22. package/dist/commands/workspace-runtime.js +54 -0
  23. package/dist/commands/workspace.js +40 -0
  24. package/dist/config.js +59 -4
  25. package/dist/index.js +40 -3
  26. package/dist/project-skills/builtin-import.js +225 -0
  27. package/dist/project-skills/commands.js +77 -0
  28. package/dist/project-skills/lifecycle.js +28 -0
  29. package/dist/project-skills/local-run.js +112 -0
  30. package/dist/project-skills/local-store.js +221 -0
  31. package/dist/project-skills/messages.js +80 -0
  32. package/dist/project-skills/reconcile.js +62 -0
  33. package/dist/project-skills/remote-cache.js +51 -0
  34. package/dist/project-skills/validation.js +19 -0
  35. package/dist/recording/messages.js +40 -0
  36. package/dist/recording/project-digest.js +85 -0
  37. package/dist/recording/recorder.js +293 -0
  38. package/dist/recording/scenario.js +50 -0
  39. package/dist/remix/clone.js +2 -0
  40. package/dist/remix/init-template.js +2 -0
  41. package/dist/remix/pull.js +2 -0
  42. package/dist/remix/push.js +21 -1
  43. package/dist/skill-registry/client.js +345 -0
  44. package/dist/skill-registry/commands.js +180 -0
  45. package/dist/skill-registry/evaluation-client.js +156 -0
  46. package/dist/skill-registry/evaluation-commands.js +174 -0
  47. package/dist/skill-registry/messages.js +177 -0
  48. package/dist/skill-registry/package.js +275 -0
  49. package/dist/skill-registry/platform-package.js +100 -0
  50. package/dist/utils/agent-api-client.js +210 -30
  51. package/dist/utils/environment-endpoints.js +17 -0
  52. package/dist/utils/error-diagnostics.js +20 -0
  53. package/dist/utils/playcraft-http-client.js +6 -4
  54. package/dist/utils/tool-operation-journal.js +124 -0
  55. package/dist/utils/video-evidence-git.js +81 -0
  56. package/dist/video-replication/client.js +234 -0
  57. package/dist/video-replication/comparison-evidence.js +149 -0
  58. package/dist/video-replication/comparison-files.js +57 -0
  59. package/dist/video-replication/comparison-log.js +72 -0
  60. package/dist/video-replication/comparison-messages.js +104 -0
  61. package/dist/video-replication/comparison-output.js +63 -0
  62. package/dist/video-replication/comparison-preflight.js +66 -0
  63. package/dist/video-replication/comparison.js +230 -0
  64. package/dist/video-replication/diagnostics.js +41 -0
  65. package/dist/video-replication/evidence.js +165 -0
  66. package/dist/video-replication/media.js +112 -0
  67. package/dist/video-replication/messages.js +97 -0
  68. package/dist/workspace/messages.js +67 -0
  69. package/dist/workspace/transfer-client.js +233 -0
  70. package/dist/workspace/transfer-errors.js +48 -0
  71. package/dist/workspace-runtime/batch/control.js +80 -0
  72. package/dist/workspace-runtime/batch/deliver.js +150 -0
  73. package/dist/workspace-runtime/batch/freeze.js +102 -0
  74. package/dist/workspace-runtime/batch/generate.js +205 -0
  75. package/dist/workspace-runtime/batch/git.js +40 -0
  76. package/dist/workspace-runtime/batch/occupancy.js +8 -0
  77. package/dist/workspace-runtime/batch/policy.js +70 -0
  78. package/dist/workspace-runtime/batch/prepare.js +202 -0
  79. package/dist/workspace-runtime/batch/processes.js +72 -0
  80. package/dist/workspace-runtime/batch/records.js +113 -0
  81. package/dist/workspace-runtime/batch/routes.js +58 -0
  82. package/dist/workspace-runtime/batch/source-capture.js +159 -0
  83. package/dist/workspace-runtime/codex/app-server.js +1040 -0
  84. package/dist/workspace-runtime/codex/compact.js +46 -0
  85. package/dist/workspace-runtime/codex/config-toml.js +107 -0
  86. package/dist/workspace-runtime/codex/jsonrpc-stdio.js +145 -0
  87. package/dist/workspace-runtime/codex/launcher-client.js +177 -0
  88. package/dist/workspace-runtime/codex/loopback.js +146 -0
  89. package/dist/workspace-runtime/codex/mcp-config.js +39 -0
  90. package/dist/workspace-runtime/codex/model-broker.js +263 -0
  91. package/dist/workspace-runtime/codex/native-adapter.js +9 -0
  92. package/dist/workspace-runtime/codex/permissions.js +79 -0
  93. package/dist/workspace-runtime/codex/thread-image.js +38 -0
  94. package/dist/workspace-runtime/codex/ui-instructions.js +4 -0
  95. package/dist/workspace-runtime/codex/ui-tools.js +186 -0
  96. package/dist/workspace-runtime/codex/work-mode.js +15 -0
  97. package/dist/workspace-runtime/main.js +10 -0
  98. package/dist/workspace-runtime/persistence/journal.js +365 -0
  99. package/dist/workspace-runtime/persistence/native-subagents.js +162 -0
  100. package/dist/workspace-runtime/persistence/sqlite-client.js +77 -0
  101. package/dist/workspace-runtime/persistence/sqlite-worker.js +1161 -0
  102. package/dist/workspace-runtime/persistence/stopped-execution.js +77 -0
  103. package/dist/workspace-runtime/previews/output.js +36 -0
  104. package/dist/workspace-runtime/previews/publish.js +262 -0
  105. package/dist/workspace-runtime/previews/single-file.js +43 -0
  106. package/dist/workspace-runtime/processes/managed-writes.js +69 -0
  107. package/dist/workspace-runtime/production/content-changes.js +36 -0
  108. package/dist/workspace-runtime/production/contracts.js +19 -0
  109. package/dist/workspace-runtime/production/controller.js +228 -0
  110. package/dist/workspace-runtime/production/dependencies.js +60 -0
  111. package/dist/workspace-runtime/production/native.js +239 -0
  112. package/dist/workspace-runtime/production/processes.js +102 -0
  113. package/dist/workspace-runtime/production/save-command.js +35 -0
  114. package/dist/workspace-runtime/production/source-archive.js +137 -0
  115. package/dist/workspace-runtime/production/source-copy.js +92 -0
  116. package/dist/workspace-runtime/production/stages.js +354 -0
  117. package/dist/workspace-runtime/production/storage.js +75 -0
  118. package/dist/workspace-runtime/serve.js +283 -0
  119. package/dist/workspace-runtime/server/auth.js +21 -0
  120. package/dist/workspace-runtime/server/connectivity.js +209 -0
  121. package/dist/workspace-runtime/server/desktop-host.js +429 -0
  122. package/dist/workspace-runtime/server/desktop-preview-config.js +81 -0
  123. package/dist/workspace-runtime/server/desktop-preview-service.js +157 -0
  124. package/dist/workspace-runtime/server/desktop-preview-static.js +53 -0
  125. package/dist/workspace-runtime/server/desktop-preview.js +189 -0
  126. package/dist/workspace-runtime/server/dispatch.js +1339 -0
  127. package/dist/workspace-runtime/server/endpoints.js +21 -0
  128. package/dist/workspace-runtime/server/execution-group.js +90 -0
  129. package/dist/workspace-runtime/server/http.js +1297 -0
  130. package/dist/workspace-runtime/server/lock.js +53 -0
  131. package/dist/workspace-runtime/server/rfb-watch-gate.js +168 -0
  132. package/dist/workspace-runtime/server/session-restore.js +84 -0
  133. package/dist/workspace-runtime/server/source-uploader.js +138 -0
  134. package/dist/workspace-runtime/server/terminal-host.js +366 -0
  135. package/dist/workspace-runtime/server/types.js +1 -0
  136. package/dist/workspace-runtime/server/workspace-transfer.js +168 -0
  137. package/dist/workspace-runtime/workspaces/archive.js +207 -0
  138. package/dist/workspace-runtime/workspaces/artifact-events.js +55 -0
  139. package/dist/workspace-runtime/workspaces/artifact-files.js +199 -0
  140. package/dist/workspace-runtime/workspaces/artifact-receipts.js +89 -0
  141. package/dist/workspace-runtime/workspaces/artifacts.js +282 -0
  142. package/dist/workspace-runtime/workspaces/asset-library-import.js +366 -0
  143. package/dist/workspace-runtime/workspaces/attachment-content.js +73 -0
  144. package/dist/workspace-runtime/workspaces/attachments.js +185 -0
  145. package/dist/workspace-runtime/workspaces/batch-commit.js +142 -0
  146. package/dist/workspace-runtime/workspaces/binary-content.js +65 -0
  147. package/dist/workspace-runtime/workspaces/binary-write.js +112 -0
  148. package/dist/workspace-runtime/workspaces/cli-context.js +23 -0
  149. package/dist/workspace-runtime/workspaces/cli-credentials.js +111 -0
  150. package/dist/workspace-runtime/workspaces/composer-context.js +147 -0
  151. package/dist/workspace-runtime/workspaces/context-error.js +2 -0
  152. package/dist/workspace-runtime/workspaces/dependencies.js +264 -0
  153. package/dist/workspace-runtime/workspaces/developer-command.js +64 -0
  154. package/dist/workspace-runtime/workspaces/directories.js +137 -0
  155. package/dist/workspace-runtime/workspaces/directory-access.js +37 -0
  156. package/dist/workspace-runtime/workspaces/directory-attachments.js +245 -0
  157. package/dist/workspace-runtime/workspaces/directory-create.js +57 -0
  158. package/dist/workspace-runtime/workspaces/directory-maintenance.js +111 -0
  159. package/dist/workspace-runtime/workspaces/directory-stats.js +49 -0
  160. package/dist/workspace-runtime/workspaces/disk-snapshot.js +31 -0
  161. package/dist/workspace-runtime/workspaces/empty-template.js +42 -0
  162. package/dist/workspace-runtime/workspaces/file-content.js +48 -0
  163. package/dist/workspace-runtime/workspaces/files-search.js +116 -0
  164. package/dist/workspace-runtime/workspaces/files.js +150 -0
  165. package/dist/workspace-runtime/workspaces/git-credential-broker.js +312 -0
  166. package/dist/workspace-runtime/workspaces/git-credential-helper.js +68 -0
  167. package/dist/workspace-runtime/workspaces/git-direct-store.js +155 -0
  168. package/dist/workspace-runtime/workspaces/git.js +670 -0
  169. package/dist/workspace-runtime/workspaces/instructions.js +56 -0
  170. package/dist/workspace-runtime/workspaces/json5-edit.js +170 -0
  171. package/dist/workspace-runtime/workspaces/library-attachments.js +268 -0
  172. package/dist/workspace-runtime/workspaces/optional-platform-skills.js +14 -0
  173. package/dist/workspace-runtime/workspaces/parameters.js +272 -0
  174. package/dist/workspace-runtime/workspaces/prepare.js +278 -0
  175. package/dist/workspace-runtime/workspaces/registry.js +251 -0
  176. package/dist/workspace-runtime/workspaces/remix-references.js +301 -0
  177. package/dist/workspace-runtime/workspaces/revisions.js +31 -0
  178. package/dist/workspace-runtime/workspaces/session-image.js +104 -0
  179. package/dist/workspace-runtime/workspaces/shared-git.js +40 -0
  180. package/dist/workspace-runtime/workspaces/skill-artifact-loader.js +95 -0
  181. package/dist/workspace-runtime/workspaces/skills.js +191 -0
  182. package/dist/workspace-runtime/workspaces/transfer-quota.js +69 -0
  183. package/dist/workspace-runtime/workspaces/transfer.js +471 -0
  184. package/dist/workspace-runtime/workspaces/turn-changes.js +75 -0
  185. package/dist/workspace-runtime/workspaces/video-attachments.js +49 -0
  186. package/package.json +15 -5
  187. package/project-template/.claude/agents/refs/ta-image-generation-detail.md +123 -67
  188. package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +63 -135
  189. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +33 -42
  190. package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +20 -18
  191. package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +7 -6
  192. package/project-template/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -39
  193. package/project-template/.claude/skills/playcraft-replica-validation/SKILL.md +25 -0
  194. package/project-template/.claude/skills/playcraft-replica-validation/references/contracts.md +79 -0
  195. package/project-template/.claude/skills/playcraft-video-understanding/SKILL.md +29 -0
  196. package/project-template/.claude/skills/playcraft-video-understanding/references/contracts.md +37 -0
  197. package/project-template-v2/.claude/agents/artist.md +82 -0
  198. package/project-template-v2/.claude/agents/developer.md +153 -0
  199. package/project-template-v2/.claude/agents/game-designer.md +264 -0
  200. package/project-template-v2/.claude/agents/refs/artist-art-style-catalog.md +533 -0
  201. package/project-template-v2/.claude/agents/refs/artist-color-audio-recipes.md +153 -0
  202. package/project-template-v2/.claude/agents/refs/artist-dimension-axis.md +27 -0
  203. package/project-template-v2/.claude/agents/refs/artist-master-composite-recipes.md +208 -0
  204. package/project-template-v2/.claude/agents/refs/atom-skill-library.md +81 -0
  205. package/project-template-v2/.claude/agents/refs/developer-impl-cookbook.md +432 -0
  206. package/project-template-v2/.claude/agents/refs/framework-5-component-filter.md +252 -0
  207. package/project-template-v2/.claude/agents/refs/framework-game-feel-juice.md +266 -0
  208. package/project-template-v2/.claude/agents/refs/framework-mda.md +147 -0
  209. package/project-template-v2/.claude/agents/refs/game-designer-gameplay-sufficiency.md +123 -0
  210. package/project-template-v2/.claude/agents/refs/ta-3d-flip-recipe.md +88 -0
  211. package/project-template-v2/.claude/agents/refs/ta-atlas-deliverable-standard.md +67 -0
  212. package/project-template-v2/.claude/agents/refs/ta-batch-pipeline-recipes.md +120 -0
  213. package/project-template-v2/.claude/agents/refs/ta-image-generation-detail.md +300 -0
  214. package/project-template-v2/.claude/agents/refs/ta-image-ops-reference.md +495 -0
  215. package/project-template-v2/.claude/agents/refs/ta-pipeline-cookbook.md +1141 -0
  216. package/project-template-v2/.claude/agents/refs/ta-tools-reference.md +111 -0
  217. package/project-template-v2/.claude/agents/refs/ta-vfx-preset-catalog.md +365 -0
  218. package/project-template-v2/.claude/agents/refs/threejs-cannon-pitfalls.md +412 -0
  219. package/project-template-v2/.claude/agents/reviewer.md +75 -0
  220. package/project-template-v2/.claude/agents/technical-artist.md +86 -0
  221. package/project-template-v2/.claude/hooks/snapshot-milestone.mjs +243 -0
  222. package/project-template-v2/.claude/hooks/user-prompt.mjs +133 -0
  223. package/project-template-v2/.claude/settings.json +33 -0
  224. package/project-template-v2/.claude/skills/brainstorming/SKILL.md +161 -0
  225. package/project-template-v2/.claude/skills/brainstorming/scripts/frame-template.html +270 -0
  226. package/project-template-v2/.claude/skills/brainstorming/scripts/helper.js +177 -0
  227. package/project-template-v2/.claude/skills/brainstorming/scripts/server.cjs +354 -0
  228. package/project-template-v2/.claude/skills/brainstorming/scripts/start-server.sh +148 -0
  229. package/project-template-v2/.claude/skills/brainstorming/scripts/stop-server.sh +56 -0
  230. package/project-template-v2/.claude/skills/brainstorming/scripts/wait-for-selection.sh +62 -0
  231. package/project-template-v2/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  232. package/project-template-v2/.claude/skills/brainstorming/visual-companion.md +309 -0
  233. package/project-template-v2/.claude/skills/playcraft-ad-psychology/SKILL.md +182 -0
  234. package/project-template-v2/.claude/skills/playcraft-art-style-guide/SKILL.md +123 -0
  235. package/project-template-v2/.claude/skills/playcraft-asset-state-sheet/SKILL.md +205 -0
  236. package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +280 -0
  237. package/project-template-v2/.claude/skills/playcraft-batch-pipeline/SKILL.md +184 -0
  238. package/project-template-v2/.claude/skills/playcraft-build-optimizer/SKILL.md +306 -0
  239. package/project-template-v2/.claude/skills/playcraft-image-generation/SKILL.md +298 -0
  240. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +123 -0
  241. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +254 -0
  242. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +324 -0
  243. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +97 -0
  244. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +118 -0
  245. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +137 -0
  246. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +397 -0
  247. package/project-template-v2/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +296 -0
  248. package/project-template-v2/.claude/skills/playcraft-image-ops/SKILL.md +122 -0
  249. package/project-template-v2/.claude/skills/playcraft-image-processing/SKILL.md +219 -0
  250. package/project-template-v2/.claude/skills/playcraft-masking/SKILL.md +373 -0
  251. package/project-template-v2/.claude/skills/playcraft-playable-optimization/SKILL.md +161 -0
  252. package/project-template-v2/.claude/skills/playcraft-research/SKILL.md +215 -0
  253. package/project-template-v2/.claude/skills/playcraft-skill-recommender/SKILL.md +382 -0
  254. package/project-template-v2/.claude/skills/playcraft-sprite-generation/SKILL.md +423 -0
  255. package/project-template-v2/.claude/skills/playcraft-sprite-remix/SKILL.md +158 -0
  256. package/project-template-v2/.claude/skills/playcraft-sprite-sheet/SKILL.md +100 -0
  257. package/project-template-v2/.claude/skills/playcraft-storyboard/SKILL.md +167 -0
  258. package/project-template-v2/.claude/skills/playcraft-style-qa/SKILL.md +270 -0
  259. package/project-template-v2/.claude/skills/playcraft-text-rendering/SKILL.md +236 -0
  260. package/project-template-v2/.claude/skills/playcraft-vfx-animation/SKILL.md +130 -0
  261. package/project-template-v2/.claude/skills/playwright-cli/SKILL.md +390 -0
  262. package/project-template-v2/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
  263. package/project-template-v2/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
  264. package/project-template-v2/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
  265. package/project-template-v2/.claude/skills/playwright-cli/references/running-code.md +240 -0
  266. package/project-template-v2/.claude/skills/playwright-cli/references/session-management.md +226 -0
  267. package/project-template-v2/.claude/skills/playwright-cli/references/spec-driven-testing.md +308 -0
  268. package/project-template-v2/.claude/skills/playwright-cli/references/storage-state.md +275 -0
  269. package/project-template-v2/.claude/skills/playwright-cli/references/test-generation.md +134 -0
  270. package/project-template-v2/.claude/skills/playwright-cli/references/tracing.md +142 -0
  271. package/project-template-v2/.claude/skills/playwright-cli/references/video-recording.md +153 -0
  272. package/project-template-v2/.claude/skills/session-analyzer/SKILL.md +386 -0
  273. package/project-template-v2/.claude/skills/session-analyzer/scripts/execution-breakdown.mjs +182 -0
  274. package/project-template-v2/.claude/skills/session-analyzer/scripts/find-turns.mjs +72 -0
  275. package/project-template-v2/.claude/skills/session-analyzer/scripts/heavy-output.mjs +121 -0
  276. package/project-template-v2/.claude/skills/session-analyzer/scripts/resolve-session.mjs +102 -0
  277. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-stats.mjs +127 -0
  278. package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-tool-timeline.mjs +106 -0
  279. package/project-template-v2/.claude/skills/session-analyzer/scripts/time-gaps.mjs +128 -0
  280. package/project-template-v2/.claude/skills/session-analyzer/scripts/turn-timeline.mjs +67 -0
  281. package/project-template-v2/.claude/snapshot.mjs +263 -0
  282. package/project-template-v2/.playcraft/skills.lock.json +152 -0
  283. package/project-template-v2/CLAUDE.md +146 -0
  284. package/project-template-v2/assets/audio/bgm/.gitkeep +0 -0
  285. package/project-template-v2/assets/audio/sfx/.gitkeep +0 -0
  286. package/project-template-v2/assets/bundles/.gitkeep +0 -0
  287. package/project-template-v2/assets/images/bg/.gitkeep +0 -0
  288. package/project-template-v2/assets/images/reference/.gitkeep +0 -0
  289. package/project-template-v2/assets/images/storyboard/.gitkeep +0 -0
  290. package/project-template-v2/assets/images/tiles/.gitkeep +0 -0
  291. package/project-template-v2/assets/images/ui/.gitkeep +0 -0
  292. package/project-template-v2/assets/images/vfx/.gitkeep +0 -0
  293. package/project-template-v2/assets/models/.gitkeep +0 -0
  294. package/project-template-v2/docs/harness/iteration-1/context-flow.md +254 -0
  295. package/project-template-v2/docs/harness/iteration-1/generate-flow.md +91 -0
  296. package/project-template-v2/docs/harness/iteration-1/ideate-flow.md +214 -0
  297. package/project-template-v2/docs/harness/iteration-1/optimize-flow.md +75 -0
  298. package/project-template-v2/docs/harness/iteration-1/wrapup-flow.md +63 -0
  299. package/project-template-v2/docs/harness/iteration-2/context-flow.md +223 -0
  300. package/project-template-v2/docs/harness/iteration-2/generate-flow.md +129 -0
  301. package/project-template-v2/docs/harness/iteration-2/ideate-flow.md +267 -0
  302. package/project-template-v2/docs/harness/iteration-2/optimize-flow.md +164 -0
  303. package/project-template-v2/docs/harness/iteration-2/wrapup-flow.md +115 -0
  304. package/project-template-v2/docs/harness/orchestrator-flow.md +364 -0
  305. package/project-template-v2/docs/project-state.json +60 -0
  306. package/project-template-v2/docs/project-state.md +72 -0
  307. package/project-template-v2/docs/standards/README.md +225 -0
  308. package/project-template-v2/docs/standards/agent-behavior-standards.md +174 -0
  309. package/project-template-v2/docs/standards/artifacts/design-brief.md +19 -0
  310. package/project-template-v2/docs/standards/artifacts/design.md +22 -0
  311. package/project-template-v2/docs/standards/artifacts/game-code.md +41 -0
  312. package/project-template-v2/docs/standards/artifacts/todo-list.md +41 -0
  313. package/project-template-v2/docs/standards/iter1-agent-behavior-standards.md +343 -0
  314. package/project-template-v2/game/index.ts +18 -0
  315. package/project-template-v2/globals.d.ts +51 -0
  316. package/project-template-v2/index.css +34 -0
  317. package/project-template-v2/index.html +18 -0
  318. package/project-template-v2/main.ts +9 -0
  319. package/project-template-v2/package.json +46 -0
  320. package/project-template-v2/skills/_shared/scripts/dispatch-clear.mjs +31 -0
  321. package/project-template-v2/skills/_shared/scripts/dispatch-set.mjs +86 -0
  322. package/project-template-v2/skills/_shared/scripts/dod-check.mjs +153 -0
  323. package/project-template-v2/skills/_shared/scripts/handoff-append.mjs +70 -0
  324. package/project-template-v2/skills/_shared/scripts/lib/validator-artifacts.mjs +91 -0
  325. package/project-template-v2/skills/_shared/scripts/pipeline/dod-config.mjs +131 -0
  326. package/project-template-v2/skills/_shared/scripts/pipeline/index.mjs +80 -0
  327. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-1-core.mjs +90 -0
  328. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-2-wrap.mjs +93 -0
  329. package/project-template-v2/skills/_shared/scripts/pipeline/iteration-3-visual.mjs +23 -0
  330. package/project-template-v2/skills/_shared/scripts/render-project-state.mjs +230 -0
  331. package/project-template-v2/skills/_shared/scripts/state-advance-stage.mjs +58 -0
  332. package/project-template-v2/skills/_shared/scripts/state-get.mjs +339 -0
  333. package/project-template-v2/skills/_shared/scripts/state-handoff.mjs +39 -0
  334. package/project-template-v2/skills/_shared/scripts/state-set.mjs +94 -0
  335. package/project-template-v2/skills/_shared/scripts/state-store.mjs +783 -0
  336. package/project-template-v2/skills/_shared/scripts/todo-add.mjs +88 -0
  337. package/project-template-v2/skills/_shared/scripts/todo-get.mjs +130 -0
  338. package/project-template-v2/skills/_shared/scripts/todo-remove.mjs +33 -0
  339. package/project-template-v2/skills/_shared/scripts/todo-set.mjs +47 -0
  340. package/project-template-v2/skills/_shared/scripts/verify-asset-code-sync.mjs +268 -0
  341. package/project-template-v2/skills/_shared/scripts/verify-env.mjs +285 -0
  342. package/project-template-v2/skills/_shared/scripts/verify-placeholders.mjs +161 -0
  343. package/project-template-v2/skills/playable-autoplay/SKILL.md +176 -0
  344. package/project-template-v2/skills/playable-autoplay/agents/openai.yaml +4 -0
  345. package/project-template-v2/skills/playable-debug/SKILL.md +116 -0
  346. package/project-template-v2/skills/playable-debug/agents/openai.yaml +4 -0
  347. package/project-template-v2/skills/playable-debug/references/debug-config.md +40 -0
  348. package/project-template-v2/skills/playable-record/SKILL.md +140 -0
  349. package/project-template-v2/skills/playable-record/scripts/lib/dev-server.mjs +104 -0
  350. package/project-template-v2/skills/playable-record/scripts/lib/record-audio-bridge.js +141 -0
  351. package/project-template-v2/skills/playable-record/scripts/record-playable.mjs +425 -0
  352. package/project-template-v2/skills/playable-record/scripts/verify-contract.mjs +261 -0
  353. package/project-template-v2/skills/playable-record/scripts/verify-firstwin.mjs +398 -0
  354. package/project-template-v2/skills/playable-record/scripts/verify-fusion.mjs +322 -0
  355. package/project-template-v2/skills/playable-record/scripts/verify-lifecycle.mjs +105 -0
  356. package/project-template-v2/skills/playable-record/scripts/verify-vlm-video.mjs +230 -0
  357. package/project-template-v2/skills/playable-validate/SKILL.md +61 -0
  358. package/project-template-v2/skills/playable-validate/validation-rules.md +14 -0
  359. package/project-template-v2/skills/playable-verify-ui/SKILL.md +63 -0
  360. package/project-template-v2/skills/playable-verify-ui/scripts/lib/__init__.py +1 -0
  361. package/project-template-v2/skills/playable-verify-ui/scripts/lib/config_expr.js +218 -0
  362. package/project-template-v2/skills/playable-verify-ui/scripts/lib/node_utils.js +51 -0
  363. package/project-template-v2/skills/playable-verify-ui/scripts/lib/profile_loader.py +59 -0
  364. package/project-template-v2/skills/playable-verify-ui/scripts/lib/report.py +106 -0
  365. package/project-template-v2/skills/playable-verify-ui/scripts/lib/runtime_contract.js +116 -0
  366. package/project-template-v2/skills/playable-verify-ui/scripts/verify_fetch_antipatterns.py +59 -0
  367. package/project-template-v2/skills/playable-verify-ui/scripts/verify_hardcoded_layout.js +64 -0
  368. package/project-template-v2/skills/playable-verify-ui/scripts/verify_runtime_contract.js +58 -0
  369. package/project-template-v2/skills/playable-verify-ui/scripts/verify_text_overlap.py +333 -0
  370. package/project-template-v2/ta-workspace/scripts/.gitkeep +0 -0
  371. package/project-template-v2/tsconfig.json +20 -0
  372. package/project-template-v2/vite.config.ts +27 -0
  373. package/project-templates/batch-locks/phaser.yaml +922 -0
  374. package/project-templates/batch-locks/threejs.yaml +978 -0
  375. package/project-templates/empty/AGENTS.md +41 -0
  376. package/project-templates/empty/gitignore +33 -0
  377. package/project-templates/phaser/.claude/agents/refs/ta-image-generation-detail.md +59 -59
  378. package/project-templates/phaser/.claude/skills/playcraft-image-generation/SKILL.md +63 -135
  379. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +33 -42
  380. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +20 -18
  381. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +7 -6
  382. package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -39
  383. package/project-templates/threejs/.claude/agents/refs/ta-image-generation-detail.md +59 -59
  384. package/project-templates/threejs/.claude/skills/playcraft-image-generation/SKILL.md +63 -135
  385. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +33 -42
  386. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +20 -18
  387. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +7 -6
  388. package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -39
  389. package/dist/commands/tools-image-context.js +0 -29
  390. package/dist/utils/image-asset-context.js +0 -228
@@ -0,0 +1,165 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFile, readdir, writeFile } from 'node:fs/promises';
3
+ import { basename, dirname, join, resolve } from 'node:path';
4
+ import sharp from 'sharp';
5
+ import { videoUnderstandingAnalysisSchema, validateVideoUnderstandingContent, } from '@playcraft/common/agent-tools';
6
+ import { openVideo, runMediaTool, verifyVideo } from './media.js';
7
+ import { VideoCliError, videoMessage } from './messages.js';
8
+ import { ensureVideoEvidenceGitExcluded } from '../utils/video-evidence-git.js';
9
+ import { comparisonOutputPath, comparisonOutputRoot, writeComparisonArtifact, writeComparisonJson } from './comparison-output.js';
10
+ import { ComparisonCliError } from './comparison-messages.js';
11
+ async function videoOutput(action) {
12
+ try {
13
+ return await action();
14
+ }
15
+ catch (error) {
16
+ if (error instanceof ComparisonCliError && error.code === 'unsafeOutput')
17
+ throw new VideoCliError('unsafeOutput', 64);
18
+ throw error;
19
+ }
20
+ }
21
+ export async function writeJsonAtomic(path, value) {
22
+ await videoOutput(async () => {
23
+ await comparisonOutputRoot(dirname(path), true);
24
+ await writeComparisonJson(dirname(path), basename(path), value);
25
+ });
26
+ }
27
+ export async function prepareArtifactDirectory(out, runId, resume) {
28
+ if (!(await ensureVideoEvidenceGitExcluded(process.cwd())))
29
+ console.error(videoMessage('gitExcludeWarning'));
30
+ await videoOutput(async () => {
31
+ await comparisonOutputRoot(out, true);
32
+ await comparisonOutputPath(out, 'request.json');
33
+ });
34
+ const names = await readdir(out);
35
+ if (!names.length && !resume)
36
+ return;
37
+ try {
38
+ const saved = JSON.parse(await readFile(join(out, 'request.json'), 'utf8'));
39
+ if (resume && saved.schemaVersion === 'playcraft.video-request.v1' && saved.runId === runId && saved.out === resolve(out))
40
+ return;
41
+ }
42
+ catch { /* An unrelated or incomplete output directory must not be overwritten. */ }
43
+ throw new VideoCliError('outputConflict', 64);
44
+ }
45
+ export async function loadSavedRequest(out, runId, workspaceId) {
46
+ try {
47
+ await videoOutput(() => comparisonOutputPath(out, 'request.json'));
48
+ const value = JSON.parse(await readFile(join(out, 'request.json'), 'utf8'));
49
+ if (value.schemaVersion !== 'playcraft.video-request.v1' || value.runId !== runId || value.workspaceId !== workspaceId || value.out !== resolve(out) || typeof value.videoPath !== 'string')
50
+ throw new Error('invalid');
51
+ return value;
52
+ }
53
+ catch {
54
+ throw new VideoCliError('resumeMissing', 64);
55
+ }
56
+ }
57
+ const escapeXml = (text) => text.replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&apos;' })[c]);
58
+ const escapeMarkdown = (text) => text.replace(/([\\`*_[\]<>])/g, '\\$1');
59
+ export function renderVideoAnalysis(analysis, frames) {
60
+ const lines = [`# ${videoMessage('summary')}`, '', escapeMarkdown(analysis.summary), '', videoMessage('transcriptNotice'), ''];
61
+ for (const [key, items] of [
62
+ ['observations', analysis.observations], ['inferences', analysis.inferences], ['unknowns', analysis.unknowns],
63
+ ]) {
64
+ lines.push(`## ${videoMessage(key)}`, '');
65
+ for (const item of items) {
66
+ const confidence = 'confidence' in item ? ` (${item.confidence})` : '';
67
+ lines.push(`- **${escapeMarkdown(item.id)}**${confidence}: ${escapeMarkdown(item.text)}`);
68
+ }
69
+ lines.push('');
70
+ }
71
+ lines.push(`## ${videoMessage('events')}`, '');
72
+ for (const event of analysis.events)
73
+ lines.push(`- ${escapeMarkdown(event.id)} [${event.startMs}–${event.endMs} ms]: ${event.kind}`);
74
+ lines.push('', `## ${videoMessage('hints')}`, '');
75
+ for (const [key, items] of Object.entries(analysis.reconstructionHints)) {
76
+ lines.push(`### ${videoMessage(key === 'candidateRules' ? 'rules' : key)}`, '');
77
+ for (const item of items)
78
+ lines.push(`- ${escapeMarkdown(item)}`);
79
+ lines.push('');
80
+ }
81
+ lines.push(`## ${videoMessage('evidence')}`, '');
82
+ for (const evidence of analysis.evidence)
83
+ lines.push(`- ${escapeMarkdown(evidence.id)} [${evidence.startMs}–${evidence.endMs} ms]: [frame](${frames.get(evidence.id)})`);
84
+ return `${lines.join('\n')}\n`;
85
+ }
86
+ /** Materialize only validated original-video timestamps; the model never supplies file paths. */
87
+ export async function materializeVideoEvidence(input) {
88
+ let analysis;
89
+ try {
90
+ analysis = videoUnderstandingAnalysisSchema.parse(input.analysis);
91
+ validateVideoUnderstandingContent({
92
+ summary: analysis.summary, observations: analysis.observations, events: analysis.events,
93
+ evidence: analysis.evidence, inferences: analysis.inferences, unknowns: analysis.unknowns,
94
+ reconstructionHints: analysis.reconstructionHints,
95
+ }, analysis.source, input.request?.clip);
96
+ }
97
+ catch {
98
+ throw new VideoCliError('invalidResult');
99
+ }
100
+ // Refuse any redirected destination before replacing evidence from a previous attempt.
101
+ await videoOutput(async () => {
102
+ await comparisonOutputRoot(input.out, true);
103
+ for (const path of [...analysis.evidence.map(item => `keyframes/${item.id}.png`), 'analysis.json', 'analysis.md', 'manifest.json', 'contact-sheet.jpg'])
104
+ await comparisonOutputPath(input.out, path);
105
+ });
106
+ const file = await openVideo(input.sourcePath);
107
+ const frames = new Map();
108
+ const manifestFrames = [];
109
+ const tiles = [];
110
+ const width = 240;
111
+ const height = 200;
112
+ const columns = Math.min(4, analysis.evidence.length);
113
+ try {
114
+ await verifyVideo(file, analysis.source);
115
+ const frameOutput = await runMediaTool('ffprobe', [
116
+ '-v', 'error', '-protocol_whitelist', 'file,pipe', '-format_whitelist', 'mov,matroska,webm',
117
+ '-select_streams', 'v:0', '-show_entries', 'frame=best_effort_timestamp_time', '-of', 'csv=p=0', '/dev/fd/3',
118
+ ], file.fd, input.signal);
119
+ const rawFrameTimes = frameOutput.split('\n').map(line => Number.parseFloat(line) * 1000).filter(Number.isFinite);
120
+ const firstFrameTime = rawFrameTimes[0] ?? 0;
121
+ const frameTimes = rawFrameTimes.map(time => time - firstFrameTime).filter(time => time >= 0 && time < analysis.source.durationMs);
122
+ if (!frameTimes.length)
123
+ throw new VideoCliError('invalidResult');
124
+ for (const [index, evidence] of analysis.evidence.entries()) {
125
+ input.signal?.throwIfAborted();
126
+ const path = `keyframes/${evidence.id}.png`;
127
+ // Quantize the model's suggested midpoint to a real decoded frame, including the final frame.
128
+ const requestedTimeMs = (evidence.startMs + evidence.endMs) / 2;
129
+ const timeMs = frameTimes.reduce((best, candidate) => Math.abs(candidate - requestedTimeMs) < Math.abs(best - requestedTimeMs) ? candidate : best);
130
+ await videoOutput(() => writeComparisonArtifact(input.out, path, temporary => runMediaTool('ffmpeg', [
131
+ '-v', 'error', '-nostdin', '-y', '-protocol_whitelist', 'file,pipe', '-format_whitelist', 'mov,matroska,webm',
132
+ '-ss', (Math.max(0, timeMs - 0.01) / 1000).toFixed(6), '-i', '/dev/fd/3', '-map', '0:v:0',
133
+ '-frames:v', '1', '-vf', 'scale=min(1280\\,iw):-2', '-threads', '1', temporary,
134
+ ], file.fd, input.signal)));
135
+ const bytes = await readFile(join(input.out, path));
136
+ const metadata = await sharp(bytes).metadata();
137
+ if (!metadata.width || !metadata.height)
138
+ throw new VideoCliError('invalidResult');
139
+ frames.set(evidence.id, path);
140
+ manifestFrames.push({ evidenceId: evidence.id, timeMs, requestedTimeMs, path, sha256: createHash('sha256').update(bytes).digest('hex') });
141
+ const thumbnail = await sharp(bytes).resize(width, height - 30, { fit: 'contain', background: '#f4f4f4' }).png().toBuffer();
142
+ const label = Buffer.from(`<svg width="${width}" height="30"><rect width="100%" height="100%" fill="white"/><text x="8" y="20" font-size="12">${escapeXml(evidence.id)} ${(timeMs / 1000).toFixed(2)}s</text></svg>`);
143
+ const tile = await sharp({ create: { width, height, channels: 3, background: '#ffffff' } }).composite([{ input: thumbnail, top: 0, left: 0 }, { input: label, top: height - 30, left: 0 }]).png().toBuffer();
144
+ tiles.push({ input: tile, left: (index % columns) * width, top: Math.floor(index / columns) * height });
145
+ }
146
+ await verifyVideo(file, analysis.source);
147
+ }
148
+ finally {
149
+ await file.close();
150
+ }
151
+ const contactSheet = join(input.out, 'contact-sheet.jpg');
152
+ await videoOutput(() => writeComparisonArtifact(input.out, 'contact-sheet.jpg', temporary => sharp({ create: { width: columns * width, height: Math.ceil(tiles.length / columns) * height, channels: 3, background: '#dddddd' } }).composite(tiles).jpeg({ quality: 85 }).toFile(temporary)));
153
+ // Keep analysis.json compatible with the shared schema; local frame references live in the manifest.
154
+ const analysisPath = join(input.out, 'analysis.json');
155
+ const markdown = join(input.out, 'analysis.md');
156
+ await writeJsonAtomic(analysisPath, analysis);
157
+ await videoOutput(() => writeComparisonArtifact(input.out, 'analysis.md', temporary => writeFile(temporary, renderVideoAnalysis(analysis, frames), { mode: 0o600, flag: 'wx' })));
158
+ const manifest = join(input.out, 'manifest.json');
159
+ await writeJsonAtomic(manifest, {
160
+ schemaVersion: 'playcraft.video-evidence.v1', runId: analysis.runId, state: 'completed', source: analysis.source, model: analysis.model,
161
+ analysis: 'analysis.json', markdown: 'analysis.md', contactSheet: 'contact-sheet.jpg',
162
+ frames: manifestFrames, frameTimeSemantics: 'nearest-decoded-original-video-frame',
163
+ });
164
+ return { manifest, analysis: analysisPath, markdown, contactSheet, keyframes: manifestFrames.map(frame => join(input.out, frame.path)) };
165
+ }
@@ -0,0 +1,112 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { createHash } from 'node:crypto';
3
+ import { open, realpath } from 'node:fs/promises';
4
+ import { isAbsolute } from 'node:path';
5
+ import { VIDEO_MAX_BYTES, videoSourceSchema, } from '@playcraft/common/agent-tools';
6
+ import { VideoCliError, videoMessage } from './messages.js';
7
+ /** No shell, external protocols, or unbounded child-process output. */
8
+ export function runMediaTool(tool, args, inputFd, signal) {
9
+ return new Promise((resolve, reject) => {
10
+ const override = process.env[tool === 'ffmpeg' ? 'FFMPEG_PATH' : 'FFPROBE_PATH'];
11
+ if (override && !isAbsolute(override)) {
12
+ reject(new VideoCliError('mediaTool'));
13
+ return;
14
+ }
15
+ const child = spawn(override || tool, args, { stdio: ['ignore', 'pipe', 'pipe', inputFd], signal });
16
+ let output = '';
17
+ let diagnostic = '';
18
+ let settled = false;
19
+ const finish = (error) => {
20
+ if (settled)
21
+ return;
22
+ settled = true;
23
+ clearTimeout(timer);
24
+ if (error)
25
+ reject(error);
26
+ else
27
+ resolve(output);
28
+ };
29
+ const timer = setTimeout(() => {
30
+ child.kill('SIGKILL');
31
+ finish(new VideoCliError('mediaTool', 4, { cause: new Error(`${tool}: ${videoMessage('mediaTimedOut')}`) }));
32
+ }, 30_000);
33
+ child.stdout.on('data', chunk => {
34
+ output += chunk.toString();
35
+ if (output.length > 1024 * 1024) {
36
+ child.kill('SIGKILL');
37
+ finish(new VideoCliError('videoFormat', 4, { cause: new Error(`${tool}: ${videoMessage('mediaOutputLimit')}`) }));
38
+ }
39
+ });
40
+ child.stderr.on('data', chunk => { diagnostic = (diagnostic + chunk.toString()).slice(0, 4096); });
41
+ child.once('error', error => finish(error.name === 'AbortError' ? error : new VideoCliError('mediaTool', 4, { cause: error })));
42
+ child.once('close', code => finish(code === 0 ? undefined : new VideoCliError('videoFormat', 4, { cause: new Error(`${tool}: ${videoMessage('mediaExit')} ${code}. ${diagnostic}`) })));
43
+ });
44
+ }
45
+ export async function openVideo(path) {
46
+ try {
47
+ const file = await open(path, 'r');
48
+ const stat = await file.stat();
49
+ if (!stat.isFile()) {
50
+ await file.close();
51
+ throw new VideoCliError('videoMissing', 64);
52
+ }
53
+ if (stat.size <= 0 || stat.size > VIDEO_MAX_BYTES) {
54
+ await file.close();
55
+ throw new VideoCliError('videoQuota', 64);
56
+ }
57
+ return file;
58
+ }
59
+ catch (error) {
60
+ if (error instanceof VideoCliError)
61
+ throw error;
62
+ throw new VideoCliError('videoMissing', 64, { cause: error });
63
+ }
64
+ }
65
+ async function digests(file) {
66
+ const sha = createHash('sha256');
67
+ const md5 = createHash('md5');
68
+ for await (const chunk of file.createReadStream({ autoClose: false, start: 0 })) {
69
+ sha.update(chunk);
70
+ md5.update(chunk);
71
+ }
72
+ return { sha256: sha.digest('hex'), contentMd5: md5.digest('base64') };
73
+ }
74
+ export async function probeVideo(path, signal) {
75
+ const absolute = await realpath(path).catch(error => { throw new VideoCliError('videoMissing', 64, { cause: error }); });
76
+ const file = await openVideo(absolute);
77
+ try {
78
+ const stat = await file.stat();
79
+ const magic = Buffer.alloc(16);
80
+ await file.read(magic, 0, magic.length, 0);
81
+ const isIso = magic.subarray(4, 8).toString('ascii') === 'ftyp';
82
+ const isWebm = magic.readUInt32BE(0) === 0x1a45dfa3;
83
+ if (!isIso && !isWebm)
84
+ throw new VideoCliError('videoFormat', 64);
85
+ const output = await runMediaTool('ffprobe', [
86
+ '-v', 'error', '-protocol_whitelist', 'file,pipe', '-format_whitelist', 'mov,matroska,webm',
87
+ '-show_entries', 'format=duration,format_name:stream=codec_type,width,height,duration',
88
+ '-of', 'json', '/dev/fd/3',
89
+ ], file.fd, signal);
90
+ const result = JSON.parse(output);
91
+ const video = result.streams?.find(stream => stream.codec_type === 'video');
92
+ if (!video)
93
+ throw new VideoCliError('videoFormat', 64);
94
+ const durationMs = Number(result.format?.duration ?? video.duration) * 1000;
95
+ const hashes = await digests(file);
96
+ const parsed = videoSourceSchema.safeParse({
97
+ sha256: hashes.sha256, sizeBytes: stat.size, durationMs, width: video.width, height: video.height,
98
+ mimeType: isWebm ? 'video/webm' : magic.subarray(8, 12).toString('ascii') === 'qt ' ? 'video/quicktime' : 'video/mp4',
99
+ });
100
+ if (!parsed.success)
101
+ throw new VideoCliError('videoQuota', 64);
102
+ return { path: absolute, source: parsed.data, contentMd5: hashes.contentMd5 };
103
+ }
104
+ finally {
105
+ await file.close();
106
+ }
107
+ }
108
+ export async function verifyVideo(file, expected) {
109
+ const stat = await file.stat();
110
+ if (stat.size !== expected.sizeBytes || (await digests(file)).sha256 !== expected.sha256)
111
+ throw new VideoCliError('sourceChanged', 64);
112
+ }
@@ -0,0 +1,97 @@
1
+ const messages = {
2
+ en: {
3
+ topic: 'Video understanding and replica comparison with evidence frames',
4
+ models: 'List authorized video models and supported processing modes',
5
+ understand: 'Understand a local reference video using a managed video model',
6
+ jobs: 'Inspect or cancel an existing analysis without submitting new inference',
7
+ get: 'Read an existing video task state', cancel: 'Explicitly request remote cancellation',
8
+ workspace: 'Workspace UUID (defaults to the nearest workspace context file)',
9
+ json: 'Print machine-readable JSON (always enabled)', video: 'Local MP4, MOV or WebM file',
10
+ question: 'Focused question about the video', context: 'Prior analysis.json for this video',
11
+ processing: 'auto | agentic | static', fps: 'Static sampling: 1 | 2 | 4 | 8',
12
+ clip: 'Static clip in original video seconds: start:end',
13
+ model: 'Authorized model configuration UUID', out: 'Artifact directory',
14
+ timeout: 'Maximum local wait in seconds; the remote task remains recoverable',
15
+ resume: 'Resume this existing run UUID; cannot be combined with new inputs',
16
+ invalidArguments: 'Invalid video command arguments.',
17
+ workspaceMissing: 'Specify --workspace or run inside a Cloud Workspace checkout.',
18
+ workspaceMismatch: 'The explicit workspace does not match the checkout context.',
19
+ videoMissing: 'The video must be a readable regular file.',
20
+ videoQuota: 'The video exceeds 100 MiB or 180 seconds, or has unsupported dimensions.',
21
+ videoFormat: 'The file is not a supported MP4, MOV or WebM video.',
22
+ mediaTool: 'FFmpeg and ffprobe are required. Check the managed runtime installation.',
23
+ outputConflict: 'The artifact directory belongs to another run. Choose an empty directory.',
24
+ unsafeOutput: 'The artifact directory contains a linked or unsupported output path.',
25
+ gitExcludeWarning: 'The local Git ignore rule could not be updated. Video analysis will continue; do not commit .playcraft/video-replication evidence to the repository.',
26
+ invalidContext: 'The context is invalid or belongs to a different video.',
27
+ invalidResult: 'The video service returned invalid or incomplete evidence.',
28
+ sourceChanged: 'The video changed since it was probed or the task was created.',
29
+ uploadFailed: 'Video upload could not be completed.',
30
+ modelUnavailable: 'No authorized model supports the requested video processing mode.',
31
+ resumeMissing: 'The saved request is missing or does not match this run and workspace.',
32
+ timeoutReached: 'Local waiting ended. Resume this run to check its existing result.',
33
+ interrupted: 'Interrupted. Remote cancellation was not requested or confirmed.',
34
+ uncertain: 'The remote outcome is unknown. Check this run; do not submit another analysis.',
35
+ remoteFailed: 'The remote analysis failed or was cancelled.',
36
+ failed: 'Video understanding failed. Inspect the saved request and task before retrying.',
37
+ probing: 'Inspecting the video', uploading: 'Uploading the video',
38
+ preparing: 'Preparing the video command', loadingModels: 'Loading authorized video models',
39
+ initializingUpload: 'Initializing the video upload', finalizingUpload: 'Validating the uploaded video',
40
+ failureStage: 'Stage', failureReason: 'Reason', mediaExit: 'Media tool exit status',
41
+ mediaTimedOut: 'Media tool timed out', mediaOutputLimit: 'Media tool output exceeded the limit',
42
+ submitting: 'Submitting the analysis', waiting: 'Waiting for the existing analysis',
43
+ extracting: 'Extracting evidence frames',
44
+ summary: 'Summary', observations: 'Observed facts', events: 'Events',
45
+ inferences: 'Inferences', unknowns: 'Unknowns', hints: 'Reconstruction suggestions',
46
+ evidence: 'Evidence', entities: 'Entities', assets: 'Assets', rules: 'Candidate rules',
47
+ transcriptNotice: 'Observed events cover only the demonstrated video. Inferred controls and hidden rules remain uncertain.',
48
+ },
49
+ zh: {
50
+ topic: '视频理解与复刻比较,抽取证据关键帧',
51
+ models: '列出有权使用的视频模型和处理模式',
52
+ understand: '使用受管视频模型理解本地参考视频',
53
+ jobs: '核对或取消已有任务,不新建推理', get: '读取已有视频任务状态', cancel: '明确请求远端取消',
54
+ workspace: '工作区编号,默认读取最近的工作区上下文文件',
55
+ json: '输出机器可读的 JSON(始终启用)', video: '本地 MP4、MOV 或 WebM 文件',
56
+ question: '需要确认的视频问题', context: '同一视频的已有 analysis.json',
57
+ processing: 'auto | agentic | static', fps: '静态抽样:1 | 2 | 4 | 8',
58
+ clip: '原视频上的静态片段秒数:开始:结束', model: '有权使用的模型配置编号', out: '制品输出目录',
59
+ timeout: '本地等待的最长秒数,远端任务仍可恢复', resume: '恢复已有任务编号,不能与新输入组合使用',
60
+ invalidArguments: '视频命令参数无效。', workspaceMissing: '请指定 --workspace,或在云端工作区目录内运行。',
61
+ workspaceMismatch: '指定的工作区与当前目录的工作区上下文不一致。',
62
+ videoMissing: '视频必须是可读的普通文件。', videoQuota: '视频超出 100 MiB、180 秒或支持的画面尺寸。',
63
+ videoFormat: '文件不是支持的 MP4、MOV 或 WebM 视频。', mediaTool: '需要 FFmpeg 和 ffprobe,请检查受管运行环境安装。',
64
+ outputConflict: '输出目录属于另一轮任务,请使用空目录。', invalidContext: '上下文无效,或属于另一份视频。',
65
+ unsafeOutput: '制品目录包含符号链接或不支持的输出路径。',
66
+ gitExcludeWarning: '无法更新 Git 本地忽略规则。视频分析将继续,请勿将 .playcraft/video-replication 证据提交到仓库。',
67
+ invalidResult: '视频服务返回的证据无效或不完整。', sourceChanged: '视频在探测后或任务创建后发生了变化。',
68
+ uploadFailed: '视频上传未完成。', modelUnavailable: '没有有权使用且支持所需视频模式的模型。',
69
+ resumeMissing: '找不到保存的请求,或请求与任务、工作区不一致。',
70
+ timeoutReached: '本地等待结束,请恢复此任务核对已有结果。',
71
+ interrupted: '操作已中断,尚未请求或确认远端取消。',
72
+ uncertain: '远端结果未知,请核对此任务,不要另建分析。', remoteFailed: '远端分析失败或已取消。',
73
+ failed: '视频理解失败,请先核对已保存的请求和任务再重试。',
74
+ probing: '正在探测视频', uploading: '正在上传视频', submitting: '正在提交分析',
75
+ preparing: '正在准备视频命令', loadingModels: '正在加载有权使用的视频模型',
76
+ initializingUpload: '正在初始化视频上传', finalizingUpload: '正在校验已上传的视频',
77
+ failureStage: '失败阶段', failureReason: '具体原因', mediaExit: '媒体工具退出状态',
78
+ mediaTimedOut: '媒体工具执行超时', mediaOutputLimit: '媒体工具输出超出限制',
79
+ waiting: '正在等待已有分析', extracting: '正在抽取证据关键帧',
80
+ summary: '概述', observations: '观察事实', events: '事件', inferences: '推断', unknowns: '未知项',
81
+ hints: '复刻建议', evidence: '证据', entities: '实体', assets: '素材', rules: '候选规则',
82
+ transcriptNotice: '观察事件仅覆盖视频展示的路径;操作方式和隐藏规则的推断仍需确认。',
83
+ },
84
+ };
85
+ export function videoMessage(key) {
86
+ const locale = process.env.PLAYCRAFT_LANGUAGE || process.env.LANG || 'en';
87
+ return messages[locale.startsWith('zh') ? 'zh' : 'en'][key];
88
+ }
89
+ export class VideoCliError extends Error {
90
+ code;
91
+ exitCode;
92
+ constructor(code, exitCode = 4, options) {
93
+ super(videoMessage(code), options);
94
+ this.code = code;
95
+ this.exitCode = exitCode;
96
+ }
97
+ }
@@ -0,0 +1,67 @@
1
+ const messages = {
2
+ en: {
3
+ description: 'Download cloud workspaces and push local commits back',
4
+ clone: 'Clone the current workspace files, including uncommitted changes',
5
+ push: 'Push local commits back; reject concurrent cloud changes',
6
+ workspaceId: 'Cloud workspace identifier', directory: 'Engineering directory, or root for the whole workspace',
7
+ target: 'Local checkout directory', url: 'PlayCraft service base address, including any environment prefix',
8
+ token: 'Personal access token', json: 'Print structured output',
9
+ invalidTarget: 'Invalid workspace identifier, directory, or service address.',
10
+ directoryExists: 'The target directory already exists. Choose an empty new directory.',
11
+ metadataMissing: 'No workspace checkout metadata found. Run workspace clone first.',
12
+ cleanRequired: 'Commit or discard local changes before running workspace push.',
13
+ notReady: 'Workspace access is not ready. Open the workspace and retry.',
14
+ conflict: 'Cloud files changed since this checkout. Clone again and merge your changes before pushing.',
15
+ failed: 'Workspace transfer failed', cloned: 'Workspace cloned:', pushed: 'Local commits pushed to the cloud workspace.',
16
+ tooLarge: 'The service rejected this transfer because of its size. Check the workspace quota and the service upload configuration; direct download cannot upload your changes.',
17
+ byteCount: '{value} bytes',
18
+ quotaExceeded: 'Push would use {actual}, exceeding the workspace quota of {limit}. Reduce the committed files or ask an administrator to increase the quota. Cloud files were not changed.',
19
+ diskFull: 'Insufficient disk space for transfer staging or file replacement. Required: {actual}; available after reserved space: {limit}. Free disk space and retry.',
20
+ diskFullUnknown: 'The disk filled while preparing or applying the transfer. Free disk space on the local computer or sandbox and retry. Your local commits are preserved.',
21
+ diskUnavailable: 'Could not check available workspace storage. Retry or ask an administrator to check the sandbox disk.',
22
+ proxyTooLarge: 'The upload gateway rejected the transfer (413). Ask an administrator to increase the gateway upload limit; direct download cannot upload your changes.',
23
+ timeout: 'Workspace transfer timed out. Your local commits are preserved. Retry the push to confirm its result; ask an administrator to check service timeouts if it repeats.',
24
+ network: 'Could not reach the workspace service. Check the service address and your connection, then retry. Your local commits are preserved.',
25
+ busy: 'The workspace has an active task, terminal, or file write. Wait for it to finish, then retry the push.',
26
+ gitMissing: 'Git is not installed or is unavailable on the command path. Install Git and retry.',
27
+ gitFailed: 'Git could not prepare or apply the workspace transfer. Check local repository integrity and available disk space; retry or contact an administrator.',
28
+ baseMissing: 'The original workspace snapshot is missing from this local repository. Clone the workspace again and merge your local files before pushing.',
29
+ invalidTransfer: 'The workspace contains an unsupported path, symbolic link, or invalid transfer data. Check the committed files before retrying.',
30
+ upgradeRequired: 'This server does not support incremental workspace transfer. Upgrade the server before pushing with this command.',
31
+ preflight: 'Push preflight passed: {files} files, {bytes} of content. Preparing incremental transfer.',
32
+ upload: 'Uploading incremental transfer: {bytes}.',
33
+ login: 'Log in to the target environment using playcraft login --url',
34
+ },
35
+ zh: {
36
+ description: '下载云工作区,并将本地提交推送回来', clone: '克隆当前工作区文件,包含尚未提交的修改',
37
+ push: '把本地提交推送回来;云端有新修改时拒绝覆盖', workspaceId: '云工作区标识',
38
+ directory: '工程目录;root 表示整个工作区', target: '本地克隆目录',
39
+ url: 'PlayCraft 服务基址,保留环境路径前缀', token: '个人访问令牌', json: '输出结构化结果',
40
+ invalidTarget: '工作区标识、目录或服务地址无效。', directoryExists: '目标目录已存在,请选择新的目录。',
41
+ metadataMissing: '未找到工作区克隆信息,请先运行 workspace clone。', cleanRequired: '请先提交或丢弃本地修改,再运行 workspace push。',
42
+ notReady: '工作区访问尚未就绪,请打开工作区后重试。', conflict: '云端文件在克隆后发生变化,请重新克隆并合并本地修改后再推送。',
43
+ failed: '工作区传输失败', cloned: '工作区已克隆到:', pushed: '本地提交已推送回云工作区。',
44
+ tooLarge: '服务端因大小拒绝了本次传输。请检查工作区配额及服务上传配置;直接下载无法把本地修改推回云端。',
45
+ byteCount: '{value} 字节',
46
+ quotaExceeded: '推送后工作区将占用 {actual},超过配额 {limit}。请减少已提交的文件,或联系管理员提高配额。云端文件未被修改。',
47
+ diskFull: '暂存传输包或替换文件所需的磁盘空间不足。需要 {actual};保留余量后可用 {limit}。请释放磁盘空间后重试。',
48
+ diskFullUnknown: '准备或应用传输时磁盘已满。请释放本机或沙箱磁盘空间后重试,本地提交已保留。',
49
+ diskUnavailable: '无法检查工作区存储空间。请重试,或联系管理员检查沙箱磁盘。',
50
+ proxyTooLarge: '上传网关拒绝了本次传输(413)。请联系管理员提高网关上传上限;直接下载无法把本地修改推回云端。',
51
+ timeout: '工作区传输超时。本地提交已保留,可重试推送以确认结果;若持续发生,请联系管理员检查服务超时配置。',
52
+ network: '无法连接工作区服务。请检查服务地址和网络后重试,本地提交已保留。',
53
+ busy: '工作区有正在执行的任务、终端或文件写入。请等待结束后重试推送。',
54
+ gitMissing: '未安装 Git 或命令路径中无法找到 Git。请安装后重试。',
55
+ gitFailed: 'Git 无法准备或应用工作区传输。请检查本地仓库完整性及磁盘空间,重试或联系管理员。',
56
+ baseMissing: '本地仓库缺少最初的工作区快照。请重新克隆工作区,并合并本地文件后再推送。',
57
+ invalidTransfer: '工作区包含不支持的路径、符号链接或无效传输数据。请检查已提交文件后重试。',
58
+ upgradeRequired: '当前服务端尚不支持工作区增量传输。请升级服务端后再使用此命令推送。',
59
+ preflight: '推送预检查通过:{files} 个文件,内容共 {bytes}。正在准备增量传输。',
60
+ upload: '正在上传增量传输包:{bytes}。',
61
+ login: '请使用 playcraft login --url 登录目标环境',
62
+ },
63
+ };
64
+ export function workspaceMessage(key, values = {}) {
65
+ const locale = process.env.PLAYCRAFT_LANGUAGE || process.env.LANG || 'en';
66
+ return messages[locale.startsWith('zh') ? 'zh' : 'en'][key].replace(/\{(\w+)\}/g, (placeholder, name) => String(values[name] ?? placeholder));
67
+ }