@headband/cli 0.7.0 → 0.7.1
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 +5 -0
- package/dist/index.js +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,6 +83,7 @@ A script, CI job or agent does not need to log in. Give it a key:
|
|
|
83
83
|
| `HEADBAND_API_KEY` | `--token` | The API key to send. Used instead of any stored login. |
|
|
84
84
|
| `HEADBAND_URL` | `--url` | The Headband URL. |
|
|
85
85
|
| `HEADBAND_PROFILE` | `--profile` | Which stored login to use. |
|
|
86
|
+
| `HEADBAND_API_URL` | | Where `/v1` calls go, if not the default below. |
|
|
86
87
|
|
|
87
88
|
Precedence, highest first:
|
|
88
89
|
|
|
@@ -92,6 +93,10 @@ Precedence, highest first:
|
|
|
92
93
|
name the profile with `--profile`.
|
|
93
94
|
- **Profile:** `--profile`, then `HEADBAND_PROFILE`, then the current profile,
|
|
94
95
|
then the only stored profile when there is one.
|
|
96
|
+
- **API host:** for `https://headband.dev`, every `/v1` call goes to
|
|
97
|
+
`https://api.headband.dev`, the API host on the servers that run the engines
|
|
98
|
+
(sign-in stays on `headband.dev`). Any other URL is used as is.
|
|
99
|
+
`HEADBAND_API_URL` overrides both.
|
|
95
100
|
|
|
96
101
|
A stored key is only ever sent to the URL it was issued for. `--url` with no
|
|
97
102
|
`--profile` picks the stored profile for that URL; `--url` with a `--profile`
|
package/dist/index.js
CHANGED
|
@@ -583,8 +583,16 @@ async function apiRequest(baseUrl, path2, init2 = {}) {
|
|
|
583
583
|
}
|
|
584
584
|
return body;
|
|
585
585
|
}
|
|
586
|
+
var DEFAULT_API_URL = "https://api.headband.dev";
|
|
587
|
+
function apiUrlFor(url, env = process.env) {
|
|
588
|
+
const override = env.HEADBAND_API_URL?.trim();
|
|
589
|
+
if (override) return normalizeUrl(override);
|
|
590
|
+
const normalized = normalizeUrl(url);
|
|
591
|
+
return normalized === DEFAULT_URL ? DEFAULT_API_URL : normalized;
|
|
592
|
+
}
|
|
586
593
|
function createApiClient(url, profile) {
|
|
587
|
-
const
|
|
594
|
+
const apiUrl = apiUrlFor(url);
|
|
595
|
+
const request = (path2, init2 = {}) => apiRequest(apiUrl, path2, {
|
|
588
596
|
...init2,
|
|
589
597
|
apiKey: profile.apiKey,
|
|
590
598
|
headers: profile.headers,
|
|
@@ -1736,6 +1744,7 @@ function documentsMatch(expected, remote, primaryKey) {
|
|
|
1736
1744
|
}
|
|
1737
1745
|
|
|
1738
1746
|
// ../../src/lib/density/catalog-constants.ts
|
|
1747
|
+
var FREE_ALWAYS_ON_CLOSED_AT = Date.parse("2026-11-10T00:00:00Z");
|
|
1739
1748
|
function formatMemory(mb) {
|
|
1740
1749
|
return mb >= 1024 ? `${mb / 1024} GB` : `${mb} MB`;
|
|
1741
1750
|
}
|
|
@@ -5578,7 +5587,8 @@ function syncClientFromFlags(flags, cwd, options = {}) {
|
|
|
5578
5587
|
return fetch(input, { ...init2, headers: merged });
|
|
5579
5588
|
} : void 0;
|
|
5580
5589
|
return new HeadbandClient({
|
|
5581
|
-
|
|
5590
|
+
// The sync client calls /v1 only: the same API host as every other /v1 call (api.ts).
|
|
5591
|
+
url: apiUrlFor(auth.url),
|
|
5582
5592
|
adminKey: auth.apiKey,
|
|
5583
5593
|
...fetchImpl ? { fetchImpl } : {}
|
|
5584
5594
|
});
|
|
@@ -6639,7 +6649,7 @@ async function runSync(args, flags, io, confirm, cwd) {
|
|
|
6639
6649
|
printCommandHelp("sync", io);
|
|
6640
6650
|
throw new UsageError("Unknown sync command");
|
|
6641
6651
|
}
|
|
6642
|
-
var CLI_VERSION = true ? "0.7.
|
|
6652
|
+
var CLI_VERSION = true ? "0.7.1" : "dev";
|
|
6643
6653
|
async function run(argv, context = { io: defaultIO }) {
|
|
6644
6654
|
if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v" || argv[0] === "version")) {
|
|
6645
6655
|
context.io.stdout(CLI_VERSION);
|