@hardfin/cli 0.1.1-dev.70 → 0.1.1-dev.71
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 +46 -8
- package/dist/{check-wgnggJ45.js → check-CvjTUx-K.js} +8 -6
- package/dist/cli.js +5 -5
- package/dist/completion-tree.json +1 -1
- package/dist/{notice-CQ5Nlp80.js → notice-D6mbHF9O.js} +4 -4
- package/dist/{program-CYp6XF8D.js → program-CC8Iqb14.js} +164 -162
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,6 +85,7 @@ Most commands are generated from the published API document rather than written
|
|
|
85
85
|
| `src/command/surface.generated.ts` | Every endpoint as a command, rewritten by the generator |
|
|
86
86
|
| `surface-overrides.json` | The operations whose generated name is wrong |
|
|
87
87
|
| `spec/core.openapi.yaml` | The API document the generator reads, vendored here |
|
|
88
|
+
| `spec/source.json` | Where the vendored document came from, and whether it is a preview |
|
|
88
89
|
| `scripts/generate-surface.mjs` | The generator |
|
|
89
90
|
|
|
90
91
|
### How an endpoint becomes a command
|
|
@@ -324,24 +325,61 @@ reads it. Nothing fetches a document during a build, a release, or CI.
|
|
|
324
325
|
Refresh it with the script, which then rewrites the generated commands:
|
|
325
326
|
|
|
326
327
|
```sh
|
|
327
|
-
scripts/update-spec.sh #
|
|
328
|
+
scripts/update-spec.sh # the newer of api-spec's main and active-preview
|
|
329
|
+
scripts/update-spec.sh --main # api-spec's main, the published contract
|
|
330
|
+
scripts/update-spec.sh --preview # api-spec's active-preview, and fails when there is none
|
|
328
331
|
scripts/update-spec.sh ../hardfin # bundles the fragmented source in a monorepo checkout
|
|
329
332
|
```
|
|
330
333
|
|
|
331
|
-
The
|
|
332
|
-
|
|
334
|
+
The first three read `hardfinhq/api-spec` over your own git access. The monorepo form runs the
|
|
335
|
+
same bundler at the same version CI uses, so the result matches what the api-spec bridge
|
|
336
|
+
publishes. Commit the document, `spec/source.json` and the generated files together.
|
|
333
337
|
|
|
334
|
-
|
|
338
|
+
#### Previews
|
|
335
339
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
|
339
|
-
|
|
|
340
|
+
`hardfinhq/api-spec` has two branches the script reads.
|
|
341
|
+
|
|
342
|
+
| Branch | Holds | Exists |
|
|
343
|
+
| ---------------- | ------------------------------------------------------- | --------------------------------------------- |
|
|
344
|
+
| `main` | The published contract, which the production API serves | always |
|
|
345
|
+
| `active-preview` | The next contract, before it publishes | while the monorepo's `api-preview` tag exists |
|
|
346
|
+
|
|
347
|
+
Pushing or moving the monorepo's `api-preview` tag rebuilds `active-preview` from `main` with
|
|
348
|
+
the tagged commit's document. Deleting the tag deletes the branch. With no option, the script
|
|
349
|
+
reads `active-preview` while it exists and its last commit is newer than `main`'s. Once `main`
|
|
350
|
+
publishes past it, `main` holds everything the preview did, and the script reads `main`.
|
|
351
|
+
|
|
352
|
+
A preview lets a dev build carry the next contract before it publishes. Merging a preview
|
|
353
|
+
document to `dev` publishes it as a `-dev` build like any other change.
|
|
354
|
+
|
|
355
|
+
The script records where the document came from in `spec/source.json`, including whether it is
|
|
356
|
+
a preview. A preview names an API version the production API does not serve yet, so it never
|
|
357
|
+
reaches a release.
|
|
358
|
+
|
|
359
|
+
| Check | Refuses |
|
|
360
|
+
| ------------------------------------------------ | ------------------------------------------------------- |
|
|
361
|
+
| The version check, on a pull request into `main` | a `spec/source.json` that names a preview |
|
|
362
|
+
| The release workflow, on a push to `main` | the same, for a preview that reached `main` another way |
|
|
363
|
+
|
|
364
|
+
Run `scripts/update-spec.sh --main` and commit the result before releasing a `dev` that carries a preview.
|
|
365
|
+
|
|
366
|
+
#### Checks on the document
|
|
367
|
+
|
|
368
|
+
Three checks keep the document and the generated files honest.
|
|
369
|
+
|
|
370
|
+
| Check | Refuses |
|
|
371
|
+
| ------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
372
|
+
| The generator | a document whose `info.version` is not a date, which means an earlier release |
|
|
373
|
+
| CI | a vendored document that was updated without regenerating the commands |
|
|
374
|
+
| CI | an API version that differs from the document's, because the generator writes it to `src/command/api-version.generated.ts` |
|
|
340
375
|
|
|
341
376
|
The first one matters because `hardfinhq/api-spec` can sit a release behind the monorepo
|
|
342
377
|
while its bridge pull request is open. Generating from that document would replace the
|
|
343
378
|
current commands with an earlier API's.
|
|
344
379
|
|
|
380
|
+
The API version every request sends is the document's `info.version`. Nothing sets it by hand,
|
|
381
|
+
so a new document cannot leave requests naming the version before it.
|
|
382
|
+
|
|
345
383
|
## Signing in
|
|
346
384
|
|
|
347
385
|
```sh
|
|
@@ -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]="4a31fc43-cc3a-59be-a501-eb86f4115b3f")}catch(e){}}();
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -113,9 +113,11 @@ function toRelease(of) {
|
|
|
113
113
|
return `hardfin-cli@${of}`;
|
|
114
114
|
}
|
|
115
115
|
//#endregion
|
|
116
|
+
//#region src/command/api-version.generated.ts
|
|
117
|
+
/** API_VERSION is the version of the API document the commands were generated from. */
|
|
118
|
+
const API_VERSION = "2026-10-22";
|
|
119
|
+
//#endregion
|
|
116
120
|
//#region src/config/settings.ts
|
|
117
|
-
/** The API version this build was written against, sent on every request. */
|
|
118
|
-
const API_VERSION = "2026-10-21";
|
|
119
121
|
/** The file a local build reads its overrides from, in the working directory. */
|
|
120
122
|
const CONFIG_FILE = "config.local.json";
|
|
121
123
|
const DEFAULT_API_URL = "https://api.hardfin.com/v2";
|
|
@@ -494,7 +496,7 @@ function writeCache(cache) {
|
|
|
494
496
|
} catch {}
|
|
495
497
|
}
|
|
496
498
|
//#endregion
|
|
497
|
-
export { ExpectedFailure as C, TimedOut as E, version$1 as S, LockHeld as T,
|
|
499
|
+
export { ExpectedFailure as C, TimedOut as E, version$1 as S, LockHeld as T, CONFIG_FILE as _, isShipped as a, API_VERSION as b, toOutdatedTo as c, toJSON as d, toLastFailureCode as f, writeFailure as g, writeData as h, toUpdateCheckRefusal as i, toStateDirectory as l, toText as m, isReminderDue as n, toPackageDirectory as o, toPrintable as p, toCheck as r, noteNotices as s, PACKAGE as t, isJSONOutput as u, ConfigFailure as v, Interrupted as w, toTelemetry as x, toSettings as y };
|
|
498
500
|
|
|
499
|
-
//# sourceMappingURL=check-
|
|
500
|
-
//# debugId=
|
|
501
|
+
//# sourceMappingURL=check-CvjTUx-K.js.map
|
|
502
|
+
//# debugId=4a31fc43-cc3a-59be-a501-eb86f4115b3f
|
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]="3bf6cdf0-d851-549b-9a43-bb3c8520e8ff")}catch(e){}}();
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
//#region src/cli.ts
|
|
6
6
|
module.enableCompileCache?.();
|
|
@@ -14,8 +14,8 @@ 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-
|
|
18
|
-
const { startUpdateCheck, writeUpdateNotice } = await import("./notice-
|
|
17
|
+
const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-CC8Iqb14.js");
|
|
18
|
+
const { startUpdateCheck, writeUpdateNotice } = await import("./notice-D6mbHF9O.js");
|
|
19
19
|
const pending = startUpdateCheck(process.argv.slice(2));
|
|
20
20
|
try {
|
|
21
21
|
await toCli().parseAsync(process.argv);
|
|
@@ -36,7 +36,7 @@ async function toCrash(error) {
|
|
|
36
36
|
isCrashing = true;
|
|
37
37
|
const isJSON = process.argv.includes("--json") || !process.stdout.isTTY;
|
|
38
38
|
try {
|
|
39
|
-
const { toReported, writeCrash } = await import("./program-
|
|
39
|
+
const { toReported, writeCrash } = await import("./program-CC8Iqb14.js");
|
|
40
40
|
writeCrash(error, isJSON);
|
|
41
41
|
await toReported(error, isJSON, void 0, "fatal");
|
|
42
42
|
} catch {
|
|
@@ -57,4 +57,4 @@ async function toQuickAnswer(args) {
|
|
|
57
57
|
export {};
|
|
58
58
|
|
|
59
59
|
//# sourceMappingURL=cli.js.map
|
|
60
|
-
//# debugId=
|
|
60
|
+
//# debugId=3bf6cdf0-d851-549b-9a43-bb3c8520e8ff
|