feat(phased-execution): ntfy notification after each task; add new-project, upgrade-existing-app, writing-tests, security-audit skills

This commit is contained in:
2026-08-25 11:35:29 -04:00
parent a5c01735ca
commit 4c187ca0d2
7 changed files with 358 additions and 0 deletions
+1
View File
@@ -88,6 +88,7 @@ phases: `.agent/reports/<phase>.a*.*`) — the script also prints a ready to run
| `PI_TRUST` | `0` | `1` = pass `--approve` (load project `.pi/` settings/skills into children) |
| `FRESH_FIX` | `0` | `1` = fixer retries start fresh instead of resuming the failed session |
| `QUIET` | `0` | `1` = suppress live progress display (reports are still written) |
| `PHASE_NOTIFY` | `1` | `0` = disable ntfy push notifications. When on and `~/.env/pi-ntfy.env` exists, a notification is sent after every unit completes (`task` for each task file, `phase` for a phase's final pass) |
## Setup notes
+3
View File
@@ -34,6 +34,9 @@ while unit="$(next_unit)"; do
exit 1
fi
delivered+=("$unit")
# Notify after every unit completes: a phase-end (00_phase.md / legacy file)
# announces the phase; a normal task file announces the task.
if is_phase_end "$unit"; then notify_task "$unit" phase; else notify_task "$unit" task; fi
done
echo
+34
View File
@@ -300,6 +300,40 @@ run_validation() {
bash .agent/validate.sh >"$1" 2>&1
}
# --- notifications ------------------------------------------------------------
# Send a push notification via ntfy after a unit completes. Reads
# ~/.env/pi-ntfy.env (see the ntfy skill). No-ops (silently) when notifications
# are disabled (PHASE_NOTIFY=0) or ntfy is not configured, so it never breaks
# the pipeline. Gated on PHASE_NOTIFY so a misconfigured server can't stall a
# long run; default ON when the env file is present.
notify_task() {
local unit="$1" status="$2" # status: task | phase
[[ "${PHASE_NOTIFY:-1}" == "1" ]] || return 0
local envf="${NTFY_ENV_FILE:-$HOME/.env/pi-ntfy.env}"
[[ -f "$envf" ]] || return 0
# shellcheck disable=SC1090
source "$envf"
[[ -n "${NTFY_URL:-}" && -n "${NTFY_TOKEN:-}" ]] || return 0
local title body tags
if [[ "$status" == phase ]]; then
title="Phase $(unit_phase "$unit") done"
tags="heavy_check_mark,phase-complete"
body="Phase $(unit_phase "$unit") of the pipeline completed."
else
title="Task complete"
tags="heavy_check_mark,task-complete"
body="Task delivered: $unit"
fi
curl -sS -X POST "${NTFY_URL}/${NTFY_TOPIC:-pi}" \
-H "Authorization: Bearer ${NTFY_TOKEN}" \
-H "X-Title: $title" \
-H "X-Priority: 4" \
-H "X-Tags: $tags" \
-H "X-Markdown: yes" \
-d "$body" >/dev/null 2>&1 || warn "ntfy notification failed for $unit"
}
# --- one unit (task, phase final pass, or legacy phase), with retries ---------
# execute_unit <unit>
# Returns 0 and moves the unit to complete/ on success; returns 1 after