fix: harden review and verifier governance
This commit is contained in:
68
scripts/cron_status_report.sh
Executable file
68
scripts/cron_status_report.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
ACTOR="${1:-cron}"
|
||||
STATUS="${2:-unknown}"
|
||||
TOPIC="${3:-cron status report}"
|
||||
EVIDENCE_LINE="${4:-}"
|
||||
NEXT_LINE="${5:-}"
|
||||
|
||||
if [[ "$ACTOR" != "cron" ]]; then
|
||||
echo "unsupported actor: $ACTOR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
report_date="${REPORT_DATE:-$(date +%F)}"
|
||||
daily_memory_path="${LLM_DAILY_MEMORY_PATH:-memory/${report_date}.md}"
|
||||
now_hm="$(date +%H:%M)"
|
||||
|
||||
header="# llm-intelligence Daily Memory - ${report_date}
|
||||
|
||||
> 项目单日归档文件,不是实时 WAL。
|
||||
|
||||
## Entries
|
||||
"
|
||||
if [[ -f "$daily_memory_path" ]]; then
|
||||
existing="$(python3 - <<'PY' "$daily_memory_path"
|
||||
from pathlib import Path
|
||||
import sys
|
||||
p=Path(sys.argv[1])
|
||||
print(p.read_text(encoding='utf-8'), end='')
|
||||
PY
|
||||
)"
|
||||
else
|
||||
mkdir -p "$(dirname "$daily_memory_path")"
|
||||
existing="$header"
|
||||
fi
|
||||
|
||||
entry="
|
||||
## ${now_hm} - cron - cron status report
|
||||
### Context
|
||||
status=${STATUS}
|
||||
topic=${TOPIC}
|
||||
|
||||
### Evidence
|
||||
${EVIDENCE_LINE:-none}
|
||||
|
||||
### Outcome
|
||||
status=${STATUS}
|
||||
${TOPIC}
|
||||
|
||||
### Next
|
||||
${NEXT_LINE:-none}
|
||||
"
|
||||
|
||||
python3 - <<'PY' "$daily_memory_path" "$existing" "$entry"
|
||||
from pathlib import Path
|
||||
import sys
|
||||
path=Path(sys.argv[1])
|
||||
existing=sys.argv[2]
|
||||
entry=sys.argv[3]
|
||||
content=existing.rstrip() + "\n" + entry
|
||||
path.write_text(content, encoding='utf-8')
|
||||
PY
|
||||
|
||||
echo "CRON_STATUS actor=cron status=${STATUS} file=${daily_memory_path}"
|
||||
Reference in New Issue
Block a user