Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 5.38 KB

AGENTS.md

File metadata and controls

51 lines (38 loc) · 5.38 KB

AGENTS.md — Pite

Rust workspace (resolver 2, edition 2021, rust-version 1.95). Scene-tree game engine (not ECS): Rust core + embedded Python 3.12 + eframe/egui editor. target/, scene _cache/ are gitignored — never commit them. assets.pite.toml is committed.

Commands in CI Order

cargo fmt --all -- --check
npx markdownlint-cli2
cargo build --workspace --locked
cargo test --workspace --locked
PITE_LSP_SMOKE=1 cargo test -p pite-editor --lib live_pyright_smoke   # needs pyright==1.1.411, gated off by default
PITE_BUNDLE_SMOKE=1 cargo test -p pite-export --lib                   # real CPython download; CI-only, slow
bash scripts/check-examples.sh
  • Single crate: cargo test -p <crate> (e.g. -p pite-scene). Focused check: cargo run -p pite -- check --path <dir>; --strict promotes warnings, --json gives machine report.
  • Build needs CPython 3.12 dev headers + ALSA headers or it fails to link: libasound2-dev pkg-config on Debian/Ubuntu, plus export PYO3_PYTHON=$(which python3.12) and LD_LIBRARY_PATH pointing at its LIBDIR.
  • WSL without Wayland: WINIT_UNIX_BACKEND=x11 cargo run -p pite -- edit.
  • pite dogfood flow: new → cd <project> → edit → check → run. Export via pite export linux|windows|macos; offline export needs --no-bundle-python (+ PITE_PYTHON / --skip-python-check). Export ships the player found via --binary, else a pite-player sibling of pite (with automatic download fallback to toolchain cache if missing) — from a source checkout build both: cargo build --release -p pite -p pite-player.

Architecture by Crate Role

pite (the pite binary, in crates/pite-cli/) → pite-runtime (window, main loop, hot reload) → pite-core (node tree, handles, lifecycle) + pite-scene (TOML load/validate/cache) + pite-script (embedded pite module) + pite-physics (pure-Rust rapier2d 2D physics subsystem) + pite-render (Renderer2D wgpu seam) + pite-assets (Importer trait, asset registry) + pite-audio (WAV/OGG/MP3/FLAC, silent-simulation fallback) + pite-project (pite.toml, res://, templates) + pite-export (binary + resolved content) + pite-player (lean run-only binary — the runtime without the editor) + pite-editor (egui panels, LSP client). Docs in docs/ are authoritative per topic: scene-format, scripting-api, assets, editor, manifest, export, lsp.

Gotchas agents miss

  • Scenes: .ptscn TOML is source of truth; binary _cache/<stem>.<hash>.bin beside it is derived. Node ids are human strings, never UUIDs. Unknown props warn and survive saves (forward compat) — don't "clean" them. Saves are byte-stable (sorted prop keys); [[instance]] entries stay as entries with edits recorded as "node.prop" overrides, never inlined.
  • Assets: all refs are res:// project-relative strings; absolute paths are forbidden. assets.pite.toml tracks content hashes and is committed to git. After renaming/moving an asset outside the editor, run pite check --reimport-assets (rewrites refs by content hash); check without --reimport-assets never writes. Orphan-asset warnings only consider scenes transitively reachable from main_scene.
  • Deps: exports drop site-packages; third-party imports die in an export unless vendored (pite vendor add pkg==ver → project vendor/, pinned in [vendor]). pite check warns per offending import; non-vendored sibling modules need [export] include to ship.
  • Scripts: one file = one class inheriting pite.*, snake_case. Missing _ready/_process is a no-op, never an error. Cross-node calls go through get_node("../Name"); a miss raises KeyError. Signals are typed (pite.signal(int)); Button.pressed and Timer.timeout (fires each wait_time seconds, looping; non-positive never fires) are engine-owned — just connect, don't declare.
  • Logging: tracing everywhere — never println!/log:: in engine code.
  • Visuals: DESIGN.md + assets/palette.json are the single source of truth (teal #0b9387, dark-only editor in crates/pite-editor/src/theme.rs). Don't invent hexes.
  • LSP: pinned pyright server; live test is env-gated (PITE_LSP_SMOKE=1), don't run it unconditionally.

Conventions

  • Conventional commits (feat:/fix:/docs:/chore:), one focused change per commit/PR; never commit secrets, target/, or local paths.
  • Git hooks (pre-commit) check formatting, Markdown, and commit subjects; install them with pre-commit install and run everything with pre-commit run --all-files.
  • New Rust files start with // SPDX-License-Identifier: MIT OR Apache-2.0 (Python: # …); examples/ game scripts stay header-free.
  • Pinned values bump in multi-file lockstep (13 internal path-dep pins, scene FORMAT_VERSION/CACHE_VERSION, the pyright pin in crates/pite-editor/src/lsp.rs + docs + CI, python_bundle.rs pins) — checklist in docs/developer/maintenance.md.
  • Keep docs/changelog.md (## Unreleased) and affected docs/ pages updated whenever a change is user-facing or alters documented behavior.

Repository Governance

All agents operating in this repository must uphold the unbroken link chain and project standards: