← story.propek
STORY MI-0.2
MI-0.2
Epic: Market Intel Macro v1
PENDING
ACCEPTANCE CRITERIA (14/14)
1. `lib/data-store.js` exports `readJSON(filePath)`, `writeJSON(filePath, data, options)`, `appendToSeries(filePath, dataPoint, maxEntries)`, `ensureDir(dirPath)`
2. `readJSON` returns parsed object or `null` if file does not exist or is invalid JSON
3. `writeJSON` writes atomically: write to `.tmp` file then `fs.renameSync` to final path
4. `writeJSON` creates parent directories automatically via `ensureDir`
5. `writeJSON` supports `options.backup` (creates `.bak` before overwrite) and `options.pretty` (2-space indent, default true)
6. `appendToSeries` deduplicates by `date_iso` field -- same date overwrites existing entry
7. `appendToSeries` trims series to `maxEntries` (default 365) oldest-first
8. `appendToSeries` returns the updated series object with `lastUpdated` timestamp
9. `lib/logger.js` exports `createLogger(name, options)`
10. Logger returns object with `.debug()`, `.info()`, `.warn()`, `.error()` methods
11. Output format: `TIMESTAMP [LEVEL] name -- message {JSON_DATA}`
12. Level filtering: messages below configured level are suppressed (debug < info < warn < error)
13. Optional file output: if `options.file` is set, also appends to that file path
14. Both libs use ONLY Node.js stdlib (`fs`, `path`) -- zero npm dependencies