@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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -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/auth-profile.d.ts +5 -0
  8. package/dist/auth-profile.js +7 -0
  9. package/dist/auth-profile.js.map +1 -0
  10. package/dist/auth-sessions.d.ts +5 -0
  11. package/dist/auth-sessions.js +7 -0
  12. package/dist/auth-sessions.js.map +1 -0
  13. package/dist/chunk-7D4AYBAV.js +64 -0
  14. package/dist/chunk-7D4AYBAV.js.map +1 -0
  15. package/dist/chunk-J5MAU4QZ.js +102 -0
  16. package/dist/chunk-J5MAU4QZ.js.map +1 -0
  17. package/dist/chunk-LH7UO57C.js +23 -0
  18. package/dist/chunk-LH7UO57C.js.map +1 -0
  19. package/dist/chunk-N7AI7HZK.js +529 -0
  20. package/dist/chunk-N7AI7HZK.js.map +1 -0
  21. package/dist/chunk-PKTLVQXZ.js +82 -0
  22. package/dist/chunk-PKTLVQXZ.js.map +1 -0
  23. package/dist/chunk-SQE4NPZP.js +31 -0
  24. package/dist/chunk-SQE4NPZP.js.map +1 -0
  25. package/dist/chunk-U6V3HEBB.js +939 -0
  26. package/dist/chunk-U6V3HEBB.js.map +1 -0
  27. package/dist/chunk-VEHNFPEO.js +224 -0
  28. package/dist/chunk-VEHNFPEO.js.map +1 -0
  29. package/dist/development.d.ts +102 -0
  30. package/dist/development.js +33 -0
  31. package/dist/development.js.map +1 -0
  32. package/dist/documentation.d.ts +27 -0
  33. package/dist/documentation.js +7 -0
  34. package/dist/documentation.js.map +1 -0
  35. package/dist/game-analytics.d.ts +5 -0
  36. package/dist/game-analytics.js +7 -0
  37. package/dist/game-analytics.js.map +1 -0
  38. package/dist/game-app-id.d.ts +5 -0
  39. package/dist/game-app-id.js +7 -0
  40. package/dist/game-app-id.js.map +1 -0
  41. package/dist/game-media.d.ts +5 -0
  42. package/dist/game-media.js +7 -0
  43. package/dist/game-media.js.map +1 -0
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +2468 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/scaffold.d.ts +6 -0
  48. package/dist/scaffold.js +20 -0
  49. package/dist/scaffold.js.map +1 -0
  50. package/package.json +82 -3
  51. package/runtime/local-network.d.mts +6 -0
  52. package/runtime/local-network.mjs +9 -0
  53. package/runtime/public-assets.mjs +62 -0
  54. package/runtime/source-fence.mjs +182 -0
  55. package/runtime/vite-config.d.mts +43 -0
  56. package/runtime/vite-config.mjs +134 -0
  57. package/runtime/vite-dev.mjs +18 -0
  58. package/runtime/vite-https.d.mts +11 -0
  59. package/runtime/vite-https.mjs +40 -0
  60. package/template-assets/bootstrap/.claude/launch.json +12 -0
  61. package/template-assets/bootstrap/AGENTS.md +290 -0
  62. package/template-assets/bootstrap/CLAUDE.md +55 -0
  63. package/template-assets/bootstrap/_gitignore +6 -0
  64. package/template-assets/bootstrap/skills/airjam-docs-workflow/SKILL.md +49 -0
  65. package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +100 -0
  66. package/template-assets/bootstrap/skills/canvas-2d-gameplay/SKILL.md +47 -0
  67. package/template-assets/bootstrap/skills/controller-ui/SKILL.md +71 -0
  68. package/template-assets/bootstrap/skills/debug-and-test/SKILL.md +72 -0
  69. package/template-assets/bootstrap/skills/game-architecture/SKILL.md +102 -0
  70. package/template-assets/bootstrap/skills/game-state-and-rendering/SKILL.md +44 -0
  71. package/template-assets/bootstrap/skills/host-surface/SKILL.md +52 -0
  72. package/template-assets/bootstrap/skills/index.md +36 -0
  73. package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +58 -0
  74. package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +61 -0
  75. package/template-assets/documentation/for-agents/controller-ui/page.mdx +99 -0
  76. package/template-assets/documentation/for-agents/page.mdx +120 -0
  77. package/template-assets/documentation/for-agents/project-structure/page.mdx +170 -0
  78. package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +77 -0
  79. package/template-assets/documentation/for-agents/supported-agents/page.mdx +18 -0
  80. package/template-assets/documentation/getting-started/debugging/page.mdx +164 -0
  81. package/template-assets/documentation/getting-started/dev-logs/page.mdx +169 -0
  82. package/template-assets/documentation/getting-started/game-ideas/page.mdx +114 -0
  83. package/template-assets/documentation/getting-started/introduction/page.mdx +200 -0
  84. package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +673 -0
  85. package/template-assets/documentation/getting-started/quick-start/page.mdx +310 -0
  86. package/template-assets/documentation/how-it-works/architecture/page.mdx +230 -0
  87. package/template-assets/documentation/how-it-works/host-system/page.mdx +270 -0
  88. package/template-assets/documentation/manifest.json +500 -0
  89. package/template-assets/documentation/sdk/assets-and-theme/page.mdx +185 -0
  90. package/template-assets/documentation/sdk/hooks/page.mdx +435 -0
  91. package/template-assets/documentation/sdk/input-system/page.mdx +240 -0
  92. package/template-assets/documentation/sdk/networked-state/page.mdx +295 -0
  93. package/template-assets/documentation/sdk/settings/page.mdx +155 -0
  94. package/template-assets/documentation/sdk/ui-components/page.mdx +268 -0
  95. package/template-assets/managed/.airjam/ai-pack.json +209 -0
  96. package/template-assets/managed/docs/airjam/agent-gold-path.md +115 -0
  97. package/template-assets/managed/docs/airjam/agent-mcp.md +179 -0
  98. package/template-assets/managed/docs/airjam/canvas-2d-gameplay.md +82 -0
  99. package/template-assets/managed/docs/airjam/composition-shell-contract.md +87 -0
  100. package/template-assets/managed/docs/airjam/debug-and-testing.md +104 -0
  101. package/template-assets/managed/docs/airjam/development-loop.md +51 -0
  102. package/template-assets/managed/docs/airjam/docs-index.md +64 -0
  103. package/template-assets/managed/docs/airjam/generated/architecture.md +223 -0
  104. package/template-assets/managed/docs/airjam/generated/assets-and-theme.md +188 -0
  105. package/template-assets/managed/docs/airjam/generated/controller-ui.md +102 -0
  106. package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +165 -0
  107. package/template-assets/managed/docs/airjam/generated/for-agents.md +123 -0
  108. package/template-assets/managed/docs/airjam/generated/game-ideas.md +107 -0
  109. package/template-assets/managed/docs/airjam/generated/host-system.md +261 -0
  110. package/template-assets/managed/docs/airjam/generated/input-system.md +241 -0
  111. package/template-assets/managed/docs/airjam/generated/introduction.md +195 -0
  112. package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +674 -0
  113. package/template-assets/managed/docs/airjam/generated/networked-state.md +298 -0
  114. package/template-assets/managed/docs/airjam/generated/project-structure.md +171 -0
  115. package/template-assets/managed/docs/airjam/generated/quick-start.md +311 -0
  116. package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +430 -0
  117. package/template-assets/managed/docs/airjam/generated/settings.md +158 -0
  118. package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +80 -0
  119. package/template-assets/managed/docs/airjam/generated/supported-agents.md +21 -0
  120. package/template-assets/managed/docs/airjam/generated/ui-components.md +265 -0
  121. package/template-assets/managed/docs/airjam/generated/unified-dev-logs.md +170 -0
  122. package/template-assets/managed/docs/airjam/iconography.md +55 -0
  123. package/template-assets/managed/docs/airjam/prefab-authoring.md +212 -0
  124. package/template-assets/managed/docs/airjam/preview-controllers.md +129 -0
  125. package/template-assets/managed/docs/airjam/r3f-3d-scene.md +163 -0
  126. package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +101 -0
  127. package/template-assets/managed/docs/airjam/visual-system.md +103 -0
