api2cli 0.3.13 → 0.3.14

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2273,12 +2273,15 @@ function askQuestion(question) {
2273
2273
  });
2274
2274
  });
2275
2275
  }
2276
- async function publishToMarketplace(githubUrl) {
2276
+ async function publishToMarketplace(githubUrl, category) {
2277
2277
  try {
2278
+ const payload = { githubUrl };
2279
+ if (category)
2280
+ payload.category = category;
2278
2281
  const res = await fetch(`${API_URL}/api/publish-cli`, {
2279
2282
  method: "POST",
2280
2283
  headers: { "Content-Type": "application/json" },
2281
- body: JSON.stringify({ githubUrl })
2284
+ body: JSON.stringify(payload)
2282
2285
  });
2283
2286
  const data = await res.json();
2284
2287
  if (!res.ok) {
@@ -2293,10 +2296,22 @@ async function publishToMarketplace(githubUrl) {
2293
2296
  return false;
2294
2297
  }
2295
2298
  }
2296
- var publishCommand = new Command("publish").description("Publish a CLI to the api2cli marketplace").argument("<app>", "CLI to publish").option("--github <url>", "GitHub repo URL (e.g. user/repo)").addHelpText("after", `
2299
+ var VALID_CATEGORIES = [
2300
+ "social",
2301
+ "finance",
2302
+ "devtools",
2303
+ "marketing",
2304
+ "productivity",
2305
+ "communication",
2306
+ "analytics",
2307
+ "ai",
2308
+ "ecommerce",
2309
+ "other"
2310
+ ];
2311
+ var publishCommand = new Command("publish").description("Publish a CLI to the api2cli marketplace").argument("<app>", "CLI to publish").option("--github <url>", "GitHub repo URL (e.g. user/repo)").option("--category <cat>", `Category: ${VALID_CATEGORIES.join(", ")}`).addHelpText("after", `
2297
2312
  Examples:
2298
- api2cli publish typefully --github user/typefully-cli
2299
- api2cli publish dub`).action(async (app, opts) => {
2313
+ api2cli publish typefully --github user/typefully-cli --category social
2314
+ api2cli publish dub --category marketing`).action(async (app, opts) => {
2300
2315
  const cliDir = getCliDir(app);
2301
2316
  if (!existsSync3(cliDir)) {
2302
2317
  console.error(`${import_picocolors.default.red("\u2717")} ${app}-cli not found.`);
@@ -2310,10 +2325,15 @@ Examples:
2310
2325
  console.log(`${import_picocolors.default.yellow("\u2717")} No GitHub URL provided. Skipped.`);
2311
2326
  return;
2312
2327
  }
2328
+ const category = opts.category?.toLowerCase();
2329
+ if (category && !VALID_CATEGORIES.includes(category)) {
2330
+ console.error(`${import_picocolors.default.red("\u2717")} Invalid category "${category}". Valid: ${VALID_CATEGORIES.join(", ")}`);
2331
+ process.exit(1);
2332
+ }
2313
2333
  console.log(`
2314
2334
  Publishing ${import_picocolors.default.bold(`${app}-cli`)} to marketplace...
2315
2335
  `);
2316
- await publishToMarketplace(githubUrl);
2336
+ await publishToMarketplace(githubUrl, category);
2317
2337
  });
2318
2338
 
2319
2339
  // src/commands/create.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api2cli",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Turn any REST API into a standardized, agent-ready CLI",
5
5
  "type": "module",
6
6
  "bin": {