specli 0.0.34 → 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 +20 -4
- package/dist/cli/main.js +2 -17
- package/dist/cli.js +0 -1
- package/package.json +1 -1
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: `./
|
|
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: ./
|
|
81
|
+
# Creates: ./out/my-api
|
|
82
82
|
|
|
83
83
|
# Compile with explicit name
|
|
84
84
|
specli compile ./openapi.yaml --name myapi
|
|
85
|
-
# Creates: ./
|
|
85
|
+
# Creates: ./out/myapi
|
|
86
86
|
|
|
87
87
|
# Cross-compile for Linux
|
|
88
|
-
specli compile ./openapi.json --target bun-linux-x64 --outfile ./
|
|
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/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
|
|
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) => {
|