@hardfin/cli 0.1.1-dev.56 → 0.1.1-dev.57
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 +25 -0
- package/dist/cli.js +4 -4
- package/dist/completion-tree.json +29 -0
- package/dist/{program-CI4W2agw.js → program-PaNgBWFL.js} +987 -877
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -143,6 +143,31 @@ An agent branches on `code`. A code is never renamed and never changes meaning,
|
|
|
143
143
|
message may be reworded at any time. `hardfin agent-guide` lists every code with what it
|
|
144
144
|
means, and `src/output/failure.ts` defines them.
|
|
145
145
|
|
|
146
|
+
### Calling an endpoint no command covers
|
|
147
|
+
|
|
148
|
+
`hardfin api` calls any path under the API. It takes the same parts a generated command does,
|
|
149
|
+
named by hand.
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
hardfin api /customer -f page=2 -f limit=50 # query parameters
|
|
153
|
+
hardfin api -X PATCH /item/item_V1StGXR8Z5jdHi6B --input body.json # a JSON body
|
|
154
|
+
hardfin api /file/file_7hq2mx9pkr4stz8w --output photo.jpg # a download
|
|
155
|
+
hardfin api -X POST /file --file photo.jpg -F fileType=ASSET_FILE # an upload, as multipart
|
|
156
|
+
hardfin api /file/file_7hq2mx9pkr4stz8w -H 'If-None-Match: "abc"' --output photo.jpg
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
| Flag | Sends |
|
|
160
|
+
| ------------------ | ---------------------------------------------------------------------------------- |
|
|
161
|
+
| `-f key=value` | A query parameter, repeatable |
|
|
162
|
+
| `--input <path>` | A JSON body, from a file or `-` for standard input |
|
|
163
|
+
| `--file <path>` | A file as multipart, under the part name `data` unless `--file-part` names another |
|
|
164
|
+
| `-F key=value` | A field beside the file, repeatable |
|
|
165
|
+
| `-H "Name: value"` | A request header, repeatable |
|
|
166
|
+
| `--output <path>` | Nothing. It writes the file the endpoint answers with, or `-` for standard output |
|
|
167
|
+
|
|
168
|
+
A header cannot set `Authorization`, `X-API-Key` or `X-API-Version`, which come from your sign
|
|
169
|
+
in and settings. `--file` and `--input` cannot be given together.
|
|
170
|
+
|
|
146
171
|
### Reading the commands from a program
|
|
147
172
|
|
|
148
173
|
`hardfin agent-guide` describes the CLI to an agent, as Markdown or as JSON. Name a command to
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1c7d3a24-925a-543e-a2eb-caf5f5968ada")}catch(e){}}();
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
//#region src/cli.ts
|
|
6
6
|
module.enableCompileCache?.();
|
|
@@ -14,7 +14,7 @@ process.on("unhandledRejection", (error) => void toCrash(error));
|
|
|
14
14
|
try {
|
|
15
15
|
const answer = await toQuickAnswer(process.argv.slice(2));
|
|
16
16
|
if (answer === void 0) {
|
|
17
|
-
const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-
|
|
17
|
+
const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-PaNgBWFL.js");
|
|
18
18
|
try {
|
|
19
19
|
await toCli().parseAsync(process.argv);
|
|
20
20
|
} catch (error) {
|
|
@@ -33,7 +33,7 @@ async function toCrash(error) {
|
|
|
33
33
|
isCrashing = true;
|
|
34
34
|
const isJSON = process.argv.includes("--json") || !process.stdout.isTTY;
|
|
35
35
|
try {
|
|
36
|
-
const { toReported, writeCrash } = await import("./program-
|
|
36
|
+
const { toReported, writeCrash } = await import("./program-PaNgBWFL.js");
|
|
37
37
|
writeCrash(error, isJSON);
|
|
38
38
|
await toReported(error, isJSON, void 0, "fatal");
|
|
39
39
|
} catch {
|
|
@@ -54,4 +54,4 @@ async function toQuickAnswer(args) {
|
|
|
54
54
|
export {};
|
|
55
55
|
|
|
56
56
|
//# sourceMappingURL=cli.js.map
|
|
57
|
-
//# debugId=
|
|
57
|
+
//# debugId=1c7d3a24-925a-543e-a2eb-caf5f5968ada
|
|
@@ -2566,6 +2566,35 @@
|
|
|
2566
2566
|
"description": "A file holding the JSON request body, or - for stdin",
|
|
2567
2567
|
"valueName": "file"
|
|
2568
2568
|
},
|
|
2569
|
+
{
|
|
2570
|
+
"name": "file",
|
|
2571
|
+
"description": "A file to upload as multipart, in place of a JSON body",
|
|
2572
|
+
"valueName": "path"
|
|
2573
|
+
},
|
|
2574
|
+
{
|
|
2575
|
+
"name": "file-part",
|
|
2576
|
+
"description": "The name of the part the file is sent as, which is data when not given",
|
|
2577
|
+
"valueName": "name"
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
"name": "form",
|
|
2581
|
+
"short": "F",
|
|
2582
|
+
"description": "A field sent beside the file as key=value, repeatable",
|
|
2583
|
+
"valueName": "key=value",
|
|
2584
|
+
"repeatable": true
|
|
2585
|
+
},
|
|
2586
|
+
{
|
|
2587
|
+
"name": "header",
|
|
2588
|
+
"short": "H",
|
|
2589
|
+
"description": "A request header as Name: value, repeatable",
|
|
2590
|
+
"valueName": "name: value",
|
|
2591
|
+
"repeatable": true
|
|
2592
|
+
},
|
|
2593
|
+
{
|
|
2594
|
+
"name": "output",
|
|
2595
|
+
"description": "Where to write a file the endpoint answers with, or - for standard output",
|
|
2596
|
+
"valueName": "path"
|
|
2597
|
+
},
|
|
2569
2598
|
{
|
|
2570
2599
|
"name": "json",
|
|
2571
2600
|
"description": "Print machine-readable output, which is the default when stdout is not a terminal"
|