From c538c151c7462ad0395ff2c15c5e11e89e362aa8 Mon Sep 17 00:00:00 2001
From: Striven <sg.striven@cutecat.club>
Date: Sat, 04 Apr 2026 19:47:16 +0000
Subject: [PATCH] Initial commit

---
 quartz/util/log.ts |   46 ++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/quartz/util/log.ts b/quartz/util/log.ts
index 773945c..cfd8c3f 100644
--- a/quartz/util/log.ts
+++ b/quartz/util/log.ts
@@ -1,26 +1,56 @@
-import { Spinner } from "cli-spinner"
+import truncate from "ansi-truncate"
+import readline from "readline"
 
 export class QuartzLogger {
   verbose: boolean
-  spinner: Spinner | undefined
+  private spinnerInterval: NodeJS.Timeout | undefined
+  private spinnerText: string = ""
+  private updateSuffix: string = ""
+  private spinnerIndex: number = 0
+  private readonly spinnerChars = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
+
   constructor(verbose: boolean) {
-    this.verbose = verbose
+    const isInteractiveTerminal =
+      process.stdout.isTTY && process.env.TERM !== "dumb" && !process.env.CI
+    this.verbose = verbose || !isInteractiveTerminal
   }
 
   start(text: string) {
+    this.spinnerText = text
+
     if (this.verbose) {
       console.log(text)
     } else {
-      this.spinner = new Spinner(`%s ${text}`)
-      this.spinner.setSpinnerString(18)
-      this.spinner.start()
+      this.spinnerIndex = 0
+      this.spinnerInterval = setInterval(() => {
+        readline.clearLine(process.stdout, 0)
+        readline.cursorTo(process.stdout, 0)
+
+        const columns = process.stdout.columns || 80
+        let output = `${this.spinnerChars[this.spinnerIndex]} ${this.spinnerText}`
+        if (this.updateSuffix) {
+          output += `: ${this.updateSuffix}`
+        }
+
+        const truncated = truncate(output, columns)
+        process.stdout.write(truncated)
+        this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerChars.length
+      }, 50)
     }
   }
 
+  updateText(text: string) {
+    this.updateSuffix = text
+  }
+
   end(text?: string) {
-    if (!this.verbose) {
-      this.spinner!.stop(true)
+    if (!this.verbose && this.spinnerInterval) {
+      clearInterval(this.spinnerInterval)
+      this.spinnerInterval = undefined
+      readline.clearLine(process.stdout, 0)
+      readline.cursorTo(process.stdout, 0)
     }
+
     if (text) {
       console.log(text)
     }

--
Gitblit v1.10.0