···11-# Tangled Sync
22-33-**Tangled Sync** is a TypeScript project that automates the process of syncing GitHub repositories to Tangled and publishing ATProto records for each repository. It is designed to streamline your workflow if you want your GitHub projects mirrored on Tangled while also maintaining structured metadata in ATProto.
44-55-This tool is particularly useful for developers and organisations that want a decentralized or alternative hosting layer for their code repositories while keeping them discoverable via ATProto.
66-77----
88-99-## Getting Started
1010-1111-### Configuration
1212-1313-Before running any scripts, you need to configure the project. Create a `src/.env` file based on `src/.env.example`:
1414-1515-```bash
1616-cp src/.env.example src/.env
1717-```
1818-1919-Then edit `src/.env` with your actual values:
2020-2121-* `BASE_DIR` – the local directory where GitHub repositories will be cloned.
2222-* `GITHUB_USER` – your GitHub username or organisation.
2323-* `ATPROTO_DID` – your ATProto DID (Decentralized Identifier).
2424-* `BLUESKY_PDS` – the URL of your Bluesky PDS instance.
2525-* `BLUESKY_USERNAME` – your Bluesky username.
2626-* `BLUESKY_PASSWORD` – your Bluesky password.
2727-2828-Make sure this file is properly set up before proceeding.
2929-3030----
3131-3232-### Installation
3333-3434-1. Clone this repository locally.
3535-2. Navigate to the project directory.
3636-3. Run:
11+# tangled-sync — Archived
3723838-```bash
3939-npm install
4040-```
33+> **This repository has been tombstoned.** `@ewanc26/tangled-sync` has moved to the [`@ewanc26/pkgs`](https://github.com/ewanc26/pkgs/tree/main/packages/tangled-sync) monorepo.
4144242-This will install all dependencies required for syncing GitHub repositories and interacting with ATProto.
55+This repository is kept for historical reference only and will not receive further updates.
436447---
4584646-### Verify SSH Connection to Tangled
4747-4848-* If the Tangled remote does not exist for a repository, the script will attempt to create it on first run. This requires a working SSH key associated with your account.
4949-5050-Without proper SSH authentication, repository creation and pushing will fail.
5151-5252----
5353-5454-### Testing AT Proto Connection
5555-5656-**Before running the full sync**, test your AT Proto connection:
5757-5858-```bash
5959-npm run test-atproto
6060-```
6161-6262-This will:
6363-- Verify your Bluesky credentials
6464-- Confirm your DID matches the configuration
6565-- List any existing `sh.tangled.repo` records
6666-- Validate the connection to the PDS
6767-6868-### Running the Sync Script
6969-7070-Once configuration, SSH verification, and AT Proto testing are complete, run:
7171-7272-```bash
7373-npm run sync
7474-```
7575-7676-What happens during the sync:
7777-7878-1. **Login to Bluesky:** The script authenticates using your credentials to allow publishing ATProto records.
7979-2. **Clone GitHub Repositories:** All repositories under your configured GitHub user are cloned locally (excluding a repository with the same name as your username to avoid recursion).
8080-3. **Ensure Tangled Remotes:** For each repository, a `tangled` remote is added if it doesn’t exist.
8181-4. **Push to Tangled:** The script pushes the `main` branch to Tangled. If your `origin` remote’s push URL points to Tangled, it will reset it back to GitHub.
8282-5. **Update README:** Each repository’s README is updated to include a link to its Tangled mirror, if it isn’t already present.
8383-6. **Create ATProto Records:** Each repository gets a structured record published in ATProto under your DID, including metadata like description, creation date, and source URL.
8484-8585----
8686-8787-### Notes & Best Practices
8888-8989-* **Directory Management:** The script ensures that your `BASE_DIR` exists and creates it if necessary.
9090-* **Record Uniqueness:** ATProto records use a time-based, sortable ID (TID) to ensure uniqueness. Duplicate IDs are avoided automatically.
9191-* **Error Handling:** If a repository cannot be pushed to Tangled, the script logs a warning but continues processing the remaining repositories.
9292-* **Idempotency:** Running the script multiple times is safe; existing remotes and ATProto records are checked before creation to prevent duplicates.
9393-9494----
9595-9696-### Example Workflow
9797-9898-```bash
9999-# Run the sync script
100100-npm run sync
101101-```
102102-103103-After execution, you’ll see logs detailing which repositories were cloned, which remotes were added, which READMEs were updated, and which ATProto records were created.
104104-105105-This allows you to quickly confirm that all GitHub repositories have been mirrored and documented properly on Tangled.
106106-107107----
108108-109109-### Contribution & Development
110110-111111-If you plan to contribute:
112112-113113-* Ensure Node.js v18+ and npm v9+ are installed.
114114-* Test the script in a separate directory to avoid accidentally overwriting your production repositories.
115115-* Use `console.log` statements to debug or track progress during development.
116116-* Maintain proper `.env` configuration to avoid leaking credentials.
117117-118118----
119119-120120-**Tangled Sync** bridges GitHub and Tangled efficiently, providing automatic mirroring, record management, and easy discoverability. Following these steps will ensure a smooth, automated workflow for syncing and publishing your repositories.
121121-122122-## ☕ Support
123123-124124-If you found this useful, consider [buying me a ko-fi](https://ko-fi.com/ewancroft)!
99+**New location:** [`https://github.com/ewanc26/pkgs/tree/main/packages/tangled-sync`](https://github.com/ewanc26/pkgs/tree/main/packages/tangled-sync)