mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-19 22:53:08 +00:00
feat: Add git log parsing and rebase endpoint with input validation
This commit is contained in:
@@ -2259,15 +2259,23 @@ function createMockWorktreeAPI(): WorktreeAPI {
|
||||
};
|
||||
},
|
||||
|
||||
pull: async (worktreePath: string, remote?: string) => {
|
||||
pull: async (worktreePath: string, remote?: string, stashIfNeeded?: boolean) => {
|
||||
const targetRemote = remote || 'origin';
|
||||
console.log('[Mock] Pulling latest changes for:', { worktreePath, remote: targetRemote });
|
||||
console.log('[Mock] Pulling latest changes for:', {
|
||||
worktreePath,
|
||||
remote: targetRemote,
|
||||
stashIfNeeded,
|
||||
});
|
||||
return {
|
||||
success: true,
|
||||
result: {
|
||||
branch: 'main',
|
||||
pulled: true,
|
||||
message: `Pulled latest changes from ${targetRemote}`,
|
||||
hasLocalChanges: false,
|
||||
hasConflicts: false,
|
||||
stashed: false,
|
||||
stashRestored: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -2696,6 +2704,7 @@ function createMockWorktreeAPI(): WorktreeAPI {
|
||||
result: {
|
||||
applied: true,
|
||||
hasConflicts: false,
|
||||
conflictFiles: [] as string[],
|
||||
operation: pop ? ('pop' as const) : ('apply' as const),
|
||||
stashIndex,
|
||||
message: `Stash ${pop ? 'popped' : 'applied'} successfully`,
|
||||
@@ -2740,6 +2749,17 @@ function createMockWorktreeAPI(): WorktreeAPI {
|
||||
},
|
||||
};
|
||||
},
|
||||
rebase: async (worktreePath: string, ontoBranch: string) => {
|
||||
console.log('[Mock] Rebase:', { worktreePath, ontoBranch });
|
||||
return {
|
||||
success: true,
|
||||
result: {
|
||||
branch: 'current-branch',
|
||||
ontoBranch,
|
||||
message: `Successfully rebased onto ${ontoBranch}`,
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2135,8 +2135,8 @@ export class HttpApiClient implements ElectronAPI {
|
||||
featureId,
|
||||
filePath,
|
||||
}),
|
||||
pull: (worktreePath: string, remote?: string) =>
|
||||
this.post('/api/worktree/pull', { worktreePath, remote }),
|
||||
pull: (worktreePath: string, remote?: string, stashIfNeeded?: boolean) =>
|
||||
this.post('/api/worktree/pull', { worktreePath, remote, stashIfNeeded }),
|
||||
checkoutBranch: (worktreePath: string, branchName: string, baseBranch?: string) =>
|
||||
this.post('/api/worktree/checkout-branch', { worktreePath, branchName, baseBranch }),
|
||||
listBranches: (worktreePath: string, includeRemote?: boolean) =>
|
||||
@@ -2230,6 +2230,8 @@ export class HttpApiClient implements ElectronAPI {
|
||||
this.post('/api/worktree/stash-drop', { worktreePath, stashIndex }),
|
||||
cherryPick: (worktreePath: string, commitHashes: string[], options?: { noCommit?: boolean }) =>
|
||||
this.post('/api/worktree/cherry-pick', { worktreePath, commitHashes, options }),
|
||||
rebase: (worktreePath: string, ontoBranch: string) =>
|
||||
this.post('/api/worktree/rebase', { worktreePath, ontoBranch }),
|
||||
getBranchCommitLog: (worktreePath: string, branchName?: string, limit?: number) =>
|
||||
this.post('/api/worktree/branch-commit-log', { worktreePath, branchName, limit }),
|
||||
getTestLogs: (worktreePath?: string, sessionId?: string): Promise<TestLogsResponse> => {
|
||||
|
||||
Reference in New Issue
Block a user