Skip to content

viberank v2 — multi-tool support (Claude Code, Codex, Gemini & more)#51

Merged
nikshepsvn merged 10 commits into
mainfrom
feat/multi-tool-support
Jun 9, 2026
Merged

viberank v2 — multi-tool support (Claude Code, Codex, Gemini & more)#51
nikshepsvn merged 10 commits into
mainfrom
feat/multi-tool-support

Conversation

@nikshepsvn

Copy link
Copy Markdown
Contributor

viberank v2 — multi-tool support

viberank started as a Claude Code leaderboard. As ccusage v20 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

ccusage v20's default daily --json keys daily rows by period (not date) and adds agent/metadata.agents. The submit path read day.dateundefinedevery submission failed with Invalid date format: undefined (#49). Reasoning/thinking tokens also inflate totalTokens past the four components, tripping the strict token-sum check (#48). Both are fixed.

What's in it

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.

⚠️ Deploy ordering

Apply supabase/migrations/002_multi_tool.sql to prod before this deploys. It's additive (new columns default to '{}'), safe to run ahead.

Verification

  • pnpm test → 22 passed (incl. real multi-tool cc.json that the old code rejected)
  • pnpm build → green
  • Full pre-merge audit pass; findings fixed in-branch.

🤖 Generated with Claude Code

nikshepsvn and others added 8 commits June 9, 2026 17:43
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>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
viberank Ready Ready Preview, Comment Jun 9, 2026 12:50pm

Request Review

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>
@nikshepsvn nikshepsvn merged commit 9c58f81 into main Jun 9, 2026
2 checks passed
@nikshepsvn nikshepsvn deleted the feat/multi-tool-support branch June 9, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

submit mutation rejects current ccusage output: daily entries now use period instead of date (Invalid date format: undefined)

1 participant