diff --git a/.claude/bootstrap-version b/.claude/bootstrap-version new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/.claude/bootstrap-version @@ -0,0 +1 @@ +2 diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..de3ed84 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,25 @@ +{ + "hooks": { + "PostToolUse": [ + { + "matcher": "Edit|Write", + "hooks": [ + { + "type": "command", + "command": "f=$(jq -r '.tool_input.file_path // empty'); case \"$f\" in *.sh) bash -n \"$f\" || exit 2;; *.rs) rustfmt --edition 2021 \"$f\" >/dev/null 2>&1 || true;; esac" + } + ] + } + ], + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "cd \"$CLAUDE_PROJECT_DIR\" && for f in spikes/*.sh; do [ -e \"$f\" ] && { bash -n \"$f\" || { echo \"syntax error in $f\" >&2; exit 2; }; }; done; if [ -f Cargo.toml ]; then cargo fmt --check && cargo clippy -- -D warnings && cargo test || exit 2; fi" + } + ] + } + ] + } +} diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f9ec6f8 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +# No environment variables are read yet. Add names only (never values) as they appear. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..06df4bf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: ci +on: + pull_request: + branches: [development] + push: + branches: [development, main] +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Shell syntax + run: for f in spikes/*.sh; do bash -n "$f"; done + - name: Rust (once a Cargo workspace exists) + if: hashFiles('Cargo.toml') != '' + run: | + cargo fmt --check + cargo clippy -- -D warnings + cargo test diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000..ea09887 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,41 @@ +name: version +on: + push: + branches: [development, main] +permissions: + contents: write +jobs: + bump: + if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'github-actions[bot]' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Bump version + id: bump + run: | + set -euo pipefail + IFS=. read -r MA MI PA < VERSION + branch="${GITHUB_REF_NAME}" + if [ "$branch" = main ] && [ "$(git rev-list --parents -n1 HEAD | wc -w)" = 3 ] \ + && git merge-base --is-ancestor HEAD^2 origin/development; then + MI=$((MI+1)); PA=0 + else + PA=$((PA+1)) + fi + echo "$MA.$MI.$PA" > VERSION + echo "v=$MA.$MI.$PA" >> "$GITHUB_OUTPUT" + - name: Commit and push + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add VERSION + git commit -m "chore(release): v${{ steps.bump.outputs.v }} [skip ci]" + git push origin "HEAD:${GITHUB_REF_NAME}" + if [ "${GITHUB_REF_NAME}" = main ]; then + git fetch origin development + git checkout -B development origin/development + git merge --no-edit origin/main + git push origin development + fi diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..8388524 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,35 @@ +# Grove (working name: gitsync) + +## Overview +Linux tool that keeps chosen git repos continuously in sync across machines, including +uncommitted work, via snapshot refs (`refs/sync//`) on a primary remote. +Planned as a Rust workspace (core, providers, daemon, CLI, Tauri GUI). Currently in +**Phase 0 done / Phase 1 not started**: only spike scripts and docs exist. Do not start a +new phase before its predecessor's results are written to `docs/`. + +## Commands +- Check shell scripts: `for f in spikes/*.sh; do bash -n "$f"; done` +- Throwaway Forgejo (dev only, Podman): `spikes/forgejo-up.sh`, then `spikes/phase0.sh` +- Once the Rust workspace exists: `cargo fmt --check`, `cargo clippy -- -D warnings`, `cargo test` + +## Architecture +See `docs/` (`phase0-spike.md`, `DECISIONS.md`). Git is the storage layer; shell out to +system `git`; snapshots use a temp `GIT_INDEX_FILE` + `commit-tree`, never touching the +user's branch or index. + +## Conventions +- Everything in the repo is English. Open questions go to `docs/DECISIONS.md`. +- Never destroy local work; divergence is surfaced, never auto-merged. + +## Workflow quirks +- Remote: Gitea `git.zenvairo.es`, owner `dasemu` (section `DarĂ­o`), CLI `tea`. SSH (port 22) + is unreachable from the dev machine; use HTTPS with `git -c credential.helper='!tea login helper'`. +- In zsh, aliases like `g`/`gg` shadow shell functions; use unusual function names in scripts. +- Throwaway repos created on the real Gitea for tests must be deleted afterwards. + +## Deployment +Native Linux app (systemd user service). Never Docker for deployment. + +## Gotchas +- Forgejo push mirrors to localhost need `migrations.ALLOW_LOCALNETWORKS` (test instances only). +- Push-mirror exclusion of `refs/sync/*` is verified on Forgejo 11 only, not yet on the real Gitea. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7594380 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Grove + +Keeps your git repos in sync across machines without manual commit/push/pull, including +work in progress. Early stage (spikes only). See `docs/` for details. diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0