@skillport/cli 1.0.0 → 1.0.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 +59 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3072,15 +3072,17 @@ import chalk16 from "chalk";
|
|
|
3072
3072
|
var ACTION_DESC = {
|
|
3073
3073
|
publish: "Publishing skill (draft \u2192 published)...",
|
|
3074
3074
|
unpublish: "Unpublishing skill (published \u2192 draft)...",
|
|
3075
|
-
delete: "Deleting skill..."
|
|
3075
|
+
delete: "Deleting skill...",
|
|
3076
|
+
"set-price": "Updating skill price..."
|
|
3076
3077
|
};
|
|
3077
3078
|
var ACTION_SUCCESS = {
|
|
3078
3079
|
publish: "Skill published! It is now live on the marketplace.",
|
|
3079
3080
|
unpublish: "Skill unpublished. It is now in draft.",
|
|
3080
|
-
delete: "Skill deleted. It is no longer visible on the marketplace."
|
|
3081
|
+
delete: "Skill deleted. It is no longer visible on the marketplace.",
|
|
3082
|
+
"set-price": "Skill price updated."
|
|
3081
3083
|
};
|
|
3082
|
-
async function manageCommand(skillId, action) {
|
|
3083
|
-
const validActions = ["publish", "unpublish", "delete"];
|
|
3084
|
+
async function manageCommand(skillId, action, extraArgs) {
|
|
3085
|
+
const validActions = ["publish", "unpublish", "delete", "set-price"];
|
|
3084
3086
|
if (!validActions.includes(action)) {
|
|
3085
3087
|
console.log(chalk16.red(`Invalid action: ${action}`));
|
|
3086
3088
|
console.log(`Valid actions: ${validActions.join(", ")}`);
|
|
@@ -3094,6 +3096,57 @@ async function manageCommand(skillId, action) {
|
|
|
3094
3096
|
return;
|
|
3095
3097
|
}
|
|
3096
3098
|
const act = action;
|
|
3099
|
+
if (act === "set-price") {
|
|
3100
|
+
const priceArg = extraArgs?.[0];
|
|
3101
|
+
if (priceArg === void 0 || priceArg === "") {
|
|
3102
|
+
console.log(chalk16.red("Missing price. Usage: skillport manage <skill-id> set-price <dollars>"));
|
|
3103
|
+
console.log(chalk16.dim(" Example: skillport manage abc123 set-price 9.99"));
|
|
3104
|
+
process.exitCode = 1;
|
|
3105
|
+
return;
|
|
3106
|
+
}
|
|
3107
|
+
const dollars = parseFloat(priceArg);
|
|
3108
|
+
if (isNaN(dollars) || dollars < 0) {
|
|
3109
|
+
console.log(chalk16.red("Price must be a non-negative number (in dollars)."));
|
|
3110
|
+
process.exitCode = 1;
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3113
|
+
const cents = Math.round(dollars * 100);
|
|
3114
|
+
console.log(ACTION_DESC[act]);
|
|
3115
|
+
try {
|
|
3116
|
+
const res = await fetch(`${config.marketplace_url}/v1/skills/${skillId}`, {
|
|
3117
|
+
method: "PATCH",
|
|
3118
|
+
headers: {
|
|
3119
|
+
Authorization: `Bearer ${config.auth_token}`,
|
|
3120
|
+
"Content-Type": "application/json"
|
|
3121
|
+
},
|
|
3122
|
+
body: JSON.stringify({ price: cents })
|
|
3123
|
+
});
|
|
3124
|
+
if (!res.ok) {
|
|
3125
|
+
const body = await res.json().catch(() => ({}));
|
|
3126
|
+
const msg = String(body.error || res.statusText);
|
|
3127
|
+
if (res.status === 403) {
|
|
3128
|
+
console.log(chalk16.red("Permission denied. You are not the author of this skill."));
|
|
3129
|
+
} else if (res.status === 404) {
|
|
3130
|
+
console.log(chalk16.red(`Server does not support price updates (PATCH /v1/skills/:id returned 404).`));
|
|
3131
|
+
console.log(chalk16.dim("Are you on an old API deployment? Try updating the server."));
|
|
3132
|
+
} else {
|
|
3133
|
+
console.log(chalk16.red(`Failed: ${msg}`));
|
|
3134
|
+
}
|
|
3135
|
+
process.exitCode = 1;
|
|
3136
|
+
return;
|
|
3137
|
+
}
|
|
3138
|
+
const result = await res.json();
|
|
3139
|
+
console.log(chalk16.green(ACTION_SUCCESS[act]));
|
|
3140
|
+
console.log();
|
|
3141
|
+
console.log(` ${chalk16.bold("Skill ID:")} ${result.id}`);
|
|
3142
|
+
console.log(` ${chalk16.bold("Price:")} ${result.price === 0 ? "Free" : `$${(result.price / 100).toFixed(2)}`}`);
|
|
3143
|
+
console.log(` ${chalk16.bold("Status:")} ${result.status}`);
|
|
3144
|
+
} catch (error) {
|
|
3145
|
+
console.log(chalk16.red(`Failed: ${error.message}`));
|
|
3146
|
+
process.exitCode = 1;
|
|
3147
|
+
}
|
|
3148
|
+
return;
|
|
3149
|
+
}
|
|
3097
3150
|
console.log(ACTION_DESC[act]);
|
|
3098
3151
|
try {
|
|
3099
3152
|
let res;
|
|
@@ -3138,7 +3191,7 @@ async function manageCommand(skillId, action) {
|
|
|
3138
3191
|
|
|
3139
3192
|
// src/index.ts
|
|
3140
3193
|
var program = new Command();
|
|
3141
|
-
program.name("skillport").description("SkillPort \u2014 open-source secure skill distribution for OpenClaw").version("1.0.
|
|
3194
|
+
program.name("skillport").description("SkillPort \u2014 open-source secure skill distribution for OpenClaw").version("1.0.1");
|
|
3142
3195
|
program.command("init").description("Generate Ed25519 key pair for signing").action(initCommand);
|
|
3143
3196
|
program.command("scan <path>").description("Run security scan on a skill directory or .ssp file").action(scanCommand);
|
|
3144
3197
|
program.command("export <path>").description("Export a skill directory as a SkillPort package (.ssp)").option("-o, --output <file>", "Output file path").option("-y, --yes", "Non-interactive mode (include all, skip prompts)").option("--id <id>", "Skill ID (author-slug/skill-slug)").option("--name <name>", "Skill name").option("--description <desc>", "Skill description").option("--skill-version <ver>", "Skill version (semver)").option("--author <name>", "Author name").option("--openclaw-compat <range>", "OpenClaw compatibility range").option("--os <os...>", "Compatible OS (macos, linux, windows)").action(exportCommand);
|
|
@@ -3150,7 +3203,7 @@ program.command("uninstall <id>").description("Uninstall an installed skill").ac
|
|
|
3150
3203
|
program.command("login").description("Authenticate with SkillPort Market").option("--method <method>", "Login method: browser or token", "browser").option("--token <token>", "API token (for --method token)").option("-y, --yes", "Non-interactive mode (skip prompts)").option("--no-browser", "Print auth URL instead of opening browser").option("--port <port>", "Callback port (default: 9876, use 0 for auto)").option("--host <host>", "Callback host (default: 127.0.0.1)").action(loginCommand);
|
|
3151
3204
|
program.command("publish <ssp>").description("Publish a SkillPort package to the marketplace").action(publishCommand);
|
|
3152
3205
|
program.command("list").description("List your marketplace skills and their status").option("--json", "Output as JSON").action(listCommand);
|
|
3153
|
-
program.command("manage <skill-id> <action>").description("Manage a skill: publish, unpublish, or
|
|
3206
|
+
program.command("manage <skill-id> <action> [args...]").description("Manage a skill: publish, unpublish, delete, or set-price").action(manageCommand);
|
|
3154
3207
|
program.command("whoami").description("Show current configuration and identity").option("--json", "Output as JSON").action(whoamiCommand);
|
|
3155
3208
|
program.command("doctor").description("Check connectivity and setup health").option("--json", "Output as JSON").action(doctorCommand);
|
|
3156
3209
|
var keys = program.command("keys").description("Manage signing keys");
|
package/package.json
CHANGED