@erdoai/cli 0.58.0 → 0.59.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/dist/index.js +73 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -579,6 +579,14 @@ var ErdoClient = class {
|
|
|
579
579
|
input
|
|
580
580
|
);
|
|
581
581
|
}
|
|
582
|
+
// --- page feedback ---
|
|
583
|
+
// Structured client page-feedback intake. Each item names its page by
|
|
584
|
+
// experiment_slug + variant_key and mints a 'defect' observation (judge_slug
|
|
585
|
+
// human:<you>) on the ledger with the feedback text stored verbatim as the
|
|
586
|
+
// reason — the same channel respondAttentionItem's defects flag writes to.
|
|
587
|
+
recordPageFeedback(items) {
|
|
588
|
+
return this.request("POST", "/v1/page-feedback", { items });
|
|
589
|
+
}
|
|
582
590
|
// --- activity feed ---
|
|
583
591
|
// The unified, ranked, read-only feed. It defaults to attention items,
|
|
584
592
|
// approvals, and workstream events; catalog and execution history are opt-in.
|
|
@@ -1392,6 +1400,12 @@ function printPageReview(review) {
|
|
|
1392
1400
|
return;
|
|
1393
1401
|
}
|
|
1394
1402
|
console.error(`review: ${review.summary || `${review.issues?.length ?? 0} issue(s)`}`);
|
|
1403
|
+
if (review.lighthouse) {
|
|
1404
|
+
const score = (value) => value === void 0 ? "unavailable" : `${value}/100`;
|
|
1405
|
+
console.error(
|
|
1406
|
+
` lighthouse (mobile): performance ${score(review.lighthouse.performance)}, accessibility ${score(review.lighthouse.accessibility)}, best practices ${score(review.lighthouse.best_practices)}, seo ${score(review.lighthouse.seo)}`
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1395
1409
|
for (const issue of review.issues || []) {
|
|
1396
1410
|
console.error(` [${issue.severity}/${issue.category}] ${issue.description}`);
|
|
1397
1411
|
if (issue.suggestion) console.error(` fix: ${issue.suggestion}`);
|
|
@@ -2077,7 +2091,7 @@ expCmd.command("create").description("Create an experiment with its variants, ev
|
|
|
2077
2091
|
}
|
|
2078
2092
|
}
|
|
2079
2093
|
);
|
|
2080
|
-
expCmd.command("observations <slug>").description("Read an experiment's observation log (
|
|
2094
|
+
expCmd.command("observations <slug>").description("Read an experiment's observation log (metrics / decisions / actions / judge forecasts / defects)").option("--variant <key>", "filter to one variant").option("--type <type>", "metric_read, decision_check, action_taken, prediction, comparison, defect").option("--judge <slug>", "filter to one judge's forecasts within this experiment").option("-n, --limit <n>", "max rows", (v) => parseInt(v, 10)).action(
|
|
2081
2095
|
async (slug, opts) => {
|
|
2082
2096
|
try {
|
|
2083
2097
|
print(
|
|
@@ -3105,6 +3119,64 @@ attnCmd.command("respond <id>").description(
|
|
|
3105
3119
|
}
|
|
3106
3120
|
}
|
|
3107
3121
|
);
|
|
3122
|
+
var pageFeedbackCmd = program.command("page-feedback").description(
|
|
3123
|
+
"Structured client page-feedback intake \u2014 mints defect observations bound to a page's experiment variant"
|
|
3124
|
+
);
|
|
3125
|
+
pageFeedbackCmd.command("record").description(
|
|
3126
|
+
"Record one or more page-feedback items. Each item's feedback text is stored VERBATIM as the resulting defect observation's reason \u2014 no summarizing or rewriting happens here. Use --experiment/--variant/--feedback for a single item, or --items for a whole round."
|
|
3127
|
+
).option("--experiment <slug>", "experiment slug or uuid the page belongs to (single-item form)").option("--variant <key>", "the page variant this feedback is about (single-item form)").option(
|
|
3128
|
+
"--feedback <text>",
|
|
3129
|
+
"the client's own words, stored byte-for-byte as supplied (single-item form)"
|
|
3130
|
+
).option(
|
|
3131
|
+
"--image-key <key>",
|
|
3132
|
+
"optional bucket_key from a prior image upload, anchoring this item to an image (single-item form)"
|
|
3133
|
+
).option(
|
|
3134
|
+
"--items <json>",
|
|
3135
|
+
`a whole feedback round as JSON, or @path to a JSON file: '[{"experiment_slug":"...","variant_key":"...","feedback":"..."}]'`
|
|
3136
|
+
).action(
|
|
3137
|
+
async (opts) => {
|
|
3138
|
+
try {
|
|
3139
|
+
const singleGiven = opts.experiment !== void 0 || opts.variant !== void 0 || opts.feedback !== void 0 || opts.imageKey !== void 0;
|
|
3140
|
+
if (opts.items !== void 0 && singleGiven) {
|
|
3141
|
+
fail(
|
|
3142
|
+
new Error(
|
|
3143
|
+
"provide either --items or the single-item flags (--experiment/--variant/--feedback/--image-key), not both"
|
|
3144
|
+
)
|
|
3145
|
+
);
|
|
3146
|
+
}
|
|
3147
|
+
let items;
|
|
3148
|
+
if (opts.items !== void 0) {
|
|
3149
|
+
let parsed;
|
|
3150
|
+
try {
|
|
3151
|
+
parsed = JSON.parse(readMaybeFile(opts.items));
|
|
3152
|
+
} catch {
|
|
3153
|
+
throw new Error(
|
|
3154
|
+
`--items must be valid JSON (or @path to a JSON file), e.g. '[{"experiment_slug":"...","variant_key":"...","feedback":"..."}]'`
|
|
3155
|
+
);
|
|
3156
|
+
}
|
|
3157
|
+
if (!Array.isArray(parsed)) {
|
|
3158
|
+
throw new Error("--items must be a JSON array of {experiment_slug, variant_key, feedback} objects");
|
|
3159
|
+
}
|
|
3160
|
+
items = parsed;
|
|
3161
|
+
} else {
|
|
3162
|
+
if (!opts.experiment || !opts.variant || !opts.feedback) {
|
|
3163
|
+
throw new Error("provide --items, or all of --experiment, --variant, --feedback");
|
|
3164
|
+
}
|
|
3165
|
+
items = [
|
|
3166
|
+
{
|
|
3167
|
+
experiment_slug: opts.experiment,
|
|
3168
|
+
variant_key: opts.variant,
|
|
3169
|
+
feedback: opts.feedback,
|
|
3170
|
+
image_bucket_key: opts.imageKey
|
|
3171
|
+
}
|
|
3172
|
+
];
|
|
3173
|
+
}
|
|
3174
|
+
print(await new ErdoClient().recordPageFeedback(items));
|
|
3175
|
+
} catch (e) {
|
|
3176
|
+
fail(e);
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
);
|
|
3108
3180
|
function activityLine(it) {
|
|
3109
3181
|
const handle = it.slug || it.id;
|
|
3110
3182
|
const parts = [it.title || it.type];
|