Imported from jbcom/humanoid-kit (
AGENTS.md). Install upstream withnpx skills add jbcom/humanoid-kit. Copyright stays with the author.
Agent notes
This file is for an autonomous coding agent working in this repository. It covers what isn't obvious from reading the code alone.
Toolchain
- Node 26 and pnpm 12 to build (
.nvmrc,mise.toml,package.json#packageManager), TypeScript 7 to compile.engines.nodeis>=24; do not use an API Node 24 lacks. - The package is ESM-only. Source files import each other with
.tsspecifiers (allowImportingTsExtensions);rewriteRelativeImportExtensionsmakestsc -p tsconfig.build.jsonemit.jsspecifiers intodist/. The publishedfilesof the root package aredist,README.md,LICENSEandNOTICE.md. - This is a pnpm workspace with four members:
.(thehumanoid-kitlibrary, plus the playground and its tests),packs/body(humanoid-kit-body),packs/adult-anatomy(humanoid-kit-adult-anatomy) anddocs/(the private Sourcey site). Root scripts operate on the library;pnpm docs:*delegate todocs/. pnpm verifyis the gate CI runs: Biome lint, markdownlint (pnpm lint:docs), strict TypeScript oversrc,tests,scripts,e2eandplayground, the unit suite with coverage thresholds, the build, andpnpm package:check(publint, Are The Types Wrong with the ESM-only profile, andscripts/verify-package.mjs). A change is not done while any part of it is red.- Coverage thresholds apply to
src/format,src/morph,src/subdivandsrc/recipe(src/rigis listed invitest.config.tsbut does not exist yet).src/makehuman,src/modelandsrc/buildare exercised bytests/but are not in the threshold set.src/reactandsrc/workerneed a browser and are proven bypnpm test:e2e(Playwright against the playground). playground/is the library's own demo, not a consumer. It aliaseshumanoid-kitand its subpaths to../src, so it needs no build step, and it loads the body pack only.pnpm pack:data <makehuman-data-dir>regenerates both packs from a checkout of the upstream project; seeNOTICE.md.
Core invariants: do not violate these when editing src/ or packs/
Full detail in docs/ARCHITECTURE.md.
- Every figure is the single hm08 base mesh. Do not add a second mesh, a second rig or per-species geometry.
- The age policy lives in
src/recipe/agePolicy.tsand is enforced insiderecipeContributions, so no caller can evaluate an invalid recipe. Under 18, breast size and firmness, regional breast values and adult-only modifiers throwAgePolicyError; they are never clamped.macroTargetWeightsnever weights a breast macro target under 18.withAgestrips adult-only values explicitly. KeepADULT_ONLY_MODIFIERin step with the packer'sisAdultOnlyTarget;tests/agePolicy.test.tschecks they agree. - Adult-only targets and modifiers ship only in
humanoid-kit-adult-anatomy, never in the body pack. The loader refuses an adult pack whosetopologyorbodySha256does not match the body pack it is loaded with. The public demo must never include the adult pack;pnpm check:pagesscans built output for its files, package name, target names and modifier names. - Regional traits stay independent. A regional macro override changes only its region's weights; no trait may lock, clamp or rescale another.
- The core (
src/format,src/morph,src/subdiv,src/recipe,src/makehuman,src/model,src/build) imports no React, no DOM and no WebGL, so it stays unit-testable in Node. - Catmull-Clark subdivision runs from precomputed stencils (
src/subdiv,src/build).HumanoidModelis framework-free and can run anywhere, but the React bindings evaluate throughHumanoidWorkerClient; do not move evaluation onto the render path. - Data files are generated, never hand-edited. Change the packer and rerun
pnpm pack:data. The packer's licence gate must keep refusing any source file that does not prove CC0 from its own content. - Only MakeHuman asset data (CC0) is used. Never copy, port or translate
MakeHuman program code, and keep
NOTICE.mdaccurate. - Public names, docs, examples and fixtures are neutral. Do not put the name of any game, studio or host app in code, comments, docs, tests or fixtures.
Keeping docs and tests in sync
A change to a public export needs matching updates in tests/ (or e2e/ for
src/react and src/worker), docs/API.md, docs/ARCHITECTURE.md when a
boundary or invariant moves, and the README and llms.txt when the quick start
or the roadmap changes. Document only what the code does: planned work belongs in
the roadmap, labelled as planned. humanoid-kit/editor is declared in
package.json but src/editor does not exist yet.
Known gaps
pnpm check:pagesis not wired into any workflow; run it afterpnpm build:playgroundandpnpm docs:build.- The comment at the top of
scripts/pack-makehuman.tsmentions anadult-targets.bin; the packer actually writespacks/adult-anatomy/data/targets.bin.
Commits and releases
scripts/apply-branch-ruleset.mjsis the canonical OSS ruleset installer. Run it only with explicit authorization.- Conventional Commits only. Release Please owns
CHANGELOG.mdand versions; never hand-edit either. pre-commit,simple-git-hooks,lint-stagedandcommitlintrun locally afterpnpm install; never bypass them with--no-verify.
Files most likely to surprise you
pnpm-workspace.yaml'sallowBuildscontrols which install scripts run.- The data packs are binary (
packs/*/data/*.binis markedbinaryin.gitattributes) and are committed to the repository, not stored in LFS. - Sourcey paths in
docs/sourcey.config.tsresolve relative todocs/. The CD workflow copies the built playground intodocs/dist/playground, so Pages serves docs at the root and the playground under/playground/. pnpm build:playgroundsets the Vite base to/humanoid-kit/playground/to match that layout.
