Skip to content

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Dec 30, 2025

Build a tool for retrieving Git repositories archived on softwareheritage.org

These APIs all support CORS

Given a URL to a GitHub repo, start with this GraphQL query to https://archive.softwareheritage.org/graphql/

query {
  origin(url: "https://github.com/uktrade/sqlite-s3vfs") {
    url
    latestSnapshot {
      swhid
    }
  }
}

This returns a swhid - then make a POST request like this to get back the download URL for that:

POST https://archive.softwareheritage.org/api/1/vault/git-bare/swh:1:snp:1930ecd7bcc8c8666c721c4def3944c98d650abf/

Which returns JSON like this:

{
  "fetch_url": "https://archive.softwareheritage.org/api/1/vault/git-bare/swh:1:snp:1930ecd7bcc8c8666c721c4def3944c98d650abf/raw/",
  "progress_message": null,
  "id": 417949633,
  "status": "done",
  "swhid": "swh:1:snp:1930ecd7bcc8c8666c721c4def3944c98d650abf"
}

Provide the user with a prominent Download which links to that URL. It redirects them to blob storage.

A single-page tool that allows users to download archived Git repositories from Software Heritage. Given a repository URL (e.g., GitHub), it queries the Software Heritage GraphQL API to get the SWHID, requests the archive from the vault API, and provides a prominent download link once ready.

Features:

  • GraphQL lookup for repository snapshots
  • Vault API integration with polling for archive preparation
  • URL fragment support for bookmarking/sharing
  • Responsive design with prominent download button
  • Error handling for missing repos and API failures

Claude Code transcript: https://gistpreview.github.io/?3a76a868095c989d159c226b7622b092/index.html

A single-page tool that allows users to download archived Git repositories
from Software Heritage. Given a repository URL (e.g., GitHub), it queries
the Software Heritage GraphQL API to get the SWHID, requests the archive
from the vault API, and provides a prominent download link once ready.

Features:
- GraphQL lookup for repository snapshots
- Vault API integration with polling for archive preparation
- URL fragment support for bookmarking/sharing
- Responsive design with prominent download button
- Error handling for missing repos and API failures
@claude
Copy link
Contributor

claude bot commented Dec 30, 2025

Claude Code is working…

I'll analyze this and get back to you.

View job run

@simonw simonw merged commit dc4748c into main Dec 30, 2025
1 of 4 checks passed
@simonw
Copy link
Owner Author

simonw commented Dec 30, 2025

CleanShot 2025-12-30 at 15 41 36@2x

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.

3 participants