A TypeScript-based Continuous Deployment (CD) tool designed for monorepo management with flexible versioning strategies and GitHub integration.
- π·οΈ Flexible Version Management: Support for user-defined version tags with timestamp or increment strategies
- π¦ Monorepo Support: Handle multiple projects with different languages in a single repository
- π§ Multi-Language Support: TypeScript/npm and Rust/crates.io with extensible architecture
- π Registry Support: npm, crates.io, and container registries
- π Automated Workflows: GitHub Actions workflow generation for each registry type
- π Interactive CLI: User-friendly prompts for version bumps and tag selection
- π― Smart Change Detection: Automatic detection of changed projects with dependency tracking
- π GitHub Integration: Direct GitHub CLI integration for PR and release management
-
Node.js 20+
node --version # Should be 20.0.0 or higher -
Git
git --version
-
GitHub CLI (gh) - REQUIRED
# Install GitHub CLI # On macOS brew install gh # On Ubuntu/Debian sudo apt install gh # On Windows winget install --id GitHub.cli # Or download from https://cli.github.com/
-
GitHub CLI Authentication - REQUIRED
# Authenticate with GitHub gh auth login # Verify authentication gh auth status
The GitHub CLI must be authenticated with a token that has the following permissions:
- Contents: Write β (for creating commits)
- Metadata: Read β (for basic repository info)
- Pull requests: Write β (for creating/updating/merging PRs)
repo(Full control of private repositories)
npm install -g cd-toolsOr for development:
git clone <repository>
cd cd-tools
npm install
npm run build-
Verify prerequisites:
node --version # Check Node.js git --version # Check Git gh --version # Check GitHub CLI gh auth status # Check GitHub authentication
-
Initialize your project:
cd-tools init
This creates
.cdtools/config.jsonand GitHub workflow files. -
Configure your project by editing
.cdtools/config.json:{ "versioningStrategy": "fixed", "versionTags": [ { "alpha": { "versionSuffixStrategy": "timestamp" } }, { "rc": { "versionSuffixStrategy": "increment", "next": "stable" } } ], "projects": [ { "path": "./frontend", "type": "typescript", "baseVersion": "1.0.0", "deps": ["./backend", "package.json"], "registries": ["npm"] }, { "path": "./backend", "type": "rust", "baseVersion": "1.1.0", "registries": ["crates"] } ] } -
Start a release:
cd-tools start-pr
- Select version tag (alpha, rc, stable)
- Enter branch name
- Creates
branchName(tag)branch - Sets up release tracking
-
Update versions and create PR:
cd-tools push-pr
- Select bump types (patch/minor/major) for each project
- Detects changed files automatically
- Updates project versions intelligently
- Commits and pushes changes
- Automatically creates GitHub PR β¨
-
Finalize release:
cd-tools end-pr
- Applies next version if configured (e.g., rc β stable)
- Automatically merges PR with squash β¨
- Cleans up tracking files
Initializes the project with GitHub workflows and default configuration.
- Interactive registry selection (npm, docker)
- Generates appropriate
.github/workflows/*.ymlfiles - Creates default
.cdtools/config.json - Sets up
analyze-workspaces.shscript
Starts a release PR with interactive version tag selection.
- Pulls latest changes from current branch
- Interactive tag selection from configured version tags
- Creates branch with format:
branchName(tag) - Sets up tracking file for release state
Updates versions and creates/updates the pull request.
- Interactive bump type selection (patch/minor/major) per project
- Detects changed files using
git diff - Calculates new versions based on tag strategy and existing bumps
- Updates
package.jsonorCargo.tomlfiles - Commits and pushes version changes
- Automatically creates/updates GitHub PR using
ghCLI - Generates detailed PR description with change summary
Finalizes the release and merges the PR.
- Handles version tag transitions (e.g.,
rcβstable) - Updates to next tag versions if configured
- Updates base versions for stable releases
- Automatically merges PR using
ghCLI with squash method - Cleans up tracking files
- Deletes release branch
CD Tools integrates directly with GitHub CLI for seamless automation:
- Automatic PR creation with detailed descriptions
- Interactive base branch selection with safety checks
- Automatic PR merging with squash method
- Automatic branch cleanup after merge
- GitHub CLI availability checks with helpful error messages
- Authentication verification before operations
- Graceful error handling with clear instructions
npx cd-tools push-pr
# β
GitHub PR created: https://github.com/user/repo/pull/123
npx cd-tools end-pr
# β
PR merged with squash method
# β
Branch deletedThe tool uses .cdtools/config.json for configuration:
fixed: All projects use the same version (follows updates even without changes)independent: Only changed projects and their dependents are versioned
Define custom version tags with flexible strategies:
{
"versionTags": [
{
"alpha": {
"versionSuffixStrategy": "timestamp"
}
},
{
"rc": {
"versionSuffixStrategy": "increment",
"next": "stable"
}
}
]
}Version Suffix Strategies:
- timestamp: Generates versions like
1.0.1-rc.20250629135030 - increment: Generates versions like
1.0.1-rc.0,1.0.1-rc.1, etc.
Tag Transitions:
- next: Defines version tag progressions (e.g.,
rcβstable)
{
"projects": [
{
"path": "./frontend",
"type": "typescript",
"baseVersion": "1.0.0",
"deps": ["./backend", "package.json"],
"registries": ["npm"]
},
{
"path": "./backend",
"type": "rust",
"baseVersion": "1.1.0",
"registries": ["crates"]
}
]
}Supported Project Types:
typescript: Updatespackage.jsonversion fieldrust: UpdatesCargo.tomlversion field
Supported Registries:
npm: npm registry (for TypeScript/JavaScript)crates: crates.io registry (for Rust)docker: Container registries (Docker)
Dependencies (deps):
- List of file paths (not just package.json) that trigger workspace updates
- Includes Dockerfiles, configuration files, etc.
src/
βββ index.ts # Main CLI entry point with command routing
βββ commands/ # Command implementations
β βββ init.ts # Project initialization with GitHub workflows
β βββ start-pr.ts # Release branch creation
β βββ push-pr.ts # Version updates and PR creation
β βββ end-pr.ts # Release finalization and PR merge
βββ utils/ # Core utilities
βββ config.ts # Configuration and branch info management
βββ git.ts # Git operations with security validation
βββ github.ts # GitHub CLI integration
βββ version-updater.ts # Version file updates
- Node.js 20+
- TypeScript 5.8+
- Git
- GitHub CLI (gh) - for testing GitHub integration features
git clone <repository>
cd cd-tools
npm installnpm run build # Build TypeScript to JavaScript
npm test # Run all tests (78 tests)
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run with coverage report
npm run lint # Check for linting issues (Biome)
npm run format # Auto-format code (Biome)
npm run dev # Build and run CLIThe project follows Test-Driven Development (TDD) with comprehensive test coverage:
npm test # β
78 tests passing
npm run test:coverage # Detailed coverage reportTest Coverage Areas:
- Configuration parsing and validation
- Version calculation logic (timestamp/increment strategies)
- CLI argument parsing and command routing
- File system operations and git integration
- Command implementations and error handling
- GitHub CLI integration (mocked in tests)
- TypeScript with
@tsconfig/strictestconfiguration - Prompts for interactive CLI
- Vitest for testing framework
- Biome for linting and formatting (unified tool)
- Node.js ES modules with ESM-first architecture
- GitHub CLI for GitHub integration
- Strict TypeScript: Maximum type safety with strict configuration
- Biome Integration: Unified linting and formatting
- TDD Approach: Test-first development methodology
- ES Modules: Modern JavaScript module system
- Security: Secure subprocess execution with
spawn
cd-tools start-pr # Select "alpha" tag, create branch
# Make changes...
cd-tools push-pr # Creates 1.0.1-alpha.20250717123456 + GitHub PR
cd-tools end-pr # Merge PR and finalizecd-tools start-pr # Select "rc" tag
# Make changes...
cd-tools push-pr # Creates 1.0.1-rc.0 + GitHub PR
cd-tools push-pr # Creates 1.0.1-rc.1 + Updates PR (if more changes)
cd-tools end-pr # Creates 1.0.1 stable + Merges PR# Changes to both frontend/ and backend/
cd-tools push-pr # Updates both package.json and Cargo.toml + Creates PR
# GitHub Actions triggered for both npm and crates.io
cd-tools end-pr # Merges PRFixed Strategy:
- All projects get the same version
- If any project changes, all projects are updated
Independent Strategy:
- Only changed projects get new versions
- Dependencies are automatically detected and updated
When adding new dependencies:
- Consult the gemini CLI for complexity and reliability assessment
- Update CLAUDE.md with any installation decisions
- Document rationale in
docs/ADR.md
This policy ensures thoughtful dependency management and maintains project simplicity.
- Follow TDD methodology
- Maintain test coverage above 90%
- Use TypeScript strict mode
- Follow existing code patterns
- Update documentation for new features
- Test GitHub CLI integration features
"gh: command not found"
# Install GitHub CLI from https://cli.github.com/
# On macOS: brew install gh
# On Ubuntu: sudo apt install gh
# On Windows: winget install --id GitHub.cli"gh auth status" fails
# Authenticate with GitHub
gh auth login
# Follow the interactive prompts"insufficient permissions" error
# Re-authenticate with required scopes
gh auth refresh -s repoPR creation fails
# Check if you're on the correct branch
git branch --show-current
# Ensure you have commits to create PR from
git log --oneline -5"No tracking file found"
- Run
cd-tools start-prfirst to initialize a release
"Version tag configuration not found"
- Check your
.cdtools/config.jsonfor correct version tag configuration
"Cannot find module" errors
- Run
npm run buildto compile TypeScript - Ensure all dependencies are installed with
npm install
"Branch info file not found"
- Run
cd-tools start-prto create the tracking file - Check that you're on the correct release branch
MIT License - see LICENSE file for details.
- Design Document - Detailed requirements and design (Japanese)
- Development Guide - Development setup and guidelines
Current Implementation Status:
- β Core CLI framework with command routing
- β Configuration management with validation
- β Version calculation (timestamp/increment strategies)
- β All 4 main commands (init, start-pr, push-pr, end-pr)
- β File system utilities (package.json, Cargo.toml)
- β Git operations with security validation
- β GitHub CLI integration (PR creation, merging)
- β Interactive prompts system
- β GitHub workflow generation
- β 78 comprehensive tests with full coverage
- β TypeScript strict compilation
- β Biome linting/formatting
- β Branch info tag updates for next version transitions
The tool is production-ready for monorepo CD workflows with full GitHub integration via GitHub CLI.