mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 06:17:23 +01:00
The product, its assistant, the repo, the host and every unit on the box now share one name. 638 files, ~3,000 mentions: UI copy, config, env keys (FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs, articles, the deploy workflow other repos reuse, and nine file names. - Three article slugs carried the old name and had been shared; permanent redirects keep those links alive (next.config.ts). - test-no-retired-name.sh now also forbids the old product name across the whole repo, so the rename cannot creep back through templates and examples. - ASSISTANT_STACK collapses the product and the assistant into one entry, because they are now the same name. Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki` database and role, loki.orangecat.ch (old host 308s to it; /api, /widget, /embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases. The Resend sending domain stays fleetcrown.orangecat.ch until the new domain is verified in DNS. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
80 lines
3.2 KiB
Bash
Executable File
80 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Installs sync-agent-projects-conf.sh as a local systemd --user timer, so
|
|
# ~/.config/agent-projects.conf stays in sync with the Loki project
|
|
# registry without anyone remembering to run it by hand. Idempotent — safe
|
|
# to re-run (e.g. after the repo moves, or to pick up a schedule change).
|
|
#
|
|
# WHY A DEDICATED WORKTREE: this installer is typically run from whatever
|
|
# checkout or worktree an agent happens to be sitting in at the time — a
|
|
# feature branch, a job-scoped worktree under .claude/worktrees/ that gets
|
|
# cleaned up, or the primary dev checkout, which is routinely mid-work on
|
|
# some other branch. Pointing ExecStart at any of those means the timer
|
|
# breaks the moment that directory moves off main or gets deleted. Instead,
|
|
# this creates (or reuses) a small detached-HEAD worktree pinned at
|
|
# "<repo>-scripts", sibling to the primary checkout, used ONLY by this
|
|
# timer. ExecStartPre re-fetches and re-checks-out origin/main there before
|
|
# every run, so it can never go stale and never collides with a human
|
|
# actively developing on a branch (git refuses to check out the same branch
|
|
# into two worktrees, which is exactly why this uses --detach).
|
|
#
|
|
# Usage: scripts/db/install-agent-projects-sync.sh
|
|
set -euo pipefail
|
|
|
|
# --git-common-dir resolves to the ORIGINAL clone's .git even when this
|
|
# installer is invoked from a linked worktree — that's what makes the
|
|
# dedicated worktree's path stable regardless of where you ran this from.
|
|
PRIMARY_GIT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && git rev-parse --git-common-dir)"
|
|
PRIMARY_REPO_DIR="$(cd "$(dirname "$PRIMARY_GIT_DIR")" && pwd)"
|
|
DEDICATED_WORKTREE="${PRIMARY_REPO_DIR}-scripts"
|
|
SYNC_SCRIPT="$DEDICATED_WORKTREE/scripts/db/sync-agent-projects-conf.sh"
|
|
UNIT_DIR="$HOME/.config/systemd/user"
|
|
|
|
if [[ -d "$DEDICATED_WORKTREE/.git" || -f "$DEDICATED_WORKTREE/.git" ]]; then
|
|
git -C "$DEDICATED_WORKTREE" fetch --quiet origin main
|
|
git -C "$DEDICATED_WORKTREE" checkout --quiet --detach origin/main
|
|
else
|
|
git -C "$PRIMARY_REPO_DIR" worktree add --detach "$DEDICATED_WORKTREE" origin/main
|
|
fi
|
|
|
|
if [[ ! -x "$SYNC_SCRIPT" ]]; then
|
|
echo "install-agent-projects-sync: $SYNC_SCRIPT missing or not executable" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$UNIT_DIR"
|
|
|
|
cat > "$UNIT_DIR/agent-projects-sync.service" <<EOF
|
|
[Unit]
|
|
Description=Sync ~/.config/agent-projects.conf from Loki's project registry
|
|
After=network-online.target
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStartPre=/bin/sh -c 'cd $DEDICATED_WORKTREE && git fetch --quiet origin main && git checkout --quiet --detach origin/main'
|
|
ExecStart=$SYNC_SCRIPT
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
EOF
|
|
|
|
cat > "$UNIT_DIR/agent-projects-sync.timer" <<'EOF'
|
|
[Unit]
|
|
Description=Periodic sync of agent-projects.conf from Loki's project registry
|
|
|
|
[Timer]
|
|
OnBootSec=2m
|
|
OnUnitActiveSec=15m
|
|
Persistent=true
|
|
|
|
[Install]
|
|
WantedBy=timers.target
|
|
EOF
|
|
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --now agent-projects-sync.timer
|
|
|
|
echo "Installed agent-projects-sync.timer (runs every 15m, plus 2m after boot)."
|
|
echo "Status: systemctl --user status agent-projects-sync.timer"
|
|
echo "Logs: journalctl --user -u agent-projects-sync.service -n 20"
|
|
echo "Run now: systemctl --user start agent-projects-sync.service"
|