@nomad-e/bluma-cli 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Alex Fonseca and NomadEngenuity contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,216 @@
1
+ # BluMa CLI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/bluma.svg?style=flat-square)](https://www.npmjs.com/package/bluma)
4
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
5
+ [![Build Status](https://img.shields.io/badge/build-passing-brightgreen?style=flat-square)](https://shields.io/)
6
+
7
+ <p align="center">
8
+ <img src="docs\assets\images\bluma.png" alt="Tela inicial BluMa CLI" width="1000"/>
9
+ </p>
10
+
11
+ BluMa CLI is an independent agent for automation and advanced software engineering. The project is a conversational assistant that interacts via terminal (CLI), built with React/Ink, supporting smart agents (LLM, OpenAI Azure), tool execution, persistent history, session management, and extensibility through external plugins/tools.
12
+
13
+ ---
14
+
15
+ ## Table of Contents
16
+ - [Overview](#overview)
17
+ - [Key Features](#key-features)
18
+ - [Requirements](#requirements)
19
+ - [Installation](#installation)
20
+ - [How to Run](#how-to-run)
21
+ - [Project Structure](#project-structure)
22
+ - [Development and Build](#development-and-build)
23
+ - [Extensibility: Tools and Plugins](#extensibility-tools-and-plugins)
24
+ - [Tests](#tests)
25
+ - [Configuration and Environment Variables](#configuration-and-environment-variables)
26
+ - [License](#license)
27
+
28
+ ---
29
+
30
+ ## <a name="overview"></a>Overview
31
+ BluMa CLI is a modern CLI focused on automation, LLM collaboration, documentation, refactoring, running complex tasks, and integrating with external tools. It uses React (via Ink) for rich terminal interfaces and features context/conversation management, smart feedback, and interactive confirmation systems.
32
+
33
+ ---
34
+
35
+ ## <a name="key-features"></a>Key Features
36
+ - **Rich CLI interface** using React/Ink 5, with interactive prompts and custom components.
37
+ - **Session management:** automatic persistence of conversation and tool history via files.
38
+ - **Central agent (LLM):** orchestrated by Azure OpenAI (or compatible), enabling natural language-driven automation.
39
+ - **Tool invocation:** native and via MCP SDK for running commands, code manipulation, file management, and more.
40
+ - **Dynamic prompts:** builds live conversational context, behavioral rules, and technical history.
41
+ - **Smart feedback component** with technical suggestions and checks.
42
+ - **ConfirmPrompt & Workflow Decision:** confirmations for sensitive operations, edit/code previews, always-accepted tool whitelists.
43
+ - **Extensible:** easily add new tools or integrate external SDK/plugins.
44
+
45
+ ---
46
+
47
+ ## <a name="requirements"></a>Requirements
48
+ - Node.js >= 18
49
+ - npm >= 9
50
+ - Account (with key) for Azure OpenAI (or equivalent variables for OpenAI-compatible endpoints)
51
+
52
+ ---
53
+
54
+ ## <a name="installation"></a>Installation
55
+
56
+ ### Recommended: Global Installation
57
+
58
+ > **Important:** It is recommended to install BluMa globally so the `bluma` command works in any terminal.
59
+
60
+ ```bash
61
+ npm install -g @nomad-e/bluma-cli
62
+ ```
63
+
64
+ If you get permission errors, EXAMPLES:
65
+ - **Linux:** Run as administrator using `sudo`:
66
+ ```bash
67
+ sudo npm install -g @nomad-e/bluma-cli
68
+ ```
69
+ - **Windows:** Open Command Prompt/Terminal as Administrator and repeat the command
70
+
71
+ > **macOS:** After global installation, **always run the `bluma` command without sudo**:
72
+ >
73
+ > ```bash
74
+ > bluma
75
+ > ```
76
+ > Running with sudo may cause permission problems, environment variable issues, and npm cache ownership problems.
77
+ > Only use sudo to install, never to run the CLI.
78
+
79
+ ### Setting Up Environment Variables
80
+ For BluMa CLI to operate with OpenAI/Azure, GitHub, and Notion, set the following environment variables globally in your system.
81
+
82
+ **Required:**
83
+ - `AZURE_OPENAI_ENDPOINT`
84
+ - `AZURE_OPENAI_API_KEY`
85
+ - `AZURE_OPENAI_API_VERSION`
86
+ - `AZURE_OPENAI_DEPLOYMENT`
87
+ - `GITHUB_PERSONAL_ACCESS_TOKEN` (if you'll use GitHub)
88
+ - `NOTION_API_TOKEN` (if you'll use Notion)
89
+
90
+ #### How to set environment variables globally:
91
+
92
+ **Linux/macOS:**
93
+ Add to your `~/.bashrc`, `~/.zshrc`, or equivalent:
94
+ ```sh
95
+ export AZURE_OPENAI_ENDPOINT="https://..."
96
+ export AZURE_OPENAI_API_KEY="your_key"
97
+ export AZURE_OPENAI_API_VERSION="2024-06-01"
98
+ export AZURE_OPENAI_DEPLOYMENT="bluma-gpt"
99
+ export GITHUB_PERSONAL_ACCESS_TOKEN="..."
100
+ export NOTION_API_TOKEN="..."
101
+ ```
102
+ Then run:
103
+ ```sh
104
+ source ~/.bashrc # or whichever file you edited
105
+ ```
106
+
107
+ **Windows (CMD):**
108
+ ```cmd
109
+ setx AZURE_OPENAI_ENDPOINT "https://..."
110
+ setx AZURE_OPENAI_API_KEY "your_key"
111
+ setx AZURE_OPENAI_API_VERSION "2024-06-01"
112
+ setx AZURE_OPENAI_DEPLOYMENT "bluma-gpt"
113
+ setx GITHUB_PERSONAL_ACCESS_TOKEN "..."
114
+ setx NOTION_API_TOKEN "..."
115
+ ```
116
+ (Only needs to be run once per variable. Restart the terminal after.)
117
+
118
+ **Windows (PowerShell):**
119
+ ```powershell
120
+ [Environment]::SetEnvironmentVariable("AZURE_OPENAI_ENDPOINT", "https://...", "Machine")
121
+ [Environment]::SetEnvironmentVariable("AZURE_OPENAI_API_KEY", "your_key", "Machine")
122
+ [Environment]::SetEnvironmentVariable("AZURE_OPENAI_API_VERSION", "2024-06-01", "Machine")
123
+ [Environment]::SetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT", "bluma-gpt", "Machine")
124
+ [Environment]::SetEnvironmentVariable("GITHUB_PERSONAL_ACCESS_TOKEN", "...", "Machine")
125
+ [Environment]::SetEnvironmentVariable("NOTION_API_TOKEN", "...", "Machine")
126
+ ```
127
+
128
+ ### ℹ️ Global Installation of npm Packages in PowerShell (Windows)
129
+ When installing BluMa (or any npm package globally) in PowerShell, you might see:
130
+ ```
131
+ Do you want to change the execution policy?
132
+ [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
133
+ ```
134
+ 👉 **Choose `Y` (Yes) or `A` (Yes to All)**. This will change the execution policy to **RemoteSigned** (only scripts from the internet need a digital signature).
135
+
136
+ - This is safe for devs: Windows only requires digital signatures for web scripts—local scripts, from npm, work normally.
137
+ - Read more: [About Execution Policies (Microsoft Docs)](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/about/about_execution_policies)
138
+
139
+ **To restore the default policy after installation, run:**
140
+ ```powershell
141
+ Set-ExecutionPolicy Default
142
+ ```
143
+
144
+ > **Tip:** Restart your terminal to ensure the variables are loaded globally.
145
+
146
+ ---
147
+
148
+ ## <a name="how-to-run"></a>How to Run
149
+ ```bash
150
+ npm start
151
+ # Or directly using the built binary
152
+ npx bluma
153
+ ```
154
+ ==> The CLI will open an interactive terminal interface for dialogue, command execution, and engineering workflow automation.
155
+
156
+ ---
157
+
158
+ ## <a name="project-structure"></a>Project Structure
159
+ ```
160
+ bluma-engineer/
161
+ ├── package.json # npm/project config
162
+ ├── tsconfig.json # TypeScript config
163
+ ├── scripts/build.js # Build script using esbuild
164
+ ├── src/
165
+ │ ├── main.ts # Entry point (Ink renderer)
166
+ │ └── app/
167
+ │ ├── agent/ # Agent core (session mgmt, tools, MCP, prompt, feedback)
168
+ │ ├── ui/ # Ink/React CLI interface components
169
+ │ └── protocols/ # Protocols & helpers
170
+ ```
171
+ ---
172
+
173
+ ## <a name="development-and-build"></a>Development and Build
174
+ - Build is performed using [esbuild](https://esbuild.github.io/) (see scripts/build.js).
175
+ - TS source files are in `src/` and compiled to `dist/`.
176
+ - Use `npm run build` to compile and get the CLI binary ready.
177
+ - Config files are automatically copied to `dist/config`.
178
+
179
+ ### Main scripts:
180
+ ```bash
181
+ npm run build # Compiles project to dist/
182
+ npm start # Runs CLI (after build)
183
+ npm run dev # (If configured, hot-reload/TS watch)
184
+ ```
185
+
186
+ ---
187
+
188
+ ## <a name="extensibility-tools-and-plugins"></a>Extensibility: Tools and Plugins
189
+ - Add native tools in `src/app/agent/tools/natives/`
190
+ - Use the MCP SDK for advanced plugins integrating with external APIs
191
+ - Create custom Ink components to expand the interface
192
+
193
+ ---
194
+
195
+ ## <a name="tests"></a>Tests
196
+ - Organize your tests inside the `test/` folder in your preferred style or as your project's coverage grows
197
+
198
+ ---
199
+
200
+ ## <a name="configuration-and-environment-variables"></a>Configuration and Environment Variables
201
+ You must create a `.env` file (copy if needed from `.env.example`) with the following variables:
202
+ - `AZURE_OPENAI_ENDPOINT`
203
+ - `AZURE_OPENAI_API_KEY`
204
+ - `AZURE_OPENAI_API_VERSION`
205
+ - `AZURE_OPENAI_DEPLOYMENT`
206
+
207
+ And others required by your agent/context or Azure setup.
208
+
209
+ Advanced config files are located in `src/app/agent/config/`.
210
+
211
+ ---
212
+
213
+ ## <a name="license"></a>License
214
+ MIT. Made by Alex Fonseca and NomadEngenuity contributors.
215
+
216
+ Enjoy, hack, and—if possible—contribute!
@@ -0,0 +1,52 @@
1
+ {
2
+ "mcpServers": {
3
+ "bluma": {
4
+ "type": "stdio",
5
+ "command": "cmd",
6
+ "args": [
7
+ "/c",
8
+ "npx",
9
+ "-y",
10
+ "@sousaalex1605/bluma-nootebook"
11
+ ]
12
+ },
13
+ "github": {
14
+ "type": "stdio",
15
+ "command": "cmd",
16
+ "args": [
17
+ "/c",
18
+ "npx",
19
+ "-y",
20
+ "@modelcontextprotocol/server-github"
21
+ ],
22
+ "env": {
23
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
24
+ }
25
+ },
26
+ "notion": {
27
+ "type": "stdio",
28
+ "command": "cmd",
29
+ "args": [
30
+ "/c",
31
+ "npx",
32
+ "-y",
33
+ "@suekou/mcp-notion-server"
34
+ ],
35
+ "env": {
36
+ "NOTION_API_TOKEN": "${NOTION_API_TOKEN}"
37
+ }
38
+ },
39
+ "upstash_context7-mcp": {
40
+ "type": "stdio",
41
+ "command": "cmd",
42
+ "args": [
43
+ "/c",
44
+ "npx",
45
+ "-y",
46
+ "@upstash/context7-mcp@latest"
47
+ ],
48
+ "disabled": false,
49
+ "autoApprove": []
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,199 @@
1
+ {
2
+ "nativeTools": [
3
+ {
4
+ "type": "function",
5
+ "function": {
6
+ "name": "shell_command",
7
+ "description": "Executes a terminal command in a robust and Windows/Linux compatible way.",
8
+ "parameters": {
9
+ "type": "object",
10
+ "properties": {
11
+ "command": {
12
+ "type": "string",
13
+ "description": "Shell command to execute"
14
+ },
15
+ "timeout": {
16
+ "type": "integer",
17
+ "description": "Maximum execution time in seconds",
18
+ "default": 20
19
+ },
20
+ "cwd": {
21
+ "type": "string",
22
+ "description": "Working directory for command execution (must use absolute path)"
23
+ },
24
+ "verbose": {
25
+ "type": "boolean",
26
+ "description": "If True, returns detailed report; if False, only main output",
27
+ "default": false
28
+ }
29
+ },
30
+ "required": [
31
+ "command"
32
+ ]
33
+ }
34
+ }
35
+ },
36
+ {
37
+ "type": "function",
38
+ "function": {
39
+ "name": "edit_tool",
40
+ "description": "Replaces text within a file. By default, replaces a single occurrence, but can replace multiple occurrences when `expected_replacements` is specified. This tool requires providing significant context around the change to ensure precise targeting. Always use the read file tool to examine the file's current content before attempting a text replacement.\n\nExpectation for required parameters:\n1. `file_path` MUST be an absolute path; otherwise an error will be thrown.\n2. `old_string` MUST be the exact literal text to replace (including all whitespace, indentation, newlines, and surrounding code etc.).\n3. `new_string` MUST be the exact literal text to replace `old_string` with (also including all whitespace, indentation, newlines, and surrounding code etc.). Ensure the resulting code is correct and idiomatic.\n4. NEVER escape `old_string` or `new_string`, that would break the exact literal text requirement.\n**Important:** If ANY of the above are not satisfied, the tool will fail. CRITICAL for `old_string`: Must uniquely identify the single instance to change. Include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string matches multiple locations, or does not match exactly, the tool will fail.\n**Multiple replacements:** Set `expected_replacements` to the number of occurrences you want to replace. The tool will replace ALL occurrences that match `old_string` exactly. Ensure the number of replacements matches your expectation.",
41
+ "parameters": {
42
+ "type": "object",
43
+ "properties": {
44
+ "file_path": {
45
+ "type": "string",
46
+ "description": "The absolute path to the file to modify. Must start with '/'."
47
+ },
48
+ "old_string": {
49
+ "type": "string",
50
+ "description": "The exact literal text to replace, preferably unescaped. For single replacements (default), include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. For multiple replacements, specify expected_replacements parameter. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail."
51
+ },
52
+ "new_string": {
53
+ "type": "string",
54
+ "description": "The exact literal text to replace `old_string` with, preferably unescaped. Provide the EXACT text. Ensure the resulting code is correct and idiomatic."
55
+ },
56
+ "expected_replacements": {
57
+ "type": "integer",
58
+ "description": "Number of replacements expected. Defaults to 1 if not specified. Use when you want to replace multiple occurrences.",
59
+ "default": 1
60
+ }
61
+ },
62
+ "required": [
63
+ "file_path",
64
+ "old_string",
65
+ "new_string"
66
+ ]
67
+ }
68
+ }
69
+ },
70
+ {
71
+ "type": "function",
72
+ "function": {
73
+ "name": "agent_end_task",
74
+ "description": "Ends the current task and logs out of the agent",
75
+ "parameters": {
76
+ "type": "object",
77
+ "properties": {},
78
+ "required": []
79
+ }
80
+ }
81
+ },
82
+ {
83
+ "type": "function",
84
+ "function": {
85
+ "name": "message_notify_dev",
86
+ "description": "Send a message to dev without requiring a response. Use for acknowledging receipt of messages, providing progress updates, reporting task completion, or explaining changes in approach.",
87
+ "parameters": {
88
+ "type": "object",
89
+ "properties": {
90
+ "text_markdown": {
91
+ "type": "string",
92
+ "description": "The body of the message in Markdown format."
93
+ }
94
+ },
95
+ "required": [
96
+ "text_markdown"
97
+ ]
98
+ }
99
+ }
100
+ },
101
+ {
102
+ "type": "function",
103
+ "function": {
104
+ "name": "ls_tool",
105
+ "description": "Lists files and subdirectories with advanced support for pagination and filtering. Automatically ignores common unnecessary files/directories like '.venv', 'node_modules', etc.",
106
+ "parameters": {
107
+ "type": "object",
108
+ "properties": {
109
+ "directory_path": {
110
+ "type": "string",
111
+ "description": "Path of the directory to list. Defaults to '.' (current directory).",
112
+ "default": "."
113
+ },
114
+ "recursive": {
115
+ "type": "boolean",
116
+ "description": "If True, lists recursively all subdirectories.",
117
+ "default": false
118
+ },
119
+ "ignore_patterns": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "string"
123
+ },
124
+ "description": "Additional patterns to ignore (beyond defaults). E.g., ['test_*', '*.tmp']"
125
+ },
126
+ "start_index": {
127
+ "type": "integer",
128
+ "description": "Starting index for pagination (0-based).",
129
+ "default": 0
130
+ },
131
+ "end_index": {
132
+ "type": "integer",
133
+ "description": "Ending index for pagination (exclusive). If not provided, lists everything from start_index."
134
+ },
135
+ "show_hidden": {
136
+ "type": "boolean",
137
+ "description": "If True, shows files/directories starting with '.'.",
138
+ "default": false
139
+ },
140
+ "file_extensions": {
141
+ "type": "array",
142
+ "items": {
143
+ "type": "string"
144
+ },
145
+ "description": "List of extensions to filter (e.g., ['.ts', '.js', '.md']). If not provided, shows all file types."
146
+ },
147
+ "max_depth": {
148
+ "type": "integer",
149
+ "description": "Maximum depth for recursive listing. If not provided, there is no limit."
150
+ }
151
+ },
152
+ "required": []
153
+ }
154
+ }
155
+ },
156
+ {
157
+ "type": "function",
158
+ "function": {
159
+ "name": "count_file_lines",
160
+ "description": "Counts and returns the total number of lines in a text file. Useful for quickly determining file size or checking if a file is empty before reading it.",
161
+ "parameters": {
162
+ "type": "object",
163
+ "properties": {
164
+ "filepath": {
165
+ "type": "string",
166
+ "description": "Path to the file to count lines from. Can be relative or absolute."
167
+ }
168
+ },
169
+ "required": ["filepath"]
170
+ }
171
+ }
172
+ },
173
+ {
174
+ "type": "function",
175
+ "function": {
176
+ "name": "read_file_lines",
177
+ "description": "Reads and returns content between specific line numbers from a text file. Ideal for efficiently reading portions of large files.",
178
+ "parameters": {
179
+ "type": "object",
180
+ "properties": {
181
+ "filepath": {
182
+ "type": "string",
183
+ "description": "Path to the file to read from."
184
+ },
185
+ "start_line": {
186
+ "type": "integer",
187
+ "description": "Starting line number (1-based index). Must be >= 1."
188
+ },
189
+ "end_line": {
190
+ "type": "integer",
191
+ "description": "Ending line number (1-based index, inclusive). Must be >= start_line."
192
+ }
193
+ },
194
+ "required": ["filepath", "start_line", "end_line"]
195
+ }
196
+ }
197
+ }
198
+ ]
199
+ }