ht-skills 0.2.8 → 0.2.9
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/lib/cli.js +74 -39
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -1538,6 +1538,10 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1538
1538
|
width: Math.max(44, Math.min(outputWidth - 4, 72)),
|
|
1539
1539
|
}));
|
|
1540
1540
|
};
|
|
1541
|
+
const setFlowStatus = (stepId, status) => {
|
|
1542
|
+
flowState[stepId] = status;
|
|
1543
|
+
renderPublishFlow();
|
|
1544
|
+
};
|
|
1541
1545
|
|
|
1542
1546
|
if (ui) {
|
|
1543
1547
|
// eslint-disable-next-line no-console
|
|
@@ -1557,48 +1561,70 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1557
1561
|
printFallbackPublishIntro({ registry, skillDir, archiveName, visibility }, log);
|
|
1558
1562
|
}
|
|
1559
1563
|
|
|
1560
|
-
|
|
1564
|
+
setFlowStatus("auth", "active");
|
|
1561
1565
|
if (!ui) {
|
|
1562
1566
|
log(`Checking login for ${registry}...`);
|
|
1563
1567
|
}
|
|
1564
1568
|
const { token } = await ensureValidAuthToken(registry, flags, deps);
|
|
1565
|
-
|
|
1569
|
+
setFlowStatus("auth", "done");
|
|
1566
1570
|
|
|
1567
1571
|
const packSpinner = ui ? ui.spinner() : null;
|
|
1568
|
-
|
|
1572
|
+
setFlowStatus("pack", "active");
|
|
1569
1573
|
if (packSpinner) {
|
|
1570
1574
|
packSpinner.start(`Packing ${path.basename(skillDir) || skillDir}`);
|
|
1571
1575
|
} else {
|
|
1572
1576
|
log(`Packing skill directory: ${skillDir}`);
|
|
1573
1577
|
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1578
|
+
let archiveBuffer;
|
|
1579
|
+
try {
|
|
1580
|
+
archiveBuffer = await createZipFromDirectory(skillDir);
|
|
1581
|
+
setFlowStatus("pack", "done");
|
|
1582
|
+
if (packSpinner) {
|
|
1583
|
+
packSpinner.stop(`Created ${archiveName} (${formatBytes(archiveBuffer.length)})`);
|
|
1584
|
+
} else {
|
|
1585
|
+
log(`Created archive ${archiveName} (${formatBytes(archiveBuffer.length)})`);
|
|
1586
|
+
}
|
|
1587
|
+
} catch (error) {
|
|
1588
|
+
setFlowStatus("pack", "error");
|
|
1589
|
+
if (packSpinner) {
|
|
1590
|
+
packSpinner.stop("Packing failed");
|
|
1591
|
+
}
|
|
1592
|
+
throw error;
|
|
1580
1593
|
}
|
|
1581
1594
|
|
|
1582
1595
|
const uploadSpinner = ui ? ui.spinner() : null;
|
|
1583
|
-
|
|
1596
|
+
setFlowStatus("inspect", "active");
|
|
1584
1597
|
if (uploadSpinner) {
|
|
1585
1598
|
uploadSpinner.start("Uploading archive for package inspection");
|
|
1586
1599
|
} else {
|
|
1587
1600
|
log("Uploading archive for package inspection...");
|
|
1588
1601
|
}
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1602
|
+
let job;
|
|
1603
|
+
try {
|
|
1604
|
+
job = await requestJsonImpl(
|
|
1605
|
+
`${registry}/api/skills/inspect-package-jobs/upload?archive_name=${encodeURIComponent(archiveName)}`,
|
|
1606
|
+
{
|
|
1607
|
+
method: "POST",
|
|
1608
|
+
headers: withBearerToken({
|
|
1609
|
+
"content-type": "application/zip",
|
|
1610
|
+
}, token),
|
|
1611
|
+
body: archiveBuffer,
|
|
1612
|
+
},
|
|
1613
|
+
);
|
|
1614
|
+
} catch (error) {
|
|
1615
|
+
setFlowStatus("inspect", "error");
|
|
1616
|
+
if (uploadSpinner) {
|
|
1617
|
+
uploadSpinner.stop("Inspection upload failed");
|
|
1618
|
+
}
|
|
1619
|
+
throw error;
|
|
1620
|
+
}
|
|
1599
1621
|
|
|
1600
1622
|
const jobId = String(job.job_id || "").trim();
|
|
1601
1623
|
if (!jobId) {
|
|
1624
|
+
setFlowStatus("inspect", "error");
|
|
1625
|
+
if (uploadSpinner) {
|
|
1626
|
+
uploadSpinner.stop("Inspection upload failed");
|
|
1627
|
+
}
|
|
1602
1628
|
throw new Error("registry did not return an inspection job id");
|
|
1603
1629
|
}
|
|
1604
1630
|
if (uploadSpinner) {
|
|
@@ -1617,7 +1643,7 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1617
1643
|
}
|
|
1618
1644
|
while (inspection.status !== "succeeded" && inspection.status !== "failed") {
|
|
1619
1645
|
if (Date.now() > publishDeadline) {
|
|
1620
|
-
|
|
1646
|
+
setFlowStatus("inspect", "error");
|
|
1621
1647
|
if (inspectSpinner) {
|
|
1622
1648
|
inspectSpinner.stop("Inspection timed out");
|
|
1623
1649
|
}
|
|
@@ -1636,7 +1662,7 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1636
1662
|
} catch (error) {
|
|
1637
1663
|
consecutivePollErrors += 1;
|
|
1638
1664
|
if (consecutivePollErrors >= pollErrorLimit) {
|
|
1639
|
-
|
|
1665
|
+
setFlowStatus("inspect", "error");
|
|
1640
1666
|
if (inspectSpinner) {
|
|
1641
1667
|
inspectSpinner.stop("Inspection polling failed");
|
|
1642
1668
|
}
|
|
@@ -1650,7 +1676,7 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1650
1676
|
|
|
1651
1677
|
const runtimeError = String(inspection.error?.message || inspection.error || "").trim();
|
|
1652
1678
|
if (runtimeError && inspection.status !== "succeeded") {
|
|
1653
|
-
|
|
1679
|
+
setFlowStatus("inspect", "error");
|
|
1654
1680
|
if (inspectSpinner) {
|
|
1655
1681
|
inspectSpinner.stop("Inspection failed");
|
|
1656
1682
|
}
|
|
@@ -1674,13 +1700,13 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1674
1700
|
}
|
|
1675
1701
|
|
|
1676
1702
|
if (inspection.status !== "succeeded") {
|
|
1677
|
-
|
|
1703
|
+
setFlowStatus("inspect", "error");
|
|
1678
1704
|
if (inspectSpinner) {
|
|
1679
1705
|
inspectSpinner.stop("Inspection failed");
|
|
1680
1706
|
}
|
|
1681
1707
|
throw new Error(inspection.error || "skill archive inspection failed");
|
|
1682
1708
|
}
|
|
1683
|
-
|
|
1709
|
+
setFlowStatus("inspect", "done");
|
|
1684
1710
|
if (inspectSpinner) {
|
|
1685
1711
|
inspectSpinner.stop("Inspection passed");
|
|
1686
1712
|
} else {
|
|
@@ -1689,6 +1715,7 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1689
1715
|
|
|
1690
1716
|
const preview = inspection.result || {};
|
|
1691
1717
|
if (!preview.valid || !preview.preview_token) {
|
|
1718
|
+
setFlowStatus("inspect", "error");
|
|
1692
1719
|
throw new Error(summarizePreviewErrors(preview));
|
|
1693
1720
|
}
|
|
1694
1721
|
if (!ui) {
|
|
@@ -1710,24 +1737,33 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1710
1737
|
}
|
|
1711
1738
|
|
|
1712
1739
|
const submitSpinner = ui ? ui.spinner() : null;
|
|
1713
|
-
|
|
1740
|
+
setFlowStatus("submit", "active");
|
|
1714
1741
|
if (submitSpinner) {
|
|
1715
1742
|
submitSpinner.start(`Submitting review request (${visibility})`);
|
|
1716
1743
|
} else {
|
|
1717
1744
|
log(`Submitting review request with access=${visibility}...`);
|
|
1718
1745
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1746
|
+
let result;
|
|
1747
|
+
try {
|
|
1748
|
+
result = await requestJsonImpl(`${registry}/api/skills/submit`, {
|
|
1749
|
+
method: "POST",
|
|
1750
|
+
headers: withBearerToken({
|
|
1751
|
+
"content-type": "application/json",
|
|
1752
|
+
}, token),
|
|
1753
|
+
body: JSON.stringify(body),
|
|
1754
|
+
});
|
|
1755
|
+
setFlowStatus("submit", "done");
|
|
1756
|
+
if (submitSpinner) {
|
|
1757
|
+
submitSpinner.stop(`Review submission created (${result.submission_id || "pending"})`);
|
|
1758
|
+
} else {
|
|
1759
|
+
log(`Review submission created: ${result.submission_id || "(no submission id returned)"}`);
|
|
1760
|
+
}
|
|
1761
|
+
} catch (error) {
|
|
1762
|
+
setFlowStatus("submit", "error");
|
|
1763
|
+
if (submitSpinner) {
|
|
1764
|
+
submitSpinner.stop("Submit failed");
|
|
1765
|
+
}
|
|
1766
|
+
throw error;
|
|
1731
1767
|
}
|
|
1732
1768
|
|
|
1733
1769
|
const summaryPayload = {
|
|
@@ -1750,7 +1786,6 @@ async function cmdPublish(flags, deps = {}) {
|
|
|
1750
1786
|
].join("\n"),
|
|
1751
1787
|
"Published",
|
|
1752
1788
|
);
|
|
1753
|
-
renderPublishFlow();
|
|
1754
1789
|
ui.outro(`Submitted ${ui.pc.cyan(archiveName)} for review.`);
|
|
1755
1790
|
} else {
|
|
1756
1791
|
log(JSON.stringify(summaryPayload, null, 2));
|