@playcraft/cli 0.1.36-beta1 → 0.1.38-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.
- package/README.md +58 -3
- package/SKILLS_REGISTRY.md +149 -0
- package/dist/agent/local-backend.js +1 -1
- package/dist/auth/account-activation.js +157 -0
- package/dist/auth/messages.js +30 -0
- package/dist/cli-root-help.js +2 -0
- package/dist/commands/build-all.js +5 -19
- package/dist/commands/build-temp.js +26 -0
- package/dist/commands/build.js +15 -28
- package/dist/commands/create.js +26 -33
- package/dist/commands/image.js +2 -6
- package/dist/commands/login.js +84 -42
- package/dist/commands/platform-skills.generated.js +19 -0
- package/dist/commands/playable.js +53 -0
- package/dist/commands/skills.js +4 -0
- package/dist/commands/tools-3d.js +11 -0
- package/dist/commands/tools-batch.js +87 -0
- package/dist/commands/tools-generation.js +68 -109
- package/dist/commands/tools.js +2 -2
- package/dist/commands/video.js +111 -0
- package/dist/commands/workspace-runtime.js +54 -0
- package/dist/commands/workspace.js +35 -0
- package/dist/config.js +59 -4
- package/dist/index.js +40 -3
- package/dist/project-skills/builtin-import.js +225 -0
- package/dist/project-skills/commands.js +77 -0
- package/dist/project-skills/lifecycle.js +28 -0
- package/dist/project-skills/local-run.js +112 -0
- package/dist/project-skills/local-store.js +221 -0
- package/dist/project-skills/messages.js +80 -0
- package/dist/project-skills/reconcile.js +62 -0
- package/dist/project-skills/remote-cache.js +51 -0
- package/dist/project-skills/validation.js +19 -0
- package/dist/recording/messages.js +40 -0
- package/dist/recording/project-digest.js +85 -0
- package/dist/recording/recorder.js +293 -0
- package/dist/recording/scenario.js +50 -0
- package/dist/remix/clone.js +2 -0
- package/dist/remix/init-template.js +2 -0
- package/dist/remix/pull.js +2 -0
- package/dist/remix/push.js +21 -1
- package/dist/skill-registry/client.js +345 -0
- package/dist/skill-registry/commands.js +180 -0
- package/dist/skill-registry/evaluation-client.js +156 -0
- package/dist/skill-registry/evaluation-commands.js +174 -0
- package/dist/skill-registry/messages.js +177 -0
- package/dist/skill-registry/package.js +275 -0
- package/dist/skill-registry/platform-package.js +100 -0
- package/dist/utils/agent-api-client.js +185 -30
- package/dist/utils/environment-endpoints.js +17 -0
- package/dist/utils/playcraft-http-client.js +6 -4
- package/dist/utils/tool-operation-journal.js +124 -0
- package/dist/utils/video-evidence-git.js +81 -0
- package/dist/video-replication/client.js +222 -0
- package/dist/video-replication/comparison-evidence.js +149 -0
- package/dist/video-replication/comparison-files.js +57 -0
- package/dist/video-replication/comparison-log.js +72 -0
- package/dist/video-replication/comparison-messages.js +104 -0
- package/dist/video-replication/comparison-output.js +63 -0
- package/dist/video-replication/comparison-preflight.js +66 -0
- package/dist/video-replication/comparison.js +216 -0
- package/dist/video-replication/evidence.js +165 -0
- package/dist/video-replication/media.js +111 -0
- package/dist/video-replication/messages.js +89 -0
- package/dist/workspace/messages.js +35 -0
- package/dist/workspace/transfer-client.js +174 -0
- package/dist/workspace-runtime/codex/app-server.js +1040 -0
- package/dist/workspace-runtime/codex/compact.js +46 -0
- package/dist/workspace-runtime/codex/config-toml.js +107 -0
- package/dist/workspace-runtime/codex/jsonrpc-stdio.js +145 -0
- package/dist/workspace-runtime/codex/launcher-client.js +177 -0
- package/dist/workspace-runtime/codex/loopback.js +146 -0
- package/dist/workspace-runtime/codex/mcp-config.js +39 -0
- package/dist/workspace-runtime/codex/model-broker.js +263 -0
- package/dist/workspace-runtime/codex/native-adapter.js +9 -0
- package/dist/workspace-runtime/codex/permissions.js +70 -0
- package/dist/workspace-runtime/codex/thread-image.js +38 -0
- package/dist/workspace-runtime/codex/ui-instructions.js +4 -0
- package/dist/workspace-runtime/codex/ui-tools.js +183 -0
- package/dist/workspace-runtime/codex/work-mode.js +15 -0
- package/dist/workspace-runtime/main.js +10 -0
- package/dist/workspace-runtime/persistence/journal.js +365 -0
- package/dist/workspace-runtime/persistence/native-subagents.js +162 -0
- package/dist/workspace-runtime/persistence/sqlite-client.js +77 -0
- package/dist/workspace-runtime/persistence/sqlite-worker.js +1161 -0
- package/dist/workspace-runtime/persistence/stopped-execution.js +77 -0
- package/dist/workspace-runtime/previews/output.js +36 -0
- package/dist/workspace-runtime/previews/publish.js +262 -0
- package/dist/workspace-runtime/previews/single-file.js +43 -0
- package/dist/workspace-runtime/processes/managed-writes.js +69 -0
- package/dist/workspace-runtime/production/content-changes.js +36 -0
- package/dist/workspace-runtime/production/contracts.js +19 -0
- package/dist/workspace-runtime/production/controller.js +218 -0
- package/dist/workspace-runtime/production/dependencies.js +60 -0
- package/dist/workspace-runtime/production/native.js +212 -0
- package/dist/workspace-runtime/production/processes.js +102 -0
- package/dist/workspace-runtime/production/save-command.js +35 -0
- package/dist/workspace-runtime/production/source-archive.js +137 -0
- package/dist/workspace-runtime/production/source-copy.js +91 -0
- package/dist/workspace-runtime/production/stages.js +334 -0
- package/dist/workspace-runtime/production/storage.js +75 -0
- package/dist/workspace-runtime/serve.js +214 -0
- package/dist/workspace-runtime/server/auth.js +21 -0
- package/dist/workspace-runtime/server/connectivity.js +201 -0
- package/dist/workspace-runtime/server/desktop-host.js +429 -0
- package/dist/workspace-runtime/server/desktop-preview-config.js +81 -0
- package/dist/workspace-runtime/server/desktop-preview-service.js +157 -0
- package/dist/workspace-runtime/server/desktop-preview-static.js +53 -0
- package/dist/workspace-runtime/server/desktop-preview.js +189 -0
- package/dist/workspace-runtime/server/dispatch.js +1217 -0
- package/dist/workspace-runtime/server/endpoints.js +21 -0
- package/dist/workspace-runtime/server/execution-group.js +90 -0
- package/dist/workspace-runtime/server/http.js +1243 -0
- package/dist/workspace-runtime/server/lock.js +53 -0
- package/dist/workspace-runtime/server/rfb-watch-gate.js +168 -0
- package/dist/workspace-runtime/server/source-uploader.js +138 -0
- package/dist/workspace-runtime/server/terminal-host.js +366 -0
- package/dist/workspace-runtime/server/types.js +1 -0
- package/dist/workspace-runtime/server/workspace-transfer.js +99 -0
- package/dist/workspace-runtime/workspaces/archive.js +207 -0
- package/dist/workspace-runtime/workspaces/artifact-events.js +55 -0
- package/dist/workspace-runtime/workspaces/artifact-files.js +197 -0
- package/dist/workspace-runtime/workspaces/artifact-receipts.js +89 -0
- package/dist/workspace-runtime/workspaces/artifacts.js +282 -0
- package/dist/workspace-runtime/workspaces/attachment-content.js +123 -0
- package/dist/workspace-runtime/workspaces/attachments.js +185 -0
- package/dist/workspace-runtime/workspaces/batch-commit.js +142 -0
- package/dist/workspace-runtime/workspaces/cli-context.js +23 -0
- package/dist/workspace-runtime/workspaces/cli-credentials.js +111 -0
- package/dist/workspace-runtime/workspaces/composer-context.js +147 -0
- package/dist/workspace-runtime/workspaces/context-error.js +2 -0
- package/dist/workspace-runtime/workspaces/dependencies.js +264 -0
- package/dist/workspace-runtime/workspaces/developer-command.js +64 -0
- package/dist/workspace-runtime/workspaces/directories.js +133 -0
- package/dist/workspace-runtime/workspaces/directory-access.js +37 -0
- package/dist/workspace-runtime/workspaces/directory-attachments.js +245 -0
- package/dist/workspace-runtime/workspaces/directory-maintenance.js +111 -0
- package/dist/workspace-runtime/workspaces/directory-stats.js +49 -0
- package/dist/workspace-runtime/workspaces/disk-snapshot.js +31 -0
- package/dist/workspace-runtime/workspaces/empty-template.js +42 -0
- package/dist/workspace-runtime/workspaces/files-search.js +116 -0
- package/dist/workspace-runtime/workspaces/files.js +120 -0
- package/dist/workspace-runtime/workspaces/git-credential-broker.js +312 -0
- package/dist/workspace-runtime/workspaces/git-credential-helper.js +68 -0
- package/dist/workspace-runtime/workspaces/git-direct-store.js +155 -0
- package/dist/workspace-runtime/workspaces/git.js +670 -0
- package/dist/workspace-runtime/workspaces/instructions.js +56 -0
- package/dist/workspace-runtime/workspaces/json5-edit.js +170 -0
- package/dist/workspace-runtime/workspaces/library-attachments.js +268 -0
- package/dist/workspace-runtime/workspaces/optional-platform-skills.js +14 -0
- package/dist/workspace-runtime/workspaces/parameters.js +272 -0
- package/dist/workspace-runtime/workspaces/prepare.js +278 -0
- package/dist/workspace-runtime/workspaces/registry.js +251 -0
- package/dist/workspace-runtime/workspaces/remix-references.js +301 -0
- package/dist/workspace-runtime/workspaces/revisions.js +31 -0
- package/dist/workspace-runtime/workspaces/session-image.js +104 -0
- package/dist/workspace-runtime/workspaces/shared-git.js +40 -0
- package/dist/workspace-runtime/workspaces/skill-artifact-loader.js +95 -0
- package/dist/workspace-runtime/workspaces/skills.js +191 -0
- package/dist/workspace-runtime/workspaces/transfer.js +288 -0
- package/dist/workspace-runtime/workspaces/turn-changes.js +75 -0
- package/dist/workspace-runtime/workspaces/video-attachments.js +49 -0
- package/package.json +15 -5
- package/project-template/.claude/agents/refs/ta-image-generation-detail.md +123 -67
- package/project-template/.claude/skills/playcraft-image-generation/SKILL.md +44 -105
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +33 -42
- package/project-template/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +20 -18
- package/project-template/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +7 -6
- package/project-template/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -36
- package/project-template/.claude/skills/playcraft-replica-validation/SKILL.md +25 -0
- package/project-template/.claude/skills/playcraft-replica-validation/references/contracts.md +79 -0
- package/project-template/.claude/skills/playcraft-video-understanding/SKILL.md +29 -0
- package/project-template/.claude/skills/playcraft-video-understanding/references/contracts.md +37 -0
- package/project-template-v2/.claude/agents/artist.md +82 -0
- package/project-template-v2/.claude/agents/developer.md +153 -0
- package/project-template-v2/.claude/agents/game-designer.md +264 -0
- package/project-template-v2/.claude/agents/refs/artist-art-style-catalog.md +533 -0
- package/project-template-v2/.claude/agents/refs/artist-color-audio-recipes.md +153 -0
- package/project-template-v2/.claude/agents/refs/artist-dimension-axis.md +27 -0
- package/project-template-v2/.claude/agents/refs/artist-master-composite-recipes.md +208 -0
- package/project-template-v2/.claude/agents/refs/atom-skill-library.md +81 -0
- package/project-template-v2/.claude/agents/refs/developer-impl-cookbook.md +432 -0
- package/project-template-v2/.claude/agents/refs/framework-5-component-filter.md +252 -0
- package/project-template-v2/.claude/agents/refs/framework-game-feel-juice.md +266 -0
- package/project-template-v2/.claude/agents/refs/framework-mda.md +147 -0
- package/project-template-v2/.claude/agents/refs/game-designer-gameplay-sufficiency.md +123 -0
- package/project-template-v2/.claude/agents/refs/ta-3d-flip-recipe.md +88 -0
- package/project-template-v2/.claude/agents/refs/ta-atlas-deliverable-standard.md +67 -0
- package/project-template-v2/.claude/agents/refs/ta-batch-pipeline-recipes.md +120 -0
- package/project-template-v2/.claude/agents/refs/ta-image-generation-detail.md +300 -0
- package/project-template-v2/.claude/agents/refs/ta-image-ops-reference.md +495 -0
- package/project-template-v2/.claude/agents/refs/ta-pipeline-cookbook.md +1141 -0
- package/project-template-v2/.claude/agents/refs/ta-tools-reference.md +111 -0
- package/project-template-v2/.claude/agents/refs/ta-vfx-preset-catalog.md +365 -0
- package/project-template-v2/.claude/agents/refs/threejs-cannon-pitfalls.md +412 -0
- package/project-template-v2/.claude/agents/reviewer.md +75 -0
- package/project-template-v2/.claude/agents/technical-artist.md +86 -0
- package/project-template-v2/.claude/hooks/snapshot-milestone.mjs +243 -0
- package/project-template-v2/.claude/hooks/user-prompt.mjs +133 -0
- package/project-template-v2/.claude/settings.json +33 -0
- package/project-template-v2/.claude/skills/brainstorming/SKILL.md +161 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/frame-template.html +270 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/helper.js +177 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/server.cjs +354 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/start-server.sh +148 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/project-template-v2/.claude/skills/brainstorming/scripts/wait-for-selection.sh +62 -0
- package/project-template-v2/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/project-template-v2/.claude/skills/brainstorming/visual-companion.md +309 -0
- package/project-template-v2/.claude/skills/playcraft-ad-psychology/SKILL.md +182 -0
- package/project-template-v2/.claude/skills/playcraft-art-style-guide/SKILL.md +123 -0
- package/project-template-v2/.claude/skills/playcraft-asset-state-sheet/SKILL.md +205 -0
- package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +280 -0
- package/project-template-v2/.claude/skills/playcraft-batch-pipeline/SKILL.md +184 -0
- package/project-template-v2/.claude/skills/playcraft-build-optimizer/SKILL.md +306 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/SKILL.md +298 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/build-sprite-sheet.template.mjs +123 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/compare-style.template.mjs +254 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +324 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +97 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/gen-edit-variants.template.mjs +118 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +137 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +397 -0
- package/project-template-v2/.claude/skills/playcraft-image-generation/reference/validate-sprite-sheet.template.mjs +296 -0
- package/project-template-v2/.claude/skills/playcraft-image-ops/SKILL.md +122 -0
- package/project-template-v2/.claude/skills/playcraft-image-processing/SKILL.md +219 -0
- package/project-template-v2/.claude/skills/playcraft-masking/SKILL.md +373 -0
- package/project-template-v2/.claude/skills/playcraft-playable-optimization/SKILL.md +161 -0
- package/project-template-v2/.claude/skills/playcraft-research/SKILL.md +215 -0
- package/project-template-v2/.claude/skills/playcraft-skill-recommender/SKILL.md +382 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-generation/SKILL.md +423 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-remix/SKILL.md +158 -0
- package/project-template-v2/.claude/skills/playcraft-sprite-sheet/SKILL.md +100 -0
- package/project-template-v2/.claude/skills/playcraft-storyboard/SKILL.md +167 -0
- package/project-template-v2/.claude/skills/playcraft-style-qa/SKILL.md +270 -0
- package/project-template-v2/.claude/skills/playcraft-text-rendering/SKILL.md +236 -0
- package/project-template-v2/.claude/skills/playcraft-vfx-animation/SKILL.md +130 -0
- package/project-template-v2/.claude/skills/playwright-cli/SKILL.md +390 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/running-code.md +240 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/session-management.md +226 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/spec-driven-testing.md +308 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/storage-state.md +275 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/test-generation.md +134 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/tracing.md +142 -0
- package/project-template-v2/.claude/skills/playwright-cli/references/video-recording.md +153 -0
- package/project-template-v2/.claude/skills/session-analyzer/SKILL.md +386 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/execution-breakdown.mjs +182 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/find-turns.mjs +72 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/heavy-output.mjs +121 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/resolve-session.mjs +102 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-stats.mjs +127 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/subagent-tool-timeline.mjs +106 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/time-gaps.mjs +128 -0
- package/project-template-v2/.claude/skills/session-analyzer/scripts/turn-timeline.mjs +67 -0
- package/project-template-v2/.claude/snapshot.mjs +263 -0
- package/project-template-v2/.playcraft/skills.lock.json +152 -0
- package/project-template-v2/CLAUDE.md +146 -0
- package/project-template-v2/assets/audio/bgm/.gitkeep +0 -0
- package/project-template-v2/assets/audio/sfx/.gitkeep +0 -0
- package/project-template-v2/assets/bundles/.gitkeep +0 -0
- package/project-template-v2/assets/images/bg/.gitkeep +0 -0
- package/project-template-v2/assets/images/reference/.gitkeep +0 -0
- package/project-template-v2/assets/images/storyboard/.gitkeep +0 -0
- package/project-template-v2/assets/images/tiles/.gitkeep +0 -0
- package/project-template-v2/assets/images/ui/.gitkeep +0 -0
- package/project-template-v2/assets/images/vfx/.gitkeep +0 -0
- package/project-template-v2/assets/models/.gitkeep +0 -0
- package/project-template-v2/docs/harness/iteration-1/context-flow.md +254 -0
- package/project-template-v2/docs/harness/iteration-1/generate-flow.md +91 -0
- package/project-template-v2/docs/harness/iteration-1/ideate-flow.md +214 -0
- package/project-template-v2/docs/harness/iteration-1/optimize-flow.md +75 -0
- package/project-template-v2/docs/harness/iteration-1/wrapup-flow.md +63 -0
- package/project-template-v2/docs/harness/iteration-2/context-flow.md +223 -0
- package/project-template-v2/docs/harness/iteration-2/generate-flow.md +129 -0
- package/project-template-v2/docs/harness/iteration-2/ideate-flow.md +267 -0
- package/project-template-v2/docs/harness/iteration-2/optimize-flow.md +164 -0
- package/project-template-v2/docs/harness/iteration-2/wrapup-flow.md +115 -0
- package/project-template-v2/docs/harness/orchestrator-flow.md +364 -0
- package/project-template-v2/docs/project-state.json +60 -0
- package/project-template-v2/docs/project-state.md +72 -0
- package/project-template-v2/docs/standards/README.md +225 -0
- package/project-template-v2/docs/standards/agent-behavior-standards.md +174 -0
- package/project-template-v2/docs/standards/artifacts/design-brief.md +19 -0
- package/project-template-v2/docs/standards/artifacts/design.md +22 -0
- package/project-template-v2/docs/standards/artifacts/game-code.md +41 -0
- package/project-template-v2/docs/standards/artifacts/todo-list.md +41 -0
- package/project-template-v2/docs/standards/iter1-agent-behavior-standards.md +343 -0
- package/project-template-v2/game/index.ts +18 -0
- package/project-template-v2/globals.d.ts +51 -0
- package/project-template-v2/index.css +34 -0
- package/project-template-v2/index.html +18 -0
- package/project-template-v2/main.ts +9 -0
- package/project-template-v2/package.json +46 -0
- package/project-template-v2/skills/_shared/scripts/dispatch-clear.mjs +31 -0
- package/project-template-v2/skills/_shared/scripts/dispatch-set.mjs +86 -0
- package/project-template-v2/skills/_shared/scripts/dod-check.mjs +153 -0
- package/project-template-v2/skills/_shared/scripts/handoff-append.mjs +70 -0
- package/project-template-v2/skills/_shared/scripts/lib/validator-artifacts.mjs +91 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/dod-config.mjs +131 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/index.mjs +80 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-1-core.mjs +90 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-2-wrap.mjs +93 -0
- package/project-template-v2/skills/_shared/scripts/pipeline/iteration-3-visual.mjs +23 -0
- package/project-template-v2/skills/_shared/scripts/render-project-state.mjs +230 -0
- package/project-template-v2/skills/_shared/scripts/state-advance-stage.mjs +58 -0
- package/project-template-v2/skills/_shared/scripts/state-get.mjs +339 -0
- package/project-template-v2/skills/_shared/scripts/state-handoff.mjs +39 -0
- package/project-template-v2/skills/_shared/scripts/state-set.mjs +94 -0
- package/project-template-v2/skills/_shared/scripts/state-store.mjs +783 -0
- package/project-template-v2/skills/_shared/scripts/todo-add.mjs +88 -0
- package/project-template-v2/skills/_shared/scripts/todo-get.mjs +130 -0
- package/project-template-v2/skills/_shared/scripts/todo-remove.mjs +33 -0
- package/project-template-v2/skills/_shared/scripts/todo-set.mjs +47 -0
- package/project-template-v2/skills/_shared/scripts/verify-asset-code-sync.mjs +268 -0
- package/project-template-v2/skills/_shared/scripts/verify-env.mjs +285 -0
- package/project-template-v2/skills/_shared/scripts/verify-placeholders.mjs +161 -0
- package/project-template-v2/skills/playable-autoplay/SKILL.md +176 -0
- package/project-template-v2/skills/playable-autoplay/agents/openai.yaml +4 -0
- package/project-template-v2/skills/playable-debug/SKILL.md +116 -0
- package/project-template-v2/skills/playable-debug/agents/openai.yaml +4 -0
- package/project-template-v2/skills/playable-debug/references/debug-config.md +40 -0
- package/project-template-v2/skills/playable-record/SKILL.md +140 -0
- package/project-template-v2/skills/playable-record/scripts/lib/dev-server.mjs +104 -0
- package/project-template-v2/skills/playable-record/scripts/lib/record-audio-bridge.js +141 -0
- package/project-template-v2/skills/playable-record/scripts/record-playable.mjs +425 -0
- package/project-template-v2/skills/playable-record/scripts/verify-contract.mjs +261 -0
- package/project-template-v2/skills/playable-record/scripts/verify-firstwin.mjs +398 -0
- package/project-template-v2/skills/playable-record/scripts/verify-fusion.mjs +322 -0
- package/project-template-v2/skills/playable-record/scripts/verify-lifecycle.mjs +105 -0
- package/project-template-v2/skills/playable-record/scripts/verify-vlm-video.mjs +230 -0
- package/project-template-v2/skills/playable-validate/SKILL.md +61 -0
- package/project-template-v2/skills/playable-validate/validation-rules.md +14 -0
- package/project-template-v2/skills/playable-verify-ui/SKILL.md +63 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/__init__.py +1 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/config_expr.js +218 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/node_utils.js +51 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/profile_loader.py +59 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/report.py +106 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/lib/runtime_contract.js +116 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_fetch_antipatterns.py +59 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_hardcoded_layout.js +64 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_runtime_contract.js +58 -0
- package/project-template-v2/skills/playable-verify-ui/scripts/verify_text_overlap.py +333 -0
- package/project-template-v2/ta-workspace/scripts/.gitkeep +0 -0
- package/project-template-v2/tsconfig.json +20 -0
- package/project-template-v2/vite.config.ts +27 -0
- package/project-templates/batch-locks/phaser.yaml +922 -0
- package/project-templates/batch-locks/threejs.yaml +978 -0
- package/project-templates/empty/AGENTS.md +41 -0
- package/project-templates/empty/gitignore +33 -0
- package/project-templates/phaser/.claude/agents/refs/ta-image-generation-detail.md +59 -59
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/SKILL.md +44 -105
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +33 -42
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +20 -18
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +7 -6
- package/project-templates/phaser/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -36
- package/project-templates/threejs/.claude/agents/refs/ta-image-generation-detail.md +59 -59
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/SKILL.md +44 -105
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch-sprite.template.mjs +33 -42
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/gen-batch.template.mjs +20 -18
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/process-batch.template.mjs +7 -6
- package/project-templates/threejs/.claude/skills/playcraft-image-generation/reference/prompt-cookbook.md +39 -36
- package/dist/commands/tools-image-context.js +0 -23
- package/dist/utils/image-asset-context.js +0 -105
package/README.md
CHANGED
|
@@ -7,14 +7,34 @@
|
|
|
7
7
|
|
|
8
8
|
PlayCraft CLI(Command-Line Interface,命令行工具)支持本地代码与云端编辑器实时同步,以及将 PlayCanvas/PlayCraft 项目打包为多平台 Playable Ads。
|
|
9
9
|
|
|
10
|
-
## 云端工作台 Runtime
|
|
10
|
+
## 云端工作台 Runtime
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
`playcraft workspace-runtime serve --config <json>` 已注册。它前台常驻、跳过升级检查,读取 Runtime Server 下发的引导配置,只绑定回环并校验 control token。`runtime.ensure` 会执行到终态;设置 `PLAYCRAFT_NATIVE_ADAPTER=loopback` 或测试注入 loopback 适配器后,可跑会话 create/turn/interrupt/审批,以及本地 journal 检查点/恢复/销毁。工作空间相对路径的 `file.write` 与文件检查点不依赖 loopback。相同幂等键上的 `uncertain` 操作不会新开 turn。这不是 Codex App Server。现有 `playcraft start` 仍用于单项目本地开发,二者不要混用。
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
实现与模块边界见 [Sandbox Agent Server](./src/workspace-runtime/README.md);契约见 [云端工作台后端架构方案](../../docs/architecture/backend/cloud-workspace/backend-architecture.md#cli-runtime)。
|
|
15
|
+
|
|
16
|
+
## 下载云工作区并推送本地修改
|
|
17
|
+
|
|
18
|
+
文件面板的下载弹窗可复制下列命令。需要发布包含 `workspace` 命令的新版 `@playcraft/cli`,并部署对应的工作区传输端点;旧版 Remix 命令保持兼容。
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @playcraft/cli@latest login --url 'https://playcraft.example.com/__env/test-a'
|
|
22
|
+
npx @playcraft/cli@latest workspace clone --workspace-id '<workspace-id>' --directory root --url 'https://playcraft.example.com/__env/test-a' --dir './my-workspace'
|
|
23
|
+
cd './my-workspace'
|
|
24
|
+
# 完成本地编辑后提交,再同步回原工作区
|
|
25
|
+
git add -A
|
|
26
|
+
git commit -m 'Update workspace'
|
|
27
|
+
npx @playcraft/cli@latest workspace push
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`--directory root` 下载整个工作区的工程目录;也可指定 `basic` 或已有工程目录。独立工作区无需关联平台项目。下载包含当前未提交文件、二进制素材和 `dist/` 产物,使用只有当前快照的新 Git 历史;排除 `.git`、`node_modules`、凭据文件和运行时路由信息。本地 `.playcraft-workspace.json` 保存目标工作区、目录、完整环境基址和快照摘要,不含访问令牌,默认不进入提交。服务基址的环境路径前缀会完整保留。
|
|
31
|
+
|
|
32
|
+
`workspace push` 要求本地修改已经提交,将提交的文件同步回同一个云工作区;云端文件变化或有正在运行的任务时拒绝覆盖,需重新克隆并合并后再推送。云端现有 Git 仓库和分支元数据会保留,保存到远端项目仍使用工作区原有保存流程;针对项目分支的操作可继续使用 `remix clone` / `remix push`。传输限制为 20,000 个文件、256 MiB(Mebibyte,二进制兆字节)内容及压缩包,超限可使用弹窗中的直接下载。命令支持 `--token`、`--dir` 与 `--json`。
|
|
15
33
|
|
|
16
34
|
## ✨ 特性
|
|
17
35
|
|
|
36
|
+
远程技能的上传、更新、发布、审核、查询与下载见 [技能注册表命令](./SKILLS_REGISTRY.md)。入口为 `playcraft skills registry`,复用已有登录;本地技能发现与项目技能命令保持原有语义。
|
|
37
|
+
|
|
18
38
|
- 🚀 **本地开发隧道** - 在本地 IDE 编写代码,云端编辑器实时预览与热更新
|
|
19
39
|
- 📦 **Playable Ads 打包** - 支持 10 个主流广告平台的一键打包
|
|
20
40
|
- 🎬 **智能场景选择** - 交互式场景选择,可减小 30-60% 文件大小(**新功能**)
|
|
@@ -141,6 +161,17 @@ playcraft login --url https://your-playcraft.example.com
|
|
|
141
161
|
|
|
142
162
|
登录成功后,`tools`、`recommend`、`fix-ids` 等所有需要后端 API 的命令均无需额外配置,直接使用。
|
|
143
163
|
|
|
164
|
+
账号提示待激活时,使用同一目标环境及已保存的个人访问令牌主动激活:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
playcraft login --activate
|
|
168
|
+
playcraft login --activate --url https://your-playcraft.example.com
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
也可通过 `PLAYCRAFT_TOKEN` 提供个人访问令牌。激活只发送一次请求,成功后重新执行原业务命令;该动作不会打开浏览器或续签令牌。目标服务须已接入身份服务的激活入口;封禁、停用账号及沙箱执行令牌不能用于激活。
|
|
172
|
+
|
|
173
|
+
若本地、全局或环境变量配置冲突,激活会要求明确指定 `--url`、所需的 `PLAYCRAFT_ENV` 和对应的个人访问令牌。
|
|
174
|
+
|
|
144
175
|
### 沙箱环境(CI / Agent)
|
|
145
176
|
|
|
146
177
|
在沙箱或 CI 中可通过 `.playcraft.json` 或环境变量配置:
|
|
@@ -188,6 +219,30 @@ echo '{"token":"<sandbox-jwt>","apiUrl":"https://..."}' > .playcraft.json
|
|
|
188
219
|
| `recommend improvements` | Tag 改进建议 | `playcraft recommend improvements --channel Facebook` |
|
|
189
220
|
| `recommend random` | 随机 Tag 组合推荐 | `playcraft recommend random --channel Google` |
|
|
190
221
|
|
|
222
|
+
### 业务工具请求恢复
|
|
223
|
+
|
|
224
|
+
业务工具写请求要求服务支持持久操作协议。命令行先保存请求编号、路径和输入摘要到 `~/.playcraft/tool-requests/`,再发送请求;记录不包含凭证或请求正文。可用绝对路径环境变量 `PLAYCRAFT_TOOL_REQUEST_DIR` 指定可持久保留的目录。
|
|
225
|
+
|
|
226
|
+
原样重跑同一条命令(路径与参数都相同)时,命令行按上一次的结果决定是否沿用原请求编号:
|
|
227
|
+
|
|
228
|
+
| 上一次的结果 | 原样重跑时 |
|
|
229
|
+
| -------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
230
|
+
| 成功(2xx) | 新操作 |
|
|
231
|
+
| 请求被拒绝(4xx,下列 409 除外):请求没有被执行 | 新操作 |
|
|
232
|
+
| 服务端错误(5xx)、超时或连接中断:结果未知 | 沿用原编号,不会另起一次操作;服务端按下文的恢复方式处理 |
|
|
233
|
+
| 409 `business_operation_in_progress`:原操作仍在执行 | 沿用原编号,稍后重跑取得结果 |
|
|
234
|
+
| 409 `business_operation_requires_reconciliation`:结果未知,需要核对 | 沿用原编号,不会再执行 |
|
|
235
|
+
|
|
236
|
+
沿用原编号时,服务端按原操作的状态处理:已完成则返回原结果;仍在执行则返回 409 `business_operation_in_progress`;没有拿到结果就结束时,按该工具声明的恢复方式决定,可以安全重做的工具(生图、构建、发布到 COS 等)用原编号再执行一次,其余返回 409 `business_operation_requires_reconciliation`。原调用的执行租约有效期间(执行中每 20 秒续期,60 秒未续即过期),同一编号不会被再次执行;续期因服务或数据库故障中断超过 60 秒时,重做可能与仍在运行的原调用重叠。
|
|
237
|
+
|
|
238
|
+
需要核对的操作,只有确认它没有生效后,才可设置 `PLAYCRAFT_TOOL_NEW_REQUEST=1` 强制发起新操作;不要删除记录来绕过。也可以显式指定编号,只查询原操作的确定结果(不会重新执行;声明了恢复方式的工具若上次报错,返回那次的错误)。只查询时即使是可以安全重做的工具,没有结果也返回需要核对;去掉 `PLAYCRAFT_TOOL_REQUEST_ID` 原样重跑即可续做:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
PLAYCRAFT_TOOL_REQUEST_ID=<错误中显示的请求编号> playcraft tools build-project --project-id <原项目编号>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
能力检查失败时命令会明确说明尚未发送操作。服务不兼容时命令会在发送业务请求前停止;沙箱命令行与 Business 须排空旧调用后同步升级。
|
|
245
|
+
|
|
191
246
|
### 构建相关
|
|
192
247
|
|
|
193
248
|
| 命令 | 说明 | 示例 |
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# 远程技能管理
|
|
2
|
+
|
|
3
|
+
`playcraft skills registry` 管理已部署注册表中的技能、不可变版本和发行审核。它与现有离线 `skills list/match/read`、项目 `skills project` 命令并存。服务端需要提供 `/api/agent/skill-registry/managed` 路由。
|
|
4
|
+
|
|
5
|
+
网页管理复用现有技能控制台的“发布与更新”页签:系统管理入口为 `/admin/system?tab=agentSkills`,技能工作台入口为 `/agent/skills?view=management`。不新增 Skills 一级导航,旧 `/skills` 仅保留兼容重定向。
|
|
6
|
+
|
|
7
|
+
2026-10-15 已在当前开发配置指定的目标数据库执行并验证 0186 和 [0187_add_skill_scope_governance.sql](../backend-business-server/drizzle/migrations/0187_add_skill_scope_governance.sql)。其他环境启用前仍须应用对应迁移,并部署配套服务与客户端。本次目标数据库升级不代表生产已上线或命令包已发行。
|
|
8
|
+
|
|
9
|
+
## 登录与目标环境
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
playcraft login --url 'https://playcraft.example.com/__env/test-a'
|
|
13
|
+
playcraft skills registry list --scope private --json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
命令复用登录保存的 PAT (Personal Access Token, 个人访问令牌)。所有命令支持 `--url`、`--token`、`--json`、`--scope private|team|platform` 和 `--team <teamId>`。环境地址顺序为 `--url`、`PLAYCRAFT_API_URL`、`PLAYCRAFT_URL`、已保存地址、默认云端。令牌优先使用 `--token` 或 `PLAYCRAFT_TOKEN`,否则仅使用该环境保存的凭据。环境路径前缀完整保留,向其他环境不会自动发送原环境令牌。
|
|
17
|
+
|
|
18
|
+
`private` 是默认范围;`team` 必须明确传入 `--team`,其他范围不能携带 `--team`。`--json` 成功时只输出一个结果对象,运行错误时只输出一个 `error` 对象并以非零状态退出。未知参数或缺少必填参数由命令解析器报告到标准错误。
|
|
19
|
+
|
|
20
|
+
## 查询与下载
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
playcraft skills registry list --scope private --query video --limit 20 --json
|
|
24
|
+
playcraft skills registry list --scope team --team '<teamId>' --cursor '<nextCursor>' --json
|
|
25
|
+
playcraft skills registry list --scope platform --json
|
|
26
|
+
playcraft skills registry info author/video-helper@1.2.0 --files --json
|
|
27
|
+
playcraft skills registry info author/video-helper --versions --json
|
|
28
|
+
playcraft skills registry pull author/video-helper@1.2.0 --out ./downloaded-skill --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`list` 支持关键词、1–100 条分页和返回的 `nextCursor`;不会自动取完所有页面。`info` 默认省略正文与文件清单,`--files` 返回文件清单,`--versions` 返回可访问版本。查询与下载可省略版本,此时先解析所选发行范围的当前版本,再按其精确版本标识下载。
|
|
32
|
+
|
|
33
|
+
`pull` 同时验证元数据、响应头和压缩包的 SHA-256 (Secure Hash Algorithm 256-bit, 256 位安全散列算法) 摘要。包内已声明的 `skillRef/version` 必须匹配;历史制品可缺少声明,仍按服务端精确版本与摘要校验,不重写原制品。内容先写入临时目录,校验完成后原子落地;目标须不存在或为空,路径不能包含符号链接。拉取不会执行资源中的脚本,不修改项目声明、锁或运行时绑定。`.playcraft-skill.json` 保存环境、身份、版本和摘要,不含凭据;再次打包时自动排除。
|
|
34
|
+
|
|
35
|
+
## 上传与发布
|
|
36
|
+
|
|
37
|
+
技能目录必须包含非空 `SKILL.md`,可包含 `manifest.json`、`references/`、`scripts/`、`assets/` 等完整资源。`manifest.json` 可直接声明 `skillRef/version`;否则通过参数明确提供。标识必须是小写 `namespace/slug`,以字母或数字开头,允许连字符和下划线,slug 还允许点号。版本目前支持无前导零的精确 `x.y.z`,最多 32 字符;不支持预发行、构建后缀、`latest` 或版本范围。
|
|
38
|
+
|
|
39
|
+
首期上传接受 Markdown 技能包(`bundleType: "markdown"`),Atom 技能的查询与下载可用,上传管理尚未开放。正式发行还要求有效名称和描述,建议在 `SKILL.md` 的 frontmatter 中声明 `name` 与 `description`,或在清单中声明。平台发行还要求上传时通过 `--changelog` 提供变更说明,并完成平台评估与管理员审核。
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 只登记草稿,不发布
|
|
43
|
+
playcraft skills registry push ./my-skill --ref author/video-helper --version 1.2.0 --json
|
|
44
|
+
|
|
45
|
+
# 上传后发布到本人范围;本人发布与更新免管理员审核
|
|
46
|
+
playcraft skills registry publish ./my-skill --ref author/video-helper --version 1.2.0 --scope private --json
|
|
47
|
+
|
|
48
|
+
# 上传新版本,明确旧版本;先同步修改清单中的 version(若已声明)
|
|
49
|
+
playcraft skills registry update author/video-helper --from ./my-skill --version 1.3.0 --base-version 1.2.0 --changelog 'Improve examples' --json
|
|
50
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope private --json
|
|
51
|
+
|
|
52
|
+
# 同一精确版本推广到团队或平台,不重新分配身份
|
|
53
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
54
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope platform --json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
目录打包仅在内存中补充缺失的清单字段,不改动源目录。显式参数与现有清单身份或版本冲突时拒绝上传。`publish <ref>@<version>` 只发布已上传版本,不能同时传入目录上传参数 `--ref`、`--version`、`--base-version` 或 `--changelog`。排除根目录 `.git`、`node_modules` 和拉取回执;其他文件按目录完整收录,发布前应确保目录只包含需要分享的技能资源。拒绝符号链接、硬链接、不安全路径及大小超限:最多 512 个文件,单文件 16 MiB (Mebibyte, 二进制兆字节),内容总量与压缩包各 64 MiB。清单中的文件引用和显式摘要必须匹配实际文件。
|
|
58
|
+
|
|
59
|
+
全平台同一 `skillRef@version` 唯一;同内容重传复用版本,改内容必须增加版本号。已有命名空间占用或所有权冲突不会转换为更新他人技能。平台保留标识和新建平台归属技能由服务端管理员权限控制,普通作者可先上传本人技能,再向平台发行提审。
|
|
60
|
+
|
|
61
|
+
`push/update` 返回 `published: false`。`publish` 先检查当前发行指针,再携带该指针提交;并发发行变更由服务端拒绝。本人发行免审核;团队发行须目标团队管理员批准;平台发行须平台管理员批准。没有有效批准时,发布返回 `status: "review_pending"`、`published: false` 和审核标识。以返回字段为准,命令成功不代表已经发行。
|
|
62
|
+
|
|
63
|
+
## 审核、历史与回滚
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
playcraft skills registry publish-check author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
67
|
+
playcraft skills registry review submit author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
68
|
+
playcraft skills registry review list --scope team --team '<teamId>' --json
|
|
69
|
+
playcraft skills registry review approve '<reviewId>' --json
|
|
70
|
+
playcraft skills registry review reject '<reviewId>' --reason 'Add usage examples' --json
|
|
71
|
+
|
|
72
|
+
# 审核后显式发布相同版本、相同目标范围
|
|
73
|
+
playcraft skills registry publish author/video-helper@1.3.0 --scope team --team '<teamId>' --json
|
|
74
|
+
playcraft skills registry history author/video-helper --scope team --team '<teamId>' --json
|
|
75
|
+
playcraft skills registry rollback author/video-helper@1.2.0 --scope team --team '<teamId>' --reason 'Regression in 1.3.0' --json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
审核决定只批准或拒绝指定申请,不自动执行发布。审核授权与申请目标范围由服务端校验。`publish-check` 显示硬性问题、评估问题、审核要求和当前发行指针;检查通过仍可能因发布时权限或指针改变而失败。回滚只移动选定范围的发行指针,复用已有精确版本,仍受该范围授权、审核和并发检查约束,不重写旧项目锁。
|
|
79
|
+
|
|
80
|
+
## 中断与恢复
|
|
81
|
+
|
|
82
|
+
修改请求不自动重试。命令在发出请求前将请求键及 `pending` 状态写入 `~/.playcraft/registry-requests/`,收到明确结果后记录 `completed/rejected`;回执不保存令牌或技能内容。发布与回滚同时保存操作目标、精确版本、摘要和首次检查得到的发行指针。超时、断线或响应无法确认目标时保留 `pending`;相同环境、凭据和操作的重试复用原请求键及原发行指针,不重新检查后覆盖其他人后来发布的版本。已明确完成或拒绝后,再次执行属于新的操作,会重新检查并分配请求键。服务端精确版本、内容摘要及发行指针是最终事实来源。上传后发布中断时,也可运行 `info <ref>@<version>`、`publish-check` 和 `history` 核对,再继续精确版本发布。
|
|
83
|
+
|
|
84
|
+
## 原生平台视频技能首次登记
|
|
85
|
+
|
|
86
|
+
云工作区默认使用的两个引用是 `remix/playcraft-video-understanding` 和 `remix/playcraft-replica-validation`。它们必须通过 `platform push` 登记,服务端会创建 `kind=platform`、`source=platform` 的原生身份。普通 `push --scope platform` 创建的是托管工作区技能,不能替代这一入口。
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
playcraft skills registry platform push ./playcraft-video-understanding-1.0.1.tar.gz --changelog '更新视频理解指引与评估用例' --json
|
|
90
|
+
playcraft skills registry platform push ./playcraft-replica-validation-1.0.1.tar.gz --changelog '更新复刻验收指引与评估用例' --json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`platform push <source>` 接受完整目录或已准备的压缩包。目录必须已含原生 `manifest.json`;命令保留其文件内容,不补充托管技能默认字段。已有压缩包原样发送,不重打包。可选的 `--ref`、`--version` 必须与清单一致;可用 `--evaluation-template <templateId>` 指定初始评估模板。原生入口当前仅接受上述两个引用,要求平台类型、单一 `sandbox-agent` surface、对齐的名称与版本、无 imports/relationships;服务端执行完整校验与摘要归一化,并返回最终 `artifactHash`。登记不会自动评估、审核或发布。
|
|
94
|
+
|
|
95
|
+
此入口要求具有平台管理权限的真实账号凭据;命令复用目标环境登录,不发送本地身份模拟请求头。服务端需已部署允许真实管理员个人访问令牌访问原生登记和评估接口的版本。
|
|
96
|
+
|
|
97
|
+
## 真实评估
|
|
98
|
+
|
|
99
|
+
评估会使用指定工作区的模型和配置,在服务端评估执行器中实际运行用例。命令不构造通过记录,也不调用内部执行步骤接口。评估队列、执行器、模型和证据存储均须可用。先明确目标环境、工作区以及精确 `ref@version`,再选择模板和模型:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
playcraft skills registry evaluation templates list --json
|
|
103
|
+
playcraft skills registry evaluation models --workspace '<workspaceId>' --json
|
|
104
|
+
playcraft skills registry evaluation config get remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
没有可用模板时,管理员可创建并启用模板:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
playcraft skills registry evaluation templates create --input ./evaluation-template.json --json
|
|
111
|
+
playcraft skills registry evaluation templates enable '<templateId>' --json
|
|
112
|
+
# 停用模板会使相关发布检查不再接受该模板
|
|
113
|
+
playcraft skills registry evaluation templates disable '<templateId>' --json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
模板输入文件只接受 `{ "key": "...", "name": "...", "spec": { ... } }`。`spec` 使用现有评估模板字段:`executor`、`dockerImage`、`cloudTemplateId`、`nodeVersion`、`opencodeVersion`、`modelConfigId`、`graderVersion`、`caseTimeoutSeconds`、`runTimeoutSeconds`、`globalConcurrency`。填写实际运行镜像与工具版本;使用本地 Docker 时不要填写虚构的云模板标识。运行平台如何选择执行器由部署配置决定,命令不会自动切换。模板创建会分配新修订,**不保证请求键幂等**;若响应丢失,先用 `templates list` 核对,再决定是否重试。
|
|
117
|
+
|
|
118
|
+
配置输入文件只接受 `{ "templateId": "...", "expectedRevision": 0, "spec": { ... } }`。`expectedRevision` 使用 `config get` 返回的修订号;`spec` 包含 `modelConfigId`、`caseTimeoutSeconds`、`cases`。用例结构及断言种类见 [共享评估类型](../common/src/skill-evaluation.ts)。填写有意义的真实提示词、输入文件、断言和必要的模型评审要求;服务端校验完整性、运行证据与发布条件。
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
playcraft skills registry evaluation config set remix/playcraft-video-understanding@1.0.1 --scope platform --input ./video-evaluation-config.json --json
|
|
122
|
+
playcraft skills registry evaluation run remix/playcraft-video-understanding@1.0.1 --scope platform --workspace '<workspaceId>' --config '<configId>' --request-key 'video-1-0-1-run-001' --wait --timeout 1800 --interval 3 --json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`--config` 必须是保存返回的精确配置标识;工作区标识不要求是通用唯一标识符。请求键允许 8–128 位字母、数字、下划线或连字符;重新执行一次评估需新键,断线恢复同一次评估需复用原键及全部原参数。`--compare` 可同时评估当前稳定版作为基线。省略 `--wait` 时返回已创建评估;带 `--wait` 时只有 `phase=completed` 且 `verdict=passed` 才成功退出,失败或取消会返回包含评估记录的结构化错误并非零退出。
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
playcraft skills registry evaluation status '<runId>' --json
|
|
129
|
+
playcraft skills registry evaluation runs remix/playcraft-video-understanding@1.0.1 --scope platform --workspace '<workspaceId>' --json
|
|
130
|
+
playcraft skills registry evaluation wait '<runId>' --timeout 1800 --interval 3 --json
|
|
131
|
+
playcraft skills registry evaluation evidence '<runId>' --case '<caseResultId>' --json
|
|
132
|
+
playcraft skills registry evaluation cancel '<runId>' --json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`--case` 使用状态结果中的 `results[].id`,不是逻辑用例名 `normal/boundary/regression`。状态含用例结果和检查项;`evidence` 读取对应归档证据。轮询默认最多 600 秒、间隔 3 秒;超时只停止等待,不取消后台评估,也不自动重新发起。修改请求不自动重试;配置写入使用预期修订号,断线后先读取配置确认实际结果。
|
|
136
|
+
|
|
137
|
+
## 同一原生版本的正式发布
|
|
138
|
+
|
|
139
|
+
应用治理迁移后,原生平台身份也使用托管注册表的审核、检查和发布命令;不要调用旧发布接口。评估配置变化会使旧配置的审核和证据失效。完成真实评估后,对同一精确版本提交审核、查看证据并由有权限的管理员批准,然后发布:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
playcraft skills registry review submit remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
143
|
+
playcraft skills registry review approve '<reviewId>' --json
|
|
144
|
+
playcraft skills registry publish-check remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
145
|
+
playcraft skills registry publish remix/playcraft-video-understanding@1.0.1 --scope platform --json
|
|
146
|
+
playcraft skills registry history remix/playcraft-video-understanding --scope platform --json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
对 `remix/playcraft-replica-validation@1.0.1` 独立完成同样流程。检查必须没有硬性或评估问题;最终核对 `published: true`、返回的精确版本与摘要,以及发行历史。命令没有例外发布选项,不跳过真实评估或审核。这里描述的是操作流程,新增命令的自动测试通过不代表任一环境已完成真实评估或正式发布。工作区预览绑定仍不属于本命令组。
|
|
@@ -2,7 +2,7 @@ import express from 'express';
|
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import fs from 'node:fs/promises';
|
|
5
|
-
import { eq, inArray } from '
|
|
5
|
+
import { eq, inArray } from '@playcraft/common/database/operators';
|
|
6
6
|
import pc from 'picocolors';
|
|
7
7
|
import { createSqliteAdapter } from '@playcraft/common/database';
|
|
8
8
|
import { AssetModel, ProjectModel, SceneModel } from '@playcraft/common/models';
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { loadGlobalConfig } from '../config.js';
|
|
5
|
+
import { accountActivationMessage } from './messages.js';
|
|
6
|
+
export const ACCOUNT_PENDING_ACTIVATION = 'account_pending_activation';
|
|
7
|
+
export class AccountActivationError extends Error {
|
|
8
|
+
code;
|
|
9
|
+
status;
|
|
10
|
+
retryable = false;
|
|
11
|
+
constructor(code, message, status) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.status = status;
|
|
15
|
+
this.name = 'AccountActivationError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function responseErrorCode(payload) {
|
|
19
|
+
if (!payload || typeof payload !== 'object')
|
|
20
|
+
return undefined;
|
|
21
|
+
const { error, code } = payload;
|
|
22
|
+
return typeof error?.code === 'string' ? error.code : typeof code === 'string' ? code : undefined;
|
|
23
|
+
}
|
|
24
|
+
export function pendingAccountActivationError(status, payload) {
|
|
25
|
+
return status === 403 && responseErrorCode(payload) === ACCOUNT_PENDING_ACTIVATION
|
|
26
|
+
? new AccountActivationError(ACCOUNT_PENDING_ACTIVATION, `${ACCOUNT_PENDING_ACTIVATION}: ${accountActivationMessage('pending')}`, status)
|
|
27
|
+
: undefined;
|
|
28
|
+
}
|
|
29
|
+
export function parseErrorPayload(text) {
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(text);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function localActivationConfig() {
|
|
38
|
+
for (const path of [
|
|
39
|
+
join(process.cwd(), '.playcraft.json'),
|
|
40
|
+
'/project/.playcraft.json',
|
|
41
|
+
join(homedir(), '.playcraft.json'),
|
|
42
|
+
]) {
|
|
43
|
+
if (!existsSync(path))
|
|
44
|
+
continue;
|
|
45
|
+
try {
|
|
46
|
+
const config = JSON.parse(readFileSync(path, 'utf8'));
|
|
47
|
+
if (config && typeof config === 'object' && !Array.isArray(config))
|
|
48
|
+
return config;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Follow the existing local credential lookup when a file is unreadable.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
function stringValue(value) {
|
|
57
|
+
return typeof value === 'string' && value ? value : undefined;
|
|
58
|
+
}
|
|
59
|
+
function activationBaseUrl(raw) {
|
|
60
|
+
try {
|
|
61
|
+
const url = new URL(raw);
|
|
62
|
+
if (!['http:', 'https:'].includes(url.protocol) ||
|
|
63
|
+
url.username ||
|
|
64
|
+
url.password ||
|
|
65
|
+
url.search ||
|
|
66
|
+
url.hash)
|
|
67
|
+
throw new Error();
|
|
68
|
+
url.pathname = url.pathname.replace(/\/+$/, '').replace(/\/api$/, '');
|
|
69
|
+
return url.toString().replace(/\/+$/, '');
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
throw new AccountActivationError('INVALID_ACTIVATION_TARGET', accountActivationMessage('invalidTarget'));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function savedTokenForTarget(config, rawUrl, target, environment) {
|
|
76
|
+
if (!rawUrl || (stringValue(config.env)?.trim() || '') !== environment)
|
|
77
|
+
return undefined;
|
|
78
|
+
try {
|
|
79
|
+
return activationBaseUrl(rawUrl) === target ? stringValue(config.token) : undefined;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function normalizedSavedUrl(raw) {
|
|
86
|
+
try {
|
|
87
|
+
return raw ? activationBaseUrl(raw) : undefined;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export async function activateAccount(options, defaultBaseUrl) {
|
|
94
|
+
const local = localActivationConfig();
|
|
95
|
+
const global = loadGlobalConfig();
|
|
96
|
+
const localUrl = stringValue(local.apiUrl);
|
|
97
|
+
const globalUrl = stringValue(global.backendUrl) || stringValue(global.url);
|
|
98
|
+
const explicitUrl = options.url || process.env.PLAYCRAFT_API_URL || process.env.PLAYCRAFT_URL;
|
|
99
|
+
const target = activationBaseUrl(explicitUrl || localUrl || globalUrl || defaultBaseUrl);
|
|
100
|
+
const explicitToken = options.token || process.env.PLAYCRAFT_TOKEN || process.env.PLAYCRAFT_SANDBOX_TOKEN;
|
|
101
|
+
const savedUrls = [normalizedSavedUrl(localUrl), normalizedSavedUrl(globalUrl)].filter(Boolean);
|
|
102
|
+
const savedTokens = [stringValue(local.token), stringValue(global.token)].filter(Boolean);
|
|
103
|
+
const environmentsConflict = savedUrls.length === 2 &&
|
|
104
|
+
savedUrls[0] === savedUrls[1] &&
|
|
105
|
+
(stringValue(local.env)?.trim() || '') !== (stringValue(global.env)?.trim() || '');
|
|
106
|
+
const environmentTokensConflict = process.env.PLAYCRAFT_TOKEN &&
|
|
107
|
+
process.env.PLAYCRAFT_SANDBOX_TOKEN &&
|
|
108
|
+
process.env.PLAYCRAFT_TOKEN !== process.env.PLAYCRAFT_SANDBOX_TOKEN;
|
|
109
|
+
const environmentUrlsConflict = process.env.PLAYCRAFT_API_URL &&
|
|
110
|
+
process.env.PLAYCRAFT_URL &&
|
|
111
|
+
normalizedSavedUrl(process.env.PLAYCRAFT_API_URL) !==
|
|
112
|
+
normalizedSavedUrl(process.env.PLAYCRAFT_URL);
|
|
113
|
+
if ((!explicitUrl && new Set(savedUrls).size > 1) ||
|
|
114
|
+
(!explicitToken && new Set(savedTokens).size > 1) ||
|
|
115
|
+
(environmentsConflict && !process.env.PLAYCRAFT_ENV) ||
|
|
116
|
+
(environmentTokensConflict && !options.token) ||
|
|
117
|
+
(environmentUrlsConflict && !options.url)) {
|
|
118
|
+
throw new AccountActivationError('AMBIGUOUS_ACTIVATION_TARGET', accountActivationMessage('ambiguous'));
|
|
119
|
+
}
|
|
120
|
+
const environment = (process.env.PLAYCRAFT_ENV ||
|
|
121
|
+
(!explicitUrl ? (localUrl ? stringValue(local.env) : stringValue(global.env)) : '') ||
|
|
122
|
+
'').trim();
|
|
123
|
+
const token = explicitToken ||
|
|
124
|
+
savedTokenForTarget(local, localUrl, target, environment) ||
|
|
125
|
+
savedTokenForTarget(global, globalUrl, target, environment);
|
|
126
|
+
if (!token)
|
|
127
|
+
throw new AccountActivationError('AUTH_REQUIRED', accountActivationMessage('missingToken'));
|
|
128
|
+
if (!/^playcraft_pat_[A-Za-z0-9_-]{32}$/.test(token)) {
|
|
129
|
+
throw new AccountActivationError('INVALID_ACTIVATION_TOKEN', accountActivationMessage('invalidToken'));
|
|
130
|
+
}
|
|
131
|
+
let response;
|
|
132
|
+
try {
|
|
133
|
+
response = await fetch(`${target}/api/settings/personal-access-tokens/activate`, {
|
|
134
|
+
method: 'POST',
|
|
135
|
+
redirect: 'error',
|
|
136
|
+
signal: AbortSignal.timeout(30_000),
|
|
137
|
+
headers: {
|
|
138
|
+
Authorization: `Bearer ${token}`,
|
|
139
|
+
...(environment ? { 'playcraft-env': environment } : {}),
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
throw new AccountActivationError('ACTIVATION_UNCONFIRMED', accountActivationMessage('unavailable'));
|
|
145
|
+
}
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
await response.body?.cancel().catch(() => { });
|
|
148
|
+
throw new AccountActivationError('ACTIVATION_FAILED', accountActivationMessage('failed'), response.status);
|
|
149
|
+
}
|
|
150
|
+
const result = await response.json().catch(() => undefined);
|
|
151
|
+
if (!result ||
|
|
152
|
+
typeof result !== 'object' ||
|
|
153
|
+
result.accountStatus !== 'active') {
|
|
154
|
+
throw new AccountActivationError('ACTIVATION_UNCONFIRMED', accountActivationMessage('unavailable'), response.status);
|
|
155
|
+
}
|
|
156
|
+
console.log(accountActivationMessage('success'));
|
|
157
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const messages = {
|
|
2
|
+
en: {
|
|
3
|
+
activateOption: 'Explicitly activate the account using the current personal access token',
|
|
4
|
+
tokenOption: 'Personal access token for --activate (or use PLAYCRAFT_TOKEN)',
|
|
5
|
+
pending: 'Account activation is required. Run `playcraft login --activate` with the same token and target environment, then rerun your command.',
|
|
6
|
+
success: 'Account activated. Rerun your original command to continue.',
|
|
7
|
+
missingToken: 'No personal access token matches this target environment. Provide PLAYCRAFT_TOKEN or log in to this environment first.',
|
|
8
|
+
invalidToken: 'Account activation requires a personal access token. A sandbox token cannot activate an account.',
|
|
9
|
+
ambiguous: 'Activation credentials or target environments conflict. Specify --url, PLAYCRAFT_ENV when needed, and an explicit personal access token using --token or PLAYCRAFT_TOKEN.',
|
|
10
|
+
invalidTarget: 'Use a web service base address (http:// or https://) without credentials, a query, or a fragment.',
|
|
11
|
+
failed: 'Account activation failed. Check the target environment and token before trying again.',
|
|
12
|
+
unavailable: 'Account activation could not be confirmed. Check your account status before explicitly trying again.',
|
|
13
|
+
},
|
|
14
|
+
zh: {
|
|
15
|
+
activateOption: '明确使用当前个人访问令牌激活账号',
|
|
16
|
+
tokenOption: '用于 --activate 的个人访问令牌(也可使用 PLAYCRAFT_TOKEN)',
|
|
17
|
+
pending: '账号需要激活。请使用同一令牌和目标环境主动运行 `playcraft login --activate`,然后重新执行原命令。',
|
|
18
|
+
success: '账号已激活,请重新执行原命令继续。',
|
|
19
|
+
missingToken: '没有与目标环境匹配的个人访问令牌。请提供 PLAYCRAFT_TOKEN,或先登录此环境。',
|
|
20
|
+
invalidToken: '激活账号需要个人访问令牌,沙箱令牌不能用于激活账号。',
|
|
21
|
+
ambiguous: '激活凭据或目标环境存在冲突。请明确指定 --url、所需的 PLAYCRAFT_ENV,并通过 --token 或 PLAYCRAFT_TOKEN 提供个人访问令牌。',
|
|
22
|
+
invalidTarget: '激活目标必须是网页服务基址(http:// 或 https://),不能包含凭据、查询参数或片段。',
|
|
23
|
+
failed: '账号激活失败,请检查目标环境和令牌后再尝试。',
|
|
24
|
+
unavailable: '无法确认账号是否已激活。请先检查账号状态,再主动决定是否重试。',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export function accountActivationMessage(key) {
|
|
28
|
+
const locale = process.env.PLAYCRAFT_LANGUAGE || process.env.LANG || 'en';
|
|
29
|
+
return messages[locale.startsWith('zh') ? 'zh' : 'en'][key];
|
|
30
|
+
}
|
package/dist/cli-root-help.js
CHANGED
|
@@ -5,8 +5,10 @@ export function getCliTopicsHelpText() {
|
|
|
5
5
|
'',
|
|
6
6
|
' 本地开发 create, init, start, stop, status, logs, config, sync, fix-ids',
|
|
7
7
|
' 素材 tools generate-* | image <子命令> | audio <子命令> | prefab <子命令>',
|
|
8
|
+
' 视频理解 video models | video understand | video jobs get/cancel',
|
|
8
9
|
' 平台 build, build-base, build-playable, build-all, analyze, inspect, upgrade',
|
|
9
10
|
' tools 除 generate-* 外(Git / 沙箱构建 / 发布 / 列表 / Prefab 等,需后端 API)',
|
|
11
|
+
' 沙箱常驻 workspace-runtime serve(Cloud Workspace,由 Runtime 引导配置启动)',
|
|
10
12
|
'',
|
|
11
13
|
'也可运行: playcraft topics',
|
|
12
14
|
'',
|
|
@@ -4,6 +4,7 @@ import pc from 'picocolors';
|
|
|
4
4
|
import ora from 'ora';
|
|
5
5
|
import { BaseBuilder, ViteBuilder, PlayableBuilder, EngineDetector, detectAmmoUsage, } from '@playcraft/build';
|
|
6
6
|
import { loadBuildConfig } from '../build-config.js';
|
|
7
|
+
import { cleanupBuildTempDirectory, createBuildTempDirectory } from './build-temp.js';
|
|
7
8
|
import inquirer from 'inquirer';
|
|
8
9
|
/**
|
|
9
10
|
* 所有可用的渠道平台
|
|
@@ -141,6 +142,7 @@ export async function buildAllCommand(projectPath, options) {
|
|
|
141
142
|
const spinner = ora(pc.cyan('🚀 批量打渠道包...')).start();
|
|
142
143
|
let isBaseBuild = false;
|
|
143
144
|
let baseBuildDir;
|
|
145
|
+
let tempBuildDir;
|
|
144
146
|
try {
|
|
145
147
|
// 1. 确定要构建的平台列表
|
|
146
148
|
let targetPlatforms;
|
|
@@ -415,9 +417,9 @@ export async function buildAllCommand(projectPath, options) {
|
|
|
415
417
|
}
|
|
416
418
|
else {
|
|
417
419
|
spinner.text = pc.cyan('执行阶段1: 基础构建(仅一次)...');
|
|
418
|
-
|
|
420
|
+
tempBuildDir = await createBuildTempDirectory(resolvedProjectPath);
|
|
419
421
|
const baseBuilder = new BaseBuilder(resolvedProjectPath, {
|
|
420
|
-
outputDir:
|
|
422
|
+
outputDir: tempBuildDir,
|
|
421
423
|
selectedScenes,
|
|
422
424
|
analyze: options.analyze,
|
|
423
425
|
});
|
|
@@ -593,6 +595,7 @@ export async function buildAllCommand(projectPath, options) {
|
|
|
593
595
|
if (failCount > 0) {
|
|
594
596
|
process.exit(1);
|
|
595
597
|
}
|
|
598
|
+
await cleanupBuildTempDirectory(tempBuildDir);
|
|
596
599
|
}
|
|
597
600
|
catch (error) {
|
|
598
601
|
spinner.fail(pc.red('批量构建失败'));
|
|
@@ -602,21 +605,4 @@ export async function buildAllCommand(projectPath, options) {
|
|
|
602
605
|
}
|
|
603
606
|
process.exit(1);
|
|
604
607
|
}
|
|
605
|
-
finally {
|
|
606
|
-
// 清理临时目录,避免磁盘空间浪费
|
|
607
|
-
if (!isBaseBuild && baseBuildDir && baseBuildDir.includes('.playcraft-temp')) {
|
|
608
|
-
try {
|
|
609
|
-
await fs.rm(baseBuildDir, { recursive: true, force: true });
|
|
610
|
-
// 如果 .playcraft-temp 父目录为空,也一并清理
|
|
611
|
-
const tempParent = path.dirname(baseBuildDir);
|
|
612
|
-
const remaining = await fs.readdir(tempParent);
|
|
613
|
-
if (remaining.length === 0) {
|
|
614
|
-
await fs.rm(tempParent, { recursive: true, force: true });
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
catch {
|
|
618
|
-
// 清理失败不影响构建结果
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
608
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, rm } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export async function createBuildTempDirectory(projectPath) {
|
|
5
|
+
const parent = path.join(projectPath, '.playcraft-temp');
|
|
6
|
+
await mkdir(parent, { recursive: true });
|
|
7
|
+
const directory = path.join(parent, `base-build-${randomUUID()}`);
|
|
8
|
+
// mkdir 继承工程的共享组和权限掩码;mkdtemp 固定使用 0700。
|
|
9
|
+
await mkdir(directory);
|
|
10
|
+
return directory;
|
|
11
|
+
}
|
|
12
|
+
export async function cleanupBuildTempDirectory(directory) {
|
|
13
|
+
if (!directory)
|
|
14
|
+
return;
|
|
15
|
+
if (process.env.PLAYCRAFT_KEEP_BUILD_TEMP === '1') {
|
|
16
|
+
console.log(`构建临时目录保留在: ${directory}`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
// 只删除本次创建的目录,保留并发构建与用户输入;父目录不做递归清理。
|
|
21
|
+
await rm(directory, { recursive: true, force: true });
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.warn(`清理构建临时目录失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
25
|
+
}
|
|
26
|
+
}
|