mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 21:03:56 +00:00
fix(coding-agent): export Theme and ThemeColor for hooks to use proper types
This commit is contained in:
parent
65d3081d80
commit
8c227052d3
2 changed files with 6 additions and 7 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
* with a nice custom UI.
|
* with a nice custom UI.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { HookAPI } from "@mariozechner/pi-coding-agent";
|
import type { HookAPI, Theme } from "@mariozechner/pi-coding-agent";
|
||||||
import { isCtrlC, isEscape, truncateToWidth } from "@mariozechner/pi-tui";
|
import { isCtrlC, isEscape, truncateToWidth } from "@mariozechner/pi-tui";
|
||||||
|
|
||||||
interface Todo {
|
interface Todo {
|
||||||
|
|
@ -23,12 +23,12 @@ interface TodoDetails {
|
||||||
|
|
||||||
class TodoListComponent {
|
class TodoListComponent {
|
||||||
private todos: Todo[];
|
private todos: Todo[];
|
||||||
private theme: { fg: (color: string, text: string) => string };
|
private theme: Theme;
|
||||||
private onClose: () => void;
|
private onClose: () => void;
|
||||||
private cachedWidth?: number;
|
private cachedWidth?: number;
|
||||||
private cachedLines?: string[];
|
private cachedLines?: string[];
|
||||||
|
|
||||||
constructor(todos: Todo[], theme: { fg: (color: string, text: string) => string }, onClose: () => void) {
|
constructor(todos: Todo[], theme: Theme, onClose: () => void) {
|
||||||
this.todos = todos;
|
this.todos = todos;
|
||||||
this.theme = theme;
|
this.theme = theme;
|
||||||
this.onClose = onClose;
|
this.onClose = onClose;
|
||||||
|
|
@ -127,8 +127,7 @@ export default function (pi: HookAPI) {
|
||||||
const todos = getTodos(ctx);
|
const todos = getTodos(ctx);
|
||||||
|
|
||||||
await ctx.ui.custom<void>((_tui, theme, done) => {
|
await ctx.ui.custom<void>((_tui, theme, done) => {
|
||||||
// Cast: Theme.fg uses ThemeColor union type, but we only use standard colors
|
return new TodoListComponent(todos, theme, () => done());
|
||||||
return new TodoListComponent(todos, theme as { fg: (color: string, text: string) => string }, () => done());
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -157,5 +157,5 @@ export {
|
||||||
export { main } from "./main.js";
|
export { main } from "./main.js";
|
||||||
// UI components for hooks
|
// UI components for hooks
|
||||||
export { BorderedLoader } from "./modes/interactive/components/bordered-loader.js";
|
export { BorderedLoader } from "./modes/interactive/components/bordered-loader.js";
|
||||||
// Theme utilities for custom tools
|
// Theme utilities for custom tools and hooks
|
||||||
export { getMarkdownTheme } from "./modes/interactive/theme/theme.js";
|
export { getMarkdownTheme, Theme, type ThemeColor } from "./modes/interactive/theme/theme.js";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue