hubble-cli 4.0.0__tar.gz
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.
- hubble_cli-4.0.0/LICENSE +21 -0
- hubble_cli-4.0.0/PKG-INFO +275 -0
- hubble_cli-4.0.0/README.md +246 -0
- hubble_cli-4.0.0/hubble/__init__.py +3 -0
- hubble_cli-4.0.0/hubble/__main__.py +4 -0
- hubble_cli-4.0.0/hubble/agent.py +546 -0
- hubble_cli-4.0.0/hubble/banner.py +484 -0
- hubble_cli-4.0.0/hubble/board.py +118 -0
- hubble_cli-4.0.0/hubble/main.py +299 -0
- hubble_cli-4.0.0/hubble/models.py +92 -0
- hubble_cli-4.0.0/hubble/onboarding.py +94 -0
- hubble_cli-4.0.0/hubble/permissions.py +139 -0
- hubble_cli-4.0.0/hubble/prompts.py +157 -0
- hubble_cli-4.0.0/hubble/provider.py +283 -0
- hubble_cli-4.0.0/hubble/providers.py +186 -0
- hubble_cli-4.0.0/hubble/repl.py +976 -0
- hubble_cli-4.0.0/hubble/scanner.py +134 -0
- hubble_cli-4.0.0/hubble/session.py +128 -0
- hubble_cli-4.0.0/hubble/settings.py +184 -0
- hubble_cli-4.0.0/hubble/skills.py +173 -0
- hubble_cli-4.0.0/hubble/spinner.py +77 -0
- hubble_cli-4.0.0/hubble/tools.py +763 -0
- hubble_cli-4.0.0/hubble/ui.py +469 -0
- hubble_cli-4.0.0/hubble/web.py +279 -0
- hubble_cli-4.0.0/hubble_cli.egg-info/PKG-INFO +275 -0
- hubble_cli-4.0.0/hubble_cli.egg-info/SOURCES.txt +33 -0
- hubble_cli-4.0.0/hubble_cli.egg-info/dependency_links.txt +1 -0
- hubble_cli-4.0.0/hubble_cli.egg-info/entry_points.txt +3 -0
- hubble_cli-4.0.0/hubble_cli.egg-info/requires.txt +6 -0
- hubble_cli-4.0.0/hubble_cli.egg-info/top_level.txt +1 -0
- hubble_cli-4.0.0/pyproject.toml +50 -0
- hubble_cli-4.0.0/setup.cfg +4 -0
- hubble_cli-4.0.0/tests/test_core.py +568 -0
- hubble_cli-4.0.0/tests/test_skills.py +186 -0
- hubble_cli-4.0.0/tests/test_tools.py +310 -0
hubble_cli-4.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hamday Rabby Hossain
|
|
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.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hubble-cli
|
|
3
|
+
Version: 4.0.0
|
|
4
|
+
Summary: Hubble: agentic coding CLI for AIHub and other OpenAI-compatible APIs
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Hamdayrabby/hubble-cli
|
|
7
|
+
Project-URL: Repository, https://github.com/Hamdayrabby/hubble-cli
|
|
8
|
+
Project-URL: Changelog, https://github.com/Hamdayrabby/hubble-cli/blob/main/CHANGELOG.md
|
|
9
|
+
Keywords: cli,agent,coding-assistant,llm,ai
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: httpx>=0.25.0
|
|
24
|
+
Requires-Dist: rich>=13.0
|
|
25
|
+
Requires-Dist: prompt_toolkit>=3.0.40
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Hubble
|
|
31
|
+
|
|
32
|
+
An agentic coding CLI in the style of Claude Code, Antigravity/Gemini CLI and Codex CLI. It works directly
|
|
33
|
+
in your repository: it searches, reads and edits files and runs commands through native function calling,
|
|
34
|
+
and you approve each action. It talks to any OpenAI-compatible API — the AIHub gateway by default, or
|
|
35
|
+
OpenAI, Groq, OpenRouter, Mistral, a local Ollama server, or others via `/provider add`.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pipx install git+https://github.com/Hamdayrabby/hubble-cli.git
|
|
41
|
+
```
|
|
42
|
+
(or `pip install --user git+https://github.com/Hamdayrabby/hubble-cli.git` if you don't use pipx)
|
|
43
|
+
|
|
44
|
+
Then just run it from any project:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
cd /path/to/your/project
|
|
48
|
+
hubble
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
With no API key configured anywhere, the first run walks you through adding one — no manual `.env` editing
|
|
52
|
+
required. To set one up yourself instead, put it in `.env` in your project or in `~/.hubble/.env`:
|
|
53
|
+
```
|
|
54
|
+
HUBBLE_API_KEY=your_key_here
|
|
55
|
+
HUBBLE_BASE_URL=https://aihub.071129.xyz/v1 # or any other OpenAI-compatible base URL
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**From a local clone**, for development: `pip install -e .` from the repo root installs the `hubble`
|
|
59
|
+
command (`aihub` also works, kept as an alias) against your working copy — edits take effect immediately.
|
|
60
|
+
Without installing at all: `python code_cli.py [args]` from the repo root (add `--cwd <project>` to work
|
|
61
|
+
elsewhere). The original single-file prototype is still there as `python chat_cli.py`.
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
hubble # interactive REPL
|
|
67
|
+
hubble "explain the architecture" # REPL with a first prompt
|
|
68
|
+
hubble -c # continue the latest session in this folder
|
|
69
|
+
hubble -r # choose a session to resume
|
|
70
|
+
hubble -p "fix the failing test" --permission-mode accept-edits --allow "shell(pytest*)"
|
|
71
|
+
git diff | hubble -p "review this diff" --output-format json
|
|
72
|
+
hubble -m nvidia/nemotron-3-super-120b-a12b --persona architect
|
|
73
|
+
hubble --test codestral-latest # check that a model responds
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Tools the model can use
|
|
77
|
+
|
|
78
|
+
| Tool | What it does |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `read_file` | Read with line numbers, `offset`/`limit` for large files |
|
|
81
|
+
| `edit_file` | Exact string replace; must be unique unless `replace_all`; keeps CRLF |
|
|
82
|
+
| `write_file` | Create or overwrite a file (existing files must be read first) |
|
|
83
|
+
| `shell` | Run a command in the workspace root (PowerShell on Windows), with timeout and closed stdin |
|
|
84
|
+
| `grep` | Regex search (ripgrep if installed, otherwise Python) |
|
|
85
|
+
| `glob` | Find files by pattern, newest first |
|
|
86
|
+
| `list_dir` | List a directory |
|
|
87
|
+
| `todo_write` | Task list for multi-step work, shown in the terminal |
|
|
88
|
+
| `task` | Read-only sub-agent for broad research; returns a report |
|
|
89
|
+
| `web_search` | Web search. DuckDuckGo by default (no key); set `BRAVE_API_KEY` or `TAVILY_API_KEY` to use those instead |
|
|
90
|
+
| `web_fetch` | Fetch a URL as readable text, page by page (`offset`). Asks once per domain; refuses local and private addresses |
|
|
91
|
+
|
|
92
|
+
Safety:
|
|
93
|
+
- **Workspace confinement:** paths outside the workspace are refused. Add others with `additional_dirs`.
|
|
94
|
+
- **Secret files are blocked:** `.env`, `*.pem`, `id_rsa` and similar are never read, searched or attached (`allow_secret_files` turns this off).
|
|
95
|
+
- **Edits need a fresh read:** a file must be read before it is edited or overwritten, and read again if it changed on disk since.
|
|
96
|
+
- **Undo:** every change is snapshotted, so `/undo` can revert it.
|
|
97
|
+
|
|
98
|
+
**Shell commands are not sandboxed by default** — they run directly on your machine with your own
|
|
99
|
+
permissions, same as anything you'd type yourself. Approval prompts are the only protection unless you
|
|
100
|
+
turn on the Docker sandbox below.
|
|
101
|
+
|
|
102
|
+
### Sandboxed shell execution (optional)
|
|
103
|
+
|
|
104
|
+
With [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed, shell commands can run
|
|
105
|
+
inside an isolated, disposable container instead of directly on your machine:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
/sandbox on
|
|
109
|
+
```
|
|
110
|
+
or in `~/.hubble/settings.json` / `.hubble/settings.json`:
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"shell_sandbox": "docker",
|
|
114
|
+
"sandbox_image": "python:3.12-slim",
|
|
115
|
+
"sandbox_memory": "1g",
|
|
116
|
+
"sandbox_cpus": "2",
|
|
117
|
+
"sandbox_network": true
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
Only the project folder is mounted in (as `/workspace`); nothing else on your machine is reachable from
|
|
121
|
+
inside it. Memory and CPU are capped, and the container is removed after every command. Set
|
|
122
|
+
`sandbox_image` to whatever your project needs (e.g. `node:20` for a JS project); set `sandbox_network` to
|
|
123
|
+
`false` to also block network access from inside the sandbox, if your workflow doesn't need `pip`/`npm`
|
|
124
|
+
install-style commands. Like `permission_mode`, `shell_sandbox` and `sandbox_network` only take effect from
|
|
125
|
+
a project's own `.hubble/settings.json` once you've trusted that folder — an untrusted, freshly cloned
|
|
126
|
+
project can't quietly turn sandboxing off or re-enable network access on your behalf.
|
|
127
|
+
|
|
128
|
+
## Permission modes
|
|
129
|
+
|
|
130
|
+
Cycle with **Shift+Tab** or set with `/mode` or `--permission-mode`:
|
|
131
|
+
|
|
132
|
+
| Mode | Behaviour |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `default` | Ask before every edit and shell command. The prompt shows a diff or the command. |
|
|
135
|
+
| `accept-edits` | Edits are auto-approved. Shell commands still ask. |
|
|
136
|
+
| `plan` | Read-only. The model explores and proposes a plan. |
|
|
137
|
+
| `yolo` | Everything is auto-approved except deny rules. |
|
|
138
|
+
|
|
139
|
+
At an approval prompt:
|
|
140
|
+
- `y` allows the action once.
|
|
141
|
+
- `a` allows it for the rest of the session: all edits, or commands with the same prefix, e.g. `pytest*`.
|
|
142
|
+
- `n` denies it. You can add feedback, which is sent to the model.
|
|
143
|
+
- Ctrl+C stops the turn.
|
|
144
|
+
|
|
145
|
+
Allow rules never apply to chained commands (`&&`, `;`, `|`, redirects), so `shell(git status*)` does not approve `git status && rm -rf x`.
|
|
146
|
+
|
|
147
|
+
## In-session commands
|
|
148
|
+
|
|
149
|
+
| Input | Action |
|
|
150
|
+
|---|---|
|
|
151
|
+
| `/help` | All commands and shortcuts |
|
|
152
|
+
| `/model [name\|#]`, `/models [filter]` | Switch or list models (latencies from `python test_models.py`) |
|
|
153
|
+
| `/mode [mode]` | Permission mode |
|
|
154
|
+
| `/persona [code\|debug\|review\|architect\|chat]` | System persona |
|
|
155
|
+
| `/clear` | New conversation |
|
|
156
|
+
| `/compact [focus]` | Summarize history to free context (automatic at 80%) |
|
|
157
|
+
| `/resume [#\|id]` | Resume a saved session |
|
|
158
|
+
| `/undo` | Revert files changed in the last turn that edited files |
|
|
159
|
+
| `/diff` | Show `git diff` |
|
|
160
|
+
| `/init` | Generate `HUBBLE.md` project instructions |
|
|
161
|
+
| `/memory` | Show loaded memory files |
|
|
162
|
+
| `/add <file>`, `/drop <file>`, `/files` | Pin files into the system prompt |
|
|
163
|
+
| `/todos`, `/cost`, `/context`, `/config`, `/test [model]`, `/temp [t]`, `/export [file]` | Info and utilities |
|
|
164
|
+
| `@path` | Attach a file (or directory listing) to your message; Tab completes paths |
|
|
165
|
+
| `!cmd` | Run a shell command yourself |
|
|
166
|
+
| `#note` | Append a note to `./HUBBLE.md` |
|
|
167
|
+
| Esc+Enter / Ctrl+J | New line |
|
|
168
|
+
| Ctrl+C / Ctrl+D | Cancel turn / quit |
|
|
169
|
+
|
|
170
|
+
**Custom commands:** `.hubble/commands/<name>.md` (project) or `~/.hubble/commands/<name>.md` (user) becomes
|
|
171
|
+
`/<name>`. `$ARGUMENTS` is replaced by the text after the command.
|
|
172
|
+
|
|
173
|
+
## Providers (extra base URLs and API keys)
|
|
174
|
+
|
|
175
|
+
Any OpenAI-compatible API can be added next to the built-in AIHub gateway: OpenRouter, Groq, OpenAI, Mistral,
|
|
176
|
+
Gemini's OpenAI endpoint, a local Ollama server, and others.
|
|
177
|
+
|
|
178
|
+
1. Type `/provider add`, or open `/provider` and choose **+ Add a provider**.
|
|
179
|
+
2. Pick a known provider or **Custom URL...**, then paste the API key. The key is hidden as you type.
|
|
180
|
+
3. The CLI checks the URL and key by listing the provider's models. If the check fails, it tells you why: wrong key, wrong URL, or can't connect.
|
|
181
|
+
4. Optionally, the CLI checks which models actually respond, in the background. Progress shows in the bottom bar.
|
|
182
|
+
5. Choose whether to switch to the new provider now. If you do, a model picker for that provider opens.
|
|
183
|
+
|
|
184
|
+
After that:
|
|
185
|
+
- `/model` lists models from every provider and switches provider automatically. The choice is saved as your default.
|
|
186
|
+
- `/provider` switches provider, `/provider list` shows all of them, and `/provider remove <name>` deletes one.
|
|
187
|
+
- `hubble --provider <name>` picks a provider for one run.
|
|
188
|
+
- On first start with no API key at all, the same setup runs instead of an error.
|
|
189
|
+
|
|
190
|
+
Extra providers are stored in `~/.hubble/providers.json`, with their API keys in plain text, like a `.env` file.
|
|
191
|
+
Their model lists are stored in `~/.hubble/models/<name>.json`. When a model is rate limited or down, Hubble retries that request with a fallback that the current provider actually has, in this order: the fallback you picked with `/fallback`, then `fallback_model` if the provider has it, then the provider's fastest verified model, then `fallback_model` on the built-in hubble provider. Sub-agents use the same route. `/fallback off` disables it for a provider.
|
|
192
|
+
|
|
193
|
+
## Project memory
|
|
194
|
+
|
|
195
|
+
On startup the CLI loads `~/.hubble/HUBBLE.md`, then one of `HUBBLE.md`, `AGENTS.md`, `CLAUDE.md` or `GEMINI.md`
|
|
196
|
+
from each directory between the git root and the workspace, into the system prompt.
|
|
197
|
+
|
|
198
|
+
## Configuration
|
|
199
|
+
|
|
200
|
+
Settings merge in order (later wins):
|
|
201
|
+
1. Built-in defaults
|
|
202
|
+
2. `~/.hubble/settings.json`
|
|
203
|
+
3. `.hubble/settings.json`
|
|
204
|
+
4. `.hubble/settings.local.json`
|
|
205
|
+
5. CLI flags
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"model": "codestral-latest",
|
|
210
|
+
"max_tokens": 8192,
|
|
211
|
+
"context_window": 128000,
|
|
212
|
+
"permission_mode": "default",
|
|
213
|
+
"shell": "auto",
|
|
214
|
+
"additional_dirs": [],
|
|
215
|
+
"permissions": {
|
|
216
|
+
"allow": ["shell(pytest*)", "shell(git status*)", "shell(git diff*)"],
|
|
217
|
+
"deny": ["shell(git push*)", "edit_file(migrations/*)"]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
- Rule syntax is `tool` or `tool(glob)`. The glob is matched against the path or the command.
|
|
223
|
+
- `bash`, `edit`, `write` and `read` work as aliases for the tool names.
|
|
224
|
+
- Deny rules win over allow rules.
|
|
225
|
+
- `shell` can be `auto` (pwsh, then Windows PowerShell), `cmd` or `bash`.
|
|
226
|
+
|
|
227
|
+
Project settings files (`.hubble/*.json`) come from the repository, so they are treated as untrusted:
|
|
228
|
+
- They can never set `base_url` or `api_key`.
|
|
229
|
+
- `permission_mode`, `allow_secret_files`, `additional_dirs`, `shell` and allow rules apply only after you trust the folder. The CLI asks once and remembers the answer in `~/.hubble/trusted_folders.json`.
|
|
230
|
+
- Deny rules always apply.
|
|
231
|
+
|
|
232
|
+
Credentials come from `HUBBLE_API_KEY` / `HUBBLE_BASE_URL` in the environment, `.env` in your project, or `~/.hubble/.env`.
|
|
233
|
+
Only `AIHUB_*` keys are read from those files.
|
|
234
|
+
|
|
235
|
+
Sessions are saved as JSONL in `~/.hubble/projects/<project>/`. Input history is in `~/.hubble/history`.
|
|
236
|
+
|
|
237
|
+
## Layout
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
hubble/
|
|
241
|
+
main.py CLI flags, headless -p mode, resume
|
|
242
|
+
repl.py prompt_toolkit REPL, slash commands, @mentions
|
|
243
|
+
ui.py rich rendering: streamed markdown, diffs, approval prompts
|
|
244
|
+
agent.py agent loop, compaction, task sub-agent
|
|
245
|
+
provider.py OpenAI-compatible SSE client, retries, tool-call assembly
|
|
246
|
+
tools.py workspace tools, sandbox, checkpoints
|
|
247
|
+
permissions.py modes and allow/deny rules
|
|
248
|
+
session.py JSONL transcripts
|
|
249
|
+
prompts.py system prompt, personas, memory files
|
|
250
|
+
settings.py layered settings and .env loading
|
|
251
|
+
models.py model registry (shared with config.py)
|
|
252
|
+
tests/ pytest suite (python -m pytest -q)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Models on AIHub
|
|
256
|
+
|
|
257
|
+
Hubble checks which models actually respond in the background: automatically every time it starts (for
|
|
258
|
+
every provider you have configured), and on demand with `/models refresh`. `/models` shows the results and
|
|
259
|
+
how long ago they were checked. Set `"model_refresh_hours"` in `~/.hubble/settings.json` to a positive number
|
|
260
|
+
to only recheck once the list is that many hours old instead of on every start, or `null` to turn the
|
|
261
|
+
automatic check off entirely (`/models refresh` still works). The check is one tiny request per model, so it
|
|
262
|
+
costs a little on paid APIs.
|
|
263
|
+
|
|
264
|
+
Running `python test_models.py` does the same scan for the built-in provider from the command line.
|
|
265
|
+
The last scan found 33 working models out of 295.
|
|
266
|
+
|
|
267
|
+
| Category | Models |
|
|
268
|
+
|---|---|
|
|
269
|
+
| Coding (default) | `codestral-latest`, `codestral-2508`, `mistral-code-latest`, `mistral-code-fim-latest` |
|
|
270
|
+
| Reasoning | `nvidia/nemotron-3-super-120b-a12b`, `intern-s2-preview`, `intern-s1-mini`, `intern-s1` |
|
|
271
|
+
| Fast chat | `ministral-14b-latest`, `open-mistral-nemo`, `ministral-8b-latest`, `ministral-3b-latest` |
|
|
272
|
+
| Vision | `meta/llama-3.2-11b-vision-instruct`, `internvl3.5-latest`, `internvl-latest` |
|
|
273
|
+
|
|
274
|
+
Native tool calling was verified on `codestral-latest`, `mistral-code-latest`, `ministral-14b-latest` and
|
|
275
|
+
`nvidia/nemotron-3-super-120b-a12b`.
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Hubble
|
|
2
|
+
|
|
3
|
+
An agentic coding CLI in the style of Claude Code, Antigravity/Gemini CLI and Codex CLI. It works directly
|
|
4
|
+
in your repository: it searches, reads and edits files and runs commands through native function calling,
|
|
5
|
+
and you approve each action. It talks to any OpenAI-compatible API — the AIHub gateway by default, or
|
|
6
|
+
OpenAI, Groq, OpenRouter, Mistral, a local Ollama server, or others via `/provider add`.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pipx install git+https://github.com/Hamdayrabby/hubble-cli.git
|
|
12
|
+
```
|
|
13
|
+
(or `pip install --user git+https://github.com/Hamdayrabby/hubble-cli.git` if you don't use pipx)
|
|
14
|
+
|
|
15
|
+
Then just run it from any project:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd /path/to/your/project
|
|
19
|
+
hubble
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
With no API key configured anywhere, the first run walks you through adding one — no manual `.env` editing
|
|
23
|
+
required. To set one up yourself instead, put it in `.env` in your project or in `~/.hubble/.env`:
|
|
24
|
+
```
|
|
25
|
+
HUBBLE_API_KEY=your_key_here
|
|
26
|
+
HUBBLE_BASE_URL=https://aihub.071129.xyz/v1 # or any other OpenAI-compatible base URL
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**From a local clone**, for development: `pip install -e .` from the repo root installs the `hubble`
|
|
30
|
+
command (`aihub` also works, kept as an alias) against your working copy — edits take effect immediately.
|
|
31
|
+
Without installing at all: `python code_cli.py [args]` from the repo root (add `--cwd <project>` to work
|
|
32
|
+
elsewhere). The original single-file prototype is still there as `python chat_cli.py`.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
hubble # interactive REPL
|
|
38
|
+
hubble "explain the architecture" # REPL with a first prompt
|
|
39
|
+
hubble -c # continue the latest session in this folder
|
|
40
|
+
hubble -r # choose a session to resume
|
|
41
|
+
hubble -p "fix the failing test" --permission-mode accept-edits --allow "shell(pytest*)"
|
|
42
|
+
git diff | hubble -p "review this diff" --output-format json
|
|
43
|
+
hubble -m nvidia/nemotron-3-super-120b-a12b --persona architect
|
|
44
|
+
hubble --test codestral-latest # check that a model responds
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Tools the model can use
|
|
48
|
+
|
|
49
|
+
| Tool | What it does |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `read_file` | Read with line numbers, `offset`/`limit` for large files |
|
|
52
|
+
| `edit_file` | Exact string replace; must be unique unless `replace_all`; keeps CRLF |
|
|
53
|
+
| `write_file` | Create or overwrite a file (existing files must be read first) |
|
|
54
|
+
| `shell` | Run a command in the workspace root (PowerShell on Windows), with timeout and closed stdin |
|
|
55
|
+
| `grep` | Regex search (ripgrep if installed, otherwise Python) |
|
|
56
|
+
| `glob` | Find files by pattern, newest first |
|
|
57
|
+
| `list_dir` | List a directory |
|
|
58
|
+
| `todo_write` | Task list for multi-step work, shown in the terminal |
|
|
59
|
+
| `task` | Read-only sub-agent for broad research; returns a report |
|
|
60
|
+
| `web_search` | Web search. DuckDuckGo by default (no key); set `BRAVE_API_KEY` or `TAVILY_API_KEY` to use those instead |
|
|
61
|
+
| `web_fetch` | Fetch a URL as readable text, page by page (`offset`). Asks once per domain; refuses local and private addresses |
|
|
62
|
+
|
|
63
|
+
Safety:
|
|
64
|
+
- **Workspace confinement:** paths outside the workspace are refused. Add others with `additional_dirs`.
|
|
65
|
+
- **Secret files are blocked:** `.env`, `*.pem`, `id_rsa` and similar are never read, searched or attached (`allow_secret_files` turns this off).
|
|
66
|
+
- **Edits need a fresh read:** a file must be read before it is edited or overwritten, and read again if it changed on disk since.
|
|
67
|
+
- **Undo:** every change is snapshotted, so `/undo` can revert it.
|
|
68
|
+
|
|
69
|
+
**Shell commands are not sandboxed by default** — they run directly on your machine with your own
|
|
70
|
+
permissions, same as anything you'd type yourself. Approval prompts are the only protection unless you
|
|
71
|
+
turn on the Docker sandbox below.
|
|
72
|
+
|
|
73
|
+
### Sandboxed shell execution (optional)
|
|
74
|
+
|
|
75
|
+
With [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed, shell commands can run
|
|
76
|
+
inside an isolated, disposable container instead of directly on your machine:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
/sandbox on
|
|
80
|
+
```
|
|
81
|
+
or in `~/.hubble/settings.json` / `.hubble/settings.json`:
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"shell_sandbox": "docker",
|
|
85
|
+
"sandbox_image": "python:3.12-slim",
|
|
86
|
+
"sandbox_memory": "1g",
|
|
87
|
+
"sandbox_cpus": "2",
|
|
88
|
+
"sandbox_network": true
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
Only the project folder is mounted in (as `/workspace`); nothing else on your machine is reachable from
|
|
92
|
+
inside it. Memory and CPU are capped, and the container is removed after every command. Set
|
|
93
|
+
`sandbox_image` to whatever your project needs (e.g. `node:20` for a JS project); set `sandbox_network` to
|
|
94
|
+
`false` to also block network access from inside the sandbox, if your workflow doesn't need `pip`/`npm`
|
|
95
|
+
install-style commands. Like `permission_mode`, `shell_sandbox` and `sandbox_network` only take effect from
|
|
96
|
+
a project's own `.hubble/settings.json` once you've trusted that folder — an untrusted, freshly cloned
|
|
97
|
+
project can't quietly turn sandboxing off or re-enable network access on your behalf.
|
|
98
|
+
|
|
99
|
+
## Permission modes
|
|
100
|
+
|
|
101
|
+
Cycle with **Shift+Tab** or set with `/mode` or `--permission-mode`:
|
|
102
|
+
|
|
103
|
+
| Mode | Behaviour |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `default` | Ask before every edit and shell command. The prompt shows a diff or the command. |
|
|
106
|
+
| `accept-edits` | Edits are auto-approved. Shell commands still ask. |
|
|
107
|
+
| `plan` | Read-only. The model explores and proposes a plan. |
|
|
108
|
+
| `yolo` | Everything is auto-approved except deny rules. |
|
|
109
|
+
|
|
110
|
+
At an approval prompt:
|
|
111
|
+
- `y` allows the action once.
|
|
112
|
+
- `a` allows it for the rest of the session: all edits, or commands with the same prefix, e.g. `pytest*`.
|
|
113
|
+
- `n` denies it. You can add feedback, which is sent to the model.
|
|
114
|
+
- Ctrl+C stops the turn.
|
|
115
|
+
|
|
116
|
+
Allow rules never apply to chained commands (`&&`, `;`, `|`, redirects), so `shell(git status*)` does not approve `git status && rm -rf x`.
|
|
117
|
+
|
|
118
|
+
## In-session commands
|
|
119
|
+
|
|
120
|
+
| Input | Action |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `/help` | All commands and shortcuts |
|
|
123
|
+
| `/model [name\|#]`, `/models [filter]` | Switch or list models (latencies from `python test_models.py`) |
|
|
124
|
+
| `/mode [mode]` | Permission mode |
|
|
125
|
+
| `/persona [code\|debug\|review\|architect\|chat]` | System persona |
|
|
126
|
+
| `/clear` | New conversation |
|
|
127
|
+
| `/compact [focus]` | Summarize history to free context (automatic at 80%) |
|
|
128
|
+
| `/resume [#\|id]` | Resume a saved session |
|
|
129
|
+
| `/undo` | Revert files changed in the last turn that edited files |
|
|
130
|
+
| `/diff` | Show `git diff` |
|
|
131
|
+
| `/init` | Generate `HUBBLE.md` project instructions |
|
|
132
|
+
| `/memory` | Show loaded memory files |
|
|
133
|
+
| `/add <file>`, `/drop <file>`, `/files` | Pin files into the system prompt |
|
|
134
|
+
| `/todos`, `/cost`, `/context`, `/config`, `/test [model]`, `/temp [t]`, `/export [file]` | Info and utilities |
|
|
135
|
+
| `@path` | Attach a file (or directory listing) to your message; Tab completes paths |
|
|
136
|
+
| `!cmd` | Run a shell command yourself |
|
|
137
|
+
| `#note` | Append a note to `./HUBBLE.md` |
|
|
138
|
+
| Esc+Enter / Ctrl+J | New line |
|
|
139
|
+
| Ctrl+C / Ctrl+D | Cancel turn / quit |
|
|
140
|
+
|
|
141
|
+
**Custom commands:** `.hubble/commands/<name>.md` (project) or `~/.hubble/commands/<name>.md` (user) becomes
|
|
142
|
+
`/<name>`. `$ARGUMENTS` is replaced by the text after the command.
|
|
143
|
+
|
|
144
|
+
## Providers (extra base URLs and API keys)
|
|
145
|
+
|
|
146
|
+
Any OpenAI-compatible API can be added next to the built-in AIHub gateway: OpenRouter, Groq, OpenAI, Mistral,
|
|
147
|
+
Gemini's OpenAI endpoint, a local Ollama server, and others.
|
|
148
|
+
|
|
149
|
+
1. Type `/provider add`, or open `/provider` and choose **+ Add a provider**.
|
|
150
|
+
2. Pick a known provider or **Custom URL...**, then paste the API key. The key is hidden as you type.
|
|
151
|
+
3. The CLI checks the URL and key by listing the provider's models. If the check fails, it tells you why: wrong key, wrong URL, or can't connect.
|
|
152
|
+
4. Optionally, the CLI checks which models actually respond, in the background. Progress shows in the bottom bar.
|
|
153
|
+
5. Choose whether to switch to the new provider now. If you do, a model picker for that provider opens.
|
|
154
|
+
|
|
155
|
+
After that:
|
|
156
|
+
- `/model` lists models from every provider and switches provider automatically. The choice is saved as your default.
|
|
157
|
+
- `/provider` switches provider, `/provider list` shows all of them, and `/provider remove <name>` deletes one.
|
|
158
|
+
- `hubble --provider <name>` picks a provider for one run.
|
|
159
|
+
- On first start with no API key at all, the same setup runs instead of an error.
|
|
160
|
+
|
|
161
|
+
Extra providers are stored in `~/.hubble/providers.json`, with their API keys in plain text, like a `.env` file.
|
|
162
|
+
Their model lists are stored in `~/.hubble/models/<name>.json`. When a model is rate limited or down, Hubble retries that request with a fallback that the current provider actually has, in this order: the fallback you picked with `/fallback`, then `fallback_model` if the provider has it, then the provider's fastest verified model, then `fallback_model` on the built-in hubble provider. Sub-agents use the same route. `/fallback off` disables it for a provider.
|
|
163
|
+
|
|
164
|
+
## Project memory
|
|
165
|
+
|
|
166
|
+
On startup the CLI loads `~/.hubble/HUBBLE.md`, then one of `HUBBLE.md`, `AGENTS.md`, `CLAUDE.md` or `GEMINI.md`
|
|
167
|
+
from each directory between the git root and the workspace, into the system prompt.
|
|
168
|
+
|
|
169
|
+
## Configuration
|
|
170
|
+
|
|
171
|
+
Settings merge in order (later wins):
|
|
172
|
+
1. Built-in defaults
|
|
173
|
+
2. `~/.hubble/settings.json`
|
|
174
|
+
3. `.hubble/settings.json`
|
|
175
|
+
4. `.hubble/settings.local.json`
|
|
176
|
+
5. CLI flags
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"model": "codestral-latest",
|
|
181
|
+
"max_tokens": 8192,
|
|
182
|
+
"context_window": 128000,
|
|
183
|
+
"permission_mode": "default",
|
|
184
|
+
"shell": "auto",
|
|
185
|
+
"additional_dirs": [],
|
|
186
|
+
"permissions": {
|
|
187
|
+
"allow": ["shell(pytest*)", "shell(git status*)", "shell(git diff*)"],
|
|
188
|
+
"deny": ["shell(git push*)", "edit_file(migrations/*)"]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- Rule syntax is `tool` or `tool(glob)`. The glob is matched against the path or the command.
|
|
194
|
+
- `bash`, `edit`, `write` and `read` work as aliases for the tool names.
|
|
195
|
+
- Deny rules win over allow rules.
|
|
196
|
+
- `shell` can be `auto` (pwsh, then Windows PowerShell), `cmd` or `bash`.
|
|
197
|
+
|
|
198
|
+
Project settings files (`.hubble/*.json`) come from the repository, so they are treated as untrusted:
|
|
199
|
+
- They can never set `base_url` or `api_key`.
|
|
200
|
+
- `permission_mode`, `allow_secret_files`, `additional_dirs`, `shell` and allow rules apply only after you trust the folder. The CLI asks once and remembers the answer in `~/.hubble/trusted_folders.json`.
|
|
201
|
+
- Deny rules always apply.
|
|
202
|
+
|
|
203
|
+
Credentials come from `HUBBLE_API_KEY` / `HUBBLE_BASE_URL` in the environment, `.env` in your project, or `~/.hubble/.env`.
|
|
204
|
+
Only `AIHUB_*` keys are read from those files.
|
|
205
|
+
|
|
206
|
+
Sessions are saved as JSONL in `~/.hubble/projects/<project>/`. Input history is in `~/.hubble/history`.
|
|
207
|
+
|
|
208
|
+
## Layout
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
hubble/
|
|
212
|
+
main.py CLI flags, headless -p mode, resume
|
|
213
|
+
repl.py prompt_toolkit REPL, slash commands, @mentions
|
|
214
|
+
ui.py rich rendering: streamed markdown, diffs, approval prompts
|
|
215
|
+
agent.py agent loop, compaction, task sub-agent
|
|
216
|
+
provider.py OpenAI-compatible SSE client, retries, tool-call assembly
|
|
217
|
+
tools.py workspace tools, sandbox, checkpoints
|
|
218
|
+
permissions.py modes and allow/deny rules
|
|
219
|
+
session.py JSONL transcripts
|
|
220
|
+
prompts.py system prompt, personas, memory files
|
|
221
|
+
settings.py layered settings and .env loading
|
|
222
|
+
models.py model registry (shared with config.py)
|
|
223
|
+
tests/ pytest suite (python -m pytest -q)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Models on AIHub
|
|
227
|
+
|
|
228
|
+
Hubble checks which models actually respond in the background: automatically every time it starts (for
|
|
229
|
+
every provider you have configured), and on demand with `/models refresh`. `/models` shows the results and
|
|
230
|
+
how long ago they were checked. Set `"model_refresh_hours"` in `~/.hubble/settings.json` to a positive number
|
|
231
|
+
to only recheck once the list is that many hours old instead of on every start, or `null` to turn the
|
|
232
|
+
automatic check off entirely (`/models refresh` still works). The check is one tiny request per model, so it
|
|
233
|
+
costs a little on paid APIs.
|
|
234
|
+
|
|
235
|
+
Running `python test_models.py` does the same scan for the built-in provider from the command line.
|
|
236
|
+
The last scan found 33 working models out of 295.
|
|
237
|
+
|
|
238
|
+
| Category | Models |
|
|
239
|
+
|---|---|
|
|
240
|
+
| Coding (default) | `codestral-latest`, `codestral-2508`, `mistral-code-latest`, `mistral-code-fim-latest` |
|
|
241
|
+
| Reasoning | `nvidia/nemotron-3-super-120b-a12b`, `intern-s2-preview`, `intern-s1-mini`, `intern-s1` |
|
|
242
|
+
| Fast chat | `ministral-14b-latest`, `open-mistral-nemo`, `ministral-8b-latest`, `ministral-3b-latest` |
|
|
243
|
+
| Vision | `meta/llama-3.2-11b-vision-instruct`, `internvl3.5-latest`, `internvl-latest` |
|
|
244
|
+
|
|
245
|
+
Native tool calling was verified on `codestral-latest`, `mistral-code-latest`, `ministral-14b-latest` and
|
|
246
|
+
`nvidia/nemotron-3-super-120b-a12b`.
|