Files
leon-ai--leon/scripts/setup/setup-ui.js
T
2026-07-13 12:44:08 +08:00

76 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { createConsola } from 'consola'
export const setupConsola = createConsola({
fancy: true,
formatOptions: {
date: false
}
})
function dim(text) {
return `\x1b[2m${text}\x1b[0m`
}
function green(text) {
return `\x1b[32m${text}\x1b[0m`
}
function underline(text) {
return `\x1b[4m${text}\x1b[24m`
}
/**
* Setup-only presentation helpers built on top of consola.
*/
export class SetupUI {
static section(title) {
setupConsola.box(title)
}
static aside(text) {
setupConsola.log(dim(` ${text}`))
}
static info(text) {
setupConsola.info(text)
}
static success(text) {
setupConsola.success(text)
}
static successHighlight(text) {
console.log(green(`✔ ${text}`))
}
static warning(text) {
setupConsola.warn(text)
}
static questionIntro(count) {
const quickQuestionLabel =
count === 1 ? '1 quick question' : `${count} quick questions`
this.info(
`I just have ${quickQuestionLabel} so I can set things up the way you want.`
)
}
static questionSummary(preferences) {
this.success(`Local AI: ${preferences.setupLocalAI ? 'Yes' : 'No'}`)
this.success(`Voice: ${preferences.setupVoice ? 'Yes' : 'No'}`)
}
static recap(items) {
setupConsola.box(items.join('\n'))
}
static bullet(text) {
console.log(`● ${text}`)
}
static underlined(text) {
return underline(text)
}
}