@erdoai/cli 0.154.0 → 0.155.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 +26 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2009,6 +2009,9 @@ var ErdoClient = class {
|
|
|
2009
2009
|
if (audience) body.audience = audience;
|
|
2010
2010
|
return this.request("POST", "/v1/page-reviews", body);
|
|
2011
2011
|
}
|
|
2012
|
+
reviewAd(input) {
|
|
2013
|
+
return this.request("POST", "/v1/critic/reviews", input);
|
|
2014
|
+
}
|
|
2012
2015
|
getPageReview(id) {
|
|
2013
2016
|
return this.request("GET", `/v1/page-reviews/${encodeURIComponent(id)}`);
|
|
2014
2017
|
}
|
|
@@ -5811,6 +5814,29 @@ reviewsCmd.command("decide <id>").description(
|
|
|
5811
5814
|
}
|
|
5812
5815
|
);
|
|
5813
5816
|
var pagesCmd = program.command("pages").description("Create and manage pages/artifacts");
|
|
5817
|
+
var criticCmd = program.command("critic").description("Review campaign creative");
|
|
5818
|
+
criticCmd.command("review").description("Review an ad creative request from a JSON file and print per-lens findings").requiredOption("-f, --file <path>", "JSON file containing the full critic review request envelope").option("--json", "print the complete raw JSON response").action(async (opts) => {
|
|
5819
|
+
try {
|
|
5820
|
+
const input = JSON.parse(readFileSync4(opts.file, "utf8"));
|
|
5821
|
+
const result = await new ErdoClient().reviewAd(input);
|
|
5822
|
+
if (opts.json) {
|
|
5823
|
+
print(result);
|
|
5824
|
+
return;
|
|
5825
|
+
}
|
|
5826
|
+
console.log(result.summary);
|
|
5827
|
+
for (const lens of result.lenses) {
|
|
5828
|
+
console.log(`
|
|
5829
|
+
${lens.lens_slug}: ${lens.summary}`);
|
|
5830
|
+
for (const finding of lens.findings) {
|
|
5831
|
+
console.log(` [${finding.severity}] ${finding.issue}`);
|
|
5832
|
+
console.log(` Evidence: ${finding.evidence}`);
|
|
5833
|
+
console.log(` Suggested rewrite: ${finding.suggested_rewrite}`);
|
|
5834
|
+
}
|
|
5835
|
+
}
|
|
5836
|
+
} catch (e) {
|
|
5837
|
+
fail(e);
|
|
5838
|
+
}
|
|
5839
|
+
});
|
|
5814
5840
|
function publicFlag(opts) {
|
|
5815
5841
|
if (opts.public) return true;
|
|
5816
5842
|
if (opts.private) return false;
|