@hncode/hncode 0.1.3 → 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/LICENSE +219 -219
- package/README.md +198 -197
- package/README_CN.md +187 -186
- package/bin/install.js +95 -95
- package/bin/preinstall.js +41 -41
- package/package.json +35 -35
- package/src/tui.js +19 -3
package/README.md
CHANGED
|
@@ -1,197 +1,198 @@
|
|
|
1
|
-
# hncode — AI Coding Agent CLI
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
|
|
77
|
-
| `/
|
|
78
|
-
| `/
|
|
79
|
-
| `/
|
|
80
|
-
| `/
|
|
81
|
-
| `/
|
|
82
|
-
| `/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
- `
|
|
143
|
-
- `
|
|
144
|
-
- `
|
|
145
|
-
- `
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
**
|
|
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)
|