Half your users don't have eyes
Описание и применение
CLI‑инструменты часто выводят только читаемый человеком текст, что ломает скрипты и CI. Добавив флаг --output json и обернув результат в стабильный JSON‑контейнер, программы получают надёжный контракт, а человек‑читаемый вывод становится свободным для улучшений.
Задача
CLI tools often output only human‑readable text, breaking scripts, CI pipelines, and automation that rely on parsing that output.
Результат
Automated consumers no longer break when human output changes; scripts can reliably check status and extract data. Human output becomes more readable and maintainable.
Рабочий процесс
- 1. Add a
--outputflag to every command using the framework. - 2. When
--output jsonis requested, serialize the command result into aResponseenvelope. - 3. Scripts and CI jobs call the command with
--output jsonand parse the JSON payload. - 4. Human users run the command without the flag to see the friendly text.
- 5. Maintain the envelope shape across all commands to keep the contract stable.
Доказательства
The consumer-side payoff is the whole point. A script can check .status without ever touching .data.
Machines get a stable, explicit, learn-it-once contract; humans get output that's now free to be properly readable.
- Дата записи: 2026-09-20T11:15:23.153Z