@series-inc/stowkit-cli 0.1.31 → 0.6.15
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/cli.js +65 -22
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/orchestrator.js +3 -0
- package/dist/server.js +2 -0
- package/dist/sync-runtime-assets.d.ts +11 -0
- package/dist/sync-runtime-assets.js +65 -0
- package/package.json +2 -2
- package/skill.md +16 -1
package/dist/cli.js
CHANGED
|
@@ -12,23 +12,59 @@ import { renameAsset, moveAsset, deleteAsset, setStringId } from './asset-comman
|
|
|
12
12
|
import { inspectPack } from './inspect.js';
|
|
13
13
|
const args = process.argv.slice(2);
|
|
14
14
|
const thisDir = path.dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const STOWKIT_PACKAGES = [
|
|
16
|
+
{ name: '@series-inc/stowkit-cli', monorepoFolder: 'stowkit-cli' },
|
|
17
|
+
{ name: '@series-inc/stowkit-packer-gui', monorepoFolder: 'stowkit-packer-gui' },
|
|
18
|
+
{ name: '@series-inc/stowkit-editor', monorepoFolder: 'stowkit-editor' },
|
|
19
|
+
];
|
|
20
|
+
function getInstalledVersion(packageName, monorepoFolder) {
|
|
21
|
+
const candidates = [
|
|
22
|
+
path.resolve(thisDir, `../../${monorepoFolder}/package.json`),
|
|
23
|
+
path.resolve(thisDir, `../node_modules/${packageName}/package.json`),
|
|
24
|
+
path.resolve(thisDir, `../../../${packageName}/package.json`),
|
|
25
|
+
];
|
|
26
|
+
// CLI itself
|
|
27
|
+
if (packageName === '@series-inc/stowkit-cli') {
|
|
28
|
+
candidates.unshift(path.resolve(thisDir, '../package.json'));
|
|
29
|
+
}
|
|
30
|
+
for (const p of candidates) {
|
|
31
|
+
try {
|
|
32
|
+
const pkg = JSON.parse(fs.readFileSync(p, 'utf-8'));
|
|
33
|
+
return pkg.version;
|
|
34
|
+
}
|
|
35
|
+
catch { /* not found */ }
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
15
39
|
function checkForUpdate() {
|
|
16
40
|
try {
|
|
17
|
-
const pkg = JSON.parse(fs.readFileSync(path.resolve(thisDir, '../package.json'), 'utf-8'));
|
|
18
|
-
const localVersion = pkg.version;
|
|
19
41
|
const controller = new AbortController();
|
|
20
42
|
const timeout = setTimeout(() => controller.abort(), 3000);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
43
|
+
const checks = STOWKIT_PACKAGES.map(({ name, monorepoFolder }) => {
|
|
44
|
+
const local = getInstalledVersion(name, monorepoFolder);
|
|
45
|
+
if (!local)
|
|
46
|
+
return Promise.resolve();
|
|
47
|
+
return fetch(`https://registry.npmjs.org/${name}/latest`, { signal: controller.signal })
|
|
48
|
+
.then(res => res.json())
|
|
49
|
+
.then((data) => {
|
|
50
|
+
const latest = data.version;
|
|
51
|
+
if (latest && latest !== local) {
|
|
52
|
+
return ` ${name}: ${local} → ${latest}`;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
})
|
|
56
|
+
.catch(() => null);
|
|
57
|
+
});
|
|
58
|
+
Promise.all(checks).then(results => {
|
|
24
59
|
clearTimeout(timeout);
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
console.log(`\n
|
|
60
|
+
const updates = results.filter(Boolean);
|
|
61
|
+
if (updates.length > 0) {
|
|
62
|
+
console.log(`\n Updates available:`);
|
|
63
|
+
for (const u of updates)
|
|
64
|
+
console.log(u);
|
|
28
65
|
console.log(` Run: stowkit update\n`);
|
|
29
66
|
}
|
|
30
|
-
})
|
|
31
|
-
.catch(() => { clearTimeout(timeout); });
|
|
67
|
+
}).catch(() => { clearTimeout(timeout); });
|
|
32
68
|
}
|
|
33
69
|
catch {
|
|
34
70
|
// Can't read package.json or fetch — skip silently
|
|
@@ -114,20 +150,27 @@ async function main() {
|
|
|
114
150
|
});
|
|
115
151
|
break;
|
|
116
152
|
case 'update': {
|
|
117
|
-
const currentVersion = getVersion();
|
|
118
|
-
console.log(`Current version: ${currentVersion}`);
|
|
119
153
|
console.log('Checking for updates...');
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
154
|
+
const { execSync } = await import('node:child_process');
|
|
155
|
+
let anyUpdated = false;
|
|
156
|
+
for (const { name, monorepoFolder } of STOWKIT_PACKAGES) {
|
|
157
|
+
const installed = getInstalledVersion(name, monorepoFolder);
|
|
158
|
+
if (!installed)
|
|
159
|
+
continue; // not installed, skip
|
|
160
|
+
const res = await fetch(`https://registry.npmjs.org/${name}/latest`);
|
|
161
|
+
const data = await res.json();
|
|
162
|
+
const latest = data.version;
|
|
163
|
+
if (latest === installed) {
|
|
164
|
+
console.log(` ${name}: ${installed} (up to date)`);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
console.log(` ${name}: ${installed} → ${latest}`);
|
|
168
|
+
execSync(`npm install -g ${name}@latest`, { stdio: 'inherit' });
|
|
169
|
+
anyUpdated = true;
|
|
170
|
+
}
|
|
125
171
|
}
|
|
126
|
-
|
|
127
|
-
console.log(
|
|
128
|
-
const { execSync } = await import('node:child_process');
|
|
129
|
-
execSync('npm install -g @series-inc/stowkit-cli@latest', { stdio: 'inherit' });
|
|
130
|
-
console.log(`Updated to ${latest}.`);
|
|
172
|
+
if (!anyUpdated) {
|
|
173
|
+
console.log('All packages are up to date.');
|
|
131
174
|
}
|
|
132
175
|
// Refresh skill files if in a StowKit project
|
|
133
176
|
const configExists = existsSync(path.resolve(projectDir, '.felicityproject'));
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/orchestrator.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"stowkit": "./dist/cli.js"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@series-inc/stowkit-packer-gui": "^0.1.17",
|
|
21
|
-
"@series-inc/stowkit-editor": "^0.1.
|
|
21
|
+
"@series-inc/stowkit-editor": "^0.1.4",
|
|
22
22
|
"draco3d": "^1.5.7",
|
|
23
23
|
"fbx-parser": "^2.1.3",
|
|
24
24
|
"@strangeape/ffmpeg-audio-wasm": "^0.1.0",
|
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`
|