feat(web,ui): per-project forced git provider and settings gating
Adds a per-project forced provider (github|gitlab|gitea) on top of the per-project API base URL overrides: stored under gitProviders.provider in projects/<projectId>.json, sanitized server-side, and winning over remote-host detection both in useGitProvider and in server repo resolution (parseGitLabRemoteUrl/parseGiteaRemoteUrl accept any host when the provider is forced). The Projects settings page replaces the three always-visible URL fields with a provider selector (auto-detect + the three forges) and one URL override for the active provider. Global provider override fields on the GitHub/GitLab/Gitea settings tabs now render only once an account is connected, and Settings search availability matches that gating. Also fixes the useConfigStore/useDirectoryStore circular-import TDZ in the bundled chunk via the window-registered store handle and defers the directory subscription to a microtask; fixes the Gitea PR merge payload (Do carries the merge-style string enum, not a boolean + MergeMethod); and adds a documented Gitea client live-test harness (scripts/gitea-live-test.ts + client.d.ts).
This commit is contained in:
@@ -28,6 +28,8 @@ interface SettingsSearchAvailabilityContext extends SettingsRuntimeContext {
|
||||
isLinux: boolean;
|
||||
// Windows ARM64 — temporary workaround gate (see opencode#19130).
|
||||
isWindowsArm64: boolean;
|
||||
// Git provider override fields only render once an account is connected.
|
||||
gitProvidersConnected: { github: boolean; gitlab: boolean; gitea: boolean };
|
||||
}
|
||||
|
||||
const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
@@ -507,6 +509,7 @@ const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
titleKey: 'settings.github.page.apiBaseUrl.label',
|
||||
descriptionKey: 'settings.github.page.apiBaseUrl.description',
|
||||
keywords: ['github', 'api', 'base url', 'enterprise', 'self-hosted', 'server'],
|
||||
isAvailable: (ctx) => ctx.gitProvidersConnected.github,
|
||||
},
|
||||
{
|
||||
id: 'git.github-detect-urls',
|
||||
@@ -514,6 +517,7 @@ const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
titleKey: 'settings.github.page.detectUrls.label',
|
||||
descriptionKey: 'settings.github.page.detectUrls.description',
|
||||
keywords: ['github', 'detect', 'remote', 'host', 'domain', 'ssh', 'url', 'self-hosted'],
|
||||
isAvailable: (ctx) => ctx.gitProvidersConnected.github,
|
||||
},
|
||||
{
|
||||
id: 'git.gitlab-api-base-url',
|
||||
@@ -521,6 +525,7 @@ const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
titleKey: 'settings.gitlab.page.apiBaseUrl.label',
|
||||
descriptionKey: 'settings.gitlab.page.apiBaseUrl.description',
|
||||
keywords: ['gitlab', 'api', 'base url', 'self-hosted', 'server', 'instance'],
|
||||
isAvailable: (ctx) => ctx.gitProvidersConnected.gitlab,
|
||||
},
|
||||
{
|
||||
id: 'git.gitlab-detect-urls',
|
||||
@@ -528,6 +533,7 @@ const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
titleKey: 'settings.gitlab.page.detectUrls.label',
|
||||
descriptionKey: 'settings.gitlab.page.detectUrls.description',
|
||||
keywords: ['gitlab', 'detect', 'remote', 'host', 'domain', 'ssh', 'url', 'self-hosted'],
|
||||
isAvailable: (ctx) => ctx.gitProvidersConnected.gitlab,
|
||||
},
|
||||
{
|
||||
id: 'git.gitea-api-base-url',
|
||||
@@ -535,6 +541,7 @@ const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
titleKey: 'settings.gitea.page.apiBaseUrl.label',
|
||||
descriptionKey: 'settings.gitea.page.apiBaseUrl.description',
|
||||
keywords: ['gitea', 'forgejo', 'api', 'base url', 'self-hosted', 'server', 'instance'],
|
||||
isAvailable: (ctx) => ctx.gitProvidersConnected.gitea,
|
||||
},
|
||||
{
|
||||
id: 'git.gitea-detect-urls',
|
||||
@@ -542,6 +549,7 @@ const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
titleKey: 'settings.gitea.page.detectUrls.label',
|
||||
descriptionKey: 'settings.gitea.page.detectUrls.description',
|
||||
keywords: ['gitea', 'forgejo', 'detect', 'remote', 'host', 'domain', 'ssh', 'url', 'self-hosted'],
|
||||
isAvailable: (ctx) => ctx.gitProvidersConnected.gitea,
|
||||
},
|
||||
{
|
||||
id: 'git.identities',
|
||||
@@ -616,7 +624,14 @@ const SETTINGS_SEARCH_ITEMS: readonly SettingsSearchItem[] = [
|
||||
page: 'projects',
|
||||
titleKey: 'settings.projects.page.gitProviders.title',
|
||||
descriptionKey: 'settings.projects.page.gitProviders.description',
|
||||
keywords: ['github', 'gitlab', 'gitea', 'api base url', 'self-hosted', 'override', 'enterprise', 'server'],
|
||||
keywords: ['github', 'gitlab', 'gitea', 'api base url', 'self-hosted', 'override', 'enterprise', 'server', 'provider', 'forge'],
|
||||
},
|
||||
{
|
||||
id: 'projects.git-providers.provider',
|
||||
page: 'projects',
|
||||
titleKey: 'settings.projects.page.gitProviders.provider.label',
|
||||
descriptionKey: 'settings.projects.page.gitProviders.provider.description',
|
||||
keywords: ['github', 'gitlab', 'gitea', 'provider', 'forge', 'auto-detect', 'detection'],
|
||||
},
|
||||
{
|
||||
id: 'remote-instances.client-auth',
|
||||
|
||||
Reference in New Issue
Block a user