Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-project-setup

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Set up npm imports, package entries, importmap, TypeScript and variant builds. Use for cocosair.js installation, unresolved-import errors, page shells or build artifacts.

  • 9 files
  • 27.7 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-project-setup

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referenceshtml-shell.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Derived from docs/manual/installation.md, examples/starter/index.html, examples/starter/src/main.ts, AGENTS.md, docs/reference/web-features.md (as of 2026-10-07).

Page skeleton contract

Main is browser-only, but import may happen before canvas creation. Call createAirApp with the selected canvas and optional pixelRatioCap; globals do not need to be assigned manually. Bootstrap preserves deferred loading, and html-source preserves the engine-free HTML capability surface.

At startup, native GameDiv/Cocos3dGameContainer wrappers are completed around the selected canvas. Existing wrappers must belong to that canvas. Use explicit screenMode/container for embedded layouts. A detached canvas keeps the full-window template behavior. Module scripts require type="module"; rendering requires WebGL 2. See docs/manual/safe-startup-and-release.md.

importmap shape (what the repo itself serves)

<script type="importmap">
  { "imports": { "cocosair": "/build/cocosair.module.js" } }
</script>
  • Bare specifier cocosair is a page-local alias, not the npm package name (cocosair.js); alias names in applications may differ (docs/manual/installation.md:13,22, examples/starter/index.html:22-24).
  • The alias resolves to the built bundle; with a bundler, configure cocosair (or any alias) as a path alias to build/cocosair.module.js and drop the importmap (docs/manual/installation.md:65), or import the package name cocosair.js directly (docs/manual/installation.md:19-20).
  • The engine ships named exports only - no default export (docs/manual/installation.md:14); importmap must be declared before the module scripts that rely on it (examples/starter/index.html:22-28: importmap in <head>, canvas + module script in <body>).

Minimal page order (checked against examples/starter sources)

<body>
  <canvas id="GameCanvas"></canvas>
  <!-- importmap already in <head> -->
  <script type="module">
    import { createAirApp, Scene } from 'cocosair';
    const app = await createAirApp({ canvas: '#GameCanvas' });
    app.run(new Scene('Main'));
  </script>
</body>

Source: examples/starter/index.html:26-29, examples/starter/src/main.ts:13,15-16,21. createAirApp is async and the renderer is hosted by the app (docs/manual/installation.md:15). A scene with no Camera renders nothing even after startup (examples/starter/src/main.ts:23).

Repository dev facts

Fact Value Source
From-source setup npm install then npm run build (bundle + maps; declarations need npm run build:dts) docs/manual/installation.md:12,26-29
Dev server npm run dev serves http://127.0.0.1:7454/, mounts /build/* at the web root, rebuilds the bundle on AIR source changes docs/manual/installation.md:63, AGENTS.md dev section
Editor types compilerOptions.paths alias to ./build/cocosair.module.d.ts for autocomplete docs/manual/installation.md:334-341
Version overlay VERSION is the engine baseline 4.0.0; AIR_VERSION and the package version are 1.0.0 - two different numbers docs/manual/installation.md:219, build/cocosair.module.d.ts:17578,55796
Runtime facts query Backend identity via director.root.device.constructor.name (WebGL2Device), capabilities via device.capabilities - not device.caps docs/manual/installation.md:220-221

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "install or import cocosair.js",
  "imports resolve to the wrong entry",
  "TypeScript editor declarations fail",
  "wire a page importmap and canvas",
  "which build command produces this artifact"
]
owns
[
  "package-entries",
  "importmap",
  "typescript",
  "html-shell",
  "feature-flags",
  "build-artifacts"
]
not_for
[
  "createAirApp startup failures -> cocosair-application",
  "live HTML textures or overlays -> cocosair-graphics-and-dom",
  "proving build artifacts -> cocosair-verification"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "安装和配置 Cocos AIR 项目,选择包入口、importmap、TypeScript 声明和变体构建。用于安装导入、页面骨架、类型解析或构建产物问题。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-project-setup