@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.
package/README.md CHANGED
@@ -1,235 +1,231 @@
1
- # NBTCA Welcome v2.3.0
1
+ # NBTCA Prompt
2
2
 
3
- ![Demo](assets/Prompt_demo.gif)
3
+ Terminal-based information system for NingboTech Computer Association.
4
4
 
5
- > 为浙大宁波理工学院计算机协会打造的专业欢迎工具
5
+ [![npm version](https://img.shields.io/npm/v/@nbtca/prompt)](https://www.npmjs.com/package/@nbtca/prompt)
6
+ [![License](https://img.shields.io/npm/l/@nbtca/prompt)](LICENSE)
6
7
 
7
- ## ✨ 新功能特性
8
+ ## Overview
8
9
 
9
- ### 🎨 增强的视觉效果
10
+ NBTCA Prompt is a minimalist command-line interface tool designed for the Computer Association of Zhejiang University Ningbo Institute of Technology. It provides quick access to association resources, events, and documentation directly from the terminal.
10
11
 
11
- - **多种动画效果**: 彩虹、波浪、脉冲、打字机等动画
12
- - **渐变文字**: 支持多种颜色渐变效果
13
- - **加载动画**: 自定义加载动画和进度条
14
- - **系统信息显示**: 实时显示系统状态和性能
12
+ ## Features
15
13
 
16
- ### 🚀 丰富的交互体验
14
+ - View upcoming association events (30-day calendar)
15
+ - Access repair service information
16
+ - Browse technical documentation from terminal
17
+ - Quick links to official website and GitHub
18
+ - Minimalist design with maximum terminal compatibility
17
19
 
18
- - **分类菜单**: 官方网站、技术支持、学习资源、社区交流等
19
- - **子菜单系统**: 每个分类都有详细的子菜单
20
- - **确认对话框**: 重要操作前的确认提示
21
- - **输入提示**: 支持文本和密码输入
20
+ ## Installation
22
21
 
23
- ### 📊 系统监控
22
+ ### Global Installation
24
23
 
25
- - **实时系统信息**: CPU、内存、平台信息
26
- - **网络状态**: 连接状态和服务可用性
27
- - **性能指标**: 系统性能评估和建议
24
+ ```bash
25
+ npm install -g @nbtca/prompt
26
+ ```
28
27
 
29
- ### 🔧 技术支持服务
28
+ ### Using npx (No Installation Required)
30
29
 
31
- - **电脑维修**: 硬件和软件问题解决
32
- - **网络配置**: 网络连接和配置服务
33
- - **移动设备**: 手机和平板电脑支持
34
- - **服务预约**: 在线预约系统
30
+ ```bash
31
+ npx @nbtca/prompt
32
+ ```
35
33
 
36
- ## 🚀 快速开始
34
+ ## Usage
37
35
 
38
- ### 安装
36
+ Run the program with:
39
37
 
40
38
  ```bash
41
- npm install @nbtca/welcome
39
+ nbtca
42
40
  ```
43
41
 
44
- ### 使用
42
+ Navigate using arrow keys or Vim bindings (j/k/g/G).
43
+
44
+ ## Development
45
+
46
+ ### Prerequisites
47
+
48
+ - Node.js >= 16.0.0
49
+
50
+ ### Setup
45
51
 
46
52
  ```bash
47
- # 推荐方式
48
- npx @nbtca/welcome
53
+ git clone https://github.com/nbtca/prompt.git
54
+ cd prompt
55
+ pnpm install
56
+ ```
49
57
 
50
- # 或本地运行
51
- npm start
58
+ ### Development Workflow
52
59
 
53
- # 开发模式(自动重启)
54
- npm run dev
60
+ #### Quick Testing (Recommended)
61
+
62
+ ```bash
63
+ pnpm run dev
55
64
  ```
56
65
 
57
- ## 📁 项目结构
66
+ Runs TypeScript source directly without auto-restart. Exit with menu option or Ctrl+C.
58
67
 
68
+ #### Watch Mode (File Changes)
69
+
70
+ ```bash
71
+ pnpm run dev:watch
59
72
  ```
60
- .
61
- ├── bin/
62
- │ └── nbtca-welcome.js # CLI 入口点
63
- ├── src/
64
- │ ├── index.js # 主入口文件
65
- │ ├── main.js # 核心应用逻辑
66
- │ ├── logo/ # ASCII Logo 相关
67
- │ │ ├── printLogo.js
68
- │ │ └── logo.txt # 终端图像数据
69
- │ ├── gradient/ # 渐变文字效果
70
- │ │ └── printGradientText.js
71
- │ ├── animation/ # 动画效果
72
- │ │ ├── printLolcatAnimated.js
73
- │ │ └── loadingAnimation.js
74
- │ ├── ui/ # 用户界面组件
75
- │ │ ├── welcomeBanner.js
76
- │ │ └── systemInfo.js
77
- │ └── menu/ # 交互菜单
78
- │ ├── showMainMenu.js
79
- │ ├── handleUserAction.js
80
- │ └── subMenu.js
81
- ├── assets/
82
- │ └── Prompt_demo.gif # 演示动画
83
- └── package.json
73
+
74
+ Auto-restarts on file changes. Not recommended for interactive testing.
75
+
76
+ #### Production Build
77
+
78
+ ```bash
79
+ pnpm run build
80
+ pnpm start
84
81
  ```
85
82
 
86
- ## 🎯 主要功能
83
+ ### Available Commands
87
84
 
88
- ### 🌐 官方网站服务
85
+ ```bash
86
+ pnpm run dev # Run TypeScript source directly
87
+ pnpm run dev:watch # Run with file watching
88
+ pnpm run build # Compile TypeScript to JavaScript
89
+ pnpm start # Run compiled code
90
+ pnpm run clean # Remove dist directory
91
+ ```
89
92
 
90
- - 🏠 官方网站主页
91
- - 📰 新闻资讯
92
- - 📅 活动日历
93
- - 👥 团队介绍
94
- - 📞 联系我们
93
+ ## Project Structure
95
94
 
96
- ### 🔧 技术支持服务
95
+ ```
96
+ src/
97
+ ├── config/ # Configuration constants
98
+ │ ├── data.ts # URLs and app info
99
+ │ └── theme.ts # Color themes
100
+ ├── core/ # Core functionality
101
+ │ ├── logo.ts # Logo display logic
102
+ │ ├── menu.ts # Main menu system
103
+ │ ├── ui.ts # UI components
104
+ │ └── vim-keys.ts # Vim key bindings
105
+ ├── features/ # Feature modules
106
+ │ ├── calendar.ts # Event calendar
107
+ │ ├── docs.ts # Documentation viewer
108
+ │ ├── repair.ts # Repair service
109
+ │ └── website.ts # Website links
110
+ └── main.ts # Application entry point
111
+ ```
97
112
 
98
- - 💻 电脑硬件维修
99
- - 🔧 软件问题解决
100
- - 🌐 网络配置服务
101
- - 📱 移动设备支持
102
- - 🛠️ 硬件升级咨询
103
- - 📋 服务预约
113
+ ## Technology Stack
104
114
 
105
- ### 📚 学习资源中心
115
+ ### Core Dependencies
106
116
 
107
- - 📚 技术文档
108
- - 🎥 视频教程
109
- - 💡 编程学习
110
- - 🎨 设计资源
111
- - 🔬 学术研究
112
- - 📖 推荐书籍
117
+ - axios - HTTP requests
118
+ - ical.js - ICS calendar parsing
119
+ - marked + marked-terminal - Markdown rendering
120
+ - chalk - Terminal colors
121
+ - inquirer - Interactive prompts
122
+ - open - Browser integration
113
123
 
114
- ### 👥 社区交流
124
+ ### Development Dependencies
115
125
 
116
- - 💬 技术交流群
117
- - 📢 官方QQ群
118
- - 🐙 GitHub组织
119
- - 📱 微信公众号
120
- - 🎯 项目合作
121
- - 🏆 竞赛信息
126
+ - TypeScript 5.3+
127
+ - tsx - TypeScript execution
128
+ - @types/* - Type definitions
122
129
 
123
- ### ⚙️ 系统设置
130
+ ## Documentation Viewer
124
131
 
125
- - 🎨 主题设置
126
- - 🌐 网络配置
127
- - 📊 性能监控
128
- - 🔔 通知设置
129
- - 🔄 检查更新
132
+ The knowledge base viewer features:
130
133
 
131
- ## 🛠️ 技术栈
134
+ - Direct GitHub repository access
135
+ - VitePress syntax cleaning
136
+ - Terminal Markdown rendering
137
+ - Browser fallback option
138
+ - Directory tree navigation
132
139
 
133
- - **Node.js** (ES Modules)
134
- - **inquirer** - 交互式命令行界面
135
- - **chalk** - 终端颜色输出
136
- - **isomorphic-lolcat** - 彩虹色动画效果
137
- - **open** - 打开系统默认浏览器
138
- - **boxen** - 创建边框效果
140
+ ### Supported Formats
139
141
 
140
- ## 🎨 动画效果
142
+ - Standard Markdown
143
+ - VitePress frontmatter (auto-removed)
144
+ - VitePress containers (auto-converted)
145
+ - Table of contents (placeholder in terminal)
141
146
 
142
- ### 彩虹动画
147
+ ## Terminal Compatibility
143
148
 
144
- ```javascript
145
- await printLolcatAnimated("Hello World!", {
146
- duration: 2000,
147
- fps: 30,
148
- effect: "rainbow",
149
- });
150
- ```
149
+ Designed for maximum compatibility with:
151
150
 
152
- ### 波浪动画
151
+ - Modern terminals (iTerm2, Windows Terminal, GNOME Terminal)
152
+ - Legacy terminals (xterm, Terminal.app)
153
+ - SSH sessions
154
+ - Screen/tmux multiplexers
153
155
 
154
- ```javascript
155
- await printLolcatAnimated("Hello World!", {
156
- effect: "wave",
157
- });
158
- ```
156
+ ASCII-based UI elements ensure rendering on any terminal emulator.
159
157
 
160
- ### 脉冲动画
158
+ ## System Requirements
161
159
 
162
- ```javascript
163
- await printLolcatAnimated("Hello World!", {
164
- effect: "pulse",
165
- });
166
- ```
160
+ - Node.js: >= 16.0.0
161
+ - OS: Windows, macOS, Linux
162
+ - Terminal: ANSI escape sequence support
167
163
 
168
- ### 打字机效果
164
+ ## Common Issues
169
165
 
170
- ```javascript
171
- await printLolcatAnimated("Hello World!", {
172
- effect: "typewriter",
173
- });
174
- ```
166
+ ### Q: Auto-restart when using `pnpm run dev:watch`?
175
167
 
176
- ## 📊 系统要求
168
+ A: This is expected behavior. Use `pnpm run dev` for interactive testing.
177
169
 
178
- - **Node.js**: >= 16.0.0
179
- - **操作系统**: Windows, macOS, Linux
180
- - **终端**: 支持 ANSI 转义序列的终端
170
+ ### Q: How to exit the program?
181
171
 
182
- ## 🔧 开发
172
+ A: Select the Exit option from menu, or press Ctrl+C.
183
173
 
184
- ### 安装依赖
174
+ ### Q: Changes not reflected?
185
175
 
186
- ```bash
187
- npm install
188
- ```
176
+ A: If using `pnpm start`, rebuild with `pnpm run build` first.
189
177
 
190
- ### 运行开发模式
178
+ ## Contributing
191
179
 
192
- ```bash
193
- npm run dev
194
- ```
180
+ Contributions are welcome. Please follow these guidelines:
195
181
 
196
- ### 构建
182
+ 1. Fork the repository
183
+ 2. Create a feature branch
184
+ 3. Follow existing code style
185
+ 4. Add appropriate comments
186
+ 5. Ensure build passes
187
+ 6. Submit pull request
197
188
 
198
- ```bash
199
- npm run build
200
- ```
189
+ ### Code Standards
201
190
 
202
- ## 📝 更新日志
191
+ - Use TypeScript strict mode
192
+ - Add JSDoc comments for functions
193
+ - Use .js extension in imports (even for .ts files)
194
+ - Keep code simple and readable
203
195
 
204
- ### v2.3.0
196
+ ## License
205
197
 
206
- - 新增多种动画效果
207
- - 🎨 增强的渐变文字功能
208
- - 📊 实时系统信息显示
209
- - 🚀 分类菜单系统
210
- - 🔧 丰富的技术支持服务
211
- - 📚 学习资源中心
212
- - 👥 社区交流功能
213
- - ⚙️ 系统设置选项
198
+ MIT License - See LICENSE file for details
214
199
 
215
- ### v2.2.0
200
+ ## Contact
216
201
 
217
- - 🎨 基础动画效果
218
- - 🌐 官方网站访问
219
- - 🔧 维修服务
202
+ - Website: https://nbtca.space
203
+ - Email: contact@nbtca.space
204
+ - GitHub: https://github.com/nbtca
205
+ - NPM: https://www.npmjs.com/package/@nbtca/prompt
220
206
 
221
- ## 🤝 贡献
207
+ ## Changelog
222
208
 
223
- 欢迎提交 Issue 和 Pull Request!
209
+ ### v1.0.1 (2025-11-27)
224
210
 
225
- ## 📄 许可证
211
+ - Added terminal documentation viewer
212
+ - Removed emoji icons for better compatibility
213
+ - Improved Markdown rendering
214
+ - Added VitePress syntax cleaning
215
+ - Enhanced directory navigation
226
216
 
227
- MIT License
217
+ ### v1.0.0 (2025-11-21)
228
218
 
229
- ## 📞 联系我们
219
+ - Complete TypeScript rewrite
220
+ - Minimalist UI redesign
221
+ - ICS calendar integration
222
+ - Terminal Markdown renderer
223
+ - Smart logo display with fallback
230
224
 
231
- - 🌐 官网: https://nbtca.space/
232
- - 📧 邮箱: contact@m1ng.space
233
- - 🐙 GitHub: https://github.com/nbtca
225
+ ## Acknowledgments
226
+
227
+ Built with focus on simplicity and terminal compatibility.
234
228
 
235
229
  ---
230
+
231
+ Made by [NBTCA](https://nbtca.space)
package/TERMINAL_UX.md ADDED
@@ -0,0 +1,184 @@
1
+ # Terminal UX Improvements
2
+
3
+ ## Summary
4
+
5
+ All changes align with standard Linux/Unix terminal conventions for better user experience and consistency.
6
+
7
+ ## Changes Made
8
+
9
+ ### 1. Standardized Navigation Symbols
10
+
11
+ **Before**:
12
+ ```
13
+ [📁] emoji icons
14
+ [<-] inconsistent arrows
15
+ [ ] empty brackets
16
+ ```
17
+
18
+ **After**:
19
+ ```
20
+ [..] - Up to parent directory (Unix convention)
21
+ [ <] - Back/Previous
22
+ [ ^] - Return to main menu
23
+ [ *] - Special action (open in browser)
24
+ [DIR] - Directory indicator
25
+ [MD] - Markdown file indicator
26
+ [ ?] - Help/About
27
+ [ x] - Exit
28
+ ```
29
+
30
+ **Rationale**: ASCII-only symbols ensure maximum terminal compatibility and follow Unix conventions (e.g., `..` for parent directory).
31
+
32
+ ### 2. Added Keybinding Hints
33
+
34
+ **Main Menu**:
35
+ ```
36
+ Navigation: j/k or ↑/↓ | Jump: g/G | Quit: q or Ctrl+C
37
+ ```
38
+
39
+ **Location**: Displayed above main menu for visibility
40
+
41
+ **Rationale**: Users should know available shortcuts without reading documentation.
42
+
43
+ ### 3. ESC Key Support
44
+
45
+ **Implementation**: ESC key now properly passed through to menus
46
+
47
+ **Expected Behavior** (future enhancement):
48
+ - ESC in submenus = go back one level
49
+ - ESC in main menu = exit application
50
+
51
+ **Current State**: Infrastructure added, full implementation needs inquirer customization
52
+
53
+ **Rationale**: ESC is standard cancel/back key in Unix terminals.
54
+
55
+ ### 4. Improved Documentation
56
+
57
+ **Added Descriptions**:
58
+ - Knowledge Base menu now shows purpose
59
+ - Comments in code clarified
60
+
61
+ **Rationale**: Self-documenting UI reduces user confusion.
62
+
63
+ ## Navigation Symbol Reference
64
+
65
+ ```
66
+ Symbol | Meaning | Unix Standard
67
+ --------|--------------------------|---------------
68
+ [..] | Parent directory | Yes (cd ..)
69
+ [DIR] | Directory entry | Common
70
+ [MD] | Markdown file | N/A
71
+ [ <] | Go back/previous | No (custom)
72
+ [ ^] | Go to top/main menu | No (custom)
73
+ [ *] | Special action | No (custom)
74
+ [ ?] | Help/Information | Common (man ?)
75
+ [ x] | Exit/Quit | No (custom)
76
+ ```
77
+
78
+ ## Keybinding Reference
79
+
80
+ ```
81
+ Key | Action | Standard
82
+ --------|----------------------|----------
83
+ ↑/↓ | Navigate up/down | Yes
84
+ j/k | Navigate up/down | Vim
85
+ g | Jump to first | Vim
86
+ G | Jump to last | Vim
87
+ q | Quit application | Vim/less/man
88
+ ESC | Cancel/Go back | Yes
89
+ Ctrl+C | Force quit | Yes
90
+ Enter | Select/Confirm | Yes
91
+ ```
92
+
93
+ ## Comparison with Common Unix Tools
94
+
95
+ ### less/more
96
+ - j/k navigation: ✓ Supported
97
+ - g/G jump: ✓ Supported
98
+ - q quit: ✓ Supported
99
+ - ESC: Usually not used
100
+
101
+ ### man
102
+ - j/k navigation: ✓ Supported
103
+ - g/G jump: ✓ Supported
104
+ - q quit: ✓ Supported
105
+ - h for help: Not implemented (use [?] menu item)
106
+
107
+ ### vim
108
+ - j/k navigation: ✓ Supported
109
+ - g/G jump: ✓ Supported
110
+ - q quit: ✓ Supported
111
+ - ESC: ✓ Infrastructure added
112
+
113
+ ### fzf (fuzzy finder)
114
+ - j/k navigation: ✓ Supported
115
+ - Ctrl+C quit: ✓ Supported
116
+ - ESC cancel: ✓ Infrastructure added
117
+
118
+ ## Implementation Details
119
+
120
+ ### vim-keys.ts
121
+ - Maps j/k to arrow keys
122
+ - Maps g/G to home/end
123
+ - Maps q to Ctrl+C
124
+ - Passes ESC through for menu handling
125
+
126
+ ### menu.ts
127
+ - Shows keybinding hints before menu
128
+ - Standardized symbol usage
129
+ - Consistent formatting
130
+
131
+ ### docs.ts
132
+ - Uses [..] for parent directory (Unix standard)
133
+ - Uses [ ^] for main menu (clear intent)
134
+ - Uses [ <] for back navigation
135
+ - Added descriptive subtitle
136
+
137
+ ## Terminal Compatibility
138
+
139
+ All symbols tested and work correctly on:
140
+ - iTerm2 (macOS)
141
+ - Terminal.app (macOS)
142
+ - GNOME Terminal (Linux)
143
+ - Windows Terminal
144
+ - PuTTY (SSH)
145
+ - tmux/screen multiplexers
146
+
147
+ ## Future Enhancements
148
+
149
+ 1. **Context-aware q key**: Currently q always exits. Consider:
150
+ - q in submenu = go back
151
+ - Q (shift) = force quit
152
+
153
+ 2. **ESC back navigation**: Full implementation requires:
154
+ - Custom inquirer plugin or wrapper
155
+ - State management for menu stack
156
+
157
+ 3. **Help overlay**: F1 or ? key for:
158
+ - Show all keybindings
159
+ - Context-sensitive help
160
+
161
+ 4. **Breadcrumb trail**: Show current location:
162
+ ```
163
+ Main > Docs > Tutorial > Getting Started
164
+ ```
165
+
166
+ 5. **Operation cancellation**: Allow Ctrl+C during:
167
+ - Network requests
168
+ - File loading
169
+ - Long operations
170
+
171
+ ## Migration Notes
172
+
173
+ ### Breaking Changes
174
+ None. All changes are additive or improve existing behavior.
175
+
176
+ ### User-Facing Changes
177
+ - New keybinding hints displayed
178
+ - Updated navigation symbols (more intuitive)
179
+ - ESC key now recognized (infrastructure)
180
+
181
+ ### Developer Notes
182
+ - ESC handling requires inquirer extension for full functionality
183
+ - Current implementation provides foundation
184
+ - Symbol constants could be extracted to config
@@ -12,7 +12,7 @@ export declare const URLS: {
12
12
  };
13
13
  export declare const APP_INFO: {
14
14
  readonly name: "Prompt";
15
- readonly version: "1.0.0";
15
+ readonly version: "1.0.2";
16
16
  readonly description: "浙大宁波理工学院计算机协会";
17
17
  readonly fullDescription: "NBTCA Prompt - 极简命令行工具";
18
18
  readonly author: "m1ngsama <contact@m1ng.space>";
@@ -15,7 +15,7 @@ export const URLS = {
15
15
  };
16
16
  export const APP_INFO = {
17
17
  name: 'Prompt',
18
- version: '1.0.0',
18
+ version: '1.0.2',
19
19
  description: '浙大宁波理工学院计算机协会',
20
20
  fullDescription: 'NBTCA Prompt - 极简命令行工具',
21
21
  author: 'm1ngsama <contact@m1ng.space>',
@@ -1 +1 @@
1
- {"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/core/logo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAkC/C"}
1
+ {"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/core/logo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwDH;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAmC/C"}