fix(commands): use dynamic base branch and safe rollback in remove-ai-slops

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-01 18:21:00 -07:00
parent 51d9685571
commit 842434c81f
3 changed files with 30 additions and 9 deletions
@@ -1,3 +1,5 @@
/// <reference path="../../../bun-test.d.ts" />
import { afterEach, beforeEach, describe, test, expect } from "bun:test"
import { loadBuiltinCommands } from "./commands"
import { HANDOFF_TEMPLATE } from "./templates/handoff"
@@ -170,6 +172,15 @@ describe("REMOVE_AI_SLOPS_TEMPLATE", () => {
expect(REMOVE_AI_SLOPS_TEMPLATE).toContain("Safety Verification")
expect(REMOVE_AI_SLOPS_TEMPLATE).toContain("Behavior Preservation")
})
test("should detect the base branch dynamically instead of hardcoding main", () => {
//#given - the template string
//#when / #then
expect(REMOVE_AI_SLOPS_TEMPLATE).toContain("git symbolic-ref refs/remotes/origin/HEAD")
expect(REMOVE_AI_SLOPS_TEMPLATE).toContain('git merge-base "$BASE_BRANCH" HEAD')
expect(REMOVE_AI_SLOPS_TEMPLATE).not.toContain("git merge-base main HEAD")
})
})
describe("HANDOFF_TEMPLATE", () => {