ia_dev/git-issues/list-pending-spooler.sh
Nicolas Cantu e86a9fbb6e refactor: rename gitea-issues to git-issues and symlink projects to monorepo
- Rename directory and scripts env GIT_ISSUES_DIR; secrets path .secrets/git-issues
- Rename agent git-issues-process; update docs GIT_ISSUES_SCRIPTS_AGENTS.md
- Symlink projects/enso, smart_ide, builazoo to ../../projects/<id> when used inside smart_ide
- Update project conf paths for git-issues tokens and imap bridge
2026-04-03 19:05:28 +02:00

32 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# List .pending files in projects/<id>/data/issues/ with status "pending" (one file per message; status updated in place).
# Run from ia_dev root. If PROJECT_ID is set (from MAIL_TO or AI_AGENT_TOKEN), list that project only; else list all projects.
# Output: one path per line.
# Usage: depuis la racine de ia_dev : ./git-issues/list-pending-spooler.sh
set -euo pipefail
GIT_ISSUES_DIR="${GIT_ISSUES_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
ROOT="$(cd "${GIT_ISSUES_DIR}/../.." && pwd)"
export GIT_ISSUES_DIR
cd "$ROOT"
# shellcheck source=lib.sh
source "${GIT_ISSUES_DIR}/lib.sh" 2>/dev/null || true
if [[ -n "${DATA_ISSUES_DIR:-}" && -d "${DATA_ISSUES_DIR}" ]]; then
SPOOLS=("${DATA_ISSUES_DIR}")
else
# No project from MAIL_TO/AI_AGENT_TOKEN: list pending from all projects
SPOOLS=()
for spool in "${GIT_ISSUES_DIR}/../projects/"*/data/issues; do
[[ -d "$spool" ]] || continue
SPOOLS+=("$spool")
done
fi
for SPOOL in "${SPOOLS[@]}"; do
for f in "${SPOOL}"/*.pending; do
[[ -f "$f" ]] || continue
status="$(jq -r '.status // "pending"' "$f" 2>/dev/null)"
if [[ "$status" != "responded" ]]; then
echo "$f"
fi
done
done