Enhance repository discovery in README and setup script. Implement API access for fetching all accessible repositories, including owned, shared, and public repos. Add fallback method for pattern scanning and improve user feedback during repository selection.

This commit is contained in:
2025-07-14 11:03:27 +01:00
parent b37592e99d
commit a7d4e6ec0e
2 changed files with 124 additions and 32 deletions

View File

@@ -42,21 +42,31 @@ The script prompts for your git username, which is used to:
- Displays the public key for copying to your git account
### 3. Repository Discovery
The script automatically checks for common repository patterns:
- `username/dotfiles`
- `username/scripts`
- `username/configs`
- `username/tools`
- `username/projects`
- `username/notes`
- `username/backup`
- `username/workspace`
The script discovers ALL accessible repositories through multiple methods:
**Primary Method - API Access:**
- Attempts to use GitLab/Gitea API to fetch all repositories you have access to
- Includes both owned and shared repositories
- Automatically detects read/write permissions
**Fallback Method - Pattern Scanning:**
- Scans your own repositories: `username/dotfiles`, `username/scripts`, etc.
- Checks common shared repositories from users like: `admin`, `shared`, `public`, `team`, `common`, `devops`, `infrastructure`
- Discovers additional project repositories: `website`, `api`, `frontend`, `backend`, `database`, `monitoring`, etc.
- Tests SSH access to determine if you have read access to each repository
**Repository Types Discovered:**
- **Your repositories**: All repos you own
- **Shared repositories**: Repos you have read/write access to
- **Public repositories**: Publicly accessible repos on the server
- **Team repositories**: Organization/team repos you're a member of
### 4. Repository Selection
Users can:
- Select from numbered list of discovered repositories
- Select from numbered list of all discovered repositories (owned and shared)
- Press Enter to use `username/dotfiles` (if available)
- Type `custom` to enter a custom repository path
- See access type indicators: `(owner)`, `(shared)`, etc.
### 5. Cloning and Setup
- Clones the selected repository to the appropriate directory
@@ -101,23 +111,26 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGx... john@example.com
----------------------------------------
Press Enter after you've added the key...
[+] Fetching available git projects for user: john...
[*] Available repositories:
1. john/dotfiles
2. john/scripts
3. john/tools
[+] Fetching all accessible git projects...
[*] Attempting to fetch repositories via API...
[*] Found repositories via API:
1. john/dotfiles (owner)
2. john/scripts (owner)
3. team/shared-configs (shared)
4. admin/common-tools (shared)
5. public/templates (shared)
[?] Which project would you like to download?
Enter the number of the repository from the list above, or:
- Press Enter to use john/dotfiles (if available)
- Type 'custom' to enter a custom repository path
Enter your choice: 1
[*] Selected repository: git@git.del-c.net:john/dotfiles.git
[*] Download directory: /Users/john/.dotfiles
Enter your choice: 3
[*] Selected repository: git@git.del-c.net:team/shared-configs.git
[*] Download directory: /Users/john/shared-configs
[+] Cloning selected repository...
[+] Launching dotfiles setup using Bash...
[*] Repository cloned successfully to: /Users/john/shared-configs
```
## Troubleshooting