@puzzmo/cli 1.0.80 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +11 -0
  2. package/lib/commands/game/create.d.ts +11 -1
  3. package/lib/commands/game/create.js +62 -2
  4. package/lib/commands/game/create.js.map +1 -1
  5. package/lib/commands/puzzles.d.ts +8 -0
  6. package/lib/commands/puzzles.js +107 -0
  7. package/lib/commands/puzzles.js.map +1 -0
  8. package/lib/index.js +18 -1
  9. package/lib/index.js.map +1 -1
  10. package/lib/queries/__generated__/cliAddPuzzlesToPoolMutation.graphql.d.ts +30 -0
  11. package/lib/queries/__generated__/cliAddPuzzlesToPoolMutation.graphql.js +123 -0
  12. package/lib/queries/__generated__/cliAddPuzzlesToPoolMutation.graphql.js.map +1 -0
  13. package/lib/queries/__generated__/cliGamesForAccessTokenQuery.graphql.d.ts +19 -0
  14. package/lib/queries/__generated__/cliGamesForAccessTokenQuery.graphql.js +67 -0
  15. package/lib/queries/__generated__/cliGamesForAccessTokenQuery.graphql.js.map +1 -0
  16. package/lib/queries/__generated__/cliValidatePoolPuzzlesQuery.graphql.d.ts +27 -0
  17. package/lib/queries/__generated__/cliValidatePoolPuzzlesQuery.graphql.js +105 -0
  18. package/lib/queries/__generated__/cliValidatePoolPuzzlesQuery.graphql.js.map +1 -0
  19. package/lib/queries/puzzlePool.d.ts +21 -0
  20. package/lib/queries/puzzlePool.js +59 -0
  21. package/lib/queries/puzzlePool.js.map +1 -0
  22. package/package.json +1 -1
  23. package/src/commands/game/adoptPico8Cart.test.ts +33 -0
  24. package/src/commands/game/create.ts +67 -3
  25. package/src/commands/puzzles.ts +121 -0
  26. package/src/index.ts +20 -1
  27. package/src/queries/__generated__/cliAddPuzzlesToPoolMutation.graphql.ts +157 -0
  28. package/src/queries/__generated__/cliGamesForAccessTokenQuery.graphql.ts +88 -0
  29. package/src/queries/__generated__/cliValidatePoolPuzzlesQuery.graphql.ts +136 -0
  30. package/src/queries/puzzlePool.ts +65 -0
  31. package/templates/pico8/README.md +49 -0
  32. package/templates/pico8/cart/game.p8 +183 -0
  33. package/templates/pico8/cart/puzzmo.lua +133 -0
  34. package/templates/pico8/fixtures/puzzles/easy/five.txt +1 -0
  35. package/templates/pico8/fixtures/puzzles/easy/twelve.txt +1 -0
  36. package/templates/pico8/fixtures/puzzles/hard/ninety-nine.txt +1 -0
  37. package/templates/pico8/index.html +7 -0
  38. package/templates/pico8/package.json +20 -0
  39. package/templates/pico8/puzzmo.json +11 -0
  40. package/templates/pico8/src/main.ts +6 -0
  41. package/templates/pico8/tsconfig.json +13 -0
  42. package/templates/pico8/vite.config.ts +11 -0
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ import { type ChangedAgainst, changed } from "./commands/changed.js"
7
7
  import { gameCreate } from "./commands/game/create.js"
8
8
  import { login } from "./commands/login.js"
9
9
  import { migrate } from "./commands/migrate.js"
10
+ import { puzzlesUpload } from "./commands/puzzles.js"
10
11
  import { upload } from "./commands/upload.js"
11
12
  import { validate } from "./commands/validate.js"
12
13
  import { defaultSource } from "./util/config.js"
@@ -79,6 +80,21 @@ const gamesCommand = defineCommand({
79
80
  subCommands: { changed: changedCommand, upload: uploadCommand, validate: validateCommand },
80
81
  })
81
82
 
