@series-inc/stowkit-cli 0.1.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 (56) hide show
  1. package/dist/app/blob-store.d.ts +9 -0
  2. package/dist/app/blob-store.js +42 -0
  3. package/dist/app/disk-project.d.ts +84 -0
  4. package/dist/app/disk-project.js +70 -0
  5. package/dist/app/process-cache.d.ts +10 -0
  6. package/dist/app/process-cache.js +126 -0
  7. package/dist/app/state.d.ts +38 -0
  8. package/dist/app/state.js +16 -0
  9. package/dist/app/stowmat-io.d.ts +6 -0
  10. package/dist/app/stowmat-io.js +48 -0
  11. package/dist/app/stowmeta-io.d.ts +14 -0
  12. package/dist/app/stowmeta-io.js +207 -0
  13. package/dist/cleanup.d.ts +3 -0
  14. package/dist/cleanup.js +72 -0
  15. package/dist/cli.d.ts +2 -0
  16. package/dist/cli.js +148 -0
  17. package/dist/core/binary.d.ts +41 -0
  18. package/dist/core/binary.js +118 -0
  19. package/dist/core/constants.d.ts +64 -0
  20. package/dist/core/constants.js +65 -0
  21. package/dist/core/path.d.ts +3 -0
  22. package/dist/core/path.js +27 -0
  23. package/dist/core/types.d.ts +204 -0
  24. package/dist/core/types.js +76 -0
  25. package/dist/encoders/aac-encoder.d.ts +12 -0
  26. package/dist/encoders/aac-encoder.js +179 -0
  27. package/dist/encoders/basis-encoder.d.ts +15 -0
  28. package/dist/encoders/basis-encoder.js +116 -0
  29. package/dist/encoders/draco-encoder.d.ts +11 -0
  30. package/dist/encoders/draco-encoder.js +155 -0
  31. package/dist/encoders/fbx-loader.d.ts +4 -0
  32. package/dist/encoders/fbx-loader.js +540 -0
  33. package/dist/encoders/image-decoder.d.ts +13 -0
  34. package/dist/encoders/image-decoder.js +33 -0
  35. package/dist/encoders/interfaces.d.ts +105 -0
  36. package/dist/encoders/interfaces.js +1 -0
  37. package/dist/encoders/skinned-mesh-builder.d.ts +7 -0
  38. package/dist/encoders/skinned-mesh-builder.js +135 -0
  39. package/dist/format/metadata.d.ts +18 -0
  40. package/dist/format/metadata.js +381 -0
  41. package/dist/format/packer.d.ts +8 -0
  42. package/dist/format/packer.js +87 -0
  43. package/dist/index.d.ts +28 -0
  44. package/dist/index.js +35 -0
  45. package/dist/init.d.ts +1 -0
  46. package/dist/init.js +73 -0
  47. package/dist/node-fs.d.ts +22 -0
  48. package/dist/node-fs.js +148 -0
  49. package/dist/orchestrator.d.ts +20 -0
  50. package/dist/orchestrator.js +301 -0
  51. package/dist/pipeline.d.ts +23 -0
  52. package/dist/pipeline.js +354 -0
  53. package/dist/server.d.ts +9 -0
  54. package/dist/server.js +859 -0
  55. package/package.json +35 -0
  56. package/skill.md +211 -0
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@series-inc/stowkit-cli",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "stowkit": "./dist/cli.js"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "skill.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "dev": "tsc --watch"
17
+ },
18
+ "dependencies": {
19
+ "draco3d": "^1.5.7",
20
+ "fbx-parser": "^2.1.3",
21
+ "ffmpeg-static": "^5.2.0",
22
+ "sharp": "^0.33.5",
23
+ "three": "^0.182.0",
24
+ "ws": "^8.18.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^24.10.1",
28
+ "@types/three": "^0.182.0",
29
+ "@types/ws": "^8.5.13",
30
+ "typescript": "~5.9.3"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }
package/skill.md ADDED
@@ -0,0 +1,211 @@
1
+ # StowKit Asset Pipeline
2
+
3
+ StowKit is a game asset pipeline that compresses and packs assets into `.stow` binary files for runtime loading.
4
+
5
+ ## Project Structure
6
+
7
+ A StowKit project has a `.felicityproject` JSON file at its root:
8
+
9
+ ```json
10
+ {
11
+ "srcArtDir": "assets",
12
+ "name": "My Game",
13
+ "cdnAssetsPath": "public/cdn-assets",
14
+ "packs": [{ "name": "default" }]
15
+ }
16
+ ```
17
+
18
+ - `srcArtDir` — directory containing source art files (PNG, JPG, FBX, WAV, etc.)
19
+ - `cdnAssetsPath` — output directory for built `.stow` packs
20
+ - `packs` — named packs to split assets into
21
+
22
+ ## CLI Commands
23
+
24
+ ```bash
25
+ npx stowkit init # Scaffold a new project (creates .felicityproject, assets/, public/cdn-assets/)
26
+ npx stowkit build # Full build: scan + compress + pack (reads from cwd)
27
+ npx stowkit scan # Detect new assets and generate .stowmeta defaults
28
+ npx stowkit status # Show project info and how many assets need processing
29
+ npx stowkit packer # Open the visual packer GUI in browser
30
+ npx stowkit build --force # Reprocess everything, ignore cache
31
+ ```
32
+
33
+ All commands default to the current directory. Pass a path as second argument to target a different directory.
34
+
35
+ ## Supported Asset Types
36
+
37
+ | Type | Extensions | Compression |
38
+ |------|-----------|-------------|
39
+ | Texture2D | png, jpg, jpeg, bmp, tga, webp, gif | KTX2 (Basis Universal) |
40
+ | Audio | wav, mp3, ogg, flac, aac, m4a | AAC (M4A container) |
41
+ | StaticMesh | fbx, obj, gltf, glb | Draco |
42
+ | SkinnedMesh | fbx | Uncompressed interleaved vertex data |
43
+ | AnimationClip | fbx | v2 format (Three.js-native tracks) |
44
+ | MaterialSchema | .stowmat | Metadata only (no data blob) |
45
+
46
+ ## .stowmeta Files
47
+
48
+ Every source asset gets a `.stowmeta` sidecar file (JSON) that controls processing settings:
49
+
50
+ **Texture example:**
51
+ ```json
52
+ {
53
+ "version": 1,
54
+ "type": "texture",
55
+ "stringId": "hero_diffuse",
56
+ "tags": [],
57
+ "pack": "default",
58
+ "quality": "normal",
59
+ "resize": "full",
60
+ "generateMipmaps": false
61
+ }
62
+ ```
63
+
64
+ **Quality values:** fastest, fast, normal, high, best
65
+ **Resize values:** full, half, quarter, eighth
66
+
67
+ **Audio example:**
68
+ ```json
69
+ {
70
+ "version": 1,
71
+ "type": "audio",
72
+ "stringId": "bgm_main",
73
+ "tags": [],
74
+ "pack": "default",
75
+ "aacQuality": "medium",
76
+ "sampleRate": "auto"
77
+ }
78
+ ```
79
+
80
+ **AAC quality:** lowest, low, medium, high, best
81
+ **Sample rate:** auto, 48000, 44100, 22050, 11025
82
+
83
+ **Static mesh example:**
84
+ ```json
85
+ {
86
+ "version": 1,
87
+ "type": "staticMesh",
88
+ "stringId": "level_geometry",
89
+ "tags": [],
90
+ "pack": "default",
91
+ "dracoQuality": "balanced",
92
+ "materialOverrides": {}
93
+ }
94
+ ```
95
+
96
+ **Draco quality:** fast, balanced, high, maximum
97
+
98
+ **Skinned mesh example:**
99
+ ```json
100
+ {
101
+ "version": 1,
102
+ "type": "skinnedMesh",
103
+ "stringId": "hero_model",
104
+ "tags": [],
105
+ "pack": "default",
106
+ "materialOverrides": {}
107
+ }
108
+ ```
109
+
110
+ **Animation clip example:**
111
+ ```json
112
+ {
113
+ "version": 1,
114
+ "type": "animationClip",
115
+ "stringId": "hero_idle",
116
+ "tags": [],
117
+ "pack": "default",
118
+ "targetMeshId": null
119
+ }
120
+ ```
121
+
122
+ ## .stowmat Files (Material Schemas)
123
+
124
+ Materials are defined as `.stowmat` JSON files placed in the source art directory:
125
+
126
+ ```json
127
+ {
128
+ "version": 1,
129
+ "schemaName": "StandardPBR",
130
+ "properties": [
131
+ {
132
+ "fieldName": "Diffuse",
133
+ "fieldType": "texture",
134
+ "previewFlag": "mainTex",
135
+ "value": [1, 1, 1, 1],
136
+ "textureAsset": "textures/hero_diffuse.png"
137
+ },
138
+ {
139
+ "fieldName": "Tint",
140
+ "fieldType": "color",
141
+ "previewFlag": "tint",
142
+ "value": [1, 0.8, 0.6, 1],
143
+ "textureAsset": null
144
+ }
145
+ ]
146
+ }
147
+ ```
148
+
149
+ **Field types:** texture, color, float, vec2, vec3, vec4, int
150
+ **Preview flags:** none, mainTex, tint, alphaTest
151
+ **textureAsset:** relative path to a texture in the project (e.g. "textures/hero.png")
152
+
153
+ ## Material Overrides on Meshes
154
+
155
+ To assign materials to mesh sub-meshes, set `materialOverrides` in the mesh's `.stowmeta`:
156
+
157
+ ```json
158
+ {
159
+ "materialOverrides": {
160
+ "0": "materials/HeroSkin.stowmat",
161
+ "1": "materials/HeroArmor.stowmat"
162
+ }
163
+ }
164
+ ```
165
+
166
+ Keys are sub-mesh indices (as strings), values are relative paths to `.stowmat` files.
167
+
168
+ ## Setting Up a New Project
169
+
170
+ 1. Run `npx stowkit init` in the project root
171
+ 2. Place source art files in `assets/` (or whatever `srcArtDir` is set to)
172
+ 3. Run `npx stowkit build` to process and pack everything
173
+ 4. Output `.stow` files appear in `public/cdn-assets/`
174
+
175
+ ## Modifying Asset Settings
176
+
177
+ Edit the `.stowmeta` file for any asset, then run `npx stowkit build`.
178
+ The build respects cache — only assets whose settings or source files changed get reprocessed.
179
+ Use `--force` to reprocess everything.
180
+
181
+ ## Multi-Pack Setup
182
+
183
+ Split assets into multiple packs by editing `.felicityproject`:
184
+
185
+ ```json
186
+ {
187
+ "packs": [
188
+ { "name": "core" },
189
+ { "name": "level1" },
190
+ { "name": "level2" }
191
+ ]
192
+ }
193
+ ```
194
+
195
+ Then set `"pack": "level1"` in each asset's `.stowmeta` to assign it to a pack.
196
+
197
+ ## Cache
198
+
199
+ Processed assets are cached in `.stowcache` sidecar files next to the source.
200
+ The `.stowmeta` file stores a cache stamp (source size, modified time, settings hash).
201
+ Cache is automatically invalidated when source files or settings change.
202
+ Add `*.stowcache` to `.gitignore`.
203
+
204
+ ## Common Tasks for AI Agents
205
+
206
+ - **Add a texture:** Drop a PNG/JPG into `assets/`, run `npx stowkit scan` to generate its `.stowmeta`, optionally edit settings, then `npx stowkit build`
207
+ - **Change compression quality:** Edit the `.stowmeta` file's quality/resize fields, then `npx stowkit build`
208
+ - **Create a material:** Create a `.stowmat` JSON file in `assets/`, run `npx stowkit scan`
209
+ - **Assign material to mesh:** Edit the mesh's `.stowmeta` to add `materialOverrides`
210
+ - **Check project health:** Run `npx stowkit status`
211
+ - **Full rebuild:** `npx stowkit build --force`