Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

refactor(catalog): remove .ts imports, as any casts, normalize alias resolution (#2152)

Hernan Javier Ardila Sanchezc52b365e1d31
diff --git a/.agents/workflows/review-prs.md b/.agents/workflows/review-prs.md
index 73e547d40d..97b6dc3f83 100644
--- a/.agents/workflows/review-prs.md
+++ b/.agents/workflows/review-prs.md
@@ -200,7 +200,7 @@ Perform a **global impact assessment** to verify whether the PR changes are comp
```
- **Fallback (ONLY for external forks without maintainer edit access):**
- Using `cherry-pick` instead of fixing the contributor's PR directly is a **LAST RESORT**. You MUST ALWAYS attempt to `git push` your fixes to their branch first.
+ Using `cherry-pick` instead of fixing the contributor's PR directly is a **LAST RESORT**. You MUST ALWAYS attempt to `git push` your fixes to their branch first.
**ONLY if `git push` explicitly fails with a permission/access error** (meaning the contributor unchecked "Allow edits from maintainers" or it's a locked fork), you may use `git cherry-pick` to bring their changes into the release branch and fix the issues locally.
Even then, ensure you preserve the contributor's authorship (`git commit --author="Contributor Name <email>"` if creating new commits).
Once you have integrated their work into the release branch, **DO NOT close their PR**. Leave it open so the contributor retains credit. Under NO CIRCUMSTANCES should you use `gh pr close`.
diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml
index b5e8cfd4dc..a639c3fa36 100644
--- a/.github/workflows/claude-code-review.yml
+++ b/.github/workflows/claude-code-review.yml
@@ -36,9 +36,8 @@ jobs:
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
- 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 }}'
+ 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 }}"
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
-
diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml
index 6b15fac7af..eb9719ecca 100644
--- a/.github/workflows/claude.yml
+++ b/.github/workflows/claude.yml
@@ -47,4 +47,3 @@ jobs:
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr *)'
-
diff --git a/.issues/feat-batch-delete-provider-accounts.md b/.issues/feat-batch-delete-provider-accounts.md
index fe84a123c8..94c7910c4c 100644
--- a/.issues/feat-batch-delete-provider-accounts.md
+++ b/.issues/feat-batch-delete-provider-accounts.md
@@ -15,6 +15,7 @@ Users managing multiple provider accounts (e.g., 20+ API keys or OAuth connectio
5. Repeating for every account
This is:
+
- **Time-consuming**: O(n) confirm dialogs and API calls for n accounts
- **Error-prone**: Easy to accidentally click the wrong account
- **Tedious**: No way to quickly clean up stale or duplicate accounts
@@ -35,15 +36,15 @@ Add a checkbox-based selection UI to the provider connections list:
### Files to Modify
-| File | Change |
-|------|--------|
-| `src/app/(dashboard)/dashboard/providers/[id]/page.tsx` | Add batch delete state, select-all + per-row checkboxes, batch delete handler |
-| `src/app/api/providers/route.ts` | Add `DELETE /api/providers` with `POST` body `ids: string[]` for batch delete |
-| `src/lib/db/providers.ts` | Add `deleteProviderConnections(ids: string[])` batch DB function |
-| `src/i18n/messages/en.json` | Add i18n keys: `batchDeleteSelected`, `batchDeleteConfirm`, `batchDeleteSuccess` |
-| `src/i18n/messages/*.json` | Add i18n keys to all locale files |
-| `tests/unit/db-providers-crud.test.ts` | Add unit tests for batch delete DB function |
-| `tests/integration/api-routes-critical.test.ts` | Add integration test for batch delete API endpoint |
+| File | Change |
+| ------------------------------------------------------- | -------------------------------------------------------------------------------- |
+| `src/app/(dashboard)/dashboard/providers/[id]/page.tsx` | Add batch delete state, select-all + per-row checkboxes, batch delete handler |
+| `src/app/api/providers/route.ts` | Add `DELETE /api/providers` with `POST` body `ids: string[]` for batch delete |
+| `src/lib/db/providers.ts` | Add `deleteProviderConnections(ids: string[])` batch DB function |
+| `src/i18n/messages/en.json` | Add i18n keys: `batchDeleteSelected`, `batchDeleteConfirm`, `batchDeleteSuccess` |
+| `src/i18n/messages/*.json` | Add i18n keys to all locale files |
+| `tests/unit/db-providers-crud.test.ts` | Add unit tests for batch delete DB function |
+| `tests/integration/api-routes-critical.test.ts` | Add integration test for batch delete API endpoint |
### 1. DB Layer (`src/lib/db/providers.ts`)
@@ -60,9 +61,9 @@ export async function deleteProviderConnections(ids: string[]): Promise<number>
// Batch delete connections
const placeholders = ids.map(() => "?").join(",");
- const result = db.prepare(
- `DELETE FROM provider_connections WHERE id IN (${placeholders})`
- ).run(...ids);
+ const result = db
+ .prepare(`DELETE FROM provider_connections WHERE id IN (${placeholders})`)
+ .run(...ids);
backupDbFile("pre-write");
invalidateDbCache("connections");
@@ -210,14 +211,14 @@ interface ConnectionRowProps {
<input
type="checkbox"
checked={selectedIds.size === connections.length && connections.length > 0}
- ref={(el) => { if (el) el.indeterminate = selectedIds.size > 0 && selectedIds.size < connections.length; }}
+ ref={(el) => {
+ if (el) el.indeterminate = selectedIds.size > 0 && selectedIds.size < connections.length;
+ }}
onChange={handleToggleSelectAll}
className="w-4 h-4 rounded border-border text-primary focus:ring-primary/30"
/>
<span className="text-sm font-medium text-text-muted">
- {selectedIds.size > 0
- ? `${selectedIds.size} selected`
- : `${connections.length} accounts`}
+ {selectedIds.size > 0 ? `${selectedIds.size} selected` : `${connections.length} accounts`}
</span>
</label>
@@ -252,8 +253,10 @@ interface ConnectionRowProps {
```typescript
test("deleteProviderConnections deletes multiple connections", async () => {
const ids = [
- (await createProviderConnection({ provider: "openai", name: "test-1", authType: "apikey" })).id!,
- (await createProviderConnection({ provider: "openai", name: "test-2", authType: "apikey" })).id!,
+ (await createProviderConnection({ provider: "openai", name: "test-1", authType: "apikey" }))
+ .id!,
+ (await createProviderConnection({ provider: "openai", name: "test-2", authType: "apikey" }))
+ .id!,
];
const deleted = await deleteProviderConnections(ids);
@@ -278,7 +281,7 @@ test("DELETE /api/providers — batch delete", async () => {
const ids = [conn1.id, conn2.id];
const res = await fetch("http://localhost:20128/api/providers", {
method: "DELETE",
- headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` },
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
body: JSON.stringify({ ids }),
});
@@ -307,16 +310,17 @@ test("DELETE /api/providers — batch delete", async () => {
### Risks & Mitigations
-| Risk | Mitigation |
-|------|------------|
-| User accidentally deletes wrong accounts | Require confirmation dialog with count |
-| Too many connections selected | Cap at 100 per batch; show error if exceeded |
-| Partial failure on batch delete | DB runs in transaction; all-or-nothing semantics |
-| Performance with large selections | Batch SQL with `IN (...)` clause is efficient up to 100 |
+| Risk | Mitigation |
+| ---------------------------------------- | ------------------------------------------------------- |
+| User accidentally deletes wrong accounts | Require confirmation dialog with count |
+| Too many connections selected | Cap at 100 per batch; show error if exceeded |
+| Partial failure on batch delete | DB runs in transaction; all-or-nothing semantics |
+| Performance with large selections | Batch SQL with `IN (...)` clause is efficient up to 100 |
### Coverage
Per repository rules, this change affects production code in `src/` → automated tests required:
+
- Unit test for `deleteProviderConnections()` in `tests/unit/db-providers-crud.test.ts`
- Integration test for `DELETE /api/providers` batch endpoint in `tests/integration/api-routes-critical.test.ts`
- Run `npm run test:coverage` — all 4 metrics must meet 60% minimum
diff --git a/src/i18n/messages/pl.json b/src/i18n/messages/pl.json
index 05ac37dde6..0b88cb6d56 100644
--- a/src/i18n/messages/pl.json
+++ b/src/i18n/messages/pl.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/pt-BR.json b/src/i18n/messages/pt-BR.json
index 948ecf47c1..5fe2fe07e5 100644
--- a/src/i18n/messages/pt-BR.json
+++ b/src/i18n/messages/pt-BR.json
@@ -4836,4 +4836,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/pt.json b/src/i18n/messages/pt.json
index ebe95cadcb..1bc73cfd73 100644
--- a/src/i18n/messages/pt.json
+++ b/src/i18n/messages/pt.json
@@ -4690,4 +4690,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/ro.json b/src/i18n/messages/ro.json
index 5c510d65e7..e378df33b8 100644
--- a/src/i18n/messages/ro.json
+++ b/src/i18n/messages/ro.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json
index f5e7c2c66c..fd077d2788 100644
--- a/src/i18n/messages/ru.json
+++ b/src/i18n/messages/ru.json
@@ -4682,4 +4682,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/sk.json b/src/i18n/messages/sk.json
index 5a0666bf2f..439f6cf003 100644
--- a/src/i18n/messages/sk.json
+++ b/src/i18n/messages/sk.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/sv.json b/src/i18n/messages/sv.json
index 4819a48984..512b429248 100644
--- a/src/i18n/messages/sv.json
+++ b/src/i18n/messages/sv.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/sw.json b/src/i18n/messages/sw.json
index 001d49628d..93d1f02fc4 100644
--- a/src/i18n/messages/sw.json
+++ b/src/i18n/messages/sw.json
@@ -4951,4 +4951,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/ta.json b/src/i18n/messages/ta.json
index da7cff7a34..5acf944cd4 100644
--- a/src/i18n/messages/ta.json
+++ b/src/i18n/messages/ta.json
@@ -4951,4 +4951,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/te.json b/src/i18n/messages/te.json
index 834dfe46e8..a178d85111 100644
--- a/src/i18n/messages/te.json
+++ b/src/i18n/messages/te.json
@@ -4951,4 +4951,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/th.json b/src/i18n/messages/th.json
index 8776c4f00a..6f55813dad 100644
--- a/src/i18n/messages/th.json
+++ b/src/i18n/messages/th.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/tr.json b/src/i18n/messages/tr.json
index 8bc0fb18d9..c9ce447a70 100644
--- a/src/i18n/messages/tr.json
+++ b/src/i18n/messages/tr.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/uk-UA.json b/src/i18n/messages/uk-UA.json
index f8d744939d..b81cd285b0 100644
--- a/src/i18n/messages/uk-UA.json
+++ b/src/i18n/messages/uk-UA.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/ur.json b/src/i18n/messages/ur.json
index e2844cebaf..25ce74b47f 100644
--- a/src/i18n/messages/ur.json
+++ b/src/i18n/messages/ur.json
@@ -4951,4 +4951,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}
diff --git a/src/i18n/messages/vi.json b/src/i18n/messages/vi.json
index 221a85193e..526e9892c0 100644
--- a/src/i18n/messages/vi.json
+++ b/src/i18n/messages/vi.json
@@ -4658,4 +4658,4 @@
"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer",
"agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"
}
-}
\ No newline at end of file
+}