Skip to content

ExtremelyRyan/atomic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Project license code with love by ExtremelyRyan

this project is still in rapid development, and is prone to breaking changes on main.

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

About

CLI program to take given custom commands, which will invoke a local git commit

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages