Seed CLISeed CLI

Print

Colored logging, spinners, tables, boxes, ASCII art, trees, and progress bars.

bun add @seedcli/print

The print module provides all console output functionality — from simple logging to complex tables, boxes, and progress bars.

Logging

seed.print.info('Starting deployment...')
seed.print.success('Deployed successfully!')
seed.print.warning('Config file not found, using defaults')
seed.print.error('Failed to connect to database')
seed.print.debug('Query took 42ms')  // Only visible with --debug
seed.print.highlight('Important note')
seed.print.muted('Less important info')
seed.print.newline()
seed.print.newline(3)  // 3 blank lines

Debug Mode

Debug messages are only displayed when --debug or --verbose is passed:

seed.print.debug('This is only visible in debug mode')

Colors

Direct access to chalk for custom coloring:

const { colors } = seed.print

console.log(colors.red('Error!'))
console.log(colors.bold.green('Success!'))
console.log(colors.hex('#7cc576')('Custom color'))
console.log(colors.bgBlue.white(' BADGE '))

Spinner

Show a loading indicator for async operations:

const spinner = seed.print.spin('Deploying...')

try {
  await deploy()
  spinner.succeed('Deployed!')
} catch (err) {
  spinner.fail('Deployment failed')
}

Spinner Methods

MethodDescription
succeed(text?)Stop with a success checkmark
fail(text?)Stop with a failure cross
warn(text?)Stop with a warning symbol
info(text?)Stop with an info symbol
stop()Stop without a symbol

Spinner Properties

PropertyTypeDescription
textstringUpdate the spinner message
isSpinningbooleanCheck if currently spinning
const spinner = seed.print.spin('Processing...')
spinner.text = 'Still processing...'
spinner.text = 'Almost done...'
spinner.succeed()

Table

Render formatted tables:

seed.print.table(
  [
    ['Name', 'Version', 'Status'],
    ['core', '1.0.0', 'published'],
    ['print', '1.0.0', 'published'],
    ['prompt', '1.0.0', 'draft'],
  ],
  { headers: ['Name', 'Version', 'Status'] }
)

Table Options

OptionTypeDefaultDescription
headersstring[]Header row labels
border'single' | 'double' | 'rounded' | 'bold' | 'none''single'Border style
headerColor(text: string) => stringHeader color function
columnsRecord<number, ColumnConfig>Per-column configuration
maxWidthnumberterminal widthMaximum table width
seed.print.table(rows, {
  headers: ['Package', 'Size', 'Status'],
  border: 'rounded',
  headerColor: colors.cyan,
  maxWidth: 80,
  columns: {
    1: { alignment: 'right' },
    2: { alignment: 'center' },
  },
})

Column Config

OptionTypeDescription
alignment'left' | 'center' | 'right'Column alignment
widthnumberFixed column width
truncatebooleanTruncate overflowing text

Box

Draw a bordered box around content:

seed.print.box('Deployment complete!\nAll services are healthy.', {
  title: 'Status',
  borderColor: 'green',
  borderStyle: 'round',
  padding: 1,
})

Box Options

OptionTypeDefaultDescription
titlestringBox title
titleAlignment'left' | 'center' | 'right''left'Title position
borderColorstringBorder color
borderStyle'single' | 'double' | 'round' | 'bold' | 'singleDouble' | 'doubleSingle' | 'classic' | 'arrow' | 'none''single'Border style
backgroundColorstringBackground color
paddingnumber | object0Inner padding
marginnumber | object0Outer margin
textAlignment'left' | 'center' | 'right''left'Content alignment
dimBorderbooleanfalseDim the border
widthnumberFixed width
fullscreenbooleanfalseFill terminal width
float'left' | 'center' | 'right''left'Box position

ASCII Art (Figlet)

Render large text banners:

seed.print.ascii('My CLI', {
  font: 'Standard',
})

Figlet Options

OptionTypeDescription
fontstringFiglet font name (default: 'Standard')
horizontalLayout'default' | 'full' | 'fitted' | 'controlled smushing' | 'universal smushing'Character spacing
verticalLayout'default' | 'full' | 'fitted' | 'controlled smushing' | 'universal smushing'Vertical spacing
widthnumberMaximum width
whitespaceBreakbooleanBreak on whitespace

Tree

Display hierarchical data:

seed.print.tree({
  label: 'my-project',
  children: [
    {
      label: 'src',
      children: [
        { label: 'commands/' },
        { label: 'extensions/' },
        { label: 'index.ts' },
      ],
    },
    { label: 'package.json' },
    { label: 'tsconfig.json' },
  ],
})

Tree Options

OptionTypeDefaultDescription
indentnumber2Indentation width
guidesbooleantrueShow tree guide lines

Key-Value

Display aligned key-value pairs:

seed.print.keyValue({
  Name: 'my-project',
  Version: '1.0.0',
  Runtime: 'Bun 1.3.5',
  Platform: 'macOS arm64',
})

// Or with array of pairs
seed.print.keyValue([
  { key: 'Name', value: 'my-project' },
  { key: 'Version', value: '1.0.0' },
])

Key-Value Options

OptionTypeDefaultDescription
separatorstring':'Key-value separator
keyColor(text: string) => stringColor function for keys
valueColor(text: string) => stringColor function for values
indentnumber0Left indentation

Divider

Print a horizontal line:

seed.print.divider()
seed.print.divider({ title: 'Section Title' })
seed.print.divider({ title: 'Config', char: '═', color: colors.cyan })

Divider Options

OptionTypeDefaultDescription
titlestringCentered title text
charstring'─'Line character
widthnumberterminal widthLine width
color(text: string) => stringColor function
paddingnumber1Padding around title

Progress Bar

Show progress for long-running tasks:

const progress = seed.print.progressBar({
  total: files.length,
  width: 40,
  format: 'Processing [:bar] :percent',
})

for (const file of files) {
  await processFile(file)
  progress.update(progress.current + 1)
}

progress.done()

Progress Bar Options

OptionTypeDefaultDescription
totalnumberTotal number of steps (required)
widthnumber30Bar width in characters
completestring'█'Filled character
incompletestring'░'Empty character
formatstringCustom format string

Progress Bar Methods

MethodDescription
update(current)Set progress to a specific value
done()Complete the progress bar

Formatting Helpers

indent(text, spaces?)

const { indent } = seed.print
console.log(indent('indented text', 4))
// "    indented text"

wrap(text, width?)

const { wrap } = seed.print
console.log(wrap(longParagraph, 80))

columns(items, options?)

Format items into columns:

const { columns } = seed.print
console.log(columns(
  ['deploy', 'init', 'build', 'test', 'lint'],
  { columns: 3, padding: 2 }
))

Column Options

OptionTypeDefaultDescription
widthnumberterminal widthTotal width
paddingnumber2Padding between columns
columnsnumberautoNumber of columns

On this page