Skip to content

chenxingqiang/repo-seo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

repo-seo

PyPI version Downloads License: MIT Python 3.9+ GitHub stars

πŸš€ AI-powered GitHub SEO - Boost your repository's discoverability using X Algorithm's Two-Tower recommendation system. Optimize topics, README, and descriptions with user behavior prediction.

Architecture

Inspired by the X Algorithm's recommendation pipeline, repo-seo uses a composable pipeline architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      SEO OPTIMIZATION PIPELINE                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                     β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚ Sources  │────▢│Hydrators │────▢│ Filters  │────▢│ Scorers  β”‚   β”‚
β”‚   β”‚          β”‚     β”‚          β”‚     β”‚          β”‚     β”‚          β”‚   β”‚
β”‚   β”‚ Local    β”‚     β”‚ README   β”‚     β”‚ Quality  β”‚     β”‚ README   β”‚   β”‚
β”‚   β”‚ GitHub   β”‚     β”‚ Language β”‚     β”‚ Dedup    β”‚     β”‚ Topic    β”‚   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚ Keywords β”‚     β”‚ Relevanceβ”‚     β”‚ SEO      β”‚   β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                             β”‚       β”‚
β”‚                                                             β–Ό       β”‚
β”‚                                                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚                                                      β”‚ Selector β”‚   β”‚
β”‚                                                      β”‚  Top-K   β”‚   β”‚
β”‚                                                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                             β”‚       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚β”€β”€β”€β”€β”€β”€β”€β”˜
                                                              β–Ό
                                                    Optimized Results

Features

  • Auto-Apply SEO: Directly update GitHub topics & description with repo-seo suggest --apply
  • Phoenix SEO: X Algorithm's Two-Tower + Multi-Action ranking for topic recommendations
  • Pipeline Architecture: Composable sources, hydrators, filters, scorers, selectors
  • Dynamic Trending Topics: Real-time GitHub trending keywords matching
  • README Analysis: Section ordering suggestions, keyword optimization
  • AI-Powered Analysis: OpenAI, Anthropic Claude, DeepSeek support
  • Multi-Signal Scoring: README quality, topic relevance, trending score
  • Rule-Based Fallback: Works without API keys

Installation

# Using uv (recommended - fastest)
uv pip install repo-seo

# Or run directly without installing
uvx repo-seo suggest

# Using pip
pip install repo-seo

# Install from source (for development)
git clone https://github.com/chenxingqiang/repo-seo.git
cd repo-seo
uv pip install -e ".[dev]"  # or: pip install -e ".[dev]"

Quick Start

Using the Pipeline (Recommended)

from repo_seo import (
    Pipeline, Query,
    LocalRepoSource,
    ReadmeHydrator,
    ReadmeScorer, TopicScorer,
    TopKSelector,
)
from repo_seo.pipeline import QualityFilter, DuplicateFilter

# Create optimization pipeline
pipeline = Pipeline(
    sources=[LocalRepoSource()],
    hydrators=[ReadmeHydrator()],
    pre_filters=[QualityFilter(), DuplicateFilter()],
    scorers=[ReadmeScorer(), TopicScorer()],
    selector=TopKSelector(k=10),
)

# Run optimization
query = Query(repo_path="./my-project", repo_name="my-project")
results = pipeline.run(query)

# Process results
for candidate in results:
    print(f"{candidate.type}: {candidate.id} (score: {candidate.final_score:.1f})")

Command Line

# SEO suggestions with README/topic analysis + auto-apply to GitHub
repo-seo suggest --top-k 10
repo-seo suggest --apply  # Actually update GitHub topics & description

# Phoenix SEO recommendations (X Algorithm style)
repo-seo phoenix --detailed

# Get trending topic suggestions
repo-seo trending --language python

# Analyze current repository
repo-seo analyze

# Optimize with AI
repo-seo optimize --repo-path . --provider openai

Auto-Apply SEO Changes

The suggest command analyzes your repo and can directly update GitHub:

