Consolidate the fragile 3-RPC flow (suggestCommitAndBranch → createBranch +
checkout → runStackedAction) into a single server-side operation triggered by
`runStackedAction({ featureBranch: true })`. The server now generates the
branch name via AI, deduplicates it, creates + checks out the branch, then
runs the normal commit/push/PR pipeline atomically.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { QueryClient } from "@tanstack/react-query";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
gitMutationKeys,
|
|
gitPullMutationOptions,
|
|
gitRunStackedActionMutationOptions,
|
|
} from "./gitReactQuery";
|
|
|
|
describe("gitMutationKeys", () => {
|
|
it("scopes stacked action keys by cwd", () => {
|
|
expect(gitMutationKeys.runStackedAction("/repo/a")).not.toEqual(
|
|
gitMutationKeys.runStackedAction("/repo/b"),
|
|
);
|
|
});
|
|
|
|
it("scopes pull keys by cwd", () => {
|
|
expect(gitMutationKeys.pull("/repo/a")).not.toEqual(gitMutationKeys.pull("/repo/b"));
|
|
});
|
|
});
|
|
|
|
describe("git mutation options", () => {
|
|
const queryClient = new QueryClient();
|
|
|
|
it("attaches cwd-scoped mutation key for runStackedAction", () => {
|
|
const options = gitRunStackedActionMutationOptions({ cwd: "/repo/a", queryClient });
|
|
expect(options.mutationKey).toEqual(gitMutationKeys.runStackedAction("/repo/a"));
|
|
});
|
|
|
|
it("attaches cwd-scoped mutation key for pull", () => {
|
|
const options = gitPullMutationOptions({ cwd: "/repo/a", queryClient });
|
|
expect(options.mutationKey).toEqual(gitMutationKeys.pull("/repo/a"));
|
|
});
|
|
});
|