merge: resolve v1.21.1 conflicts with custom

Resolve all 10 upstream v1.21.1 merge conflicts into custom, keeping
custom's GitLab/Gitea forge customizations layered on upstream while
lifting upstream improvements. Restored tr.ts i18n key parity with the
custom en.ts dictionary (471 custom forge keys added, en fallback) so the
upstream-introduced locale stays in parity.

Also stage bun.lock version alignment (1.21.0 -> 1.21.1) that matches the
staged package.json bump.

Verification: ui + web type-check pass; ui/web tests pass except
pre-existing failures on the custom baseline (forge.test.ts, session-actions,
issue-1637-2270, routes.test.js fs-stat directory scope).
This commit is contained in:
2026-08-30 06:56:43 -04:00
200 changed files with 44728 additions and 370 deletions
@@ -237,6 +237,42 @@ const stripDerived = (source: Record<string, unknown>): Record<string, unknown>
return next;
};
const GIT_PROVIDER_KEYS = ['github', 'gitlab', 'gitea'];
// Light shape check for the `gitProviders` settings section coming from the
// webview: reject non-objects outright, coerce detectUrls to a string array and
// apiBaseUrl to a trimmed string, and drop empty provider entries. Keeps a
// malformed payload from landing on disk (the shared settings file).
const sanitizeGitProviders = (input: unknown): Record<string, unknown> | undefined => {
if (!input || typeof input !== 'object' || Array.isArray(input)) {
return undefined;
}
const source = input as Record<string, unknown>;
const result: Record<string, unknown> = {};
for (const key of GIT_PROVIDER_KEYS) {
const entry = source[key];
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
continue;
}
const record = entry as Record<string, unknown>;
const apiBaseUrl = typeof record.apiBaseUrl === 'string' ? record.apiBaseUrl.trim() : '';
const detectUrls = Array.isArray(record.detectUrls)
? record.detectUrls.filter((value): value is string => typeof value === 'string')
: [];
const provider: Record<string, unknown> = {};
if (apiBaseUrl) {
provider.apiBaseUrl = apiBaseUrl;
}
if (detectUrls.length > 0) {
provider.detectUrls = detectUrls;
}
if (Object.keys(provider).length > 0) {
result[key] = provider;
}
}
return Object.keys(result).length > 0 ? result : undefined;
};
let eagerMigrationAttempted = false;
// Read the merged persisted settings: shared file is canonical (synced with
@@ -329,6 +365,15 @@ export const persistSettings = async (changes: Record<string, unknown>, ctx?: Br
}
}
if ('gitProviders' in restChanges) {
const gitProviders = sanitizeGitProviders(restChanges.gitProviders);
if (gitProviders) {
restChanges.gitProviders = gitProviders;
} else {
delete restChanges.gitProviders;
}
}
if (typeof restChanges.opencodeBinary === 'string') {
restChanges.opencodeBinary = restChanges.opencodeBinary.trim();
}