@erdoai/cli 0.33.0 → 0.34.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/dist/index.js +94 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -488,6 +488,22 @@ var ErdoClient = class {
|
|
|
488
488
|
input
|
|
489
489
|
);
|
|
490
490
|
}
|
|
491
|
+
// --- activity feed ---
|
|
492
|
+
// The unified, ranked, read-only feed: attention items, approvals, workstream
|
|
493
|
+
// events, catalog updates, and urgent cause-clusters. Respond via
|
|
494
|
+
// respondAttentionItem / decideApproval — this is a view only.
|
|
495
|
+
listActivityFeed(params) {
|
|
496
|
+
const q = new URLSearchParams();
|
|
497
|
+
if (params?.limit) q.set("limit", String(params.limit));
|
|
498
|
+
if (params?.offset) q.set("offset", String(params.offset));
|
|
499
|
+
if (params?.categories) q.set("categories", params.categories);
|
|
500
|
+
if (params?.scope) q.set("scope", params.scope);
|
|
501
|
+
const qs = q.toString();
|
|
502
|
+
return this.request(
|
|
503
|
+
"GET",
|
|
504
|
+
`/v1/activity/feed${qs ? `?${qs}` : ""}`
|
|
505
|
+
);
|
|
506
|
+
}
|
|
491
507
|
// --- knowledge review queue ---
|
|
492
508
|
listReviewItems(params) {
|
|
493
509
|
const q = new URLSearchParams();
|
|
@@ -752,9 +768,11 @@ var ErdoClient = class {
|
|
|
752
768
|
return this.request("POST", "/v1/pages", input);
|
|
753
769
|
}
|
|
754
770
|
// Start a review of external page URLs with the real landing critic; returns a
|
|
755
|
-
// review id immediately (poll getPageReview for the typed findings).
|
|
756
|
-
|
|
757
|
-
|
|
771
|
+
// review id immediately (poll getPageReview for the typed findings). goal is
|
|
772
|
+
// the operator's optional declared campaign goal — it steers which conversion
|
|
773
|
+
// principles apply, and a page whose evident form contradicts it is a finding.
|
|
774
|
+
reviewPages(urls, goal) {
|
|
775
|
+
return this.request("POST", "/v1/page-reviews", goal ? { urls, goal } : { urls });
|
|
758
776
|
}
|
|
759
777
|
getPageReview(id) {
|
|
760
778
|
return this.request("GET", `/v1/page-reviews/${encodeURIComponent(id)}`);
|
|
@@ -2224,6 +2242,74 @@ attnCmd.command("respond <id>").description(
|
|
|
2224
2242
|
}
|
|
2225
2243
|
}
|
|
2226
2244
|
);
|
|
2245
|
+
function activityLine(it) {
|
|
2246
|
+
const handle = it.slug || it.id;
|
|
2247
|
+
const parts = [it.title || it.type];
|
|
2248
|
+
if (it.summary && it.summary !== it.title) {
|
|
2249
|
+
const s = it.summary.replace(/\s+/g, " ").trim();
|
|
2250
|
+
parts.push(`\u2014 ${s.length > 80 ? `${s.slice(0, 79)}\u2026` : s}`);
|
|
2251
|
+
}
|
|
2252
|
+
return ` ${handle} ${parts.join(" ")}`;
|
|
2253
|
+
}
|
|
2254
|
+
function activityAction(it) {
|
|
2255
|
+
if (it.type === "approval_request") return `erdo approvals decide ${it.id} --approve|--reject`;
|
|
2256
|
+
return `erdo attention respond ${it.slug || it.id}`;
|
|
2257
|
+
}
|
|
2258
|
+
function renderActivityFeed(feed) {
|
|
2259
|
+
const items = feed.items ?? [];
|
|
2260
|
+
const needs = items.filter((it) => it.needs_action);
|
|
2261
|
+
if (needs.length > 0) {
|
|
2262
|
+
console.log("NEEDS YOU");
|
|
2263
|
+
for (const it of needs) {
|
|
2264
|
+
const sev = it.severity ? `[${it.severity}] ` : "";
|
|
2265
|
+
console.log(` ${sev}${it.title || it.type}`);
|
|
2266
|
+
console.log(` ${activityAction(it)}`);
|
|
2267
|
+
}
|
|
2268
|
+
console.log("");
|
|
2269
|
+
}
|
|
2270
|
+
const clusters = feed.urgent_clusters ?? [];
|
|
2271
|
+
if (clusters.length > 0) {
|
|
2272
|
+
console.log("URGENT");
|
|
2273
|
+
if (feed.flood_summary) console.log(` ${feed.flood_summary}`);
|
|
2274
|
+
for (const c of clusters) console.log(` \u2022 ${c.summary} (${c.count})`);
|
|
2275
|
+
console.log("");
|
|
2276
|
+
}
|
|
2277
|
+
const rest = items.filter((it) => !it.needs_action && !it.clustered);
|
|
2278
|
+
if (rest.length > 0) {
|
|
2279
|
+
console.log("RECENT");
|
|
2280
|
+
for (const it of rest) console.log(activityLine(it));
|
|
2281
|
+
console.log("");
|
|
2282
|
+
}
|
|
2283
|
+
if (needs.length === 0 && clusters.length === 0 && rest.length === 0) {
|
|
2284
|
+
console.log("Nothing in the feed.");
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
console.log(`${items.length} shown \xB7 ${feed.total} total`);
|
|
2288
|
+
}
|
|
2289
|
+
program.command("activity").alias("feed").description(
|
|
2290
|
+
"The unified activity feed \u2014 needs-you items first, then urgent cause-clusters, then recent activity. Read-only: respond with `erdo attention respond` / `erdo approvals decide`."
|
|
2291
|
+
).option("-n, --limit <n>", "max items (default 20, max 100)", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).option(
|
|
2292
|
+
"--categories <list>",
|
|
2293
|
+
"comma-separated: attention,approval,workstream,catalog,job,heartbeat (default excludes runs)"
|
|
2294
|
+
).option("--scope <scope>", "following | all (default all)").option("--json", "raw JSON response").action(
|
|
2295
|
+
async (opts) => {
|
|
2296
|
+
try {
|
|
2297
|
+
const feed = await new ErdoClient().listActivityFeed({
|
|
2298
|
+
limit: opts.limit,
|
|
2299
|
+
offset: opts.offset,
|
|
2300
|
+
categories: opts.categories,
|
|
2301
|
+
scope: opts.scope
|
|
2302
|
+
});
|
|
2303
|
+
if (opts.json) {
|
|
2304
|
+
print(feed);
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
renderActivityFeed(feed);
|
|
2308
|
+
} catch (e) {
|
|
2309
|
+
fail(e);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
);
|
|
2227
2313
|
var reviewsCmd = program.command("reviews").description(
|
|
2228
2314
|
"The Knowledge Review queue \u2014 knowledge patches the critic proposes, investigations, and deduplicated failure signals awaiting a human decision"
|
|
2229
2315
|
);
|
|
@@ -2399,10 +2485,13 @@ pagesCmd.command("get <id>").description("Show an artifact").action(async (id) =
|
|
|
2399
2485
|
});
|
|
2400
2486
|
pagesCmd.command("review <url...>").description(
|
|
2401
2487
|
"Review external landing page URLs with Erdo's real conversion critic \u2014 typed defects (severity, issue, why it costs conversions, evidence, fix) plus strengths, judged from fold + full-page captures on desktop and mobile. Returns a review id; use --wait to poll and print the findings."
|
|
2402
|
-
).option("--wait", "poll until the review is ready, then print the findings").
|
|
2488
|
+
).option("--wait", "poll until the review is ready, then print the findings").option(
|
|
2489
|
+
"--goal <goal>",
|
|
2490
|
+
"what the page's campaign is trying to achieve ('book demos', 'brand awareness for a launch') \u2014 steers which conversion principles apply; a page whose evident form contradicts the goal is itself a finding"
|
|
2491
|
+
).action(async (urls, opts) => {
|
|
2403
2492
|
try {
|
|
2404
2493
|
const client = new ErdoClient();
|
|
2405
|
-
const started = await client.reviewPages(urls);
|
|
2494
|
+
const started = await client.reviewPages(urls, opts.goal);
|
|
2406
2495
|
if (!opts.wait) {
|
|
2407
2496
|
print(started);
|
|
2408
2497
|
return;
|