@hirakoxx/cli 0.0.0-stage → 0.2.1
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 +21 -0
- package/README.md +346 -2
- package/dist/index.js +57667 -0
- package/package.json +70 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HiraxCode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,347 @@
|
|
|
1
|
-
#
|
|
1
|
+
# HiraxCode
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@hirakoxx/cli)
|
|
4
|
+
[](https://github.com/hirakoxx/HiraxCode/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
> An AI coding agent that lives in your terminal, built for **vibe coding**.
|
|
7
|
+
> Multi-provider, local models & **GGUF**, with settings right inside the TUI.
|
|
8
|
+
|
|
9
|
+
Built with **TypeScript + Ink** (React for the terminal), shipped as a single self-contained **Node.js** bundle. Bun is only used for development.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
██╗ ██╗██╗██████╗ █████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
|
|
13
|
+
██║ ██║██║██╔══██╗██╔══██╗╚██╗██╔╝██╔════╝██╔═══██╗██╔══██╗██╔════╝
|
|
14
|
+
███████║██║██████╔╝███████║ ╚███╔╝ ██║ ██║ ██║██║ ██║█████╗
|
|
15
|
+
██╔══██║██║██╔══██╗██╔══██║ ██╔██╗ ██║ ██║ ██║██║ ██║██╔══╝
|
|
16
|
+
██║ ██║██║██║ ██║██║ ██║██╔╝ ██╗╚██████╗╚██████╔╝██████╔╝███████╗
|
|
17
|
+
╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- **18 providers** — OpenRouter, OpenAI, Anthropic, Google Gemini, Groq, DeepSeek, Mistral, xAI, Together, Fireworks, Cerebras, **River AI**, FreeLLMAPI, Ollama, LM Studio, llama.cpp, local **GGUF**, and Custom (OpenAI-compatible).
|
|
23
|
+
- **Multiple API keys + auto-rotation** — store several keys per provider (comma-separated). When one is rejected (401/402/403) or hits its rate limit (429), HiraxCode automatically rotates to the next key mid-conversation.
|
|
24
|
+
- **Local GGUF, zero setup** — just point at a `.gguf` file. If `llama-server` is missing, HiraxCode **downloads** the official llama.cpp binary into `~/.cache/hiraxcode/bin` (Windows/macOS/Linux, x64 & arm64), then spawns it and waits until it is ready.
|
|
25
|
+
- **Image input (screenshots)** — attach a clipboard screenshot with `/paste`, `Alt+V`, or `Ctrl+V`, then send it to a vision model (GPT-4.1/4o, Claude, Gemini, LLaVA, Qwen2-VL, …). If the model can't read images, HiraxCode tells you and suggests the right ones (no cryptic errors).
|
|
26
|
+
- **Local vision** — GGUF models can accept images through a *multimodal projector* (`--mmproj`); set the **mmproj (vision)** field in `/settings`.
|
|
27
|
+
- **Cross-platform** — runs on Windows, macOS, and Linux. `run_bash` uses PowerShell on Windows and bash/zsh on macOS/Linux.
|
|
28
|
+
- **In-TUI settings** (`/settings`) — provider, API key, model, base URL, reasoning, temperature, max tokens, auto-approve, working dir, accent colour. Auto-saved.
|
|
29
|
+
|
|
30
|
+
### Temperature
|
|
31
|
+
|
|
32
|
+
Temperature controls how random the model's output is: `0` = deterministic and focused, higher = more varied and creative. Past ~`1.0` most models stop producing coherent text (you get word salad), so HiraxCode clamps it to **`0.00`–`1.00`** — the range that is safe across OpenAI, Anthropic and Gemini. The default is `0.20` (good for coding). Change it with `/temp 0.3` or in `/settings → Temperature`, which also shows a label (`precise` / `focused` / `balanced` / `creative`).
|
|
33
|
+
- **Model picker** (`/model`) — fetch models straight from the provider, filter, or type a custom one.
|
|
34
|
+
- **Clean TUI** — a two-tone gradient wordmark, an indented transcript (accent bar for the user, plain assistant text, per-tool icons for tool calls), a framed session header with token counters, a bordered composer with the active agent · model · provider underneath, rounded overlay panels, and markdown rendering (headings, lists, quotes, code blocks).
|
|
35
|
+
- **Mouse-wheel scrollback** — scroll the transcript with the wheel; `↑`/`↓` also work line by line.
|
|
36
|
+
- **Command palette** — type `/` for an interactive list: `↑`/`↓` move, `Tab` completes, `Enter` runs. Long lists scroll.
|
|
37
|
+
- **Message queue** — send another message while the agent is working; it is queued and sent automatically when the turn finishes (with an `N queued` indicator).
|
|
38
|
+
- **Accent themes** (`/theme`, default `#fab283`) plus **compact mode** (`/compact`) for small screens.
|
|
39
|
+
- **Agent loop** — thinking → tool call → approval → execution → repeat.
|
|
40
|
+
- **8 tools** — `read_file`, `list_dir`, `glob`, `edit_file`, `write_file`, `run_bash`, `http_request`, `port_scan`.
|
|
41
|
+
- **Pentest & Security modes** — dedicated security-testing agents: recon (port scan + HTTP probing), enumeration, and read-only code review. See [Security & Pentest](#security--pentest).
|
|
42
|
+
- **Approval system** — dangerous actions ask for `y`/`n` confirmation.
|
|
43
|
+
- **Multi-session** — session sidebar, history persisted to disk.
|
|
44
|
+
- **Single-file bundle** — `bun run build:npm` produces one self-contained Node file with **zero dependencies**; `bun run build` produces a native binary.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
Requires **Node.js 20 or newer** — nothing else. The package has no dependencies.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g @hirakoxx/cli@latest
|
|
52
|
+
|
|
53
|
+
hiraxcode
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or run it without installing:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx @hirakoxx/cli@latest
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
On first launch, open `/settings` to pick a provider and paste an API key. That's it — start chatting.
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
Bun is only needed to work on the source.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bun install # or: npm install
|
|
70
|
+
|
|
71
|
+
cp .env.example .env # optional — you can also set everything from /settings
|
|
72
|
+
|
|
73
|
+
bun run dev # run it from source
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Build the published npm bundle — a single self-contained Node file:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
bun run build:npm # -> dist/index.js
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Build a native binary instead (embeds the Bun runtime, so it needs neither Node nor Bun at runtime):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
bun run build # -> dist/hiraxcode (current platform)
|
|
86
|
+
|
|
87
|
+
# Cross-compile for other platforms (from any OS):
|
|
88
|
+
bun run build:win # -> dist/hiraxcode-win-x64.exe
|
|
89
|
+
bun run build:mac # -> dist/hiraxcode-macos-arm64
|
|
90
|
+
bun run build:linux # -> dist/hiraxcode-linux-x64
|
|
91
|
+
bun run build:all # all of the above
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Either artifact is self-contained. The npm bundle needs only Node; the native binary needs nothing at all.
|
|
95
|
+
|
|
96
|
+
## Providers
|
|
97
|
+
|
|
98
|
+
Every provider is selectable from `/settings → Provider`. Those needing an API key are under **Cloud**; the rest are **Local** (FreeLLMAPI is local but still wants its unified key).
|
|
99
|
+
|
|
100
|
+
| Provider | Env var | Default base URL |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| OpenRouter | `OPENROUTER_API_KEY` | `https://openrouter.ai/api/v1` |
|
|
103
|
+
| OpenAI | `OPENAI_API_KEY` | `https://api.openai.com/v1` |
|
|
104
|
+
| Anthropic | `ANTHROPIC_API_KEY` | `https://api.anthropic.com` |
|
|
105
|
+
| Google Gemini | `GEMINI_API_KEY` | `https://generativelanguage.googleapis.com` |
|
|
106
|
+
| Groq | `GROQ_API_KEY` | `https://api.groq.com/openai/v1` |
|
|
107
|
+
| DeepSeek | `DEEPSEEK_API_KEY` | `https://api.deepseek.com/v1` |
|
|
108
|
+
| Mistral | `MISTRAL_API_KEY` | `https://api.mistral.ai/v1` |
|
|
109
|
+
| xAI (Grok) | `XAI_API_KEY` | `https://api.x.ai/v1` |
|
|
110
|
+
| Together | `TOGETHER_API_KEY` | `https://api.together.xyz/v1` |
|
|
111
|
+
| Fireworks | `FIREWORKS_API_KEY` | `https://api.fireworks.ai/inference/v1` |
|
|
112
|
+
| Cerebras | `CEREBRAS_API_KEY` | `https://api.cerebras.ai/v1` |
|
|
113
|
+
| FreeLLMAPI *(local router)* | `FREELLMAPI_API_KEY` | `http://localhost:3001/v1` |
|
|
114
|
+
| River AI | `RIVER_API_KEY` | `https://api.river.ai/v1` |
|
|
115
|
+
| Ollama *(local)* | — | `http://localhost:11434/v1` |
|
|
116
|
+
| LM Studio *(local)* | — | `http://localhost:1234/v1` |
|
|
117
|
+
| llama.cpp server *(local)* | — | `http://localhost:8080/v1` |
|
|
118
|
+
| **GGUF file** *(local)* | — | auto-spawns `llama-server` |
|
|
119
|
+
| Custom | — | your own |
|
|
120
|
+
|
|
121
|
+
All three wire protocols are implemented: **OpenAI-compatible**, **Anthropic Messages** (`/v1/messages` + tool-use blocks), and **Gemini** (`streamGenerateContent` + function calling).
|
|
122
|
+
|
|
123
|
+
### Running a local GGUF
|
|
124
|
+
|
|
125
|
+
1. **Nothing to install.** If `llama-server` isn't on your `PATH`, HiraxCode downloads an official llama.cpp build into `~/.cache/hiraxcode/bin/llama-server/` (Windows/macOS/Linux, x64 & arm64). If you already have one, it uses the one on `PATH`.
|
|
126
|
+
2. In the app: `/settings` → **Provider** → `GGUF file (local, auto-spawn)`.
|
|
127
|
+
3. Set **GGUF file** to the model path, e.g. `/models/qwen2.5-coder-7b-instruct-q4_k_m.gguf`.
|
|
128
|
+
4. (Optional, for vision models) set **mmproj (vision)** to the model's `.mmproj` companion file.
|
|
129
|
+
5. Send a message. HiraxCode spawns `llama-server` (with `--jinja` so tool-calling works), picks a free port, and shuts it down when you exit.
|
|
130
|
+
|
|
131
|
+
If you already run your own server (`llama-server`, Ollama, LM Studio), just pick the matching **local** provider — no spawning needed.
|
|
132
|
+
|
|
133
|
+
### FreeLLMAPI (one endpoint, many free providers)
|
|
134
|
+
|
|
135
|
+
[FreeLLMAPI](https://github.com/tashfeenahmed/freellmapi) runs a local router on port `3001` that stacks ~34 free provider tiers behind a single OpenAI-compatible `/v1` endpoint, with its own failover and key rotation.
|
|
136
|
+
|
|
137
|
+
1. Start it (desktop installer from its Releases page, or `docker compose up`). Open `http://localhost:3001`, add your upstream provider keys, and copy the unified **`freellmapi-…`** key.
|
|
138
|
+
2. In HiraxCode: `/settings` → **Provider** → `FreeLLMAPI (local router)`, then set **API key(s)** to that unified key.
|
|
139
|
+
3. Pick a model: `auto` (router picks), `auto:fast`, `auto:smart`, or any model id it lists (run `/model` to refresh the list from `/v1/models`).
|
|
140
|
+
|
|
141
|
+
HiraxCode's own multi-key rotation stacks with it: put several unified keys (comma-separated) and they rotate on `401/402/403/429` too.
|
|
142
|
+
|
|
143
|
+
### Sending images / screenshots
|
|
144
|
+
|
|
145
|
+
1. Copy a screenshot (Windows: `Win+Shift+S`; macOS: `Cmd+Ctrl+Shift+4`; Linux: use `xclip`/`wl-paste`).
|
|
146
|
+
2. In HiraxCode press `Alt+V` (or `Ctrl+V` when your terminal passes it through) or run `/paste`. A `▣ 1 image attached` indicator appears.
|
|
147
|
+
3. Send the message. HiraxCode converts the image to the right format per provider:
|
|
148
|
+
- OpenAI-compatible → `image_url` data-URI
|
|
149
|
+
- Anthropic → base64 `image` block
|
|
150
|
+
- Gemini → `inlineData`
|
|
151
|
+
4. `/drop` to cancel attachments.
|
|
152
|
+
|
|
153
|
+
You can also attach an image **from a file**:
|
|
154
|
+
|
|
155
|
+
- `/paste <path>` or `/file <path>` — e.g. `/file C:\shots\bug.png`.
|
|
156
|
+
- Copy a file in your file manager and press `Alt+V` — images are attached; other files have their path inserted into the prompt.
|
|
157
|
+
- Drag a file onto the terminal (which types its path) and press `Enter` — any image path in your message is attached automatically.
|
|
158
|
+
|
|
159
|
+
The model must be **vision-capable**. If it isn't, HiraxCode refuses to send and suggests models (e.g. `/model gpt-4.1`, `/model llava`). For local GGUF, set **mmproj** first to enable vision.
|
|
160
|
+
|
|
161
|
+
## Usage
|
|
162
|
+
|
|
163
|
+
| Key | Action |
|
|
164
|
+
|---|---|
|
|
165
|
+
| `Enter` | Send message (queued while the agent is running) |
|
|
166
|
+
| `Tab` | Open/focus the session sidebar |
|
|
167
|
+
| `Ctrl+V` / `Alt+V` | Attach an image (or file) from the clipboard |
|
|
168
|
+
| `Ctrl+B` | Toggle sidebar |
|
|
169
|
+
| `/` | Open the command palette (`↑`/`↓` to move, `Tab` to complete) |
|
|
170
|
+
| `Mouse wheel` | Scroll the transcript |
|
|
171
|
+
| `↑` / `↓` | Scroll the transcript line by line (*or* navigate menu/sidebar when active) |
|
|
172
|
+
| `Ctrl+P` / `Ctrl+N` | Previous / next input history |
|
|
173
|
+
| `←` / `→` | Change a value in Settings |
|
|
174
|
+
| `y` / `n` | Approve / deny a tool call |
|
|
175
|
+
| `Esc` | Close overlay / go back |
|
|
176
|
+
| `Ctrl+C` | Quit (from any screen) |
|
|
177
|
+
|
|
178
|
+
### Slash commands
|
|
179
|
+
|
|
180
|
+
| Command | Action |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `/settings` | Open settings (provider, key, model, …) |
|
|
183
|
+
| `/provider` | Switch provider |
|
|
184
|
+
| `/model` | Pick / type a model |
|
|
185
|
+
| `/agent [id]` | Switch agent (build / plan / pentest / security / custom) |
|
|
186
|
+
| `/pentest` | Jump straight to the Pentest agent |
|
|
187
|
+
| `/paste [path]` | Attach a clipboard image, or a file by path |
|
|
188
|
+
| `/file <path>` | Attach an image file |
|
|
189
|
+
| `/drop` | Clear image attachments |
|
|
190
|
+
| `/new` | New session |
|
|
191
|
+
| `/clear` | Clear the conversation |
|
|
192
|
+
| `/sessions` | Toggle the session sidebar |
|
|
193
|
+
| `/cd <path>` | Change the working directory |
|
|
194
|
+
| `/reasoning` | Toggle thinking |
|
|
195
|
+
| `/temp <0-1>` | Set the temperature (creativity) |
|
|
196
|
+
| `/compact` | Toggle compact mode (denser transcript) |
|
|
197
|
+
| `/yolo` | Toggle auto-approve for **all** tools (no confirmation prompts) |
|
|
198
|
+
| `/theme` | Cycle the accent colour |
|
|
199
|
+
| `/help` | Help |
|
|
200
|
+
| `/exit` | Quit |
|
|
201
|
+
|
|
202
|
+
## Tools
|
|
203
|
+
|
|
204
|
+
| Tool | Action | Approval? |
|
|
205
|
+
|---|---|---|
|
|
206
|
+
| `read_file` | Read a file (supports `offset`/`limit`) | no |
|
|
207
|
+
| `list_dir` | List a folder's contents | no |
|
|
208
|
+
| `glob` | Find files by pattern | no |
|
|
209
|
+
| `edit_file` | Replace an exact span of text | **yes** |
|
|
210
|
+
| `write_file` | Create / overwrite a file | **yes** |
|
|
211
|
+
| `run_bash` | Run a shell command (PowerShell on Windows, bash/zsh on macOS/Linux) | **yes** |
|
|
212
|
+
| `http_request` | Send an HTTP/HTTPS request and inspect status, headers, body (web probing) | no |
|
|
213
|
+
| `port_scan` | TCP-connect scan a host for open ports (recon) | **yes** |
|
|
214
|
+
|
|
215
|
+
## Security & Pentest
|
|
216
|
+
|
|
217
|
+
HiraxCode ships two security-focused agents, selected via `/agent`, `/pentest`, or the `/agent` picker:
|
|
218
|
+
|
|
219
|
+
- **Pentest** (`pentest`) — for **authorised** engagements. Workflow: scope → recon (`port_scan`, `http_request`, `run_bash`) → enumeration → common-vulnerability testing (auth, injection, misconfiguration, exposed files) → exploit PoC → findings report (severity, request evidence, impact, remediation).
|
|
220
|
+
- **Security** (`security`) — a **read-only** code review: leaked secrets, injection, authz issues, insecure deserialization, path traversal, SSRF, XSS, and dependency risk. `run_bash` is still allowed for read-only audits (e.g. `npm audit`), but there are no write/edit tools.
|
|
221
|
+
|
|
222
|
+
Both agents answer directly — they assume an authorised engagement and won't bury you in caveats. Point them at targets you own or are permitted to test: `port_scan` and `run_bash` require approval (unless you turn on `/yolo`), `http_request` is read-only and runs immediately.
|
|
223
|
+
|
|
224
|
+
Example:
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
/pentest
|
|
228
|
+
Scan 10.0.0.5 for open ports, then probe the web server on whatever ports you find
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Configuration
|
|
232
|
+
|
|
233
|
+
Two layers:
|
|
234
|
+
|
|
235
|
+
1. **`.env`** — default keys & environment (see `.env.example`).
|
|
236
|
+
2. **`~/.config/hiraxcode/config.json`** — written automatically whenever you change anything via `/settings`. Takes precedence over `.env`.
|
|
237
|
+
|
|
238
|
+
Main `.env` variables:
|
|
239
|
+
|
|
240
|
+
| Variable | Default | Description |
|
|
241
|
+
|---|---|---|
|
|
242
|
+
| `HIRAX_PROVIDER` | `openrouter` | Active provider |
|
|
243
|
+
| `MODEL` | per-provider | Default model |
|
|
244
|
+
| `<PROVIDER>_API_KEY` | — | Per-provider API key (comma-separate several to rotate) |
|
|
245
|
+
| `BASE_URL` | per-provider | Override the base URL |
|
|
246
|
+
| `GGUF_PATH` | — | Path to a `.gguf` file |
|
|
247
|
+
| `MMPROJ_PATH` | — | Path to a `.mmproj` file (vision for GGUF) |
|
|
248
|
+
| `LLAMA_SERVER_BIN` | `llama-server` | llama.cpp binary |
|
|
249
|
+
| `TEMPERATURE` | `0.2` | 0–2 |
|
|
250
|
+
| `MAX_TOKENS` | `0` | 0 = auto |
|
|
251
|
+
| `ENABLE_REASONING` | `true` | Thinking stream |
|
|
252
|
+
| `REASONING_EFFORT` | `medium` | `low`/`medium`/`high` |
|
|
253
|
+
| `AUTO_APPROVE_SAFE_TOOLS` | `true` | Run read-only tools without confirmation |
|
|
254
|
+
| `AUTO_APPROVE_ALL` | `false` | Skip confirmation for **every** tool — writes, shell, scans |
|
|
255
|
+
| `WORKING_DIR` | cwd | Agent working root |
|
|
256
|
+
| `SHOW_SIDEBAR` | `false` | Show the sidebar on start |
|
|
257
|
+
| `HIRAX_COMPACT` | `false` | Compact mode (denser transcript) |
|
|
258
|
+
| `HIRAX_MINIMAL` | `false` | Hide thinking blocks & inter-message spacing |
|
|
259
|
+
| `ACCENT` | `#fab283` | UI accent colour (also `gold`, `cyan`, `violet`, `emerald`, …) |
|
|
260
|
+
| `DEBUG` | `false` | Log to stderr |
|
|
261
|
+
|
|
262
|
+
## Architecture
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
src/
|
|
266
|
+
├── index.tsx # entry point, llama-server cleanup
|
|
267
|
+
├── core/
|
|
268
|
+
│ ├── providers.ts # 18-provider registry + metadata
|
|
269
|
+
│ ├── settings.ts # load/save settings (env + config.json)
|
|
270
|
+
│ ├── vision.ts # detect image-capable models
|
|
271
|
+
│ ├── detect.ts # detect local runtimes (ollama/lmstudio/llama.cpp)
|
|
272
|
+
│ └── types.ts
|
|
273
|
+
├── providers/
|
|
274
|
+
│ ├── types.ts # Provider + StreamEvent interfaces
|
|
275
|
+
│ ├── openai.ts # OpenAI-compatible (most + local)
|
|
276
|
+
│ ├── anthropic.ts # Anthropic Messages + tool use
|
|
277
|
+
│ ├── gemini.ts # Gemini streamGenerateContent
|
|
278
|
+
│ ├── llama.ts # spawn/health-check llama-server (GGUF)
|
|
279
|
+
│ ├── ollama.ts, lmstudio.ts # local runtime spawn helpers
|
|
280
|
+
│ ├── models.ts # list models per provider
|
|
281
|
+
│ └── index.ts # createProvider() factory
|
|
282
|
+
├── agent/
|
|
283
|
+
│ ├── prompt.ts, tools.ts, tool-registry.ts, tool-schema.ts, loop.ts
|
|
284
|
+
├── store/sessions.ts
|
|
285
|
+
├── ui/
|
|
286
|
+
│ ├── App.tsx # state, screen routing, slash commands, keys
|
|
287
|
+
│ ├── theme.ts # design system (hex palette)
|
|
288
|
+
│ ├── lib/
|
|
289
|
+
│ │ ├── text.ts # width/truncate/wrap/wrapCode helpers
|
|
290
|
+
│ │ └── markdown.tsx # inline markdown parse + render
|
|
291
|
+
│ └── components/ # Banner, Sidebar, MessageList, InputBox,
|
|
292
|
+
│ # Header, Home, StatusBar, CommandMenu,
|
|
293
|
+
│ # ListPicker, TextField, TextInput,
|
|
294
|
+
│ # SettingsScreen, HelpScreen, CustomProviderForm
|
|
295
|
+
└── utils/ # runtime (Node spawn/which/ports/sleep),
|
|
296
|
+
# logger, helpers, color, binaries (auto-download),
|
|
297
|
+
# clipboard (cross-platform image/file reading)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Agent flow: **user → streamed answer/thinking → tool call → approval → execution → result back to the model → repeat → final answer**.
|
|
301
|
+
|
|
302
|
+
## Testing
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
bun test # test suite
|
|
306
|
+
bun run typecheck # typecheck (0 errors)
|
|
307
|
+
bun run build:npm # build the published Node bundle
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Coverage includes: tools (including `http_request` & `port_scan`), the agent loop, built-in agents (build/plan/pentest/security), OpenAI/Anthropic/Gemini wire formats (against a mock SSE server), image sending for every wire format, vision-model detection, Gemini tool-schema sanitization, approvals, provider errors surfaced in the chat, settings persistence, and UI rendering. No API key required.
|
|
311
|
+
|
|
312
|
+
## Troubleshooting
|
|
313
|
+
|
|
314
|
+
- **`Raw mode is not supported on the current process.stdin`** — Ink needs an interactive terminal. Run `hiraxcode` directly in a terminal (not through a pipe/CI/`nohup`). If you really must force it, set `HIRAX_FORCE_TTY=1`.
|
|
315
|
+
- **Provider returns `400 INVALID_ARGUMENT` (Gemini) about `additionalProperties` / `type`** — already fixed: tool schemas are normalized to Gemini's `functionDeclarations` format. Update to the latest version.
|
|
316
|
+
- **No response at all** — providers return errors that now show up in the chat as `⚠️ API ...`. Read the message; it's usually a wrong/empty API key or a missing model.
|
|
317
|
+
- **`Cannot find package 'ink'` / missing modules** — only relevant when running from source: run `bun install` (or `npm install`) in the repo. The published npm bundle is fully self-contained and pulls in no dependencies.
|
|
318
|
+
- **`node: command not found` / old Node** — HiraxCode needs **Node.js 20+**. Check with `node -v`. (Bun is not required.)
|
|
319
|
+
- **Installed the old name?** — the `hiraxcode` package is superseded by `@hirakoxx/cli`: `npm uninstall -g hiraxcode && npm i -g @hirakoxx/cli@latest`.
|
|
320
|
+
- **Provider says "no API key"** — open `/settings`, pick the provider, paste the API key.
|
|
321
|
+
- **`API 500: tools param requires --jinja flag` (GGUF)** — handled automatically: HiraxCode runs `llama-server` with `--jinja`. If you set `llama-server args` yourself, don't add `--no-jinja` (or add `--jinja`). Update to the latest version.
|
|
322
|
+
- **`llama-server not found`** — HiraxCode downloads llama.cpp automatically; if that fails (e.g. no internet), install it manually and set **llama-server** in `/settings` to the binary path.
|
|
323
|
+
- **Model can't read images** — use a vision model (GPT-4.1/4o, Claude, Gemini, LLaVA, Qwen2-VL). For local GGUF, set **mmproj** in `/settings`.
|
|
324
|
+
- **`/paste` says "no image in clipboard"** — make sure you copied a screenshot, not text. On Linux you need `xclip` (X11) or `wl-paste` (Wayland).
|
|
325
|
+
- **`Ctrl+V` does nothing** — some terminals (e.g. VS Code) capture `Ctrl+V` for their own paste. Use `Alt+V` or `/paste` instead.
|
|
326
|
+
- **Image not sent** — if the model is text-only, HiraxCode withholds the send and suggests models; press `/drop` to send text only.
|
|
327
|
+
- **Local model missing** — make sure the local server is running (Ollama/LM Studio/llama.cpp), then `/model`.
|
|
328
|
+
- **Logs** — `~/.local/state/hiraxcode/hiraxcode.log`.
|
|
329
|
+
- **Sessions** — `~/.local/share/hiraxcode/sessions/*.json`.
|
|
330
|
+
- **Settings** — `~/.config/hiraxcode/config.json`.
|
|
331
|
+
|
|
332
|
+
## Roadmap
|
|
333
|
+
|
|
334
|
+
- [ ] Diff preview before applying edits
|
|
335
|
+
- [ ] Syntax highlighting
|
|
336
|
+
- [ ] Subagents / parallel tasks
|
|
337
|
+
- [ ] MCP support
|
|
338
|
+
- [ ] Full themes (not just an accent)
|
|
339
|
+
- [ ] Per-provider cost & token tracking
|
|
340
|
+
|
|
341
|
+
## Development
|
|
342
|
+
|
|
343
|
+
Questions, ideas, or bug reports — reach the developer on Telegram: **[@hirakox](https://t.me/hirakox)**.
|
|
344
|
+
|
|
345
|
+
## License
|
|
346
|
+
|
|
347
|
+
MIT
|