fix: 改用 shell wrapper 代替 bun compile(bun 1.x compile 有 bug)
install.sh 生成 shell wrapper 脚本 exec bun run cli.ts, 而非 bun build --compile(生成空文件)。 auth-cli.ts 修复 HOME 环境变量缺失时 homedir() 返回空的问题。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f079b68559
commit
ff8e74e0aa
|
|
@ -1,2 +1 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
auth-rt
|
|
||||||
|
|
|
||||||
12
install.sh
12
install.sh
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Compile auth-rt CLI binary and install to ~/.openclaw/bin/
|
# Install auth-rt CLI wrapper to ~/.openclaw/bin/
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./install.sh
|
# ./install.sh
|
||||||
|
|
@ -9,10 +9,14 @@ set -euo pipefail
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
BIN_DIR="${1:-$HOME/.openclaw/bin}"
|
BIN_DIR="${1:-$HOME/.openclaw/bin}"
|
||||||
|
SELF_DIR="$(pwd)"
|
||||||
mkdir -p "$BIN_DIR"
|
mkdir -p "$BIN_DIR"
|
||||||
|
|
||||||
echo "Compiling auth-rt..."
|
cat > "$BIN_DIR/auth-rt" <<WRAPPER
|
||||||
bun build --compile src/cli.ts --outfile "$BIN_DIR/auth-rt"
|
#!/usr/bin/env bash
|
||||||
|
exec bun run "$SELF_DIR/src/cli.ts" "\$@"
|
||||||
|
WRAPPER
|
||||||
|
chmod +x "$BIN_DIR/auth-rt"
|
||||||
|
|
||||||
echo "Installed: $BIN_DIR/auth-rt"
|
echo "Installed: $BIN_DIR/auth-rt → $SELF_DIR/src/cli.ts"
|
||||||
echo "Ensure $BIN_DIR is in your PATH."
|
echo "Ensure $BIN_DIR is in your PATH."
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"compile": "bun build --compile src/cli.ts --outfile auth-rt",
|
"clean": "rm -rf dist"
|
||||||
"clean": "rm -rf dist auth-rt"
|
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"auth",
|
"auth",
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ import { spawnSync } from 'child_process';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
|
|
||||||
|
const home = process.env.HOME || os.homedir();
|
||||||
const AUTH_RT_BIN = process.env.AUTH_RT_BIN
|
const AUTH_RT_BIN = process.env.AUTH_RT_BIN
|
||||||
|| path.join(os.homedir(), '.openclaw', 'bin', 'auth-rt');
|
|| path.join(home, '.openclaw', 'bin', 'auth-rt');
|
||||||
|
|
||||||
export interface ApiResponse {
|
export interface ApiResponse {
|
||||||
status: number;
|
status: number;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue