Add a shared log taxonomy (error<warn<info<debug<trace, default info) wired through all three layers, plus a machine-readable per-step run log. - scripts/casan-log.mjs + .specify/scripts/bash/casan-log.sh: shared logger ([LEVEL] ts [component] msg), stderr-only so stdout contracts and exit codes are byte-identical. Node side includes trace-level redaction (secret/PII). - run-casan-pipeline.mjs: per-STEP info line, loop-activation warnings (BACK-TO-PLAN, FAIL->STEP6), debug harness rc + trace_id, trace payload excerpt, end-of-run 13-STEP summary table, and one JSONL line/step in .specify/logs/pipeline-run.jsonl. New --dry-run stubs all agents but keeps the real wrapper in the loop (deterministic, offline, full 13 STEP + loops). - casan-step.mjs: debug logs for judge verdict, checkpoint, rollback; logger import degrades to noop when the file is copied standalone (T1 test). - casan-harness.sh: debug-log each phase H4-in -> H5 -> [H2-gate] -> H6-exec -> H4-out with its rc; optional CASAN_PHASE_REPORT JSON for the Boss. Default level (info) keeps output close to before; behavior opt-in via env. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
942 B
Bash
32 lines
942 B
Bash
#!/usr/bin/env bash
|
|
# CASAN shared log helper (source me, do not execute).
|
|
# Taxonomy (shared with scripts/casan-log.mjs): error < warn < info < debug < trace.
|
|
# CASAN_LOG_LEVEL selects the threshold (default: info). All log lines go to
|
|
# stderr so stdout contracts (CASAN_HARNESS_COMPLETE, cache=..., evidence
|
|
# .stdout files) stay byte-identical.
|
|
|
|
casan_log_num() {
|
|
case "$1" in
|
|
error) echo 0 ;;
|
|
warn) echo 1 ;;
|
|
info) echo 2 ;;
|
|
debug) echo 3 ;;
|
|
trace) echo 4 ;;
|
|
*) echo 2 ;;
|
|
esac
|
|
}
|
|
|
|
CASAN_LOG_LEVEL="${CASAN_LOG_LEVEL:-info}"
|
|
CASAN_LOG_THRESHOLD="$(casan_log_num "$CASAN_LOG_LEVEL")"
|
|
|
|
# casan_log <level> <component> <message...>
|
|
casan_log() {
|
|
local lvl="$1" comp="$2"
|
|
shift 2
|
|
[ "$(casan_log_num "$lvl")" -le "$CASAN_LOG_THRESHOLD" ] || return 0
|
|
printf '[%s] %s [%s] %s\n' \
|
|
"$(printf '%s' "$lvl" | tr '[:lower:]' '[:upper:]')" \
|
|
"$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
|
|
"$comp" "$*" >&2
|
|
}
|