Skip to content

Support repository URLs in --repo option#67

Merged
simonw merged 2 commits intomainfrom
claude/repo-url-support-Nwd5j
Dec 21, 2025
Merged

Support repository URLs in --repo option#67
simonw merged 2 commits intomainfrom
claude/repo-url-support-Nwd5j

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Dec 21, 2025

The --repo option now accepts URLs in addition to local paths:

When a URL is provided, the repository is cloned to a temporary directory and the filepath argument is treated as relative to the repo root.

This makes it easier to analyze remote repositories without having to manually clone them first.

Changes:

  • Added is_repo_url() and clone_repo_url() functions to cli.py
  • Modified --repo option to accept any string (not just existing paths)
  • Added validation for file existence after URL handling
  • Added tests using a vendored git HTTP server script
  • Updated README with examples of using remote URLs

Add a feature where the --repo option can be a URL e.g. https://github.com/simonw/scrape-hacker-news-by-domain or even a git@ reference like git@github.com:simonw/scrape-hacker-news-by-domain

Cover this new feature in the automated tests. Have them actually run a localhost git http server using a vendored copy of this script (stick it in the tests/ folder, run it using subprocess and sys.executable ) https://raw.githubusercontent.com/simonw/tools/refs/heads/main/python/git_read_only_http.py -

Update the help output and README too, make sure the tests pass using: uv run --with-editable '.[test]' pytest

Use TDD - write a test, watch it fail, then fix it in the implementation

claude and others added 2 commits December 21, 2025 18:12
The --repo option now accepts URLs in addition to local paths:
- HTTP/HTTPS URLs (e.g. https://github.com/user/repo)
- git@ SSH URLs (e.g. git@github.com:user/repo)

When a URL is provided, the repository is cloned to a temporary
directory and the filepath argument is treated as relative to the
repo root.

This makes it easier to analyze remote repositories without
having to manually clone them first.

Changes:
- Added is_repo_url() and clone_repo_url() functions to cli.py
- Modified --repo option to accept any string (not just existing paths)
- Added validation for file existence after URL handling
- Added tests using a vendored git HTTP server script
- Updated README with examples of using remote URLs
@simonw
Copy link
Owner Author

simonw commented Dec 21, 2025

Manually tested it like this:

uv run --with-editable '.[test]' git-history file data.db simonwillison-net.json --id id \
  --repo https://github.com/simonw/scrape-hacker-news-by-domain

@simonw simonw merged commit b74effd into main Dec 21, 2025
10 checks passed
@simonw simonw deleted the claude/repo-url-support-Nwd5j branch December 21, 2025 18:29
simonw added a commit that referenced this pull request Dec 21, 2025
simonw added a commit that referenced this pull request Dec 21, 2025
simonw added a commit to simonw/scrape-hacker-news-by-domain that referenced this pull request Dec 21, 2025
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.

2 participants