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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 23 additions & 0 deletions .claude/skills/delete-comment/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: delete-comment
description: Review and remove a batch of code comments while preserving decisions and tracking implementation debt.
disable-model-invocation: true
---

# Delete comments

1. Read the repository instructions and `docs/comment-cleanup.md`. Inspect the working tree; preserve unrelated changes.
2. Run `bun run --silent comments:inventory` and save the JSON output in a temporary file. Read each selected file and the referenced code. Inventory messages contain comment text and SHA-256 fingerprints. Work in coherent batches; when zero is requested, continue until a fresh inventory has zero diagnostics. A completed batch is not a stopping condition.
3. Classify every comment in the batch:
- **Tautology:** repeats facts directly visible in the adjacent code. Remove it.
- **Stale:** contradicts verified current behavior or references something removed. Record the evidence and remove it.
- **Excuse:** rationalizes specific unresolved implementation debt. Verify the debt, search existing issues, draft using the repository template, and show the draft before filing. Follow `SECURITY.md` for private reporting. A narrow fixture or unavoidable platform constraint is not automatically an excuse. Remove the comment without silently fixing unrelated logic.
- **Decision Record:** preserves a consequential, non-obvious choice or contract. Verify it, then move its rationale to an existing relevant ADR or a sequentially numbered ADR in `docs/adr/`. Avoid duplicating an existing record.
4. Replace tooling comments with equivalent configuration or metadata before deleting them. Migration groups belong in `statements.json`; type references and lint exceptions belong in external config. Preserve legal attribution in a license-compliant distribution location. If a license requires an inline notice, report that blocker rather than violating it. Shell shebangs remain executable interpreter metadata.
5. Use targeted edits or reviewed parser spans. Oxlint offsets are UTF-8 bytes: use byte buffers, not JavaScript string slicing. Preserve token separators and remove entire empty JSX comment containers. Verify parsing and executable AST equivalence where practical. Regex-only bulk deletion is unsafe.
6. Keep `tools/comment-baseline.json` empty. If reviewing an older nonempty ratchet, remove each deleted fingerprint occurrence and empty file entry. Never grant, transfer, or replenish allowances.
7. Extend the audit ledger with each original path, line, fingerprint, category, action, and ADR or issue reference. Mark drafts awaiting approval and unreviewed comments explicitly. Refresh the remaining counts and estimate.
8. Run `bun run lint:comments`, project lint, formatting, type checks, and applicable existing tests. Verify added line, block, JSX, inline HTML-script, and non-JS comments fail. URLs and comment-like string data must remain accepted. Check the final inventory again after builds or generators. Keep temporary verification artifacts outside tracked source.
9. Report the reviewed and pending counts, physical source lines removed, ADRs, issue links or drafts, and failed or skipped checks. Separate gross source-line savings from documentation and baseline growth. Show human-facing Markdown with Leaf using the repository handoff instructions.

Oxlint parses JS/TS, JSX/TSX, and inline HTML scripts. The companion lexical scanner covers the repository's other source/configuration syntaxes; it is not a full compiler. Dependencies, ignored generated/build outputs, and Markdown prose are outside the owned-source inventory. Treat unreviewed material as pending, never as a keyword-classified result.
1 change: 0 additions & 1 deletion .githooks/check-conventional-commit.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
# Shared by the commit-msg hook and the PR title workflow, so both accept the same messages.
set -eu

subject=$1
Expand Down
2 changes: 0 additions & 2 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/sh
# Require a Conventional Commit subject. Skip once with `git commit --no-verify`.
set -eu
hooks=$(dirname "$0")

