@metricraven/cli 0.6.0 → 0.7.0
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 +1 -1
- package/dist/commands.js +35 -9
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ The token is saved to `~/.config/metricraven/config.json` (or `$XDG_CONFIG_HOME/
|
|
|
68
68
|
| `goals definitions`, `goals preview --page <path> \| --link <site> [--link-path <path>] \| --click <text> \| --form <id> \| --download <file>` | Goals defined without code, and how many visitors (and payers) a pattern matched in the last 30 days. `--click`, `--form` and `--download` match [automatic events](https://metricraven.com/docs/automatic-events) (a button text in any letter case, a form id or name, a file name or `.pdf` for any PDF) |
|
|
69
69
|
| `goals define <name> --page /pricing \| --link stripe.com [--link-path /checkout/**] \| --click "Start free trial" \| --form signup \| --download .pdf`, `goals undefine <name>` | Create a goal without code (previews, then asks; `--yes`) or delete one (says which alerts, funnels or primary goal still use it); needs write access |
|
|
70
70
|
| `notes list`, `notes add --text [--date]` | Chart notes (adding needs write access) |
|
|
71
|
-
| `mentions [--platform x\|reddit] [--q text]` |
|
|
71
|
+
| `mentions [--platform x\|reddit\|web\|youtube\|linkedin\|threads\|tiktok\|instagram\|facebook\|pinterest] [--q text]` | Posts mentioning the website on every platform, with the visits and revenue after posts that link to it (Growth plan) |
|
|
72
72
|
| `ai-visibility` | What AI assistants answer to your tracked prompts (Growth plan); `--period` for the trend (default 90d) |
|
|
73
73
|
| `alerts list\|get <id>\|history`, `alerts create --goal <name>` (or `--trigger payment\|new_customer`), `alerts update <id>`, `alerts delete <id>` | Conversion alerts; `--recipients a@x.com,b@x.com\|all` picks who gets them, `--channel <id,id>` also posts to alert channels (changes need write access) |
|
|
74
74
|
| `alerts channels list\|get <id>`, `alerts channels add slack\|discord\|webhook --url <URL> [--spikes] [--weekly] [--monthly]`, `alerts channels add telegram`, `alerts channels update\|test\|rotate-secret\|reconnect\|remove <id>` | Alert channels: Slack, Discord, Telegram (prints the connect links) and signed webhooks (prints the signing secret once). Destinations are shown masked; remove and rotate-secret ask first (`--yes`). Changes need write access, admin |
|
package/dist/commands.js
CHANGED
|
@@ -1170,13 +1170,26 @@ async function addNote(ctx) {
|
|
|
1170
1170
|
out(`Added a note on ${note.date}: ${note.text}`);
|
|
1171
1171
|
return 0;
|
|
1172
1172
|
}
|
|
1173
|
-
|
|
1173
|
+
const MENTION_PLATFORMS = ["x", "reddit", "web", "youtube", "linkedin", "threads", "tiktok", "instagram", "facebook", "pinterest"];
|
|
1174
|
+
const MENTION_LABEL = {
|
|
1175
|
+
x: "X",
|
|
1176
|
+
reddit: "Reddit",
|
|
1177
|
+
web: "Web",
|
|
1178
|
+
youtube: "YouTube",
|
|
1179
|
+
linkedin: "LinkedIn",
|
|
1180
|
+
threads: "Threads",
|
|
1181
|
+
tiktok: "TikTok",
|
|
1182
|
+
instagram: "Instagram",
|
|
1183
|
+
facebook: "Facebook",
|
|
1184
|
+
pinterest: "Pinterest",
|
|
1185
|
+
};
|
|
1186
|
+
/** Stored mentions on every platform in the period (newest first). Reads only; never starts a search. */
|
|
1174
1187
|
async function listMentions(ctx) {
|
|
1175
1188
|
const { flags } = ctx;
|
|
1176
1189
|
const params = rangeParams({ ...flags, filter: undefined });
|
|
1177
1190
|
if (flags.platform) {
|
|
1178
|
-
if (
|
|
1179
|
-
throw new UsageError(
|
|
1191
|
+
if (!MENTION_PLATFORMS.includes(flags.platform))
|
|
1192
|
+
throw new UsageError(`--platform must be one of ${MENTION_PLATFORMS.join(", ")}.`);
|
|
1180
1193
|
params.set("platform", flags.platform);
|
|
1181
1194
|
}
|
|
1182
1195
|
if (flags.q)
|
|
@@ -1192,15 +1205,28 @@ async function listMentions(ctx) {
|
|
|
1192
1205
|
if (flags.json)
|
|
1193
1206
|
return printJson(d), 0;
|
|
1194
1207
|
if (d.meta.locked)
|
|
1195
|
-
return out(d.meta.message ?? "
|
|
1208
|
+
return out(d.meta.message ?? "Social mentions need the Growth plan."), 0;
|
|
1196
1209
|
if (!d.data.length)
|
|
1197
1210
|
return out(dim("No mentions in this period.")), 0;
|
|
1198
|
-
const where = (m) =>
|
|
1211
|
+
const where = (m) => m.platform === "x"
|
|
1212
|
+
? `X @${m.author.username}`
|
|
1213
|
+
: m.platform === "reddit"
|
|
1214
|
+
? `r/${m.subreddit ?? "?"} u/${m.author.username}`
|
|
1215
|
+
: m.platform === "web"
|
|
1216
|
+
? m.author.name
|
|
1217
|
+
: `${MENTION_LABEL[m.platform] ?? m.platform} ${m.author.username ? `@${m.author.username}` : m.author.name}`;
|
|
1218
|
+
const e = (m) => m.engagement;
|
|
1199
1219
|
const stats = (m) => m.platform === "x"
|
|
1200
|
-
? `${num(m.
|
|
1201
|
-
:
|
|
1202
|
-
|
|
1203
|
-
|
|
1220
|
+
? `${num(e(m).likes ?? 0)} likes · ${num(e(m).reposts ?? 0)} reposts`
|
|
1221
|
+
: m.platform === "reddit"
|
|
1222
|
+
? `${num(e(m).score ?? 0)} pts · ${num(e(m).comments ?? 0)} comments`
|
|
1223
|
+
: [e(m).views != null ? `${num(e(m).views)} views` : "", e(m).likes != null ? `${num(e(m).likes)} likes` : "", e(m).comments != null ? `${num(e(m).comments)} comments` : ""]
|
|
1224
|
+
.filter(Boolean)
|
|
1225
|
+
.join(" · ") || "-";
|
|
1226
|
+
// Visits and first-touch revenue from the page's host or the platform after a post that links to the site.
|
|
1227
|
+
const traffic = (m) => (m.traffic ? `${num(m.traffic.visitors)} visitors · ${money(m.traffic.revenue, d.meta.currency)}` : "-");
|
|
1228
|
+
const body = (m) => truncate(`${m.title ? `${m.title}: ` : ""}${m.text}`.replace(/\s+/g, " ").trim(), 60);
|
|
1229
|
+
out(table(["Date", "Where", "Post", "Engagement", "After the post"], d.data.map((m) => [date(m.timestamp), where(m), body(m), stats(m), traffic(m)])));
|
|
1204
1230
|
if (d.pagination.hasMore)
|
|
1205
1231
|
out(dim(`Showing ${d.pagination.offset + 1}–${d.pagination.offset + d.data.length} of ${d.pagination.total}. Use --offset for more.`));
|
|
1206
1232
|
return 0;
|
package/dist/index.js
CHANGED
|
@@ -137,8 +137,10 @@ Reports (default: last 30 days)
|
|
|
137
137
|
(follow every page, up to 100,000 rows), --csv
|
|
138
138
|
notes list Chart notes in the period
|
|
139
139
|
notes add --text [--date] Add a chart note (needs write access)
|
|
140
|
-
mentions
|
|
141
|
-
|
|
140
|
+
mentions Posts mentioning the website on X, Reddit, the web,
|
|
141
|
+
YouTube, LinkedIn, Threads, TikTok, Instagram,
|
|
142
|
+
Facebook, Pinterest (Growth); --platform <name>,
|
|
143
|
+
--q, -n/--limit, --offset
|
|
142
144
|
ai-visibility What AI assistants answer to your tracked prompts
|
|
143
145
|
(Growth): scores, per-assistant results, brands named;
|
|
144
146
|
--period (default 90d) for the trend
|
package/package.json
CHANGED