specli 0.0.33 → 0.0.35

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 CHANGED
@@ -63,7 +63,7 @@ specli compile <spec> [options]
63
63
  | Option | Description |
64
64
  |--------|-------------|
65
65
  | `--name <name>` | Binary name (default: derived from spec title) |
66
- | `--outfile <path>` | Output path (default: `./dist/<name>`) |
66
+ | `--outfile <path>` | Output path (default: `./out/<name>`) |
67
67
  | `--target <target>` | Cross-compile target (e.g. `bun-linux-x64`) |
68
68
  | `--minify` | Enable minification |
69
69
  | `--bytecode` | Enable bytecode compilation |
@@ -78,14 +78,14 @@ specli compile <spec> [options]
78
78
  ```bash
79
79
  # Compile with auto-derived name
80
80
  specli compile ./openapi.yaml
81
- # Creates: ./dist/my-api
81
+ # Creates: ./out/my-api
82
82
 
83
83
  # Compile with explicit name
84
84
  specli compile ./openapi.yaml --name myapi
85
- # Creates: ./dist/myapi
85
+ # Creates: ./out/myapi
86
86
 
87
87
  # Cross-compile for Linux
88
- specli compile ./openapi.json --target bun-linux-x64 --outfile ./dist/myapi-linux
88
+ specli compile ./openapi.json --target bun-linux-x64 --outfile ./out/myapi-linux
89
89
 
90
90
  # Bake in defaults
91
91
  specli compile https://api.example.com/openapi.json \
@@ -413,3 +413,19 @@ bun test
413
413
  bun run lint
414
414
  bun run typecheck
415
415
  ```
416
+
417
+ ## Demos
418
+
419
+ ### Weather
420
+
421
+ Compile the weather spec to an executable:
422
+
423
+ ```sh
424
+ npx specli compile https://raw.githubusercontent.com/open-meteo/open-meteo/refs/heads/main/openapi.yml --name weather
425
+ ```
426
+
427
+ Ask an agent what the current weather is:
428
+
429
+ ```sh
430
+ opencode run 'Using ./out/weather what is the current weather in new york city'
431
+ ```
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
@@ -19,8 +19,6 @@ function getPackageVersion() {
19
19
  return "0.0.0";
20
20
  }
21
21
  }
22
- import { stableStringify } from "./core/stable-json.js";
23
- import { toMinimalSchemaOutput } from "./model/schema.js";
24
22
  import { readStdinText } from "./runtime/compat.js";
25
23
  import { buildRuntimeContext } from "./runtime/context.js";
26
24
  import { addGeneratedCommands } from "./runtime/generated.js";
@@ -44,7 +42,6 @@ export async function main(argv, options = {}) {
44
42
  .option("--username <username>", "Basic auth username")
45
43
  .option("--password <password>", "Basic auth password")
46
44
  .option("--api-key <key>", "API key value")
47
- .option("--json", "Machine-readable output")
48
45
  .showHelpAfterError();
49
46
  // If user asks for help and we have no embedded spec and no --spec, show minimal help.
50
47
  const spec = getArgValue(argv, "--spec");
@@ -149,21 +146,10 @@ export async function main(argv, options = {}) {
149
146
  });
150
147
  program
151
148
  .command("__schema")
152
- .description("Print indexed operations (machine-readable when --json)")
153
- .option("--pretty", "Pretty-print JSON when used with --json")
154
- .option("--min", "Minimal JSON output (commands + metadata only)")
149
+ .description("Print indexed operations")
155
150
  .option("--commands", "List all <resource> <action> commands (can be large)")
156
151
  .action(async (_opts, command) => {
157
152
  const flags = command.optsWithGlobals();
158
- if (flags.json) {
159
- const pretty = Boolean(flags.pretty);
160
- const payload = flags.min
161
- ? toMinimalSchemaOutput(ctx.schema)
162
- : ctx.schema;
163
- const text = stableStringify(payload, { space: pretty ? 2 : 0 });
164
- process.stdout.write(`${text}\n`);
165
- return;
166
- }
167
153
  process.stdout.write(`${ctx.schema.openapi.title ?? "(untitled)"}\n`);
168
154
  process.stdout.write(`OpenAPI: ${ctx.schema.openapi.version}\n`);
169
155
  process.stdout.write(`Servers: ${ctx.schema.servers.length}\n`);
@@ -187,8 +173,7 @@ export async function main(argv, options = {}) {
187
173
  }
188
174
  process.stdout.write("\nNext:\n" +
189
175
  `- ${program.name()} <resource> --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");
176
+ `- ${program.name()} <resource> <action> --help\n`);
192
177
  });
193
178
  addGeneratedCommands(program, {
194
179
  servers: ctx.servers,
package/dist/cli.js CHANGED
@@ -36,7 +36,6 @@ program
36
36
  .option("--password <password>", "Basic auth password")
37
37
  .option("--api-key <key>", "API key value")
38
38
  .option("--profile <name>", "Profile name")
39
- .option("--json", "Machine-readable output")
40
39
  .allowUnknownOption()
41
40
  .allowExcessArguments()
42
41
  .action(async (spec, options, command) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specli",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Run any OpenAPI spec as a CLI. Built for Agents.",
5
5
  "repository": {
6
6
  "type": "git",