Merge branch 'chore/knip-dead-exports' into release/v1.37.27

This commit is contained in:
Marc-André Bombeck committed 2026-08-23 19:38:45 +02:00
commit 31991924f0
32 files changed
+282 -571

No files matched your search

-6
View File
@@ -15,14 +15,8 @@ import {
getTrendSentiment,
sentimentColorClass,
type TrendDirectionSentiment,
type TrendSentimentDirection,
} from "@/lib/insights/trend-sentiment";
// v1.9.0 — the metric-aware sentiment mapping moved to a shared module so the
// range-delta caption paints the same colour for the same signal. Re-exported
// here so existing `@/components/charts/trend-card` importers keep the type.
export type { TrendDirectionSentiment, TrendSentimentDirection };
interface SecondaryMetric {
/** Sub-value latest reading (e.g. diastolic when latest is systolic). */
latest: number | null;
-1
View File
@@ -16,5 +16,4 @@ export {
selectAllState,
selectedIdsOnPage,
selectedCountOnPage,
type SelectAllState,
} from "./selection";
@@ -13,7 +13,6 @@ import { toast } from "sonner";
import type {
CoachConversationAttachmentDTO,
CoachConversationDetailDTO,
CoachConversationDTO,
CoachConversationsPage,
CoachProvenance,
CoachScope,
@@ -1118,7 +1117,6 @@ export function useSendCoachMessage(opts: UseSendCoachMessageOptions = {}) {
// `@/lib/ai/coach/types` directly.
export type {
CoachConversationAttachmentDTO,
CoachConversationDTO,
CoachConversationDetailDTO,
CoachProvenance,
CoachSuggestion,
@@ -11,7 +11,4 @@ export { WorkoutDetailZones } from "./zones";
export { WorkoutDetailRoute } from "./route-map";
export { WorkoutDetailSplits } from "./splits";
export { WorkoutDetailDayContext } from "./day-context";
export {
WorkoutInsightCard,
type WorkoutActivityInsightData,
} from "./insight-slot";
export { WorkoutInsightCard } from "./insight-slot";
@@ -44,10 +44,7 @@
*/
import { encodeCadence } from "@/components/medications/scheduling/cadence-picker";
import {
dateToIsoString,
isoStringToDate,
} from "@/components/medications/scheduling/course-window-row";
import { dateToIsoString } from "@/components/medications/scheduling/course-window-row";
import {
type CadenceKind,
type CadenceSubControls,
@@ -1277,4 +1274,4 @@ function subControlsFromRrule(rrule: string): CadenceSubControls {
// Re-exports — convenience for the dialog and tests
// ────────────────────────────────────────────────────────────────────
export { dateToIsoString, isoStringToDate };
export { dateToIsoString };
-2
View File
@@ -42,8 +42,6 @@ import {
} from "@/lib/validations/health-profile-facts";
import { decryptHealthProfileFactValue } from "@/lib/profile/health-facts";
export { ABOUT_ME_MAX_CHARS } from "@/lib/validations/about-me";
export interface SelfContext {
aboutMe: string | null;
conditions: string | null;
+1 -12
View File
@@ -29,11 +29,7 @@
import { z } from "zod/v4";
import {
WEEKDAY_TOKENS,
type CadenceKind,
type WeekdayToken,
} from "@/components/medications/scheduling/types";
import { WEEKDAY_TOKENS } from "@/components/medications/scheduling/types";
/** Closed list — matches the design-synthesis dose-unit dropdown. */
export const DOSE_UNITS = [
@@ -90,13 +86,6 @@ export type MedicationExtractionResult = z.infer<
typeof medicationExtractionSchema
>;
/**
* Re-export the wizard `CadenceKind` + `WeekdayToken` types so callers
* (the route, the tests) import a single module rather than chasing
* the wizard types directory.
*/
export type { CadenceKind, WeekdayToken };
/**
* Build the system prompt. Same shape across calls — the model only
* sees the user's free text via `buildUserPrompt()`. The system prompt
+1 -6
View File
@@ -26,10 +26,7 @@
*
* Pure and in-place — the snapshot is a plain record by the time it gets here.
*/
import {
TODAY_CLAIM_MAX_AGE_DAYS,
isCurrentForTodayClaim,
} from "@/lib/insights/measurement-freshness";
import { isCurrentForTodayClaim } from "@/lib/insights/measurement-freshness";
/** When a metric block's series actually ends, and what may be said about it. */
export interface SnapshotAsOf {
@@ -187,5 +184,3 @@ export function annotateSnapshotFreshness(snapshot: Record<string, unknown>): {
}
return { stale, coarseWithheld };
}
export { TODAY_CLAIM_MAX_AGE_DAYS };
+3 -19
View File
@@ -6,28 +6,12 @@
* figures, and a bounded loop that executes them. The legacy snapshot path
* stays alive as the no-tools fallback (per-provider `supportsTools`).
*/
export {
COACH_TOOL_DEFS,
COACH_TOOL_NAMES,
isCoachToolName,
type CoachToolName,
} from "./definitions";
export {
executeCoachTool,
type CoachToolResult,
type CoachToolTrace,
} from "./executor";
export { COACH_TOOL_DEFS } from "./definitions";
export type { CoachToolTrace } from "./executor";
export {
buildCoachDataInventory,
renderDataInventory,
renderFocusHint,
type CoachDataInventory,
type InventoryEntry,
} from "./inventory";
export { buildToolModeAddendum } from "./system-addendum";
export {
runCoachToolLoop,
MAX_ROUNDS,
HARD_CAP,
type CoachToolLoopResult,
} from "./loop";
export { runCoachToolLoop, MAX_ROUNDS } from "./loop";
+1 -2
View File
@@ -11,7 +11,6 @@ import {
SCORE_PILLAR_DOMAINS,
SCORE_PILLAR_IDS,
SCORE_VERSION,
type CompositeValue,
type HealthScoreReport,
type PillarInputs,
type ScorePillarId,
@@ -95,5 +94,5 @@ export function computeHealthScore(
};
}
export type { CompositeValue, HealthScoreReport };
export type { HealthScoreReport };
export * from "./types";
-2
View File
@@ -20,8 +20,6 @@ import { randomBytes } from "node:crypto";
import { prisma } from "@/lib/db";
import { hashToken } from "@/lib/auth/hmac";
export { INVITE_MAX_TTL_DAYS } from "@/lib/validations/invite";
/** Raw-token prefix — distinct from `hlk_` (API) and `hlr_` (refresh). */
export const INVITE_TOKEN_PREFIX = "hlv_";
-6
View File
@@ -44,13 +44,7 @@ export function buildNativeCallbackUrl(params: Record<string, string>): string {
// Re-export the shared mint/consume core so the OIDC callback + token route
// keep importing from here unchanged.
export {
HANDOFF_CODE_PREFIX,
mintNativeHandoff,
consumeNativeHandoff,
stampIssuedRefreshToken,
} from "@/lib/auth/native-handoff";
export type {
HandoffFlow,
MintedHandoff,
ConsumeHandoffResult,
} from "@/lib/auth/native-handoff";
-3
View File
@@ -40,7 +40,6 @@ import {
} from "@/lib/crypto";
import {
ENCRYPTED_COLUMNS,
encryptedColumnKey,
type EncryptedColumn,
} from "@/lib/crypto/encrypted-columns";
@@ -381,5 +380,3 @@ export async function rotateCorpus(
totalErrors,
};
}
export { encryptedColumnKey };
-2
View File
@@ -26,10 +26,8 @@ import { CUSTOM_SYMPTOM_KEY_PREFIX } from "@/lib/cycle/custom-symptoms-shared";
export {
CUSTOM_SYMPTOM_KEY_PREFIX,
CUSTOM_SYMPTOM_CATEGORY_KEY,
CUSTOM_SYMPTOM_CATEGORY_ID,
MAX_CUSTOM_SYMPTOMS_PER_USER,
CUSTOM_SYMPTOM_ICON_ALLOWLIST,
isCustomSymptomKey,
createCustomSymptomSchema,
updateCustomSymptomSchema,
+1 -17
View File
@@ -10,25 +10,9 @@ export * from "./types";
export * from "./day-math";
export {
predictCycle,
estimateCycleLength,
estimatePeriodLength,
observedPeriodLength,
detectTempShift,
detectMucusPeak,
confirmSymptothermal,
detectTemperatureTrend,
detectLhSurgeOvulation,
median,
mad,
resolveLuteal,
clampLuteal,
} from "./prediction";
export { phaseForDay, phaseSeries, type PhaseCycle } from "./phase";
export {
resolveCycleVerdict,
type CycleVerdict,
type CycleVerdictState,
type CyclePhaseSpan,
type CycleProfileLengths,
type VerdictCalendarDay,
} from "./verdict";
export { phaseForDay, type PhaseCycle } from "./phase";
+1 -7
View File
@@ -18,7 +18,7 @@ import {
isStructuredLeafId,
REPORT_GROUPS,
} from "./report-selection/catalogue";
import { MEASUREMENT_TYPE_LABEL_KEYS } from "./measurements/type-label-keys";
import { getUnitForType } from "./validations/measurement";
import {
makeFormatters,
@@ -166,12 +166,6 @@ export interface DoctorReportRenderOptions {
includeCharts?: boolean;
}
// Per-type label keys live in a lucide-free module so leaf consumers — the
// public clinician share view, this renderer — can import the map without
// dragging icon components into their graph. Re-exported here so the PDF core
// stays the single import surface its existing callers already use.
export { MEASUREMENT_TYPE_LABEL_KEYS };
export const DOCTOR_REPORT_TYPE_UNIT_KEYS: Record<string, string | null> = {
WEIGHT: "kg",
BLOOD_PRESSURE_SYS: "mmHg",
-3
View File
@@ -37,12 +37,9 @@
* to show a biomarker's name resolves it through the labs catalog instead.
*/
import { LOINC_SYSTEM, UCUM_SYSTEM } from "@/lib/fhir/loinc-map";
import { localisedValues } from "@/lib/i18n/shared-resolve";
import { stripDiacritics } from "@/lib/i18n/fold-for-match";
export { LOINC_SYSTEM, UCUM_SYSTEM };
/** A curated biomarker → LOINC + canonical-UCUM entry. */
export interface LabLoincMapping {
loinc: string;
+1 -6
View File
@@ -39,12 +39,7 @@ import {
type CoachReadStripData,
} from "@/lib/insights/derived/coach-read-shape";
export type {
CoachReadBaseline,
CoachReadDriver,
CoachReadStripData,
CoachReadBaselinePlacement,
} from "@/lib/insights/derived/coach-read-shape";
export type { CoachReadStripData } from "@/lib/insights/derived/coach-read-shape";
/**
* Read the latest reading for `(userId, type)` — the value the strip places
+25 -163
View File
@@ -1,185 +1,47 @@
/**
* v1.10.0 — public barrel for the derived-metrics layer.
*
* The one module every consumer imports from. Append-only per wave —
* Wave 1 exports the foundation (`Derived<T>` + coverage builders +
* registry + norms + the flagship baseline engine + the route
* dispatcher); W2/W3 append their per-metric engines (`fitness-age`,
* `vascular-age`, `sleep-score`, `readiness`) here.
* Carries the cross-cutting surface: the registry (which metrics exist and
* how they are archetyped), the route dispatcher, the baseline profile
* loader, and the handful of per-metric compute engines and value shapes
* that consumers outside this directory actually reach for.
*
* Re-exports the client-safe types/coverage builders and the
* server-only compute engines from one place; consumers import only what
* they need. (A `"use client"` component must value-import only from
* `./types` + `./coverage` + `./registry` — those are server-import-free.
* The route + server consumers may import the engines below.)
* It is deliberately NOT a mirror of every export under `./`. The per-metric
* scoring helpers, their `*Opts` / `*Band` types and the sub-score weights are
* imported from their concrete module (`./sleep-score`, `./trajectory`, …) by
* the code and tests that use them; re-exporting them here only produced lines
* nothing imported. Add a line below when an outside consumer appears, not in
* anticipation of one.
*
* A `"use client"` component must value-import only from `./types`,
* `./coverage` and `./registry` — those are server-import-free. The route and
* server consumers may import the engines below.
*/
// ── client-safe contract (types + pure builders + metadata) ──────────
export type {
Derived,
DerivedOk,
DerivedInsufficient,
DerivedCoverage,
DerivedConfidence,
DerivedConfidenceBand,
DerivedProvenance,
DerivedProvenanceSource,
} from "./types";
// ── client-safe contract ─────────────────────────────────────────────
export { isDerivedOk } from "./types";
export {
deriveCoverage,
buildOk,
buildInsufficient,
scoreToBand,
nowProvenanceTimestamp,
} from "./coverage";
export type { DeriveCoverageArgs } from "./coverage";
export {
DERIVED_METRIC_IDS,
VITALS_BASELINE_TYPES,
TRAJECTORY_TYPES,
SAME_TIME_BASELINE_TYPES,
SAME_TIME_BASELINE_WINDOW_DAYS,
SAME_TIME_BASELINE_MIN_HISTORY_DAYS,
isDerivedMetricId,
getDerivedMetricMeta,
isVitalsBaselineType,
isTrajectoryType,
isSameTimeBaselineType,
} from "./registry";
export type {
DerivedMetricId,
DerivedMetricMeta,
DerivedArchetype,
} from "./registry";
export {
lookupNormalRange,
hasSharpenedNorm,
predictSixMinuteWalkDistance,
} from "./norms";
export type { NormRange, NormSex } from "./norms";
export type { DerivedMetricId } from "./registry";
// ── server-only compute engines (do NOT value-import from a client component) ──
export {
computeVitalsBaseline,
loadBaselineProfile,
buildBaselineBand,
median,
medianAbsoluteDeviation,
} from "./baseline";
export type {
VitalsBaselineValue,
VitalsBaselineOpts,
BaselineProfile,
} from "./baseline";
export { loadBaselineProfile } from "./baseline";
export type { BaselineProfile } from "./baseline";
export { computeDerivedMetric } from "./dispatch";
export type { DerivedComputeArgs } from "./dispatch";
// ── W2b vitals tier: passthrough re-frames + derived bands ───────────
export {
computeFitnessAge,
placeVo2Band,
fitnessAgeDeltaYears,
} from "./fitness-age";
export type { FitnessAgeValue, FitnessBand } from "./fitness-age";
export type { SleepScoreValue } from "./sleep-score";
export {
computeSixMinuteWalkBand,
placeSixMinuteWalkBand,
} from "./six-minute-walk";
export type { SixMinuteWalkValue, SixMinuteWalkBand } from "./six-minute-walk";
export { computeReadiness } from "./readiness";
export type { ReadinessValue, ReadinessComponentKey } from "./readiness";
export { computeVascularAgeDelta, placeVascularBand } from "./vascular-age";
export type { VascularAgeDeltaValue, VascularBand } from "./vascular-age";
export { computeCoincidentDeviation } from "./coincident-deviation";
export { computeHrvBalance, placeHrvBalance } from "./hrv-balance";
export type { HrvBalanceValue, HrvBalanceBand } from "./hrv-balance";
export type { WellnessScoreValue } from "./wellness-scores";
export { computeBmi, classifyBmi } from "./bmi";
export type { BmiValue, BmiBand, BmiCategory } from "./bmi";
// ── W3 composites (server-only compute engines) ──────────────────────
export {
computeSleepScore,
blendSleepSubScores,
reconstructNights,
sleepNeedMinutes,
scoreSufficiency,
scoreEfficiency,
scoreComposition,
scoreConsistency,
scoreTiming,
SLEEP_SUBSCORE_WEIGHTS,
} from "./sleep-score";
export type {
SleepScoreValue,
SleepScoreOpts,
SleepSubScore,
SleepSubScoreKey,
NightSummary,
} from "./sleep-score";
export {
computeReadiness,
blendReadinessComponents,
scoreDeviation,
READINESS_WEIGHTS,
READINESS_MIN_COMPONENTS,
} from "./readiness";
export type {
ReadinessValue,
ReadinessOpts,
ReadinessComponent,
ReadinessComponentKey,
} from "./readiness";
export {
computeCoincidentDeviation,
classifyDeviation,
COINCIDENT_FIRE_THRESHOLD,
COINCIDENT_MIN_BANDS,
} from "./coincident-deviation";
export type {
CoincidentDeviationValue,
CoincidentDeviationOpts,
VitalDeviation,
} from "./coincident-deviation";
// ── persisted nightly wellness scores (passthrough read) ─────────────
export {
computeWellnessScore,
bandWellnessScore,
WELLNESS_SCORE_TYPES,
} from "./wellness-scores";
export type {
WellnessScoreValue,
WellnessScoreBand,
WellnessScoreType,
WellnessScoreOpts,
} from "./wellness-scores";
// ── v1.11.0 (Epic B, Pillar 3) forecasting engine (server-only) ──────
export {
computeTrajectory,
fitOls,
predictionIntervalHalfWidth,
TRAJECTORY_MIN_R2,
TRAJECTORY_MIN_HISTORY_DAYS,
} from "./trajectory";
export type {
TrajectoryValue,
TrajectoryPoint,
TrajectoryOpts,
OlsFit,
} from "./trajectory";
// ── v1.34.0 same-time baseline for cumulative metrics (server-only) ──
export { computeSameTimeBaseline } from "./same-time-baseline";
export type {
SameTimeBaselineValue,
SameTimeBaselineOpts,
SameTimeBand,
} from "./same-time-baseline";
export { computeTrajectory } from "./trajectory";
export type { TrajectoryValue } from "./trajectory";
+1 -5
View File
@@ -39,11 +39,7 @@ import {
computeMoodDimensionSeries,
type MoodDimensionSummary,
} from "@/lib/insights/mood-dimension-series";
export {
computeMoodDimensionSeries,
type MoodDimensionPoint,
type MoodDimensionSummary,
} from "@/lib/insights/mood-dimension-series";
export { type MoodDimensionSummary } from "@/lib/insights/mood-dimension-series";
import { resolveUserTimezone } from "@/lib/tz/resolver";
import { annotate } from "@/lib/logging/context";
import { createCustomLabelResolver } from "@/lib/mood/custom-tags";
-3
View File
@@ -1,6 +1,5 @@
import { resolveProvider, resolveProviderChain } from "@/lib/ai/provider";
import {
AllProvidersFailedError,
runRawCompletionWithFallback,
type ProviderChainResolved,
} from "@/lib/ai/provider-runner";
@@ -299,5 +298,3 @@ export async function runStatusCompletion(
tokensUsed: result.tokensUsed ?? null,
};
}
export { AllProvidersFailedError };
-4
View File
@@ -41,9 +41,5 @@ export {
listTargets,
listTargetsBySource,
listDistinctTargets,
type LinkSourceKind,
type LinkTargetKind,
type LinkRequest,
type LinkResult,
type LinkedTarget,
} from "@/lib/links/link-service";
+11 -41
View File
@@ -1,47 +1,17 @@
/**
* HealthLog MCP server — barrel.
*
* A read-only-by-default Model Context Protocol surface that re-exports
* A read-only-by-default Model Context Protocol surface that exposes
* HealthLog's existing server-authoritative read paths over the MCP wire, so a
* user can query their own health data from any MCP-capable assistant. The tool
* / resource layer here is transport-agnostic; transports (stdio now, remote
* `/mcp` later) attach to `createMcpServer(ctx)`.
* / resource layer under this directory is transport-agnostic; transports
* attach to `createMcpServer(ctx)`.
*
* The barrel carries only what the remote `/mcp` transport route needs. The
* tool, resource, prompt and write registries are imported from their concrete
* module by `./server` and by their own tests — mirroring them here produced
* lines nothing imported.
*/
export { createMcpServer, MCP_SERVER_NAME, MCP_SERVER_VERSION } from "./server";
export { resolveMcpAuthContext, type McpAuthContext } from "./auth";
export { MCP_TOOLS, MCP_TOOL_NAMES, type McpToolDefinition } from "./tools";
export { MCP_WRITE_TOOLS, MCP_WRITE_TOOL_NAMES } from "./write-tools";
export {
logMcpMeasurement,
logMcpMood,
type McpMeasurementResult,
type McpMoodResult,
} from "./writes";
export {
MCP_RESOURCES,
MCP_RESOURCE_URIS,
type McpResourceDefinition,
} from "./resources";
export {
MCP_PROMPTS,
MCP_PROMPT_NAMES,
type McpPromptDefinition,
type McpPromptResult,
type McpPromptMessage,
} from "./prompts";
export {
getCorrelation,
compareMetric,
getMetricBaseline,
detectChangepoints,
resolveRichMetric,
type RichMetric,
} from "./rich-reads";
export {
SCOPE_HEALTH_READ,
SCOPE_HEALTH_WRITE,
SCOPE_WILDCARD,
tokenAllowsRead,
tokenAllowsWrite,
sessionBinding,
} from "./scopes";
export { createMcpServer } from "./server";
export { resolveMcpAuthContext } from "./auth";
export { SCOPE_HEALTH_READ } from "./scopes";
+2 -11
View File
@@ -1,17 +1,9 @@
export {
assertRecordSettingsAccess,
resolveGuardianRecordSettingsAccess,
type RecordSettingsAccess,
} from "./access";
export { toRecordSettingsDto, type RecordSettingsDto } from "./dto";
export { resolveGuardianRecordSettingsAccess } from "./access";
export { toRecordSettingsDto } from "./dto";
export { resolveManagedIntegrationState } from "./integrations";
export {
classifySettingsDestination,
isGuardianSettingsWriteAllowed,
isManageDelegateSettingsDestination,
SETTINGS_DESTINATION_INVENTORY,
type SettingsDestinationClassification,
type SettingsDestinationKind,
} from "./classification";
export {
isManagedRecordSettingsFamily,
@@ -22,6 +14,5 @@ export {
parseManagedRecordSettingsPatch,
safeParseManagedRecordSettingsPatch,
type ManagedRecordSettingsFamily,
type ManagedRecordSettingsPatch,
} from "./configuration";
export { assertRecordSettingsResponseForRecord } from "./response";
@@ -26,13 +26,6 @@ import {
type ReportSelection,
} from "./selection";
export {
savedReportProfileSchema,
parseSavedProfile,
SAVED_PROFILE_FALLBACK,
type SavedReportProfile,
} from "./profile-shape";
/**
* Resolve the owner's saved selection.
*
+1 -4
View File
@@ -11,7 +11,7 @@
* The template intersects the fenced tier at zero leaves, and
* `catalogue-guard.test.ts` fails the build if that stops being true.
*/
import { SENSITIVE_LEAF_IDS, type ReportLeafId } from "./catalogue";
import { type ReportLeafId } from "./catalogue";
/**
* Identity and insurer (the cover page a practice files the document under),
@@ -59,6 +59,3 @@ export function standardTemplateFor(
const hidden = new Set(hiddenLeaves);
return STANDARD_TEMPLATE_LEAVES.filter((leaf) => !hidden.has(leaf));
}
/** Exported so the purity guard reads the same set the panel does. */
export const SENSITIVE_LEAVES = SENSITIVE_LEAF_IDS;
-1
View File
@@ -49,7 +49,6 @@ export {
formatInUserTz,
userDayKey,
hourInTz,
type FormatInUserTzShape,
} from "./format";
const BERLIN_DAY_FORMATTER = new Intl.DateTimeFormat("en-US", {
-4
View File
@@ -19,7 +19,6 @@ import {
REMINDER_METRIC_MAX_CHARS,
} from "@/lib/ai/coach/reminders";
import {
SUGGESTED_ACTION_TYPES,
CHECKUP_LABEL_MAX_CHARS,
ACTION_NOTE_MAX_CHARS,
ACTION_METRIC_MAX_CHARS,
@@ -133,6 +132,3 @@ export const coachSuggestedActionSchema = z
export type CoachSuggestedActionInput = z.infer<
typeof coachSuggestedActionSchema
>;
/** Stable list of confirmable action types (mirrors the lib allowlist). */
export const COACH_SUGGESTED_ACTION_TYPES = SUGGESTED_ACTION_TYPES;
-3
View File
@@ -307,10 +307,7 @@ export type ListLabResultsInput = z.infer<typeof listLabResultsSchema>;
* implementation. Re-exported here for the existing import sites.
*/
export {
classifyAgainstEffectiveRange,
classifyReferenceRange,
formatReferenceRange,
resolveEffectiveReferenceRange,
type EffectiveReferenceRange,
type ReferenceRangeOrigin,
type ReferenceRangeStatus,