mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
refactor: unify kilo logos
This commit is contained in:
@@ -84,6 +84,7 @@ import { formatTranscript } from "../../util/transcript"
|
||||
import { UI } from "@/cli/ui.ts"
|
||||
import { useTuiConfig } from "../../context/tui-config"
|
||||
import { splitDiffHunks } from "@/kilocode/tui/diff" // kilocode_change
|
||||
import { session as banner } from "@/kilocode/cli/logo" // kilocode_change
|
||||
|
||||
import { formatMarkdownTables } from "../../util/markdown" // kilocode_change
|
||||
import { bell } from "@/kilocode/bell" // kilocode_change
|
||||
@@ -357,19 +358,12 @@ export function Session() {
|
||||
// Allow exit when in child session (prompt is hidden)
|
||||
const exit = useExit()
|
||||
|
||||
// kilocode_change start
|
||||
createEffect(() => {
|
||||
const title = Locale.truncate(session()?.title ?? "", 50)
|
||||
// kilocode_change start
|
||||
return exit.message.set(
|
||||
[
|
||||
``,
|
||||
` ██ ██ ██🬺🬏 ██ ██ ██🬺🬏 ${UI.Style.TEXT_DIM}${title}${UI.Style.TEXT_NORMAL}`,
|
||||
` ████🬺🬏 ██ ██ ██ ██ ${UI.Style.TEXT_DIM}kilo -s ${session()?.id}${UI.Style.TEXT_NORMAL}`,
|
||||
` ██ ██ ██████ 🬁🬬████ 🬁🬬██ `,
|
||||
].join("\n"),
|
||||
)
|
||||
// kilocode_change end
|
||||
return exit.message.set(banner(title, session()?.id, UI.Style.TEXT_DIM, UI.Style.TEXT_NORMAL))
|
||||
})
|
||||
// kilocode_change end
|
||||
|
||||
// kilocode_change start - double ctrl+c to exit for child sessions
|
||||
const [exitPress, setExitPress] = createSignal(0)
|
||||
|
||||
@@ -2,15 +2,13 @@ import z from "zod"
|
||||
import { EOL } from "os"
|
||||
import { NamedError } from "@opencode-ai/core/util/error"
|
||||
import { logo as glyphs } from "./logo"
|
||||
import { tui } from "../kilocode/cli/logo" // kilocode_change
|
||||
|
||||
// kilocode_change start
|
||||
const wordmark = [
|
||||
// kilocode_change start
|
||||
`██ ██ ██🬺🬏 ██ ██ ██🬺🬏 ████ ██ ██🬺🬏 `,
|
||||
`████🬺🬏 ~~██ ██ ~~ ██~~██ ██~~~~ ██ ~~██ `,
|
||||
`██ ██ ██████ 🬁🬬████ 🬁🬬██~~ 🬁🬬████ 🬁🬬████ ██████ `,
|
||||
`~~ ~~ ~~~~~~ ~~~~ ~~ ~~~~ ~~~~ ~~~~~~ `,
|
||||
// kilocode_change end
|
||||
...tui(),
|
||||
]
|
||||
// kilocode_change end
|
||||
|
||||
export const CancelledError = NamedError.create("UICancelledError", z.void())
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ const modern = {
|
||||
`████🬺🬏 ██ ██ ██ ██ ██ ██ ██ `,
|
||||
`██ ██ ██████ 🬁🬬████ 🬁🬬██ 🬁🬬████ 🬁🬬████ ██████ `,
|
||||
],
|
||||
exit: [
|
||||
` ██ ██ ██🬺🬏 ██ ██ ██🬺🬏 `,
|
||||
` ████🬺🬏 ██ ██ ██ ██ `,
|
||||
` ██ ██ ██████ 🬁🬬████ 🬁🬬██ `,
|
||||
],
|
||||
}
|
||||
|
||||
const fallback = {
|
||||
@@ -28,6 +33,11 @@ const fallback = {
|
||||
`████ ██ ██ ██ ██ ██ ██ ██ `,
|
||||
`██ ██ ██████ ██████ ██ ████ ██████ ██████ `,
|
||||
],
|
||||
exit: [
|
||||
` ██ ██ ████ ██ ██ ██ `,
|
||||
` ████ ██ ██ ██ ██ `,
|
||||
` ██ ██ ██████ ██████ ██ `,
|
||||
],
|
||||
}
|
||||
|
||||
function flag(value: string | undefined) {
|
||||
@@ -57,3 +67,20 @@ export function tui(env = process.env, platform = process.platform) {
|
||||
export function plain(env = process.env, platform = process.platform) {
|
||||
return supports(env, platform) ? modern.plain : fallback.plain
|
||||
}
|
||||
|
||||
export function session(
|
||||
title: string,
|
||||
id: string | undefined,
|
||||
dim: string,
|
||||
normal: string,
|
||||
env = process.env,
|
||||
platform = process.platform,
|
||||
) {
|
||||
const logo = supports(env, platform) ? modern.exit : fallback.exit
|
||||
return [
|
||||
``,
|
||||
`${logo[0]}${dim}${title}${normal}`,
|
||||
`${logo[1]}${dim}kilo -s ${id}${normal}`,
|
||||
logo[2],
|
||||
].join("\n")
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { plain, supports, tui } from "../../src/kilocode/cli/logo"
|
||||
import { plain, session, supports, tui } from "../../src/kilocode/cli/logo"
|
||||
|
||||
describe("kilocode logo", () => {
|
||||
test("falls back on remote terminals", () => {
|
||||
@@ -23,4 +23,10 @@ describe("kilocode logo", () => {
|
||||
expect(tui({ SSH_TTY: "/dev/pts/0" }, "linux").join("\n")).not.toContain("🬺🬏")
|
||||
expect(plain({ SSH_TTY: "/dev/pts/0" }, "linux").join("\n")).not.toContain("🬁🬬")
|
||||
})
|
||||
|
||||
test("formats child session exit logo", () => {
|
||||
const out = session("Title", "ses_test", "<dim>", "<reset>", { SSH_TTY: "/dev/pts/0" }, "linux")
|
||||
expect(out).toContain("<dim>Title<reset>")
|
||||
expect(out).not.toContain("🬺🬏")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user