airgen-cli 0.11.1 → 0.12.0
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/client.d.ts +1 -0
- package/dist/client.js +6 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -5
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -189,6 +189,12 @@ export class AirgenClient {
|
|
|
189
189
|
}
|
|
190
190
|
// ── Auth ──────────────────────────────────────────────────────
|
|
191
191
|
async ensureAuth() {
|
|
192
|
+
// API key mode — no login needed
|
|
193
|
+
if (this.config.apiKey) {
|
|
194
|
+
this.auth.accessToken = this.config.apiKey;
|
|
195
|
+
this.auth.tokenExpiresAt = Infinity;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
192
198
|
// Already have a valid token (with 2min buffer)
|
|
193
199
|
if (this.auth.accessToken && Date.now() < this.auth.tokenExpiresAt - 120_000) {
|
|
194
200
|
return;
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -16,15 +16,16 @@ function loadRcFile() {
|
|
|
16
16
|
export function loadConfig() {
|
|
17
17
|
const rc = loadRcFile();
|
|
18
18
|
const apiUrl = process.env.AIRGEN_API_URL ?? rc.apiUrl;
|
|
19
|
-
const
|
|
20
|
-
const
|
|
19
|
+
const apiKey = process.env.AIRGEN_API_KEY ?? rc.apiKey;
|
|
20
|
+
const email = process.env.AIRGEN_EMAIL ?? rc.email ?? "";
|
|
21
|
+
const password = process.env.AIRGEN_PASSWORD ?? rc.password ?? "";
|
|
21
22
|
if (!apiUrl) {
|
|
22
23
|
console.error("Missing AIRGEN_API_URL. Set it via environment variable or ~/.airgenrc");
|
|
23
24
|
process.exit(1);
|
|
24
25
|
}
|
|
25
|
-
if (!email || !password) {
|
|
26
|
-
console.error("Missing AIRGEN_EMAIL
|
|
26
|
+
if (!apiKey && (!email || !password)) {
|
|
27
|
+
console.error("Missing credentials. Set AIRGEN_API_KEY or AIRGEN_EMAIL + AIRGEN_PASSWORD via environment or ~/.airgenrc");
|
|
27
28
|
process.exit(1);
|
|
28
29
|
}
|
|
29
|
-
return { apiUrl, email, password };
|
|
30
|
+
return { apiUrl, email, password, apiKey };
|
|
30
31
|
}
|