@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,170 @@
|
|
|
1
|
+
# Project Structure
|
|
2
|
+
|
|
3
|
+
Air Jam games should not grow as one large React surface.
|
|
4
|
+
|
|
5
|
+
The clean default is a boundary-first structure where host logic, controller logic, pure game rules, and framework integration do not collapse into the same modules.
|
|
6
|
+
|
|
7
|
+
## Framework Recommendation
|
|
8
|
+
|
|
9
|
+
Move toward a structure like this:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
src/
|
|
13
|
+
host/
|
|
14
|
+
controller/
|
|
15
|
+
game/
|
|
16
|
+
domain/
|
|
17
|
+
engine/
|
|
18
|
+
systems/
|
|
19
|
+
adapters/
|
|
20
|
+
ui/
|
|
21
|
+
debug/
|
|
22
|
+
shared/
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The exact folder names can vary slightly, but the boundaries should stay clear.
|
|
26
|
+
|
|
27
|
+
This is a framework-level recommendation about ownership boundaries, not a requirement that every Air Jam game use the exact same filenames.
|
|
28
|
+
|
|
29
|
+
## Boundary Rules
|
|
30
|
+
|
|
31
|
+
### `src/host/`
|
|
32
|
+
|
|
33
|
+
Owns host-only composition and shell behavior.
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
|
|
37
|
+
1. host screens
|
|
38
|
+
2. room and join presentation
|
|
39
|
+
3. host-facing overlays
|
|
40
|
+
4. host runtime composition
|
|
41
|
+
|
|
42
|
+
### `src/controller/`
|
|
43
|
+
|
|
44
|
+
Owns controller-only composition and touch interactions.
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
|
|
48
|
+
1. lobby controls
|
|
49
|
+
2. gameplay controls
|
|
50
|
+
3. controller status surfaces
|
|
51
|
+
4. controller-specific UI hooks
|
|
52
|
+
|
|
53
|
+
### `src/game/domain/`
|
|
54
|
+
|
|
55
|
+
Owns pure gameplay rules, math, and types.
|
|
56
|
+
|
|
57
|
+
Examples:
|
|
58
|
+
|
|
59
|
+
1. score rules
|
|
60
|
+
2. win conditions
|
|
61
|
+
3. team assignment helpers
|
|
62
|
+
4. deterministic state transitions
|
|
63
|
+
|
|
64
|
+
This layer should stay testable without React or rendering.
|
|
65
|
+
|
|
66
|
+
### `src/game/engine/`
|
|
67
|
+
|
|
68
|
+
Owns runtime orchestration.
|
|
69
|
+
|
|
70
|
+
Examples:
|
|
71
|
+
|
|
72
|
+
1. ticking
|
|
73
|
+
2. lifecycle transitions
|
|
74
|
+
3. update ordering
|
|
75
|
+
4. system composition
|
|
76
|
+
|
|
77
|
+
### `src/game/systems/`
|
|
78
|
+
|
|
79
|
+
Owns focused gameplay systems when the game has enough scope to justify them.
|
|
80
|
+
|
|
81
|
+
Examples:
|
|
82
|
+
|
|
83
|
+
1. spawning
|
|
84
|
+
2. combat
|
|
85
|
+
3. pickups
|
|
86
|
+
4. abilities
|
|
87
|
+
5. scoring
|
|
88
|
+
|
|
89
|
+
### `src/game/adapters/`
|
|
90
|
+
|
|
91
|
+
Owns integration with frameworks and runtime services.
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
|
|
95
|
+
1. Air Jam SDK integration
|
|
96
|
+
2. R3F integration
|
|
97
|
+
3. physics integration
|
|
98
|
+
4. audio integration
|
|
99
|
+
5. network and runtime bridges
|
|
100
|
+
|
|
101
|
+
Keep adapters thin. They should connect systems, not become the real game model.
|
|
102
|
+
|
|
103
|
+
### `src/game/ui/`
|
|
104
|
+
|
|
105
|
+
Owns reusable game-facing UI modules.
|
|
106
|
+
|
|
107
|
+
Examples:
|
|
108
|
+
|
|
109
|
+
1. score displays
|
|
110
|
+
2. status strips
|
|
111
|
+
3. overlays
|
|
112
|
+
4. icon wrappers
|
|
113
|
+
|
|
114
|
+
### `tests/`
|
|
115
|
+
|
|
116
|
+
Owns behavior-focused validation for the boundaries above.
|
|
117
|
+
|
|
118
|
+
Examples:
|
|
119
|
+
|
|
120
|
+
1. `tests/game/domain/` for pure rule tests
|
|
121
|
+
2. `tests/game/stores/` for pure state-transition tests
|
|
122
|
+
3. `tests/game/engine/` for focused runtime helper tests
|
|
123
|
+
4. `tests/game/adapters/` for transport-facing mapping and boundary tests
|
|
124
|
+
5. `tests/game/ui/` for shared game-facing UI primitives that can be validated without full app shells
|
|
125
|
+
|
|
126
|
+
## Starter Template Reference
|
|
127
|
+
|
|
128
|
+
The starter Pong template is the current best starter implementation of those boundaries.
|
|
129
|
+
|
|
130
|
+
It is a recommended reference, not a framework API.
|
|
131
|
+
|
|
132
|
+
Its useful starter modules look like:
|
|
133
|
+
|
|
134
|
+
1. `src/host/index.tsx` for host surface composition
|
|
135
|
+
2. `src/controller/index.tsx` for controller flow and input cadence
|
|
136
|
+
3. `src/game/stores/pong-store.ts` for networked store wiring
|
|
137
|
+
4. `src/game/stores/pong-store-state.ts` for pure state transitions
|
|
138
|
+
5. `src/game/engine/simulation.ts` for runtime orchestration
|
|
139
|
+
6. `src/game/engine/runtime-state.ts` for hot mutable runtime values
|
|
140
|
+
7. `src/game/adapters/controller-signals.ts` for host-to-controller transport-facing mapping
|
|
141
|
+
8. `src/game/ui/` for reusable game-facing presentation primitives shared by host and controller
|
|
142
|
+
9. `src/game/prefabs/arena/` for a folder-per-prefab contract with metadata, schema, preview, and runtime composition helper
|
|
143
|
+
10. `tests/game/` for the starter testing pattern that mirrors those same boundaries
|
|
144
|
+
|
|
145
|
+
If a starter module already demonstrates the boundary you need, extend it instead of introducing a second competing pattern.
|
|
146
|
+
If your game genuinely needs a different folder or module shape, preserve the boundary intent rather than copying Pong mechanically.
|
|
147
|
+
|
|
148
|
+
### `src/game/debug/`
|
|
149
|
+
|
|
150
|
+
Owns debug helpers and overlays.
|
|
151
|
+
|
|
152
|
+
Keep debug features removable and out of gameplay hot paths.
|
|
153
|
+
|
|
154
|
+
## Decision Rule
|
|
155
|
+
|
|
156
|
+
When adding code, ask:
|
|
157
|
+
|
|
158
|
+
1. is this pure game logic
|
|
159
|
+
2. is this runtime orchestration
|
|
160
|
+
3. is this framework integration
|
|
161
|
+
4. is this host-only or controller-only
|
|
162
|
+
|
|
163
|
+
Put the code where the answer is clearest.
|
|
164
|
+
|
|
165
|
+
## Refactor Rule
|
|
166
|
+
|
|
167
|
+
If a new feature would force host, controller, domain, and rendering concerns into one file, fix the boundary first or split the work into:
|
|
168
|
+
|
|
169
|
+
1. structural cleanup
|
|
170
|
+
2. feature implementation
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# State and Rendering
|
|
2
|
+
|
|
3
|
+
Air Jam projects often combine React, Zustand, per-frame gameplay logic, and sometimes R3F or Three.
|
|
4
|
+
|
|
5
|
+
That stack works well only when state ownership is explicit.
|
|
6
|
+
|
|
7
|
+
## Core State Rules
|
|
8
|
+
|
|
9
|
+
1. keep authoritative gameplay state separate from local UI state
|
|
10
|
+
2. avoid one mega store for unrelated concerns
|
|
11
|
+
3. use narrow selectors when consuming Zustand state
|
|
12
|
+
4. keep store writes intentional and coarse
|
|
13
|
+
5. keep per-frame mutable values out of React state when React rendering is not needed
|
|
14
|
+
|
|
15
|
+
These are framework-level rules about ownership and performance.
|
|
16
|
+
They do not require one exact store or engine file layout.
|
|
17
|
+
|
|
18
|
+
## React Rules
|
|
19
|
+
|
|
20
|
+
1. do not run simulation through React rerenders
|
|
21
|
+
2. keep business logic out of presentational components
|
|
22
|
+
3. use refs for hot mutable runtime values
|
|
23
|
+
4. keep component boundaries small and purposeful
|
|
24
|
+
|
|
25
|
+
## Starter Template Reference
|
|
26
|
+
|
|
27
|
+
The starter Pong template demonstrates one good starter implementation of the state/rendering split:
|
|
28
|
+
|
|
29
|
+
1. `src/game/stores/pong-store.ts` owns Air Jam store wiring
|
|
30
|
+
2. `src/game/stores/pong-store-state.ts` owns pure state transitions
|
|
31
|
+
3. `src/game/engine/runtime-state.ts` owns per-frame mutable values
|
|
32
|
+
4. `src/game/engine/simulation.ts` owns update ordering and orchestration
|
|
33
|
+
5. `src/game/ui/` owns reusable game-facing presentation that host and controller surfaces can share
|
|
34
|
+
|
|
35
|
+
That split is a recommended starter pattern, not a mandatory framework contract.
|
|
36
|
+
If the game needs a different module layout, preserve the same ownership boundaries rather than copying the filenames literally.
|
|
37
|
+
|
|
38
|
+
## Starter Testing Pattern
|
|
39
|
+
|
|
40
|
+
The starter template also mirrors those boundaries in tests:
|
|
41
|
+
|
|
42
|
+
1. `tests/game/domain/` for pure gameplay rules
|
|
43
|
+
2. `tests/game/stores/` for pure state transitions
|
|
44
|
+
3. `tests/game/engine/` for focused runtime helpers
|
|
45
|
+
4. `tests/game/adapters/` for transport-facing mapping
|
|
46
|
+
5. `tests/game/ui/` for shared game-facing UI modules that do not require full host/controller shells
|
|
47
|
+
|
|
48
|
+
The default order is:
|
|
49
|
+
|
|
50
|
+
1. test pure logic first
|
|
51
|
+
2. test thin adapter boundaries second
|
|
52
|
+
3. add heavier runtime or browser-facing coverage only where the integration boundary actually matters
|
|
53
|
+
|
|
54
|
+
## R3F and Three Rules
|
|
55
|
+
|
|
56
|
+
1. avoid rerendering scene components on every frame
|
|
57
|
+
2. mutate refs in frame loops when visual updates do not require React state
|
|
58
|
+
3. keep rendering integration separate from pure game rules
|
|
59
|
+
4. use instancing when repeated objects justify it
|
|
60
|
+
|
|
61
|
+
## Air Jam Lane Rules
|
|
62
|
+
|
|
63
|
+
Keep the framework lanes separate:
|
|
64
|
+
|
|
65
|
+
1. input lane for high-frequency player control input
|
|
66
|
+
2. replicated state lane for replayable shared truth
|
|
67
|
+
3. signal lane for coarse UX and system events
|
|
68
|
+
|
|
69
|
+
Do not use replicated store actions as a substitute for per-frame input handling.
|
|
70
|
+
|
|
71
|
+
## Common Pitfalls
|
|
72
|
+
|
|
73
|
+
1. putting gameplay logic directly in render components
|
|
74
|
+
2. using React state as the simulation engine
|
|
75
|
+
3. selecting whole stores across many components
|
|
76
|
+
4. mixing debug state into hot runtime paths
|
|
77
|
+
5. solving every state problem with more component state
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Supported Agents
|
|
2
|
+
|
|
3
|
+
Any coding agent that can run terminal commands or start a local stdio MCP
|
|
4
|
+
server can build with Air Jam. Tested means the agent made a game through Air
|
|
5
|
+
Jam's CLI and MCP, played it with two phones and released it.
|
|
6
|
+
|
|
7
|
+
| Agent | Status | Notes |
|
|
8
|
+
| ---------------------------------- | ---------------------- | --------------------------------------- |
|
|
9
|
+
| Codex CLI | Tested | |
|
|
10
|
+
| Claude Code | Tested | |
|
|
11
|
+
| T3 Code | Tested | |
|
|
12
|
+
| Codex app, over SSH | Covered by Codex CLI | Runs the same `codex` program |
|
|
13
|
+
| Claude Desktop Code tab, over SSH | Covered by Claude Code | Runs the same `claude` program |
|
|
14
|
+
| Claude Desktop chat | Not for building | Cannot edit project files |
|
|
15
|
+
| Other terminal or stdio MCP agents | Not tested | Expected to work through the CLI or MCP |
|
|
16
|
+
|
|
17
|
+
Air Jam supports its own CLI and MCP, not the agent's interface. To connect an
|
|
18
|
+
agent, see [For Agents](/docs/for-agents).
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Debugging and Logs
|
|
2
|
+
|
|
3
|
+
When local Air Jam development breaks, the fastest fix is usually knowing which surface is failing:
|
|
4
|
+
|
|
5
|
+
1. game host
|
|
6
|
+
2. controller
|
|
7
|
+
3. local Air Jam server
|
|
8
|
+
4. Arcade embed/runtime wiring
|
|
9
|
+
|
|
10
|
+
This page explains the practical debugging loop.
|
|
11
|
+
|
|
12
|
+
## The Canonical Stream
|
|
13
|
+
|
|
14
|
+
Before you start jumping between browser tabs and terminals, remember that Air Jam has one canonical local dev stream:
|
|
15
|
+
|
|
16
|
+
- [.airjam/logs/dev-latest.ndjson](/docs/getting-started/dev-logs)
|
|
17
|
+
|
|
18
|
+
That stream is the intended first place to inspect issues that cross:
|
|
19
|
+
|
|
20
|
+
1. server lifecycle
|
|
21
|
+
2. host runtime
|
|
22
|
+
3. controller runtime
|
|
23
|
+
4. embedded runtime edges
|
|
24
|
+
|
|
25
|
+
Read the dedicated guide here:
|
|
26
|
+
|
|
27
|
+
1. [Unified Dev Logs](/docs/getting-started/dev-logs)
|
|
28
|
+
|
|
29
|
+
## 1. Start With The Canonical Local Loop
|
|
30
|
+
|
|
31
|
+
For scaffolded games, the default local command is:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm run dev
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
That gives you the most useful first signal:
|
|
38
|
+
|
|
39
|
+
1. server logs in the same terminal
|
|
40
|
+
2. Vite host output
|
|
41
|
+
3. QR/join flow using the same local runtime shape the template expects
|
|
42
|
+
|
|
43
|
+
If that terminal is not healthy, fix it before debugging the controller UI.
|
|
44
|
+
|
|
45
|
+
## 2. Check The Local Server First
|
|
46
|
+
|
|
47
|
+
The local server should answer:
|
|
48
|
+
|
|
49
|
+
[http://localhost:4000/health](http://localhost:4000/health)
|
|
50
|
+
|
|
51
|
+
If `/health` is down:
|
|
52
|
+
|
|
53
|
+
1. your local runtime server is not running
|
|
54
|
+
2. the game will not create or join rooms
|
|
55
|
+
3. controller QR flow will fail no matter what the UI shows
|
|
56
|
+
|
|
57
|
+
## 3. Know Which Console To Inspect
|
|
58
|
+
|
|
59
|
+
Use the right browser console for the right problem:
|
|
60
|
+
|
|
61
|
+
1. **Host tab** for room creation, host bootstrap, input consumption, and gameplay errors
|
|
62
|
+
2. **Controller tab/phone remote inspector** for join failures, input publishing, haptics, and controller UI state
|
|
63
|
+
3. **Server terminal** for room lifecycle, dropped connections, refused hosts and phones
|
|
64
|
+
|
|
65
|
+
Do not debug everything from only one surface.
|
|
66
|
+
|
|
67
|
+
## 4. Common Failure Buckets
|
|
68
|
+
|
|
69
|
+
### Host boots but no room appears
|
|
70
|
+
|
|
71
|
+
Check:
|
|
72
|
+
|
|
73
|
+
1. server terminal is running
|
|
74
|
+
2. host browser console has no bootstrap/config errors
|
|
75
|
+
3. `VITE_AIR_JAM_SERVER_URL` is correct for your environment
|
|
76
|
+
4. production/static deploy has a valid `VITE_AIR_JAM_APP_ID`
|
|
77
|
+
|
|
78
|
+
### Controller cannot join
|
|
79
|
+
|
|
80
|
+
Check:
|
|
81
|
+
|
|
82
|
+
1. QR or join URL contains the right room code
|
|
83
|
+
2. host and controller are talking to the same server origin
|
|
84
|
+
3. SPA rewrites are enabled for `/controller?room=XXXX`
|
|
85
|
+
4. phone can actually reach the host URL you are showing
|
|
86
|
+
|
|
87
|
+
If local phone testing is the issue, use:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm run dev -- --secure
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Input arrives late or not at all
|
|
94
|
+
|
|
95
|
+
Check:
|
|
96
|
+
|
|
97
|
+
1. the game declares its controls with `defineAirJamGame({ input })`
|
|
98
|
+
2. the controller renders the SDK's phone controls bound to those controls
|
|
99
|
+
3. the simulation reads them in its step with `input(playerId)`
|
|
100
|
+
4. you are not trying to send per-frame input through store actions
|
|
101
|
+
5. the dev log shows no `AJ_INPUT_INVALID` diagnostic
|
|
102
|
+
|
|
103
|
+
### Store actions do nothing
|
|
104
|
+
|
|
105
|
+
Check:
|
|
106
|
+
|
|
107
|
+
1. actions are dispatched via `gameStore.actions` and the store is declared in `defineAirJamGame({ stores })`
|
|
108
|
+
2. payloads are plain serializable objects
|
|
109
|
+
3. your controller is connected before dispatching
|
|
110
|
+
4. identity-dependent actions use `ctx.actorId` on the host side
|
|
111
|
+
|
|
112
|
+
### Arcade embed works in standalone but breaks in platform
|
|
113
|
+
|
|
114
|
+
Check:
|
|
115
|
+
|
|
116
|
+
1. game code is not parsing Arcade runtime params directly
|
|
117
|
+
2. gameplay state lives in the game's own store, not in local iframe lifecycle state
|
|
118
|
+
3. you are treating the bridge as transport only, not as app-state truth
|
|
119
|
+
|
|
120
|
+
## 5. Use SDK Diagnostics In Development
|
|
121
|
+
|
|
122
|
+
Air Jam exposes structured diagnostics for common misuse paths:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { onAirJamDiagnostic, setAirJamDiagnosticsEnabled } from "@air-jam/sdk";
|
|
126
|
+
|
|
127
|
+
setAirJamDiagnosticsEnabled(true);
|
|
128
|
+
|
|
129
|
+
const unsubscribe = onAirJamDiagnostic((diagnostic) => {
|
|
130
|
+
console.log(diagnostic.code, diagnostic.message, diagnostic.details);
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
This is especially useful for:
|
|
135
|
+
|
|
136
|
+
1. missing provider/session scope
|
|
137
|
+
2. invalid input payload shape
|
|
138
|
+
3. state-action dispatch before session readiness
|
|
139
|
+
4. runtime config mistakes
|
|
140
|
+
|
|
141
|
+
## 6. Use The Reference Games As Sanity Checks
|
|
142
|
+
|
|
143
|
+
If you are unsure whether the framework or your game is the problem, compare your approach against:
|
|
144
|
+
|
|
145
|
+
1. `pong` for the small canonical starter path
|
|
146
|
+
2. `air-capture` for the heavier reference-app path
|
|
147
|
+
|
|
148
|
+
If your code disagrees with both patterns, your code is probably the outlier.
|
|
149
|
+
|
|
150
|
+
## 7. Query The Unified Stream
|
|
151
|
+
|
|
152
|
+
Scaffolded games should use:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
pnpm exec air-jam-server logs
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Inside the Air Jam monorepo, the equivalent maintainer command is:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
pnpm run repo -- workspace logs
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Both commands read the same canonical local observability model.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Unified Dev Logs
|
|
2
|
+
|
|
3
|
+
Air Jam has one canonical local observability stream for development:
|
|
4
|
+
|
|
5
|
+
- server logs
|
|
6
|
+
- host runtime logs
|
|
7
|
+
- controller runtime logs
|
|
8
|
+
- embedded runtime diagnostics
|
|
9
|
+
- local dev-runner tool output such as Vite and other child-process failures
|
|
10
|
+
|
|
11
|
+
That stream exists so you do not have to debug each surface in isolation.
|
|
12
|
+
|
|
13
|
+
## Canonical File
|
|
14
|
+
|
|
15
|
+
The canonical file is:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
.airjam/logs/dev-latest.ndjson
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This file is:
|
|
22
|
+
|
|
23
|
+
1. local-first
|
|
24
|
+
2. append-only for the current server run
|
|
25
|
+
3. reset when the Air Jam server process starts
|
|
26
|
+
|
|
27
|
+
That means it is the right place to inspect:
|
|
28
|
+
|
|
29
|
+
1. room lifecycle
|
|
30
|
+
2. host bootstrap and reconnect
|
|
31
|
+
3. controller join and disconnect flow
|
|
32
|
+
4. browser/runtime diagnostics that were mirrored back to the server
|
|
33
|
+
|
|
34
|
+
## What Writes Into It
|
|
35
|
+
|
|
36
|
+
During normal Air Jam development:
|
|
37
|
+
|
|
38
|
+
1. the Air Jam server writes structured server events into the file
|
|
39
|
+
2. the SDK browser log sink mirrors host and controller browser/runtime logs into the same file
|
|
40
|
+
3. the standard dev runners mirror local child-process output into the same file as `workspace` events
|
|
41
|
+
|
|
42
|
+
If you use the standard Air Jam server and standard SDK session providers in development, this happens automatically.
|
|
43
|
+
|
|
44
|
+
No extra logging setup should be required for the normal path.
|
|
45
|
+
|
|
46
|
+
## When It Resets
|
|
47
|
+
|
|
48
|
+
The file resets when the Air Jam server process starts.
|
|
49
|
+
|
|
50
|
+
That gives you a clean current-session stream by default.
|
|
51
|
+
|
|
52
|
+
One nuance matters:
|
|
53
|
+
|
|
54
|
+
If your dev workflow reuses an already-running local server process, the file will not reset until that server actually restarts.
|
|
55
|
+
|
|
56
|
+
## Read It Two Ways
|
|
57
|
+
|
|
58
|
+
### 1. Preferred: CLI Querying
|
|
59
|
+
|
|
60
|
+
Use the published server CLI first.
|
|
61
|
+
|
|
62
|
+
Examples:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pnpm exec air-jam-server logs --view=signal
|
|
66
|
+
pnpm exec air-jam-server logs
|
|
67
|
+
pnpm exec air-jam-server logs --follow
|
|
68
|
+
pnpm exec air-jam-server logs --trace=host_abc123
|
|
69
|
+
pnpm exec air-jam-server logs --source=browser --level=warn
|
|
70
|
+
pnpm exec air-jam-server logs --view=signal --room=ROOM1
|
|
71
|
+
pnpm exec air-jam-server logs --source=workspace --process=platform --view=signal
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The intended Air Jam workflow is:
|
|
75
|
+
|
|
76
|
+
1. start with `pnpm exec air-jam-server logs --view=signal`
|
|
77
|
+
2. narrow to the failing trace, room, controller, runtime, or process
|
|
78
|
+
3. only add custom logging if the stream still does not explain the issue
|
|
79
|
+
|
|
80
|
+
### 2. Fallback: Read The File Directly
|
|
81
|
+
|
|
82
|
+
Direct file reads are also valid.
|
|
83
|
+
|
|
84
|
+
That is useful when:
|
|
85
|
+
|
|
86
|
+
1. the repo does not yet expose the convenience CLI
|
|
87
|
+
2. you are using your own tooling
|
|
88
|
+
3. an LLM or script wants the raw NDJSON stream
|
|
89
|
+
|
|
90
|
+
## Best Filters
|
|
91
|
+
|
|
92
|
+
The most useful filters are:
|
|
93
|
+
|
|
94
|
+
1. `traceId` for one host session story
|
|
95
|
+
2. `roomId` for one multiplayer room
|
|
96
|
+
3. `controllerId` for one player/controller path
|
|
97
|
+
4. `event` for one lifecycle edge
|
|
98
|
+
5. `runtimeKind` and `runtimeEpoch` for embedded bridge/runtime issues
|
|
99
|
+
6. `processName` via `--process` for one local dev process such as `platform`, `server`, or the active game
|
|
100
|
+
|
|
101
|
+
In practice, the fastest loop is usually:
|
|
102
|
+
|
|
103
|
+
1. reproduce the issue
|
|
104
|
+
2. find the relevant `traceId`, `roomId`, or `controllerId`
|
|
105
|
+
3. inspect the rest of the stream through that lens
|
|
106
|
+
|
|
107
|
+
## Which Identifier To Reach For First
|
|
108
|
+
|
|
109
|
+
Use the narrowest identifier that matches the failure:
|
|
110
|
+
|
|
111
|
+
1. use `traceId` when the problem is mainly one host session story:
|
|
112
|
+
host bootstrap, reconnect, room ownership, launch flow
|
|
113
|
+
2. use `roomId` when multiple surfaces are involved in one room and you want the whole multiplayer story
|
|
114
|
+
3. use `controllerId` when one player path is failing:
|
|
115
|
+
join, disconnect, input, action RPC, targeted controller feedback
|
|
116
|
+
4. use `runtimeKind` and `runtimeEpoch` when debugging embedded bridge/runtime activation problems
|
|
117
|
+
5. use `event` when you already know the lifecycle edge you are hunting
|
|
118
|
+
|
|
119
|
+
If you are unsure, start with `roomId` or `traceId` and then narrow further.
|
|
120
|
+
|
|
121
|
+
## Signal View Vs Raw NDJSON
|
|
122
|
+
|
|
123
|
+
Use `--view=signal` when:
|
|
124
|
+
|
|
125
|
+
1. you want the fastest first read of the session
|
|
126
|
+
2. you care about lifecycle edges, accepted/rejected outcomes, and high-signal runtime events
|
|
127
|
+
3. you want to suppress low-value framework/browser console noise
|
|
128
|
+
|
|
129
|
+
Read raw NDJSON or use broader CLI filters when:
|
|
130
|
+
|
|
131
|
+
1. you need exact append order
|
|
132
|
+
2. you need the full event payloads and metadata
|
|
133
|
+
3. you suspect the hidden plumbing events are part of the problem
|
|
134
|
+
4. you are doing deeper agent/script analysis over the stream
|
|
135
|
+
|
|
136
|
+
The practical rule is:
|
|
137
|
+
|
|
138
|
+
1. start with `pnpm exec air-jam-server logs --view=signal`
|
|
139
|
+
2. narrow with `--trace`, `--room`, `--controller`, `--runtime`, `--process`, or `--source`
|
|
140
|
+
3. fall back to raw NDJSON only when the signal view is still insufficient
|
|
141
|
+
|
|
142
|
+
## Recommended Debug Order
|
|
143
|
+
|
|
144
|
+
When something breaks:
|
|
145
|
+
|
|
146
|
+
1. inspect the canonical dev log stream first
|
|
147
|
+
2. use SDK diagnostics second
|
|
148
|
+
3. add temporary custom logs only if the canonical stream still leaves a gap
|
|
149
|
+
|
|
150
|
+
Do not default to scattered `console.log` calls across host, controller, and server code.
|
|
151
|
+
|
|
152
|
+
Air Jam is specifically designed to avoid that debugging style.
|
|
153
|
+
|
|
154
|
+
## Important Exceptions
|
|
155
|
+
|
|
156
|
+
The automatic unified stream depends on the standard development path.
|
|
157
|
+
|
|
158
|
+
You should not assume full automatic coverage when:
|
|
159
|
+
|
|
160
|
+
1. running `--web-only` without a local Air Jam server
|
|
161
|
+
2. disabling the collector explicitly
|
|
162
|
+
3. replacing the standard server/runtime path with custom infrastructure
|
|
163
|
+
4. bypassing the standard dev runner and launching tools outside the Air Jam scripts
|
|
164
|
+
|
|
165
|
+
## Related Docs
|
|
166
|
+
|
|
167
|
+
1. [Debugging and Logs](/docs/getting-started/debugging)
|
|
168
|
+
2. [For Agents](/docs/for-agents)
|
|
169
|
+
3. [Host System](/docs/how-it-works/host-system)
|