@owlmetry/cli 0.1.12 → 0.1.14
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/dist/index.cjs
CHANGED
|
@@ -6359,6 +6359,9 @@ var METRIC_PHASES = ["start", "complete", "fail", "cancel", "record"];
|
|
|
6359
6359
|
// ../../packages/shared/dist/audit.js
|
|
6360
6360
|
init_cjs_shims();
|
|
6361
6361
|
|
|
6362
|
+
// ../../packages/shared/dist/time.js
|
|
6363
|
+
init_cjs_shims();
|
|
6364
|
+
|
|
6362
6365
|
// src/commands/apps.ts
|
|
6363
6366
|
var appsCommand = new Command("apps").description("Manage apps");
|
|
6364
6367
|
appsCommand.command("list").description("List apps").option("--project-id <id>", "Filter by project ID").action(async (opts, cmd) => {
|
|
@@ -6492,33 +6495,6 @@ function resolveJsonArray(inline, filePath, opts) {
|
|
|
6492
6495
|
return parsed;
|
|
6493
6496
|
}
|
|
6494
6497
|
|
|
6495
|
-
// src/utils/time.ts
|
|
6496
|
-
init_cjs_shims();
|
|
6497
|
-
var RELATIVE_PATTERN = /^(\d+)([smhdw])$/;
|
|
6498
|
-
var MULTIPLIERS = {
|
|
6499
|
-
s: 1e3,
|
|
6500
|
-
m: 6e4,
|
|
6501
|
-
h: 36e5,
|
|
6502
|
-
d: 864e5,
|
|
6503
|
-
w: 6048e5
|
|
6504
|
-
};
|
|
6505
|
-
function parseTimeInput(input) {
|
|
6506
|
-
const match = input.match(RELATIVE_PATTERN);
|
|
6507
|
-
if (match) {
|
|
6508
|
-
const amount = parseInt(match[1], 10);
|
|
6509
|
-
const unit = match[2];
|
|
6510
|
-
const ms = amount * MULTIPLIERS[unit];
|
|
6511
|
-
return new Date(Date.now() - ms).toISOString();
|
|
6512
|
-
}
|
|
6513
|
-
const date = new Date(input);
|
|
6514
|
-
if (isNaN(date.getTime())) {
|
|
6515
|
-
throw new Error(
|
|
6516
|
-
`Invalid time input: "${input}". Use relative (e.g. 1h, 30m, 7d) or ISO 8601 format.`
|
|
6517
|
-
);
|
|
6518
|
-
}
|
|
6519
|
-
return date.toISOString();
|
|
6520
|
-
}
|
|
6521
|
-
|
|
6522
6498
|
// src/utils/pagination.ts
|
|
6523
6499
|
init_cjs_shims();
|
|
6524
6500
|
function paginationHint(result) {
|
|
@@ -6538,8 +6514,8 @@ var eventsCommand = new Command("events").description("Query events").option("--
|
|
|
6538
6514
|
new Option("--data-mode <mode>", "Data mode: production, development, or all").choices(["production", "development", "all"]).default("production")
|
|
6539
6515
|
).action(async (opts, cmd) => {
|
|
6540
6516
|
const { client, globals } = createClient(cmd);
|
|
6541
|
-
const since = opts.since
|
|
6542
|
-
const until = opts.until
|
|
6517
|
+
const since = opts.since ?? (!opts.until ? "24h" : void 0);
|
|
6518
|
+
const until = opts.until;
|
|
6543
6519
|
const result = await client.queryEvents({
|
|
6544
6520
|
project_id: opts.projectId,
|
|
6545
6521
|
app_id: opts.appId,
|
|
@@ -6715,20 +6691,18 @@ init_cjs_shims();
|
|
|
6715
6691
|
function formatMetricsTable(metrics) {
|
|
6716
6692
|
if (metrics.length === 0) return source_default.dim("No metrics defined");
|
|
6717
6693
|
const lines = [
|
|
6718
|
-
source_default.bold("Slug".padEnd(30) + "Name".padEnd(30)
|
|
6719
|
-
"\u2500".repeat(
|
|
6694
|
+
source_default.bold("Slug".padEnd(30) + "Name".padEnd(30)),
|
|
6695
|
+
"\u2500".repeat(60)
|
|
6720
6696
|
];
|
|
6721
6697
|
for (const m of metrics) {
|
|
6722
|
-
|
|
6723
|
-
lines.push(`${m.slug.padEnd(30)}${m.name.padEnd(30)}${status}`);
|
|
6698
|
+
lines.push(`${m.slug.padEnd(30)}${m.name.padEnd(30)}`);
|
|
6724
6699
|
}
|
|
6725
6700
|
return lines.join("\n");
|
|
6726
6701
|
}
|
|
6727
6702
|
function formatMetricDetail(metric) {
|
|
6728
6703
|
const lines = [
|
|
6729
6704
|
source_default.bold(metric.name),
|
|
6730
|
-
source_default.dim(`slug: ${metric.slug}`)
|
|
6731
|
-
`Status: ${metric.status === "active" ? source_default.green("active") : source_default.yellow("paused")}`
|
|
6705
|
+
source_default.dim(`slug: ${metric.slug}`)
|
|
6732
6706
|
];
|
|
6733
6707
|
if (metric.description) lines.push(`
|
|
6734
6708
|
${metric.description}`);
|
|
@@ -6797,8 +6771,8 @@ metricsCommand.command("events <slug>").description("Query raw metric events for
|
|
|
6797
6771
|
new Option("--data-mode <mode>", "Data mode: production, development, or all").choices(["production", "development", "all"]).default("production")
|
|
6798
6772
|
).action(async (slug, opts, cmd) => {
|
|
6799
6773
|
const { client, globals } = createClient(cmd);
|
|
6800
|
-
const since = opts.since
|
|
6801
|
-
const until = opts.until
|
|
6774
|
+
const since = opts.since ?? (!opts.until ? "24h" : void 0);
|
|
6775
|
+
const until = opts.until;
|
|
6802
6776
|
const result = await client.queryMetricEvents(slug, opts.projectId, {
|
|
6803
6777
|
phase: opts.phase,
|
|
6804
6778
|
tracking_id: opts.trackingId,
|
|
@@ -6840,7 +6814,7 @@ metricsCommand.command("create").description("Create a new metric definition").r
|
|
|
6840
6814
|
});
|
|
6841
6815
|
output(globals.format, metric, () => formatMetricDetail(metric));
|
|
6842
6816
|
});
|
|
6843
|
-
metricsCommand.command("query <slug>").description("Query metric aggregation").requiredOption("--project-id <id>", "Project ID").option("--since <date>", "Start
|
|
6817
|
+
metricsCommand.command("query <slug>").description("Query metric aggregation").requiredOption("--project-id <id>", "Project ID").option("--since <date>", "Start time (e.g. 1h, 30m, 7d, or ISO 8601)").option("--until <date>", "End time (e.g. 1h, 30m, 7d, or ISO 8601)").option("--app-id <id>", "Filter by app ID").option("--app-version <version>", "Filter by app version").option("--device-model <model>", "Filter by device model").option("--os-version <version>", "Filter by OS version").option("--user-id <id>", "Filter by user ID").option("--environment <env>", "Filter by environment (ios, ipados, macos, android, web, backend)").option("--group-by <field>", "Group by: app_id, app_version, device_model, os_version, environment, time:hour, time:day, time:week").addOption(
|
|
6844
6818
|
new Option("--data-mode <mode>", "Data mode: production, development, or all").choices(["production", "development", "all"]).default("production")
|
|
6845
6819
|
).action(async (slug, opts, cmd) => {
|
|
6846
6820
|
const { client, globals } = createClient(cmd);
|
|
@@ -6858,12 +6832,11 @@ metricsCommand.command("query <slug>").description("Query metric aggregation").r
|
|
|
6858
6832
|
});
|
|
6859
6833
|
output(globals.format, result, () => formatQueryResult(result));
|
|
6860
6834
|
});
|
|
6861
|
-
metricsCommand.command("update <slug>").description("Update a metric definition").requiredOption("--project-id <id>", "Project ID").option("--name <name>", "New name").option("--description <desc>", "New description").
|
|
6835
|
+
metricsCommand.command("update <slug>").description("Update a metric definition").requiredOption("--project-id <id>", "Project ID").option("--name <name>", "New name").option("--description <desc>", "New description").action(async (slug, opts, cmd) => {
|
|
6862
6836
|
const { client, globals } = createClient(cmd);
|
|
6863
6837
|
const metric = await client.updateMetric(slug, opts.projectId, {
|
|
6864
6838
|
name: opts.name,
|
|
6865
|
-
description: opts.description
|
|
6866
|
-
status: opts.status
|
|
6839
|
+
description: opts.description
|
|
6867
6840
|
});
|
|
6868
6841
|
output(globals.format, metric, () => formatMetricDetail(metric));
|
|
6869
6842
|
});
|
|
@@ -7010,7 +6983,7 @@ funnelsCommand.command("delete <slug>").description("Delete a funnel definition"
|
|
|
7010
6983
|
await client.deleteFunnel(slug, opts.projectId);
|
|
7011
6984
|
console.log(source_default.green(`Funnel "${slug}" deleted.`));
|
|
7012
6985
|
});
|
|
7013
|
-
funnelsCommand.command("query <slug>").description("Query funnel analytics").requiredOption("--project-id <id>", "Project ID").option("--since <date>", "Start
|
|
6986
|
+
funnelsCommand.command("query <slug>").description("Query funnel analytics").requiredOption("--project-id <id>", "Project ID").option("--since <date>", "Start time (e.g. 1h, 30m, 7d, or ISO 8601)").option("--until <date>", "End time (e.g. 1h, 30m, 7d, or ISO 8601)").option("--open", "Make this an open funnel. In an open funnel, users don't have to complete a previous step in order to be included in a subsequent step.").option("--app-version <version>", "Filter by app version").option("--environment <env>", "Filter by environment (ios, ipados, macos, android, web, backend)").option("--experiment <name:variant>", "Filter by experiment (format: name:variant)").option("--group-by <field>", "Group by: environment, app_version, or experiment:<name>").addOption(
|
|
7014
6987
|
new Option("--data-mode <mode>", "Data mode: production, development, or all").choices(["production", "development", "all"]).default("production")
|
|
7015
6988
|
).action(async (slug, opts, cmd) => {
|
|
7016
6989
|
const { client, globals } = createClient(cmd);
|
|
@@ -7036,15 +7009,13 @@ auditLogCommand.command("list").description("List audit log entries").requiredOp
|
|
|
7036
7009
|
new Option("--limit <n>", "Max entries to return").argParser((v) => parsePositiveInt(v, "--limit"))
|
|
7037
7010
|
).option("--cursor <cursor>", "Pagination cursor").action(async (opts, cmd) => {
|
|
7038
7011
|
const { client, globals } = createClient(cmd);
|
|
7039
|
-
const since = opts.since ? parseTimeInput(opts.since) : void 0;
|
|
7040
|
-
const until = opts.until ? parseTimeInput(opts.until) : void 0;
|
|
7041
7012
|
const result = await client.queryAuditLogs(opts.teamId, {
|
|
7042
7013
|
resource_type: opts.resourceType,
|
|
7043
7014
|
resource_id: opts.resourceId,
|
|
7044
7015
|
actor_id: opts.actorId,
|
|
7045
7016
|
action: opts.action,
|
|
7046
|
-
since,
|
|
7047
|
-
until,
|
|
7017
|
+
since: opts.since,
|
|
7018
|
+
until: opts.until,
|
|
7048
7019
|
cursor: opts.cursor,
|
|
7049
7020
|
limit: opts.limit
|
|
7050
7021
|
});
|
|
@@ -7198,7 +7169,7 @@ var switchCommand = new Command("switch").description("Switch active team profil
|
|
|
7198
7169
|
});
|
|
7199
7170
|
|
|
7200
7171
|
// src/index.ts
|
|
7201
|
-
var program2 = new Command().name("owlmetry").version("0.1.
|
|
7172
|
+
var program2 = new Command().name("owlmetry").version("0.1.14").description("OwlMetry CLI \u2014 query metrics and manage your apps from the terminal").addOption(
|
|
7202
7173
|
new Option("--format <format>", "Output format").choices(["table", "json", "log"]).default("table")
|
|
7203
7174
|
).option("--endpoint <url>", "OwlMetry API server URL").option("--api-key <key>", "API key").option("--ingest-endpoint <url>", "OwlMetry ingest endpoint URL (for SDKs; defaults to API endpoint for self-hosted)").option("--team <name-or-id>", "Use a specific team profile for this command");
|
|
7204
7175
|
program2.addCommand(authCommand);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: owlmetry-cli
|
|
3
|
-
version: 0.1.
|
|
3
|
+
version: 0.1.14
|
|
4
4
|
description: >-
|
|
5
5
|
Install the OwlMetry CLI, sign up, and manage projects, apps, metrics,
|
|
6
6
|
funnels, and events. Use when adding OwlMetry to a project, querying
|
|
@@ -161,10 +161,10 @@ owlmetry apps update <id> --name <name> --format json
|
|
|
161
161
|
owlmetry metrics list --project-id <id> --format json
|
|
162
162
|
owlmetry metrics view <slug> --project-id <id> --format json
|
|
163
163
|
owlmetry metrics create --project-id <id> --name <name> --slug <slug> [--lifecycle] [--description <desc>] --format json
|
|
164
|
-
owlmetry metrics update <slug> --project-id <id> [--name <name>] [--
|
|
164
|
+
owlmetry metrics update <slug> --project-id <id> [--name <name>] [--description <desc>] --format json
|
|
165
165
|
owlmetry metrics delete <slug> --project-id <id>
|
|
166
166
|
owlmetry metrics events <slug> --project-id <id> [--phase <phase>] [--user-id <id>] [--since <time>] [--until <time>] --format json
|
|
167
|
-
owlmetry metrics query <slug> --project-id <id> [--since <
|
|
167
|
+
owlmetry metrics query <slug> --project-id <id> [--since <time>] [--until <time>] [--app-id <id>] [--user-id <id>] [--group-by <field>] --format json
|
|
168
168
|
|
|
169
169
|
# Funnels
|
|
170
170
|
owlmetry funnels list --project-id <id> --format json
|
|
@@ -172,7 +172,7 @@ owlmetry funnels view <slug> --project-id <id> --format json
|
|
|
172
172
|
owlmetry funnels create --project-id <id> --name <name> --slug <slug> --steps-file <path> [--description <desc>] --format json
|
|
173
173
|
owlmetry funnels update <slug> --project-id <id> --steps-file <path> --format json
|
|
174
174
|
owlmetry funnels delete <slug> --project-id <id>
|
|
175
|
-
owlmetry funnels query <slug> --project-id <id> [--since <
|
|
175
|
+
owlmetry funnels query <slug> --project-id <id> [--since <time>] [--until <time>] [--open] [--group-by <field>] --format json
|
|
176
176
|
|
|
177
177
|
# Events
|
|
178
178
|
owlmetry events [--project-id <id>] [--app-id <id>] [--level <level>] [--user-id <id>] [--session-id <id>] [--since <time>] [--limit <n>] --format json
|
|
@@ -228,7 +228,7 @@ The metric definition must exist on the server **before** the SDK emits events f
|
|
|
228
228
|
owlmetry metrics list --project-id <id> --format json # List all
|
|
229
229
|
owlmetry metrics view <slug> --project-id <id> --format json # View details
|
|
230
230
|
owlmetry metrics create --project-id <id> --name <name> --slug <slug> [--lifecycle] [--description <desc>] --format json
|
|
231
|
-
owlmetry metrics update <slug> --project-id <id> [--name <name>] [--
|
|
231
|
+
owlmetry metrics update <slug> --project-id <id> [--name <name>] [--description <desc>] --format json
|
|
232
232
|
owlmetry metrics delete <slug> --project-id <id>
|
|
233
233
|
```
|
|
234
234
|
|
|
@@ -317,7 +317,7 @@ There are two ways to look at metric data:
|
|
|
317
317
|
|
|
318
318
|
```bash
|
|
319
319
|
owlmetry metrics events <slug> --project-id <id> [--phase start|complete|fail|cancel|record] [--tracking-id <id>] [--user-id <id>] [--since <time>] [--until <time>] [--environment <env>] [--data-mode <mode>] --format json
|
|
320
|
-
owlmetry metrics query <slug> --project-id <id> [--since <
|
|
320
|
+
owlmetry metrics query <slug> --project-id <id> [--since <time>] [--until <time>] [--app-id <id>] [--app-version <v>] [--environment <env>] [--user-id <id>] [--group-by app_id|app_version|device_model|os_version|environment|time:hour|time:day|time:week] [--data-mode <mode>] --format json
|
|
321
321
|
```
|
|
322
322
|
|
|
323
323
|
### Funnel Analytics
|
|
@@ -325,7 +325,7 @@ owlmetry metrics query <slug> --project-id <id> [--since <date>] [--until <date>
|
|
|
325
325
|
Funnel queries return conversion rates and drop-off between steps. The output shows how many users entered each step and what percentage continued to the next. Use `--group-by` to segment results and compare conversion across environments, app versions, or A/B experiment variants.
|
|
326
326
|
|
|
327
327
|
```bash
|
|
328
|
-
owlmetry funnels query <slug> --project-id <id> [--since <
|
|
328
|
+
owlmetry funnels query <slug> --project-id <id> [--since <time>] [--until <time>] [--open] [--app-version <v>] [--environment <env>] [--experiment <name:variant>] [--group-by environment|app_version|experiment:<name>] [--data-mode <mode>] --format json
|
|
329
329
|
```
|
|
330
330
|
|
|
331
331
|
`--open` = open funnel mode (steps evaluated independently, not sequentially).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmetry/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "OwlMetry CLI — manage projects, apps, metrics, funnels, and events from the terminal. Includes AI skill files for agent-assisted development.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|