Skip to content

Auto-detect URLs and treat as --remote for CLI #1120

Description

@primeinc

Description

It's easy to forget --remote when running commands like:

repomix https://github.com/PowerShell/ConsoleGuiTools

Currently this errors out treating it as a local path. Auto-detecting remote URLs would be more intuitive.

Proposed implementation:

Based on my understanding of the codebase, we could add auto-detection in src/cli/cliRun.ts using the existing isValidRemoteValue() function from src/core/git/gitRemoteParse.ts.

Pseudocode:

if --remote flag is set:
    use runRemoteAction with the flag value
else if single directory argument provided:
    check if path exists locally
    if NOT local path AND isValidRemoteValue(argument):
        auto-detect as remote, use runRemoteAction
    else:
        treat as local directory
else:
    use runDefaultAction for multiple directories

Precedence would be:

  1. Explicit --remote flag (highest priority)
  2. Local path exists → use local
  3. Valid remote URL/shorthand → auto-detect and clone
  4. Otherwise → proceed with default local handling

This would allow intuitive commands like repomix owner/repo while respecting existing local folders with the same name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds discussionIssues needing discussion and a decision to be made before action can be taken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions