doushi-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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Doushi AI
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,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: doushi-cli
3
+ Version: 0.1.0
4
+ Summary: Official CLI for Doushi.ai - Instant Autonomous ML Modeling from your Terminal
5
+ Author-email: Doushi AI Team <support@doushi.ai>
6
+ License: MIT
7
+ Keywords: machine-learning,ai,cli,automl,doushi,developer-tools
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: typer[all]>=0.12.0
19
+ Requires-Dist: rich>=13.7.0
20
+ Requires-Dist: httpx>=0.27.0
21
+ Requires-Dist: pydantic>=2.0.0
22
+ Requires-Dist: python-dotenv>=1.0.0
23
+ Dynamic: license-file
24
+
25
+ # Doushi AI CLI (`doushi` / `dsh`) Specification & Architecture
26
+
27
+ The official command-line interface for **Doushi.ai** — empowering developers and data teams to build, train, inspect, and deploy autonomous ML models directly from their terminal.
28
+
29
+ ---
30
+
31
+ ## 1. Vision & Core Philosophy
32
+
33
+ - **Zero-Boilerplate ML**: Go from a local dataset CSV to a production-ready hosted inference model with a single command.
34
+ - **Developer-First UX**: Beautiful terminal UI with spinners, rich colored tables, streaming agent logs, and shell completions.
35
+ - **Unix-Philosophy Compliant**: Full support for piping (`cat test.csv | doushi predict <id> | jq`), stdout redirection, and JSON outputs (`--json`).
36
+ - **No Vendor Lock-In**: One command (`doushi export`) downloads the raw scikit-learn/XGBoost/LightGBM code, Dockerfile, FastAPI microservice, and trained weights (`model.pkl`).
37
+
38
+ ---
39
+
40
+ ## 2. Authentication & Browser Sign-In Workflow
41
+
42
+ ```mermaid
43
+ sequenceDiagram
44
+ autonumber
45
+ actor User
46
+ participant CLI as Doushi CLI (Terminal)
47
+ participant Browser as Web Browser
48
+ participant Web as Doushi Web App (doushi.ai)
49
+ participant API as Doushi Backend API
50
+
51
+ User->>CLI: doushi login
52
+ CLI->>CLI: Bind local HTTP server on random port (e.g. 54321)<br/>Generate cryptographic state token
53
+ CLI->>Browser: Open https://doushi.ai/cli/auth?port=54321&state=XYZ
54
+ Browser->>Web: Load CLI Authorization Page
55
+ Note over Web,Browser: User logs in if session is expired
56
+ Web->>User: "Authorize Doushi CLI to access your account?"
57
+ User->>Web: Clicks "Authorize CLI"
58
+ Web->>API: POST /api/api-keys (name: "CLI - Hostname")
59
+ API-->>Web: Returns API Key { key: "dsh_live_...", org_id, email }
60
+ Web->>Browser: Redirect to http://localhost:54321/callback?key=dsh_live_...&state=XYZ
61
+ Browser->>CLI: GET /callback with API Key & state
62
+ CLI->>CLI: Validate state nonce, write credentials to ~/.doushi/credentials
63
+ CLI-->>Browser: HTTP 200: "Authorization Successful! Return to terminal."
64
+ CLI->>CLI: Terminate local HTTP server
65
+ CLI->>User: ✔ Logged in as user@domain.com
66
+ ```
67
+
68
+ ### Auth Modes:
69
+ 1. **Interactive Browser Login (Default)**:
70
+ ```bash
71
+ doushi login
72
+ ```
73
+ Opens `https://doushi.ai/cli/auth?port=<port>&state=<nonce>` and catches the callback automatically.
74
+
75
+ 2. **Headless / Remote SSH Server (`--no-browser`)**:
76
+ ```bash
77
+ doushi login --no-browser
78
+ ```
79
+ Outputs an activation URL and one-time verification code (Device Code Flow).
80
+
81
+ 3. **Direct Token / API Key**:
82
+ ```bash
83
+ doushi login --key dsh_live_xxxxxxxxxxxxxxxx
84
+ ```
85
+ Or set via environment variable:
86
+ ```bash
87
+ export DOUSHI_API_KEY="dsh_live_xxxxxxxxxxxxxxxx"
88
+ ```
89
+
90
+ 4. **Account Inspection & Logout**:
91
+ ```bash
92
+ doushi whoami
93
+ doushi logout
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 3. Command Hierarchy & Reference
99
+
100
+ ```text
101
+ doushi [OPTIONS] COMMAND [ARGS]...
102
+
103
+ Authentication:
104
+ login Authenticate CLI with Doushi.ai via browser or API Key
105
+ logout Remove local credentials
106
+ whoami Show active user, organization, and tier quota
107
+
108
+ Model Training & Project Management:
109
+ train, create Upload dataset and prompt to train an autonomous model
110
+ init Interactive wizard for creating a project step-by-step
111
+ projects, ls List all projects, statuses, and performance metrics
112
+ view <id> Inspect project details, features, hyperparameters, and confusion matrix
113
+ delete <id> Delete a project and its artifacts
114
+
115
+ Inference & Deployment:
116
+ predict <id> Run live prediction via inline JSON, CSV file, or stdin pipe
117
+ host <id> Toggle dedicated sub-20ms warm EC2 hosting vs on-demand mode
118
+ snippet <id> Generate copy-paste code snippets (cURL, Python, TypeScript, Go)
119
+
120
+ Agent Observability & Interaction:
121
+ logs <id> [-f] Stream real-time training and self-healing agent sandbox logs
122
+ chat <id> Interactive terminal REPL to chat with the model agent
123
+ export <id> Download model.pkl, training script, Dockerfile, and FastAPI server
124
+
125
+ Utilities:
126
+ demo Download a sample dataset (churn, housing, fraud) and test immediately
127
+ completion Generate shell autocompletion script (bash, zsh, fish)
128
+ config Get or set CLI configuration options
129
+ ```
130
+
131
+ ---
132
+
133
+ ## 4. Key Workflows & Example Invocations
134
+
135
+ ### A. One-Command Model Training
136
+ ```bash
137
+ # Train on customer churn dataset with goal
138
+ doushi train ./churn_data.csv --goal "Predict customer churn probability"
139
+
140
+ # Train with specific target column override
141
+ doushi train ./housing.csv --goal "Predict house sale price" --target price
142
+ ```
143
+
144
+ ### B. Live Agent Streaming
145
+ ```bash
146
+ # Stream agent's self-healing loop and sandbox execution in real time
147
+ doushi logs proj_982fa10c -f
148
+ ```
149
+
150
+ ### C. Live Predictions
151
+ ```bash
152
+ # 1. Single sample JSON
153
+ doushi predict proj_982fa10c --data '{"tenure": 12, "monthly_spend": 79.5, "contract": "Month-to-month"}'
154
+
155
+ # 2. Batch predict from CSV file
156
+ doushi predict proj_982fa10c --file ./test_users.csv --output ./results.csv
157
+
158
+ # 3. Unix Pipe
159
+ cat new_records.csv | doushi predict proj_982fa10c | jq '.predictions[]'
160
+ ```
161
+
162
+ ### D. Interactive Terminal Chat (Agent REPL)
163
+ ```bash
164
+ doushi chat proj_982fa10c
165
+ ```
166
+ ```text
167
+ 🤖 Doushi Assistant (Connected to Project: 'Customer Churn Predictor')
168
+ > What were the top features affecting predictions?
169
+ Agent: 1. monthly_spend (32.4%)
170
+ 2. support_tickets (28.1%)
171
+ 3. tenure_months (18.6%)
172
+
173
+ > Retrain using LightGBM and handle outliers in monthly_spend
174
+ Agent: Refinement task enqueued. Triggering new sandbox run...
175
+ ```
176
+
177
+ ### E. Standalone Code & Model Export
178
+ ```bash
179
+ doushi export proj_982fa10c --out ./exported-model/
180
+ ```
181
+ **Output Directory Contents:**
182
+ ```text
183
+ exported-model/
184
+ ├── model.pkl # Serialized model artifact
185
+ ├── pipeline.py # Scikit-learn / XGBoost training code
186
+ ├── requirements.txt # Locked dependencies
187
+ ├── serve.py # FastAPI microservice for local deployment
188
+ └── Dockerfile # Production container definition
189
+ ```
190
+
191
+ ---
192
+
193
+ ## 5. Local File System & Configuration
194
+
195
+ ```text
196
+ ~/.doushi/
197
+ ├── credentials # Mode 0600 file holding active API keys & tokens
198
+ └── config.json # Global configurations (default endpoint, format, timeouts)
199
+ ```
200
+
201
+ **`~/.doushi/credentials`**:
202
+ ```json
203
+ {
204
+ "current_context": "default",
205
+ "contexts": {
206
+ "default": {
207
+ "user_email": "user@example.com",
208
+ "user_id": "usr_abc123",
209
+ "org_id": "org_personal_456",
210
+ "api_key": "dsh_live_98a7sd8f7a9s8d7f"
211
+ }
212
+ }
213
+ }
214
+ ```
215
+
216
+ ---
217
+
218
+ ## 6. Implementation Roadmap
219
+
220
+ ### Phase 1: Core CLI Foundation
221
+ - [ ] Initialize Python CLI package with `typer`, `rich`, and `httpx` (or Go standalone binary).
222
+ - [ ] Implement `doushi login` with local loopback HTTP server and browser redirection.
223
+ - [ ] Implement `doushi whoami` and `doushi logout`.
224
+ - [ ] Implement `~/.doushi/credentials` security store.
225
+
226
+ ### Phase 2: Project Lifecycle & Training
227
+ - [ ] Implement `doushi train <file>` with multipart upload, prompt submission, and spinner.
228
+ - [ ] Implement `doushi projects list` with formatted Rich tables.
229
+ - [ ] Implement `doushi view <id>` showing status, metrics, and dataset schema.
230
+ - [ ] Implement `doushi logs <id> -f` for live execution stream.
231
+
232
+ ### Phase 3: Inference & Agent Tools
233
+ - [ ] Implement `doushi predict <id>` (JSON argument, CSV batch, and pipe support).
234
+ - [ ] Implement `doushi chat <id>` interactive REPL session.
235
+ - [ ] Implement `doushi export <id>` to download `model.pkl` + serving boilerplate.
236
+ - [ ] Implement `doushi demo` with embedded sample datasets for instant onboarding.
@@ -0,0 +1,150 @@
1
+ # ✦ Doushi AI CLI (`doushi` / `dsh`)
2
+
3
+ [![PyPI Version](https://img.shields.io/badge/pypi-v0.1.0-blue.svg)](https://pypi.org/project/doushi-cli/)
4
+ [![Python Versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)](https://pypi.org/project/doushi-cli/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6
+ [![Doushi Platform](https://img.shields.io/badge/Platform-Doushi.ai-cyan.svg)](https://doushi.ai)
7
+
8
+ **The official command-line interface for [Doushi.ai](https://doushi.ai)** — empowering developers, data scientists, and hackers to build, train, inspect, and deploy autonomous machine learning models directly from their terminal.
9
+
10
+ ---
11
+
12
+ ## ✨ Features
13
+
14
+ - ⚡ **Zero-Boilerplate ML**: Go from raw datasets (`.parquet`, `.xls`, `.xlsx`, `.json`, `.csv`, `.tsv`) to production-ready models in a single command.
15
+ - 🔒 **Security-First Auth**: AWS CLI-style credential management (`~/.doushi/credentials` with strict `0600` permissions).
16
+ - 🛡️ **Pre-Flight Limit Checks**: Validates dataset integrity and file limits locally before uploading.
17
+ - 🔄 **Real-Time Streaming**: Watch the autonomous self-healing agent loop live in your terminal.
18
+ - 🚀 **Live Inference & Pipes**: Predict via inline JSON, batch CSV files, or standard input streams (`cat data.csv | doushi predict <id>`).
19
+ - 📦 **No Vendor Lock-In**: Export raw scikit-learn/XGBoost training code, `model.pkl`, FastAPI microservice, and Dockerfile with `doushi export`.
20
+
21
+ ---
22
+
23
+ ## 📦 Installation
24
+
25
+ Install via `pip`:
26
+ ```bash
27
+ pip install doushi-cli
28
+ ```
29
+
30
+ Or run instantly without installing using `pipx`:
31
+ ```bash
32
+ pipx run doushi demo
33
+ ```
34
+
35
+ *(Both `doushi` and `dsh` are available as CLI aliases)*
36
+
37
+ ---
38
+
39
+ ## 🚀 Quickstart in 60 Seconds
40
+
41
+ ### 1. Authenticate your terminal
42
+ ```bash
43
+ doushi configure
44
+ ```
45
+ *(Prompts for your API key from [doushi.ai/settings/api-keys](https://doushi.ai/settings/api-keys))*
46
+
47
+ ### 2. Try the 30-second instant demo
48
+ ```bash
49
+ doushi demo
50
+ ```
51
+ *(Trains an autonomous model on a sample customer churn dataset and shows live performance metrics)*
52
+
53
+ ### 3. Train on your own dataset
54
+ ```bash
55
+ doushi train ./my_dataset.csv --goal "Predict customer churn probability"
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 📖 Command Reference
61
+
62
+ ### Authentication
63
+ ```bash
64
+ doushi configure # Set up API Key & verify credentials
65
+ doushi whoami # View active organization, plan tier, and project quotas
66
+ doushi logout # Remove stored local credentials
67
+ ```
68
+
69
+ ### Model Training & Projects
70
+ ```bash
71
+ # Upload dataset and train with autonomous agent
72
+ doushi train ./dataset.csv --goal "Predict house sale prices"
73
+
74
+ # List all organization projects and best metrics
75
+ doushi projects list
76
+
77
+ # Inspect detailed model parameters, KPIs, and dataset preview
78
+ doushi projects view <project_id>
79
+
80
+ # Delete a project
81
+ doushi projects delete <project_id>
82
+ ```
83
+
84
+ ### Predictions & Inference
85
+ ```bash
86
+ # 1. Predict with single inline JSON record
87
+ doushi predict <project_id> --data '{"age": 32, "tenure": 12, "balance": 4500.0}'
88
+
89
+ # 2. Batch predict from a test CSV file
90
+ doushi predict <project_id> --file ./test_records.csv --output ./predictions.csv
91
+
92
+ # 3. Unix standard input piping
93
+ cat records.csv | doushi predict <project_id> | jq '.predictions[]'
94
+ ```
95
+
96
+ ### Observability & Code Export
97
+ ```bash
98
+ # Stream real-time agent execution & self-healing sandbox logs
99
+ doushi logs <project_id> -f
100
+
101
+ # Export standalone model bundle (model.pkl + FastAPI + Dockerfile)
102
+ doushi export <project_id> --out ./model-bundle/
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 📂 Exported Model Bundle Structure
108
+
109
+ Running `doushi export <project_id>` gives you everything you need to run completely independent of Doushi:
110
+
111
+ ```text
112
+ model-bundle/
113
+ ├── model.pkl # Pretrained model weights
114
+ ├── pipeline.py # Complete scikit-learn / XGBoost training script
115
+ ├── requirements.txt # Locked dependencies
116
+ ├── serve.py # FastAPI REST microservice
117
+ ├── Dockerfile # Production container
118
+ └── README.md # Local deployment instructions
119
+ ```
120
+
121
+ ---
122
+
123
+ ## 🛠️ Development & Contributing
124
+
125
+ ### Local Setup
126
+ ```bash
127
+ git clone https://github.com/doushi-ai/doushi-cli.git
128
+ cd doushi-cli
129
+
130
+ python3 -m venv venv
131
+ source venv/bin/activate
132
+ pip install -e ".[dev]"
133
+ ```
134
+
135
+ ### Run Test Suite
136
+ ```bash
137
+ python3 -m unittest discover -s tests
138
+ ```
139
+
140
+ ---
141
+
142
+ ## 📄 License
143
+
144
+ Distributed under the [MIT License](LICENSE). See `LICENSE` for more information.
145
+
146
+ ---
147
+
148
+ <p align="center">
149
+ Built with ✦ by the <a href="https://doushi.ai">Doushi.ai</a> Team
150
+ </p>
@@ -0,0 +1,212 @@
1
+ # Doushi AI CLI (`doushi` / `dsh`) Specification & Architecture
2
+
3
+ The official command-line interface for **Doushi.ai** — empowering developers and data teams to build, train, inspect, and deploy autonomous ML models directly from their terminal.
4
+
5
+ ---
6
+
7
+ ## 1. Vision & Core Philosophy
8
+
9
+ - **Zero-Boilerplate ML**: Go from a local dataset CSV to a production-ready hosted inference model with a single command.
10
+ - **Developer-First UX**: Beautiful terminal UI with spinners, rich colored tables, streaming agent logs, and shell completions.
11
+ - **Unix-Philosophy Compliant**: Full support for piping (`cat test.csv | doushi predict <id> | jq`), stdout redirection, and JSON outputs (`--json`).
12
+ - **No Vendor Lock-In**: One command (`doushi export`) downloads the raw scikit-learn/XGBoost/LightGBM code, Dockerfile, FastAPI microservice, and trained weights (`model.pkl`).
13
+
14
+ ---
15
+
16
+ ## 2. Authentication & Browser Sign-In Workflow
17
+
18
+ ```mermaid
19
+ sequenceDiagram
20
+ autonumber
21
+ actor User
22
+ participant CLI as Doushi CLI (Terminal)
23
+ participant Browser as Web Browser
24
+ participant Web as Doushi Web App (doushi.ai)
25
+ participant API as Doushi Backend API
26
+
27
+ User->>CLI: doushi login
28
+ CLI->>CLI: Bind local HTTP server on random port (e.g. 54321)<br/>Generate cryptographic state token
29
+ CLI->>Browser: Open https://doushi.ai/cli/auth?port=54321&state=XYZ
30
+ Browser->>Web: Load CLI Authorization Page
31
+ Note over Web,Browser: User logs in if session is expired
32
+ Web->>User: "Authorize Doushi CLI to access your account?"
33
+ User->>Web: Clicks "Authorize CLI"
34
+ Web->>API: POST /api/api-keys (name: "CLI - Hostname")
35
+ API-->>Web: Returns API Key { key: "dsh_live_...", org_id, email }
36
+ Web->>Browser: Redirect to http://localhost:54321/callback?key=dsh_live_...&state=XYZ
37
+ Browser->>CLI: GET /callback with API Key & state
38
+ CLI->>CLI: Validate state nonce, write credentials to ~/.doushi/credentials
39
+ CLI-->>Browser: HTTP 200: "Authorization Successful! Return to terminal."
40
+ CLI->>CLI: Terminate local HTTP server
41
+ CLI->>User: ✔ Logged in as user@domain.com
42
+ ```
43
+
44
+ ### Auth Modes:
45
+ 1. **Interactive Browser Login (Default)**:
46
+ ```bash
47
+ doushi login
48
+ ```
49
+ Opens `https://doushi.ai/cli/auth?port=<port>&state=<nonce>` and catches the callback automatically.
50
+
51
+ 2. **Headless / Remote SSH Server (`--no-browser`)**:
52
+ ```bash
53
+ doushi login --no-browser
54
+ ```
55
+ Outputs an activation URL and one-time verification code (Device Code Flow).
56
+
57
+ 3. **Direct Token / API Key**:
58
+ ```bash
59
+ doushi login --key dsh_live_xxxxxxxxxxxxxxxx
60
+ ```
61
+ Or set via environment variable:
62
+ ```bash
63
+ export DOUSHI_API_KEY="dsh_live_xxxxxxxxxxxxxxxx"
64
+ ```
65
+
66
+ 4. **Account Inspection & Logout**:
67
+ ```bash
68
+ doushi whoami
69
+ doushi logout
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 3. Command Hierarchy & Reference
75
+
76
+ ```text
77
+ doushi [OPTIONS] COMMAND [ARGS]...
78
+
79
+ Authentication:
80
+ login Authenticate CLI with Doushi.ai via browser or API Key
81
+ logout Remove local credentials
82
+ whoami Show active user, organization, and tier quota
83
+
84
+ Model Training & Project Management:
85
+ train, create Upload dataset and prompt to train an autonomous model
86
+ init Interactive wizard for creating a project step-by-step
87
+ projects, ls List all projects, statuses, and performance metrics
88
+ view <id> Inspect project details, features, hyperparameters, and confusion matrix
89
+ delete <id> Delete a project and its artifacts
90
+
91
+ Inference & Deployment:
92
+ predict <id> Run live prediction via inline JSON, CSV file, or stdin pipe
93
+ host <id> Toggle dedicated sub-20ms warm EC2 hosting vs on-demand mode
94
+ snippet <id> Generate copy-paste code snippets (cURL, Python, TypeScript, Go)
95
+
96
+ Agent Observability & Interaction:
97
+ logs <id> [-f] Stream real-time training and self-healing agent sandbox logs
98
+ chat <id> Interactive terminal REPL to chat with the model agent
99
+ export <id> Download model.pkl, training script, Dockerfile, and FastAPI server
100
+
101
+ Utilities:
102
+ demo Download a sample dataset (churn, housing, fraud) and test immediately
103
+ completion Generate shell autocompletion script (bash, zsh, fish)
104
+ config Get or set CLI configuration options
105
+ ```
106
+
107
+ ---
108
+
109
+ ## 4. Key Workflows & Example Invocations
110
+
111
+ ### A. One-Command Model Training
112
+ ```bash
113
+ # Train on customer churn dataset with goal
114
+ doushi train ./churn_data.csv --goal "Predict customer churn probability"
115
+
116
+ # Train with specific target column override
117
+ doushi train ./housing.csv --goal "Predict house sale price" --target price
118
+ ```
119
+
120
+ ### B. Live Agent Streaming
121
+ ```bash
122
+ # Stream agent's self-healing loop and sandbox execution in real time
123
+ doushi logs proj_982fa10c -f
124
+ ```
125
+
126
+ ### C. Live Predictions
127
+ ```bash
128
+ # 1. Single sample JSON
129
+ doushi predict proj_982fa10c --data '{"tenure": 12, "monthly_spend": 79.5, "contract": "Month-to-month"}'
130
+
131
+ # 2. Batch predict from CSV file
132
+ doushi predict proj_982fa10c --file ./test_users.csv --output ./results.csv
133
+
134
+ # 3. Unix Pipe
135
+ cat new_records.csv | doushi predict proj_982fa10c | jq '.predictions[]'
136
+ ```
137
+
138
+ ### D. Interactive Terminal Chat (Agent REPL)
139
+ ```bash
140
+ doushi chat proj_982fa10c
141
+ ```
142
+ ```text
143
+ 🤖 Doushi Assistant (Connected to Project: 'Customer Churn Predictor')
144
+ > What were the top features affecting predictions?
145
+ Agent: 1. monthly_spend (32.4%)
146
+ 2. support_tickets (28.1%)
147
+ 3. tenure_months (18.6%)
148
+
149
+ > Retrain using LightGBM and handle outliers in monthly_spend
150
+ Agent: Refinement task enqueued. Triggering new sandbox run...
151
+ ```
152
+
153
+ ### E. Standalone Code & Model Export
154
+ ```bash
155
+ doushi export proj_982fa10c --out ./exported-model/
156
+ ```
157
+ **Output Directory Contents:**
158
+ ```text
159
+ exported-model/
160
+ ├── model.pkl # Serialized model artifact
161
+ ├── pipeline.py # Scikit-learn / XGBoost training code
162
+ ├── requirements.txt # Locked dependencies
163
+ ├── serve.py # FastAPI microservice for local deployment
164
+ └── Dockerfile # Production container definition
165
+ ```
166
+
167
+ ---
168
+
169
+ ## 5. Local File System & Configuration
170
+
171
+ ```text
172
+ ~/.doushi/
173
+ ├── credentials # Mode 0600 file holding active API keys & tokens
174
+ └── config.json # Global configurations (default endpoint, format, timeouts)
175
+ ```
176
+
177
+ **`~/.doushi/credentials`**:
178
+ ```json
179
+ {
180
+ "current_context": "default",
181
+ "contexts": {
182
+ "default": {
183
+ "user_email": "user@example.com",
184
+ "user_id": "usr_abc123",
185
+ "org_id": "org_personal_456",
186
+ "api_key": "dsh_live_98a7sd8f7a9s8d7f"
187
+ }
188
+ }
189
+ }
190
+ ```
191
+
192
+ ---
193
+
194
+ ## 6. Implementation Roadmap
195
+
196
+ ### Phase 1: Core CLI Foundation
197
+ - [ ] Initialize Python CLI package with `typer`, `rich`, and `httpx` (or Go standalone binary).
198
+ - [ ] Implement `doushi login` with local loopback HTTP server and browser redirection.
199
+ - [ ] Implement `doushi whoami` and `doushi logout`.
200
+ - [ ] Implement `~/.doushi/credentials` security store.
201
+
202
+ ### Phase 2: Project Lifecycle & Training
203
+ - [ ] Implement `doushi train <file>` with multipart upload, prompt submission, and spinner.
204
+ - [ ] Implement `doushi projects list` with formatted Rich tables.
205
+ - [ ] Implement `doushi view <id>` showing status, metrics, and dataset schema.
206
+ - [ ] Implement `doushi logs <id> -f` for live execution stream.
207
+
208
+ ### Phase 3: Inference & Agent Tools
209
+ - [ ] Implement `doushi predict <id>` (JSON argument, CSV batch, and pipe support).
210
+ - [ ] Implement `doushi chat <id>` interactive REPL session.
211
+ - [ ] Implement `doushi export <id>` to download `model.pkl` + serving boilerplate.
212
+ - [ ] Implement `doushi demo` with embedded sample datasets for instant onboarding.
@@ -0,0 +1,4 @@
1
+ """Doushi CLI - Instant Autonomous ML Modeling from your Terminal."""
2
+
3
+ __version__ = "1.0.0"
4
+ __app_name__ = "doushi"