@defai.digital/ax-cli 3.6.0 → 3.6.2

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.
Files changed (101) hide show
  1. package/README.md +447 -102
  2. package/config-defaults/settings.yaml +24 -0
  3. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js +7 -9
  4. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js.map +1 -1
  5. package/dist/analyzers/code-smells/detectors/dead-code-detector.js +1 -1
  6. package/dist/analyzers/code-smells/detectors/dead-code-detector.js.map +1 -1
  7. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js +22 -10
  8. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js.map +1 -1
  9. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js +1 -1
  10. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js.map +1 -1
  11. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js +1 -1
  12. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js.map +1 -1
  13. package/dist/analyzers/code-smells/detectors/large-class-detector.js +4 -1
  14. package/dist/analyzers/code-smells/detectors/large-class-detector.js.map +1 -1
  15. package/dist/analyzers/code-smells/detectors/long-method-detector.js +4 -1
  16. package/dist/analyzers/code-smells/detectors/long-method-detector.js.map +1 -1
  17. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js +4 -1
  18. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js.map +1 -1
  19. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js +4 -5
  20. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js.map +1 -1
  21. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js +4 -1
  22. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js.map +1 -1
  23. package/dist/constants.d.ts +13 -0
  24. package/dist/constants.js +28 -0
  25. package/dist/constants.js.map +1 -1
  26. package/dist/schemas/settings-schemas.d.ts +40 -0
  27. package/dist/schemas/settings-schemas.js +32 -0
  28. package/dist/schemas/settings-schemas.js.map +1 -1
  29. package/dist/tools/web-search/index.d.ts +0 -2
  30. package/dist/tools/web-search/index.js +0 -2
  31. package/dist/tools/web-search/index.js.map +1 -1
  32. package/dist/tools/web-search/router.d.ts +0 -2
  33. package/dist/tools/web-search/router.js +2 -37
  34. package/dist/tools/web-search/router.js.map +1 -1
  35. package/dist/tools/web-search/web-search-tool.js +2 -12
  36. package/dist/tools/web-search/web-search-tool.js.map +1 -1
  37. package/dist/ui/components/chat-history.d.ts +2 -0
  38. package/dist/ui/components/chat-history.js +32 -81
  39. package/dist/ui/components/chat-history.js.map +1 -1
  40. package/dist/ui/components/chat-input.d.ts +4 -1
  41. package/dist/ui/components/chat-input.js +133 -52
  42. package/dist/ui/components/chat-input.js.map +1 -1
  43. package/dist/ui/components/chat-interface.js +4 -4
  44. package/dist/ui/components/chat-interface.js.map +1 -1
  45. package/dist/ui/components/keyboard-hints.js +2 -0
  46. package/dist/ui/components/keyboard-hints.js.map +1 -1
  47. package/dist/ui/components/status-bar.d.ts +2 -0
  48. package/dist/ui/components/status-bar.js +31 -17
  49. package/dist/ui/components/status-bar.js.map +1 -1
  50. package/dist/ui/components/tool-group-display.d.ts +15 -0
  51. package/dist/ui/components/tool-group-display.js +91 -0
  52. package/dist/ui/components/tool-group-display.js.map +1 -0
  53. package/dist/ui/components/welcome-panel.js +4 -0
  54. package/dist/ui/components/welcome-panel.js.map +1 -1
  55. package/dist/ui/hooks/use-enhanced-input.d.ts +4 -0
  56. package/dist/ui/hooks/use-enhanced-input.js +156 -9
  57. package/dist/ui/hooks/use-enhanced-input.js.map +1 -1
  58. package/dist/ui/hooks/use-input-handler.d.ts +4 -0
  59. package/dist/ui/hooks/use-input-handler.js +28 -10
  60. package/dist/ui/hooks/use-input-handler.js.map +1 -1
  61. package/dist/ui/utils/change-summarizer.d.ts +20 -0
  62. package/dist/ui/utils/change-summarizer.js +193 -0
  63. package/dist/ui/utils/change-summarizer.js.map +1 -0
  64. package/dist/ui/utils/tool-grouper.d.ts +62 -0
  65. package/dist/ui/utils/tool-grouper.js +224 -0
  66. package/dist/ui/utils/tool-grouper.js.map +1 -0
  67. package/dist/utils/audit-logger.d.ts +28 -70
  68. package/dist/utils/audit-logger.js +30 -135
  69. package/dist/utils/audit-logger.js.map +1 -1
  70. package/dist/utils/config-loader.d.ts +4 -0
  71. package/dist/utils/config-loader.js.map +1 -1
  72. package/dist/utils/paste-utils.d.ts +99 -0
  73. package/dist/utils/paste-utils.js +265 -0
  74. package/dist/utils/paste-utils.js.map +1 -0
  75. package/dist/utils/rate-limiter.d.ts +15 -1
  76. package/dist/utils/rate-limiter.js +15 -1
  77. package/dist/utils/rate-limiter.js.map +1 -1
  78. package/package.json +4 -8
  79. package/packages/schemas/package.json +1 -1
  80. package/.ax-cli/CUSTOM.md +0 -269
  81. package/.ax-cli/checkpoints/2025-11-20/checkpoint-2dd84869-e62d-46c8-9885-7e45f37f36e2.json +0 -69
  82. package/.ax-cli/checkpoints/2025-11-20/checkpoint-484dc350-353f-4808-9ed1-ebb3cefdab37.json +0 -24
  83. package/.ax-cli/checkpoints/2025-11-20/checkpoint-74a18b87-6172-4215-962b-44bb9f46a662.json +0 -69
  84. package/.ax-cli/checkpoints/2025-11-20/checkpoint-870a5fb9-6e82-4ff2-8ec8-af4c251cc514.json +0 -44
  85. package/.ax-cli/checkpoints/2025-11-20/checkpoint-93946601-0e83-456c-ba47-def9713124dd.json +0 -24
  86. package/.ax-cli/checkpoints/metadata.json +0 -62
  87. package/.ax-cli/index.json +0 -44
  88. package/.ax-cli/memory.json +0 -55
  89. package/.ax-cli/settings.json +0 -1
  90. package/dist/agent/chat-history-manager.d.ts +0 -56
  91. package/dist/agent/chat-history-manager.js +0 -150
  92. package/dist/agent/chat-history-manager.js.map +0 -1
  93. package/dist/agent/tool-manager.d.ts +0 -39
  94. package/dist/agent/tool-manager.js +0 -76
  95. package/dist/agent/tool-manager.js.map +0 -1
  96. package/dist/tools/web-search/engines/brave.d.ts +0 -16
  97. package/dist/tools/web-search/engines/brave.js +0 -99
  98. package/dist/tools/web-search/engines/brave.js.map +0 -1
  99. package/dist/tools/web-search/engines/tavily.d.ts +0 -17
  100. package/dist/tools/web-search/engines/tavily.js +0 -73
  101. package/dist/tools/web-search/engines/tavily.js.map +0 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # AX CLI - Enterprise-Class GLM AI CLI
