@erdoai/cli 0.253.0 → 0.256.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 +50 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2679,6 +2679,10 @@ var ErdoClient = class {
|
|
|
2679
2679
|
updatePage(pageID, input) {
|
|
2680
2680
|
return this.request("PUT", `/v1/pages/${encodeURIComponent(pageID)}`, input);
|
|
2681
2681
|
}
|
|
2682
|
+
getPageContentReview(pageID, reviewID) {
|
|
2683
|
+
const query = reviewID ? `?review_id=${encodeURIComponent(reviewID)}` : "";
|
|
2684
|
+
return this.request("GET", `/v1/pages/review/${encodeURIComponent(pageID)}${query}`);
|
|
2685
|
+
}
|
|
2682
2686
|
validatePage(input) {
|
|
2683
2687
|
return this.request("POST", "/v1/pages/validate", input);
|
|
2684
2688
|
}
|
|
@@ -3257,6 +3261,25 @@ function printPageReview(review) {
|
|
|
3257
3261
|
if (issue.suggestion) console.error(` fix: ${issue.suggestion}`);
|
|
3258
3262
|
}
|
|
3259
3263
|
}
|
|
3264
|
+
async function waitForPageContentReview(client, review) {
|
|
3265
|
+
const deadline = Date.now() + 20 * 6e4;
|
|
3266
|
+
while (review.status === "running") {
|
|
3267
|
+
if (Date.now() >= deadline) {
|
|
3268
|
+
throw new Error(`Review ${review.id} is still running. Read it with: erdo pages review ${review.page_id} --review-id ${review.id}`);
|
|
3269
|
+
}
|
|
3270
|
+
review = await client.getPageContentReview(review.page_id, review.id);
|
|
3271
|
+
if (review.status === "running") await new Promise((resolve2) => setTimeout(resolve2, 2e3));
|
|
3272
|
+
}
|
|
3273
|
+
if (review.status !== "ready" && review.status !== "failed") throw new Error(`Unknown review status for ${review.id}: ${review.status}`);
|
|
3274
|
+
return review;
|
|
3275
|
+
}
|
|
3276
|
+
async function showRequestedPageReview(review, wait = true) {
|
|
3277
|
+
if (!review) return;
|
|
3278
|
+
console.error(`review: ${review.id} (${review.status})`);
|
|
3279
|
+
if (wait) review = await waitForPageContentReview(new ErdoClient(), review);
|
|
3280
|
+
if (review.status === "failed") throw new Error(`Review ${review.id} failed: ${review.error || "unknown error"}`);
|
|
3281
|
+
printPageReview(review.result);
|
|
3282
|
+
}
|
|
3260
3283
|
function printAlignedTable(columns, rows) {
|
|
3261
3284
|
const cell = (v) => {
|
|
3262
3285
|
if (v === null || v === void 0) return "";
|
|
@@ -6880,7 +6903,7 @@ pagesCmd.command("deploy").description("Deploy a page (HTML/React); --html/--js/
|
|
|
6880
6903
|
).option(
|
|
6881
6904
|
"--required-modules <csv>",
|
|
6882
6905
|
"runtime modules the page needs (erdoui, landing); a page using the landing components renders blank without landing"
|
|
6883
|
-
).option("--robots-policy <policy>", "index_follow (the primary page of a custom host) or noindex_nofollow (ad variants)").option("--indexing-role <role>", "primary (the page a custom host should index) or variant (an A/B arm or angle sibling)").option("--structured-data <jsonOr@file>", "SEO structured data (schema.org JSON-LD): a JSON object with @type and name, or @path to a file").option("--datasets <csv>", "dataset slugs the page reads").option("--writable-datasets <csv>", "dataset slugs the page may write via erdo.insertRows").option("--kv <csv>", "named KV-store slugs the page reads").option("--writable-kv <csv>", "named KV-store slugs the page may write").option("--public", "make the page publicly viewable").action(
|
|
6906
|
+
).option("--robots-policy <policy>", "index_follow (the primary page of a custom host) or noindex_nofollow (ad variants)").option("--indexing-role <role>", "primary (the page a custom host should index) or variant (an A/B arm or angle sibling)").option("--structured-data <jsonOr@file>", "SEO structured data (schema.org JSON-LD): a JSON object with @type and name, or @path to a file").option("--datasets <csv>", "dataset slugs the page reads").option("--writable-datasets <csv>", "dataset slugs the page may write via erdo.insertRows").option("--kv <csv>", "named KV-store slugs the page reads").option("--writable-kv <csv>", "named KV-store slugs the page may write").option("--request-review", "start a saved page review and wait for the findings").option("--no-wait", "return the review id without polling for findings").option("--public", "make the page publicly viewable").action(
|
|
6884
6907
|
async (opts) => {
|
|
6885
6908
|
try {
|
|
6886
6909
|
const csv = (v) => v ? v.split(",").map((s) => s.trim()) : void 0;
|
|
@@ -6902,10 +6925,12 @@ pagesCmd.command("deploy").description("Deploy a page (HTML/React); --html/--js/
|
|
|
6902
6925
|
writable_dataset_slugs: csv(opts.writableDatasets),
|
|
6903
6926
|
kv_slugs: csv(opts.kv),
|
|
6904
6927
|
writable_kv_slugs: csv(opts.writableKv),
|
|
6905
|
-
public: !!opts.public
|
|
6928
|
+
public: !!opts.public,
|
|
6929
|
+
request_review: !!opts.requestReview
|
|
6906
6930
|
});
|
|
6907
6931
|
console.log(`${res.id} ${res.public_url || res.url}`);
|
|
6908
6932
|
if (res.warning) console.error(`warning: ${res.warning}`);
|
|
6933
|
+
await showRequestedPageReview(res.review, opts.wait !== false);
|
|
6909
6934
|
} catch (e) {
|
|
6910
6935
|
fail(e);
|
|
6911
6936
|
}
|
|
@@ -6933,8 +6958,8 @@ pagesCmd.command("update <id>").description(
|
|
|
6933
6958
|
'replacement runtime module list (comma-separated; "[]" clears)'
|
|
6934
6959
|
).option("--robots-policy <policy>", "new robots policy: index_follow (the primary page of a custom host) or noindex_nofollow (ad variants)").option("--indexing-role <role>", "primary (the page a custom host should index) or variant (an A/B arm or angle sibling)").option("--structured-data <jsonOr@file>", "SEO structured data (schema.org JSON-LD): a JSON object with @type and name, or @path to a file").option("--datasets <csv>", 'replacement read-dataset slugs ("[]" clears)').option("--writable-datasets <csv>", 'replacement writable-dataset slugs ("[]" clears)').option("--kv <csv>", 'replacement read KV-store slugs ("[]" clears)').option("--writable-kv <csv>", 'replacement writable KV-store slugs ("[]" clears)').option("--public", "make the page publicly viewable").option("--private", "make the page private").option(
|
|
6935
6960
|
"--request-review",
|
|
6936
|
-
"
|
|
6937
|
-
).action(
|
|
6961
|
+
"start a saved review and wait for findings; use for material live-page edits"
|
|
6962
|
+
).option("--no-wait", "return the review id without polling for findings").action(
|
|
6938
6963
|
async (id, opts) => {
|
|
6939
6964
|
try {
|
|
6940
6965
|
const res = await new ErdoClient().updatePage(id, {
|
|
@@ -6963,7 +6988,7 @@ pagesCmd.command("update <id>").description(
|
|
|
6963
6988
|
});
|
|
6964
6989
|
console.log(`${res.id} ${res.public_url || res.url}`);
|
|
6965
6990
|
if (res.warning) console.error(`warning: ${res.warning}`);
|
|
6966
|
-
|
|
6991
|
+
await showRequestedPageReview(res.review, opts.wait !== false);
|
|
6967
6992
|
} catch (e) {
|
|
6968
6993
|
fail(e);
|
|
6969
6994
|
}
|
|
@@ -7075,9 +7100,9 @@ pagesCmd.command("get <id>").description("Show an artifact").action(async (id) =
|
|
|
7075
7100
|
fail(e);
|
|
7076
7101
|
}
|
|
7077
7102
|
});
|
|
7078
|
-
pagesCmd.command("review <url...>").description(
|
|
7079
|
-
"
|
|
7080
|
-
).option("--wait", "poll until the review is ready, then print the findings").option(
|
|
7103
|
+
pagesCmd.command("review <page-or-url...>").description(
|
|
7104
|
+
"Read the latest saved review for a page ID, or start a conversion review of external URLs. Use --review-id for a specific saved page review, and --wait to poll until ready."
|
|
7105
|
+
).option("--review-id <id>", "read a specific invocation for a page ID").option("--wait", "poll until the review is ready, then print the findings").option(
|
|
7081
7106
|
"--goal <goal>",
|
|
7082
7107
|
"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"
|
|
7083
7108
|
).option(
|
|
@@ -7086,6 +7111,23 @@ pagesCmd.command("review <url...>").description(
|
|
|
7086
7111
|
).action(async (urls, opts) => {
|
|
7087
7112
|
try {
|
|
7088
7113
|
const client = new ErdoClient();
|
|
7114
|
+
const isURL = (value) => {
|
|
7115
|
+
try {
|
|
7116
|
+
const parsed = new URL(value);
|
|
7117
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
7118
|
+
} catch {
|
|
7119
|
+
return false;
|
|
7120
|
+
}
|
|
7121
|
+
};
|
|
7122
|
+
if (urls.length === 1 && !isURL(urls[0])) {
|
|
7123
|
+
if (opts.goal || opts.audience) throw new Error("--goal and --audience apply to external URL reviews");
|
|
7124
|
+
let review = await client.getPageContentReview(urls[0], opts.reviewId);
|
|
7125
|
+
if (opts.wait) review = await waitForPageContentReview(client, review);
|
|
7126
|
+
print(review);
|
|
7127
|
+
if (review.status === "failed") throw new Error(`Review ${review.id} failed: ${review.error || "unknown error"}`);
|
|
7128
|
+
return;
|
|
7129
|
+
}
|
|
7130
|
+
if (opts.reviewId) throw new Error("--review-id applies to a saved review for a page ID");
|
|
7089
7131
|
const started = await client.reviewPages(urls, opts.goal, opts.audience);
|
|
7090
7132
|
if (!opts.wait) {
|
|
7091
7133
|
print(started);
|