Skip to content

feat(gamification): leaderboard gamification for fun - #53

Merged
zhravan merged 4 commits into
mainfrom
feat/add-gamification-leaderboard
Sep 17, 2025
Merged

feat(gamification): leaderboard gamification for fun#53
zhravan merged 4 commits into
mainfrom
feat/add-gamification-leaderboard

Conversation

@zhravan

@zhravan zhravan commented Sep 17, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added a publish command to share your progress via a pull request. Supports flags for repo, user, branch, and dry-run. Automatically creates a PR with GitHub CLI when available, or provides manual steps. Generates a progress snapshot and updates the leaderboard.
  • Documentation

    • Updated README: added a centered badge, new “At a glance” overview, usage examples for publish (including dry-run and user options), and a new Leaderboard section. Removed the old bottom badge and improved minor formatting.

@coderabbitai

coderabbitai Bot commented Sep 17, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new publish CLI command that generates a user progress snapshot, writes a JSON file under contrib/leaderboard/progress, updates the README leaderboard section, and automates creating a PR to an upstream repo (via gh when available). README gains usage/docs, badges updated, and a Leaderboard section is introduced.

Changes

Cohort / File(s) Summary of changes
Docs: README updates
README.md
Added centered badge block at top; introduced “At a glance” section; documented publish commands and options; inserted blank line after “Contributing”; removed bottom badge block; appended “Leaderboard” section between START_LEADERBOARD/END_LEADERBOARD markers with placeholder content.
CLI wiring for publish
internal/cli/cli.go
Registered new publish command; routed args to runPublish(args[1:]); expanded HelpText with usage, flags (--repo, --user, --branch, --dry-run) and env vars (GOLEARN_PUBLISH_REPO, GOLEARN_PUBLISH_USER); described command as publishing progress via PR.
Publish workflow and helpers
internal/cli/commands.go
Implemented runPublish flow: parse flags; build progress snapshot; dry-run print or proceed; temp-clone upstream, branch, write contrib/leaderboard/progress/.json; update README leaderboard; commit/push; create PR via gh or provide manual instructions; added helpers (parseRepoOwnerAndName, sanitizeForFile, buildProgressSnapshot, updateLeaderboardReadme, replaceBetweenMarkers, runCmd) and types (progressSnapshot, leaderRow).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as CLI (golearn)
  participant Pub as runPublish
  participant Git as Git (temp clone)
  participant GH as gh CLI
  participant Repo as Upstream Repo

  User->>CLI: golearn publish [--repo --user --branch --dry-run]
  CLI->>Pub: dispatch with args
  Pub->>Pub: parse flags, buildProgressSnapshot()
  alt --dry-run
    Pub-->>User: Print snapshot JSON and manual steps
  else publish
    Pub->>Git: git clone upstream into temp dir
    Pub->>Git: git checkout -b <branch>
    Pub->>Git: write contrib/leaderboard/progress/<user>.json
    Pub->>Git: update README between START/END_LEADERBOARD
    Pub->>Git: git add/commit/push (to fork or branch)
    alt gh available and authenticated
      Pub->>GH: gh pr create (base: upstream, head: user branch)
      GH->>Repo: Create PR
      GH-->>Pub: PR URL / status
      Pub-->>User: Report PR details
    else gh unavailable or unauthenticated
      Pub-->>User: Print manual PR instructions and pushed branch
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

A bunny taps keys with a publish-y cheer,
Snapshot in paw, to the leaderboard it steers.
Clones a fresh burrow, commits with delight,
Sends a PR hopping through GitHub’s night.
Dry-runs nibble safely, no changes to fear—
Progress blooms—thump-thump—your victory near! 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-gamification-leaderboard

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c1263b and d087aa5.

📒 Files selected for processing (3)
  • README.md (3 hunks)
  • internal/cli/cli.go (3 hunks)
  • internal/cli/commands.go (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zhravan
zhravan merged commit 6d0ba60 into main Sep 17, 2025
@zhravan
zhravan deleted the feat/add-gamification-leaderboard branch September 17, 2025 02:03
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.

1 participant