@optima-chat/bi-cli 0.3.4 → 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.
@@ -78,15 +78,39 @@ interface ForecastResponse {
78
78
  }
79
79
 
80
80
  export function createTrendsCommand(): Command {
81
- const trends = new Command('trends').description('Trend analytics');
81
+ const trends = new Command('trends').description(
82
+ `Trend analytics.
83
+
84
+ Analyze revenue trends, order heatmaps, seasonality, and forecasts.`
85
+ );
82
86
 
83
87
  // trends revenue
84
88
  trends
85
89
  .command('revenue')
86
- .description('Get revenue trend over time')
87
- .option('--days <number>', 'Number of days', '30')
88
- .option('--granularity <type>', 'Granularity: hourly, daily, weekly', 'daily')
89
- .option('--pretty', 'Output in pretty table format')
90
+ .description(
91
+ `Revenue trend analysis.
92
+
93
+ View revenue over time with hourly/daily/weekly aggregation and 7-day moving average.
94
+
95
+ Returns JSON:
96
+ {
97
+ "statistics": {
98
+ "total_revenue": number,
99
+ "avg_revenue": number,
100
+ "trend_direction": "up" | "down" | "stable"
101
+ },
102
+ "trend": [
103
+ { "period": "2024-01-01", "revenue": 1000, "orders": 50, "moving_avg_7": 950 }
104
+ ]
105
+ }
106
+
107
+ Examples:
108
+ bi-cli trends revenue # Last 30 days, daily
109
+ bi-cli trends revenue --days 7 --granularity hourly # Last 7 days, hourly`
110
+ )
111
+ .option('--days <number>', 'Number of days (default: 30)', '30')
112
+ .option('--granularity <type>', 'Time granularity: hourly | daily | weekly', 'daily')
113
+ .option('--pretty', 'Output as table')
90
114
  .action(async (options) => {
91
115
  const cfg = getConfig();
92
116
  if (!cfg.accessToken) {
@@ -152,9 +176,25 @@ export function createTrendsCommand(): Command {
152
176
  // trends heatmap
153
177
  trends
154
178
  .command('heatmap')
155
- .description('Orders heatmap by day and hour')
156
- .option('--days <number>', 'Number of days', '30')
157
- .option('--pretty', 'Output in pretty table format')
179
+ .description(
180
+ `Orders heatmap by day and hour.
181
+
182
+ Analyze order distribution by day of week and hour to find peak times.
183
+
184
+ Returns JSON:
185
+ {
186
+ "heatmap": [
187
+ { "day": "Monday", "hours": [ { "hour": 10, "orders": 15, "revenue": 500 }, ... ] }
188
+ ],
189
+ "peak_times": [
190
+ { "day": "Saturday", "hour": "14:00-15:00", "orders": 25 }
191
+ ]
192
+ }
193
+
194
+ Use case: Optimize marketing timing, schedule customer service staff.`
195
+ )
196
+ .option('--days <number>', 'Number of days (default: 30)', '30')
197
+ .option('--pretty', 'Output as table')
158
198
  .action(async (options) => {
159
199
  const cfg = getConfig();
160
200
  if (!cfg.accessToken) {
@@ -221,8 +261,26 @@ export function createTrendsCommand(): Command {
221
261
  // trends seasonality
222
262
  trends
223
263
  .command('seasonality')
224
- .description('Monthly/seasonal patterns')
225
- .option('--pretty', 'Output in pretty table format')
264
+ .description(
265
+ `Monthly/seasonal pattern analysis.
266
+
267
+ Analyze sales by month to identify peak and low seasons.
268
+
269
+ Returns JSON:
270
+ {
271
+ "monthly_pattern": [
272
+ { "month": 1, "month_name": "January", "revenue": 50000, "orders": 500, "index": 120 }
273
+ ],
274
+ "insights": {
275
+ "peak_months": ["December", "November"],
276
+ "low_months": ["February"],
277
+ "avg_monthly_revenue": 45000
278
+ }
279
+ }
280
+
281
+ Note: index is percentage relative to average (>100 = above average).`
282
+ )
283
+ .option('--pretty', 'Output as table')
226
284
  .action(async (options) => {
227
285
  const cfg = getConfig();
228
286
  if (!cfg.accessToken) {
@@ -277,9 +335,28 @@ export function createTrendsCommand(): Command {
277
335
  // trends forecast
278
336
  trends
279
337
  .command('forecast')
280
- .description('Revenue forecast')
281
- .option('--days <number>', 'Number of days to forecast', '7')
282
- .option('--pretty', 'Output in pretty table format')
338
+ .description(
339
+ `Revenue forecast.
340
+
341
+ Predict future revenue based on historical data, considering trends and day-of-week patterns.
342
+
343
+ Returns JSON:
344
+ {
345
+ "trend": { "direction": "up", "daily_change": 50.5 },
346
+ "forecast": [
347
+ { "date": "2024-01-15", "day_of_week": "Monday", "predicted_revenue": 5000, "confidence": "medium" }
348
+ ],
349
+ "disclaimer": "For reference only..."
350
+ }
351
+
352
+ Note: Forecast based on simple linear model, for reference only.
353
+
354
+ Examples:
355
+ bi-cli trends forecast # Forecast next 7 days
356
+ bi-cli trends forecast --days 14 # Forecast next 14 days`
357
+ )
358
+ .option('--days <number>', 'Days to forecast (default: 7)', '7')
359
+ .option('--pretty', 'Output as table')
283
360
  .action(async (options) => {
284
361
  const cfg = getConfig();
285
362
  if (!cfg.accessToken) {
package/src/index.ts CHANGED
@@ -20,7 +20,19 @@ const program = new Command();
20
20
 
21
21
  program
22
22
  .name('bi-cli')
23
- .description('Optima BI CLI - AI-friendly business intelligence tool')
23
+ .description(
24
+ `Optima BI CLI - E-commerce business intelligence tool for LLM agents.
25
+
26
+ IMPORTANT: Run 'bi-cli auth login' first to authenticate before using other commands.
27
+
28
+ Output: All commands output JSON by default (for programmatic parsing). Use --pretty for human-readable tables.
29
+
30
+ Common use cases:
31
+ - Get sales data → bi-cli sales get --days 7
32
+ - Top selling products → bi-cli product best-sellers --limit 10
33
+ - Revenue trends → bi-cli trends revenue --days 30
34
+ - Compare periods → bi-cli analytics compare --days 7`
35
+ )
24
36
  .version(pkg.version);
25
37
 
26
38
  // Auth commands
@@ -44,33 +56,33 @@ program.addCommand(createTrafficCommand());
44
56
  // Config commands (placeholder)
45
57
  program
46
58
  .command('config')
47
- .description('Manage configuration')
59
+ .description('[NOT IMPLEMENTED] Configuration management')
48
60
  .action(() => {
49
- console.log('Config management coming soon...');
61
+ console.log('This feature is not yet implemented');
50
62
  });
51
63
 
52
64
  // Customer commands (placeholder)
53
65
  program
54
66
  .command('customer')
55
- .description('Customer analytics')
67
+ .description('[NOT IMPLEMENTED] Customer analytics')
56
68
  .action(() => {
57
- console.log('Customer analytics coming soon...');
69
+ console.log('This feature is not yet implemented');
58
70
  });
59
71
 
60
72
  // Inventory commands (placeholder)
61
73
  program
62
74
  .command('inventory')
63
- .description('Inventory analytics')
75
+ .description('[NOT IMPLEMENTED] Inventory analytics')
64
76
  .action(() => {
65
- console.log('Inventory analytics coming soon...');
77
+ console.log('This feature is not yet implemented');
66
78
  });
67
79
 
68
80
  // Platform commands (admin only - placeholder)
69
81
  program
70
82
  .command('platform')
71
- .description('Platform analytics (admin only)')
83
+ .description('[NOT IMPLEMENTED] Platform analytics (admin only)')
72
84
  .action(() => {
73
- console.log('Platform analytics coming soon...');
85
+ console.log('This feature is not yet implemented');
74
86
  });
75
87
 
76
88
  program.parse();