forked from pingdotgg/t3code
-
Notifications
You must be signed in to change notification settings - Fork 0
chore: sync upstream fixes (SSH, sidebar, menu copy, CI, drag) #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
93dcc7a
fix(desktop): backfill SSH_AUTH_SOCK from login shell on macOS (#972)
stickerdaniel 4393981
Add copy workspace path button to thread action menu (#1128)
jamesx0416 c69fdba
fix(web): restore pointer cursors for sidebar actions (#894)
binbandit 0b688ce
fix: fix menu copy (#1063)
UtkarshUsername 1273fee
Use GitHub App token when checking out main in release workflow (#1175)
juliusmarminge b320b12
fix(web): fix sidebar project drag clipping with variable-height item…
GuilhermeVieiraDev 68a54a0
fix: treat blank SHELL env as missing before login shell probe
aaditagrawal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { describe, expect, it, vi } from "vitest"; | ||
|
|
||
| import { syncShellEnvironment } from "./syncShellEnvironment"; | ||
|
|
||
| describe("syncShellEnvironment", () => { | ||
| it("hydrates PATH and missing SSH_AUTH_SOCK from the login shell on macOS", () => { | ||
| const env: NodeJS.ProcessEnv = { | ||
| SHELL: "/bin/zsh", | ||
| PATH: "/usr/bin", | ||
| }; | ||
| const readEnvironment = vi.fn(() => ({ | ||
| PATH: "/opt/homebrew/bin:/usr/bin", | ||
| SSH_AUTH_SOCK: "/tmp/secretive.sock", | ||
| })); | ||
|
|
||
| syncShellEnvironment(env, { | ||
| platform: "darwin", | ||
| readEnvironment, | ||
| }); | ||
|
|
||
| expect(readEnvironment).toHaveBeenCalledWith("/bin/zsh", ["PATH", "SSH_AUTH_SOCK"]); | ||
| expect(env.PATH).toBe("/opt/homebrew/bin:/usr/bin"); | ||
| expect(env.SSH_AUTH_SOCK).toBe("/tmp/secretive.sock"); | ||
| }); | ||
|
|
||
| it("preserves an inherited SSH_AUTH_SOCK value", () => { | ||
| const env: NodeJS.ProcessEnv = { | ||
| SHELL: "/bin/zsh", | ||
| PATH: "/usr/bin", | ||
| SSH_AUTH_SOCK: "/tmp/inherited.sock", | ||
| }; | ||
| const readEnvironment = vi.fn(() => ({ | ||
| PATH: "/opt/homebrew/bin:/usr/bin", | ||
| SSH_AUTH_SOCK: "/tmp/login-shell.sock", | ||
| })); | ||
|
|
||
| syncShellEnvironment(env, { | ||
| platform: "darwin", | ||
| readEnvironment, | ||
| }); | ||
|
|
||
| expect(env.PATH).toBe("/opt/homebrew/bin:/usr/bin"); | ||
| expect(env.SSH_AUTH_SOCK).toBe("/tmp/inherited.sock"); | ||
| }); | ||
|
|
||
| it("preserves inherited values when the login shell omits them", () => { | ||
| const env: NodeJS.ProcessEnv = { | ||
| SHELL: "/bin/zsh", | ||
| PATH: "/usr/bin", | ||
| SSH_AUTH_SOCK: "/tmp/inherited.sock", | ||
| }; | ||
| const readEnvironment = vi.fn(() => ({ | ||
| PATH: "/opt/homebrew/bin:/usr/bin", | ||
| })); | ||
|
|
||
| syncShellEnvironment(env, { | ||
| platform: "darwin", | ||
| readEnvironment, | ||
| }); | ||
|
|
||
| expect(env.PATH).toBe("/opt/homebrew/bin:/usr/bin"); | ||
| expect(env.SSH_AUTH_SOCK).toBe("/tmp/inherited.sock"); | ||
| }); | ||
|
|
||
| it("does nothing outside macOS", () => { | ||
| const env: NodeJS.ProcessEnv = { | ||
| SHELL: "/bin/zsh", | ||
| PATH: "/usr/bin", | ||
| SSH_AUTH_SOCK: "/tmp/inherited.sock", | ||
| }; | ||
| const readEnvironment = vi.fn(() => ({ | ||
| PATH: "/opt/homebrew/bin:/usr/bin", | ||
| SSH_AUTH_SOCK: "/tmp/secretive.sock", | ||
| })); | ||
|
|
||
| syncShellEnvironment(env, { | ||
| platform: "linux", | ||
| readEnvironment, | ||
| }); | ||
|
|
||
| expect(readEnvironment).not.toHaveBeenCalled(); | ||
| expect(env.PATH).toBe("/usr/bin"); | ||
| expect(env.SSH_AUTH_SOCK).toBe("/tmp/inherited.sock"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { readEnvironmentFromLoginShell, ShellEnvironmentReader } from "@t3tools/shared/shell"; | ||
|
|
||
| export function syncShellEnvironment( | ||
| env: NodeJS.ProcessEnv = process.env, | ||
| options: { | ||
| platform?: NodeJS.Platform; | ||
| readEnvironment?: ShellEnvironmentReader; | ||
| } = {}, | ||
| ): void { | ||
| if ((options.platform ?? process.platform) !== "darwin") return; | ||
|
|
||
| try { | ||
| const shell = env.SHELL ?? "/bin/zsh"; | ||
| const shellEnvironment = (options.readEnvironment ?? readEnvironmentFromLoginShell)(shell, [ | ||
| "PATH", | ||
| "SSH_AUTH_SOCK", | ||
| ]); | ||
|
|
||
| if (shellEnvironment.PATH) { | ||
| env.PATH = shellEnvironment.PATH; | ||
| } | ||
|
|
||
| if (!env.SSH_AUTH_SOCK && shellEnvironment.SSH_AUTH_SOCK) { | ||
| env.SSH_AUTH_SOCK = shellEnvironment.SSH_AUTH_SOCK; | ||
| } | ||
| } catch { | ||
| // Keep inherited environment if shell lookup fails. | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { renderToStaticMarkup } from "react-dom/server"; | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { | ||
| SidebarMenuAction, | ||
| SidebarMenuButton, | ||
| SidebarMenuSubButton, | ||
| SidebarProvider, | ||
| } from "./sidebar"; | ||
|
|
||
| function renderSidebarButton(className?: string) { | ||
| return renderToStaticMarkup( | ||
| <SidebarProvider> | ||
| <SidebarMenuButton className={className}>Projects</SidebarMenuButton> | ||
| </SidebarProvider>, | ||
| ); | ||
| } | ||
|
|
||
| describe("sidebar interactive cursors", () => { | ||
| it("uses a pointer cursor for menu buttons by default", () => { | ||
| const html = renderSidebarButton(); | ||
|
|
||
| expect(html).toContain('data-slot="sidebar-menu-button"'); | ||
| expect(html).toContain("cursor-pointer"); | ||
| }); | ||
|
|
||
| it("lets project drag handles override the default pointer cursor", () => { | ||
| const html = renderSidebarButton("cursor-grab"); | ||
|
|
||
| expect(html).toContain("cursor-grab"); | ||
| expect(html).not.toContain("cursor-pointer"); | ||
| }); | ||
|
|
||
| it("uses a pointer cursor for menu actions", () => { | ||
| const html = renderToStaticMarkup( | ||
| <SidebarMenuAction aria-label="Create thread"> | ||
| <span>+</span> | ||
| </SidebarMenuAction>, | ||
| ); | ||
|
|
||
| expect(html).toContain('data-slot="sidebar-menu-action"'); | ||
| expect(html).toContain("cursor-pointer"); | ||
| }); | ||
|
|
||
| it("uses a pointer cursor for submenu buttons", () => { | ||
| const html = renderToStaticMarkup( | ||
| <SidebarMenuSubButton render={<button type="button" />}>Show more</SidebarMenuSubButton>, | ||
| ); | ||
|
|
||
| expect(html).toContain('data-slot="sidebar-menu-sub-button"'); | ||
| expect(html).toContain("cursor-pointer"); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.