youreit
v1.1.6
Published
Helper for environment-specific git tags
Readme
YoureIt
A simple, yet powerful CLI tool for managing environment-specific git tags with automatic version bumping and configuration.
Features
- 🏷️ Environment-specific tag management - Organize tags by environment (production, staging, dev, etc.)
- 🔍 Automatic prefix detection - Detects tag prefixes from your existing git tags
- ⚙️ Interactive setup - Guided configuration wizard for setting up environments
- 📋 List latest tags - View the latest tag for each configured environment
- 🚀 Automatic version bumping - Increment patch versions automatically
- 🎨 Beautiful CLI output - Colorized, formatted output for better readability
- 💾 Local configuration - Store environment configurations per repository
Installation
Global Installation
npm install -g youreitAfter global installation, use the tag command from anywhere:
tag list
tag setup
tag bumpLocal Installation
npm install --save-dev youreitThen use via npx:
npx tag list
npx tag setup
npx tag bumpDevelopment Installation
If you want to work on the tool while using it:
git clone <repository-url>
cd youreit
npm install
npm linkThis creates a symlink so changes are immediately available.
Quick Start
Navigate to your git repository
cd /path/to/your/repoRun setup to configure environments
tag setupList your tags
tag listCreate a new tag
tag bump staging
Commands
tag setup
Configure environment tags by detecting prefixes from existing tags.
This command will:
- Fetch tags from the remote repository
- Detect unique tag prefixes (e.g.,
v,s,x,preprod) - Prompt you to configure each prefix with a name and description
- Save configuration to
.tag-config.json
Usage:
tag setupExample:
$ tag setup
Fetching tags from origin...
✓ Tags fetched successfully
Found tag prefixes:
D: d0.1.16, d0.1.17, d0.1.18
Y: y1.3.0, y1.3.0-T1
S: s0.0.14, s0.0.15, s0.0.16
V: v0.0.10, v0.0.11, v0.0.12
X: x0.0.10, x0.0.11, x0.0.12
Prefix "D"
Examples: d0.1.16, d0.1.17, d0.1.18
? Configure prefix "d"? Yes
? Name: Dev
? Description (optional): Development environment
? Confirm "Dev" for prefix "d"? Yes
...tag list
Show the latest tag for each configured environment.
Usage:
tag listExample Output:
Production (prod): v1.2.3 - Production environment
Josh · 3 days ago
Sandbox (sandbox): x1.2.3 - Sandbox testing environment
Bob · 2 hours ago
Preprod (preprod): p1.2.3 - Pre-production environment
Joshua · 18 hours ago
Deploy hotfix for login issue
Staging (staging): s1.2.3 - Staging environment
Alice · 1 hour ago
Dev (dev): d1.2.3 - Development environment
Carol · 10 minutes agotag bump [env]
Create and push a new tag for an environment with automatic version bumping.
This command will:
- Show the current latest tag and the next tag that will be created
- Prompt for an optional annotation message
- Create the tag locally (annotated or lightweight)
- Push the tag to origin
- Fetch latest tags from origin
Usage:
tag bump [env]Examples:
# Interactive environment selection
tag bump
# Direct environment specification
tag bump staging
tag bump prod
tag bump devExample Output:
$ tag bump staging
Environment: Staging (staging)
Current latest: s0.0.4
Next tag: s0.0.5
? Annotation message (optional – leave blank to create a lightweight tag): Deploy hotfix for login issue
✓ Created tag s0.0.5
✓ Pushed s0.0.5 to origin
✓ Fetched latest tags from origintag refresh
Fetch tags from the remote repository to update your local tag list.
Usage:
tag refreshExample:
$ tag refresh
Fetching tags from origin...
✓ Tags refreshed successfullytag reset
Reset configuration by deleting the .tag-config.json file.
This will prompt for confirmation before deleting the configuration file.
Usage:
tag resetExample:
$ tag reset
? Are you sure you want to delete .tag-config.json? No
Reset cancelled.Configuration
Configuration File
The tool stores configuration in .tag-config.json in your repository root. This file is created automatically when you run tag setup.
Example .tag-config.json:
{
"d": {
"label": "Dev",
"prefix": "d",
"description": "Development environment"
},
"s": {
"label": "Staging",
"prefix": "s",
"description": "Staging environment"
},
"prod": {
"label": "Production",
"prefix": "v",
"description": "Production environment"
}
}Tag Prefix Patterns
Tags must follow the pattern: <prefix><major>.<minor>.<patch>
Examples:
v1.2.3- Production tag with prefixvs0.1.5- Staging tag with prefixsd0.4.2- Dev tag with prefixdp2.4.7- Preprod tag with prefixp
The tool automatically detects prefixes from your existing tags during setup.
Examples
Complete Workflow
# 1. Setup environments (first time)
tag setup
# 2. List current tags
tag list
# 3. Refresh tags from remote
tag refresh
# 4. Create a new staging tag
tag bump staging
# 5. Create a production tag with annotation
tag bump prod
# Enter annotation: "Release v1.2.0 - New features"
# 6. View updated tags
tag listWorking with Multiple Environments
# Create tags for different environments
tag bump dev # Creates d0.1.0
tag bump staging # Creates s0.1.0
tag bump prod # Creates v0.1.0
# Each environment maintains its own version sequence
tag bump dev # Creates d0.1.1
tag bump staging # Creates s0.1.1
tag bump prod # Creates v0.1.1Requirements
- Node.js 14+ (ES modules support)
- Git repository initialized
- Remote named
originconfigured (for push/fetch operations)
Troubleshooting
"No environments configured"
If you see this message when running tag list, you need to run tag setup first:
tag setup"Git command failed"
Make sure you're in a git repository:
git status # Should show repository status"Error refreshing tags: would clobber existing tag"
This happens when local and remote tags differ. The refresh command uses force fetch to resolve this automatically.
"fatal: not a git repository"
Ensure you're in a directory with a .git folder, or initialize a git repository:
git initConfiguration not loading
If your configuration isn't loading:
- Check that
.tag-config.jsonexists in the repository root - Verify the JSON is valid:
cat .tag-config.json | jq - Run
tag resetandtag setupagain if needed
Development
Project Structure
youreit/
├── bin/
│ └── tag.js # Main entry point
├── lib/
│ ├── utils.js # Shared utilities
│ └── commands/
│ ├── list.js # List command
│ ├── setup.js # Setup command
│ ├── refresh.js # Refresh command
│ ├── reset.js # Reset command
│ └── bump.js # Bump command
└── package.jsonRunning Locally
# Install dependencies
npm install
# Link for development
npm link
# Test commands
tag list
tag setupContributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
ISC
Author
Created for managing environment-specific git tags with ease.
Made with ❤️ By Joshua Armstrong
