Scrape framework documentation from GitHub, chunk it, and index it in Pinecone for RAG workflows. This repo keeps a manifest of file hashes and chunk IDs so each sync only updates what changed.
GitHub repos
|
v
scripts/scrape.py -> docs/<framework>/*
|
v
scripts/sync.py (diff vs manifest.json)
| |
v v
[Weekly: open PR] [On merge: embed]
| |
v v
Human reviews PR scripts/embed_from_diff.py -> Pinecone
The sync is a two-phase process with a human review gate:
-
Weekly scrape (GitHub Action:
sync-docs.yml)- Scrapes docs from all configured repos
- Diffs against
manifest.jsonto find new/modified/deleted files - Creates a
sync/YYYY-MM-DDbranch with the changes - Opens a PR with a summary (per-framework breakdown, estimated chunks, file lists)
- Closes any previously open sync PR (keeps the branch for history)
- Tags:
synced/YYYY-MM-DD+latest-sync
-
Embed on merge (GitHub Action:
embed-on-merge.yml)- Triggers automatically when a
sync/*PR is merged to master - Compares old manifest (pre-merge) vs new manifest (post-merge)
- Embeds only the changed files to Pinecone
- Commits updated manifest with populated chunk IDs
- Tags:
embedded/YYYY-MM-DD+latest-embedded
- Triggers automatically when a
| Tag | Description |
|---|---|
synced/YYYY-MM-DD |
Permanent — marks each weekly scrape |
latest-sync |
Floating — most recent scrape |
embedded/YYYY-MM-DD |
Permanent — marks each successful embed |
latest-embedded |
Floating — most recent embed (what's in Pinecone) |
Useful commands:
# What's synced but not yet embedded?
git diff latest-embedded latest-sync -- docs/
# What changed between two embed cycles?
git diff embedded/2026-06-01 embedded/2026-06-08 -- docs/
# What's currently in Pinecone?
git show latest-embedded:manifest.jsonmanifest.json stores:
- per-file SHA256 hash (change detection)
- chunk IDs (for targeted deletions)
- last synced timestamp
- framework commit SHA
This is the state used to decide NEW / MODIFIED / DELETED / UNCHANGED.
Requirements:
- Python 3.10+
- Pinecone index (with integrated inference)
Install:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtSet env vars:
export PINECONE_API_KEY="..."
export PINECONE_INDEX_NAME="docs-rag"Edit config.yaml:
sources: GitHub repos + docs paths + extensionsembedding: chunk size/overlap + header split levelvector_db: Pinecone settings (namespace template optional)
Namespace template example:
vector_db:
namespace_template: "{framework}-docs"Scrape only (no embedding):
.venv/bin/python scripts/scrape.pyDry-run diff (no changes applied):
.venv/bin/python scripts/sync.py --dry-runSync + embed (all frameworks, local):
.venv/bin/python scripts/sync.py --embedSync + embed (single framework):
.venv/bin/python scripts/sync.py --embed -f reactGenerate a JSON summary of changes:
.venv/bin/python scripts/sync.py --dry-run --json-summary summary.jsonRuns every Sunday 2AM SGT. Creates a PR for review.
Manual trigger options:
force_resync— clears manifest, treats all files as newskip_pr— emergency bypass, embeds directly to Pinecone without PR
# Normal trigger
gh workflow run "Sync docs"
# Force re-sync (all files re-embedded after merge)
gh workflow run "Sync docs" -f force_resync=true
# Emergency: skip PR and embed directly
gh workflow run "Sync docs" -f skip_pr=trueTriggers automatically when a sync/* PR is merged. Can also be re-triggered manually:
gh workflow run "Embed on merge"PINECONE_API_KEYPINECONE_INDEX_NAME
Current chunker (see scripts/embed.py):
- Splits by markdown headings at
embedding.header_level(default##). - Chunks by character size (
embedding.chunk_size). - Fenced code blocks are kept intact (never split).
- Overlap is applied only between text-only chunks.
config.yaml
manifest.json
docs/
frameworks/
react/
vue/
angular/
languages/
javascript/
typescript/
scripts/
scrape.py # fetch docs from GitHub
sync.py # orchestrate scrape → diff → embed
embed.py # chunk + embed + upsert to Pinecone
embed_from_diff.py # embed based on manifest diff (used by CI)
pr_summary.py # generate PR body from sync summary
manifest.py # manifest read/write helpers
.github/workflows/
sync-docs.yml # weekly scrape + PR creation
embed-on-merge.yml # embed on PR merge