Phase 2: analysis layer (analyze.js), cache guard, log hygiene
- analyze.js: burn rate, weekly reconstruction, cycle stagger, rotation rank, underspend alerts, log prune with weekly archive - logger.js: getCachedRun(maxAgeMinutes) — skip probing if recent data exists - monitor.js: cache guard at wake — 20-min dedup, zero extra API calls - test.js: fix type assertion for gemini-api/xai-api providers (+5 passing); add 14 new tests for cache guard and analyze.js (162 total, all green) - docs/analyze.md: usage reference Co-authored-by: Hannibal Smith <hannibal@trentuna.com>
This commit is contained in:
parent
1b4e299461
commit
34898b1196
6 changed files with 745 additions and 2 deletions
14
monitor.js
14
monitor.js
|
|
@ -58,6 +58,20 @@ async function probeProvider(p) {
|
|||
}
|
||||
|
||||
async function main() {
|
||||
// Cache guard — return last logged run if within 20 minutes (skip on --summary, --no-log, --provider filter)
|
||||
if (!noLog && !filterProvider && !isSummaryOnly) {
|
||||
const { getCachedRun } = await import('./logger.js');
|
||||
const cached = getCachedRun(20);
|
||||
if (cached) {
|
||||
if (isJson) {
|
||||
console.log(JSON.stringify(cached, null, 2));
|
||||
} else {
|
||||
console.log(generateReport(cached));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const allProviders = getProviders();
|
||||
const providerNames = filterProvider
|
||||
? [filterProvider]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue