MCP HubMCP Hub
스킬 목록으로 돌아가기

design-cli-output

pjt222
업데이트됨 2 days ago
6 조회
17
2
17
GitHub에서 보기
메타design

정보

이 스킬은 색상 텍스트, 상태 표시기, JSON을 포함한 다양한 상세도 수준과 같은 기능으로 CLI 터미널 출력을 설계하는 패턴을 제공합니다. 보고자 함수 아키텍처, 터미널 간 호환성, 일관된 내러티브 음성 유지 방법을 다룹니다. CLI 도구를 구축하거나 개선할 때 사람이 읽기 쉬우면서 기계가 파싱 가능한 출력을 표준화하기 위해 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/design-cli-output

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Design CLI Output

Consistent multi-level terminal output for CLI.

Use When

  • New reporter module → CLI
  • Warm/narrative alongside transactional
  • Std across commands
  • JSON machine parallel to human
  • Colors, glyphs, verbosity for new tool

In

  • Required: CLI name + audience (devs, ops, end users)
  • Required: Commands needing formatting
  • Optional: Ceremony/narrative variant?
  • Optional: Branding (palette, tone)

Do

Step 1: Color palette

chalk → named palette:

Standard (transactional):

let chalk;
try { chalk = (await import('chalk')).default; }
catch { chalk = new Proxy({}, { get: () => (s) => s }); }

// Status colors
const ok = chalk.green;       // success
const fail = chalk.red;       // errors
const warn = chalk.yellow;    // warnings
const info = chalk.cyan;      // identifiers, names
const dim = chalk.dim;        // secondary info, paths
const bold = chalk.bold;      // headers

Warm (ceremony/narrative):

const C = {
  flame: chalk.hex('#FF6B35'),   // active elements, fire
  amber: chalk.hex('#FFB347'),   // arriving items, warm highlights
  spark: chalk.hex('#FFF4E0'),   // individual items (sparks/skills)
  ember: chalk.hex('#8B4513'),   // cold/dormant states
  warm:  chalk.hex('#D4A574'),   // neutral warm text
  dim:   chalk.dim,              // background, secondary
  fail:  chalk.red,              // errors stay red (honest)
};

Rules:

  • No-color fallback (Proxy pattern)
  • Hex for custom (chalk.hex('#FF6B35'))
  • Fail/err → red regardless
  • Name by semantic role not visual

→ Palette obj w/ named entries + no-color fallback.

If err: chalk unavailable (piped, CI) → Proxy returns strings unchanged. Test NO_COLOR=1.

Step 2: Status indicators

Unicode glyphs or ASCII:

ASCII (max compat):

+  created/installed (green)
-  removed/deleted (red)
=  skipped/unchanged (dim)
!  error/warning (red)

Unicode (richer, UTF-8 term):

✦  item/skill/practice (spark)
◉  active/burning state
◎  cooling/embers state
○  cold/dormant state
◌  available/not installed
✗  failed item
✓  success (use sparingly — not all terminals render it well)

Criteria:

  • ASCII → CI/piped
  • Unicode → interactive
  • Both via --ascii flag or NO_COLOR
  • Test: macOS Terminal, Windows Terminal, VS Code, SSH

→ Glyph set communicates status at glance w/o color alone.

If err: Glyph renders ? or box → ASCII equiv. +/-/=/! works everywhere.

Step 3: Verbosity levels

Every cmd supports 4:

LevelFlagAudienceContent
Default(none)Human at terminalFormatted, colored, informative
Verbose--verbose or --ceremonialHuman wanting detailPer-item breakdown, arrival sequences
Quiet--quietScripts, CIMinimal lines, status icons, no decoration
JSON--jsonMachine consumersStructured, parseable, complete

Pattern:

function output(data, options) {
  if (options.json) {
    console.log(JSON.stringify(data, null, 2));
    return;
  }
  if (options.quiet) {
    for (const item of data.items) {
      const icon = item.ok ? '+' : '!';
      console.log(`${icon} ${item.id}`);
    }
    return;
  }
  // Default (or verbose) human output
  printFormatted(data, { verbose: options.verbose });
}

JSON rules:

  • Always valid (no mix w/ human text)
  • Include all human data + machine fields
  • Consistent keys across cmds
  • Exit 0 success, 1 err (regardless of mode)

→ 4 clear levels, consistent behavior across cmds.

If err: Verbose too noisy → opt-in (--ceremonial) not graduated.

Step 4: Voice rules

Tone + style. Prevents inconsistency.

Ex (campfire reporter):

  1. Present tense, active: "mystic arrives" not "mystic has been installed"
  2. No exclamation: Quiet confidence.
  3. Metaphor replaces jargon: "practices" not "dependencies" (ceremony only)
  4. Failures honest, not catastrophic: "A spark was lost" not "ERROR: installation failed with exit code 1"
  5. Closing line reflects state: Every op ends summary
  6. No emoji: Unicode glyphs carry visual weight w/o decorative
  7. Every word info: If no understanding → remove

Standard (non-ceremony):

  • Concise, factual lines
  • Status icon + item ID + ctx
  • Summary line w/ counts
  • Err msgs suggest actions

→ 3-7 voice rules output fns follow.

If err: Rules arbitrary → test. Write same output w/ + w/o rule. If no change → rule not needed.

Step 5: Reporter fns

Module w/ focused fns:

// reporter.js — standard output
export function printResults(results) { ... }
export function printItemTable(items) { ... }
export function printDetections(detections) { ... }
export function printAudit(auditResults) { ... }
export function printDryRun() { ... }
export function warn(msg) { ... }
export function error(msg) { ... }
export { chalk };

Each fn:

  1. Handle empty/null gracefully
  2. Compute layout (col widths, padding)
  3. Output w/ palette
  4. Summary line at bottom

Ceremony → separate module:

// campfire-reporter.js — warm narrative output
export function printArrival({ teamId, agents, results, ceremonial }) { ... }
export function printScatter({ teamId, agents, results }) { ... }
export function printTend(fires) { ... }
export function printCampfireList({ teams, state, reg }) { ... }
export function printFireSummary({ team, fireData, reg }) { ... }
export function printJson(data) { ... }

→ Independent fns, handle own formatting w/o caller state.

If err: Fn >~50 lines → extract helpers. Reviewable in isolation.

Step 6: Test across envs

# With colors (interactive terminal)
node cli/index.js list --domains

# Without colors (piped)
node cli/index.js list --domains | cat

# With NO_COLOR environment variable
NO_COLOR=1 node cli/index.js list --domains

# JSON mode (parseable)
node cli/index.js campfire --json | jq .

# In CI (typically no TTY)
CI=true node cli/index.js audit

Check:

  • Colors in interactive
  • No ANSI leaks in piped
  • JSON valid (jq .)
  • Unicode in target terminals
  • Col align w/ varying widths

→ Output correct in all 5 contexts.

If err: ANSI leaks → chalk respects NO_COLOR. Unicode breaks → ASCII fallback.

Check

  • Palette has no-color fallback
  • Status indicators work color + no-color
  • All 4 verbosity levels useful
  • JSON valid + jq-parseable
  • Voice rules docs + followed
  • Reporter fns handle empty/null
  • Tested: terminal, piped, NO_COLOR, CI

Traps

  • Mix human + JSON: --json only valid JSON. Stray line ("DRY RUN") breaks parsers. Suppress human in JSON mode.
  • Hardcoded col widths: Varies. Math.max(...items.map(i => i.id.length)) dyn.
  • Color w/o meaning: Color-only → colorblind + piped lose info. Pair w/ text (+, OK, ERR).
  • Ceremony wrong ctx: Interactive only. CI/scripts/--quiet = noise. Gate behind flags.
  • Forget summary: Users scan last line first. 1-line summary (counts).

  • scaffold-cli-command — cmds using this output
  • test-cli-application — test output matches
  • build-cli-plugin — plugins report results

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-ultra/skills/design-cli-output
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

content-collections

메타

이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.

스킬 보기

polymarket

메타

이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.

스킬 보기

creating-opencode-plugins

메타

이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.

스킬 보기

sglang

메타

SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.

스킬 보기