@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,290 @@
|
|
|
1
|
+
# Air Jam Project Contract
|
|
2
|
+
|
|
3
|
+
This project is designed to work well with both humans and coding agents.
|
|
4
|
+
|
|
5
|
+
This file and the project-local `skills/` directory are bootstrap-owned: once
|
|
6
|
+
the project is created, they belong to the project and Air Jam updates never
|
|
7
|
+
overwrite them. Canonical framework references live under `docs/airjam/` and
|
|
8
|
+
may be refreshed independently with `airjam ai-pack update`.
|
|
9
|
+
|
|
10
|
+
The goal is not fast messy output.
|
|
11
|
+
|
|
12
|
+
The goal is to keep the game easy to grow, easy to test, and easy to refactor as scope increases.
|
|
13
|
+
|
|
14
|
+
## First Read Order
|
|
15
|
+
|
|
16
|
+
For any non-trivial task, read these in order:
|
|
17
|
+
|
|
18
|
+
1. `docs/airjam/agent-gold-path.md`
|
|
19
|
+
2. `docs/airjam/docs-index.md`
|
|
20
|
+
3. `skills/index.md`
|
|
21
|
+
4. the relevant code you are about to change
|
|
22
|
+
5. the template `README.md` if it includes a concrete starter module map
|
|
23
|
+
|
|
24
|
+
Do not treat chat history as the source of truth for project state.
|
|
25
|
+
|
|
26
|
+
## Core Workflow
|
|
27
|
+
|
|
28
|
+
For meaningful work:
|
|
29
|
+
|
|
30
|
+
1. inspect the existing structure before coding
|
|
31
|
+
2. consult the smallest relevant local docs slice
|
|
32
|
+
3. consult the matching skill only when the task fits that skill boundary
|
|
33
|
+
4. if the repo includes starter modules that already demonstrate the boundary, extend those before creating a new home for the work
|
|
34
|
+
5. refactor first if the requested change clearly does not fit the current structure
|
|
35
|
+
6. implement the smallest correct change
|
|
36
|
+
7. keep durable notes in the user's requested place, or create a focused plan document only when the task genuinely needs one
|
|
37
|
+
8. run relevant validation
|
|
38
|
+
|
|
39
|
+
Package-manager mutations are single-writer operations. Wait for project
|
|
40
|
+
creation and its initial install to finish before inspecting or changing the
|
|
41
|
+
generated dependency graph. Never run concurrent `pnpm install`, `add`,
|
|
42
|
+
`update`, or equivalent commands against the same workspace.
|
|
43
|
+
|
|
44
|
+
## Canonical Local Guidance
|
|
45
|
+
|
|
46
|
+
### `docs/airjam/`
|
|
47
|
+
|
|
48
|
+
This is the local operational docs pack.
|
|
49
|
+
|
|
50
|
+
Use local docs first.
|
|
51
|
+
|
|
52
|
+
If you only need the shortest correct operational path, start with `docs/airjam/agent-gold-path.md` before reading the broader index.
|
|
53
|
+
|
|
54
|
+
Use hosted Air Jam docs only when:
|
|
55
|
+
|
|
56
|
+
1. local docs do not cover the topic
|
|
57
|
+
2. you need the latest canonical public guidance
|
|
58
|
+
3. the task is explicitly about updating or syncing docs
|
|
59
|
+
4. you need to inspect whether the local AI pack is behind the provenance-backed snapshot in the installed CLI via `pnpm exec airjam ai-pack status --dir . --json`
|
|
60
|
+
|
|
61
|
+
### `skills/`
|
|
62
|
+
|
|
63
|
+
These are project-owned local workflow modules.
|
|
64
|
+
|
|
65
|
+
They teach how to work in this repo and are never overwritten by Air Jam
|
|
66
|
+
guidance updates.
|
|
67
|
+
|
|
68
|
+
Do not load all skills for every task.
|
|
69
|
+
|
|
70
|
+
Use the one that matches the current problem.
|
|
71
|
+
|
|
72
|
+
## Air Jam Machine-Operation Rule
|
|
73
|
+
|
|
74
|
+
Use the Air Jam MCP or the canonical `airjam` CLI first for Air Jam-native
|
|
75
|
+
workflows. MCP is the normal lane for MCP-capable clients; the CLI is the
|
|
76
|
+
equivalent terminal-agent lane and is fully discoverable through `--help`.
|
|
77
|
+
|
|
78
|
+
Use these machine surfaces to:
|
|
79
|
+
|
|
80
|
+
1. inspect the project and available games
|
|
81
|
+
2. inspect one game's config and semantic agent contract
|
|
82
|
+
3. read the canonical unified dev logs
|
|
83
|
+
4. start dev, inspect dev status, and inspect runtime topology
|
|
84
|
+
5. read live game-session snapshots and invoke host staging actions when a game exposes them
|
|
85
|
+
6. run focused quality gates
|
|
86
|
+
7. read action metadata before guessing payloads or intended effects
|
|
87
|
+
|
|
88
|
+
MCP-capable clients start with:
|
|
89
|
+
|
|
90
|
+
1. `pnpm exec airjam mcp doctor --dir . --json`
|
|
91
|
+
2. `pnpm exec airjam mcp init --dir . --force` only if you need to repair or regenerate the project-local MCP config
|
|
92
|
+
|
|
93
|
+
Terminal agents can operate the semantic lifecycle directly with:
|
|
94
|
+
|
|
95
|
+
1. `pnpm exec airjam status --dir .`
|
|
96
|
+
2. `pnpm exec airjam dev start --dir .`
|
|
97
|
+
3. `pnpm exec airjam session open --dir .`
|
|
98
|
+
4. `pnpm exec airjam session read <session-id> --dir .`
|
|
99
|
+
5. `pnpm exec airjam session invoke <session-id> <action-id> --payload '{}'`
|
|
100
|
+
6. `pnpm exec airjam session close <session-id> --dir .`
|
|
101
|
+
7. `pnpm exec airjam dev stop --dir .`
|
|
102
|
+
|
|
103
|
+
The local lifecycle commands above return JSON documents. Use ad hoc shell
|
|
104
|
+
logic only when neither the Air Jam MCP nor the `airjam` CLI exposes the needed
|
|
105
|
+
operation.
|
|
106
|
+
|
|
107
|
+
If the current game does not expose the action an agent needs, add a small game-owned host staging action first instead of defaulting to browser-only UI automation.
|
|
108
|
+
|
|
109
|
+
## Browser And Machine Workflow Rule
|
|
110
|
+
|
|
111
|
+
For local host/controller UI work, follow the environment's global browser policy:
|
|
112
|
+
|
|
113
|
+
1. use the Air Jam MCP alongside browser work for logs, topology, host staging actions, runtime inspection, and quality gates
|
|
114
|
+
2. do not treat browser automation as the primary game-control path when a host staging action or semantic game action can express the intent directly
|
|
115
|
+
3. start the app with `pnpm run dev`; do not fall back to raw `vite` or a separate preview-only script
|
|
116
|
+
4. keep host and preview controllers in the same host screen when possible; add multiple preview controllers from the host workspace instead of opening unrelated browser tabs
|
|
117
|
+
5. for visible controller UI smoke tests, interact with preview controllers through real browser click/drag/release gestures; do not synthesize pointer events into controller iframes from parent-page eval
|
|
118
|
+
6. for reliable gameplay, physics, scoring, reset, and state assertions, use the semantic agent contract and Air Jam MCP game-session actions
|
|
119
|
+
7. if local runtime state feels stale, use Air Jam status/log/reset tooling before debugging gameplay code: `pnpm exec airjam status`, `pnpm exec airjam reset local`, and `pnpm exec air-jam-server logs --view=signal`
|
|
120
|
+
8. 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
|
|
121
|
+
|
|
122
|
+
When a clean-slate game stops being trivial:
|
|
123
|
+
|
|
124
|
+
1. add `src/game/contracts/agent.ts` and wire it through `src/airjam.config.ts` `agent` once the game has named phases, semantic actions, or non-trivial lobby/setup rules
|
|
125
|
+
2. prefer these small explicit agent seams over leaving important semantics trapped in UI-only flows
|
|
126
|
+
3. make multiplayer games startable or ready-able from controllers; the host screen should not be the only place where play begins
|
|
127
|
+
|
|
128
|
+
## Game Agent Contract Rule
|
|
129
|
+
|
|
130
|
+
If the template ships `src/game/contracts/agent.ts`, treat that file as the canonical semantic agent surface for the game.
|
|
131
|
+
|
|
132
|
+
Use it before inferring gameplay semantics from raw store domains, controller RPC names, or visible UI.
|
|
133
|
+
|
|
134
|
+
Do not generate a second parallel agent contract when the template already owns one.
|
|
135
|
+
|
|
136
|
+
## Architecture Rules
|
|
137
|
+
|
|
138
|
+
Keep boundaries explicit:
|
|
139
|
+
|
|
140
|
+
1. `src/host/` owns host-only composition
|
|
141
|
+
2. `src/controller/` owns controller-only composition
|
|
142
|
+
3. `src/game/domain/` owns pure game rules and types
|
|
143
|
+
4. `src/game/engine/` owns runtime orchestration
|
|
144
|
+
5. `src/game/adapters/` owns framework and transport integration
|
|
145
|
+
6. `src/game/ui/` owns game-facing UI modules
|
|
146
|
+
7. `src/game/prefabs/` owns reusable authored content with stable metadata and config
|
|
147
|
+
|
|
148
|
+
If the repo still uses an older structure, move toward this model instead of adding more mixed concerns.
|
|
149
|
+
|
|
150
|
+
## State And Rendering Rules
|
|
151
|
+
|
|
152
|
+
1. keep high-frequency input out of replicated store actions
|
|
153
|
+
2. keep authoritative gameplay state separate from local UI state
|
|
154
|
+
3. do not use one mega store for unrelated concerns
|
|
155
|
+
4. use narrow Zustand selectors
|
|
156
|
+
5. keep per-frame runtime values out of React state when React rendering is not needed
|
|
157
|
+
6. use refs for hot mutable values
|
|
158
|
+
7. keep simulation logic out of React render flow
|
|
159
|
+
|
|
160
|
+
### 3D Rule
|
|
161
|
+
|
|
162
|
+
If the project uses R3F or Three:
|
|
163
|
+
|
|
164
|
+
1. keep scene code separate from gameplay rules
|
|
165
|
+
2. establish a deliberate lighting and shadow setup early
|
|
166
|
+
3. keep grounding and placement deterministic
|
|
167
|
+
4. use Rapier only when true physics behavior adds real value
|
|
168
|
+
|
|
169
|
+
### 2D Rule
|
|
170
|
+
|
|
171
|
+
If the project uses canvas:
|
|
172
|
+
|
|
173
|
+
1. keep gameplay rendering in canvas, not DOM layout
|
|
174
|
+
2. keep simulation and drawing separate
|
|
175
|
+
3. keep world units separate from screen and CSS sizing
|
|
176
|
+
4. use generated SVGs only when they are curated into a consistent art language
|
|
177
|
+
|
|
178
|
+
## UI Rules
|
|
179
|
+
|
|
180
|
+
### Controller
|
|
181
|
+
|
|
182
|
+
A game whose `inputModalities` include `'joystick'` always gets a landscape controller; the SDK applies it, so do not set orientation; lay it out with `GamepadLayout` from `@air-jam/sdk/ui`: the stick under the left thumb, the actions under the right in a square the same size, and only short status between them.
|
|
183
|
+
|
|
184
|
+
1. gameplay controller UI should live inside an absolute `inset-0` root
|
|
185
|
+
2. prefer large touch targets
|
|
186
|
+
3. disable accidental text selection
|
|
187
|
+
4. avoid dense dashboard-like layouts
|
|
188
|
+
5. keep controls obvious and simple
|
|
189
|
+
|
|
190
|
+
### Host
|
|
191
|
+
|
|
192
|
+
1. the active game surface should fill an absolute `inset-0` root
|
|
193
|
+
2. avoid accidental overflow
|
|
194
|
+
3. keep overlays separate from gameplay layout
|
|
195
|
+
4. keep host shell modules separate from gameplay viewport modules
|
|
196
|
+
|
|
197
|
+
### Visual Direction
|
|
198
|
+
|
|
199
|
+
1. avoid random HTML clutter
|
|
200
|
+
2. avoid emoji-as-icon UI
|
|
201
|
+
3. prefer fluid layouts over hard-coded sizes
|
|
202
|
+
4. build reusable game UI modules instead of one-off markup
|
|
203
|
+
5. when the template already ships a visual system, extend its theme tokens and semantic utilities before adding new ad hoc styling
|
|
204
|
+
|
|
205
|
+
### Icon Rule
|
|
206
|
+
|
|
207
|
+
Prefer:
|
|
208
|
+
|
|
209
|
+
1. `@tabler/icons-react` for shell, menus, navigation, settings, and system actions
|
|
210
|
+
2. `react-icons` `Gi*` exports for abilities, status effects, pickups, damage types, and other gameplay-facing symbols
|
|
211
|
+
|
|
212
|
+
Do not mix many icon libraries casually.
|
|
213
|
+
|
|
214
|
+
Wrap icon usage behind local UI/game icon modules where practical so the project can swap or curate icons later.
|
|
215
|
+
|
|
216
|
+
## Prefab Rules
|
|
217
|
+
|
|
218
|
+
1. reusable content should live under `src/game/prefabs/`
|
|
219
|
+
2. keep prefab metadata, defaults, and runtime component boundaries clear
|
|
220
|
+
3. keep prefab placement deterministic instead of relying on hand-tuned floating offsets
|
|
221
|
+
4. move larger rules into domain or system modules instead of hiding them inside prefab components
|
|
222
|
+
|
|
223
|
+
## Testing And Debugging Rules
|
|
224
|
+
|
|
225
|
+
1. keep gameplay logic testable without full rendering where practical
|
|
226
|
+
2. add unit or behavior tests when changing real behavior
|
|
227
|
+
3. inspect the canonical Air Jam dev log stream first for multiplayer/runtime issues
|
|
228
|
+
4. start with `pnpm exec air-jam-server logs --view=signal`
|
|
229
|
+
5. narrow with `--trace`, `--room`, `--controller`, `--runtime`, `--process`, or `--source`
|
|
230
|
+
6. prefer `pnpm exec air-jam-server logs`, or read `.airjam/logs/dev-latest.ndjson` directly
|
|
231
|
+
7. remember that `dev-latest.ndjson` resets when the Air Jam server process restarts
|
|
232
|
+
8. use framework diagnostics after the canonical log stream, not instead of it
|
|
233
|
+
9. keep debug helpers isolated from hot gameplay paths
|
|
234
|
+
10. if the local AI workflow files look stale or inconsistent, inspect them with `pnpm exec airjam ai-pack status --dir . --json` and `pnpm exec airjam ai-pack diff --dir . --json`
|
|
235
|
+
11. use `pnpm exec airjam ai-pack update --dir . --json` for a newer installed pack, or `pnpm exec airjam ai-pack repair --dir . --json` to explicitly restore same-version drift; neither command merges local customizations
|
|
236
|
+
|
|
237
|
+
## Escalation Rule
|
|
238
|
+
|
|
239
|
+
If a requested change clearly requires a cleaner boundary, say so directly and do the refactor first or split the work into:
|
|
240
|
+
|
|
241
|
+
1. boundary cleanup
|
|
242
|
+
2. feature implementation
|
|
243
|
+
|
|
244
|
+
Do not preserve a weak structure just because the short-term patch looks smaller.
|
|
245
|
+
|
|
246
|
+
Always suggest the next highest long term value task at the end of your response.
|
|
247
|
+
|
|
248
|
+
## One game declaration
|
|
249
|
+
|
|
250
|
+
Read `airjam.inspect_game` for the versioned `declaration`, including
|
|
251
|
+
`declaration.agent`, controls, controller path and metadata. The game's
|
|
252
|
+
`src/airjam.config.ts` exports `airjam = defineAirJamGame(...)` from
|
|
253
|
+
`@air-jam/sdk/core`; agent helpers also come from core. Keep React, the SDK
|
|
254
|
+
root, TSX and CSS out of its graph. `app.tsx` alone binds it with
|
|
255
|
+
`createAirJamApp(airjam, { runtime })`.
|
|
256
|
+
|
|
257
|
+
Capacity comes from `metadata.maxPlayers`. The `testing` path names a module
|
|
258
|
+
exporting `testing = defineAirJamTesting({ player, profiles, visual })` from
|
|
259
|
+
`@air-jam/devtools/testing`. Profiles author scripted policies only; a declared
|
|
260
|
+
player is offered as the reserved `model` policy in every profile. Optional
|
|
261
|
+
`visual.scenarios` uses the game's declared agent. A profile's `setup` brings
|
|
262
|
+
the room to where its test starts; its `handBack` returns the creator's room,
|
|
263
|
+
usually with `return_to_lobby`, once the test ends and before its players
|
|
264
|
+
leave, so the game never plays on without them. Profiles that join play already
|
|
265
|
+
under way hand it back too. Declare `handBack: []` only when the game has no
|
|
266
|
+
phase to leave, such as a shared counter; a missing one is reported as
|
|
267
|
+
`undeclared` in the run record. Do not duplicate identity in template flags or read config source with
|
|
268
|
+
regular expressions.
|
|
269
|
+
|
|
270
|
+
## Declared settings
|
|
271
|
+
|
|
272
|
+
Declare creator tuning values with `defineAirJamSettings` and `setting` from
|
|
273
|
+
`@air-jam/sdk/core`, in the game declaration's `settings` field. Remove the
|
|
274
|
+
constants they replace. Read values in simulation create/step/observe contexts
|
|
275
|
+
and typed action contexts; host rendering uses `useAirJamSettings`. Controllers
|
|
276
|
+
show copies in replicated state. Lobby player choices stay store state.
|
|
277
|
+
|
|
278
|
+
Inspect descriptors in `airjam.inspect_game` → `declaration.settings`.
|
|
279
|
+
Use `airjam.read_game_settings({ gameSessionId })` for live values and revision,
|
|
280
|
+
then `airjam.update_game_settings({ gameSessionId, patch, expectedRevision })`
|
|
281
|
+
under host authority. Only `live: true` values can change; non-live values go
|
|
282
|
+
in `airjam.start_game_run({ settings, ... })` for a fresh room. Stale revisions
|
|
283
|
+
require a fresh read. Input log version 2 records initial values and ordered
|
|
284
|
+
settings updates for replay. See `docs/airjam/generated/settings.md`.
|
|
285
|
+
|
|
286
|
+
Declared assets and theme are read through `airjam.inspect_game` in
|
|
287
|
+
`declaration.assets` and `declaration.theme`. Keep sounds, images and loaded
|
|
288
|
+
files in `defineAirJamAssets`, colours and font families in `defineAirJamTheme`,
|
|
289
|
+
and pass both to `defineAirJamGame`. The React binding owns audio mounts and
|
|
290
|
+
theme CSS variables; games consume the declared objects and never duplicate them.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Claude Workflow Notes
|
|
2
|
+
|
|
3
|
+
Use the same Air Jam development path as every other agent.
|
|
4
|
+
|
|
5
|
+
## Local Launch
|
|
6
|
+
|
|
7
|
+
Start local development with:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Open the host at `http://localhost:5173`.
|
|
14
|
+
|
|
15
|
+
Do not use raw `vite` for normal Air Jam work. It skips the local Air Jam server.
|
|
16
|
+
|
|
17
|
+
Do not create or prefer a separate preview-specific package script.
|
|
18
|
+
|
|
19
|
+
Use these recovery commands before debugging gameplay code when local runtime state looks stale:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm exec airjam status
|
|
23
|
+
pnpm exec airjam reset local
|
|
24
|
+
pnpm exec air-jam-server logs --view=signal
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
## Preview Controllers
|
|
30
|
+
|
|
31
|
+
Use visible preview controllers in the same host preview screen for UI smoke proof:
|
|
32
|
+
|
|
33
|
+
1. click buttons with real browser clicks
|
|
34
|
+
2. drag controls with real browser drag/release gestures
|
|
35
|
+
3. verify that the controller visually connects and can trigger at least one visible action
|
|
36
|
+
|
|
37
|
+
When you need multiple local players, add multiple preview controllers from the host preview workspace instead of opening unrelated OS browser tabs unless the user explicitly asks for that.
|
|
38
|
+
|
|
39
|
+
Do not synthesize pointer events into controller iframes from parent-page eval. That path is brittle around iframe boundaries, pointer capture, and React event timing.
|
|
40
|
+
|
|
41
|
+
## Gameplay Proof
|
|
42
|
+
|
|
43
|
+
Use the game-owned agent contract for reliable gameplay assertions:
|
|
44
|
+
|
|
45
|
+
1. `airjam.open_game_session`
|
|
46
|
+
2. `airjam.read_game_session`
|
|
47
|
+
3. `airjam.invoke_game_session_action`
|
|
48
|
+
4. `airjam.capture_game_session_visuals`
|
|
49
|
+
5. `airjam.close_game_session`
|
|
50
|
+
|
|
51
|
+
Use semantic actions for gameplay mechanics, physics outcomes, scoring, reset, and state assertions. Preview controllers are for visible UI smoke proof, not the primary automation lane.
|
|
52
|
+
|
|
53
|
+
## Game Authoring Rule
|
|
54
|
+
|
|
55
|
+
Multiplayer games should be controllable from controllers. If a game has a start, ready, reset, or similar primary flow, expose it through controller UI and semantic agent actions. The host screen should not be the only place where play begins.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: airjam-docs-workflow
|
|
3
|
+
description: Use when an Air Jam task needs canonical guidance and you need to know which local docs to read, when hosted docs are appropriate, and how to avoid reading the whole docs tree unnecessarily.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Air Jam Docs Workflow
|
|
7
|
+
|
|
8
|
+
Use this skill when a task touches framework contracts, architecture, canonical patterns, or repo workflow rules.
|
|
9
|
+
|
|
10
|
+
## Read First
|
|
11
|
+
|
|
12
|
+
1. `docs/airjam/docs-index.md`
|
|
13
|
+
2. the smallest local docs page that matches the task
|
|
14
|
+
|
|
15
|
+
## Default Rule
|
|
16
|
+
|
|
17
|
+
Use local docs first.
|
|
18
|
+
|
|
19
|
+
When a canonical docs contract changes, keep the derivative surfaces aligned in the same pass:
|
|
20
|
+
|
|
21
|
+
1. source docs under `content/docs/`
|
|
22
|
+
2. generated scaffold docs under `packages/cli/template-assets/managed/docs/airjam/generated/`
|
|
23
|
+
3. repo-local skills under `packages/cli/template-assets/bootstrap/skills/`
|
|
24
|
+
4. the provenance-backed AI pack snapshot and hosted read-only delivery files generated from those sources
|
|
25
|
+
|
|
26
|
+
Use hosted Air Jam docs only when:
|
|
27
|
+
|
|
28
|
+
1. the local docs pack does not cover the topic
|
|
29
|
+
2. you need broader framework detail
|
|
30
|
+
3. you need newer canonical public guidance
|
|
31
|
+
4. the task is explicitly about syncing or updating docs
|
|
32
|
+
|
|
33
|
+
## Local Docs Triggers
|
|
34
|
+
|
|
35
|
+
Read local docs when:
|
|
36
|
+
|
|
37
|
+
1. creating a new gameplay system
|
|
38
|
+
2. changing state ownership
|
|
39
|
+
3. building controller UI
|
|
40
|
+
4. changing rendering patterns
|
|
41
|
+
5. updating tests or debug structure
|
|
42
|
+
6. deciding where code should live
|
|
43
|
+
|
|
44
|
+
## Anti-Patterns
|
|
45
|
+
|
|
46
|
+
1. reading the entire docs tree for a small task
|
|
47
|
+
2. skipping local docs and jumping straight to remote sources
|
|
48
|
+
3. treating hosted docs as the only source of truth for a scaffolded project
|
|
49
|
+
4. updating source docs but forgetting the generated scaffold/AI-pack surfaces
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: airjam-mcp
|
|
3
|
+
description: Use when operating an Air Jam project through its first-party MCP tools for inspection, development, semantic game sessions, logs, quality gates, and releases.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Air Jam MCP
|
|
7
|
+
|
|
8
|
+
Use this skill when the project includes the Air Jam MCP and the task involves Air Jam-native dev workflows.
|
|
9
|
+
|
|
10
|
+
## Default Order
|
|
11
|
+
|
|
12
|
+
1. inspect the project through the Air Jam MCP first
|
|
13
|
+
2. inspect the relevant game through the Air Jam MCP
|
|
14
|
+
3. read canonical logs through the Air Jam MCP before adding custom logging
|
|
15
|
+
4. run the smallest relevant quality gate through the Air Jam MCP
|
|
16
|
+
5. fall back to shell commands only when the MCP does not expose the required operation
|
|
17
|
+
6. when host staging actions exist, read the published action metadata before guessing payloads
|
|
18
|
+
|
|
19
|
+
## Tool Bias
|
|
20
|
+
|
|
21
|
+
Prefer the Air Jam MCP for:
|
|
22
|
+
|
|
23
|
+
1. project and game inspection
|
|
24
|
+
2. unified dev log reads
|
|
25
|
+
3. dev process start/stop/status
|
|
26
|
+
4. topology inspection
|
|
27
|
+
5. live game-session reads and host staging action invocation
|
|
28
|
+
6. quality gates
|
|
29
|
+
|
|
30
|
+
For terminal-only agents, use the canonical `pnpm exec airjam` equivalents.
|
|
31
|
+
The persistent `airjam session open/read/input/invoke/close` lifecycle exposes
|
|
32
|
+
the same semantic game contract as MCP without requiring a client plugin and
|
|
33
|
+
returns JSON for composition.
|
|
34
|
+
|
|
35
|
+
If the game does not yet expose the control an agent needs, prefer adding a small game-owned host staging action over automating the visible browser UI.
|
|
36
|
+
|
|
37
|
+
If the template ships `src/game/contracts/agent.ts`, treat that file as the canonical semantic agent surface and use the MCP agent tools before inferring raw controller/store semantics.
|
|
38
|
+
|
|
39
|
+
When local UI verification matters, pair the Air Jam MCP with the current agent or client's built-in browser or in-app browser tooling first.
|
|
40
|
+
|
|
41
|
+
If Claude Code Desktop preview launches the app, use the committed `.claude/launch.json`; it runs Air Jam's preview-managed adapter for Claude Preview. If another browser or preview tool wants a launch command, use `pnpm run dev`.
|
|
42
|
+
Do not use raw `vite` for normal Air Jam development because it skips the local Air Jam backend.
|
|
43
|
+
If you need HTTPS/secure dev, use the normal `pnpm run dev -- --secure` flow.
|
|
44
|
+
For Claude Code or similar preview surfaces, keep host and preview controllers in the same visible preview screen when possible. Add multiple preview-controller windows from the host workspace for multiple local players instead of opening unrelated OS browser tabs unless the user asks for tabs.
|
|
45
|
+
For visible controller UI smoke proof, use real browser click/drag/release gestures on preview controllers. Do not synthesize pointer events into controller iframes from parent-page eval.
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
Use secondary browser MCPs such as Chrome DevTools only when that first-party browser tooling is unavailable or when lower-level DOM, network, or performance inspection is required.
|
|
49
|
+
|
|
50
|
+
If a clean-slate project becomes non-trivial, add a small `src/game/contracts/agent.ts` surface and wire it through `src/airjam.config.ts` `agent` before the game's important semantics drift into UI-only flows.
|
|
51
|
+
|
|
52
|
+
Prefer direct shell commands for:
|
|
53
|
+
|
|
54
|
+
1. raw git operations
|
|
55
|
+
2. arbitrary file inspection not covered by the MCP
|
|
56
|
+
3. repo maintenance outside Air Jam devtools boundaries
|
|
57
|
+
|
|
58
|
+
## One game declaration
|
|
59
|
+
|
|
60
|
+
Read `airjam.inspect_game` for the versioned `declaration`, including
|
|
61
|
+
`declaration.agent`, controls, controller path and metadata. The game's
|
|
62
|
+
`src/airjam.config.ts` exports `airjam = defineAirJamGame(...)` from
|
|
63
|
+
`@air-jam/sdk/core`; agent helpers also come from core. Keep React, the SDK
|
|
64
|
+
root, TSX and CSS out of its graph. `app.tsx` alone binds it with
|
|
65
|
+
`createAirJamApp(airjam, { runtime })`.
|
|
66
|
+
|
|
67
|
+
Capacity comes from `metadata.maxPlayers`. The `testing` path names a module
|
|
68
|
+
exporting `testing = defineAirJamTesting({ player, profiles, visual })` from
|
|
69
|
+
`@air-jam/devtools/testing`. Profiles author scripted policies only; a declared
|
|
70
|
+
player is offered as the reserved `model` policy in every profile. Optional
|
|
71
|
+
`visual.scenarios` uses the game's declared agent. A profile's `setup` brings
|
|
72
|
+
the room to where its test starts; its `handBack` returns the creator's room,
|
|
73
|
+
usually with `return_to_lobby`, once the test ends and before its players
|
|
74
|
+
leave, so the game never plays on without them. Profiles that join play already
|
|
75
|
+
under way hand it back too. Declare `handBack: []` only when the game has no
|
|
76
|
+
phase to leave, such as a shared counter; a missing one is reported as
|
|
77
|
+
`undeclared` in the run record. Do not duplicate identity in template flags or read config source with
|
|
78
|
+
regular expressions.
|
|
79
|
+
|
|
80
|
+
## Declared settings
|
|
81
|
+
|
|
82
|
+
Declare creator tuning values with `defineAirJamSettings` and `setting` from
|
|
83
|
+
`@air-jam/sdk/core`, in the game declaration's `settings` field. Remove the
|
|
84
|
+
constants they replace. Read values in simulation create/step/observe contexts
|
|
85
|
+
and typed action contexts; host rendering uses `useAirJamSettings`. Controllers
|
|
86
|
+
show copies in replicated state. Lobby player choices stay store state.
|
|
87
|
+
|
|
88
|
+
Inspect descriptors in `airjam.inspect_game` → `declaration.settings`.
|
|
89
|
+
Use `airjam.read_game_settings({ gameSessionId })` for live values and revision,
|
|
90
|
+
then `airjam.update_game_settings({ gameSessionId, patch, expectedRevision })`
|
|
91
|
+
under host authority. Only `live: true` values can change; non-live values go
|
|
92
|
+
in `airjam.start_game_run({ settings, ... })` for a fresh room. Stale revisions
|
|
93
|
+
require a fresh read. Input log version 2 records initial values and ordered
|
|
94
|
+
settings updates for replay. See `docs/airjam/generated/settings.md`.
|
|
95
|
+
|
|
96
|
+
Declared assets and theme are read through `airjam.inspect_game` in
|
|
97
|
+
`declaration.assets` and `declaration.theme`. Keep sounds, images and loaded
|
|
98
|
+
files in `defineAirJamAssets`, colours and font families in `defineAirJamTheme`,
|
|
99
|
+
and pass both to `defineAirJamGame`. The React binding owns audio mounts and
|
|
100
|
+
theme CSS variables; games consume the declared objects and never duplicate them.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: canvas-2d-gameplay
|
|
3
|
+
description: Use when building or reviewing a 2D Air Jam game with canvas so simulation, rendering, SVG/sprite assets, scaling, and collision stay clean instead of collapsing into DOM-heavy ad hoc logic.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Canvas 2D Gameplay
|
|
7
|
+
|
|
8
|
+
Use this skill for 2D gameplay rendered on canvas.
|
|
9
|
+
|
|
10
|
+
## Read First
|
|
11
|
+
|
|
12
|
+
1. `docs/airjam/canvas-2d-gameplay.md`
|
|
13
|
+
2. `docs/airjam/generated/state-and-rendering.md`
|
|
14
|
+
3. `docs/airjam/generated/project-structure.md`
|
|
15
|
+
|
|
16
|
+
## Core Rule
|
|
17
|
+
|
|
18
|
+
Use canvas as the gameplay render surface, and keep React/DOM for shell UI and overlays.
|
|
19
|
+
|
|
20
|
+
Do not try to run the whole game through DOM layout.
|
|
21
|
+
|
|
22
|
+
## Structure Rules
|
|
23
|
+
|
|
24
|
+
1. keep simulation separate from drawing
|
|
25
|
+
2. keep world coordinates separate from screen and CSS coordinates
|
|
26
|
+
3. keep HUD and menus in reusable UI modules above the canvas
|
|
27
|
+
4. keep input interpretation out of the render code
|
|
28
|
+
|
|
29
|
+
## Asset Rules
|
|
30
|
+
|
|
31
|
+
1. LLM-generated SVGs are fine for icons, pickups, simple props, and UI art if they are cleaned up and curated
|
|
32
|
+
2. keep a consistent visual language across sprites, SVGs, and UI
|
|
33
|
+
3. prefer a small curated asset set over random mixed-generation output
|
|
34
|
+
|
|
35
|
+
## Movement And Collision Rule
|
|
36
|
+
|
|
37
|
+
For most 2D games, prefer simple custom movement and collision before reaching for a heavyweight physics layer.
|
|
38
|
+
|
|
39
|
+
Add a physics engine only when the mechanic truly needs it.
|
|
40
|
+
|
|
41
|
+
## Anti-Patterns
|
|
42
|
+
|
|
43
|
+
1. gameplay logic buried inside draw calls
|
|
44
|
+
2. DOM elements used as the main simulation surface
|
|
45
|
+
3. inconsistent scaling between world units and canvas pixels
|
|
46
|
+
4. random SVGs with mismatched stroke, color, and perspective language
|
|
47
|
+
5. overcomplicated physics for simple arcade movement
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: controller-ui
|
|
3
|
+
description: Use when building or reviewing Air Jam controller surfaces so touch controls stay simple, readable, and game-appropriate instead of drifting into dense web-app UI patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Controller UI
|
|
7
|
+
|
|
8
|
+
Use this skill for controller gameplay and lobby surfaces.
|
|
9
|
+
|
|
10
|
+
## Read First
|
|
11
|
+
|
|
12
|
+
1. `docs/airjam/generated/controller-ui.md`
|
|
13
|
+
2. `docs/airjam/visual-system.md`
|
|
14
|
+
3. `docs/airjam/iconography.md`
|
|
15
|
+
4. `docs/airjam/composition-shell-contract.md` when the controller needs lobby/status/lifecycle shell work
|
|
16
|
+
|
|
17
|
+
## Gameplay Rules
|
|
18
|
+
|
|
19
|
+
A game whose `inputModalities` include `'joystick'` always gets a sideways controller; lay it out with `GamepadLayout` as the Sideways Controllers section of `docs/airjam/generated/controller-ui.md` describes.
|
|
20
|
+
|
|
21
|
+
1. gameplay controller UI should live inside an absolute `inset-0` root
|
|
22
|
+
2. avoid scroll during active gameplay
|
|
23
|
+
3. use large touch targets
|
|
24
|
+
4. disable accidental text selection
|
|
25
|
+
5. keep actions obvious and single-purpose
|
|
26
|
+
|
|
27
|
+
## Lobby Rules
|
|
28
|
+
|
|
29
|
+
1. keep the flow simple
|
|
30
|
+
2. allow scroll only when it helps
|
|
31
|
+
3. keep the hierarchy sparse
|
|
32
|
+
4. prefer the shared shell contract for top status and lifecycle action placement unless the game has a strong reason to go fully custom
|
|
33
|
+
|
|
34
|
+
## Shell Contract Rule
|
|
35
|
+
|
|
36
|
+
For controller shell work:
|
|
37
|
+
|
|
38
|
+
1. prefer `RuntimeShellHeader`, `LifecycleActionGroup`, `useControllerShellStatus`, `useControllerLifecyclePermissions`, and `useControllerLifecycleIntents` for the default composition path
|
|
39
|
+
2. if you need custom markup, keep the same lifecycle behavior and action ordering
|
|
40
|
+
3. do not keep duplicate lifecycle controls in both a top shell and a legacy local panel
|
|
41
|
+
|
|
42
|
+
## Design Direction
|
|
43
|
+
|
|
44
|
+
1. build controller UI like a game control surface
|
|
45
|
+
2. avoid card-heavy dashboards
|
|
46
|
+
3. avoid tiny controls and dense text
|
|
47
|
+
4. avoid emoji-as-icon UI
|
|
48
|
+
5. if the template already defines semantic panel, shell, or touch-surface utilities, use those before inventing new visual patterns
|
|
49
|
+
|
|
50
|
+
## Icon Rule
|
|
51
|
+
|
|
52
|
+
Prefer:
|
|
53
|
+
|
|
54
|
+
1. `@tabler/icons-react` for general UI and system actions
|
|
55
|
+
2. `react-icons` `Gi*` exports for gameplay-specific concepts such as abilities, status effects, pickups, and damage types
|
|
56
|
+
|
|
57
|
+
Do not mix icon packs casually throughout the tree.
|
|
58
|
+
|
|
59
|
+
Prefer local wrapper modules so icon usage stays curated and replaceable.
|
|
60
|
+
|
|
61
|
+
## Attribution Note
|
|
62
|
+
|
|
63
|
+
If the project uses `react-icons` `Gi*` icons, remember that the underlying Game Icons set has its own attribution requirements.
|
|
64
|
+
|
|
65
|
+
Downstream teams remain responsible for how they satisfy those requirements.
|
|
66
|
+
|
|
67
|
+
## Anti-Patterns
|
|
68
|
+
|
|
69
|
+
1. generic SaaS UI for active gameplay
|
|
70
|
+
2. hard-coded desktop-like layouts on mobile
|
|
71
|
+
3. nested control groups that hide or shrink the main action
|