@aident-ai/cli 0.1.8-rc.0 → 0.1.8-rc.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/dist/cli.mjs +27 -22
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -598,7 +598,7 @@ function normalizeBaseUrl(url) {
|
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
// src/version.ts
|
|
601
|
-
var VERSION = "0.1.8-rc.
|
|
601
|
+
var VERSION = "0.1.8-rc.1";
|
|
602
602
|
|
|
603
603
|
// src/catalogCache.ts
|
|
604
604
|
var CACHE_TTL_MS = 5 * 60 * 1000;
|
|
@@ -6179,6 +6179,30 @@ function mergeCatalogs(catalogs, packages, onCommand) {
|
|
|
6179
6179
|
// src/credentials.ts
|
|
6180
6180
|
import { mkdir as mkdir5, readFile as readFile6, rm, writeFile as writeFile5 } from "node:fs/promises";
|
|
6181
6181
|
import { join as join7 } from "node:path";
|
|
6182
|
+
|
|
6183
|
+
// ../web/shared/loadout/AidentCredentialOrigin.mjs
|
|
6184
|
+
function getSharedAidentOrigin(value) {
|
|
6185
|
+
try {
|
|
6186
|
+
const url = new URL(value);
|
|
6187
|
+
if (url.protocol !== "https:" || url.port !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || url.username !== "" || url.password !== "" || url.hostname !== "aident.ai" && !url.hostname.endsWith(".aident.ai")) {
|
|
6188
|
+
return null;
|
|
6189
|
+
}
|
|
6190
|
+
return url.origin;
|
|
6191
|
+
} catch {
|
|
6192
|
+
return null;
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6195
|
+
function resolveAidentCredentialBaseUrl(credentialsBaseUrl, requestedBaseUrl) {
|
|
6196
|
+
const credentialsUrl = credentialsBaseUrl.replace(/\/+$/, "");
|
|
6197
|
+
const requestedUrl = requestedBaseUrl.replace(/\/+$/, "");
|
|
6198
|
+
if (credentialsUrl === requestedUrl)
|
|
6199
|
+
return requestedUrl;
|
|
6200
|
+
if (!getSharedAidentOrigin(credentialsUrl))
|
|
6201
|
+
return null;
|
|
6202
|
+
return getSharedAidentOrigin(requestedUrl);
|
|
6203
|
+
}
|
|
6204
|
+
|
|
6205
|
+
// src/credentials.ts
|
|
6182
6206
|
var REFRESH_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
6183
6207
|
function getCredentialsFile() {
|
|
6184
6208
|
return join7(getAidentDir(), "credentials.json");
|
|
@@ -6202,16 +6226,8 @@ async function clearCredentials() {
|
|
|
6202
6226
|
await rm(getCredentialsFile(), { force: true });
|
|
6203
6227
|
}
|
|
6204
6228
|
function credentialsForBaseUrl(creds, baseUrl) {
|
|
6205
|
-
const
|
|
6206
|
-
|
|
6207
|
-
if (credentialsBaseUrl === requestedBaseUrl)
|
|
6208
|
-
return { ...creds, base_url: requestedBaseUrl };
|
|
6209
|
-
if (!getSharedAidentBaseUrl(credentialsBaseUrl))
|
|
6210
|
-
return null;
|
|
6211
|
-
const sharedBaseUrl = getSharedAidentBaseUrl(requestedBaseUrl);
|
|
6212
|
-
if (!sharedBaseUrl)
|
|
6213
|
-
return null;
|
|
6214
|
-
return { ...creds, base_url: sharedBaseUrl };
|
|
6229
|
+
const resolvedBaseUrl = resolveAidentCredentialBaseUrl(creds.base_url, baseUrl);
|
|
6230
|
+
return resolvedBaseUrl ? { ...creds, base_url: resolvedBaseUrl } : null;
|
|
6215
6231
|
}
|
|
6216
6232
|
async function clearCredentialsForIncompatibleBaseUrl(baseUrl) {
|
|
6217
6233
|
const creds = await readCredentials();
|
|
@@ -6228,17 +6244,6 @@ function isExpired(creds) {
|
|
|
6228
6244
|
return false;
|
|
6229
6245
|
return Date.now() >= expiresAt - REFRESH_WINDOW_MS;
|
|
6230
6246
|
}
|
|
6231
|
-
function getSharedAidentBaseUrl(baseUrl) {
|
|
6232
|
-
try {
|
|
6233
|
-
const url = new URL(baseUrl);
|
|
6234
|
-
if (url.protocol !== "https:" || url.port !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "" || url.username !== "" || url.password !== "" || url.hostname !== "aident.ai" && !url.hostname.endsWith(".aident.ai")) {
|
|
6235
|
-
return null;
|
|
6236
|
-
}
|
|
6237
|
-
return url.origin;
|
|
6238
|
-
} catch {
|
|
6239
|
-
return null;
|
|
6240
|
-
}
|
|
6241
|
-
}
|
|
6242
6247
|
|
|
6243
6248
|
// src/doctor.ts
|
|
6244
6249
|
import { existsSync as existsSync2 } from "node:fs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aident-ai/cli",
|
|
3
|
-
"version": "0.1.8-rc.
|
|
3
|
+
"version": "0.1.8-rc.1",
|
|
4
4
|
"description": "Aident CLI — umbrella access to Loadout integrations, Playbook automation, Intern tools, and the Aident platform.",
|
|
5
5
|
"homepage": "https://aident.ai",
|
|
6
6
|
"repository": {
|