refactor(coding-agent): simplified temporary model status message

- Inlined the temporary model status formatting logic directly into the controller.
- Removed the unused `formatTemporaryModelStatus` utility function and its associated test.
This commit is contained in:
can1357
2026-06-21 07:42:46 +02:00
parent 78f6586dd4
commit 5207a98fd8
3 changed files with 4 additions and 16 deletions
@@ -71,10 +71,6 @@ import { buildCopyTargets } from "../utils/copy-targets";
const MANUAL_LOGIN_TIP = "Tip: You can complete pairing with /login <redirect URL>.";
export function formatTemporaryModelStatus(modelLabel: string, roleSelectorHint = "Alt+M"): string {
return `Temporary model selection is session-only: ${modelLabel}. Use ${roleSelectorHint} or /model for role models (default/smol/plan/task/slow/custom roles).`;
}
export class SelectorController {
constructor(private ctx: InteractiveModeContext) {}
@@ -499,7 +495,9 @@ export class SelectorController {
this.ctx.statusLine.invalidate();
this.ctx.updateEditorBorderColor();
const roleSelectorHint = this.ctx.keybindings.getKeys("app.model.select")[0] ?? "Alt+M";
this.ctx.showStatus(formatTemporaryModelStatus(selector ?? model.id, roleSelectorHint));
this.ctx.showStatus(
`Session-only model: ${selector ?? model.id}. Use ${roleSelectorHint} or /model for roles.`,
);
done();
this.ctx.ui.requestRender();
} else if (role === "default") {
@@ -17,7 +17,6 @@ You are a helpful assistant the team trusts with load-bearing changes, operating
- You are not alone in this repo. Treat unexpected changes as the user's work and adapt.
- In terminal prose and final chat, you MAY use LaTeX math (`$`, `$$`, `\text`, `\times`) and color (`\textcolor`, `\colorbox`, `\fcolorbox`).
- To show a diagram, you MAY emit a ` ```mermaid ` block — the terminal renders it as ASCII. Use it for genuine structure or flow, not trivia.
- For a visual separator between sections, use `─` (U+2500).
RUNTIME
==============
@@ -1,9 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
import {
formatTemporaryModelStatus,
SelectorController,
} from "@oh-my-pi/pi-coding-agent/modes/controllers/selector-controller";
import { SelectorController } from "@oh-my-pi/pi-coding-agent/modes/controllers/selector-controller";
import { beginSettingsTest, restoreSettingsTestState, type SettingsTestState } from "./helpers/settings-test-state";
let settingsState: SettingsTestState | undefined;
@@ -19,12 +16,6 @@ afterEach(() => {
});
describe("selector setting side effects", () => {
it("formats temporary model status with role assignment guidance", () => {
expect(formatTemporaryModelStatus("openai/gpt-5.1", "alt+m")).toBe(
"Temporary model selection is session-only: openai/gpt-5.1. Use alt+m or /model for role models (default/smol/plan/task/slow/custom roles).",
);
});
it("refreshes the status line when git integration changes at runtime", () => {
const updateSettings = vi.fn();
const updateEditorTopBorder = vi.fn();