deploro 0.6.0 → 0.6.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 +30 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1473,8 +1473,38 @@ async function deployStatusCommand() {
|
|
|
1473
1473
|
console.log(` Branch : ${latest.git_branch ?? "(none)"}`);
|
|
1474
1474
|
console.log(` Started : ${new Date(latest.created_at).toLocaleString()}`);
|
|
1475
1475
|
console.log(` Finished: ${latest.finished_at ? new Date(latest.finished_at).toLocaleString() : "(in progress)"}`);
|
|
1476
|
+
if (latest.status === "failed") {
|
|
1477
|
+
const reason = await failureReason(config.projectId, latest.id);
|
|
1478
|
+
if (reason) {
|
|
1479
|
+
console.log("");
|
|
1480
|
+
console.log(` Reason : ${reason}`);
|
|
1481
|
+
}
|
|
1482
|
+
console.log("");
|
|
1483
|
+
console.log(` Full output: deploro deploy logs ${latest.id}`);
|
|
1484
|
+
}
|
|
1476
1485
|
console.log("");
|
|
1477
1486
|
}
|
|
1487
|
+
async function failureReason(projectId, deploymentId) {
|
|
1488
|
+
try {
|
|
1489
|
+
const data = await apiRequest(
|
|
1490
|
+
`/api/projects/${projectId}/deployments/${deploymentId}`
|
|
1491
|
+
);
|
|
1492
|
+
const d = data.deployment;
|
|
1493
|
+
if (typeof d.ai_error_summary === "string" && d.ai_error_summary.trim()) {
|
|
1494
|
+
return collapse(d.ai_error_summary);
|
|
1495
|
+
}
|
|
1496
|
+
if (typeof d.logs !== "string" || !d.logs.trim()) return null;
|
|
1497
|
+
const lines = d.logs.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
1498
|
+
const explicit = [...lines].reverse().find((l) => l.includes("[deploro] Deploy failed:"));
|
|
1499
|
+
return collapse(explicit ?? lines[lines.length - 1]);
|
|
1500
|
+
} catch {
|
|
1501
|
+
return null;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
function collapse(text) {
|
|
1505
|
+
const one = text.replace(/\s+/g, " ").trim();
|
|
1506
|
+
return one.length > 300 ? `${one.slice(0, 297)}...` : one;
|
|
1507
|
+
}
|
|
1478
1508
|
async function deployLogsCommand(deploymentId) {
|
|
1479
1509
|
const config = requireProject();
|
|
1480
1510
|
let id = deploymentId;
|
package/package.json
CHANGED