viberank v2 — multi-tool support (Claude Code, Codex, Gemini & more)#51
Merged
Conversation
ccusage v20's default `daily --json` is the aggregate report: rows keyed by `period` (not `date`), with `agent`/`metadata.agents`. The submit path read `day.date` -> undefined -> "Invalid date format" (#49). Reasoning tokens also inflate `totalTokens` past the four components, tripping the strict token-sum check (#48). - add src/lib/ccusage.ts: normalizeCcData (period->date, dedupe the aggregate "all" rows so per-agent rows can't double-count, resolve per-day tools from metadata.agents, recompute totals) + validateCcData (one-sided token check: reject only total < components; port cost/token ratio + range ceilings from Convex as the real anti-inflation guard) - wire normalization into the submit route as the single chokepoint - thread per-day `agents` and submission `tools` through the types - add scripts/test-ccusage.mts (18 cases incl. real multi-tool cc.json) and a `pnpm test` script Verified against a real 97-day / 7-tool cc.json that the old code rejected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Record which coding tools (claude, codex, gemini, copilot, opencode, …)
contributed to each submission and let the leaderboard be filtered by tool.
- migration 002: add submissions.tools[] + daily_breakdowns.agents[]
(additive, default '{}', GIN index for tool filtering)
- persist tools/agents on insert, the overlap-merge, and the claim-merge
- map them back through convertDbSubmission/convertDbDailyBreakdown
- LeaderboardParams.tool -> .contains("tools", [tool]) on both the paged
and date-range queries
- stats: bucket usage by tool instead of the old opus/sonnet-only split
that mislabeled every non-Claude model as "sonnet"
- Leaderboard UI: "All tools / Claude / Codex / …" dropdown (sourced from
global per-tool stats), wired into both leaderboard hooks
Apply migration 002 BEFORE deploying this code.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Viberank now accepts usage from all ccusage-supported tools, so the branding reflects that without sacrificing the "Claude Code" keyword that drives organic traffic. Additive copy (keeps "Claude Code", adds Codex/Gemini/AI coding): - title/description/keywords, OpenGraph + Twitter, JSON-LD descriptions - H1: "Claude Code, Codex & AI Coding Leaderboard" (top-2 tools by usage + umbrella; matches the title tag) - OG/Twitter image cards + /api/og default - per-profile metadata now lists each profile's ACTUAL tools (Claude sorts first) — accurate for multi-tool users and still keyword-rich - domain, URLs, routes, sitemap, canonicals unchanged -> no SEO churn - blog posts left as-is (legit Claude-Code topical content) CLI v1.1.0: - pin `ccusage@latest daily --json` (v20's bare default still works but be explicit); broaden the Claude-only guidance copy; add tool keywords Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The admin "Unflag" action was the last browser->Supabase write using the anon key, which RLS blocks silently (same class as #42/#47). Move it to an admin-gated /api/admin/flag route backed by the service-role data layer. - add src/lib/admin.ts (shared ADMIN_USERS / isAdmin), used by both the /admin page gate and the route's server-side enforcement - useUpdateFlagStatus now POSTs /api/admin/flag and surfaces errors Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convex was dead code behind a feature flag (production has always run on Supabase). It's also what misled PR #50 into patching the wrong backend. Removing it makes the data layer single-backend and removes the confusion. - delete convex/, convex.json, src/lib/data/convex/ - strip Convex branches from the data-layer factory and the submission/ profile/stats hooks; Supabase is the only path - providers.tsx: drop ConvexProvider; env/turbo: drop CONVEX_* vars - drop convex + @convex-dev/rate-limiter deps (Supabase rate-limiter already replaced the latter) - DatabaseBackend type narrowed to "supabase" Build green, tests pass, no live convex references remain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- README: v2 multi-tool narrative, tool filter, ccusage v20 `daily --json`, migration 002 ordering note, `pnpm test`, drop dormant-Convex mention - VALIDATION: one-sided token rule + cost/token ratio guard; point at src/lib/ccusage.ts; admin flag via /api/admin/flag - CONTRIBUTING: Supabase-only data-layer layout - .env.example: drop dead NEXT_PUBLIC_DATABASE_BACKEND + CONVEX_* vars Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…as Claude Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- claim/merge: union submissions.tools with daily agents so tools set by an earlier normalized submission survive a claim/merge (was derived only from daily_breakdowns.agents, which is empty for pre-migration rows) [blocker] - normalizeCcData: decide authoritative rows per-date, not globally, so a payload mixing aggregate dates with per-agent-only dates can't drop the per-agent-only days [edge-case data loss] + test - pin `ccusage daily --json` in the MCP server and submit-to-viberank.sh - claim/merge: don't mutate the submissions array in place when picking base Tests: 22 passed. Build green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 9, 2026
Vercel CI installs with --frozen-lockfile; the lockfile still pinned convex + @convex-dev/rate-limiter after they were dropped from package.json, failing the preview build. Regenerated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Vercel project Build Command was `pnpx convex deploy --cmd 'turbo run build'`, which fails now that Convex is removed (and was running a Convex prod deploy on every push). Add vercel.json to override it with plain `turbo run build`; remove the dead NEXT_PUBLIC_DATABASE_BACKEND from turbo's env allowlist. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
viberank v2 — multi-tool support
viberank started as a Claude Code leaderboard. As
ccusagev20 grew to track Codex, Gemini CLI, Copilot, OpenCode and more, submissions broke and the data model no longer fit. This PR evolves viberank into a multi-tool AI coding leaderboard while keeping Claude Code first-class — and fixes the live submission outage along the way.Fixes the current outage
ccusagev20's defaultdaily --jsonkeys daily rows byperiod(notdate) and addsagent/metadata.agents. The submit path readday.date→undefined→ every submission failed withInvalid date format: undefined(#49). Reasoning/thinking tokens also inflatetotalTokenspast the four components, tripping the strict token-sum check (#48). Both are fixed.What's in it
src/lib/ccusage.ts):period→date, dedupe the aggregateagent:"all"rows (per-date, so mixed payloads never drop days), resolve per-day tools, recompute totals. Pure + unit-tested (22 cases incl. a real 97-day / 7-toolcc.json).total ≥ components(reasoning tokens), with a cost/token ratio guard ported from Convex as the real anti-inflation defense ("Token totals don't match. Please use official ccusage tool." #48).submissions.tools[]+daily_breakdowns.agents[](migration002), persisted on insert + both merge paths, mapped on read, filterable on the leaderboard ("All tools / Claude / Codex / …"). (Add codex / other supported tools from ccusage #45)/api/admin/flag(service-role) — the last browser anon-key write (same class as 401 Unauthorized when merging two submissions #42/Merge button does nothing & cc.json upload fails with RLS error — duplicate profile cannot be consolidated #47).periodinstead ofdate(Invalid date format: undefined) #50) is gone; Supabase-only.ccusage daily --json, broadened copy.Closes / addresses
Closes #49, #48, #45. Resolves the bug class behind #42/#47 (already deployed) and #50 (superseded — fix landed in the Supabase path). #43 documented as a known limitation. #39 to be declined; #46 to be rebased.
Apply
supabase/migrations/002_multi_tool.sqlto prod before this deploys. It's additive (new columns default to'{}'), safe to run ahead.Verification
pnpm test→ 22 passed (incl. real multi-toolcc.jsonthat the old code rejected)pnpm build→ green🤖 Generated with Claude Code