diff options
| author | Aiden Cline <[email protected]> | 2025-08-15 06:11:41 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-15 06:11:41 -0500 |
| commit | 8355ee2061a8f4f6f8e0450dfe4c6aa91b29ab90 (patch) | |
| tree | a37fdd8e50d5b90240bd005344dcfdca43b25883 | |
| parent | 62fed8d2ce3070f7e346752017f3d7d5167b1a4e (diff) | |
| download | opencode-8355ee2061a8f4f6f8e0450dfe4c6aa91b29ab90.tar.gz opencode-8355ee2061a8f4f6f8e0450dfe4c6aa91b29ab90.zip | |
fix: more permissive owner/repo detection (#1948)
| -rw-r--r-- | packages/opencode/src/cli/cmd/github.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts index a6f8917a3..7fcfc4ca8 100644 --- a/packages/opencode/src/cli/cmd/github.ts +++ b/packages/opencode/src/cli/cmd/github.ts @@ -188,13 +188,17 @@ export const GithubInstallCommand = cmd({ const info = await $`git remote get-url origin`.quiet().nothrow().text() // match https or git pattern // ie. https://github.com/sst/opencode.git + // ie. https://github.com/sst/opencode // ie. [email protected]:sst/opencode.git - const parsed = info.match(/git@github\.com:(.*)\.git/) ?? info.match(/github\.com\/(.*)\.git/) + // ie. [email protected]:sst/opencode + // ie. ssh://[email protected]/sst/opencode.git + // ie. ssh://[email protected]/sst/opencode + const parsed = info.match(/^(?:(?:https?|ssh):\/\/)?(?:git@)?github\.com[:/]([^/]+)\/([^/.]+?)(?:\.git)?$/) if (!parsed) { prompts.log.error(`Could not find git repository. Please run this command from a git repository.`) throw new UI.CancelledError() } - const [owner, repo] = parsed[1].split("/") + const [, owner, repo] = parsed return { owner, repo, root: app.path.root } } |
