@nbtca/prompt 1.0.0 → 1.0.3

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.
@@ -0,0 +1,25 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(gh pr create:*)",
5
+ "Bash(gh release:*)",
6
+ "Bash(npm whoami:*)",
7
+ "Bash(git fetch:*)",
8
+ "Bash(git pull:*)",
9
+ "Bash(Jump: g/G)",
10
+ "Bash(npm run build:*)",
11
+ "Bash(git add:*)",
12
+ "Bash(git commit -m \"$(cat <<''EOF''\nfix: correct version display in application\n\nPrevious commit bumped package.json to 1.0.2 but missed updating the version in the application code itself, causing the UI to still display 1.0.0.\nEOF\n)\")",
13
+ "Bash(git tag:*)",
14
+ "Bash(git push:*)",
15
+ "Bash(npm publish:*)",
16
+ "Bash(npm view:*)",
17
+ "Bash(npm unpublish:*)",
18
+ "Bash(npm config:*)",
19
+ "Bash(tee:*)",
20
+ "Bash(npm cache clean:*)"
21
+ ],
22
+ "deny": [],
23
+ "ask": []
24
+ }
25
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,77 @@
1
+ # CHANGELOG
2
+
3
+ ## [1.0.2] - 2025-11-27
4
+
5
+ ### Added
6
+ - **Terminal Documentation Viewer**: Browse and read Markdown documentation from nbtca/documents repository directly in terminal
7
+ - GitHub API integration for fetching directory structure and file contents
8
+ - Recursive directory navigation with [DIR] and [MD] indicators
9
+ - VitePress syntax cleaning (frontmatter, containers, [[toc]], HTML comments)
10
+ - Terminal Markdown rendering using marked-terminal
11
+ - Browser fallback on network errors or user preference
12
+ - Retry mechanism for failed network requests
13
+
14
+ ### Changed
15
+ - **ASCII-Only Interface**: Removed all emoji icons for maximum terminal compatibility
16
+ - Replaced emoji with ASCII symbols: [*], [?], [x], [..], [DIR], [MD], [ <], [ ^], [ *]
17
+ - Works on all terminal emulators, SSH sessions, tmux, and legacy systems
18
+ - Follows Unix/Linux terminal conventions
19
+ - Professional, minimalist design
20
+
21
+ ### Improved
22
+ - **Terminal UX Enhancements**:
23
+ - Added keybinding hints to main menu: "Navigation: j/k or ↑/↓ | Jump: g/G | Quit: q or Ctrl+C"
24
+ - Added ESC key infrastructure for future back navigation and operation cancellation
25
+ - Standardized navigation symbols across all menus
26
+ - Better vim-keys.ts documentation with clearer comments
27
+
28
+ ### Fixed
29
+ - **Development Workflow**: Fixed `pnpm run dev` auto-restart issue
30
+ - Split dev command: `dev` (no watch, for interactive CLI) and `dev:watch` (with watch mode)
31
+ - Proper exit behavior for interactive CLI testing
32
+
33
+ ### Documentation
34
+ - Added DEVELOPMENT.md: Comprehensive development guide with workflows, testing methods, and common issues
35
+ - Added TERMINAL_UX.md: Terminal UX improvements and compatibility documentation
36
+ - Updated README.md: Professional, concise documentation without decorative elements
37
+
38
+ ### Technical Details
39
+ - Enhanced docs.ts with GitHub repository integration
40
+ - Improved menu.ts with ASCII symbols and keybinding hints
41
+ - Enhanced vim-keys.ts with ESC support and better documentation
42
+ - Better package.json scripts for development workflow
43
+
44
+ ## [1.0.1] - 2025-11-21
45
+
46
+ ### Added
47
+ - New English tagline with smooth blue gradient animation
48
+ - Full Vim keybindings support (j/k/g/G/q)
49
+ - Minimalist UI design inspired by Claude Code CLI
50
+
51
+ ### Improved
52
+ - Smoother gradient animation (24 frames, 1.2s duration)
53
+ - Removed keyboard instruction text for cleaner interface
54
+ - Blue color scheme throughout (deep blue → sky blue → cyan)
55
+
56
+ ### Changed
57
+ - q key now exits the application
58
+ - Removed Chinese tagline
59
+ - Simplified menu layout
60
+
61
+ ### Removed
62
+ - Unused DATA_MANAGEMENT.md documentation
63
+
64
+ ### Dependencies
65
+ - Updated gradient-string to ^3.0.0
66
+ - Updated @inquirer/prompts to ^8.0.3
67
+
68
+ ## [1.0.0] - 2025-11-21
69
+
70
+ ### Added
71
+ - Initial release of NBTCA Prompt CLI tool
72
+ - Interactive terminal menu system
73
+ - Event calendar integration
74
+ - Repair service information
75
+ - Knowledge base access
76
+ - Quick links to official website and GitHub
77
+ - About section with project information
package/DEVELOPMENT.md ADDED
@@ -0,0 +1,258 @@
1
+ # 开发指南
2
+
3
+ ## 🚀 快速开始
4
+
5
+ ### 安装依赖
6
+
7
+ ```bash
8
+ pnpm install
9
+ ```
10
+
11
+ ## 🧪 本地测试方法
12
+
13
+ ### ✅ 方法 1: 快速测试(推荐)
14
+
15
+ ```bash
16
+ pnpm run dev
17
+ ```
18
+
19
+ - ✅ 直接运行 TypeScript 源码
20
+ - ✅ 不会自动重启
21
+ - ✅ 适合交互式 CLI 测试
22
+ - ✅ 程序退出后命令才结束
23
+ - ✅ 可以正常使用 Ctrl+C 退出
24
+
25
+ **使用场景**: 日常开发和功能测试
26
+
27
+ ### 📦 方法 2: 生产环境测试
28
+
29
+ ```bash
30
+ # 步骤 1: 构建
31
+ pnpm run build
32
+
33
+ # 步骤 2: 运行
34
+ pnpm start
35
+ ```
36
+
37
+ - ✅ 测试编译后的代码
38
+ - ✅ 最接近生产环境
39
+ - ⚠️ 修改代码后需要重新构建
40
+
41
+ **使用场景**: 发布前最终测试
42
+
43
+ ### 🔗 方法 3: 全局命令测试
44
+
45
+ ```bash
46
+ # 步骤 1: 构建并链接到全局
47
+ pnpm run build
48
+ npm link
49
+
50
+ # 步骤 2: 在任何目录测试
51
+ nbtca
52
+
53
+ # 步骤 3: 测试完成后清理
54
+ npm unlink -g @nbtca/prompt
55
+ ```
56
+
57
+ **使用场景**: 测试全局安装体验
58
+
59
+ ### ⚠️ 方法 4: 监听模式(不推荐用于交互式测试)
60
+
61
+ ```bash
62
+ pnpm run dev:watch
63
+ ```
64
+
65
+ - ⚠️ 文件变化时自动重启
66
+ - ❌ 不适合交互式 CLI 测试
67
+ - ❌ 会频繁中断交互
68
+ - ✅ 仅适合纯函数/工具类开发
69
+
70
+ **使用场景**: 仅用于调试非交互式代码
71
+
72
+ ## 🎯 测试新功能(知识库模块)
73
+
74
+ ### 测试步骤
75
+
76
+ 1. **启动程序**
77
+ ```bash
78
+ pnpm run dev
79
+ ```
80
+
81
+ 2. **选择 "知识库" 选项**
82
+ - 使用方向键或 Vim 键位 (j/k) 导航
83
+ - 按 Enter 确认
84
+
85
+ 3. **浏览文档分类**
86
+ - 📚 教程 (Tutorial)
87
+ - 🔧 维修日
88
+ - 🎉 相关活动举办
89
+ - 📋 流程文档 (Process)
90
+ - 🛠️ 维修相关 (Repair)
91
+ - 📦 归档文档 (Archived)
92
+ - 📖 README
93
+
94
+ 4. **测试功能点**
95
+ - [ ] 进入目录
96
+ - [ ] 返回上级目录
97
+ - [ ] 查看 Markdown 文件
98
+ - [ ] 终端渲染是否正常
99
+ - [ ] 在浏览器中打开
100
+ - [ ] 网络错误处理
101
+
102
+ ### 预期行为
103
+
104
+ ✅ **正常流程**:
105
+ 1. 从 GitHub 获取文档列表
106
+ 2. 显示目录树
107
+ 3. 选择文件后在终端渲染 Markdown
108
+ 4. 提供返回或浏览器打开选项
109
+
110
+ ✅ **错误处理**:
111
+ 1. GitHub API 失败时提示重试
112
+ 2. 文件加载失败时建议浏览器打开
113
+ 3. 网络超时友好提示
114
+
115
+ ## 🔧 常见问题
116
+
117
+ ### Q1: 为什么 `pnpm run dev` 比 `pnpm run dev:watch` 好?
118
+
119
+ **A**: 对于交互式 CLI 应用:
120
+
121
+ - `pnpm run dev` (tsx src/index.ts)
122
+ - ✅ 运行一次,等待程序退出
123
+ - ✅ 用户可以正常交互
124
+ - ✅ Ctrl+C 正常工作
125
+
126
+ - `pnpm run dev:watch` (tsx watch src/index.ts)
127
+ - ❌ 监听文件变化,自动重启
128
+ - ❌ 用户操作会被中断
129
+ - ❌ Ctrl+C 只能退出 tsx,不能优雅退出程序
130
+
131
+ ### Q2: 如何退出正在运行的程序?
132
+
133
+ **A**:
134
+ - **正常退出**: 在菜单中选择 "退出" 选项
135
+ - **强制退出**: 按 `Ctrl+C`
136
+ - 如果卡住: 按 `Ctrl+C` 两次
137
+
138
+ ### Q3: 修改代码后看不到变化?
139
+
140
+ **A**: 取决于你的测试方法:
141
+ - `pnpm run dev`: 重新运行命令即可
142
+ - `pnpm start`: 需要先 `pnpm run build`
143
+ - `npm link`: 需要 `pnpm run build` 后重新测试
144
+
145
+ ### Q4: TypeScript 编译错误怎么办?
146
+
147
+ **A**:
148
+ ```bash
149
+ # 检查类型错误
150
+ pnpm run build
151
+
152
+ # 如果有错误,根据提示修复
153
+ # 常见错误:
154
+ # - 导入路径缺少 .js 后缀
155
+ # - 类型定义不匹配
156
+ # - 未使用的变量
157
+ ```
158
+
159
+ ## 📝 开发工作流
160
+
161
+ ### 日常开发
162
+
163
+ ```bash
164
+ # 1. 修改代码
165
+ vim src/features/docs.ts
166
+
167
+ # 2. 测试
168
+ pnpm run dev
169
+
170
+ # 3. 重复 1-2 直到功能完成
171
+ ```
172
+
173
+ ### 提交前检查
174
+
175
+ ```bash
176
+ # 1. 确保构建通过
177
+ pnpm run build
178
+
179
+ # 2. 测试编译后的代码
180
+ pnpm start
181
+
182
+ # 3. 提交
183
+ git add .
184
+ git commit -m "feat: add terminal docs viewer"
185
+ ```
186
+
187
+ ### 发布前测试
188
+
189
+ ```bash
190
+ # 1. 构建
191
+ pnpm run build
192
+
193
+ # 2. 全局测试
194
+ npm link
195
+ nbtca
196
+
197
+ # 3. 清理
198
+ npm unlink -g @nbtca/prompt
199
+ ```
200
+
201
+ ## 🎨 代码规范
202
+
203
+ - 使用 TypeScript 严格模式
204
+ - 函数添加 JSDoc 注释
205
+ - 导入模块使用 `.js` 后缀(即使是 `.ts` 文件)
206
+ - 保持代码简洁,避免过度抽象
207
+
208
+ ## 📂 项目结构
209
+
210
+ ```
211
+ src/
212
+ ├── config/ # 配置常量
213
+ │ ├── data.ts # URL、应用信息
214
+ │ └── theme.ts # 颜色主题
215
+
216
+ ├── core/ # 核心功能
217
+ │ ├── logo.ts # Logo 显示
218
+ │ ├── menu.ts # 主菜单
219
+ │ ├── ui.ts # UI 组件
220
+ │ └── vim-keys.ts # Vim 键位支持
221
+
222
+ ├── features/ # 功能模块
223
+ │ ├── calendar.ts # 活动日历
224
+ │ ├── docs.ts # 知识库 ⭐ 新功能
225
+ │ ├── repair.ts # 维修服务
226
+ │ └── website.ts # 网站访问
227
+
228
+ ├── logo/ # Logo 资源
229
+ ├── index.ts # 入口
230
+ ├── main.ts # 主逻辑
231
+ └── types.ts # 类型定义
232
+ ```
233
+
234
+ ## 🌟 新功能说明
235
+
236
+ ### 知识库终端查看器
237
+
238
+ **文件**: `src/features/docs.ts`
239
+
240
+ **核心功能**:
241
+ 1. `fetchGitHubDirectory()` - 从 GitHub API 获取目录
242
+ 2. `fetchGitHubRawContent()` - 获取文件原始内容
243
+ 3. `browseDirectory()` - 交互式目录浏览
244
+ 4. `viewMarkdownFile()` - 终端渲染 Markdown
245
+ 5. `showDocsMenu()` - 主菜单入口
246
+
247
+ **依赖**:
248
+ - `axios` - HTTP 请求
249
+ - `marked` + `marked-terminal` - Markdown 渲染
250
+ - `inquirer` - 交互式选择
251
+ - `chalk` - 终端颜色
252
+
253
+ **测试要点**:
254
+ - [ ] GitHub API 正常调用
255
+ - [ ] 目录树正确显示
256
+ - [ ] Markdown 渲染美观
257
+ - [ ] 错误处理友好
258
+ - [ ] 导航流畅
@@ -0,0 +1,27 @@
1
+ Prompt Wiki
2
+
3
+ ## Memo
4
+
5
+ NBTCA support bunch of services since latest contribution from party members.
6
+
7
+ - Blog about active and skills
8
+
9
+ - NBTCA Calendar and notification
10
+
11
+ - Repair service
12
+
13
+ - Tech support
14
+
15
+ - Open source code of service support applications
16
+
17
+ - Docs of archive
18
+
19
+ - Minecraft server
20
+
21
+ Design purpose
22
+
23
+ - Build multi-independent tools and each tool focus one thing
24
+
25
+ - K.I.S.S. (keep it simple stupid)
26
+
27
+ - Gather tools to construct interactive service