sage-ai-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. sage_ai_cli-0.1.0/LICENSE +21 -0
  2. sage_ai_cli-0.1.0/PKG-INFO +214 -0
  3. sage_ai_cli-0.1.0/README.md +185 -0
  4. sage_ai_cli-0.1.0/pyproject.toml +50 -0
  5. sage_ai_cli-0.1.0/setup.cfg +4 -0
  6. sage_ai_cli-0.1.0/src/sage_ai_cli.egg-info/PKG-INFO +214 -0
  7. sage_ai_cli-0.1.0/src/sage_ai_cli.egg-info/SOURCES.txt +54 -0
  8. sage_ai_cli-0.1.0/src/sage_ai_cli.egg-info/dependency_links.txt +1 -0
  9. sage_ai_cli-0.1.0/src/sage_ai_cli.egg-info/entry_points.txt +3 -0
  10. sage_ai_cli-0.1.0/src/sage_ai_cli.egg-info/requires.txt +7 -0
  11. sage_ai_cli-0.1.0/src/sage_ai_cli.egg-info/top_level.txt +1 -0
  12. sage_ai_cli-0.1.0/src/sagecli/__init__.py +7 -0
  13. sage_ai_cli-0.1.0/src/sagecli/__main__.py +6 -0
  14. sage_ai_cli-0.1.0/src/sagecli/cli.py +506 -0
  15. sage_ai_cli-0.1.0/src/sagecli/config.py +261 -0
  16. sage_ai_cli-0.1.0/src/sagecli/core/__init__.py +15 -0
  17. sage_ai_cli-0.1.0/src/sagecli/core/agent.py +212 -0
  18. sage_ai_cli-0.1.0/src/sagecli/core/context.py +105 -0
  19. sage_ai_cli-0.1.0/src/sagecli/core/doctor.py +120 -0
  20. sage_ai_cli-0.1.0/src/sagecli/core/orchestrator.py +40 -0
  21. sage_ai_cli-0.1.0/src/sagecli/core/state.py +85 -0
  22. sage_ai_cli-0.1.0/src/sagecli/core/tracker.py +73 -0
  23. sage_ai_cli-0.1.0/src/sagecli/llm/__init__.py +18 -0
  24. sage_ai_cli-0.1.0/src/sagecli/llm/anthropic_provider.py +238 -0
  25. sage_ai_cli-0.1.0/src/sagecli/llm/base.py +84 -0
  26. sage_ai_cli-0.1.0/src/sagecli/llm/factory.py +62 -0
  27. sage_ai_cli-0.1.0/src/sagecli/llm/gemini_provider.py +271 -0
  28. sage_ai_cli-0.1.0/src/sagecli/llm/openai_provider.py +216 -0
  29. sage_ai_cli-0.1.0/src/sagecli/security.py +90 -0
  30. sage_ai_cli-0.1.0/src/sagecli/tools/__init__.py +26 -0
  31. sage_ai_cli-0.1.0/src/sagecli/tools/base.py +45 -0
  32. sage_ai_cli-0.1.0/src/sagecli/tools/dataset_ops.py +139 -0
  33. sage_ai_cli-0.1.0/src/sagecli/tools/file_ops.py +175 -0
  34. sage_ai_cli-0.1.0/src/sagecli/tools/git_ops.py +98 -0
  35. sage_ai_cli-0.1.0/src/sagecli/tools/registry.py +102 -0
  36. sage_ai_cli-0.1.0/src/sagecli/tools/shell_ops.py +72 -0
  37. sage_ai_cli-0.1.0/src/sagecli/tools/test_eval_ops.py +65 -0
  38. sage_ai_cli-0.1.0/src/sagecli/ui/__init__.py +65 -0
  39. sage_ai_cli-0.1.0/src/sagecli/ui/banner.py +328 -0
  40. sage_ai_cli-0.1.0/src/sagecli/ui/console.py +179 -0
  41. sage_ai_cli-0.1.0/src/sagecli/ui/logo.py +142 -0
  42. sage_ai_cli-0.1.0/src/sagecli/ui/prompts.py +172 -0
  43. sage_ai_cli-0.1.0/src/sagecli/ui/symbols.py +100 -0
  44. sage_ai_cli-0.1.0/src/sagecli/ui/theme.py +103 -0
  45. sage_ai_cli-0.1.0/src/sagecli/wizard.py +154 -0
  46. sage_ai_cli-0.1.0/tests/test_agent.py +159 -0
  47. sage_ai_cli-0.1.0/tests/test_banner.py +109 -0
  48. sage_ai_cli-0.1.0/tests/test_cli.py +53 -0
  49. sage_ai_cli-0.1.0/tests/test_console.py +81 -0
  50. sage_ai_cli-0.1.0/tests/test_llm.py +54 -0
  51. sage_ai_cli-0.1.0/tests/test_logo.py +91 -0
  52. sage_ai_cli-0.1.0/tests/test_security.py +61 -0
  53. sage_ai_cli-0.1.0/tests/test_slash_commands.py +58 -0
  54. sage_ai_cli-0.1.0/tests/test_symbols.py +46 -0
  55. sage_ai_cli-0.1.0/tests/test_theme.py +32 -0
  56. sage_ai_cli-0.1.0/tests/test_tools.py +100 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zaheer JK Labs
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.
@@ -0,0 +1,214 @@
1
+ Metadata-Version: 2.4
2
+ Name: sage-ai-cli
3
+ Version: 0.1.0
4
+ Summary: SageCLI - AI Engineering Agent for Machine Learning & Deep Learning
5
+ Author-email: zaheerjklabs <zaheerjklabs@gmail.com>
6
+ License: MIT
7
+ Keywords: ai,cli,machine-learning,deep-learning,agent,engineering
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: rich>=13.0.0
23
+ Requires-Dist: typer>=0.9.0
24
+ Requires-Dist: prompt-toolkit>=3.0.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # SageCLI
31
+
32
+ ```text
33
+ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
34
+ โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•
35
+ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
36
+ โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ•โ•โ•
37
+ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
38
+ โ•šโ•โ•โ•โ•โ•โ•โ• โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•
39
+
40
+ S A G E C L I
41
+ AI ENGINEERING AGENT
42
+ ```
43
+
44
+ > **Build โ€ข Train โ€ข Debug โ€ข Evaluate โ€ข Deploy**
45
+
46
+ SageCLI is a terminal-native autonomous AI coding agent designed specifically for **Machine Learning, Deep Learning, and AI Engineering**. Running directly inside your terminal, SageCLI autonomously inspects repositories and datasets, plans modular architectures, writes and executes code, runs tests, self-debugs tracebacks, computes metrics, and sets up inference endpoints.
47
+
48
+ ---
49
+
50
+ ## ๐Ÿš€ Autonomous Agent Workflow
51
+
52
+ ```text
53
+ User Prompt
54
+ โ†“
55
+ Context / Repository & Dataset Ingestion
56
+ โ†“
57
+ Planning & Architecture Phase
58
+ โ†“
59
+ Code Generation (PyTorch, Scikit-Learn, LightGBM, FastAPI)
60
+ โ†“
61
+ Execution & Pipeline Run
62
+ โ†“
63
+ Automated Testing & Autonomous Traceback Debugging
64
+ โ†“
65
+ Model Evaluation & Metric Tracking
66
+ โ†“
67
+ Documentation & Git Checkpoints
68
+ ```
69
+
70
+ ---
71
+
72
+ ## ๐Ÿ› ๏ธ Key Capabilities
73
+
74
+ * **First-Run Interactive Setup Wizard (`sage setup`)**: Multi-provider auto-detection, masked credential entry, model selection, mode choice, and live connection verification.
75
+ * **Provider-Agnostic Engine**: Native tool-calling support for:
76
+ * **Google Gemini** (`gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.0-flash`)
77
+ * **OpenAI** (`gpt-4o`, `gpt-4o-mini`, `o3-mini`, `o1`)
78
+ * **Anthropic Claude** (`claude-3-7-sonnet`, `claude-3-5-sonnet`, `claude-3-5-haiku`)
79
+ * **Groq** (`llama-3.3-70b-versatile`, `deepseek-r1-distill-llama-70b`)
80
+ * **OpenRouter** (`deepseek/deepseek-r1`, etc.)
81
+ * **Ollama (Local)** (`llama3.2`, `deepseek-r1`, `qwen2.5-coder`)
82
+ * **Custom OpenAI-compatible endpoints** (vLLM, LocalAI, LM Studio)
83
+ * **ML/DL Engineering Tool Suite**:
84
+ * `inspect_dataset`: Deep EDA on CSV, Parquet, JSON, NumPy, Excel files (shapes, missing values, statistics, class distribution).
85
+ * `read_file` / `write_file` / `patch_file` / `list_directory`: Surgical and sandboxed workspace file operations.
86
+ * `execute_command`: Shell command and Python script execution with timeouts and security checks.
87
+ * `run_tests`: Pytest runner with failure analysis and traceback extraction.
88
+ * `git_checkpoint` / `git_diff` / `git_rollback`: Version control safety and rollback support.
89
+ * **Self-Healing & Autonomous Debugging**: When scripts fail with errors (e.g., shape mismatches, missing modules, runtime exceptions), SageCLI intercepts the stderr/stack trace, diagnoses the cause, patches the code, and re-executes until verified.
90
+ * **Execution Modes**:
91
+ * `Safe` (Default) โ€” Requests user approval before running write or shell operations.
92
+ * `Auto` โ€” Autonomously executes safe workspace steps, prompting only for destructive actions.
93
+ * `Plan` โ€” Generates comprehensive plans and diffs without modifying files on disk.
94
+ * **State & Memory Management**: Persists conversation history, task memory, dataset metadata, and ML experiment metrics in `.sage/` (automatically added to `.gitignore`).
95
+
96
+ ---
97
+
98
+ ## ๐Ÿ“ฆ Installation
99
+
100
+ ### From PyPI
101
+ ```bash
102
+ pip install sage-ai-cli
103
+ ```
104
+
105
+ ### From Source (Development)
106
+ ```bash
107
+ # Clone the repository
108
+ git clone https://github.com/zaheerjklabs/SageCLI.git
109
+ cd SageCLI
110
+
111
+ # Install in editable mode
112
+ pip install -e .
113
+ ```
114
+
115
+ ---
116
+
117
+ ## โšก Quickstart
118
+
119
+ ### 1. Launch SageCLI
120
+ ```bash
121
+ sage
122
+ ```
123
+ On first launch, the interactive setup wizard will guide you through provider selection and credential validation.
124
+
125
+ ### 2. Interactive Engineering Prompt
126
+ ```text
127
+ sage โฏ Build a customer churn prediction system using data/raw/customers.csv with XGBoost and a FastAPI endpoint.
128
+ ```
129
+
130
+ SageCLI will:
131
+ 1. ๐Ÿ” **Inspect** `data/raw/customers.csv` and report feature distributions.
132
+ 2. ๐Ÿ“ **Plan** modular components (`src/data.py`, `src/model.py`, `src/train.py`, `src/app.py`).
133
+ 3. ๐Ÿ’ป **Implement** clean preprocessing, feature engineering, and model training.
134
+ 4. โšก **Execute** the pipeline and self-debug any runtime errors.
135
+ 5. ๐Ÿ“Š **Evaluate** ROC-AUC, Precision/Recall, and log metrics.
136
+ 6. ๐Ÿš€ **Deliver** test suites and a FastAPI inference service.
137
+
138
+ ---
139
+
140
+ ## ๐ŸŽฎ Interactive Slash Commands (`/`)
141
+
142
+ SageCLI provides an intuitive, Claude Code-inspired command palette with autocompletion and instant dropdown help:
143
+
144
+ | Command | Action | Description |
145
+ | :--- | :--- | :--- |
146
+ | `/help` | Detailed help manual | View all commands, shortcuts, and capabilities |
147
+ | `/setup` | Setup wizard | Interactive multi-provider and API key configuration |
148
+ | `/config` | View/edit settings | Show active configuration or update with `/config set <key> <val>` |
149
+ | `/mode <safe\|auto\|plan>` | Switch execution mode | `Safe` (confirm writes), `Auto` (full autonomous), `Plan` (read-only) |
150
+ | `/model [name]` | Switch LLM model | Switch model or view recommended options |
151
+ | `/provider [name]` | Switch AI provider | `gemini`, `openai`, `anthropic`, `groq`, `openrouter`, `ollama` |
152
+ | `/doctor` | Environment diagnostics | Inspect Python, GPU/CUDA, Git repo, disk space, and API latency |
153
+ | `/cost` / `/usage` | Token & cost tracking | Display session token usage and estimated USD cost breakdown |
154
+ | `/context` | Workspace summary | Review detected directory tree, datasets, and ML stack |
155
+ | `/memory` | Session task memory | Display or reset active task history and persistent state |
156
+ | `/dataset <path>` | EDA & Data Profiling | Analyze dataset shape, missing values, statistics, and distributions |
157
+ | `/diff` | Git diff | View uncommitted code modifications |
158
+ | `/checkpoint <msg>` | Git checkpoint | Create an immediate snapshot commit |
159
+ | `/rollback` | Git rollback | Revert workspace changes safely |
160
+ | `/compact` | Memory compaction | Compact session history to save token context window |
161
+ | `/ascii` | Toggle ASCII mode | Switch between Unicode and pure ASCII terminal glyphs |
162
+ | `/demo` | Status language demo | Preview SageCLI's branded status symbols and styling |
163
+ | `/clear` | Clear screen | Clear terminal view while preserving session state |
164
+ | `/exit` / `/quit` | Exit | Exit SageCLI session |
165
+
166
+ ---
167
+
168
+ ## ๐Ÿ—๏ธ Architecture
169
+
170
+ ```text
171
+ src/sagecli/
172
+ โ”œโ”€โ”€ __init__.py # Package version and brand definitions
173
+ โ”œโ”€โ”€ __main__.py # python -m sagecli entry point
174
+ โ”œโ”€โ”€ cli.py # Typer application, CLI flags, and interactive REPL
175
+ โ”œโ”€โ”€ config.py # Multi-provider hierarchical configuration
176
+ โ”œโ”€โ”€ security.py # Secret masking, sandboxing, and safety checks
177
+ โ”œโ”€โ”€ wizard.py # First-run interactive setup wizard
178
+ โ”œโ”€โ”€ core/
179
+ โ”‚ โ”œโ”€โ”€ agent.py # Autonomous agent execution loop
180
+ โ”‚ โ”œโ”€โ”€ state.py # Project memory, task history, and metrics in .sage/
181
+ โ”‚ โ”œโ”€โ”€ context.py # Workspace scanner, dataset detector, and environment specs
182
+ โ”‚ โ””โ”€โ”€ orchestrator.py # Multi-role prompt engineering for ML/DL pipelines
183
+ โ”œโ”€โ”€ llm/
184
+ โ”‚ โ”œโ”€โ”€ base.py # Provider interface and message models
185
+ โ”‚ โ”œโ”€โ”€ factory.py # Dynamic provider factory
186
+ โ”‚ โ”œโ”€โ”€ gemini_provider.py# Google Gemini provider
187
+ โ”‚ โ”œโ”€โ”€ openai_provider.py# OpenAI / Groq / OpenRouter / Ollama provider
188
+ โ”‚ โ””โ”€โ”€ anthropic_provider.py # Anthropic Claude provider
189
+ โ”œโ”€โ”€ tools/
190
+ โ”‚ โ”œโ”€โ”€ base.py # Tool base class and schemas
191
+ โ”‚ โ”œโ”€โ”€ registry.py # Tool registry and permission dispatcher
192
+ โ”‚ โ”œโ”€โ”€ file_ops.py # Read, write, patch, list files
193
+ โ”‚ โ”œโ”€โ”€ shell_ops.py # Terminal command and script execution
194
+ โ”‚ โ”œโ”€โ”€ dataset_ops.py # Exploratory data analysis & schema inspection
195
+ โ”‚ โ”œโ”€โ”€ test_eval_ops.py # Pytest execution and failure parser
196
+ โ”‚ โ””โ”€โ”€ git_ops.py # Git checkpoints, diffs, and rollbacks
197
+ โ””โ”€โ”€ ui/
198
+ โ”œโ”€โ”€ banner.py # Startup banner, splash, metadata table
199
+ โ”œโ”€โ”€ console.py # Branded visual language formatters
200
+ โ”œโ”€โ”€ logo.py # ASCII logo and responsive renderers
201
+ โ”œโ”€โ”€ prompts.py # Interactive prompt_toolkit session
202
+ โ”œโ”€โ”€ symbols.py # Unicode & ASCII symbols
203
+ โ””โ”€โ”€ theme.py # SageCLI palette and Rich styles
204
+ ```
205
+
206
+ ---
207
+
208
+ ## ๐Ÿงช Testing
209
+
210
+ Run the full automated test suite with:
211
+
212
+ ```bash
213
+ python3 -m pytest -v
214
+ ```
@@ -0,0 +1,185 @@
1
+ # SageCLI
2
+
3
+ ```text
4
+ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
5
+ โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•
6
+ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
7
+ โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ•โ•โ•
8
+ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
9
+ โ•šโ•โ•โ•โ•โ•โ•โ• โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•
10
+
11
+ S A G E C L I
12
+ AI ENGINEERING AGENT
13
+ ```
14
+
15
+ > **Build โ€ข Train โ€ข Debug โ€ข Evaluate โ€ข Deploy**
16
+
17
+ SageCLI is a terminal-native autonomous AI coding agent designed specifically for **Machine Learning, Deep Learning, and AI Engineering**. Running directly inside your terminal, SageCLI autonomously inspects repositories and datasets, plans modular architectures, writes and executes code, runs tests, self-debugs tracebacks, computes metrics, and sets up inference endpoints.
18
+
19
+ ---
20
+
21
+ ## ๐Ÿš€ Autonomous Agent Workflow
22
+
23
+ ```text
24
+ User Prompt
25
+ โ†“
26
+ Context / Repository & Dataset Ingestion
27
+ โ†“
28
+ Planning & Architecture Phase
29
+ โ†“
30
+ Code Generation (PyTorch, Scikit-Learn, LightGBM, FastAPI)
31
+ โ†“
32
+ Execution & Pipeline Run
33
+ โ†“
34
+ Automated Testing & Autonomous Traceback Debugging
35
+ โ†“
36
+ Model Evaluation & Metric Tracking
37
+ โ†“
38
+ Documentation & Git Checkpoints
39
+ ```
40
+
41
+ ---
42
+
43
+ ## ๐Ÿ› ๏ธ Key Capabilities
44
+
45
+ * **First-Run Interactive Setup Wizard (`sage setup`)**: Multi-provider auto-detection, masked credential entry, model selection, mode choice, and live connection verification.
46
+ * **Provider-Agnostic Engine**: Native tool-calling support for:
47
+ * **Google Gemini** (`gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.0-flash`)
48
+ * **OpenAI** (`gpt-4o`, `gpt-4o-mini`, `o3-mini`, `o1`)
49
+ * **Anthropic Claude** (`claude-3-7-sonnet`, `claude-3-5-sonnet`, `claude-3-5-haiku`)
50
+ * **Groq** (`llama-3.3-70b-versatile`, `deepseek-r1-distill-llama-70b`)
51
+ * **OpenRouter** (`deepseek/deepseek-r1`, etc.)
52
+ * **Ollama (Local)** (`llama3.2`, `deepseek-r1`, `qwen2.5-coder`)
53
+ * **Custom OpenAI-compatible endpoints** (vLLM, LocalAI, LM Studio)
54
+ * **ML/DL Engineering Tool Suite**:
55
+ * `inspect_dataset`: Deep EDA on CSV, Parquet, JSON, NumPy, Excel files (shapes, missing values, statistics, class distribution).
56
+ * `read_file` / `write_file` / `patch_file` / `list_directory`: Surgical and sandboxed workspace file operations.
57
+ * `execute_command`: Shell command and Python script execution with timeouts and security checks.
58
+ * `run_tests`: Pytest runner with failure analysis and traceback extraction.
59
+ * `git_checkpoint` / `git_diff` / `git_rollback`: Version control safety and rollback support.
60
+ * **Self-Healing & Autonomous Debugging**: When scripts fail with errors (e.g., shape mismatches, missing modules, runtime exceptions), SageCLI intercepts the stderr/stack trace, diagnoses the cause, patches the code, and re-executes until verified.
61
+ * **Execution Modes**:
62
+ * `Safe` (Default) โ€” Requests user approval before running write or shell operations.
63
+ * `Auto` โ€” Autonomously executes safe workspace steps, prompting only for destructive actions.
64
+ * `Plan` โ€” Generates comprehensive plans and diffs without modifying files on disk.
65
+ * **State & Memory Management**: Persists conversation history, task memory, dataset metadata, and ML experiment metrics in `.sage/` (automatically added to `.gitignore`).
66
+
67
+ ---
68
+
69
+ ## ๐Ÿ“ฆ Installation
70
+
71
+ ### From PyPI
72
+ ```bash
73
+ pip install sage-ai-cli
74
+ ```
75
+
76
+ ### From Source (Development)
77
+ ```bash
78
+ # Clone the repository
79
+ git clone https://github.com/zaheerjklabs/SageCLI.git
80
+ cd SageCLI
81
+
82
+ # Install in editable mode
83
+ pip install -e .
84
+ ```
85
+
86
+ ---
87
+
88
+ ## โšก Quickstart
89
+
90
+ ### 1. Launch SageCLI
91
+ ```bash
92
+ sage
93
+ ```
94
+ On first launch, the interactive setup wizard will guide you through provider selection and credential validation.
95
+
96
+ ### 2. Interactive Engineering Prompt
97
+ ```text
98
+ sage โฏ Build a customer churn prediction system using data/raw/customers.csv with XGBoost and a FastAPI endpoint.
99
+ ```
100
+
101
+ SageCLI will:
102
+ 1. ๐Ÿ” **Inspect** `data/raw/customers.csv` and report feature distributions.
103
+ 2. ๐Ÿ“ **Plan** modular components (`src/data.py`, `src/model.py`, `src/train.py`, `src/app.py`).
104
+ 3. ๐Ÿ’ป **Implement** clean preprocessing, feature engineering, and model training.
105
+ 4. โšก **Execute** the pipeline and self-debug any runtime errors.
106
+ 5. ๐Ÿ“Š **Evaluate** ROC-AUC, Precision/Recall, and log metrics.
107
+ 6. ๐Ÿš€ **Deliver** test suites and a FastAPI inference service.
108
+
109
+ ---
110
+
111
+ ## ๐ŸŽฎ Interactive Slash Commands (`/`)
112
+
113
+ SageCLI provides an intuitive, Claude Code-inspired command palette with autocompletion and instant dropdown help:
114
+
115
+ | Command | Action | Description |
116
+ | :--- | :--- | :--- |
117
+ | `/help` | Detailed help manual | View all commands, shortcuts, and capabilities |
118
+ | `/setup` | Setup wizard | Interactive multi-provider and API key configuration |
119
+ | `/config` | View/edit settings | Show active configuration or update with `/config set <key> <val>` |
120
+ | `/mode <safe\|auto\|plan>` | Switch execution mode | `Safe` (confirm writes), `Auto` (full autonomous), `Plan` (read-only) |
121
+ | `/model [name]` | Switch LLM model | Switch model or view recommended options |
122
+ | `/provider [name]` | Switch AI provider | `gemini`, `openai`, `anthropic`, `groq`, `openrouter`, `ollama` |
123
+ | `/doctor` | Environment diagnostics | Inspect Python, GPU/CUDA, Git repo, disk space, and API latency |
124
+ | `/cost` / `/usage` | Token & cost tracking | Display session token usage and estimated USD cost breakdown |
125
+ | `/context` | Workspace summary | Review detected directory tree, datasets, and ML stack |
126
+ | `/memory` | Session task memory | Display or reset active task history and persistent state |
127
+ | `/dataset <path>` | EDA & Data Profiling | Analyze dataset shape, missing values, statistics, and distributions |
128
+ | `/diff` | Git diff | View uncommitted code modifications |
129
+ | `/checkpoint <msg>` | Git checkpoint | Create an immediate snapshot commit |
130
+ | `/rollback` | Git rollback | Revert workspace changes safely |
131
+ | `/compact` | Memory compaction | Compact session history to save token context window |
132
+ | `/ascii` | Toggle ASCII mode | Switch between Unicode and pure ASCII terminal glyphs |
133
+ | `/demo` | Status language demo | Preview SageCLI's branded status symbols and styling |
134
+ | `/clear` | Clear screen | Clear terminal view while preserving session state |
135
+ | `/exit` / `/quit` | Exit | Exit SageCLI session |
136
+
137
+ ---
138
+
139
+ ## ๐Ÿ—๏ธ Architecture
140
+
141
+ ```text
142
+ src/sagecli/
143
+ โ”œโ”€โ”€ __init__.py # Package version and brand definitions
144
+ โ”œโ”€โ”€ __main__.py # python -m sagecli entry point
145
+ โ”œโ”€โ”€ cli.py # Typer application, CLI flags, and interactive REPL
146
+ โ”œโ”€โ”€ config.py # Multi-provider hierarchical configuration
147
+ โ”œโ”€โ”€ security.py # Secret masking, sandboxing, and safety checks
148
+ โ”œโ”€โ”€ wizard.py # First-run interactive setup wizard
149
+ โ”œโ”€โ”€ core/
150
+ โ”‚ โ”œโ”€โ”€ agent.py # Autonomous agent execution loop
151
+ โ”‚ โ”œโ”€โ”€ state.py # Project memory, task history, and metrics in .sage/
152
+ โ”‚ โ”œโ”€โ”€ context.py # Workspace scanner, dataset detector, and environment specs
153
+ โ”‚ โ””โ”€โ”€ orchestrator.py # Multi-role prompt engineering for ML/DL pipelines
154
+ โ”œโ”€โ”€ llm/
155
+ โ”‚ โ”œโ”€โ”€ base.py # Provider interface and message models
156
+ โ”‚ โ”œโ”€โ”€ factory.py # Dynamic provider factory
157
+ โ”‚ โ”œโ”€โ”€ gemini_provider.py# Google Gemini provider
158
+ โ”‚ โ”œโ”€โ”€ openai_provider.py# OpenAI / Groq / OpenRouter / Ollama provider
159
+ โ”‚ โ””โ”€โ”€ anthropic_provider.py # Anthropic Claude provider
160
+ โ”œโ”€โ”€ tools/
161
+ โ”‚ โ”œโ”€โ”€ base.py # Tool base class and schemas
162
+ โ”‚ โ”œโ”€โ”€ registry.py # Tool registry and permission dispatcher
163
+ โ”‚ โ”œโ”€โ”€ file_ops.py # Read, write, patch, list files
164
+ โ”‚ โ”œโ”€โ”€ shell_ops.py # Terminal command and script execution
165
+ โ”‚ โ”œโ”€โ”€ dataset_ops.py # Exploratory data analysis & schema inspection
166
+ โ”‚ โ”œโ”€โ”€ test_eval_ops.py # Pytest execution and failure parser
167
+ โ”‚ โ””โ”€โ”€ git_ops.py # Git checkpoints, diffs, and rollbacks
168
+ โ””โ”€โ”€ ui/
169
+ โ”œโ”€โ”€ banner.py # Startup banner, splash, metadata table
170
+ โ”œโ”€โ”€ console.py # Branded visual language formatters
171
+ โ”œโ”€โ”€ logo.py # ASCII logo and responsive renderers
172
+ โ”œโ”€โ”€ prompts.py # Interactive prompt_toolkit session
173
+ โ”œโ”€โ”€ symbols.py # Unicode & ASCII symbols
174
+ โ””โ”€โ”€ theme.py # SageCLI palette and Rich styles
175
+ ```
176
+
177
+ ---
178
+
179
+ ## ๐Ÿงช Testing
180
+
181
+ Run the full automated test suite with:
182
+
183
+ ```bash
184
+ python3 -m pytest -v
185
+ ```
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sage-ai-cli"
7
+ version = "0.1.0"
8
+ description = "SageCLI - AI Engineering Agent for Machine Learning & Deep Learning"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "zaheerjklabs", email = "zaheerjklabs@gmail.com" }
14
+ ]
15
+ keywords = ["ai", "cli", "machine-learning", "deep-learning", "agent", "engineering"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Intended Audience :: Science/Research",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Programming Language :: Python :: 3.14",
28
+ ]
29
+ dependencies = [
30
+ "rich>=13.0.0",
31
+ "typer>=0.9.0",
32
+ "prompt-toolkit>=3.0.0",
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ dev = [
37
+ "pytest>=7.0.0",
38
+ "pytest-cov>=4.0.0",
39
+ ]
40
+
41
+ [project.scripts]
42
+ sage = "sagecli.cli:app"
43
+ sagecli = "sagecli.cli:app"
44
+
45
+ [tool.setuptools.packages.find]
46
+ where = ["src"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
50
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+