@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,89 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
/**
|
|
3
|
+
* Auth commands: login, logout, whoami, usage, points-history
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import { removePoeTilesSessionToken } from "../auth-token.js";
|
|
8
|
+
import type { SlopPoeClient } from "../client.js";
|
|
9
|
+
import { assertSuccess } from "../errors.js";
|
|
10
|
+
import { isJsonMode, printJson, printKeyValue, printTable } from "../output.js";
|
|
11
|
+
|
|
12
|
+
export function createAuthCommands(client: SlopPoeClient): Command {
|
|
13
|
+
const auth = new Command("auth").description(
|
|
14
|
+
"Authentication and account info",
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
auth
|
|
18
|
+
.command("logout")
|
|
19
|
+
.description("End current session")
|
|
20
|
+
.action(async function (this: Command) {
|
|
21
|
+
const result = await client.logout();
|
|
22
|
+
assertSuccess(result);
|
|
23
|
+
removePoeTilesSessionToken();
|
|
24
|
+
if (isJsonMode(this)) {
|
|
25
|
+
printJson({ success: true });
|
|
26
|
+
} else {
|
|
27
|
+
console.log("Logged out.");
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
auth
|
|
32
|
+
.command("whoami")
|
|
33
|
+
.description("Show current user")
|
|
34
|
+
.action(async function (this: Command) {
|
|
35
|
+
const result = await client.getSession();
|
|
36
|
+
assertSuccess(result);
|
|
37
|
+
const { user } = result;
|
|
38
|
+
if (isJsonMode(this)) {
|
|
39
|
+
printJson(user);
|
|
40
|
+
} else {
|
|
41
|
+
printKeyValue([
|
|
42
|
+
["User ID", user.user_id],
|
|
43
|
+
["Username", user.username],
|
|
44
|
+
["Display Name", user.display_name],
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
auth
|
|
50
|
+
.command("usage")
|
|
51
|
+
.description("Show point balance")
|
|
52
|
+
.action(async function (this: Command) {
|
|
53
|
+
const result = await client.getUsage();
|
|
54
|
+
assertSuccess(result);
|
|
55
|
+
if (isJsonMode(this)) {
|
|
56
|
+
printJson({ pointBalance: result.pointBalance });
|
|
57
|
+
} else {
|
|
58
|
+
printKeyValue([["Point Balance", result.pointBalance]]);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
auth
|
|
63
|
+
.command("points-history")
|
|
64
|
+
.description("Show usage history")
|
|
65
|
+
.action(async function (this: Command) {
|
|
66
|
+
const result = await client.getPointsHistory();
|
|
67
|
+
assertSuccess(result);
|
|
68
|
+
if (isJsonMode(this)) {
|
|
69
|
+
printJson(result.history);
|
|
70
|
+
} else {
|
|
71
|
+
if (result.history.length === 0) {
|
|
72
|
+
console.log("No usage history.");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
printTable({
|
|
76
|
+
headers: ["Bot", "Cost", "Type", "Time", "Query ID"],
|
|
77
|
+
rows: result.history.map((e) => [
|
|
78
|
+
e.bot_name,
|
|
79
|
+
e.cost_points,
|
|
80
|
+
e.usage_type,
|
|
81
|
+
new Date(e.creation_time * 1000).toISOString(),
|
|
82
|
+
e.query_id,
|
|
83
|
+
]),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return auth;
|
|
89
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
/**
|
|
3
|
+
* What `tiles checkout` does differently for a Creator prototype: a folder
|
|
4
|
+
* with `.poe-tile.json`, the `.poe-prototype` marker and `index.html` (plus
|
|
5
|
+
* any generated `assets/`), downloaded as the runtime bundle the prototype
|
|
6
|
+
* published (see the prototype skill's "Files").
|
|
7
|
+
*
|
|
8
|
+
* An agent outside Creator gets instructions that fit a prototype instead of
|
|
9
|
+
* the generic "load tile-creator" text: the installed prototype skill alone
|
|
10
|
+
* tells an agent without Creator's tools to follow tile-creator, which would
|
|
11
|
+
* scaffold a full project on the first edit.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { existsSync, rmSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { cliName } from "../cli-name.js";
|
|
17
|
+
|
|
18
|
+
const PROTOTYPE_MARKER = ".poe-prototype";
|
|
19
|
+
const RUNTIME_MANIFEST = ".poe-tile-runtime.json";
|
|
20
|
+
|
|
21
|
+
export function isPrototypeFolder(dir: string): boolean {
|
|
22
|
+
return existsSync(join(dir, PROTOTYPE_MARKER));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Remove the publish artifact and write the prototype's agent instructions.
|
|
27
|
+
* Existing instruction files are kept, as `installWorkspaceSkills` keeps them.
|
|
28
|
+
*/
|
|
29
|
+
export function preparePrototypeCheckout(dir: string): void {
|
|
30
|
+
// `declarePrototypeStartup` writes it into every prototype upload; the next
|
|
31
|
+
// deploy from the folder adds it again.
|
|
32
|
+
rmSync(join(dir, RUNTIME_MANIFEST), { force: true });
|
|
33
|
+
writeIfMissing(join(dir, "AGENTS.md"), prototypeAgentInstructions());
|
|
34
|
+
// Claude Code reads CLAUDE.md, not AGENTS.md; this line imports it.
|
|
35
|
+
writeIfMissing(join(dir, "CLAUDE.md"), "@AGENTS.md\n");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function writeIfMissing(path: string, text: string): void {
|
|
39
|
+
if (!existsSync(path)) writeFileSync(path, text);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function prototypeAgentInstructions(): string {
|
|
43
|
+
const cli = cliName();
|
|
44
|
+
return `# Joiner tile prototype
|
|
45
|
+
|
|
46
|
+
This folder is a Creator prototype, checked out with \`${cli} tiles checkout\`. The tile is \`index.html\`, its \`.poe-tile.json\`, the empty \`.poe-prototype\` marker, and any generated art or sound in \`assets/\`. There is no \`package.json\`, no build, and nothing to install.
|
|
47
|
+
|
|
48
|
+
## Change the prototype
|
|
49
|
+
|
|
50
|
+
- Read the \`prototype\` skill before you edit. Obey its "index.html" and "How a prototype should feel" rules: one \`<style>\` block and one \`<script type="module">\` with the six labelled modules, state in memory only, and no network.
|
|
51
|
+
- The Creator-only parts of that skill do not apply here: the \`/workspace\` paths, the \`begin_conversion\` and \`promote_conversion\` tools, the \`generate_image\`, \`generate_music\` and \`generate_sound_effect\` tools, \`.poe-tile-change-summary\`, and the automatic preview publish. Its rule to follow \`tile-creator\` when \`begin_conversion\` is missing also does not apply: this folder stays a prototype until the creator asks for the full version.
|
|
52
|
+
- Keep \`.poe-prototype\` while the tile is a prototype. Do not add \`package.json\`, the SDK, or a store.
|
|
53
|
+
- Publish with \`${cli} tiles deploy\` from this folder. The platform keeps the published files as the tile's source, so Creator can continue from this version.
|
|
54
|
+
|
|
55
|
+
## Build the full version
|
|
56
|
+
|
|
57
|
+
Do this only when the creator asks for it, for example for saved progress, shared state, or multiplayer.
|
|
58
|
+
|
|
59
|
+
1. Read the \`tile-creator\` and \`synced-store\` skills.
|
|
60
|
+
2. Scaffold a project in an empty folder outside this one: \`${cli} tiles init <handle> --template <react|preact|solidjs|vanilla-js|phaserjs> --output-dir <folder> --no-skills\`, with the \`handle\` from \`.poe-tile.json\`. Run \`bun install\` in the new project.
|
|
61
|
+
3. Port the prototype into the project as step 4 ("Port") of the prototype skill's "Integrate with Joiner" section says: one module to one place, modular TypeScript, generated assets copied, and \`bun run type-check\` passing.
|
|
62
|
+
4. Move the project into this folder. Delete \`index.html\` and \`.poe-prototype\` from this folder. Replace \`AGENTS.md\`, \`CLAUDE.md\`, and \`.poe-tile.json\` with the project's files, but keep the \`handle\`, \`displayName\`, and \`shortDescription\` of this folder's \`.poe-tile.json\`. Keep \`.poe-checkout.log\`.
|
|
63
|
+
5. Run \`bun install\` and the checks that \`tile-creator\` requires. Explain source visibility to the creator, then publish with \`${cli} tiles deploy\`.
|
|
64
|
+
|
|
65
|
+
When the creator opens the tile in Creator again and merges the newer version, Creator continues from this full version.
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// owner: aaronroe
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
|
|
5
|
+
export const CREATOR_SOURCE_SESSION_CAPABILITY = "creator-source-session-v1";
|
|
6
|
+
|
|
7
|
+
export function createCreatorSourceCapabilityCommand(): Command {
|
|
8
|
+
return new Command("creator-source-capability").action(() => {
|
|
9
|
+
console.log(CREATOR_SOURCE_SESSION_CAPABILITY);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
|
|
3
|
+
import { dirname, relative, resolve, sep } from "node:path";
|
|
4
|
+
import {
|
|
5
|
+
bunSupport,
|
|
6
|
+
TESTED_BUN_RANGE,
|
|
7
|
+
untestedBunWarning,
|
|
8
|
+
} from "../bun-version.js";
|
|
9
|
+
import { cliName } from "../cli-name.js";
|
|
10
|
+
import { SDK_PACKAGE_NAMES } from "../sdk-dependency.js";
|
|
11
|
+
import type {
|
|
12
|
+
DoctorCheck,
|
|
13
|
+
DoctorCommandRunner,
|
|
14
|
+
DoctorFileSystem,
|
|
15
|
+
} from "./doctor.js";
|
|
16
|
+
|
|
17
|
+
function readManifest(directory: string, fileSystem: DoctorFileSystem) {
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(
|
|
20
|
+
fileSystem.readFileSync(resolve(directory, "package.json"), "utf8"),
|
|
21
|
+
) as {
|
|
22
|
+
name?: unknown;
|
|
23
|
+
engines?: { bun?: unknown };
|
|
24
|
+
workspaces?: unknown;
|
|
25
|
+
} | null;
|
|
26
|
+
return {
|
|
27
|
+
name: typeof parsed?.name === "string" ? parsed.name : null,
|
|
28
|
+
bunRange:
|
|
29
|
+
typeof parsed?.engines?.bun === "string" ? parsed.engines.bun : null,
|
|
30
|
+
workspaces: Array.isArray(parsed?.workspaces)
|
|
31
|
+
? parsed.workspaces.filter(
|
|
32
|
+
(entry): entry is string => typeof entry === "string",
|
|
33
|
+
)
|
|
34
|
+
: [],
|
|
35
|
+
};
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function matchesWorkspace(patterns: string[], path: string): boolean {
|
|
42
|
+
return (
|
|
43
|
+
patterns.some(
|
|
44
|
+
(pattern) =>
|
|
45
|
+
!pattern.startsWith("!") && new Bun.Glob(pattern).match(path),
|
|
46
|
+
) &&
|
|
47
|
+
!patterns.some(
|
|
48
|
+
(pattern) =>
|
|
49
|
+
pattern.startsWith("!") && new Bun.Glob(pattern.slice(1)).match(path),
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function isJoinerWorkspace(
|
|
55
|
+
directory: string,
|
|
56
|
+
fileSystem: DoctorFileSystem,
|
|
57
|
+
): boolean {
|
|
58
|
+
const manifest = readManifest(directory, fileSystem);
|
|
59
|
+
// The SDK package keeps its directory but may carry either name, so a
|
|
60
|
+
// released CLI still recognizes the monorepo after the package rename.
|
|
61
|
+
const sdkName = readManifest(
|
|
62
|
+
resolve(directory, "packages/poe-tiles-sdk"),
|
|
63
|
+
fileSystem,
|
|
64
|
+
)?.name;
|
|
65
|
+
return (
|
|
66
|
+
manifest?.name === "ai-app" &&
|
|
67
|
+
matchesWorkspace(manifest.workspaces, "packages/poe-tiles-sdk") &&
|
|
68
|
+
(SDK_PACKAGE_NAMES as readonly unknown[]).includes(sdkName)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function workspaceBunRange(
|
|
73
|
+
cwd: string,
|
|
74
|
+
fileSystem: DoctorFileSystem,
|
|
75
|
+
): string | null {
|
|
76
|
+
// Standalone scaffolds declare their own toolchain, even inside a workspace.
|
|
77
|
+
const app = readManifest(cwd, fileSystem);
|
|
78
|
+
if (!app || app.bunRange) return null;
|
|
79
|
+
for (let directory = dirname(cwd); ; directory = dirname(directory)) {
|
|
80
|
+
const manifest = readManifest(directory, fileSystem);
|
|
81
|
+
const path = relative(directory, cwd).split(sep).join("/");
|
|
82
|
+
if (
|
|
83
|
+
manifest?.bunRange &&
|
|
84
|
+
matchesWorkspace(manifest.workspaces, path) &&
|
|
85
|
+
isJoinerWorkspace(directory, fileSystem)
|
|
86
|
+
) {
|
|
87
|
+
return manifest.bunRange;
|
|
88
|
+
}
|
|
89
|
+
if (dirname(directory) === directory) return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function checkBun(options: {
|
|
94
|
+
cwd: string;
|
|
95
|
+
fileSystem: DoctorFileSystem;
|
|
96
|
+
runner: DoctorCommandRunner;
|
|
97
|
+
}): DoctorCheck {
|
|
98
|
+
const result = options.runner.run({
|
|
99
|
+
command: "bun",
|
|
100
|
+
args: ["--version"],
|
|
101
|
+
cwd: options.cwd,
|
|
102
|
+
});
|
|
103
|
+
const workspaceRange = workspaceBunRange(options.cwd, options.fileSystem);
|
|
104
|
+
const fix = workspaceRange
|
|
105
|
+
? `Install Bun matching the workspace root's engines.bun (${workspaceRange}), then re-run \`${cliName()} doctor\`.`
|
|
106
|
+
: `Install Bun 1.4.2 using https://bun.com/docs/installation#installing-older-versions, then re-run \`${cliName()} doctor\`.`;
|
|
107
|
+
if (result.status !== 0) {
|
|
108
|
+
return {
|
|
109
|
+
name: "Bun",
|
|
110
|
+
status: "fail",
|
|
111
|
+
message: "Bun is not available to this workspace.",
|
|
112
|
+
fix,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return versionCheck(result.stdout.trim(), workspaceRange, fix);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function versionCheck(
|
|
119
|
+
version: string,
|
|
120
|
+
workspaceRange: string | null,
|
|
121
|
+
fix: string,
|
|
122
|
+
): DoctorCheck {
|
|
123
|
+
if (workspaceRange) {
|
|
124
|
+
return Bun.semver.satisfies(version, workspaceRange)
|
|
125
|
+
? { name: "Bun", status: "pass", message: `Bun ${version} is available.` }
|
|
126
|
+
: {
|
|
127
|
+
name: "Bun",
|
|
128
|
+
status: "fail",
|
|
129
|
+
message: `Found Bun ${version || "(unknown)"}, but this workspace needs Bun ${workspaceRange}.`,
|
|
130
|
+
fix,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const support = bunSupport(version);
|
|
134
|
+
if (support === "unsupported") {
|
|
135
|
+
return {
|
|
136
|
+
name: "Bun",
|
|
137
|
+
status: "fail",
|
|
138
|
+
message: `Found Bun ${version || "(unknown)"}, but Poe Tiles needs Bun 1.x (tested with ${TESTED_BUN_RANGE}).`,
|
|
139
|
+
fix,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return support === "untested"
|
|
143
|
+
? { name: "Bun", status: "warn", message: untestedBunWarning(version) }
|
|
144
|
+
: { name: "Bun", status: "pass", message: `Bun ${version} is available.` };
|
|
145
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
/**
|
|
3
|
+
* Commander wrapper and display output for `poe-tiles doctor`.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import { cliName } from "../cli-name.js";
|
|
8
|
+
import { isJsonMode, printJson } from "../output.js";
|
|
9
|
+
import {
|
|
10
|
+
type DoctorReport,
|
|
11
|
+
type RunDoctorOptions,
|
|
12
|
+
runDoctor,
|
|
13
|
+
} from "./doctor.js";
|
|
14
|
+
|
|
15
|
+
export function createDoctorCommand(
|
|
16
|
+
dependencies: Omit<RunDoctorOptions, "apiKey" | "cwd"> = {},
|
|
17
|
+
): Command {
|
|
18
|
+
return new Command("doctor")
|
|
19
|
+
.description(
|
|
20
|
+
"Check whether this Joiner project is ready to build and upload",
|
|
21
|
+
)
|
|
22
|
+
.option("--cwd <path>", "Project directory to check", process.cwd())
|
|
23
|
+
.action(function (this: Command, opts: { cwd: string }) {
|
|
24
|
+
const report = runDoctor({
|
|
25
|
+
...dependencies,
|
|
26
|
+
apiKey: rootCommandOptions(this).apiKey,
|
|
27
|
+
cwd: opts.cwd,
|
|
28
|
+
});
|
|
29
|
+
if (isJsonMode(this)) {
|
|
30
|
+
printJson(report);
|
|
31
|
+
} else {
|
|
32
|
+
printDoctorReport(report);
|
|
33
|
+
}
|
|
34
|
+
if (!report.ok) process.exitCode = 1;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function printDoctorReport(report: DoctorReport): void {
|
|
39
|
+
console.log("Joiner doctor");
|
|
40
|
+
console.log(`Folder: ${report.cwd}`);
|
|
41
|
+
console.log("");
|
|
42
|
+
for (const check of report.checks) {
|
|
43
|
+
console.log(`[${check.status}] ${check.name}: ${check.message}`);
|
|
44
|
+
if (check.fix) console.log(` Fix: ${check.fix}`);
|
|
45
|
+
}
|
|
46
|
+
console.log("");
|
|
47
|
+
if (report.ok) {
|
|
48
|
+
console.log("Ready to build and upload.");
|
|
49
|
+
console.log(
|
|
50
|
+
"Next: run `bun run dev`, `bun run build`, or `bun run publish-to-poe-tiles`.",
|
|
51
|
+
);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
console.log(
|
|
55
|
+
`${report.summary.failures} failed check${report.summary.failures === 1 ? "" : "s"}. ` +
|
|
56
|
+
`Fix them and run \`${cliName()} doctor\` again.`,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function rootCommandOptions(command: Command): { apiKey?: string } {
|
|
61
|
+
let root = command;
|
|
62
|
+
while (root.parent) root = root.parent;
|
|
63
|
+
return root.opts() as { apiKey?: string };
|
|
64
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// owner: kevlu94
|
|
2
|
+
/**
|
|
3
|
+
* Shared package.json read for `poe-tiles doctor` checks. Parsed once per
|
|
4
|
+
* run; the scripts/dependencies checks consume the same state so a broken
|
|
5
|
+
* package.json fails each of them with a consistent pointer.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { resolve } from "node:path";
|
|
9
|
+
import type { DoctorFileSystem } from "./doctor.js";
|
|
10
|
+
|
|
11
|
+
export type PackageJsonState =
|
|
12
|
+
| {
|
|
13
|
+
kind: "ok";
|
|
14
|
+
scripts: Record<string, unknown>;
|
|
15
|
+
dependencies: Record<string, unknown>;
|
|
16
|
+
devDependencies: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
| { kind: "missing" }
|
|
19
|
+
| { kind: "invalid"; error: string };
|
|
20
|
+
|
|
21
|
+
export function readPackageJson(options: {
|
|
22
|
+
cwd: string;
|
|
23
|
+
fileSystem: DoctorFileSystem;
|
|
24
|
+
}): PackageJsonState {
|
|
25
|
+
const path = resolve(options.cwd, "package.json");
|
|
26
|
+
if (!options.fileSystem.existsSync(path)) return { kind: "missing" };
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(
|
|
29
|
+
options.fileSystem.readFileSync(path, "utf8"),
|
|
30
|
+
) as {
|
|
31
|
+
scripts?: Record<string, unknown>;
|
|
32
|
+
dependencies?: Record<string, unknown>;
|
|
33
|
+
devDependencies?: Record<string, unknown>;
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
kind: "ok",
|
|
37
|
+
scripts: parsed.scripts ?? {},
|
|
38
|
+
dependencies: parsed.dependencies ?? {},
|
|
39
|
+
devDependencies: parsed.devDependencies ?? {},
|
|
40
|
+
};
|
|
41
|
+
} catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
kind: "invalid",
|
|
44
|
+
error: error instanceof Error ? error.message : String(error),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// owner: kevlu94
|
|
2
|
+
/**
|
|
3
|
+
* `poe-tiles doctor` check for the SDK pin (`joiner-sdk` or `poe-tiles-sdk`).
|
|
4
|
+
*
|
|
5
|
+
* Scaffolded apps freeze the SDK tarball URL in package.json at scaffold
|
|
6
|
+
* time, so an app can silently fall behind the SDK the docs describe. This
|
|
7
|
+
* check compares the app's pin against the URL baked into the CLI install —
|
|
8
|
+
* an offline comparison that catches the common case (CLI upgraded, app pin
|
|
9
|
+
* never bumped) without a network call.
|
|
10
|
+
*
|
|
11
|
+
* It also fails a project that declares both SDK keys (two SDK copies would
|
|
12
|
+
* bundle SDK modules twice), and one whose `joiner-sdk` key points at a
|
|
13
|
+
* tarball that predates the `joiner-sdk` name.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { cliName } from "../cli-name.js";
|
|
17
|
+
import {
|
|
18
|
+
findSdkDependency,
|
|
19
|
+
LEGACY_SDK_PACKAGE_NAME,
|
|
20
|
+
SDK_PACKAGE_NAME,
|
|
21
|
+
} from "../sdk-dependency.js";
|
|
22
|
+
import type { DoctorCheck } from "./doctor.js";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The published export that marks an SDK tarball which understands the
|
|
26
|
+
* `joiner-sdk` name. Its absence under a `joiner-sdk` key means the pin
|
|
27
|
+
* predates that support.
|
|
28
|
+
*/
|
|
29
|
+
export const SDK_NAME_SUPPORT_EXPORT = "./sdk-package-names";
|
|
30
|
+
|
|
31
|
+
export function checkSdkPin(options: {
|
|
32
|
+
/**
|
|
33
|
+
* Merged `dependencies` + `devDependencies` from package.json (runtime
|
|
34
|
+
* pins win), or null when package.json is unreadable.
|
|
35
|
+
*/
|
|
36
|
+
dependencies: Record<string, unknown> | null;
|
|
37
|
+
/** The current published SDK tarball URL, or null when unknown. */
|
|
38
|
+
currentSdkUrl: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Reads `node_modules/<key>/package.json`, or returns null when the SDK is
|
|
41
|
+
* not installed or its manifest is unreadable.
|
|
42
|
+
*/
|
|
43
|
+
readInstalledSdkManifest?: (key: string) => unknown;
|
|
44
|
+
}): DoctorCheck {
|
|
45
|
+
const cli = cliName();
|
|
46
|
+
if (options.dependencies === null) {
|
|
47
|
+
return {
|
|
48
|
+
name: "SDK version",
|
|
49
|
+
status: "fail",
|
|
50
|
+
message: "The SDK pin cannot be checked until package.json is fixed.",
|
|
51
|
+
fix: "Fix the project folder problem above first.",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const sdk = findSdkDependency({ dependencies: options.dependencies });
|
|
55
|
+
if (sdk !== null && "error" in sdk) {
|
|
56
|
+
return {
|
|
57
|
+
name: "SDK version",
|
|
58
|
+
status: "fail",
|
|
59
|
+
message: `package.json declares both ${SDK_PACKAGE_NAME} and ${LEGACY_SDK_PACKAGE_NAME}. Two SDK copies would bundle SDK modules twice.`,
|
|
60
|
+
fix: `Keep one of the two keys in package.json, remove the other, then run \`bun install\`.`,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (sdk === null || sdk.spec === "") {
|
|
64
|
+
return {
|
|
65
|
+
name: "SDK version",
|
|
66
|
+
status: "fail",
|
|
67
|
+
message: `package.json has no ${SDK_PACKAGE_NAME} dependency.`,
|
|
68
|
+
fix: `Add the line that \`${cli} sdk-url --snippet\` prints to dependencies, then run \`bun install\`.`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const { key, spec: pin } = sdk;
|
|
72
|
+
// Monorepo-resident tiles depend on the SDK source directly; nothing to
|
|
73
|
+
// compare against a published tarball.
|
|
74
|
+
if (pin.startsWith("workspace:")) {
|
|
75
|
+
return {
|
|
76
|
+
name: "SDK version",
|
|
77
|
+
status: "pass",
|
|
78
|
+
message: `${key} is a workspace dependency.`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (
|
|
82
|
+
key === SDK_PACKAGE_NAME &&
|
|
83
|
+
installedSdkLacksNameSupport(options.readInstalledSdkManifest?.(key))
|
|
84
|
+
) {
|
|
85
|
+
return {
|
|
86
|
+
name: "SDK version",
|
|
87
|
+
status: "fail",
|
|
88
|
+
message: `The ${SDK_PACKAGE_NAME} pin predates ${SDK_PACKAGE_NAME} support.`,
|
|
89
|
+
fix: `Run \`${cli} sdk-url\`, replace the ${SDK_PACKAGE_NAME} value in package.json with the printed URL, then run \`bun install\`.`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return comparePinWithCurrent({
|
|
93
|
+
key,
|
|
94
|
+
pin,
|
|
95
|
+
currentSdkUrl: options.currentSdkUrl,
|
|
96
|
+
cli,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Compares a published-tarball pin with the URL this CLI shipped with. */
|
|
101
|
+
function comparePinWithCurrent(options: {
|
|
102
|
+
key: string;
|
|
103
|
+
pin: string;
|
|
104
|
+
currentSdkUrl: string | null;
|
|
105
|
+
cli: string;
|
|
106
|
+
}): DoctorCheck {
|
|
107
|
+
const { key, pin, cli } = options;
|
|
108
|
+
if (options.currentSdkUrl === null) {
|
|
109
|
+
return {
|
|
110
|
+
name: "SDK version",
|
|
111
|
+
status: "warn",
|
|
112
|
+
message:
|
|
113
|
+
"Could not determine the current SDK tarball URL from this CLI install, so the pin was not compared.",
|
|
114
|
+
fix: `Run \`${cli} upgrade\` to refresh the CLI, then re-run \`${cli} doctor\`.`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (pin === options.currentSdkUrl) {
|
|
118
|
+
return {
|
|
119
|
+
name: "SDK version",
|
|
120
|
+
status: "pass",
|
|
121
|
+
message: `${key} is pinned to the current published tarball.`,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// A non-URL pin (e.g. a semver range) isn't comparable to the published
|
|
125
|
+
// tarball, so don't claim it is "older" — just say it can't be checked.
|
|
126
|
+
if (!pin.startsWith("https://")) {
|
|
127
|
+
return {
|
|
128
|
+
name: "SDK version",
|
|
129
|
+
status: "warn",
|
|
130
|
+
message: `${key} is pinned to "${pin}", not a published tarball URL, so the doctor cannot tell whether it is current.`,
|
|
131
|
+
fix: `Run \`${cli} sdk-url\`, replace the ${key} value in package.json with the printed URL, then run \`bun install\`.`,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// Content-hashed URLs carry no ordering, and the comparison URL is only as
|
|
135
|
+
// fresh as this CLI install — so an unequal pin is not provably "older"
|
|
136
|
+
// (the creator may have just pinned a NEWER SDK than the CLI shipped with).
|
|
137
|
+
// Say "differs" and point at both remedies.
|
|
138
|
+
return {
|
|
139
|
+
name: "SDK version",
|
|
140
|
+
status: "warn",
|
|
141
|
+
message: `${key} is pinned to a different tarball than the SDK this CLI shipped with — the app's pin may be outdated, or this CLI may be older than the pin.`,
|
|
142
|
+
fix: `Run \`${cli} upgrade\`, then \`${cli} sdk-url\`; if the printed URL differs from the pin, replace the ${key} value in package.json and run \`bun install\`.`,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** An installed manifest whose `exports` lacks the name-support marker. */
|
|
147
|
+
function installedSdkLacksNameSupport(manifest: unknown): boolean {
|
|
148
|
+
// Not installed (or unreadable): the dependency check reports installs.
|
|
149
|
+
if (!manifest || typeof manifest !== "object") return false;
|
|
150
|
+
const exports = (manifest as { exports?: unknown }).exports;
|
|
151
|
+
return !(
|
|
152
|
+
exports &&
|
|
153
|
+
typeof exports === "object" &&
|
|
154
|
+
SDK_NAME_SUPPORT_EXPORT in exports
|
|
155
|
+
);
|
|
156
|
+
}
|