bhai-cli 0.1.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.
- bhai_cli-0.1.0/LICENSE +190 -0
- bhai_cli-0.1.0/PKG-INFO +228 -0
- bhai_cli-0.1.0/README.md +192 -0
- bhai_cli-0.1.0/pyproject.toml +60 -0
- bhai_cli-0.1.0/src/bhai_cli/__init__.py +9 -0
- bhai_cli-0.1.0/src/bhai_cli/audio_engine.py +269 -0
- bhai_cli-0.1.0/src/bhai_cli/cli.py +305 -0
- bhai_cli-0.1.0/src/bhai_cli/config_manager.py +138 -0
- bhai_cli-0.1.0/src/bhai_cli/orchestrator.py +233 -0
- bhai_cli-0.1.0/src/bhai_cli/tools/__init__.py +124 -0
- bhai_cli-0.1.0/src/bhai_cli/tools/bash.py +86 -0
- bhai_cli-0.1.0/src/bhai_cli/tools/codebase.py +193 -0
- bhai_cli-0.1.0/src/bhai_cli/tools/search.py +49 -0
bhai_cli-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 Madhav Kapila
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
bhai_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bhai-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: BHAI — The Dual-Brain AI Coding Agent with Punjabi Swagger. Indic-native voice + universal LLM tool-calling.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Madhav Kapila
|
|
8
|
+
Author-email: smartatk04@gmail.com
|
|
9
|
+
Requires-Python: >=3.11,<4.0
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
19
|
+
Provides-Extra: audio
|
|
20
|
+
Requires-Dist: duckduckgo-search (>=6.0.0)
|
|
21
|
+
Requires-Dist: httpx (>=0.27.0)
|
|
22
|
+
Requires-Dist: litellm (>=1.40.0)
|
|
23
|
+
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
24
|
+
Requires-Dist: pydantic-settings (>=2.0.0,<3.0.0)
|
|
25
|
+
Requires-Dist: pyfiglet (>=1.0.2,<2.0.0)
|
|
26
|
+
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
27
|
+
Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
28
|
+
Requires-Dist: rich (>=13.7.0,<14.0.0)
|
|
29
|
+
Requires-Dist: sounddevice (>=0.4.6) ; extra == "audio"
|
|
30
|
+
Requires-Dist: soundfile (>=0.12.0) ; extra == "audio"
|
|
31
|
+
Requires-Dist: typer[all] (>=0.12.3)
|
|
32
|
+
Project-URL: Homepage, https://github.com/madhavkapila
|
|
33
|
+
Project-URL: Repository, https://github.com/madhavkapila/bhai-cli
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# 🇮🇳 BHAI-CLI
|
|
37
|
+
|
|
38
|
+
**The Dual-Brain AI Coding Agent — 22 Indian Languages. One CLI.**
|
|
39
|
+
|
|
40
|
+
> भाई · ভাই · ભાઈ · ਭਾਈ · భాయ్ · ಭಾಯ್ · भाऊ · ভাই
|
|
41
|
+
|
|
42
|
+
BHAI is a lean, zero-state resilient CLI tool that acts as your 10x Senior SDE from India. It uses a **Dual-Brain Architecture** — a VibeLLM for persona and intent parsing, and a CoderAgent for tool-calling execution — all powered by [litellm](https://github.com/BerriAI/litellm) for universal LLM provider support and [Sarvam AI](https://sarvam.ai) for 22 Indian language understanding.
|
|
43
|
+
|
|
44
|
+
> *"You are BHAI, a 10x Senior SDE from India. Sab bhasha samajhte ho. You roast O(N²) loops and unoptimized Dockerfiles."*
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## ✨ Features
|
|
49
|
+
|
|
50
|
+
- **🧠 Dual-Brain Architecture**: VibeLLM (persona + intent) → CoderAgent (tool execution) → VibeLLM (swagger summary)
|
|
51
|
+
- **🇮🇳 22 Indian Languages**: Speak in Hindi, Punjabi, Bengali, Tamil, Telugu, Gujarati, Marathi, Kannada, Malayalam, and more — powered by Sarvam AI
|
|
52
|
+
- **🌍 Universal LLM Support**: Every provider on Earth — OpenAI, Anthropic, Groq, Google Gemini, Sarvam, Mistral, Cerebras, Ollama, Bedrock, and more via litellm
|
|
53
|
+
- **🎙️ Indic Voice Interface**: Sarvam Saaras v3 (STT) translates any Indian language to English, Bulbul v3 (TTS) reads responses back
|
|
54
|
+
- **🔧 MCP-Style Tools**: `execute_bash`, `web_search`, `codebase_context` — with a hard `[Y/n]` guardrail on every command
|
|
55
|
+
- **⚡ Zero-State Resilience**: Boots in <300ms, persistent YAML config, hot-swappable model overrides
|
|
56
|
+
- **📦 PyPI-Ready**: Clean `src/` layout, Poetry-managed, lean dependency footprint
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 🚀 Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install bhai-cli
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**With voice support (optional):**
|
|
67
|
+
```bash
|
|
68
|
+
pip install "bhai-cli[audio]"
|
|
69
|
+
# Also needs: sudo apt install libportaudio2 (Linux)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## ⚙️ Setup
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bhai-code setup
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The interactive wizard will configure:
|
|
81
|
+
1. **VibeLLM** — Your persona brain (e.g., `sarvam/sarvam-105b`, `groq/llama-3.3-70b-versatile`)
|
|
82
|
+
2. **CoderAgent** — Your tool-calling brain (e.g., `openai/gpt-4o`, `anthropic/claude-sonnet-4-20250514`)
|
|
83
|
+
3. **Sarvam AI** — Voice interface API key (optional)
|
|
84
|
+
|
|
85
|
+
### Model Format
|
|
86
|
+
|
|
87
|
+
Uses [litellm's model naming](https://docs.litellm.ai/docs/providers):
|
|
88
|
+
|
|
89
|
+
| Provider | Format | Example |
|
|
90
|
+
|----------|--------|---------|
|
|
91
|
+
| OpenAI | `openai/model` | `openai/gpt-4o` |
|
|
92
|
+
| Anthropic | `anthropic/model` | `anthropic/claude-sonnet-4-20250514` |
|
|
93
|
+
| Google | `gemini/model` | `gemini/gemini-2.5-flash` |
|
|
94
|
+
| Groq | `groq/model` | `groq/llama-3.3-70b-versatile` |
|
|
95
|
+
| Sarvam | `sarvam/model` | `sarvam/sarvam-105b` |
|
|
96
|
+
| Mistral | `mistral/model` | `mistral/mistral-large-latest` |
|
|
97
|
+
| Cerebras | `cerebras/model` | `cerebras/llama-3.3-70b` |
|
|
98
|
+
| Ollama | `ollama/model` | `ollama/llama3` |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 💬 Usage
|
|
103
|
+
|
|
104
|
+
### Text Mode
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Single prompt
|
|
108
|
+
bhai-code text "find all TODO comments in this project"
|
|
109
|
+
|
|
110
|
+
# Interactive chat
|
|
111
|
+
bhai-code text "what does this codebase do?" --interactive
|
|
112
|
+
|
|
113
|
+
# Override models on the fly
|
|
114
|
+
bhai-code text "optimize this Dockerfile" --vibe-model groq/llama-3.3-70b-versatile --coder-model openai/gpt-4o
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Voice Mode
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Live microphone
|
|
121
|
+
bhai-code listen
|
|
122
|
+
|
|
123
|
+
# From audio file
|
|
124
|
+
bhai-code listen --file recording.wav
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### View Config
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bhai-code config
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 🏗️ Architecture
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
User Input (Any of 22 Indian Languages / English)
|
|
139
|
+
│
|
|
140
|
+
▼
|
|
141
|
+
┌─────────────────────┐
|
|
142
|
+
│ VibeLLM (Brain A) │ ← Persona + Intent Parsing
|
|
143
|
+
│ Sarvam-105B / any │
|
|
144
|
+
└──────────┬──────────┘
|
|
145
|
+
│ {"task": "clean English intent"}
|
|
146
|
+
▼
|
|
147
|
+
┌─────────────────────┐
|
|
148
|
+
│ CoderAgent (Brain B)│ ← Tool-Calling Execution
|
|
149
|
+
│ Any litellm model │
|
|
150
|
+
│ │
|
|
151
|
+
│ Tools: │
|
|
152
|
+
│ • execute_bash │ ← [Y/n] guardrail
|
|
153
|
+
│ • web_search │ ← DuckDuckGo
|
|
154
|
+
│ • codebase_context │ ← AST signatures
|
|
155
|
+
└──────────┬──────────┘
|
|
156
|
+
│ Results
|
|
157
|
+
▼
|
|
158
|
+
┌─────────────────────┐
|
|
159
|
+
│ VibeLLM (Brain A) │ ← Swagger Summary
|
|
160
|
+
└─────────────────────┘
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🔧 Tools
|
|
166
|
+
|
|
167
|
+
| Tool | Description |
|
|
168
|
+
|------|-------------|
|
|
169
|
+
| `execute_bash` | Run shell commands with mandatory `[Y/n]` confirmation, timeout handling |
|
|
170
|
+
| `web_search` | DuckDuckGo search for real-time debugging and docs lookup |
|
|
171
|
+
| `codebase_context` | Smart directory scanner with AST-based signature extraction (anti-context-rot) |
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 📁 Project Structure
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
bhai-cli/
|
|
179
|
+
├── src/bhai_cli/
|
|
180
|
+
│ ├── __init__.py # Package metadata
|
|
181
|
+
│ ├── cli.py # Typer CLI (setup, text, listen, config)
|
|
182
|
+
│ ├── config_manager.py # Pydantic YAML/env config engine
|
|
183
|
+
│ ├── orchestrator.py # Dual-Brain routing logic
|
|
184
|
+
│ ├── audio_engine.py # Sarvam STT/TTS + mic recording
|
|
185
|
+
│ └── tools/
|
|
186
|
+
│ ├── __init__.py # Tool registry + JSON schemas
|
|
187
|
+
│ ├── bash.py # execute_bash with guardrails
|
|
188
|
+
│ ├── search.py # web_search via DuckDuckGo
|
|
189
|
+
│ └── codebase.py # codebase_context with AST
|
|
190
|
+
├── tests/
|
|
191
|
+
├── pyproject.toml # Poetry config (lean deps)
|
|
192
|
+
├── README.md
|
|
193
|
+
└── LICENSE # Apache-2.0
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 🔑 Environment Variables
|
|
199
|
+
|
|
200
|
+
| Variable | Description |
|
|
201
|
+
|----------|-------------|
|
|
202
|
+
| `SARVAM_API_KEY` | Sarvam AI API key |
|
|
203
|
+
| `VIBE_API_KEY` | VibeLLM provider API key |
|
|
204
|
+
| `CODER_API_KEY` | CoderAgent provider API key |
|
|
205
|
+
| `GROQ_API_KEY` | Groq API key (auto-detected by litellm) |
|
|
206
|
+
| `OPENAI_API_KEY` | OpenAI API key (auto-detected by litellm) |
|
|
207
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key (auto-detected by litellm) |
|
|
208
|
+
| `GEMINI_API_KEY` | Google Gemini API key (auto-detected by litellm) |
|
|
209
|
+
|
|
210
|
+
You can also use a `.env` file in your working directory.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 🗺️ Roadmap (v2)
|
|
215
|
+
|
|
216
|
+
- [ ] MCP Server connectivity for external tool integration
|
|
217
|
+
- [ ] Streaming responses
|
|
218
|
+
- [ ] Multi-turn CoderAgent memory
|
|
219
|
+
- [ ] Plugin system for custom tools
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 📄 License
|
|
224
|
+
|
|
225
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
226
|
+
|
|
227
|
+
Built with ❤️ from India by [Madhav Kapila](https://github.com/madhavkapila).
|
|
228
|
+
|
bhai_cli-0.1.0/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# 🇮🇳 BHAI-CLI
|
|
2
|
+
|
|
3
|
+
**The Dual-Brain AI Coding Agent — 22 Indian Languages. One CLI.**
|
|
4
|
+
|
|
5
|
+
> भाई · ভাই · ભાઈ · ਭਾਈ · భాయ్ · ಭಾಯ್ · भाऊ · ভাই
|
|
6
|
+
|
|
7
|
+
BHAI is a lean, zero-state resilient CLI tool that acts as your 10x Senior SDE from India. It uses a **Dual-Brain Architecture** — a VibeLLM for persona and intent parsing, and a CoderAgent for tool-calling execution — all powered by [litellm](https://github.com/BerriAI/litellm) for universal LLM provider support and [Sarvam AI](https://sarvam.ai) for 22 Indian language understanding.
|
|
8
|
+
|
|
9
|
+
> *"You are BHAI, a 10x Senior SDE from India. Sab bhasha samajhte ho. You roast O(N²) loops and unoptimized Dockerfiles."*
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ✨ Features
|
|
14
|
+
|
|
15
|
+
- **🧠 Dual-Brain Architecture**: VibeLLM (persona + intent) → CoderAgent (tool execution) → VibeLLM (swagger summary)
|
|
16
|
+
- **🇮🇳 22 Indian Languages**: Speak in Hindi, Punjabi, Bengali, Tamil, Telugu, Gujarati, Marathi, Kannada, Malayalam, and more — powered by Sarvam AI
|
|
17
|
+
- **🌍 Universal LLM Support**: Every provider on Earth — OpenAI, Anthropic, Groq, Google Gemini, Sarvam, Mistral, Cerebras, Ollama, Bedrock, and more via litellm
|
|
18
|
+
- **🎙️ Indic Voice Interface**: Sarvam Saaras v3 (STT) translates any Indian language to English, Bulbul v3 (TTS) reads responses back
|
|
19
|
+
- **🔧 MCP-Style Tools**: `execute_bash`, `web_search`, `codebase_context` — with a hard `[Y/n]` guardrail on every command
|
|
20
|
+
- **⚡ Zero-State Resilience**: Boots in <300ms, persistent YAML config, hot-swappable model overrides
|
|
21
|
+
- **📦 PyPI-Ready**: Clean `src/` layout, Poetry-managed, lean dependency footprint
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🚀 Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install bhai-cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**With voice support (optional):**
|
|
32
|
+
```bash
|
|
33
|
+
pip install "bhai-cli[audio]"
|
|
34
|
+
# Also needs: sudo apt install libportaudio2 (Linux)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ⚙️ Setup
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bhai-code setup
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The interactive wizard will configure:
|
|
46
|
+
1. **VibeLLM** — Your persona brain (e.g., `sarvam/sarvam-105b`, `groq/llama-3.3-70b-versatile`)
|
|
47
|
+
2. **CoderAgent** — Your tool-calling brain (e.g., `openai/gpt-4o`, `anthropic/claude-sonnet-4-20250514`)
|
|
48
|
+
3. **Sarvam AI** — Voice interface API key (optional)
|
|
49
|
+
|
|
50
|
+
### Model Format
|
|
51
|
+
|
|
52
|
+
Uses [litellm's model naming](https://docs.litellm.ai/docs/providers):
|
|
53
|
+
|
|
54
|
+
| Provider | Format | Example |
|
|
55
|
+
|----------|--------|---------|
|
|
56
|
+
| OpenAI | `openai/model` | `openai/gpt-4o` |
|
|
57
|
+
| Anthropic | `anthropic/model` | `anthropic/claude-sonnet-4-20250514` |
|
|
58
|
+
| Google | `gemini/model` | `gemini/gemini-2.5-flash` |
|
|
59
|
+
| Groq | `groq/model` | `groq/llama-3.3-70b-versatile` |
|
|
60
|
+
| Sarvam | `sarvam/model` | `sarvam/sarvam-105b` |
|
|
61
|
+
| Mistral | `mistral/model` | `mistral/mistral-large-latest` |
|
|
62
|
+
| Cerebras | `cerebras/model` | `cerebras/llama-3.3-70b` |
|
|
63
|
+
| Ollama | `ollama/model` | `ollama/llama3` |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 💬 Usage
|
|
68
|
+
|
|
69
|
+
### Text Mode
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Single prompt
|
|
73
|
+
bhai-code text "find all TODO comments in this project"
|
|
74
|
+
|
|
75
|
+
# Interactive chat
|
|
76
|
+
bhai-code text "what does this codebase do?" --interactive
|
|
77
|
+
|
|
78
|
+
# Override models on the fly
|
|
79
|
+
bhai-code text "optimize this Dockerfile" --vibe-model groq/llama-3.3-70b-versatile --coder-model openai/gpt-4o
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Voice Mode
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Live microphone
|
|
86
|
+
bhai-code listen
|
|
87
|
+
|
|
88
|
+
# From audio file
|
|
89
|
+
bhai-code listen --file recording.wav
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### View Config
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
bhai-code config
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🏗️ Architecture
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
User Input (Any of 22 Indian Languages / English)
|
|
104
|
+
│
|
|
105
|
+
▼
|
|
106
|
+
┌─────────────────────┐
|
|
107
|
+
│ VibeLLM (Brain A) │ ← Persona + Intent Parsing
|
|
108
|
+
│ Sarvam-105B / any │
|
|
109
|
+
└──────────┬──────────┘
|
|
110
|
+
│ {"task": "clean English intent"}
|
|
111
|
+
▼
|
|
112
|
+
┌─────────────────────┐
|
|
113
|
+
│ CoderAgent (Brain B)│ ← Tool-Calling Execution
|
|
114
|
+
│ Any litellm model │
|
|
115
|
+
│ │
|
|
116
|
+
│ Tools: │
|
|
117
|
+
│ • execute_bash │ ← [Y/n] guardrail
|
|
118
|
+
│ • web_search │ ← DuckDuckGo
|
|
119
|
+
│ • codebase_context │ ← AST signatures
|
|
120
|
+
└──────────┬──────────┘
|
|
121
|
+
│ Results
|
|
122
|
+
▼
|
|
123
|
+
┌─────────────────────┐
|
|
124
|
+
│ VibeLLM (Brain A) │ ← Swagger Summary
|
|
125
|
+
└─────────────────────┘
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🔧 Tools
|
|
131
|
+
|
|
132
|
+
| Tool | Description |
|
|
133
|
+
|------|-------------|
|
|
134
|
+
| `execute_bash` | Run shell commands with mandatory `[Y/n]` confirmation, timeout handling |
|
|
135
|
+
| `web_search` | DuckDuckGo search for real-time debugging and docs lookup |
|
|
136
|
+
| `codebase_context` | Smart directory scanner with AST-based signature extraction (anti-context-rot) |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 📁 Project Structure
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
bhai-cli/
|
|
144
|
+
├── src/bhai_cli/
|
|
145
|
+
│ ├── __init__.py # Package metadata
|
|
146
|
+
│ ├── cli.py # Typer CLI (setup, text, listen, config)
|
|
147
|
+
│ ├── config_manager.py # Pydantic YAML/env config engine
|
|
148
|
+
│ ├── orchestrator.py # Dual-Brain routing logic
|
|
149
|
+
│ ├── audio_engine.py # Sarvam STT/TTS + mic recording
|
|
150
|
+
│ └── tools/
|
|
151
|
+
│ ├── __init__.py # Tool registry + JSON schemas
|
|
152
|
+
│ ├── bash.py # execute_bash with guardrails
|
|
153
|
+
│ ├── search.py # web_search via DuckDuckGo
|
|
154
|
+
│ └── codebase.py # codebase_context with AST
|
|
155
|
+
├── tests/
|
|
156
|
+
├── pyproject.toml # Poetry config (lean deps)
|
|
157
|
+
├── README.md
|
|
158
|
+
└── LICENSE # Apache-2.0
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 🔑 Environment Variables
|
|
164
|
+
|
|
165
|
+
| Variable | Description |
|
|
166
|
+
|----------|-------------|
|
|
167
|
+
| `SARVAM_API_KEY` | Sarvam AI API key |
|
|
168
|
+
| `VIBE_API_KEY` | VibeLLM provider API key |
|
|
169
|
+
| `CODER_API_KEY` | CoderAgent provider API key |
|
|
170
|
+
| `GROQ_API_KEY` | Groq API key (auto-detected by litellm) |
|
|
171
|
+
| `OPENAI_API_KEY` | OpenAI API key (auto-detected by litellm) |
|
|
172
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key (auto-detected by litellm) |
|
|
173
|
+
| `GEMINI_API_KEY` | Google Gemini API key (auto-detected by litellm) |
|
|
174
|
+
|
|
175
|
+
You can also use a `.env` file in your working directory.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 🗺️ Roadmap (v2)
|
|
180
|
+
|
|
181
|
+
- [ ] MCP Server connectivity for external tool integration
|
|
182
|
+
- [ ] Streaming responses
|
|
183
|
+
- [ ] Multi-turn CoderAgent memory
|
|
184
|
+
- [ ] Plugin system for custom tools
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 📄 License
|
|
189
|
+
|
|
190
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
191
|
+
|
|
192
|
+
Built with ❤️ from India by [Madhav Kapila](https://github.com/madhavkapila).
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "bhai-cli"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "BHAI — The Dual-Brain AI Coding Agent with Punjabi Swagger. Indic-native voice + universal LLM tool-calling."
|
|
5
|
+
authors = ["Madhav Kapila <smartatk04@gmail.com>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
repository = "https://github.com/madhavkapila/bhai-cli"
|
|
9
|
+
homepage = "https://github.com/madhavkapila"
|
|
10
|
+
packages = [{include = "bhai_cli", from = "src"}]
|
|
11
|
+
|
|
12
|
+
classifiers = [
|
|
13
|
+
"License :: OSI Approved :: Apache Software License",
|
|
14
|
+
"Topic :: Software Development :: Build Tools",
|
|
15
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[tool.poetry.dependencies]
|
|
22
|
+
python = "^3.11"
|
|
23
|
+
|
|
24
|
+
# --- Core CLI (lean) ---
|
|
25
|
+
typer = {extras = ["all"], version = ">=0.12.3"}
|
|
26
|
+
rich = "^13.7.0"
|
|
27
|
+
pyfiglet = "^1.0.2"
|
|
28
|
+
pydantic = "^2.0.0"
|
|
29
|
+
pydantic-settings = "^2.0.0"
|
|
30
|
+
pyyaml = "^6.0"
|
|
31
|
+
python-dotenv = "^1.0.0"
|
|
32
|
+
|
|
33
|
+
# --- LLM Backbone ---
|
|
34
|
+
litellm = ">=1.40.0"
|
|
35
|
+
|
|
36
|
+
# --- Web Search ---
|
|
37
|
+
duckduckgo-search = ">=6.0.0"
|
|
38
|
+
|
|
39
|
+
# --- Audio (optional: requires system libportaudio2) ---
|
|
40
|
+
sounddevice = {version = ">=0.4.6", optional = true}
|
|
41
|
+
soundfile = {version = ">=0.12.0", optional = true}
|
|
42
|
+
httpx = {version = ">=0.27.0"}
|
|
43
|
+
|
|
44
|
+
[tool.poetry.extras]
|
|
45
|
+
audio = ["sounddevice", "soundfile"]
|
|
46
|
+
|
|
47
|
+
[tool.poetry.scripts]
|
|
48
|
+
bhai-code = "bhai_cli.cli:app"
|
|
49
|
+
|
|
50
|
+
[tool.pytest.ini_options]
|
|
51
|
+
testpaths = ["tests"]
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = ["poetry-core"]
|
|
55
|
+
build-backend = "poetry.core.masonry.api"
|
|
56
|
+
|
|
57
|
+
[dependency-groups]
|
|
58
|
+
dev = [
|
|
59
|
+
"pytest (>=9.0.3,<10.0.0)"
|
|
60
|
+
]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
BHAI-CLI: The Dual-Brain AI Coding Agent with Punjabi Swagger.
|
|
3
|
+
|
|
4
|
+
Lean heritage. Zero-state resilience. Universal LLM support via litellm.
|
|
5
|
+
Indic-native voice interface via Sarvam AI (Saaras v3 STT / Bulbul v3 TTS).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
__app_name__ = "bhai-cli"
|