Update files
This commit is contained in:
@@ -75,14 +75,14 @@ describe("DaemonClientV2", () => {
|
||||
mock.triggerOpen();
|
||||
await connectPromise;
|
||||
|
||||
const p1 = client.getCheckoutStatus("agent-1");
|
||||
const p2 = client.getCheckoutStatus("agent-1");
|
||||
const p1 = client.getCheckoutStatus("/tmp/project");
|
||||
const p2 = client.getCheckoutStatus("/tmp/project");
|
||||
|
||||
expect(mock.sent).toHaveLength(1);
|
||||
|
||||
const request = JSON.parse(mock.sent[0]) as {
|
||||
type: "session";
|
||||
message: { type: "checkout_status_request"; agentId: string; requestId: string };
|
||||
message: { type: "checkout_status_request"; cwd: string; requestId: string };
|
||||
};
|
||||
|
||||
const response = {
|
||||
@@ -90,8 +90,7 @@ describe("DaemonClientV2", () => {
|
||||
message: {
|
||||
type: "checkout_status_response",
|
||||
payload: {
|
||||
agentId: "agent-1",
|
||||
cwd: "/tmp",
|
||||
cwd: "/tmp/project",
|
||||
error: null,
|
||||
requestId: request.message.requestId,
|
||||
isGit: false,
|
||||
@@ -109,16 +108,16 @@ describe("DaemonClientV2", () => {
|
||||
|
||||
mock.triggerMessage(JSON.stringify(response));
|
||||
const [r1, r2] = await Promise.all([p1, p2]);
|
||||
expect(r1).toMatchObject({ agentId: "agent-1", requestId: request.message.requestId, isGit: false });
|
||||
expect(r2).toMatchObject({ agentId: "agent-1", requestId: request.message.requestId, isGit: false });
|
||||
expect(r1).toMatchObject({ cwd: "/tmp/project", requestId: request.message.requestId, isGit: false });
|
||||
expect(r2).toMatchObject({ cwd: "/tmp/project", requestId: request.message.requestId, isGit: false });
|
||||
|
||||
// After completion, a new call should issue a new request.
|
||||
const p3 = client.getCheckoutStatus("agent-1");
|
||||
const p3 = client.getCheckoutStatus("/tmp/project");
|
||||
expect(mock.sent).toHaveLength(2);
|
||||
|
||||
const request2 = JSON.parse(mock.sent[1]) as {
|
||||
type: "session";
|
||||
message: { type: "checkout_status_request"; agentId: string; requestId: string };
|
||||
message: { type: "checkout_status_request"; cwd: string; requestId: string };
|
||||
};
|
||||
|
||||
mock.triggerMessage(
|
||||
|
||||
@@ -1130,14 +1130,13 @@ export class DaemonClientV2 {
|
||||
// ============================================================================
|
||||
|
||||
async getCheckoutStatus(
|
||||
agentId: string,
|
||||
options?: { cwd?: string; requestId?: string }
|
||||
cwd: string,
|
||||
options?: { requestId?: string }
|
||||
): Promise<CheckoutStatusPayload> {
|
||||
const requestId = options?.requestId;
|
||||
const cwd = options?.cwd;
|
||||
|
||||
if (!requestId) {
|
||||
const existing = this.checkoutStatusInFlight.get(agentId);
|
||||
const existing = this.checkoutStatusInFlight.get(cwd);
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
@@ -1146,7 +1145,6 @@ export class DaemonClientV2 {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_status_request",
|
||||
agentId,
|
||||
cwd,
|
||||
requestId: resolvedRequestId,
|
||||
});
|
||||
@@ -1170,10 +1168,10 @@ export class DaemonClientV2 {
|
||||
})();
|
||||
|
||||
if (!requestId) {
|
||||
this.checkoutStatusInFlight.set(agentId, responsePromise);
|
||||
this.checkoutStatusInFlight.set(cwd, responsePromise);
|
||||
responsePromise.finally(() => {
|
||||
if (this.checkoutStatusInFlight.get(agentId) === responsePromise) {
|
||||
this.checkoutStatusInFlight.delete(agentId);
|
||||
if (this.checkoutStatusInFlight.get(cwd) === responsePromise) {
|
||||
this.checkoutStatusInFlight.delete(cwd);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1182,14 +1180,14 @@ export class DaemonClientV2 {
|
||||
}
|
||||
|
||||
async getCheckoutDiff(
|
||||
agentId: string,
|
||||
cwd: string,
|
||||
compare: { mode: "uncommitted" | "base"; baseRef?: string },
|
||||
requestId?: string
|
||||
): Promise<CheckoutDiffPayload> {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_diff_request",
|
||||
agentId,
|
||||
cwd,
|
||||
compare,
|
||||
requestId: resolvedRequestId,
|
||||
});
|
||||
@@ -1211,14 +1209,14 @@ export class DaemonClientV2 {
|
||||
}
|
||||
|
||||
async checkoutCommit(
|
||||
agentId: string,
|
||||
cwd: string,
|
||||
input: { message?: string; addAll?: boolean },
|
||||
requestId?: string
|
||||
): Promise<CheckoutCommitPayload> {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_commit_request",
|
||||
agentId,
|
||||
cwd,
|
||||
message: input.message,
|
||||
addAll: input.addAll,
|
||||
requestId: resolvedRequestId,
|
||||
@@ -1241,14 +1239,14 @@ export class DaemonClientV2 {
|
||||
}
|
||||
|
||||
async checkoutMerge(
|
||||
agentId: string,
|
||||
cwd: string,
|
||||
input: { baseRef?: string; strategy?: "merge" | "squash"; requireCleanTarget?: boolean },
|
||||
requestId?: string
|
||||
): Promise<CheckoutMergePayload> {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_merge_request",
|
||||
agentId,
|
||||
cwd,
|
||||
baseRef: input.baseRef,
|
||||
strategy: input.strategy,
|
||||
requireCleanTarget: input.requireCleanTarget,
|
||||
@@ -1272,14 +1270,14 @@ export class DaemonClientV2 {
|
||||
}
|
||||
|
||||
async checkoutMergeFromBase(
|
||||
agentId: string,
|
||||
cwd: string,
|
||||
input: { baseRef?: string; requireCleanTarget?: boolean },
|
||||
requestId?: string
|
||||
): Promise<CheckoutMergeFromBasePayload> {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_merge_from_base_request",
|
||||
agentId,
|
||||
cwd,
|
||||
baseRef: input.baseRef,
|
||||
requireCleanTarget: input.requireCleanTarget,
|
||||
requestId: resolvedRequestId,
|
||||
@@ -1301,11 +1299,11 @@ export class DaemonClientV2 {
|
||||
return response;
|
||||
}
|
||||
|
||||
async checkoutPush(agentId: string, requestId?: string): Promise<CheckoutPushPayload> {
|
||||
async checkoutPush(cwd: string, requestId?: string): Promise<CheckoutPushPayload> {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_push_request",
|
||||
agentId,
|
||||
cwd,
|
||||
requestId: resolvedRequestId,
|
||||
});
|
||||
const response = this.waitFor(
|
||||
@@ -1326,14 +1324,14 @@ export class DaemonClientV2 {
|
||||
}
|
||||
|
||||
async checkoutPrCreate(
|
||||
agentId: string,
|
||||
cwd: string,
|
||||
input: { title?: string; body?: string; baseRef?: string },
|
||||
requestId?: string
|
||||
): Promise<CheckoutPrCreatePayload> {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_pr_create_request",
|
||||
agentId,
|
||||
cwd,
|
||||
title: input.title,
|
||||
body: input.body,
|
||||
baseRef: input.baseRef,
|
||||
@@ -1357,13 +1355,13 @@ export class DaemonClientV2 {
|
||||
}
|
||||
|
||||
async checkoutPrStatus(
|
||||
agentId: string,
|
||||
cwd: string,
|
||||
requestId?: string
|
||||
): Promise<CheckoutPrStatusPayload> {
|
||||
const resolvedRequestId = this.createRequestId(requestId);
|
||||
const message = SessionInboundMessageSchema.parse({
|
||||
type: "checkout_pr_status_request",
|
||||
agentId,
|
||||
cwd,
|
||||
requestId: resolvedRequestId,
|
||||
});
|
||||
const response = this.waitFor(
|
||||
|
||||
@@ -191,7 +191,7 @@ describe("daemon checkout ship loop", () => {
|
||||
});
|
||||
agentId = agent.id;
|
||||
|
||||
const status = await ctx.client.getCheckoutStatus(agent.id);
|
||||
const status = await ctx.client.getCheckoutStatus(worktree.worktreePath);
|
||||
expect(status.isGit).toBe(true);
|
||||
expect(status.isPaseoOwnedWorktree).toBe(true);
|
||||
expect(status.repoRoot).toContain(repoDir);
|
||||
@@ -207,13 +207,13 @@ describe("daemon checkout ship loop", () => {
|
||||
const renamePayload = getStructuredContent(renameResult);
|
||||
expect(renamePayload?.success).toBe(true);
|
||||
|
||||
const updatedStatus = await ctx.client.getCheckoutStatus(agent.id);
|
||||
const updatedStatus = await ctx.client.getCheckoutStatus(worktree.worktreePath);
|
||||
expect(updatedStatus.currentBranch).toBe("ship-loop-ready");
|
||||
|
||||
const readmePath = path.join(worktree.worktreePath, "README.md");
|
||||
writeFileSync(readmePath, "init\nship loop update\n");
|
||||
|
||||
const diffUncommitted = await ctx.client.getCheckoutDiff(agent.id, {
|
||||
const diffUncommitted = await ctx.client.getCheckoutDiff(worktree.worktreePath, {
|
||||
mode: "uncommitted",
|
||||
});
|
||||
expect(diffUncommitted.error).toBeNull();
|
||||
@@ -221,7 +221,7 @@ describe("daemon checkout ship loop", () => {
|
||||
|
||||
const timelineBeforeCommit =
|
||||
ctx.daemon.daemon.agentManager.getTimeline(agent.id).length;
|
||||
const commitResult = await ctx.client.checkoutCommit(agent.id, {
|
||||
const commitResult = await ctx.client.checkoutCommit(worktree.worktreePath, {
|
||||
addAll: true,
|
||||
});
|
||||
expect(commitResult.error).toBeNull();
|
||||
@@ -230,12 +230,12 @@ describe("daemon checkout ship loop", () => {
|
||||
ctx.daemon.daemon.agentManager.getTimeline(agent.id).length;
|
||||
expect(timelineAfterCommit).toBe(timelineBeforeCommit);
|
||||
|
||||
const diffAfterCommit = await ctx.client.getCheckoutDiff(agent.id, {
|
||||
const diffAfterCommit = await ctx.client.getCheckoutDiff(worktree.worktreePath, {
|
||||
mode: "uncommitted",
|
||||
});
|
||||
expect(diffAfterCommit.files.length).toBe(0);
|
||||
|
||||
const baseDiff = await ctx.client.getCheckoutDiff(agent.id, {
|
||||
const baseDiff = await ctx.client.getCheckoutDiff(worktree.worktreePath, {
|
||||
mode: "base",
|
||||
baseRef: "main",
|
||||
});
|
||||
@@ -243,7 +243,7 @@ describe("daemon checkout ship loop", () => {
|
||||
|
||||
const timelineBeforePr =
|
||||
ctx.daemon.daemon.agentManager.getTimeline(agent.id).length;
|
||||
const prCreate = await ctx.client.checkoutPrCreate(agent.id, {
|
||||
const prCreate = await ctx.client.checkoutPrCreate(worktree.worktreePath, {
|
||||
baseRef: "main",
|
||||
});
|
||||
expect(prCreate.error).toBeNull();
|
||||
@@ -252,12 +252,12 @@ describe("daemon checkout ship loop", () => {
|
||||
ctx.daemon.daemon.agentManager.getTimeline(agent.id).length;
|
||||
expect(timelineAfterPr).toBe(timelineBeforePr);
|
||||
|
||||
const prStatus = await ctx.client.checkoutPrStatus(agent.id);
|
||||
const prStatus = await ctx.client.checkoutPrStatus(worktree.worktreePath);
|
||||
expect(prStatus.error).toBeNull();
|
||||
expect(prStatus.status?.url).toContain(repoName);
|
||||
expect(prStatus.status?.state).toBeTruthy();
|
||||
|
||||
const mergeResult = await ctx.client.checkoutMerge(agent.id, {
|
||||
const mergeResult = await ctx.client.checkoutMerge(worktree.worktreePath, {
|
||||
baseRef: "main",
|
||||
strategy: "merge",
|
||||
requireCleanTarget: true,
|
||||
@@ -265,14 +265,14 @@ describe("daemon checkout ship loop", () => {
|
||||
expect(mergeResult.error).toBeNull();
|
||||
expect(mergeResult.success).toBe(true);
|
||||
|
||||
const statusAfterMerge = await ctx.client.getCheckoutStatus(agent.id);
|
||||
const statusAfterMerge = await ctx.client.getCheckoutStatus(worktree.worktreePath);
|
||||
expect(statusAfterMerge.isGit).toBe(true);
|
||||
if (statusAfterMerge.isGit) {
|
||||
expect(statusAfterMerge.baseRef).toBe("main");
|
||||
expect(statusAfterMerge.aheadBehind?.ahead ?? 0).toBe(0);
|
||||
}
|
||||
|
||||
const baseDiffAfterMerge = await ctx.client.getCheckoutDiff(agent.id, {
|
||||
const baseDiffAfterMerge = await ctx.client.getCheckoutDiff(worktree.worktreePath, {
|
||||
mode: "base",
|
||||
baseRef: "main",
|
||||
});
|
||||
@@ -353,7 +353,7 @@ describe("daemon checkout ship loop", () => {
|
||||
});
|
||||
agentId = agent.id;
|
||||
|
||||
const status = await ctx.client.getCheckoutStatus(agent.id);
|
||||
const status = await ctx.client.getCheckoutStatus(worktree.worktreePath);
|
||||
expect(status.isGit).toBe(true);
|
||||
if (status.isGit) {
|
||||
expect(status.hasRemote).toBe(true);
|
||||
@@ -374,14 +374,14 @@ describe("daemon checkout ship loop", () => {
|
||||
|
||||
// Add a commit on the agent branch.
|
||||
writeFileSync(path.join(worktree.worktreePath, "feature.txt"), "feature\n");
|
||||
const commitResult = await ctx.client.checkoutCommit(agent.id, {
|
||||
const commitResult = await ctx.client.checkoutCommit(worktree.worktreePath, {
|
||||
message: "feature commit",
|
||||
addAll: true,
|
||||
});
|
||||
expect(commitResult.error).toBeNull();
|
||||
expect(commitResult.success).toBe(true);
|
||||
|
||||
const mergeFromBase = await ctx.client.checkoutMergeFromBase(agent.id, {
|
||||
const mergeFromBase = await ctx.client.checkoutMergeFromBase(worktree.worktreePath, {
|
||||
baseRef: "main",
|
||||
requireCleanTarget: true,
|
||||
});
|
||||
@@ -394,7 +394,7 @@ describe("daemon checkout ship loop", () => {
|
||||
stdio: "pipe",
|
||||
});
|
||||
|
||||
const pushResult = await ctx.client.checkoutPush(agent.id);
|
||||
const pushResult = await ctx.client.checkoutPush(worktree.worktreePath);
|
||||
expect(pushResult.error).toBeNull();
|
||||
expect(pushResult.success).toBe(true);
|
||||
} finally {
|
||||
@@ -423,15 +423,15 @@ describe("daemon checkout ship loop", () => {
|
||||
});
|
||||
agentId = agent.id;
|
||||
|
||||
const status = await ctx.client.getCheckoutStatus(agent.id);
|
||||
const status = await ctx.client.getCheckoutStatus(worktree.worktreePath);
|
||||
expect(status.isGit).toBe(false);
|
||||
|
||||
const diff = await ctx.client.getCheckoutDiff(agent.id, {
|
||||
const diff = await ctx.client.getCheckoutDiff(worktree.worktreePath, {
|
||||
mode: "uncommitted",
|
||||
});
|
||||
expect(diff.error?.code).toBe("NOT_GIT_REPO");
|
||||
|
||||
const commit = await ctx.client.checkoutCommit(agent.id, {
|
||||
const commit = await ctx.client.checkoutCommit(worktree.worktreePath, {
|
||||
message: "Should fail",
|
||||
addAll: true,
|
||||
});
|
||||
|
||||
@@ -4,10 +4,10 @@ import { exec } from "child_process";
|
||||
import { promisify, inspect } from "util";
|
||||
import { join, resolve, sep } from "path";
|
||||
import invariant from "tiny-invariant";
|
||||
import { z } from "zod";
|
||||
import { streamText, stepCountIs } from "ai";
|
||||
import type { ToolSet } from "ai";
|
||||
import type { ModelMessage } from "@ai-sdk/provider-utils";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
createOpenRouter,
|
||||
OpenRouterProviderOptions,
|
||||
@@ -121,6 +121,12 @@ let restartRequested = false;
|
||||
const DEFAULT_AGENT_PROVIDER = AGENT_PROVIDER_IDS[0];
|
||||
const RESTART_EXIT_DELAY_MS = 250;
|
||||
|
||||
/**
|
||||
* Default model used for auto-generating commit messages and PR descriptions.
|
||||
* Uses Claude Haiku for speed and cost efficiency.
|
||||
*/
|
||||
const AUTO_GEN_MODEL = "haiku";
|
||||
|
||||
type ProcessingPhase = "idle" | "transcribing" | "llm";
|
||||
|
||||
type NormalizedGitOptions = {
|
||||
@@ -2357,18 +2363,8 @@ export class Session {
|
||||
return resolvedCandidate.startsWith(resolvedRoot + sep);
|
||||
}
|
||||
|
||||
private buildEphemeralAgentConfig(agent: ManagedAgent, title: string): AgentSessionConfig {
|
||||
return {
|
||||
...agent.config,
|
||||
cwd: agent.cwd,
|
||||
title,
|
||||
parentAgentId: agent.id,
|
||||
internal: true,
|
||||
};
|
||||
}
|
||||
|
||||
private async generateCommitMessage(agent: ManagedAgent): Promise<string> {
|
||||
const diff = await getCheckoutDiff(agent.cwd, { mode: "uncommitted" }, { paseoHome: this.paseoHome });
|
||||
private async generateCommitMessage(cwd: string): Promise<string> {
|
||||
const diff = await getCheckoutDiff(cwd, { mode: "uncommitted" }, { paseoHome: this.paseoHome });
|
||||
const schema = z.object({
|
||||
message: z
|
||||
.string()
|
||||
@@ -2385,7 +2381,13 @@ export class Session {
|
||||
try {
|
||||
const result = await generateStructuredAgentResponse({
|
||||
manager: this.agentManager,
|
||||
agentConfig: this.buildEphemeralAgentConfig(agent, "Commit generator"),
|
||||
agentConfig: {
|
||||
provider: "claude",
|
||||
model: AUTO_GEN_MODEL,
|
||||
cwd,
|
||||
title: "Commit generator",
|
||||
internal: true,
|
||||
},
|
||||
prompt,
|
||||
schema,
|
||||
schemaName: "CommitMessage",
|
||||
@@ -2400,12 +2402,12 @@ export class Session {
|
||||
}
|
||||
}
|
||||
|
||||
private async generatePullRequestText(agent: ManagedAgent, baseRef?: string): Promise<{
|
||||
private async generatePullRequestText(cwd: string, baseRef?: string): Promise<{
|
||||
title: string;
|
||||
body: string;
|
||||
}> {
|
||||
const diff = await getCheckoutDiff(
|
||||
agent.cwd,
|
||||
cwd,
|
||||
{
|
||||
mode: "base",
|
||||
baseRef,
|
||||
@@ -2425,7 +2427,13 @@ export class Session {
|
||||
try {
|
||||
return await generateStructuredAgentResponse({
|
||||
manager: this.agentManager,
|
||||
agentConfig: this.buildEphemeralAgentConfig(agent, "PR generator"),
|
||||
agentConfig: {
|
||||
provider: "claude",
|
||||
model: AUTO_GEN_MODEL,
|
||||
cwd,
|
||||
title: "PR generator",
|
||||
internal: true,
|
||||
},
|
||||
prompt,
|
||||
schema,
|
||||
schemaName: "PullRequest",
|
||||
@@ -2853,31 +2861,7 @@ export class Session {
|
||||
private async handleCheckoutStatusRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_status_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
// Use cwd from agent if found, otherwise fall back to cwd from message
|
||||
const cwd = agent?.cwd ?? msg.cwd;
|
||||
if (!cwd) {
|
||||
this.emit({
|
||||
type: "checkout_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd: "",
|
||||
isGit: false,
|
||||
repoRoot: null,
|
||||
currentBranch: null,
|
||||
isDirty: null,
|
||||
baseRef: null,
|
||||
aheadBehind: null,
|
||||
hasRemote: false,
|
||||
remoteUrl: null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
error: { code: "UNKNOWN", message: `Agent not found and no cwd provided: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
const status = await getCheckoutStatus(cwd, { paseoHome: this.paseoHome });
|
||||
@@ -2885,7 +2869,6 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
isGit: false,
|
||||
repoRoot: null,
|
||||
@@ -2893,6 +2876,7 @@ export class Session {
|
||||
isDirty: null,
|
||||
baseRef: null,
|
||||
aheadBehind: null,
|
||||
aheadOfOrigin: null,
|
||||
hasRemote: false,
|
||||
remoteUrl: null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
@@ -2907,7 +2891,6 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
isGit: true,
|
||||
repoRoot: status.repoRoot ?? null,
|
||||
@@ -2915,6 +2898,7 @@ export class Session {
|
||||
isDirty: status.isDirty ?? null,
|
||||
baseRef: status.baseRef,
|
||||
aheadBehind: status.aheadBehind ?? null,
|
||||
aheadOfOrigin: status.aheadOfOrigin ?? null,
|
||||
hasRemote: status.hasRemote,
|
||||
remoteUrl: status.remoteUrl,
|
||||
isPaseoOwnedWorktree: true,
|
||||
@@ -2928,7 +2912,6 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
isGit: true,
|
||||
repoRoot: status.repoRoot ?? null,
|
||||
@@ -2936,6 +2919,7 @@ export class Session {
|
||||
isDirty: status.isDirty ?? null,
|
||||
baseRef: status.baseRef ?? null,
|
||||
aheadBehind: status.aheadBehind ?? null,
|
||||
aheadOfOrigin: status.aheadOfOrigin ?? null,
|
||||
hasRemote: status.hasRemote,
|
||||
remoteUrl: status.remoteUrl,
|
||||
isPaseoOwnedWorktree: false,
|
||||
@@ -2947,7 +2931,6 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
isGit: false,
|
||||
repoRoot: null,
|
||||
@@ -2955,6 +2938,7 @@ export class Session {
|
||||
isDirty: null,
|
||||
baseRef: null,
|
||||
aheadBehind: null,
|
||||
aheadOfOrigin: null,
|
||||
hasRemote: false,
|
||||
remoteUrl: null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
@@ -2968,24 +2952,11 @@ export class Session {
|
||||
private async handleCheckoutDiffRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_diff_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId, compare } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
if (!agent) {
|
||||
this.emit({
|
||||
type: "checkout_diff_response",
|
||||
payload: {
|
||||
agentId,
|
||||
files: [],
|
||||
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId, compare } = msg;
|
||||
|
||||
try {
|
||||
const diffResult = await getCheckoutDiff(
|
||||
agent.cwd,
|
||||
cwd,
|
||||
{
|
||||
mode: compare.mode,
|
||||
baseRef: compare.baseRef,
|
||||
@@ -2996,7 +2967,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_diff_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
files: diffResult.structured ?? [],
|
||||
error: null,
|
||||
requestId,
|
||||
@@ -3006,7 +2977,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_diff_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
files: [],
|
||||
error: this.toCheckoutError(error),
|
||||
requestId,
|
||||
@@ -3018,31 +2989,18 @@ export class Session {
|
||||
private async handleCheckoutCommitRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_commit_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
if (!agent) {
|
||||
this.emit({
|
||||
type: "checkout_commit_response",
|
||||
payload: {
|
||||
agentId,
|
||||
success: false,
|
||||
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
let message = msg.message?.trim() ?? "";
|
||||
if (!message) {
|
||||
message = await this.generateCommitMessage(agent);
|
||||
message = await this.generateCommitMessage(cwd);
|
||||
}
|
||||
if (!message) {
|
||||
throw new Error("Commit message is required");
|
||||
}
|
||||
|
||||
await commitChanges(agent.cwd, {
|
||||
await commitChanges(cwd, {
|
||||
message,
|
||||
addAll: msg.addAll ?? true,
|
||||
});
|
||||
@@ -3050,7 +3008,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_commit_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: true,
|
||||
error: null,
|
||||
requestId,
|
||||
@@ -3060,7 +3018,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_commit_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: false,
|
||||
error: this.toCheckoutError(error),
|
||||
requestId,
|
||||
@@ -3072,29 +3030,14 @@ export class Session {
|
||||
private async handleCheckoutMergeRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_merge_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
if (!agent) {
|
||||
this.emit({
|
||||
type: "checkout_merge_response",
|
||||
payload: {
|
||||
agentId,
|
||||
success: false,
|
||||
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
const status = await getCheckoutStatus(agent.cwd, { paseoHome: this.paseoHome });
|
||||
const status = await getCheckoutStatus(cwd, { paseoHome: this.paseoHome });
|
||||
if (!status.isGit) {
|
||||
// `getCheckoutStatus` can return `isGit=false` in transient situations (e.g. cwd lookup
|
||||
// running during other git operations). Double-check with git directly before failing.
|
||||
try {
|
||||
await execAsync("git rev-parse --is-inside-work-tree", {
|
||||
cwd: agent.cwd,
|
||||
cwd,
|
||||
env: READ_ONLY_GIT_ENV,
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -3104,13 +3047,13 @@ export class Session {
|
||||
: error instanceof Error
|
||||
? error.message
|
||||
: String(error);
|
||||
throw new Error(`Not a git repository: ${agent.cwd}\n${details}`.trim());
|
||||
throw new Error(`Not a git repository: ${cwd}\n${details}`.trim());
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.requireCleanTarget) {
|
||||
const { stdout } = await execAsync("git status --porcelain", {
|
||||
cwd: agent.cwd,
|
||||
cwd,
|
||||
env: READ_ONLY_GIT_ENV,
|
||||
});
|
||||
if (stdout.trim().length > 0) {
|
||||
@@ -3127,7 +3070,7 @@ export class Session {
|
||||
}
|
||||
|
||||
await mergeToBase(
|
||||
agent.cwd,
|
||||
cwd,
|
||||
{
|
||||
baseRef,
|
||||
mode: msg.strategy === "squash" ? "squash" : "merge",
|
||||
@@ -3138,7 +3081,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_merge_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: true,
|
||||
error: null,
|
||||
requestId,
|
||||
@@ -3148,7 +3091,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_merge_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: false,
|
||||
error: this.toCheckoutError(error),
|
||||
requestId,
|
||||
@@ -3160,25 +3103,12 @@ export class Session {
|
||||
private async handleCheckoutMergeFromBaseRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_merge_from_base_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
if (!agent) {
|
||||
this.emit({
|
||||
type: "checkout_merge_from_base_response",
|
||||
payload: {
|
||||
agentId,
|
||||
success: false,
|
||||
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
if (msg.requireCleanTarget ?? true) {
|
||||
const { stdout } = await execAsync("git status --porcelain", {
|
||||
cwd: agent.cwd,
|
||||
cwd,
|
||||
env: READ_ONLY_GIT_ENV,
|
||||
});
|
||||
if (stdout.trim().length > 0) {
|
||||
@@ -3187,7 +3117,7 @@ export class Session {
|
||||
}
|
||||
|
||||
await mergeFromBase(
|
||||
agent.cwd,
|
||||
cwd,
|
||||
{
|
||||
baseRef: msg.baseRef,
|
||||
requireCleanTarget: msg.requireCleanTarget ?? true,
|
||||
@@ -3197,7 +3127,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_merge_from_base_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: true,
|
||||
error: null,
|
||||
requestId,
|
||||
@@ -3207,7 +3137,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_merge_from_base_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: false,
|
||||
error: this.toCheckoutError(error),
|
||||
requestId,
|
||||
@@ -3219,27 +3149,14 @@ export class Session {
|
||||
private async handleCheckoutPushRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_push_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
if (!agent) {
|
||||
this.emit({
|
||||
type: "checkout_push_response",
|
||||
payload: {
|
||||
agentId,
|
||||
success: false,
|
||||
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
await pushCurrentBranch(agent.cwd);
|
||||
await pushCurrentBranch(cwd);
|
||||
this.emit({
|
||||
type: "checkout_push_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: true,
|
||||
error: null,
|
||||
requestId,
|
||||
@@ -3249,7 +3166,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_push_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
success: false,
|
||||
error: this.toCheckoutError(error),
|
||||
requestId,
|
||||
@@ -3261,39 +3178,19 @@ export class Session {
|
||||
private async handleCheckoutPrCreateRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_pr_create_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
if (!agent) {
|
||||
this.emit({
|
||||
type: "checkout_pr_create_response",
|
||||
payload: {
|
||||
agentId,
|
||||
url: null,
|
||||
number: null,
|
||||
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
let title = msg.title?.trim() ?? "";
|
||||
let body = msg.body?.trim() ?? "";
|
||||
|
||||
if (!title || !body) {
|
||||
const generated = await this.generatePullRequestText(agent, msg.baseRef);
|
||||
if (!title) {
|
||||
title = generated.title;
|
||||
}
|
||||
if (!body) {
|
||||
body = generated.body;
|
||||
}
|
||||
}
|
||||
if (!title) {
|
||||
throw new Error("Pull request title is required");
|
||||
const generated = await this.generatePullRequestText(cwd, msg.baseRef);
|
||||
if (!title) title = generated.title;
|
||||
if (!body) body = generated.body;
|
||||
}
|
||||
|
||||
const result = await createPullRequest(agent.cwd, {
|
||||
const result = await createPullRequest(cwd, {
|
||||
title,
|
||||
body,
|
||||
base: msg.baseRef,
|
||||
@@ -3302,7 +3199,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_pr_create_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
url: result.url ?? null,
|
||||
number: result.number ?? null,
|
||||
error: null,
|
||||
@@ -3313,7 +3210,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_pr_create_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
url: null,
|
||||
number: null,
|
||||
error: this.toCheckoutError(error),
|
||||
@@ -3326,27 +3223,14 @@ export class Session {
|
||||
private async handleCheckoutPrStatusRequest(
|
||||
msg: Extract<SessionInboundMessage, { type: "checkout_pr_status_request" }>
|
||||
): Promise<void> {
|
||||
const { agentId, requestId } = msg;
|
||||
const agent = this.agentManager.getAgent(agentId);
|
||||
if (!agent) {
|
||||
this.emit({
|
||||
type: "checkout_pr_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
status: null,
|
||||
error: { code: "UNKNOWN", message: `Agent not found: ${agentId}` },
|
||||
requestId,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { cwd, requestId } = msg;
|
||||
|
||||
try {
|
||||
const status = await getPullRequestStatus(agent.cwd);
|
||||
const status = await getPullRequestStatus(cwd);
|
||||
this.emit({
|
||||
type: "checkout_pr_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
status,
|
||||
error: null,
|
||||
requestId,
|
||||
@@ -3356,7 +3240,7 @@ export class Session {
|
||||
this.emit({
|
||||
type: "checkout_pr_status_response",
|
||||
payload: {
|
||||
agentId,
|
||||
cwd,
|
||||
status: null,
|
||||
error: this.toCheckoutError(error),
|
||||
requestId,
|
||||
|
||||
@@ -476,22 +476,20 @@ const CheckoutDiffCompareSchema = z.object({
|
||||
|
||||
export const CheckoutStatusRequestSchema = z.object({
|
||||
type: z.literal("checkout_status_request"),
|
||||
agentId: z.string(),
|
||||
/** Optional cwd to use if the agent is not live in memory (e.g. from persisted agents.json) */
|
||||
cwd: z.string().optional(),
|
||||
cwd: z.string(),
|
||||
requestId: z.string(),
|
||||
});
|
||||
|
||||
export const CheckoutDiffRequestSchema = z.object({
|
||||
type: z.literal("checkout_diff_request"),
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
compare: CheckoutDiffCompareSchema,
|
||||
requestId: z.string(),
|
||||
});
|
||||
|
||||
export const CheckoutCommitRequestSchema = z.object({
|
||||
type: z.literal("checkout_commit_request"),
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
message: z.string().optional(),
|
||||
addAll: z.boolean().optional(),
|
||||
requestId: z.string(),
|
||||
@@ -499,7 +497,7 @@ export const CheckoutCommitRequestSchema = z.object({
|
||||
|
||||
export const CheckoutMergeRequestSchema = z.object({
|
||||
type: z.literal("checkout_merge_request"),
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
baseRef: z.string().optional(),
|
||||
strategy: z.enum(["merge", "squash"]).optional(),
|
||||
requireCleanTarget: z.boolean().optional(),
|
||||
@@ -508,7 +506,7 @@ export const CheckoutMergeRequestSchema = z.object({
|
||||
|
||||
export const CheckoutMergeFromBaseRequestSchema = z.object({
|
||||
type: z.literal("checkout_merge_from_base_request"),
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
baseRef: z.string().optional(),
|
||||
requireCleanTarget: z.boolean().optional(),
|
||||
requestId: z.string(),
|
||||
@@ -516,13 +514,13 @@ export const CheckoutMergeFromBaseRequestSchema = z.object({
|
||||
|
||||
export const CheckoutPushRequestSchema = z.object({
|
||||
type: z.literal("checkout_push_request"),
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
requestId: z.string(),
|
||||
});
|
||||
|
||||
export const CheckoutPrCreateRequestSchema = z.object({
|
||||
type: z.literal("checkout_pr_create_request"),
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
title: z.string().optional(),
|
||||
body: z.string().optional(),
|
||||
baseRef: z.string().optional(),
|
||||
@@ -531,7 +529,7 @@ export const CheckoutPrCreateRequestSchema = z.object({
|
||||
|
||||
export const CheckoutPrStatusRequestSchema = z.object({
|
||||
type: z.literal("checkout_pr_status_request"),
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
requestId: z.string(),
|
||||
});
|
||||
|
||||
@@ -1052,7 +1050,6 @@ const AheadBehindSchema = z.object({
|
||||
});
|
||||
|
||||
const CheckoutStatusCommonSchema = z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
requestId: z.string(),
|
||||
@@ -1066,6 +1063,7 @@ const CheckoutStatusNotGitSchema = CheckoutStatusCommonSchema.extend({
|
||||
isDirty: z.null(),
|
||||
baseRef: z.null(),
|
||||
aheadBehind: z.null(),
|
||||
aheadOfOrigin: z.null(),
|
||||
hasRemote: z.boolean(),
|
||||
remoteUrl: z.null(),
|
||||
});
|
||||
@@ -1078,6 +1076,7 @@ const CheckoutStatusGitNonPaseoSchema = CheckoutStatusCommonSchema.extend({
|
||||
isDirty: z.boolean(),
|
||||
baseRef: z.string().nullable(),
|
||||
aheadBehind: AheadBehindSchema.nullable(),
|
||||
aheadOfOrigin: z.number().nullable(),
|
||||
hasRemote: z.boolean(),
|
||||
remoteUrl: z.string().nullable(),
|
||||
});
|
||||
@@ -1090,6 +1089,7 @@ const CheckoutStatusGitPaseoSchema = CheckoutStatusCommonSchema.extend({
|
||||
isDirty: z.boolean(),
|
||||
baseRef: z.string(),
|
||||
aheadBehind: AheadBehindSchema.nullable(),
|
||||
aheadOfOrigin: z.number().nullable(),
|
||||
hasRemote: z.boolean(),
|
||||
remoteUrl: z.string().nullable(),
|
||||
});
|
||||
@@ -1106,7 +1106,7 @@ export const CheckoutStatusResponseSchema = z.object({
|
||||
export const CheckoutDiffResponseSchema = z.object({
|
||||
type: z.literal("checkout_diff_response"),
|
||||
payload: z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
files: z.array(ParsedDiffFileSchema),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
requestId: z.string(),
|
||||
@@ -1116,7 +1116,7 @@ export const CheckoutDiffResponseSchema = z.object({
|
||||
export const CheckoutCommitResponseSchema = z.object({
|
||||
type: z.literal("checkout_commit_response"),
|
||||
payload: z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
success: z.boolean(),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
requestId: z.string(),
|
||||
@@ -1126,7 +1126,7 @@ export const CheckoutCommitResponseSchema = z.object({
|
||||
export const CheckoutMergeResponseSchema = z.object({
|
||||
type: z.literal("checkout_merge_response"),
|
||||
payload: z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
success: z.boolean(),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
requestId: z.string(),
|
||||
@@ -1136,7 +1136,7 @@ export const CheckoutMergeResponseSchema = z.object({
|
||||
export const CheckoutMergeFromBaseResponseSchema = z.object({
|
||||
type: z.literal("checkout_merge_from_base_response"),
|
||||
payload: z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
success: z.boolean(),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
requestId: z.string(),
|
||||
@@ -1146,7 +1146,7 @@ export const CheckoutMergeFromBaseResponseSchema = z.object({
|
||||
export const CheckoutPushResponseSchema = z.object({
|
||||
type: z.literal("checkout_push_response"),
|
||||
payload: z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
success: z.boolean(),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
requestId: z.string(),
|
||||
@@ -1156,7 +1156,7 @@ export const CheckoutPushResponseSchema = z.object({
|
||||
export const CheckoutPrCreateResponseSchema = z.object({
|
||||
type: z.literal("checkout_pr_create_response"),
|
||||
payload: z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
url: z.string().nullable(),
|
||||
number: z.number().nullable(),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
@@ -1175,7 +1175,7 @@ const CheckoutPrStatusSchema = z.object({
|
||||
export const CheckoutPrStatusResponseSchema = z.object({
|
||||
type: z.literal("checkout_pr_status_response"),
|
||||
payload: z.object({
|
||||
agentId: z.string(),
|
||||
cwd: z.string(),
|
||||
status: CheckoutPrStatusSchema.nullable(),
|
||||
error: CheckoutErrorSchema.nullable(),
|
||||
requestId: z.string(),
|
||||
|
||||
@@ -70,6 +70,7 @@ export type CheckoutStatusGitNonPaseo = {
|
||||
isDirty: boolean;
|
||||
baseRef: string | null;
|
||||
aheadBehind: AheadBehind | null;
|
||||
aheadOfOrigin: number | null;
|
||||
hasRemote: boolean;
|
||||
remoteUrl: string | null;
|
||||
isPaseoOwnedWorktree: false;
|
||||
@@ -82,6 +83,7 @@ export type CheckoutStatusGitPaseo = {
|
||||
isDirty: boolean;
|
||||
baseRef: string;
|
||||
aheadBehind: AheadBehind | null;
|
||||
aheadOfOrigin: number | null;
|
||||
hasRemote: boolean;
|
||||
remoteUrl: string | null;
|
||||
isPaseoOwnedWorktree: true;
|
||||
@@ -393,6 +395,22 @@ async function getAheadBehind(cwd: string, baseRef: string, currentBranch: strin
|
||||
return { ahead, behind };
|
||||
}
|
||||
|
||||
async function getAheadOfOrigin(cwd: string, currentBranch: string): Promise<number | null> {
|
||||
if (!currentBranch) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const { stdout } = await execAsync(
|
||||
`git rev-list --count origin/${currentBranch}..${currentBranch}`,
|
||||
{ cwd, env: READ_ONLY_GIT_ENV }
|
||||
);
|
||||
const count = Number.parseInt(stdout.trim(), 10);
|
||||
return Number.isNaN(count) ? null : count;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function getUntrackedDiff(cwd: string): Promise<string> {
|
||||
let untrackedDiff = "";
|
||||
try {
|
||||
@@ -443,6 +461,8 @@ export async function getCheckoutStatus(
|
||||
const baseRef = configured.baseRef ?? (await resolveBaseRef(repoInfo.path));
|
||||
const aheadBehind =
|
||||
baseRef && currentBranch ? await getAheadBehind(cwd, baseRef, currentBranch) : null;
|
||||
const aheadOfOrigin =
|
||||
hasRemote && currentBranch ? await getAheadOfOrigin(cwd, currentBranch) : null;
|
||||
|
||||
if (configured.isPaseoOwnedWorktree) {
|
||||
return {
|
||||
@@ -452,6 +472,7 @@ export async function getCheckoutStatus(
|
||||
isDirty,
|
||||
baseRef: configured.baseRef,
|
||||
aheadBehind,
|
||||
aheadOfOrigin,
|
||||
hasRemote,
|
||||
remoteUrl,
|
||||
isPaseoOwnedWorktree: true,
|
||||
@@ -465,6 +486,7 @@ export async function getCheckoutStatus(
|
||||
isDirty,
|
||||
baseRef,
|
||||
aheadBehind,
|
||||
aheadOfOrigin,
|
||||
hasRemote,
|
||||
remoteUrl,
|
||||
isPaseoOwnedWorktree: false,
|
||||
|
||||
Reference in New Issue
Block a user