@series-inc/stowkit-cli 0.1.31 → 0.6.14

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.
package/dist/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export { startServer } from './server.js';
26
26
  export type { ServerOptions } from './server.js';
27
27
  export { initProject } from './init.js';
28
28
  export { cleanupProject } from './cleanup.js';
29
+ export { syncRuntimeAssets } from './sync-runtime-assets.js';
package/dist/index.js CHANGED
@@ -33,3 +33,5 @@ export { startServer } from './server.js';
33
33
  export { initProject } from './init.js';
34
34
  // Cleanup
35
35
  export { cleanupProject } from './cleanup.js';
36
+ // Runtime asset sync
37
+ export { syncRuntimeAssets } from './sync-runtime-assets.js';
@@ -11,6 +11,7 @@ import { readStowmat, stowmatToMaterialConfig } from './app/stowmat-io.js';
11
11
  import { readCacheBlobs, writeCacheBlobs, buildCacheStamp, isCacheValid, } from './app/process-cache.js';
12
12
  import { buildPack, processExtractedAnimations, validatePackDependencies } from './pipeline.js';
13
13
  import { WorkerPool } from './workers/worker-pool.js';
14
+ import { syncRuntimeAssets } from './sync-runtime-assets.js';
14
15
  export async function scanProject(projectDir, opts) {
15
16
  const config = await readProjectConfig(projectDir);
16
17
  const scan = await scanDirectory(config.srcArtDir);
@@ -46,6 +47,8 @@ export async function fullBuild(projectDir, opts) {
46
47
  console.log(`Project: ${config.projectName}`);
47
48
  if (verbose)
48
49
  console.log(`Source dir: ${config.srcArtDir}`);
50
+ // 0. Sync WASM/Basis/Draco from node_modules → public/stowkit/
51
+ syncRuntimeAssets(projectDir, verbose);
49
52
  // 1. Scan
50
53
  const scan = await scanDirectory(config.srcArtDir);
51
54
  if (verbose)
package/dist/server.js CHANGED
@@ -10,6 +10,7 @@ import { detectAssetType, readStowmeta, writeStowmeta, stowmetaToAssetSettings,
10
10
  import { readStowmat, writeStowmat, stowmatToMaterialConfig, materialConfigToStowmat } from './app/stowmat-io.js';
11
11
  import { readCacheBlobs, writeCacheBlobs, buildCacheStamp, isCacheValid, } from './app/process-cache.js';
12
12
  import { buildPack, validatePackDependencies, processExtractedAnimations } from './pipeline.js';
13
+ import { syncRuntimeAssets } from './sync-runtime-assets.js';
13
14
  import { parseGlb, pbrToMaterialConfig } from './encoders/glb-loader.js';
14
15
  import { WorkerPool } from './workers/worker-pool.js';
15
16
  async function scanPrefabFiles(dir, prefix) {
@@ -1577,6 +1578,7 @@ export async function startServer(opts = {}) {
1577
1578
  }
1578
1579
  // Open project if specified (skip if already loaded — e.g. stowkit editor starts two servers)
1579
1580
  if (opts.projectDir && (!projectConfig || projectConfig.projectDir !== opts.projectDir)) {
1581
+ syncRuntimeAssets(opts.projectDir);
1580
1582
  await openProject(opts.projectDir);
1581
1583
  queueProcessing({ force: opts.force });
1582
1584
  }
@@ -0,0 +1,11 @@
1
+ interface SyncResult {
2
+ wasm: boolean;
3
+ basis: boolean;
4
+ draco: boolean;
5
+ }
6
+ /**
7
+ * Copy stowkit_reader.wasm, basis/, and draco/ decoders from node_modules
8
+ * into `<projectDir>/public/stowkit/`.
9
+ */
10
+ export declare function syncRuntimeAssets(projectDir: string, verbose?: boolean): SyncResult;
11
+ export {};
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Sync WASM, Basis, and Draco runtime assets from node_modules to public/stowkit/.
3
+ *
4
+ * Postinstall scripts are unreliable for keeping these in sync (they don't re-run
5
+ * on transitive dep updates). This module is called by `stowkit build` and
6
+ * `stowkit serve/packer/editor` so the files are always fresh.
7
+ */
8
+ import { existsSync, mkdirSync, readdirSync, copyFileSync, statSync } from 'node:fs';
9
+ import { join, resolve } from 'node:path';
10
+ /**
11
+ * Copy stowkit_reader.wasm, basis/, and draco/ decoders from node_modules
12
+ * into `<projectDir>/public/stowkit/`.
13
+ */
14
+ export function syncRuntimeAssets(projectDir, verbose = false) {
15
+ const dest = join(projectDir, 'public', 'stowkit');
16
+ const result = { wasm: false, basis: false, draco: false };
17
+ // ── WASM ────────────────────────────────────────────────────────────────────
18
+ const wasmCandidates = [
19
+ join(projectDir, 'node_modules', '@series-inc', 'stowkit-reader', 'dist', 'stowkit_reader.wasm'),
20
+ ];
21
+ for (const src of wasmCandidates) {
22
+ if (existsSync(src)) {
23
+ mkdirSync(dest, { recursive: true });
24
+ copyFileSync(src, join(dest, 'stowkit_reader.wasm'));
25
+ result.wasm = true;
26
+ if (verbose)
27
+ console.log(' Synced stowkit_reader.wasm → public/stowkit/');
28
+ break;
29
+ }
30
+ }
31
+ // ── Basis & Draco decoders ──────────────────────────────────────────────────
32
+ const loaderCandidates = [
33
+ join(projectDir, 'node_modules', '@series-inc', 'stowkit-three-loader', 'public'),
34
+ ];
35
+ for (const loaderPublic of loaderCandidates) {
36
+ if (!existsSync(loaderPublic))
37
+ continue;
38
+ // Guard against recursive copy
39
+ const srcAbs = resolve(loaderPublic);
40
+ const destAbs = resolve(dest);
41
+ if (destAbs.startsWith(srcAbs + '/') || destAbs.startsWith(srcAbs + '\\') || destAbs === srcAbs)
42
+ continue;
43
+ for (const subdir of ['basis', 'draco']) {
44
+ const src = join(loaderPublic, subdir);
45
+ if (!existsSync(src))
46
+ continue;
47
+ const subdirDest = join(dest, subdir);
48
+ mkdirSync(subdirDest, { recursive: true });
49
+ for (const file of readdirSync(src)) {
50
+ if (statSync(join(src, file)).isFile()) {
51
+ copyFileSync(join(src, file), join(subdirDest, file));
52
+ }
53
+ }
54
+ result[subdir] = true;
55
+ if (verbose)
56
+ console.log(` Synced ${subdir}/ → public/stowkit/${subdir}/`);
57
+ }
58
+ break;
59
+ }
60
+ if (result.wasm || result.basis || result.draco) {
61
+ const parts = [result.wasm && 'WASM', result.basis && 'Basis', result.draco && 'Draco'].filter(Boolean);
62
+ console.log(`Synced runtime assets (${parts.join(', ')}) → public/stowkit/`);
63
+ }
64
+ return result;
65
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@series-inc/stowkit-cli",
3
- "version": "0.1.31",
3
+ "version": "0.6.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "stowkit": "./dist/cli.js"
package/skill.md CHANGED
@@ -37,7 +37,8 @@ A StowKit project has a `.felicityproject` JSON file at its root:
37
37
 
38
38
  ```bash
39
39
  stowkit init [dir] # Scaffold a new project (interactive menu: pipeline only or with 3D engine)
40
- stowkit init --with-engine # Scaffold with 3D engine pre-installed
40
+ stowkit init --with-engine # Scaffold with 3D engine pre-installed (@series-inc/rundot-3d-engine + three)
41
+ stowkit init --no-engine # Scaffold without 3D engine (skip interactive prompt)
41
42
  stowkit init --update [dir] # Update AI skill files to match installed CLI version
42
43
  stowkit update # Update CLI to latest version and refresh skill files
43
44
  stowkit version # Show installed version
@@ -559,6 +560,17 @@ The CLI always re-extracts GLB containers on every build, so changes to `preserv
559
560
  - **true:** The original scene graph node hierarchy is preserved with local transforms (position, rotation, scale) per node. Use this for complex multi-part models where you need individual nodes at runtime (e.g. a vehicle with doors, a character with attachable accessories).
560
561
  - Skinned meshes are always excluded from hierarchy preservation regardless of this setting.
561
562
 
563
+ ### Inspecting built packs
564
+
565
+ Use `stowkit inspect` to examine the contents of a built `.stow` pack file:
566
+
567
+ ```bash
568
+ stowkit inspect public/cdn-assets/default.stow # Show manifest (asset names, types, sizes)
569
+ stowkit inspect public/cdn-assets/default.stow -v # Verbose — includes metadata details per asset
570
+ ```
571
+
572
+ This is useful for verifying build output, checking which assets ended up in which pack, and debugging asset loading issues at runtime.
573
+
562
574
  ### Other common tasks
563
575
 
564
576
  - **Add a texture:** Place PNG/JPG into `assets/`, run `stowkit build`. The CLI auto-generates the `.stowmeta`. Do NOT create it yourself.
@@ -572,6 +584,9 @@ The CLI always re-extracts GLB containers on every build, so changes to `preserv
572
584
  - **Move an asset:** `stowkit move textures/hero.png characters` (moves to `characters/hero.png`, updates GLB child refs if container)
573
585
  - **Delete an asset:** `stowkit delete textures/unused.png` (removes source + .stowmeta + .stowcache, cascades for GLB containers)
574
586
  - **Change an asset's stringId:** `stowkit set-id textures/hero.png hero_diffuse`
587
+ - **Inspect a built pack:** `stowkit inspect public/cdn-assets/default.stow` (shows manifest; add `-v` for detailed metadata)
575
588
  - **Check project health:** Run `stowkit status`
576
589
  - **Full rebuild:** `stowkit build --force`
577
590
  - **Clean orphaned files:** `stowkit clean`
591
+ - **Set up with engine:** `stowkit init --with-engine` (installs `@series-inc/rundot-3d-engine` + `three`)
592
+ - **Update CLI + skill files:** `stowkit update`