@air-jam/cli 0.0.0-stage → 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +273 -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/auth-profile.d.ts +5 -0
- package/dist/auth-profile.js +7 -0
- package/dist/auth-profile.js.map +1 -0
- package/dist/auth-sessions.d.ts +5 -0
- package/dist/auth-sessions.js +7 -0
- package/dist/auth-sessions.js.map +1 -0
- package/dist/chunk-7D4AYBAV.js +64 -0
- package/dist/chunk-7D4AYBAV.js.map +1 -0
- package/dist/chunk-J5MAU4QZ.js +102 -0
- package/dist/chunk-J5MAU4QZ.js.map +1 -0
- package/dist/chunk-LH7UO57C.js +23 -0
- package/dist/chunk-LH7UO57C.js.map +1 -0
- package/dist/chunk-N7AI7HZK.js +529 -0
- package/dist/chunk-N7AI7HZK.js.map +1 -0
- package/dist/chunk-PKTLVQXZ.js +82 -0
- package/dist/chunk-PKTLVQXZ.js.map +1 -0
- package/dist/chunk-SQE4NPZP.js +31 -0
- package/dist/chunk-SQE4NPZP.js.map +1 -0
- package/dist/chunk-U6V3HEBB.js +939 -0
- package/dist/chunk-U6V3HEBB.js.map +1 -0
- package/dist/chunk-VEHNFPEO.js +224 -0
- package/dist/chunk-VEHNFPEO.js.map +1 -0
- package/dist/development.d.ts +102 -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/game-analytics.d.ts +5 -0
- package/dist/game-analytics.js +7 -0
- package/dist/game-analytics.js.map +1 -0
- package/dist/game-app-id.d.ts +5 -0
- package/dist/game-app-id.js +7 -0
- package/dist/game-app-id.js.map +1 -0
- package/dist/game-media.d.ts +5 -0
- package/dist/game-media.js +7 -0
- package/dist/game-media.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2468 -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 +82 -3
- package/runtime/local-network.d.mts +6 -0
- package/runtime/local-network.mjs +9 -0
- package/runtime/public-assets.mjs +62 -0
- package/runtime/source-fence.mjs +182 -0
- package/runtime/vite-config.d.mts +43 -0
- package/runtime/vite-config.mjs +134 -0
- package/runtime/vite-dev.mjs +18 -0
- package/runtime/vite-https.d.mts +11 -0
- package/runtime/vite-https.mjs +40 -0
- package/template-assets/bootstrap/.claude/launch.json +12 -0
- package/template-assets/bootstrap/AGENTS.md +290 -0
- package/template-assets/bootstrap/CLAUDE.md +55 -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 +100 -0
- package/template-assets/bootstrap/skills/canvas-2d-gameplay/SKILL.md +47 -0
- package/template-assets/bootstrap/skills/controller-ui/SKILL.md +71 -0
- package/template-assets/bootstrap/skills/debug-and-test/SKILL.md +72 -0
- package/template-assets/bootstrap/skills/game-architecture/SKILL.md +102 -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 +58 -0
- package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +61 -0
- package/template-assets/documentation/for-agents/controller-ui/page.mdx +99 -0
- package/template-assets/documentation/for-agents/page.mdx +120 -0
- package/template-assets/documentation/for-agents/project-structure/page.mdx +170 -0
- package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +77 -0
- package/template-assets/documentation/for-agents/supported-agents/page.mdx +18 -0
- package/template-assets/documentation/getting-started/debugging/page.mdx +164 -0
- package/template-assets/documentation/getting-started/dev-logs/page.mdx +169 -0
- package/template-assets/documentation/getting-started/game-ideas/page.mdx +114 -0
- package/template-assets/documentation/getting-started/introduction/page.mdx +200 -0
- package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +673 -0
- package/template-assets/documentation/getting-started/quick-start/page.mdx +310 -0
- package/template-assets/documentation/how-it-works/architecture/page.mdx +230 -0
- package/template-assets/documentation/how-it-works/host-system/page.mdx +270 -0
- package/template-assets/documentation/manifest.json +500 -0
- package/template-assets/documentation/sdk/assets-and-theme/page.mdx +185 -0
- package/template-assets/documentation/sdk/hooks/page.mdx +435 -0
- package/template-assets/documentation/sdk/input-system/page.mdx +240 -0
- package/template-assets/documentation/sdk/networked-state/page.mdx +295 -0
- package/template-assets/documentation/sdk/settings/page.mdx +155 -0
- package/template-assets/documentation/sdk/ui-components/page.mdx +268 -0
- package/template-assets/managed/.airjam/ai-pack.json +209 -0
- package/template-assets/managed/docs/airjam/agent-gold-path.md +115 -0
- package/template-assets/managed/docs/airjam/agent-mcp.md +179 -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 +104 -0
- package/template-assets/managed/docs/airjam/development-loop.md +51 -0
- package/template-assets/managed/docs/airjam/docs-index.md +64 -0
- package/template-assets/managed/docs/airjam/generated/architecture.md +223 -0
- package/template-assets/managed/docs/airjam/generated/assets-and-theme.md +188 -0
- package/template-assets/managed/docs/airjam/generated/controller-ui.md +102 -0
- package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +165 -0
- package/template-assets/managed/docs/airjam/generated/for-agents.md +123 -0
- package/template-assets/managed/docs/airjam/generated/game-ideas.md +107 -0
- package/template-assets/managed/docs/airjam/generated/host-system.md +261 -0
- package/template-assets/managed/docs/airjam/generated/input-system.md +241 -0
- package/template-assets/managed/docs/airjam/generated/introduction.md +195 -0
- package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +674 -0
- package/template-assets/managed/docs/airjam/generated/networked-state.md +298 -0
- package/template-assets/managed/docs/airjam/generated/project-structure.md +171 -0
- package/template-assets/managed/docs/airjam/generated/quick-start.md +311 -0
- package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +430 -0
- package/template-assets/managed/docs/airjam/generated/settings.md +158 -0
- package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +80 -0
- package/template-assets/managed/docs/airjam/generated/supported-agents.md +21 -0
- package/template-assets/managed/docs/airjam/generated/ui-components.md +265 -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 +212 -0
- package/template-assets/managed/docs/airjam/preview-controllers.md +129 -0
- package/template-assets/managed/docs/airjam/r3f-3d-scene.md +163 -0
- package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +101 -0
- package/template-assets/managed/docs/airjam/visual-system.md +103 -0
|
@@ -0,0 +1,179 @@
|
|
|
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.
|
|
136
|
+
|
|
137
|
+
## One game declaration
|
|
138
|
+
|
|
139
|
+
Read `airjam.inspect_game` for the versioned `declaration`, including
|
|
140
|
+
`declaration.agent`, controls, controller path and metadata. The game's
|
|
141
|
+
`src/airjam.config.ts` exports `airjam = defineAirJamGame(...)` from
|
|
142
|
+
`@air-jam/sdk/core`; agent helpers also come from core. Keep React, the SDK
|
|
143
|
+
root, TSX and CSS out of its graph. `app.tsx` alone binds it with
|
|
144
|
+
`createAirJamApp(airjam, { runtime })`.
|
|
145
|
+
|
|
146
|
+
Capacity comes from `metadata.maxPlayers`. The `testing` path names a module
|
|
147
|
+
exporting `testing = defineAirJamTesting({ player, profiles, visual })` from
|
|
148
|
+
`@air-jam/devtools/testing`. Profiles author scripted policies only; a declared
|
|
149
|
+
player is offered as the reserved `model` policy in every profile. Optional
|
|
150
|
+
`visual.scenarios` uses the game's declared agent. A profile's `setup` brings
|
|
151
|
+
the room to where its test starts; its `handBack` returns the creator's room,
|
|
152
|
+
usually with `return_to_lobby`, once the test ends and before its players
|
|
153
|
+
leave, so the game never plays on without them. Profiles that join play already
|
|
154
|
+
under way hand it back too. Declare `handBack: []` only when the game has no
|
|
155
|
+
phase to leave, such as a shared counter; a missing one is reported as
|
|
156
|
+
`undeclared` in the run record. Do not duplicate identity in template flags or read config source with
|
|
157
|
+
regular expressions.
|
|
158
|
+
|
|
159
|
+
## Declared settings
|
|
160
|
+
|
|
161
|
+
Declare creator tuning values with `defineAirJamSettings` and `setting` from
|
|
162
|
+
`@air-jam/sdk/core`, in the game declaration's `settings` field. Remove the
|
|
163
|
+
constants they replace. Read values in simulation create/step/observe contexts
|
|
164
|
+
and typed action contexts; host rendering uses `useAirJamSettings`. Controllers
|
|
165
|
+
show copies in replicated state. Lobby player choices stay store state.
|
|
166
|
+
|
|
167
|
+
Inspect descriptors in `airjam.inspect_game` → `declaration.settings`.
|
|
168
|
+
Use `airjam.read_game_settings({ gameSessionId })` for live values and revision,
|
|
169
|
+
then `airjam.update_game_settings({ gameSessionId, patch, expectedRevision })`
|
|
170
|
+
under host authority. Only `live: true` values can change; non-live values go
|
|
171
|
+
in `airjam.start_game_run({ settings, ... })` for a fresh room. Stale revisions
|
|
172
|
+
require a fresh read. Input log version 2 records initial values and ordered
|
|
173
|
+
settings updates for replay. See `docs/airjam/generated/settings.md`.
|
|
174
|
+
|
|
175
|
+
Declared assets and theme are read through `airjam.inspect_game` in
|
|
176
|
+
`declaration.assets` and `declaration.theme`. Keep sounds, images and loaded
|
|
177
|
+
files in `defineAirJamAssets`, colours and font families in `defineAirJamTheme`,
|
|
178
|
+
and pass both to `defineAirJamGame`. The React binding owns audio mounts and
|
|
179
|
+
theme CSS variables; games consume the declared objects and never duplicate them.
|
|
@@ -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,104 @@
|
|
|
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
|
+
## Decision-model Playtesting
|
|
69
|
+
|
|
70
|
+
Declare an `AirJamPlayerContract` from `@air-jam/devtools/testing` with `brief`
|
|
71
|
+
and `turn`. Return `{ state, question, options }` with 1 to 16 named options,
|
|
72
|
+
each carrying `when` and `control`, or `null` when the seat has nothing to do.
|
|
73
|
+
Zero options is invalid. A single sensible move, such as joining a lobby, is
|
|
74
|
+
allowed: the run owner takes that option's control directly with no model call
|
|
75
|
+
or cost. Do not add a fake alternative. Multiple options ask the model to choose.
|
|
76
|
+
The trace keeps the choice and control with the note `Only option; no model
|
|
77
|
+
asked.`; the seat's optional `answers.automatic` count distinguishes these
|
|
78
|
+
automatic answers in the run record.
|
|
79
|
+
|
|
80
|
+
In Studio, `studio_press_phone` taps, holds or types on one named mounted Studio phone
|
|
81
|
+
and returns its private screen in the same call. Coordinates are fractions 0..1 of
|
|
82
|
+
`studio_observe_current_game`'s `surface=phone` image. Tap a field before typing;
|
|
83
|
+
a hold captures while pressed, then releases. Reuse the requestId UUID for retries.
|
|
84
|
+
Guest/real phones and older runtimes return an explicit unavailable reason.
|
|
85
|
+
|
|
86
|
+
## Starter Template Testing Pattern
|
|
87
|
+
|
|
88
|
+
If the project ships the starter testing layout, keep using it:
|
|
89
|
+
|
|
90
|
+
1. `tests/game/domain/` for pure gameplay rules
|
|
91
|
+
2. `tests/game/stores/` for pure state transitions
|
|
92
|
+
3. `tests/game/engine/` for focused runtime helpers
|
|
93
|
+
4. `tests/game/adapters/` for host/controller or transport-facing mapping
|
|
94
|
+
5. `tests/game/ui/` for shared game-facing UI primitives that can be validated without full app shells
|
|
95
|
+
|
|
96
|
+
Default order:
|
|
97
|
+
|
|
98
|
+
1. write the pure test first
|
|
99
|
+
2. add adapter or shared UI coverage second
|
|
100
|
+
3. add heavier integration tests only when the boundary really requires them
|
|
101
|
+
|
|
102
|
+
## Architecture Consequence
|
|
103
|
+
|
|
104
|
+
If game logic is too entangled with React, rendering, or transport to test cleanly, that usually means the structure should be improved.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Development Loop
|
|
2
|
+
|
|
3
|
+
Use this as the default implementation loop.
|
|
4
|
+
|
|
5
|
+
## 1. Pick Scope
|
|
6
|
+
|
|
7
|
+
1. define the concrete behavior you want to change
|
|
8
|
+
2. inspect the current structure before writing code
|
|
9
|
+
3. decide whether the task fits the current boundaries or needs a refactor first
|
|
10
|
+
|
|
11
|
+
## 2. Read The Right Guidance
|
|
12
|
+
|
|
13
|
+
1. read the relevant local docs page
|
|
14
|
+
2. use the Air Jam MCP first when the task fits Air Jam-native devtools flows such as project inspection, logs, or quality gates
|
|
15
|
+
3. read the matching skill only if the task fits that skill boundary
|
|
16
|
+
4. if the scaffold template includes a concrete example map in its `README.md`, inspect the starter modules it points to before inventing a new location for the work
|
|
17
|
+
5. if Claude Code Desktop preview launches the app, use the committed `.claude/launch.json`; for other browser tools that ask for a command, use `pnpm run dev`; do not use raw `vite`
|
|
18
|
+
6. 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
|
|
19
|
+
|
|
20
|
+
## 3. Implement Minimal Correct Changes
|
|
21
|
+
|
|
22
|
+
1. prefer the smallest safe change
|
|
23
|
+
2. do not layer hacks on top of weak structure
|
|
24
|
+
3. keep using the established starter module boundaries when they already fit the task
|
|
25
|
+
4. refactor first when the current shape is the real problem
|
|
26
|
+
|
|
27
|
+
## 4. Keep Notes Intentional
|
|
28
|
+
|
|
29
|
+
1. keep durable notes only when they help the work survive the current chat
|
|
30
|
+
2. create a focused plan document only for multi-step work that truly needs it
|
|
31
|
+
3. do not add root-level planning files unless the user asks for them
|
|
32
|
+
|
|
33
|
+
## 5. Validate
|
|
34
|
+
|
|
35
|
+
Run the checks that match the change:
|
|
36
|
+
|
|
37
|
+
1. typecheck
|
|
38
|
+
2. lint
|
|
39
|
+
3. tests
|
|
40
|
+
4. build
|
|
41
|
+
|
|
42
|
+
When the Air Jam MCP is available, prefer its quality-gate tools before ad hoc shell commands.
|
|
43
|
+
|
|
44
|
+
## 6. Update Contracts
|
|
45
|
+
|
|
46
|
+
If behavior or canonical patterns changed:
|
|
47
|
+
|
|
48
|
+
1. update docs in the same change
|
|
49
|
+
2. keep examples and scaffolding aligned
|
|
50
|
+
3. if you are unsure whether the local AI pack matches the provenance-backed snapshot in the installed CLI, compare it with `pnpm exec airjam ai-pack status --dir .` or `pnpm exec airjam ai-pack diff --dir .`
|
|
51
|
+
4. use `pnpm exec airjam ai-pack update --dir .` for a newer installed pack, or `pnpm exec airjam ai-pack repair --dir .` to restore same-version drift; these commands never own or overwrite project instructions, project-local skills, or user-created notes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Local Docs Index
|
|
2
|
+
|
|
3
|
+
This local docs pack is the first place to look during implementation.
|
|
4
|
+
|
|
5
|
+
It combines:
|
|
6
|
+
|
|
7
|
+
1. generated canonical docs exported from `content/docs`
|
|
8
|
+
2. small local supplements for template-specific operating guidance
|
|
9
|
+
|
|
10
|
+
For broader public framework docs, use the hosted docs site after checking these local files first.
|
|
11
|
+
|
|
12
|
+
## Generated Canonical Docs
|
|
13
|
+
|
|
14
|
+
1. [For Agents](./generated/for-agents.md)
|
|
15
|
+
2. [Supported Agents](./generated/supported-agents.md)
|
|
16
|
+
3. [Project Structure](./generated/project-structure.md)
|
|
17
|
+
4. [Controller UI](./generated/controller-ui.md)
|
|
18
|
+
5. [State And Rendering](./generated/state-and-rendering.md)
|
|
19
|
+
6. [Introduction](./generated/introduction.md)
|
|
20
|
+
7. [Quick Start](./generated/quick-start.md)
|
|
21
|
+
8. [Architecture](./generated/architecture.md)
|
|
22
|
+
9. [Host System](./generated/host-system.md)
|
|
23
|
+
10. [SDK Hooks](./generated/sdk-hooks.md)
|
|
24
|
+
11. [UI Components](./generated/ui-components.md)
|
|
25
|
+
12. [Input System](./generated/input-system.md)
|
|
26
|
+
13. [Networked State](./generated/networked-state.md)
|
|
27
|
+
14. [Game Settings](./generated/settings.md)
|
|
28
|
+
15. [Game Assets And Theme](./generated/assets-and-theme.md)
|
|
29
|
+
16. [Debugging And Logs](./generated/debugging-and-logs.md)
|
|
30
|
+
17. [Unified Dev Logs](./generated/unified-dev-logs.md)
|
|
31
|
+
18. [Game Ideas](./generated/game-ideas.md)
|
|
32
|
+
19. [Migrating Legacy Games](./generated/migrating-legacy-games.md)
|
|
33
|
+
|
|
34
|
+
## Local Supplements
|
|
35
|
+
|
|
36
|
+
1. [Agent Gold Path](./agent-gold-path.md)
|
|
37
|
+
2. [Development Loop](./development-loop.md)
|
|
38
|
+
3. [Agent MCP](./agent-mcp.md)
|
|
39
|
+
4. [State Lanes Cookbook](./state-lanes-cookbook.md)
|
|
40
|
+
5. [Iconography](./iconography.md)
|
|
41
|
+
6. [Visual System](./visual-system.md)
|
|
42
|
+
7. [Composition Shell Contract](./composition-shell-contract.md)
|
|
43
|
+
8. [Debug And Testing](./debug-and-testing.md)
|
|
44
|
+
9. [Prefab Authoring](./prefab-authoring.md)
|
|
45
|
+
10. [R3F 3D Scene](./r3f-3d-scene.md)
|
|
46
|
+
11. [Canvas 2D Gameplay](./canvas-2d-gameplay.md)
|
|
47
|
+
12. [Preview Controllers](./preview-controllers.md)
|
|
48
|
+
|
|
49
|
+
## Hosted Canonical Docs
|
|
50
|
+
|
|
51
|
+
1. [Introduction](https://airjam.io/docs/getting-started/introduction)
|
|
52
|
+
2. [Quick Start](https://airjam.io/docs/getting-started/quick-start)
|
|
53
|
+
3. [Architecture](https://airjam.io/docs/how-it-works/architecture)
|
|
54
|
+
4. [Host System](https://airjam.io/docs/how-it-works/host-system)
|
|
55
|
+
5. [SDK Hooks](https://airjam.io/docs/sdk/hooks)
|
|
56
|
+
6. [Input System](https://airjam.io/docs/sdk/input-system)
|
|
57
|
+
7. [Networked State](https://airjam.io/docs/sdk/networked-state)
|
|
58
|
+
|
|
59
|
+
## Usage Rule
|
|
60
|
+
|
|
61
|
+
1. if you are an agent starting a real task, read `docs/airjam/agent-gold-path.md` first
|
|
62
|
+
2. use generated canonical docs for framework guidance
|
|
63
|
+
3. use local supplements for project operating rules and template-specific patterns
|
|
64
|
+
4. use hosted docs when you need broader framework detail or newer canonical public guidance
|