@audienti/cli 0.1.6 → 0.1.7
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/cli.js +34 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to the Audienti CLI are documented here.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.1.7] - 2026-07-12
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Show writer test-run target-step error status and warnings when a draft fails instead of rendering an empty drafted-copy block.
|
|
12
|
+
|
|
7
13
|
## [0.1.6] - 2026-07-12
|
|
8
14
|
|
|
9
15
|
### Added
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1113,7 +1113,7 @@ function writerCachedDraftsForRequest(cache, branchFilter) {
|
|
|
1113
1113
|
const branchKeys = writerRequestedBranchKeys(branchFilter);
|
|
1114
1114
|
return Object.values(cache.entries || {})
|
|
1115
1115
|
.filter((entry) => branchKeys.includes(entry.branch))
|
|
1116
|
-
.filter((entry) => entry.key && (entry.body || entry.text || entry.subject))
|
|
1116
|
+
.filter((entry) => entry.key && (entry.body || entry.text || entry.subject || writerCacheQualityFailure(entry)))
|
|
1117
1117
|
.map((entry) => compactObject({
|
|
1118
1118
|
branch: entry.branch,
|
|
1119
1119
|
key: entry.key,
|
|
@@ -1125,6 +1125,9 @@ function writerCachedDraftsForRequest(cache, branchFilter) {
|
|
|
1125
1125
|
body: entry.body,
|
|
1126
1126
|
text: entry.text,
|
|
1127
1127
|
status: entry.status,
|
|
1128
|
+
quality_codes: entry.quality_codes,
|
|
1129
|
+
blank_reason: entry.blank_reason,
|
|
1130
|
+
writer_path: entry.writer_path,
|
|
1128
1131
|
generated_at: entry.generated_at,
|
|
1129
1132
|
writer_engine: entry.writer_engine,
|
|
1130
1133
|
target: entry.target,
|
|
@@ -1187,7 +1190,7 @@ async function persistWriterDraftsFromPayload(context, { cache, payload }) {
|
|
|
1187
1190
|
function writerCacheEntryFromStep(step, { branchKey, generatedAt }) {
|
|
1188
1191
|
if (step?.kind !== "message") return null;
|
|
1189
1192
|
if (!step.key) return null;
|
|
1190
|
-
if (!(step.body || step.text || step.subject)) return null;
|
|
1193
|
+
if (!(step.body || step.text || step.subject || writerCacheQualityFailure(step))) return null;
|
|
1191
1194
|
if (step.status === "planned" || step.status === "unavailable" || step.status === "error") return null;
|
|
1192
1195
|
|
|
1193
1196
|
return compactObject({
|
|
@@ -1201,8 +1204,11 @@ function writerCacheEntryFromStep(step, { branchKey, generatedAt }) {
|
|
|
1201
1204
|
body: step.body,
|
|
1202
1205
|
text: step.text,
|
|
1203
1206
|
status: step.status,
|
|
1207
|
+
quality_codes: Array.isArray(step.quality_codes) ? step.quality_codes.filter(Boolean) : undefined,
|
|
1208
|
+
blank_reason: step.blank_reason,
|
|
1209
|
+
writer_path: step.writer_path,
|
|
1204
1210
|
generated_at: step.generated_at || generatedAt || new Date().toISOString(),
|
|
1205
|
-
writer_engine: step?.metadata?.writer_engine,
|
|
1211
|
+
writer_engine: step.writer_engine || step?.metadata?.writer_engine,
|
|
1206
1212
|
target: step.target,
|
|
1207
1213
|
metadata: step.metadata
|
|
1208
1214
|
});
|
|
@@ -1212,6 +1218,10 @@ function writerCacheEntryKey(entry) {
|
|
|
1212
1218
|
return `${entry.branch}:${entry.key}`;
|
|
1213
1219
|
}
|
|
1214
1220
|
|
|
1221
|
+
function writerCacheQualityFailure(entry) {
|
|
1222
|
+
return String(entry?.status || "") === "quality_failure";
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1215
1225
|
async function prospectsImport(args, context, { accountOverride } = {}) {
|
|
1216
1226
|
const { values, positionals } = parseCommandArgs(args, {
|
|
1217
1227
|
...jsonOptions(),
|
|
@@ -2343,7 +2353,7 @@ function renderWriterStepRow(step, index, context) {
|
|
|
2343
2353
|
fixedWidth(compactKindLabel(step.kind), 4),
|
|
2344
2354
|
fixedWidth(writerStepAction(step), 42),
|
|
2345
2355
|
fixedWidth(compactChannelLabel(step.channel), 7),
|
|
2346
|
-
fixedWidth(
|
|
2356
|
+
fixedWidth(compactWriterStatusLabel(step.status), 9)
|
|
2347
2357
|
].join(" ");
|
|
2348
2358
|
writeLine(context.stdout, row);
|
|
2349
2359
|
}
|
|
@@ -2359,8 +2369,21 @@ function renderWriterTargetDraft(branch, context) {
|
|
|
2359
2369
|
writeLine(context.stdout, `Drafted copy: ${display(draftedStep.stage)}${branch.resolved_target_step ? ` (${branch.resolved_target_step})` : ""}`);
|
|
2360
2370
|
const targetUrl = writerDraftTargetUrl(draftedStep);
|
|
2361
2371
|
if (targetUrl) writeLine(context.stdout, `Replying to: ${targetUrl}`);
|
|
2372
|
+
if (draftedStep.status && draftedStep.status !== "success") writeLine(context.stdout, `Status: ${draftedStep.status}`);
|
|
2373
|
+
if (String(draftedStep.status || "") === "quality_failure") {
|
|
2374
|
+
const qualityCodes = Array.isArray(draftedStep.quality_codes) ? draftedStep.quality_codes.filter(Boolean) : [];
|
|
2375
|
+
if (qualityCodes.length) writeLine(context.stdout, `Quality failure: ${qualityCodes.join(", ")}`);
|
|
2376
|
+
if (draftedStep.blank_reason) writeLine(context.stdout, `Blank reason: ${draftedStep.blank_reason}`);
|
|
2377
|
+
if (draftedStep.writer_path) writeLine(context.stdout, `Writer path: ${draftedStep.writer_path}`);
|
|
2378
|
+
if (draftedStep.writer_engine) writeLine(context.stdout, `Writer engine: ${draftedStep.writer_engine}`);
|
|
2379
|
+
}
|
|
2380
|
+
for (const warning of Array.isArray(draftedStep.warnings) ? draftedStep.warnings : []) {
|
|
2381
|
+
if (warning) writeLine(context.stdout, `Warning: ${warning}`);
|
|
2382
|
+
}
|
|
2383
|
+
if (draftedStep.missing_reason) writeLine(context.stdout, `Missing reason: ${draftedStep.missing_reason}`);
|
|
2362
2384
|
if (draftedStep.subject) writeLine(context.stdout, `Subject: ${draftedStep.subject}`);
|
|
2363
|
-
|
|
2385
|
+
const body = draftedStep.body || draftedStep.text || draftedStep.empty_body_reason;
|
|
2386
|
+
writeLine(context.stdout, display(body || "No draft body returned."));
|
|
2364
2387
|
}
|
|
2365
2388
|
|
|
2366
2389
|
function writerDraftTargetUrl(step) {
|
|
@@ -2414,6 +2437,12 @@ function compactChannelLabel(channel) {
|
|
|
2414
2437
|
return value;
|
|
2415
2438
|
}
|
|
2416
2439
|
|
|
2440
|
+
function compactWriterStatusLabel(status) {
|
|
2441
|
+
const value = String(display(status));
|
|
2442
|
+
if (value === "quality_failure") return "quality";
|
|
2443
|
+
return value;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2417
2446
|
function fixedWidth(value, width, options = {}) {
|
|
2418
2447
|
const text = truncateCliText(value, width);
|
|
2419
2448
|
return options.align === "right" ? text.padStart(width) : text.padEnd(width);
|