@aident-ai/cli 0.1.6 → 0.1.7

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +40 -4
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -496,6 +496,37 @@ function formatCliPackages(packages) {
496
496
  return packages.join(",");
497
497
  }
498
498
 
499
+ // ../web/shared/env/loadoutHosts.ts
500
+ var LOADOUT_PRODUCTION_HOST = "loadout.aident.ai";
501
+ var LOADOUT_STAGING_HOST = "staging.loadout.aident.ai";
502
+ var LOADOUT_PREVIEW_HOST = "rc.loadout.aident.ai";
503
+ var LOADOUT_CUSTOM_HOSTS = [LOADOUT_PRODUCTION_HOST, LOADOUT_STAGING_HOST, LOADOUT_PREVIEW_HOST];
504
+ var LOADOUT_HOST_BY_AIDENT_APP_HOST = {
505
+ "app.aident.ai": LOADOUT_PRODUCTION_HOST,
506
+ "staging.app.aident.ai": LOADOUT_STAGING_HOST,
507
+ "rc.app.aident.ai": LOADOUT_PREVIEW_HOST
508
+ };
509
+ var AIDENT_PUBLIC_HOSTS = new Set(["aident.ai", "www.aident.ai"]);
510
+ function getLoadoutHostname(host) {
511
+ return (host ?? "").split(":")[0]?.toLowerCase() ?? "";
512
+ }
513
+ function isLoadoutCustomHost(host) {
514
+ const hostname = getLoadoutHostname(host);
515
+ return LOADOUT_CUSTOM_HOSTS.some((candidate) => candidate === hostname) || /^pr-\d+-loadout\.prebuilt\.aident\.ai$/.test(hostname);
516
+ }
517
+ function getLoadoutHostForAidentAppHost(host) {
518
+ const hostname = getLoadoutHostname(host);
519
+ return LOADOUT_HOST_BY_AIDENT_APP_HOST[hostname] ?? null;
520
+ }
521
+ function getCanonicalLoadoutHost(host) {
522
+ const hostname = getLoadoutHostname(host);
523
+ return getLoadoutHostForAidentAppHost(hostname) ?? (isLoadoutCustomHost(hostname) ? hostname : null);
524
+ }
525
+ function getLoadoutHostForLegacyAidentHost(host) {
526
+ const hostname = getLoadoutHostname(host);
527
+ return AIDENT_PUBLIC_HOSTS.has(hostname) ? LOADOUT_PRODUCTION_HOST : getCanonicalLoadoutHost(hostname);
528
+ }
529
+
499
530
  // src/config.ts
500
531
  function getAidentDir() {
501
532
  const home = process.env.HOME || process.env.USERPROFILE || homedir();
@@ -512,6 +543,8 @@ async function readConfig() {
512
543
  const parsed = JSON.parse(text);
513
544
  if (!parsed || typeof parsed !== "object")
514
545
  return {};
546
+ if (typeof parsed.baseUrl === "string")
547
+ parsed.baseUrl = normalizeBaseUrl(parsed.baseUrl);
515
548
  return parsed;
516
549
  } catch {
517
550
  return {};
@@ -535,10 +568,10 @@ async function unsetConfigValue(key) {
535
568
  async function resolveDefaultBaseUrl() {
536
569
  const env = process.env.AIDENT_BASE_URL?.trim();
537
570
  if (env)
538
- return env;
571
+ return normalizeBaseUrl(env);
539
572
  const config = await readConfig();
540
573
  if (typeof config.baseUrl === "string" && config.baseUrl.trim() !== "") {
541
- return config.baseUrl.trim();
574
+ return normalizeBaseUrl(config.baseUrl);
542
575
  }
543
576
  return DEFAULT_BASE_URL;
544
577
  }
@@ -556,11 +589,14 @@ function normalizeBaseUrl(url) {
556
589
  let trimmed = url.trim();
557
590
  if (!/^https?:\/\//i.test(trimmed))
558
591
  trimmed = `https://${trimmed}`;
559
- return trimmed.replace(/\/+$/, "");
592
+ const normalized = trimmed.replace(/\/+$/, "");
593
+ const officialOrigin = /^https:\/\/([^/?#:@]+)$/i.exec(normalized);
594
+ const loadoutHost = getLoadoutHostForLegacyAidentHost(officialOrigin?.[1]);
595
+ return loadoutHost ? `https://${loadoutHost}` : normalized;
560
596
  }
561
597
 
562
598
  // src/version.ts
563
- var VERSION = "0.1.6";
599
+ var VERSION = "0.1.7";
564
600
 
565
601
  // src/catalogCache.ts
566
602
  var CACHE_TTL_MS = 5 * 60 * 1000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aident-ai/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
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": {