feat: implement permission verification for repository transfers #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.




Summary
Implements automated permission verification for repository transfers, completing step 1 of issue #9. This PR adds the infrastructure to check if worlddriven org has admin access to origin repositories before attempting transfer.
Changes
New Module: Permission Verification
scripts/check-transfer-permissions.js: Core module for checking GitHub permissionscheckTransferPermission(token, originRepo)- Check single repositorycheckMultipleTransferPermissions(token, originRepos)- Batch checkingGET /repos/{owner}/{repo}/collaborators/worlddriven/permission{hasPermission, permissionLevel, details}node scripts/check-transfer-permissions.js owner/repoTests
scripts/check-transfer-permissions.test.js: Unit tests for validation logicEnhanced Drift Detection
scripts/detect-drift.js: Integrated permission checkingOriginfieldEnhanced Sync Planning
scripts/sync-repositories.js: Transfer action supporttransfer(added to plan when permissions verified)transferandtransferBlockedUpdated Documentation
REPOSITORIES.md: Comprehensive migration guidePermission Verification Flow
How It Works
Origin: owner/repo-nameGitHub API Details
GET /repos/{owner}/{repo}/collaborators/worlddriven/permissionWORLDDRIVEN_GITHUB_TOKENpermissionfieldUser Experience
PR Comments
When a PR includes a repository with Origin field:
Or if permission is missing:
Sync Plan Output
Testing
Manual Testing
Unit Tests
node --test scripts/*.test.jsAll tests passing ✅ (19 tests, 2 suites)
Implementation Status
✅ Completed (This PR)
🚧 Remaining (Future PRs)
POST /repos/{owner}/{repo}/transfer)Breaking Changes
None - this PR is fully backward compatible. Existing functionality unchanged.
Related Issue
Closes #9 (partial - completes permission verification step)
Next Steps
Notes