From 3a711d08149dbaf1ac40ee5578d276dbc69e35c1 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Thu, 14 Aug 2025 15:19:37 -0400 Subject: [PATCH] Remove onboarding script (#36203) Just use `ZED_STATELESS=1 zed` instead! Release Notes: - N/A *or* Added/Fixed/Improved ... --- script/onboarding | 176 ---------------------------------------------- 1 file changed, 176 deletions(-) delete mode 100755 script/onboarding diff --git a/script/onboarding b/script/onboarding deleted file mode 100755 index 6cc878ec96..0000000000 --- a/script/onboarding +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env bash - -set -e - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -CHANNEL="$1" -COMMAND="$2" - -if [[ "$CHANNEL" != "stable" && "$CHANNEL" != "preview" && "$CHANNEL" != "nightly" && "$CHANNEL" != "dev" ]]; then - echo -e "${RED}Error: Invalid channel '$CHANNEL'. Must be one of: stable, preview, nightly, dev${NC}" - exit 1 -fi - -if [[ "$OSTYPE" == "darwin"* ]]; then - DB_BASE_DIR="$HOME/Library/Application Support/Zed/db" - DB_DIR="$DB_BASE_DIR/0-$CHANNEL" - DB_BACKUP_DIR="$DB_BASE_DIR/0-$CHANNEL.onboarding_backup" - case "$CHANNEL" in - stable) APP_NAME="Zed" ;; - preview) APP_NAME="Zed Preview" ;; - nightly) APP_NAME="Zed Nightly" ;; - dev) APP_NAME="Zed Dev" ;; - esac -elif [[ "$OSTYPE" == "linux-gnu"* ]]; then - DB_BASE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zed/db" - DB_DIR="$DB_BASE_DIR/0-$CHANNEL" - DB_BACKUP_DIR="$DB_BASE_DIR/0-$CHANNEL.onboarding_backup" - case "$CHANNEL" in - stable) APP_NAME="zed" ;; - preview) APP_NAME="zed-preview" ;; - nightly) APP_NAME="zed-nightly" ;; - dev) APP_NAME="zed-dev" ;; - esac -elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "win32" ]]; then - LOCALAPPDATA_PATH="${LOCALAPPDATA:-$USERPROFILE/AppData/Local}" - DB_BASE_DIR="$LOCALAPPDATA_PATH/Zed/db" - DB_DIR="$DB_BASE_DIR/0-$CHANNEL" - DB_BACKUP_DIR="$DB_BASE_DIR/0-$CHANNEL.onboarding_backup" - - case "$CHANNEL" in - stable) APP_NAME="Zed" ;; - preview) APP_NAME="Zed Preview" ;; - nightly) APP_NAME="Zed Nightly" ;; - dev) APP_NAME="Zed Dev" ;; - esac -else - echo -e "${RED}Error: Unsupported OS type: $OSTYPE${NC}" - exit 1 -fi - -reset_onboarding() { - echo -e "${BLUE}=== Resetting $APP_NAME to First-Time User State ===${NC}" - echo "" - - if [ ! -d "$DB_DIR" ]; then - echo -e "${YELLOW}No database directory found at: $DB_DIR${NC}" - echo "Zed will create a fresh database on next launch and show onboarding." - exit 0 - fi - - if [ -d "$DB_BACKUP_DIR" ]; then - echo -e "${RED}ERROR: Backup already exists at: $DB_BACKUP_DIR${NC}" - echo "" - echo "This suggests you've already run 'onboarding reset'." - echo "To avoid losing your original database, this script won't overwrite the backup." - echo "" - echo "Options:" - echo " 1. Run './script/onboarding $CHANNEL restore' to restore your original database" - echo " 2. Manually remove the backup if you're sure: rm -rf $DB_BACKUP_DIR" - exit 1 - fi - - echo -e "${YELLOW}Moving $DB_DIR to $DB_BACKUP_DIR${NC}" - mv "$DB_DIR" "$DB_BACKUP_DIR" - - echo -e "${GREEN}✓ Backed up: $DB_BACKUP_DIR${NC}" - echo "" - echo -e "${GREEN}Success! Zed has been reset to first-time user state.${NC}" - echo "" - echo "Next steps:" - echo " 1. Start Zed - you should see the onboarding flow" - echo " 2. When done testing, run: ./script/onboarding $CHANNEL restore" - echo "" - echo -e "${YELLOW}Note: All your workspace data is safely preserved in the backup.${NC}" -} - -restore_onboarding() { - echo -e "${BLUE}=== Restoring Original $APP_NAME Database ===${NC}" - echo "" - - if [ ! -d "$DB_BACKUP_DIR" ]; then - echo -e "${RED}ERROR: No backup found at: $DB_BACKUP_DIR${NC}" - echo "" - echo "Run './script/onboarding $CHANNEL reset' first to create a backup." - exit 1 - fi - - if [ -d "$DB_DIR" ]; then - echo -e "${YELLOW}Removing current database directory: $DB_DIR${NC}" - rm -rf "$DB_DIR" - fi - - echo -e "${YELLOW}Restoring $DB_BACKUP_DIR to $DB_DIR${NC}" - mv "$DB_BACKUP_DIR" "$DB_DIR" - - echo -e "${GREEN}✓ Restored: $DB_DIR${NC}" - echo "" - echo -e "${GREEN}Success! Your original database has been restored.${NC}" -} - -show_status() { - echo -e "${BLUE}=== Zed Onboarding Test Status ===${NC}" - echo "" - - if [ -d "$DB_BACKUP_DIR" ]; then - echo -e "${YELLOW}Status: TESTING MODE${NC}" - echo " • Original database: $DB_BACKUP_DIR" - echo " • Zed is using: $DB_DIR" - echo " • Run './script/onboarding $CHANNEL restore' to return to normal" - elif [ -d "$DB_DIR" ]; then - echo -e "${GREEN}Status: NORMAL${NC}" - echo " • Zed is using: $DB_DIR" - echo " • Run './script/onboarding $CHANNEL reset' to test onboarding" - else - echo -e "${BLUE}Status: NO DATABASE${NC}" - echo " • No Zed database directory exists yet" - echo " • Zed will show onboarding on next launch" - fi -} - -case "${COMMAND:-}" in - reset) - reset_onboarding - ;; - restore) - restore_onboarding - ;; - status) - show_status - ;; - *) - echo -e "${BLUE}Zed Onboarding Test Script${NC}" - echo "" - echo "Usage: $(basename $0) [channel] " - echo "" - echo "Commands:" - echo " reset - Back up current database and reset to show onboarding" - echo " restore - Restore the original database after testing" - echo " status - Show current testing status" - echo "" - echo "Channels:" - echo " stable, preview, nightly, dev" - echo "" - echo "Working with channel: $CHANNEL" - echo "Database directory: $DB_DIR" - echo "" - echo "Examples:" - echo " ./script/onboarding nightly reset # Reset nightly" - echo " ./script/onboarding stable reset # Reset stable" - echo " ./script/onboarding preview restore # Restore preview" - echo "" - echo "Workflow:" - echo " 1. Close Zed" - echo " 2. ./script/onboarding nightly reset" - echo " 3. Open Zed" - echo " 4. Test onboarding" - echo " 5. Close Zed" - echo " 6. ./script/onboarding nightly restore" - exit 1 - ;; -esac