@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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +145 -2
  3. package/bin/airjam.mjs +66 -0
  4. package/dist/ai-pack.d.ts +44 -0
  5. package/dist/ai-pack.js +15 -0
  6. package/dist/ai-pack.js.map +1 -0
  7. package/dist/chunk-A4V2N4LX.js +938 -0
  8. package/dist/chunk-A4V2N4LX.js.map +1 -0
  9. package/dist/chunk-J5MAU4QZ.js +102 -0
  10. package/dist/chunk-J5MAU4QZ.js.map +1 -0
  11. package/dist/chunk-N7AI7HZK.js +529 -0
  12. package/dist/chunk-N7AI7HZK.js.map +1 -0
  13. package/dist/development.d.ts +98 -0
  14. package/dist/development.js +33 -0
  15. package/dist/development.js.map +1 -0
  16. package/dist/documentation.d.ts +27 -0
  17. package/dist/documentation.js +7 -0
  18. package/dist/documentation.js.map +1 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +2184 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/scaffold.d.ts +6 -0
  23. package/dist/scaffold.js +20 -0
  24. package/dist/scaffold.js.map +1 -0
  25. package/package.json +78 -3
  26. package/runtime/local-network.d.mts +8 -0
  27. package/runtime/local-network.mjs +9 -0
  28. package/runtime/vite-config.d.mts +42 -0
  29. package/runtime/vite-config.mjs +130 -0
  30. package/runtime/vite-https.d.mts +11 -0
  31. package/runtime/vite-https.mjs +41 -0
  32. package/template-assets/bootstrap/.claude/launch.json +12 -0
  33. package/template-assets/bootstrap/AGENTS.md +248 -0
  34. package/template-assets/bootstrap/CLAUDE.md +63 -0
  35. package/template-assets/bootstrap/_gitignore +6 -0
  36. package/template-assets/bootstrap/skills/airjam-docs-workflow/SKILL.md +49 -0
  37. package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +56 -0
  38. package/template-assets/bootstrap/skills/canvas-2d-gameplay/SKILL.md +47 -0
  39. package/template-assets/bootstrap/skills/controller-ui/SKILL.md +69 -0
  40. package/template-assets/bootstrap/skills/debug-and-test/SKILL.md +72 -0
  41. package/template-assets/bootstrap/skills/game-architecture/SKILL.md +58 -0
  42. package/template-assets/bootstrap/skills/game-state-and-rendering/SKILL.md +44 -0
  43. package/template-assets/bootstrap/skills/host-surface/SKILL.md +52 -0
  44. package/template-assets/bootstrap/skills/index.md +36 -0
  45. package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +48 -0
  46. package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +51 -0
  47. package/template-assets/documentation/for-agents/controller-ui/page.mdx +60 -0
  48. package/template-assets/documentation/for-agents/page.mdx +98 -0
  49. package/template-assets/documentation/for-agents/project-structure/page.mdx +172 -0
  50. package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +79 -0
  51. package/template-assets/documentation/getting-started/debugging/page.mdx +165 -0
  52. package/template-assets/documentation/getting-started/dev-logs/page.mdx +171 -0
  53. package/template-assets/documentation/getting-started/game-ideas/page.mdx +116 -0
  54. package/template-assets/documentation/getting-started/introduction/page.mdx +183 -0
  55. package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +427 -0
  56. package/template-assets/documentation/getting-started/quick-start/page.mdx +333 -0
  57. package/template-assets/documentation/how-it-works/architecture/page.mdx +189 -0
  58. package/template-assets/documentation/how-it-works/host-system/page.mdx +267 -0
  59. package/template-assets/documentation/manifest.json +430 -0
  60. package/template-assets/documentation/sdk/hooks/page.mdx +500 -0
  61. package/template-assets/documentation/sdk/input-system/page.mdx +270 -0
  62. package/template-assets/documentation/sdk/networked-state/page.mdx +213 -0
  63. package/template-assets/documentation/sdk/ui-components/page.mdx +227 -0
  64. package/template-assets/managed/.airjam/ai-pack.json +191 -0
  65. package/template-assets/managed/docs/airjam/agent-gold-path.md +67 -0
  66. package/template-assets/managed/docs/airjam/agent-mcp.md +135 -0
  67. package/template-assets/managed/docs/airjam/canvas-2d-gameplay.md +82 -0
  68. package/template-assets/managed/docs/airjam/composition-shell-contract.md +87 -0
  69. package/template-assets/managed/docs/airjam/debug-and-testing.md +86 -0
  70. package/template-assets/managed/docs/airjam/development-loop.md +51 -0
  71. package/template-assets/managed/docs/airjam/docs-index.md +58 -0
  72. package/template-assets/managed/docs/airjam/generated/architecture.md +178 -0
  73. package/template-assets/managed/docs/airjam/generated/controller-ui.md +61 -0
  74. package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +164 -0
  75. package/template-assets/managed/docs/airjam/generated/for-agents.md +99 -0
  76. package/template-assets/managed/docs/airjam/generated/game-ideas.md +107 -0
  77. package/template-assets/managed/docs/airjam/generated/host-system.md +251 -0
  78. package/template-assets/managed/docs/airjam/generated/input-system.md +260 -0
  79. package/template-assets/managed/docs/airjam/generated/introduction.md +175 -0
  80. package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +426 -0
  81. package/template-assets/managed/docs/airjam/generated/networked-state.md +214 -0
  82. package/template-assets/managed/docs/airjam/generated/project-structure.md +171 -0
  83. package/template-assets/managed/docs/airjam/generated/quick-start.md +334 -0
  84. package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +490 -0
  85. package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +80 -0
  86. package/template-assets/managed/docs/airjam/generated/ui-components.md +222 -0
  87. package/template-assets/managed/docs/airjam/generated/unified-dev-logs.md +170 -0
  88. package/template-assets/managed/docs/airjam/iconography.md +55 -0
  89. package/template-assets/managed/docs/airjam/prefab-authoring.md +112 -0
  90. package/template-assets/managed/docs/airjam/preview-controllers.md +126 -0
  91. package/template-assets/managed/docs/airjam/r3f-3d-scene.md +97 -0
  92. package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +106 -0
  93. package/template-assets/managed/docs/airjam/visual-system.md +103 -0
