@zhanngning/hecode 0.7.0 → 1.0.0

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,287 +1,30 @@
1
- # Hecode
1
+ # HeCode
2
2
 
3
- Your AI Coding Assistant CLI with Financial Analysis.
3
+ AI-powered coding agent with terminal UI, based on [opencode](https://github.com/anomalyco/opencode).
4
4
 
5
- ## Features
6
-
7
- - **Multi-Model Support**: OpenAI, Anthropic, MiMo, Ollama, and any OpenAI-compatible API
8
- - **Tool System**: File read/write/edit, bash execution, glob/grep search
9
- - **Skill System**: Loadable domain skills (coding, testing, ppt, planning, finance, etc.)
10
- - **Memory System**: Session, project, and global memory with search
11
- - **Interactive REPL**: Streaming output, slash commands, tool status display
12
- - **Financial Analysis**: Stock analysis, technical indicators, research reports
13
-
14
- ## Install
5
+ ## Installation
15
6
 
16
7
  ```bash
17
- npm install -g hecode
8
+ npm i -g @zhanngning/hecode
18
9
  ```
19
10
 
20
- ## Quick Start
11
+ ## Usage
21
12
 
22
13
  ```bash
23
- # Interactive mode
24
14
  hecode
25
-
26
- # Single-shot mode
27
- hecode "fix the bug in src/app.ts"
28
-
29
- # Use a specific model
30
- hecode --model claude:sonnet "explain this code"
31
-
32
- # Use a specific skill
33
- hecode --skill coding "implement a sorting algorithm"
34
- ```
35
-
36
- ## Configuration
37
-
38
- Edit `~/.hecode/config.json`:
39
-
40
- ```json
41
- {
42
- "defaultModel": "openai:gpt-4o",
43
- "models": {
44
- "openai": { "apiKey": "sk-...", "baseUrl": "https://api.openai.com/v1" },
45
- "claude": { "apiKey": "sk-ant-..." },
46
- "mimo": { "apiKey": "...", "baseUrl": "https://api.mimo.xiaomi.com" },
47
- "ollama": { "baseUrl": "http://localhost:11434" }
48
- }
49
- }
50
- ```
51
-
52
- ## Supported Models
53
-
54
- | Provider | Models | Config Key |
55
- |----------|--------|------------|
56
- | OpenAI | GPT-4o, GPT-4.1, o3, o4-mini | `openai` |
57
- | Anthropic | Claude Sonnet 4, Claude Opus 4 | `claude` / `anthropic` |
58
- | MiMo | MiMo series | `mimo` |
59
- | Ollama | Llama, Qwen, DeepSeek, etc. | `ollama` |
60
- | OpenAI Compatible | Any compatible API | `openai` + custom `baseUrl` |
61
-
62
- ## Built-in Tools
63
-
64
- | Tool | Description |
65
- |------|-------------|
66
- | `read_file` | Read file content with offset/limit |
67
- | `write_file` | Write/create files |
68
- | `edit_file` | Precise string replacement |
69
- | `bash` | Execute shell commands |
70
- | `glob` | File pattern matching |
71
- | `grep` | Content regex search |
72
- | `finance_analyze` | Financial analysis and research reports |
73
-
74
- ## Financial Analysis
75
-
76
- Analyze stocks and generate research reports using free data sources.
77
-
78
- ### Usage
79
-
80
- ```bash
81
- # Interactive mode with finance skill
82
- hecode --skill finance "分析贵州茅台"
83
-
84
- # Direct tool call
85
- hecode "分析股票 600519"
86
15
  ```
87
16
 
88
- ### Features
89
-
90
- - **Price Analysis**: Current price, change percentage, volume
91
- - **Technical Indicators**: MA5, MA10, MA20, RSI(14)
92
- - **Trend Detection**: Uptrend, downtrend, or neutral
93
- - **Research Reports**: Comprehensive Markdown reports
94
-
95
- ### Supported Markets
96
-
97
- - **A-Shares**: Shanghai and Shenzhen stock exchanges
98
- - **HK Stocks**: Hong Kong stock exchange
99
-
100
- ### Prerequisites
101
-
102
- Install Python and akshare:
103
-
104
- ```bash
105
- pip install akshare pandas
106
- ```
107
-
108
- ### Example Output
109
-
110
- ```
111
- # 贵州茅台 (600519) 研究报告
112
-
113
- ## 价格信息
114
- - 当前价格: ¥1168.63
115
- - 涨跌幅: -1.3%
116
-
117
- ## 技术分析
118
- - 5日均线: ¥1180.25
119
- - RSI(14): 45.32
120
- - 趋势信号: 中性
121
- ```
122
-
123
- ## REPL Commands
124
-
125
- | Command | Description |
126
- |---------|-------------|
127
- | `/help` | Show help |
128
- | `/clear` | Clear conversation |
129
- | `/history` | Show message count |
130
- | `/save` | Save session |
131
- | `/session` | Show session ID |
132
- | `/exit` | Exit Hecode |
133
-
134
- ## Skill System
135
-
136
- Hecode uses a skill-based architecture to handle different tasks. Each skill provides specialized instructions for specific domains.
137
-
138
- ### Built-in Skills
139
-
140
- | Skill | Trigger Words | Description |
141
- |-------|---------------|-------------|
142
- | `coding` | code, fix, debug, refactor, implement, write, create, build | Write clean, minimal code following best practices |
143
- | `testing` | test, testing, unit test, integration test, e2e, TDD, BDD | Write tests, test-driven development |
144
- | `code-review` | review, code review, 审查, 代码审查, check code | Review code for quality, bugs, and improvements |
145
- | `docs` | docs, documentation, 文档, readme, api doc, 注释 | Generate documentation and comments |
146
- | `git` | git, commit, pr, pull request, merge, branch | Git workflow assistance |
147
- | `explain` | explain, 解释, 说明, understand, what does | Explain complex code in simple terms |
148
- | `refactor` | refactor, 重构, optimize, 优化, improve, clean | Improve code quality while preserving behavior |
149
- | `security` | security, 安全, vulnerability, 漏洞, audit | Identify and fix security vulnerabilities |
150
- | `perf` | performance, 性能, optimize, speed, slow, benchmark | Performance optimization |
151
- | `content` | content, 内容, 文章, article, blog, 博客, 公众号 | Content creation for various platforms |
152
- | `data-analysis` | data, 数据, analysis, 分析, chart, 图表, visualization | Data analysis and visualization |
153
- | `translate` | translate, 翻译, 英文, 中文, english, chinese | Translation between languages |
154
- | `ppt` | ppt, presentation, slides, 演示, 幻灯片, 汇报 | Create professional presentations |
155
- | `planning` | plan, planning, project, roadmap, 项目, 计划, 规划 | Create project plans and roadmaps |
156
- | `finance` | finance, 股票, 金融, 研究报告, stock | Financial analysis and research reports |
157
-
158
- ### Skill Details
159
-
160
- #### Coding Skill
161
- Write production-ready code with:
162
- - Clean, minimal implementations
163
- - Follow existing project conventions
164
- - Proper error handling
165
- - Type safety
166
-
167
- ```bash
168
- hecode --skill coding "implement user authentication with JWT"
169
- hecode --skill coding "refactor the database connection module"
170
- hecode --skill coding "fix the memory leak in the event handler"
171
- ```
172
-
173
- #### Testing Skill
174
- Comprehensive testing support:
175
- - Unit tests, integration tests, E2E tests
176
- - TDD workflow (Red-Green-Refactor)
177
- - Mocking and test fixtures
178
- - Coverage analysis
179
-
180
- ```bash
181
- hecode --skill testing "write unit tests for the payment service"
182
- hecode --skill testing "create integration tests for the API"
183
- hecode --skill testing "help me practice TDD for a sorting algorithm"
184
- ```
185
-
186
- #### PPT Skill
187
- Create professional presentations:
188
- - Title slides, content slides, data slides
189
- - Consistent design and formatting
190
- - Charts and visualizations
191
- - Speaker notes
192
-
193
- ```bash
194
- hecode --skill ppt "create a product demo presentation"
195
- hecode --skill ppt "make a quarterly business review deck"
196
- hecode --skill ppt "设计一个技术分享PPT"
197
- ```
198
-
199
- #### Planning Skill
200
- Project planning and management:
201
- - Project scope and objectives
202
- - Timeline and milestones
203
- - Task breakdown and dependencies
204
- - Risk assessment
205
-
206
- ```bash
207
- hecode --skill planning "create a project plan for the new feature"
208
- hecode --skill planning "制定Q3季度开发计划"
209
- hecode --skill planning "create a roadmap for the next 6 months"
210
- ```
211
-
212
- #### Financial Analysis Skill
213
- Stock analysis and research reports:
214
- - Real-time price data (A-shares, HK stocks)
215
- - Technical indicators (MA, RSI, MACD)
216
- - Trend analysis and signals
217
- - Comprehensive research reports
218
-
219
- ```bash
220
- hecode --skill finance "分析贵州茅台"
221
- hecode --skill finance "analyze stock 600519"
222
- hecode --skill finance "生成腾讯研究报告"
223
- ```
224
-
225
- ### Custom Skills
226
-
227
- Create your own skills by adding a `SKILL.md` file in `skills/<name>/`:
228
-
229
- ```markdown
230
- # My Custom Skill
231
-
232
- trigger: keyword1, keyword2, 关键词
233
-
234
- ## Instructions
235
-
236
- You are an expert in [domain]. When helping users:
237
-
238
- 1. First understand the requirement
239
- 2. Provide step-by-step guidance
240
- 3. Use relevant tools
241
- 4. Verify the result
242
-
243
- ## Example
244
-
245
- User: "help me with X"
246
- Assistant: [detailed response following the skill instructions]
247
- ```
248
-
249
- ### Skill Selection
250
-
251
- Skills are automatically matched based on:
252
- - User input keywords
253
- - Context analysis
254
- - Explicit `--skill` flag
255
-
256
- If no skill matches, the default coding behavior is used.
257
-
258
- ## Development
17
+ ## Features
259
18
 
260
- ```bash
261
- git clone <repo-url>
262
- cd hecode
263
- npm install
264
- npm run dev # Run in dev mode
265
- npm test # Run tests
266
- npm run build # Build for production
267
- npm run lint # Type check
268
- ```
19
+ - Terminal UI (TUI) for interactive coding sessions
20
+ - Multi-provider AI support (Anthropic, OpenAI, Google, etc.)
21
+ - Tool use (file editing, bash commands, web search, etc.)
22
+ - Session management with persistent history
23
+ - Plugin system for extensibility
269
24
 
270
- ## Project Structure
25
+ ## Based On
271
26
 
272
- ```
273
- hecode/
274
- ├── src/
275
- │ ├── core/ # Core engine (orchestrator, types)
276
- │ ├── tools/ # Built-in tools
277
- │ ├── models/ # Multi-model providers
278
- │ ├── memory/ # Session/project/global memory
279
- │ ├── skills/ # Skill loader
280
- │ └── cli/ # CLI entry, REPL, commands
281
- ├── skills/ # Built-in skill definitions
282
- ├── tests/ # Unit tests
283
- └── dist/ # Build output
284
- ```
27
+ This project is based on [opencode](https://github.com/anomalyco/opencode) with custom modifications.
285
28
 
286
29
  ## License
287
30
 
package/bin/hecode ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("../dist/index.js")