@air-jam/cli 0.0.0-stage → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +145 -2
- package/bin/airjam.mjs +66 -0
- package/dist/ai-pack.d.ts +44 -0
- package/dist/ai-pack.js +15 -0
- package/dist/ai-pack.js.map +1 -0
- package/dist/chunk-A4V2N4LX.js +938 -0
- package/dist/chunk-A4V2N4LX.js.map +1 -0
- package/dist/chunk-J5MAU4QZ.js +102 -0
- package/dist/chunk-J5MAU4QZ.js.map +1 -0
- package/dist/chunk-N7AI7HZK.js +529 -0
- package/dist/chunk-N7AI7HZK.js.map +1 -0
- package/dist/development.d.ts +98 -0
- package/dist/development.js +33 -0
- package/dist/development.js.map +1 -0
- package/dist/documentation.d.ts +27 -0
- package/dist/documentation.js +7 -0
- package/dist/documentation.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2184 -0
- package/dist/index.js.map +1 -0
- package/dist/scaffold.d.ts +6 -0
- package/dist/scaffold.js +20 -0
- package/dist/scaffold.js.map +1 -0
- package/package.json +78 -3
- package/runtime/local-network.d.mts +8 -0
- package/runtime/local-network.mjs +9 -0
- package/runtime/vite-config.d.mts +42 -0
- package/runtime/vite-config.mjs +130 -0
- package/runtime/vite-https.d.mts +11 -0
- package/runtime/vite-https.mjs +41 -0
- package/template-assets/bootstrap/.claude/launch.json +12 -0
- package/template-assets/bootstrap/AGENTS.md +248 -0
- package/template-assets/bootstrap/CLAUDE.md +63 -0
- package/template-assets/bootstrap/_gitignore +6 -0
- package/template-assets/bootstrap/skills/airjam-docs-workflow/SKILL.md +49 -0
- package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +56 -0
- package/template-assets/bootstrap/skills/canvas-2d-gameplay/SKILL.md +47 -0
- package/template-assets/bootstrap/skills/controller-ui/SKILL.md +69 -0
- package/template-assets/bootstrap/skills/debug-and-test/SKILL.md +72 -0
- package/template-assets/bootstrap/skills/game-architecture/SKILL.md +58 -0
- package/template-assets/bootstrap/skills/game-state-and-rendering/SKILL.md +44 -0
- package/template-assets/bootstrap/skills/host-surface/SKILL.md +52 -0
- package/template-assets/bootstrap/skills/index.md +36 -0
- package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +48 -0
- package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +51 -0
- package/template-assets/documentation/for-agents/controller-ui/page.mdx +60 -0
- package/template-assets/documentation/for-agents/page.mdx +98 -0
- package/template-assets/documentation/for-agents/project-structure/page.mdx +172 -0
- package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +79 -0
- package/template-assets/documentation/getting-started/debugging/page.mdx +165 -0
- package/template-assets/documentation/getting-started/dev-logs/page.mdx +171 -0
- package/template-assets/documentation/getting-started/game-ideas/page.mdx +116 -0
- package/template-assets/documentation/getting-started/introduction/page.mdx +183 -0
- package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +427 -0
- package/template-assets/documentation/getting-started/quick-start/page.mdx +333 -0
- package/template-assets/documentation/how-it-works/architecture/page.mdx +189 -0
- package/template-assets/documentation/how-it-works/host-system/page.mdx +267 -0
- package/template-assets/documentation/manifest.json +430 -0
- package/template-assets/documentation/sdk/hooks/page.mdx +500 -0
- package/template-assets/documentation/sdk/input-system/page.mdx +270 -0
- package/template-assets/documentation/sdk/networked-state/page.mdx +213 -0
- package/template-assets/documentation/sdk/ui-components/page.mdx +227 -0
- package/template-assets/managed/.airjam/ai-pack.json +191 -0
- package/template-assets/managed/docs/airjam/agent-gold-path.md +67 -0
- package/template-assets/managed/docs/airjam/agent-mcp.md +135 -0
- package/template-assets/managed/docs/airjam/canvas-2d-gameplay.md +82 -0
- package/template-assets/managed/docs/airjam/composition-shell-contract.md +87 -0
- package/template-assets/managed/docs/airjam/debug-and-testing.md +86 -0
- package/template-assets/managed/docs/airjam/development-loop.md +51 -0
- package/template-assets/managed/docs/airjam/docs-index.md +58 -0
- package/template-assets/managed/docs/airjam/generated/architecture.md +178 -0
- package/template-assets/managed/docs/airjam/generated/controller-ui.md +61 -0
- package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +164 -0
- package/template-assets/managed/docs/airjam/generated/for-agents.md +99 -0
- package/template-assets/managed/docs/airjam/generated/game-ideas.md +107 -0
- package/template-assets/managed/docs/airjam/generated/host-system.md +251 -0
- package/template-assets/managed/docs/airjam/generated/input-system.md +260 -0
- package/template-assets/managed/docs/airjam/generated/introduction.md +175 -0
- package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +426 -0
- package/template-assets/managed/docs/airjam/generated/networked-state.md +214 -0
- package/template-assets/managed/docs/airjam/generated/project-structure.md +171 -0
- package/template-assets/managed/docs/airjam/generated/quick-start.md +334 -0
- package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +490 -0
- package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +80 -0
- package/template-assets/managed/docs/airjam/generated/ui-components.md +222 -0
- package/template-assets/managed/docs/airjam/generated/unified-dev-logs.md +170 -0
- package/template-assets/managed/docs/airjam/iconography.md +55 -0
- package/template-assets/managed/docs/airjam/prefab-authoring.md +112 -0
- package/template-assets/managed/docs/airjam/preview-controllers.md +126 -0
- package/template-assets/managed/docs/airjam/r3f-3d-scene.md +97 -0
- package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +106 -0
- package/template-assets/managed/docs/airjam/visual-system.md +103 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<!-- Generated from content/docs/sdk/ui-components/page.mdx. Do not edit directly. -->
|
|
2
|
+
<!-- Canonical public doc: https://airjam.io/docs/sdk/ui-components -->
|
|
3
|
+
|
|
4
|
+
# SDK UI Components
|
|
5
|
+
|
|
6
|
+
`@air-jam/sdk` is headless by default. `@air-jam/sdk/ui` provides optional, composable UI primitives you can drop into your own game layout.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import {
|
|
10
|
+
SurfaceViewport,
|
|
11
|
+
PlayerAvatar,
|
|
12
|
+
RoomQrCode,
|
|
13
|
+
VolumeControls,
|
|
14
|
+
Button,
|
|
15
|
+
Slider,
|
|
16
|
+
} from "@air-jam/sdk/ui";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### `RoomQrCode`
|
|
20
|
+
|
|
21
|
+
Render a room join QR code from any URL string.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { RoomQrCode } from "@air-jam/sdk/ui";
|
|
25
|
+
import { useAirJamHost } from "@air-jam/sdk";
|
|
26
|
+
|
|
27
|
+
const LobbyQr = () => {
|
|
28
|
+
const host = useAirJamHost();
|
|
29
|
+
|
|
30
|
+
if (host.joinUrlStatus !== "ready") {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<RoomQrCode
|
|
36
|
+
value={host.joinUrl}
|
|
37
|
+
size={180}
|
|
38
|
+
padding={1}
|
|
39
|
+
className="rounded-xl border border-white/20 bg-black/50 p-2"
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If you are rendering before the join URL has been resolved, prefer gating with `host.joinUrlStatus === "ready"` and show your own loading state until then.
|
|
46
|
+
|
|
47
|
+
Props:
|
|
48
|
+
|
|
49
|
+
- `value: string` (required)
|
|
50
|
+
- `size?: number` default `180`
|
|
51
|
+
- `padding?: number` default `1`
|
|
52
|
+
- `foregroundColor?: string` default `#111111`
|
|
53
|
+
- `backgroundColor?: string` default `#ffffff`
|
|
54
|
+
- `errorCorrectionLevel?: "L" | "M" | "Q" | "H"` default `"M"`
|
|
55
|
+
- `className?: string`
|
|
56
|
+
- `style?: CSSProperties`
|
|
57
|
+
- `alt?: string` default `"Room join QR code"`
|
|
58
|
+
|
|
59
|
+
Use it for:
|
|
60
|
+
|
|
61
|
+
- lobby overlays
|
|
62
|
+
- pause overlays
|
|
63
|
+
- spectator join prompts
|
|
64
|
+
|
|
65
|
+
Avoid:
|
|
66
|
+
|
|
67
|
+
- generating URLs manually when `host.joinUrl` / `controller.joinUrl` already exists
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### `PlayerAvatar`
|
|
72
|
+
|
|
73
|
+
Render a stable avatar ringed by player color from `PlayerProfile`. Set `isBot` when you want the same shell to represent an AI-controlled slot with a bot icon instead of player artwork.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { PlayerAvatar } from "@air-jam/sdk/ui";
|
|
77
|
+
|
|
78
|
+
<PlayerAvatar player={player} size="md" />;
|
|
79
|
+
<PlayerAvatar player={player} isBot size="md" />;
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Props:
|
|
83
|
+
|
|
84
|
+
- `player: PlayerProfile` (required)
|
|
85
|
+
- `isBot?: boolean` render the shared bot icon instead of the player avatar image
|
|
86
|
+
- `size?: "sm" | "md" | "lg"` default `"md"`
|
|
87
|
+
- `className?: string`
|
|
88
|
+
|
|
89
|
+
Use it for:
|
|
90
|
+
|
|
91
|
+
- team strips
|
|
92
|
+
- connected player rows
|
|
93
|
+
- controller headers
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### `SurfaceViewport`
|
|
98
|
+
|
|
99
|
+
Own safe-area, orientation, and page-level UI scaling for a game surface.
|
|
100
|
+
It should fill the available screen while scaling the UI system proportionally, rather than letterboxing a fixed contained stage.
|
|
101
|
+
Internally it publishes a local `--airjam-ui-scale` into Tailwind's own spacing, text, radius, and container variables so normal Tailwind utilities keep working.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { SurfaceViewport } from "@air-jam/sdk/ui";
|
|
105
|
+
|
|
106
|
+
<SurfaceViewport orientation="portrait" className="bg-zinc-950">
|
|
107
|
+
<ControllerView />
|
|
108
|
+
</SurfaceViewport>;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Props:
|
|
112
|
+
|
|
113
|
+
- `orientation?: "portrait" | "landscape"`
|
|
114
|
+
- `children: ReactNode` (required)
|
|
115
|
+
- `designWidth?: number`
|
|
116
|
+
- `designHeight?: number`
|
|
117
|
+
- `uiScaleMultiplier?: number`
|
|
118
|
+
- `minScale?: number`
|
|
119
|
+
- `maxScale?: number`
|
|
120
|
+
- `lockOnGesture?: boolean` default `true`
|
|
121
|
+
- `className?: string`
|
|
122
|
+
- `contentClassName?: string`
|
|
123
|
+
- `style?: CSSProperties`
|
|
124
|
+
|
|
125
|
+
Use it for:
|
|
126
|
+
|
|
127
|
+
- controller routes that should keep a stable phone-like UI feel while still filling the screen
|
|
128
|
+
- host routes that should scale proportionally without collapsing into ordinary website behavior
|
|
129
|
+
|
|
130
|
+
Avoid:
|
|
131
|
+
|
|
132
|
+
- nesting multiple surface viewports
|
|
133
|
+
- treating it like a centered black-bar stage wrapper
|
|
134
|
+
- depending on arbitrary raw `px` values for most of the UI chrome when a normal Tailwind scale utility would do
|
|
135
|
+
- assuming native OS/browser lock is guaranteed everywhere
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### `VolumeControls`
|
|
140
|
+
|
|
141
|
+
Ready-made control block for master/music/sfx sliders bound to the shared platform settings runtime.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { VolumeControls } from "@air-jam/sdk/ui";
|
|
145
|
+
|
|
146
|
+
<VolumeControls className="w-full max-w-xs" compact />;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Mount it below `PlatformSettingsRuntime` when you want slider changes to persist in Arcade and inherit into embedded games.
|
|
150
|
+
|
|
151
|
+
Props:
|
|
152
|
+
|
|
153
|
+
- `className?: string`
|
|
154
|
+
- `compact?: boolean`
|
|
155
|
+
|
|
156
|
+
Use it for:
|
|
157
|
+
|
|
158
|
+
- in-game settings overlays
|
|
159
|
+
- pause/settings drawers
|
|
160
|
+
- Arcade- or platform-owned settings panels
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### `Button`
|
|
165
|
+
|
|
166
|
+
Styling primitive for consistent buttons.
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
import { Button } from "@air-jam/sdk/ui";
|
|
170
|
+
|
|
171
|
+
<Button variant="secondary" size="lg">
|
|
172
|
+
Start Match
|
|
173
|
+
</Button>;
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Common props:
|
|
177
|
+
|
|
178
|
+
- `variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"`
|
|
179
|
+
- `size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`
|
|
180
|
+
- `asChild?: boolean`
|
|
181
|
+
|
|
182
|
+
### `Slider`
|
|
183
|
+
|
|
184
|
+
Styling primitive for ranges and tuning inputs.
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { Slider } from "@air-jam/sdk/ui";
|
|
188
|
+
|
|
189
|
+
<Slider
|
|
190
|
+
value={[pointsToWin]}
|
|
191
|
+
min={3}
|
|
192
|
+
max={15}
|
|
193
|
+
step={1}
|
|
194
|
+
onValueChange={([value]) => setPointsToWin(value)}
|
|
195
|
+
/>;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### Lobby Overlay
|
|
201
|
+
|
|
202
|
+
Combine:
|
|
203
|
+
|
|
204
|
+
- `RoomQrCode` for quick join
|
|
205
|
+
- `PlayerAvatar` for team roster
|
|
206
|
+
- `Button` for start/ready actions
|
|
207
|
+
|
|
208
|
+
### Controller Route
|
|
209
|
+
|
|
210
|
+
Combine:
|
|
211
|
+
|
|
212
|
+
- `SurfaceViewport` for shared full-screen UI scaling
|
|
213
|
+
- `PlayerAvatar` in a compact header
|
|
214
|
+
- `Button` + `Slider` for controls/options
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Anti-Patterns
|
|
219
|
+
|
|
220
|
+
- Do not build gameplay input on UI components; keep input lane in `useInputWriter` / `useGetInput`.
|
|
221
|
+
- Do not rely on UI primitives for room/session lifecycle; lifecycle stays in headless SDK hooks.
|
|
222
|
+
- Do not fork component behavior in each game if composition solves it; prefer small wrappers around canonical primitives.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<!-- Generated from content/docs/getting-started/dev-logs/page.mdx. Do not edit directly. -->
|
|
2
|
+
<!-- Canonical public doc: https://airjam.io/docs/getting-started/dev-logs -->
|
|
3
|
+
|
|
4
|
+
# Unified Dev Logs
|
|
5
|
+
|
|
6
|
+
Air Jam has one canonical local observability stream for development:
|
|
7
|
+
|
|
8
|
+
- server logs
|
|
9
|
+
- host runtime logs
|
|
10
|
+
- controller runtime logs
|
|
11
|
+
- embedded runtime diagnostics
|
|
12
|
+
- local dev-runner tool output such as Vite and other child-process failures
|
|
13
|
+
|
|
14
|
+
That stream exists so you do not have to debug each surface in isolation.
|
|
15
|
+
|
|
16
|
+
## Canonical File
|
|
17
|
+
|
|
18
|
+
The canonical file is:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
.airjam/logs/dev-latest.ndjson
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This file is:
|
|
25
|
+
|
|
26
|
+
1. local-first
|
|
27
|
+
2. append-only for the current server run
|
|
28
|
+
3. reset when the Air Jam server process starts
|
|
29
|
+
|
|
30
|
+
That means it is the right place to inspect:
|
|
31
|
+
|
|
32
|
+
1. room lifecycle
|
|
33
|
+
2. host bootstrap and reconnect
|
|
34
|
+
3. controller join and disconnect flow
|
|
35
|
+
4. browser/runtime diagnostics that were mirrored back to the server
|
|
36
|
+
|
|
37
|
+
## What Writes Into It
|
|
38
|
+
|
|
39
|
+
During normal Air Jam development:
|
|
40
|
+
|
|
41
|
+
1. the Air Jam server writes structured server events into the file
|
|
42
|
+
2. the SDK browser log sink mirrors host and controller browser/runtime logs into the same file
|
|
43
|
+
3. the standard dev runners mirror local child-process output into the same file as `workspace` events
|
|
44
|
+
|
|
45
|
+
If you use the standard Air Jam server and standard SDK session providers in development, this happens automatically.
|
|
46
|
+
|
|
47
|
+
No extra logging setup should be required for the normal path.
|
|
48
|
+
|
|
49
|
+
## When It Resets
|
|
50
|
+
|
|
51
|
+
The file resets when the Air Jam server process starts.
|
|
52
|
+
|
|
53
|
+
That gives you a clean current-session stream by default.
|
|
54
|
+
|
|
55
|
+
One nuance matters:
|
|
56
|
+
|
|
57
|
+
If your dev workflow reuses an already-running local server process, the file will not reset until that server actually restarts.
|
|
58
|
+
|
|
59
|
+
### 1. Preferred: CLI Querying
|
|
60
|
+
|
|
61
|
+
Use the published server CLI first.
|
|
62
|
+
|
|
63
|
+
Examples:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pnpm exec air-jam-server logs --view=signal
|
|
67
|
+
pnpm exec air-jam-server logs
|
|
68
|
+
pnpm exec air-jam-server logs --follow
|
|
69
|
+
pnpm exec air-jam-server logs --trace=host_abc123
|
|
70
|
+
pnpm exec air-jam-server logs --source=browser --level=warn
|
|
71
|
+
pnpm exec air-jam-server logs --view=signal --room=ROOM1
|
|
72
|
+
pnpm exec air-jam-server logs --source=workspace --process=platform --view=signal
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The intended Air Jam workflow is:
|
|
76
|
+
|
|
77
|
+
1. start with `pnpm exec air-jam-server logs --view=signal`
|
|
78
|
+
2. narrow to the failing trace, room, controller, runtime, or process
|
|
79
|
+
3. only add custom logging if the stream still does not explain the issue
|
|
80
|
+
|
|
81
|
+
### 2. Fallback: Read The File Directly
|
|
82
|
+
|
|
83
|
+
Direct file reads are also valid.
|
|
84
|
+
|
|
85
|
+
That is useful when:
|
|
86
|
+
|
|
87
|
+
1. the repo does not yet expose the convenience CLI
|
|
88
|
+
2. you are using your own tooling
|
|
89
|
+
3. an LLM or script wants the raw NDJSON stream
|
|
90
|
+
|
|
91
|
+
## Best Filters
|
|
92
|
+
|
|
93
|
+
The most useful filters are:
|
|
94
|
+
|
|
95
|
+
1. `traceId` for one host session story
|
|
96
|
+
2. `roomId` for one multiplayer room
|
|
97
|
+
3. `controllerId` for one player/controller path
|
|
98
|
+
4. `event` for one lifecycle edge
|
|
99
|
+
5. `runtimeKind` and `runtimeEpoch` for embedded bridge/runtime issues
|
|
100
|
+
6. `processName` via `--process` for one local dev process such as `platform`, `server`, or the active game
|
|
101
|
+
|
|
102
|
+
In practice, the fastest loop is usually:
|
|
103
|
+
|
|
104
|
+
1. reproduce the issue
|
|
105
|
+
2. find the relevant `traceId`, `roomId`, or `controllerId`
|
|
106
|
+
3. inspect the rest of the stream through that lens
|
|
107
|
+
|
|
108
|
+
## Which Identifier To Reach For First
|
|
109
|
+
|
|
110
|
+
Use the narrowest identifier that matches the failure:
|
|
111
|
+
|
|
112
|
+
1. use `traceId` when the problem is mainly one host session story:
|
|
113
|
+
host bootstrap, reconnect, room ownership, launch flow
|
|
114
|
+
2. use `roomId` when multiple surfaces are involved in one room and you want the whole multiplayer story
|
|
115
|
+
3. use `controllerId` when one player path is failing:
|
|
116
|
+
join, disconnect, input, action RPC, targeted controller feedback
|
|
117
|
+
4. use `runtimeKind` and `runtimeEpoch` when debugging embedded bridge/runtime activation problems
|
|
118
|
+
5. use `event` when you already know the lifecycle edge you are hunting
|
|
119
|
+
|
|
120
|
+
If you are unsure, start with `roomId` or `traceId` and then narrow further.
|
|
121
|
+
|
|
122
|
+
## Signal View Vs Raw NDJSON
|
|
123
|
+
|
|
124
|
+
Use `--view=signal` when:
|
|
125
|
+
|
|
126
|
+
1. you want the fastest first read of the session
|
|
127
|
+
2. you care about lifecycle edges, accepted/rejected outcomes, and high-signal runtime events
|
|
128
|
+
3. you want to suppress low-value framework/browser console noise
|
|
129
|
+
|
|
130
|
+
Read raw NDJSON or use broader CLI filters when:
|
|
131
|
+
|
|
132
|
+
1. you need exact append order
|
|
133
|
+
2. you need the full event payloads and metadata
|
|
134
|
+
3. you suspect the hidden plumbing events are part of the problem
|
|
135
|
+
4. you are doing deeper agent/script analysis over the stream
|
|
136
|
+
|
|
137
|
+
The practical rule is:
|
|
138
|
+
|
|
139
|
+
1. start with `pnpm exec air-jam-server logs --view=signal`
|
|
140
|
+
2. narrow with `--trace`, `--room`, `--controller`, `--runtime`, `--process`, or `--source`
|
|
141
|
+
3. fall back to raw NDJSON only when the signal view is still insufficient
|
|
142
|
+
|
|
143
|
+
## Recommended Debug Order
|
|
144
|
+
|
|
145
|
+
When something breaks:
|
|
146
|
+
|
|
147
|
+
1. inspect the canonical dev log stream first
|
|
148
|
+
2. use SDK diagnostics second
|
|
149
|
+
3. add temporary custom logs only if the canonical stream still leaves a gap
|
|
150
|
+
|
|
151
|
+
Do not default to scattered `console.log` calls across host, controller, and server code.
|
|
152
|
+
|
|
153
|
+
Air Jam is specifically designed to avoid that debugging style.
|
|
154
|
+
|
|
155
|
+
## Important Exceptions
|
|
156
|
+
|
|
157
|
+
The automatic unified stream depends on the standard development path.
|
|
158
|
+
|
|
159
|
+
You should not assume full automatic coverage when:
|
|
160
|
+
|
|
161
|
+
1. running `--web-only` without a local Air Jam server
|
|
162
|
+
2. disabling the collector explicitly
|
|
163
|
+
3. replacing the standard server/runtime path with custom infrastructure
|
|
164
|
+
4. bypassing the standard dev runner and launching tools outside the Air Jam scripts
|
|
165
|
+
|
|
166
|
+
## Related Docs
|
|
167
|
+
|
|
168
|
+
1. [Debugging and Logs](./debugging-and-logs.md)
|
|
169
|
+
2. [For Agents](./for-agents.md)
|
|
170
|
+
3. [Host System](./host-system.md)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Iconography
|
|
2
|
+
|
|
3
|
+
Use icons intentionally.
|
|
4
|
+
|
|
5
|
+
Do not use emojis as UI icons.
|
|
6
|
+
|
|
7
|
+
## Default Pack Split
|
|
8
|
+
|
|
9
|
+
Prefer:
|
|
10
|
+
|
|
11
|
+
1. `@tabler/icons-react` for general UI and system icons
|
|
12
|
+
2. `react-icons` `Gi*` exports for game-specific icons
|
|
13
|
+
|
|
14
|
+
## When To Use `Tabler`
|
|
15
|
+
|
|
16
|
+
Use `@tabler/icons-react` for:
|
|
17
|
+
|
|
18
|
+
1. navigation
|
|
19
|
+
2. menu items
|
|
20
|
+
3. settings
|
|
21
|
+
4. device and network status
|
|
22
|
+
5. close, back, play, pause, stop, confirm, and other general actions
|
|
23
|
+
6. shell and dashboard-like non-gameplay UI
|
|
24
|
+
|
|
25
|
+
## When To Use `Game Icons`
|
|
26
|
+
|
|
27
|
+
Use `react-icons` `Gi*` exports for:
|
|
28
|
+
|
|
29
|
+
1. abilities
|
|
30
|
+
2. status effects
|
|
31
|
+
3. pickups
|
|
32
|
+
4. damage or energy types
|
|
33
|
+
5. equipment-like gameplay concepts
|
|
34
|
+
6. game-specific verbs and entities that general UI packs do not express well
|
|
35
|
+
|
|
36
|
+
## Architecture Rule
|
|
37
|
+
|
|
38
|
+
Do not import icon packs randomly throughout the app.
|
|
39
|
+
|
|
40
|
+
Prefer local wrappers such as:
|
|
41
|
+
|
|
42
|
+
1. `src/ui/icons/` for general UI icons
|
|
43
|
+
2. `src/game/ui/icons/` for gameplay icons
|
|
44
|
+
|
|
45
|
+
That keeps:
|
|
46
|
+
|
|
47
|
+
1. icon usage consistent
|
|
48
|
+
2. future swaps possible
|
|
49
|
+
3. game icon curation easier
|
|
50
|
+
|
|
51
|
+
## Attribution Note
|
|
52
|
+
|
|
53
|
+
The `Gi*` icon set in `react-icons` comes from Game Icons and carries its own attribution expectations.
|
|
54
|
+
|
|
55
|
+
The project should note that when using those assets, but the template should not hard-enforce attribution behavior for every downstream team.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Prefab Authoring
|
|
2
|
+
|
|
3
|
+
Prefabs should be first-class reusable content units.
|
|
4
|
+
|
|
5
|
+
The goal is not just code reuse.
|
|
6
|
+
|
|
7
|
+
The goal is to make content predictable enough for future tooling to scan, preview, configure, and compose.
|
|
8
|
+
|
|
9
|
+
## What A Prefab Is
|
|
10
|
+
|
|
11
|
+
A prefab is a reusable gameplay or scene object with a stable contract.
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
|
|
15
|
+
1. a tree, rock, wall, or prop
|
|
16
|
+
2. a pickup or spawn point
|
|
17
|
+
3. a vehicle or obstacle
|
|
18
|
+
4. a reusable gameplay actor shell
|
|
19
|
+
|
|
20
|
+
## Goals
|
|
21
|
+
|
|
22
|
+
Good prefabs should make it possible to:
|
|
23
|
+
|
|
24
|
+
1. reuse the same content definition in multiple scenes
|
|
25
|
+
2. expose safe configuration without rewriting component internals
|
|
26
|
+
3. generate previews later
|
|
27
|
+
4. scan the prefab directory and build a lightweight catalog
|
|
28
|
+
|
|
29
|
+
Each game should also expose one game-owned prefab catalog export so future
|
|
30
|
+
Studio or agent tooling has a single honest scan surface instead of searching
|
|
31
|
+
the whole codebase heuristically.
|
|
32
|
+
|
|
33
|
+
## Prefabs vs Scene Population
|
|
34
|
+
|
|
35
|
+
Do not mix these two concepts.
|
|
36
|
+
|
|
37
|
+
1. a prefab is a reusable authored content unit with a stable contract
|
|
38
|
+
2. scene population is the runtime or authored layer that places many prefab instances into a scene
|
|
39
|
+
|
|
40
|
+
Examples of scene population:
|
|
41
|
+
|
|
42
|
+
1. spawn one ship per connected player
|
|
43
|
+
2. render all collectibles from replicated store state
|
|
44
|
+
3. fill an arena with obstacle instances from a level layout
|
|
45
|
+
|
|
46
|
+
Those population or pooling layers should live outside `src/game/prefabs/`.
|
|
47
|
+
|
|
48
|
+
## Recommended Shape
|
|
49
|
+
|
|
50
|
+
Move toward a folder per prefab under `src/game/prefabs/`.
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
src/game/prefabs/
|
|
56
|
+
tree/
|
|
57
|
+
prefab.ts
|
|
58
|
+
tree.prefab.tsx
|
|
59
|
+
tree.schema.ts
|
|
60
|
+
tree.preview.ts
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The exact filenames can vary, but the boundary should stay clear:
|
|
64
|
+
|
|
65
|
+
1. metadata and registry-facing contract
|
|
66
|
+
2. config schema and defaults
|
|
67
|
+
3. runtime render entry
|
|
68
|
+
4. optional preview descriptor
|
|
69
|
+
|
|
70
|
+
## Recommended Metadata
|
|
71
|
+
|
|
72
|
+
Each prefab should converge on stable fields like:
|
|
73
|
+
|
|
74
|
+
1. `id`
|
|
75
|
+
2. `label`
|
|
76
|
+
3. `category`
|
|
77
|
+
4. `description`
|
|
78
|
+
5. `tags`
|
|
79
|
+
6. `defaultProps`
|
|
80
|
+
7. `configSchema`
|
|
81
|
+
8. `render`
|
|
82
|
+
9. `preview`
|
|
83
|
+
10. `placement`
|
|
84
|
+
|
|
85
|
+
## Placement Rule
|
|
86
|
+
|
|
87
|
+
Prefab placement should be deterministic.
|
|
88
|
+
|
|
89
|
+
Do not rely on manual trial-and-error offsets that leave models floating, clipping, or inconsistently grounded.
|
|
90
|
+
|
|
91
|
+
If a prefab needs grounding logic:
|
|
92
|
+
|
|
93
|
+
1. define its origin clearly
|
|
94
|
+
2. define its footprint or bounds clearly
|
|
95
|
+
3. keep placement helpers reusable instead of baking ad hoc offsets into every scene
|
|
96
|
+
|
|
97
|
+
## Behavior Rule
|
|
98
|
+
|
|
99
|
+
Do not let prefabs become a dumping ground for full gameplay systems.
|
|
100
|
+
|
|
101
|
+
Use:
|
|
102
|
+
|
|
103
|
+
1. prefab files for reusable content assembly
|
|
104
|
+
2. domain or system modules for larger rules and behavior
|
|
105
|
+
3. adapters for engine or renderer integration
|
|
106
|
+
4. scene-population or pooling modules for multi-instance runtime ownership
|
|
107
|
+
|
|
108
|
+
## Decision Rule
|
|
109
|
+
|
|
110
|
+
If something is meant to be reused, previewed, or configured later, give it a prefab contract early.
|
|
111
|
+
|
|
112
|
+
If it is truly one-off scene glue, keep it out of the prefab layer.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Preview Controllers
|
|
2
|
+
|
|
3
|
+
Preview controllers are the fast local desktop tryout path for host surfaces.
|
|
4
|
+
|
|
5
|
+
They are useful in local development when you want to:
|
|
6
|
+
|
|
7
|
+
1. verify the controller UI without picking up a phone first
|
|
8
|
+
2. test host + controller interplay on one agent
|
|
9
|
+
3. mix one desktop preview controller with one real phone/browser controller in the same room
|
|
10
|
+
|
|
11
|
+
## Product Position
|
|
12
|
+
|
|
13
|
+
Air Jam is still phone-first.
|
|
14
|
+
|
|
15
|
+
Preview controllers are not the main product interaction. They are an optional
|
|
16
|
+
host-side accessory that speeds up local iteration and public tryout.
|
|
17
|
+
|
|
18
|
+
## Important Rules
|
|
19
|
+
|
|
20
|
+
1. preview controllers use the real controller route
|
|
21
|
+
2. preview controllers join the same room/session model as phone controllers
|
|
22
|
+
3. preview controllers are not a fake simulator or second topology
|
|
23
|
+
4. production should stay explicit opt-in
|
|
24
|
+
|
|
25
|
+
Embedded preview controllers intentionally rebase that controller route onto the
|
|
26
|
+
current host-page origin. The shared/join URL stays canonical for phones and
|
|
27
|
+
external browsers, but the local iframe should stay same-origin with the host so
|
|
28
|
+
browser tooling can interact with it reliably.
|
|
29
|
+
|
|
30
|
+
If a game behaves differently under a preview controller, treat that as a sign
|
|
31
|
+
the game may be relying on an accidental controller-origin assumption.
|
|
32
|
+
|
|
33
|
+
## Default Local Dev Usage
|
|
34
|
+
|
|
35
|
+
Scaffolded host surfaces can mount the shared SDK preview workspace like this:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { HostPreviewControllerWorkspace } from "@air-jam/sdk/preview";
|
|
39
|
+
|
|
40
|
+
export const HostView = () => {
|
|
41
|
+
const previewControllersEnabled = import.meta.env.DEV;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<GameSurface />
|
|
46
|
+
<HostPreviewControllerWorkspace enabled={previewControllersEnabled} />
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
In the normal local loop:
|
|
53
|
+
|
|
54
|
+
1. open the host page
|
|
55
|
+
2. click `Open controller`
|
|
56
|
+
3. a real controller client opens in the host-local preview workspace
|
|
57
|
+
4. you can still join the same room from a phone or another browser tab
|
|
58
|
+
|
|
59
|
+
For Claude Code or other agent preview surfaces, keep this flow in the same
|
|
60
|
+
visible host preview screen when possible. The point is to let the user see the
|
|
61
|
+
agent operate the host plus preview controllers together. Add more local players
|
|
62
|
+
with more preview-controller windows before reaching for separate OS browser
|
|
63
|
+
tabs.
|
|
64
|
+
|
|
65
|
+
Agents should use real browser click, drag, and release gestures against the
|
|
66
|
+
visible controller UI. They should not synthesize pointer events into controller
|
|
67
|
+
iframes from parent-page eval; that path is brittle around iframe boundaries,
|
|
68
|
+
pointer capture, and React event timing.
|
|
69
|
+
|
|
70
|
+
The preview workspace supports:
|
|
71
|
+
|
|
72
|
+
1. multiple floating controller windows
|
|
73
|
+
2. drag by the title bar
|
|
74
|
+
3. resize from any window edge or corner
|
|
75
|
+
4. minimize and close controls
|
|
76
|
+
5. per-window portrait or landscape rotation from the title bar
|
|
77
|
+
6. shared active-opacity control for preview windows through platform settings
|
|
78
|
+
7. a room controller roster with source-aware `Kick` controls for manual local recovery
|
|
79
|
+
8. a `Reset room` escape hatch that creates a fresh empty room and reloads the local host page so gameplay state and controller state both reset cleanly
|
|
80
|
+
|
|
81
|
+
`host.players` stays the gameplay-facing list.
|
|
82
|
+
|
|
83
|
+
`host.controllers` is the richer room-session roster. Use it when you need:
|
|
84
|
+
|
|
85
|
+
1. controller source (`phone`, `preview`, `virtual`)
|
|
86
|
+
2. connected versus disconnected session state
|
|
87
|
+
3. resume-lease awareness
|
|
88
|
+
4. manual host recovery controls such as removing a stuck controller
|
|
89
|
+
5. local-dev recovery flows such as resetting the current room
|
|
90
|
+
|
|
91
|
+
## Production Rule
|
|
92
|
+
|
|
93
|
+
Do not mount preview controllers in production by accident.
|
|
94
|
+
|
|
95
|
+
The safe default is:
|
|
96
|
+
|
|
97
|
+
1. enabled in local dev
|
|
98
|
+
2. disabled in production unless the host intentionally opts in
|
|
99
|
+
|
|
100
|
+
That keeps phone controllers as the canonical public interaction while still
|
|
101
|
+
allowing deliberate product experiments later.
|
|
102
|
+
|
|
103
|
+
## Where The API Lives
|
|
104
|
+
|
|
105
|
+
The feature is intentionally not part of the root SDK surface.
|
|
106
|
+
|
|
107
|
+
Use the experimental leaf:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
@air-jam/sdk/preview
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
That leaf currently owns:
|
|
114
|
+
|
|
115
|
+
1. preview launch helpers
|
|
116
|
+
2. preview identity helpers
|
|
117
|
+
3. preview session manager state
|
|
118
|
+
4. shared workspace and floating-window components
|
|
119
|
+
|
|
120
|
+
## What To Avoid
|
|
121
|
+
|
|
122
|
+
1. do not build a second controller transport for previews
|
|
123
|
+
2. do not inject fake controller state directly into gameplay
|
|
124
|
+
3. do not move preview layout/session state into replicated game state
|
|
125
|
+
4. do not assume preview-controller APIs are stable root-SDK contracts
|
|
126
|
+
5. do not use preview controllers as the primary semantic gameplay test path when the game exposes an agent contract
|