flowgen-cli
v1.0.19
Published
CLI tool for streamlined GitLab branch management and automation.
Downloads
6,246
Maintainers
Readme
Flowgen CLI Documentation
Flowgen CLI s a tool designed to simplify and automate developer workflows on GitLab. It provides various commands for branch management, synchronization, and more, making it easier for teams to keep their projects organized and up to date.
Installation
To install Flowgen CLI globally, use npm:
npm install -g flowgen-cli
Available Commands
- help, h, -h: Displays the list of available commands and their usage.
- login: Saves your GitLab token for authentication.
- logout: Removes the locally stored GitLab token.
- check: Validates your GitLab token and displays user information.
- promote: Promotes the current branch to specified environments and manages all necessary GitLab operations.
- switch: Switches to a specific branch across all subprojects. Tries the first branch, falls back to the second.
- sync: Pulls the latest changes in all Git subprojects.
- version, -v: Displays the current version of Flowgen CLI.
- config: Sets CLI configuration, such as language preferences.
Usage
The basic syntax for using Flowgen CLI is:
flowgen <command> [options]
Overview of the promote Command
The promote command is particularly useful for automating the promotion of a new feature or fix branch through a series of environments. It follows a simple flow:
- You create a local branch (for example, feature/amazing-update).
- Run flowgen promote ... (e.g., flowgen promote qa stg prod).
- Flowgen publishes your branch to the remote repository.
- It then creates new environment-specific branches (like feature/amazing-update-qa, feature/amazing-update-stg, etc.) directly on the remote.
- Locally, Flowgen checks out each environment branch.
- It cherry-picks (or merges) your branch changes into these environment branches and pushes them back to the remote.
- Flowgen automatically creates merge requests (MRs) for each environment branch targeting their respective base branches (e.g., qa, stg, prod).
- You are prompted to confirm or skip merging each MR interactively.
- Once everything looks good, Flowgen deletes your original feature branch from the remote.
- If anything goes wrong during the process, Flowgen attempts to roll back the newly created branches, leaving your repo in a clean state.
Promote usage
flowgen promote qa stg
- Make sure you are on your feature branch (e.g., feature/amazing-update).
- Use the above command to promote it to qa and stg.
- Follow the interactive prompts.
- Your code changes will be applied to the new branches (feature/amazing-update-qa and feature/amazing-update-stg), with MRs opened and approved interactively.
- The original branch feature/amazing-update gets removed from the remote once the merges are done.
Important Notes
- The (promote) command is still in active development, so proceed with caution.
- You need a valid GitLab token
- In case of an error, the system will try to revert any environment branches it created, ensuring minimal disruption to your workflow
Conclusion
Flowgen CLI’s (promote) command accelerates and simplifies branch promotion by automating multiple manual GitLab actions. It reduces the risk of human error, speeds up repetitive tasks, and provides an interactive way to confirm or merge critical updates.
For more detailed usage of other commands (login, logout, check, switch, sync, etc.), refer to the main documentation or run:
flowgen help
// Or
flogen -h
Keep an eye on new releases and updates, and have fun automating your GitLab workflows!
License
This project is licensed under the MIT License.