polleoai_athena/scripts/install-sync-launchd.sh
POLLEO.AI 774d374f81 fix(canonical_source): GitHub regex tolerates X.com's truncation
User-reported: an X post by @AISecHub referenced a GitHub repo
(huhusmang/Awesome-LLMs-for-Vulnerability-Detection) but the repo
wasn't auto-fetched via canonical-source discovery — which is the
user's spec rule #1 ("auto ingest should add more pages if the page
mentioned a repo or the source of the paper").

Root cause: X.com appends `…` (U+2026 ellipsis) to shortened URL
display text. The `_GITHUB_REPO_RE` lookahead expected the URL to
end at whitespace/slash/quote/paren/bracket, NOT at `…`. So every
X post referencing a GitHub repo was silently skipped. The PDF
regex already handles `…` (via `[^\s"\'\)\]<>…]*`); this is the
symmetric fix for GitHub.

Retroactive rescan of all X.com raws found 12 social posts with
previously-missed canonical URLs (GitHub repos, arXiv papers, PDFs).
All now queued in inbox/url-new.txt for the next `kb add` cycle to
fetch. The next auto-ingest will turn these into real wiki pages
tagged `discovered_via: <source-x-post>`.
2026-05-17 22:03:49 -07:00

48 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# install-sync-launchd.sh — install both Athena launchd jobs:
# 1. com.athena.sync — hourly git pull + build + ingest backstop
# 2. com.athena.autoingest — filesystem-watch capture → wiki synth (~1-2s)
#
# Copies the version-controlled plists from scripts/ to ~/Library/LaunchAgents/
# and loads them. Idempotent: existing loads are replaced cleanly.
#
# Uninstall:
# launchctl unload ~/Library/LaunchAgents/com.athena.sync.plist
# launchctl unload ~/Library/LaunchAgents/com.athena.autoingest.plist
# rm ~/Library/LaunchAgents/com.athena.{sync,autoingest}.plist
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
LAUNCHAGENTS="$HOME/Library/LaunchAgents"
mkdir -p "$LAUNCHAGENTS"
install_plist() {
local label="$1"
local src="$SCRIPT_DIR/$label.plist"
local dst="$LAUNCHAGENTS/$label.plist"
if [ ! -f "$src" ]; then
echo "ERROR: source plist not found at $src" >&2
return 1
fi
if launchctl list | grep -q "$label"; then
echo "[install] unloading existing $label"
launchctl unload "$dst" 2>/dev/null || true
fi
cp "$src" "$dst"
launchctl load "$dst"
echo "[install] ✓ $label loaded ($dst)"
}
install_plist com.athena.sync
install_plist com.athena.autoingest
echo
echo "[install] both jobs loaded:"
echo " com.athena.sync hourly → /tmp/athena-sync.log"
echo " com.athena.autoingest on-change → /tmp/athena-autoingest.log"
echo
echo "[install] verify with: launchctl list | grep com.athena"