Update files

This commit is contained in:
Mohamed Boudra
2026-01-25 08:42:00 +07:00
parent d4011408f7
commit 9d0dd8b19e
9 changed files with 946 additions and 102 deletions
+5
View File
@@ -2769,6 +2769,7 @@ export class Session {
baseRef: null,
aheadBehind: null,
hasRemote: false,
remoteUrl: null,
isPaseoOwnedWorktree: false,
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
requestId,
@@ -2792,6 +2793,7 @@ export class Session {
baseRef: null,
aheadBehind: null,
hasRemote: false,
remoteUrl: null,
isPaseoOwnedWorktree: false,
error: null,
requestId,
@@ -2813,6 +2815,7 @@ export class Session {
baseRef: status.baseRef,
aheadBehind: status.aheadBehind ?? null,
hasRemote: status.hasRemote,
remoteUrl: status.remoteUrl,
isPaseoOwnedWorktree: true,
error: null,
requestId,
@@ -2833,6 +2836,7 @@ export class Session {
baseRef: status.baseRef ?? null,
aheadBehind: status.aheadBehind ?? null,
hasRemote: status.hasRemote,
remoteUrl: status.remoteUrl,
isPaseoOwnedWorktree: false,
error: null,
requestId,
@@ -2851,6 +2855,7 @@ export class Session {
baseRef: null,
aheadBehind: null,
hasRemote: false,
remoteUrl: null,
isPaseoOwnedWorktree: false,
error: this.toCheckoutError(error),
requestId,
+3
View File
@@ -1056,6 +1056,7 @@ const CheckoutStatusNotGitSchema = CheckoutStatusCommonSchema.extend({
baseRef: z.null(),
aheadBehind: z.null(),
hasRemote: z.boolean(),
remoteUrl: z.null(),
});
const CheckoutStatusGitNonPaseoSchema = CheckoutStatusCommonSchema.extend({
@@ -1067,6 +1068,7 @@ const CheckoutStatusGitNonPaseoSchema = CheckoutStatusCommonSchema.extend({
baseRef: z.string().nullable(),
aheadBehind: AheadBehindSchema.nullable(),
hasRemote: z.boolean(),
remoteUrl: z.string().nullable(),
});
const CheckoutStatusGitPaseoSchema = CheckoutStatusCommonSchema.extend({
@@ -1078,6 +1080,7 @@ const CheckoutStatusGitPaseoSchema = CheckoutStatusCommonSchema.extend({
baseRef: z.string(),
aheadBehind: AheadBehindSchema.nullable(),
hasRemote: z.boolean(),
remoteUrl: z.string().nullable(),
});
export const CheckoutStatusResponseSchema = z.object({
+15 -4
View File
@@ -71,6 +71,7 @@ export type CheckoutStatusGitNonPaseo = {
baseRef: string | null;
aheadBehind: AheadBehind | null;
hasRemote: boolean;
remoteUrl: string | null;
isPaseoOwnedWorktree: false;
};
@@ -82,6 +83,7 @@ export type CheckoutStatusGitPaseo = {
baseRef: string;
aheadBehind: AheadBehind | null;
hasRemote: boolean;
remoteUrl: string | null;
isPaseoOwnedWorktree: true;
};
@@ -257,18 +259,24 @@ async function isWorkingTreeDirty(cwd: string, repoType: "bare" | "normal"): Pro
return stdout.trim().length > 0;
}
async function hasOriginRemote(cwd: string): Promise<boolean> {
async function getOriginRemoteUrl(cwd: string): Promise<string | null> {
try {
const { stdout } = await execAsync("git config --get remote.origin.url", {
cwd,
env: READ_ONLY_GIT_ENV,
});
return stdout.trim().length > 0;
const url = stdout.trim();
return url.length > 0 ? url : null;
} catch {
return false;
return null;
}
}
async function hasOriginRemote(cwd: string): Promise<boolean> {
const url = await getOriginRemoteUrl(cwd);
return url !== null;
}
async function resolveBaseRef(repoRoot: string): Promise<string | null> {
try {
const { stdout } = await execAsync("git symbolic-ref --quiet refs/remotes/origin/HEAD", {
@@ -429,7 +437,8 @@ export async function getCheckoutStatus(
const currentBranch = await getCurrentBranch(cwd);
const isDirty = await isWorkingTreeDirty(cwd, repoInfo.type);
const hasRemote = await hasOriginRemote(repoInfo.path);
const remoteUrl = await getOriginRemoteUrl(repoInfo.path);
const hasRemote = remoteUrl !== null;
const configured = await getConfiguredBaseRefForCwd(cwd, context);
const baseRef = configured.baseRef ?? (await resolveBaseRef(repoInfo.path));
const aheadBehind =
@@ -444,6 +453,7 @@ export async function getCheckoutStatus(
baseRef: configured.baseRef,
aheadBehind,
hasRemote,
remoteUrl,
isPaseoOwnedWorktree: true,
};
}
@@ -456,6 +466,7 @@ export async function getCheckoutStatus(
baseRef,
aheadBehind,
hasRemote,
remoteUrl,
isPaseoOwnedWorktree: false,
};
}