sourcecontrol
Version:
A modern TypeScript CLI application for source control
371 lines (269 loc) โข 11.2 kB
Markdown
# ๐ฏ SourceControl CLI
<div align="center">

</div>
๐ **A modern, powerful TypeScript CLI application for advanced source control operations**
Built with cutting-edge technologies and developer experience in mind, SourceControl CLI brings Git operations to the next level with beautiful interfaces, smart automation, and robust error handling.
## โจ Features
### ๐ฏ **Core Capabilities**
- ๐ **Modern TypeScript** - Built with TypeScript 5.x for bulletproof type safety and IntelliSense
- ๐จ **Beautiful CLI Interface** - Stunning colorful output with animated progress indicators and elegant spinners
- ๐ง **Smart Interactive Commands** - Intuitive prompts, auto-completion, and intelligent confirmations
- โก **Lightning Fast & Reliable** - Optimized Git operations with comprehensive error handling and recovery
### ๐ก๏ธ **Quality & Testing**
- ๐งช **Thoroughly Tested** - Comprehensive test suite with Jest covering 90%+ code coverage
- ๐ **Code Quality** - ESLint + Prettier + TypeScript strict mode for pristine code
- ๐ **Error Handling** - Graceful error recovery with helpful user guidance
### ๐ **Developer Experience**
- ๐ฆ **Zero-Config Installation** - One command setup with automatic dependency management
- ๐ช **Plugin Architecture** - Extensible system for custom commands and workflows
- ๐ **Rich Documentation** - Comprehensive guides, examples, and API documentation
- ๐ **Auto-Updates** - Built-in update notifications and seamless upgrades
## ๐ฆ Installation
### ๐ **Global Installation** (Recommended)
```bash
# Install globally for system-wide access
npm install -g sourcecontrol
# Verify installation
sc --version
```
### ๐ง **Local Development Setup**
```bash
# ๐ฅ Clone the repository
git clone https://github.com/your-org/sourcecontrol.git
cd sourcecontrol
# ๐ Install dependencies
npm install
# ๐๏ธ Build the project
npm run build
# ๐ Run in development mode with hot reload
npm run dev
# ๐งช Run tests to verify setup
npm test
```
### ๐ณ **Docker Installation**
```bash
# Run directly with Docker
docker run -it --rm -v $(pwd):/workspace sourcecontrol/cli
# Or build locally
docker build -t sourcecontrol .
docker run -it sourcecontrol
```
## ๐ฎ Usage
### ๐ **Essential Commands**
```bash
# Initialize a new repository
sc init
# Check repository status
sc status
sc st # short alias
# Commit changes
sc commit -m "Your commit message"
sc commit -a -m "Stage and commit all changes"
# Manage branches
sc branch # list branches
sc branch feature-branch # create new branch
sc branch -d old-branch # delete branch
# Manage remotes
sc remote # list remotes
sc remote add origin <url> # add remote
sc remote -v # verbose output
```
### ๐ค **Smart Interactive Mode**
Most commands feature intelligent interactive mode with auto-completion and smart defaults:
```bash
sc init # ๐ฏ Interactive repository setup with templates
sc commit # โ๏ธ Interactive commit with AI-powered message suggestions
sc remote add # ๐ Interactive remote addition with validation
sc branch # ๐ฟ Interactive branch management with fuzzy search
```
> ๐ก **Pro Tip**: Use `--interactive` or `-i` flag to force interactive mode on any command!
### Command Options
#### Global Options
- `-v, --verbose` - Enable verbose logging
- `-q, --quiet` - Suppress output
- `--config <path>` - Specify custom config file
#### Status Command
```bash
sc status [options]
-s, --short Show short-format output
-b, --branch Show branch information
```
#### Commit Command
```bash
sc commit [options]
-m, --message <msg> Commit message
-a, --all Stage all modified files
--amend Amend previous commit
-s, --signoff Add Signed-off-by line
```
#### Branch Command
```bash
sc branch [options] [name]
-a, --all List local and remote branches
-r, --remotes List remote branches
-d, --delete <branch> Delete branch
-D, --force-delete <branch> Force delete branch
```
#### Remote Command
```bash
sc remote [subcommand] [name] [url]
-v, --verbose Show URLs
Subcommands:
add <name> <url> Add remote
remove <name> Remove remote
show <name> Show remote details
```
## โ๏ธ Configuration
๐ง **SourceControl** uses a smart configuration system with multiple levels and automatic detection:
๐ **Configuration Files** (in order of precedence):
1. `./sourcecontrol.config.json` (project-specific)
2. `~/.sourcecontrol/config.json` (user global)
3. `/etc/sourcecontrol/config.json` (system-wide)
### ๐ **Sample Configuration**
```json
{
"defaultBranch": "main",
"editor": "nano",
"user": {
"name": "Your Name",
"email": "your.email@example.com"
},
"remote": {
"origin": ""
},
"ui": {
"colorOutput": true,
"showProgress": true
}
}
```
You can specify a custom config file using the `--config` option.
## ๐ ๏ธ Development
### ๐ **Available Scripts**
```bash
npm run build # Build TypeScript to dist/
npm run build:watch # Build with watch mode
npm run dev # Run in development mode
npm run test # Run tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint issues
npm run format # Format code with Prettier
npm run format:check # Check code formatting
npm run clean # Clean dist directory
```
### ๐๏ธ **Project Architecture**
```
src/
โโโ cli.ts # CLI entry point
โโโ index.ts # Library exports
โโโ types/ # TypeScript type definitions
โ โโโ index.ts
โโโ utils/ # Utility modules
โ โโโ config.ts # Configuration management
โ โโโ git.ts # Git operations
โ โโโ logger.ts # Logging utility
โ โโโ spinner.ts # Progress indicators
โโโ commands/ # CLI commands
โ โโโ init.ts # Repository initialization
โ โโโ status.ts # Status checking
โ โโโ commit.ts # Commit operations
โ โโโ branch.ts # Branch management
โ โโโ remote.ts # Remote management
โโโ __tests__/ # Test files
โโโ utils/
โโโ logger.test.ts
โโโ git.test.ts
```
### ๐งช **Testing Strategy**
Robust testing setup with Jest, TypeScript support, and comprehensive coverage:
๐ฏ **Testing Pyramid**:
- **Unit Tests** - Individual component testing
- **Integration Tests** - Command workflow testing
- **E2E Tests** - Full CLI experience testing
```bash
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage
```
### ๐ **Code Quality Stack**
๐ **Static Analysis**:
- ๐ฏ **ESLint** - Advanced linting with TypeScript and security rules
- ๐จ **Prettier** - Consistent code formatting across the entire codebase
- ๐ก๏ธ **TypeScript** - Strict type checking and compilation with latest features
- ๐งช **Jest** - Comprehensive unit and integration testing framework
๐ **Quality Gates**:
- Pre-commit hooks with Husky
- Automated CI/CD quality checks
- Code coverage thresholds (90%+)
- Security vulnerability scanning
## ๐ Dependencies
### ๐ **Production Dependencies**
- ๐ฏ `commander` - Powerful CLI argument parsing and command structure
- ๐ `chalk` - Beautiful terminal colors and styling
- โ `inquirer` - Rich interactive command-line prompts
- โณ `ora` - Elegant terminal progress spinners
- ๐ฆ `boxen` - Create beautiful terminal boxes and borders
- ๐ `update-notifier` - Smart update notifications for better UX
- ๐ `fs-extra` - Enhanced file system operations with promises
- ๐ `keytar` - Secure credential storage for Git authentication
### ๐ ๏ธ **Development Dependencies**
- ๐ `typescript` - TypeScript compiler with latest features
- ๐งช `jest` - Delightful JavaScript testing framework
- ๐ `eslint` - Pluggable JavaScript and TypeScript linting
- ๐จ `prettier` - Opinionated code formatter
- โก `ts-node` - TypeScript execution environment for Node.js
- ๐บ `husky` - Git hooks made easy
- ๐ `codecov` - Code coverage reporting
## ๐ค Contributing
We love contributions! Here's how to get started:
### ๐ **Quick Start**
1. ๐ด **Fork** the repository
2. ๐ฟ **Create** a feature branch (`git checkout -b feature/amazing-feature`)
3. โจ **Make** your changes with love
4. ๐งช **Add tests** for new functionality (required!)
5. โ
**Run** the full test suite (`npm test`)
6. ๐ **Commit** with conventional commits (`npm run commit`)
7. ๐ **Push** to your branch (`git push origin feature/amazing-feature`)
8. ๐ฏ **Open** a Pull Request with detailed description
### ๐ฏ **Contribution Guidelines**
- ๐ Follow our [Code of Conduct](CODE_OF_CONDUCT.md)
- ๐ Use [Conventional Commits](https://conventionalcommits.org/)
- ๐งช Maintain or improve test coverage
- ๐ Update documentation for new features
- ๐ Run `npm run lint` before submitting
### ๐ **Recognition**
All contributors are celebrated in our [Contributors Hall of Fame](CONTRIBUTORS.md)!
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## ๐บ๏ธ Roadmap
### ๐ฏ **Phase 1: Core Enhancement** (Q1 2024)
- [ ] ๐ Add push/pull commands with smart conflict resolution
- [ ] ๐ฃ Git hooks support with custom triggers
- [ ] ๐ Plugin system with marketplace
- [ ] ๐ Configuration templates for popular workflows
### ๐ **Phase 2: Advanced Features** (Q2 2024)
- [ ] ๐ค AI-powered merge conflict resolution helpers
- [ ] ๐ฟ Advanced branch operations (rebase, cherry-pick)
- [ ] ๐ Git flow support with visual workflows
- [ ] โก Performance optimizations and caching
### ๐ **Phase 3: Intelligence** (Q3 2024)
- [ ] ๐ค AI commit message generation
- [ ] ๐ Repository analytics and insights
- [ ] ๐ Smart code review suggestions
- [ ] ๐ฏ Predictive branch naming
### ๐ช **Phase 4: Integration** (Q4 2024)
- [ ] ๐ GitHub/GitLab/Bitbucket deep integration
- [ ] ๐ฌ Slack/Teams notifications
- [ ] ๐ฑ Mobile companion app
- [ ] ๐ Web dashboard
---
<div align="center">
**Made with โค๏ธ by the SourceControl team**
[๐ Documentation](https://docs.sourcecontrol.dev) โข [๐ Report Bug](https://github.com/owner/repo/issues) โข [๐ก Request Feature](https://github.com/owner/repo/discussions) โข [๐ฌ Community](https://discord.gg/sourcecontrol)
</div>