fix(cli): cli behave as expected in forked workspaces

This commit is contained in:
Ruben Fiszel
2025-11-30 15:15:27 +00:00
parent c0200bfdae
commit b9ea46b78b
3 changed files with 134 additions and 89 deletions
+6 -11
View File
@@ -1,7 +1,7 @@
// deno-lint-ignore-file no-explicit-any
import { GlobalOptions } from "../../types.ts";
import { colors, Input, log, setClient } from "../../../deps.ts";
import { addWorkspace, allWorkspaces, list, removeWorkspace } from "./workspace.ts";
import { allWorkspaces, list, removeWorkspace } from "./workspace.ts";
import * as wmill from "../../../gen/services.gen.ts";
import { getCurrentGitBranch, getOriginalBranchForWorkspaceForks, isGitRepository } from "../../utils/git.ts";
import { WM_FORK_PREFIX } from "../../main.ts";
@@ -123,19 +123,14 @@ async function createWorkspaceFork(
throw error;
}
await addWorkspace(
{
name: workspaceName,
remote: remote,
workspaceId: trueWorkspaceId,
token: token,
},
opts
);
const newBranchName = `${WM_FORK_PREFIX}/${clonedBranchName}/${workspaceId}`
log.info(`Created forked workspace ${trueWorkspaceId}. To start contributing to your fork, create and push edits to the branch \`${newBranchName}\` by using the command:\n\n\t`+colors.white(`git checkout -b ${newBranchName}`) + `\n\nThe changes will then be reflected in your fork if you've setup the git sync workflows correctly.`);
log.info(`Created forked workspace ${trueWorkspaceId}. To start contributing to your fork, create and push edits to the branch \`${newBranchName}\` by using the command:
\t`+colors.white(`git checkout -b ${newBranchName}`) + `
When doing operations on the forked workspace, it will use the remote setup in gitBranches for the branch it was forked from.`);
}
async function deleteWorkspaceFork(