@bluehawks/cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +36 -0
- package/.prettierrc +8 -0
- package/README.md +288 -0
- package/dist/cli/app.d.ts +12 -0
- package/dist/cli/app.d.ts.map +1 -0
- package/dist/cli/app.js +201 -0
- package/dist/cli/app.js.map +1 -0
- package/dist/cli/commands/index.d.ts +56 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +201 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/config/constants.d.ts +32 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +39 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +56 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +28 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/settings.d.ts +20 -0
- package/dist/config/settings.d.ts.map +1 -0
- package/dist/config/settings.js +102 -0
- package/dist/config/settings.js.map +1 -0
- package/dist/core/agents/agent.d.ts +33 -0
- package/dist/core/agents/agent.d.ts.map +1 -0
- package/dist/core/agents/agent.js +156 -0
- package/dist/core/agents/agent.js.map +1 -0
- package/dist/core/agents/index.d.ts +3 -0
- package/dist/core/agents/index.d.ts.map +1 -0
- package/dist/core/agents/index.js +3 -0
- package/dist/core/agents/index.js.map +1 -0
- package/dist/core/agents/orchestrator.d.ts +56 -0
- package/dist/core/agents/orchestrator.d.ts.map +1 -0
- package/dist/core/agents/orchestrator.js +151 -0
- package/dist/core/agents/orchestrator.js.map +1 -0
- package/dist/core/api/client.d.ts +46 -0
- package/dist/core/api/client.d.ts.map +1 -0
- package/dist/core/api/client.js +223 -0
- package/dist/core/api/client.js.map +1 -0
- package/dist/core/api/index.d.ts +3 -0
- package/dist/core/api/index.d.ts.map +1 -0
- package/dist/core/api/index.js +3 -0
- package/dist/core/api/index.js.map +1 -0
- package/dist/core/api/types.d.ts +126 -0
- package/dist/core/api/types.d.ts.map +1 -0
- package/dist/core/api/types.js +16 -0
- package/dist/core/api/types.js.map +1 -0
- package/dist/core/hooks/index.d.ts +3 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +3 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/manager.d.ts +43 -0
- package/dist/core/hooks/manager.d.ts.map +1 -0
- package/dist/core/hooks/manager.js +178 -0
- package/dist/core/hooks/manager.js.map +1 -0
- package/dist/core/hooks/types.d.ts +68 -0
- package/dist/core/hooks/types.d.ts.map +1 -0
- package/dist/core/hooks/types.js +6 -0
- package/dist/core/hooks/types.js.map +1 -0
- package/dist/core/mcp/client.d.ts +48 -0
- package/dist/core/mcp/client.d.ts.map +1 -0
- package/dist/core/mcp/client.js +139 -0
- package/dist/core/mcp/client.js.map +1 -0
- package/dist/core/mcp/index.d.ts +3 -0
- package/dist/core/mcp/index.d.ts.map +1 -0
- package/dist/core/mcp/index.js +3 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/manager.d.ts +46 -0
- package/dist/core/mcp/manager.d.ts.map +1 -0
- package/dist/core/mcp/manager.js +133 -0
- package/dist/core/mcp/manager.js.map +1 -0
- package/dist/core/plugins/index.d.ts +3 -0
- package/dist/core/plugins/index.d.ts.map +1 -0
- package/dist/core/plugins/index.js +3 -0
- package/dist/core/plugins/index.js.map +1 -0
- package/dist/core/plugins/loader.d.ts +63 -0
- package/dist/core/plugins/loader.d.ts.map +1 -0
- package/dist/core/plugins/loader.js +258 -0
- package/dist/core/plugins/loader.js.map +1 -0
- package/dist/core/plugins/types.d.ts +95 -0
- package/dist/core/plugins/types.d.ts.map +1 -0
- package/dist/core/plugins/types.js +6 -0
- package/dist/core/plugins/types.js.map +1 -0
- package/dist/core/session/index.d.ts +3 -0
- package/dist/core/session/index.d.ts.map +1 -0
- package/dist/core/session/index.js +3 -0
- package/dist/core/session/index.js.map +1 -0
- package/dist/core/session/manager.d.ts +57 -0
- package/dist/core/session/manager.d.ts.map +1 -0
- package/dist/core/session/manager.js +182 -0
- package/dist/core/session/manager.js.map +1 -0
- package/dist/core/session/storage.d.ts +42 -0
- package/dist/core/session/storage.d.ts.map +1 -0
- package/dist/core/session/storage.js +138 -0
- package/dist/core/session/storage.js.map +1 -0
- package/dist/core/tools/definitions/file.d.ts +6 -0
- package/dist/core/tools/definitions/file.d.ts.map +1 -0
- package/dist/core/tools/definitions/file.js +276 -0
- package/dist/core/tools/definitions/file.js.map +1 -0
- package/dist/core/tools/definitions/git.d.ts +6 -0
- package/dist/core/tools/definitions/git.d.ts.map +1 -0
- package/dist/core/tools/definitions/git.js +294 -0
- package/dist/core/tools/definitions/git.js.map +1 -0
- package/dist/core/tools/definitions/index.d.ts +11 -0
- package/dist/core/tools/definitions/index.d.ts.map +1 -0
- package/dist/core/tools/definitions/index.js +22 -0
- package/dist/core/tools/definitions/index.js.map +1 -0
- package/dist/core/tools/definitions/search.d.ts +6 -0
- package/dist/core/tools/definitions/search.d.ts.map +1 -0
- package/dist/core/tools/definitions/search.js +223 -0
- package/dist/core/tools/definitions/search.js.map +1 -0
- package/dist/core/tools/definitions/shell.d.ts +6 -0
- package/dist/core/tools/definitions/shell.d.ts.map +1 -0
- package/dist/core/tools/definitions/shell.js +190 -0
- package/dist/core/tools/definitions/shell.js.map +1 -0
- package/dist/core/tools/definitions/web.d.ts +6 -0
- package/dist/core/tools/definitions/web.d.ts.map +1 -0
- package/dist/core/tools/definitions/web.js +104 -0
- package/dist/core/tools/definitions/web.js.map +1 -0
- package/dist/core/tools/executor.d.ts +24 -0
- package/dist/core/tools/executor.d.ts.map +1 -0
- package/dist/core/tools/executor.js +111 -0
- package/dist/core/tools/executor.js.map +1 -0
- package/dist/core/tools/index.d.ts +4 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +4 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/registry.d.ts +23 -0
- package/dist/core/tools/registry.d.ts.map +1 -0
- package/dist/core/tools/registry.js +28 -0
- package/dist/core/tools/registry.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +352 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
- package/src/cli/app.tsx +319 -0
- package/src/cli/commands/index.ts +261 -0
- package/src/config/constants.ts +45 -0
- package/src/config/index.ts +3 -0
- package/src/config/schema.ts +36 -0
- package/src/config/settings.ts +121 -0
- package/src/core/agents/agent.ts +205 -0
- package/src/core/agents/index.ts +2 -0
- package/src/core/agents/orchestrator.ts +223 -0
- package/src/core/api/client.ts +300 -0
- package/src/core/api/index.ts +2 -0
- package/src/core/api/types.ts +149 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/manager.ts +212 -0
- package/src/core/hooks/types.ts +116 -0
- package/src/core/mcp/client.ts +198 -0
- package/src/core/mcp/index.ts +2 -0
- package/src/core/mcp/manager.ts +153 -0
- package/src/core/plugins/index.ts +2 -0
- package/src/core/plugins/loader.ts +312 -0
- package/src/core/plugins/types.ts +111 -0
- package/src/core/session/index.ts +2 -0
- package/src/core/session/manager.ts +246 -0
- package/src/core/session/storage.ts +184 -0
- package/src/core/tools/definitions/file.ts +312 -0
- package/src/core/tools/definitions/git.ts +326 -0
- package/src/core/tools/definitions/index.ts +24 -0
- package/src/core/tools/definitions/search.ts +266 -0
- package/src/core/tools/definitions/shell.ts +228 -0
- package/src/core/tools/definitions/web.ts +113 -0
- package/src/core/tools/executor.ts +145 -0
- package/src/core/tools/index.ts +3 -0
- package/src/core/tools/registry.ts +44 -0
- package/src/index.ts +407 -0
- package/tsconfig.json +40 -0
- package/vitest.config.ts +13 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"plugins": [
|
|
5
|
+
"@typescript-eslint"
|
|
6
|
+
],
|
|
7
|
+
"extends": [
|
|
8
|
+
"eslint:recommended",
|
|
9
|
+
"plugin:@typescript-eslint/recommended"
|
|
10
|
+
],
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"ecmaVersion": 2022,
|
|
13
|
+
"sourceType": "module",
|
|
14
|
+
"project": "./tsconfig.json"
|
|
15
|
+
},
|
|
16
|
+
"env": {
|
|
17
|
+
"node": true,
|
|
18
|
+
"es2022": true
|
|
19
|
+
},
|
|
20
|
+
"rules": {
|
|
21
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
22
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
23
|
+
"@typescript-eslint/no-unused-vars": [
|
|
24
|
+
"error",
|
|
25
|
+
{
|
|
26
|
+
"argsIgnorePattern": "^_"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"no-console": "off"
|
|
30
|
+
},
|
|
31
|
+
"ignorePatterns": [
|
|
32
|
+
"dist/",
|
|
33
|
+
"node_modules/",
|
|
34
|
+
"*.js"
|
|
35
|
+
]
|
|
36
|
+
}
|
package/.prettierrc
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# Bluehawks CLI 🦅
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](https://www.typescriptlang.org)
|
|
6
|
+
|
|
7
|
+
A powerful, production-ready **multi-agent AI CLI assistant** for terminal-based coding assistance. Built with TypeScript, featuring an extensible plugin architecture, hooks system, and MCP integration.
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
- 🤖 **Multi-Agent Architecture** - Specialized agents for coding, research, and shell tasks
|
|
12
|
+
- 💬 **Interactive & Headless Modes** - Use interactively or in scripts/CI
|
|
13
|
+
- 🔌 **Plugin System** - Extend with custom commands, tools, and agents
|
|
14
|
+
- 🪝 **Hooks System** - Lifecycle hooks for tool execution and session events
|
|
15
|
+
- 🔗 **MCP Integration** - Connect to external data sources via Model Context Protocol
|
|
16
|
+
- 📝 **Session Management** - Resume previous conversations, named sessions
|
|
17
|
+
- ⚡ **Streaming Responses** - Real-time token streaming
|
|
18
|
+
- 🛠️ **Built-in Tools** - File operations, shell commands, git integration
|
|
19
|
+
|
|
20
|
+
## 📦 Installation
|
|
21
|
+
|
|
22
|
+
### From npm (Coming Soon)
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @bluehawks/cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### From Source
|
|
28
|
+
```bash
|
|
29
|
+
git clone https://github.com/bluehawks-ai/bluehawks-cli.git
|
|
30
|
+
cd bluehawks-cli
|
|
31
|
+
npm install
|
|
32
|
+
npm run build
|
|
33
|
+
npm link
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 🚀 Quick Start
|
|
37
|
+
|
|
38
|
+
### 1. Configure API Key
|
|
39
|
+
|
|
40
|
+
Create configuration file at `~/.bluehawks/.env`:
|
|
41
|
+
```env
|
|
42
|
+
BLUEHAWKS_API_KEY=your-api-key
|
|
43
|
+
BLUEHAWKS_API_URL=https://api.bluehawks.ai/v1
|
|
44
|
+
BLUEHAWKS_MODEL=qwen-coder-32b
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Run the CLI
|
|
48
|
+
|
|
49
|
+
**Interactive Mode:**
|
|
50
|
+
```bash
|
|
51
|
+
bluehawks
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Headless Mode (for scripts/CI):**
|
|
55
|
+
```bash
|
|
56
|
+
bluehawks -p "explain this codebase" --json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 💻 Usage
|
|
60
|
+
|
|
61
|
+
### Commands
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Start interactive session
|
|
65
|
+
bluehawks
|
|
66
|
+
|
|
67
|
+
# Run with initial prompt
|
|
68
|
+
bluehawks -p "refactor the auth module"
|
|
69
|
+
|
|
70
|
+
# Continue last session
|
|
71
|
+
bluehawks -c
|
|
72
|
+
|
|
73
|
+
# Resume specific session
|
|
74
|
+
bluehawks -r my-session
|
|
75
|
+
|
|
76
|
+
# List saved sessions
|
|
77
|
+
bluehawks sessions
|
|
78
|
+
|
|
79
|
+
# List available tools
|
|
80
|
+
bluehawks tools
|
|
81
|
+
|
|
82
|
+
# Manage plugins
|
|
83
|
+
bluehawks plugins
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### CLI Flags
|
|
87
|
+
|
|
88
|
+
| Flag | Description |
|
|
89
|
+
|------|-------------|
|
|
90
|
+
| `-p, --prompt <text>` | Initial prompt to send |
|
|
91
|
+
| `-c, --continue` | Continue most recent session |
|
|
92
|
+
| `-r, --resume <name>` | Resume named session |
|
|
93
|
+
| `--max-turns <n>` | Limit agentic iterations |
|
|
94
|
+
| `--system-prompt <text>` | Override system prompt |
|
|
95
|
+
| `--append-system-prompt <text>` | Append to system prompt |
|
|
96
|
+
| `--add-dir <dirs...>` | Additional context directories |
|
|
97
|
+
| `--output-format <format>` | Output format: `text`, `json`, `stream-json` |
|
|
98
|
+
| `--json` | Output in JSON format |
|
|
99
|
+
| `-y, --yes` | Auto-approve all tool calls (YOLO mode) |
|
|
100
|
+
|
|
101
|
+
### Slash Commands
|
|
102
|
+
|
|
103
|
+
Inside the CLI, use these commands:
|
|
104
|
+
|
|
105
|
+
| Command | Description |
|
|
106
|
+
|---------|-------------|
|
|
107
|
+
| `/help` | Show available commands |
|
|
108
|
+
| `/clear` | Clear conversation history |
|
|
109
|
+
| `/save [name]` | Save current session |
|
|
110
|
+
| `/stats` | Show session statistics |
|
|
111
|
+
| `/plan` | Toggle planning mode |
|
|
112
|
+
| `/yolo` | Toggle auto-approval mode |
|
|
113
|
+
| `/exit` | Exit the CLI |
|
|
114
|
+
|
|
115
|
+
## 🔌 Plugins
|
|
116
|
+
|
|
117
|
+
Create plugins to extend functionality with custom commands, tools, and agents.
|
|
118
|
+
|
|
119
|
+
### Plugin Structure
|
|
120
|
+
```
|
|
121
|
+
~/.bluehawks/plugins/my-plugin/
|
|
122
|
+
├── plugin.json # Plugin manifest
|
|
123
|
+
├── commands/
|
|
124
|
+
│ └── greet.js # Command handler
|
|
125
|
+
└── tools/
|
|
126
|
+
└── custom_tool.js # Tool handler
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Plugin Manifest (`plugin.json`)
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"name": "my-plugin",
|
|
133
|
+
"version": "1.0.0",
|
|
134
|
+
"description": "My custom plugin",
|
|
135
|
+
"commands": [
|
|
136
|
+
{
|
|
137
|
+
"name": "greet",
|
|
138
|
+
"description": "Say hello",
|
|
139
|
+
"handler": "commands/greet.js"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"tools": [
|
|
143
|
+
{
|
|
144
|
+
"name": "custom_tool",
|
|
145
|
+
"description": "My custom tool",
|
|
146
|
+
"handler": "tools/custom_tool.js",
|
|
147
|
+
"parameters": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": {
|
|
150
|
+
"input": { "type": "string" }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"agents": [
|
|
156
|
+
{
|
|
157
|
+
"name": "reviewer",
|
|
158
|
+
"description": "Code review agent",
|
|
159
|
+
"systemPrompt": "You are an expert code reviewer..."
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## 🪝 Hooks
|
|
166
|
+
|
|
167
|
+
Hooks allow you to intercept and modify CLI behavior at various lifecycle events.
|
|
168
|
+
|
|
169
|
+
### Available Hooks
|
|
170
|
+
|
|
171
|
+
| Event | Trigger |
|
|
172
|
+
|-------|---------|
|
|
173
|
+
| `SessionStart` | When CLI session starts |
|
|
174
|
+
| `PreToolUse` | Before a tool executes (can block) |
|
|
175
|
+
| `PostToolUse` | After successful tool execution |
|
|
176
|
+
| `PostToolUseFailure` | After tool execution fails |
|
|
177
|
+
| `Stop` | Before CLI exits |
|
|
178
|
+
|
|
179
|
+
### Hook Configuration
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"hooks": {
|
|
183
|
+
"PreToolUse": [
|
|
184
|
+
{
|
|
185
|
+
"matcher": "run_command",
|
|
186
|
+
"command": "echo 'Tool: $HOOK_INPUT' >> ~/tool.log"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 🔗 MCP Integration
|
|
194
|
+
|
|
195
|
+
Connect to external data sources using the Model Context Protocol.
|
|
196
|
+
|
|
197
|
+
### Configuration (`.mcp.json`)
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"mcpServers": {
|
|
201
|
+
"github": {
|
|
202
|
+
"command": "npx",
|
|
203
|
+
"args": ["@modelcontextprotocol/server-github"]
|
|
204
|
+
},
|
|
205
|
+
"filesystem": {
|
|
206
|
+
"command": "npx",
|
|
207
|
+
"args": ["@modelcontextprotocol/server-filesystem", "/path/to/dir"]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
MCP tools are automatically registered and available to the agent.
|
|
214
|
+
|
|
215
|
+
## 🛠️ Built-in Tools
|
|
216
|
+
|
|
217
|
+
| Tool | Description |
|
|
218
|
+
|------|-------------|
|
|
219
|
+
| `read_file` | Read file contents |
|
|
220
|
+
| `write_file` | Write content to file |
|
|
221
|
+
| `search_files` | Search files by pattern |
|
|
222
|
+
| `run_command` | Execute shell commands |
|
|
223
|
+
| `grep_search` | Search file contents |
|
|
224
|
+
| `git_status` | Get git repository status |
|
|
225
|
+
| `list_directory` | List directory contents |
|
|
226
|
+
|
|
227
|
+
## 🏗️ Architecture
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
src/
|
|
231
|
+
├── cli/ # CLI components (Ink/React)
|
|
232
|
+
│ ├── app.tsx # Main application component
|
|
233
|
+
│ └── commands/ # Slash command handlers
|
|
234
|
+
├── core/
|
|
235
|
+
│ ├── agents/ # Agent implementations
|
|
236
|
+
│ │ ├── agent.ts # Base agent class
|
|
237
|
+
│ │ └── orchestrator.ts
|
|
238
|
+
│ ├── api/ # API client
|
|
239
|
+
│ ├── hooks/ # Hooks system
|
|
240
|
+
│ ├── mcp/ # MCP integration
|
|
241
|
+
│ ├── plugins/ # Plugin loader
|
|
242
|
+
│ ├── session/ # Session management
|
|
243
|
+
│ └── tools/ # Tool definitions & executor
|
|
244
|
+
└── config/ # Configuration constants
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## 🧪 Development
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Build
|
|
251
|
+
npm run build
|
|
252
|
+
|
|
253
|
+
# Watch mode
|
|
254
|
+
npm run dev
|
|
255
|
+
|
|
256
|
+
# Run tests
|
|
257
|
+
npm test
|
|
258
|
+
|
|
259
|
+
# Lint
|
|
260
|
+
npm run lint
|
|
261
|
+
|
|
262
|
+
# Format
|
|
263
|
+
npm run format
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## 📄 License
|
|
267
|
+
|
|
268
|
+
Apache 2.0 - See [LICENSE](LICENSE) for details.
|
|
269
|
+
|
|
270
|
+
## 🤝 Contributing
|
|
271
|
+
|
|
272
|
+
Contributions welcome! Please read our contributing guidelines before submitting PRs.
|
|
273
|
+
|
|
274
|
+
1. Fork the repository
|
|
275
|
+
2. Create a feature branch
|
|
276
|
+
3. Make your changes
|
|
277
|
+
4. Run tests and linting
|
|
278
|
+
5. Submit a pull request
|
|
279
|
+
|
|
280
|
+
## 📞 Support
|
|
281
|
+
|
|
282
|
+
- 📖 [Documentation](https://docs.bluehawks.ai)
|
|
283
|
+
- 💬 [Discord](https://discord.gg/bluehawks)
|
|
284
|
+
- 🐛 [Issue Tracker](https://github.com/bluehawks-ai/bluehawks-cli/issues)
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
Built with ❤️ by [Bluehawks AI](https://bluehawks.ai)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bluehawks CLI - Main Application Component
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
interface AppProps {
|
|
6
|
+
initialPrompt?: string;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
yoloMode?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const App: React.FC<AppProps>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/cli/app.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAchE,UAAU,QAAQ;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAiSlC,CAAC"}
|
package/dist/cli/app.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Bluehawks CLI - Main Application Component
|
|
4
|
+
*/
|
|
5
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
6
|
+
import { Text, Box, useInput, useApp } from 'ink';
|
|
7
|
+
import Spinner from 'ink-spinner';
|
|
8
|
+
import TextInput from 'ink-text-input';
|
|
9
|
+
import { APIClient } from '../core/api/client.js';
|
|
10
|
+
import { Orchestrator } from '../core/agents/orchestrator.js';
|
|
11
|
+
import { ToolExecutor, toolRegistry, registerAllTools } from '../core/tools/index.js';
|
|
12
|
+
import { SessionManager } from '../core/session/manager.js';
|
|
13
|
+
import { commandRegistry } from './commands/index.js';
|
|
14
|
+
import { CLI_NAME, CLI_VERSION, COLORS } from '../config/constants.js';
|
|
15
|
+
import { hooksManager } from '../core/hooks/index.js';
|
|
16
|
+
export const App = ({ initialPrompt, apiKey, yoloMode = false }) => {
|
|
17
|
+
const { exit } = useApp();
|
|
18
|
+
const [input, setInput] = useState('');
|
|
19
|
+
const [messages, setMessages] = useState([]);
|
|
20
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
21
|
+
const [currentTool, setCurrentTool] = useState(null);
|
|
22
|
+
const [streamingContent, setStreamingContent] = useState('');
|
|
23
|
+
const [pendingApproval, setPendingApproval] = useState(null);
|
|
24
|
+
const [isYoloMode, setIsYoloMode] = useState(yoloMode);
|
|
25
|
+
// Initialize components
|
|
26
|
+
const [apiClient] = useState(() => new APIClient({ apiKey }));
|
|
27
|
+
const [toolExecutor] = useState(() => {
|
|
28
|
+
const executor = new ToolExecutor({
|
|
29
|
+
approvalMode: yoloMode ? 'never' : 'unsafe-only',
|
|
30
|
+
});
|
|
31
|
+
return executor;
|
|
32
|
+
});
|
|
33
|
+
const [orchestrator] = useState(() => {
|
|
34
|
+
registerAllTools();
|
|
35
|
+
return new Orchestrator({
|
|
36
|
+
projectPath: process.cwd(),
|
|
37
|
+
apiClient,
|
|
38
|
+
toolExecutor,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
const [sessionManager] = useState(() => new SessionManager(process.cwd(), apiClient.currentModel));
|
|
42
|
+
// Set up approval handler and lifecycle hooks
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
toolExecutor.setApprovalHandler(async (toolName, args) => {
|
|
45
|
+
if (isYoloMode)
|
|
46
|
+
return true;
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
setPendingApproval({ toolName, args, resolve });
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
// Initialize orchestrator and trigger SessionStart hook
|
|
52
|
+
orchestrator.initialize().then(async () => {
|
|
53
|
+
const hookContext = {
|
|
54
|
+
sessionId: sessionManager.getSessionId(),
|
|
55
|
+
projectPath: process.cwd(),
|
|
56
|
+
model: apiClient.currentModel,
|
|
57
|
+
timestamp: new Date().toISOString(),
|
|
58
|
+
cwd: process.cwd(),
|
|
59
|
+
};
|
|
60
|
+
await hooksManager.execute('SessionStart', hookContext);
|
|
61
|
+
}).catch((err) => {
|
|
62
|
+
setMessages((prev) => [...prev, { role: 'error', content: `Init error: ${err}` }]);
|
|
63
|
+
});
|
|
64
|
+
// Cleanup: trigger Stop hook and auto-save session on exit
|
|
65
|
+
return () => {
|
|
66
|
+
const cleanup = async () => {
|
|
67
|
+
const stopContext = {
|
|
68
|
+
sessionId: sessionManager.getSessionId(),
|
|
69
|
+
projectPath: process.cwd(),
|
|
70
|
+
model: apiClient.currentModel,
|
|
71
|
+
timestamp: new Date().toISOString(),
|
|
72
|
+
reason: 'completed',
|
|
73
|
+
messageCount: sessionManager.getStats().messageCount,
|
|
74
|
+
};
|
|
75
|
+
await hooksManager.execute('Stop', stopContext);
|
|
76
|
+
await sessionManager.save();
|
|
77
|
+
};
|
|
78
|
+
cleanup().catch(console.error);
|
|
79
|
+
};
|
|
80
|
+
}, [toolExecutor, isYoloMode, orchestrator, sessionManager, apiClient]);
|
|
81
|
+
// Handle initial prompt
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (initialPrompt) {
|
|
84
|
+
handleSubmit(initialPrompt);
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
87
|
+
const handleSubmit = useCallback(async (value) => {
|
|
88
|
+
const trimmed = value.trim();
|
|
89
|
+
if (!trimmed || isProcessing)
|
|
90
|
+
return;
|
|
91
|
+
// Check for slash commands
|
|
92
|
+
if (commandRegistry.isCommand(trimmed)) {
|
|
93
|
+
const context = {
|
|
94
|
+
sessionManager,
|
|
95
|
+
orchestrator,
|
|
96
|
+
toolRegistry,
|
|
97
|
+
onExit: () => exit(),
|
|
98
|
+
};
|
|
99
|
+
const result = await commandRegistry.execute(trimmed, context);
|
|
100
|
+
if (result) {
|
|
101
|
+
setMessages((prev) => [...prev, { role: 'system', content: result }]);
|
|
102
|
+
}
|
|
103
|
+
setInput('');
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// Check for YOLO toggle
|
|
107
|
+
if (trimmed.toLowerCase() === '/yolo') {
|
|
108
|
+
setIsYoloMode((prev) => {
|
|
109
|
+
const newValue = !prev;
|
|
110
|
+
toolExecutor.setApprovalMode(newValue ? 'never' : 'unsafe-only');
|
|
111
|
+
setMessages((prev) => [
|
|
112
|
+
...prev,
|
|
113
|
+
{
|
|
114
|
+
role: 'system',
|
|
115
|
+
content: newValue
|
|
116
|
+
? '⚡ YOLO mode enabled! All tools will auto-execute.'
|
|
117
|
+
: '🛡️ YOLO mode disabled. Dangerous tools will require approval.',
|
|
118
|
+
},
|
|
119
|
+
]);
|
|
120
|
+
return newValue;
|
|
121
|
+
});
|
|
122
|
+
setInput('');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
// Add user message
|
|
126
|
+
setMessages((prev) => [...prev, { role: 'user', content: trimmed }]);
|
|
127
|
+
setInput('');
|
|
128
|
+
setIsProcessing(true);
|
|
129
|
+
setStreamingContent('');
|
|
130
|
+
try {
|
|
131
|
+
const response = await orchestrator.chat(trimmed, [], {
|
|
132
|
+
onChunk: (chunk) => {
|
|
133
|
+
setStreamingContent((prev) => prev + chunk);
|
|
134
|
+
},
|
|
135
|
+
onToolStart: (name) => {
|
|
136
|
+
setCurrentTool(name);
|
|
137
|
+
setMessages((prev) => [
|
|
138
|
+
...prev,
|
|
139
|
+
{ role: 'tool', content: `🔧 Running: ${name}...` },
|
|
140
|
+
]);
|
|
141
|
+
},
|
|
142
|
+
onToolEnd: (name, result) => {
|
|
143
|
+
setCurrentTool(null);
|
|
144
|
+
const truncated = result.length > 500 ? result.substring(0, 500) + '...' : result;
|
|
145
|
+
setMessages((prev) => [
|
|
146
|
+
...prev,
|
|
147
|
+
{ role: 'tool', content: `✓ ${name}:\n${truncated}` },
|
|
148
|
+
]);
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
// Add final response
|
|
152
|
+
if (response.content) {
|
|
153
|
+
setMessages((prev) => [...prev, { role: 'assistant', content: response.content }]);
|
|
154
|
+
}
|
|
155
|
+
// Update session
|
|
156
|
+
sessionManager.addMessage({ role: 'user', content: trimmed });
|
|
157
|
+
sessionManager.addMessage({ role: 'assistant', content: response.content });
|
|
158
|
+
response.toolsUsed.forEach((tool) => sessionManager.addToolUsed(tool));
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
162
|
+
setMessages((prev) => [...prev, { role: 'error', content: `Error: ${errorMessage}` }]);
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
setIsProcessing(false);
|
|
166
|
+
setStreamingContent('');
|
|
167
|
+
setCurrentTool(null);
|
|
168
|
+
}
|
|
169
|
+
}, [isProcessing, orchestrator, sessionManager, exit, toolExecutor, isYoloMode]);
|
|
170
|
+
// Handle approval input
|
|
171
|
+
useInput((input, key) => {
|
|
172
|
+
if (pendingApproval) {
|
|
173
|
+
if (input.toLowerCase() === 'y' || key.return) {
|
|
174
|
+
pendingApproval.resolve(true);
|
|
175
|
+
setPendingApproval(null);
|
|
176
|
+
}
|
|
177
|
+
else if (input.toLowerCase() === 'n' || key.escape) {
|
|
178
|
+
pendingApproval.resolve(false);
|
|
179
|
+
setPendingApproval(null);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}, { isActive: pendingApproval !== null });
|
|
183
|
+
const getRoleColor = (role) => {
|
|
184
|
+
switch (role) {
|
|
185
|
+
case 'user':
|
|
186
|
+
return COLORS.primary;
|
|
187
|
+
case 'assistant':
|
|
188
|
+
return COLORS.success;
|
|
189
|
+
case 'tool':
|
|
190
|
+
return COLORS.info;
|
|
191
|
+
case 'system':
|
|
192
|
+
return COLORS.warning;
|
|
193
|
+
case 'error':
|
|
194
|
+
return COLORS.error;
|
|
195
|
+
default:
|
|
196
|
+
return COLORS.muted;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { bold: true, color: COLORS.primary, children: ["\uD83E\uDD85 ", CLI_NAME, " v", CLI_VERSION] }), _jsx(Text, { color: COLORS.muted, children: " | " }), _jsx(Text, { color: COLORS.muted, children: "Type /help for commands" }), isYoloMode && (_jsxs(_Fragment, { children: [_jsx(Text, { color: COLORS.muted, children: " | " }), _jsx(Text, { color: COLORS.warning, children: "\u26A1 YOLO" })] }))] }), _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [messages.slice(-20).map((msg, i) => (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: getRoleColor(msg.role), children: [msg.role === 'user' ? '› ' : msg.role === 'assistant' ? '🦅 ' : '', msg.content] }) }, i))), streamingContent && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: COLORS.success, children: ["\uD83E\uDD85 ", streamingContent] }) })), currentTool && (_jsxs(Box, { children: [_jsx(Spinner, { type: "dots" }), _jsxs(Text, { color: COLORS.info, children: [" Running ", currentTool, "..."] })] })), pendingApproval && (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", padding: 1, children: [_jsxs(Text, { color: COLORS.warning, children: ["\u26A0\uFE0F Tool requires approval: ", pendingApproval.toolName] }), _jsxs(Text, { color: COLORS.muted, children: ["Args: ", JSON.stringify(pendingApproval.args, null, 2).substring(0, 200)] }), _jsxs(Text, { children: ["Press ", _jsx(Text, { color: "green", children: "Y" }), " to approve, ", _jsx(Text, { color: "red", children: "N" }), " to deny"] })] }))] }), !pendingApproval && (_jsxs(Box, { children: [_jsx(Text, { color: COLORS.primary, children: "\u203A " }), isProcessing ? (_jsxs(Box, { children: [_jsx(Spinner, { type: "dots" }), _jsx(Text, { color: COLORS.muted, children: " Thinking..." })] })) : (_jsx(TextInput, { value: input, onChange: setInput, onSubmit: handleSubmit, placeholder: "Ask me anything..." }))] }))] }));
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/cli/app.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAuB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAetD,MAAM,CAAC,MAAM,GAAG,GAAuB,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,EAAE,EAAE;IACnF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,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C,KAAK,6BAAqB,IAC5C,CACT,CAAC,CAAC,CAAC,CACA,KAAC,SAAS,IACN,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAC,oBAAoB,GAClC,CACL,IACC,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bluehawks CLI - Slash Commands
|
|
3
|
+
*/
|
|
4
|
+
export interface Command {
|
|
5
|
+
name: string;
|
|
6
|
+
aliases?: string[];
|
|
7
|
+
description: string;
|
|
8
|
+
execute: (args: string[], context: CommandContext) => Promise<string> | string;
|
|
9
|
+
}
|
|
10
|
+
export interface CommandContext {
|
|
11
|
+
sessionManager: {
|
|
12
|
+
getStats: () => {
|
|
13
|
+
messageCount: number;
|
|
14
|
+
userMessages: number;
|
|
15
|
+
assistantMessages: number;
|
|
16
|
+
toolMessages: number;
|
|
17
|
+
tokensUsed: number;
|
|
18
|
+
toolsUsed: string[];
|
|
19
|
+
duration: number;
|
|
20
|
+
};
|
|
21
|
+
clear: () => void;
|
|
22
|
+
compressHistory: () => void;
|
|
23
|
+
save: () => Promise<string>;
|
|
24
|
+
};
|
|
25
|
+
orchestrator: {
|
|
26
|
+
setPlanMode: (enabled: boolean) => void;
|
|
27
|
+
isPlanMode: () => boolean;
|
|
28
|
+
getSubAgents: () => Array<{
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
toolRegistry: {
|
|
34
|
+
getAll: () => Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
definition: {
|
|
37
|
+
function: {
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
onExit: () => void;
|
|
44
|
+
}
|
|
45
|
+
export declare const commands: Command[];
|
|
46
|
+
declare class CommandRegistry {
|
|
47
|
+
private commands;
|
|
48
|
+
constructor();
|
|
49
|
+
register(command: Command): void;
|
|
50
|
+
get(name: string): Command | undefined;
|
|
51
|
+
execute(input: string, context: CommandContext): Promise<string | null>;
|
|
52
|
+
isCommand(input: string): boolean;
|
|
53
|
+
}
|
|
54
|
+
export declare const commandRegistry: CommandRegistry;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CAClF;AAED,MAAM,WAAW,cAAc;IAC3B,cAAc,EAAE;QACZ,QAAQ,EAAE,MAAM;YACZ,YAAY,EAAE,MAAM,CAAC;YACrB,YAAY,EAAE,MAAM,CAAC;YACrB,iBAAiB,EAAE,MAAM,CAAC;YAC1B,YAAY,EAAE,MAAM,CAAC;YACrB,UAAU,EAAE,MAAM,CAAC;YACnB,SAAS,EAAE,MAAM,EAAE,CAAC;YACpB,QAAQ,EAAE,MAAM,CAAC;SACpB,CAAC;QACF,KAAK,EAAE,MAAM,IAAI,CAAC;QAClB,eAAe,EAAE,MAAM,IAAI,CAAC;QAC5B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;KAC/B,CAAC;IACF,YAAY,EAAE;QACV,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;QACxC,UAAU,EAAE,MAAM,OAAO,CAAC;QAC1B,YAAY,EAAE,MAAM,KAAK,CAAC;YAAE,IA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