ignis-agent-cli 0.1.2 → 0.1.4

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 (3) hide show
  1. package/README.md +13 -1
  2. package/dist/index.js +31 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,10 +8,22 @@ Node CLI for the Ultra-Mai Agent V2 CLI facade.
8
8
  npm install -g ignis-agent-cli
9
9
  ```
10
10
 
11
+ Package name:
12
+ - `ignis-agent-cli`
13
+ - installed command: `ignis`
14
+
11
15
  ## Configure
12
16
 
13
17
  ```bash
14
- ignis login --base-url http://127.0.0.1:57988 --token <cli_token>
18
+ ignis login --config-url <user_config_link>
19
+ ```
20
+
21
+ Treat `config_url` as a short-lived bootstrap link. Fetch it once, save local config, and do not redistribute it.
22
+
23
+ Fallback:
24
+
25
+ ```bash
26
+ ignis login --base-url https://ignis-cli.funplus-marketing.ai --token <cli_token>
15
27
  ```
16
28
 
17
29
  This stores config in `~/.ignis/config.json` and reuses the current working directory as the default session context.
package/dist/index.js CHANGED
@@ -748,20 +748,29 @@ function toNonNegativeInt(value, fallbackValue) {
748
748
  import { Command as Command5 } from "commander";
749
749
  function buildLoginCommand() {
750
750
  const command = new Command5("login");
751
- command.description("Store CLI token and base URL in ~/.ignis/config.json").requiredOption("--base-url <url>", "Backend base URL").requiredOption("--token <token>", "CLI token").option("--json", "Print machine-readable JSON output").action(
751
+ command.description("Store CLI token and base URL in ~/.ignis/config.json").option("--base-url <url>", "Backend base URL").option("--token <token>", "CLI token").option("--config-url <url>", "Fetch a short-lived config JSON").option("--json", "Print machine-readable JSON output").action(
752
752
  wrapCommand(async (options) => {
753
+ const remoteConfig = options.configUrl?.trim() ? await fetchRemoteConfig(options.configUrl.trim()) : null;
754
+ const resolvedBaseUrl = (options.baseUrl?.trim() || remoteConfig?.baseUrl || "").replace(/\/+$/, "");
755
+ const resolvedToken = options.token?.trim() || remoteConfig?.cliToken || "";
756
+ if (!resolvedBaseUrl || !resolvedToken) {
757
+ throw new Error(
758
+ "Missing login config. Use `ignis login --config-url ...` or pass both --base-url and --token."
759
+ );
760
+ }
753
761
  const config = await loadConfig();
754
762
  const nextConfig = {
755
763
  ...config,
756
- baseUrl: options.baseUrl.trim().replace(/\/+$/, ""),
757
- cliToken: options.token.trim()
764
+ baseUrl: resolvedBaseUrl,
765
+ cliToken: resolvedToken
758
766
  };
759
767
  await saveConfig(nextConfig);
760
768
  if (options.json) {
761
769
  printJson({
762
770
  ok: true,
763
771
  config_path: getConfigPath(),
764
- base_url: nextConfig.baseUrl
772
+ base_url: nextConfig.baseUrl,
773
+ source: remoteConfig ? "config_url" : "direct"
765
774
  });
766
775
  } else {
767
776
  printLoginHuman(getConfigPath());
@@ -771,6 +780,23 @@ function buildLoginCommand() {
771
780
  );
772
781
  return command;
773
782
  }
783
+ async function fetchRemoteConfig(configUrl) {
784
+ const response = await fetch(configUrl, {
785
+ headers: {
786
+ Accept: "application/json, text/plain;q=0.9, */*;q=0.8"
787
+ }
788
+ });
789
+ if (!response.ok) {
790
+ throw new Error(`Failed to fetch config URL: ${response.status} ${response.statusText}`);
791
+ }
792
+ const payload = await response.json();
793
+ const baseUrl = String(payload.baseUrl || payload.base_url || "").trim().replace(/\/+$/, "");
794
+ const cliToken = String(payload.cliToken || payload.cli_token || "").trim();
795
+ if (!baseUrl || !cliToken) {
796
+ throw new Error("Config URL response must include baseUrl/base_url and cliToken/cli_token");
797
+ }
798
+ return { baseUrl, cliToken };
799
+ }
774
800
 
775
801
  // src/commands/result.ts
776
802
  import { Command as Command6, Option as Option4 } from "commander";
@@ -946,7 +972,7 @@ function buildWaitCommand() {
946
972
 
947
973
  // src/index.ts
948
974
  var program = new Command11();
949
- program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.1");
975
+ program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.4");
950
976
  program.addCommand(buildLoginCommand());
951
977
  program.addCommand(buildAskCommand());
952
978
  program.addCommand(buildHistoryCommand());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ignis-agent-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Stateless CLI for the Ultra-Mai Agent V2 service",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",