@optima-chat/bi-cli 0.3.5 → 0.3.6

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 (2) hide show
  1. package/README.md +136 -52
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # @optima-chat/bi-cli
2
2
 
3
- Optima BI CLI - AI-friendly business intelligence tool for e-commerce analytics.
3
+ Optima BI CLI - E-commerce business intelligence tool designed for LLM agents.
4
+
5
+ ## Features
6
+
7
+ - **LLM-Friendly**: Detailed help messages with JSON schemas and examples
8
+ - **JSON Output**: All commands output JSON by default for programmatic parsing
9
+ - **Pretty Tables**: Use `--pretty` flag for human-readable table format
10
+ - **Unified Auth**: Shared authentication with `commerce-cli` and `optima-agent`
4
11
 
5
12
  ## Installation
6
13
 
@@ -8,9 +15,26 @@ Optima BI CLI - AI-friendly business intelligence tool for e-commerce analytics.
8
15
  npm install -g @optima-chat/bi-cli
9
16
  ```
10
17
 
11
- ## Authentication
18
+ ## Quick Start
19
+
20
+ ```bash
21
+ # Login first (required)
22
+ bi-cli auth login
23
+
24
+ # Get sales data
25
+ bi-cli sales get --days 7
26
+
27
+ # Top selling products
28
+ bi-cli product best-sellers --limit 10
12
29
 
13
- bi-cli uses unified authentication via `~/.optima/token.json`, shared with `commerce-cli` and `optima-agent`.
30
+ # Revenue trends
31
+ bi-cli trends revenue --days 30
32
+
33
+ # Compare with previous period
34
+ bi-cli analytics compare --days 7
35
+ ```
36
+
37
+ ## Authentication
14
38
 
15
39
  ### Login
16
40
 
@@ -28,14 +52,9 @@ bi-cli auth login --env development
28
52
  ### Check Status
29
53
 
30
54
  ```bash
31
- # Show current user
32
- bi-cli auth whoami
33
-
34
- # Show authentication status
35
- bi-cli auth status
36
-
37
- # Logout
38
- bi-cli auth logout
55
+ bi-cli auth whoami # Show current user
56
+ bi-cli auth status # Show authentication status
57
+ bi-cli auth logout # Logout
39
58
  ```
40
59
 
41
60
  ### Environment Configuration
@@ -52,93 +71,158 @@ bi-cli auth logout
52
71
  2. `OPTIMA_TOKEN` environment variable
53
72
  3. `~/.optima/token.json` file
54
73
 
55
- ### Environment Variables
56
-
57
- ```bash
58
- # Override token
59
- export BI_CLI_TOKEN="your-access-token"
60
-
61
- # Override URLs
62
- export BI_CLI_BACKEND_URL="https://custom-api.example.com"
63
- export BI_CLI_AUTH_URL="https://custom-auth.example.com"
64
-
65
- # Override environment
66
- export BI_CLI_ENV="stage"
67
- ```
68
-
69
74
  ## Commands
70
75
 
71
76
  ### Sales Analytics
72
77
 
73
78
  ```bash
74
- # Get sales data
75
- bi-cli sales get
76
- bi-cli sales get --days 30
79
+ bi-cli sales get # Get last 7 days (default)
80
+ bi-cli sales get --days 30 # Get last 30 days
81
+ bi-cli sales get --days 7 --pretty # Output as table
82
+ ```
83
+
84
+ Returns:
85
+
86
+ ```json
87
+ {
88
+ "summary": {
89
+ "total_revenue": 10000,
90
+ "total_orders": 100,
91
+ "avg_order_value": 100,
92
+ "unique_customers": 80
93
+ },
94
+ "daily": [{ "date": "2024-01-01", "total_revenue": 1500, "order_count": 15 }]
95
+ }
77
96
  ```
78
97
 
79
98
  ### Product Analytics
80
99
 
81
100
  ```bash
82
101
  # Best selling products
83
- bi-cli product best-sellers
84
- bi-cli product best-sellers --limit 10
102
+ bi-cli product best-sellers # Top 10 by revenue
103
+ bi-cli product best-sellers --limit 5 # Top 5
104
+ bi-cli product best-sellers --sort quantity # Sort by quantity
85
105
 
86
- # ABC inventory analysis
106
+ # ABC inventory analysis (Pareto)
87
107
  bi-cli product abc-analysis
88
108
 
89
- # Price point analysis
109
+ # Price range analysis
90
110
  bi-cli product price-analysis
91
111
 
92
- # Product performance
93
- bi-cli product performance
112
+ # Product performance metrics
113
+ bi-cli product performance --days 30 --limit 20
94
114
  ```
95
115
 
96
116
  ### Trend Analytics
97
117
 
98
118
  ```bash
