Update: 将子项目从 submodule 转为完整内容

- 移除 GovAI, nomifun-tauri, 算力盒子 的 submodule 引用
- 添加所有子项目的完整源代码
- 保留原始 .git 为 .git.bak 备份
This commit is contained in:
freedak
2026-07-04 19:20:46 +08:00
parent 54d6465fa7
commit f7a720204a
3360 changed files with 802660 additions and 3 deletions
@@ -0,0 +1,90 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_DIR="${1:-$HOME/Star-Office-UI}"
PORT_FRONTEND="${PORT_FRONTEND:-19000}"
PORT_BACKEND="${PORT_BACKEND:-18791}"
URL_FRONTEND="http://127.0.0.1:${PORT_FRONTEND}"
URL_BACKEND="http://127.0.0.1:${PORT_BACKEND}"
echo "[star-office-doctor] target: $TARGET_DIR"
echo "[star-office-doctor] frontend: $URL_FRONTEND"
echo "[star-office-doctor] backend: $URL_BACKEND"
echo
check_cmd() {
local c="$1"
if command -v "$c" >/dev/null 2>&1; then
echo "OK command: $c"
else
echo "MISS command: $c"
fi
}
check_http() {
local url="$1"
local name="$2"
local code
code="$(curl -s -o /tmp/star_office_doctor_body.txt -w "%{http_code}" "$url" || true)"
if [ "$code" = "200" ] || [ "$code" = "401" ]; then
echo "OK $name http=$code url=$url"
if rg -q "Unauthorized" /tmp/star_office_doctor_body.txt 2>/dev/null; then
echo "WARN $name returns Unauthorized (likely backend auth/session not ready)"
fi
else
echo "FAIL $name http=$code url=$url"
fi
}
check_port() {
local p="$1"
if lsof -nP -iTCP:"$p" -sTCP:LISTEN >/tmp/star_office_port_"$p".txt 2>/dev/null; then
echo "OK port $p listening"
head -n 3 /tmp/star_office_port_"$p".txt
else
echo "FAIL port $p not listening"
fi
}
check_cmd python3
check_cmd git
check_cmd curl
check_cmd lsof
check_cmd rg
echo
if [ -d "$TARGET_DIR" ]; then
echo "OK directory exists: $TARGET_DIR"
else
echo "FAIL directory missing: $TARGET_DIR"
fi
if [ -f "$TARGET_DIR/backend/requirements.txt" ]; then
echo "OK backend requirements found"
else
echo "FAIL backend requirements missing"
fi
if [ -d "$TARGET_DIR/.venv" ]; then
echo "OK .venv exists"
else
echo "WARN .venv missing (run setup script)"
fi
echo
check_port "$PORT_FRONTEND"
check_port "$PORT_BACKEND"
echo
check_http "$URL_FRONTEND" "frontend"
check_http "$URL_BACKEND" "backend-root"
echo
cat <<'EOF'
Checklist:
1) If pip failed with externally-managed-environment, use:
python3 -m venv .venv && .venv/bin/python -m pip install -r backend/requirements.txt
2) If browser shows Unauthorized, backend may be running but not initialized/session missing.
3) If frontend opens but no animation, verify OpenClaw events are actually flowing to Star Office backend.
4) In Nomi preview panel, use exact URL of running frontend (usually http://127.0.0.1:19000).
EOF
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_DIR="${1:-$HOME/Star-Office-UI}"
REPO_URL="${STAR_OFFICE_REPO_URL:-https://github.com/ringhyacinth/Star-Office-UI.git}"
echo "[star-office-setup] target: $TARGET_DIR"
if ! command -v python3 >/dev/null 2>&1; then
echo "ERROR: python3 not found"
exit 1
fi
if ! command -v git >/dev/null 2>&1; then
echo "ERROR: git not found"
exit 1
fi
if [ ! -d "$TARGET_DIR/.git" ]; then
echo "[star-office-setup] cloning repo..."
git clone "$REPO_URL" "$TARGET_DIR"
else
echo "[star-office-setup] repo exists, skip clone"
fi
cd "$TARGET_DIR"
if [ ! -d ".venv" ]; then
echo "[star-office-setup] creating .venv"
python3 -m venv .venv
fi
echo "[star-office-setup] installing backend requirements in .venv"
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -r backend/requirements.txt
if [ ! -f "state.json" ] && [ -f "state.sample.json" ]; then
cp state.sample.json state.json
echo "[star-office-setup] created state.json from sample"
fi
echo ""
echo "[star-office-setup] Done. Proceed to start backend and frontend."
@@ -0,0 +1,160 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_DIR="${1:-$HOME/Star-Office-UI}"
PORT_FRONTEND="${PORT_FRONTEND:-19000}"
PORT_BACKEND="${PORT_BACKEND:-18791}"
echo "[star-office-uninstall] target: $TARGET_DIR"
echo
# --- Step 1: Kill processes matching the target directory ---
echo "[step 1/5] Stopping Star-Office-UI processes..."
killed_any=false
kill_matching() {
local pattern="$1"
local label="$2"
local pids
pids="$(pgrep -f "$pattern" 2>/dev/null || true)"
if [ -z "$pids" ]; then
return
fi
for pid in $pids; do
echo " stopping $label PID=$pid (SIGTERM)"
kill "$pid" 2>/dev/null || true
killed_any=true
done
}
# Match processes by the actual target directory path
kill_matching "$TARGET_DIR/backend" "backend"
kill_matching "$TARGET_DIR/frontend" "frontend"
# Also match by directory basename in case cwd differs from full path
dir_basename="$(basename "$TARGET_DIR")"
kill_matching "$dir_basename/backend" "backend"
kill_matching "$dir_basename/frontend" "frontend"
if [ "$killed_any" = true ]; then
echo " waiting for graceful shutdown..."
sleep 2
# Force kill any survivors
for pattern in "$TARGET_DIR/backend" "$TARGET_DIR/frontend" "$dir_basename/backend" "$dir_basename/frontend"; do
pids="$(pgrep -f "$pattern" 2>/dev/null || true)"
for pid in $pids; do
echo " force killing PID=$pid (SIGKILL)"
kill -9 "$pid" 2>/dev/null || true
done
done
else
echo " no Star-Office-UI processes found"
fi
echo
# --- Step 2: Check and clean ports ---
echo "[step 2/5] Checking ports $PORT_FRONTEND and $PORT_BACKEND..."
for port in "$PORT_FRONTEND" "$PORT_BACKEND"; do
pids="$(lsof -ti :"$port" 2>/dev/null || true)"
if [ -z "$pids" ]; then
echo " OK port $port is free"
continue
fi
for pid in $pids; do
# Check if process is related to Star Office before killing
cmd="$(ps -p "$pid" -o args= 2>/dev/null || true)"
if echo "$cmd" | grep -qi "star.office\|$dir_basename" 2>/dev/null; then
echo " killing Star-Office process on port $port, PID=$pid ($cmd)"
kill -9 "$pid" 2>/dev/null || true
else
echo " WARN port $port occupied by non-Star-Office process PID=$pid ($cmd)"
echo " skipping — kill manually if needed"
fi
done
done
sleep 1
echo
# --- Step 3: Remove directory ---
echo "[step 3/5] Removing directory $TARGET_DIR..."
if [ -d "$TARGET_DIR" ]; then
rm -rf "$TARGET_DIR"
echo " OK directory removed"
else
echo " SKIP directory does not exist"
fi
echo
# --- Step 4: Clean up temp files left by doctor script ---
echo "[step 4/5] Cleaning temp files..."
cleaned=false
for f in /tmp/star_office_doctor_body.txt /tmp/star_office_port_*.txt; do
if [ -f "$f" ]; then
rm -f "$f"
echo " removed $f"
cleaned=true
fi
done
if [ "$cleaned" = false ]; then
echo " no temp files to clean"
fi
echo
# --- Step 5: Final verification ---
echo "[step 5/5] Final verification..."
errors=0
# Check processes
if pgrep -f "$TARGET_DIR" >/dev/null 2>&1 || pgrep -f "$dir_basename/backend\|$dir_basename/frontend" >/dev/null 2>&1; then
echo " FAIL Star-Office-UI processes still running:"
pgrep -af "$TARGET_DIR" 2>/dev/null || true
pgrep -af "$dir_basename" 2>/dev/null || true
errors=$((errors + 1))
else
echo " OK no Star-Office-UI processes"
fi
# Check ports
for port in "$PORT_FRONTEND" "$PORT_BACKEND"; do
occupant="$(lsof -ti :"$port" 2>/dev/null || true)"
if [ -n "$occupant" ]; then
cmd="$(ps -p "$occupant" -o args= 2>/dev/null || true)"
if echo "$cmd" | grep -qi "star.office\|$dir_basename" 2>/dev/null; then
echo " FAIL port $port still occupied by Star-Office process"
errors=$((errors + 1))
else
echo " OK port $port occupied by unrelated process (not a Star-Office residual)"
fi
else
echo " OK port $port free"
fi
done
# Check directory
if [ -d "$TARGET_DIR" ]; then
echo " FAIL directory still exists: $TARGET_DIR"
errors=$((errors + 1))
else
echo " OK directory gone"
fi
echo
if [ "$errors" -eq 0 ]; then
echo "[star-office-uninstall] Done. Star Office has been completely uninstalled."
else
echo "[star-office-uninstall] Completed with $errors issue(s). Review output above."
fi