Integrate OpenHandoff factory workspace (#212)

This commit is contained in:
Nathan Flurry 2026-03-09 14:00:20 -07:00 committed by GitHub
parent 3d9476ed0b
commit bf282199b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
251 changed files with 42824 additions and 692 deletions

View file

@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import {
deriveFallbackTitle,
resolveCreateFlowDecision,
sanitizeBranchName
} from "../src/services/create-flow.js";
describe("create flow decision", () => {
it("derives a conventional-style fallback title from task text", () => {
const title = deriveFallbackTitle("Fix OAuth callback bug in handler");
expect(title).toBe("fix: Fix OAuth callback bug in handler");
});
it("preserves an explicit conventional prefix without duplicating it", () => {
const title = deriveFallbackTitle("Reply with exactly: READY", "feat: Browser UI Flow");
expect(title).toBe("feat: Browser UI Flow");
});
it("sanitizes generated branch names", () => {
expect(sanitizeBranchName("feat: Add @mentions & #hashtags")).toBe("feat-add-mentions-hashtags");
expect(sanitizeBranchName(" spaces everywhere ")).toBe("spaces-everywhere");
});
it("auto-increments generated branch names for conflicts", () => {
const resolved = resolveCreateFlowDecision({
task: "Add auth",
localBranches: ["feat-add-auth"],
handoffBranches: ["feat-add-auth-2"]
});
expect(resolved.title).toBe("feat: Add auth");
expect(resolved.branchName).toBe("feat-add-auth-3");
});
it("fails when explicit branch already exists", () => {
expect(() =>
resolveCreateFlowDecision({
task: "new task",
explicitBranchName: "existing-branch",
localBranches: ["existing-branch"],
handoffBranches: []
})
).toThrow("already exists");
});
});