feat(linkedin-studio): trend-store staleness nudge — SessionStart B-S3 [skip-docs]
SessionStart now warns (>=7d, warn-only) when the persistent trend store's newest capture is stale, firing ONLY when the store already holds captures (a never-scanned user is never nagged). Neutral wording — "scan for trends" hits trend-spotter's own trigger; no hardcoded beat (de-niche invariant). - store.ts: newestCaptureDate() — pure max-capturedAt staleness signal (SSOT) - cli.ts: status [--json] subcommand (count + newest + daysStale) - session-start.mjs: trendsNewestCapture() reads trends.json as raw JSON (no tsx spawn at session start) + the reminder line, beside import-staleness - tests: +3 store tests (newestCaptureDate) + hook subprocess test (3 cases: >=7d fires, <7d silent, absent/empty silent + no crash) - test-runner.sh: trends floor 21->24 Verified: trends 24/24 · all hook tests 131/131 · gate 89/0/0 · real render confirms "Trend signals are N days old. Scan for trends…". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RigJBiRFNtFZKCz21qNbQ4
This commit is contained in:
parent
9f9c4bbd86
commit
0907b2b92d
6 changed files with 186 additions and 2 deletions
|
|
@ -161,6 +161,17 @@ export function history(store: TrendStore, opts: HistoryOptions = {}): TrendReco
|
|||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* The most recent capturedAt across the store (ISO date), or null when the
|
||||
* store is empty. The staleness signal behind the SessionStart trend-freshness
|
||||
* nudge (B-S3) and the `status` CLI subcommand: reuses history()'s newest-first
|
||||
* ordering so the module has a single notion of "newest". Pure — the days-stale
|
||||
* arithmetic (needs "today") lives in the caller, not here.
|
||||
*/
|
||||
export function newestCaptureDate(store: TrendStore): string | null {
|
||||
return history(store, { limit: 1 })[0]?.capturedAt ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default store path under the per-user data dir (M0 data-path convention), so
|
||||
* the trend history survives plugin upgrades/reinstalls. `LINKEDIN_STUDIO_DATA`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue