@jgengine/assets 0.9.0 → 0.11.0

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 (68) hide show
  1. package/CHANGELOG.md +34 -3
  2. package/README.md +103 -50
  3. package/dist/aliases.d.ts +5 -0
  4. package/dist/aliases.js +28 -9
  5. package/dist/catalogs/build.js +9 -0
  6. package/dist/catalogs/buildSprites.d.ts +10 -0
  7. package/dist/catalogs/buildSprites.js +15 -0
  8. package/dist/catalogs/starter.d.ts +5 -0
  9. package/dist/catalogs/starter.js +10 -1
  10. package/dist/cli/paths.d.ts +9 -1
  11. package/dist/cli/paths.js +11 -1
  12. package/dist/cli/pull.d.ts +12 -0
  13. package/dist/cli/pull.js +210 -15
  14. package/dist/download.d.ts +46 -3
  15. package/dist/download.js +158 -9
  16. package/dist/find.d.ts +20 -1
  17. package/dist/find.js +52 -2
  18. package/dist/generated/index.js +18 -6
  19. package/dist/generated/kaykit-adventurers.json +674 -0
  20. package/dist/generated/kaykit-city-builder.json +863 -0
  21. package/dist/generated/kaykit-dungeon.json +4265 -0
  22. package/dist/generated/kaykit-furniture.json +1115 -0
  23. package/dist/generated/kaykit-skeletons.json +410 -0
  24. package/dist/generated/kaykit-space-base.json +1199 -0
  25. package/dist/generated/quaternius-medieval-village.json +3698 -0
  26. package/dist/generated/quaternius-modular-scifi.json +4013 -0
  27. package/dist/generated/quaternius-stylized-nature.json +1430 -0
  28. package/dist/generated-sprites/index.d.ts +5 -0
  29. package/dist/generated-sprites/index.js +4 -0
  30. package/dist/index.d.ts +9 -2
  31. package/dist/index.js +9 -2
  32. package/dist/indexGen.js +7 -5
  33. package/dist/manifest.d.ts +12 -1
  34. package/dist/materials.d.ts +61 -0
  35. package/dist/materials.js +98 -0
  36. package/dist/packs/starter.d.ts +46 -0
  37. package/dist/packs/starter.js +248 -0
  38. package/dist/provisioning.d.ts +88 -0
  39. package/dist/provisioning.js +74 -0
  40. package/dist/registry-catalog.json +40 -0
  41. package/dist/snippet.d.ts +4 -0
  42. package/dist/snippet.js +27 -0
  43. package/dist/sources/ambientcg.d.ts +5 -0
  44. package/dist/sources/ambientcg.js +64 -0
  45. package/dist/sources/gameicons.d.ts +10 -0
  46. package/dist/sources/gameicons.js +21 -0
  47. package/dist/sources/index.d.ts +9 -2
  48. package/dist/sources/index.js +11 -3
  49. package/dist/sources/kaykit.js +55 -6
  50. package/dist/sources/quaternius.js +60 -9
  51. package/dist/spriteIndexGen.d.ts +17 -0
  52. package/dist/spriteIndexGen.js +108 -0
  53. package/dist/verify.d.ts +1 -0
  54. package/dist/verify.js +38 -1
  55. package/package.json +4 -4
  56. package/skills/jgengine/SKILL.md +51 -0
  57. package/skills/jgengine/api.md +434 -0
  58. package/skills/jgengine/capabilities.md +29 -0
  59. package/skills/jgengine/reference-cartridge.md +72 -0
  60. package/skills/jgengine-assets/SKILL.md +41 -0
  61. package/skills/jgengine-assets/api.md +273 -0
  62. package/skills/jgengine-assets/capabilities.md +13 -0
  63. package/dist/generated/kenney-blaster.json +0 -362
  64. package/dist/generated/kenney-nature.json +0 -3292
  65. package/dist/generated/kenney-space.json +0 -1532
  66. package/dist/sources/kenney.d.ts +0 -2
  67. package/dist/sources/kenney.js +0 -36
  68. package/llms.txt +0 -997
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: jgengine-assets
3
+ description: Source, license, catalog, and resolve game-ready media assets.
4
+ ---
5
+
6
+ # JGengine assets
7
+
8
+ ## Ownership
9
+
10
+ This skill owns model, sprite, texture/material, and audio-file discovery; licensing; catalog metadata; pull/index workflows; and runtime asset references. Placement belongs to `jgengine-editor`, spatial audio behavior to `jgengine-world`, and rendering/UI composition to their respective domains.
11
+
12
+ Search [capabilities.md](capabilities.md) before adding a resolver or catalog path. Use [api.md](api.md) for exact exports.
13
+
14
+ ## Canonical workflow
15
+
16
+ 1. Prefer existing catalog entries and typed asset refs.
17
+ 2. Verify source license and attribution requirements before download.
18
+ 3. Record canonical facing, source units, pivot, footprint, bounds, and placement policy in metadata.
19
+ 4. Pull/index through shared tooling; do not commit remote-library bulk bytes when the catalog is designed to resolve them.
20
+ 5. Preview through the same resolver runtime will use.
21
+ 6. Add required credit in the same PR.
22
+
23
+ ## Reference integrity
24
+
25
+ Every logical asset id has a declared owner: `committed` (a single's shipped URL, resolves on a clean clone), `provisioned` (a pack index entry whose GLB is fetched by `assets pull <source>`), or `dangling` (nothing owns it — a broken contract). Resolve one id with `resolveProvenance(id)`; gate a set of references with `validateAssetReferences(refs)`, which fails on any dangling reference and reports the exact `assets pull <source>` steps a clean checkout still needs. `assets provenance <id>...` exposes the same contract on the CLI and exits non-zero on a dangling id. This resolves references structurally against the catalog — never grep source text as the long-term contract.
26
+
27
+ At load time the shell classifies a model fetch before parsing via `classifyAssetResponse` (`@jgengine/core/scene/assetDiagnostics`), so a missing file, a dev-server HTML fallback, corrupt bytes, or a non-model format surface as an actionable diagnostic naming the URL — not an opaque GLTF parse error.
28
+
29
+ ## Source rules
30
+
31
+ - Never use or reference Kenney.nl assets.
32
+ - Prefer Quaternius or KayKit for CC0 3D, game-icons.net for icons, and ambientCG for PBR.
33
+ - Preserve third-party license and attribution data with the catalog entry.
34
+ - A permissive source allows copying assets, not transplanting another game's implementation.
35
+
36
+ ## Traps
37
+
38
+ - Fix wrong scale/facing/pivot upstream in catalog metadata, never with per-game corrective transforms.
39
+ - Asset ids and metadata are stable data contracts; filenames and URLs are implementation details.
40
+ - Missing attribution is a release blocker even when the code works.
41
+
@@ -0,0 +1,273 @@
1
+ <!-- GENERATED by scripts/gen-skill-api.ts — do not edit. Regenerate: bun run gen:skill-api -->
2
+
3
+ # jgengine-assets — exported API surface
4
+
5
+ ## @jgengine/assets
6
+
7
+ - `AssetAlias` (interface): interface AssetAlias — ⚠ undocumented
8
+ - `AssetDownload` (type): type AssetDownload = PinnedDownload | ScrapeDownload — ⚠ undocumented
9
+ - `AssetKind` (type): type AssetKind = "model" | "pack" | "material" | "component" | "icon" | "sprite" | "spritePack" — ⚠ undocumented
10
+ - `AssetMatch` (type): type AssetMatch = | { kind: "model"; id: string; source: string; file?: string; via: "index" | "alias" | "single" } | { kind: "pack"; source: string; title: string; categories: readonly string[] } | { kind: "material"; id: string; title: string; categories: readonly string[] } | { kind: "component";… — ⚠ undocumented
11
+ - `AssetProvenance` (interface): interface AssetProvenance — The resolved ownership of one logical asset id — the provisioning contract for that id.
12
+ - `AssetProvenanceKind` (type): type AssetProvenanceKind = "committed" | "provisioned" | "dangling" — How an asset id's bytes reach a clean checkout: - `committed` — resolves to a self-hosted / remote URL carried in the shipped index (a {@link SingleAsset}); no pull step, available immediately. - `provisioned` — a pack {@link IndexEntry}; the id is declared but its GLB is fetched on demand by `assets pull <source>` into the consumer's served dir. - `dangling` — nothing in the index, singles, or aliases owns the id, so no provisioning step exists and it can never resolve on a clean clone.
13
+ - `AssetProvider` (type): type AssetProvider = | "quaternius" | "kaykit" | "polypizza" | "itch" | "ambientcg" | "gameicons" | "custom" — ⚠ undocumented
14
+ - `AssetReference` (interface): interface AssetReference — A logical asset id referenced by some consumer (a game, scene, or config), for validation.
15
+ - `AssetSource` (interface): interface AssetSource — ⚠ undocumented
16
+ - `AssetSourceKind` (type): type AssetSourceKind = "model" | "material" | "sprite" — What a source's archive contains: GLB models (default), one PBR material's texture maps, or a pack of individual 2D sprite/icon files (SVG/PNG).
17
+ - `AssetSpace` (interface): interface AssetSpace — Catalog-level asset-space metadata: how a model is authored relative to the engine, owned by the catalog entry rather than re-derived per game. Every field is optional so an unmeasured asset stays valid; {@link resolveFacingRotationY}/{@link assetUnitScale}/{@link resolveAnchorOffset} supply the documented defaults.
18
+ - `BuildCatalogOptions` (interface): interface BuildCatalogOptions — ⚠ undocumented
19
+ - `BuildMaterialCatalogOptions` (interface): interface BuildMaterialCatalogOptions — Options for `buildMaterialCatalog`.
20
+ - `BuildSpriteCatalogOptions` (interface): interface BuildSpriteCatalogOptions — Options for `buildSpriteCatalog`.
21
+ - `ExtractedMaterialMap` (interface): interface ExtractedMaterialMap — One normalized map pulled out of a material archive by `extractMaterialMaps`.
22
+ - `ExtractedSpriteFile` (interface): interface ExtractedSpriteFile — One SVG/PNG file pulled out of a sprite/icon-pack archive by `extractSpriteFiles`.
23
+ - `FindOptions` (interface): interface FindOptions — ⚠ undocumented
24
+ - `IndexEntry` (interface): interface IndexEntry — ⚠ undocumented
25
+ - `MATERIAL_MAP_FILES` (const): const MATERIAL_MAP_FILES: { readonly color: "color.jpg"; readonly normal: "normal.jpg"; readonly roughness: "roughness.jpg"; readonly ao: "ao.jpg"; readonly displacement: "displacement.jpg"; } — Normalized filenames a pulled material directory contains, keyed by map role.
26
+ - `MaterialCatalog` (interface): interface MaterialCatalog — Resolves material ids and `material/…` aliases to `MaterialRef`s.
27
+ - `MaterialMapRole` (type): type MaterialMapRole = keyof typeof MATERIAL_MAP_FILES — One PBR map's role within a material: color, normal, roughness, ao, or displacement.
28
+ - `MaterialMaps` (interface): interface MaterialMaps — URLs of one material's PBR maps; `ao`/`displacement` files may be absent from a rare pack.
29
+ - `MaterialRef` (interface): interface MaterialRef — A resolved material: identity, attribution, and its normalized map URLs.
30
+ - `ModelDims` (interface): interface ModelDims — Measured horizontal footprint, footprint center, and lowest Y of a model in model space.
31
+ - `ModelSnippetOptions` (interface): interface ModelSnippetOptions — ⚠ undocumented
32
+ - `PinnedDownload` (interface): interface PinnedDownload — ⚠ undocumented
33
+ - `RankedMatch` (interface): interface RankedMatch — ⚠ undocumented
34
+ - `ReferenceValidation` (interface): interface ReferenceValidation — The verdict for one {@link AssetReference}.
35
+ - `RegistryCatalog` (interface): interface RegistryCatalog — ⚠ undocumented
36
+ - `RegistryComponent` (interface): interface RegistryComponent — ⚠ undocumented
37
+ - `ReindexSpritesResult` (interface): interface ReindexSpritesResult — Per-source and total counts returned by `reindexSprites`.
38
+ - `ResolveProvenanceOptions` (interface): interface ResolveProvenanceOptions — Override the data {@link resolveProvenance} resolves against; every field defaults to the shipped catalog.
39
+ - `STARTER_ASSETS` (const): const STARTER_ASSETS: readonly StarterAsset[] — Flat list of every curated starter asset across themes.
40
+ - `STARTER_PACKS` (const): const STARTER_PACKS: Readonly<Record<StarterTheme, readonly StarterAsset[]>> — Theme → assets table for browse/docs (`STARTER_PACKS.people`, …).
41
+ - `STARTER_SOURCE_PACKS` (const): const STARTER_SOURCE_PACKS: readonly string[] — Source pack ids a game must pull so every starter asset URL resolves on disk.
42
+ - `STARTER_THEMES` (const): const STARTER_THEMES: readonly StarterTheme[] — Ordered starter theme ids: people, props, nature, urban.
43
+ - `ScrapeDownload` (interface): interface ScrapeDownload — ⚠ undocumented
44
+ - `SingleAsset` (interface): interface SingleAsset — ⚠ undocumented
45
+ - `StarterAsset` (interface): interface StarterAsset — One curated starter model: short id, theme, live catalog target, license, suggested height.
46
+ - `StarterTheme` (type): type StarterTheme = "people" | "props" | "nature" | "urban" — Curated drop-in starter themes for new games. Each entry maps a short semantic id (also registered as `asset:<id>`) to a live catalog GLB that is already measured (dims/anchor flow from the generated index via the alias target). Games wire them as `entityModels: { guest: "asset:person_casual" }`. Never Kenney — Quaternius / KayKit only.
47
+ - `ValidateAssetReferencesOptions` (interface): interface ValidateAssetReferencesOptions extends ResolveProvenanceOptions — Options for {@link validateAssetReferences}: the resolution data plus an optional on-disk `present` check.
48
+ - `ValidateAssetReferencesResult` (interface): interface ValidateAssetReferencesResult — The aggregate result of validating a set of references against the provisioning contract.
49
+ - `VerifyResult` (interface): interface VerifyResult — ⚠ undocumented
50
+ - `aliases` (const): const aliases: readonly AssetAlias[] — Semantic keys → live catalog ids. Prefer these in games so re-homes only touch this table. Never point at kenney-*. Curated starter theme ids (`asset:person_casual`, `nature_tree`, …) come from {@link starterAliases}.
51
+ - `ambientcgSources` (const): const ambientcgSources: readonly AssetSource[] — Every ambientCG material source, generated per family (`ambientcg-grass001` … ).
52
+ - `buildCatalog` (function): function buildCatalog(options: BuildCatalogOptions = {}): AssetCatalog — ⚠ undocumented
53
+ - `buildMaterialCatalog` (function): function buildMaterialCatalog(options: BuildMaterialCatalogOptions = {}): MaterialCatalog — A resolvable catalog over every `kind: "material"` source. Ids are source ids (`ambientcg-grass001`) plus the `material/…` aliases; every resolve returns the normalized map URLs under `basePath`, matching what `assets pull` writes into `<dir>/materials/<id>/`.
54
+ - `buildSpriteCatalog` (function): function buildSpriteCatalog(options: BuildSpriteCatalogOptions = {}): AssetCatalog — Resolves individual pulled sprite/icon ids (e.g. `gameicons-icons/sword`) to `{ url }`.
55
+ - `componentInstallUrl` (function): function componentInstallUrl(name: string): string — The `shadcn add` URL for a HUD component, e.g. `https://jgengine.com/r/vital-bar.json`.
56
+ - `componentWiringSnippet` (function): function componentWiringSnippet(component: RegistryComponent): string — Copy-paste wiring for a HUD component: the `shadcn add` command plus import + usage.
57
+ - `createStarterCatalog` (function): function createStarterCatalog(options: BuildCatalogOptions = {}): AssetCatalog<ModelAssetRef> — Catalog restricted to the curated starter packs (people/props/nature/urban). Prefer this for scaffolds and probes so `asset:person_casual` etc. resolve without pulling the whole library. Full index: {@link buildCatalog}.
58
+ - `entryForSpriteFile` (function): function entryForSpriteFile(source: AssetSource, file: string): IndexEntry — Builds one sprite/icon `IndexEntry` — same shape as a model entry, minus `dims`.
59
+ - `entryUrl` (function): function entryUrl(basePath: string, entry: IndexEntry): string — ⚠ undocumented
60
+ - `extractMaterialMaps` (function): function extractMaterialMaps(archive: Uint8Array): ExtractedMaterialMap[] — Pulls the recognized PBR maps out of a material archive (ambientCG's flat `<Asset>_<Res>_<Map>.jpg` layout) and normalizes their names so resolved URLs never depend on the provider's naming or the pulled resolution.
61
+ - `findAssets` (function): function findAssets(query: string, options: FindOptions = {}): AssetMatch[] — The ranked matches for a query — models, packs, HUD components, and icons in one list.
62
+ - `gameiconsSources` (const): const gameiconsSources: readonly AssetSource[] — game-icons.net (https://game-icons.net) — ~4,000 CC BY 3.0 SVG item/ability icons from 40+ contributing artists, mirrored as one GitHub repo (github.com/game-icons/icons). `HEAD` resolves the default branch without pinning a name or commit, so this always mirrors the current set; the per-artist `license.txt` files inside the repo carry the individual credits behind this pack's single collective `author` field.
63
+ - `generatedBySource` (const): const generatedBySource: Record<string, IndexEntry[]> — ⚠ undocumented
64
+ - `generatedIndex` (const): const generatedIndex: IndexEntry[] — ⚠ undocumented
65
+ - `generatedSpriteBySource` (const): const generatedSpriteBySource: Record<string, IndexEntry[]> — Pulled sprite/icon entries grouped by source id.
66
+ - `generatedSpriteIndex` (const): const generatedSpriteIndex: IndexEntry[] — Every pulled sprite/icon entry across all sources, flattened.
67
+ - `iconWiringSnippet` (function): function iconWiringSnippet(name: string): string — Copy-paste wiring for a HUD glyph from the registry `game-icon` catalog.
68
+ - `indexSpriteSourceDir` (function): function indexSpriteSourceDir(source: AssetSource, dir: string): IndexEntry[] — Walks a pulled sprite-pack directory and returns one `IndexEntry` per SVG/PNG, deduped by filename.
69
+ - `isScrapeDownload` (function): function isScrapeDownload(download: AssetDownload): download is ScrapeDownload — ⚠ undocumented
70
+ - `kaykitSources` (const): const kaykitSources: readonly AssetSource[] — ⚠ undocumented
71
+ - `keyFromSpriteFile` (function): function keyFromSpriteFile(file: string): string — Strips the `.svg`/`.png` extension off a pulled sprite/icon filename to get its id suffix.
72
+ - `materialAliases` (const): const materialAliases: readonly AssetAlias[] — Semantic keys onto the ambientCG catalog, mirroring the model alias layer.
73
+ - `materialSources` (const): const materialSources: readonly AssetSource[] — Every `kind: "material"` source — one CC0 PBR material each, resolvable via `buildMaterialCatalog`.
74
+ - `materialWiringSnippet` (function): function materialWiringSnippet(id: string, basePath = "/materials"): string — Copy-paste wiring for a pulled PBR material: resolve the map URLs through the material catalog, then apply them onto terrain or a model.
75
+ - `modelSources` (const): const modelSources: readonly AssetSource[] — Every source whose archive holds GLB models (Quaternius, KayKit packs).
76
+ - `modelWiringSnippet` (function): function modelWiringSnippet(id: string, options: ModelSnippetOptions = {}): string — Copy-paste wiring for a pulled GLB id: resolve through the catalog, drop into a model seam.
77
+ - `quaterniusSources` (const): const quaterniusSources: readonly AssetSource[] — ⚠ undocumented
78
+ - `rankAssets` (function): function rankAssets(query: string, options: FindOptions = {}): RankedMatch[] — Rank every catalog entry — models, packs, HUD components, icons — against one query.
79
+ - `readGlbDims` (function): function readGlbDims(bytes: Uint8Array): ModelDims | null — ⚠ undocumented
80
+ - `registryCatalog` (const): const registryCatalog: RegistryCatalog — ⚠ undocumented
81
+ - `reindexSprites` (function): function reindexSprites(spritesDir: string, outDir: string): ReindexSpritesResult — Same shape as `reindex` (models) but walks SVG/PNG files and skips dims measurement — sprites have no footprint.
82
+ - `resolveProvenance` (function): function resolveProvenance(id: string, options: ResolveProvenanceOptions = {}): AssetProvenance — Resolve one logical asset id (a pack id, a single id, or an alias key) to its {@link AssetProvenance}. Aliases are followed one hop to their target. An id that matches no declared owner is `dangling` — the signal a clean-clone gate turns into a hard failure, because no provisioning step can ever satisfy it.
83
+ - `singles` (const): const singles: readonly SingleAsset[] — ⚠ undocumented
84
+ - `sourceById` (const): const sourceById: ReadonlyMap<string, AssetSource> — ⚠ undocumented
85
+ - `sources` (const): const sources: readonly AssetSource[] — ⚠ undocumented
86
+ - `spriteSources` (const): const spriteSources: readonly AssetSource[] — Every `kind: "sprite"` source — a pack of individual 2D icon/UI files, resolvable via `buildSpriteCatalog`.
87
+ - `spriteWiringSnippet` (function): function spriteWiringSnippet(id: string, basePath = "/sprites"): string — Copy-paste wiring for a pulled sprite/icon-pack file: resolve through the sprite catalog.
88
+ - `validateAssetReferences` (function): function validateAssetReferences(references: readonly AssetReference[], options: ValidateAssetReferencesOptions = {}): ValidateAssetReferencesResult — Validate that every {@link AssetReference} resolves against the declared provisioning contract — not by grepping source text, but by resolving each logical id to its committed / provisioned / dangling owner. A `dangling` reference fails with the referencing consumer, the logical id, the (null) resolved path, and the missing provisioning step; a `provisioned` reference passes and contributes its `assets pull <source>` step to `provisioning` (unless `present` is supplied and reports the bytes absent).
89
+ - `verifyManifest` (function): function verifyManifest(): VerifyResult — ⚠ undocumented
90
+
91
+ ## @jgengine/assets/aliases
92
+
93
+ - `aliases` (const): const aliases: readonly AssetAlias[] — Semantic keys → live catalog ids. Prefer these in games so re-homes only touch this table. Never point at kenney-*. Curated starter theme ids (`asset:person_casual`, `nature_tree`, …) come from {@link starterAliases}.
94
+
95
+ ## @jgengine/assets/catalogs/build
96
+
97
+ - `BuildCatalogOptions` (interface): interface BuildCatalogOptions — ⚠ undocumented
98
+ - `buildCatalog` (function): function buildCatalog(options: BuildCatalogOptions = {}): AssetCatalog — ⚠ undocumented
99
+ - `entryUrl` (function): function entryUrl(basePath: string, entry: IndexEntry): string — ⚠ undocumented
100
+
101
+ ## @jgengine/assets/catalogs/buildSprites
102
+
103
+ - `BuildSpriteCatalogOptions` (interface): interface BuildSpriteCatalogOptions — Options for `buildSpriteCatalog`.
104
+ - `buildSpriteCatalog` (function): function buildSpriteCatalog(options: BuildSpriteCatalogOptions = {}): AssetCatalog — Resolves individual pulled sprite/icon ids (e.g. `gameicons-icons/sword`) to `{ url }`.
105
+
106
+ ## @jgengine/assets/catalogs/starter
107
+
108
+ - `createStarterCatalog` (function): function createStarterCatalog(options: BuildCatalogOptions = {}): AssetCatalog<ModelAssetRef> — Catalog restricted to the curated starter packs (people/props/nature/urban). Prefer this for scaffolds and probes so `asset:person_casual` etc. resolve without pulling the whole library. Full index: {@link buildCatalog}.
109
+
110
+ ## @jgengine/assets/cli/pull
111
+
112
+ - `cliFetch` (const): const cliFetch: typeof fetch — The runtime's own fetch, with a curl fallback for hosts it cannot reach — some proxied sandboxes tear down bun's TLS stream to GitHub's release-asset host while curl (which honors SSL_CERT_FILE) gets through fine.
113
+ - `generatedDir` (const): const generatedDir: string — Sibling of `cli/` under `src/` (dev) or `dist/` (published) so reindex writes the tree consumers import.
114
+ - `generatedSpritesDir` (const): const generatedSpritesDir: string — Sprite-pack counterpart of `generatedDir`.
115
+
116
+ ## @jgengine/assets/dims
117
+
118
+ - `ModelDims` (interface): interface ModelDims — Measured horizontal footprint, footprint center, and lowest Y of a model in model space.
119
+ - `readGlbDims` (function): function readGlbDims(bytes: Uint8Array): ModelDims | null — ⚠ undocumented
120
+
121
+ ## @jgengine/assets/download
122
+
123
+ - `DEFAULT_RELEASE_BASE` (const): const DEFAULT_RELEASE_BASE: "https://github.com/Noisemaker111/jgengine/releases/download/packs" — Default asset mirror: this repo's own GitHub Releases, reachable from every cloud sandbox without network-policy changes (github.com is on the default allowlist). Assets live on the rolling `packs` release, one flat zip per pack named `<provider>-<packId>.zip`, kept in sync with the source catalog by `.github/workflows/mirror-assets.yml` — adding a catalog entry is the whole publishing step. Override the chain with `--mirror` / `JGENGINE_ASSETS_MIRROR`, or disable this hop with `JGENGINE_ASSETS_NO_DEFAULT_MIRROR=1`.
124
+ - `DownloadPackOptions` (interface): interface DownloadPackOptions — ⚠ undocumented
125
+ - `DownloadPackResult` (interface): interface DownloadPackResult — ⚠ undocumented
126
+ - `ExtractedGlb` (interface): interface ExtractedGlb — ⚠ undocumented
127
+ - `ExtractedSpriteFile` (interface): interface ExtractedSpriteFile — One SVG/PNG file pulled out of a sprite/icon-pack archive by `extractSpriteFiles`.
128
+ - `ExtractedTexture` (interface): interface ExtractedTexture — ⚠ undocumented
129
+ - `FetchLike` (type): type FetchLike = typeof fetch — ⚠ undocumented
130
+ - `MAX_ARCHIVE_COMPRESSION_RATIO` (const): const MAX_ARCHIVE_COMPRESSION_RATIO: 100 — Max allowed originalSize/size ratio for a single archive entry — past this it's treated as a zip bomb.
131
+ - `MAX_ARCHIVE_DOWNLOAD_BYTES` (const): const MAX_ARCHIVE_DOWNLOAD_BYTES: number — Max size of a downloaded (still-compressed) archive, in bytes. Provider zips run tens of MB; this leaves headroom without buffering an unbounded response.
132
+ - `MAX_ARCHIVE_ENTRY_COUNT` (const): const MAX_ARCHIVE_ENTRY_COUNT: 20000 — Max number of entries this module will extract out of one archive.
133
+ - `MAX_ARCHIVE_UNCOMPRESSED_BYTES` (const): const MAX_ARCHIVE_UNCOMPRESSED_BYTES: number — Max total uncompressed size this module will inflate out of one archive, in bytes.
134
+
135
+ ## @jgengine/assets/find
136
+
137
+ - `AssetKind` (type): type AssetKind = "model" | "pack" | "material" | "component" | "icon" | "sprite" | "spritePack" — ⚠ undocumented
138
+ - `AssetMatch` (type): type AssetMatch = | { kind: "model"; id: string; source: string; file?: string; via: "index" | "alias" | "single" } | { kind: "pack"; source: string; title: string; categories: readonly string[] } | { kind: "material"; id: string; title: string; categories: readonly string[] } | { kind: "component";… — ⚠ undocumented
139
+ - `FindOptions` (interface): interface FindOptions — ⚠ undocumented
140
+ - `RankedMatch` (interface): interface RankedMatch — ⚠ undocumented
141
+ - `findAssets` (function): function findAssets(query: string, options: FindOptions = {}): AssetMatch[] — The ranked matches for a query — models, packs, HUD components, and icons in one list.
142
+ - `rankAssets` (function): function rankAssets(query: string, options: FindOptions = {}): RankedMatch[] — Rank every catalog entry — models, packs, HUD components, icons — against one query.
143
+
144
+ ## @jgengine/assets/generated
145
+
146
+ - `generatedBySource` (const): const generatedBySource: Record<string, IndexEntry[]> — ⚠ undocumented
147
+ - `generatedIndex` (const): const generatedIndex: IndexEntry[] — ⚠ undocumented
148
+
149
+ ## @jgengine/assets/generated-sprites
150
+
151
+ - `generatedSpriteBySource` (const): const generatedSpriteBySource: Record<string, IndexEntry[]> — Pulled sprite/icon entries grouped by source id.
152
+ - `generatedSpriteIndex` (const): const generatedSpriteIndex: IndexEntry[] — Every pulled sprite/icon entry across all sources, flattened.
153
+
154
+ ## @jgengine/assets/indexGen
155
+
156
+ - `ReindexResult` (interface): interface ReindexResult — ⚠ undocumented
157
+ - `entryForFile` (function): function entryForFile(source: AssetSource, file: string, dims?: ModelDims): IndexEntry — ⚠ undocumented
158
+ - `indexSourceDir` (function): function indexSourceDir(source: AssetSource, dir: string): IndexEntry[] — ⚠ undocumented
159
+ - `keyFromFile` (function): function keyFromFile(file: string): string — ⚠ undocumented
160
+ - `reindex` (function): function reindex(modelsDir: string, outDir: string): ReindexResult — ⚠ undocumented
161
+
162
+ ## @jgengine/assets/manifest
163
+
164
+ - `AssetAlias` (interface): interface AssetAlias — ⚠ undocumented
165
+ - `AssetDownload` (type): type AssetDownload = PinnedDownload | ScrapeDownload — ⚠ undocumented
166
+ - `AssetProvider` (type): type AssetProvider = | "quaternius" | "kaykit" | "polypizza" | "itch" | "ambientcg" | "gameicons" | "custom" — ⚠ undocumented
167
+ - `AssetSource` (interface): interface AssetSource — ⚠ undocumented
168
+ - `AssetSourceKind` (type): type AssetSourceKind = "model" | "material" | "sprite" — What a source's archive contains: GLB models (default), one PBR material's texture maps, or a pack of individual 2D sprite/icon files (SVG/PNG).
169
+ - `AssetSpace` (interface): interface AssetSpace — Catalog-level asset-space metadata: how a model is authored relative to the engine, owned by the catalog entry rather than re-derived per game. Every field is optional so an unmeasured asset stays valid; {@link resolveFacingRotationY}/{@link assetUnitScale}/{@link resolveAnchorOffset} supply the documented defaults.
170
+ - `IndexEntry` (interface): interface IndexEntry — ⚠ undocumented
171
+ - `ModelDims` (interface): interface ModelDims — Measured horizontal footprint, footprint center, and lowest Y of a model in model space.
172
+ - `PinnedDownload` (interface): interface PinnedDownload — ⚠ undocumented
173
+ - `ScrapeDownload` (interface): interface ScrapeDownload — ⚠ undocumented
174
+ - `SingleAsset` (interface): interface SingleAsset — ⚠ undocumented
175
+ - `isScrapeDownload` (function): function isScrapeDownload(download: AssetDownload): download is ScrapeDownload — ⚠ undocumented
176
+
177
+ ## @jgengine/assets/materials
178
+
179
+ - `BuildMaterialCatalogOptions` (interface): interface BuildMaterialCatalogOptions — Options for `buildMaterialCatalog`.
180
+ - `ExtractedMaterialMap` (interface): interface ExtractedMaterialMap — One normalized map pulled out of a material archive by `extractMaterialMaps`.
181
+ - `MATERIAL_MAP_FILES` (const): const MATERIAL_MAP_FILES: { readonly color: "color.jpg"; readonly normal: "normal.jpg"; readonly roughness: "roughness.jpg"; readonly ao: "ao.jpg"; readonly displacement: "displacement.jpg"; } — Normalized filenames a pulled material directory contains, keyed by map role.
182
+ - `MaterialCatalog` (interface): interface MaterialCatalog — Resolves material ids and `material/…` aliases to `MaterialRef`s.
183
+ - `MaterialMapRole` (type): type MaterialMapRole = keyof typeof MATERIAL_MAP_FILES — One PBR map's role within a material: color, normal, roughness, ao, or displacement.
184
+ - `MaterialMaps` (interface): interface MaterialMaps — URLs of one material's PBR maps; `ao`/`displacement` files may be absent from a rare pack.
185
+ - `MaterialRef` (interface): interface MaterialRef — A resolved material: identity, attribution, and its normalized map URLs.
186
+ - `buildMaterialCatalog` (function): function buildMaterialCatalog(options: BuildMaterialCatalogOptions = {}): MaterialCatalog — A resolvable catalog over every `kind: "material"` source. Ids are source ids (`ambientcg-grass001`) plus the `material/…` aliases; every resolve returns the normalized map URLs under `basePath`, matching what `assets pull` writes into `<dir>/materials/<id>/`.
187
+ - `extractMaterialMaps` (function): function extractMaterialMaps(archive: Uint8Array): ExtractedMaterialMap[] — Pulls the recognized PBR maps out of a material archive (ambientCG's flat `<Asset>_<Res>_<Map>.jpg` layout) and normalizes their names so resolved URLs never depend on the provider's naming or the pulled resolution.
188
+ - `materialAliases` (const): const materialAliases: readonly AssetAlias[] — Semantic keys onto the ambientCG catalog, mirroring the model alias layer.
189
+
190
+ ## @jgengine/assets/packs/starter
191
+
192
+ - `STARTER_ASSETS` (const): const STARTER_ASSETS: readonly StarterAsset[] — Flat list of every curated starter asset across themes.
193
+ - `STARTER_PACKS` (const): const STARTER_PACKS: Readonly<Record<StarterTheme, readonly StarterAsset[]>> — Theme → assets table for browse/docs (`STARTER_PACKS.people`, …).
194
+ - `STARTER_SOURCE_PACKS` (const): const STARTER_SOURCE_PACKS: readonly string[] — Source pack ids a game must pull so every starter asset URL resolves on disk.
195
+ - `STARTER_THEMES` (const): const STARTER_THEMES: readonly StarterTheme[] — Ordered starter theme ids: people, props, nature, urban.
196
+ - `StarterAsset` (interface): interface StarterAsset — One curated starter model: short id, theme, live catalog target, license, suggested height.
197
+ - `StarterTheme` (type): type StarterTheme = "people" | "props" | "nature" | "urban" — Curated drop-in starter themes for new games. Each entry maps a short semantic id (also registered as `asset:<id>`) to a live catalog GLB that is already measured (dims/anchor flow from the generated index via the alias target). Games wire them as `entityModels: { guest: "asset:person_casual" }`. Never Kenney — Quaternius / KayKit only.
198
+
199
+ ## @jgengine/assets/provisioning
200
+
201
+ - `AssetProvenance` (interface): interface AssetProvenance — The resolved ownership of one logical asset id — the provisioning contract for that id.
202
+ - `AssetProvenanceKind` (type): type AssetProvenanceKind = "committed" | "provisioned" | "dangling" — How an asset id's bytes reach a clean checkout: - `committed` — resolves to a self-hosted / remote URL carried in the shipped index (a {@link SingleAsset}); no pull step, available immediately. - `provisioned` — a pack {@link IndexEntry}; the id is declared but its GLB is fetched on demand by `assets pull <source>` into the consumer's served dir. - `dangling` — nothing in the index, singles, or aliases owns the id, so no provisioning step exists and it can never resolve on a clean clone.
203
+ - `AssetReference` (interface): interface AssetReference — A logical asset id referenced by some consumer (a game, scene, or config), for validation.
204
+ - `ReferenceValidation` (interface): interface ReferenceValidation — The verdict for one {@link AssetReference}.
205
+ - `ResolveProvenanceOptions` (interface): interface ResolveProvenanceOptions — Override the data {@link resolveProvenance} resolves against; every field defaults to the shipped catalog.
206
+ - `ValidateAssetReferencesOptions` (interface): interface ValidateAssetReferencesOptions extends ResolveProvenanceOptions — Options for {@link validateAssetReferences}: the resolution data plus an optional on-disk `present` check.
207
+ - `ValidateAssetReferencesResult` (interface): interface ValidateAssetReferencesResult — The aggregate result of validating a set of references against the provisioning contract.
208
+ - `resolveProvenance` (function): function resolveProvenance(id: string, options: ResolveProvenanceOptions = {}): AssetProvenance — Resolve one logical asset id (a pack id, a single id, or an alias key) to its {@link AssetProvenance}. Aliases are followed one hop to their target. An id that matches no declared owner is `dangling` — the signal a clean-clone gate turns into a hard failure, because no provisioning step can ever satisfy it.
209
+ - `validateAssetReferences` (function): function validateAssetReferences(references: readonly AssetReference[], options: ValidateAssetReferencesOptions = {}): ValidateAssetReferencesResult — Validate that every {@link AssetReference} resolves against the declared provisioning contract — not by grepping source text, but by resolving each logical id to its committed / provisioned / dangling owner. A `dangling` reference fails with the referencing consumer, the logical id, the (null) resolved path, and the missing provisioning step; a `provisioned` reference passes and contributes its `assets pull <source>` step to `provisioning` (unless `present` is supplied and reports the bytes absent).
210
+
211
+ ## @jgengine/assets/registry
212
+
213
+ - `RegistryCatalog` (interface): interface RegistryCatalog — ⚠ undocumented
214
+ - `RegistryComponent` (interface): interface RegistryComponent — ⚠ undocumented
215
+ - `componentInstallUrl` (function): function componentInstallUrl(name: string): string — The `shadcn add` URL for a HUD component, e.g. `https://jgengine.com/r/vital-bar.json`.
216
+ - `registryCatalog` (const): const registryCatalog: RegistryCatalog — ⚠ undocumented
217
+
218
+ ## @jgengine/assets/singles
219
+
220
+ - `singles` (const): const singles: readonly SingleAsset[] — ⚠ undocumented
221
+
222
+ ## @jgengine/assets/snippet
223
+
224
+ - `ModelSnippetOptions` (interface): interface ModelSnippetOptions — ⚠ undocumented
225
+ - `componentWiringSnippet` (function): function componentWiringSnippet(component: RegistryComponent): string — Copy-paste wiring for a HUD component: the `shadcn add` command plus import + usage.
226
+ - `iconWiringSnippet` (function): function iconWiringSnippet(name: string): string — Copy-paste wiring for a HUD glyph from the registry `game-icon` catalog.
227
+ - `materialWiringSnippet` (function): function materialWiringSnippet(id: string, basePath = "/materials"): string — Copy-paste wiring for a pulled PBR material: resolve the map URLs through the material catalog, then apply them onto terrain or a model.
228
+ - `modelWiringSnippet` (function): function modelWiringSnippet(id: string, options: ModelSnippetOptions = {}): string — Copy-paste wiring for a pulled GLB id: resolve through the catalog, drop into a model seam.
229
+ - `spriteWiringSnippet` (function): function spriteWiringSnippet(id: string, basePath = "/sprites"): string — Copy-paste wiring for a pulled sprite/icon-pack file: resolve through the sprite catalog.
230
+
231
+ ## @jgengine/assets/sources
232
+
233
+ - `ambientcgSources` (const): const ambientcgSources: readonly AssetSource[] — Every ambientCG material source, generated per family (`ambientcg-grass001` … ).
234
+ - `gameiconsSources` (const): const gameiconsSources: readonly AssetSource[] — game-icons.net (https://game-icons.net) — ~4,000 CC BY 3.0 SVG item/ability icons from 40+ contributing artists, mirrored as one GitHub repo (github.com/game-icons/icons). `HEAD` resolves the default branch without pinning a name or commit, so this always mirrors the current set; the per-artist `license.txt` files inside the repo carry the individual credits behind this pack's single collective `author` field.
235
+ - `kaykitSources` (const): const kaykitSources: readonly AssetSource[] — ⚠ undocumented
236
+ - `materialSources` (const): const materialSources: readonly AssetSource[] — Every `kind: "material"` source — one CC0 PBR material each, resolvable via `buildMaterialCatalog`.
237
+ - `modelSources` (const): const modelSources: readonly AssetSource[] — Every source whose archive holds GLB models (Quaternius, KayKit packs).
238
+ - `quaterniusSources` (const): const quaterniusSources: readonly AssetSource[] — ⚠ undocumented
239
+ - `sourceById` (const): const sourceById: ReadonlyMap<string, AssetSource> — ⚠ undocumented
240
+ - `sources` (const): const sources: readonly AssetSource[] — ⚠ undocumented
241
+ - `spriteSources` (const): const spriteSources: readonly AssetSource[] — Every `kind: "sprite"` source — a pack of individual 2D icon/UI files, resolvable via `buildSpriteCatalog`.
242
+
243
+ ## @jgengine/assets/sources/ambientcg
244
+
245
+ - `ambientcgAssetId` (function): function ambientcgAssetId(source: AssetSource): string — Upstream asset id (`Grass001`) for a material source id (`ambientcg-grass001`).
246
+ - `ambientcgSources` (const): const ambientcgSources: readonly AssetSource[] — Every ambientCG material source, generated per family (`ambientcg-grass001` … ).
247
+
248
+ ## @jgengine/assets/sources/gameicons
249
+
250
+ - `gameiconsSources` (const): const gameiconsSources: readonly AssetSource[] — game-icons.net (https://game-icons.net) — ~4,000 CC BY 3.0 SVG item/ability icons from 40+ contributing artists, mirrored as one GitHub repo (github.com/game-icons/icons). `HEAD` resolves the default branch without pinning a name or commit, so this always mirrors the current set; the per-artist `license.txt` files inside the repo carry the individual credits behind this pack's single collective `author` field.
251
+
252
+ ## @jgengine/assets/sources/kaykit
253
+
254
+ - `kaykitSources` (const): const kaykitSources: readonly AssetSource[] — ⚠ undocumented
255
+
256
+ ## @jgengine/assets/sources/quaternius
257
+
258
+ - `quaterniusSources` (const): const quaterniusSources: readonly AssetSource[] — ⚠ undocumented
259
+
260
+ ## @jgengine/assets/spriteIndexGen
261
+
262
+ - `ReindexSpritesResult` (interface): interface ReindexSpritesResult — Per-source and total counts returned by `reindexSprites`.
263
+ - `entryForSpriteFile` (function): function entryForSpriteFile(source: AssetSource, file: string): IndexEntry — Builds one sprite/icon `IndexEntry` — same shape as a model entry, minus `dims`.
264
+ - `indexSpriteSourceDir` (function): function indexSpriteSourceDir(source: AssetSource, dir: string): IndexEntry[] — Walks a pulled sprite-pack directory and returns one `IndexEntry` per SVG/PNG, deduped by filename.
265
+ - `keyFromSpriteFile` (function): function keyFromSpriteFile(file: string): string — Strips the `.svg`/`.png` extension off a pulled sprite/icon filename to get its id suffix.
266
+ - `reindexSprites` (function): function reindexSprites(spritesDir: string, outDir: string): ReindexSpritesResult — Same shape as `reindex` (models) but walks SVG/PNG files and skips dims measurement — sprites have no footprint.
267
+
268
+ ## @jgengine/assets/verify
269
+
270
+ - `VerifyInput` (interface): interface VerifyInput — ⚠ undocumented
271
+ - `VerifyResult` (interface): interface VerifyResult — ⚠ undocumented
272
+ - `verifyData` (function): function verifyData(input: VerifyInput): VerifyResult — ⚠ undocumented
273
+ - `verifyManifest` (function): function verifyManifest(): VerifyResult — ⚠ undocumented
@@ -0,0 +1,13 @@
1
+ <!-- GENERATED by scripts/gen-capability-index.ts — do not edit. Regenerate: bun run gen:capabilities -->
2
+
3
+ # jgengine-assets — capability index
4
+
5
+ Reach for these before hand-rolling. Each row is *the thing you need* → *the primitive that already does it*.
6
+
7
+ ## asset-reference-integrity — validate asset references against the provisioning contract (dangling / committed / provisioned)
8
+
9
+ - `validateAssetReferences` (function) · `import { validateAssetReferences } from "@jgengine/assets"`
10
+
11
+ ## starter-packs — themed CC0 model ids (people/props/nature/urban) ready for entityModels
12
+
13
+ - `StarterTheme` (type) · `import { StarterTheme } from "@jgengine/assets"`