@brainbase-labs/cli 0.4.1 → 0.4.2
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 +16 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33782,7 +33782,7 @@ var BrainbaseSourceSchema = exports_external.object({
|
|
|
33782
33782
|
type: exports_external.literal("brainbase"),
|
|
33783
33783
|
creator: exports_external.string().regex(/^[a-z0-9_-]+$/i),
|
|
33784
33784
|
slug: exports_external.string().regex(/^[a-z0-9_-]+$/i),
|
|
33785
|
-
version: exports_external.string().regex(/^\d+\.\d+\.\d+$/)
|
|
33785
|
+
version: exports_external.string().regex(/^\d+\.\d+\.\d+$/).optional()
|
|
33786
33786
|
});
|
|
33787
33787
|
var InlineSourceSchema = exports_external.object({ type: exports_external.literal("inline") });
|
|
33788
33788
|
var LocalSourceSchema = exports_external.object({ type: exports_external.literal("local") });
|
|
@@ -48541,7 +48541,7 @@ function parseSkillSource(input) {
|
|
|
48541
48541
|
type: "brainbase",
|
|
48542
48542
|
creator: bb[1],
|
|
48543
48543
|
slug: bb[2],
|
|
48544
|
-
version: bb[3]
|
|
48544
|
+
version: bb[3]
|
|
48545
48545
|
};
|
|
48546
48546
|
}
|
|
48547
48547
|
if (s3.startsWith("file://") || s3.startsWith("./") || s3.startsWith("../") || s3.startsWith("/") || s3.startsWith("~")) {
|
|
@@ -48616,7 +48616,7 @@ function describeSource(source) {
|
|
|
48616
48616
|
case "git":
|
|
48617
48617
|
return `git:${source.url}${source.ref ? "@" + source.ref : ""}${source.subpath ? " (" + source.subpath + ")" : ""}`;
|
|
48618
48618
|
case "brainbase":
|
|
48619
|
-
return `brainbase://${source.creator}/${source.slug}
|
|
48619
|
+
return `brainbase://${source.creator}/${source.slug}${source.version ? "@" + source.version : " (latest)"}`;
|
|
48620
48620
|
}
|
|
48621
48621
|
}
|
|
48622
48622
|
|
|
@@ -49722,14 +49722,24 @@ var brainbaseResolver = {
|
|
|
49722
49722
|
if (source.type !== "brainbase") {
|
|
49723
49723
|
throw new Error("expected brainbase source");
|
|
49724
49724
|
}
|
|
49725
|
-
|
|
49725
|
+
let version = source.version;
|
|
49726
|
+
if (!version) {
|
|
49727
|
+
const pkg = await skillsApi.getPackage(source.creator, source.slug);
|
|
49728
|
+
const latest = pkg.latest_version;
|
|
49729
|
+
if (!latest) {
|
|
49730
|
+
throw new Error(`${source.creator}/${source.slug} has no published versions`);
|
|
49731
|
+
}
|
|
49732
|
+
version = latest.version;
|
|
49733
|
+
source.version = version;
|
|
49734
|
+
}
|
|
49735
|
+
const remoteVersion = await skillsApi.getVersion(source.creator, source.slug, version);
|
|
49726
49736
|
if (remoteVersion.yanked) {
|
|
49727
|
-
throw new Error(`${source.creator}/${source.slug}@${
|
|
49737
|
+
throw new Error(`${source.creator}/${source.slug}@${version} has been yanked${remoteVersion.yanked_reason ? ": " + remoteVersion.yanked_reason : ""}`);
|
|
49728
49738
|
}
|
|
49729
49739
|
const tmp = fs33.mkdtempSync(path36.join(os8.tmpdir(), "bb-skill-"));
|
|
49730
49740
|
const tarPath = path36.join(tmp, "skill.tgz");
|
|
49731
49741
|
try {
|
|
49732
|
-
await skillsApi.downloadTarball(source.creator, source.slug,
|
|
49742
|
+
await skillsApi.downloadTarball(source.creator, source.slug, version, tarPath);
|
|
49733
49743
|
await verifyTarball(tarPath, remoteVersion.bundle_sha256);
|
|
49734
49744
|
ensureDir(destDir);
|
|
49735
49745
|
await extract({ tarFile: tarPath, outDir: destDir });
|