api2cli 0.3.14 → 0.3.16

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 (3) hide show
  1. package/README.md +9 -11
  2. package/dist/index.js +47 -7
  3. 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 (~5KB JS bundle)
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>` | Build a CLI from source |
126
- | `api2cli bundle --all` | Build all installed CLIs |
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>` | Remove a CLI entirely |
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 <app>` | Install from registry (coming soon) |
135
- | `api2cli publish <app>` | Publish to registry (coming soon) |
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
@@ -2690,7 +2690,7 @@ ${import_picocolors4.default.bold("Installing")} ${import_picocolors4.default.cy
2690
2690
  console.log(` ${import_picocolors4.default.green("+")} Built`);
2691
2691
  addToPath(app, distDir);
2692
2692
  symlinkSkill(cliDir, appCli);
2693
- const trackName = skillName ?? getAppName(repo);
2693
+ const trackName = skillName ?? (repo.endsWith("-cli") ? repo : `${repo}-cli`);
2694
2694
  fetch(`${REGISTRY_API}/skills/${trackName}/download`, { method: "POST" }).catch(() => {});
2695
2695
  console.log(`
2696
2696
  ${import_picocolors4.default.green("\u2713")} Installed ${import_picocolors4.default.bold(appCli)}`);
@@ -2803,11 +2803,40 @@ async function buildCli(app, compile) {
2803
2803
 
2804
2804
  // src/commands/link.ts
2805
2805
  var import_picocolors7 = __toESM(require_picocolors(), 1);
2806
- import { existsSync as existsSync9, readdirSync as readdirSync5 } from "fs";
2807
- var linkCommand = new Command("link").description("Add a CLI to your PATH").argument("[app]", "CLI to link (omit with --all)").option("--all", "Link all installed CLIs").addHelpText("after", `
2806
+ import { existsSync as existsSync9, mkdirSync as mkdirSync5, readdirSync as readdirSync5, symlinkSync as symlinkSync3, unlinkSync as unlinkSync3 } from "fs";
2807
+ import { homedir as homedir4 } from "os";
2808
+ import { join as join8 } from "path";
2809
+ var AGENT_SKILL_DIRS = {
2810
+ claude: join8(homedir4(), ".claude", "skills"),
2811
+ cursor: join8(homedir4(), ".cursor", "skills"),
2812
+ openclaw: join8(homedir4(), ".openclaw", "workspace", "skills")
2813
+ };
2814
+ function linkSkill(app, skillsPath) {
2815
+ const cliDir = getCliDir(app);
2816
+ const skillSource = join8(cliDir, "skills", `${app}-cli`, "SKILL.md");
2817
+ if (!existsSync9(skillSource)) {
2818
+ console.log(` ${import_picocolors7.default.dim("No SKILL.md found for")} ${app}-cli${import_picocolors7.default.dim(", skipping skill link")}`);
2819
+ return;
2820
+ }
2821
+ const targetDir = join8(skillsPath, `${app}-cli`);
2822
+ mkdirSync5(targetDir, { recursive: true });
2823
+ const targetLink = join8(targetDir, "SKILL.md");
2824
+ if (existsSync9(targetLink))
2825
+ unlinkSync3(targetLink);
2826
+ symlinkSync3(skillSource, targetLink);
2827
+ console.log(`${import_picocolors7.default.green("+")} Skill linked ${import_picocolors7.default.bold(`${app}-cli`)} -> ${import_picocolors7.default.dim(targetLink)}`);
2828
+ }
2829
+ var linkCommand = new Command("link").description("Add a CLI to your PATH (and optionally link skills to agent directories)").argument("[app]", "CLI to link (omit with --all)").option("--all", "Link all installed CLIs").option("--openclaw", "Also symlink skill to ~/.openclaw/workspace/skills/").option("--skills-path <path>", "Custom path to symlink the skill into").addHelpText("after", `
2808
2830
  Examples:
2809
2831
  api2cli link typefully
2810
- api2cli link --all`).action((app, opts) => {
2832
+ api2cli link typefully --openclaw
2833
+ api2cli link typefully --skills-path ~/.openclaw/workspace/skills
2834
+ api2cli link --all --openclaw`).action((app, opts) => {
2835
+ const skillsPaths = [];
2836
+ if (opts.openclaw)
2837
+ skillsPaths.push(AGENT_SKILL_DIRS.openclaw);
2838
+ if (opts.skillsPath)
2839
+ skillsPaths.push(opts.skillsPath.replace(/^~/, homedir4()));
2811
2840
  if (opts.all || !app) {
2812
2841
  if (!existsSync9(CLI_ROOT)) {
2813
2842
  console.log("No CLIs installed.");
@@ -2817,6 +2846,8 @@ Examples:
2817
2846
  for (const d of dirs) {
2818
2847
  const name = d.replace(/-cli$/, "");
2819
2848
  addToPath(name, getDistDir(name));
2849
+ for (const sp of skillsPaths)
2850
+ linkSkill(name, sp);
2820
2851
  }
2821
2852
  return;
2822
2853
  }
@@ -2825,6 +2856,8 @@ Examples:
2825
2856
  process.exit(1);
2826
2857
  }
2827
2858
  addToPath(app, getDistDir(app));
2859
+ for (const sp of skillsPaths)
2860
+ linkSkill(app, sp);
2828
2861
  });
2829
2862
 
2830
2863
  // src/commands/unlink.ts
@@ -2837,7 +2870,7 @@ Example:
2837
2870
  // src/commands/tokens.ts
2838
2871
  var import_picocolors8 = __toESM(require_picocolors(), 1);
2839
2872
  import { existsSync as existsSync10, readdirSync as readdirSync6, readFileSync as readFileSync4 } from "fs";
2840
- import { join as join8 } from "path";
2873
+ import { join as join9 } from "path";
2841
2874
  var tokensCommand = new Command("tokens").description("List all configured API tokens").option("--show", "Show full unmasked tokens").addHelpText("after", `
2842
2875
  Examples:
2843
2876
  api2cli tokens
@@ -2856,7 +2889,7 @@ ${import_picocolors8.default.bold("Configured tokens:")}
2856
2889
  `);
2857
2890
  for (const f of files) {
2858
2891
  const name = f.replace(".txt", "");
2859
- const token = readFileSync4(join8(TOKENS_DIR, f), "utf-8").trim();
2892
+ const token = readFileSync4(join9(TOKENS_DIR, f), "utf-8").trim();
2860
2893
  const display = opts.show ? token : token.length > 8 ? `${token.slice(0, 4)}${import_picocolors8.default.dim("...")}${token.slice(-4)}` : import_picocolors8.default.dim("****");
2861
2894
  console.log(` ${import_picocolors8.default.bold(name.padEnd(25))} ${display}`);
2862
2895
  }
@@ -2936,7 +2969,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
2936
2969
  import { existsSync as existsSync13 } from "fs";
2937
2970
  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", `
2938
2971
  Example:
2939
- api2cli update typefully --docs https://docs.typefully.com`).action(async (app) => {
2972
+ api2cli update typefully --docs https://docs.typefully.com`).action(async (app, opts) => {
2940
2973
  const cliDir = getCliDir(app);
2941
2974
  if (!existsSync13(cliDir)) {
2942
2975
  console.error(`${import_picocolors11.default.red("\u2717")} ${app}-cli not found. Run: ${import_picocolors11.default.cyan(`api2cli create ${app}`)}`);
@@ -2946,6 +2979,13 @@ Example:
2946
2979
  console.log(`
2947
2980
  Use your AI agent to update resources in:`);
2948
2981
  console.log(` ${import_picocolors11.default.dim(`${cliDir}/src/resources/`)}`);
2982
+ if (opts.docs) {
2983
+ console.log(`
2984
+ API docs: ${import_picocolors11.default.cyan(opts.docs)}`);
2985
+ }
2986
+ if (opts.openapi) {
2987
+ console.log(`OpenAPI spec: ${import_picocolors11.default.cyan(opts.openapi)}`);
2988
+ }
2949
2989
  console.log(`
2950
2990
  Then rebuild: ${import_picocolors11.default.cyan(`api2cli bundle ${app}`)}`);
2951
2991
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api2cli",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "description": "Turn any REST API into a standardized, agent-ready CLI",
5
5
  "type": "module",
6
6
  "bin": {