diff options
| author | Paul Buetow <paul@buetow.org> | 2025-10-31 20:13:32 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-10-31 20:13:32 +0200 |
| commit | 11eea6a82cbfdde40ec1457c6ea080da4da6b7dc (patch) | |
| tree | 8026068f6a3beb3ee02c45f06f4487f4b89caaf1 /internal/cli/handlers.go | |
| parent | 5c3e0b5cf99d028c4f06be7a825388b296e37a22 (diff) | |
feat: implement amp AI tool support and replace Taskfile with Magev0.10.0
- Add amp as default AI tool for release notes and showcase generation
- Fallback chain: amp → hexai → claude → aichat
- Replace Taskfile.yaml with magefile.go for build automation
- Update all documentation (README.md, AGENTS.md, doc/development.md)
- Update version to 0.10.0
Amp-Thread-ID: https://ampcode.com/threads/T-735ba1e2-0255-4b43-8ed1-6c0d2f78301b
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/cli/handlers.go')
| -rw-r--r-- | internal/cli/handlers.go | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/internal/cli/handlers.go b/internal/cli/handlers.go index 02df7ae..aa43a86 100644 --- a/internal/cli/handlers.go +++ b/internal/cli/handlers.go @@ -28,7 +28,7 @@ func HandleTestGitHubToken() int { fmt.Println("Please set GITHUB_TOKEN environment variable or create ~/.gitsyncer_github_token file") return 1 } - + // Test the token by checking a known repo exists, err := client.RepoExists("gitsyncer") if err != nil { @@ -41,7 +41,7 @@ func HandleTestGitHubToken() int { } return 1 } - + fmt.Printf("SUCCESS: Token is valid! Repository check returned: %v\n", exists) return 0 } @@ -54,7 +54,7 @@ func LoadConfig(configPath string) (*config.Config, error) { return nil, fmt.Errorf("no configuration file found") } } - + fmt.Printf("Loaded configuration from: %s\n", configPath) return config.Load(configPath) } @@ -78,14 +78,14 @@ func findDefaultConfigPath() string { return loc } } - + return "" } // ShowConfigHelp displays help for creating a configuration file func ShowConfigHelp() { home, _ := os.UserHomeDir() - + fmt.Println("No configuration file found. Please create one of:") fmt.Printf(" - ./gitsyncer.json\n") fmt.Printf(" - %s/.config/gitsyncer/config.json\n", home) @@ -135,7 +135,7 @@ func HandleListRepos(cfg *config.Config) int { // ShowUsage displays the usage information func ShowUsage(cfg *config.Config) { fmt.Println("\ngitsyncer - Git repository synchronization tool") - fmt.Printf("Configured with %d organization(s) and %d repository(ies)\n", + fmt.Printf("Configured with %d organization(s) and %d repository(ies)\n", len(cfg.Organizations), len(cfg.Repositories)) fmt.Println("\nUsage:") fmt.Println(" gitsyncer --sync <repo-name> Sync a specific repository") @@ -166,18 +166,18 @@ func HandleDeleteRepo(cfg *config.Config, repoName string) int { } fmt.Printf("\n⚠️ WARNING: This will permanently delete the repository '%s' from all configured organizations!\n\n", repoName) - + // Find organizations where the repo exists var orgsWithRepo []struct { org config.Organization exists bool err error } - + for _, org := range cfg.Organizations { var exists bool var err error - + switch org.Host { case "git@github.com": client := github.NewClient(org.GitHubToken, org.Name) @@ -189,14 +189,14 @@ func HandleDeleteRepo(cfg *config.Config, repoName string) int { fmt.Printf("Skipping unsupported host: %s\n", org.Host) continue } - + orgsWithRepo = append(orgsWithRepo, struct { org config.Organization exists bool err error }{org, exists, err}) } - + // Show summary of where the repo exists fmt.Println("Repository status:") foundAny := false @@ -210,36 +210,36 @@ func HandleDeleteRepo(cfg *config.Config, repoName string) int { fmt.Printf(" ⬜ %s: Not found\n", info.org.GetGitURL()) } } - + if !foundAny { fmt.Printf("\nRepository '%s' not found in any configured organization.\n", repoName) return 0 } - + // Confirm deletion fmt.Printf("\nAre you sure you want to delete '%s' from the above organizations? This action cannot be undone!\n", repoName) fmt.Print("Type 'yes' to confirm: ") - + reader := bufio.NewReader(os.Stdin) confirmation, _ := reader.ReadString('\n') confirmation = strings.TrimSpace(confirmation) - + if confirmation != "yes" { fmt.Println("Deletion cancelled.") return 0 } - + // Perform deletions fmt.Println("\nDeleting repositories...") hasError := false - + for _, info := range orgsWithRepo { if !info.exists || info.err != nil { continue } - + fmt.Printf(" Deleting from %s... ", info.org.GetGitURL()) - + var deleteErr error switch info.org.Host { case "git@github.com": @@ -249,7 +249,7 @@ func HandleDeleteRepo(cfg *config.Config, repoName string) int { client := codeberg.NewClient(info.org.Name, info.org.CodebergToken) deleteErr = client.DeleteRepo(repoName) } - + if deleteErr != nil { fmt.Printf("FAILED: %v\n", deleteErr) hasError = true @@ -257,12 +257,12 @@ func HandleDeleteRepo(cfg *config.Config, repoName string) int { fmt.Println("SUCCESS") } } - + if hasError { fmt.Println("\n⚠️ Some deletions failed. Check the errors above.") return 1 } - + fmt.Printf("\n✅ Repository '%s' has been successfully deleted from all organizations.\n", repoName) return 0 -}
\ No newline at end of file +} |
