@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,133 @@
|
|
|
1
|
+
// owner: klu
|
|
2
|
+
import { writeFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import type { SlopPoeClient } from "../client.js";
|
|
6
|
+
import { CliError } from "../errors.js";
|
|
7
|
+
import { isJsonMode, printJson, printKeyValue, printTable } from "../output.js";
|
|
8
|
+
import { SIMULATION_DEBUG_MAX_BYTES } from "../simulation-snapshot.js";
|
|
9
|
+
import type { SimulationDebugDocument } from "../simulation-types.js";
|
|
10
|
+
import { parsePositiveIntegerOption } from "./parse-options.js";
|
|
11
|
+
|
|
12
|
+
const TYPE_ID_HELP =
|
|
13
|
+
"Tile type ID, optionally scoped as <id>~v-<version> or <id>~c-<channel>";
|
|
14
|
+
|
|
15
|
+
export function createSimulationsCommands(client: SlopPoeClient): Command {
|
|
16
|
+
const simulations = new Command("simulations").description(
|
|
17
|
+
"Create, list, and debug your tile simulations",
|
|
18
|
+
);
|
|
19
|
+
simulations
|
|
20
|
+
.command("create")
|
|
21
|
+
.description(
|
|
22
|
+
"Start a fresh simulation of a tile you own, seeded with test players",
|
|
23
|
+
)
|
|
24
|
+
.argument("<typeId>", TYPE_ID_HELP)
|
|
25
|
+
.action(async function (this: Command, typeId: string) {
|
|
26
|
+
const result = await client.simulations.create(typeId);
|
|
27
|
+
if (isJsonMode(this)) printJson(result);
|
|
28
|
+
else
|
|
29
|
+
printKeyValue([
|
|
30
|
+
["typeId", result.typeId],
|
|
31
|
+
["instanceId", result.instanceId],
|
|
32
|
+
["containerId", result.container.instanceId],
|
|
33
|
+
["players", result.devUsers.map((user) => user.slug).join(", ")],
|
|
34
|
+
]);
|
|
35
|
+
});
|
|
36
|
+
simulations
|
|
37
|
+
.command("list")
|
|
38
|
+
.description("List your existing simulations for an exact tile type ID")
|
|
39
|
+
.argument("<typeId>", TYPE_ID_HELP)
|
|
40
|
+
.action(async function (this: Command, typeId: string) {
|
|
41
|
+
const result = await client.simulations.list(typeId);
|
|
42
|
+
if (isJsonMode(this)) printJson(result);
|
|
43
|
+
else
|
|
44
|
+
printTable({
|
|
45
|
+
headers: ["Instance ID", "Container ID", "Players", "Created"],
|
|
46
|
+
rows: result.sandboxes.map((item) => [
|
|
47
|
+
item.instanceId,
|
|
48
|
+
item.containerId,
|
|
49
|
+
item.puppetSlugs.join(", "),
|
|
50
|
+
item.createdAt,
|
|
51
|
+
]),
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
simulations
|
|
55
|
+
.command("debug")
|
|
56
|
+
.description(
|
|
57
|
+
"Capture simulation state as JSON, including your test players' private state",
|
|
58
|
+
)
|
|
59
|
+
.argument("<typeId>", TYPE_ID_HELP)
|
|
60
|
+
.argument(
|
|
61
|
+
"<instanceId>",
|
|
62
|
+
"Tile instance ID returned by simulations create or list",
|
|
63
|
+
)
|
|
64
|
+
.option(
|
|
65
|
+
"--out <path>",
|
|
66
|
+
"Write the JSON document to a new file instead of stdout",
|
|
67
|
+
)
|
|
68
|
+
.option(
|
|
69
|
+
"--max-bytes <bytes>",
|
|
70
|
+
"Snapshot budget in UTF-8 bytes (262144–4194304)",
|
|
71
|
+
String(SIMULATION_DEBUG_MAX_BYTES),
|
|
72
|
+
)
|
|
73
|
+
.option(
|
|
74
|
+
"--timeout-ms <ms>",
|
|
75
|
+
"WebSocket open and response timeout in milliseconds",
|
|
76
|
+
"30000",
|
|
77
|
+
)
|
|
78
|
+
.action(async function (
|
|
79
|
+
this: Command,
|
|
80
|
+
typeId: string,
|
|
81
|
+
instanceId: string,
|
|
82
|
+
opts: { out?: string; maxBytes: string; timeoutMs: string },
|
|
83
|
+
) {
|
|
84
|
+
const document = await client.simulations.debug({
|
|
85
|
+
typeId,
|
|
86
|
+
instanceId,
|
|
87
|
+
maxBytes: parsePositiveIntegerOption(opts.maxBytes, "--max-bytes"),
|
|
88
|
+
timeoutMs: parsePositiveIntegerOption(opts.timeoutMs, "--timeout-ms"),
|
|
89
|
+
});
|
|
90
|
+
printDebugDocument({ document, out: opts.out, json: isJsonMode(this) });
|
|
91
|
+
});
|
|
92
|
+
return simulations;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function printDebugDocument(options: {
|
|
96
|
+
document: SimulationDebugDocument;
|
|
97
|
+
out: string | undefined;
|
|
98
|
+
json: boolean;
|
|
99
|
+
}): void {
|
|
100
|
+
const { document, out, json } = options;
|
|
101
|
+
if (!document.complete || !document.store.consistent) {
|
|
102
|
+
console.error(
|
|
103
|
+
`Snapshot complete=${document.complete}, consistent=${document.store.consistent}. Inspect these flags before relying on the captured state.`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
if (out === undefined) {
|
|
107
|
+
printJson(document);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const path = resolve(out);
|
|
111
|
+
try {
|
|
112
|
+
writeFileSync(path, `${JSON.stringify(document)}\n`, {
|
|
113
|
+
mode: 0o600,
|
|
114
|
+
flag: "wx",
|
|
115
|
+
});
|
|
116
|
+
} catch (error) {
|
|
117
|
+
throw new CliError(
|
|
118
|
+
`Could not write debug snapshot to ${path}: ${error instanceof Error ? error.message : String(error)}`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
const receipt = {
|
|
122
|
+
path,
|
|
123
|
+
complete: document.complete,
|
|
124
|
+
consistent: document.store.consistent,
|
|
125
|
+
};
|
|
126
|
+
if (json) printJson(receipt);
|
|
127
|
+
else
|
|
128
|
+
printKeyValue([
|
|
129
|
+
["file", path],
|
|
130
|
+
["complete", String(receipt.complete)],
|
|
131
|
+
["consistent", String(receipt.consistent)],
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
/**
|
|
3
|
+
* `poe-tiles skills install` command.
|
|
4
|
+
*
|
|
5
|
+
* Writes the SDK skills (tile-creator, synced-store, prototype) bundled with the
|
|
6
|
+
* currently-installed CLI into a target directory, **merging** with any
|
|
7
|
+
* existing skill directories at the same paths. Files at matching paths
|
|
8
|
+
* are overwritten; files the user added under `<dir>/<skill-name>/` that
|
|
9
|
+
* are not part of the bundle are preserved (e.g. project-specific
|
|
10
|
+
* reference docs, custom subskills the developer dropped alongside the
|
|
11
|
+
* platform-provided ones).
|
|
12
|
+
*
|
|
13
|
+
* The CLI bundles these skills at the package's `skills/`
|
|
14
|
+
* (tarball install) or resolves them from `packages/poe-tiles-sdk/skills/`
|
|
15
|
+
* (monorepo). Source-of-truth is the `poe-templated-docs` external
|
|
16
|
+
* render — re-running install after a CLI upgrade pulls in the latest
|
|
17
|
+
* version of the bundle's files.
|
|
18
|
+
*
|
|
19
|
+
* Trade-off: a reference doc that was renamed or removed in a newer CLI
|
|
20
|
+
* release will linger in the target dir alongside the new version until
|
|
21
|
+
* the user deletes it. Merge semantics protect user additions; if you
|
|
22
|
+
* want a clean wipe, delete `<dir>/<skill-name>/` manually before
|
|
23
|
+
* running install.
|
|
24
|
+
*
|
|
25
|
+
* Local-only: does not call the API, so the preAction auth hook in
|
|
26
|
+
* `cli.ts` skips client setup for this command.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { homedir } from "node:os";
|
|
30
|
+
import { resolve } from "node:path";
|
|
31
|
+
import { Command } from "commander";
|
|
32
|
+
import { CliError } from "../errors.js";
|
|
33
|
+
import {
|
|
34
|
+
DEFAULT_SKILLS_DIR,
|
|
35
|
+
installSdkSkills,
|
|
36
|
+
installWorkspaceSkills,
|
|
37
|
+
} from "../sdk-skills.js";
|
|
38
|
+
|
|
39
|
+
/** The user-level skill directories of Claude Code and of Codex-style agents. */
|
|
40
|
+
const GLOBAL_SKILLS_DIRS = [DEFAULT_SKILLS_DIR, ".agents/skills"] as const;
|
|
41
|
+
|
|
42
|
+
export function createSkillsCommands({
|
|
43
|
+
homeDir = homedir(),
|
|
44
|
+
}: {
|
|
45
|
+
homeDir?: string;
|
|
46
|
+
} = {}): Command {
|
|
47
|
+
const skills = new Command("skills").description("Manage SDK skills");
|
|
48
|
+
|
|
49
|
+
skills
|
|
50
|
+
.command("install")
|
|
51
|
+
.description(
|
|
52
|
+
"Install (or refresh) the SDK skills bundled with this CLI into a directory. Merges with existing skill directories — files at matching paths are overwritten; user-added files outside the bundle are preserved.",
|
|
53
|
+
)
|
|
54
|
+
.option(
|
|
55
|
+
"--dir <path>",
|
|
56
|
+
"Custom target directory. By default, refreshes both .claude/skills and .agents/skills in the current project.",
|
|
57
|
+
)
|
|
58
|
+
.option(
|
|
59
|
+
"--global",
|
|
60
|
+
"Install into your user-level ~/.claude/skills and ~/.agents/skills, so coding agents can use the skills in any folder.",
|
|
61
|
+
)
|
|
62
|
+
.action(async function (
|
|
63
|
+
this: Command,
|
|
64
|
+
opts: { dir?: string; global?: boolean },
|
|
65
|
+
) {
|
|
66
|
+
if (opts.dir && opts.global)
|
|
67
|
+
throw new CliError("Pass either --dir or --global, not both.");
|
|
68
|
+
if (opts.global) {
|
|
69
|
+
installGlobalSkills(homeDir);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const targetDir = opts.dir
|
|
73
|
+
? resolve(process.cwd(), opts.dir)
|
|
74
|
+
: process.cwd();
|
|
75
|
+
const skillNames = opts.dir
|
|
76
|
+
? installSdkSkills(targetDir)
|
|
77
|
+
: installWorkspaceSkills(targetDir);
|
|
78
|
+
|
|
79
|
+
reportInstalledSkills(skillNames, targetDir, Boolean(opts.dir));
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return skills;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function installGlobalSkills(homeDir: string): void {
|
|
86
|
+
const targets = GLOBAL_SKILLS_DIRS.map((dir) => resolve(homeDir, dir));
|
|
87
|
+
let skillNames: string[] = [];
|
|
88
|
+
for (const target of targets) skillNames = installSdkSkills(target);
|
|
89
|
+
reportInstalledSkills(skillNames, targets.join(" and "), true);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function reportInstalledSkills(
|
|
93
|
+
skillNames: string[],
|
|
94
|
+
targetDir: string,
|
|
95
|
+
customDirectory: boolean,
|
|
96
|
+
): void {
|
|
97
|
+
const destination = customDirectory
|
|
98
|
+
? targetDir
|
|
99
|
+
: `${resolve(targetDir, ".claude/skills")} and ${resolve(targetDir, ".agents/skills")}`;
|
|
100
|
+
process.stdout.write(
|
|
101
|
+
`Installed ${skillNames.length} skill${skillNames.length === 1 ? "" : "s"} into ${destination}:\n`,
|
|
102
|
+
);
|
|
103
|
+
if (!customDirectory)
|
|
104
|
+
process.stdout.write(
|
|
105
|
+
`Project instructions: ${resolve(targetDir, "AGENTS.md")}\n`,
|
|
106
|
+
);
|
|
107
|
+
for (const name of skillNames) process.stdout.write(` ${name}\n`);
|
|
108
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
|
|
3
|
+
import { readFileSync, statSync } from "node:fs";
|
|
4
|
+
import { basename, resolve } from "node:path";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { cliName } from "../cli-name.js";
|
|
7
|
+
import type { SlopPoeClient } from "../client.js";
|
|
8
|
+
import { CliError } from "../errors.js";
|
|
9
|
+
import { isJsonMode, printJson, printKeyValue } from "../output.js";
|
|
10
|
+
import {
|
|
11
|
+
assertStoreFileUploadSize,
|
|
12
|
+
type StoreFileUploadResult,
|
|
13
|
+
} from "../store-file-upload.js";
|
|
14
|
+
|
|
15
|
+
interface UploadCommandOptions {
|
|
16
|
+
name?: string;
|
|
17
|
+
contentType?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function errorMessage(error: unknown): string {
|
|
21
|
+
return error instanceof Error ? error.message : String(error);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function readUploadFile(path: string): Uint8Array {
|
|
25
|
+
const absolutePath = resolve(path);
|
|
26
|
+
try {
|
|
27
|
+
const stats = statSync(absolutePath);
|
|
28
|
+
if (!stats.isFile()) throw new Error("path is not a regular file");
|
|
29
|
+
assertStoreFileUploadSize(stats.size);
|
|
30
|
+
return new Uint8Array(readFileSync(absolutePath));
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error instanceof CliError) throw error;
|
|
33
|
+
throw new CliError(
|
|
34
|
+
`Could not read upload file ${absolutePath}: ${errorMessage(error)}`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function printUploadResult(result: StoreFileUploadResult): void {
|
|
40
|
+
console.log("File uploaded.");
|
|
41
|
+
printKeyValue([
|
|
42
|
+
["File ID", result.fileId],
|
|
43
|
+
["File Key", result.fileKey],
|
|
44
|
+
["URL", result.url],
|
|
45
|
+
["Size", result.sizeBytes],
|
|
46
|
+
["Content Type", result.contentType],
|
|
47
|
+
["Width", result.width ?? undefined],
|
|
48
|
+
["Height", result.height ?? undefined],
|
|
49
|
+
]);
|
|
50
|
+
console.log("");
|
|
51
|
+
console.log(
|
|
52
|
+
`Claim the File ID in a fileRefs-declared field with \`${cliName()} store mutate\`; unclaimed uploads expire.`,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function createStoreFilesCommands(client: SlopPoeClient): Command {
|
|
57
|
+
const files = new Command("files").description("Managed store files");
|
|
58
|
+
|
|
59
|
+
files
|
|
60
|
+
.command("upload")
|
|
61
|
+
.description("Upload a file to a store instance")
|
|
62
|
+
.argument("<typeId>", "Store type ID")
|
|
63
|
+
.argument("<instanceId>", "Store instance ID")
|
|
64
|
+
.argument("<file>", "Local file path")
|
|
65
|
+
.option("--name <name>", "Original display name (defaults to the basename)")
|
|
66
|
+
.option(
|
|
67
|
+
"--content-type <type>",
|
|
68
|
+
"Content-type hint; the platform inspects the bytes authoritatively",
|
|
69
|
+
)
|
|
70
|
+
.action(async function (
|
|
71
|
+
this: Command,
|
|
72
|
+
typeId: string,
|
|
73
|
+
instanceId: string,
|
|
74
|
+
file: string,
|
|
75
|
+
opts: UploadCommandOptions,
|
|
76
|
+
) {
|
|
77
|
+
const result = await client.uploadStoreFile({
|
|
78
|
+
storeTypeId: typeId,
|
|
79
|
+
instanceId,
|
|
80
|
+
data: readUploadFile(file),
|
|
81
|
+
name: opts.name ?? basename(file),
|
|
82
|
+
...(opts.contentType === undefined
|
|
83
|
+
? {}
|
|
84
|
+
: { contentType: opts.contentType }),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (isJsonMode(this)) printJson(result);
|
|
88
|
+
else printUploadResult(result);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return files;
|
|
92
|
+
}
|