@air-jam/cli 0.0.0-stage → 0.9.3
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/LICENSE +21 -0
- package/README.md +145 -2
- package/bin/airjam.mjs +66 -0
- package/dist/ai-pack.d.ts +44 -0
- package/dist/ai-pack.js +15 -0
- package/dist/ai-pack.js.map +1 -0
- package/dist/chunk-A4V2N4LX.js +938 -0
- package/dist/chunk-A4V2N4LX.js.map +1 -0
- package/dist/chunk-J5MAU4QZ.js +102 -0
- package/dist/chunk-J5MAU4QZ.js.map +1 -0
- package/dist/chunk-N7AI7HZK.js +529 -0
- package/dist/chunk-N7AI7HZK.js.map +1 -0
- package/dist/development.d.ts +98 -0
- package/dist/development.js +33 -0
- package/dist/development.js.map +1 -0
- package/dist/documentation.d.ts +27 -0
- package/dist/documentation.js +7 -0
- package/dist/documentation.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2184 -0
- package/dist/index.js.map +1 -0
- package/dist/scaffold.d.ts +6 -0
- package/dist/scaffold.js +20 -0
- package/dist/scaffold.js.map +1 -0
- package/package.json +78 -3
- package/runtime/local-network.d.mts +8 -0
- package/runtime/local-network.mjs +9 -0
- package/runtime/vite-config.d.mts +42 -0
- package/runtime/vite-config.mjs +130 -0
- package/runtime/vite-https.d.mts +11 -0
- package/runtime/vite-https.mjs +41 -0
- package/template-assets/bootstrap/.claude/launch.json +12 -0
- package/template-assets/bootstrap/AGENTS.md +248 -0
- package/template-assets/bootstrap/CLAUDE.md +63 -0
- package/template-assets/bootstrap/_gitignore +6 -0
- package/template-assets/bootstrap/skills/airjam-docs-workflow/SKILL.md +49 -0
- package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +56 -0
- package/template-assets/bootstrap/skills/canvas-2d-gameplay/SKILL.md +47 -0
- package/template-assets/bootstrap/skills/controller-ui/SKILL.md +69 -0
- package/template-assets/bootstrap/skills/debug-and-test/SKILL.md +72 -0
- package/template-assets/bootstrap/skills/game-architecture/SKILL.md +58 -0
- package/template-assets/bootstrap/skills/game-state-and-rendering/SKILL.md +44 -0
- package/template-assets/bootstrap/skills/host-surface/SKILL.md +52 -0
- package/template-assets/bootstrap/skills/index.md +36 -0
- package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +48 -0
- package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +51 -0
- package/template-assets/documentation/for-agents/controller-ui/page.mdx +60 -0
- package/template-assets/documentation/for-agents/page.mdx +98 -0
- package/template-assets/documentation/for-agents/project-structure/page.mdx +172 -0
- package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +79 -0
- package/template-assets/documentation/getting-started/debugging/page.mdx +165 -0
- package/template-assets/documentation/getting-started/dev-logs/page.mdx +171 -0
- package/template-assets/documentation/getting-started/game-ideas/page.mdx +116 -0
- package/template-assets/documentation/getting-started/introduction/page.mdx +183 -0
- package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +427 -0
- package/template-assets/documentation/getting-started/quick-start/page.mdx +333 -0
- package/template-assets/documentation/how-it-works/architecture/page.mdx +189 -0
- package/template-assets/documentation/how-it-works/host-system/page.mdx +267 -0
- package/template-assets/documentation/manifest.json +430 -0
- package/template-assets/documentation/sdk/hooks/page.mdx +500 -0
- package/template-assets/documentation/sdk/input-system/page.mdx +270 -0
- package/template-assets/documentation/sdk/networked-state/page.mdx +213 -0
- package/template-assets/documentation/sdk/ui-components/page.mdx +227 -0
- package/template-assets/managed/.airjam/ai-pack.json +191 -0
- package/template-assets/managed/docs/airjam/agent-gold-path.md +67 -0
- package/template-assets/managed/docs/airjam/agent-mcp.md +135 -0
- package/template-assets/managed/docs/airjam/canvas-2d-gameplay.md +82 -0
- package/template-assets/managed/docs/airjam/composition-shell-contract.md +87 -0
- package/template-assets/managed/docs/airjam/debug-and-testing.md +86 -0
- package/template-assets/managed/docs/airjam/development-loop.md +51 -0
- package/template-assets/managed/docs/airjam/docs-index.md +58 -0
- package/template-assets/managed/docs/airjam/generated/architecture.md +178 -0
- package/template-assets/managed/docs/airjam/generated/controller-ui.md +61 -0
- package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +164 -0
- package/template-assets/managed/docs/airjam/generated/for-agents.md +99 -0
- package/template-assets/managed/docs/airjam/generated/game-ideas.md +107 -0
- package/template-assets/managed/docs/airjam/generated/host-system.md +251 -0
- package/template-assets/managed/docs/airjam/generated/input-system.md +260 -0
- package/template-assets/managed/docs/airjam/generated/introduction.md +175 -0
- package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +426 -0
- package/template-assets/managed/docs/airjam/generated/networked-state.md +214 -0
- package/template-assets/managed/docs/airjam/generated/project-structure.md +171 -0
- package/template-assets/managed/docs/airjam/generated/quick-start.md +334 -0
- package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +490 -0
- package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +80 -0
- package/template-assets/managed/docs/airjam/generated/ui-components.md +222 -0
- package/template-assets/managed/docs/airjam/generated/unified-dev-logs.md +170 -0
- package/template-assets/managed/docs/airjam/iconography.md +55 -0
- package/template-assets/managed/docs/airjam/prefab-authoring.md +112 -0
- package/template-assets/managed/docs/airjam/preview-controllers.md +126 -0
- package/template-assets/managed/docs/airjam/r3f-3d-scene.md +97 -0
- package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +106 -0
- package/template-assets/managed/docs/airjam/visual-system.md +103 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"packVersion": "0.1.0",
|
|
4
|
+
"channel": "stable",
|
|
5
|
+
"releaseDate": "2026-03-29T00:00:00.000Z",
|
|
6
|
+
"source": {
|
|
7
|
+
"mode": "packaged-snapshot",
|
|
8
|
+
"package": "@air-jam/cli"
|
|
9
|
+
},
|
|
10
|
+
"scaffold": {
|
|
11
|
+
"template": null,
|
|
12
|
+
"createAirjamVersion": null
|
|
13
|
+
},
|
|
14
|
+
"managedFiles": [
|
|
15
|
+
{
|
|
16
|
+
"path": "docs/airjam/agent-gold-path.md",
|
|
17
|
+
"kind": "docs-local",
|
|
18
|
+
"size": 5018,
|
|
19
|
+
"sha256": "8419951ad3a1e92fed5b7c3714b0908c6e6bed3d661041d5692ee38337888dcd"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "docs/airjam/agent-mcp.md",
|
|
23
|
+
"kind": "docs-local",
|
|
24
|
+
"size": 7245,
|
|
25
|
+
"sha256": "c878e2eebfbbc927dfce5548c0d7a4163feffd3965a82c8c5dc38a9ec385c42b"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "docs/airjam/canvas-2d-gameplay.md",
|
|
29
|
+
"kind": "docs-local",
|
|
30
|
+
"size": 1808,
|
|
31
|
+
"sha256": "d19086c4d1c0b52fe64e91a6de068803db18f7879719e1e90dbaa26ef1be14ae"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "docs/airjam/composition-shell-contract.md",
|
|
35
|
+
"kind": "docs-local",
|
|
36
|
+
"size": 2666,
|
|
37
|
+
"sha256": "91bf49cb98f3b94cabd145d960a9562786e73c029b3955904ef45a8f8bf71a06"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"path": "docs/airjam/debug-and-testing.md",
|
|
41
|
+
"kind": "docs-local",
|
|
42
|
+
"size": 2889,
|
|
43
|
+
"sha256": "65adf52e5cdcf0648ab56af1c0b639e30cf93495a85e2971b83168b571db97af"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"path": "docs/airjam/development-loop.md",
|
|
47
|
+
"kind": "docs-local",
|
|
48
|
+
"size": 2453,
|
|
49
|
+
"sha256": "a4a805fa89d199b2cd9282561339ca066a17f902b12ce73ba18f1cc066818d81"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"path": "docs/airjam/docs-index.md",
|
|
53
|
+
"kind": "docs-local",
|
|
54
|
+
"size": 2392,
|
|
55
|
+
"sha256": "35c70672b7401b4f1e14abd8a88d9b50ecb8925b39245072474ac4fa88d27fb2"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"path": "docs/airjam/generated/architecture.md",
|
|
59
|
+
"kind": "docs-generated",
|
|
60
|
+
"size": 7115,
|
|
61
|
+
"sha256": "1cbd763c55f77bc4bd0fb00605fd718daa63b8638c17313d12a1468f508fdf73"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"path": "docs/airjam/generated/controller-ui.md",
|
|
65
|
+
"kind": "docs-generated",
|
|
66
|
+
"size": 1578,
|
|
67
|
+
"sha256": "fd54779b68ecffc359d29fad15a1bf17f965a2f8dd0602fbe3700a3237f906e2"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"path": "docs/airjam/generated/debugging-and-logs.md",
|
|
71
|
+
"kind": "docs-generated",
|
|
72
|
+
"size": 4575,
|
|
73
|
+
"sha256": "7998e1427b96d162986c193d32f30a97d35f92346c8d50a0a8b77019fb738897"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"path": "docs/airjam/generated/for-agents.md",
|
|
77
|
+
"kind": "docs-generated",
|
|
78
|
+
"size": 3916,
|
|
79
|
+
"sha256": "fca62f1760b114bc62c6afa981da0107abafce7ce251adc3e38ae4d35b68432e"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"path": "docs/airjam/generated/game-ideas.md",
|
|
83
|
+
"kind": "docs-generated",
|
|
84
|
+
"size": 3034,
|
|
85
|
+
"sha256": "e7ac9abc839ab21544e0cfa0075d353591cb277d5dbd65b121010c965e90f62e"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"path": "docs/airjam/generated/host-system.md",
|
|
89
|
+
"kind": "docs-generated",
|
|
90
|
+
"size": 9618,
|
|
91
|
+
"sha256": "38561068538f6cd69bd8aa43d022bba6eee1eb6a635933d9d738ff305620ce8a"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"path": "docs/airjam/generated/input-system.md",
|
|
95
|
+
"kind": "docs-generated",
|
|
96
|
+
"size": 6024,
|
|
97
|
+
"sha256": "86395f226fc78c13eee4632998f60911d487739a027f82858371c8d233d4932f"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"path": "docs/airjam/generated/introduction.md",
|
|
101
|
+
"kind": "docs-generated",
|
|
102
|
+
"size": 5194,
|
|
103
|
+
"sha256": "f6b2220d39b2a72e736f0f757ba01c948f09ae9063c98c202ec5bbe9ec749d58"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"path": "docs/airjam/generated/migrating-legacy-games.md",
|
|
107
|
+
"kind": "docs-generated",
|
|
108
|
+
"size": 11763,
|
|
109
|
+
"sha256": "dadd93324cd6a1543f4d86124b44f6c7eb84333ae476a1d2026318e19ebeacdf"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"path": "docs/airjam/generated/networked-state.md",
|
|
113
|
+
"kind": "docs-generated",
|
|
114
|
+
"size": 7057,
|
|
115
|
+
"sha256": "f6e8a0d752bc6a2a8bef82e9a4e9552f4f23e46e3d3dedacd4ac03076c4b0cb9"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"path": "docs/airjam/generated/project-structure.md",
|
|
119
|
+
"kind": "docs-generated",
|
|
120
|
+
"size": 4418,
|
|
121
|
+
"sha256": "e8656cca6330442d6c3f990c37b82038867abaa672c50d8798b2e88c2f06d062"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"path": "docs/airjam/generated/quick-start.md",
|
|
125
|
+
"kind": "docs-generated",
|
|
126
|
+
"size": 12468,
|
|
127
|
+
"sha256": "52b9bdf13249976162d266ed895a606e4ff5df34749cf97c51357f9efdb52d08"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"path": "docs/airjam/generated/sdk-hooks.md",
|
|
131
|
+
"kind": "docs-generated",
|
|
132
|
+
"size": 16017,
|
|
133
|
+
"sha256": "0697f9d3db87814784ab7919f41d40d2d8b0c399e98e0ac165ef8649052e0362"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"path": "docs/airjam/generated/state-and-rendering.md",
|
|
137
|
+
"kind": "docs-generated",
|
|
138
|
+
"size": 3176,
|
|
139
|
+
"sha256": "c9e52a44c5f865db217a5bb538d0ee64b82ef342c78bc85acc830c488e3c8198"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"path": "docs/airjam/generated/ui-components.md",
|
|
143
|
+
"kind": "docs-generated",
|
|
144
|
+
"size": 5410,
|
|
145
|
+
"sha256": "4f01e900e2a2abdded844b3ba71ff872a277aeff3a425b359496a65bddd1301f"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"path": "docs/airjam/generated/unified-dev-logs.md",
|
|
149
|
+
"kind": "docs-generated",
|
|
150
|
+
"size": 5592,
|
|
151
|
+
"sha256": "f210c6e197bc5029b281edbc8d28b74a40cde06f1de41aca89d762968f438bbb"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"path": "docs/airjam/iconography.md",
|
|
155
|
+
"kind": "docs-local",
|
|
156
|
+
"size": 1264,
|
|
157
|
+
"sha256": "d50f06e49d72dea63f82b9d8276480c5dc13007cdd66ac0371f8c08a6019a2e4"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"path": "docs/airjam/prefab-authoring.md",
|
|
161
|
+
"kind": "docs-local",
|
|
162
|
+
"size": 2887,
|
|
163
|
+
"sha256": "0383338b0e68386433bc1847a6e2191fe6ce580625431d6332d11da6241ea92c"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"path": "docs/airjam/preview-controllers.md",
|
|
167
|
+
"kind": "docs-local",
|
|
168
|
+
"size": 4464,
|
|
169
|
+
"sha256": "d1189e966a7891abc265793d264a201b0cf8c56902342697999c70356f18cac5"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"path": "docs/airjam/r3f-3d-scene.md",
|
|
173
|
+
"kind": "docs-local",
|
|
174
|
+
"size": 2979,
|
|
175
|
+
"sha256": "7142a7e1a513f3a43a0838b48daf85cca9780ffca58f34db50c06a24a56176d0"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"path": "docs/airjam/state-lanes-cookbook.md",
|
|
179
|
+
"kind": "docs-local",
|
|
180
|
+
"size": 3206,
|
|
181
|
+
"sha256": "5dde111762f1071ef5e7fc23ffe1adac07454662ad8dced7a42a8d40e4f6150b"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"path": "docs/airjam/visual-system.md",
|
|
185
|
+
"kind": "docs-local",
|
|
186
|
+
"size": 2830,
|
|
187
|
+
"sha256": "0eaa064c38b4568c200fbf5cadb96f16c7c738a29469c4c955fb1ac5f8077edf"
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
"contentDigest": "d5e870a50333e7ce47e53aad9348a78c0e9bf5a7337ca0287991778cb704c835"
|
|
191
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Agent Gold Path
|
|
2
|
+
|
|
3
|
+
This is the shortest correct workflow for building and testing an Air Jam game.
|
|
4
|
+
|
|
5
|
+
## Read This First
|
|
6
|
+
|
|
7
|
+
1. `src/airjam.config.ts`
|
|
8
|
+
2. `src/game/contracts/agent.ts` if it exists
|
|
9
|
+
3. `docs/airjam/state-lanes-cookbook.md` when you are deciding where state or effects belong
|
|
10
|
+
4. `docs/airjam/agent-mcp.md` when you need exact MCP operations
|
|
11
|
+
|
|
12
|
+
## Five-Step Mental Model
|
|
13
|
+
|
|
14
|
+
1. Need to see the game: use your built-in browser or in-app browser.
|
|
15
|
+
2. Need structured game state: use `airjam.open_game_session` then `airjam.read_game_session`.
|
|
16
|
+
3. Need to trigger a semantic game verb: use `airjam.invoke_game_session_action` with a `player:*` action id.
|
|
17
|
+
4. Need deterministic host staging or reset actions: use `host:*` session actions when the game exposes them.
|
|
18
|
+
5. Need visual proof: use the embedded browser when available, otherwise call `airjam.capture_game_session_visuals` on the room-owning session.
|
|
19
|
+
|
|
20
|
+
## Launch Rule
|
|
21
|
+
|
|
22
|
+
1. Treat project creation and package-manager mutation as single-writer work.
|
|
23
|
+
Wait for the active scaffold/install command to finish; never start
|
|
24
|
+
concurrent installs against the same workspace.
|
|
25
|
+
1. Use `pnpm run dev` for normal local development.
|
|
26
|
+
1. Use the committed `.claude/launch.json` when Claude Code Desktop preview launches the app. It runs `pnpm run dev -- --preview-managed` so Claude Preview sees Vite as the foreground process while Air Jam manages the local server in the background.
|
|
27
|
+
1. Do not replace the Air Jam dev flow with raw `pnpm exec vite` unless you intentionally want frontend-only rendering without the local Air Jam backend.
|
|
28
|
+
1. If you need HTTPS/secure local dev, use `pnpm run dev -- --secure`.
|
|
29
|
+
1. If local runtime state feels stale, use Air Jam status/log/reset tooling before debugging gameplay code.
|
|
30
|
+
1. After editing host-only runtime refs, physics loops, or `useHostActionListener` side effects, hard refresh the host or run `pnpm exec airjam reset local` if actions appear duplicated or rendered state no longer matches replicated state.
|
|
31
|
+
|
|
32
|
+
## Canonical Files
|
|
33
|
+
|
|
34
|
+
`src/airjam.config.ts`
|
|
35
|
+
: Declares the runtime, metadata, controller path, and semantic game contract.
|
|
36
|
+
|
|
37
|
+
`src/game/contracts/agent.ts`
|
|
38
|
+
: Owns the semantic agent contract. Keep snapshot projection and semantic actions here.
|
|
39
|
+
|
|
40
|
+
## Action Rules
|
|
41
|
+
|
|
42
|
+
1. `player:*` actions act like a player or a semantic controller verb.
|
|
43
|
+
2. `host:*` actions are deterministic semantic host actions. Define them with `agentAction.host(...)` when the game needs precise host staging or reset verbs for testing, visual proof, or controlled setup.
|
|
44
|
+
3. Store action dispatch returns an acknowledgement. Check it when outcome matters.
|
|
45
|
+
4. For `airjam.invoke_game_session_action`, prefer the returned normalized `outcome` over guessing from the raw acknowledgement alone. A missing host acknowledgement with observed committed state change is still a meaningful success signal, not an automatic rejection.
|
|
46
|
+
5. `ctx.actorId` always means the dispatcher. If host code dispatches with `useStore.useActions()`, then `ctx.actorId` is the host.
|
|
47
|
+
6. If host code intentionally needs to run the same semantic player action as controller `X`, use `useStore.asPlayer("X")` explicitly.
|
|
48
|
+
7. If a store action needs a host-only local side effect like audio, sim refs, or one-shot UI effects, use `useStore.useHostActionListener(...)` instead of replicated queue-and-drain state.
|
|
49
|
+
8. `resultDescription` is documentation for agents and humans about the expected semantic effect. It does not automatically become runtime result data.
|
|
50
|
+
9. If an action must return actual runtime result data, return `acceptAirJamAction(result)` from the store action and read the acknowledgement/result separately.
|
|
51
|
+
10. For host gameplay loops, prefer `useHostTick(...)` over hand-rolled `requestAnimationFrame` or `setInterval` loops unless you have a documented reason not to.
|
|
52
|
+
|
|
53
|
+
## Import Rules
|
|
54
|
+
|
|
55
|
+
1. Browser/runtime code imports runtime symbols from the normal Air Jam packages used by the template.
|
|
56
|
+
2. If you need imperative live replicated state in React-owned agent code, use `useStore.useLiveStateRef()`.
|
|
57
|
+
|
|
58
|
+
## Browser + MCP Pairing
|
|
59
|
+
|
|
60
|
+
1. Browser is the visual truth.
|
|
61
|
+
2. Air Jam MCP is the agent-control and runtime-inspection path.
|
|
62
|
+
3. Use both together instead of forcing browser automation to do semantic work.
|
|
63
|
+
4. In Claude Code or similar preview surfaces, keep host and preview controllers in the same visible preview screen when possible.
|
|
64
|
+
5. Add multiple preview controllers from the host preview workspace when you need multiple local players; do not open unrelated OS browser tabs unless the user asks for tabs.
|
|
65
|
+
6. Use visible preview controllers for UI smoke proof with real browser click/drag/release gestures.
|
|
66
|
+
7. Do not synthesize pointer events into controller iframes from parent-page eval; use semantic game actions when reliable gameplay proof matters.
|
|
67
|
+
8. If the agent environment cannot launch a browser, capture the existing room's canonical host and controller views through `airjam.capture_game_session_visuals`; do not start an unrelated browser or room.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Agent MCP
|
|
2
|
+
|
|
3
|
+
Use the Air Jam MCP for Air Jam-native workflows before falling back to ad hoc shell commands.
|
|
4
|
+
|
|
5
|
+
If you only want the shortest correct mental model first, read `docs/airjam/agent-gold-path.md` before this file.
|
|
6
|
+
|
|
7
|
+
## What It Is
|
|
8
|
+
|
|
9
|
+
The project-local Air Jam MCP is the intended agent-facing path for:
|
|
10
|
+
|
|
11
|
+
1. project inspection
|
|
12
|
+
2. game inspection
|
|
13
|
+
3. canonical log reads
|
|
14
|
+
4. dev process lifecycle and status
|
|
15
|
+
5. runtime topology inspection
|
|
16
|
+
6. live game-session reads and semantic action invocation
|
|
17
|
+
7. quality-gate execution
|
|
18
|
+
|
|
19
|
+
The goal is to keep agents on explicit Air Jam contracts instead of forcing them to rediscover repo commands.
|
|
20
|
+
|
|
21
|
+
## Default Workflow
|
|
22
|
+
|
|
23
|
+
Start here:
|
|
24
|
+
|
|
25
|
+
1. `pnpm exec airjam mcp doctor --dir .`
|
|
26
|
+
2. the project already ships a committed `.mcp.json`
|
|
27
|
+
3. `pnpm exec airjam mcp init --dir . --force` only when you want to repair or regenerate that config
|
|
28
|
+
4. use the `mcp` script or `pnpm exec airjam-mcp` in your MCP-capable client
|
|
29
|
+
|
|
30
|
+
## Usage Rule
|
|
31
|
+
|
|
32
|
+
Use the Air Jam MCP first for:
|
|
33
|
+
|
|
34
|
+
1. `inspect_project`
|
|
35
|
+
2. `list_games`
|
|
36
|
+
3. `inspect_game`
|
|
37
|
+
4. `read_logs`
|
|
38
|
+
5. `start_dev`
|
|
39
|
+
6. `status`
|
|
40
|
+
7. `topology`
|
|
41
|
+
8. `open_game_session`
|
|
42
|
+
9. `send_game_session_input`
|
|
43
|
+
10. `read_game_session`
|
|
44
|
+
11. `invoke_game_session_action`
|
|
45
|
+
12. `capture_game_session_visuals`
|
|
46
|
+
13. `close_game_session`
|
|
47
|
+
14. `run_quality_gate`
|
|
48
|
+
|
|
49
|
+
Use direct shell commands only when:
|
|
50
|
+
|
|
51
|
+
1. the MCP does not expose the required operation
|
|
52
|
+
2. you are doing one-off repo maintenance work outside Air Jam devtools boundaries
|
|
53
|
+
|
|
54
|
+
## Browser Tooling Rule
|
|
55
|
+
|
|
56
|
+
When local UI verification matters:
|
|
57
|
+
|
|
58
|
+
1. use the current agent or client's built-in browser or in-app browser tooling first when available
|
|
59
|
+
2. prefer visible host/controller browser sessions over hidden automation when you need to verify what a player actually sees
|
|
60
|
+
3. pair that browser workflow with Air Jam MCP for logs, topology, snapshots, host staging actions, and quality gates
|
|
61
|
+
4. use secondary browser MCPs such as Chrome DevTools only when the first-party browser tooling is unavailable or when you need lower-level DOM, network, or performance diagnostics
|
|
62
|
+
5. if Claude Code Desktop preview launches the app, use the committed `.claude/launch.json`
|
|
63
|
+
6. if another browser/preview tool wants a launch command, use `pnpm run dev`
|
|
64
|
+
7. do not use raw `vite` for normal Air Jam development because it skips the local Air Jam backend
|
|
65
|
+
8. use normal `pnpm run dev -- --secure` when HTTPS is required
|
|
66
|
+
9. use visible preview controllers for controller UI smoke proof with real browser click/drag/release gestures
|
|
67
|
+
10. do not synthesize pointer events into controller iframes from parent-page eval; use semantic game actions when reliable gameplay proof matters
|
|
68
|
+
11. when the agent cannot own a browser process, use `airjam.capture_game_session_visuals` on the room-owning session to capture canonical host and controller screenshots through Air Jam's project-scoped runtime owner
|
|
69
|
+
|
|
70
|
+
## Debugging Rule
|
|
71
|
+
|
|
72
|
+
For runtime or multiplayer issues:
|
|
73
|
+
|
|
74
|
+
1. start with `airjam.read_logs`
|
|
75
|
+
2. use `view=signal` first
|
|
76
|
+
3. narrow with `trace`, `room`, `controller`, `runtime`, `process`, or `source`
|
|
77
|
+
4. only add ad hoc logs after the canonical log stream is insufficient
|
|
78
|
+
5. prefer `airjam.topology` over manually reconstructing local endpoints
|
|
79
|
+
6. when you need to drive and inspect a live game, use `airjam.open_game_session`, `airjam.send_game_session_input`, `airjam.read_game_session`, `airjam.invoke_game_session_action`, `airjam.capture_game_session_visuals`, and `airjam.close_game_session`
|
|
80
|
+
7. use the unified session action metadata from `airjam.open_game_session` and `airjam.read_game_session` before guessing payload shapes
|
|
81
|
+
8. session action ids are lane-prefixed on purpose: `player:<actionId>` for semantic player-lane actions and `host:<actionId>` for semantic host-lane staging actions
|
|
82
|
+
9. when a compatible local Air Jam dev session is already running, the official harness/session tools should attach to that live stack instead of trying to start a duplicate dev server
|
|
83
|
+
10. read the returned action `outcome` together with `acknowledgementObservation` and `snapshotAfterStatus`: a missing host acknowledgement is not the same thing as semantic rejection if the post-action snapshot shows committed state change
|
|
84
|
+
11. if an isolated harness or runtime ownership tool times out, check Air Jam status/log/reset tooling before treating it as gameplay bug
|
|
85
|
+
12. after editing host-only runtime refs, physics loops, or `useHostActionListener` side effects, hard refresh the host or run `pnpm exec airjam reset local` if actions appear duplicated or rendered state no longer matches replicated state
|
|
86
|
+
|
|
87
|
+
## Semantic Staging Rule
|
|
88
|
+
|
|
89
|
+
`src/game/contracts/agent.ts` is the primary agent-facing contract.
|
|
90
|
+
|
|
91
|
+
When you own the game code and the existing host staging surface is too thin:
|
|
92
|
+
|
|
93
|
+
1. add a small game-owned semantic action instead of automating the visible browser UI whenever the intent is really part of the game contract
|
|
94
|
+
2. prefer explicit verbs like `returnToLobby`, `startRound`, `setScore`, or `finishMatch`
|
|
95
|
+
3. include action descriptions and payload descriptions so future agents can discover the contract without source diving
|
|
96
|
+
4. for schema-backed semantic action payloads, prefer `agentActionInput.zod(...)` over ad hoc custom parsers when Zod already expresses the shape cleanly
|
|
97
|
+
5. if the verb is a host-owned staging/reset action rather than a player verb, publish it with `agentAction.host(...)` so it becomes a canonical `host:*` session action instead of a bridge action
|
|
98
|
+
6. `resultDescription` should describe the expected semantic effect for agents and humans; it is not automatic runtime result data
|
|
99
|
+
7. if a semantic action must return actual runtime result data, the underlying store action should return `acceptAirJamAction(result)` and callers should read that result from the acknowledgement or session action response
|
|
100
|
+
|
|
101
|
+
## Semantic Game Rule
|
|
102
|
+
|
|
103
|
+
If the scaffolded template includes `src/game/contracts/agent.ts`, treat `src/airjam.config.ts` as the canonical agent manifest and the template-owned contract file as the portable implementation it wires through `agent`.
|
|
104
|
+
|
|
105
|
+
That contract is template-owned. Do not create a second generated agent surface on top of it, and do not rely on devtools guessing its filesystem path when the config already declares it.
|
|
106
|
+
|
|
107
|
+
Use:
|
|
108
|
+
|
|
109
|
+
1. `airjam.open_game_session`
|
|
110
|
+
2. `airjam.send_game_session_input`
|
|
111
|
+
3. `airjam.read_game_session`
|
|
112
|
+
4. `airjam.invoke_game_session_action`
|
|
113
|
+
5. `airjam.capture_game_session_visuals`
|
|
114
|
+
6. `airjam.close_game_session`
|
|
115
|
+
|
|
116
|
+
If a clean-slate project does not ship those files yet but the game is growing beyond a trivial single-screen flow:
|
|
117
|
+
|
|
118
|
+
1. add `src/game/contracts/agent.ts` early
|
|
119
|
+
2. wire it through `src/airjam.config.ts` `agent`
|
|
120
|
+
3. publish a small semantic action set for the important game verbs instead of leaving them implicit in visible UI only
|
|
121
|
+
|
|
122
|
+
## Quality Rule
|
|
123
|
+
|
|
124
|
+
Before finishing meaningful work:
|
|
125
|
+
|
|
126
|
+
1. run the smallest matching `airjam.run_quality_gate`
|
|
127
|
+
2. prefer focused checks first
|
|
128
|
+
3. broaden to the heavier project checks only when the change warrants it
|
|
129
|
+
4. for host/controller UI or gameplay presentation changes, verify the visible browser preview before sign-off
|
|
130
|
+
|
|
131
|
+
## Notes
|
|
132
|
+
|
|
133
|
+
The MCP config is project-local and scaffolded by default.
|
|
134
|
+
|
|
135
|
+
Do not mutate global client configuration unless you explicitly mean to.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Canvas 2D Gameplay
|
|
2
|
+
|
|
3
|
+
This guide exists for Air Jam projects that render gameplay in 2D on canvas.
|
|
4
|
+
|
|
5
|
+
The goal is to keep 2D games structured like games, not like DOM-heavy mini websites.
|
|
6
|
+
|
|
7
|
+
## Render Layer Rule
|
|
8
|
+
|
|
9
|
+
Use canvas for gameplay rendering.
|
|
10
|
+
|
|
11
|
+
Use React and normal UI modules for:
|
|
12
|
+
|
|
13
|
+
1. menus
|
|
14
|
+
2. HUD wrappers
|
|
15
|
+
3. overlays
|
|
16
|
+
4. controller and host shell chrome
|
|
17
|
+
|
|
18
|
+
Do not use the DOM as the main gameplay scene graph unless the game is genuinely UI-native.
|
|
19
|
+
|
|
20
|
+
## Separation Rule
|
|
21
|
+
|
|
22
|
+
Keep these concerns separate:
|
|
23
|
+
|
|
24
|
+
1. simulation and game state
|
|
25
|
+
2. drawing and visual presentation
|
|
26
|
+
3. shell UI and overlays
|
|
27
|
+
4. input interpretation
|
|
28
|
+
|
|
29
|
+
Canvas code should not become the place where all game logic lives.
|
|
30
|
+
|
|
31
|
+
## Scaling Rule
|
|
32
|
+
|
|
33
|
+
Keep world coordinates distinct from:
|
|
34
|
+
|
|
35
|
+
1. canvas pixel dimensions
|
|
36
|
+
2. CSS layout dimensions
|
|
37
|
+
3. device pixel ratio
|
|
38
|
+
|
|
39
|
+
This makes camera, zoom, hit areas, and responsive scaling much easier to reason about.
|
|
40
|
+
|
|
41
|
+
## Asset Direction
|
|
42
|
+
|
|
43
|
+
LLM-generated SVGs can work well for:
|
|
44
|
+
|
|
45
|
+
1. icons
|
|
46
|
+
2. pickups
|
|
47
|
+
3. simple props
|
|
48
|
+
4. UI symbols
|
|
49
|
+
5. stylized sprite inputs
|
|
50
|
+
|
|
51
|
+
But they should still be curated.
|
|
52
|
+
|
|
53
|
+
Rules:
|
|
54
|
+
|
|
55
|
+
1. keep a consistent stroke/fill language
|
|
56
|
+
2. normalize sizing and viewBox conventions
|
|
57
|
+
3. avoid mixing unrelated visual styles casually
|
|
58
|
+
|
|
59
|
+
## Animation And Effects
|
|
60
|
+
|
|
61
|
+
Prefer simple readable motion over overproduced effect stacks.
|
|
62
|
+
|
|
63
|
+
Use:
|
|
64
|
+
|
|
65
|
+
1. clean tweens
|
|
66
|
+
2. lightweight particles
|
|
67
|
+
3. readable squash, stretch, flash, or trail effects
|
|
68
|
+
|
|
69
|
+
Only add more visual complexity if the base game already reads well.
|
|
70
|
+
|
|
71
|
+
## Movement And Collision
|
|
72
|
+
|
|
73
|
+
For many 2D Air Jam games, a custom movement/collision model is the cleanest choice.
|
|
74
|
+
|
|
75
|
+
Use that first for:
|
|
76
|
+
|
|
77
|
+
1. simple arcade motion
|
|
78
|
+
2. constrained arenas
|
|
79
|
+
3. overlap-driven pickups
|
|
80
|
+
4. deterministic authored interactions
|
|
81
|
+
|
|
82
|
+
Only adopt a dedicated physics engine when the mechanic clearly benefits from it.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Composition Shell Contract
|
|
2
|
+
|
|
3
|
+
This template supports two valid ways to build host/controller shell UI:
|
|
4
|
+
|
|
5
|
+
1. compose from shared SDK shell atoms
|
|
6
|
+
2. build fully custom shell markup
|
|
7
|
+
|
|
8
|
+
Both are acceptable.
|
|
9
|
+
What is not acceptable is breaking the required lifecycle and room-join behavior contract.
|
|
10
|
+
|
|
11
|
+
## Required Host Lobby Contract
|
|
12
|
+
|
|
13
|
+
The host lobby should expose:
|
|
14
|
+
|
|
15
|
+
1. room/join context
|
|
16
|
+
2. QR access, either inline or via an obvious overlay trigger
|
|
17
|
+
3. controller join URL field
|
|
18
|
+
4. copy join URL action
|
|
19
|
+
5. open join URL action
|
|
20
|
+
6. primary start/play action
|
|
21
|
+
|
|
22
|
+
The theme, layout, typography, and art direction stay game-owned.
|
|
23
|
+
|
|
24
|
+
## Required Controller Contract
|
|
25
|
+
|
|
26
|
+
The controller shell should expose:
|
|
27
|
+
|
|
28
|
+
1. top status bar with connection state
|
|
29
|
+
2. player identity/avatar area
|
|
30
|
+
3. lifecycle action cluster in a consistent top position
|
|
31
|
+
4. gameplay controls below the shell
|
|
32
|
+
|
|
33
|
+
Lifecycle actions should stay in this order when present:
|
|
34
|
+
|
|
35
|
+
1. `Start`
|
|
36
|
+
2. `Pause` or `Resume`
|
|
37
|
+
3. `Back to Lobby`
|
|
38
|
+
|
|
39
|
+
## Composition-First Default Path
|
|
40
|
+
|
|
41
|
+
If the game does not need a highly custom shell, prefer composing from:
|
|
42
|
+
|
|
43
|
+
1. `RuntimeShellHeader`
|
|
44
|
+
2. `ConnectionStatusPill`
|
|
45
|
+
3. `LifecycleActionGroup`
|
|
46
|
+
4. `JoinUrlField`
|
|
47
|
+
5. `JoinUrlActionButtons`
|
|
48
|
+
6. `JoinUrlControls`
|
|
49
|
+
7. `JoinQrOverlay`
|
|
50
|
+
8. `RoomQrCode` when a game truly needs inline QR presentation
|
|
51
|
+
9. `HostMuteButton` where host audio mute is needed
|
|
52
|
+
|
|
53
|
+
When lifecycle action visibility or labels should stay shared, prefer `useLifecycleActionGroupModel` and render from its returned action descriptors.
|
|
54
|
+
|
|
55
|
+
For shared shell state and handler wiring, prefer:
|
|
56
|
+
|
|
57
|
+
1. `useHostJoinControls`
|
|
58
|
+
2. `useControllerShellStatus`
|
|
59
|
+
3. `useControllerLifecyclePermissions`
|
|
60
|
+
4. `useControllerLifecycleIntents`
|
|
61
|
+
5. `useLifecycleActionGroupModel`
|
|
62
|
+
|
|
63
|
+
## Full-Custom Path
|
|
64
|
+
|
|
65
|
+
If the game wants a completely custom shell:
|
|
66
|
+
|
|
67
|
+
1. keep the host/controller behavior contract intact
|
|
68
|
+
2. keep lifecycle actions as controller intents, not direct authority bypasses
|
|
69
|
+
3. keep host/store actions authoritative for actual lifecycle transitions
|
|
70
|
+
4. do not remove the required room/join and controller lifecycle affordances
|
|
71
|
+
|
|
72
|
+
Full-custom is about presentation freedom, not behavior freedom.
|
|
73
|
+
|
|
74
|
+
## Avoid
|
|
75
|
+
|
|
76
|
+
1. duplicate lifecycle controls in both a shared shell and a legacy local panel
|
|
77
|
+
2. controller-only state mutation that bypasses host/store authority
|
|
78
|
+
3. hiding join URL actions or start controls on the host lobby
|
|
79
|
+
4. making shell controls drift to different positions across games without a strong reason
|
|
80
|
+
|
|
81
|
+
## Authoring Rule
|
|
82
|
+
|
|
83
|
+
When changing shell UI:
|
|
84
|
+
|
|
85
|
+
1. prefer shared atoms for common behavior
|
|
86
|
+
2. prefer local wrappers for theme-specific styling
|
|
87
|
+
3. add direct tests when a shared shell component or shared shell behavior changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Debug And Testing
|
|
2
|
+
|
|
3
|
+
Debuggability and testability should be designed in from the start.
|
|
4
|
+
|
|
5
|
+
## Debug Workflow
|
|
6
|
+
|
|
7
|
+
Use this order:
|
|
8
|
+
|
|
9
|
+
1. inspect the canonical Air Jam dev log stream first, preferably through the Air Jam MCP when available
|
|
10
|
+
2. use framework diagnostics second
|
|
11
|
+
3. use domain-level debug helpers third
|
|
12
|
+
4. add custom logs only where they add real value
|
|
13
|
+
|
|
14
|
+
## Canonical Dev Log Stream
|
|
15
|
+
|
|
16
|
+
The standard Air Jam development path writes one unified local stream to:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
.airjam/logs/dev-latest.ndjson
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use:
|
|
23
|
+
|
|
24
|
+
1. `airjam.read_logs` with `view=signal`
|
|
25
|
+
2. `pnpm exec air-jam-server logs --view=signal`
|
|
26
|
+
3. `pnpm exec air-jam-server logs`
|
|
27
|
+
4. direct file reads when you need the raw NDJSON stream
|
|
28
|
+
|
|
29
|
+
Important behavior:
|
|
30
|
+
|
|
31
|
+
1. the file resets when the Air Jam server process restarts
|
|
32
|
+
2. host, controller, server, and standard dev-runner events should land in the same stream on the normal development path
|
|
33
|
+
3. this should be the first place to look before adding ad hoc logs
|
|
34
|
+
|
|
35
|
+
## Query Strategy
|
|
36
|
+
|
|
37
|
+
Start with the narrowest useful identifier:
|
|
38
|
+
|
|
39
|
+
1. `traceId` for host bootstrap, reconnect, and room ownership stories
|
|
40
|
+
2. `roomId` for one full multiplayer room story
|
|
41
|
+
3. `controllerId` for one player/controller failure path
|
|
42
|
+
4. `runtimeKind` and `runtimeEpoch` for embedded runtime issues
|
|
43
|
+
|
|
44
|
+
Use `pnpm exec air-jam-server logs --view=signal` first when you want the quickest high-signal read.
|
|
45
|
+
|
|
46
|
+
Use `--process` when the likely failure is in one local process such as `platform`, `server`, or the active game dev server.
|
|
47
|
+
|
|
48
|
+
Use direct file reads or broader filtering when you need:
|
|
49
|
+
|
|
50
|
+
1. exact append order
|
|
51
|
+
2. full raw payloads
|
|
52
|
+
3. plumbing events that signal view intentionally hides
|
|
53
|
+
|
|
54
|
+
## Structure Rules
|
|
55
|
+
|
|
56
|
+
1. keep debug helpers under `src/game/debug/`
|
|
57
|
+
2. keep debug-only code isolated from hot gameplay paths
|
|
58
|
+
3. use structured logs instead of random console spam
|
|
59
|
+
4. make debug overlays removable without destabilizing core code
|
|
60
|
+
|
|
61
|
+
## Testing Rules
|
|
62
|
+
|
|
63
|
+
1. test pure domain logic with unit tests
|
|
64
|
+
2. test important gameplay systems with behavior tests
|
|
65
|
+
3. add focused tests when changing real behavior
|
|
66
|
+
4. prefer observable behavior over implementation details
|
|
67
|
+
|
|
68
|
+
## Starter Template Testing Pattern
|
|
69
|
+
|
|
70
|
+
If the project ships the starter testing layout, keep using it:
|
|
71
|
+
|
|
72
|
+
1. `tests/game/domain/` for pure gameplay rules
|
|
73
|
+
2. `tests/game/stores/` for pure state transitions
|
|
74
|
+
3. `tests/game/engine/` for focused runtime helpers
|
|
75
|
+
4. `tests/game/adapters/` for host/controller or transport-facing mapping
|
|
76
|
+
5. `tests/game/ui/` for shared game-facing UI primitives that can be validated without full app shells
|
|
77
|
+
|
|
78
|
+
Default order:
|
|
79
|
+
|
|
80
|
+
1. write the pure test first
|
|
81
|
+
2. add adapter or shared UI coverage second
|
|
82
|
+
3. add heavier integration tests only when the boundary really requires them
|
|
83
|
+
|
|
84
|
+
## Architecture Consequence
|
|
85
|
+
|
|
86
|
+
If game logic is too entangled with React, rendering, or transport to test cleanly, that usually means the structure should be improved.
|