Skip to main content

AI-powered GitHub repository SEO optimization using X Algorithm's recommendation pipeline

Project description

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 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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repo_seo-0.6.1.tar.gz (71.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repo_seo-0.6.1-py3-none-any.whl (79.2 kB view details)

Uploaded Python 3

File details

Details for the file repo_seo-0.6.1.tar.gz.

File metadata

  • Download URL: repo_seo-0.6.1.tar.gz
  • Upload date:
  • Size: 71.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for repo_seo-0.6.1.tar.gz
Algorithm Hash digest
SHA256 9cbd7cc3ce3b2db0b1bf5833248203ba49089b9f06d760f9d032d2b3c8c08887
MD5 a0f58b116ba61aac7b9083ff8395b45e
BLAKE2b-256 96154c910ec6fde1c92c763db7ec33406cfadf2931f4ce8d9708e8ad20353d0b

See more details on using hashes here.

File details

Details for the file repo_seo-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: repo_seo-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 79.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for repo_seo-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a28a8be373978cc946c33ac9b3965e3c247993e8ddc0dbe9ca0e12878640e28f
MD5 8a40af6c0eef9c15e8ffed8894960554
BLAKE2b-256 155178ba617ecbeb192c27aeb11ff26a9216acd75964d247562265d1502d467b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page