@devries-cameron20 / t3code-1 / commits / dc032d7c8f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

feat(web,mobile): Add project lists only GitHub until you turn other hosts on (#34978)

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>

Theo Browne committed Nov 12, 2026 at 00:33 UTC dc032d7c8f889612ccb7ebe081117bb0c15639ec
9 files changed +177 -36
apps/mobile/src/features/projects/AddProjectScreen.tsx
+31 -19
@@ -30,6 +30,7 @@ import {
30 parseAddProjectRemoteSource,
31 resolveAddProjectPath,
32 sortAddProjectProviderSources,
33 + type OfferedSourceControlProviders,
34 type AddProjectRemoteSource,
35 } from "@t3tools/client-runtime/operations/projects";
36 import {
@@ -118,6 +119,7 @@ interface EnvironmentOption {
119 readonly connectionError: string | null;
120 readonly connectionErrorTraceId: string | null;
121 readonly ghqCloneLayout: boolean;
122 + readonly offeredSourceControlProviders: OfferedSourceControlProviders | undefined;
123 }
124
125 const environmentOptionOrder = Order.mapInput(
@@ -413,6 +415,7 @@ function useEnvironmentOptions(
415 connectionError: runtime?.connectionError ?? null,
416 connectionErrorTraceId: runtime?.connectionErrorTraceId ?? null,
417 ghqCloneLayout: config?.settings.ghqCloneLayout === true,
418 + offeredSourceControlProviders: config?.settings.offeredSourceControlProviders,
419 };
420 });
421 return Arr.sort(
@@ -649,24 +652,30 @@ export function AddProjectSourceScreen(props: { readonly environmentId?: string
652 )
653 }
654 />
652 - {(["url", ...sortAddProjectProviderSources(readiness)] as AddProjectRemoteSource[]).map(
653 - (candidate) => (
654 - <SourceControlRow
655 - key={candidate}
656 - source={candidate}
657 - selectedEnvironmentId={selectedEnvironment.environmentId}
658 - ready={canCloneProject && readiness(candidate).ready}
659 - hint={
660 - !canCloneProject
661 - ? "This connection cannot clone projects."
662 - : readiness(candidate).ready
663 - ? addProjectRemoteSourcePathHint(candidate)
664 - : (readiness(candidate).hint ?? "")
665 - }
666 - isFirst={false}
667 - />
668 - ),
669 - )}
655 + {(
656 + [
657 + "url",
658 + ...sortAddProjectProviderSources(
659 + readiness,
660 + selectedEnvironment.offeredSourceControlProviders,
661 + ),
662 + ] as AddProjectRemoteSource[]
663 + ).map((candidate) => (
664 + <SourceControlRow
665 + key={candidate}
666 + source={candidate}
667 + selectedEnvironmentId={selectedEnvironment.environmentId}
668 + ready={canCloneProject && readiness(candidate).ready}
669 + hint={
670 + !canCloneProject
671 + ? "This connection cannot clone projects."
672 + : readiness(candidate).ready
673 + ? addProjectRemoteSourcePathHint(candidate)
674 + : (readiness(candidate).hint ?? "")
675 + }
676 + isFirst={false}
677 + />
678 + ))}
679 </ListSection>
680 {discoveryState.isPending ? (
681 <AppActivityIndicator colorClassName="accent-icon-muted" />
@@ -1055,7 +1064,10 @@ export function AddProjectNewScreen(props: { readonly environmentId?: string | s
1064 input: {},
1065 }),
1066 );
1058 - const publishTargets = getNewProjectPublishTargets(discoveryState.data);
1067 + const publishTargets = getNewProjectPublishTargets(
1068 + discoveryState.data,
1069 + environment?.offeredSourceControlProviders,
1070 + );
1071 const [name, setName] = useState("");
1072 const [publishes, setPublishes] = useState(false);
1073 const [publishKind, setPublishKind] = useState<SourceControlProviderKind | null>(null);
apps/mobile/src/features/settings/SettingsServerControlsRouteScreen.tsx
+27
@@ -43,6 +43,8 @@ import {
43 import { PullRequestGlyph } from "../pull-requests/pullRequestGlyphs";
44 import { AutoSettleSettingsRows } from "./ThreadSettingsSections";
45 import { supportsSharedSettingsSync } from "@t3tools/client-runtime/state/shared-settings";
46 +import { isSourceControlProviderOffered } from "@t3tools/client-runtime/operations/projects";
47 +import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
48
49 type SettingsPage = "threads" | "source-control" | "worktrees" | "maintenance";
50
@@ -406,6 +408,31 @@ function ServerSettingsDetail(props: { readonly page: SettingsPage }) {
408 canWrite={(environmentId) => writableEnvironments.has(environmentId)}
409 />
410 )}
411 + {projectSelected ? null : (
412 + <SettingsSection title="Project sources">
413 + {sourceControlClients.definitions.map((definition) => {
414 + const offered = displayTargets.map((target) =>
415 + isSourceControlProviderOffered(
416 + target.settings.offeredSourceControlProviders,
417 + definition.kind,
418 + ),
419 + );
420 + return (
421 + <SettingsSwitchRow
422 + key={definition.kind}
423 + label={definition.pickerLabel}
424 + value={
425 + offered.every((value) => value === offered[0]) ? offered[0]! : null
426 + }
427 + disabled={disabledFor("offeredSourceControlProviders")}
428 + onValueChange={(value) =>
429 + write({ offeredSourceControlProviders: { [definition.kind]: value } })
430 + }
431 + />
432 + );
433 + })}
434 + </SettingsSection>
435 + )}
436 <SettingsSection title="Pull requests">
437 <SettingsSwitchRow
438 icon={PullRequestGlyph.merged}
apps/web/src/components/CommandPalette.tsx
+11 -2
@@ -1017,6 +1017,10 @@ function OpenCommandPaletteDialog(props: {
1017 environments.find((environment) => environment.environmentId === environmentId)?.serverConfig
1018 ?.newProjectsRoot ?? null;
1019
1020 + const offeredProvidersFor = (environmentId: EnvironmentId | null) =>
1021 + environments.find((environment) => environment.environmentId === environmentId)?.serverConfig
1022 + ?.settings.offeredSourceControlProviders;
1023 +
1024 const startNewProject = (
1025 environmentId: EnvironmentId,
1026 sourcesEnvironmentId: EnvironmentId | null,
@@ -1073,7 +1077,7 @@ function OpenCommandPaletteDialog(props: {
1077
1078 const orderedSources: ReadonlyArray<AddProjectRemoteSource> = [
1079 "url",
1076 - ...sortAddProjectProviderSources(readinessBySource),
1080 + ...sortAddProjectProviderSources(readinessBySource, offeredProvidersFor(environmentId)),
1081 ];
1082
1083 for (const source of orderedSources) {
@@ -2001,7 +2005,12 @@ function OpenCommandPaletteDialog(props: {
2005 };
2006
2007 const newProjectPublishTargets =
2004 - newProjectFlow === null ? [] : getNewProjectPublishTargets(sourceControlDiscovery.data ?? null);
2008 + newProjectFlow === null
2009 + ? []
2010 + : getNewProjectPublishTargets(
2011 + sourceControlDiscovery.data ?? null,
2012 + offeredProvidersFor(newProjectFlow.environmentId),
2013 + );
2014 const newProjectPublishTarget = getNewProjectPublishTarget(
2015 newProjectPublishTargets,
2016 newProjectPublishKind,
apps/web/src/components/GitActionsControl.tsx
+21 -7
@@ -119,6 +119,10 @@ import {
119 THREAD_DETAILS_PANEL_SPLIT_SEPARATOR_CLASS,
120 } from "./chat/threadDetailsPanelStyles";
121 import { getSourceControlPresentation, sourceControlIcon } from "~/sourceControlPresentation";
122 +import {
123 + isSourceControlProviderOffered,
124 + type OfferedSourceControlProviders,
125 +} from "@t3tools/client-runtime/operations/projects";
126 import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
127 import { formatDiffCount } from "@t3tools/client-runtime/diff-count";
128 import { useOpenLink } from "~/browser/useOpenLink";
@@ -437,6 +441,7 @@ interface PublishRepositoryDialogProps {
441 readonly environmentId: ScopedThreadRef["environmentId"] | null;
442 readonly threadRef: ScopedThreadRef | null;
443 readonly gitCwd: string;
444 + readonly offeredProviders: OfferedSourceControlProviders | undefined;
445 }
446
447 function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
@@ -484,10 +489,13 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
489 );
490 const publishProviderReadiness = (provider: SourceControlProviderKind) =>
491 publishReadinessByProvider.get(provider) ?? { ready: false, hint: null };
487 - const hasReadyPublishProvider = PUBLISH_PROVIDER_OPTIONS.some(
492 + const offeredPublishProviderOptions = PUBLISH_PROVIDER_OPTIONS.filter((option) =>
493 + isSourceControlProviderOffered(props.offeredProviders, option.value),
494 + );
495 + const hasReadyPublishProvider = offeredPublishProviderOptions.some(
496 (option) => publishProviderReadiness(option.value).ready,
497 );
490 - const sortedPublishProviderOptions = PUBLISH_PROVIDER_OPTIONS.toSorted((left, right) => {
498 + const sortedPublishProviderOptions = offeredPublishProviderOptions.toSorted((left, right) => {
499 const leftReady = publishProviderReadiness(left.value).ready;
500 const rightReady = publishProviderReadiness(right.value).ready;
501 if (leftReady !== rightReady) {
@@ -498,12 +506,16 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
506 const firstReadyPublishProvider = sortedPublishProviderOptions.find(
507 (option) => publishProviderReadiness(option.value).ready,
508 )?.value;
501 - const publishProvider =
502 - selectedPublishProvider !== null && publishProviderReadiness(selectedPublishProvider).ready
509 + // The dialog stays mounted, so a host turned off after it was picked must not stay selected.
510 + const offeredSelection =
511 + selectedPublishProvider !== null &&
512 + isSourceControlProviderOffered(props.offeredProviders, selectedPublishProvider)
513 ? selectedPublishProvider
504 - : (firstReadyPublishProvider ??
505 - selectedPublishProvider ??
506 - sourceControlClients.get(undefined).kind);
514 + : null;
515 + const publishProvider =
516 + offeredSelection !== null && publishProviderReadiness(offeredSelection).ready
517 + ? offeredSelection
518 + : (firstReadyPublishProvider ?? offeredSelection ?? sourceControlClients.get(undefined).kind);
519 const selectedPublishProviderReadiness = publishProviderReadiness(publishProvider);
520 const publishAccount = publishAccountByProvider.get(publishProvider) ?? null;
521 const publishRepositoryPrefill = publishAccount ? `${publishAccount}/` : "";
@@ -530,6 +542,7 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
542 const publishRepositoryName = publishRepositoryParts.slice(1).join("/").trim();
543 const canSubmitPublishRepository =
544 publishRepositoryAction.isAllowed &&
545 + hasReadyPublishProvider &&
546 selectedPublishProviderReadiness.ready &&
547 !publishRepositoryAction.isPending &&
548 publishRepositoryOwner.length > 0 &&
@@ -1936,6 +1949,7 @@ export default function GitActionsControl({
1949 environmentId={activeEnvironmentId}
1950 threadRef={activeThreadRef}
1951 gitCwd={gitCwd}
1952 + offeredProviders={serverConfig?.settings.offeredSourceControlProviders}
1953 />
1954 ) : null}
1955
apps/web/src/components/settings/SourceControlSettings.tsx
+53 -6
@@ -1,5 +1,6 @@
1 import { RefreshIcon } from "~/components/ui/refresh-icon";
2 import { ChevronDownIcon } from "lucide-react";
3 +import { useAtomValue } from "@effect/atom-react";
4 import * as Option from "effect/Option";
5 import { useState, type ReactNode } from "react";
6 import type {
@@ -13,7 +14,9 @@ import { useSettingsScope } from "./SettingsScopeContext";
14 import { ProjectDefaultsSettings } from "./ProjectDefaultsSettings";
15 import { cn } from "../../lib/utils";
16 import { useEnvironmentQuery } from "../../state/query";
17 +import { serverEnvironment } from "../../state/server";
18 import { sourceControlEnvironment } from "../../state/sourceControl";
19 +import { useAtomCommand } from "../../state/use-atom-command";
20 import { Badge } from "../ui/badge";
21 import { Button } from "../ui/button";
22 import { Collapsible, CollapsibleContent } from "../ui/collapsible";
@@ -44,6 +47,7 @@ import {
47 } from "./settingsLayout";
48 import { searchableSetting, sourceControlHostSettingsSearchId } from "./settingsSearch";
49 import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons";
50 +import { isSourceControlProviderOffered } from "@t3tools/client-runtime/operations/projects";
51 import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
52 import { sourceControlIcon } from "~/sourceControlPresentation";
53
@@ -207,15 +211,19 @@ function itemSummary({
211
212 function DiscoveryItemRow({
213 item,
214 + offered,
215 children,
216 }: {
217 readonly item: VcsDiscoveryItem | SourceControlProviderDiscoveryItem;
218 + /** A provider's switch chooses whether the project pickers offer it; a VCS switch only reports. */
219 + readonly offered?: {
220 + readonly checked: boolean;
221 + readonly disabled: boolean;
222 + readonly onChange: (checked: boolean) => void;
223 + };
224 readonly children?: ReactNode;
225 }) {
226 const version = optionLabel(item.version);
216 - const enabled = isProviderDiscoveryItem(item)
217 - ? item.status === "available" && item.auth.status === "authenticated"
218 - : item.status === "available" && item.implemented;
227 const auth = isProviderDiscoveryItem(item) ? item.auth : null;
228 const authStatus = auth ? authPresentation(auth) : null;
229 const authAccount = auth ? optionLabel(auth.account) : null;
@@ -272,8 +280,26 @@ function DiscoveryItemRow({
280 />
281 </Button>
282 ) : null}
275 - {!isVcsNotReady(item) ? (
276 - <Switch checked={enabled} disabled aria-label={`${item.label} availability`} />
283 + {offered ? (
284 + <Tooltip>
285 + <TooltipTrigger
286 + render={
287 + <Switch
288 + checked={offered.checked}
289 + disabled={offered.disabled}
290 + onCheckedChange={offered.onChange}
291 + aria-label={`Offer ${item.label} when adding or publishing a project`}
292 + />
293 + }
294 + />
295 + <TooltipPopup side="top">Offer when adding or publishing a project</TooltipPopup>
296 + </Tooltip>
297 + ) : !isVcsNotReady(item) ? (
298 + <Switch
299 + checked={item.status === "available"}
300 + disabled
301 + aria-label={`${item.label} availability`}
302 + />
303 ) : null}
304 </div>
305 </div>
@@ -388,6 +414,13 @@ export function SourceControlSettingsPanel() {
414 const handleScan = () => {
415 discovery.refresh();
416 };
417 + const offeredProviders = environment?.serverConfig?.settings.offeredSourceControlProviders;
418 + const updateSettings = useAtomCommand(serverEnvironment.updateSettings, {
419 + label: "save source control providers",
420 + });
421 + const canUpdateSettings = useAtomValue(
422 + serverEnvironment.updateSettings.permissionAtom(environmentId),
423 + );
424 const hostSettingsPanel = (item: SourceControlProviderDiscoveryItem) => {
425 const definition = sourceControlClients.find(item.kind);
426 if (!definition?.settings || environmentId === null) return undefined;
@@ -506,7 +539,21 @@ export function SourceControlSettingsPanel() {
539 headerAction={hasVersionControlSystems ? null : scanButton}
540 >
541 {result.sourceControlProviders.map((item) => (
509 - <DiscoveryItemRow key={`provider:${item.kind}`} item={item}>
542 + <DiscoveryItemRow
543 + key={`provider:${item.kind}`}
544 + item={item}
545 + offered={{
546 + checked: isSourceControlProviderOffered(offeredProviders, item.kind),
547 + disabled: !canUpdateSettings,
548 + onChange: (checked) =>
549 + void updateSettings({
550 + environmentId,
551 + input: {
552 + patch: { offeredSourceControlProviders: { [item.kind]: checked } },
553 + },
554 + }),
555 + }}
556 + >
557 {hostSettingsPanel(item)}
558 </DiscoveryItemRow>
559 ))}
docs/user/source-control.md
+3 -1
@@ -155,7 +155,9 @@ publish it. If Git has no name or email on that machine, the project is created
155 first commit.
156
157 Use **Add Project** in the command palette (`Cmd/Ctrl+K`) to clone a repository. Choose a hosting
158 -provider or paste a Git URL, then choose where to save it. A branch or file page copied from GitHub,
158 +provider or paste a Git URL, then choose where to save it. Only GitHub is listed at first. To list
159 +another provider here and in **Publish Repository**, turn on its switch under
160 +**Settings → Source control**. A branch or file page copied from GitHub,
161 GitLab, GitCafe, Codeberg or Bitbucket also works: T3 Code clones that repository's default branch.
162 On other hosts, paste the repository's clone URL. The project opens right away while the
163 clone runs in the background: you can write your first prompt, and sending waits until the files
packages/client-runtime/src/operations/projects.test.ts
+9
@@ -12,10 +12,19 @@ import {
12 getDefaultCloneUrl,
13 githubIncompleteOwnerRepositoryMessage,
14 normalizePastedCloneUrl,
15 + sortAddProjectProviderSources,
16 } from "./projects.ts";
17 import type { EnvironmentProject } from "../state/models.ts";
18
19 describe("add project shared logic", () => {
20 + it("offers only GitHub until other hosts are turned on", () => {
21 + const ready = () => ({ ready: true, hint: null });
22 + expect(sortAddProjectProviderSources(ready, {})).toEqual(["github"]);
23 + expect(sortAddProjectProviderSources(ready, { gitlab: true, github: false })).toEqual([
24 + "gitlab",
25 + ]);
26 + });
27 +
28 it("asks for a repository name when GitHub input is only an owner path", () => {
29 const github = SourceControlProviderKind.make("github");
30 expect(githubIncompleteOwnerRepositoryMessage(github, "pingdotgg/")).toBe(
packages/client-runtime/src/operations/projects.ts
+17 -1
@@ -5,6 +5,7 @@ import type {
5 ProjectMutation,
6 ProjectId,
7 ServerConfig,
8 + ServerSettings,
9 SourceControlDiscoveryResult,
10 SourceControlRepositoryInfo,
11 } from "@t3tools/contracts";
@@ -141,11 +142,24 @@ export function getDefaultCloneUrl(
142 : repository.sshUrl;
143 }
144
145 +export type OfferedSourceControlProviders = ServerSettings["offeredSourceControlProviders"];
146 +
147 +/** Whether the project pickers offer a host. Only the default host is on until the user turns others on. */
148 +export function isSourceControlProviderOffered(
149 + offered: OfferedSourceControlProviders | undefined,
150 + kind: SourceControlProviderKind,
151 +): boolean {
152 + return offered?.[kind] ?? kind === sourceControlClients.get(undefined).kind;
153 +}
154 +
155 export function sortAddProjectProviderSources(
156 readiness: AddProjectRemoteSourceReadiness,
157 + offered: OfferedSourceControlProviders | undefined,
158 ): ReadonlyArray<SourceControlProviderKind> {
159 return Arr.sort(
148 - ADD_PROJECT_REMOTE_PROVIDER_SOURCES,
160 + ADD_PROJECT_REMOTE_PROVIDER_SOURCES.filter((source) =>
161 + isSourceControlProviderOffered(offered, source),
162 + ),
163 Order.mapInput(
164 Order.Struct({
165 ready: Order.flip(Order.Boolean),
@@ -253,9 +267,11 @@ export interface NewProjectPublishTarget {
267
268 export function getNewProjectPublishTargets(
269 discovery: SourceControlDiscoveryResult | null,
270 + offered: OfferedSourceControlProviders | undefined,
271 ): ReadonlyArray<NewProjectPublishTarget> {
272 const readiness = buildAddProjectRemoteSourceReadiness(discovery);
273 return sourceControlClients.definitions.flatMap((definition) => {
274 + if (!isSourceControlProviderOffered(offered, definition.kind)) return [];
275 if (!readiness(definition.kind).ready) return [];
276 const provider = discovery?.sourceControlProviders.find(
277 (candidate) => candidate.kind === definition.kind,
packages/contracts/src/settings.ts
+5
@@ -1548,6 +1548,10 @@ export const ServerSettings = Schema.Struct({
1548 sourceControlHosts: Schema.Record(Schema.String, SourceControlHostSettings).pipe(
1549 Schema.withDecodingDefault(Effect.succeed({})),
1550 ),
1551 + /** Hosts the add and publish project pickers offer, by kind. An unset host is off, except the default one. */
1552 + offeredSourceControlProviders: Schema.Record(Schema.String, Schema.Boolean).pipe(
1553 + Schema.withDecodingDefault(Effect.succeed({})),
1554 + ),
1555 // User-chosen ids preserve rows across edits; undecodable entries round-trip untouched.
1556 usageLimitSources: Schema.Record(UsageLimitSourceId, UsageLimitSourceConfig).pipe(
1557 Schema.withDecodingDefault(Effect.succeed({})),
@@ -1926,6 +1930,7 @@ export const ServerSettingsPatch = Schema.Struct({
1930 ),
1931 /** Merges per host, replacing patched fields whole; redaction markers retain secrets, empty secrets remove them. A non-empty token map keeps the saved tokens of hosts it omits; an empty map clears them all. */
1932 sourceControlHosts: Schema.optionalKey(Schema.Record(Schema.String, SourceControlHostSettings)),
1933 + offeredSourceControlProviders: Schema.optionalKey(Schema.Record(Schema.String, Schema.Boolean)),
1934 // Replace whole maps to avoid half-merged driver configs.
1935 providerInstances: Schema.optionalKey(Schema.Record(ProviderInstanceId, ProviderInstanceConfig)),
1936 // Merge per source to avoid racing other edits; null removes an entry.