Dax Raad 8 месяцев назад
Родитель
Сommit
aab47714c9

+ 2 - 1
packages/opencode/src/cli/cmd/auth.ts

@@ -13,7 +13,8 @@ export const AuthCommand = cmd({
     yargs
       .command(AuthLoginCommand)
       .command(AuthLogoutCommand)
-      .command(AuthListCommand),
+      .command(AuthListCommand)
+      .demandCommand(),
   async handler(args) {},
 })
 

+ 6 - 6
packages/opencode/src/cli/ui.ts

@@ -44,19 +44,19 @@ export namespace UI {
     blank = true
   }
 
-  export function logo() {
-    empty()
+  export function logo(pad?: string) {
+    const result = []
     for (const row of LOGO) {
-      print("   ")
+      if (pad) result.push(pad)
       for (let i = 0; i < row.length; i++) {
         const color =
           i > 18 ? Bun.color("white", "ansi") : Bun.color("gray", "ansi")
         const char = row[i]
-        print(color + char)
+        result.push(color + char)
       }
-      println()
+      result.push("\n")
     }
-    empty()
+    return result.join("").trimEnd()
   }
 
   export async function input(prompt: string): Promise<string> {

+ 4 - 1
packages/opencode/src/index.ts

@@ -33,6 +33,7 @@ const cli = yargs(hideBin(process.argv))
       args: process.argv.slice(2),
     })
   })
+  .usage("\n" + UI.logo())
   .command({
     command: "$0",
     describe: "Start OpenCode TUI",
@@ -85,7 +86,9 @@ const cli = yargs(hideBin(process.argv))
         )
         if (result === "done") break
         if (result === "needs_provider") {
-          UI.logo()
+          UI.empty()
+          UI.println(UI.logo("   "))
+          UI.empty()
           await AuthLoginCommand.handler(args)
         }
       }