Finder-launched terminals now inherit a login PATH so tools like ollama resolve, destructive SFTP/editor actions require confirmation, and terminal search plus window dragging work again. SSH forwards and RDP sessions keep listeners and survive reconnect without FastPath crashes. Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
1.4 KiB
Bash
Executable File
54 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
||
set -e
|
||
|
||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||
cd "$ROOT_DIR"
|
||
|
||
# 颜色定义
|
||
RED='\033[0;31m'
|
||
GREEN='\033[0;32m'
|
||
YELLOW='\033[1;33m'
|
||
CYAN='\033[0;36m'
|
||
NC='\033[0m'
|
||
|
||
PID_FILE="/tmp/opsxshell.pid"
|
||
|
||
# Same path as src-tauri infrastructure/file_log.rs (dirs::data_local_dir).
|
||
if [ "$(uname -s)" = "Darwin" ]; then
|
||
APP_LOG="$HOME/Library/Application Support/opsxshell/logs/opsxshell.log"
|
||
else
|
||
APP_LOG="${XDG_DATA_HOME:-$HOME/.local/share}/opsxshell/logs/opsxshell.log"
|
||
fi
|
||
|
||
echo -e "${CYAN}🦐 启动 OpsXShell...${NC}"
|
||
|
||
# 1. 清理旧进程
|
||
echo -e "${YELLOW}🧹 清理旧进程...${NC}"
|
||
pkill -f "vite" 2>/dev/null || true
|
||
pkill -f "opsxshell" 2>/dev/null || true
|
||
sleep 1
|
||
|
||
# 2. 检查依赖
|
||
if [ ! -d "node_modules" ]; then
|
||
echo -e "${YELLOW}📦 安装依赖...${NC}"
|
||
npm install
|
||
fi
|
||
|
||
# 3. 启动(原生 tracing 写入应用日志目录;Vite 输出留在本终端)
|
||
echo -e "${GREEN}⚡ 启动 OpsXShell...${NC}"
|
||
npm run dev &
|
||
VITE_PID=$!
|
||
echo $VITE_PID >"$PID_FILE"
|
||
|
||
# 4. 等待启动
|
||
sleep 3
|
||
|
||
echo ""
|
||
echo -e "${GREEN}🎉 OpsXShell 已启动!${NC}"
|
||
echo -e "${CYAN}📄 应用日志: tail -f \"${APP_LOG}\"${NC}"
|
||
echo -e "${CYAN}📦 轮转: 单文件 ≤10MB,最多 opsxshell.log + .1 + .2(正式版同路径)${NC}"
|
||
echo -e "${CYAN}🔍 DevTools: 菜单「视图 → 开发者工具」,或 Cmd+Option+I / F12(前端 console)${NC}"
|
||
|
||
# 等待子进程
|
||
wait $VITE_PID 2>/dev/null || true
|