99
- # Revenue trends
100
- bi-cli trends revenue
101
- bi-cli trends revenue --days 30
119
+ # Revenue trends with moving average
120
+ bi-cli trends revenue # Last 30 days, daily
121
+ bi-cli trends revenue --granularity hourly # Hourly granularity
122
+ bi-cli trends revenue --granularity weekly # Weekly granularity
102
123
 
103
- # Orders heatmap
124
+ # Orders heatmap by day and hour
104
125
  bi-cli trends heatmap
105
126
 
106
- # Seasonal patterns
127
+ # Monthly/seasonal patterns
107
128
  bi-cli trends seasonality
108
129
 
109
130
  # Revenue forecast
110
- bi-cli trends forecast
131
+ bi-cli trends forecast # Next 7 days
132
+ bi-cli trends forecast --days 14 # Next 14 days
111
133
  ```
112
134
 
113
135
  ### Advanced Analytics
114
136
 
115
137
  ```bash
116
- # Compare periods
117
- bi-cli analytics compare
118
- bi-cli analytics compare --days 30
138
+ # Period comparison
139
+ bi-cli analytics compare # Last 30 days vs previous
140
+ bi-cli analytics compare --days 7 # This week vs last week
141
+ bi-cli analytics compare --compare-to previous_year # Year-over-year
119
142
 
120
143
  # Growth trends
121
- bi-cli analytics growth
144
+ bi-cli analytics growth # Daily, last 30 periods
145
+ bi-cli analytics growth --period weekly # Weekly
146
+ bi-cli analytics growth --period monthly # Monthly
122
147
 
123
- # Customer cohort analysis
148
+ # Customer cohort analysis (LTV)
124
149
  bi-cli analytics cohort
125
150
 
126
- # Order funnel analysis
127
- bi-cli analytics funnel
151
+ # Order status funnel
152
+ bi-cli analytics funnel --days 30
153
+ ```
154
+
155
+ ### Traffic Analytics
156
+
157
+ ```bash
158
+ # Traffic overview
159
+ bi-cli traffic overview # Last 30 days
160
+ bi-cli traffic overview --days 7 # Last 7 days
161
+ bi-cli traffic overview --product <uuid> # Filter by product
162
+
163
+ # Traffic sources
164
+ bi-cli traffic sources --limit 10
165
+
166
+ # Conversion funnel
167
+ bi-cli traffic funnel
168
+
169
+ # Site search analytics
170
+ bi-cli traffic search
171
+ bi-cli traffic search --zero-results # Zero-result queries only
172
+
173
+ # Top pages
174
+ bi-cli traffic pages --limit 20
128
175
  ```
129
176
 
130
- ## JSON Output
177
+ ## Output Formats
131
178
 
132
- All commands output JSON by default, making it easy to integrate with AI agents and other tools.
179
+ ### JSON (Default)
180
+
181
+ All commands output JSON by default, ideal for LLM agents and programmatic use:
133
182
 
134
183
  ```bash
135
- # Pipe to jq for formatting
136
184
  bi-cli sales get | jq .
137
-
138
- # Use with AI agents
139
185
  bi-cli product best-sellers --limit 5 | your-ai-tool
140
186
  ```
141
187
 
188
+ ### Pretty Tables
189
+
190
+ Use `--pretty` flag for human-readable output:
191
+
192
+ ```bash
193
+ bi-cli sales get --pretty
194
+ bi-cli product best-sellers --pretty
195
+ ```
196
+
197
+ ## Environment Variables
198
+
199
+ ```bash
200
+ # Override token
201
+ export BI_CLI_TOKEN="your-access-token"
202
+
203
+ # Override URLs
204
+ export BI_CLI_BACKEND_URL="https://custom-api.example.com"
205
+ export BI_CLI_AUTH_URL="https://custom-auth.example.com"
206
+
207
+ # Override environment
208
+ export BI_CLI_ENV="stage"
209
+ ```
210
+
211
+ ## For LLM Agents
212
+
213
+ Each command includes detailed help with:
214
+
215
+ - Function description
216
+ - JSON return structure
217
+ - Usage examples
218
+ - Parameter descriptions with valid values
219
+
220
+ ```bash
221
+ bi-cli sales get --help
222
+ bi-cli product abc-analysis --help
223
+ bi-cli analytics cohort --help
224
+ ```
225
+
142
226
  ## License
143
227
 
144
228
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/bi-cli",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "description": "Optima BI CLI - AI-friendly business intelligence tool",
6
6
  "main": "dist/index.js",