{"id":29881127,"url":"https://github.com/knsh14/gitcc","last_synced_at":"2025-10-08T06:57:30.754Z","repository":{"id":306819108,"uuid":"1015796501","full_name":"knsh14/gitcc","owner":"knsh14","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-08T06:19:04.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-27T21:18:12.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knsh14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-08T03:58:29.000Z","updated_at":"2025-07-08T06:19:07.000Z","dependencies_parsed_at":"2025-07-27T21:18:15.230Z","dependency_job_id":"4d5b4a52-a92e-4c73-9bfc-9d017dce1e91","html_url":"https://github.com/knsh14/gitcc","commit_stats":null,"previous_names":["knsh14/gitcc"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/knsh14/gitcc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knsh14%2Fgitcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knsh14%2Fgitcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knsh14%2Fgitcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knsh14%2Fgitcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knsh14","download_url":"https://codeload.github.com/knsh14/gitcc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knsh14%2Fgitcc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268024675,"owners_count":24183149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-31T10:33:24.534Z","updated_at":"2025-10-08T06:57:25.731Z","avatar_url":"https://github.com/knsh14.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitcc - Git Configuration Checker\n\n[![Go Version](https://img.shields.io/badge/go-1.19+-blue.svg)](https://golang.org)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n\nA command-line tool that helps manage git user configuration across different repositories. gitcc automatically checks if your current repository has appropriate user settings and allows you to select from a predefined list of users when needed.\n\n## Features\n\n- 🔍 **Automatic Detection**: Checks if local git user configuration exists in repository\n- 👥 **User Management**: Maintains a list of users in a TOML configuration file\n- 🎯 **Smart Selection**: Only prompts for user selection when needed\n- 🤫 **Quiet Mode**: Supports quiet operation for scripting scenarios\n- ✅ **Exit Codes**: Returns meaningful exit codes for different error conditions\n- 🏗️ **Clean Architecture**: Well-structured codebase with comprehensive tests\n\n## How It Works\n\ngitcc follows a simple workflow:\n\n1. **Check Local Configuration**: Verifies if the current repository has local git user settings\n2. **Validate User**: Checks if the current user exists in your configured user list\n3. **Interactive Selection**: If needed, presents a menu to choose from available users\n4. **Apply Configuration**: Sets the selected user for the current repository\n\n## Installation\n\n### From Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/knsh14/gitcc.git\ncd gitcc\n\n# Build the binary\ngo build -o gitcc ./cmd/gitcc\n\n# Install to your PATH (optional)\nsudo mv gitcc /usr/local/bin/\n```\n\n### Using Go Install\n\n```bash\ngo install github.com/knsh14/gitcc/cmd/gitcc@latest\n```\n\n## Configuration\n\nCreate a configuration file at `~/.gitcc.toml` with your available users:\n\n```toml\n[[users]]\nname = \"John Doe\"\nemail = \"john.doe@work.com\"\n\n[[users]]\nname = \"John Doe\"\nemail = \"john.doe@personal.com\"\n\n[[users]]\nname = \"Jane Smith\"\nemail = \"jane@company.com\"\n\n[[users]]\nname = \"Developer\"\nemail = \"dev@localhost\"\n```\n\n## Usage\n\n### Basic Usage\n\n```bash\n# Run in any git repository\ngitcc\n```\n\n### Command Line Options\n\n```bash\n# Suppress error messages (useful for scripting)\ngitcc -quiet\ngitcc -q\n\n# Show help\ngitcc -h\ngitcc --help\n```\n\n### Example Output\n\n```bash\n$ gitcc\nCurrent Git Configuration:\n  user.name: John Doe\n  user.email: john.doe@oldcompany.com\n\nCurrent user is not in the configured user list.\n\nAvailable users:\n1. John Doe \u003cjohn.doe@work.com\u003e\n2. John Doe \u003cjohn.doe@personal.com\u003e\n3. Jane Smith \u003cjane@company.com\u003e\n4. Developer \u003cdev@localhost\u003e\n\nSelect a user (1-4): 1\n\nGit configuration updated:\n  user.name: John Doe\n  user.email: john.doe@work.com\n```\n\n## Exit Codes\n\ngitcc returns different exit codes based on the type of error encountered:\n\n- **0**: Success (no error)\n- **1**: General error\n- **2**: Configuration error (missing or invalid config file, no users configured)\n- **3**: Git error (git not installed, not in repository, git command failed)\n- **4**: User input error (invalid selection, out of range, no input provided)\n- **5**: Validation error (empty name/email, invalid email format)\n\nThis makes gitcc suitable for use in scripts:\n\n```bash\n# Check if gitcc succeeded\nif gitcc -q; then\n    echo \"Git configuration is properly set\"\nelse\n    echo \"Failed to configure git user (exit code: $?)\"\nfi\n```\n\n## Use Cases\n\n### Work vs Personal Repositories\n\nKeep separate identities for work and personal projects:\n\n```toml\n[[users]]\nname = \"John Doe\"\nemail = \"john.doe@company.com\"\n\n[[users]]\nname = \"John Doe\"\nemail = \"john@personal.email.com\"\n```\n\n### Team Development\n\nShare a common configuration across team members:\n\n```toml\n[[users]]\nname = \"Alice Johnson\"\nemail = \"alice@company.com\"\n\n[[users]]\nname = \"Bob Smith\"\nemail = \"bob@company.com\"\n\n[[users]]\nname = \"Service Account\"\nemail = \"ci@company.com\"\n```\n\n### Development Environments\n\nUse different identities for different environments:\n\n```toml\n[[users]]\nname = \"Developer\"\nemail = \"dev@localhost\"\n\n[[users]]\nname = \"Test User\"\nemail = \"test@staging.com\"\n\n[[users]]\nname = \"Production User\"\nemail = \"prod@company.com\"\n```\n\n## Development\n\n### Prerequisites\n\n- Go 1.19 or later\n- Git\n\n### Building from Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/knsh14/gitcc.git\ncd gitcc\n\n# Install dependencies\ngo mod tidy\n\n# Run tests\ngo test ./...\n\n# Build the application\ngo build -o gitcc ./cmd/gitcc\n\n# Run the application\n./gitcc\n```\n\n### Project Structure\n\n```\ngitcc/\n├── cmd/\n│   └── gitcc/\n│       └── main.go           # CLI entry point and flag parsing\n├── internal/\n│   ├── app/                  # Application logic and orchestration\n│   │   ├── app.go\n│   │   └── app_test.go\n│   ├── config/               # Configuration file handling\n│   │   ├── config.go\n│   │   └── config_test.go\n│   ├── errors/               # Centralized error definitions\n│   │   ├── errors.go\n│   │   └── errors_test.go\n│   ├── git/                  # Git operations\n│   │   └── git.go\n│   └── ui/                   # User interface operations\n│       ├── ui.go\n│       └── ui_test.go\n├── testdata/                 # Test data files\n│   ├── valid_users.toml\n│   ├── invalid_toml.toml\n│   └── ...\n├── go.mod\n├── go.sum\n├── README.md\n└── CLAUDE.md                 # Development guidance\n```\n\n### Architecture\n\nThe project follows clean architecture principles:\n\n- **`cmd/gitcc`**: Entry point with CLI argument parsing\n- **`internal/app`**: Core application logic and orchestration\n- **`internal/config`**: TOML configuration file handling\n- **`internal/git`**: Git command operations\n- **`internal/ui`**: User interface and input/output\n- **`internal/errors`**: Centralized error definitions using sentinel errors\n\n### Testing\n\n```bash\n# Run all tests\ngo test ./...\n\n# Run tests with coverage\ngo test -v -cover ./...\n\n# Run tests for a specific package\ngo test ./internal/config\n\n# Run a specific test\ngo test -run TestLoadAvailableUsers ./internal/config\n```\n\n### Error Handling\n\nThe project uses Go's standard error handling patterns:\n\n- **Sentinel errors**: Defined using `errors.New()` for consistent error checking\n- **Error wrapping**: Uses `fmt.Errorf` with `%w` verb to maintain error chains\n- **Error checking**: Uses `errors.Is()` for proper error type assertion\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Add tests for new functionality\n5. Ensure all tests pass (`go test ./...`)\n6. Format your code (`go fmt ./...`)\n7. Commit your changes (`git commit -m 'Add amazing feature'`)\n8. Push to the branch (`git push origin feature/amazing-feature`)\n9. Open a Pull Request\n\n### Code Style\n\n- Follow standard Go conventions\n- Use `gofmt` for formatting\n- Write clear, descriptive commit messages\n- Add tests for new functionality\n- Update documentation as needed\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Built with Go's standard library\n- Uses [BurntSushi/toml](https://github.com/BurntSushi/toml) for TOML parsing\n- Inspired by the need for better git user management across multiple repositories","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknsh14%2Fgitcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknsh14%2Fgitcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknsh14%2Fgitcc/lists"}