# Preview suggestions
repo-seo suggest --top-k 8

# Apply changes to GitHub (updates topics + description)
repo-seo suggest --apply

Output:

πŸ“ README Optimization Suggestions:
  1. Add [installation]: Include installation instructions
  2. Add status badges (build, coverage, version, license)

🏷️ Topic Keywords (Priority Order):
  πŸ”₯ 1. api (score: 84 +20)        # +20 = content match boost
  πŸ”₯ 2. machine-learning (score: 82 +20)
  πŸ“Š 3. cli (score: 65)

πŸ“‹ Description Optimization:
  Current:   My project...
  Suggested: AI-powered tool for X. Built with Python. Features api support.

πŸš€ Applying Changes to GitHub
  βœ… Topics updated successfully!
  βœ… Description updated successfully!

Simple API

from repo_seo import RepoAnalyzer

repo_info = {
    "name": "my-project",
    "description": "A sample project",
    "languages": ["Python"],
    "topics": ["python", "cli"],
    "readme": "# My Project\n\nDescription here.",
}

analyzer = RepoAnalyzer(repo_info)
results = analyzer.analyze()
print(f"SEO Score: {results['score']}/100")

Phoenix SEO (X Algorithm Style)

Topic recommendation using X Algorithm's Two-Tower architecture with Multi-Action User Behavior Prediction:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     PHOENIX SEO PIPELINE                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚   β”‚  REPO TOWER     β”‚              β”‚  TRENDING TOWER         β”‚  β”‚
β”‚   β”‚  (Your Repo)    β”‚              β”‚  (GitHub LIVE)          β”‚  β”‚
β”‚   β”‚  README         β”‚   Dot        β”‚  Trending Repos Topics  β”‚  β”‚
β”‚   β”‚  Description    │─ Product ───▢│  Featured Topics        β”‚  β”‚
β”‚   β”‚  Languages      β”‚              β”‚  (Real-time from API)   β”‚  β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚            β”‚                                    β”‚               β”‚
β”‚            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β”‚                         β–Ό                                       β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚         MULTI-ACTION USER BEHAVIOR PREDICTION           β”‚   β”‚
β”‚   β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚   β”‚
β”‚   β”‚  β”‚ POSITIVE ACTIONS       β”‚ NEGATIVE ACTIONS           β”‚β”‚   β”‚
β”‚   β”‚  β”‚ ⭐ P(star)             β”‚ β›” P(ignore)                β”‚β”‚   β”‚
β”‚   β”‚  β”‚ 🍴 P(fork)             β”‚ 🚫 P(report)                β”‚β”‚   β”‚
β”‚   β”‚  β”‚ πŸ‘† P(click)            β”‚                            β”‚β”‚   β”‚
β”‚   β”‚  β”‚ πŸ‘οΈ P(watch)            β”‚                            β”‚β”‚   β”‚
β”‚   β”‚  β”‚ πŸ“₯ P(clone)            β”‚                            β”‚β”‚   β”‚
β”‚   β”‚  β”‚ 🀝 P(contribute)       β”‚                            β”‚β”‚   β”‚
β”‚   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚   β”‚
β”‚   β”‚  Final Score = Ξ£(weight Γ— P(positive)) - Ξ£(weight Γ— P(negative))β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
from repo_seo.pipeline import PhoenixSEO, phoenix_recommend

# Quick recommendation with user behavior prediction
recommendations = phoenix_recommend(
    readme=open("README.md").read(),
    languages=["Python"],
)

for rec in recommendations:
    print(f"{rec['topic']}: Score={rec['final_score']}")
    actions = rec['action_scores']
    print(f"  ⭐ P(star)={actions['star']}  🍴 P(fork)={actions['fork']}")
    print(f"  πŸ‘† P(click)={actions['click']}  πŸ‘οΈ P(watch)={actions['watch']}")
    print(f"  β›” P(ignore)={actions['ignore']}")

CLI with detailed predictions:

repo-seo phoenix --detailed

