@siglume/api-sdk 0.7.5 → 0.7.6

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/dist/cli/index.js CHANGED
@@ -2511,11 +2511,15 @@ var init_client = __esm({
2511
2511
  max_retries;
2512
2512
  fetchImpl;
2513
2513
  pendingConfirmations = /* @__PURE__ */ new Map();
2514
- constructor(options) {
2515
- if (!options.api_key) {
2516
- throw new SiglumeClientError("SIGLUME_API_KEY is required.");
2514
+ constructor(options = {}) {
2515
+ const envApiKey = typeof process !== "undefined" ? process.env?.SIGLUME_API_KEY : void 0;
2516
+ const resolvedApiKey = (options.api_key ?? envApiKey ?? "").trim();
2517
+ if (!resolvedApiKey) {
2518
+ throw new SiglumeClientError(
2519
+ "SIGLUME_API_KEY is required. Pass it as the api_key option or set the SIGLUME_API_KEY env var."
2520
+ );
2517
2521
  }
2518
- this.api_key = options.api_key;
2522
+ this.api_key = resolvedApiKey;
2519
2523
  this.agent_key = options.agent_key?.trim() || void 0;
2520
2524
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
2521
2525
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
@@ -4578,7 +4582,7 @@ ${details}` : summary;
4578
4582
  const headers = new Headers({
4579
4583
  Authorization: `Bearer ${this.api_key}`,
4580
4584
  Accept: "application/json",
4581
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
4585
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
4582
4586
  });
4583
4587
  if (options.headers) {
4584
4588
  for (const [key, value] of Object.entries(options.headers)) {
@@ -4780,7 +4784,7 @@ var init_metering = __esm({
4780
4784
  fetchImpl;
4781
4785
  constructor(options) {
4782
4786
  this.client = new SiglumeClient(options);
4783
- this.api_key = options.api_key;
4787
+ this.api_key = this.client.api_key;
4784
4788
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
4785
4789
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
4786
4790
  this.max_retries = Math.max(1, Math.trunc(options.max_retries ?? 3));
@@ -4826,7 +4830,7 @@ var init_metering = __esm({
4826
4830
  const headers = new Headers({
4827
4831
  Authorization: `Bearer ${this.api_key}`,
4828
4832
  Accept: "application/json",
4829
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
4833
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
4830
4834
  });
4831
4835
  let body;
4832
4836
  if (options.json_body) {
@@ -7797,10 +7801,18 @@ function operationReadmeTemplate(operation, manifest, warning) {
7797
7801
  "",
7798
7802
  "## Commands",
7799
7803
  "",
7804
+ "Start locally without a Siglume API key:",
7805
+ "",
7800
7806
  "```bash",
7801
- "siglume validate .",
7802
7807
  "siglume test .",
7803
7808
  "npm test -- tests/test_adapter.ts",
7809
+ "siglume score . --offline",
7810
+ "```",
7811
+ "",
7812
+ "After placeholders are replaced and `SIGLUME_API_KEY` is set, run the server-aligned checks and register:",
7813
+ "",
7814
+ "```bash",
7815
+ "siglume validate .",
7804
7816
  "siglume score . --remote",
7805
7817
  "siglume register . --confirm",
7806
7818
  "```",
@@ -8230,9 +8242,17 @@ function readmeTemplate(template) {
8230
8242
  "",
8231
8243
  "Suggested workflow:",
8232
8244
  "",
8245
+ "Start locally without a Siglume API key:",
8246
+ "",
8233
8247
  "```bash",
8234
- "siglume validate .",
8235
8248
  "siglume test .",
8249
+ "siglume score . --offline",
8250
+ "```",
8251
+ "",
8252
+ "After placeholders are replaced and `SIGLUME_API_KEY` is set, run the server-aligned checks and register:",
8253
+ "",
8254
+ "```bash",
8255
+ "siglume validate .",
8236
8256
  "siglume score . --remote",
8237
8257
  "siglume register . --confirm",
8238
8258
  "```",