chore: ignore .bkit/, add CLAUDE.md and update-service.sh
This commit is contained in:
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SERVICE_NAME="clawtap.service"
|
||||
UNIT_DIR="$HOME/.config/systemd/user"
|
||||
ENV_FILE="$HOME/.clawtap/env"
|
||||
UNIT_FILE="$UNIT_DIR/$SERVICE_NAME"
|
||||
|
||||
# --- Install systemd unit if missing ---
|
||||
if [ ! -f "$UNIT_FILE" ]; then
|
||||
echo "Installing $SERVICE_NAME..."
|
||||
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
echo "ERROR: $ENV_FILE not found."
|
||||
echo "Create it with at minimum:"
|
||||
echo " CLAWTAP_PASSWORD=your-password-here"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$UNIT_DIR"
|
||||
cat > "$UNIT_FILE" <<EOF
|
||||
[Unit]
|
||||
Description=ClawTap — mobile UI for AI coding sessions
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=$REPO_DIR
|
||||
Environment=HOME=$HOME
|
||||
Environment=PATH=/usr/local/bin:/usr/bin:/bin
|
||||
EnvironmentFile=$ENV_FILE
|
||||
ExecStart=$REPO_DIR/node_modules/.bin/tsx $REPO_DIR/server/index.ts
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
StandardOutput=append:$HOME/.clawtap/server.log
|
||||
StandardError=append:$HOME/.clawtap/server.log
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable "$SERVICE_NAME"
|
||||
echo "Service installed and enabled."
|
||||
fi
|
||||
|
||||
# --- Build frontend ---
|
||||
echo "Building frontend..."
|
||||
cd "$REPO_DIR"
|
||||
npm run build
|
||||
|
||||
# --- Install CLI binary ---
|
||||
echo "Installing CLI binary..."
|
||||
sudo cp "$REPO_DIR/bin/clawtap" /usr/bin/clawtap
|
||||
|
||||
# --- Restart ---
|
||||
echo "Restarting $SERVICE_NAME..."
|
||||
systemctl --user restart "$SERVICE_NAME"
|
||||
|
||||
echo "Status:"
|
||||
systemctl --user status "$SERVICE_NAME" --no-pager
|
||||
Reference in New Issue
Block a user