Upload sync.py with huggingface_hub
Browse files10 unmodified lines1112131415161719 unmodified lines373839404142434445464744 unmodified lines92939495969798991001011021031048910510610710810 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 seconds
19 unmodified lines if 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 deletions shutil.copytree(OPENCODE_DIR, CACHE_DIR, dirs_exist_ok=True) print("Restoration complete.")44 unmodified lines token=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"] ) # 3. Rebuild local deletion cache # 4. Rebuild local deletion cache if CACHE_DIR.exists(): shutil.rmtree(CACHE_DIR) shutil.copytree(OPENCODE_DIR, CACHE_DIR, dirs_exist_ok=True)sync.py+17-1