api2cli 0.3.13 → 0.3.15
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/README.md +9 -11
- package/dist/index.js +35 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ program.addCommand(draftsResource);
|
|
|
103
103
|
### 3. Build and link
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
api2cli bundle <app> # Build the CLI
|
|
106
|
+
api2cli bundle <app> # Build the CLI
|
|
107
107
|
api2cli link <app> # Add to PATH (updates .bashrc/.zshrc)
|
|
108
108
|
```
|
|
109
109
|
|
|
@@ -122,18 +122,16 @@ api2cli link <app> # Add to PATH (updates .bashrc/.zshrc)
|
|
|
122
122
|
| Command | Description |
|
|
123
123
|
|---------|-------------|
|
|
124
124
|
| `api2cli create <app>` | Generate a new CLI from API docs |
|
|
125
|
-
| `api2cli bundle <app
|
|
126
|
-
| `api2cli
|
|
127
|
-
| `api2cli link <app>` | Add a CLI to PATH |
|
|
128
|
-
| `api2cli link --all` | Link all CLIs |
|
|
125
|
+
| `api2cli bundle <app> [--compile] [--all]` | Build a CLI from source (`--compile` for standalone binary) |
|
|
126
|
+
| `api2cli link <app> [--all]` | Add a CLI to PATH |
|
|
129
127
|
| `api2cli unlink <app>` | Remove from PATH |
|
|
130
|
-
| `api2cli list` | List all installed CLIs |
|
|
131
|
-
| `api2cli tokens` | List all configured tokens (masked) |
|
|
132
|
-
| `api2cli remove <app
|
|
128
|
+
| `api2cli list [--json]` | List all installed CLIs |
|
|
129
|
+
| `api2cli tokens [--show]` | List all configured tokens (masked) |
|
|
130
|
+
| `api2cli remove <app> [--keep-token]` | Remove a CLI entirely |
|
|
133
131
|
| `api2cli doctor` | Check system requirements |
|
|
134
|
-
| `api2cli install <
|
|
135
|
-
| `api2cli publish <app
|
|
136
|
-
| `api2cli update <app>` | Re-sync with API changes |
|
|
132
|
+
| `api2cli install <source> [--force]` | Install from GitHub repo or registry |
|
|
133
|
+
| `api2cli publish <app> [--github <url>] [--category <cat>]` | Publish to registry |
|
|
134
|
+
| `api2cli update <app>` | Re-sync with API changes (agent-driven) |
|
|
137
135
|
|
|
138
136
|
### Generated CLIs (`<app>-cli`)
|
|
139
137
|
|
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(
|
|
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
|
|
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
|
|
@@ -2670,7 +2690,7 @@ ${import_picocolors4.default.bold("Installing")} ${import_picocolors4.default.cy
|
|
|
2670
2690
|
console.log(` ${import_picocolors4.default.green("+")} Built`);
|
|
2671
2691
|
addToPath(app, distDir);
|
|
2672
2692
|
symlinkSkill(cliDir, appCli);
|
|
2673
|
-
const trackName = skillName ??
|
|
2693
|
+
const trackName = skillName ?? (repo.endsWith("-cli") ? repo : `${repo}-cli`);
|
|
2674
2694
|
fetch(`${REGISTRY_API}/skills/${trackName}/download`, { method: "POST" }).catch(() => {});
|
|
2675
2695
|
console.log(`
|
|
2676
2696
|
${import_picocolors4.default.green("\u2713")} Installed ${import_picocolors4.default.bold(appCli)}`);
|
|
@@ -2916,7 +2936,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
2916
2936
|
import { existsSync as existsSync13 } from "fs";
|
|
2917
2937
|
var updateCommand = new Command("update").description("Re-sync a CLI when the upstream API changes").argument("<app>", "CLI to update").option("--docs <url>", "Updated API documentation URL").option("--openapi <url>", "Updated OpenAPI spec URL").addHelpText("after", `
|
|
2918
2938
|
Example:
|
|
2919
|
-
api2cli update typefully --docs https://docs.typefully.com`).action(async (app) => {
|
|
2939
|
+
api2cli update typefully --docs https://docs.typefully.com`).action(async (app, opts) => {
|
|
2920
2940
|
const cliDir = getCliDir(app);
|
|
2921
2941
|
if (!existsSync13(cliDir)) {
|
|
2922
2942
|
console.error(`${import_picocolors11.default.red("\u2717")} ${app}-cli not found. Run: ${import_picocolors11.default.cyan(`api2cli create ${app}`)}`);
|
|
@@ -2926,6 +2946,13 @@ Example:
|
|
|
2926
2946
|
console.log(`
|
|
2927
2947
|
Use your AI agent to update resources in:`);
|
|
2928
2948
|
console.log(` ${import_picocolors11.default.dim(`${cliDir}/src/resources/`)}`);
|
|
2949
|
+
if (opts.docs) {
|
|
2950
|
+
console.log(`
|
|
2951
|
+
API docs: ${import_picocolors11.default.cyan(opts.docs)}`);
|
|
2952
|
+
}
|
|
2953
|
+
if (opts.openapi) {
|
|
2954
|
+
console.log(`OpenAPI spec: ${import_picocolors11.default.cyan(opts.openapi)}`);
|
|
2955
|
+
}
|
|
2929
2956
|
console.log(`
|
|
2930
2957
|
Then rebuild: ${import_picocolors11.default.cyan(`api2cli bundle ${app}`)}`);
|
|
2931
2958
|
});
|