Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
aaac2c6
Merge pull request #165 from zicochaos/feat/forward-cache-routing-hea…
mcowger Apr 15, 2026
846adb4
feat: add per-attribution Prometheus metrics for API keys
github-actions[bot] Apr 15, 2026
d14a5a2
Merge pull request #170 from mcowger/claude/issue-168-20260415-1948
mcowger Apr 15, 2026
6185741
Merge pull request #160: feat: allow API keys to log into admin panel…
mcowger Apr 15, 2026
6844db7
feat: add metadata overrides and custom source for model aliases
claude Apr 14, 2026
7f6c591
fix: address review feedback on custom metadata + overrides
claude Apr 14, 2026
b796741
fix: call ensureDb() before reading this.schema in getDebugLogs/getEr…
darkspadez Apr 14, 2026
6ee366a
feat: auto-populate override form and add tag inputs for modalities/p…
darkspadez Apr 14, 2026
37127a7
fix: preserve user edits across catalog switches in override form
darkspadez Apr 14, 2026
f614b1b
fix: consistent tag dedup, blur-commit gating, and deep custom-defaul…
darkspadez Apr 14, 2026
258a1b6
fix: cancel stale metadata debounce and reset override mode on clear
darkspadez Apr 14, 2026
1cc3a83
fix: batch alias metadata fetch and narrow principal via role discrim…
darkspadez Apr 15, 2026
29f56f0
chore: regenerate migrations after rebase onto main
mcowger Apr 15, 2026
a5b00f4
fix: throw ManagementAuthError in preHandlers instead of calling repl…
mcowger Apr 15, 2026
9db46cc
Merge pull request #163: feat: add metadata overrides and custom sour…
mcowger Apr 15, 2026
e2532ab
fix: encapsulate management routes to avoid FSTWRN004 errorHandler wa…
mcowger Apr 15, 2026
13e8cdb
fix: compute previous release tag explicitly to avoid dev-tag pollution
mcowger Apr 15, 2026
4ab037c
Update migrations technique
mcowger Apr 15, 2026
28a45c5
feat: enhance release notes workflow with PR grouping, contributor at…
mcowger Apr 15, 2026
09db303
feat: use AI_DATA secret for release notes model config
mcowger Apr 15, 2026
91e5ed2
feat: use AI_DATA secret for claude-code-action workflows
mcowger Apr 15, 2026
80b4b4f
fix: install git in Docker builder stage for prepare script
mcowger Apr 15, 2026
15eb33a
fix: skip git hooks setup when git is unavailable (e.g. Docker)
mcowger Apr 15, 2026
2ed25aa
fix: pass AI_DATA secret via env var to avoid JS escaping issues
mcowger Apr 15, 2026
477e2dc
fix: set ANTHROPIC_SMALL_FAST_MODEL to prevent calls to default haiku
mcowger Apr 15, 2026
516434d
fix: restore plugin_marketplaces line in claude-code-review.yml
mcowger Apr 15, 2026
1420bf2
feat: add YAML validation for workflow files in pre-commit hook
mcowger Apr 15, 2026
ee25267
docs: remove YAML config references from AGENTS.md - config is now DB…
mcowger Apr 15, 2026
c46012d
ci: add Biome format to pre-commit hook
mcowger Apr 15, 2026
8a161f8
fix: separate main model and small model in claude workflow
mcowger Apr 16, 2026
f350236
fix: use epoch ms for PostgreSQL bigint columns in quota_state
github-actions[bot] Apr 16, 2026
92c9e2d
fix: set ANTHROPIC_DEFAULT_*_MODEL env vars
mcowger Apr 16, 2026
11b8e75
fix: prevent API key leakage in Actions logs
mcowger Apr 16, 2026
e1ee1fe
Merge pull request #171 from mcowger/claude/issue-166-20260416-0017
mcowger Apr 16, 2026
a6d1385
docs: document AI_DATA secret schema in claude workflow
mcowger Apr 16, 2026
fd376cd
docs: remove hostname from AI_DATA secret documentation
mcowger Apr 16, 2026
a25141a
Improve calculations and display for energy usage.
alexispurslane Apr 11, 2026
79ba2e6
Better model situation
alexispurslane Apr 11, 2026
544c248
Probably more accurate active params.
alexispurslane Apr 11, 2026
39a0c19
resolve code review critiques
alexispurslane Apr 13, 2026
743b890
improve visualization and computational efficiency of energytimecompa…
alexispurslane Apr 13, 2026
240b686
improve slices toasted
alexispurslane Apr 13, 2026
931046e
use session time instead of AI inf duration; add PS5
alexispurslane Apr 14, 2026
c16d46e
aesthetic fix
alexispurslane Apr 14, 2026
d7506b3
huge refactor of huggingface-model-fetcher for testing
alexispurslane Apr 14, 2026
2b53787
improve visualization
alexispurslane Apr 15, 2026
d53599f
strip out extra graphs, focus on exposing metrics
alexispurslane Apr 16, 2026
a4c8d69
deal with migrations
alexispurslane Apr 16, 2026
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
42 changes: 42 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,48 @@ set -euo pipefail
repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root"

