aggroot 1.3.1 → 1.3.4

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 AggRoot
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,43 +1,463 @@
1
1
  # AggRoot - AI Coding Assistant
2
2
 
3
- A powerful, extensible AI coding assistant built with Node.js and TypeScript.
3
+ A powerful, extensible AI coding assistant built with Node.js and TypeScript. It provides file operations, web search, code execution, Git integration, and more through a modern DDD + plugin architecture.
4
4
 
5
- ## Features
5
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
7
 
7
- - **Multi-Model Support** - DeepSeek, OpenAI GPT, Claude, Ollama, Qwen, Kimi, and more
8
- - **Intelligent Code Tools** - Read, Write, Edit, Grep, Glob with syntax-aware processing
9
- - **Shell Execution** - Run commands with cross-platform support (Bash, PowerShell, NuShell)
10
- - **Sub-Agent System** - Delegate tasks to specialized agents (explore, plan, code-review)
11
- - **Document Reading** - Word (.docx), PowerPoint (.pptx), Excel (.xlsx), images, PDFs
12
- - **Git Integration** - Status, diff, log, blame, and more
13
- - **Web Tools** - Search and fetch web content
14
- - **MCP Protocol** - Connect external tools via Model Context Protocol
15
- - **Plugin Architecture** - Hot-pluggable DDD-based plugin system
8
+ **[中文文档](README_CN.md)**
9
+
10
+ ## Table of Contents
11
+
12
+ - [Core Features](#core-features)
13
+ - [CLI Interface](#cli-interface)
14
+ - [Quick Start](#quick-start)
15
+ - [Configuration](#configuration)
16
+ - [Usage](#usage)
17
+ - [Available Tools](#available-tools)
18
+ - [Skills System](#skills-system)
19
+ - [MCP Integration](#mcp-integration)
20
+ - [Agent System](#agent-system)
21
+ - [Memory Management](#memory-management)
22
+ - [Cross-Platform Support](#cross-platform-support)
23
+ - [Changelog](#changelog)
24
+ - [License](#license)
25
+
26
+ ## Core Features
27
+
28
+ - **TypeScript First**: Full TypeScript support with strict type checking and modern ES modules
29
+ - **DDD + Plugin Architecture**: Clean domain-driven design with hot-pluggable plugins
30
+ - **Extensible Tool System**: 10 tool plugins providing 30+ built-in tools, easily extensible
31
+ - **Multi AI Agents**: Code agent, chat agent, and specialized sub-agents
32
+ - **Smart Memory**: Context-aware memory with auto-compression and project-level persistence
33
+ - **Advanced File Operations**: Read, Write, Edit, Glob, Grep, DirectoryTree with smart pagination and outline mode
34
+ - **Web Tools**: Web search, web fetch, and HTTP requests with automatic encoding handling
35
+ - **Code Intelligence**: Execute, validate, format, analyze, refactor, and search code symbols
36
+ - **Git Integration**: Full Git operations with cross-platform support
37
+ - **Stock Quotes**: Real-time stock quotes and market data
38
+ - **Modern CLI Interface**: Interactive terminal UI with split-screen layout and Markdown rendering
39
+ - **Skills System**: Reusable skill templates (explain, refactor, test, debug, and more)
40
+ - **MCP Integration**: Model Context Protocol for external tool integration
41
+ - **Security Controls**: Built-in risk control, safe command execution, and dangerous command interception
42
+ - **Cross-Platform**: Seamless operation on Windows, Linux, and macOS
43
+ - **Session Management**: Multi-session support with history, undo, and export
44
+ - **YOLO Mode**: Toggle auto-execution mode to skip tool confirmation prompts
45
+
46
+ ## CLI Interface
47
+
48
+ AggRoot provides a modern terminal UI with a split-screen layout:
49
+
50
+ ```
51
+ ┌──────────────────────────────────────────────────────────────┐
52
+ │ │
53
+ │ Output Area │
54
+ │ (scrollable conversation history) │
55
+ │ (Markdown rendering support) │
56
+ │ │
57
+ ├──────────────────────────────────────────────────────────────┤ ← top separator
58
+ │ Agent> _ │ ← input line
59
+ ├──────────────────────────────────────────────────────────────┤ ← bottom separator
60
+ │ deepseek-chat | Token: 1234/5678 | Mode: coding │ ← status bar
61
+ └──────────────────────────────────────────────────────────────┘
62
+ ```
63
+
64
+ ### CLI Features
65
+
66
+ - **Split-Screen Layout**: Clear separation between output and input areas
67
+ - **Visual Separators**: Double-line separators clearly mark the input area
68
+ - **Status Bar**: Shows current model, token usage, and working mode
69
+ - **Thinking Animation**: Animated status display during AI processing
70
+ - **Raw Mode Input**: Full keyboard support including arrow keys and history navigation
71
+ - **Quick Menus**:
72
+ - Press `/` to view commands
73
+ - Press `$` to select a model
74
+ - Press `#` to select an agent
75
+ - Press `@` to insert a file reference
76
+ - **Markdown Rendering**: Rich text formatting for AI responses
77
+
78
+ ### CLI Commands
79
+
80
+ | Command | Alias | Description |
81
+ |---------|-------|-------------|
82
+ | `/help` | `/h`, `/?` | Show help information |
83
+ | `/model <id>` | — | Switch AI model |
84
+ | `/agents` | — | List all available agents |
85
+ | `/switch [n]` | — | Switch session (by number) |
86
+ | `/reset` | — | Reset current session |
87
+ | `/sessions` | — | List all sessions |
88
+ | `/undo [path]` | — | Undo file changes |
89
+ | `/memory` | — | Manage project memory (list/add/delete/search) |
90
+ | `/init` | — | Generate AGGROOT.md project documentation |
91
+ | `/yolo` | — | Toggle auto-execution mode (skip confirmations) |
92
+ | `/export [format]` | — | Export conversation |
93
+ | `/config` | — | Show current configuration |
94
+ | `/history` | — | Show command history |
95
+ | `/clear` | `/cls` | Clear screen |
96
+ | `/exit` | `/quit`, `/q` | Exit program |
16
97
 
17
98
  ## Quick Start
18
99
 
100
+ ### Prerequisites
101
+
102
+ - **Node.js** >= 20.0.0
103
+ - AI provider API key (DeepSeek, OpenAI, etc.)
104
+
105
+ ### Installation
106
+
19
107
  ```bash
20
- # Install globally
21
- npm install -g aggroot-node
108
+ # Install globally via npm
109
+ npm install -g aggroot
22
110
 
23
- # Run
111
+ # Run the assistant
24
112
  aggroot
25
113
  ```
26
114
 
27
115
  ## Configuration
28
116
 
29
- Create a `.env` file in your project directory:
117
+ ### Environment Variables
118
+
119
+ Create a `.env` file in your project directory or set environment variables directly:
30
120
 
31
121
  ```env
32
- DEEPSEEK_API_KEY=your-api-key
33
- # or
34
- OPENAI_API_KEY=your-api-key
122
+ # === AI Providers (at least one required) ===
123
+ DEEPSEEK_API_KEY=your_deepseek_api_key # DeepSeek (default provider)
124
+ OPENAI_API_KEY=your_openai_api_key # OpenAI GPT
125
+ CLAUDE_API_KEY=your_claude_api_key # Anthropic Claude
126
+ ZHIPU_API_KEY=your_zhipu_api_key # Zhipu AI
127
+ KIMI_API_KEY=your_kimi_api_key # Kimi (Moonshot)
128
+ MINIMAX_API_KEY=your_minimax_api_key # MiniMax
129
+
130
+ # === Ollama (Local Models) ===
131
+ OLLAMA_BASE_URL=http://localhost:11434
132
+ OLLAMA_MODEL_NAME=llama3.2
133
+
134
+ # === Shell Configuration ===
135
+ DEFAULT_SHELL=auto # auto | powershell | cmd | bash | nushell | wsl
136
+ SHELL_TIMEOUT=30000 # Shell command timeout (ms)
137
+ CODE_EXECUTION_TIMEOUT=30 # Code execution timeout (seconds)
138
+
139
+ # === Session Management ===
140
+ MAX_SESSION_HISTORY=50 # Max messages per session
141
+ SESSION_TIMEOUT=60 # Session timeout (minutes)
142
+
143
+ # === Logging ===
144
+ LOG_LEVEL=info # debug | info | warn | error | fatal
145
+
146
+ # === Security ===
147
+ SAFE_MODE=true # Enable safe mode for code execution
148
+ DANGEROUS_COMMANDS=rm -rf,format,del /f /q,shutdown,reboot
149
+ ```
150
+
151
+ > **Important:** At least one AI provider API key is required. DeepSeek is the default provider.
152
+
153
+ ## Usage
154
+
155
+ ### Interactive Mode
156
+
157
+ Start AggRoot and interact with the AI assistant:
158
+
159
+ ```bash
160
+ aggroot
161
+ ```
162
+
163
+ Then type your questions or instructions naturally:
164
+
165
+ ```
166
+ Agent> Read the README.md file and summarize it
167
+ Agent> Search for all TypeScript files in the src directory
168
+ Agent> Run the test suite and fix any failing tests
169
+ Agent> What's the current git status?
170
+ ```
171
+
172
+ ### Quick Menus
173
+
174
+ - **`$`** — Open model selection menu
175
+ - **`#`** — Open agent selection menu
176
+ - **`@`** — Insert file reference
177
+ - **`/`** — Show command list
178
+
179
+ ### YOLO Mode
180
+
181
+ Enable YOLO mode to auto-execute tools without confirmation:
182
+
183
+ ```
184
+ Agent> /yolo
185
+ ✅ YOLO mode enabled - tools will auto-execute
186
+ ```
187
+
188
+ ### Session Management
189
+
190
+ ```bash
191
+ /sessions # List all sessions
192
+ /switch 2 # Switch to session 2
193
+ /reset # Reset current session
194
+ /export markdown # Export conversation as Markdown
195
+ ```
196
+
197
+ ### Memory Management
198
+
199
+ ```bash
200
+ /memory # Show memory stats
201
+ /memory list # List all project memories
202
+ /memory add # Add a new memory
203
+ /memory search # Search memories
35
204
  ```
36
205
 
37
- ## Requirements
206
+ ## Available Tools
207
+
208
+ ### Core Tools (`@aggroot/core-tools`)
209
+
210
+ **File Operations:**
211
+ | Tool | Description |
212
+ |------|-------------|
213
+ | `Read` | Read file contents with smart pagination, outline mode, and context search |
214
+ | `Write` | Create new files or overwrite existing ones |
215
+ | `Edit` | Precise file editing with diff-style replacement (minimizes token consumption) |
216
+ | `Glob` | Find files by name/path pattern (e.g., `**/*.ts`, `src/**/*.py`) |
217
+ | `Grep` | Search file contents with regex (preferred tool for finding code) |
218
+ | `DirectoryTree` | Quickly list directory tree structure with configurable depth and exclusions |
219
+
220
+ **User Interaction:**
221
+ | Tool | Description |
222
+ |------|-------------|
223
+ | `AskUser` | Ask the user questions with multi-select or free-text input |
224
+
225
+ **Planning:**
226
+ | Tool | Description |
227
+ |------|-------------|
228
+ | `EnterPlanMode` | Enter plan mode to break down complex tasks before execution |
229
+ | `ExitPlanMode` | Exit plan mode and submit the plan for approval |
230
+
231
+ ### Code Tools (`@aggroot/code-tools`)
232
+
233
+ | Tool | Description |
234
+ |------|-------------|
235
+ | `CodeExecute` | Safely execute TypeScript/JavaScript code with timeout control |
236
+ | `CodeValidate` | Validate code syntax with TypeScript compiler (real type checking) |
237
+ | `CodeFormat` | Format code with configurable indentation |
238
+ | `CodeAnalyze` | Analyze code for symbols, complexity, imports/exports, and issues |
239
+ | `CodeSearch` | Unified symbol search (definitions, references, workspace symbols) |
240
+ | `CodeRefactor` | Code refactoring operations (extract function, rename, organize imports) |
241
+
242
+ ### Git Tools (`@aggroot/git-tools`)
243
+
244
+ | Tool | Description |
245
+ |------|-------------|
246
+ | `GitStatus` | Show working tree status |
247
+ | `GitDiff` | Show differences between commits, or between commits and working tree |
248
+ | `GitLog` | Show commit logs |
249
+ | `GitBranch` | List, create, or delete branches |
250
+ | `GitShow` | Show various types of objects (commits, tags, trees, etc.) |
251
+ | `GitAdd` | Stage file contents |
252
+ | `GitCommit` | Record changes to the repository |
253
+ | `GitPush` | Push to remote repositories |
254
+ | `GitPull` | Pull from remote repositories |
255
+ | `GitCheckout` | Switch branches or restore working tree files |
256
+ | `GitRemote` | Manage remote repository sets |
257
+ | `GitStash` | Stash changes in a dirty working directory |
258
+
259
+ ### Web Tools (`@aggroot/web-tools`)
260
+
261
+ | Tool | Description |
262
+ |------|-------------|
263
+ | `WebSearch` | Search the web (with query optimization) |
264
+ | `WebFetch` | Fetch web content from URLs (auto-retry with multiple URLs) |
265
+ | `HttpRequest` | Make HTTP requests (GET, POST, PUT, DELETE, PATCH) |
266
+
267
+ ### Shell Tools (`@aggroot/shell-tools`)
268
+
269
+ | Tool | Description |
270
+ |------|-------------|
271
+ | `Shell` | Execute shell commands with security controls and timeout |
272
+
273
+ > **Important:** Prefer core tools (read/write/edit/glob/grep) for file operations over shell commands. Use Shell only for system-level operations that core tools cannot accomplish.
274
+
275
+ ### Todo Tools (`@aggroot/todo-tools`)
276
+
277
+ | Tool | Description |
278
+ |------|-------------|
279
+ | `TodoCreate` | Create a new todo item |
280
+ | `TodoList` | List all todo items |
281
+ | `TodoUpdate` | Update a todo item |
282
+ | `TodoDelete` | Delete a todo item |
283
+ | `TodoComplete` | Mark a todo item as completed |
284
+
285
+ ### Skill Tools (`@aggroot/skill-tools`)
286
+
287
+ | Tool | Description |
288
+ |------|-------------|
289
+ | `Skill` | Invoke a skill by name (reusable task template) |
290
+ | `ListSkills` | List all available skills |
291
+
292
+ ### MCP Tools (`@aggroot/mcp-tools`)
293
+
294
+ | Tool | Description |
295
+ |------|-------------|
296
+ | `MCP` | Model Context Protocol integration for connecting external tool servers |
297
+
298
+ ### Risk Control Tools (`@aggroot/risk-control-tools`)
299
+
300
+ Security and risk management tools for safe command execution and domain reputation checks.
301
+
302
+ ### Stock Tools (`@aggroot/stock-tools`)
303
+
304
+ | Tool | Description |
305
+ |------|-------------|
306
+ | `StockQuote` | Get real-time stock quotes |
307
+
308
+ ## Skills System
309
+
310
+ AggRoot includes a built-in skills system that provides reusable templates for common tasks:
311
+
312
+ **Built-in Skills:**
313
+ - `explain` — Explain code or concepts
314
+ - `refactor` — Refactor code to improve quality
315
+ - `test` — Generate test cases
316
+ - `document` — Generate documentation
317
+ - `debug` — Debug issues and errors
318
+ - `analyze` — Analyze codebase structure
319
+ - `security-check` — Security audit and vulnerability scanning
320
+ - `commit` — Generate meaningful commit messages
321
+
322
+ **Using Skills:**
323
+ ```
324
+ Agent> /explain this function
325
+ Agent> /refactor src/utils/helpers.ts
326
+ Agent> /test src/domain/agent/
327
+ ```
328
+
329
+ ## MCP Integration
330
+
331
+ AggRoot supports the **Model Context Protocol (MCP)** for integrating external tool servers:
332
+
333
+ - Connect MCP-compatible tool servers
334
+ - Dynamically discover and use external tools
335
+ - Supports **stdio**, **HTTP**, **WebSocket**, and **SSE** transport protocols
336
+ - Auto-reconnect (with exponential backoff) and health monitoring
337
+ - Configure MCP servers at project or user level
338
+
339
+ ### Configuration
340
+
341
+ MCP servers are configured via `.aggroot/mcp.json` (project-level) or `~/.aggroot/mcp.json` (user-global):
342
+
343
+ ```json
344
+ {
345
+ "servers": [
346
+ {
347
+ "name": "powerpoint-server",
348
+ "transport": {
349
+ "type": "stdio",
350
+ "command": "uvx",
351
+ "args": ["--from", "office-powerpoint-mcp-server", "ppt_mcp_server"]
352
+ },
353
+ "enabled": true
354
+ },
355
+ {
356
+ "name": "word-document-server",
357
+ "transport": {
358
+ "type": "stdio",
359
+ "command": "uvx",
360
+ "args": ["--from", "office-word-mcp-server", "word_mcp_server"]
361
+ },
362
+ "enabled": true
363
+ }
364
+ ],
365
+ "settings": {
366
+ "defaultTimeout": 30000,
367
+ "autoReconnect": true
368
+ }
369
+ }
370
+ ```
371
+
372
+ ### Pre-configured MCP Servers
373
+
374
+ | Server | Package | Description |
375
+ |--------|---------|-------------|
376
+ | `powerpoint-server` | `office-powerpoint-mcp-server` | Create, edit, and manipulate PowerPoint presentations (34 tools: charts, shapes, tables, gradients, etc.) |
377
+ | `word-document-server` | `office-word-mcp-server` | Create, read, and manipulate Word documents (42 tools: paragraphs, tables, images, formatting, etc.) |
378
+
379
+ ### Installing MCP Servers
380
+
381
+ ```bash
382
+ # Option 1: Use uvx (recommended — no global install needed, requires uv/uvx)
383
+ # Already configured in mcp.json, just ensure uv/uvx is installed
384
+
385
+ # Option 2: Global pip install
386
+ pip install office-powerpoint-mcp-server office-word-mcp-server
387
+ ```
388
+
389
+ > **Note:** The `name` in the config determines the tool prefix. For example, `powerpoint-server` generates tools like `mcp_powerpoint-server_create_presentation`.
390
+
391
+ ## Agent System
392
+
393
+ AggRoot features a powerful **agent** system with multiple specialized agents for different tasks:
394
+
395
+ ### Built-in Agents
396
+
397
+ | Agent | Name | Description |
398
+ |-------|------|-------------|
399
+ | Code Agent | Code Deity | Professional coding assistant — directive refactoring, code generation, multi-file collaboration with sub-agent support |
400
+ | Content Agent | Content Creator | Content creation assistant — articles, copywriting, professional PPT presentations and Word documents (via MCP) |
401
+ | Resume Agent | Resume Optimizer | Resume optimization expert — diagnostics, STAR rewriting, keyword analysis, Word document formatting (via MCP) |
402
+ | Companion Agent | Xiao Ai | Warm and caring virtual companion — cute and friendly, supports web search and file operations |
403
+ | Lei Jun Assistant | Lei Jun Classmate | Lei Jun-style assistant — investment insights, stock analysis, business strategy |
404
+ | Investment Agent | Investment Master | Investment analysis expert — data-driven stock analysis (A-shares and HK stocks), quotes/financials/technical/news |
405
+ | Ops Agent | Ops Master | System operations expert — system administration, environment management, deployment |
406
+ | Risk Control Agent | Risk Detective | Risk detective — payment fraud detection, phishing detection, domain reputation, security scanning |
407
+
408
+ ### Sub-Agent System
409
+
410
+ The Code Agent can delegate tasks to specialized sub-agents:
411
+
412
+ - **Explore Agent**: Quick read-only codebase exploration with parallel tool calls
413
+ - **Plan Agent**: Plan and design tasks
414
+ - **Code Reviewer Agent**: Code review and quality analysis
415
+ - **General Purpose Agent**: Complex multi-step tasks
416
+
417
+ Sub-agents run autonomously and return complete output, enabling efficient task decomposition and parallel execution.
418
+
419
+ ## Memory Management
420
+
421
+ AggRoot includes an intelligent memory system:
422
+
423
+ - **Context-Aware Memory**: Automatically tracks conversation context with auto-compression when needed
424
+ - **Project Memory**: Cross-session persistent project-level memory
425
+ - **Memory Commands**: `/memory list`, `/memory add`, `/memory delete`, `/memory search`
426
+ - **Auto-Compression**: Intelligently summarizes old conversations to stay within token limits
427
+ - **File Tracking**: Tracks file changes during conversations with undo support
428
+
429
+ ## Cross-Platform Support
430
+
431
+ AggRoot is designed to work seamlessly across all major operating systems:
432
+
433
+ | Platform | Architecture | Shell Support | Notes |
434
+ |----------|-------------|---------------|-------|
435
+ | **Windows** | x64, arm64 | PowerShell, CMD, Git Bash, Nushell, WSL | Auto encoding detection (GBK/UTF-8) |
436
+ | **Linux** | x64, arm64 | Bash, Zsh, Fish | — |
437
+ | **macOS** | x64, arm64 (Apple Silicon) | Zsh, Bash | Native Apple Silicon support |
438
+
439
+ ### Platform Compatibility
440
+
441
+ | Feature | Windows | Linux | macOS |
442
+ |---------|---------|-------|-------|
443
+ | File Operations | ✅ | ✅ | ✅ |
444
+ | Shell Commands | ✅ (Git Bash / Nushell / PowerShell) | ✅ | ✅ |
445
+ | Web Tools | ✅ | ✅ | ✅ |
446
+ | Git Integration | ✅ | ✅ | ✅ |
447
+ | Encoding Support | ✅ (GBK/UTF-8) | ✅ (UTF-8) | ✅ (UTF-8) |
448
+
449
+ ## Changelog
450
+
451
+ ### v1.3.4
38
452
 
39
- - Node.js >= 20.0.0
453
+ - **Nushell Shell Support**: Added Nushell (`nu`) as a supported shell on Windows, with automatic detection via common install paths and PATH lookup
454
+ - **Updated Shell Priority**: Default shell priority on Windows is now Git Bash > Nushell > PowerShell
455
+ - **Smart Shell Syntax**: System prompt now generates shell syntax compatible with the detected default shell instead of always assuming Git Bash
456
+ - **Bug Fixes**:
457
+ - Read tool auto-corrects `../` relative paths via searchFilePath fallback
458
+ - SubAgent robust summary round with tool result fallback when no output
459
+ - Glob tool description clarifies it matches files only, not directories
40
460
 
41
461
  ## License
42
462
 
43
- MIT
463
+ This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.