Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ build/
.mypy_cache/
.ruff_cache/
.pytest_cache/
.vitest/
10 changes: 0 additions & 10 deletions .husky/pre-commit

This file was deleted.

9 changes: 9 additions & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
set -e

vp staged
vp check
pnpm run knip

# The SDK has its own lint config; run it only when its files are staged.
if git diff --cached --name-only --diff-filter=ACMR | grep -q '^sdks/typescript/'; then
pnpm --dir sdks/typescript run check
fi
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ Local build needs dummy env: `DATABASE_URL=postgres://… BETTER_AUTH_SECRET=<
- `src/lib/shared/schemas/project.ts` (name `^[a-zA-Z0-9_-]+$` 1–50, `retentionDays` null/0/1–3650), `log.ts`, `incident.ts`
- `src/routes/v1/logs/+server.ts`, `v1/ingest/+server.ts`, `api/projects/[id]/logs/+server.ts`, `logs/stream/+server.ts`, `incidents/stream/+server.ts`
- `drizzle/` SQL + `compose.yaml` + `Dockerfile` + `entrypoint.sh` (migrate → seed if `ADMIN_PASSWORD` → `bun ./build/index.js`)
- `vite.config.ts` (vp: staged `vp check --fix`, lint ignores `sdks/**`), `knip.json`, `pnpm-workspace.yaml` (pnpm settings + `allowBuilds`), `.husky/pre-commit` (`vp check && pnpm run knip`)
- `vite.config.ts` (vp: staged formatting, lint ignores `sdks/**`), `knip.json`, `pnpm-workspace.yaml` (pnpm settings + `allowBuilds`), `.vite-hooks/pre-commit` (`vp staged`, `vp check`, knip, conditional SDK check)

## Runtime/Tooling Preferences

- **pnpm 12 + Bun.** pnpm manages dependencies (`packageManager pnpm@12.6.0`; the app and `sdks/typescript` share the root `pnpm-lock.yaml`). Settings live in `pnpm-workspace.yaml`, not `.npmrc`, and install scripts are denied unless listed under `allowBuilds` — an unreviewed one fails `pnpm install`, as does a `package.json` change (`pnpm install` is frozen by default; regenerate with `pnpm install --lockfile-only` first). Bun (`engines.bun >=1.2.0`, pinned 1.4.2 in the CI e2e jobs + Docker `oven/bun:1.4.2-alpine`) stays the runtime: it serves the built output and runs `scripts/*.ts`, which rely on bun's extensionless TS resolution. One-off CLIs: `pnpm dlx → bunx → npx`.
- **Vite+ (`vp`) 0.3.1**, **vitest 4.1.11** via `overrides`, `@vitest/coverage-v8` must match runner (hard-fail otherwise). Root TS 6 + `@typescript/native` 7 for `--tsgo` (svelte-check 4.x rejects TS7 main). `vite`/`vitest`/`@vitest/*` bumps via `vp migrate` only.
- **Vite+ (`vp`) 1.0.0-rc.0**, **Vitest 5.0.1** via the workspace catalog/overrides; `@vitest/coverage-v8` must match the runner (hard-fail otherwise). Root TS 6 + `@typescript/native` 7 for `--tsgo` (svelte-check 4.x rejects TS7 main). Upgrade the toolchain from the workspace root with the current global `vp migrate --full`, not one package at a time.
- **Postgres 18-alpine** everywhere (PG19 beta — don't bump). `db:push` dev-only; prod/CI `db:migrate`. `db:generate` needs TTY; if it replays old migrations (meta snapshots cover 0000–0005+0011), hand-write SQL.
- Env: `DATABASE_URL` (must start `postgres`, required), `BETTER_AUTH_SECRET` (≥32, required unless dev/test), `ORIGIN` (prod proxies), `RATE_LIMIT_*_RPM`, `SSE_*`, `LOG_*`, `IDLE_TIMEOUT` (Bun.serve idle timeout in seconds; image ships 120, heartbeat clamped to half), `INCIDENT_AUTO_RESOLVE_MINUTES=30`. Behind proxy set `ADDRESS_HEADER` + `XFF_DEPTH` or IP limiting sees socket IP.
- Never commit/push/rebase unless asked; never `reset --hard`, `clean -fd`, print secrets.
Expand All @@ -91,4 +91,4 @@ Tier by **filename suffix** (Playwright excluded from Vitest). Import from `vite
- **Integration:** fresh PGlite per test via schema reflection (not `drizzle/*.sql`); new column types may need `test-db.ts` type map / `tableOrder` or table silently skipped. Seed via `tests/fixtures/db.ts` (`seedProject`, `seedLog`, `seedProjectWithApiKey` — plaintext once); add same-origin `Origin`; `clearApiKeyCache()` in `beforeEach`. Don't copy `health.integration.test.ts` inline `CREATE TABLE` (legacy `api_key` col).
- **Conventions before refactor:** timeseries/incident-detail/timeline tests spy on `db.select` and throw on full-row pulls — aggregate in SQL. `hooks.server.unit.test.ts` drives the real `handle` (session population, `/v1` + `/api/health` fast paths, login + `/v1` rate limits, signup kill-switch, CSRF).
- **E2E:** CI preview `:4173`, local dev `:5173`, `workers:1 retries:2`, `extraHTTPHeaders` Origin, admin `admin/adminpass`, `RATE_LIMIT_LOGIN_RPM=10000`, login specs wrap in `expect(…).toPass({timeout:45000})`. Helpers: `helpers/otlp.ts`, `helpers/log-selectors.ts`. Chromium+firefox local, chromium-only CI.
- Pre-commit: `vp check && pnpm run knip` (+ `pnpm run check` for Svelte/TS). Run nearest tier for touched code. Coverage signal-only.
- Pre-commit: Vite+ dispatcher runs `vp staged && vp check && pnpm run knip` (plus SDK check when SDK files are staged). Run `pnpm run check` for Svelte/TS and nearest test tier for touched code. Coverage signal-only.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Logwell is a lightweight, self-hosted log aggregation platform for developers wh

## Prerequisites

- [Node.js](https://nodejs.org) >= 22.18 (build, tests, tooling)
- [Node.js](https://nodejs.org) ^22.22.2, ^24.15.0, or >=26 (build, tests, and Vite+ hooks)
- [pnpm](https://pnpm.io) 12 (`packageManager` pins the exact version)
- [Bun](https://bun.sh) >= 1.2 (runtime for the built server and `scripts/*.ts`)
- [Docker](https://docker.com) (for PostgreSQL)
Expand Down Expand Up @@ -168,7 +168,7 @@ pnpm --filter logwell up # TypeScript SDK only

To update pnpm itself, run `pnpm self-update` here and update the pinned version and release-asset checksums in `Dockerfile`.

Vite+/Vite/Vitest share versions in the root workspace catalog. Upgrade them together via `pnpm exec vp migrate --full` rather than independently. Python (`sdks/python/uv.lock`) and Go (`sdks/go/go.mod`) remain separate ecosystems; update them with `uv lock --upgrade` and `go get -u ./...` from their respective SDK directories.
Vite+/Vite/Vitest share versions in the root workspace catalog. Upgrade them together from the workspace root with the current global `vp migrate --full --no-interactive` (not one package at a time). Python (`sdks/python/uv.lock`) and Go (`sdks/go/go.mod`) remain separate ecosystems; update them with `uv lock --upgrade` and `go get -u ./...` from their respective SDK directories.

## Environment Variables

Expand Down
1 change: 0 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
},
"ignoreDependencies": [
"tw-animate-css",
"@oxlint/plugins",
"@divkix/logwell",
"layerchart",
"d3-scale",
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev": "vp -C . dev",
"build": "vp -C . build",
"preview": "vp -C . preview",
"prepare": "vp config && husky && svelte-kit sync || echo ''",
"prepare": "vp config && svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --tsgo",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --tsgo --watch",
"lint": "vp check",
Expand Down Expand Up @@ -51,7 +51,6 @@
"devDependencies": {
"@electric-sql/pglite": "^0.5.8",
"@internationalized/date": "^3.12.4",
"@oxlint/plugins": "1.85.0",
"@playwright/test": "^1.63.0",
"@sveltejs/kit": "^2.70.3",
"@sveltejs/vite-plugin-svelte": "^7.3.0",
Expand All @@ -65,7 +64,6 @@
"@vitest/coverage-v8": "catalog:",
"@vitest/ui": "catalog:",
"bits-ui": "^2.19.2",
"husky": "^9.1.7",
"jsdom": "^30.1.1",
"knip": "^6.35.1",
"mode-watcher": "^1.1.0",
Expand All @@ -81,7 +79,7 @@
},
"engines": {
"bun": ">=1.2.0",
"node": ">=22.18.0"
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
},
"packageManager": "pnpm@12.6.0"
}
Loading
Loading