Skip to content

Commit 9bc3914

Browse files
feat(server): jj commit, push, PR create/checkout and stacked actions
Co-authored-by: Лев Федорец <[email protected]>
1 parent 503cd4e commit 9bc3914

25 files changed

Lines changed: 4417 additions & 187 deletions

‎apps/server/src/git/GitWorkflowService.ts‎

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ import * as JjVcsDriver from "../vcs/JjVcsDriver.ts";
3737
import * as VcsDriverRegistry from "../vcs/VcsDriverRegistry.ts";
3838

3939
/**
40-
* The routed workflow surface. Native implementations share these signatures for their supported
41-
* operations; unsupported operations fail at the routing boundary rather than falling back to Git.
40+
* The workflow surface every VCS kind implements. `GitWorkflowService` routes by kind; the Git and
41+
* Jujutsu implementations both satisfy this type, so a future change to a shared signature fails to
42+
* compile in both lanes instead of silently drifting in one.
4243
*/
4344
export interface VcsWorkflowOps {
4445
readonly hasCommit: (input: {
@@ -243,34 +244,6 @@ export const make = Effect.gen(function* () {
243244
}),
244245
);
245246

246-
const unsupportedJjCause = (operation: string) =>
247-
new VcsUnsupportedOperationError({
248-
operation,
249-
kind: "jj",
250-
detail: "This operation is not supported for Jujutsu repositories.",
251-
});
252-
253-
const unsupportedJjCommand = (operation: string, cwd: string) =>
254-
Effect.fail(
255-
new GitCommandError({
256-
operation,
257-
command: "vcs-route",
258-
cwd,
259-
detail: "This operation is not supported for Jujutsu repositories.",
260-
cause: unsupportedJjCause(operation),
261-
}),
262-
);
263-
264-
const unsupportedJjWorkflow = (operation: string, cwd: string) =>
265-
Effect.fail(
266-
new GitManagerError({
267-
operation,
268-
cwd,
269-
detail: "This operation is not supported for Jujutsu repositories.",
270-
cause: unsupportedJjCause(operation),
271-
}),
272-
);
273-
274247
const undetectableCommand = (operation: string, cwd: string, detecting = false) =>
275248
Effect.mapError(
276249
(cause: VcsError) =>
@@ -527,26 +500,25 @@ export const make = Effect.gen(function* () {
527500
pullCurrentBranch: (cwd) =>
528501
route("GitWorkflowService.pullCurrentBranch", commandRouting, {
529502
git: () => git.pullCurrentBranch(cwd),
530-
jj: () => unsupportedJjCommand("GitWorkflowService.pullCurrentBranch", cwd),
503+
jj: () => jjWorkflow.pullCurrentBranch(cwd),
531504
})({ cwd }),
532505
runStackedAction: (input, options) =>
533506
route("GitWorkflowService.runStackedAction", workflowRouting, {
534507
git: (actionInput: GitRunStackedActionInput) =>
535508
gitManager.runStackedAction(actionInput, options),
536509
jj: (actionInput: GitRunStackedActionInput) =>
537-
unsupportedJjWorkflow("GitWorkflowService.runStackedAction", actionInput.cwd),
510+
jjWorkflow.runStackedAction(actionInput, options),
538511
})(input),
539512
resolvePullRequest: route("GitWorkflowService.resolvePullRequest", workflowRouting, {
540513
git: gitManager.resolvePullRequest,
541-
jj: (input) => unsupportedJjWorkflow("GitWorkflowService.resolvePullRequest", input.cwd),
514+
jj: jjWorkflow.resolvePullRequest,
542515
}),
543516
preparePullRequestThread: route(
544517
"GitWorkflowService.preparePullRequestThread",
545518
workflowRouting,
546519
{
547520
git: gitManager.preparePullRequestThread,
548-
jj: (input) =>
549-
unsupportedJjWorkflow("GitWorkflowService.preparePullRequestThread", input.cwd),
521+
jj: jjWorkflow.preparePullRequestThread,
550522
},
551523
),
552524
listRefs: routeOr(

0 commit comments

Comments
 (0)