From repetitive manual tasks to a tested and customizable open-source CLI.
1. Introduction
Automation is one of the fundamental principles of DevOps and software engineering. However, even developers who automate complex infrastructure and deployment workflows often perform repetitive tasks when starting a new software project.
Creating directories, initializing Git repositories, configuring remote repositories, and opening development environments are simple operations. When repeated frequently, however, they become unnecessary friction in the development workflow.
This observation motivated me to develop Init Flow, an open-source command-line interface written in Bash to automate and standardize project initialization.
The project combines Linux automation, Git, GitHub CLI, software engineering practices, and continuous integration into a lightweight development tool.
In this article, I will introduce Init Flow, demonstrate its capabilities, explain its architectural decisions, and share lessons learned while developing and releasing version v0.2.0.
2. The Problem: Repetitive Project Initialization
A typical project initialization workflow might involve several manual commands:
mkdir -p ~/projects/my-project cd ~/projects/my-project git init -b main gh repo create my-project --public --source=. --remote=origin code . Although each command is relatively simple, this workflow assumes that:
- All required dependencies are installed.
- GitHub CLI authentication is configured.
- The project directory does not already exist.
- The remote repository name is available.
- Each operation completes successfully.
Without proper validation and error handling, these assumptions can lead to inconsistent environments, unexpected failures, or conflicts with existing projects.
The challenge was not simply to combine commands into a shell script, but to create a reliable, predictable, and maintainable CLI.
3. Introducing Init Flow
Init Flow automates project initialization through a single command:
initflow create my-project By default, the tool:
- Validates the project name and arguments.
- Checks required dependencies.
- Verifies GitHub CLI authentication.
- Checks for local and remote conflicts.
- Creates the local project directory.
- Initializes Git with the
mainbranch. - Creates a public GitHub repository.
- Configures the
originremote. - Opens the project in Visual Studio Code.
The goal is to reduce repetitive work while maintaining control over the initialization process.
Init Flow is distributed under the MIT License and is currently focused on Linux environments.
4. Getting Started
Prerequisites
For the default workflow, you need:
- Bash
- Git
- GitHub CLI (
gh) - Visual Studio Code CLI (
code)
Authenticate with GitHub CLI if necessary:
gh auth login Installation
Clone the published version of the repository:
git clone --branch v0.2.0 --depth 1 \ https://github.com/jacivaldocarvalho/init-flow.git cd init-flow ./scripts/install.sh The installer creates a symbolic link in:
~/.local/bin/initflow No root privileges are required.
Make sure this directory is available in your PATH.
Verify the installation:
initflow --version initflow --help Creating your first project
initflow create my-project This initializes a local project, creates a public GitHub repository, and opens Visual Studio Code.
Uninstallation
From the cloned repository:
./scripts/uninstall.sh The uninstaller removes only the symbolic link associated with the expected installation.
5. What's New in v0.2.0?
The first release focused on establishing a functional project initialization workflow.
Version v0.2.0 — Configuration and Customization extends that foundation with seven command-line options.
| Option | Description |
|---|---|
--private | Creates a private GitHub repository |
--readme | Generates a local README.md |
--description TEXT | Sets the remote repository description |
--local | Creates a local Git project without GitHub integration |
--path DIRECTORY | Specifies a custom base directory |
--no-editor | Skips opening Visual Studio Code |
--dry-run | Previews the execution without making changes |
These options make Init Flow adaptable to different development workflows.
Creating a private repository
initflow create internal-tool --private Creating a project with documentation
initflow create automation-tool \ --readme \ --description "Linux automation utilities" The README is generated locally. Init Flow does not automatically commit or push it.
Creating a local-only project
initflow create local-lab \ --local \ --readme \ --no-editor This workflow requires Git but does not require GitHub CLI authentication or Visual Studio Code.
Using a custom project directory
initflow create infrastructure-lab \ --local \ --path "$HOME/labs" \ --no-editor Previewing an operation
initflow create production-tool \ --private \ --readme \ --dry-run Dry-run mode displays the planned operation without creating directories, initializing Git repositories, creating remote repositories, or opening the editor.
Remote repository availability is not verified during a dry run.
6. Architecture and Design Decisions
One of the main architectural goals was to keep the implementation simple without sacrificing reliability.
Rather than introducing external frameworks or additional runtime dependencies, Init Flow uses Bash and existing development tools.
The repository is organized around clear responsibilities:
init-flow/ ├── .github/ │ └── workflows/ │ └── ci.yml ├── assets/ │ └── demo/ ├── docs/ ├── examples/ ├── scripts/ │ ├── initflow │ ├── install.sh │ └── uninstall.sh ├── tests/ │ ├── test_initflow.sh │ ├── test_create.sh │ ├── test_install.sh │ └── test_uninstall.sh ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE └── README.md The main executable handles command execution, while installation, uninstallation, testing, and documentation remain separated.
Centralized argument parsing
Version v0.2.0 introduces centralized argument parsing.
Arguments are validated before operations that modify the filesystem or interact with GitHub.
This includes detecting:
- Unknown options.
- Duplicate options.
- Missing option values.
- Incompatible option combinations.
For example, combining --local with --private is rejected because repository visibility has no meaning when no remote repository is created.
Conditional dependency management
Not every execution mode requires the same dependencies.
| Execution mode | Git | GitHub CLI | VS Code |
|---|---|---|---|
| Default | Yes | Yes | Yes |
--no-editor | Yes | Yes | No |
--local | Yes | No | Yes |
--local --no-editor | Yes | No | No |
--dry-run | No | No | No |
Checking dependencies according to the selected execution mode avoids imposing unnecessary requirements on users.
Project directory resolution
Init Flow resolves the base project directory using the following precedence:
--path DIRECTORY ↓ INITFLOW_PROJECTS_DIR ↓ $HOME/projects This allows users to customize their development environment without modifying the source code.
Relative paths and paths containing spaces are also supported.
7. Security and Reliability
Shell automation can become dangerous when user input is passed directly to system commands without validation.
For this reason, Init Flow prioritizes defensive programming.
The implementation uses Bash strict mode:
set -euo pipefail However, strict mode alone is not sufficient. Reliable shell scripts also require explicit validation and appropriate error handling.
The project follows several defensive principles:
- Validate project names and arguments before execution.
- Quote variables and paths appropriately.
- Protect existing files and directories.
- Detect conflicting symbolic links.
- Avoid overwriting existing README files.
- Preserve local project data when remote operations fail.
- Avoid unnecessary destructive operations.
- Never expose authentication tokens.
- Avoid requiring elevated privileges for local installation.
Dry-run mode adds another layer of operational safety by allowing users to inspect planned actions before execution.
Repository visibility remains public by default for backward compatibility. Users working with private projects should explicitly select --private or use --local.
8. Automated Testing and Continuous Integration
A major goal of Init Flow is to demonstrate that even relatively small shell-based tools benefit from structured software engineering practices.
The project evolved from 30 automated tests in v0.1.0 to 58 automated tests in v0.2.0.
The test suites cover four main areas:
| Test suite | Responsibility |
|---|---|
test_initflow.sh | CLI commands and argument validation |
test_create.sh | Project creation and integration workflows |
test_install.sh | Installation behavior |
test_uninstall.sh | Uninstallation behavior |
Integration tests use mocks to simulate external commands such as Git, GitHub CLI, and Visual Studio Code where appropriate.
This prevents automated tests from accidentally creating real GitHub repositories or interacting with external services.
Static analysis
ShellCheck is used to identify common shell scripting problems, including quoting issues, unsafe expansions, and other potentially unreliable patterns.
shellcheck scripts/* tests/*.sh Bash syntax validation
Each script is checked individually:
( for file in scripts/initflow scripts/*.sh tests/*.sh; do bash -n "$file" || exit 1 done ) Continuous integration
GitHub Actions automates the validation process, including:
- Bash syntax validation.
- ShellCheck analysis.
- CLI tests.
- Integration tests.
- Installation tests.
- Uninstallation tests.
The release workflow requires successful CI validation before publishing a new version.
The published tag is also validated through an isolated post-release smoke test, ensuring that the distributed version behaves as expected.
9. Lessons Learned: Portability and CI Failures
One of the most valuable lessons during the v0.2.0 release came from an unexpected CI failure.
All local tests had passed, but the integration tests failed in GitHub Actions.
The root cause was a dependency on ripgrep (rg) that was available in my local development environment but absent from the CI runner.
The affected test used a command similar to:
rg -q -- '--private' "$MOCK_LOG" The solution was to replace it with a standard tool already available in the target environment:
grep -Fq -- '--private' "$MOCK_LOG" Another test used a pipeline to verify dry-run output. Early termination by the search command could produce a broken pipe.
Instead of relying on that pipeline, the output was captured and evaluated directly:
preview_output="$("$CLI" create remote-preview --dry-run --no-editor)" if [[ "$preview_output" == *'Remote availability has not been verified'* ]]; then # Assertion passed fi The correction preserved the original assertions while removing the unnecessary dependency and the problematic pipeline.
After the fix, the affected integration suite passed all 30 tests, and GitHub Actions successfully validated the release candidate.
This experience reinforced several engineering principles:
- A passing local test suite does not guarantee portability.
- Test dependencies deserve the same attention as runtime dependencies.
- CI should expose environmental assumptions.
- Fixing the root cause is preferable to bypassing a failing check.
- Small, focused corrections improve maintainability and traceability.
The fix was recorded in a dedicated Conventional Commit:
fix(test): remove ripgrep dependency from integration tests 10. Roadmap and Future Improvements
Init Flow is still evolving.
The current release establishes a configurable foundation for project initialization, with future possibilities including:
- Project scaffolding and reusable templates.
- Persistent configuration.
- Environment diagnostics.
- Additional development workflow integrations.
- Expanded documentation and automated testing.
These are potential directions rather than committed features for the next release.
The long-term objective is to reach a stable v1.0.0 while preserving simplicity, reliability, and maintainability.
11. Conclusion
Developing Init Flow has been an opportunity to apply software engineering and DevOps principles to a practical automation problem.
The project demonstrates how a Bash CLI can evolve beyond a collection of shell commands into a structured, tested, documented, and versioned open-source tool.
Its development reinforces the importance of:
- Automation and standardization.
- Defensive shell scripting.
- Dependency management.
- Automated testing.
- Continuous integration.
- Root cause analysis.
- Technical documentation.
- Incremental software development.
Version v0.2.0 represents another step toward a reliable and extensible project initialization tool.
If you work with Linux, Bash, DevOps, or developer automation, feel free to explore the repository, experiment with the CLI, report issues, or suggest improvements.
Project Resources
About the Author
Jacivaldo Carvalho
Telecommunications Engineer | DevOps Engineer | SRE | Networking

