@localskills/cli 0.11.2 → 0.12.0
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 +33 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1572,6 +1572,11 @@ var loginCommand = new Command("login").description("Log in to localskills.sh").
|
|
|
1572
1572
|
Le("Done!");
|
|
1573
1573
|
return;
|
|
1574
1574
|
}
|
|
1575
|
+
if (pollRes.data.status === "denied") {
|
|
1576
|
+
pollSpinner.stop("Authorization denied in the browser.");
|
|
1577
|
+
process.exit(1);
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1575
1580
|
if (pollRes.data.status === "expired" || pollRes.data.status === "not_found") {
|
|
1576
1581
|
pollSpinner.stop("Login expired. Please try again.");
|
|
1577
1582
|
process.exit(1);
|
|
@@ -2980,6 +2985,28 @@ var uninstallCommand = new Command3("uninstall").description("Uninstall a skill"
|
|
|
2980
2985
|
|
|
2981
2986
|
// src/commands/list.ts
|
|
2982
2987
|
import { Command as Command4 } from "commander";
|
|
2988
|
+
function toTagArray(tags) {
|
|
2989
|
+
if (Array.isArray(tags)) return tags.filter((t) => typeof t === "string");
|
|
2990
|
+
if (typeof tags === "string" && tags.trim()) {
|
|
2991
|
+
try {
|
|
2992
|
+
const parsed = JSON.parse(tags);
|
|
2993
|
+
if (Array.isArray(parsed)) return parsed.filter((t) => typeof t === "string");
|
|
2994
|
+
return [tags];
|
|
2995
|
+
} catch {
|
|
2996
|
+
return [tags];
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
return [];
|
|
3000
|
+
}
|
|
3001
|
+
function formatTags(tags) {
|
|
3002
|
+
const list = toTagArray(tags);
|
|
3003
|
+
return list.length > 0 ? ` [${list.join(", ")}]` : "";
|
|
3004
|
+
}
|
|
3005
|
+
function oneLine(text, max = 100) {
|
|
3006
|
+
if (!text) return "";
|
|
3007
|
+
const flat = text.replace(/\s+/g, " ").trim();
|
|
3008
|
+
return flat.length > max ? `${flat.slice(0, max - 1)}\u2026` : flat;
|
|
3009
|
+
}
|
|
2983
3010
|
var listCommand = new Command4("list").description("List available skills").option("--public", "Show public skills only").option("--tag <tag>", "Filter by tag (requires --public)").option("--search <query>", "Search skills (requires --public)").action(async (opts) => {
|
|
2984
3011
|
const client = new ApiClient();
|
|
2985
3012
|
if ((opts.tag || opts.search) && !opts.public) {
|
|
@@ -3005,8 +3032,8 @@ var listCommand = new Command4("list").description("List available skills").opti
|
|
|
3005
3032
|
console.log("Public skills:\n");
|
|
3006
3033
|
for (const skill of res.data) {
|
|
3007
3034
|
const ver = formatVersionLabel(skill.currentSemver, skill.currentVersion);
|
|
3008
|
-
const tags = skill.tags
|
|
3009
|
-
console.log(` ${skill.slug} ${ver}${tags} \u2014 ${skill.description || skill.name}`);
|
|
3035
|
+
const tags = formatTags(skill.tags);
|
|
3036
|
+
console.log(` ${skill.slug} ${ver}${tags} \u2014 ${oneLine(skill.description) || skill.name}`);
|
|
3010
3037
|
}
|
|
3011
3038
|
console.log(`
|
|
3012
3039
|
${res.data.length} skill(s) found.`);
|
|
@@ -3026,8 +3053,8 @@ ${res.data.length} skill(s) found.`);
|
|
|
3026
3053
|
for (const skill of res.data) {
|
|
3027
3054
|
const vis = skill.visibility === "public" ? "" : ` [${skill.visibility}]`;
|
|
3028
3055
|
const ver = formatVersionLabel(skill.currentSemver, skill.currentVersion);
|
|
3029
|
-
const tags = skill.tags
|
|
3030
|
-
console.log(` ${skill.slug} ${ver}${vis}${tags} \u2014 ${skill.description || skill.name}`);
|
|
3056
|
+
const tags = formatTags(skill.tags);
|
|
3057
|
+
console.log(` ${skill.slug} ${ver}${vis}${tags} \u2014 ${oneLine(skill.description) || skill.name}`);
|
|
3031
3058
|
}
|
|
3032
3059
|
console.log(`
|
|
3033
3060
|
${res.data.length} skill(s) found.`);
|
|
@@ -3746,7 +3773,7 @@ async function uploadSkill(client, params) {
|
|
|
3746
3773
|
return false;
|
|
3747
3774
|
}
|
|
3748
3775
|
spinner.stop(`Published!`);
|
|
3749
|
-
R2.success(`\u2192 localskills.sh/s/${res.data.
|
|
3776
|
+
R2.success(`\u2192 localskills.sh/s/${res.data.publicId}`);
|
|
3750
3777
|
return true;
|
|
3751
3778
|
}
|
|
3752
3779
|
async function uploadPackage(client, params) {
|
|
@@ -3772,7 +3799,7 @@ async function uploadPackage(client, params) {
|
|
|
3772
3799
|
return false;
|
|
3773
3800
|
}
|
|
3774
3801
|
spinner.stop(`Published! (${packed.fileCount} files)`);
|
|
3775
|
-
R2.success(`\u2192 localskills.sh/s/${res.data.
|
|
3802
|
+
R2.success(`\u2192 localskills.sh/s/${res.data.publicId}`);
|
|
3776
3803
|
return true;
|
|
3777
3804
|
}
|
|
3778
3805
|
function validateContentType(value) {
|