@hasna/analytics 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @hasna/analytics
2
+
3
+ Business analytics for AI agents — track KPIs, manage dashboards, generate reports, and get AI-powered executive summaries.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @hasna/analytics
9
+ ```
10
+
11
+ ## CLI
12
+
13
+ ```bash
14
+ # KPIs
15
+ analytics kpi record --name revenue --value 50000 --category Finance --period 2024-Q1
16
+ analytics kpi get revenue
17
+ analytics kpi trend revenue --days 30
18
+ analytics kpi list --category Finance --latest
19
+
20
+ # Dashboards
21
+ analytics dashboard create --name "Sales Overview" --description "Main sales dashboard"
22
+ analytics dashboard list
23
+ analytics dashboard get <id>
24
+ analytics dashboard update <id> --name "Updated Name"
25
+ analytics dashboard delete <id>
26
+
27
+ # Reports
28
+ analytics report generate --name "Q1 Review" --type quarterly --period 2024-Q1
29
+ analytics report list --type quarterly
30
+ analytics report get <id>
31
+
32
+ # Health & Summary
33
+ analytics health
34
+ analytics summary
35
+ ```
36
+
37
+ ## MCP Server
38
+
39
+ ```bash
40
+ analytics-mcp
41
+ ```
42
+
43
+ Add to your MCP config:
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "analytics": {
49
+ "command": "analytics-mcp"
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ ### MCP Tools
56
+
57
+ | Tool | Description |
58
+ |------|-------------|
59
+ | `record_kpi` | Record a KPI value |
60
+ | `get_kpi` | Get latest value for a KPI by name |
61
+ | `get_kpi_trend` | Get KPI trend over N days |
62
+ | `list_kpis` | List KPIs with optional filters |
63
+ | `get_latest_kpis` | Most recent value per unique KPI |
64
+ | `delete_kpi` | Delete a KPI entry |
65
+ | `create_dashboard` | Create a dashboard |
66
+ | `get_dashboard` | Get a dashboard by ID |
67
+ | `list_dashboards` | List all dashboards |
68
+ | `update_dashboard` | Update a dashboard |
69
+ | `delete_dashboard` | Delete a dashboard |
70
+ | `generate_report` | Generate a business report |
71
+ | `get_report` | Get a report by ID |
72
+ | `list_reports` | List reports with filters |
73
+ | `delete_report` | Delete a report |
74
+ | `get_business_health` | Get health summary across all KPIs |
75
+ | `generate_executive_summary` | AI-powered executive summary |
76
+
77
+ ## Data Storage
78
+
79
+ Data is stored in `~/.hasna/analytics/analytics.db` by default.
80
+
81
+ Override with env vars:
82
+ - `HASNA_ANALYTICS_DIR` — full path to directory
83
+ - `ANALYTICS_DIR` — full path to directory
84
+
85
+ ## Programmatic API
86
+
87
+ ```typescript
88
+ import { recordKpi, getKpi, getBusinessHealth } from "@hasna/analytics";
89
+
90
+ const kpi = recordKpi({ name: "revenue", value: 50000, category: "Finance" });
91
+ const health = getBusinessHealth();
92
+ ```
93
+
94
+ ## License
95
+
96
+ Apache-2.0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}