@@ -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,58 @@
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. [Project Structure](./generated/project-structure.md)
16
+ 3. [Controller UI](./generated/controller-ui.md)
17
+ 4. [State And Rendering](./generated/state-and-rendering.md)
18
+ 5. [Introduction](./generated/introduction.md)
19
+ 6. [Quick Start](./generated/quick-start.md)
20
+ 7. [Architecture](./generated/architecture.md)
21
+ 8. [Host System](./generated/host-system.md)
22
+ 9. [SDK Hooks](./generated/sdk-hooks.md)
23
+ 10. [Input System](./generated/input-system.md)
24
+ 11. [Networked State](./generated/networked-state.md)
25
+ 12. [Debugging And Logs](./generated/debugging-and-logs.md)
26
+ 13. [Unified Dev Logs](./generated/unified-dev-logs.md)
27
+
28
+ ## Local Supplements
29
+
30
+ 1. [Agent Gold Path](./agent-gold-path.md)
31
+ 2. [Development Loop](./development-loop.md)
32
+ 3. [Agent MCP](./agent-mcp.md)
33
+ 4. [State Lanes Cookbook](./state-lanes-cookbook.md)
34
+ 5. [Iconography](./iconography.md)
35
+ 6. [Visual System](./visual-system.md)
36
+ 7. [Composition Shell Contract](./composition-shell-contract.md)
37
+ 8. [Debug And Testing](./debug-and-testing.md)
38
+ 9. [Prefab Authoring](./prefab-authoring.md)
39
+ 10. [R3F 3D Scene](./r3f-3d-scene.md)
40
+ 11. [Canvas 2D Gameplay](./canvas-2d-gameplay.md)
41
+ 12. [Preview Controllers](./preview-controllers.md)
42
+
43
+ ## Hosted Canonical Docs
44
+
45
+ 1. [Introduction](https://airjam.io/docs/getting-started/introduction)
46
+ 2. [Quick Start](https://airjam.io/docs/getting-started/quick-start)
47
+ 3. [Architecture](https://airjam.io/docs/how-it-works/architecture)
48
+ 4. [Host System](https://airjam.io/docs/how-it-works/host-system)
49
+ 5. [SDK Hooks](https://airjam.io/docs/sdk/hooks)
50
+ 6. [Input System](https://airjam.io/docs/sdk/input-system)
51
+ 7. [Networked State](https://airjam.io/docs/sdk/networked-state)
52
+
53
+ ## Usage Rule
54
+
55
+ 1. if you are an agent starting a real task, read `docs/airjam/agent-gold-path.md` first
56
+ 2. use generated canonical docs for framework guidance
57
+ 3. use local supplements for project operating rules and template-specific patterns
58
+ 4. use hosted docs when you need broader framework detail or newer canonical public guidance
@@ -0,0 +1,178 @@
1
+ <!-- Generated from content/docs/how-it-works/architecture/page.mdx. Do not edit directly. -->
2
+ <!-- Canonical public doc: https://airjam.io/docs/how-it-works/architecture -->
3
+
4
+ # Architecture
5
+
6
+ Air Jam's open framework has three core components: the room server, game SDK,
7
+ and creator harness. Reference games show how they work together for multiplayer
8
+ gaming with smartphone controllers.
9
+
10
+ The important current rule is that Air Jam has one framework model, not one model for standalone games and a different model for Arcade.
11
+
12
+ Arcade is an Air Jam app around another Air Jam app.
13
+
14
+ ## Components
15
+
16
+ The Arcade and Studio at [airjam.io](https://airjam.io) are a separately operated
17
+ product, not an application in this public repository. Their hosted services
18
+ compose the same open runtime; standalone games need neither that product nor
19
+ its database. The diagrams include hosted surfaces to show how embedding works.
20
+
21
+ ### 1. Server (`packages/server`)
22
+
23
+ **Role:** Real-time communication backbone
24
+
25
+ **Technology:** Node.js, Express, Socket.IO
26
+
27
+ **Core Services:**
28
+
29
+ **Socket Events:**
30
+
31
+ ### 2. SDK (`packages/sdk`)
32
+
33
+ **Role:** Developer toolkit for building Air Jam games
34
+
35
+ **Technology:** React, TypeScript, Socket.IO Client, Zustand, Zod
36
+
37
+ **Architecture:**
38
+
39
+ **Key Design Decisions:**
40
+
41
+ 1. **Provider Pattern** - Single provider for configuration, multiple hooks for access
42
+ 2. **Lightweight Hooks** - `useGetInput`, `useSendSignal` don't trigger re-renders
43
+ 3. **Input Latching** - Ensures rapid button taps are never missed
44
+ 4. **Schema Validation** - Type-safe input with runtime validation
45
+
46
+ ### 3. Creator Harness
47
+
48
+ The public CLI, MCP server and harness packages support project creation,
49
+ development, semantic game sessions, visual inspection and release preparation.
50
+ The same contracts work with external agents and the managed Studio; creator
51
+ tools do not depend on private application source.
52
+
53
+ ### Reference Game: Air Capture (`games/air-capture`)
54
+
55
+ **Role:** Reference implementation showcasing SDK capabilities
56
+
57
+ **Technology:** React, Vite, React Three Fiber, Rapier Physics
58
+
59
+ **Demonstrates:**
60
+
61
+ - Host-side game logic with physics
62
+ - Controller UI with joystick and buttons
63
+ - Player spawning/despawning on join/leave
64
+ - Haptic feedback on collisions
65
+ - Multiple game modes (CTF, survival)
66
+
67
+ ## Core Lane Model
68
+
69
+ Air Jam uses three lanes and they should stay separate:
70
+
71
+ 1. **Input lane** for high-frequency transient control data via `useInputWriter` and `getInput` / `useGetInput`
72
+ 2. **Replicated state lane** for replayable shared state via `createAirJamStore`
73
+ 3. **Signal / command lane** for coarse UX/runtime messages such as haptics, toasts, pause, and exit
74
+
75
+ This is the same model in standalone games and in Arcade-embedded games.
76
+
77
+ ## Run Modes
78
+
79
+ The SDK automatically detects and adapts to different deployment scenarios:
80
+
81
+ ### Standalone Mode
82
+
83
+ Your game runs independently with direct WebSocket connection.
84
+
85
+ ```
86
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
87
+ │ Your Game │◀───▶│ AirJam │◀───▶│ Controller │
88
+ │ (Host) │ │ Server │ │ (Phone) │
89
+ └──────────────┘ └──────────────┘ └──────────────┘
90
+ ```
91
+
92
+ **Use case:** Self-hosted games, development, custom deployments
93
+
94
+ ### Arcade Mode
95
+
96
+ Game runs inside an iframe on the Air Jam Platform.
97
+
98
+ ```
99
+ ┌─────────────────────────────────────────┐
100
+ │ Air Jam Platform (Parent) │
101
+ │ ┌───────────────────────────────────┐ │
102
+ │ │ Your Game (iframe) │ │
103
+ │ │ • Receives launch capability │ │
104
+ │ │ • Controlled player routing │ │
105
+ │ └───────────────────────────────────┘ │
106
+ └─────────────────────────────────────────┘
107
+ ```
108
+
109
+ **Use case:** Featured on Air Jam arcade, game discovery
110
+
111
+ ### Bridge Mode
112
+
113
+ Controller runs inside platform's runtime wrapper (iframe communication).
114
+
115
+ ```
116
+ ┌─────────────────────────────────────────┐
117
+ │ Platform Controller Runtime (Parent) │
118
+ │ ┌───────────────────────────────────┐ │
119
+ │ │ Your Controller UI (iframe) │ │
120
+ │ │ • Input via postMessage │ │
121
+ │ │ • Seamless game switching │ │
122
+ │ └───────────────────────────────────┘ │
123
+ └─────────────────────────────────────────┘
124
+ ```
125
+
126
+ **Use case:** Arcade mode controllers, persistent session
127
+
128
+ ### Input Path (Controller → Game)
129
+
130
+ ```
131
+ 1. Player moves joystick on phone
132
+ 2. Controller publishes input via useInputWriter({ vector: {x, y}, action: false })
133
+ 3. SDK sends controller:input event to server
134
+ 4. Server routes to host socket
135
+ 5. Host SDK's InputManager receives input
136
+ 6. InputManager validates with Zod schema
137
+ 7. InputManager applies configured input behavior (`pulse`, `hold`, `latest`)
138
+ 8. Game calls getInput(playerId) in game loop
139
+ 9. Returns typed, validated input with behavior semantics applied
140
+ ```
141
+
142
+ ### Signal Path (Game → Controller)
143
+
144
+ ```
145
+ 1. Game detects collision
146
+ 2. Host calls sendSignal("HAPTIC", { pattern: "heavy" }, playerId)
147
+ 3. SDK sends host:signal event to server
148
+ 4. Server routes to target controller(s)
149
+ 5. Controller SDK receives signal
150
+ 6. SDK triggers navigator.vibrate() with pattern
151
+ 7. Player feels haptic feedback
152
+ ```
153
+
154
+ ### Host Bootstrap
155
+
156
+ - Hosts perform one `host:bootstrap` verification step in production/static mode
157
+ - In normal static mode, the server validates the browser-facing `appId` once, then binds host authority to the socket
158
+ - Static apps can optionally restrict bootstrap by allowed origin per app identity
159
+ - In optional signed mode, the SDK first fetches a short-lived host grant from `hostGrantEndpoint`, then bootstraps with that grant instead of raw `appId`
160
+ - Later host lifecycle events rely on socket authority instead of repeated raw auth payloads
161
+
162
+ ### Child Launch Capability
163
+
164
+ - Arcade game launch issues a room/game-scoped `launchCapability`
165
+ - Embedded host iframes receive `aj_cap` / `aj_cap_exp` automatically
166
+ - Game code does not parse or manage this capability directly
167
+
168
+ ### Room Isolation
169
+
170
+ - Each room has unique 4-character code
171
+ - Controllers can only join with correct code
172
+ - Input is only routed to the designated host
173
+
174
+ ### Input Validation
175
+
176
+ - Zod schemas validate all incoming input
177
+ - Invalid input is rejected with console warning
178
+ - Protects game logic from malformed data
@@ -0,0 +1,61 @@
1
+ <!-- Generated from content/docs/for-agents/controller-ui/page.mdx. Do not edit directly. -->
2
+ <!-- Canonical public doc: https://airjam.io/docs/for-agents/controller-ui -->
3
+
4
+ # Controller UI
5
+
6
+ Controller UI should feel like a game controller first and a webpage second.
7
+
8
+ The main failure mode is borrowing desktop web-app patterns for active gameplay surfaces.
9
+
10
+ ## Gameplay Controller Rules
11
+
12
+ For active gameplay:
13
+
14
+ 1. use an absolute `inset-0` root
15
+ 2. avoid scroll
16
+ 3. disable accidental text selection
17
+ 4. use large touch targets
18
+ 5. keep controls visually obvious and single-purpose
19
+ 6. minimize text and dense hierarchy
20
+
21
+ ## Lobby Rules
22
+
23
+ Lobby screens can be slightly more flexible, but should still prefer:
24
+
25
+ 1. simple layout
26
+ 2. large controls
27
+ 3. minimal friction
28
+ 4. scroll only when it actually helps the flow
29
+
30
+ ## Interaction Rules
31
+
32
+ Avoid:
33
+
34
+ 1. tiny toggles
35
+ 2. multi-purpose buttons with unclear affordance
36
+ 3. deeply nested control groups
37
+ 4. layouts that assume precise pointer interaction
38
+
39
+ ## Visual Rules
40
+
41
+ Prefer:
42
+
43
+ 1. sparse game-like hierarchy
44
+ 2. fluid layout over hard-coded widths and heights
45
+ 3. obvious action grouping
46
+ 4. strong contrast and immediate readability
47
+
48
+ Avoid:
49
+
50
+ 1. card-heavy dashboard styling for active gameplay
51
+ 2. emoji-as-icon UI
52
+ 3. cluttered web-app chrome
53
+
54
+ ## Icon Rule
55
+
56
+ For template and starter work, a practical split is:
57
+
58
+ 1. a general UI and system icon pack for shell actions
59
+ 2. a gameplay-oriented icon set for abilities, pickups, and status effects
60
+
61
+ Keep icon usage behind local wrappers where practical so the project can curate or replace icons later.
@@ -0,0 +1,164 @@
1
+ <!-- Generated from content/docs/getting-started/debugging/page.mdx. Do not edit directly. -->
2
+ <!-- Canonical public doc: https://airjam.io/docs/getting-started/debugging -->
3
+
4
+ # Debugging and Logs
5
+
6
+ When local Air Jam development breaks, the fastest fix is usually knowing which surface is failing:
7
+
8
+ 1. game host
9
+ 2. controller
10
+ 3. local Air Jam server
11
+ 4. Arcade embed/runtime wiring
12
+
13
+ This page explains the practical debugging loop.
14
+
15
+ ## The Canonical Stream
16
+
17
+ Before you start jumping between browser tabs and terminals, remember that Air Jam has one canonical local dev stream:
18
+
19
+ - [.airjam/logs/dev-latest.ndjson](./unified-dev-logs.md)
20
+
21
+ That stream is the intended first place to inspect issues that cross:
22
+
23
+ 1. server lifecycle
24
+ 2. host runtime
25
+ 3. controller runtime
26
+ 4. embedded runtime edges
27
+
28
+ Read the dedicated guide here:
29
+
30
+ 1. [Unified Dev Logs](./unified-dev-logs.md)
31
+
32
+ ## 1. Start With The Canonical Local Loop
33
+
34
+ For scaffolded games, the default local command is:
35
+
36
+ ```bash
37
+ pnpm run dev
38
+ ```
39
+
40
+ That gives you the most useful first signal:
41
+
42
+ 1. server logs in the same terminal
43
+ 2. Vite host output
44
+ 3. QR/join flow using the same local runtime shape the template expects
45
+
46
+ If that terminal is not healthy, fix it before debugging the controller UI.
47
+
48
+ ## 2. Check The Local Server First
49
+
50
+ The local server should answer:
51
+
52
+ [http://localhost:4000/health](http://localhost:4000/health)
53
+
54
+ If `/health` is down:
55
+
56
+ 1. your local runtime server is not running
57
+ 2. the game will not create or join rooms
58
+ 3. controller QR flow will fail no matter what the UI shows
59
+
60
+ ## 3. Know Which Console To Inspect
61
+
62
+ Use the right browser console for the right problem:
63
+
64
+ 1. **Host tab** for room creation, host bootstrap, input consumption, and gameplay errors
65
+ 2. **Controller tab/phone remote inspector** for join failures, input publishing, haptics, and controller UI state
66
+ 3. **Server terminal** for room lifecycle, socket disconnects, auth/bootstrap problems, and routing issues
67
+
68
+ Do not debug everything from only one surface.
69
+
70
+ ### Host boots but no room appears
71
+
72
+ Check:
73
+
74
+ 1. server terminal is running
75
+ 2. host browser console has no bootstrap/config errors
76
+ 3. `VITE_AIR_JAM_SERVER_URL` is correct for your environment
77
+ 4. production/static deploy has a valid `VITE_AIR_JAM_APP_ID`
78
+
79
+ ### Controller cannot join
80
+
81
+ Check:
82
+
83
+ 1. QR or join URL contains the right room code
84
+ 2. host and controller are talking to the same server origin
85
+ 3. SPA rewrites are enabled for `/controller?room=XXXX`
86
+ 4. phone can actually reach the host URL you are showing
87
+
88
+ If local phone testing is the issue, use:
89
+
90
+ ```bash
91
+ pnpm run dev -- --secure
92
+ ```
93
+
94
+ ### Input arrives late or not at all
95
+
96
+ Check:
97
+
98
+ 1. controller is publishing input via `useControllerTick` + `useInputWriter`
99
+ 2. host is reading input via `getInput` or `useGetInput`
100
+ 3. you are not trying to send per-frame input through store actions
101
+ 4. the input schema still matches the payload shape
102
+
103
+ ### Store actions do nothing
104
+
105
+ Check:
106
+
107
+ 1. actions are dispatched via `useActions()`
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,99 @@
1
+ <!-- Generated from content/docs/for-agents/page.mdx. Do not edit directly. -->
2
+ <!-- Canonical public doc: https://airjam.io/docs/for-agents -->
3
+
4
+ # For Agents
5
+
6
+ This page is the fastest entrypoint for LLM agents and automation tools.
7
+
8
+ ## What Air Jam Is
9
+
10
+ Air Jam is an open AI-native framework for multiplayer games controlled by
11
+ phones.
12
+ Hosts run in your game, inputs are routed through the Air Jam server, and both
13
+ humans and agents work against typed controller, runtime, state, and release
14
+ surfaces instead of guessing through UI only.
15
+
16
+ Air Jam is the harness around your existing coding agent, not a separate hosted
17
+ editor. Local project instructions, CLI commands, MCP tools, runtime observations,
18
+ and hosted release services form one development path.
19
+
20
+ ## Connect to a Project
21
+
22
+ Run these commands from a generated game project with dependencies installed:
23
+
24
+ ```bash
25
+ pnpm exec airjam --help
26
+ pnpm exec airjam mcp doctor --dir . --json
27
+ pnpm exec airjam mcp config --profile portable --dir .
28
+ ```
29
+
30
+ New projects include `.mcp.json`. If a project has no declaration, use
31
+ `pnpm exec airjam mcp init --dir .`; it does not overwrite an existing declaration
32
+ unless you explicitly pass `--force`.
33
+
34
+ Some clients use their own registration formats instead of reading `.mcp.json`:
35
+
36
+ ```bash
37
+ pnpm exec airjam mcp config --profile codex --dir .
38
+ pnpm exec airjam mcp config --profile claude-desktop --dir .
39
+ ```
40
+
41
+ These commands render configuration; they do not install it into the client.
42
+ Use the rendered command, arguments, and absolute project directory when adding
43
+ the server. `mcp doctor` distinguishes project declarations from detected client
44
+ registrations. Confirm that the connected client discovers Air Jam's tools before
45
+ treating the connection as working.
46
+
47
+ ## Operate and Evaluate
48
+
49
+ For gameplay assertions, use `airjam.open_game_session`,
50
+ `airjam.read_game_session`, `airjam.invoke_game_session_action`, and
51
+ `airjam.close_game_session`. Read each session's published actions and state;
52
+ do not guess game-specific action IDs. `airjam.capture_game_session_visuals`
53
+ adds host and phone-controller screenshots to the same session.
54
+
55
+ MCP is optional. A terminal agent can use the same services:
56
+
57
+ ```bash
58
+ pnpm exec airjam session open --dir .
59
+ pnpm exec airjam session read <session-id> --dir .
60
+ pnpm exec airjam session invoke <session-id> <action-id> --payload '{}'
61
+ pnpm exec airjam session capture <session-id> --dir .
62
+ pnpm exec airjam session close <session-id> --dir .
63
+ ```
64
+
65
+ A session starts or reuses the canonical development process. If you start it
66
+ yourself, use `pnpm run dev`, not raw Vite. Use semantic state for repeatable
67
+ gameplay checks and rendered screenshots or browser interaction for visual polish.
68
+ During editing, run the relevant focused checks. Before sharing a completed game,
69
+ run `pnpm exec airjam evaluate --dir .` or the `airjam.evaluate` tool for the complete
70
+ typecheck, lint, test, and build result.
71
+
72
+ The [Quick Start publishing guide](https://airjam.io/docs/getting-started/quick-start#terminal-or-agent-publishing)
73
+ covers CLI authentication, hosted release submission, inspection, and explicit
74
+ publication. Local development and evaluation do not require hosted publishing.
75
+
76
+ ## Read These First
77
+
78
+ 1. [Introduction](./introduction.md)
79
+ 2. [Quick Start](./quick-start.md)
80
+ 3. [Architecture](./architecture.md)
81
+ 4. [Host System](./host-system.md)
82
+ 5. [Project Structure](./project-structure.md)
83
+ 6. [Controller UI](./controller-ui.md)
84
+ 7. [State and Rendering](./state-and-rendering.md)
85
+ 8. [SDK Hooks](./sdk-hooks.md)
86
+ 9. [Debugging and Logs](./debugging-and-logs.md)
87
+ 10. [Unified Dev Logs](./unified-dev-logs.md)
88
+
89
+ ## SDK Focus Areas
90
+
91
+ - [Input System](./input-system.md)
92
+ - [Networked State](./networked-state.md)
93
+
94
+ ## Machine Discovery
95
+
96
+ - [AI Pack Manifest](/ai-pack/manifest.json)
97
+ - [LLMs Index](https://airjam.io/llms.txt)
98
+ - [Sitemap](https://airjam.io/sitemap.xml)
99
+ - [Robots](https://airjam.io/robots.txt)