@air-jam/cli 0.0.0-stage → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +145 -2
  3. package/bin/airjam.mjs +66 -0
  4. package/dist/ai-pack.d.ts +44 -0
  5. package/dist/ai-pack.js +15 -0
  6. package/dist/ai-pack.js.map +1 -0
  7. package/dist/chunk-A4V2N4LX.js +938 -0
  8. package/dist/chunk-A4V2N4LX.js.map +1 -0
  9. package/dist/chunk-J5MAU4QZ.js +102 -0
  10. package/dist/chunk-J5MAU4QZ.js.map +1 -0
  11. package/dist/chunk-N7AI7HZK.js +529 -0
  12. package/dist/chunk-N7AI7HZK.js.map +1 -0
  13. package/dist/development.d.ts +98 -0
  14. package/dist/development.js +33 -0
  15. package/dist/development.js.map +1 -0
  16. package/dist/documentation.d.ts +27 -0
  17. package/dist/documentation.js +7 -0
  18. package/dist/documentation.js.map +1 -0
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +2184 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/scaffold.d.ts +6 -0
  23. package/dist/scaffold.js +20 -0
  24. package/dist/scaffold.js.map +1 -0
  25. package/package.json +78 -3
  26. package/runtime/local-network.d.mts +8 -0
  27. package/runtime/local-network.mjs +9 -0
  28. package/runtime/vite-config.d.mts +42 -0
  29. package/runtime/vite-config.mjs +130 -0
  30. package/runtime/vite-https.d.mts +11 -0
  31. package/runtime/vite-https.mjs +41 -0
  32. package/template-assets/bootstrap/.claude/launch.json +12 -0
  33. package/template-assets/bootstrap/AGENTS.md +248 -0
  34. package/template-assets/bootstrap/CLAUDE.md +63 -0
  35. package/template-assets/bootstrap/_gitignore +6 -0
  36. package/template-assets/bootstrap/skills/airjam-docs-workflow/SKILL.md +49 -0
  37. package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +56 -0
  38. package/template-assets/bootstrap/skills/canvas-2d-gameplay/SKILL.md +47 -0
  39. package/template-assets/bootstrap/skills/controller-ui/SKILL.md +69 -0
  40. package/template-assets/bootstrap/skills/debug-and-test/SKILL.md +72 -0
  41. package/template-assets/bootstrap/skills/game-architecture/SKILL.md +58 -0
  42. package/template-assets/bootstrap/skills/game-state-and-rendering/SKILL.md +44 -0
  43. package/template-assets/bootstrap/skills/host-surface/SKILL.md +52 -0
  44. package/template-assets/bootstrap/skills/index.md +36 -0
  45. package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +48 -0
  46. package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +51 -0
  47. package/template-assets/documentation/for-agents/controller-ui/page.mdx +60 -0
  48. package/template-assets/documentation/for-agents/page.mdx +98 -0
  49. package/template-assets/documentation/for-agents/project-structure/page.mdx +172 -0
  50. package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +79 -0
  51. package/template-assets/documentation/getting-started/debugging/page.mdx +165 -0
  52. package/template-assets/documentation/getting-started/dev-logs/page.mdx +171 -0
  53. package/template-assets/documentation/getting-started/game-ideas/page.mdx +116 -0
  54. package/template-assets/documentation/getting-started/introduction/page.mdx +183 -0
  55. package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +427 -0
  56. package/template-assets/documentation/getting-started/quick-start/page.mdx +333 -0
  57. package/template-assets/documentation/how-it-works/architecture/page.mdx +189 -0
  58. package/template-assets/documentation/how-it-works/host-system/page.mdx +267 -0
  59. package/template-assets/documentation/manifest.json +430 -0
  60. package/template-assets/documentation/sdk/hooks/page.mdx +500 -0
  61. package/template-assets/documentation/sdk/input-system/page.mdx +270 -0
  62. package/template-assets/documentation/sdk/networked-state/page.mdx +213 -0
  63. package/template-assets/documentation/sdk/ui-components/page.mdx +227 -0
  64. package/template-assets/managed/.airjam/ai-pack.json +191 -0
  65. package/template-assets/managed/docs/airjam/agent-gold-path.md +67 -0
  66. package/template-assets/managed/docs/airjam/agent-mcp.md +135 -0
  67. package/template-assets/managed/docs/airjam/canvas-2d-gameplay.md +82 -0
  68. package/template-assets/managed/docs/airjam/composition-shell-contract.md +87 -0
  69. package/template-assets/managed/docs/airjam/debug-and-testing.md +86 -0
  70. package/template-assets/managed/docs/airjam/development-loop.md +51 -0
  71. package/template-assets/managed/docs/airjam/docs-index.md +58 -0
  72. package/template-assets/managed/docs/airjam/generated/architecture.md +178 -0
  73. package/template-assets/managed/docs/airjam/generated/controller-ui.md +61 -0
  74. package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +164 -0
  75. package/template-assets/managed/docs/airjam/generated/for-agents.md +99 -0
  76. package/template-assets/managed/docs/airjam/generated/game-ideas.md +107 -0
  77. package/template-assets/managed/docs/airjam/generated/host-system.md +251 -0
  78. package/template-assets/managed/docs/airjam/generated/input-system.md +260 -0
  79. package/template-assets/managed/docs/airjam/generated/introduction.md +175 -0
  80. package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +426 -0
  81. package/template-assets/managed/docs/airjam/generated/networked-state.md +214 -0
  82. package/template-assets/managed/docs/airjam/generated/project-structure.md +171 -0
  83. package/template-assets/managed/docs/airjam/generated/quick-start.md +334 -0
  84. package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +490 -0
  85. package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +80 -0
  86. package/template-assets/managed/docs/airjam/generated/ui-components.md +222 -0
  87. package/template-assets/managed/docs/airjam/generated/unified-dev-logs.md +170 -0
  88. package/template-assets/managed/docs/airjam/iconography.md +55 -0
  89. package/template-assets/managed/docs/airjam/prefab-authoring.md +112 -0
  90. package/template-assets/managed/docs/airjam/preview-controllers.md +126 -0
  91. package/template-assets/managed/docs/airjam/r3f-3d-scene.md +97 -0
  92. package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +106 -0
  93. package/template-assets/managed/docs/airjam/visual-system.md +103 -0
