aboutsummaryrefslogtreecommitdiffstats
path: root/CLAUDE.md
blob: 1a4aed59612f0f08b0ed326eb60414d17a0678b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What This Is

Single-script dotfile backup tool. `dot-backup.sh` copies files from `DOTFILES` array to a local git repo (`~/Programming/GIT/my-dotfiles`), split into `home/` and `system/` subdirectories, then stages everything with `git add`.

## Running

```bash
./dot-backup.sh
```

No build step. No tests. No deps beyond bash + rsync + git.

## Architecture

`dot-backup.sh` does three things in sequence:

1. **Setup** — ensures `$DEFAULT_OUTPUT_DIR` exists with `home/` and `system/` subdirs; initializes git if needed; writes `lastupdate` timestamp and `lastupdate.epoch` (epoch seconds, machine-readable)
2. **Copy loop** — iterates `DOTFILES` array; paths starting with `/` go to `system/`, all others go to `home/`; uses `rsync -a` for both files and directories
3. **Commit**`git add .` + auto-commits with timestamp message in `$DEFAULT_OUTPUT_DIR`; optionally pushes with `--push`

`--suggest` is a read-only shortcut: it reads `lastupdate.epoch`, scans `~/.config` children and top-level hidden dirs/files in `$HOME`, and prints any that are newer than the last backup and not already tracked, formatted as a paste-ready block for `files.list`. Prints and exits — never copies or commits. Basenames to skip are controlled by `SUGGEST_IGNORE` (baked-in default; override in config).

## Key Variables

| Variable | Default | Purpose |
|---|---|---|
| `DEFAULT_OUTPUT_DIR` | `~/Programming/GIT/my-dotfiles` | Where backups land |
| `DOTFILES` | array in script | What gets backed up |
| `GIT_REMOTE` | _(unset)_ | Remote URL; required for `--push` |
| `GIT_BRANCH` | current branch | Branch to push to |

Set `GIT_REMOTE` and `GIT_BRANCH` in `~/.config/dot-backup/config`. To change backup destination, edit `DEFAULT_OUTPUT_DIR` at the top of the script.

## Adding Dotfiles

Add paths to the `DOTFILES` array. Relative paths = home dir. Absolute paths (starting `/`) = system files (copied preserving full path under `system/`).

## Git Workflow

Remote is a personal repository. Commit and push directly — no PRs.