дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
The changed-files chip under the composer opens the task's changes in an editor tab of their own: the file tree beside one scrolling diff of every file, with the scope, accept and rollback controls in the diff's toolbar. The conversation keeps its layout instead of gaining a side pane. Added and deleted files show their one side alone, and selecting a file no longer renders every mounted diff again.
42 рядки
1.4 KiB
TypeScript
42 рядки
1.4 KiB
TypeScript
/** Changes tab view options, persisted across sessions. */
|
|
import { create } from "zustand";
|
|
|
|
/** What the tab lists: the whole task's changes, or the last turn's. */
|
|
export type ChangesScope = "task" | "turn";
|
|
|
|
export interface ChangesOptions {
|
|
/** Files grouped by the commit that changed them; otherwise the flat list since the task started. */
|
|
groupByCommit: boolean;
|
|
scope: ChangesScope;
|
|
}
|
|
|
|
/** IDEA-like default: the review view. */
|
|
export const DEFAULT_CHANGES_OPTIONS: ChangesOptions = { groupByCommit: true, scope: "task" };
|
|
|
|
const KEY = "openidea.agents.changesView.v1";
|
|
|
|
function load(): ChangesOptions {
|
|
try {
|
|
const raw = localStorage.getItem(KEY);
|
|
const o = raw ? (JSON.parse(raw) as Record<string, unknown>) : {};
|
|
return {
|
|
groupByCommit: typeof o.groupByCommit === "boolean" ? o.groupByCommit : DEFAULT_CHANGES_OPTIONS.groupByCommit,
|
|
scope: o.scope === "turn" ? "turn" : DEFAULT_CHANGES_OPTIONS.scope,
|
|
};
|
|
} catch {
|
|
return { ...DEFAULT_CHANGES_OPTIONS };
|
|
}
|
|
}
|
|
|
|
export const useChangesOptions = create<ChangesOptions>(() => load());
|
|
|
|
/** Updates the options and persists them. */
|
|
export function setChangesOptions(patch: Partial<ChangesOptions>) {
|
|
useChangesOptions.setState(patch);
|
|
try {
|
|
localStorage.setItem(KEY, JSON.stringify(useChangesOptions.getState()));
|
|
} catch {
|
|
// Storage unavailable: the options last for this session.
|
|
}
|
|
}
|