From 691b24d51806e1f86b22efb3a1bf3ca938a9538d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:01:48 +0000 Subject: [PATCH] feat: Add Offline Bundle to Landing Page - Modified build.mjs to run npm pack and move tarball to dist/ - Updated landing/index.html with download link and instructions - Updated TORCH.md with Offline & Air-Gapped Installation guide Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- TORCH.md | 32 ++++++++++++++++++++++++++++++++ build.mjs | 22 ++++++++++++++++++++++ landing/index.html | 25 +++++++++++++++++++++++++ 3 files changed, 79 insertions(+) diff --git a/TORCH.md b/TORCH.md index 6058b51..cd6cdfa 100644 --- a/TORCH.md +++ b/TORCH.md @@ -307,3 +307,35 @@ The lock CLI resolves roster names in this order: 2. Stop memory maintenance scheduler processes. 3. Preserve database state for post-incident analysis; do not drop or rewrite memory tables during rollback. 4. Keep prune actions in `dry-run` (or disabled) until lifecycle policy and data integrity are revalidated. + +## Offline & Air-Gapped Installation + +TORCH is designed to operate in diverse environments, including high-security, air-gapped, or offline networks where direct access to the npm registry is restricted. + +### The Offline Bundle + +The "Offline Bundle" is a standard npm package tarball (`.tgz`) generated during the build process. It contains the complete source code and dependency definitions required to run TORCH. + +**Why use the bundle?** + +1. **Security & Integrity:** You can verify the checksum of the tarball before installing it. It creates a frozen snapshot of the code that doesn't change. +2. **No Registry Dependency:** You can install it directly using `npm install ./torch-lock-0.1.0.tgz` without needing to connect to `registry.npmjs.org`. +3. **Project Integration:** Unlike a binary executable, the tarball installs TORCH as a standard dependency in your `package.json`. This ensures: + * Scripts like `npm run lock:check` work natively. + * TORCH versioning is managed alongside your other dependencies. + * It works across all operating systems that support Node.js. + +### Installation Instructions + +1. Download the tarball from the landing page or your internal artifact repository. +2. Place it in your project root or a `vendor/` directory. +3. Run the install command: + ```bash + npm install ./torch-lock-0.1.0.tgz + ``` + *(Replace `0.1.0` with the actual version number)* + +4. Initialize TORCH: + ```bash + npx torch-lock init + ``` diff --git a/build.mjs b/build.mjs index 72c5e53..689bba0 100644 --- a/build.mjs +++ b/build.mjs @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; +import { execSync } from 'child_process'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -15,6 +16,10 @@ const PROMPTS_SRC = path.join(__dirname, 'src', 'prompts', 'META_PROMPTS.md'); const CONFIG_SRC = path.join(__dirname, 'torch-config.json'); const ASSETS_SRC = path.join(__dirname, 'assets'); +// Read package.json to get version and name +const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8')); +const tarballName = `${packageJson.name}-${packageJson.version}.tgz`; + // Ensure clean slate if (fs.existsSync(DIST_DIR)) { fs.rmSync(DIST_DIR, { recursive: true, force: true }); @@ -32,6 +37,9 @@ distHtml = distHtml.replace(/"\.\.\/dashboard\/"/g, '"dashboard/"'); // Link to distHtml = distHtml.replace(/'\.\.\/src\/docs\/TORCH\.md'/g, "'src/docs/TORCH.md'"); distHtml = distHtml.replace(/"\.\.\/assets\//g, '"assets/'); +// Inject Offline Bundle Filename +distHtml = distHtml.replace(/{{OFFLINE_BUNDLE_FILENAME}}/g, tarballName); + fs.writeFileSync(path.join(DIST_DIR, 'index.html'), distHtml); // 2. Copy dashboard/ -> dist/dashboard/ @@ -71,4 +79,18 @@ if (fs.existsSync(ASSETS_SRC)) { fs.cpSync(ASSETS_SRC, distAssets, { recursive: true }); } +// 7. Generate NPM Pack Tarball +console.log('Generating npm package tarball...'); +try { + execSync('npm pack', { stdio: 'inherit' }); + if (fs.existsSync(tarballName)) { + fs.renameSync(tarballName, path.join(DIST_DIR, tarballName)); + console.log(`Moved ${tarballName} to dist/`); + } else { + console.error(`Error: ${tarballName} not found after npm pack.`); + } +} catch (error) { + console.error('Error packing npm module:', error); +} + console.log('Build complete! Output directory: dist/'); diff --git a/landing/index.html b/landing/index.html index 44ef08a..62ded99 100644 --- a/landing/index.html +++ b/landing/index.html @@ -661,6 +661,31 @@ npm install https://github.com/PR0M3TH3AN/TORCH/archive/refs/heads/main.tar.gz & Copy + +
+

Running Offline or Air-Gapped?

+

Download the standalone bundle and install it directly without registry access.

+ + + + + + + + Download Bundle + + +
+ npm install ./{{OFFLINE_BUNDLE_FILENAME}} + +
+