@easbot/terminal 0.3.26 → 0.3.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.en.md +31 -19
  2. package/README.md +32 -19
  3. package/package.json +3 -3
package/README.en.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  > Terminal interaction toolkit — unified terminal output, formatting, prompts, and state recovery for the EASBOT ecosystem.
6
6
 
7
+ ## Version
8
+
9
+ v0.3.28
7
10
  ## Introduction
8
11
 
9
12
  `@easbot/terminal` is a terminal interaction toolkit for the EASBOT ecosystem. It encapsulates the common capabilities required by CLI / TUI scenarios: themed color output, ANSI handling, table rendering, command output formatting, styled prompts, JSON contract output, human-output helpers (`printHuman` / `renderLines`), a unified **interactive Prompt namespace**, an interactive searchable multi-select prompt, a readline-based CLI input helper, a lightweight markdown renderer, shared icon / status-symbol constants, a stateless Loader spinner, and terminal-state recovery. Every module auto-detects terminal capability (`NO_COLOR` / `FORCE_COLOR` / TTY) and degrades gracefully in non-TTY environments (pipes, redirected files, CI logs).
@@ -82,7 +85,12 @@ console.log(formatStatus('running', 'Building...'));
82
85
  ### Paths & hyperlinks
83
86
 
84
87
  ```typescript
85
- import { resolveUserPath, resolveConfigDir, displayPath, formatTerminalLink } from '@easbot/terminal';
88
+ import {
89
+ resolveUserPath,
90
+ resolveConfigDir,
91
+ displayPath,
92
+ formatTerminalLink,
93
+ } from '@easbot/terminal';
86
94
 
87
95
  const configDir = resolveConfigDir(); // ~/.config/easbot (or $EASBOT_STATE_DIR if set)
88
96
  console.log(displayPath(configDir));
@@ -123,14 +131,11 @@ console.log(
123
131
  import { printHuman, renderLines } from '@easbot/terminal';
124
132
 
125
133
  // The canonical "grouped detail + summary + outro" page
126
- printHuman(
127
- [' ✓ eas-agent-creation', ' ✓ eas-agent-evolution', ' ✗ eas-legacy-tool'],
128
- {
129
- title: 'Project Skills Update',
130
- outro: 'Run `easbot skills list` to see current state.',
131
- empty: 'No skills tracked in lock file.',
132
- },
133
- );
134
+ printHuman([' ✓ eas-agent-creation', ' ✓ eas-agent-evolution', ' ✗ eas-legacy-tool'], {
135
+ title: 'Project Skills Update',
136
+ outro: 'Run `easbot skills list` to see current state.',
137
+ empty: 'No skills tracked in lock file.',
138
+ });
134
139
 
135
140
  // renderLines: build a grouped tree (list / find / store-list style)
136
141
  const lines = renderLines({
@@ -178,7 +183,10 @@ const selected = await Prompt.multiselect({
178
183
  const skills = await Prompt.groupMultiselect({
179
184
  message: 'Pick the skills to install',
180
185
  options: {
181
- General: [{ value: 'foo', label: 'foo' }, { value: 'bar', label: 'bar' }],
186
+ General: [
187
+ { value: 'foo', label: 'foo' },
188
+ { value: 'bar', label: 'bar' },
189
+ ],
182
190
  'Advanced Plugins': [{ value: 'baz', label: 'baz' }],
183
191
  },
184
192
  });
@@ -324,7 +332,11 @@ Keyboard shortcuts: `↑↓ ←→` move · `PageUp/Down` page · `Home/End` jum
324
332
  ### Safe stream writes & state recovery
325
333
 
326
334
  ```typescript
327
- import { createSafeStreamWriter, restoreTerminalState, registerActiveProgressLine } from '@easbot/terminal';
335
+ import {
336
+ createSafeStreamWriter,
337
+ restoreTerminalState,
338
+ registerActiveProgressLine,
339
+ } from '@easbot/terminal';
328
340
 
329
341
  const writer = createSafeStreamWriter();
330
342
  registerActiveProgressLine(process.stdout);
@@ -503,14 +515,14 @@ The single recommended entry point for business code. Details in the "Prompt nam
503
515
 
504
516
  ## Environment Variables
505
517
 
