refactor(server): canonicalize service API (#31049)
This commit is contained in:
parent
53ff1b57c9
commit
fe0c4f8c74
388 changed files with 7075 additions and 4064 deletions
38
packages/tui/src/util/presentation.ts
Normal file
38
packages/tui/src/util/presentation.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
const logo = {
|
||||
left: [" ", "█▀▀█ █▀▀█ █▀▀█ █▀▀▄", "█__█ █__█ █^^^ █__█", "▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀~~▀"],
|
||||
right: [" ▄ ", "█▀▀▀ █▀▀█ █▀▀█ █▀▀█", "█___ █__█ █__█ █^^^", "▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"],
|
||||
}
|
||||
|
||||
const reset = "\x1b[0m"
|
||||
const bold = "\x1b[1m"
|
||||
const dim = "\x1b[90m"
|
||||
|
||||
function wordmark(pad = "") {
|
||||
const draw = (line: string, fg: string, shadow: string, bg: string) =>
|
||||
[...line]
|
||||
.map((char) => {
|
||||
if (char === "_") return `${bg} ${reset}`
|
||||
if (char === "^") return `${fg}${bg}▀${reset}`
|
||||
if (char === "~") return `${shadow}▀${reset}`
|
||||
if (char === " ") return " "
|
||||
return `${fg}${char}${reset}`
|
||||
})
|
||||
.join("")
|
||||
|
||||
return logo.left.map((line, index) => {
|
||||
const left = draw(line, dim, "\x1b[38;5;235m", "\x1b[48;5;235m")
|
||||
const right = draw(logo.right[index] ?? "", reset, "\x1b[38;5;238m", "\x1b[48;5;238m")
|
||||
return `${pad}${left} ${right}`
|
||||
})
|
||||
}
|
||||
|
||||
export function sessionExitSummary(input: { title: string; sessionID?: string }) {
|
||||
const weak = (text: string) => `${dim}${text.padEnd(10, " ")}${reset}`
|
||||
return [
|
||||
...wordmark(" "),
|
||||
"",
|
||||
` ${weak("Session")}${bold}${input.title}${reset}`,
|
||||
` ${weak("Continue")}${bold}opencode -s ${input.sessionID}${reset}`,
|
||||
"",
|
||||
].join("\n")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue