aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rebuild-bundles.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/scripts/rebuild-bundles.py b/scripts/rebuild-bundles.py
new file mode 100644
index 0000000..47ef12f
--- /dev/null
+++ b/scripts/rebuild-bundles.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python3
+"""
+Rebuild the core and critical-ext bundles for newOS4.
+Run this whenever a file in modules/core/ or one of the critical ext modules changes.
+"""
+import os
+
+ROOT = '/var/www/webx11.duckdns.org/spaces/newos4'
+
+CORE_FILES = [
+ 'virtual-fs.js',
+ 'module-manager.js',
+ 'ollama-manager.js',
+ 'terminal.js',
+ 'module-system.js',
+ 'module-fs.js',
+ 'module-ollama.js',
+ 'module-my.js',
+ 'module-modmgr.js',
+ 'module-searxng.js',
+ 'module-servermon.js',
+ 'module-config.js',
+ 'module-simplegui.js',
+ 'module-io.js',
+ 'module-dynamicprompts.js',
+ 'module-aiassist.js',
+ 'module-aiasm.js',
+ 'module-smartctx.js',
+ 'module-duckduckgo.js',
+ 'module-fetcher.js',
+ 'secret-vault.js',
+ 'module-chatstudio.js',
+ 'module-agent-registry.js',
+ 'module-leases.js',
+ 'module-orchestrator.js',
+ 'module-sandbox.js',
+ 'module-memory-graph.js',
+ 'module-predictor.js',
+ 'module-world-model.js',
+ 'module-neural-vfs.js',
+]
+
+CRITICAL_EXT_FILES = [
+ 'editor.js', 'shell.js', 'alias.js', 'finder.js', 'filemgr.js', 'diff.js', 'busybox.js'
+]
+
+def build_bundle(source_dir, files, output_path, label):
+ parts = [f'// {label} bundle', f'// Generated from {source_dir}', '']
+ for f in files:
+ src = os.path.join(source_dir, f)
+ with open(src, 'r', encoding='utf-8') as fh:
+ code = fh.read()
+ parts.append(f'\n/* === {f} === */\n')
+ parts.append(code)
+ if not code.endswith('\n'):
+ parts.append('\n')
+ parts.append(f'\n/* === end {label.lower()} bundle === */\n')
+ out = ''.join(parts)
+ with open(output_path, 'w', encoding='utf-8') as fh:
+ fh.write(out)
+ print(f'{output_path}: {len(out)} bytes ({len(out)/1024:.1f} KB)')
+
+def main():
+ build_bundle(
+ os.path.join(ROOT, 'modules/core'),
+ CORE_FILES,
+ os.path.join(ROOT, 'modules/core/core-bundle.js'),
+ 'Core module'
+ )
+ build_bundle(
+ os.path.join(ROOT, 'modules/ext'),
+ CRITICAL_EXT_FILES,
+ os.path.join(ROOT, 'modules/ext/critical-ext-bundle.js'),
+ 'Critical ext module'
+ )
+
+if __name__ == '__main__':
+ main()