feat: add repository cloning to project setup
Add project can clone repositories into a chosen folder Command palette now opens the add project flow Clone flow supports selecting Git identities
This commit is contained in:
@@ -1415,6 +1415,24 @@ class OpencodeService {
|
||||
return result;
|
||||
}
|
||||
|
||||
async cloneRepository(input: { remoteUrl: string; destinationPath: string; gitIdentityId?: string | null }): Promise<{ success: boolean; path: string; output?: string }> {
|
||||
const response = await fetch(`${this.baseUrl}/fs/clone`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
},
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({ error: 'Failed to clone repository' }));
|
||||
throw new Error(error.error || 'Failed to clone repository');
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
async listLocalDirectory(directoryPath: string | null | undefined, options?: { respectGitignore?: boolean }): Promise<FilesystemEntry[]> {
|
||||
const normalizedDirectoryPath = typeof directoryPath === 'string' ? normalizeFsPath(directoryPath.trim()) : '';
|
||||
const cacheKey = `${normalizedDirectoryPath}|${options?.respectGitignore ? '1' : '0'}`;
|
||||
|
||||
Reference in New Issue
Block a user