cargo-atomic 0.1.1

A CLI tool to help make local git commits easier.
cargo-atomic-0.1.1 is not a library.
Visit the last successful build: cargo-atomic-0.1.0

Project license code with love by ExtremelyRyan

Atomic

Atomic is a fast, minimal CLI tool that automates local Git commits around the scripts you already run β€” tests, formatters, docs, builds, anything. Define commands once in a TOML file. Let Atomic run them and snapshot your work with zero friction.

Use it as:

  • A commit automation tool
  • A task runner that remembers to save your work
  • A Git-integrated wrapper for dev scripts
  • A shell-based CI runner for solo workflows

πŸ”§ Why Use Atomic?

Atomic solves a common annoyance: you run cargo test, npm run format, or ./scripts/setup.sh β€” but forget to commit. Or you commit inconsistently.

Now, your routine commands can automatically commit your changes, so you never lose progress.

πŸš€ Installation

From Source

git clone https://github.com/ExtremelyRyan/atomic.git
cd atomic
cargo install --path .

From Crates.io

cargo install cargo-atomic

Note: minimum supported Rust version is 1.74. Windows 10/11 only (Linux coming soon).

βš™οΈ How It Works

  1. Define your dev commands in atomic.toml.
  2. Run them with atomic <command>.
  3. Atomic runs the command (plus any pre/post hooks).
  4. If it changes your Git state, it locally auto-commits.

πŸ“„ Sample atomic.toml

[custom.check]
command = "cargo check"

[custom.clippy]
before = "echo Running Clippy"
command = "cargo clippy"
after = "echo Clippy finished"

[custom.chain]
command = ["check", "clippy", "cargo fmt"]

[plugin.generate-docs]
script = "./scripts/gen_docs.py"
args = ["hello", "from", "Atomic!"]
silent = true

βœ… Supported Use Cases

  • Auto-committing after build/test/lint
  • Pre/post hooks around scripts or shell commands
  • Cross-platform script runner (Windows PowerShell, batch, Python, etc.)
  • Command chaining (["cargo check", "cargo test"])
  • Git-integrated plugin system
  • Project scaffolding with starter templates

πŸ” Pre/Post Hooks

Add before and after to wrap any command:

[custom.test]
before = "echo Testing..."
command = "cargo test"
after = "echo Done."

πŸ”Œ Plugins

Run script-based plugins (any language):

[plugin.cleanup]
script = "./scripts/clean_temp.py"
args = ["--force"]
silent = true

Call with:

atomic --plugin cleanup

If silent = true, logs go to atomic-logs/cleanup.log.

πŸ§ͺ Commands

Atomic Commands

Command Description
atomic init Create an example atomic.toml with built-in Rust tasks
atomic init --template rust Use the built-in Rust starter template
atomic <command> Run a [custom.<command>] entry from your config
atomic --plugin <name> Run a [plugin.<name>] script
atomic --list List all available commands from your TOML
atomic config show Show resolved TOML config in the terminal
atomic remote "message" Stage, squash, and force-push all changes as a single commit with your message (replaces all remote history!)

You can use kebab-case or snake_case for commandsβ€”both are supported.


How atomic remote Works

  • Auto-stages all changes (staged and unstaged).
  • Commits them if needed, using your message.
  • Squashes all your local commits into one, using your message.
  • Force-pushes the branch, so the remote will always show just your one commit.

⚠️ WARNING:
atomic remote force-pushes and rewrites your branch history on the remote. Never use on shared or protected branches! Always communicate with your team before rewriting remote history.


Examples:

atomic remote "feat: add user login with OAuth"
atomic remote "fix: final bugfix before review"

## πŸ—‚ Templates

```bash
atomic init --template rust
atomic init --template example

Built-in templates:

  • rust
  • example

They include:

  • Common Rust commands (check, clippy, test)
  • Plugin examples
  • Commented TOML

πŸ’Ύ Git Auto-Commits

When you run any custom or plugin command that alters the Git tree, Atomic will auto-commit it locally with a timestamp:

[2024-03-27 13:52:12] command: cargo fmt

You don't have to think about git add or git commit. It just saves your progress.

πŸ”’ Script Support

Works with:

  • .sh, .bat, .cmd, .ps1, .py, .exe
  • Shell chaining: &&, ||, ;
  • Auto OS detection

πŸ›  Built With

  • Rust 1.74
  • clap for CLI parsing
  • git2 for native Git integration
  • chrono for commit timestamps

πŸ—Ί Roadmap

  • Linux support
  • Plugin chaining (plugin.build && plugin.deploy)
  • Template variables with default values ({{ var | default("fallback") }})
  • Git hook integration
  • Command caching or skip-if-clean behavior
  • Web UI (log viewer or dashboard)

Contribute or suggest features on GitHub.

πŸ™‹ Support

✍️ Author

Built by ExtremelyRyan. MIT licensed. Star the repo if you use it!

πŸ”— Project Metadata

  • Crate name: cargo-atomic
  • Binary name: atomic
  • License: MIT
  • Categories: CLI Tools, Git Automation, Rust Dev Utilities