fix: restore log, notify, notify_ctx functions to dev-agent.sh
Lost during #160 refactor. These are dev-agent specific (reference $ISSUE, $THREAD_FILE, $LOGFILE) so they belong in the agent script, not the shared library.
This commit is contained in:
parent
d83098f382
commit
42fa8f48e0
1 changed files with 21 additions and 0 deletions
|
|
@ -40,6 +40,27 @@ API="${CODEBERG_API}"
|
||||||
LOCKFILE="/tmp/dev-agent-${PROJECT_NAME:-harb}.lock"
|
LOCKFILE="/tmp/dev-agent-${PROJECT_NAME:-harb}.lock"
|
||||||
STATUSFILE="/tmp/dev-agent-status"
|
STATUSFILE="/tmp/dev-agent-status"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf '[%s] #%s %s\n' "$(date -u '+%Y-%m-%d %H:%M:%S UTC')" "$ISSUE" "$*" >> "$LOGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
notify() {
|
||||||
|
local thread_id=""
|
||||||
|
[ -f "${THREAD_FILE:-}" ] && thread_id=$(cat "$THREAD_FILE" 2>/dev/null || true)
|
||||||
|
matrix_send "dev" "🔧 #${ISSUE}: $*" "${thread_id}" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_ctx() {
|
||||||
|
local plain="$1" html="$2"
|
||||||
|
local thread_id=""
|
||||||
|
[ -f "${THREAD_FILE:-}" ] && thread_id=$(cat "$THREAD_FILE" 2>/dev/null || true)
|
||||||
|
if [ -n "$thread_id" ]; then
|
||||||
|
matrix_send_ctx "dev" "🔧 #${ISSUE}: ${plain}" "🔧 #${ISSUE}: ${html}" "${thread_id}" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
matrix_send "dev" "🔧 #${ISSUE}: ${plain}" "" "${ISSUE}" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
printf '[%s] dev-agent #%s: %s\n' "$(date -u '+%Y-%m-%d %H:%M:%S UTC')" "$ISSUE" "$*" > "$STATUSFILE"
|
printf '[%s] dev-agent #%s: %s\n' "$(date -u '+%Y-%m-%d %H:%M:%S UTC')" "$ISSUE" "$*" > "$STATUSFILE"
|
||||||
log "$*"
|
log "$*"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue