@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,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAirJamDevProxyOptions,
|
|
3
|
+
getAirJamHttpsServerOptions,
|
|
4
|
+
} from "./vite-https.mjs";
|
|
5
|
+
|
|
6
|
+
export const AIR_JAM_IFRAME_HEADERS = {
|
|
7
|
+
// Air Jam games must be embeddable inside the local Arcade shell.
|
|
8
|
+
"Content-Security-Policy": "frame-ancestors *;",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const AIR_JAM_VITE_PROFILES = new Set(["default", "three"]);
|
|
12
|
+
const DEFAULT_CHUNK_WARNING_LIMIT_KB = 1000;
|
|
13
|
+
const THREE_PROFILE_CHUNK_WARNING_LIMIT_KB = 2500;
|
|
14
|
+
|
|
15
|
+
const resolveThreeProfileManualChunk = (id) => {
|
|
16
|
+
if (id.includes("/zod/") || id.includes("/packages/sdk/src/")) {
|
|
17
|
+
// Keep SDK runtime dependencies with the SDK chunk so schema evaluation
|
|
18
|
+
// cannot race a separate vendor chunk during embedded production startup.
|
|
19
|
+
return "airjam-sdk";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!id.includes("node_modules")) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (
|
|
27
|
+
id.includes("@dimforge/rapier3d-compat") ||
|
|
28
|
+
id.includes("@react-three/rapier")
|
|
29
|
+
) {
|
|
30
|
+
return "rapier-runtime";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (
|
|
34
|
+
id.includes("@react-three/drei") ||
|
|
35
|
+
id.includes("three-stdlib") ||
|
|
36
|
+
id.includes("@use-gesture") ||
|
|
37
|
+
id.includes("@react-spring")
|
|
38
|
+
) {
|
|
39
|
+
return "drei-runtime";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (id.includes("@react-three/fiber")) {
|
|
43
|
+
return "fiber-runtime";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (id.includes("/three/")) {
|
|
47
|
+
return "three-core";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (
|
|
51
|
+
id.includes("/react/") ||
|
|
52
|
+
id.includes("/react-dom/") ||
|
|
53
|
+
id.includes("react-router-dom")
|
|
54
|
+
) {
|
|
55
|
+
// Keep the core React/app runtime in one chunk for the three profile.
|
|
56
|
+
// Splitting React away from state/router/runtime helpers created a
|
|
57
|
+
// circular startup edge in built embeds.
|
|
58
|
+
return "app-runtime";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (
|
|
62
|
+
id.includes("/zustand/") ||
|
|
63
|
+
id.includes("/howler/") ||
|
|
64
|
+
id.includes("/socket.io-client/") ||
|
|
65
|
+
id.includes("/qrcode/")
|
|
66
|
+
) {
|
|
67
|
+
return "app-runtime";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return undefined;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const resolveBuildConfig = (profile) => {
|
|
74
|
+
if (profile === "three") {
|
|
75
|
+
return {
|
|
76
|
+
chunkSizeWarningLimit: THREE_PROFILE_CHUNK_WARNING_LIMIT_KB,
|
|
77
|
+
rollupOptions: {
|
|
78
|
+
output: {
|
|
79
|
+
manualChunks: resolveThreeProfileManualChunk,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
chunkSizeWarningLimit: DEFAULT_CHUNK_WARNING_LIMIT_KB,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const createSharedDevServerConfig = ({ env, port }) => ({
|
|
91
|
+
host: true,
|
|
92
|
+
allowedHosts: true,
|
|
93
|
+
https: getAirJamHttpsServerOptions(env),
|
|
94
|
+
port,
|
|
95
|
+
strictPort: true,
|
|
96
|
+
headers: AIR_JAM_IFRAME_HEADERS,
|
|
97
|
+
cors: true,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const AIR_JAM_GENERATED_STATE_GLOB = "**/.airjam/**";
|
|
101
|
+
|
|
102
|
+
export const createAirJamViteConfig = ({
|
|
103
|
+
env = process.env,
|
|
104
|
+
port = Number(env.VITE_PORT || 5173),
|
|
105
|
+
profile = "default",
|
|
106
|
+
} = {}) => {
|
|
107
|
+
if (!AIR_JAM_VITE_PROFILES.has(profile)) {
|
|
108
|
+
throw new Error(
|
|
109
|
+
`Unsupported Air Jam Vite profile "${profile}". Use "default" or "three".`,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const build = resolveBuildConfig(profile);
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
build,
|
|
117
|
+
server: {
|
|
118
|
+
...createSharedDevServerConfig({ env, port }),
|
|
119
|
+
watch: {
|
|
120
|
+
// Runtime logs, managed-process state, screenshots, and other generated
|
|
121
|
+
// Air Jam artifacts live here. Watching them creates a feedback loop:
|
|
122
|
+
// browser activity writes a log entry, Vite reloads the browser, and
|
|
123
|
+
// the reload writes another entry.
|
|
124
|
+
ignored: [AIR_JAM_GENERATED_STATE_GLOB],
|
|
125
|
+
},
|
|
126
|
+
proxy: getAirJamDevProxyOptions(env),
|
|
127
|
+
},
|
|
128
|
+
preview: createSharedDevServerConfig({ env, port }),
|
|
129
|
+
};
|
|
130
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const DEFAULT_AIR_JAM_DEV_BACKEND_URL: string;
|
|
2
|
+
|
|
3
|
+
export function getAirJamHttpsServerOptions(
|
|
4
|
+
env?: NodeJS.ProcessEnv,
|
|
5
|
+
): { cert: Buffer; key: Buffer } | undefined;
|
|
6
|
+
|
|
7
|
+
export function getAirJamDevBackendUrl(env?: NodeJS.ProcessEnv): string;
|
|
8
|
+
|
|
9
|
+
export function getAirJamDevProxyOptions(
|
|
10
|
+
env?: NodeJS.ProcessEnv,
|
|
11
|
+
): Record<string, { target: string; ws?: boolean; changeOrigin: boolean }>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { resolveLocalBackendOrigin } from "./local-network.mjs";
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_AIR_JAM_DEV_BACKEND_URL = resolveLocalBackendOrigin();
|
|
5
|
+
|
|
6
|
+
export const getAirJamHttpsServerOptions = (env = process.env) => {
|
|
7
|
+
const certFile = env.AIR_JAM_DEV_CERT_FILE;
|
|
8
|
+
const keyFile = env.AIR_JAM_DEV_KEY_FILE;
|
|
9
|
+
if (!certFile || !keyFile) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(certFile) || !fs.existsSync(keyFile)) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
cert: fs.readFileSync(certFile),
|
|
19
|
+
key: fs.readFileSync(keyFile),
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const getAirJamDevBackendUrl = (env = process.env) =>
|
|
24
|
+
env.AIR_JAM_DEV_PROXY_BACKEND_URL?.trim() ||
|
|
25
|
+
resolveLocalBackendOrigin(env);
|
|
26
|
+
|
|
27
|
+
export const getAirJamDevProxyOptions = (env = process.env) => {
|
|
28
|
+
const target = getAirJamDevBackendUrl(env);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
"/socket.io": {
|
|
32
|
+
target,
|
|
33
|
+
ws: true,
|
|
34
|
+
changeOrigin: true,
|
|
35
|
+
},
|
|
36
|
+
"/__airjam": {
|
|
37
|
+
target,
|
|
38
|
+
changeOrigin: true,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,248 @@
|
|
|
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:
|
|
112
|
+
|
|
113
|
+
1. use the current agent or client's built-in browser or in-app browser tooling first when available
|
|
114
|
+
2. prefer a visible local browser session for real host/controller verification
|
|
115
|
+
3. use the Air Jam MCP alongside browser work for logs, topology, host staging actions, runtime inspection, and quality gates
|
|
116
|
+
4. use secondary browser MCPs such as Chrome DevTools only when the built-in browser tooling is unavailable or when low-level DOM, network, or performance inspection is required
|
|
117
|
+
5. 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
|
|
118
|
+
6. if Claude Code Desktop preview launches the app, use the committed `.claude/launch.json`; it runs the normal dev command with the preview-managed adapter Claude Preview needs
|
|
119
|
+
7. for other browser/preview tools that ask for a launch command, use `pnpm run dev`; do not fall back to raw `vite` or a separate preview-only script
|
|
120
|
+
8. for Claude Code or similar preview surfaces, keep host and preview controllers in the same visible preview screen when possible; add multiple preview controllers from the host preview workspace instead of opening unrelated OS browser tabs unless the user asks for tabs
|
|
121
|
+
9. 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
|
|
122
|
+
10. for reliable gameplay, physics, scoring, reset, and state assertions, use the semantic agent contract and Air Jam MCP game-session actions
|
|
123
|
+
11. 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`
|
|
124
|
+
12. 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
|
|
125
|
+
|
|
126
|
+
When a clean-slate game stops being trivial:
|
|
127
|
+
|
|
128
|
+
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
|
|
129
|
+
2. prefer these small explicit agent seams over leaving important semantics trapped in UI-only flows
|
|
130
|
+
3. make multiplayer games startable or ready-able from controllers; the host screen should not be the only place where play begins
|
|
131
|
+
|
|
132
|
+
## Game Agent Contract Rule
|
|
133
|
+
|
|
134
|
+
If the template ships `src/game/contracts/agent.ts`, treat that file as the canonical semantic agent surface for the game.
|
|
135
|
+
|
|
136
|
+
Use it before inferring gameplay semantics from raw store domains, controller RPC names, or visible UI.
|
|
137
|
+
|
|
138
|
+
Do not generate a second parallel agent contract when the template already owns one.
|
|
139
|
+
|
|
140
|
+
## Architecture Rules
|
|
141
|
+
|
|
142
|
+
Keep boundaries explicit:
|
|
143
|
+
|
|
144
|
+
1. `src/host/` owns host-only composition
|
|
145
|
+
2. `src/controller/` owns controller-only composition
|
|
146
|
+
3. `src/game/domain/` owns pure game rules and types
|
|
147
|
+
4. `src/game/engine/` owns runtime orchestration
|
|
148
|
+
5. `src/game/adapters/` owns framework and transport integration
|
|
149
|
+
6. `src/game/ui/` owns game-facing UI modules
|
|
150
|
+
7. `src/game/prefabs/` owns reusable authored content with stable metadata and config
|
|
151
|
+
|
|
152
|
+
If the repo still uses an older structure, move toward this model instead of adding more mixed concerns.
|
|
153
|
+
|
|
154
|
+
## State And Rendering Rules
|
|
155
|
+
|
|
156
|
+
1. keep high-frequency input out of replicated store actions
|
|
157
|
+
2. keep authoritative gameplay state separate from local UI state
|
|
158
|
+
3. do not use one mega store for unrelated concerns
|
|
159
|
+
4. use narrow Zustand selectors
|
|
160
|
+
5. keep per-frame runtime values out of React state when React rendering is not needed
|
|
161
|
+
6. use refs for hot mutable values
|
|
162
|
+
7. keep simulation logic out of React render flow
|
|
163
|
+
|
|
164
|
+
### 3D Rule
|
|
165
|
+
|
|
166
|
+
If the project uses R3F or Three:
|
|
167
|
+
|
|
168
|
+
1. keep scene code separate from gameplay rules
|
|
169
|
+
2. establish a deliberate lighting and shadow setup early
|
|
170
|
+
3. keep grounding and placement deterministic
|
|
171
|
+
4. use Rapier only when true physics behavior adds real value
|
|
172
|
+
|
|
173
|
+
### 2D Rule
|
|
174
|
+
|
|
175
|
+
If the project uses canvas:
|
|
176
|
+
|
|
177
|
+
1. keep gameplay rendering in canvas, not DOM layout
|
|
178
|
+
2. keep simulation and drawing separate
|
|
179
|
+
3. keep world units separate from screen and CSS sizing
|
|
180
|
+
4. use generated SVGs only when they are curated into a consistent art language
|
|
181
|
+
|
|
182
|
+
## UI Rules
|
|
183
|
+
|
|
184
|
+
### Controller
|
|
185
|
+
|
|
186
|
+
1. gameplay controller UI should live inside an absolute `inset-0` root
|
|
187
|
+
2. prefer large touch targets
|
|
188
|
+
3. disable accidental text selection
|
|
189
|
+
4. avoid dense dashboard-like layouts
|
|
190
|
+
5. keep controls obvious and simple
|
|
191
|
+
|
|
192
|
+
### Host
|
|
193
|
+
|
|
194
|
+
1. the active game surface should fill an absolute `inset-0` root
|
|
195
|
+
2. avoid accidental overflow
|
|
196
|
+
3. keep overlays separate from gameplay layout
|
|
197
|
+
4. keep host shell modules separate from gameplay viewport modules
|
|
198
|
+
|
|
199
|
+
### Visual Direction
|
|
200
|
+
|
|
201
|
+
1. avoid random HTML clutter
|
|
202
|
+
2. avoid emoji-as-icon UI
|
|
203
|
+
3. prefer fluid layouts over hard-coded sizes
|
|
204
|
+
4. build reusable game UI modules instead of one-off markup
|
|
205
|
+
5. when the template already ships a visual system, extend its theme tokens and semantic utilities before adding new ad hoc styling
|
|
206
|
+
|
|
207
|
+
### Icon Rule
|
|
208
|
+
|
|
209
|
+
Prefer:
|
|
210
|
+
|
|
211
|
+
1. `@tabler/icons-react` for shell, menus, navigation, settings, and system actions
|
|
212
|
+
2. `react-icons` `Gi*` exports for abilities, status effects, pickups, damage types, and other gameplay-facing symbols
|
|
213
|
+
|
|
214
|
+
Do not mix many icon libraries casually.
|
|
215
|
+
|
|
216
|
+
Wrap icon usage behind local UI/game icon modules where practical so the project can swap or curate icons later.
|
|
217
|
+
|
|
218
|
+
## Prefab Rules
|
|
219
|
+
|
|
220
|
+
1. reusable content should live under `src/game/prefabs/`
|
|
221
|
+
2. keep prefab metadata, defaults, and runtime component boundaries clear
|
|
222
|
+
3. keep prefab placement deterministic instead of relying on hand-tuned floating offsets
|
|
223
|
+
4. move larger rules into domain or system modules instead of hiding them inside prefab components
|
|
224
|
+
|
|
225
|
+
## Testing And Debugging Rules
|
|
226
|
+
|
|
227
|
+
1. keep gameplay logic testable without full rendering where practical
|
|
228
|
+
2. add unit or behavior tests when changing real behavior
|
|
229
|
+
3. inspect the canonical Air Jam dev log stream first for multiplayer/runtime issues
|
|
230
|
+
4. start with `pnpm exec air-jam-server logs --view=signal`
|
|
231
|
+
5. narrow with `--trace`, `--room`, `--controller`, `--runtime`, `--process`, or `--source`
|
|
232
|
+
6. prefer `pnpm exec air-jam-server logs`, or read `.airjam/logs/dev-latest.ndjson` directly
|
|
233
|
+
7. remember that `dev-latest.ndjson` resets when the Air Jam server process restarts
|
|
234
|
+
8. use framework diagnostics after the canonical log stream, not instead of it
|
|
235
|
+
9. keep debug helpers isolated from hot gameplay paths
|
|
236
|
+
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`
|
|
237
|
+
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
|
|
238
|
+
|
|
239
|
+
## Escalation Rule
|
|
240
|
+
|
|
241
|
+
If a requested change clearly requires a cleaner boundary, say so directly and do the refactor first or split the work into:
|
|
242
|
+
|
|
243
|
+
1. boundary cleanup
|
|
244
|
+
2. feature implementation
|
|
245
|
+
|
|
246
|
+
Do not preserve a weak structure just because the short-term patch looks smaller.
|
|
247
|
+
|
|
248
|
+
Always suggest the next highest long term value task at the end of your response.
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
Claude Code Desktop preview is already configured through `.claude/launch.json`. Use that preview configuration when opening the embedded preview. It runs:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm run dev -- --preview-managed
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This keeps Vite as the foreground process for Claude Preview while Air Jam manages the local server in the background. Humans and normal terminal workflows should still use `pnpm run dev`.
|
|
26
|
+
|
|
27
|
+
Use these recovery commands before debugging gameplay code when local runtime state looks stale:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm exec airjam status
|
|
31
|
+
pnpm exec airjam reset local
|
|
32
|
+
pnpm exec air-jam-server logs --view=signal
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
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.
|
|
36
|
+
|
|
37
|
+
## Preview Controllers
|
|
38
|
+
|
|
39
|
+
Use visible preview controllers in the same host preview screen for UI smoke proof:
|
|
40
|
+
|
|
41
|
+
1. click buttons with real browser clicks
|
|
42
|
+
2. drag controls with real browser drag/release gestures
|
|
43
|
+
3. verify that the controller visually connects and can trigger at least one visible action
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
## Gameplay Proof
|
|
50
|
+
|
|
51
|
+
Use the game-owned agent contract for reliable gameplay assertions:
|
|
52
|
+
|
|
53
|
+
1. `airjam.open_game_session`
|
|
54
|
+
2. `airjam.read_game_session`
|
|
55
|
+
3. `airjam.invoke_game_session_action`
|
|
56
|
+
4. `airjam.capture_game_session_visuals`
|
|
57
|
+
5. `airjam.close_game_session`
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
## Game Authoring Rule
|
|
62
|
+
|
|
63
|
+
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,56 @@
|
|
|
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
|
|
@@ -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
|