@joiner-platform/cli 0.0.0-stage → 0.1.1
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 +30 -2
- package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
- package/bundled-resources/poe-tile-templates/base/README.md +7 -0
- package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
- package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
- package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
- package/bundled-resources/poe-tile-templates/base/package.json +36 -0
- package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
- package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
- package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
- package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
- package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
- package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
- package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
- package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
- package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
- package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
- package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
- package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
- package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
- package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
- package/bundled-resources/poe-tile-templates/index.ts +27 -0
- package/bundled-resources/poe-tile-templates/package.json +31 -0
- package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
- package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
- package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
- package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
- package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
- package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
- package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
- package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
- package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
- package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
- package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
- package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
- package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
- package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
- package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
- package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
- package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
- package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
- package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
- package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
- package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
- package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
- package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
- package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
- package/cli.ts +134 -0
- package/index.ts +96 -0
- package/package.json +48 -5
- package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/audio-generation/SKILL.md +125 -0
- package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/finish-prototype/SKILL.md +22 -0
- package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
- package/skills/help-me-build/SKILL.md +56 -0
- package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/image-generation/SKILL.md +128 -0
- package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
- package/skills/one-shot/SKILL.md +22 -0
- package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-prototype/SKILL.md +60 -0
- package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-subagent/SKILL.md +16 -0
- package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
- package/skills/poe-tiles-cli/SKILL.md +609 -0
- package/skills/poe-tiles-cli/references/device-motion.md +40 -0
- package/skills/poe-tiles-cli/references/player-updates.md +41 -0
- package/skills/prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/prototype/SKILL.md +149 -0
- package/skills/publish/.generated-by-poe-templated-docs +0 -0
- package/skills/publish/SKILL.md +73 -0
- package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
- package/skills/synced-store/SKILL.md +583 -0
- package/skills/synced-store/references/actions.md +85 -0
- package/skills/synced-store/references/api-patterns.md +245 -0
- package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
- package/skills/synced-store/references/client-api-reference.md +263 -0
- package/skills/synced-store/references/data-visibility.md +95 -0
- package/skills/synced-store/references/external-stores.md +162 -0
- package/skills/synced-store/references/file-uploads.md +216 -0
- package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
- package/skills/synced-store/references/limitations.md +72 -0
- package/skills/synced-store/references/live-data-limit-hook.md +131 -0
- package/skills/synced-store/references/mutator-rules.md +169 -0
- package/skills/synced-store/references/platform.md +49 -0
- package/skills/synced-store/references/schema-and-bindings.md +85 -0
- package/skills/synced-store/references/schema-libraries.md +57 -0
- package/skills/synced-store/references/schema-migrations.md +119 -0
- package/skills/synced-store/references/searchable-tables.md +27 -0
- package/skills/synced-store/references/server-forking.md +115 -0
- package/skills/synced-store/references/singleton-tables.md +61 -0
- package/skills/synced-store/references/sort-keys.md +253 -0
- package/skills/synced-store/references/ui-patterns.md +95 -0
- package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
- package/skills/tile-creator/SKILL.md +197 -0
- package/skills/tile-creator/references/assets.md +124 -0
- package/skills/tile-creator/references/backend-api.md +354 -0
- package/skills/tile-creator/references/cli-limitations.md +64 -0
- package/skills/tile-creator/references/cli.md +604 -0
- package/skills/tile-creator/references/client-api.md +2407 -0
- package/skills/tile-creator/references/composing-apps.md +166 -0
- package/skills/tile-creator/references/e2e-tests.md +55 -0
- package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
- package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
- package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
- package/skills/tile-creator/references/native-results.md +100 -0
- package/skills/tile-creator/references/platform-integration.md +201 -0
- package/skills/tile-creator/references/power-report.md +199 -0
- package/skills/tile-creator/references/publish-rollout.md +166 -0
- package/skills/tile-creator/references/publishing.md +33 -0
- package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
- package/skills/tile-creator/references/render-check.md +266 -0
- package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
- package/skills/tile-creator/references/safe-area-insets.md +79 -0
- package/skills/tile-creator/references/sandbox-limitations.md +32 -0
- package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
- package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
- package/skills/tile-creator/references/simulations.md +125 -0
- package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
- package/skills/tile-creator/references/troubleshooting.md +22 -0
- package/skills/tile-creator/references/turn-based-mutator.md +43 -0
- package/skills/tile-creator/references/user-erasure.md +14 -0
- package/skills/tile-creator/references/vite-plugin.md +166 -0
- package/skills/tile-creator/references/workspace-retention.md +72 -0
- package/src/admin-conversions-client.ts +28 -0
- package/src/admin-reviews-client.ts +36 -0
- package/src/api.generated.ts +1527 -0
- package/src/auth-token.ts +198 -0
- package/src/bounded-read.ts +35 -0
- package/src/bun-version.ts +33 -0
- package/src/checkout-base.ts +207 -0
- package/src/cli-bun-version.ts +16 -0
- package/src/cli-env.ts +28 -0
- package/src/cli-name.ts +23 -0
- package/src/client.ts +2474 -0
- package/src/collect-files.ts +226 -0
- package/src/commands/accounts.ts +55 -0
- package/src/commands/admin-abandon-conversion.ts +60 -0
- package/src/commands/admin-reviews.ts +66 -0
- package/src/commands/admin.ts +219 -0
- package/src/commands/auth.ts +89 -0
- package/src/commands/checkout-prototype.ts +67 -0
- package/src/commands/creator-source-capability.ts +11 -0
- package/src/commands/doctor-bun.ts +145 -0
- package/src/commands/doctor-command.ts +64 -0
- package/src/commands/doctor-package-json.ts +47 -0
- package/src/commands/doctor-sdk-pin.ts +156 -0
- package/src/commands/doctor-store-keys-lexer.ts +213 -0
- package/src/commands/doctor-store-keys-scan.ts +262 -0
- package/src/commands/doctor-store-keys.ts +196 -0
- package/src/commands/doctor.ts +371 -0
- package/src/commands/init/blank-scaffold-templates.ts +397 -0
- package/src/commands/init/index.ts +170 -0
- package/src/commands/init/internal-toolchain.ts +49 -0
- package/src/commands/init/manager-test-template.ts +107 -0
- package/src/commands/init/multiplayer-test-template.ts +217 -0
- package/src/commands/init/name-input.tsx +167 -0
- package/src/commands/init/no-store-scaffold-templates.ts +281 -0
- package/src/commands/init/no-store-scaffold.ts +134 -0
- package/src/commands/init/package-json-scripts.ts +72 -0
- package/src/commands/init/scaffold.ts +960 -0
- package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
- package/src/commands/init/sdk-tarball-url.ts +31 -0
- package/src/commands/init/template-picker.tsx +147 -0
- package/src/commands/inspect-child-entry.ts +107 -0
- package/src/commands/inspect-contract.ts +87 -0
- package/src/commands/inspect-freshness.ts +217 -0
- package/src/commands/inspect-lock.ts +201 -0
- package/src/commands/inspect-options.ts +360 -0
- package/src/commands/inspect-orchestrate.ts +375 -0
- package/src/commands/inspect-process.ts +172 -0
- package/src/commands/inspect-ready.ts +65 -0
- package/src/commands/inspect-report.ts +235 -0
- package/src/commands/inspect-run-state.ts +296 -0
- package/src/commands/inspect-run.ts +157 -0
- package/src/commands/inspect-watchdog.ts +74 -0
- package/src/commands/install-joiner.ts +208 -0
- package/src/commands/login.ts +308 -0
- package/src/commands/models.ts +40 -0
- package/src/commands/parse-options.ts +36 -0
- package/src/commands/remix-package-json.ts +64 -0
- package/src/commands/remix.ts +379 -0
- package/src/commands/sdk-url.ts +141 -0
- package/src/commands/simulations.ts +133 -0
- package/src/commands/skills.ts +108 -0
- package/src/commands/store-files.ts +92 -0
- package/src/commands/stores.ts +703 -0
- package/src/commands/tiles-channel-commands.ts +115 -0
- package/src/commands/tiles-checkout.ts +351 -0
- package/src/commands/tiles-gallery-command.ts +95 -0
- package/src/commands/tiles-get-helpers.ts +27 -0
- package/src/commands/tiles-inspect.ts +276 -0
- package/src/commands/tiles-power-command.ts +308 -0
- package/src/commands/tiles-power-format.ts +396 -0
- package/src/commands/tiles-power-versions.ts +299 -0
- package/src/commands/tiles-publish-helpers.ts +145 -0
- package/src/commands/tiles-upload-command.ts +277 -0
- package/src/commands/tiles-version-commands.ts +201 -0
- package/src/commands/tiles-visibility-command.ts +103 -0
- package/src/commands/tiles.ts +257 -0
- package/src/commands/upgrade.ts +307 -0
- package/src/commit-in-progress.ts +42 -0
- package/src/creator-source-context.ts +97 -0
- package/src/creator-source-publish.ts +52 -0
- package/src/deferred-assets.ts +125 -0
- package/src/distribution.ts +28 -0
- package/src/errors.ts +61 -0
- package/src/install-command.ts +43 -0
- package/src/output.ts +62 -0
- package/src/poe-tile-config-files.ts +100 -0
- package/src/poe-tile-config-players.ts +168 -0
- package/src/poe-tile-config-remix.ts +166 -0
- package/src/poe-tile-config.ts +831 -0
- package/src/power-report-client.ts +55 -0
- package/src/prototype-startup.ts +21 -0
- package/src/publish-change-summary.ts +55 -0
- package/src/publish-overrides-validation.ts +49 -0
- package/src/publish-pack.ts +167 -0
- package/src/publish-phases.ts +57 -0
- package/src/publish-retry.ts +51 -0
- package/src/publish-tile-from-config.ts +434 -0
- package/src/recorder-stream.ts +169 -0
- package/src/remix-provenance.ts +156 -0
- package/src/resolve-client-credential.ts +71 -0
- package/src/resolve-media-uploads.ts +147 -0
- package/src/sdk-dependency.ts +54 -0
- package/src/sdk-skills.ts +85 -0
- package/src/should-skip-client-setup.ts +20 -0
- package/src/simulation-snapshot.ts +123 -0
- package/src/simulation-types.ts +74 -0
- package/src/simulations-client.ts +112 -0
- package/src/source-bundle.ts +466 -0
- package/src/staged-publish-cleanup.ts +44 -0
- package/src/staged-publish-deferred.ts +160 -0
- package/src/staged-publish.ts +401 -0
- package/src/store-file-upload.ts +268 -0
- package/src/store-request.ts +168 -0
- package/src/tar-canonical.ts +41 -0
- package/src/tar-extensions.ts +159 -0
- package/src/tar-extract.ts +193 -0
- package/src/tar-parse.ts +224 -0
- package/src/tar.ts +231 -0
- package/src/template-check-scripts.ts +18 -0
- package/src/tile-gallery-client.ts +82 -0
- package/src/types.ts +258 -0
- package/src/upload-concurrency.ts +54 -0
- package/src/whole-tile.ts +52 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
/**
|
|
3
|
+
* Upload-outcome + promote helpers for the `tiles upload` / `tiles deploy`
|
|
4
|
+
* commands, split out to keep the command files within the per-file line budget.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { printJson, printKeyValue } from "../output.js";
|
|
8
|
+
import type { PublishResult, SourceUpload } from "../types.js";
|
|
9
|
+
|
|
10
|
+
/** How a `runtime_bundle` source upload reads to the creator. */
|
|
11
|
+
const RUNTIME_BUNDLE_SOURCE_UPLOAD =
|
|
12
|
+
"this prototype's files (owner-only unless the tile's source is already shared)";
|
|
13
|
+
|
|
14
|
+
function sourceUploadRow(sourceUpload: SourceUpload | undefined): string {
|
|
15
|
+
if (sourceUpload === "runtime_bundle") return RUNTIME_BUNDLE_SOURCE_UPLOAD;
|
|
16
|
+
return sourceUpload ?? "Not reported by this publisher";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The line printed before an upload starts. */
|
|
20
|
+
export function describeSourceUpload(sourceUpload: SourceUpload): string {
|
|
21
|
+
switch (sourceUpload) {
|
|
22
|
+
case "runtime_bundle":
|
|
23
|
+
return `Source upload: ${RUNTIME_BUNDLE_SOURCE_UPLOAD}.`;
|
|
24
|
+
case "unchanged":
|
|
25
|
+
return "Source upload: unchanged. No source bundle in this upload; any previously uploaded source keeps its visibility.";
|
|
26
|
+
case "public":
|
|
27
|
+
return "Source upload: public. Other signed-in users can download and remix it.";
|
|
28
|
+
case "owner_only":
|
|
29
|
+
return "Source upload: owner_only. Only the owner can download the uploaded source.";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The object `--json` prints for an upload: the tile's identity, its URL, and
|
|
35
|
+
* the publish-state fields. The one shape a program reads a publish through —
|
|
36
|
+
* Creator's bridge reads it from the CLI's stdout, and reads the same object
|
|
37
|
+
* directly when it runs the publish in its own process.
|
|
38
|
+
*/
|
|
39
|
+
export function publishOutcomeJson(
|
|
40
|
+
result: Extract<PublishResult, { success: true }>,
|
|
41
|
+
promotedVersion: number | undefined,
|
|
42
|
+
): Record<string, unknown> {
|
|
43
|
+
return {
|
|
44
|
+
...result.tile,
|
|
45
|
+
tileUrl: result.tileUrl,
|
|
46
|
+
// Forwarded as-is: absent from an older server, never defaulted here.
|
|
47
|
+
versionNumber: result.versionNumber,
|
|
48
|
+
sourceBundleId: result.sourceBundleId,
|
|
49
|
+
sourceUpload: result.sourceUpload,
|
|
50
|
+
simulation: result.simulation,
|
|
51
|
+
warning: result.warning,
|
|
52
|
+
...(promotedVersion === undefined
|
|
53
|
+
? {}
|
|
54
|
+
: { promotedToLiveVersion: promotedVersion }),
|
|
55
|
+
...publishStateFields(result),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Print the upload outcome (JSON or human), including any promote result. */
|
|
60
|
+
export function reportPublishOutcome(
|
|
61
|
+
jsonMode: boolean,
|
|
62
|
+
result: Extract<PublishResult, { success: true }>,
|
|
63
|
+
promotedVersion: number | undefined,
|
|
64
|
+
): void {
|
|
65
|
+
if (jsonMode) {
|
|
66
|
+
printJson(publishOutcomeJson(result, promotedVersion));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
printPublishResult(result);
|
|
70
|
+
if (promotedVersion !== undefined) {
|
|
71
|
+
console.log(`Promoted version ${promotedVersion} to live.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The publish-state booleans, forwarded verbatim INCLUDING when absent.
|
|
77
|
+
*
|
|
78
|
+
* A consumer has to be able to tell "this server said players are unaffected"
|
|
79
|
+
* from "this server never said", so a missing field stays missing rather than
|
|
80
|
+
* being defaulted here. Each is dropped individually for that reason — see
|
|
81
|
+
* their docstrings in `types.ts`.
|
|
82
|
+
*
|
|
83
|
+
* Split out of {@link reportPublishOutcome} so the set can grow without that
|
|
84
|
+
* function's branch count growing with it.
|
|
85
|
+
*/
|
|
86
|
+
function publishStateFields(
|
|
87
|
+
result: Extract<PublishResult, { success: true }>,
|
|
88
|
+
): Record<string, boolean> {
|
|
89
|
+
const fields: Record<string, boolean> = {};
|
|
90
|
+
for (const key of [
|
|
91
|
+
"livePromoted",
|
|
92
|
+
"previewScoped",
|
|
93
|
+
"listed",
|
|
94
|
+
"previewAheadOfLive",
|
|
95
|
+
] as const) {
|
|
96
|
+
const value = result[key];
|
|
97
|
+
if (value !== undefined) fields[key] = value;
|
|
98
|
+
}
|
|
99
|
+
return fields;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Human-readable `tiles upload` success output (JSON mode prints the raw shape). */
|
|
103
|
+
function printPublishResult(
|
|
104
|
+
result: Extract<PublishResult, { success: true }>,
|
|
105
|
+
): void {
|
|
106
|
+
console.log("Tile uploaded.");
|
|
107
|
+
printKeyValue([
|
|
108
|
+
["Tile ID", result.tile.id],
|
|
109
|
+
["Handle", result.tile.handle],
|
|
110
|
+
["Client Bundle ID", result.tile.clientBundleId],
|
|
111
|
+
["Backend Bundle ID", result.tile.backendBundleId || "(none)"],
|
|
112
|
+
["Tile URL", result.tileUrl],
|
|
113
|
+
[
|
|
114
|
+
"Live",
|
|
115
|
+
result.livePromoted === undefined
|
|
116
|
+
? "Not reported by this server"
|
|
117
|
+
: result.livePromoted
|
|
118
|
+
? "New version is live"
|
|
119
|
+
: "Live version did not change",
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
"Discovery",
|
|
123
|
+
result.listed === undefined
|
|
124
|
+
? "Not reported by this server"
|
|
125
|
+
: result.listed
|
|
126
|
+
? "Publicly listed"
|
|
127
|
+
: "Unlisted — accessible by link",
|
|
128
|
+
],
|
|
129
|
+
["Source upload", sourceUploadRow(result.sourceUpload)],
|
|
130
|
+
// Only for a tile whose declared `players` range makes it worth testing
|
|
131
|
+
// with several players. Printed as its own labeled row so an agent
|
|
132
|
+
// relaying upload output to a creator can surface it verbatim.
|
|
133
|
+
...(result.simulation === undefined
|
|
134
|
+
? []
|
|
135
|
+
: ([
|
|
136
|
+
[
|
|
137
|
+
`Multiplayer simulation (${result.simulation.users} players)`,
|
|
138
|
+
result.simulation.url,
|
|
139
|
+
],
|
|
140
|
+
] as Array<[string, string]>)),
|
|
141
|
+
]);
|
|
142
|
+
if (result.warning !== undefined) {
|
|
143
|
+
console.warn(`Warning: ${result.warning}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
// owner: klu
|
|
2
|
+
/**
|
|
3
|
+
* The `tiles upload` / `tiles deploy` commands — recording a new version of a
|
|
4
|
+
* tile without (`upload`) or with (`deploy`) an explicit in-band promote
|
|
5
|
+
* of `live`. Split from `tiles.ts` so that file stays within the per-file line
|
|
6
|
+
* budget, and so the two commands share one option surface by construction
|
|
7
|
+
* rather than by keeping two lists in sync.
|
|
8
|
+
*
|
|
9
|
+
* `upload` keeps `publish` as an alias on purpose: every scaffolded
|
|
10
|
+
* `publish-to-poe-tiles` script, installed skill, and container bridge in the
|
|
11
|
+
* wild invokes `tiles publish`, and the CLI self-upgrades underneath them.
|
|
12
|
+
* The alias must outlive the rename; removing it is a breaking change for
|
|
13
|
+
* workspaces nobody can regenerate.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { type Command, Option } from "commander";
|
|
17
|
+
import {
|
|
18
|
+
confirmCheckoutIsCurrent,
|
|
19
|
+
recordDeployedVersion,
|
|
20
|
+
} from "../checkout-base.js";
|
|
21
|
+
import type { SlopPoeClient } from "../client.js";
|
|
22
|
+
import { CliError } from "../errors.js";
|
|
23
|
+
import { isJsonMode } from "../output.js";
|
|
24
|
+
import { readPoeTileConfig } from "../poe-tile-config.js";
|
|
25
|
+
import { publishTileFromConfig } from "../publish-tile-from-config.js";
|
|
26
|
+
import {
|
|
27
|
+
describeSourceUpload,
|
|
28
|
+
reportPublishOutcome,
|
|
29
|
+
} from "./tiles-publish-helpers.js";
|
|
30
|
+
|
|
31
|
+
/** The flags `upload` and `deploy` share. `deploy` forces `promote` on. */
|
|
32
|
+
interface UploadCommandOptions {
|
|
33
|
+
handle?: string;
|
|
34
|
+
dir?: string;
|
|
35
|
+
publishAsPoe?: boolean;
|
|
36
|
+
publishAsTileAuthor?: boolean;
|
|
37
|
+
publishAsReleaseIdentity?: boolean;
|
|
38
|
+
sourceBundle?: string;
|
|
39
|
+
sourceBundleVisibility?: string;
|
|
40
|
+
sourceBundleIgnore?: string;
|
|
41
|
+
profilePicture?: string;
|
|
42
|
+
shortDescription?: string;
|
|
43
|
+
longDescription?: string;
|
|
44
|
+
displayName?: string;
|
|
45
|
+
changeSummary?: string;
|
|
46
|
+
versionName?: string;
|
|
47
|
+
versionNotes?: string;
|
|
48
|
+
promote?: boolean;
|
|
49
|
+
finalizeEdit?: boolean;
|
|
50
|
+
editHandle?: string;
|
|
51
|
+
overwriteNewer?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Register the option surface `upload` and `deploy` share.
|
|
56
|
+
*
|
|
57
|
+
* One function rather than two option lists: a flag added to `upload` but not
|
|
58
|
+
* `deploy` would make "same flags as `tiles upload`" in deploy's help a lie,
|
|
59
|
+
* and nothing else would catch it.
|
|
60
|
+
*/
|
|
61
|
+
function addSharedUploadOptions(command: Command): Command {
|
|
62
|
+
return (
|
|
63
|
+
command
|
|
64
|
+
.option(
|
|
65
|
+
"--handle <handle>",
|
|
66
|
+
"Tile handle (lowercase alphanumeric + hyphens). " +
|
|
67
|
+
"Required unless .poe-tile.json provides one.",
|
|
68
|
+
)
|
|
69
|
+
.option(
|
|
70
|
+
"--dir <path>",
|
|
71
|
+
"Directory containing tile files (must include index.html). " +
|
|
72
|
+
"Defaults to `runtimeBundle.dir` from .poe-tile.json, or `dist` if neither is set.",
|
|
73
|
+
)
|
|
74
|
+
// Paired boolean: `--publish-as-poe` sets `publishAsPoe = true`;
|
|
75
|
+
// `--no-publish-as-poe` sets `publishAsPoe = false`. Config files cannot
|
|
76
|
+
// set this anymore; uploading under @poe must be an explicit invocation.
|
|
77
|
+
.option(
|
|
78
|
+
"--publish-as-poe",
|
|
79
|
+
"Upload under the @poe system account (requires allowlisted API key)",
|
|
80
|
+
)
|
|
81
|
+
.option(
|
|
82
|
+
"--no-publish-as-poe",
|
|
83
|
+
"Upload under the calling user (the default)",
|
|
84
|
+
)
|
|
85
|
+
.option(
|
|
86
|
+
"--publish-as-tile-author",
|
|
87
|
+
"Upload under the checked-in first-party author (internal; requires allowlisted API key)",
|
|
88
|
+
)
|
|
89
|
+
.option(
|
|
90
|
+
"--publish-as-release-identity",
|
|
91
|
+
"Let the server choose @poe vs the checked-in author for this handle " +
|
|
92
|
+
"(internal release automation; requires allowlisted API key)",
|
|
93
|
+
)
|
|
94
|
+
.option(
|
|
95
|
+
"--source-bundle <path>",
|
|
96
|
+
"Optional source-code directory to upload alongside the runtime bundle. " +
|
|
97
|
+
"Enables future remix/edit. Requires --source-bundle-visibility.",
|
|
98
|
+
)
|
|
99
|
+
.option(
|
|
100
|
+
"--source-bundle-visibility <vis>",
|
|
101
|
+
"Visibility of the uploaded source bundle: 'owner_only' (private) or " +
|
|
102
|
+
"'public' (anyone authenticated can fetch). Required when --source-bundle is set.",
|
|
103
|
+
)
|
|
104
|
+
.option(
|
|
105
|
+
"--source-bundle-ignore <path>",
|
|
106
|
+
"Optional ignore file with extra patterns to exclude from the source bundle " +
|
|
107
|
+
"(applied on top of the built-in defaults and the project's .gitignore).",
|
|
108
|
+
)
|
|
109
|
+
.option(
|
|
110
|
+
"--profile-picture <pathOrUrl>",
|
|
111
|
+
"Tile icon shown on cards and at the top of the tile landing page. " +
|
|
112
|
+
"Local path (PNG/JPG/WEBP, ≤512 KB) or `https://` URL stored as-is. " +
|
|
113
|
+
'Pass an empty string (--profile-picture="") to clear an existing picture.',
|
|
114
|
+
)
|
|
115
|
+
.option(
|
|
116
|
+
"--short-description <text>",
|
|
117
|
+
"One-line tagline (≤140 chars) shown on cards and the landing page. " +
|
|
118
|
+
"Pass an empty string to clear.",
|
|
119
|
+
)
|
|
120
|
+
.option(
|
|
121
|
+
"--long-description <path>",
|
|
122
|
+
"Path to a markdown file (≤16 KB) rendered on the tile landing page " +
|
|
123
|
+
"below the Launch button. Pass an empty string to clear.",
|
|
124
|
+
)
|
|
125
|
+
.option(
|
|
126
|
+
"--display-name <name>",
|
|
127
|
+
"Human-friendly display name (≤80 chars) shown instead of the kebab-case handle. " +
|
|
128
|
+
"Pass an empty string to clear.",
|
|
129
|
+
)
|
|
130
|
+
.option(
|
|
131
|
+
"--change-summary <text>",
|
|
132
|
+
"Concise user-facing summary of this upload (≤500 chars), included in Creator chat receipts.",
|
|
133
|
+
)
|
|
134
|
+
.option(
|
|
135
|
+
"--version-name <name>",
|
|
136
|
+
'Label for the new version (≤60 chars) shown in the version-history UI instead of the default "Version N".',
|
|
137
|
+
)
|
|
138
|
+
.option(
|
|
139
|
+
"--version-notes <text>",
|
|
140
|
+
"Free-form what-changed notes (≤2000 chars) stored on the new version. Defaults to --change-summary when omitted.",
|
|
141
|
+
)
|
|
142
|
+
// On both commands, so a migrated `publish --promote` invocation keeps
|
|
143
|
+
// working whichever new spelling it lands on: on `upload` it is the
|
|
144
|
+
// deprecated way to go live, on `deploy` it is redundant and ignored
|
|
145
|
+
// (deploy already forces the promote).
|
|
146
|
+
.addOption(
|
|
147
|
+
new Option(
|
|
148
|
+
"--promote",
|
|
149
|
+
"(deprecated — use `tiles deploy`) Make the new version live even " +
|
|
150
|
+
"when the tile's follow-latest preference is off.",
|
|
151
|
+
).hideHelp(),
|
|
152
|
+
)
|
|
153
|
+
.option(
|
|
154
|
+
"--overwrite-newer",
|
|
155
|
+
"In a `tiles checkout` folder, replace versions published since the " +
|
|
156
|
+
"checkout (for example from Creator) without asking.",
|
|
157
|
+
)
|
|
158
|
+
.addOption(
|
|
159
|
+
new Option(
|
|
160
|
+
"--finalize-edit",
|
|
161
|
+
"Finalize the current platform Edit session",
|
|
162
|
+
),
|
|
163
|
+
)
|
|
164
|
+
.addOption(
|
|
165
|
+
new Option(
|
|
166
|
+
"--edit-handle <handle>",
|
|
167
|
+
"Explicitly rename the tile while finalizing Edit",
|
|
168
|
+
),
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The shared action body. All resolution + validation lives in
|
|
175
|
+
* `publishTileFromConfig` so in-monorepo callers (dev-watch-tiles, playwright
|
|
176
|
+
* seed) take the exact same path as these commands.
|
|
177
|
+
*/
|
|
178
|
+
async function runUpload(
|
|
179
|
+
command: Command,
|
|
180
|
+
client: SlopPoeClient,
|
|
181
|
+
opts: UploadCommandOptions,
|
|
182
|
+
): Promise<void> {
|
|
183
|
+
const { overwriteNewer, ...overrides } = opts;
|
|
184
|
+
const cwd = process.cwd();
|
|
185
|
+
await confirmCheckoutIsCurrent({
|
|
186
|
+
client,
|
|
187
|
+
dir: cwd,
|
|
188
|
+
handle: opts.handle ?? configuredHandle(cwd),
|
|
189
|
+
interactive: process.stdin.isTTY === true && !isJsonMode(command),
|
|
190
|
+
overwriteNewer: overwriteNewer === true,
|
|
191
|
+
});
|
|
192
|
+
const result = await publishTileFromConfig({
|
|
193
|
+
client,
|
|
194
|
+
cwd,
|
|
195
|
+
overrides,
|
|
196
|
+
beforeUpload(sourceUpload) {
|
|
197
|
+
if (isJsonMode(command)) return;
|
|
198
|
+
console.log(describeSourceUpload(sourceUpload));
|
|
199
|
+
console.log(
|
|
200
|
+
opts.promote
|
|
201
|
+
? "This deployment makes the new version live."
|
|
202
|
+
: "This upload follows the tile's Auto-Advance Live setting (on by default).",
|
|
203
|
+
);
|
|
204
|
+
console.log(
|
|
205
|
+
"Uploading does not change discovery visibility. Unlisted tiles remain accessible by link; browser-delivered code is readable by players.",
|
|
206
|
+
);
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
if (!result.success) {
|
|
211
|
+
throw new CliError(result.message);
|
|
212
|
+
}
|
|
213
|
+
recordDeployedVersion(cwd, {
|
|
214
|
+
tileId: result.tile.id,
|
|
215
|
+
versionNumber: result.versionNumber,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// With the live follow-latest preference off, an upload only records the
|
|
219
|
+
// version (advancing follow-latest custom channels in-batch); `deploy` (or
|
|
220
|
+
// the deprecated `--promote`) makes the new version live IN-BAND regardless
|
|
221
|
+
// — the server promotes under the same request identity that uploaded, so
|
|
222
|
+
// it composes with `--publish-as-*` and can't strand the receipt. The
|
|
223
|
+
// promoted version rides back on the upload response.
|
|
224
|
+
reportPublishOutcome(
|
|
225
|
+
isJsonMode(command),
|
|
226
|
+
result,
|
|
227
|
+
result.promotedToLiveVersion,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The handle `.poe-tile.json` names, or `undefined`. A malformed config fails
|
|
233
|
+
* in `publishTileFromConfig`, which reports it.
|
|
234
|
+
*/
|
|
235
|
+
function configuredHandle(cwd: string): string | undefined {
|
|
236
|
+
try {
|
|
237
|
+
const config = readPoeTileConfig(cwd);
|
|
238
|
+
return config.found ? config.config.handle : undefined;
|
|
239
|
+
} catch {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Register `tiles upload` (alias `publish`) and `tiles deploy` on `tiles`. */
|
|
245
|
+
export function addTileUploadCommands(
|
|
246
|
+
tiles: Command,
|
|
247
|
+
client: SlopPoeClient,
|
|
248
|
+
): void {
|
|
249
|
+
addSharedUploadOptions(
|
|
250
|
+
tiles
|
|
251
|
+
.command("upload")
|
|
252
|
+
.alias("publish")
|
|
253
|
+
.description(
|
|
254
|
+
"Upload a new version of a tile from a directory. Records the " +
|
|
255
|
+
"version; live also advances while its follow-latest preference is " +
|
|
256
|
+
"on (the default) — use `tiles deploy` to make a build live " +
|
|
257
|
+
"explicitly. Reads defaults from .poe-tile.json in the current " +
|
|
258
|
+
"directory if present (explicit flags win). `publish` is the " +
|
|
259
|
+
"command's old name, kept as an alias.",
|
|
260
|
+
),
|
|
261
|
+
).action(async function (this: Command, opts: UploadCommandOptions) {
|
|
262
|
+
await runUpload(this, client, opts);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
addSharedUploadOptions(
|
|
266
|
+
tiles
|
|
267
|
+
.command("deploy")
|
|
268
|
+
.description(
|
|
269
|
+
"Upload a new version of a tile AND make it live in one step — " +
|
|
270
|
+
"an upload plus the in-band promote, applied even while live is " +
|
|
271
|
+
"pinned. Takes the same flags as `tiles upload`. To release an " +
|
|
272
|
+
"already-uploaded version instead, use `tiles promote`.",
|
|
273
|
+
),
|
|
274
|
+
).action(async function (this: Command, opts: UploadCommandOptions) {
|
|
275
|
+
await runUpload(this, client, { ...opts, promote: true });
|
|
276
|
+
});
|
|
277
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// owner: klu
|
|
2
|
+
/**
|
|
3
|
+
* The `tiles` version-management commands — `versions` (list publish history
|
|
4
|
+
* with names/descriptions and the channel markers), `edit-version`
|
|
5
|
+
* (rename a version / edit its description after publish), and
|
|
6
|
+
* `auto-advance` (the "Auto-Advance Live" publish preference). Split from
|
|
7
|
+
* `tiles.ts` so that file stays within the per-file line budget.
|
|
8
|
+
*
|
|
9
|
+
* Together with `channels` / `promote` / `set-channel` / `upload
|
|
10
|
+
* --version-name --version-notes`, this gives the CLI (and therefore the
|
|
11
|
+
* tile-creator agent, which drives this CLI from its sandbox) the same
|
|
12
|
+
* version-management surface as the manager's Tile Versions UI.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { Command } from "commander";
|
|
16
|
+
import type { SlopPoeClient } from "../client.js";
|
|
17
|
+
import { assertSuccess, CliError } from "../errors.js";
|
|
18
|
+
import { isJsonMode, printJson, printKeyValue } from "../output.js";
|
|
19
|
+
import type { CliTileChannel, CliTileVersion } from "../types.js";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Build the tri-state patch from the edit-version flags: an omitted flag
|
|
23
|
+
* stays ABSENT (the field is untouched), an empty string clears (`null`).
|
|
24
|
+
*/
|
|
25
|
+
function versionMetaPatch(opts: { name?: string; description?: string }): {
|
|
26
|
+
displayName?: string | null;
|
|
27
|
+
notes?: string | null;
|
|
28
|
+
} {
|
|
29
|
+
const patch: { displayName?: string | null; notes?: string | null } = {};
|
|
30
|
+
if (opts.name !== undefined) {
|
|
31
|
+
patch.displayName = opts.name.trim() === "" ? null : opts.name;
|
|
32
|
+
}
|
|
33
|
+
if (opts.description !== undefined) {
|
|
34
|
+
patch.notes = opts.description.trim() === "" ? null : opts.description;
|
|
35
|
+
}
|
|
36
|
+
return patch;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Parse a positive-integer CLI argument or throw a `CliError`. */
|
|
40
|
+
function parsePositiveInt(arg: string, label: string): number {
|
|
41
|
+
// `Number`, not `Number.parseInt`: parseInt accepts a numeric prefix, so a
|
|
42
|
+
// typo like "1abc" would silently target version 1.
|
|
43
|
+
const value = Number(arg);
|
|
44
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
45
|
+
throw new CliError(`${label} must be a positive integer`);
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The names of the channels that serve `versionNumber`, such as `live`. */
|
|
51
|
+
export function channelNamesServing(
|
|
52
|
+
channels: readonly CliTileChannel[],
|
|
53
|
+
versionNumber: number,
|
|
54
|
+
): string[] {
|
|
55
|
+
return channels
|
|
56
|
+
.filter((channel) => channel.versionNumber === versionNumber)
|
|
57
|
+
.map((channel) => channel.name);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A version with its channel markers: "v12", or "v12 [LIVE, STAGING]". */
|
|
61
|
+
export function versionLabel(
|
|
62
|
+
versionNumber: number,
|
|
63
|
+
channelNames: readonly string[],
|
|
64
|
+
): string {
|
|
65
|
+
const markers = channelNames.map((name) => name.toUpperCase());
|
|
66
|
+
return `v${versionNumber}${markers.length > 0 ? ` [${markers.join(", ")}]` : ""}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** One-line human summary of a version row, with its channel markers. */
|
|
70
|
+
function versionSummary(
|
|
71
|
+
version: CliTileVersion,
|
|
72
|
+
channels: readonly CliTileChannel[],
|
|
73
|
+
): [string, string] {
|
|
74
|
+
const name = version.displayName === null ? "" : ` — ${version.displayName}`;
|
|
75
|
+
const notes = version.notes === null ? "" : `\n ${version.notes}`;
|
|
76
|
+
return [
|
|
77
|
+
versionLabel(
|
|
78
|
+
version.versionNumber,
|
|
79
|
+
channelNamesServing(channels, version.versionNumber),
|
|
80
|
+
),
|
|
81
|
+
`${version.publishedAt}${name}${notes}`,
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Register the version-management commands on `tiles`. */
|
|
86
|
+
export function addTileVersionCommands(
|
|
87
|
+
tiles: Command,
|
|
88
|
+
client: SlopPoeClient,
|
|
89
|
+
): void {
|
|
90
|
+
tiles
|
|
91
|
+
.command("versions")
|
|
92
|
+
.description(
|
|
93
|
+
"List a tile's published versions (newest first) with their names, " +
|
|
94
|
+
"descriptions, and which one is LIVE vs STAGING. Owner only.",
|
|
95
|
+
)
|
|
96
|
+
.argument("<tileHandleOrId>", "Tile ID or userHandle/tileHandle")
|
|
97
|
+
.option("--limit <n>", "How many versions to list (default 20)", "20")
|
|
98
|
+
.action(async function (
|
|
99
|
+
this: Command,
|
|
100
|
+
tileHandleOrId: string,
|
|
101
|
+
opts: { limit: string },
|
|
102
|
+
) {
|
|
103
|
+
const limit = parsePositiveInt(opts.limit, "--limit");
|
|
104
|
+
const lookup = await client.getTile(tileHandleOrId);
|
|
105
|
+
assertSuccess(lookup);
|
|
106
|
+
const [versions, channels] = await Promise.all([
|
|
107
|
+
client.listTileVersions(lookup.tile.id, limit),
|
|
108
|
+
client.getTileChannels(lookup.tile.id),
|
|
109
|
+
]);
|
|
110
|
+
assertSuccess(versions);
|
|
111
|
+
assertSuccess(channels);
|
|
112
|
+
if (isJsonMode(this)) {
|
|
113
|
+
printJson({
|
|
114
|
+
versions: versions.versions,
|
|
115
|
+
channels: channels.channels,
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
printKeyValue(
|
|
119
|
+
versions.versions.map((version) =>
|
|
120
|
+
versionSummary(version, channels.channels),
|
|
121
|
+
),
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
tiles
|
|
127
|
+
.command("edit-version")
|
|
128
|
+
.description(
|
|
129
|
+
"Rename a published version or edit its description — the same " +
|
|
130
|
+
"metadata `upload --version-name/--version-notes` sets at upload " +
|
|
131
|
+
"time. Pass an empty string to clear a field back to its default. " +
|
|
132
|
+
"Owner only.",
|
|
133
|
+
)
|
|
134
|
+
.argument("<tileHandleOrId>", "Tile ID or userHandle/tileHandle")
|
|
135
|
+
.argument("<versionNumber>", "Version number (see `tiles versions`)")
|
|
136
|
+
.option("--name <name>", "Version name (≤60 chars; '' clears)")
|
|
137
|
+
.option(
|
|
138
|
+
"--description <text>",
|
|
139
|
+
"What changed in this version (≤2000 chars; '' clears)",
|
|
140
|
+
)
|
|
141
|
+
.action(async function (
|
|
142
|
+
this: Command,
|
|
143
|
+
tileHandleOrId: string,
|
|
144
|
+
versionNumber: string,
|
|
145
|
+
opts: { name?: string; description?: string },
|
|
146
|
+
) {
|
|
147
|
+
if (opts.name === undefined && opts.description === undefined) {
|
|
148
|
+
throw new CliError("Provide --name and/or --description.");
|
|
149
|
+
}
|
|
150
|
+
const version = parsePositiveInt(versionNumber, "versionNumber");
|
|
151
|
+
const lookup = await client.getTile(tileHandleOrId);
|
|
152
|
+
assertSuccess(lookup);
|
|
153
|
+
const result = await client.updateTileVersionMeta(
|
|
154
|
+
lookup.tile.id,
|
|
155
|
+
version,
|
|
156
|
+
versionMetaPatch(opts),
|
|
157
|
+
);
|
|
158
|
+
assertSuccess(result);
|
|
159
|
+
if (isJsonMode(this)) {
|
|
160
|
+
printJson(result);
|
|
161
|
+
} else {
|
|
162
|
+
console.log(`Updated version ${version}.`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
tiles
|
|
167
|
+
.command("auto-advance")
|
|
168
|
+
.description(
|
|
169
|
+
"Set the tile's live follow-latest preference. 'on' (the default for " +
|
|
170
|
+
"every tile): each upload goes live immediately. 'off': uploads " +
|
|
171
|
+
"only record the version, and you set a version live yourself " +
|
|
172
|
+
"(`tiles deploy`, `tiles promote`, or the creator page). Owner only.",
|
|
173
|
+
)
|
|
174
|
+
.argument("<tileHandleOrId>", "Tile ID or userHandle/tileHandle")
|
|
175
|
+
.argument("<state>", "'on' or 'off'")
|
|
176
|
+
.action(async function (
|
|
177
|
+
this: Command,
|
|
178
|
+
tileHandleOrId: string,
|
|
179
|
+
state: string,
|
|
180
|
+
) {
|
|
181
|
+
if (state !== "on" && state !== "off") {
|
|
182
|
+
throw new CliError(`Invalid state: ${state}. Expected 'on' or 'off'.`);
|
|
183
|
+
}
|
|
184
|
+
const lookup = await client.getTile(tileHandleOrId);
|
|
185
|
+
assertSuccess(lookup);
|
|
186
|
+
const result = await client.setLiveAutoAdvance(
|
|
187
|
+
lookup.tile.id,
|
|
188
|
+
state === "on",
|
|
189
|
+
);
|
|
190
|
+
assertSuccess(result);
|
|
191
|
+
if (isJsonMode(this)) {
|
|
192
|
+
printJson({ tileId: lookup.tile.id, autoAdvance: result.autoAdvance });
|
|
193
|
+
} else {
|
|
194
|
+
console.log(
|
|
195
|
+
result.autoAdvance
|
|
196
|
+
? "Live follows latest — each upload goes live immediately."
|
|
197
|
+
: "Live is pinned — uploads only record the version; release with `tiles deploy` or `tiles promote`.",
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|