diff --git a/install b/install index f9135957a88..d7dbd69e5e2 100755 --- a/install +++ b/install @@ -517,10 +517,46 @@ if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then fi # kilocode_change start +logo_supports() { + case "${KILO_UNICODE_LOGO:-}" in + 1|true|TRUE|yes|YES|on|ON) + return 0 + ;; + 0|false|FALSE|no|NO|off|OFF) + return 1 + ;; + esac + + if [ "${TERM:-}" = "dumb" ]; then + return 1 + fi + + if [ -n "${SSH_TTY:-}" ] || [ -n "${SSH_CLIENT:-}" ] || [ -n "${SSH_CONNECTION:-}" ]; then + return 1 + fi + + if [ -n "${ConEmuPID:-}" ] || [ -n "${ANSICON:-}" ]; then + return 1 + fi + + return 0 +} + +print_logo() { + if logo_supports; then + echo -e "██ ██ ██🬺🬏 ██ ██ ██🬺🬏 ████ ██ ██🬺🬏 " + echo -e "████🬺🬏 ██ ██ ██ ██ ██ ██ ██ " + echo -e "██ ██ ██████ 🬁🬬████ 🬁🬬██ 🬁🬬████ 🬁🬬████ ██████ " + return + fi + + echo -e "██ ██ ████ ██ ██ ███ ████ ██ ████ " + echo -e "████ ██ ██ ██ ██ ██ ██ ██ " + echo -e "██ ██ ██████ ██████ ██ ████ ██████ ██████ " +} + echo -e "" -echo -e "██ ██ ██🬺🬏 ██ ██ ██🬺🬏 ████ ██ ██🬺🬏 " -echo -e "████🬺🬏 ██ ██ ██ ██ ██ ██ ██ " -echo -e "██ ██ ██████ 🬁🬬████ 🬁🬬██ 🬁🬬████ 🬁🬬████ ██████ " +print_logo echo -e "" echo -e "" echo -e "${MUTED}Kilo includes free models so you can start immediately:${NC}" diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index 2571a4c9192..462a0e60f56 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -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) diff --git a/packages/opencode/src/cli/ui.ts b/packages/opencode/src/cli/ui.ts index 57bd8949c7e..4a49be541ee 100644 --- a/packages/opencode/src/cli/ui.ts +++ b/packages/opencode/src/cli/ui.ts @@ -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()) diff --git a/packages/opencode/src/kilocode/cli/logo.ts b/packages/opencode/src/kilocode/cli/logo.ts index 234281232f9..ca818c7189d 100644 --- a/packages/opencode/src/kilocode/cli/logo.ts +++ b/packages/opencode/src/kilocode/cli/logo.ts @@ -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") +} diff --git a/packages/opencode/test/kilocode/logo.test.ts b/packages/opencode/test/kilocode/logo.test.ts index 6778244cf43..a936581aa71 100644 --- a/packages/opencode/test/kilocode/logo.test.ts +++ b/packages/opencode/test/kilocode/logo.test.ts @@ -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", "", "", { SSH_TTY: "/dev/pts/0" }, "linux") + expect(out).toContain("Title") + expect(out).not.toContain("🬺🬏") + }) })