feat: make reasoning tab cycling opt-in (default off) (#1175)
This commit is contained in:
@@ -45,4 +45,30 @@ describe("reasoning tier cycle wiring", () => {
|
||||
|
||||
expect(callbackBlocks.length).toBeGreaterThanOrEqual(2);
|
||||
});
|
||||
|
||||
test("tab-based reasoning cycling is opt-in only", () => {
|
||||
const appPath = fileURLToPath(
|
||||
new URL("../../cli/App.tsx", import.meta.url),
|
||||
);
|
||||
const indexPath = fileURLToPath(new URL("../../index.ts", import.meta.url));
|
||||
const settingsPath = fileURLToPath(
|
||||
new URL("../../settings-manager.ts", import.meta.url),
|
||||
);
|
||||
|
||||
const appSource = readFileSync(appPath, "utf-8");
|
||||
const indexSource = readFileSync(indexPath, "utf-8");
|
||||
const settingsSource = readFileSync(settingsPath, "utf-8");
|
||||
|
||||
expect(settingsSource).toContain("reasoningTabCycleEnabled: boolean;");
|
||||
expect(settingsSource).toContain("reasoningTabCycleEnabled: false,");
|
||||
expect(indexSource).toContain(
|
||||
"reasoningTabCycleEnabled: settings.reasoningTabCycleEnabled === true,",
|
||||
);
|
||||
expect(appSource).toMatch(
|
||||
/if\s*\(\s*trimmed\s*===\s*"\/reasoning-tab"\s*\|\|\s*trimmed\.startsWith\("\/reasoning-tab "\)\s*\)\s*\{/,
|
||||
);
|
||||
expect(appSource).toMatch(
|
||||
/onCycleReasoningEffort=\{\s*reasoningTabCycleEnabled\s*\?\s*handleCycleReasoningEffort\s*:\s*undefined\s*\}/,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
57
src/tests/cli/reasoning-tab-toggle.test.ts
Normal file
57
src/tests/cli/reasoning-tab-toggle.test.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { resolveReasoningTabToggleCommand } from "../../cli/helpers/reasoningTabToggle";
|
||||
|
||||
describe("reasoning tab toggle command parsing", () => {
|
||||
test("returns null for non-matching commands", () => {
|
||||
expect(resolveReasoningTabToggleCommand("/model", false)).toBeNull();
|
||||
});
|
||||
|
||||
test("status/default reports current state", () => {
|
||||
expect(resolveReasoningTabToggleCommand("/reasoning-tab", false)).toEqual({
|
||||
kind: "status",
|
||||
message:
|
||||
"Reasoning Tab shortcut is disabled. Use /reasoning-tab on to enable it.",
|
||||
});
|
||||
|
||||
expect(
|
||||
resolveReasoningTabToggleCommand("/reasoning-tab status", true),
|
||||
).toEqual({
|
||||
kind: "status",
|
||||
message:
|
||||
"Reasoning Tab shortcut is enabled. Tab now cycles reasoning tiers.",
|
||||
});
|
||||
});
|
||||
|
||||
test("accepts enable aliases", () => {
|
||||
for (const arg of ["on", "enable", "enabled", "true", "1"]) {
|
||||
expect(
|
||||
resolveReasoningTabToggleCommand(`/reasoning-tab ${arg}`, false),
|
||||
).toEqual({
|
||||
kind: "set",
|
||||
enabled: true,
|
||||
message: "Reasoning Tab shortcut enabled.",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("accepts disable aliases", () => {
|
||||
for (const arg of ["off", "disable", "disabled", "false", "0"]) {
|
||||
expect(
|
||||
resolveReasoningTabToggleCommand(`/reasoning-tab ${arg}`, true),
|
||||
).toEqual({
|
||||
kind: "set",
|
||||
enabled: false,
|
||||
message: "Reasoning Tab shortcut disabled.",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test("returns usage for invalid arg", () => {
|
||||
expect(
|
||||
resolveReasoningTabToggleCommand("/reasoning-tab maybe", true),
|
||||
).toEqual({
|
||||
kind: "invalid",
|
||||
message: "Usage: /reasoning-tab [on|off|status] (default is off)",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user