A polyglot implementation of a git backup merger tool, where each component is written in the language that provides the strongest safety guarantees for that component’s concerns.
polysafe-gitfixer helps you manage git repository backups by:
Scanning a directory tree for git repositories
Finding backup directories (
-backup,.backup-*)Matching backups to their corresponding repos
Diffing backup vs repo contents
Offering interactive merge/replace/delete options
Maintaining an append-only audit log
Handling failures gracefully via OTP supervision
┌─────────────────────────────────────────────────────────────────────────────┐
│ COMPONENT MAP │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Haskell │ │ Nickel │ │
│ │ TUI/CLI │◄────────│ Config │ │
│ │ (Brick) │ │ (schemas) │ │
│ └────────┬────────┘ └─────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Elixir/OTP │ │
│ │ Orchestration & Supervision │ │
│ └───┬─────────────────┬─────────────────┬─────────────────┬───┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Idris │ │ Haskell │ │ Rust │ │ Rust │ │
│ │Workflow │ │ Diff │ │ Git │ │ F/S │ │
│ │ State │ │ Engine │ │ Ops │ │ Ops │ │
│ └─────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ │
│ ┌──────────────────────────────┐ │
│ │ Rust │ │
│ │ Capability & Audit Layer │ │
│ └──────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘| Component | Language | Safety Guarantee |
|---|---|---|
Configuration | Nickel | Schema validation, typed defaults |
Capability & Audit | Rust | Path traversal prevention, tamper-evident logging |
Filesystem Ops | Rust | RAII, atomic transactions, rollback on failure |
Git Operations | Rust | Error handling, effect tracking |
Diff Engine | Haskell | Totality, streaming for large files |
Workflow State | Idris 2 | Typestate (can’t call operations in wrong order) |
Orchestration | Elixir/OTP | Fault isolation, supervision trees |
TUI/CLI | Haskell (Brick) | Elm Architecture, exhaustive event handling |
Rust 1.75+ (via rustup)
Haskell GHC 9.4+, Cabal 3.8+
Elixir 1.15+, OTP 26+
Nickel 1.4+ (optional, for config validation)
Idris 2 0.6+ (optional, Haskell fallback available)
polysafe-gitfixer/
├── config/ # Nickel configuration schemas
├── crates/ # Rust components
│ ├── capability/ # Path safety & audit logging
│ ├── fs_ops/ # Transactional filesystem operations
│ ├── git_ops/ # Git repository operations
│ └── polysafe_nifs/ # Rustler NIFs for Elixir
├── haskell/ # Haskell components
│ ├── diff-engine/ # Tree/file diffing
│ └── tui/ # Terminal UI
├── idris/ # Idris 2 workflow state machine
├── elixir/ # Elixir orchestrator
├── .well-known/ # RSR protocol files
└── test/ # Integration testsEach component uses the language with the strongest safety guarantees for its specific concerns:
- Rust (capability, fs_ops, git_ops)
Memory safety without garbage collection, RAII for deterministic cleanup, strong ownership model prevents data races.
- Haskell (diff-engine, tui)
Strong static typing, totality checking, lazy evaluation for streaming large files, Elm Architecture for exhaustive event handling.
- Elixir/OTP (orchestrator)
"Let it crash" philosophy with supervision trees, process isolation, fault-tolerant by design.
- Idris 2 (workflow)
Dependent types enable typestate patterns where invalid states are unrepresentable at compile time.
- Nickel (configuration)
Schema validation with contracts, preventing configuration errors before runtime.
We welcome contributions! See CONTRIBUTING for:
The Tri-Perimeter Contribution Framework (TPCF)
Development setup instructions
Code style guidelines
How to submit merge requests
Security Policy - Vulnerability reporting
Code of Conduct - Community standards
Governance - Decision-making process
Maintainers - Project leadership
This project is licensed under the Mozilla Public License, v. 2.0. See the LICENSE file for details.
SPDX-License-Identifier: CC-BY-SA-4.0
Rhodium Standard - Repository standards
git2-rs - Rust bindings for libgit2
ring - Cryptographic primitives
This project follows the Rhodium Standard Repositories specification.
See TOPOLOGY.md for a visual architecture map and completion dashboard.