Files
LobsterAI/scripts/openclaw-runtime-host.cjs
btc69m979y-dotcomandClaude Opus 4.6 6bb25e2ef2 feat: pin OpenClaw dependency to versioned releases with auto-fetch and build cache
- Add `openclaw.version` and `openclaw.repo` config in package.json
- Add `ensure-openclaw-version.cjs` to auto-clone or checkout the pinned tag
- Add build cache in `build-openclaw-runtime.sh` — skip rebuild when version matches
- Enhanced `runtime-build-info.json` with openclawVersion and openclawCommit
- Fix Windows: prefer Git Bash over WSL bash (WindowsApps\bash.exe)
- Fix Windows: normalize PATH env for bash, use relative script path
- Fix Windows: add `shell: true` for npm.cmd in openclaw-runtime-host.cjs
- Add `.gitattributes` to enforce LF line endings for .sh files
- Update README.md and README_zh.md with OpenClaw dev workflow and version management docs

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-06 16:35:07 +08:00

43 lines
938 B
JavaScript

'use strict';
const { spawnSync } = require('child_process');
const path = require('path');
function resolveHostTargetId() {
const platformMap = {
darwin: 'mac',
win32: 'win',
linux: 'linux',
};
const archMap = {
x64: 'x64',
arm64: 'arm64',
ia32: 'ia32',
};
const platform = platformMap[process.platform];
const arch = archMap[process.arch];
if (!platform || !arch) {
throw new Error(`Unsupported host platform/arch: ${process.platform}/${process.arch}`);
}
return `${platform}-${arch}`;
}
const targetId = resolveHostTargetId();
const rootDir = path.resolve(__dirname, '..');
const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const result = spawnSync(npmBin, ['run', `openclaw:runtime:${targetId}`], {
cwd: rootDir,
env: process.env,
stdio: 'inherit',
shell: true,
});
if (typeof result.status === 'number') {
process.exit(result.status);
}
process.exit(1);