@hncode/hncode 0.1.1 → 0.1.4

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,340 +1,198 @@
1
- # hncode — AI Coding Agent CLI
2
-
3
- > **这是我 Vibe Coding 的产物,可能不是特别好,但是如果有什么建议的话也欢迎提 issue**
4
-
5
- A cyan-blue TUI coding agent inspired by kimi-code-cli, with OpenAI + Anthropic support, MCP-style toolbelt, and intelligent context management.
6
-
7
- ---
8
-
9
- ## 🌟 Features
10
-
11
- - **Cyan-blue TUI**: Raw terminal renderer for perfect Windows Terminal compatibility
12
- - **Dual Protocol Support**: Works with both OpenAI-compatible APIs and Anthropic
13
- - **Smart Context Management**: Auto-compaction at 85% usage, AI-summarized history retention
14
- - **MCP-style Toolbelt**: Read, Write, Edit, Bash, Glob, Grep, TodoList, WebSearch, etc.
15
- - **Plugin System**: Extend with custom tools, commands, and hooks
16
- - **Session Persistence**: Resume conversations across sessions
17
- - **Permission Modes**: Ask, YOLO, or Auto modes for different workflows
18
-
19
- ---
20
-
21
- ## 🚀 Installation
22
-
23
- ### Global Installation (Recommended)
24
-
25
- ```bash
26
- npm install -g @hncode/hncode
27
- ```
28
-
29
- Then run:
30
- ```bash
31
- hncode
32
- ```
33
-
34
- ### Using npx (No installation required)
35
-
36
- ```bash
37
- npx @hncode/hncode
38
- ```
39
-
40
- This will download and run the latest version without installing it globally.
41
-
42
- ---
43
-
44
- ## ⚙️ Configuration
45
-
46
- Create `~/.hncode/config.toml`:
47
-
48
- ```toml
49
- default_model = "gpt-4o-mini"
50
-
51
- [providers.openai]
52
- base_url = "https://api.openai.com/v1"
53
- api_key = "your-api-key-here"
54
-
55
- [models.gpt-4o-mini]
56
- provider = "openai"
57
- model = "gpt-4o-mini"
58
- ```
59
-
60
- Or set environment variables:
61
- ```bash
62
- export HNCODE_API_KEY="your-key"
63
- export HNCODE_PROVIDER="openai"
64
- export HNCODE_MODEL="gpt-4o-mini"
65
- ```
66
-
67
- ---
68
-
69
- ## 📖 Usage
70
-
71
- ### Basic Commands
72
-
73
- ```bash
74
- # Start interactive session
75
- hncode
76
-
77
- # Headless mode (one prompt)
78
- hncode -p "Fix the bug in src/main.js"
79
-
80
- # Continue previous session
81
- hncode --continue
82
-
83
- # Auto mode (no questions)
84
- hncode --auto
85
- ```
86
-
87
- ### Slash Commands
88
-
89
- | Command | Description |
90
- |---------|-------------|
91
- | `/compact [ratio]` | Compact conversation (AI summary + keep last 20%) |
92
- | `/model <name>` | Switch LLM model |
93
- | `/sessions` | Browse and resume past conversations |
94
- | `/move <path>` | Move current session to another directory |
95
- | `/auto` / `/ask` / `/yolo` | Toggle permission mode |
96
- | `/plan` / `/focus` | Toggle research-only or full-edit mode |
97
- | `/calm-mode` | Terse replies (skip narration) |
98
- | `/help` | Show all commands |
99
-
100
- ### Advanced Features
101
-
102
- **Tab Completion**:
103
- - Type `/` → command menu
104
- - Type `@` → file/folder completion
105
- - Use Tab to navigate and Enter to select
106
-
107
- **Auto Compaction**:
108
- - Triggers at 85% context window
109
- - AI summarizes dropped messages
110
- - Keeps most recent 20% of conversation
111
-
112
- **Plugin System**:
113
- Place plugins in `~/.hncode/plugins/`:
114
- ```javascript
115
- // my-plugin.mjs
116
- export function install(api) {
117
- api.registerTool({ /* ... */ });
118
- api.registerCommand({ name: 'mycmd', run: () => {} });
119
- }
120
- export default { name: 'my-plugin', version: '1.0.0' };
121
- ```
122
-
123
- ---
124
-
125
- ## 🛠 Tools
126
-
127
- Built-in tools include:
128
- - `Read`, `Write`, `Edit` - File operations
129
- - `Bash` - Execute shell commands
130
- - `Glob`, `Grep` - Search files
131
- - `TodoList`, `TaskOutput` - Task management
132
- - `FetchURL`, `WebSearch` - Internet access
133
- - `ReadMediaFile`, `FileLines` - Media handling
134
-
135
- ---
136
-
137
- ## 🎨 Theme
138
-
139
- Supported themes: `auto`, `dark`, `light`, or custom RGB colors.
140
-
141
- Set via config:
142
- ```toml
143
- theme = "dark"
144
- ```
145
-
146
- Or `/theme <name>` in TUI.
147
-
148
- ---
149
-
150
- ## 🤝 Contributing
151
-
152
- This project was created through Vibe Coding. While it may not be perfect, I welcome your feedback!
153
-
154
- **Please feel free to:**
155
- - Submit issues for bugs or suggestions
156
- - Fork and create pull requests
157
- - Share your experience using hncode
158
-
159
- ---
160
-
161
- ## 🙏 Acknowledgments
162
-
163
- hncode draws inspiration from several excellent projects:
164
-
165
- - **[kimi-code-cli](https://github.com/mckaymatt/kimi-code-cli)** - The original cyan-blue TUI coding agent that inspired this project's design and approach
166
- - **[claude-code](https://github.com/anthropics/claude-code)** - The conversation flow and tool interaction patterns
167
-
168
- Special thanks to the communities behind these projects for pushing the boundaries of AI-assisted coding.
169
-
170
- ---
171
-
172
- ## 📄 License
173
-
174
- MIT License - See LICENSE file for details.
175
-
176
- ---
177
-
178
- # hncode — AI 编程助手命令行工具
179
-
180
- > **这是我 Vibe Coding 的产物,可能不是特别好,但是如果有什么建议的话也欢迎提 issue**
181
-
182
- 一个青色蓝调终端界面的 AI 编程助手,灵感来自 kimi-code-cli,支持 OpenAI 和 Anthropic API,配备 MCP 风格的工具集和智能上下文管理。
183
-
184
- ---
185
-
186
- ## 🌟 功能特性
187
-
188
- - **青色蓝调 TUI**: 原生终端渲染器,完美兼容 Windows Terminal
189
- - **双协议支持**: 同时支持 OpenAI 兼容 API 和 Anthropic
190
- - **智能上下文管理**: 85% 使用率时自动压缩,AI 摘要保留历史对话
191
- - **MCP 风格工具集**: Read、Write、Edit、Bash、Glob、Grep、TodoList、WebSearch 等
192
- - **插件系统**: 通过自定义工具、命令和钩子扩展功能
193
- - **会话持久化**: 跨会话恢复对话
194
- - **权限模式**: Ask、YOLO、Auto 三种工作流模式
195
-
196
- ---
197
-
198
- ## 🚀 安装
199
-
200
- ```bash
201
- npm install -g hncode
202
- ```
203
-
204
- 或直接使用:
205
- ```bash
206
- npx hncode
207
- ```
208
-
209
- ---
210
-
211
- ## ⚙️ 配置
212
-
213
- 创建 `~/.hncode/config.toml`:
214
-
215
- ```toml
216
- default_model = "gpt-4o-mini"
217
-
218
- [providers.openai]
219
- base_url = "https://api.openai.com/v1"
220
- api_key = "你的-api-key"
221
-
222
- [models.gpt-4o-mini]
223
- provider = "openai"
224
- model = "gpt-4o-mini"
225
- ```
226
-
227
- 或使用环境变量:
228
- ```bash
229
- export HNCODE_API_KEY="你的-key"
230
- export HNCODE_PROVIDER="openai"
231
- export HNCODE_MODEL="gpt-4o-mini"
232
- ```
233
-
234
- ---
235
-
236
- ## 📖 使用方法
237
-
238
- ### 基本命令
239
-
240
- ```bash
241
- # 启动交互式会话
242
- hncode
243
-
244
- # 无头模式(单次提示)
245
- hncode -p "修复 src/main.js 中的 bug"
246
-
247
- # 继续之前的会话
248
- hncode --continue
249
-
250
- # 自动模式(不问问题)
251
- hncode --auto
252
- ```
253
-
254
- ### 斜杠命令
255
-
256
- | 命令 | 描述 |
257
- |------|------|
258
- | `/compact [ratio]` | 压缩对话(AI 摘要 + 保留最近 20%) |
259
- | `/model <name>` | 切换 LLM 模型 |
260
- | `/sessions` | 浏览和恢复过往对话 |
261
- | `/move <path>` | 将当前会话迁移到另一个目录 |
262
- | `/auto` / `/ask` / `/yolo` | 切换权限模式 |
263
- | `/plan` / `/focus` | 切换仅研究或完整编辑模式 |
264
- | `/calm-mode` | 简洁回复(跳过叙述) |
265
- | `/help` | 显示所有命令 |
266
-
267
- ### 高级功能
268
-
269
- **Tab 补全**:
270
- - 输入 `/` → 命令菜单
271
- - 输入 `@` → 文件/文件夹补全
272
- - 使用 Tab 导航,Enter 选择
273
-
274
- **自动压缩**:
275
- - 在 85% 上下文窗口时触发
276
- - AI 摘要被丢弃的消息
277
- - 保留最近 20% 的对话
278
-
279
- **插件系统**:
280
- 将插件放在 `~/.hncode/plugins/`:
281
- ```javascript
282
- // my-plugin.mjs
283
- export function install(api) {
284
- api.registerTool({ /* ... */ });
285
- api.registerCommand({ name: 'mycmd', run: () => {} });
286
- }
287
- export default { name: 'my-plugin', version: '1.0.0' };
288
- ```
289
-
290
- ---
291
-
292
- ## 🛠 内置工具
293
-
294
- - `Read`, `Write`, `Edit` - 文件操作
295
- - `Bash` - 执行 Shell 命令
296
- - `Glob`, `Grep` - 搜索文件
297
- - `TodoList`, `TaskOutput` - 任务管理
298
- - `FetchURL`, `WebSearch` - 网络访问
299
- - `ReadMediaFile`, `FileLines` - 媒体处理
300
-
301
- ---
302
-
303
- ## 🎨 主题
304
-
305
- 支持的 theme:`auto`、`dark`、`light` 或自定义 RGB 颜色。
306
-
307
- 通过配置设置:
308
- ```toml
309
- theme = "dark"
310
- ```
311
-
312
- 或在 TUI 中使用 `/theme <name>`。
313
-
314
- ---
315
-
316
- ## 🤝 贡献
317
-
318
- 这个项目是通过 Vibe Coding 创建的。虽然它可能不够完美,但我欢迎您的反馈!
319
-
320
- **欢迎:**
321
- - 提交问题报告 bug 或提出建议
322
- - Fork 并创建拉取请求
323
- - 分享您使用 hncode 的体验
324
-
325
- ---
326
-
327
- ## 🙏 致谢
328
-
329
- hncode 从以下几个优秀项目中汲取了灵感:
330
-
331
- - **[kimi-code-cli](https://github.com/mckaymatt/kimi-code-cli)** - 原始的青色蓝调终端界面 AI 编程助手,启发了本项目的设计和理念
332
- - **[claude-code](https://github.com/anthropics/claude-code)** - 对话流程和工具交互模式
333
-
334
- 特别感谢这些项目背后的社区,它们推动了 AI 辅助编程的边界。
335
-
336
- ---
337
-
338
- ## 📄 许可证
339
-
340
- MIT License - 详见 LICENSE 文件。
1
+ # hncode — AI Coding Agent CLI
2
+
3
+ English | [简体中文](./README_CN.md)
4
+
5
+ > **This is a product of my Vibe Coding session. It may not be perfect, but if you have any suggestions, feel free to open an issue.**
6
+
7
+ A cyan-blue TUI coding agent inspired by [Kimi Code CLI](https://github.com/MoonshotAI/kimi-code), with OpenAI + Anthropic support, MCP-style toolbelt, and intelligent context management.
8
+
9
+ ---
10
+
11
+ ## 🌟 Features
12
+
13
+ - **Cyan-blue TUI**: Raw terminal renderer for perfect Windows Terminal compatibility
14
+ - **Dual Protocol Support**: Works with both OpenAI-compatible APIs and Anthropic
15
+ - **Smart Context Management**: Auto-compaction at 85% usage, AI-summarized history retention
16
+ - **MCP-style Toolbelt**: Read, Write, Edit, Bash, Glob, Grep, TodoList, WebSearch, etc.
17
+ - **Plugin System**: Extend with custom tools, commands, and hooks
18
+ - **Session Persistence**: Resume conversations across sessions
19
+ - **Permission Modes**: Ask, YOLO, or Auto modes for different workflows
20
+
21
+ ---
22
+
23
+ ## 🚀 Installation
24
+
25
+ ### Global Installation (Recommended)
26
+
27
+ ```bash
28
+ npm install -g @hncode/hncode
29
+ ```
30
+
31
+ Then run:
32
+ ```bash
33
+ hncode
34
+ ```
35
+
36
+ ### Using npx (No installation required)
37
+
38
+ ```bash
39
+ npx @hncode/hncode
40
+ ```
41
+
42
+ This will download and run the latest version without installing it globally.
43
+
44
+ ---
45
+
46
+ ## ⚙️ Configuration
47
+
48
+ Create `~/.hncode/config.toml`:
49
+
50
+ ```toml
51
+ default_model = "gpt-4o-mini"
52
+
53
+ [providers.openai]
54
+ base_url = "https://api.openai.com/v1"
55
+ api_key = "your-api-key-here"
56
+
57
+ [models.gpt-4o-mini]
58
+ provider = "openai"
59
+ model = "gpt-4o-mini"
60
+ ```
61
+
62
+ Or set environment variables:
63
+ ```bash
64
+ export HNCODE_API_KEY="your-key"
65
+ export HNCODE_PROVIDER="openai"
66
+ export HNCODE_MODEL="gpt-4o-mini"
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 📖 Usage
72
+
73
+ ### Basic Commands
74
+
75
+ | Command | Description |
76
+ |---------|-------------|
77
+ | `/compact [ratio]` | Compact conversation (AI summary + keep last 20%) |
78
+ | `/model <name>` | Switch LLM model |
79
+ | `/sessions` | Browse and resume past conversations |
80
+ | `/move <path>` | Move current session to another directory |
81
+ | `/auto` / `/ask` / `/yolo` | Toggle permission mode |
82
+ | `/plan` / `/focus` | Toggle research-only or full-edit mode |
83
+ | `/calm-mode` | Terse replies (skip narration) |
84
+ | `/help` | Show all commands |
85
+
86
+ ### Tab Completion
87
+
88
+ - Type `/` → command menu
89
+ - Type `@` → file/folder completion
90
+ - Use Tab to navigate, Enter to select
91
+
92
+ ### Auto Compaction
93
+
94
+ - Triggers automatically when context usage reaches 85%
95
+ - AI summarizes dropped messages instead of simply deleting them
96
+ - Keeps the most recent 20% of conversation to maintain context coherence
97
+
98
+ ---
99
+
100
+ ## 🔧 Plugin System
101
+
102
+ ### Creating Plugins
103
+
104
+ Create `.js` or `.mjs` files in `~/.hncode/plugins/`:
105
+
106
+ ```javascript
107
+ // my-plugin.mjs
108
+ export function install(api) {
109
+ // Register new tool
110
+ api.registerTool({
111
+ name: 'MyTool',
112
+ description: '...',
113
+ parameters: { /* schema */ },
114
+ async execute(args, ctx) { return result; }
115
+ });
116
+
117
+ // Register command
118
+ api.registerCommand({
119
+ name: 'mycmd',
120
+ description: '...',
121
+ run: (arg, ctx) => { /* ... */ }
122
+ });
123
+
124
+ // Register hook
125
+ api.registerHook('onTurnEnd', (turnInfo) => { /* ... */ });
126
+ }
127
+
128
+ export default { name: 'my-plugin', version: '1.0.0' };
129
+ ```
130
+
131
+ ### View Loaded Plugins
132
+
133
+ ```bash
134
+ hncode /plugins
135
+ ```
136
+
137
+ ---
138
+
139
+ ## 🛠 Tools
140
+
141
+ Built-in tools include:
142
+ - `Read`, `Write`, `Edit` - File operations
143
+ - `Bash` - Execute shell commands
144
+ - `Glob`, `Grep` - Search files
145
+ - `TodoList`, `TaskOutput` - Task management
146
+ - `FetchURL`, `WebSearch` - Internet access
147
+ - `ReadMediaFile`, `FileLines` - Media handling
148
+
149
+ ---
150
+
151
+ ## 🎨 Themes
152
+
153
+ Supported themes: `auto`, `dark`, `light`, or custom RGB colors.
154
+
155
+ Set via config:
156
+ ```toml
157
+ theme = "dark"
158
+ ```
159
+
160
+ Or use `/theme <name>` in TUI.
161
+
162
+ ---
163
+
164
+ ## 🤝 Contributing
165
+
166
+ This project was created through Vibe Coding. While it may not be perfect, I welcome your feedback!
167
+
168
+ **Feel free to:**
169
+ - Submit issues for bugs or suggestions
170
+ - Fork and create pull requests
171
+ - Share your experience using hncode
172
+
173
+ ---
174
+
175
+ ## 🙏 Acknowledgments
176
+
177
+ hncode draws inspiration from several excellent projects:
178
+
179
+ - **[Kimi Code CLI](https://github.com/MoonshotAI/kimi-code)** - The original cyan-blue TUI coding agent that inspired this project's design and approach
180
+ - **[Claude Code](https://github.com/anthropics/claude-code)** - The conversation flow and tool interaction patterns
181
+
182
+ Special thanks to the communities behind these projects for pushing the boundaries of AI-assisted coding.
183
+
184
+ ---
185
+
186
+ ## 📄 License
187
+
188
+ This project is licensed under the [GNU General Public License v3.0](LICENSE).
189
+
190
+ **In short:**
191
+ 1. ✅ You can freely use, modify, and share this code
192
+ 2. ✅ Must retain author attribution (NiceHello666) and link back to this repository
193
+ 3. ❌ Cannot be used for commercial purposes (e.g., selling, as part of paid products)
194
+
195
+ ---
196
+
197
+ **NPM Package**: [@hncode/hncode](https://www.npmjs.com/package/@hncode/hncode)
198
+ **GitHub**: [NiceHello666/hncode](https://github.com/NiceHello666/hncode)