83
+ const puzzlesUploadCommand = defineCommand({
84
+ meta: { name: "upload", description: "Add puzzle files to the end of a game's puzzle pool" },
85
+ args: {
86
+ path: { type: "positional", description: "A puzzle file, or a directory of them", required: true },
87
+ game: { type: "string", description: "The game slug to upload puzzles for", required: true },
88
+ "dry-run": { type: "boolean", description: "Validate the files without uploading them" },
89
+ },
90
+ run: ({ args }) => puzzlesUpload(args.path, { game: args.game, dryRun: args["dry-run"] }),
91
+ })
92
+
93
+ const puzzlesCommand = defineCommand({
94
+ meta: { name: "puzzles", description: "Manage the puzzles scheduled for your games" },
95
+ subCommands: { upload: puzzlesUploadCommand },
96
+ })
97
+
82
98
  const migrateCommand = defineCommand({
83
99
  meta: { name: "migrate", description: "List and select migration skills from workshop.puzzmo.com" },
84
100
  run: () => migrate(),
@@ -87,7 +103,8 @@ const migrateCommand = defineCommand({
87
103
  const gameCreateCommand = defineCommand({
88
104
  meta: { name: "create", description: "Scaffold a new Puzzmo game project" },
89
105
  args: {
90
- strategy: { type: "enum", options: ["import", "blank", "prompt"], description: "How to seed the new game" },
106
+ strategy: { type: "enum", options: ["import", "blank", "prompt", "pico8"], description: "How to seed the new game" },
107
+ cart: { type: "string", description: "An existing .p8 cart to start from (used with --strategy pico8)" },
91
108
  prompt: { type: "string", description: "Game description (used with --strategy prompt)" },
92
109
  name: { type: "string", description: "Game display name" },
93
110
  slug: { type: "string", description: "Game slug (defaults to a slugified --name)" },
@@ -108,6 +125,7 @@ const gameCreateCommand = defineCommand({
108
125
  agent: args.agent,
109
126
  accessToken: args.token,
110
127
  pm: args.pm,
128
+ cart: args.cart,
111
129
  }),
112
130
  })
113
131
 
@@ -143,6 +161,7 @@ const main = defineCommand({
143
161
  subCommands: {
144
162
  login: loginCommand,
145
163
  games: gamesCommand,
164
+ puzzles: puzzlesCommand,
146
165
  migrate: migrateCommand,
147
166
  game: gameCommand,
148
167
  upload: uploadAlias,
@@ -0,0 +1,157 @@
1
+ /**
2
+ * @generated SignedSource<<892c3aa4f6c7673e590b4a9bcc8514c2>>
3
+ * @lightSyntaxTransform
4
+ */
5
+
6
+ /* tslint:disable */
7
+ /* eslint-disable */
8
+ // @ts-nocheck
9
+
10
+ import { ConcreteRequest } from 'relay-runtime';
11
+ export type McpPuzzleFileInput = {
12
+ content: string;
13
+ filename: string;
14
+ };
15
+ export type cliAddPuzzlesToPoolMutation$variables = {
16
+ gameSlug: string;
17
+ puzzles: ReadonlyArray<McpPuzzleFileInput>;
18
+ token: string;
19
+ };
20
+ export type cliAddPuzzlesToPoolMutation$data = {
21
+ readonly addPuzzlesToPool: {
22
+ readonly failed: ReadonlyArray<{
23
+ readonly filename: string;
24
+ readonly message: string;
25
+ }>;
26
+ readonly poolCount: number;
27
+ readonly uploadedFilenames: ReadonlyArray<string>;
28
+ } | null | undefined;
29
+ };
30
+ export type cliAddPuzzlesToPoolMutation = {
31
+ response: cliAddPuzzlesToPoolMutation$data;
32
+ variables: cliAddPuzzlesToPoolMutation$variables;
33
+ };
34
+
35
+ const node: ConcreteRequest = (function(){
36
+ var v0 = {
37
+ "defaultValue": null,
38
+ "kind": "LocalArgument",
39
+ "name": "gameSlug"
40
+ },
41
+ v1 = {
42
+ "defaultValue": null,
43
+ "kind": "LocalArgument",
44
+ "name": "puzzles"
45
+ },
46
+ v2 = {
47
+ "defaultValue": null,
48
+ "kind": "LocalArgument",
49
+ "name": "token"
50
+ },
51
+ v3 = [
52
+ {
53
+ "alias": null,
54
+ "args": [
55
+ {
56
+ "kind": "Variable",
57
+ "name": "gameSlug",
58
+ "variableName": "gameSlug"
59
+ },
60
+ {
61
+ "kind": "Variable",
62
+ "name": "puzzles",
63
+ "variableName": "puzzles"
64
+ },
65
+ {
66
+ "kind": "Variable",
67
+ "name": "token",
68
+ "variableName": "token"
69
+ }
70
+ ],
71
+ "concreteType": "McpPoolUploadResult",
72
+ "kind": "LinkedField",
73
+ "name": "addPuzzlesToPool",
74
+ "plural": false,
75
+ "selections": [
76
+ {
77
+ "alias": null,
78
+ "args": null,
79
+ "kind": "ScalarField",
80
+ "name": "uploadedFilenames",
81
+ "storageKey": null
82
+ },
83
+ {
84
+ "alias": null,
85
+ "args": null,
86
+ "concreteType": "McpPoolUploadFailure",
87
+ "kind": "LinkedField",
88
+ "name": "failed",
89
+ "plural": true,
90
+ "selections": [
91
+ {
92
+ "alias": null,
93
+ "args": null,
94
+ "kind": "ScalarField",
95
+ "name": "filename",
96
+ "storageKey": null
97
+ },
98
+ {
99
+ "alias": null,
100
+ "args": null,
101
+ "kind": "ScalarField",
102
+ "name": "message",
103
+ "storageKey": null
104
+ }
105
+ ],
106
+ "storageKey": null
107
+ },
108
+ {
109
+ "alias": null,
110
+ "args": null,
111
+ "kind": "ScalarField",
112
+ "name": "poolCount",
113
+ "storageKey": null
114
+ }
115
+ ],
116
+ "storageKey": null
117
+ }
118
+ ];
119
+ return {
120
+ "fragment": {
121
+ "argumentDefinitions": [
122
+ (v0/*:: as any*/),
123
+ (v1/*:: as any*/),
124
+ (v2/*:: as any*/)
125
+ ],
126
+ "kind": "Fragment",
127
+ "metadata": null,
128
+ "name": "cliAddPuzzlesToPoolMutation",
129
+ "selections": (v3/*:: as any*/),
130
+ "type": "Mutation",
131
+ "abstractKey": null
132
+ },
133
+ "kind": "Request",
134
+ "operation": {
135
+ "argumentDefinitions": [
136
+ (v2/*:: as any*/),
137
+ (v0/*:: as any*/),
138
+ (v1/*:: as any*/)
139
+ ],
140
+ "kind": "Operation",
141
+ "name": "cliAddPuzzlesToPoolMutation",
142
+ "selections": (v3/*:: as any*/)
143
+ },
144
+ "params": {
145
+ "cacheID": "a779ada059e34a22a12c7175df0e50fc",
146
+ "id": null,
147
+ "metadata": {},
148
+ "name": "cliAddPuzzlesToPoolMutation",
149
+ "operationKind": "mutation",
150
+ "text": "mutation cliAddPuzzlesToPoolMutation(\n $token: String!\n $gameSlug: String!\n $puzzles: [McpPuzzleFileInput!]!\n) {\n addPuzzlesToPool(token: $token, gameSlug: $gameSlug, puzzles: $puzzles) {\n uploadedFilenames\n failed {\n filename\n message\n }\n poolCount\n }\n}\n"
151
+ }
152
+ };
153
+ })();
154
+
155
+ (node as any).hash = "f79544fe70b713f8304a444df02b2016";
156
+
157
+ export default node;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @generated SignedSource<<76fc8a9b6e4d8ebe2c47a8b32617c0be>>
3
+ * @lightSyntaxTransform
4
+ */
5
+
6
+ /* tslint:disable */
7
+ /* eslint-disable */
8
+ // @ts-nocheck
9
+
10
+ import { ConcreteRequest } from 'relay-runtime';
11
+ export type cliGamesForAccessTokenQuery$variables = {
12
+ token: string;
13
+ };
14
+ export type cliGamesForAccessTokenQuery$data = {
15
+ readonly gamesForAccessToken: ReadonlyArray<{
16
+ readonly slug: string;
17
+ }> | null | undefined;
18
+ };
19
+ export type cliGamesForAccessTokenQuery = {
20
+ response: cliGamesForAccessTokenQuery$data;
21
+ variables: cliGamesForAccessTokenQuery$variables;
22
+ };
23
+
24
+ const node: ConcreteRequest = (function(){
25
+ var v0 = [
26
+ {
27
+ "defaultValue": null,
28
+ "kind": "LocalArgument",
29
+ "name": "token"
30
+ }
31
+ ],
32
+ v1 = [
33
+ {
34
+ "alias": null,
35
+ "args": [
36
+ {
37
+ "kind": "Variable",
38
+ "name": "token",
39
+ "variableName": "token"
40
+ }
41
+ ],
42
+ "concreteType": "AccessibleGame",
43
+ "kind": "LinkedField",
44
+ "name": "gamesForAccessToken",
45
+ "plural": true,
46
+ "selections": [
47
+ {
48
+ "alias": null,
49
+ "args": null,
50
+ "kind": "ScalarField",
51
+ "name": "slug",
52
+ "storageKey": null
53
+ }
54
+ ],
55
+ "storageKey": null
56
+ }
57
+ ];
58
+ return {
59
+ "fragment": {
60
+ "argumentDefinitions": (v0/*:: as any*/),
61
+ "kind": "Fragment",
62
+ "metadata": null,
63
+ "name": "cliGamesForAccessTokenQuery",
64
+ "selections": (v1/*:: as any*/),
65
+ "type": "Query",
66
+ "abstractKey": null
67
+ },
68
+ "kind": "Request",
69
+ "operation": {
70
+ "argumentDefinitions": (v0/*:: as any*/),
71
+ "kind": "Operation",
72
+ "name": "cliGamesForAccessTokenQuery",
73
+ "selections": (v1/*:: as any*/)
74
+ },
75
+ "params": {
76
+ "cacheID": "95e52459ee4e3b5b63aebf0a956d84b9",
77
+ "id": null,
78
+ "metadata": {},
79
+ "name": "cliGamesForAccessTokenQuery",
80
+ "operationKind": "query",
81
+ "text": "query cliGamesForAccessTokenQuery(\n $token: String!\n) {\n gamesForAccessToken(token: $token) {\n slug\n }\n}\n"
82
+ }
83
+ };
84
+ })();
85
+
86
+ (node as any).hash = "5e25f82f0177e712ee4d7e9e95245d28";
87
+
88
+ export default node;
@@ -0,0 +1,136 @@
1
+ /**
2
+ * @generated SignedSource<<8b45a4259087b0ba56f45d09b2de210b>>
3
+ * @lightSyntaxTransform
4
+ */
5
+
6
+ /* tslint:disable */
7
+ /* eslint-disable */
8
+ // @ts-nocheck
9
+
10
+ import { ConcreteRequest } from 'relay-runtime';
11
+ export type McpPuzzleFileInput = {
12
+ content: string;
13
+ filename: string;
14
+ };
15
+ export type cliValidatePoolPuzzlesQuery$variables = {
16
+ gameSlug: string;
17
+ puzzles: ReadonlyArray<McpPuzzleFileInput>;
18
+ token: string;
19
+ };
20
+ export type cliValidatePoolPuzzlesQuery$data = {
21
+ readonly validatePoolPuzzles: ReadonlyArray<{
22
+ readonly errors: ReadonlyArray<string>;
23
+ readonly filename: string;
24
+ readonly valid: boolean;
25
+ }> | null | undefined;
26
+ };
27
+ export type cliValidatePoolPuzzlesQuery = {
28
+ response: cliValidatePoolPuzzlesQuery$data;
29
+ variables: cliValidatePoolPuzzlesQuery$variables;
30
+ };
31
+
32
+ const node: ConcreteRequest = (function(){
33
+ var v0 = {
34
+ "defaultValue": null,
35
+ "kind": "LocalArgument",
36
+ "name": "gameSlug"
37
+ },
38
+ v1 = {
39
+ "defaultValue": null,
40
+ "kind": "LocalArgument",
41
+ "name": "puzzles"
42
+ },
43
+ v2 = {
44
+ "defaultValue": null,
45
+ "kind": "LocalArgument",
46
+ "name": "token"
47
+ },
48
+ v3 = [
49
+ {
50
+ "alias": null,
51
+ "args": [
52
+ {
53
+ "kind": "Variable",
54
+ "name": "gameSlug",
55
+ "variableName": "gameSlug"
56
+ },
57
+ {
58
+ "kind": "Variable",
59
+ "name": "puzzles",
60
+ "variableName": "puzzles"
61
+ },
62
+ {
63
+ "kind": "Variable",
64
+ "name": "token",
65
+ "variableName": "token"
66
+ }
67
+ ],
68
+ "concreteType": "McpPoolPuzzleValidation",
69
+ "kind": "LinkedField",
70
+ "name": "validatePoolPuzzles",
71
+ "plural": true,
72
+ "selections": [
73
+ {
74
+ "alias": null,
75
+ "args": null,
76
+ "kind": "ScalarField",
77
+ "name": "filename",
78
+ "storageKey": null
79
+ },
80
+ {
81
+ "alias": null,
82
+ "args": null,
83
+ "kind": "ScalarField",
84
+ "name": "valid",
85
+ "storageKey": null
86
+ },
87
+ {
88
+ "alias": null,
89
+ "args": null,
90
+ "kind": "ScalarField",
91
+ "name": "errors",
92
+ "storageKey": null
93
+ }
94
+ ],
95
+ "storageKey": null
96
+ }
97
+ ];
98
+ return {
99
+ "fragment": {
100
+ "argumentDefinitions": [
101
+ (v0/*:: as any*/),
102
+ (v1/*:: as any*/),
103
+ (v2/*:: as any*/)
104
+ ],
105
+ "kind": "Fragment",
106
+ "metadata": null,
107
+ "name": "cliValidatePoolPuzzlesQuery",
108
+ "selections": (v3/*:: as any*/),
109
+ "type": "Query",
110
+ "abstractKey": null
111
+ },
112
+ "kind": "Request",
113
+ "operation": {
114
+ "argumentDefinitions": [
115
+ (v2/*:: as any*/),
116
+ (v0/*:: as any*/),
117
+ (v1/*:: as any*/)
118
+ ],
119
+ "kind": "Operation",
120
+ "name": "cliValidatePoolPuzzlesQuery",
121
+ "selections": (v3/*:: as any*/)
122
+ },
123
+ "params": {
124
+ "cacheID": "934ec64898f9b820ebc69f223fd50cc5",
125
+ "id": null,
126
+ "metadata": {},
127
+ "name": "cliValidatePoolPuzzlesQuery",
128
+ "operationKind": "query",
129
+ "text": "query cliValidatePoolPuzzlesQuery(\n $token: String!\n $gameSlug: String!\n $puzzles: [McpPuzzleFileInput!]!\n) {\n validatePoolPuzzles(token: $token, gameSlug: $gameSlug, puzzles: $puzzles) {\n filename\n valid\n errors\n }\n}\n"
130
+ }
131
+ };
132
+ })();
133
+
134
+ (node as any).hash = "08673f877fe016f880516c4a9fdcf03d";
135
+
136
+ export default node;
@@ -0,0 +1,65 @@
1
+ import { graphql, query } from "../util/belay.js"
2
+ import type { cliAddPuzzlesToPoolMutation } from "./__generated__/cliAddPuzzlesToPoolMutation.graphql.js"
3
+ import type { cliGamesForAccessTokenQuery } from "./__generated__/cliGamesForAccessTokenQuery.graphql.js"
4
+ import type { cliValidatePoolPuzzlesQuery } from "./__generated__/cliValidatePoolPuzzlesQuery.graphql.js"
5
+
6
+ const gamesForAccessTokenQuery = graphql`
7
+ query cliGamesForAccessTokenQuery($token: String!) {
8
+ gamesForAccessToken(token: $token) {
9
+ slug
10
+ }
11
+ }
12
+ `
13
+
14
+ const validatePoolPuzzlesQuery = graphql`
15
+ query cliValidatePoolPuzzlesQuery($token: String!, $gameSlug: String!, $puzzles: [McpPuzzleFileInput!]!) {
16
+ validatePoolPuzzles(token: $token, gameSlug: $gameSlug, puzzles: $puzzles) {
17
+ filename
18
+ valid
19
+ errors
20
+ }
21
+ }
22
+ `
23
+
24
+ const addPuzzlesToPoolMutation = graphql`
25
+ mutation cliAddPuzzlesToPoolMutation($token: String!, $gameSlug: String!, $puzzles: [McpPuzzleFileInput!]!) {
26
+ addPuzzlesToPool(token: $token, gameSlug: $gameSlug, puzzles: $puzzles) {
27
+ uploadedFilenames
28
+ failed {
29
+ filename
30
+ message
31
+ }
32
+ poolCount
33
+ }
34
+ }
35
+ `
36
+
37
+ export type PuzzleFile = { filename: string; content: string }
38
+
39
+ /** The slugs of the games a token can manage, or null when the server rejects the token. */
40
+ export const fetchGameSlugsForToken = async (apiURL: string, token: string): Promise<string[] | null> => {
41
+ const { data } = await query<cliGamesForAccessTokenQuery>(gamesForAccessTokenQuery, { variables: { token }, url: `${apiURL}/graphql` })
42
+ return data?.gamesForAccessToken?.map((g) => g.slug) ?? null
43
+ }
44
+
45
+ /** Checks puzzle files against the game's pool rules without uploading them. */
46
+ export const validatePoolPuzzles = async (apiURL: string, token: string, gameSlug: string, puzzles: PuzzleFile[]) => {
47
+ const { data, errors } = await query<cliValidatePoolPuzzlesQuery>(validatePoolPuzzlesQuery, {
48
+ variables: { token, gameSlug, puzzles },
49
+ url: `${apiURL}/graphql`,
50
+ })
51
+ if (errors?.length) throw new Error(errors.map((e) => e.message).join("; "))
52
+ if (!data?.validatePoolPuzzles) throw new Error(`No game named "${gameSlug}" is accessible with that token.`)
53
+ return data.validatePoolPuzzles
54
+ }
55
+
56
+ /** Adds puzzle files to the end of the game's pool; invalid files come back in `failed`. */
57
+ export const addPuzzlesToPool = async (apiURL: string, token: string, gameSlug: string, puzzles: PuzzleFile[]) => {
58
+ const { data, errors } = await query<cliAddPuzzlesToPoolMutation>(addPuzzlesToPoolMutation, {
59
+ variables: { token, gameSlug, puzzles },
60
+ url: `${apiURL}/graphql`,
61
+ })
62
+ if (errors?.length) throw new Error(errors.map((e) => e.message).join("; "))
63
+ if (!data?.addPuzzlesToPool) throw new Error(`No game named "${gameSlug}" is accessible with that token.`)
64
+ return data.addPuzzlesToPool
65
+ }
@@ -0,0 +1,49 @@
1
+ # __DISPLAY_NAME__
2
+
3
+ A Puzzmo game written as a PICO-8 cart. The whole game is in `cart/game.p8`, and `puzzmo.lua` connects it to Puzzmo
4
+ over PICO-8's GPIO bytes.
5
+
6
+ ## Develop
7
+
8
+ You need [PICO-8](https://www.lexaloffle.com/pico-8.php) to make changes to the cart.
9
+
10
+ ```
11
+ yarn install # or npm/pnpm
12
+ yarn dev # opens the Puzzmo simulator
13
+ ```
14
+
15
+ Open `cart/game.p8` in PICO-8 and edit away. Each time you save, the dev server re-exports the cart and reloads the
16
+ page. It looks for `pico8` on your PATH, then in the usual install locations; set `PICO8=/path/to/pico8` if yours
17
+ lives somewhere else.
18
+
19
+ HTML exports need a label: run the cart in PICO-8, press CTRL-7, and save.
20
+
21
+ Commit `export/`. It's the exported cart, and it means building the game doesn't need PICO-8.
22
+
23
+ ## How it fits together
24
+
25
+ - `cart/game.p8` is the game. It starts with `#include puzzmo.lua`, calls `pz_init()` in `_init` and `pz_update()`
26
+ at the top of `_update60`, and gets the puzzle from `pz.puzzle`.
27
+ - `cart/puzzmo.lua` connects the cart to Puzzmo. The dev server keeps it up to date, so don't edit it. The comment
28
+ at the top lists everything it gives you.
29
+ - `src/main.ts` hands the cart the puzzle and passes on what the cart saves. You shouldn't need to change it.
30
+ - `fixtures/puzzles/` holds the puzzles the simulator can load.
31
+
32
+ ## Bringing over a cart you already have
33
+
34
+ Replace `cart/game.p8` with your cart (keep the name, or pass `cart` to `puzzmoPico8()` in `vite.config.ts`), then:
35
+
36
+ 1. Add `#include puzzmo.lua` at the top of its code.
37
+ 2. Call `pz_init()` in `_init`, and `pz_update()` first thing in `_update` or `_update60`.
38
+ 3. Wait for `pz.ready` before starting, then build the level from `pz.puzzle`.
39
+ 4. Only take input while `pz.started` is true and `pz.paused` is false.
40
+ 5. Call `pz_save(str)` after each move, and read it back from `pz.progress` when the player returns.
41
+ 6. Call `pz_complete(points, str)` when the puzzle is solved, and `pz_finished()` when your victory animation is done.
42
+
43
+ ## Deployment
44
+
45
+ ```
46
+ puzzmo login <your-token> # token from workshop.puzzmo.com
47
+ yarn deploy # builds, then uploads to Puzzmo
48
+ yarn deploy:only # uploads the current dist/
49
+ ```