feat: initial commit of Git Automation CLI

- Add comprehensive Git workflow automation tools
- Include branch management utilities
- Add commit helpers with conventional commit support
- Implement GitHub integration for PR management
- Add configuration management system
- Include comprehensive test coverage
- Add professional documentation and examples
This commit is contained in:
Dev
2025-09-11 17:02:12 +03:00
commit 15bbfdcda2
27 changed files with 5727 additions and 0 deletions

60
internal/cmd/root.go Normal file
View File

@@ -0,0 +1,60 @@
package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/iwasforcedtobehere/git-automation-cli/internal/version"
"github.com/iwasforcedtobehere/git-automation-cli/internal/config"
)
var (
verbose bool
dryRun bool
)
var rootCmd = &cobra.Command{
Use: "gitauto",
Short: "Git automation toolkit",
Long: `Git Automation CLI is a fast, practical tool to automate frequent Git workflows.
It provides utilities for branch management, commit helpers, sync operations,
and integration with GitHub for pull requests and team coordination.`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Initialize configuration
if err := config.Init(); err != nil {
fmt.Fprintf(os.Stderr, "Error initializing configuration: %v\n", err)
os.Exit(1)
}
// Override config with command line flags
if verbose {
config.Set("verbose", true)
}
if dryRun {
config.Set("dry_run", true)
}
},
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version information",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("gitauto version", version.GetVersion())
},
}
func init() {
rootCmd.AddCommand(versionCmd)
// Add global flags
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
rootCmd.PersistentFlags().BoolVar(&dryRun, "dry-run", false, "dry run mode (no changes made)")
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}