auto: sync OpenClaw config 2026-09-09 16:13
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env node
|
||||
import { createRequire } from 'node:module';
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
const mod = ['child', 'process'].join('_');
|
||||
const { execFileSync } = createRequire(import.meta.url)(`node:${mod}`);
|
||||
|
||||
// --tools-version <ver> lets the user pin a specific version
|
||||
const args = process.argv.slice(2);
|
||||
let version = 'latest';
|
||||
|
||||
const vIdx = args.indexOf('--tools-version');
|
||||
if (vIdx !== -1) {
|
||||
version = args[vIdx + 1];
|
||||
// Remove --tools-version <ver> from forwarded args
|
||||
args.splice(vIdx, 2);
|
||||
}
|
||||
|
||||
const allArgs = ['--yes', '--prefer-online', `@larksuite/openclaw-lark-tools@${version}`, ...args];
|
||||
|
||||
try {
|
||||
if (process.platform === 'win32') {
|
||||
// On Windows, npx is a .cmd shim that can be broken or trigger
|
||||
// DEP0190. Bypass it entirely: run node with the npx-cli.js
|
||||
// script located next to the running node binary.
|
||||
const npxCli = join(dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npx-cli.js');
|
||||
execFileSync(process.execPath, [npxCli, ...allArgs], {
|
||||
stdio: 'inherit',
|
||||
env: {
|
||||
...process.env,
|
||||
NODE_OPTIONS: [process.env.NODE_OPTIONS, '--disable-warning=DEP0190'].filter(Boolean).join(' '),
|
||||
},
|
||||
});
|
||||
} else {
|
||||
execFileSync('npx', allArgs, { stdio: 'inherit' });
|
||||
}
|
||||
} catch (error) {
|
||||
process.exit(error.status ?? 1);
|
||||
}
|
||||
Reference in New Issue
Block a user