Move from GitHub to Tangled
1# 🎉 Tangled Sync - Ready to Use!
2
3## Summary of Changes
4
5I've improved your Tangled Sync project to ensure proper AT Proto authentication and repository record creation. Here's what was updated:
6
7### ✅ What's Fixed
8
91. **Enhanced AT Proto Login**
10 - Added better error handling and validation
11 - Shows DID and handle on successful login
12 - Clearer error messages when authentication fails
13
142. **Corrected Repository Schema**
15 - Fixed record structure to match `sh.tangled.repo` lexicon
16 - Required fields (`name`, `knot`, `createdAt`) now ordered correctly
17 - Optional fields properly marked as optional
18 - Added better error handling for record creation
19
203. **Improved Logging**
21 - More detailed startup information
22 - Better progress tracking during sync
23 - Shows AT Proto record URIs when created
24 - Success/failure messages are clearer
25
26### 📁 New Files Created
27
281. **`src/.env.example`** - Template for your configuration
292. **`src/test-atproto.ts`** - Test AT Proto connection before syncing
303. **`src/validate-config.ts`** - Validate your environment setup
314. **`SETUP.md`** - Comprehensive setup and troubleshooting guide
32
33### 🚀 How to Use
34
35#### Step 1: Configure Environment
36```bash
37# Copy the example file
38cp src/.env.example src/.env
39
40# Edit with your actual values
41nano src/.env
42```
43
44You need:
45- Your GitHub username
46- Your AT Proto DID (from Bluesky settings)
47- A Bluesky **app password** (not your main password!)
48- Base directory for repos
49
50#### Step 2: Validate Configuration
51```bash
52npm run validate
53```
54
55This checks all your environment variables are set correctly.
56
57#### Step 3: Test AT Proto Connection
58```bash
59npm run test-atproto
60```
61
62This verifies:
63- ✅ Your credentials work
64- ✅ Your DID is correct
65- ✅ You can access the PDS
66- ✅ Shows any existing Tangled repo records
67
68#### Step 4: Run the Sync
69```bash
70npm run sync
71```
72
73This will:
741. Login to AT Proto ✅
752. Fetch your GitHub repos
763. Clone them locally (if needed)
774. Add Tangled remotes
785. Push to Tangled
796. Update READMEs
807. Create AT Proto records for each repo ✅
81
82### 🔍 What to Check
83
84After running the sync, verify:
85
861. **AT Proto Records Created**
87 ```bash
88 npm run test-atproto
89 ```
90 Should show your repos listed
91
922. **Repos on Tangled**
93 Visit: `https://tangled.org/YOUR_DID/REPO_NAME`
94
953. **Local Git Remotes**
96 ```bash
97 cd YOUR_BASE_DIR/some-repo
98 git remote -v
99 ```
100 Should show both `origin` (GitHub) and `tangled` remotes
101
102### 📊 Record Schema
103
104Each repository creates a record with this structure:
105
106```typescript
107{
108 $type: "sh.tangled.repo",
109 name: "your-repo-name", // required
110 knot: "knot1.tangled.sh", // required
111 createdAt: "2024-01-01T00:00:00Z", // required
112 description: "Repo description", // optional
113 source: "https://github.com/...", // optional
114 labels: [], // optional
115}
116```
117
118This matches the official `sh.tangled.repo` lexicon schema.
119
120### ⚠️ Important Notes
121
1221. **Use App Password**: Never use your main Bluesky password. Create an app password in Settings → App Passwords.
123
1242. **Check Your DID**: Run `npm run test-atproto` first to ensure your DID in `.env` matches your actual account.
125
1263. **SSH Key Required**: Make sure your SSH key is added to Tangled at https://tangled.org/settings/keys
127
1284. **Rate Limits**: GitHub API has rate limits (60 req/hour unauthenticated). If you have many repos, consider adding GitHub auth.
129
130### 🐛 Troubleshooting
131
132**"Missing Bluesky credentials"**
133- Check `src/.env` exists and has `BLUESKY_USERNAME` and `BLUESKY_PASSWORD`
134
135**"Login failed"**
136- Verify you're using an app password, not your main password
137- Check username includes full handle (e.g., `you.bsky.social`)
138
139**"Could not push to Tangled"**
140- Verify SSH key is configured: `ssh git@tangled.sh`
141- Check repo exists on Tangled
142
143**"Failed to create ATProto record"**
144- Run `npm run test-atproto` to check connection
145- Verify your app password has write permissions
146
147See `SETUP.md` for more detailed troubleshooting.
148
149### 📚 Available Commands
150
151```bash
152npm run check # Comprehensive health check (recommended first step!)
153npm run validate # Check environment configuration only
154npm run test-atproto # Test AT Proto connection only
155npm run sync # Run sync (only new repos without AT Proto records)
156npm run sync:force # Force sync all repos (including existing)
157```
158
159#### `npm run check` - Comprehensive Health Check
160
161This is the **most useful command** for troubleshooting! It runs all checks in one go:
162
163- ✅ Configuration validation
164- ✅ AT Proto connection test
165- ✅ SSH connection to Tangled
166- ✅ GitHub API access
167- ✅ Dependencies verification
168
169**When to use:**
170- Before your first sync
171- When troubleshooting issues
172- After changing configuration
173- To verify everything is working
174
175#### Individual Check Commands
176
177**Normal sync** (recommended): Only processes repos that don't have AT Proto records yet. This is efficient and safe for regular use.
178
179**Force sync**: Processes all repos regardless of whether they already have records. Use this if you need to:
180- Re-push repos to Tangled
181- Update READMEs for all repos
182- Recover from a partial sync
183
184### ✨ Next Steps
185
1861. Copy and configure `src/.env`
1872. Run `npm run validate`
1883. Run `npm run test-atproto`
1894. Run `npm run sync`
190
191That's it! Your GitHub repos will be synced to Tangled with proper AT Proto records.
192
193---
194
195**Questions?** Check `SETUP.md` for detailed instructions and troubleshooting.
196
197**Happy syncing! 🚀**