@@ -0,0 +1,97 @@
1
+ # R3F 3D Scene
2
+
3
+ This guide exists for Air Jam projects that use React Three Fiber for host-side gameplay.
4
+
5
+ The goal is not just to "make Three.js work".
6
+
7
+ The goal is to keep 3D scenes readable, performant, and authored with stable conventions so LLMs do not create visual chaos.
8
+
9
+ ## Render Layer Rule
10
+
11
+ Treat R3F as the scene and rendering layer.
12
+
13
+ Keep:
14
+
15
+ 1. gameplay rules in domain/system modules
16
+ 2. orchestration in engine/adapters
17
+ 3. scene composition, cameras, lights, and materials in the 3D layer
18
+
19
+ ## Lighting Baseline
20
+
21
+ Establish one clean baseline lighting setup early.
22
+
23
+ For many stylized scenes, that usually means:
24
+
25
+ 1. one main directional light that defines form and shadows
26
+ 2. one ambient or hemisphere contribution so shadows are not dead black
27
+ 3. one environment or sky source that gives the whole scene a coherent fill
28
+
29
+ Do not keep stacking random lights until the scene looks acceptable.
30
+
31
+ ## Shadows
32
+
33
+ Three.js shadows often fail because the shadow camera bounds do not match the actual play area.
34
+
35
+ Rules:
36
+
37
+ 1. enable shadows only on lights and meshes that matter
38
+ 2. tune the directional light shadow camera to the real gameplay footprint
39
+ 3. avoid gigantic catch-all shadow bounds
40
+ 4. verify the play area fits inside the shadow frustum during active gameplay
41
+
42
+ If shadows look clipped, low-detail, or unstable, fix the shadow camera first before raising map sizes blindly.
43
+
44
+ ## Grounding And Placement
45
+
46
+ Models should have a clear grounding convention.
47
+
48
+ Do not solve floating props with random hand-tuned offsets in every scene.
49
+
50
+ Instead:
51
+
52
+ 1. define the ground plane or gameplay floor height
53
+ 2. define each prefab's origin and intended contact point
54
+ 3. keep reusable placement helpers for grounding and bounds
55
+
56
+ This matters for props, pickups, vehicles, characters, and spawnables.
57
+
58
+ ## Physics
59
+
60
+ Rapier is a good default when the game genuinely needs:
61
+
62
+ 1. rigid-body motion
63
+ 2. stacking or collision response
64
+ 3. reliable intersection/cast queries
65
+ 4. authored physics interactions that are easier to express with a solver
66
+
67
+ Prefer custom movement/collision when:
68
+
69
+ 1. objects move on simple constrained planes
70
+ 2. collision is mostly overlap or tile/shape based
71
+ 3. the game wants deterministic arcade behavior more than simulation fidelity
72
+
73
+ Do not pay the complexity cost of a full physics engine without clear benefit.
74
+
75
+ ## Particles And Effects
76
+
77
+ Use particles to reinforce motion, impacts, pickups, or atmosphere.
78
+
79
+ Do not use them as noise.
80
+
81
+ Rules:
82
+
83
+ 1. keep them isolated in effect modules or systems
84
+ 2. tie them to concrete gameplay events
85
+ 3. keep spawn counts and lifetime intentional
86
+
87
+ ## Materials, Textures, And Shaders
88
+
89
+ Prefer a coherent material language over random defaults.
90
+
91
+ Use:
92
+
93
+ 1. curated textures when they actually improve readability
94
+ 2. generated textures when the style is controlled and repeatable
95
+ 3. custom shaders when the mechanic or visual identity truly needs them
96
+
97
+ Avoid introducing shader complexity just to make a weak base scene look more advanced.
@@ -0,0 +1,106 @@
1
+ # State Lanes Cookbook
2
+
3
+ Use this when you are deciding where a fact or effect belongs.
4
+
5
+ Air Jam is easiest to reason about when you keep four lanes separate:
6
+
7
+ 1. controller input lane
8
+ 2. replicated state lane
9
+ 3. host-only runtime lane
10
+ 4. signal/result lane
11
+
12
+ ## The Short Rule
13
+
14
+ 1. If a value comes from a controller every frame, keep it in the input lane.
15
+ 2. If multiple surfaces must render the same durable truth, keep it in replicated state.
16
+ 3. If only the host runtime needs it locally, keep it in host-only refs or local runtime state.
17
+ 4. If you only need to notify, reject, or return a one-shot outcome, use signals or action acknowledgements instead of replicated state.
18
+
19
+ ## Worked Example
20
+
21
+ Imagine a slingshot artillery game.
22
+
23
+ ### Controller Input Lane
24
+
25
+ Use `useInputWriter(...)` on the controller and `host.getInput(...)` or `useGetInput(...)` on the host for:
26
+
27
+ 1. drag vector
28
+ 2. aim angle
29
+ 3. button held state
30
+ 4. latest joystick direction
31
+
32
+ These values are transient and per-frame. They should not be replicated store state.
33
+
34
+ ## Replicated State Lane
35
+
36
+ Use `createAirJamStore(...)` for durable shared truth that host and controllers both render:
37
+
38
+ 1. current phase (`lobby`, `playing`, `ended`)
39
+ 2. team assignments
40
+ 3. score
41
+ 4. cooldown timers that controllers display
42
+ 5. which players are alive
43
+
44
+ If the controller HUD or another remote surface must render it, it belongs here.
45
+
46
+ ### Host-Only Runtime Lane
47
+
48
+ Use host refs, local runtime state, `useLiveStateRef()`, `useHostTick(...)`, and `useHostActionListener(...)` for local host concerns such as:
49
+
50
+ 1. physics world refs
51
+ 2. particle systems
52
+ 3. audio handles
53
+ 4. canvas draw caches
54
+ 5. interpolated render-only positions
55
+
56
+ These are often derived from replicated state or semantic actions, but they are not themselves the shared truth.
57
+
58
+ ```tsx
59
+ const worldRef = useRef(createPhysicsWorld());
60
+ const gameRef = useGameStore.useLiveStateRef();
61
+
62
+ useGameStore.useHostActionListener((event) => {
63
+ if (event.actionName !== "fire") {
64
+ return;
65
+ }
66
+
67
+ worldRef.current.spawnProjectile(event.payload);
68
+ });
69
+
70
+ useHostTick({
71
+ mode: "fixed",
72
+ intervalMs: 16,
73
+ onTick: ({ deltaSeconds }) => {
74
+ worldRef.current.step(deltaSeconds, gameRef.current.playersAlive);
75
+ },
76
+ });
77
+ ```
78
+
79
+ ### Signal And Result Lane
80
+
81
+ Use signals and action acknowledgements for one-shot outcomes:
82
+
83
+ 1. haptics
84
+ 2. toast notifications
85
+ 3. “action rejected because player is dead”
86
+ 4. “action accepted and returned a result payload”
87
+
88
+ Do not push these through replicated state just to trigger an effect once.
89
+
90
+ ## Anti-Patterns
91
+
92
+ Avoid these:
93
+
94
+ 1. storing per-frame joystick movement in replicated state
95
+ 2. storing host-only sim refs or particle instances in replicated state
96
+ 3. creating fake replicated booleans just to trigger a one-shot sound
97
+ 4. driving semantic game actions by browser clicks when the game already has an agent contract
98
+
99
+ ## Fast Placement Test
100
+
101
+ Ask these in order:
102
+
103
+ 1. Does this change every frame from a controller? Input lane.
104
+ 2. Do host and controllers both need to render it later? Replicated state lane.
105
+ 3. Does only the host runtime need it to simulate or render locally? Host-only runtime lane.
106
+ 4. Is it just a one-shot notification or outcome? Signal/result lane.
@@ -0,0 +1,103 @@
1
+ # Visual System
2
+
3
+ Use this doc when extending the starter template's styling.
4
+
5
+ The goal is not to scatter one-off classes, arbitrary colors, and ad hoc gradients across the tree.
6
+
7
+ The goal is to keep the visual language intentional, reusable, and easy to evolve.
8
+
9
+ ## Default Rule
10
+
11
+ When a template already ships a visual system:
12
+
13
+ 1. extend the existing theme tokens first
14
+ 2. extend the existing semantic utilities second
15
+ 3. only then add one-off styling if the case is truly isolated
16
+
17
+ Do not bypass the shipped system casually.
18
+
19
+ ## Tailwind Rule
20
+
21
+ For Tailwind CSS-first projects, prefer this order:
22
+
23
+ 1. `@theme` for tokens such as colors, shadows, fonts, and reusable design values
24
+ 2. `@layer base` for root, body, and element defaults
25
+ 3. `@utility` for semantic reusable classes like stage shells, panels, status pills, and touch surfaces
26
+ 4. inline utility classes in components for local composition
27
+
28
+ That keeps the styling model clear:
29
+
30
+ 1. tokens define the palette and system values
31
+ 2. semantic utilities define recurring UI primitives
32
+ 3. component markup composes those primitives
33
+
34
+ ## What Belongs In Tokens
35
+
36
+ Good token candidates:
37
+
38
+ 1. brand or game palette colors
39
+ 2. text colors and muted variants
40
+ 3. shadows
41
+ 4. type families
42
+ 5. surface colors
43
+ 6. border strengths
44
+
45
+ Bad token candidates:
46
+
47
+ 1. one-off page-specific measurements
48
+ 2. one component's temporary padding tweak
49
+ 3. values that are only used once and have no system meaning
50
+
51
+ ## What Belongs In Semantic Utilities
52
+
53
+ Good semantic utility candidates:
54
+
55
+ 1. game shell backgrounds
56
+ 2. host stage frames
57
+ 3. reusable panel surfaces
58
+ 4. status pills
59
+ 5. touch control shells
60
+ 6. overlay containers
61
+
62
+ Bad semantic utility candidates:
63
+
64
+ 1. wrappers used by one element only
65
+ 2. tiny spacing helpers that are really just local layout
66
+ 3. utilities that hide unclear visual intent behind vague names
67
+
68
+ ## Component Rule
69
+
70
+ Component files should mostly compose:
71
+
72
+ 1. existing theme tokens
73
+ 2. existing semantic utilities
74
+ 3. local Tailwind classes for layout and spacing
75
+
76
+ Avoid:
77
+
78
+ 1. repeating the same arbitrary color values in many components
79
+ 2. rebuilding the same panel styling in multiple places
80
+ 3. mixing several unrelated visual directions in one template
81
+
82
+ ## Host And Controller Guidance
83
+
84
+ When the template has both host and controller surfaces:
85
+
86
+ 1. keep one shared design language across both
87
+ 2. let the host feel more atmospheric and stage-like
88
+ 3. let the controller feel more tactile and action-first
89
+ 4. keep gameplay controls simpler than lobby or status surfaces
90
+
91
+ Shared language does not mean identical layout.
92
+
93
+ ## Decision Rule
94
+
95
+ Before adding styling, ask:
96
+
97
+ 1. is this a token
98
+ 2. is this a reusable semantic utility
99
+ 3. is this only local composition
100
+
101
+ Put it at the highest level that is still honest.
102
+
103
+ If the answer is not clear, prefer local composition over premature abstraction.