specli 0.0.32 → 0.0.34

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/bin/cli.sh CHANGED
@@ -22,15 +22,29 @@ for arg in "$@"; do
22
22
  fi
23
23
  done
24
24
 
25
- # 1. Prefer Bun if installed
26
- if command -v bun >/dev/null 2>&1; then
25
+ # Check if Bun version is >= 1.3
26
+ bun_version_ok() {
27
+ version=$(bun --version 2>/dev/null) || return 1
28
+ major=$(printf '%s' "$version" | cut -d. -f1)
29
+ minor=$(printf '%s' "$version" | cut -d. -f2)
30
+ [ "$major" -gt 1 ] || { [ "$major" -eq 1 ] && [ "$minor" -ge 3 ]; }
31
+ }
32
+
33
+ # 1. Prefer Bun if installed and version >= 1.3
34
+ if command -v bun >/dev/null 2>&1 && bun_version_ok; then
27
35
  exec bun "$CLI_JS" "$@"
28
36
  fi
29
37
 
30
- # 2. Bun is required for compile
38
+ # 2. Bun >= 1.3 is required for compile
31
39
  if [ "$is_compile" -eq 1 ]; then
32
- printf '%s\n' "Error: The 'compile' command requires Bun." "Install Bun: https://bun.sh" >&2
33
- exit 1
40
+ if ! command -v bun >/dev/null 2>&1; then
41
+ printf '%s\n' "Error: The 'compile' command requires Bun >= 1.3." "Install Bun: https://bun.sh" >&2
42
+ exit 1
43
+ fi
44
+ if ! bun_version_ok; then
45
+ printf '%s\n' "Error: The 'compile' command requires Bun >= 1.3 (found $(bun --version))." "Update Bun: https://bun.sh" >&2
46
+ exit 1
47
+ fi
34
48
  fi
35
49
 
36
50
  # 3. Fallback to Node.js
package/dist/cli/main.js CHANGED
@@ -152,6 +152,7 @@ export async function main(argv, options = {}) {
152
152
  .description("Print indexed operations (machine-readable when --json)")
153
153
  .option("--pretty", "Pretty-print JSON when used with --json")
154
154
  .option("--min", "Minimal JSON output (commands + metadata only)")
155
+ .option("--commands", "List all <resource> <action> commands (can be large)")
155
156
  .action(async (_opts, command) => {
156
157
  const flags = command.optsWithGlobals();
157
158
  if (flags.json) {
@@ -165,11 +166,17 @@ export async function main(argv, options = {}) {
165
166
  }
166
167
  process.stdout.write(`${ctx.schema.openapi.title ?? "(untitled)"}\n`);
167
168
  process.stdout.write(`OpenAPI: ${ctx.schema.openapi.version}\n`);
168
- process.stdout.write(`Spec: ${ctx.schema.spec.id} (${ctx.schema.spec.source})\n`);
169
- process.stdout.write(`Fingerprint: ${ctx.schema.spec.fingerprint}\n`);
170
169
  process.stdout.write(`Servers: ${ctx.schema.servers.length}\n`);
171
170
  process.stdout.write(`Auth Schemes: ${ctx.schema.authSchemes.length}\n`);
172
- if (ctx.schema.planned?.length) {
171
+ process.stdout.write(`Spec: ${ctx.schema.spec.id} (${ctx.schema.spec.source})\n`);
172
+ // Token-efficient default output: list resources (top-level commands)
173
+ // and push the user/agent toward --help for details.
174
+ process.stdout.write(`\nResources: ${ctx.commands.resources.length}\n\n`);
175
+ const resources = [...ctx.commands.resources].sort((a, b) => a.resource.localeCompare(b.resource));
176
+ for (const r of resources) {
177
+ process.stdout.write(`- ${r.resource} (${r.actions.length} actions)\n`);
178
+ }
179
+ if (flags.commands && ctx.schema.planned?.length) {
173
180
  process.stdout.write(`\nCommands: ${ctx.schema.planned.length}\n\n`);
174
181
  for (const op of ctx.schema.planned) {
175
182
  const args = op.pathArgs.length
@@ -178,10 +185,10 @@ export async function main(argv, options = {}) {
178
185
  process.stdout.write(`- ${program.name()} ${op.resource} ${op.action}${args}\n`);
179
186
  }
180
187
  }
181
- process.stdout.write("\nTip: explore required flags with --help at each level:\n" +
182
- `- ${program.name()} --help\n` +
188
+ process.stdout.write("\nNext:\n" +
183
189
  `- ${program.name()} <resource> --help\n` +
184
- `- ${program.name()} <resource> <action> --help\n`);
190
+ `- ${program.name()} <resource> <action> --help\n` +
191
+ "\nNote: Use --help to discover required flags; avoid __schema --json for agent use (too verbose).\n");
185
192
  });
186
193
  addGeneratedCommands(program, {
187
194
  servers: ctx.servers,
@@ -256,9 +263,10 @@ export async function main(argv, options = {}) {
256
263
  }
257
264
  lines.push("");
258
265
  lines.push("Agent workflow:");
259
- lines.push(` 1) ${name} __schema --json --min`);
266
+ lines.push(` 1) ${name} __schema`);
260
267
  lines.push(` 2) ${name} <resource> --help`);
261
268
  lines.push(` 3) ${name} <resource> <action> --help`);
269
+ lines.push(` 4) ${name} <resource> <action> --curl`);
262
270
  lines.push("");
263
271
  return lines.join("\n");
264
272
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specli",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "description": "Run any OpenAPI spec as a CLI. Built for Agents.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "build": "tsc",
34
- "prepublishOnly": "tsc",
34
+ "prepublishOnly": "rm -rf dist && tsc",
35
35
  "lint": "biome ci",
36
36
  "lint:check": "biome check --write --unsafe",
37
37
  "lint:format": "biome format --write",
@@ -54,7 +54,7 @@
54
54
  "@tsconfig/node22": "^22.0.5",
55
55
  "@types/bun": "^1.3.6",
56
56
  "@types/node": "^22.19.7",
57
- "@typescript/native-preview": "^7.0.0-dev.20260122.3",
57
+ "@typescript/native-preview": "^7.0.0-dev.20260122.4",
58
58
  "typescript": "^5.9.3"
59
59
  }
60
60
  }