@@ -0,0 +1,114 @@
1
+ # Game Ideas for Air Jam
2
+
3
+ A collection of game concepts that leverage Air Jam's unique architecture: **High-Frequency Input Streams** (declared controls) + **Reliable Shared State** (AirJam Store).
4
+
5
+ ---
6
+
7
+ ## Tier 1: Arcade Classics (Easy)
8
+
9
+ ### Neon Tanks
10
+
11
+ - Top-down arena shooter (4-8 players)
12
+ - Dual stick controls: movement + turret aiming
13
+ - Tap to fire
14
+ - **Key Feature:** Demonstrates dual stick capability on touchscreen
15
+
16
+ ### Super Sumo Balls
17
+
18
+ - Rolling balls on tilting platform
19
+ - Use phone gyroscope/accelerometer to tilt
20
+ - Haptic feedback on collisions
21
+ - **Key Feature:** Phone sensors + haptic signals
22
+
23
+ ---
24
+
25
+ ## Tier 2: Party & Social Games (Medium)
26
+
27
+ ### The Traitor (Among Us style)
28
+
29
+ - 8 players: 6 crew, 2 traitors
30
+ - Hidden roles shown only on phone
31
+ - Task minigames on controller
32
+ - Voting UI on phone
33
+ - **Key Feature:** Secret information per player (killer app for phone controllers)
34
+
35
+ ### Sketchy Business (Pictionary style)
36
+
37
+ - Draw prompts on phone canvas
38
+ - Drawings appear on TV
39
+ - **Key Feature:** Touchscreen as natural drawing pad
40
+
41
+ ### Quiz Show Royale
42
+
43
+ - Fastest finger first trivia
44
+ - Personalized feedback (green/red + vibration)
45
+ - **Key Feature:** Input timestamping for speed
46
+
47
+ ---
48
+
49
+ ## Tier 3: Co-op Chaos (Medium-Hard)
50
+
51
+ ### Starship Bridge Simulator
52
+
53
+ - 4 players with different roles
54
+ - Each player gets different UI on phone
55
+ - Asymmetrical gameplay
56
+ - **Key Feature:** Different React components per controller
57
+
58
+ ### Ghost Hunter
59
+
60
+ - 1 vs 3 asymmetrical gameplay
61
+ - Ghost sees minimap on phone only
62
+ - Hunters use joysticks on TV
63
+ - **Key Feature:** Private screen advantage
64
+
65
+ ---
66
+
67
+ ## Tier 4: Strategy & Card Games (Hard)
68
+
69
+ ### Poker Night / Blackjack
70
+
71
+ - Private cards on phone
72
+ - Betting UI on phone
73
+ - Public table on TV
74
+ - **Key Feature:** Hidden information per player
75
+
76
+ ### Artillery Wars (Worms style)
77
+
78
+ - Turn-based tank battle
79
+ - Aiming interface on phone (angle/power sliders)
80
+ - Weapon selection on phone
81
+ - **Key Feature:** Complex menus on touchscreen
82
+
83
+ ---
84
+
85
+ ## Tier 5: Experimental (Advanced)
86
+
87
+ ### The Crowd Pixel (r/place style)
88
+
89
+ - 50+ players
90
+ - Each controls a pixel/cursor
91
+ - Collaborative painting
92
+ - **Key Feature:** Tests scalability
93
+
94
+ ### Minority Report UI
95
+
96
+ - Phone as trackpad
97
+ - Gesture controls
98
+ - **Key Feature:** Phone as input device
99
+
100
+ ---
101
+
102
+ ## Key Mechanics Enabled
103
+
104
+ ```
105
+ | Mechanic | Example | Technical Feature |
106
+ |-------------------|-------------------|-----------------------------------------|
107
+ | Secret Roles | Mafia / Traitor | `useSharedState` (filter by `playerId`) |
108
+ | Private Inventory | RPG / Poker | Shared Store + React UI on Phone |
109
+ | Motion Steering | Racing / Rolling | Device Accelerometer → Input Stream |
110
+ | Fastest Finger | Quiz Show | Input Latching (Timestamps) |
111
+ | Physical Feedback | Fighting / Action | `host.sendSignal("HAPTIC")` |
112
+ | Drawing | Pictionary | Canvas API + Data Packet |
113
+ | Asymmetry | Ghost Hunter | Different Views per Role |
114
+ ```
@@ -0,0 +1,200 @@
1
+ # Introduction
2
+
3
+ Air Jam is an open **AI-native framework for multiplayer games controlled by
4
+ phones**. A computer or TV acts as the host display, smartphones become the
5
+ controllers, and both humans and coding agents build against the same runtime,
6
+ input, state, and release model.
7
+
8
+ ## Key Features
9
+
10
+ - **Zero App Download**: Players join by scanning a QR code—no app store required
11
+ - **Instant Multiplayer**: Connect smartphones up to the game’s declared player capacity
12
+ - **Developer Friendly**: Built with modern web technologies (React, TypeScript)
13
+ - **AI-Native By Design**: Humans and agents share explicit contracts for runtime, input, logs, and release workflows
14
+ - **Type Safe**: End-to-end type safety with Zod schema validation
15
+ - **Performance Optimized**: Tap-safe button input with fixed tick cadence
16
+ - **Haptic Feedback**: Send vibration patterns to controllers for game events
17
+
18
+ ## How It Works
19
+
20
+ <HowItWorksDiagram />
21
+
22
+ ## Quick Start
23
+
24
+ ### 1. Install the SDK
25
+
26
+ ```bash
27
+ pnpm add @air-jam/sdk
28
+ ```
29
+
30
+ ### 2. Wrap Your App
31
+
32
+ ```tsx filename="src/app.tsx"
33
+ import { createAirJamApp, env } from "@air-jam/sdk";
34
+ import { airjam as game } from "./airjam.config";
35
+
36
+ const airjam = createAirJamApp(game, { runtime: env.vite(import.meta.env) });
37
+
38
+ export const App = () => (
39
+ <Routes>
40
+ <Route
41
+ path="/"
42
+ element={
43
+ <airjam.Host
44
+ onPlayerJoin={(player) => {
45
+ console.log(`${player.label} joined!`);
46
+ }}
47
+ onPlayerLeave={(id) => {
48
+ console.log(`Player ${id} left`);
49
+ }}
50
+ >
51
+ <HostView />
52
+ </airjam.Host>
53
+ }
54
+ />
55
+ <Route
56
+ path={airjam.paths.controller}
57
+ element={
58
+ <airjam.Controller>
59
+ <ControllerView />
60
+ </airjam.Controller>
61
+ }
62
+ />
63
+ </Routes>
64
+ );
65
+ ```
66
+
67
+ ```ts filename="src/airjam.config.ts"
68
+ import { defineAirJamGame } from "@air-jam/sdk/core";
69
+ import {
70
+ axis,
71
+ button,
72
+ defineAirJamInput,
73
+ defineAirJamSimulation,
74
+ type AirJamInputValues,
75
+ } from "@air-jam/sdk/core";
76
+
77
+ export const gameInput = defineAirJamInput({
78
+ direction: axis(),
79
+ fire: button("pressed"),
80
+ });
81
+
82
+ const simulation = defineAirJamSimulation<
83
+ World,
84
+ AirJamInputValues<typeof gameInput>
85
+ >({
86
+ stepMs: 1000 / 60,
87
+ create: () => createWorld(),
88
+ step: (world, { input, players, dtSeconds }) => {
89
+ for (const player of players) {
90
+ const { direction, fire } = input(player.id);
91
+ movePaddle(world, player.id, direction * SPEED * dtSeconds);
92
+ if (fire) fireLaser(world, player.id);
93
+ }
94
+ },
95
+ });
96
+
97
+ export const airjam = defineAirJamGame({
98
+ metadata: {
99
+ slug: "space-game",
100
+ name: "Space Game",
101
+ tagline: "Fly together and defend the fleet.",
102
+ category: "arcade",
103
+ minPlayers: 1,
104
+ maxPlayers: 4,
105
+ inputModalities: ["buttons", "touch"],
106
+ supportedSdkRange: "^1.0.0",
107
+ maintainer: { name: "Air Jam" },
108
+ version: 1,
109
+ },
110
+ controllerPath: "/controller",
111
+ simulation,
112
+ input: gameInput,
113
+ });
114
+ ```
115
+
116
+ ### 3. Create Your Host View
117
+
118
+ The path below matches the current starter template layout.
119
+ It is a good default, not a required framework filename.
120
+
121
+ ```tsx filename="src/host/index.tsx"
122
+ import { useAirJamHost } from "@air-jam/sdk";
123
+
124
+ const HostView = () => {
125
+ const host = useAirJamHost();
126
+ // The simulation moves the game; this view draws it with useSimulationFrame.
127
+
128
+ return (
129
+ <div className="relative min-h-screen bg-black text-white">
130
+ <header className="absolute top-0 right-0 left-0 z-10 flex items-center justify-between border-b border-white/10 bg-black/70 px-4 py-2 backdrop-blur">
131
+ <span>Room {host.roomId}</span>
132
+ <button
133
+ onClick={
134
+ host.runtimeState === "playing"
135
+ ? host.pauseRuntime
136
+ : host.resumeRuntime
137
+ }
138
+ >
139
+ {host.runtimeState === "playing" ? "Pause" : "Resume"}
140
+ </button>
141
+ </header>
142
+ <GameCanvas />
143
+ </div>
144
+ );
145
+ };
146
+ ```
147
+
148
+ Mount host ownership once at `<airjam.Host ...>`, then use `useAirJamHost()` only as a consumer hook inside that boundary.
149
+
150
+ ### 4. Create Your Controller View
151
+
152
+ The path below also matches the current starter template layout.
153
+ If your project uses a different file shape, keep the same ownership boundary even if the filename changes.
154
+
155
+ ```tsx filename="src/controller/index.tsx"
156
+ import { AxisButton, ControlButton } from "@air-jam/sdk/ui";
157
+ import { gameInput } from "../airjam.config";
158
+
159
+ const ControllerView = () => (
160
+ <div className="grid h-full grid-cols-2 gap-3 p-3">
161
+ <AxisButton control={gameInput.direction} value={-1}>
162
+ Up
163
+ </AxisButton>
164
+ <AxisButton control={gameInput.direction} value={1}>
165
+ Down
166
+ </AxisButton>
167
+ <ControlButton control={gameInput.fire} className="col-span-2">
168
+ Fire
169
+ </ControlButton>
170
+ </div>
171
+ );
172
+ ```
173
+
174
+ The SDK's phone controls fill the declared controls and send them; the
175
+ controller runs no send loop.
176
+
177
+ ## Canonical Architecture: Three Lanes
178
+
179
+ Use one lane per concern:
180
+
181
+ 1. **Input lane**: controls declared with `defineAirJamInput`, filled by the SDK's phone controls, read in simulation steps with `input(playerId)`.
182
+ 2. **State lane**: `createAirJamStore` with host-owned actions, dispatched through `store.actions`.
183
+ 3. **Signal lane**: `sendSignal` / system commands for out-of-band UX and runtime commands.
184
+
185
+ <Callout variant="info" title="Tip">
186
+ Arcade does not replace this model. Arcade is an Air Jam app around another
187
+ Air Jam app, so the same lane rules still apply in embedded runtime mode.
188
+ </Callout>
189
+
190
+ Avoid cross-lane misuse:
191
+
192
+ 1. Don’t stream per-frame movement through store actions.
193
+ 2. Don’t encode authoritative gameplay state in signals.
194
+ 3. Don’t call `state.actions.*`; dispatch through `gameStore.actions`.
195
+
196
+ ## Next Steps
197
+
198
+ - [Architecture](/docs/how-it-works/architecture) - Understand the system design
199
+ - [Hooks Reference](/docs/sdk/hooks) - Complete API documentation
200
+ - [Input System](/docs/sdk/input-system) - Declare controls and read them each step