1
+ # AX CLI - Enterprise-Class CLI for GenAI coding
2
2
 
3
3
  [![npm](https://img.shields.io/npm/dt/@defai.digital/ax-cli?style=flat-square&logo=npm&label=downloads)](https://npm-stat.com/charts.html?package=%40defai.digital%2Fax-cli)
4
- [![Tests](https://img.shields.io/badge/tests-1036%20passing-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)
4
+ [![Tests](https://img.shields.io/badge/tests-1381%20passing-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)
5
5
  [![Coverage](https://img.shields.io/badge/coverage-98%2B%25-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9%2B-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
7
7
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D24.0.0-blue?style=flat-square)](https://nodejs.org/)
@@ -44,7 +44,7 @@ ax-cli
44
44
  - 200K context window, 128K max output capability
45
45
  - 30% more token efficient than GLM 4.5
46
46
  - Optimized for complex code generation and refactoring
47
- - **🎯 Multi-Phase Task Planner** (NEW in v3.0.0): Intelligent task decomposition for complex requests
47
+ - **🎯 Multi-Phase Task Planner**: Intelligent task decomposition for complex requests
48
48
  - Automatic complexity detection (57 keyword patterns)
49
49
  - LLM-based plan generation with phases and dependencies
50
50
  - Phase-by-phase execution with progress tracking
@@ -64,32 +64,56 @@ ax-cli
64
64
  - **✅ Production-Ready**: 98%+ test coverage, TypeScript strict mode, Zod validation
65
65
  - **🎯 Interactive & Headless**: Chat interface or one-shot commands
66
66
  - **📝 Smart Project Init**: Automatic project analysis and custom instructions
67
- - **🧠 Project Memory** (NEW): Intelligent context caching for z.ai GLM-4.6
67
+ - **🧠 Project Memory**: Intelligent context caching for z.ai GLM-4.6
68
68
  - Automatic project scanning and context generation
69
69
  - z.ai implicit caching support (50% token savings on repeated context)
70
70
  - Cache statistics tracking and efficiency monitoring
71
- - **🏥 Health Check** (NEW): Comprehensive diagnostics with `ax-cli doctor`
71
+ - **🏥 Health Check**: Comprehensive diagnostics with `ax-cli doctor`
72
72
  - Verify configuration, API connectivity, and dependencies
73
73
  - Detailed error messages with actionable suggestions
74
- - **💬 Dual-Model Mode** (NEW): Use different models for chat vs coding
74
+ - **🎨 Smart Verbosity Control**: Multi-level output for optimal UX
75
+ - **Quiet mode** (default): Groups tool operations → 85% less noise
76
+ - **Concise mode**: One line per tool execution
77
+ - **Verbose mode**: Full details for debugging
78
+ - Press `Ctrl+O` to cycle between levels
79
+ - Auto-expands errors with full details
80
+ - **💬 Dual-Model Mode**: Use different models for chat vs coding
75
81
  - Configure chat and coding models separately
76
82
  - Manual model switching with `--chat-mode` flag
77
83
  - Optimize cost and performance for different task types
78
- - **🌐 Web Search** (NEW in v3.4.0): Real-time internet search capabilities
79
- - Integrated Tavily AI (AI-optimized search) and Brave Search
80
- - Intelligent query routing based on intent detection
81
- - Results caching for faster responses and reduced API costs
82
- - Support for technical docs, code examples, news, and general queries
83
- - Configurable search depth and freshness filters
84
+ - **🌐 Web Search**: Real-time package search capabilities
85
+ - **Works out-of-the-box**: npm, PyPI, and crates.io package search (no API keys required)
86
+ - **Intelligent routing**: Automatically selects the best engine based on query intent
87
+ - JavaScript/Node.js packages npm registry search
88
+ - Python packages PyPI registry search
89
+ - Rust packages crates.io registry search
90
+ - Results caching for faster responses (5 minute TTL)
91
+ - Support for package discovery, dependency research, and version information
92
+ - Session-based context for iterative package exploration
84
93
  - **🔄 Auto-Update**: Built-in update checker and installer
85
- - **🔒 Enterprise Security** (NEW in v3.6.0): Optional hardening features for enterprise deployments
86
- - **Automatic API Key Encryption**: AES-256-GCM encryption at rest (transparent migration)
87
- - **Optional Command Whitelist**: Restrict bash commands to safe list (disabled by default)
88
- - **Optional SSRF Protection**: Validate MCP transport URLs (disabled by default)
89
- - **Optional Error Sanitization**: Remove sensitive data from error messages (disabled by default)
90
- - **117 security tests** with 98%+ coverage
91
- - **User-friendly defaults**: Full functionality for 95% of users, opt-in hardening for enterprise
92
- - **📊 Advanced Code Analysis** (NEW in v2.4.0): Professional-grade static analysis tools
94
+ - **🔒 Enterprise-Grade Security**: **FREE & Open Source**
95
+ - **Command Injection Protection**: CVSS 9.8 CRITICAL fix - Safe command execution with whitelisting
96
+ - **Path Traversal Hardening**: CVSS 8.6 HIGH fix - Prevent unauthorized file system access
97
+ - **SSRF Attack Prevention**: CVSS 7.5 HIGH fix - Validate MCP transport URLs and block private IPs
98
+ - **Input Sanitization**: CVSS 7.0 HIGH fix - Comprehensive input validation and sanitization
99
+ - **Error Sanitization**: CVSS 6.5 MEDIUM fix - Prevent sensitive data leakage in error messages
100
+ - **API Key Encryption**: AES-256-GCM encryption at rest with automatic migration
101
+ - **Memory Leak Fixes**: Process pool management for long-running operations
102
+ - **Security Audit Logging**: Basic JSON logging with 30-day retention
103
+ - **Rate Limiting**: Token bucket algorithm to prevent API abuse (100 req/min)
104
+ - **1381+ tests passing** with **98.29% coverage** - Production-ready security
105
+ - **User-friendly defaults**: Full functionality with enterprise-grade security for everyone
106
+ - **🏢 Enterprise Features**: Advanced capabilities for teams and compliance
107
+ - **Compliance Report Generation**: SOC2, HIPAA, PCI-DSS automated reporting
108
+ - **Advanced Audit Logging**: Tamper-proof encrypted logs with hash chains and extended retention (1+ years)
109
+ - **Real-time Security Dashboards**: Monitor security events, anomalies, and compliance status
110
+ - **Advanced Rate Limiting**: Custom quotas per user/team/project with cost analytics and budget alerts
111
+ - **Team Collaboration**: Shared chat history with full-text search and multi-format export
112
+ - **Policy Enforcement**: Tool execution policies, approval workflows, and usage analytics
113
+ - **SSO/SAML Integration**: Enterprise identity provider support
114
+ - **Priority Support**: 24-hour SLA email support
115
+ - 📧 **Contact sales@defai.digital** for enterprise licensing and pricing
116
+ - **📊 Advanced Code Analysis**: Professional-grade static analysis tools
93
117
  - **Dependency Analyzer**: Detect circular dependencies, calculate coupling metrics, identify orphan and hub files
94
118
  - **Code Smell Detector**: Find 10+ anti-patterns (long methods, large classes, duplicates, dead code, etc.)
95
119
  - **Hotspot Analyzer**: Identify frequently changing, complex code using git history analysis
@@ -134,7 +158,7 @@ AX CLI officially supports the following platforms:
134
158
  ### Prerequisites
135
159
 
136
160
  - Node.js 24.0.0 or higher
137
- - npm or bun package manager
161
+ - npm package manager
138
162
 
139
163
  ### Global Installation (Recommended)
140
164
 
@@ -148,20 +172,37 @@ npm install -g @defai.digital/ax-cli
148
172
 
149
173
  ### Quick Setup
150
174
 
175
+ The recommended way to configure AX CLI is using the interactive setup wizard:
176
+
151
177
  ```bash
152
- # Set your API key (for cloud providers)
153
- export YOUR_API_KEY=your_api_key_here
178
+ # Run the setup wizard (recommended)
179
+ ax-cli setup
180
+
181
+ # This will:
182
+ # 1. Guide you through provider selection (Z.AI, OpenAI, Anthropic, Ollama, etc.)
183
+ # 2. Securely encrypt and store your API key (AES-256-GCM encryption)
184
+ # 3. Configure default model and settings
185
+ # 4. Validate your configuration
186
+ ```
154
187
 
155
- # Or configure in settings
156
- ax-cli # Will prompt for API key on first run
188
+ **Alternative: Environment Variable Override**
189
+
190
+ For CI/CD pipelines or temporary overrides, you can set an environment variable:
191
+
192
+ ```bash
193
+ # Override API key temporarily (not recommended for daily use)
194
+ export YOUR_API_KEY=your_api_key_here
195
+ ax-cli
157
196
  ```
158
197
 
198
+ **⚠️ Security Note**: API keys are automatically encrypted in config files using AES-256-GCM encryption. **Do not manually edit `~/.ax-cli/config.json`** - always use `ax-cli setup` to update your API key securely.
199
+
159
200
  ### Configuration Files
160
201
 
161
- - **User Settings**: `~/.ax-cli/config.json`
162
- - **Project Settings**: `.ax-cli/settings.json`
163
- - **Custom Instructions**: `.ax-cli/CUSTOM.md`
164
- - **Project Memory**: `.ax-cli/memory.json` (auto-generated)
202
+ - **User Settings**: `~/.ax-cli/config.json` (API keys are encrypted)
203
+ - **Project Settings**: `.ax-cli/settings.json` (project-specific overrides)
204
+ - **Custom Instructions**: `.ax-cli/CUSTOM.md` (AI behavior customization)
205
+ - **Project Memory**: `.ax-cli/memory.json` (auto-generated context cache)
165
206
 
166
207
  [Configuration Guide →](docs/configuration.md)
167
208
 
@@ -193,7 +234,7 @@ ax-cli -c
193
234
  /commit-and-push # AI-powered git commit
194
235
  /exit # Exit application
195
236
 
196
- # Multi-Phase Planner commands (NEW in v3.0.0):
237
+ # Multi-Phase Planner commands:
197
238
  /plans # List all execution plans
198
239
  /plan # Show current plan details
199
240
  /phases # Show phase progress
@@ -209,7 +250,7 @@ AX CLI supports powerful keyboard shortcuts for enhanced productivity:
209
250
 
210
251
  | Shortcut | Action | Description |
211
252
  |----------|--------|-------------|
212
- | **Ctrl+O** | Toggle verbose mode | Default: concise single-line output. Verbose: full details, diffs, file contents |
253
+ | **Ctrl+O** | Cycle verbosity | Quiet (grouped) → Concise (per-tool) Verbose (full details) Quiet |
213
254
  | **Ctrl+B** | Background mode | Move running command to background, or toggle "always background" mode |
214
255
  | **Ctrl+K** | Quick actions | Open quick actions menu |
215
256
  | **Shift+Tab** | Auto-edit mode | Toggle automatic approval for all operations |
@@ -218,6 +259,11 @@ AX CLI supports powerful keyboard shortcuts for enhanced productivity:
218
259
  | **Ctrl+A/E** | Cursor | Move to line start/end |
219
260
  | **Ctrl+W** | Delete word | Delete word before cursor |
220
261
 
262
+ **Verbosity Levels** (Ctrl+O to cycle):
263
+ - **Quiet** (default): Groups operations → `⏺ Working on app.ts (3 edits, 5 reads) ✓ 2.3s`
264
+ - **Concise**: One line per tool → `⏺ Read (app.ts) ✓ 22 lines`
265
+ - **Verbose**: Full details → Shows args, outputs, diffs, timings
266
+
221
267
  ### 🔄 Background Tasks
222
268
 
223
269
  Run long-running commands in the background (like Claude Code's Ctrl+B):
@@ -250,7 +296,7 @@ ax-cli -p "write tests for utils/" --max-tool-rounds 50
250
296
  ax-cli -p "refactor" --model glm-4.6
251
297
  ```
252
298
 
253
- ### 🔌 VSCode Integration (NEW!)
299
+ ### 🔌 VSCode Integration
254
300
 
255
301
  AX CLI integrates seamlessly with Visual Studio Code via tasks and keyboard shortcuts:
256
302
 
@@ -366,17 +412,43 @@ ax-cli usage reset
366
412
 
367
413
  ## 📋 Working with Large Content
368
414
 
369
- When working with large amounts of text (logs, code files, documentation), use **file-based workflows** instead of pasting directly into the terminal.
415
+ AX CLI has **intelligent paste handling** that automatically manages large text inputs for better readability.
370
416
 
371
- ### ⚠️ Terminal Paste Limitations
417
+ ### 📝 Smart Paste Auto-Collapse
372
418
 
373
- **Avoid pasting large content directly** into the interactive terminal:
419
+ When you paste **20+ lines** of text, AX CLI automatically collapses it:
374
420
 
375
- - **DON'T**: Paste large code files, logs, or documents (>2000 characters)
376
- - ⚠️ Some terminals may have paste limitations
377
- - ⚠️ Character counter shows visual warning: Gray (0-999) Cyan (1000-1599) → Yellow (1600-1999) **Red (2000+)**
421
+ - **Automatic Detection**: Pastes with 20+ lines are auto-collapsed
422
+ - **Clean Display**: Shows `[Pasted text #1 +89 lines]` instead of cluttering the UI
423
+ - **Full Submission**: Complete text is still sent to the AI (not just the placeholder)
424
+ - ✅ **Review Anytime**: Press **Ctrl+P** on a collapsed block to expand/collapse
378
425
 
379
- ### ✅ Recommended Approaches
426
+ **Example:**
427
+ ```bash
428
+ # Paste a 100-line error log
429
+ # → Shows: [Pasted text #1 +100 lines]
430
+ # → AI receives: Full 100 lines
431
+
432
+ # Position cursor on placeholder and press Ctrl+P to review
433
+ # → Expands to show all 100 lines
434
+ ```
435
+
436
+ **Configure in `~/.ax-cli/config.json`:**
437
+ ```json
438
+ {
439
+ "paste": {
440
+ "autoCollapse": true, // Enable/disable (default: true)
441
+ "collapseThreshold": 20 // Min lines to collapse (default: 20)
442
+ }
443
+ }
444
+ ```
445
+
446
+ ### ⚠️ Character Counter Warning
447
+
448
+ The character counter shows visual warnings for very large single inputs:
449
+ - Gray (0-999) → Cyan (1000-1599) → Yellow (1600-1999) → **Red (2000+)**
450
+
451
+ ### ✅ Alternative Approaches for Extremely Large Content
380
452
 
381
453
  **Option 1: File Reference (Interactive Mode)**
382
454
  ```bash
@@ -418,7 +490,7 @@ The interactive terminal shows a character counter `[count/2000]` with color-cod
418
490
  | **Yellow** | 1600-1999 | ⚠️ Consider using files |
419
491
  | **Red** | 2000+ | ❌ Use file-based workflow |
420
492
 
421
- ## 🏥 Health Check & Diagnostics (NEW)
493
+ ## 🏥 Health Check & Diagnostics
422
494
 
423
495
  Run comprehensive diagnostics to verify your AX CLI configuration:
424
496
 
@@ -442,13 +514,15 @@ The `doctor` command checks:
442
514
  - ✓ MCP server configuration
443
515
  - ✓ Dependencies (ripgrep, git)
444
516
 
445
- ## 💬 Dual-Model Mode (NEW)
517
+ ## 💬 Dual-Model Mode
446
518
 
447
519
  Use different models for chat vs coding tasks to optimize performance and cost:
448
520
 
449
521
  ### Configuration
450
522
 
451
- Add to `~/.ax-cli/config.json` or `.ax-cli/settings.json`:
523
+ **Option 1: Project Settings** (recommended for project-specific preferences)
524
+
525
+ Add to `.ax-cli/settings.json` in your project directory:
452
526
 
453
527
  ```json
454
528
  {
@@ -460,6 +534,8 @@ Add to `~/.ax-cli/config.json` or `.ax-cli/settings.json`:
460
534
  }
461
535
  ```
462
536
 
537
+ **Option 2: Environment Variables** (for temporary or CI/CD use)
538
+
463
539
  ### Usage
464
540
 
465
541
  ```bash
@@ -489,72 +565,68 @@ ax-cli --chat-mode
489
565
  - ⚡ **Better performance**: Match model capability to task complexity
490
566
  - 🎯 **Manual control**: You decide when to use each model
491
567
 
492
- ## 🌐 Web Search (NEW)
568
+ ## 🌐 Web Search
493
569
 
494
- Search the internet for real-time information, documentation, code examples, and current events.
570
+ Search package registries for JavaScript, Python, and Rust packages with intelligent language detection and cross-registry comparison.
495
571
 
496
572
  ### ✨ Works Out of the Box!
497
573
 
498
- **npm package search is enabled by default** (no API key required). For enhanced web search capabilities, optionally configure Tavily AI or Brave Search.
574
+ **Package search is enabled by default** (no API key required):
575
+ - **npm** - JavaScript/Node.js packages from npmjs.com
576
+ - **PyPI** - Python packages from pypi.org
577
+ - **crates.io** - Rust packages from crates.io
499
578
 
500
579
  ### Quick Setup
501
580
 
502
- **Option 1: Use npm Search Only** (Default - No Setup Required)
503
- - npm package search works immediately
504
- - Perfect for JavaScript/TypeScript development
581
+ **No setup required!** Package search works immediately:
582
+ - **npm** - JavaScript/Node.js packages work immediately
583
+ - **PyPI** - Python packages work immediately
584
+ - **crates.io** - Rust packages work immediately
585
+ - Perfect for package discovery and dependency management
505
586
  - No API keys needed
506
587
 
507
- **Option 2: Add Enhanced Web Search** (Optional)
508
- 1. **Get API Keys** (choose one or both):
509
- - **Tavily AI** (recommended): https://tavily.com/
510
- - Free tier: 1,000 searches/month
511
- - Best for: AI-optimized general search, technical queries
512
- - **Brave Search**: https://brave.com/search/api/
513
- - Free tier: 2,000 searches/month
514
- - Best for: News, current events, privacy-focused
515
-
516
- 2. **Configure API Keys**:
517
-
518
- ```bash
519
- # Add to ~/.bashrc, ~/.zshrc, or .env (OPTIONAL)
520
- export TAVILY_API_KEY="your_tavily_api_key"
521
- export BRAVE_API_KEY="your_brave_api_key"
522
- ```
523
-
524
588
  ### Usage
525
589
 
526
590
  ```bash
527
591
  # The AI will automatically use web search when needed
528
592
  ax-cli
529
593
 
530
- > "Find a React state management library" # Uses npm search
531
- > "Search for axios npm package" # Uses npm search
532
- > "What are the latest TypeScript features?" # Uses Tavily/Brave (if configured)
533
- > "Latest security news" # Uses Brave (if configured)
594
+ > "Find a React state management library" # Uses npm search
595
+ > "Search for axios npm package" # Uses npm search
596
+ > "Find a Python data analysis library" # Uses PyPI search
597
+ > "Search for tokio rust crate" # Uses crates.io search
534
598
  ```
535
599
 
536
600
  ### How It Works
537
601
 
538
- - **Intelligent Routing**: Automatically selects the best search engine based on query type
539
- - **Package queries** → npm search (always available, no API key)
540
- - **Technical queries** → Tavily (if configured) or npm fallback
541
- - **News queries** → Brave (if configured) or npm fallback
542
- - **General queries** → Tavily (if configured) or npm fallback
602
+ - **Intelligent Routing**: Automatically selects the best search engine based on query type and language detection
603
+ - **JavaScript/Node.js packages** → npm registry search (always available, no API key)
604
+ - **Python packages** → PyPI registry search (always available, no API key)
605
+ - **Rust packages** → crates.io registry search (always available, no API key)
606
+ - **General/technical queries** → package search fallback
607
+
608
+ - **Language Detection**: Automatically detects programming language from keywords
609
+ - Python keywords (pip, django, flask, pandas) → PyPI
610
+ - Rust keywords (cargo, crate, tokio, serde) → crates.io
611
+ - npm/package keywords → npm registry
612
+ - Multiple engines may be used in parallel for best results
543
613
 
544
- - **Automatic Caching**: Results cached for 5 minutes to reduce API costs
614
+ - **Automatic Caching**: Results cached for 5 minutes for faster subsequent queries
545
615
 
546
- - **LLM Integration**: The AI decides when to search based on:
547
- - Real-time information needs
548
- - Documentation lookups
549
- - Current events
550
- - Questions beyond training data
616
+ - **LLM Integration**: The AI automatically uses package search for:
617
+ - Package discovery and dependency management
618
+ - Version compatibility checks
619
+ - Alternative package recommendations
620
+ - Package documentation and usage information
551
621
 
552
622
  ### Features
553
623
 
554
- - **Search Depth**: `basic` (faster) or `advanced` (comprehensive)
555
- - **Freshness Filters**: `day`, `week`, `month`, or `year`
556
- - **AI Summaries**: Automatic answer generation from search results
624
+ - **Multi-Registry Package Search**: Search across npm, PyPI, and crates.io simultaneously
625
+ - Package metadata, descriptions, and download statistics
626
+ - Version information and release dates
627
+ - No API keys or setup required
557
628
  - **Source Attribution**: All results include URLs and sources
629
+ - **Parallel Search**: Multiple engines searched concurrently for comprehensive results
558
630
 
559
631
  ### Manual Usage
560
632
 
@@ -562,36 +634,253 @@ While the AI uses web search automatically, you can also request it explicitly:
562
634
 
563
635
  ```bash
564
636
  # In interactive mode
565
- > "search the web for Next.js 14 server actions tutorial"
637
+ > "search npm for a markdown parser library"
638
+ > "search PyPI for a web scraping package"
639
+ > "search crates.io for async runtime"
566
640
 
567
641
  # Headless mode
568
- ax-cli -p "search for latest Node.js LTS security updates"
642
+ ax-cli -p "search for react-query npm package"
643
+ ax-cli -p "find a Python FastAPI alternative"
569
644
  ```
570
645
 
571
- ### Costs (Optional - Free Tier Available)
646
+ ### Web Search Session
647
+
648
+ AX CLI maintains intelligent search context across your conversation, enabling natural follow-up questions and iterative refinement:
572
649
 
573
- Both services offer generous free tiers:
650
+ **Session Continuity:**
651
+ - Package search results are preserved in conversation context
652
+ - Ask follow-up questions about packages without re-searching
653
+ - Reference previous search results naturally
654
+ - Session context includes package URLs, metadata, versions, and download stats
574
655
 
575
- | Service | Free Tier | Paid Tier |
576
- |---------|-----------|-----------|
577
- | Tavily AI | 1,000/month | $120/month (10K searches) |
578
- | Brave Search | 2,000/month | $3/1,000 queries |
579
- | **Combined** | **~3,000/month FREE** | **~$150/month (20K total)** |
656
+ **Example Session:**
580
657
 
581
- **Recommendation**: Start with free tiers (sufficient for most users). Only upgrade if you exceed limits.
658
+ ```bash
659
+ ax-cli
660
+
661
+ # Initial package search
662
+ > "search npm for a state management library"
663
+ 🔍 Searching npm registry...
664
+ Found 5 packages:
665
+
666
+ 1. **zustand** (2.5M weekly downloads)
667
+ Small, fast and scalable state-management
668
+ Latest: v4.4.7 | Size: 1.2KB gzipped
669
+
670
+ 2. **redux** (8.1M weekly downloads)
671
+ Predictable state container for JavaScript apps
672
+ Latest: v5.0.0 | Size: 6.2KB (core only)
673
+
674
+ 3. **mobx** (1.2M weekly downloads)
675
+ Simple, scalable state management
676
+ Latest: v6.12.0 | Size: 16KB
677
+ ...
678
+
679
+ # Natural follow-up (uses cached context from npm search)
680
+ > "which one has the smallest bundle size?"
681
+ Based on the npm search results:
682
+ - ✅ zustand: 1.2KB (gzipped) - Smallest
683
+ - jotai: 2.9KB (gzipped)
684
+ - redux: 6.2KB (core only)
685
+ - mobx: 16KB
686
+
687
+ # Version and compatibility check
688
+ > "what's the latest version of zustand and does it support React 18?"
689
+ Package: zustand v4.4.7 (latest)
690
+ ✅ Full React 18 support with concurrent features
691
+ ✅ TypeScript 5.0+ support
692
+ 📅 Last published: 2 weeks ago
693
+
694
+ # Installation guide
695
+ > "show me how to install and use zustand"
696
+ Installation:
697
+ npm install zustand
698
+
699
+ Basic usage:
700
+ [Provides code example from npm documentation]
701
+ ```
702
+
703
+ **Context-Aware Features:**
704
+
705
+ 1. **Result Caching**: Package search results stay in memory for the session
706
+ - 5-minute cache for identical queries
707
+ - Instant responses for follow-up questions about packages
708
+ - No repeated API calls to registries
709
+
710
+ 2. **Multi-Turn Package Refinement**:
711
+ ```bash
712
+ > "search npm for a react table library"
713
+ Found: tanstack-table, react-table, ag-grid-react, mui-x-data-grid
714
+
715
+ > "which ones have TypeScript support?"
716
+ All 4 packages support TypeScript:
717
+ - @tanstack/react-table: Full TS rewrite
718
+ - react-table (deprecated, use @tanstack)
719
+ - ag-grid-react: TypeScript included
720
+ - @mui/x-data-grid: Full TS support
721
+
722
+ > "which has the best documentation?"
723
+ Based on npm stats and GitHub stars:
724
+ - @tanstack/react-table: Excellent docs, 24K stars
725
+
726
+ > "install that one"
727
+ npm install @tanstack/react-table
728
+ ```
729
+
730
+ 3. **Cross-Registry Context**:
731
+ ```bash
732
+ > "search for data validation libraries"
733
+ Searching npm, PyPI, and crates.io...
734
+
735
+ npm: zod, yup, joi, ajv
736
+ PyPI: pydantic, marshmallow, cerberus
737
+ crates.io: serde, validator
738
+
739
+ > "compare the JavaScript and Python options"
740
+ **JavaScript (npm):**
741
+ - zod: 3.5M/week, TypeScript-first, 30KB
742
+ - yup: 5.2M/week, Schema builder, 45KB
743
+
744
+ **Python (PyPI):**
745
+ - pydantic: 50M/month, Type hints, fast
746
+ - marshmallow: 8M/month, Schema validation
747
+
748
+ > "which is fastest?"
749
+ - JavaScript: zod (TypeScript inference, zero-cost)
750
+ - Python: pydantic (uses Rust core, 20x faster than marshmallow)
751
+ ```
752
+
753
+ 4. **Package Comparison Tables**:
754
+ ```bash
755
+ > "search npm for http client libraries"
756
+ Found: axios, node-fetch, got, ky, superagent
757
+
758
+ > "create a comparison table"
759
+
760
+ | Package | Weekly DLs | Size | Last Update | Browser | Node |
761
+ |-------------|------------|---------|-------------|---------|------|
762
+ | axios | 48M | 11.5KB | 2 weeks ago | ✅ | ✅ |
763
+ | node-fetch | 35M | 4.5KB | 3 months | ❌ | ✅ |
764
+ | got | 23M | 15KB | 1 week ago | ❌ | ✅ |
765
+ | ky | 1.2M | 12KB | 2 weeks ago | ✅ | ✅ |
766
+
767
+ > "which is best for Node.js backend with retry logic?"
768
+ Recommendation: **got**
769
+ - Built-in retry with exponential backoff
770
+ - HTTP/2 support
771
+ - Request cancellation
772
+ - Promise & stream support
773
+ ```
774
+
775
+ **Session Management:**
776
+
777
+ - **Session Duration**: Active for entire interactive session
778
+ - **History Integration**: Search results included in `--continue` sessions
779
+ - **Memory Commands**:
780
+ ```bash
781
+ /clear # Clears search context and conversation
782
+ /exit # Ends session (context lost)
783
+ ```
784
+ - **Persistent Context**: Use with `--continue` to maintain search context across sessions
785
+
786
+ **Best Practices:**
787
+
788
+ 1. **Start Broad, Refine Iteratively**:
789
+ ```bash
790
+ > "search npm for testing libraries"
791
+ Found: jest, vitest, mocha, jasmine, playwright, cypress
792
+
793
+ > "focus on those for integration testing"
794
+ Integration testing: playwright, cypress, vitest (has browser mode)
795
+
796
+ > "which has TypeScript support?"
797
+ All 3 have TypeScript:
798
+ - playwright: Native TS
799
+ - cypress: Full TS support
800
+ - vitest: Native TS (Vite-powered)
801
+
802
+ > "show setup for playwright"
803
+ npm install -D @playwright/test
804
+ [Provides example config and test]
805
+ ```
806
+
807
+ 2. **Leverage Context for Framework Comparisons**:
808
+ ```bash
809
+ > "search npm for react vue svelte packages"
810
+ Found core packages with download stats:
811
+ - react: 22M/week
812
+ - vue: 5.1M/week
813
+ - svelte: 850K/week
814
+
815
+ > "compare their package ecosystems"
816
+ **React:** 180K+ packages
817
+ **Vue:** 45K+ packages
818
+ **Svelte:** 8K+ packages
819
+
820
+ > "which has better TypeScript support?"
821
+ All have excellent TS support:
822
+ - React: @types/react (20M/week)
823
+ - Vue: Built-in TS (Vue 3+)
824
+ - Svelte: svelte-check + TypeScript plugin
825
+ ```
826
+
827
+ 3. **Version Compatibility Checks**:
828
+ ```bash
829
+ > "search npm for next auth package"
830
+ Found: next-auth (8M/week, v4.24.5)
831
+
832
+ > "does it work with Next.js 15?"
833
+ ⚠️ Compatibility:
834
+ - next-auth v4: Next.js 12-14
835
+ - For Next.js 15: Use NextAuth.js v5 (beta)
836
+
837
+ > "show me the v5 package"
838
+ Package: next-auth@beta (v5.0.0-beta.4)
839
+ ✅ Next.js 15 compatible
840
+ [Installation and migration guide]
841
+ ```
842
+
843
+ 4. **Combine Search with Development Tasks**:
844
+ ```bash
845
+ > "search npm for a markdown parser library"
846
+ Found: marked, remark, markdown-it, showdown
847
+
848
+ > "which is fastest and most secure?"
849
+ Recommendation: **marked**
850
+ - 13M/week downloads
851
+ - Fast (built-in sanitization)
852
+ - Active maintenance
853
+
854
+ > "install marked and show me basic usage"
855
+ Installing: npm install marked
856
+ [Generates code example with marked usage]
857
+
858
+ > "add it to my project"
859
+ [Creates/updates relevant files with implementation]
860
+ ```
861
+
862
+ **Performance Tips:**
863
+
864
+ - **First search**: 1-3 seconds (registry API call)
865
+ - **Follow-up questions**: Instant (uses cached package data)
866
+ - **Cache duration**: 5 minutes per query
867
+ - **Parallel searches**: Multiple registries searched concurrently for cross-language queries
868
+ - **Offline work**: Use `--continue` to preserve search context across sessions
582
869
 
583
870
  ### Troubleshooting
584
871
 
585
- **"No search engines configured"**
586
- - Set at least one API key (TAVILY_API_KEY or BRAVE_API_KEY)
872
+ **No results found**
873
+ - Package registries (npm, PyPI, crates.io) are always available
874
+ - Try refining your search query
875
+ - Check your internet connection
587
876
 
588
877
  **Rate limit errors**
589
- - Check your usage at provider dashboards
878
+ - Package registry searches are rate-limited by the registry providers
590
879
  - Results are cached to minimize API calls
591
880
 
592
881
  **Slow searches**
593
- - Use `basic` search depth (default)
594
- - Results are cached after first search
882
+ - Results are cached after first search (5 minute TTL)
883
+ - Subsequent identical queries will be instant
595
884
 
596
885
  ## 🔌 MCP (Model Context Protocol)
597
886
 
@@ -610,7 +899,7 @@ ax-cli mcp remove linear
610
899
 
611
900
  [MCP Integration Guide →](docs/mcp.md)
612
901
 
613
- ## 🧠 Project Memory (NEW)
902
+ ## 🧠 Project Memory
614
903
 
615
904
  Project Memory enables intelligent context caching for z.ai GLM-4.6, reducing token costs and improving response consistency:
616
905
 
@@ -729,8 +1018,9 @@ AX CLI implements enterprise-grade architecture with:
729
1018
 
730
1019
  - **Single Source of Truth (SSOT)** type system via `@ax-cli/schemas`
731
1020
  - **TypeScript strict mode** with Zod runtime validation
732
- - **98%+ test coverage** (562 tests)
1021
+ - **98%+ test coverage** (1381 tests passing)
733
1022
  - **Modular design** with clean separation of concerns
1023
+ - **Enterprise security** with AES-256-GCM encryption for sensitive data
734
1024
 
735
1025
  [Architecture Documentation →](docs/architecture.md)
736
1026
 
@@ -749,6 +1039,61 @@ AX CLI implements enterprise-grade architecture with:
749
1039
 
750
1040
  ## 📋 Changelog
751
1041
 
1042
+ ### v3.6.1 (2025-11-22)
1043
+
1044
+ **🔧 Improvements:**
1045
+ - **Web Search Simplification**: Removed Tavily AI dependency, focusing entirely on package registries
1046
+ - Streamlined to npm, PyPI, and crates.io package search only
1047
+ - No API keys required for web search functionality
1048
+ - Reduced dependencies and simplified architecture
1049
+ - **Documentation Overhaul**: Completely updated web search documentation
1050
+ - 200+ lines updated with package-focused examples
1051
+ - 15+ new realistic examples showing npm, PyPI, and crates.io workflows
1052
+ - Comprehensive session examples for package discovery and comparison
1053
+ - Best practices for cross-registry searches and version compatibility checks
1054
+ - **Smart Paste Auto-Collapse**: Intelligent handling of large text inputs
1055
+ - Automatic collapse of 20+ line pastes for better readability
1056
+ - Press Ctrl+P to expand/collapse pasted content
1057
+ - Configurable threshold in `~/.ax-cli/config.json`
1058
+ - Full content still sent to AI (not just the placeholder)
1059
+
1060
+ **✅ Quality:**
1061
+ - All 1,381 tests passing with 98.29% coverage
1062
+ - Zero breaking changes
1063
+ - Cleaner codebase with reduced complexity
1064
+
1065
+ ### v3.6.0 (2025-11-22)
1066
+
1067
+ **🔒 Enterprise-Grade Security (FREE & Open Source):**
1068
+ - **API Key Encryption**: AES-256-GCM encryption for API keys at rest
1069
+ - **Command Injection Protection**: CVSS 9.8 CRITICAL fix with command whitelisting
1070
+ - **Path Traversal Hardening**: CVSS 8.6 HIGH fix preventing unauthorized file access
1071
+ - **SSRF Attack Prevention**: CVSS 7.5 HIGH fix for MCP transport URL validation
1072
+ - **Input Sanitization**: CVSS 7.0 HIGH fix for comprehensive input validation
1073
+ - **Error Sanitization**: CVSS 6.5 MEDIUM fix preventing credential leakage
1074
+ - **Security Audit Logging**: Basic JSON logging with 30-day retention
1075
+ - **Rate Limiting**: Token bucket algorithm to prevent API abuse
1076
+ - **Memory Leak Fixes**: Process pool management for long-running operations
1077
+
1078
+ **✅ Test Quality:**
1079
+ - **1381+ tests passing** (up from 1,038) with 98.29% coverage
1080
+ - All security modules fully tested and validated
1081
+ - Production-ready security implementation
1082
+
1083
+ **🏢 Enterprise Features (Available):**
1084
+ - Advanced audit logging with compliance reports (SOC2, HIPAA, PCI-DSS)
1085
+ - Team collaboration with shared chat history
1086
+ - Policy enforcement and approval workflows
1087
+ - Extended audit log retention (1+ years)
1088
+ - SSO/SAML integration support
1089
+ - Priority 24-hour SLA support
1090
+ - Contact sales@defai.digital for enterprise licensing
1091
+
1092
+ **🔧 Configuration Improvements:**
1093
+ - New `ax-cli setup` wizard for secure API key configuration
1094
+ - Automatic migration of plain-text API keys to encrypted format
1095
+ - Environment variable override support for CI/CD workflows
1096
+
752
1097
  ### v3.5.3 (2025-11-22)
753
1098
 
754
1099
  **Bug Fixes - Test Quality & Reliability:**
@@ -790,7 +1135,7 @@ AX CLI implements enterprise-grade architecture with:
790
1135
  - Multi-phase task planner with automatic complexity detection
791
1136
  - Enhanced MCP integration with production-ready templates
792
1137
  - Project memory system with intelligent context caching
793
- - Web search capabilities with Tavily AI and Brave Search
1138
+ - Web search capabilities with npm, PyPI, and crates.io package registries
794
1139
  - Advanced code analysis tools (dependency, security, metrics)
795
1140
 
796
1141
  ## 📄 License
@@ -804,5 +1149,5 @@ Built with **AutomatosX** multi-agent orchestration to achieve enterprise-class
804
1149
  ---
805
1150
 
806
1151
  <p align="center">
807
- Made with ❤️ by <a href="https://github.com/defai-digital">DefAI Digital</a>
1152
+ Made with ❤️ by <a href="https://github.com/defai-digital">DEFAI Digital</a>
808
1153
  </p>