← story.propek
STORY MI-1.2
MI-1.2
Epic: Market Intel Macro v1
PENDING
ACCEPTANCE CRITERIA (10/10)
1. Script `scripts/generate-alerts.js` reads latest state files (bcb-latest.json, commodities-latest.json) and timeseries files for previous values
2. Compares all available indicators against `config/thresholds.json` using `alert-engine.evaluateAll()`
3. For each triggered alert, generates a markdown file at `data/alerts/YYYY-MM-DD-{indicator}-{severity}.md` with frontmatter (title, date, type, severity, indicator, value, threshold)
4. Alert markdown includes: indicator description, current value with unit, threshold value with direction, delta vs previous, timestamp, and recommended action
5. Writes `data/state/alerts-active.json` with summary: all active alerts, alert_count, critical_count, warning_count
6. Gracefully handles missing state files (e.g., commodities not yet collected) -- skips those indicators
7. Supports `--dry-run` flag (prints alerts that would be generated without writing)
8. Supports `--verbose` and `--help` flags
9. Prints summary to stdout: "N alerts (X critical, Y warning)"
10. Overwrites existing alert file for same indicator+severity+date (idempotent)