Upload sync.py with huggingface_hub
Browse files10 unmodified lines11121314151619 unmodified lines36373839404144 unmodified lines8687888990919210 unmodified lines# Core directoriesWORKSPACE_DIR = Path("/home/node/workspace")OPENCODE_DIR = Path("/home/node/.local/share/opencode") # Default Linux storageCACHE_DIR = Path("/home/node/.sync_cache")INTERVAL = 30 * 60 # 30 minutes in seconds19 unmodified linesif ds_opencode.exists():shutil.copytree(ds_opencode, OPENCODE_DIR, dirs_exist_ok=True)# Create an initial cache to track future deletionsshutil.copytree(OPENCODE_DIR, CACHE_DIR, dirs_exist_ok=True)print("Restoration complete.")44 unmodified linestoken=TOKEN)# 3. Rebuild local deletion cacheif CACHE_DIR.exists():shutil.rmtree(CACHE_DIR)shutil.copytree(OPENCODE_DIR, CACHE_DIR, dirs_exist_ok=True)10 unmodified lines1112131415161719 unmodified lines373839404142434445464744 unmodified lines929394959697989910010110210310410510610710810 unmodified lines# Core directoriesWORKSPACE_DIR = Path("/home/node/workspace")OPENCODE_DIR = Path("/home/node/.local/share/opencode") # Default Linux storageGLOBAL_CONFIG_DIR = Path("/home/node/.config/opencode") # Global AGENTS.md + skillsCACHE_DIR = Path("/home/node/.sync_cache")INTERVAL = 30 * 60 # 30 minutes in seconds19 unmodified linesif ds_opencode.exists():shutil.copytree(ds_opencode, OPENCODE_DIR, dirs_exist_ok=True)# Restore global config (AGENTS.md and skills)ds_global = Path(local_dir) / "global"if ds_global.exists():shutil.copytree(ds_global, GLOBAL_CONFIG_DIR, dirs_exist_ok=True)# Create an initial cache to track future deletionsshutil.copytree(OPENCODE_DIR, CACHE_DIR, dirs_exist_ok=True)print("Restoration complete.")44 unmodified linestoken=TOKEN)# 3. Sync global config (AGENTS.md and skills)api.upload_folder(folder_path=str(GLOBAL_CONFIG_DIR),path_in_repo="global",repo_id=REPO_ID,repo_type="dataset",token=TOKEN,ignore_patterns=["node_modules", "**/node_modules/*", "*.log"])# 4. Rebuild local deletion cacheif CACHE_DIR.exists():shutil.rmtree(CACHE_DIR)shutil.copytree(OPENCODE_DIR, CACHE_DIR, dirs_exist_ok=True)
sync.py+17-1