@solgridai/cli 0.2.0-beta.2 → 0.2.0-beta.3
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 +19 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2075,7 +2075,7 @@ function useColor() {
|
|
|
2075
2075
|
// node_modules/commander/index.js
|
|
2076
2076
|
var program = new Command;
|
|
2077
2077
|
// src/build-info.ts
|
|
2078
|
-
var buildInfo = { packageName: "@solgridai/cli", version: "0.2.0-beta.
|
|
2078
|
+
var buildInfo = { packageName: "@solgridai/cli", version: "0.2.0-beta.3" };
|
|
2079
2079
|
|
|
2080
2080
|
// src/core/errors.ts
|
|
2081
2081
|
class CliError extends Error {
|
|
@@ -4894,7 +4894,8 @@ be changed later.`);
|
|
|
4894
4894
|
const client = apiClient(ctx);
|
|
4895
4895
|
out.progress.start("Fetching Skill…");
|
|
4896
4896
|
const skill = await findSkill(client, target);
|
|
4897
|
-
|
|
4897
|
+
const tagNames = opts.json ? undefined : await tagNamesFor(client, skill.tags);
|
|
4898
|
+
out.result(skill, () => renderSkill(skill, out.style, tagNames));
|
|
4898
4899
|
}));
|
|
4899
4900
|
skills.command("tags").description(`List the tags a Skill can carry (up to ${MAX_TAGS} each).`).option(...JSON_FLAG).action((opts) => runAction(ctx, opts.json, async (out) => {
|
|
4900
4901
|
const client = apiClient(ctx);
|
|
@@ -5074,7 +5075,20 @@ be changed later.`);
|
|
|
5074
5075
|
out.result({ slug: opts.slug, path: destination, sizeBytes: bytes }, () => `Saved ${destination} (${formatBytes(bytes)}).`);
|
|
5075
5076
|
}));
|
|
5076
5077
|
}
|
|
5077
|
-
function
|
|
5078
|
+
async function tagNamesFor(client, tags) {
|
|
5079
|
+
if (!tags?.length)
|
|
5080
|
+
return;
|
|
5081
|
+
try {
|
|
5082
|
+
return new Map((await listSkillTags(client)).map((tag) => [tag.id, tag.name]));
|
|
5083
|
+
} catch {
|
|
5084
|
+
return;
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5087
|
+
function renderSkill(skill, style, tagNames) {
|
|
5088
|
+
const tags = skill.tags?.map((id) => {
|
|
5089
|
+
const name = tagNames?.get(id);
|
|
5090
|
+
return name ? `${name} (${id})` : id;
|
|
5091
|
+
});
|
|
5078
5092
|
const lines = [
|
|
5079
5093
|
style("bold", skill.title),
|
|
5080
5094
|
"",
|
|
@@ -5082,8 +5096,8 @@ function renderSkill(skill, style) {
|
|
|
5082
5096
|
["Slug", skill.slug],
|
|
5083
5097
|
["ID", skill.id],
|
|
5084
5098
|
["Kind", kindName(skill.kind)],
|
|
5085
|
-
["Author", skill.author?.nickname ||
|
|
5086
|
-
["Tags",
|
|
5099
|
+
["Author", skill.author?.nickname || "-"],
|
|
5100
|
+
["Tags", tags?.length ? tags.join(", ") : undefined],
|
|
5087
5101
|
["Created", skill.createdAt ? formatTime(skill.createdAt) : undefined],
|
|
5088
5102
|
["Updated", skill.updatedAt ? formatTime(skill.updatedAt) : undefined]
|
|
5089
5103
|
], style)
|
package/package.json
CHANGED