@stephendolan/chartmogul-cli 1.0.0 → 1.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 +40 -162
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,170 +14,94 @@ A command-line interface for ChartMogul analytics, designed for developers and L
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
### From npm (recommended)
|
|
18
|
-
|
|
19
17
|
```bash
|
|
20
18
|
npm install -g @stephendolan/chartmogul-cli
|
|
21
|
-
# or
|
|
22
|
-
bun install -g @stephendolan/chartmogul-cli
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### From source
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
git clone https://github.com/stephendolan/chartmogul-cli.git
|
|
29
|
-
cd chartmogul-cli
|
|
30
|
-
bun install
|
|
31
|
-
bun run link
|
|
32
19
|
```
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
On Linux, install libsecret for keychain support:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
sudo apt-get install libsecret-1-dev
|
|
40
|
-
```
|
|
21
|
+
On Linux, install libsecret for keychain support: `sudo apt-get install libsecret-1-dev`
|
|
41
22
|
|
|
42
23
|
## Authentication
|
|
43
24
|
|
|
44
|
-
### Using API Key (recommended)
|
|
45
|
-
|
|
46
25
|
```bash
|
|
47
|
-
# Store API key in OS keychain
|
|
48
26
|
chartmogul auth login --api-key YOUR_API_KEY
|
|
49
|
-
|
|
50
|
-
# Check authentication status
|
|
51
27
|
chartmogul auth status
|
|
52
|
-
|
|
53
|
-
# Remove stored credentials
|
|
54
28
|
chartmogul auth logout
|
|
55
29
|
```
|
|
56
30
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
export CHARTMOGUL_API_KEY=your_api_key
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Get your API key from ChartMogul: Profile → API Keys
|
|
64
|
-
|
|
65
|
-
## Usage
|
|
31
|
+
Or use the environment variable: `export CHARTMOGUL_API_KEY=your_api_key`
|
|
66
32
|
|
|
67
|
-
|
|
33
|
+
Get your API key from ChartMogul: Profile -> API Keys
|
|
68
34
|
|
|
69
|
-
|
|
70
|
-
# View account details
|
|
71
|
-
chartmogul account view
|
|
72
|
-
```
|
|
35
|
+
## Commands
|
|
73
36
|
|
|
74
37
|
### Metrics
|
|
75
38
|
|
|
76
|
-
|
|
77
|
-
# Get all metrics (last 30 days by default)
|
|
78
|
-
chartmogul metrics all
|
|
79
|
-
|
|
80
|
-
# MRR (Monthly Recurring Revenue)
|
|
81
|
-
chartmogul metrics mrr
|
|
82
|
-
chartmogul metrics mrr --start-date 2024-01-01 --end-date 2024-12-31
|
|
83
|
-
|
|
84
|
-
# ARR (Annual Recurring Revenue)
|
|
85
|
-
chartmogul metrics arr --interval month
|
|
86
|
-
|
|
87
|
-
# ARPA (Average Revenue Per Account)
|
|
88
|
-
chartmogul metrics arpa
|
|
89
|
-
|
|
90
|
-
# ASP (Average Sale Price)
|
|
91
|
-
chartmogul metrics asp
|
|
39
|
+
All metric commands support `--start-date`, `--end-date`, and `--interval` (day, week, month, quarter).
|
|
92
40
|
|
|
93
|
-
|
|
94
|
-
chartmogul metrics
|
|
95
|
-
|
|
96
|
-
#
|
|
97
|
-
chartmogul metrics
|
|
98
|
-
|
|
99
|
-
#
|
|
100
|
-
chartmogul metrics
|
|
41
|
+
```bash
|
|
42
|
+
chartmogul metrics all # All key metrics (last 30 days)
|
|
43
|
+
chartmogul metrics mrr # Monthly Recurring Revenue
|
|
44
|
+
chartmogul metrics arr # Annual Recurring Revenue
|
|
45
|
+
chartmogul metrics arpa # Average Revenue Per Account
|
|
46
|
+
chartmogul metrics asp # Average Sale Price
|
|
47
|
+
chartmogul metrics customer-count # Customer count over time
|
|
48
|
+
chartmogul metrics customer-churn # Customer churn rate
|
|
49
|
+
chartmogul metrics mrr-churn # MRR churn rate
|
|
50
|
+
chartmogul metrics ltv # Customer Lifetime Value
|
|
101
51
|
|
|
102
|
-
#
|
|
103
|
-
chartmogul metrics
|
|
52
|
+
# With date range
|
|
53
|
+
chartmogul metrics mrr --start-date 2024-01-01 --end-date 2024-12-31 --interval month
|
|
104
54
|
```
|
|
105
55
|
|
|
106
56
|
### Customers
|
|
107
57
|
|
|
108
58
|
```bash
|
|
109
|
-
# List customers
|
|
110
|
-
chartmogul customers list
|
|
111
|
-
chartmogul customers
|
|
112
|
-
chartmogul customers list --data-source <uuid>
|
|
113
|
-
|
|
114
|
-
# View a customer
|
|
115
|
-
chartmogul customers view <uuid>
|
|
116
|
-
|
|
117
|
-
# Search by email
|
|
59
|
+
chartmogul customers list # List all customers
|
|
60
|
+
chartmogul customers list --status Active # Filter by status
|
|
61
|
+
chartmogul customers view <uuid> # View customer details
|
|
118
62
|
chartmogul customers search --email user@example.com
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
chartmogul customers activities <uuid>
|
|
122
|
-
|
|
123
|
-
# View customer subscriptions
|
|
124
|
-
chartmogul customers subscriptions <uuid>
|
|
63
|
+
chartmogul customers activities <uuid> # Customer activities
|
|
64
|
+
chartmogul customers subscriptions <uuid> # Customer subscriptions
|
|
125
65
|
```
|
|
126
66
|
|
|
127
|
-
###
|
|
67
|
+
### Other Resources
|
|
128
68
|
|
|
129
69
|
```bash
|
|
130
|
-
#
|
|
131
|
-
chartmogul
|
|
70
|
+
# Account
|
|
71
|
+
chartmogul account view
|
|
132
72
|
|
|
133
|
-
#
|
|
73
|
+
# Plans
|
|
74
|
+
chartmogul plans list
|
|
134
75
|
chartmogul plans view <uuid>
|
|
135
|
-
```
|
|
136
76
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
# List invoices
|
|
77
|
+
# Invoices
|
|
141
78
|
chartmogul invoices list
|
|
142
79
|
chartmogul invoices list --customer <uuid>
|
|
143
|
-
|
|
144
|
-
# View an invoice
|
|
145
80
|
chartmogul invoices view <uuid>
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Data Sources
|
|
149
81
|
|
|
150
|
-
|
|
151
|
-
# List data sources
|
|
82
|
+
# Data Sources
|
|
152
83
|
chartmogul data-sources list
|
|
153
|
-
|
|
154
|
-
# View a data source
|
|
155
84
|
chartmogul data-sources view <uuid>
|
|
156
|
-
|
|
157
|
-
# Set default data source for filtering
|
|
158
85
|
chartmogul data-sources set-default <uuid>
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Activities
|
|
162
86
|
|
|
163
|
-
|
|
164
|
-
# List activities
|
|
87
|
+
# Activities
|
|
165
88
|
chartmogul activities list
|
|
166
|
-
chartmogul activities list --type new_biz
|
|
167
|
-
chartmogul activities list --start-date 2024-01-01 --end-date 2024-12-31
|
|
89
|
+
chartmogul activities list --type new_biz --start-date 2024-01-01
|
|
168
90
|
```
|
|
169
91
|
|
|
170
|
-
## Output
|
|
92
|
+
## Output
|
|
171
93
|
|
|
172
|
-
All commands output JSON
|
|
94
|
+
All commands output JSON. Use `--compact` or `-c` for single-line output:
|
|
173
95
|
|
|
174
96
|
```bash
|
|
175
|
-
# Pretty-printed JSON
|
|
176
|
-
chartmogul metrics mrr
|
|
97
|
+
chartmogul metrics mrr # Pretty-printed JSON
|
|
98
|
+
chartmogul -c metrics mrr # Compact JSON (single line)
|
|
99
|
+
```
|
|
177
100
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
101
|
+
Errors are also returned as JSON:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{"error": {"name": "unauthorized", "detail": "Invalid API key", "statusCode": 401}}
|
|
181
105
|
```
|
|
182
106
|
|
|
183
107
|
## Environment Variables
|
|
@@ -187,52 +111,6 @@ chartmogul --compact customers list
|
|
|
187
111
|
| `CHARTMOGUL_API_KEY` | API key (alternative to keychain) |
|
|
188
112
|
| `CHARTMOGUL_DATA_SOURCE` | Default data source UUID |
|
|
189
113
|
|
|
190
|
-
## Common Patterns
|
|
191
|
-
|
|
192
|
-
### Get current MRR
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
chartmogul metrics mrr --start-date $(date +%Y-%m-%d) --end-date $(date +%Y-%m-%d)
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Get monthly MRR trend
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
chartmogul metrics mrr --start-date 2024-01-01 --end-date 2024-12-31 --interval month
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Find high-value customers
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
chartmogul customers list | jq '.entries | sort_by(.mrr) | reverse | .[0:10]'
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Get churn analysis
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
chartmogul metrics customer-churn --start-date 2024-01-01 --end-date 2024-12-31 --interval month
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### View recent activities
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
chartmogul activities list --type churn --start-date 2024-12-01
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## Error Handling
|
|
223
|
-
|
|
224
|
-
Errors are returned as JSON:
|
|
225
|
-
|
|
226
|
-
```json
|
|
227
|
-
{
|
|
228
|
-
"error": {
|
|
229
|
-
"name": "unauthorized",
|
|
230
|
-
"detail": "Invalid API key",
|
|
231
|
-
"statusCode": 401
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
```
|
|
235
|
-
|
|
236
114
|
## License
|
|
237
115
|
|
|
238
116
|
MIT
|
package/dist/cli.js
CHANGED
|
@@ -593,7 +593,7 @@ function createActivitiesCommand() {
|
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
// src/cli.ts
|
|
596
|
-
var version = true ? "1.0.
|
|
596
|
+
var version = true ? "1.0.1" : "0.0.0-dev";
|
|
597
597
|
var program = new Command9();
|
|
598
598
|
program.name("chartmogul").description("A command-line interface for ChartMogul analytics").version(version).option("-c, --compact", "Minified JSON output (single line)").hook("preAction", (thisCommand) => {
|
|
599
599
|
const options = thisCommand.opts();
|