Merge branch 'release/1.6.0' into main

This commit is contained in:
Matteo Cherubini 2026-06-21 00:43:43 +02:00
commit cb75558724
2 changed files with 7 additions and 8 deletions

View file

@ -1,5 +1,5 @@
# =============================================================================
# Knowledge Genome - Makefile v. 1.5.1
# Knowledge Genome - Makefile v. 1.6.0
# Orchestrates the setup and management of the knowledge base.
# =============================================================================

View file

@ -6,7 +6,6 @@
# - One commit per author (single-device => one commit). No-op if there is nothing.
# - JSON output built with jq (safe escaping), with a `files` array:
# for each raw -> file, author, local_path, local_url (file://), remote_url (Forgejo web).
set -euo pipefail
genome="${1:?usage: genome-raw-commit <genome>}"
@ -19,7 +18,7 @@ set -a; . "${HOME}/.config/knowledge-genome.env"; set +a
: "${FORGEJO_USER:=n8n-bot}"
: "${FORGEJO_HOST:=127.0.0.1:3001}"
: "${FORGEJO_OWNER:=Keru}"
: "${FORGEJO_WEB_BASE:=https://git.keruhomelab.com}
: "${FORGEJO_WEB_BASE:=https://git.keruhomelab.com}" # human-facing URL for remote links (not the loopback)
: "${SYNCTHING_URL:=http://127.0.0.1:8384}"
: "${COMMITTER_NAME:=n8n-bot}"
: "${COMMITTER_EMAIL:=n8n-bot@homelab}"
@ -48,13 +47,13 @@ if git diff --cached --quiet; then
exit 0
fi
resolve_dev() { # $1 = path relativo al vault (raw/...) -> stampa lo short device id o vuoto
resolve_dev() { # $1 = path relative to the vault (raw/...) -> prints the short device id, or empty
[[ -z "${SYNCTHING_API_KEY:-}" ]] && return 0
curl -fsS -H "X-API-Key: ${SYNCTHING_API_KEY}" --get "${SYNCTHING_URL}/rest/db/file" \
--data-urlencode "folder=${fid}" --data-urlencode "file=${1#raw/}" 2>/dev/null \
| jq -r '.local.modifiedBy // empty' 2>/dev/null || true
}
author_for_dev() { # $1 = device id -> stampa "name\temail"
author_for_dev() { # $1 = device id -> prints "name\temail"
local dev="$1" name="$DEFAULT_AUTHOR_NAME" email="$DEFAULT_AUTHOR_EMAIL"
if [[ -n "$dev" && -f "$authors_map" ]] && jq -e --arg d "$dev" '.[$d]' "$authors_map" >/dev/null 2>&1; then
name="$(jq -r --arg d "$dev" '.[$d].name' "$authors_map")"
@ -63,7 +62,7 @@ author_for_dev() { # $1 = device id -> stampa "name\temail"
printf '%s\t%s' "$name" "$email"
}
# raccolgo per-file (relpath, author) e raggruppo per autore per il commit
# Collect per-file (relpath, author) and group by author for committing
declare -A G_FILES G_NAME G_EMAIL
declare -a ROWS
while IFS= read -r f; do
@ -88,7 +87,7 @@ for key in "${!G_FILES[@]}"; do
summary="${summary}${summary:+; }${G_NAME[$key]}:${short}"
done
# incorporo eventuali avanzamenti del remoto (es. PR wiki mergiata), poi pusho
# Pull in any remote advances (e.g. a merged wiki PR), then push
git fetch -q origin
if git show-ref --verify --quiet "refs/remotes/origin/${GENOME_BASE}"; then
git rebase -q "origin/${GENOME_BASE}" \
@ -97,7 +96,7 @@ fi
git push -q "$clone_url" "HEAD:${GENOME_BASE}"
head="$(git rev-parse --short HEAD)"
# array `files`: link locale (file://) e remoto (Forgejo web) per ogni raw committata
# `files` array: local (file://) and remote (Forgejo web) link for each committed raw
files_json="$(
for row in "${ROWS[@]}"; do
IFS=$'\t' read -r rel aname <<< "$row"