@aigne/cli 1.36.0 → 1.36.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.36.3](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.36.2...cli-v1.36.3) (2025-08-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **cli:** display only the origin URL when linking to hub ([#369](https://github.com/AIGNE-io/aigne-framework/issues/369)) ([b3baf3f](https://github.com/AIGNE-io/aigne-framework/commit/b3baf3f2c98f965d5279dd0dfb282be9f5ffb6c2))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @aigne/aigne-hub bumped to 0.6.2
16
+
17
+ ## [1.36.2](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.36.1...cli-v1.36.2) (2025-08-15)
18
+
19
+
20
+ ### Dependencies
21
+
22
+ * The following workspace dependencies were updated
23
+ * dependencies
24
+ * @aigne/aigne-hub bumped to 0.6.1
25
+
26
+ ## [1.36.1](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.36.0...cli-v1.36.1) (2025-08-14)
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * The following workspace dependencies were updated
32
+ * dependencies
33
+ * @aigne/aigne-hub bumped to 0.6.0
34
+
3
35
  ## [1.36.0](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.35.1...cli-v1.36.0) (2025-08-14)
4
36
 
5
37
 
@@ -6,6 +6,7 @@ import Table from "cli-table3";
6
6
  import inquirer from "inquirer";
7
7
  import { parse, stringify } from "yaml";
8
8
  import { getUserInfo } from "../utils/aigne-hub-user.js";
9
+ import { getUrlOrigin } from "../utils/get-url-origin.js";
9
10
  const formatNumber = (balance) => {
10
11
  const balanceNum = String(balance).split(".")[0];
11
12
  return chalk.yellow((balanceNum || "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
@@ -82,8 +83,8 @@ async function formatHubsList(statusList) {
82
83
  });
83
84
  console.log(chalk.blue("Connected AIGNE Hubs:\n"));
84
85
  for (const status of statusList) {
85
- const isConnected = new URL(status.apiUrl).origin === new URL(defaultHub).origin;
86
- table.push([status.apiUrl, isConnected ? "YES" : "NO"]);
86
+ const isConnected = getUrlOrigin(status.apiUrl) === getUrlOrigin(defaultHub);
87
+ table.push([getUrlOrigin(status.apiUrl), isConnected ? "YES" : "NO"]);
87
88
  }
88
89
  console.log(table.toString());
89
90
  console.log(chalk.blue("Use 'aigne hub use' to switch to a different hub."));
@@ -158,7 +159,7 @@ async function useHub() {
158
159
  name: "hubApiKey",
159
160
  message: `Choose a hub to switch to:`,
160
161
  choices: hubs.map((h) => ({
161
- name: new URL(h.apiUrl).origin,
162
+ name: getUrlOrigin(h.apiUrl),
162
163
  value: h.apiUrl,
163
164
  })),
164
165
  });
@@ -170,7 +171,7 @@ async function showStatus() {
170
171
  console.log(chalk.red("No active hub."));
171
172
  return;
172
173
  }
173
- console.log(`Active hub: ${active} - online`);
174
+ console.log(`Active hub: ${getUrlOrigin(active)} - online`);
174
175
  }
175
176
  async function removeHub() {
176
177
  const hubs = await getHubs();
@@ -183,7 +184,7 @@ async function removeHub() {
183
184
  name: "hubApiKey",
184
185
  message: `Choose a hub to remove:`,
185
186
  choices: hubs.map((h) => ({
186
- name: new URL(h.apiUrl).origin,
187
+ name: getUrlOrigin(h.apiUrl),
187
188
  value: h.apiUrl,
188
189
  })),
189
190
  });
@@ -200,7 +201,7 @@ async function showInfo() {
200
201
  name: "hubApiKey",
201
202
  message: `Choose a hub to view info:`,
202
203
  choices: hubs.map((h) => ({
203
- name: new URL(h.apiUrl).origin,
204
+ name: getUrlOrigin(h.apiUrl),
204
205
  value: h.apiUrl,
205
206
  })),
206
207
  });
@@ -219,9 +220,12 @@ async function saveAndConnect(url) {
219
220
  const envs = parse(await readFile(AIGNE_ENV_FILE, "utf8").catch(() => stringify({})));
220
221
  const host = new URL(url).host;
221
222
  if (envs[host]) {
222
- await setDefaultHub(envs[host]?.AIGNE_HUB_API_URL || "");
223
- console.log(chalk.green(`✓ Hub ${envs[host]?.AIGNE_HUB_API_URL} connected successfully.`));
224
- return;
223
+ const currentUrl = envs[host]?.AIGNE_HUB_API_URL;
224
+ if (currentUrl) {
225
+ await setDefaultHub(currentUrl);
226
+ console.log(chalk.green(`✓ Hub ${getUrlOrigin(currentUrl)} connected successfully.`));
227
+ return;
228
+ }
225
229
  }
226
230
  try {
227
231
  if (isTest) {
@@ -237,7 +241,7 @@ async function saveAndConnect(url) {
237
241
  return;
238
242
  }
239
243
  await connectToAIGNEHub(url);
240
- console.log(chalk.green(`✓ Hub ${url} connected successfully.`));
244
+ console.log(chalk.green(`✓ Hub ${getUrlOrigin(url)} connected successfully.`));
241
245
  }
242
246
  catch (error) {
243
247
  console.error(chalk.red("✗ Failed to connect:"), error.message);
@@ -251,7 +255,7 @@ async function setDefaultHub(url) {
251
255
  return;
252
256
  }
253
257
  await writeFile(AIGNE_ENV_FILE, stringify({ ...envs, default: { AIGNE_HUB_API_URL: envs[host]?.AIGNE_HUB_API_URL } }));
254
- console.log(chalk.green(`✓ Switched active hub to ${url}`));
258
+ console.log(chalk.green(`✓ Switched active hub to ${getUrlOrigin(url)}`));
255
259
  }
256
260
  async function deleteHub(url) {
257
261
  const envs = parse(await readFile(AIGNE_ENV_FILE, "utf8").catch(() => stringify({})));
@@ -261,7 +265,7 @@ async function deleteHub(url) {
261
265
  delete envs.default;
262
266
  }
263
267
  await writeFile(AIGNE_ENV_FILE, stringify(envs));
264
- console.log(chalk.green(`✓ Hub ${url} removed`));
268
+ console.log(chalk.green(`✓ Hub ${getUrlOrigin(url)} removed`));
265
269
  }
266
270
  async function printHubDetails(url) {
267
271
  const envs = parse(await readFile(AIGNE_ENV_FILE, "utf8").catch(() => stringify({})));
@@ -271,7 +275,7 @@ async function printHubDetails(url) {
271
275
  apiKey: envs[host]?.AIGNE_HUB_API_KEY || "",
272
276
  }).catch(() => null);
273
277
  printHubStatus({
274
- hub: url,
278
+ hub: getUrlOrigin(url),
275
279
  status: userInfo ? "Connected" : "Not connected",
276
280
  user: {
277
281
  name: userInfo?.user.fullName || "",
@@ -0,0 +1 @@
1
+ export declare const getUrlOrigin: (url: string) => string;
@@ -0,0 +1,8 @@
1
+ export const getUrlOrigin = (url) => {
2
+ try {
3
+ return new URL(url).origin;
4
+ }
5
+ catch {
6
+ return url;
7
+ }
8
+ };
@@ -10,6 +10,7 @@ import chalk from "chalk";
10
10
  import inquirer from "inquirer";
11
11
  import { parse, stringify } from "yaml";
12
12
  import { availableMemories } from "../constants.js";
13
+ import { getUrlOrigin } from "./get-url-origin.js";
13
14
  const isTest = process.env.CI || process.env.NODE_ENV === "test";
14
15
  const mockInquirerPrompt = (() => Promise.resolve({ useAigneHub: true }));
15
16
  let printed = false;
@@ -23,7 +24,7 @@ function printChatModelInfoBox(model) {
23
24
  lines.push(`${chalk.cyan("Model")}: ${chalk.green(credential?.model)}`);
24
25
  }
25
26
  if (credential?.url) {
26
- lines.push(`${chalk.cyan("API URL")}: ${chalk.green(credential?.url || "N/A")}`);
27
+ lines.push(`${chalk.cyan("API URL")}: ${chalk.green(getUrlOrigin(credential?.url) || "N/A")}`);
27
28
  }
28
29
  if (credential?.apiKey) {
29
30
  lines.push(`${chalk.cyan("API Key")}: ${chalk.green(maskApiKey(credential?.apiKey))}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/cli",
3
- "version": "1.36.0",
3
+ "version": "1.36.3",
4
4
  "description": "Your command center for agent development",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -72,13 +72,13 @@
72
72
  "yaml": "^2.8.0",
73
73
  "yargs": "^18.0.0",
74
74
  "zod": "^3.25.67",
75
- "@aigne/aigne-hub": "^0.5.2",
76
- "@aigne/agentic-memory": "^1.0.20",
77
75
  "@aigne/agent-library": "^1.21.20",
78
- "@aigne/core": "^1.50.0",
76
+ "@aigne/agentic-memory": "^1.0.20",
77
+ "@aigne/aigne-hub": "^0.6.2",
79
78
  "@aigne/default-memory": "^1.1.2",
80
- "@aigne/openai": "^0.11.2",
81
- "@aigne/observability-api": "^0.9.0"
79
+ "@aigne/core": "^1.50.0",
80
+ "@aigne/observability-api": "^0.9.0",
81
+ "@aigne/openai": "^0.11.2"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/archiver": "^6.0.3",