-
Notifications
You must be signed in to change notification settings - Fork 212
Expand file tree
/
Copy pathHeader.tsx
More file actions
72 lines (63 loc) · 1.93 KB
/
Copy pathHeader.tsx
File metadata and controls
72 lines (63 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { memo } from "react"
import { Text, Box } from "ink"
import type { TokenUsage } from "@roo-code/types"
import { ASCII_ROO } from "@/types/constants.js"
import { ExtensionHostOptions } from "@/agent/index.js"
import { useTerminalSize } from "../hooks/TerminalSizeContext.js"
import * as theme from "../theme.js"
import MetricsDisplay from "./MetricsDisplay.js"
interface HeaderProps extends ExtensionHostOptions {
version: string
tokenUsage?: TokenUsage | null
contextWindow?: number
}
function Header({
workspacePath,
provider,
model,
mode,
reasoningEffort,
nonInteractive,
version,
tokenUsage,
contextWindow,
}: HeaderProps) {
const { columns } = useTerminalSize()
const homeDir = process.env.HOME || process.env.USERPROFILE || ""
const title = `Roo Code CLI v${version}`
const remainingDashes = Math.max(0, columns - `── ${title} `.length)
return (
<Box flexDirection="column" width={columns}>
<Text color={theme.borderColor}>
── <Text color={theme.titleColor}>{title}</Text> {"─".repeat(remainingDashes)}
</Text>
<Box width={columns}>
<Box flexDirection="row">
<Box marginY={1}>
<Text color="magenta">{ASCII_ROO}</Text>
</Box>
<Box flexDirection="column" marginLeft={1} marginTop={1}>
<Text color={theme.dimText}>
cwd:{" "}
{workspacePath.startsWith(homeDir) ? workspacePath.replace(homeDir, "~") : workspacePath}
</Text>
<Text color={theme.dimText}>
{provider}: {model} [{reasoningEffort}]
</Text>
<Text color={theme.dimText}>
mode: {mode}
{nonInteractive && " (YOLO)"}
</Text>
</Box>
</Box>
</Box>
{tokenUsage && contextWindow && contextWindow > 0 && (
<Box alignSelf="flex-end" marginTop={-1}>
<MetricsDisplay tokenUsage={tokenUsage} contextWindow={contextWindow} />
</Box>
)}
<Text color={theme.borderColor}>{"─".repeat(columns)}</Text>
</Box>
)
}
export default memo(Header)