subject=$(grep -v '^#' "$1" | sed -n '/[^[:space:]]/{p;q;}')
case $subject in
# Git writes these, and autosquash or a revert replaces them before merge.
"Merge "* | "Revert "* | "fixup! "* | "squash! "* | "amend! "*) exit 0 ;;
esac
"$hooks/check-conventional-commit.sh" "$subject"
1 change: 0 additions & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
# Lint, format-check, and type-check the working tree before each commit. Skip once with `git commit --no-verify`.
set -eu
hooks=$(dirname "$0")
"$hooks/check-bun-version.sh"
Expand Down
3 changes: 0 additions & 3 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/sh
# Run the checks CI runs on a pull request, against the commit being pushed and the current origin/main.
# Skip once with `git push --no-verify`.
set -eu
hooks=$(cd "$(dirname "$0")" && pwd)
cd "$(git rev-parse --show-toplevel)"
Expand All @@ -27,7 +25,6 @@ fi
"$hooks/check-bun-version.sh"
bun install --frozen-lockfile

# CI compares against the pull request base, which is main's tip when the run starts.
git fetch --quiet origin main || echo "pre-push: could not fetch origin/main; comparing against the local copy." >&2
base=$(git rev-parse origin/main)

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@ permissions:
contents: read

jobs:
# Branch protection requires a check named `check`; the API contract workflow's job has the same name.
check:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version-file: .bun-version
- run: bun install --frozen-lockfile
# Type-aware lint also checks the independently installed docs and site.
- run: bun install --frozen-lockfile
working-directory: apps/docs
# The site needs its generated route tree before lint.
- run: bun install --frozen-lockfile
working-directory: apps/site
- run: bun --bun run build
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,34 @@ jobs:
run:
working-directory: apps/docs
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version-file: .bun-version
- run: bun install --frozen-lockfile
# --bun runs Blume's node shebang on Bun, so the job needs no Node setup.
- run: bun --bun run check
- run: bun --bun run build

deploy:
needs: check
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
# Queue deploys so an older commit never finishes after a newer one.
concurrency:
group: docs-deploy
cancel-in-progress: false
defaults:
run:
working-directory: apps/docs
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version-file: .bun-version
# Wrangler supports Node, not Bun, so it runs on its node shebang.
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version: 22
- run: bun install --frozen-lockfile
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
sparse-checkout: .githooks
# Squash merges use the title as the commit on main. Passed through env so the title can't inject shell.
- run: sh .githooks/check-conventional-commit.sh "$TITLE"
env:
TITLE: ${{ github.event.pull_request.title }}
10 changes: 2 additions & 8 deletions .github/workflows/react-doctor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# React Doctor finds security, performance, correctness, accessibility,
# bundle-size, and architecture issues in React code. Docs: https://www.react.doctor/ci

name: React Doctor

on:
# Pull requests report and fail only on issues they introduce, relative to the merge base.
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
# Pushes to main track the health score; the action never fails them.
push:
branches: ["main"]

Expand All @@ -26,11 +21,10 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
# The merge base needs full history; a shallow checkout reports pre-existing issues too.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
fetch-depth: 0
- uses: millionco/react-doctor@695e46eee203a5d1855020191aa7e9c010a1250e # v2.4.0
- uses: millionco/react-doctor@695e46eee203a5d1855020191aa7e9c010a1250e
with:
blocking: error
11 changes: 5 additions & 6 deletions .github/workflows/server-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Tags
Expand All @@ -53,16 +53,15 @@ jobs:
else
echo "tags=$image:main,$image:sha-${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
fi
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069
- if: github.event_name != 'pull_request'
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Pull requests only check that the image builds, on one platform to stay fast.
- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc
with:
context: .
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,37 @@ jobs:
run:
working-directory: apps/site
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version-file: .bun-version
# Runs `panda codegen` through the package's prepare script.
- run: bun install --frozen-lockfile
# Builds the client and Worker, then type-checks.
- run: bun --bun run build

deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
# Queue deploys so an older commit never finishes after a newer one.
concurrency:
group: site-deploy
cancel-in-progress: false
defaults:
run:
working-directory: apps/site
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version-file: .bun-version
# Wrangler supports Node, not Bun, so it runs on its node shebang.
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version: 22
- run: bun install --frozen-lockfile
- run: bun --bun run build
# Deploys the Worker config the Cloudflare Vite plugin wrote during the build.
- run: bunx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/workspace-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
target: [base, desktop]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Tags
Expand All @@ -37,16 +37,15 @@ jobs:
else
echo "tags=$image:main,$image:sha-${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
fi
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069
- if: github.event_name != 'pull_request'
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Pull requests only check that the images build, on one platform to stay fast.
- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc
with:
context: apps/server/workspace-image
target: ${{ matrix.target }}
Expand Down
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

# Private server state and installation credentials
data/
data.lock/
*.sqlite
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Remove repository-owned source comments, preserve consequential decisions in ADRs, and enforce a zero-comment baseline across source and configuration. Add the repository-local `/delete-comment` skill. Move migration separators into metadata without changing historical hashes or execution groups, and replace inline lint/type directives with configuration.

- Replace custom lint rules and vendored plugins with `@cloudflare/oxlint-config`.
- The web client validates JSON API responses against their route schemas and rejects malformed responses instead of trusting unchecked types.

Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ cd apps/site && bun install && bun run build
- **Terminology:** follow [`GLOSSARY.md`](GLOSSARY.md). When a word in the docs or UI and a word in the code disagree, the glossary wins.
- **Effect:** server code uses [Effect](https://effect.website). Read [`AGENTS.md`](AGENTS.md) and `apps/server/node_modules/effect/AGENTS.md` before you write Effect services or layers.
- **Web UI components:** add shadcn components with `bun run ui:add`, as described in [`AGENTS.md`](AGENTS.md).
- **Formatting and lint:** `bun run fix` formats with `bun fmt` and applies `oxlint` fixes. Lint uses [`@cloudflare/oxlint-config`](https://github.com/cloudflare/oxlint-config) in `oxlint.config.ts`, without custom rules or plugins.
- **Formatting and lint:** `bun run fix` formats with `bun fmt` and applies `oxlint` fixes. Lint uses [`@cloudflare/oxlint-config`](https://github.com/cloudflare/oxlint-config) in `oxlint.config.ts`, plus the repository's comment ban. `bun run lint:comments` checks tracked and nonignored source files, including tests and UI components. Record non-obvious decisions in `docs/adr/` instead of source comments. Keep tooling exceptions in configuration, not inline suppressions. See [the comment cleanup report](docs/comment-cleanup.md) and invoke `/delete-comment` for future cleanup.
- **Test speed:** the unit test suite in CI must finish in two minutes or less.
- **Documentation:** when a change alters behavior, settings, endpoints, or UI labels described in the docs, update the matching page in [`apps/docs/content/`](apps/docs/content) in the same pull request and run `bun run check` in `apps/docs`.

Expand Down Expand Up @@ -176,6 +176,8 @@ bun run --cwd apps/server db:generate --name short_description # store.sql
bun run --cwd apps/server db:generate:push --name short_description # push.sqlite
```

These wrappers forward options to Drizzle, then move statement separators into adjacent `statements.json` metadata. Keep each SQL file and its metadata together. Historical migration hashes and statement order remain unchanged. See [ADR 0023](docs/adr/0023-comment-free-migration-metadata.md).

## API contract

Route and SSE schemas in `apps/server/src/contract/` generate everything in [`openapi/`](openapi). After changing a route or event schema, run `bun run openapi:generate` and commit the result. `bun run check` fails while the files are stale.
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# syntax=docker/dockerfile:1
FROM oven/bun:1.4 AS deps
WORKDIR /app
COPY package.json bun.lock ./
Expand All @@ -9,8 +8,6 @@ RUN bun install --frozen-lockfile --production
FROM oven/bun:1.4
WORKDIR /app

# The lock file is created beside the data directory, so the volume holds both
# and a second container on the same volume fails to start.
ENV NODE_ENV=production \
CRUMBLE_HOST=0.0.0.0 \
CRUMBLE_PORT=7337 \
Expand Down
Loading