Files
HealthLog/.github/workflows/knip.yml
T
Marc-André Bombeck 8a56f48259 refactor(prompts): unify src/lib/insights/prompt*.ts into src/lib/ai/prompts/
Pre-v1.4.41 prompts lived in two homes — `src/lib/ai/prompts/` (per-
metric system prompts + safety contracts) and `src/lib/insights/prompt
*.ts` (user-prompt builder + comparison snapshot + the `compactSections`
helper). A new reader could not tell from filenames which file to
extend; both directories looked equally authoritative. Audit rec #3
flagged the split as the only undiscoverable seam in the AI layer.

Move both files into `src/lib/ai/prompts/`:
  - `lib/insights/prompt.ts` → `lib/ai/prompts/insight-system-prompt.ts`
  - `lib/insights/prompt-compact.ts` → `lib/ai/prompts/compact-sections.ts`
  - co-located tests follow

Three importers updated: `app/api/insights/generate/route.ts`,
`lib/ai/coach/snapshot.ts`, the generate route test (the
`vi.mock('@/lib/insights/prompt')` path moved too). Prompts now have
ONE home and ONE mental model.
2026-05-21 17:14:01 +02:00

44 lines
1.2 KiB
YAML

name: Knip
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
knip:
name: Dead-code gate
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm db:generate
# v1.4.41 W-PROCESS-DOCS — exports + types tier staged for
# promotion to enforcing. The W-SIMPLIFIER and W-INSIGHTS-HOT
# cleanup waves have not yet landed on develop at the time this
# comment was written (48 unused exports + 52 unused exported
# types still in the tree), so the gate remains scoped to
# files,dependencies,binaries,unlisted. Once those cleanup waves
# merge and `pnpm knip --reporter compact` reports zero unused
# exports + zero unused types, drop the `--include` flag below
# to flip exports + types to enforcing. See
# `.planning/phase-W-PROCESS-DOCS-v1441-report.md` for the
# promotion checklist and the rollback path.
- run: pnpm knip --reporter compact --include files,dependencies,binaries,unlisted