Retire Planner v1: engine (live 2026 CPP/OAS/GIS/RRIF/tax), 17-step UI, 4 SVG charts, vision gallery, tests
This commit is contained in:
commit
e25dd4e0a1
29 files changed
+3143
No files matched your search
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stage 4 driver: generate 13 vision images with z-image-turbo ($0.0119/img).
|
||||
# Aborts if remainingBalance < $1.00 or cumulative cost > $2.00.
|
||||
set -u
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p site/vision .fetch
|
||||
export RETIRE_NANO_KEY="$(grep -m1 '^HERMES_CUSTOM_NANO_GPT_API_KEY=' ~/.hermes/.env | cut -d= -f2-)"
|
||||
[ -n "$RETIRE_NANO_KEY" ] || { echo "NO KEY"; exit 3; }
|
||||
TOTAL=0
|
||||
LOG=.fetch/vision_log.jsonl
|
||||
: > "$LOG"
|
||||
while IFS=$'\t' read -r slug prompt; do
|
||||
[ -n "$slug" ] || continue
|
||||
if [ -s "site/vision/$slug.png" ] && [ "${FORCE:-0}" != 1 ]; then
|
||||
echo "SKIP $slug (exists)"; continue
|
||||
fi
|
||||
line=$(node scripts/gen1.js "$slug" "$prompt" 2>&1 | tail -1)
|
||||
echo "RES $line"
|
||||
echo "$line" >> "$LOG"
|
||||
read -r ok cost bal <<<"$(node -e "const o=JSON.parse(process.argv[1]);console.log(o.ok?1:0,(o.cost??0),(o.bal??-1))" "$line")"
|
||||
if [ "$ok" != "1" ]; then
|
||||
echo "GEN FAIL $slug — continuing"
|
||||
sleep 3
|
||||
continue
|
||||
fi
|
||||
TOTAL=$(node -e "console.log((parseFloat(process.argv[1])+parseFloat(process.argv[2])).toFixed(4))" "$TOTAL" "$cost")
|
||||
echo "OK $slug cost=$cost cumulative=$TOTAL bal=$bal"
|
||||
awk -v a="$TOTAL" -v b="2.00" 'BEGIN{exit (a+0 > b+0)?0:1}' && { echo "ABORT: cumulative cost $TOTAL > \$2"; break; }
|
||||
awk -v b="$bal" 'BEGIN{exit (b+0 >= 0 && b+0 < 1.0)?0:1}' && { echo "ABORT: remainingBalance $bal < \$1"; break; }
|
||||
sleep 1
|
||||
done < scripts/prompts.tsv
|
||||
echo "DONE cumulative=$TOTAL"
|
||||
ls -la site/vision/
|
||||
node -e '
|
||||
const fs=require("fs");
|
||||
const m={};
|
||||
for (const f of fs.readdirSync("site/vision")) {
|
||||
const mt = f.match(/^(.+)\.(png|webp|jpeg)$/); if (!mt) continue;
|
||||
m[mt[1]] = f;
|
||||
}
|
||||
fs.writeFileSync("site/vision/manifest.json", JSON.stringify(m, null, 2));
|
||||
console.log("manifest:", JSON.stringify(m));
|
||||
'
|
||||
Reference in new issue
Block a user