From fd7c443c8c71a76549f4edbeb085dc0fccca24bd Mon Sep 17 00:00:00 2001 From: Lince Mathew Date: Sat, 25 Apr 2026 15:09:31 +0530 Subject: [PATCH 1/2] feat: add support for GitHub Codespaces authentication flow LiveReview Pre-Commit Check: ran (iter:1, coverage:0%) --- README.md | 9 +++++++++ internal/appui/setup_flow.go | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/README.md b/README.md index 970ea6a..436c5ed 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,15 @@ curl -fsSL https://hexmos.com/lrc-install.sh | bash iwr -useb https://hexmos.com/lrc-install.ps1 | iex ``` +
+GitHub Codespaces + +```bash +curl -fsSL https://git.new/lrc-install | bash +``` + +
+ Binary installed. Hooks set up globally. Done. ### Setup diff --git a/internal/appui/setup_flow.go b/internal/appui/setup_flow.go index cbfc580..859dbe8 100644 --- a/internal/appui/setup_flow.go +++ b/internal/appui/setup_flow.go @@ -218,6 +218,16 @@ func backupExistingConfig(slog *setupLog) error { return nil } +// isCodespace returns the public HTTPS callback URL for GitHub Codespaces +func isCodespace(port int) (string, bool) { + name := os.Getenv("CODESPACE_NAME") + domain := os.Getenv("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN") + if name == "" || domain == "" { + return "", false + } + return fmt.Sprintf("https://%s-%d.%s/callback", name, port, domain), true +} + // runHexmosLoginFlow starts a temporary server, opens the browser for Hexmos Login, // waits for the callback, and provisions the user in LiveReview. func runHexmosLoginFlow(slog *setupLog, apiURL string) (*setupResult, error) { @@ -227,6 +237,9 @@ func runHexmosLoginFlow(slog *setupLog, apiURL string) (*setupResult, error) { } port := listener.Addr().(*net.TCPAddr).Port callbackURL := fmt.Sprintf("http://127.0.0.1:%d/callback", port) + if csURL, ok := isCodespace(port); ok { + callbackURL = csURL + } dataCh := make(chan *hexmosCallbackData, 1) errCh := make(chan error, 1) From c11838579084a6d5da9bb82d56ba11c06f364461 Mon Sep 17 00:00:00 2001 From: Lince Mathew Date: Sat, 25 Apr 2026 15:37:22 +0530 Subject: [PATCH 2/2] fix:codespace callback url LiveReview Pre-Commit Check: vouched (iter:1, coverage:0%) --- setup/login_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/login_server.go b/setup/login_server.go index 4687233..2130152 100644 --- a/setup/login_server.go +++ b/setup/login_server.go @@ -16,7 +16,7 @@ func BuildSigninURL(callbackURL string) (string, error) { if cbURL.Scheme != "http" && cbURL.Scheme != "https" { return "", fmt.Errorf("invalid callback url scheme: %s", cbURL.Scheme) } - if cbURL.Hostname() != "127.0.0.1" && cbURL.Hostname() != "localhost" { + if cbURL.Scheme == "http" && cbURL.Hostname() != "127.0.0.1" && cbURL.Hostname() != "localhost" { return "", fmt.Errorf("callback url must use localhost/127.0.0.1") }