The src/ directory contains the package source code. The architecture strictly separates OS-Level Mechanics (Service management, Identity) from Git Plumbing (Object manipulation).
git_pulsar/daemon.py: The background process.- Role: The "Heartbeat." It wakes up, checks system constraints (Battery, CPU Load), and triggers the backup logic.
- Logic: Decouples "Saving" (Commit) from "Publishing" (Push) using independent intervals to optimize for battery life.
- Safety: Implements
GIT_INDEX_FILEisolation to ensure it never locks or corrupts the user's active git index.
git_pulsar/ops.py: High-level Business Logic.- Role: The "Controller." It orchestrates complex multi-step operations like
finalize(Octopus Merges) andrestore. - Logic: Calculates the "Zipper Graph" topology to merge shadow commits back into the main branch.
- Role: The "Controller." It orchestrates complex multi-step operations like
git_pulsar/config.py: Configuration Engine.- Role: The "Source of Truth."
- Logic: Implements a cascading hierarchy (Defaults → Global → Local) to merge settings from
~/.config/git-pulsar/config.tomland project-levelpulsar.tomlorpyproject.toml.
git_pulsar/git_wrapper.py: The Git Interface.- Role: A strict wrapper around
subprocess. - Philosophy: No Porcelain. This module primarily uses git plumbing commands (
write-tree,commit-tree,update-ref) rather than user-facing commands (commit,add) to ensure deterministic behavior.
- Role: A strict wrapper around
git_pulsar/system.py: OS Abstraction.- Role: Identity & Environment.
- Logic: Handles the chaos of cross-platform identity (mapping
IOPlatformUUIDon macOS vs/etc/machine-idon Linux) to ensure stable "Roaming Profiles."
git_pulsar/service.py: The Installation Engine.- Role: Interface with the host init system.
- Logic: Generates and registers
systemduser timers (Linux) or instructions forlaunchd(macOS/Homebrew).
git_pulsar/cli.py: The User Entry Point.- Role: Argument parsing and UI rendering.
- Tech: Uses
richfor terminal visualization. It delegates all logic toops.pyordaemon.py.
- Index Isolation: The
daemonmodule MUST ALWAYS setos.environ["GIT_INDEX_FILE"]to a temporary path before performing write operations. - Zero-Destruction: The
prunelogic inops.pyrelies on strictly namespaced refspecs (refs/heads/wip/pulsar/...) and never touches standard heads. - Identity Stability: The
systemmodule guarantees that a Machine ID persists across reboots, preventing "Split Brain" backup histories. - Configuration Precedence: Local project configuration MUST always override global user settings to ensure repo-specific constraints (e.g., large file limits) are respected.