506
- | Variable | Description |
507
- |----------|-------------|
508
- | `NO_COLOR` | Disables colors when set (unless `FORCE_COLOR` is also set) — see [no-color.org](https://no-color.org/) |
509
- | `FORCE_COLOR` | Forces colors when non-empty and not equal to `'0'` |
510
- | `HOME` / `USERPROFILE` | Fallback sources for home directory resolution |
511
- | `EASBOT_TEST_HOME` | **Test-only** highest-priority home override (highest priority; see `home-dir.ts`) |
512
- | `EASBOT_HOME` | Explicit override for the home directory; changes the display prefix from `~` to `$EASBOT_HOME` |
513
- | `EASBOT_STATE_DIR` | Override the resolved config directory |
518
+ | Variable | Description |
519
+ | ---------------------- | ------------------------------------------------------------------------------------------------------- |
520
+ | `NO_COLOR` | Disables colors when set (unless `FORCE_COLOR` is also set) — see [no-color.org](https://no-color.org/) |
521
+ | `FORCE_COLOR` | Forces colors when non-empty and not equal to `'0'` |
522
+ | `HOME` / `USERPROFILE` | Fallback sources for home directory resolution |
523
+ | `EASBOT_TEST_HOME` | **Test-only** highest-priority home override (highest priority; see `home-dir.ts`) |
524
+ | `EASBOT_HOME` | Explicit override for the home directory; changes the display prefix from `~` to `$EASBOT_HOME` |
525
+ | `EASBOT_STATE_DIR` | Override the resolved config directory |
514
526
 
515
527
  **Home resolution order (highest to lowest):**
516
528
  `EASBOT_TEST_HOME` → `EASBOT_HOME` → `HOME` → `USERPROFILE` → `os.homedir()`.
package/README.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  > 终端交互工具库 — 为 EASBOT 生态提供统一的终端输出、格式化、提示、Prompt 与状态恢复能力。
6
6
 
7
+ ## 版本
8
+
9
+ v0.3.28
7
10
  ## 简介
8
11
 
9
12
  `@easbot/terminal` 是一个面向 EASBOT 生态的终端交互工具库,封装了命令行 / TUI 场景下常用的能力:终端主题色、ANSI 处理、表格渲染、命令输出格式化、提示样式化、JSON 规范输出、人类输出统一封装(`printHuman` / `renderLines`)、一个**统一的交互式 Prompt namespace**、一个**可搜索的多选交互 prompt**、一个**CLI 输入 helper**、一个**轻量级 markdown 渲染器**、图标 / 状态符号统一常量、Loader 旋转动画、终端状态恢复等。所有能力都基于终端能力自动检测(`NO_COLOR` / `FORCE_COLOR` / TTY)进行降级,可在管道、文件重定向等非 TTY 场景下安全使用。
@@ -82,7 +85,12 @@ console.log(formatStatus('running', '正在执行构建...'));
82
85
  ### 路径与超链接
83
86
 
84
87
  ```typescript
85
- import { resolveUserPath, resolveConfigDir, displayPath, formatTerminalLink } from '@easbot/terminal';
88
+ import {
89
+ resolveUserPath,
90
+ resolveConfigDir,
91
+ displayPath,
92
+ formatTerminalLink,
93
+ } from '@easbot/terminal';
86
94
 
87
95
  const configDir = resolveConfigDir(); // ~/.config/easbot(如设了 EASBOT_STATE_DIR 则用之)
88
96
  console.log(displayPath(configDir));
@@ -123,14 +131,11 @@ console.log(
123
131
  import { printHuman, renderLines } from '@easbot/terminal';
124
132
 
125
133
  // 业务侧常见的"分组细节 + 总结 + outro"一页输出
126
- printHuman(
127
- [' ✓ eas-agent-creation', ' ✓ eas-agent-evolution', ' ✗ eas-legacy-tool'],
128
- {
129
- title: 'Project Skills Update',
130
- outro: 'Run `easbot skills list` to see current state.',
131
- empty: 'No skills tracked in lock file.',
132
- },
133
- );
134
+ printHuman([' ✓ eas-agent-creation', ' ✓ eas-agent-evolution', ' ✗ eas-legacy-tool'], {
135
+ title: 'Project Skills Update',
136
+ outro: 'Run `easbot skills list` to see current state.',
137
+ empty: 'No skills tracked in lock file.',
138
+ });
134
139
 
135
140
  // renderLines:构造 list / find 风格的分组树状
136
141
  const lines = renderLines({
@@ -178,7 +183,10 @@ const selected = await Prompt.multiselect({
178
183
  const skills = await Prompt.groupMultiselect({
179
184
  message: '选择要安装的技能',
180
185
  options: {
181
- General: [{ value: 'foo', label: 'foo' }, { value: 'bar', label: 'bar' }],
186
+ General: [
187
+ { value: 'foo', label: 'foo' },
188
+ { value: 'bar', label: 'bar' },
189
+ ],
182
190
  'Advanced Plugins': [{ value: 'baz', label: 'baz' }],
183
191
  },
184
192
  });
@@ -205,6 +213,7 @@ spinner.stop(`Found ${count} skill(s)`);
205
213
  ```
206
214
 
207
215
  **取消语义收口**:
216
+
208
217
  - `Prompt.cancelSymbol` —— 唯一 sentinel(与 `Search.cancelSymbol` 同引用)
209
218
  - `Prompt.isCancel(value)` —— 类型守卫,同时识别 `Prompt.cancelSymbol` 与 clack 的 `Symbol('')`
210
219
  - `Prompt.cancel(message?)` —— `never` 返回 + 内置 `process.exit(0)`
@@ -323,7 +332,11 @@ if (result === cancelSymbol) return;
323
332
  ### 安全流写入与状态恢复
324
333
 
325
334
  ```typescript
326
- import { createSafeStreamWriter, restoreTerminalState, registerActiveProgressLine } from '@easbot/terminal';
335
+ import {
336
+ createSafeStreamWriter,
337
+ restoreTerminalState,
338
+ registerActiveProgressLine,
339
+ } from '@easbot/terminal';
327
340
 
328
341
  const writer = createSafeStreamWriter();
329
342
  registerActiveProgressLine(process.stdout);
@@ -493,14 +506,14 @@ emitJsonError('E_NOT_FOUND', '资源不存在');
493
506
 
494
507
  ## 环境变量
495
508
 
496
- | 变量 | 作用 |
497
- |------|------|
498
- | `NO_COLOR` | 存在时禁用终端颜色(除非同时设置了 `FORCE_COLOR`),遵循 [no-color.org](https://no-color.org/) 规范 |
499
- | `FORCE_COLOR` | 非空且不为 `'0'` 时强制启用颜色 |
500
- | `HOME` / `USERPROFILE` | 主目录解析的备选来源(OS 默认值) |
501
- | `EASBOT_TEST_HOME` | **测试专用** 最高优先级的主目录覆盖(详见 `home-dir.ts`) |
502
- | `EASBOT_HOME` | 显式指定主目录;设置后路径显示前缀由 `~` 切换为 `$EASBOT_HOME` |
503
- | `EASBOT_STATE_DIR` | 配置目录覆盖项 |
509
+ | 变量 | 作用 |
510
+ | ---------------------- | --------------------------------------------------------------------------------------------------- |
511
+ | `NO_COLOR` | 存在时禁用终端颜色(除非同时设置了 `FORCE_COLOR`),遵循 [no-color.org](https://no-color.org/) 规范 |
512
+ | `FORCE_COLOR` | 非空且不为 `'0'` 时强制启用颜色 |
513
+ | `HOME` / `USERPROFILE` | 主目录解析的备选来源(OS 默认值) |
514
+ | `EASBOT_TEST_HOME` | **测试专用** 最高优先级的主目录覆盖(详见 `home-dir.ts`) |
515
+ | `EASBOT_HOME` | 显式指定主目录;设置后路径显示前缀由 `~` 切换为 `$EASBOT_HOME` |
516
+ | `EASBOT_STATE_DIR` | 配置目录覆盖项 |
504
517
 
505
518
  **主目录解析顺序(高 → 低)**:
506
519
  `EASBOT_TEST_HOME` → `EASBOT_HOME` → `HOME` → `USERPROFILE` → `os.homedir()`。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easbot/terminal",
3
- "version": "0.3.26",
3
+ "version": "0.3.28",
4
4
  "description": "Terminal interaction toolkit for the EASBOT ecosystem — themed colors, ANSI utilities, OSC-8 hyperlinks, command formatting, table rendering, styled prompts, safe stream writes, and terminal-state recovery",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -47,8 +47,8 @@
47
47
  "dependencies": {
48
48
  "@clack/prompts": "^1.7.0",
49
49
  "chalk": "^6.0.0",
50
- "@easbot/types": "0.3.26",
51
- "@easbot/utils": "0.3.26"
50
+ "@easbot/types": "0.3.28",
51
+ "@easbot/utils": "0.3.28"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^25.9.5",