# --- Block migration file commits (CI auto-generates these) ---
if [ "${CI:-}" != "true" ] && [ "${ALLOW_MIGRATIONS:-}" != "1" ]; then
migration_files=$(git diff --cached --name-only -- \
'packages/backend/drizzle/migrations/' \
'packages/backend/drizzle/migrations_pg/' || true)
if [ -n "$migration_files" ]; then
echo ""
echo "[pre-commit] ERROR: Migration files should not be committed manually."
echo "Migrations are auto-generated on main by CI after schema changes merge."
echo ""
echo "Blocked files:"
echo "$migration_files" | sed 's/^/ /'
echo ""
echo "To remove them from your commit: git reset HEAD -- packages/backend/drizzle/migrations/ packages/backend/drizzle/migrations_pg/"
echo "To bypass (maintainers only): ALLOW_MIGRATIONS=1 git commit ..."
echo ""
exit 1
fi
fi

# --- Validate GitHub Actions workflow YAML ---
workflow_files=$(git diff --cached --name-only -- '.github/workflows/*.yml' '.github/workflows/*.yaml' || true)
if [ -n "$workflow_files" ]; then
echo "[pre-commit] Validating workflow YAML files..."
for f in $workflow_files; do
if [ -f "$repo_root/$f" ]; then
if ! bun -e "const fs=require('fs');const yaml=require('$repo_root/packages/backend/node_modules/yaml');try{yaml.parse(fs.readFileSync('$repo_root/$f','utf8'));console.log(' ✓ $f')}catch(e){console.error(' ✗ $f:',e.message);process.exit(1)}" 2>&1; then
echo "[pre-commit] ERROR: Invalid YAML in $f"
exit 1
fi
fi
done
fi

# --- Run Biome formatter on staged files ---
staged_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.ts' '*.tsx' '*.js' '*.jsx' '*.json' '*.md' '*.yaml' '*.yml' || true)
if [ -n "$staged_files" ]; then
echo "[pre-commit] Running Biome formatter on staged files..."
echo "$staged_files" | xargs bunx biome format --write
echo "$staged_files" | xargs git add
fi

echo "[pre-commit] Running backend tests..."
cd packages/backend
bun test
24 changes: 24 additions & 0 deletions .github/workflows/check-no-migrations-in-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check No Migrations in PR

on:
pull_request:
paths:
- 'packages/backend/drizzle/migrations/**'
- 'packages/backend/drizzle/migrations_pg/**'

jobs:
check-migrations:
name: Block migration files in PR
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'migrations-ok') }}
steps:
- name: Reject migration files
run: |
echo "::error::This PR modifies migration files (drizzle/migrations/ or drizzle/migrations_pg/)."
echo ""
echo "Community PRs should only modify schema .ts files in drizzle/schema/."
echo "Migrations are auto-generated after merge by CI."
echo ""
echo "To test locally: run 'bunx drizzle-kit generate' but do not commit the output."
echo "If this is a maintainer PR that intentionally includes migrations, add the 'migrations-ok' label."
exit 1
18 changes: 17 additions & 1 deletion .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,27 @@ jobs:
with:
fetch-depth: 1

