@hncode/hncode 0.1.3 → 0.1.5

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,197 +1,198 @@
1
- # hncode — AI Coding Agent CLI
2
-
3
- > **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.**
4
-
5
- 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.
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
- | Command | Description |
74
- |---------|-------------|
75
- | `/compact [ratio]` | Compact conversation (AI summary + keep last 20%) |
76
- | `/model <name>` | Switch LLM model |
77
- | `/sessions` | Browse and resume past conversations |
78
- | `/move <path>` | Move current session to another directory |
79
- | `/auto` / `/ask` / `/yolo` | Toggle permission mode |
80
- | `/plan` / `/focus` | Toggle research-only or full-edit mode |
81
- | `/calm-mode` | Terse replies (skip narration) |
82
- | `/help` | Show all commands |
83
-
84
- ### Tab Completion
85
-
86
- - Type `/` → command menu
87
- - Type `@` → file/folder completion
88
- - Use Tab to navigate, Enter to select
89
-
90
- ### Auto Compaction
91
-
92
- - Triggers automatically when context usage reaches 85%
93
- - AI summarizes dropped messages instead of simply deleting them
94
- - Keeps the most recent 20% of conversation to maintain context coherence
95
-
96
- ---
97
-
98
- ## 🔧 Plugin System
99
-
100
- ### Creating Plugins
101
-
102
- Create `.js` or `.mjs` files in `~/.hncode/plugins/`:
103
-
104
- ```javascript
105
- // my-plugin.mjs
106
- export function install(api) {
107
- // Register new tool
108
- api.registerTool({
109
- name: 'MyTool',
110
- description: '...',
111
- parameters: { /* schema */ },
112
- async execute(args, ctx) { return result; }
113
- });
114
-
115
- // Register command
116
- api.registerCommand({
117
- name: 'mycmd',
118
- description: '...',
119
- run: (arg, ctx) => { /* ... */ }
120
- });
121
-
122
- // Register hook
123
- api.registerHook('onTurnEnd', (turnInfo) => { /* ... */ });
124
- }
125
-
126
- export default { name: 'my-plugin', version: '1.0.0' };
127
- ```
128
-
129
- ### View Loaded Plugins
130
-
131
- ```bash
132
- hncode /plugins
133
- ```
134
-
135
- ---
136
-
137
- ## 🛠 Tools
138
-
139
- Built-in tools include:
140
- - `Read`, `Write`, `Edit` - File operations
141
- - `Bash` - Execute shell commands
142
- - `Glob`, `Grep` - Search files
143
- - `TodoList`, `TaskOutput` - Task management
144
- - `FetchURL`, `WebSearch` - Internet access
145
- - `ReadMediaFile`, `FileLines` - Media handling
146
-
147
- ---
148
-
149
- ## 🎨 Themes
150
-
151
- Supported themes: `auto`, `dark`, `light`, or custom RGB colors.
152
-
153
- Set via config:
154
- ```toml
155
- theme = "dark"
156
- ```
157
-
158
- Or use `/theme <name>` in TUI.
159
-
160
- ---
161
-
162
- ## 🤝 Contributing
163
-
164
- This project was created through Vibe Coding. While it may not be perfect, I welcome your feedback!
165
-
166
- **Feel free to:**
167
- - Submit issues for bugs or suggestions
168
- - Fork and create pull requests
169
- - Share your experience using hncode
170
-
171
- ---
172
-
173
- ## 🙏 Acknowledgments
174
-
175
- hncode draws inspiration from several excellent projects:
176
-
177
- - **[Kimi Code CLI](https://github.com/MoonshotAI/kimi-code)** - The original cyan-blue TUI coding agent that inspired this project's design and approach
178
- - **[Claude Code](https://github.com/anthropics/claude-code)** - The conversation flow and tool interaction patterns
179
-
180
- Special thanks to the communities behind these projects for pushing the boundaries of AI-assisted coding.
181
-
182
- ---
183
-
184
- ## 📄 License
185
-
186
- This project is licensed under the [GNU General Public License v3.0](LICENSE).
187
-
188
- **In short:**
189
- 1. ✅ You can freely use, modify, and share this code
190
- 2. ✅ Must retain author attribution (NiceHello666) and link back to this repository
191
- 3. ❌ Cannot be used for commercial purposes (e.g., selling, as part of paid products)
192
-
193
- ---
194
-
195
- **NPM Package**: [@hncode/hncode](https://www.npmjs.com/package/@hncode/hncode)
196
- **GitHub**: [NiceHello666/hncode](https://github.com/NiceHello666/hncode)
197
- **Chinese Version**: [README_CN.md](./README_CN.md)
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)