@series-inc/stowkit-cli 0.1.0 → 0.1.2

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 (3) hide show
  1. package/dist/cli.js +26 -18
  2. package/package.json +35 -35
  3. package/skill.md +211 -211
package/dist/cli.js CHANGED
@@ -11,34 +11,42 @@ const args = process.argv.slice(2);
11
11
  const thisDir = path.dirname(fileURLToPath(import.meta.url));
12
12
  const req = createRequire(import.meta.url);
13
13
  function printUsage() {
14
- console.log(`
15
- Usage:
16
- stowkit init [dir] Initialize a StowKit project
17
- stowkit build [dir] Full build: scan + process + pack
18
- stowkit scan [dir] Detect new assets, generate .stowmeta defaults
19
- stowkit process [dir] Compress assets (respects cache)
20
- stowkit status [dir] Show project summary, stale asset count
21
- stowkit clean [dir] Delete orphaned .stowcache and .stowmeta files
22
- stowkit packer [dir] Open the packer GUI
23
- stowkit editor [dir] Open the level editor
24
- stowkit serve [dir] Start API server only (no GUI)
25
-
26
- Options:
27
- --force Ignore cache and reprocess everything
28
- --verbose Detailed output
29
- --port Server port (default 3210)
30
- --help Show this help message
14
+ console.log(`
15
+ Usage:
16
+ stowkit init [dir] Initialize a StowKit project
17
+ stowkit build [dir] Full build: scan + process + pack
18
+ stowkit scan [dir] Detect new assets, generate .stowmeta defaults
19
+ stowkit process [dir] Compress assets (respects cache)
20
+ stowkit status [dir] Show project summary, stale asset count
21
+ stowkit clean [dir] Delete orphaned .stowcache and .stowmeta files
22
+ stowkit packer [dir] Open the packer GUI
23
+ stowkit editor [dir] Open the level editor
24
+ stowkit serve [dir] Start API server only (no GUI)
25
+
26
+ Options:
27
+ --force Ignore cache and reprocess everything
28
+ --verbose Detailed output
29
+ --port Server port (default 3210)
30
+ --help Show this help message
31
31
  `.trim());
32
32
  }
33
33
  function resolveAppDir(packageName, monorepoFolder) {
34
34
  const candidates = [
35
35
  path.resolve(thisDir, `../../${monorepoFolder}/dist`), // monorepo dev
36
36
  ];
37
+ // Try resolving from CLI package location
37
38
  try {
38
39
  const pkgJson = req.resolve(`${packageName}/package.json`);
39
40
  candidates.push(path.join(path.dirname(pkgJson), 'dist'));
40
41
  }
41
- catch { /* not installed */ }
42
+ catch { /* not installed next to CLI */ }
43
+ // Try resolving from user's project (npx runs CLI from global cache)
44
+ try {
45
+ const projectReq = createRequire(path.join(process.cwd(), 'package.json'));
46
+ const pkgJson = projectReq.resolve(`${packageName}/package.json`);
47
+ candidates.push(path.join(path.dirname(pkgJson), 'dist'));
48
+ }
49
+ catch { /* not installed in project */ }
42
50
  for (const dir of candidates) {
43
51
  if (existsSync(path.join(dir, 'index.html')))
44
52
  return dir;
package/package.json CHANGED
@@ -1,35 +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
- }
1
+ {
2
+ "name": "@series-inc/stowkit-cli",
3
+ "version": "0.1.2",
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 CHANGED
@@ -1,211 +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`
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`