fix(projects): separate registration from workspace setup

Adding or cloning a project now registers it and opens workspace setup
instead of creating a workspace implicitly. Keep Add Project independently
mounted from Search so closing one cannot control the other.
This commit is contained in:
Mohamed Boudra
2026-07-15 23:13:55 +02:00
parent 38cfe109c9
commit 943d03ad99
23 changed files with 340 additions and 295 deletions
+10 -10
View File
@@ -14,15 +14,15 @@ interface CloneCommandOptions extends CommandOptions {
export interface CloneResult {
repo: string;
checkoutPath: string;
workspaceId: string;
workspaceName: string;
projectId: string;
projectName: string;
}
export const cloneSchema: OutputSchema<CloneResult> = {
idField: "workspaceId",
idField: "projectId",
columns: [
{ header: "REPO", field: "repo", width: 28 },
{ header: "WORKSPACE", field: "workspaceName", width: 28 },
{ header: "PROJECT", field: "projectName", width: 28 },
{ header: "PATH", field: "checkoutPath", width: 56 },
],
};
@@ -52,7 +52,7 @@ export async function runCloneCommand(
throw buildDaemonConnectionCommandError({ host: options.host, error: err });
}
if (client.getLastServerInfoMessage()?.features?.workspaceGithubClone !== true) {
if (client.getLastServerInfoMessage()?.features?.projectGithubClone !== true) {
await client.close().catch(() => {});
throw cmdError(
"UNSUPPORTED_BY_HOST",
@@ -62,15 +62,15 @@ export async function runCloneCommand(
}
try {
const response = await client.cloneGithubWorkspace({
const response = await client.cloneGithubProject({
repo,
targetDirectory,
...(repoIsCompleteRemote ? {} : { cloneProtocol: options.protocol }),
});
if (response.error || !response.workspace || !response.checkoutPath) {
if (response.error || !response.project || !response.checkoutPath) {
throw cmdError(
"CLONE_FAILED",
`Failed to clone GitHub repo: ${response.error ?? "no workspace returned"}`,
`Failed to clone GitHub repo: ${response.error ?? "no project returned"}`,
);
}
@@ -79,8 +79,8 @@ export async function runCloneCommand(
data: {
repo: response.repo,
checkoutPath: response.checkoutPath,
workspaceId: response.workspace.id,
workspaceName: response.workspace.name,
projectId: response.project.projectId,
projectName: response.project.projectDisplayName,
},
schema: cloneSchema,
};