Trending Topics

Dynamic matching with GitHub's trending keywords:

from repo_seo.pipeline import TrendingTopicSuggester, get_trending_topics

# Get trending topics for Python
topics = get_trending_topics("python", max_topics=10)
print(topics)  # ['machine-learning', 'fastapi', 'langchain', ...]

# Get personalized suggestions for your repo
suggester = TrendingTopicSuggester()
suggestions = suggester.suggest(
    repo_path="./my-project",
    current_topics=["python", "cli"],
    languages=["Python"],
    readme_content=open("README.md").read(),
)

for s in suggestions:
    print(f"{s['topic']}: {s['combined_score']:.1f}")

Pipeline Components

Component Description
Source Fetches candidates (LocalRepoSource, GitHubTrendingSource)
Hydrator Enriches with features (ReadmeHydrator, TrendingHydrator)
Filter Removes invalid items (QualityFilter, DuplicateFilter)
Scorer Computes scores (ReadmeScorer, TopicScorer, TrendingScorer)
Selector Picks top candidates (TopKSelector, DiversitySelector)

Find Similar Excellent Repos

Learn from top GitHub repos (5000+ stars) to optimize your topics:

# Find repos similar to yours and get topic recommendations
repo-seo similar --top-k 10
Similar repos:
  1. donnemartin/system-design-primer  333,552⭐  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 0.5148
  2. huggingface/transformers          155,819⭐  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘ 0.4866

Recommended topics from similar repos:
  1. awesome (used by HelloGitHub, awesome-python)
  2. deep-learning (used by transformers, tensorflow)

Real-time Monitoring

Run a background daemon to track stars, forks, and downloads:

# Start background monitor (checks every 5 min)
repo-seo monitor --start --interval 300

# Check current metrics
repo-seo monitor

# Check monitor status
repo-seo monitor --status

# View history
repo-seo monitor --history

# Stop monitor
repo-seo monitor --stop

CLI Commands

Command Description
repo-seo suggest --apply Analyze & auto-apply SEO to GitHub
repo-seo phoenix --detailed User behavior prediction (star/fork/click)
repo-seo monitor --start Start background monitoring daemon
repo-seo mcp-server Start MCP server for AI assistants
repo-seo retrieval Two-Tower retrieval visualization
repo-seo similar Find similar excellent repos
repo-seo trending Get trending topic suggestions
repo-seo corpus Build repo embedding corpus

MCP Server (AI Assistant Integration)

Use repo-seo as an MCP server for AI assistants like Claude in Cursor:

1. Add to Cursor MCP config (~/.cursor/mcp.json):

{
  "mcpServers": {
    "repo-seo": {
      "command": "repo-seo",
      "args": ["mcp-server"]
    }
  }
}

2. Available MCP Tools:

Tool Description
repo_seo_suggest Get SEO optimization suggestions
repo_seo_phoenix Run Two-Tower + behavior prediction
repo_seo_trending Get trending topics
repo_seo_similar Find similar excellent repos
repo_seo_monitor Check metrics and monitoring
repo_seo_analyze Analyze README quality
repo_seo_set_api_key Set API key (OPENAI, ANTHROPIC, etc.)
repo_seo_get_config View current configuration
repo_seo_list_providers List LLM providers and status
repo_seo_delete_api_key Remove a stored API key
repo_seo_github_auth Check/set GitHub authentication

3. Or run standalone:

repo-seo mcp-server
# or
repo-seo-mcp

Configuration

# Set API keys (optional - works without them)
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...

Development

pip install -e ".[dev]"
pytest
ruff check repo_seo/

Contributing

Contributions welcome! Please read CONTRIBUTING.md first.

License

MIT License - see LICENSE for details.


⭐ Star this repo if it helps you!
https://github.com/chenxingqiang/repo-seo

About

πŸš€ AI-powered GitHub SEO: Boost repo discoverability with X Algorithm's Two-Tower recommendation. Topics, README optimization & user behavior prediction.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages