remove ObserverFeed script — feed file replaces it

This commit is contained in:
Levi Neely 2026-08-13 21:10:22 +02:00
parent 324247b6a5
commit 4061e494b3
2 changed files with 2 additions and 69 deletions

View File

@ -1,66 +0,0 @@
#!/bin/bash
# ObserverFeed — watches git repo for changes and feeds diffs to an observer agent.
#
# Usage: ObserverFeed <session>/<agent> [interval]
#
# Watches the git working tree. When the diff changes, pushes the new diff
# to the agent's prompt. Runs until killed.
#
# Arguments:
# session/agent Target agent (e.g., myproj/observer)
# interval Poll interval in seconds (default: 5)
#
# The agent should be created first:
# o myproj/observer new /path/to/repo
#
# Environment:
# Respects the repo at the agent's cwd. Falls back to $PWD.
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "usage: ObserverFeed <session>/<agent> [interval]" >&2
exit 1
fi
TARGET="$1"
INTERVAL="${2:-5}"
# Parse session/agent
if [[ "$TARGET" != */* ]]; then
echo "error: must specify session/agent (e.g., myproj/observer)" >&2
exit 1
fi
SESSION="${TARGET%%/*}"
AGENT="${TARGET#*/}"
PROMPT_PATH="session/$SESSION/agent/$AGENT/prompt"
# Get the agent's cwd for the git repo
CWD=$(ollie-9p read "session/$SESSION/agent/$AGENT/cfg" 2>/dev/null | grep '^cwd=' | cut -d= -f2-)
if [[ -z "$CWD" ]]; then
CWD="$PWD"
fi
cd "$CWD"
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "error: $CWD is not a git repository" >&2
exit 1
fi
echo "[observer-feed] watching $CWD every ${INTERVAL}s → $TARGET"
LAST_DIFF=""
while true; do
# Capture current diff (unstaged + staged vs HEAD)
DIFF=$(git diff HEAD -- 2>/dev/null || true)
if [[ -n "$DIFF" && "$DIFF" != "$LAST_DIFF" ]]; then
printf '%s\n' "$DIFF" | ollie-9p write "$PROMPT_PATH"
LAST_DIFF="$DIFF"
fi
sleep "$INTERVAL"
done

View File

@ -92,7 +92,7 @@ install-el:
migrate-bin:
#!/usr/bin/env sh
old="$HOME/bin"
for f in olliesrv ollie-9p ollie-remote toolsrv ollie-gui ollie-remount logseq-cli o ObserverFeed; do
for f in olliesrv ollie-9p ollie-remote toolsrv ollie-gui ollie-remount logseq-cli o; do
if [ -f "$old/$f" ]; then
echo " removing stale $old/$f"
rm -f "$old/$f"
@ -184,12 +184,11 @@ install-data:
install -m644 data/tools/_lib/__init__.py {{cfg}}/tools/_lib/__init__.py
install -m644 data/tools/_lib/args.py {{cfg}}/tools/_lib/args.py
install -m755 data/tools/_lib/args.sh {{cfg}}/tools/_lib/args.sh
# Scripts (ollie-remount, logseq-cli, o, ObserverFeed)
# Scripts (ollie-remount, logseq-cli, o)
mkdir -p {{bin}}
install -m755 data/scripts/ollie-remount {{bin}}/ollie-remount
install -m755 data/scripts/logseq-cli {{bin}}/logseq-cli
install -m755 data/scripts/o {{bin}}/o
install -m755 data/scripts/ObserverFeed {{bin}}/ObserverFeed
# Acme scripts
install -m755 data/scripts/acme/acme-ollie-ensure {{bin}}/acme-ollie-ensure
install -m755 data/scripts/acme/AskFile {{bin}}/AskFile