- name: Parse AI config from secret
id: ai_config
uses: actions/github-script@v7
env:
AI_DATA: ${{ secrets.AI_DATA }}
with:
script: |
const ai = JSON.parse(process.env.AI_DATA);
core.setOutput('base_url', ai.base_url);
core.setOutput('model', ai.model_name);
core.setOutput('api_key', ai.api_key);

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
env:
ANTHROPIC_BASE_URL: ${{ steps.ai_config.outputs.base_url }}
ANTHROPIC_SMALL_FAST_MODEL: ${{ steps.ai_config.outputs.model }}
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
anthropic_api_key: ${{ steps.ai_config.outputs.api_key }}
claude_args: '--model ${{ steps.ai_config.outputs.model }}'
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
Expand Down
33 changes: 32 additions & 1 deletion .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
name: Claude Code

# The AI_DATA repository secret controls which models and API endpoint
# the Claude Code action uses. It must be a JSON object with this shape:
#
# {
# "base_url": "<url>", # Proxy URL → ANTHROPIC_BASE_URL
# "model_name": "glm-5.1", # Main work model → --model, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL
# "small_model_name": "claude-haiku-4-5", # Classification model → ANTHROPIC_SMALL_FAST_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL
# "api_key": "sk-..." # API key → ANTHROPIC_API_KEY (auto-masked via core.setSecret)
# }
#
on:
issue_comment:
types: [created]
Expand Down Expand Up @@ -30,11 +40,32 @@ jobs:
with:
fetch-depth: 1

- name: Parse AI config from secret
id: ai_config
uses: actions/github-script@v7
env:
AI_DATA: ${{ secrets.AI_DATA }}
with:
script: |
const ai = JSON.parse(process.env.AI_DATA);
core.setOutput('base_url', ai.base_url);
core.setOutput('model', ai.model_name);
core.setOutput('small_model', ai.small_model_name);
core.setSecret(ai.api_key);
core.setOutput('api_key', ai.api_key);

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
env:
ANTHROPIC_BASE_URL: ${{ steps.ai_config.outputs.base_url }}
ANTHROPIC_SMALL_FAST_MODEL: ${{ steps.ai_config.outputs.small_model }}
ANTHROPIC_DEFAULT_SONNET_MODEL: ${{ steps.ai_config.outputs.model }}
ANTHROPIC_DEFAULT_HAIKU_MODEL: ${{ steps.ai_config.outputs.small_model }}
ANTHROPIC_DEFAULT_OPUS_MODEL: ${{ steps.ai_config.outputs.model }}
ANTHROPIC_API_KEY: ${{ steps.ai_config.outputs.api_key }}
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: '--model ${{ steps.ai_config.outputs.model }}'

# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/generate-migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Generate Migrations

on:
push:
branches: [main]
paths:
- 'packages/backend/drizzle/schema/**/*.ts'

concurrency:
group: generate-migrations
cancel-in-progress: false

jobs:
generate:
name: Generate Migrations
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: |
bun install --frozen-lockfile
cd packages/backend && bun install --frozen-lockfile

- name: Generate SQLite migrations
working-directory: packages/backend
run: bunx drizzle-kit generate

- name: Generate PostgreSQL migrations
working-directory: packages/backend
run: bunx drizzle-kit generate --config drizzle.config.pg.ts

- name: Check for new migrations
id: check
run: |
if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard packages/backend/drizzle/migrations packages/backend/drizzle/migrations_pg)" ]; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi

- name: Commit and push migrations
if: steps.check.outputs.has_changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add packages/backend/drizzle/migrations/ packages/backend/drizzle/migrations_pg/
git commit -m "chore: auto-generate migrations for schema changes"
git push
Loading