@aigne/cli 1.19.0 → 1.20.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/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.20.1](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.20.0...cli-v1.20.1) (2025-07-02)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @aigne/agent-library bumped to 1.17.9
11
+ * @aigne/anthropic bumped to 0.5.4
12
+ * @aigne/bedrock bumped to 0.5.4
13
+ * @aigne/core bumped to 1.29.1
14
+ * @aigne/deepseek bumped to 0.4.4
15
+ * @aigne/gemini bumped to 0.4.4
16
+ * @aigne/observability-api bumped to 0.3.3
17
+ * @aigne/ollama bumped to 0.4.4
18
+ * @aigne/open-router bumped to 0.4.4
19
+ * @aigne/openai bumped to 0.6.4
20
+ * @aigne/xai bumped to 0.4.4
21
+
22
+ ## [1.20.0](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.19.0...cli-v1.20.0) (2025-07-02)
23
+
24
+
25
+ ### Features
26
+
27
+ * **cli:** support executing aigne.yaml via shebang (#!/usr/bin/env aigne) ([#211](https://github.com/AIGNE-io/aigne-framework/issues/211)) ([2a82c27](https://github.com/AIGNE-io/aigne-framework/commit/2a82c2754b5eab5c3d6e45a5cbe7f0c76d927967))
28
+
29
+
30
+ ### Dependencies
31
+
32
+ * The following workspace dependencies were updated
33
+ * dependencies
34
+ * @aigne/agent-library bumped to 1.17.8
35
+ * @aigne/anthropic bumped to 0.5.3
36
+ * @aigne/bedrock bumped to 0.5.3
37
+ * @aigne/core bumped to 1.29.0
38
+ * @aigne/deepseek bumped to 0.4.3
39
+ * @aigne/gemini bumped to 0.4.3
40
+ * @aigne/ollama bumped to 0.4.3
41
+ * @aigne/open-router bumped to 0.4.3
42
+ * @aigne/openai bumped to 0.6.3
43
+ * @aigne/xai bumped to 0.4.3
44
+
3
45
  ## [1.19.0](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.18.1...cli-v1.19.0) (2025-07-01)
4
46
 
5
47
 
package/dist/cli.js CHANGED
@@ -1,10 +1,22 @@
1
1
  #!/usr/bin/env node
2
+ import { existsSync, realpathSync, statSync } from "node:fs";
2
3
  import { config } from "dotenv-flow";
3
4
  import PrettyError from "pretty-error";
4
5
  import { createAIGNECommand } from "./commands/aigne.js";
5
6
  config({ silent: true });
6
- createAIGNECommand()
7
- .parseAsync()
7
+ function getAIGNEFilePath() {
8
+ let file = process.argv[2];
9
+ if (file) {
10
+ if (!existsSync(file))
11
+ return;
12
+ file = realpathSync(file);
13
+ if (statSync(file).isFile())
14
+ return file;
15
+ }
16
+ }
17
+ const aigneFilePath = getAIGNEFilePath();
18
+ createAIGNECommand({ aigneFilePath })
19
+ .parseAsync(["", "", ...process.argv.slice(aigneFilePath ? 3 : 2)])
8
20
  .catch((error) => {
9
21
  console.error(new PrettyError().render(error));
10
22
  process.exit(1);
@@ -1,2 +1,4 @@
1
1
  import { Command } from "commander";
2
- export declare function createAIGNECommand(): Command;
2
+ export declare function createAIGNECommand(options?: {
3
+ aigneFilePath?: string;
4
+ }): Command;
@@ -6,16 +6,16 @@ import { createObservabilityCommand } from "./observe.js";
6
6
  import { createRunCommand } from "./run.js";
7
7
  import { createServeMCPCommand } from "./serve-mcp.js";
8
8
  import { createTestCommand } from "./test.js";
9
- export function createAIGNECommand() {
9
+ export function createAIGNECommand(options) {
10
10
  console.log(asciiLogo);
11
11
  return new Command()
12
12
  .name("aigne")
13
13
  .description("CLI for AIGNE framework")
14
14
  .version(AIGNE_CLI_VERSION)
15
- .addCommand(createRunCommand())
16
- .addCommand(createTestCommand())
15
+ .addCommand(createRunCommand(options))
16
+ .addCommand(createTestCommand(options))
17
17
  .addCommand(createCreateCommand())
18
- .addCommand(createServeMCPCommand())
18
+ .addCommand(createServeMCPCommand(options))
19
19
  .addCommand(createObservabilityCommand())
20
20
  .showHelpAfterError(true)
21
21
  .showSuggestionAfterError(true);
@@ -1,2 +1,4 @@
1
1
  import type { Command } from "commander";
2
- export declare function createRunCommand(): Command;
2
+ export declare function createRunCommand({ aigneFilePath }?: {
3
+ aigneFilePath?: string;
4
+ }): Command;
@@ -12,14 +12,14 @@ import { availableMemories, availableModels } from "../constants.js";
12
12
  import { isV1Package, toAIGNEPackage } from "../utils/agent-v1.js";
13
13
  import { downloadAndExtract } from "../utils/download.js";
14
14
  import { createRunAIGNECommand, parseAgentInputByCommander, parseModelOption, runAgentWithAIGNE, } from "../utils/run-with-aigne.js";
15
- export function createRunCommand() {
15
+ export function createRunCommand({ aigneFilePath } = {}) {
16
16
  return createRunAIGNECommand()
17
17
  .description("Run AIGNE from the specified agent")
18
18
  .option("--url, --path <path_or_url>", "Path to the agents directory or URL to aigne project", ".")
19
19
  .option("--entry-agent <entry-agent>", "Name of the agent to run (defaults to the first agent found)")
20
20
  .option("--cache-dir <dir>", "Directory to download the package to (defaults to the ~/.aigne/xxx)")
21
21
  .action(async (options) => {
22
- const { path } = options;
22
+ const path = aigneFilePath || options.path;
23
23
  if (options.logLevel)
24
24
  logger.level = options.logLevel;
25
25
  const { cacheDir, dir } = prepareDirs(path, options);
@@ -1,2 +1,4 @@
1
1
  import { Command } from "commander";
2
- export declare function createServeMCPCommand(): Command;
2
+ export declare function createServeMCPCommand({ aigneFilePath }?: {
3
+ aigneFilePath?: string;
4
+ }): Command;
@@ -13,7 +13,7 @@ const DEFAULT_PORT = () => tryOrThrow(() => {
13
13
  throw new Error(`Invalid PORT: ${PORT}`);
14
14
  return port;
15
15
  }, (error) => new Error(`parse PORT error ${error.message}`));
16
- export function createServeMCPCommand() {
16
+ export function createServeMCPCommand({ aigneFilePath } = {}) {
17
17
  return new Command("serve-mcp")
18
18
  .description("Serve the agents in the specified directory as a MCP server (streamable http)")
19
19
  .option("--url, --path <path_or_url>", "Path to the agents directory or URL to aigne project", ".")
@@ -21,7 +21,7 @@ export function createServeMCPCommand() {
21
21
  .option("--port <port>", "Port to run the MCP server on", (s) => Number.parseInt(s))
22
22
  .option("--pathname <pathname>", "Pathname to the service", "/mcp")
23
23
  .action(async (options) => {
24
- const { path } = options;
24
+ const path = aigneFilePath || options.path;
25
25
  const absolutePath = isAbsolute(path) ? path : resolve(process.cwd(), path);
26
26
  const port = options.port || DEFAULT_PORT();
27
27
  const aigne = await AIGNE.load(absolutePath, {
@@ -1,2 +1,4 @@
1
1
  import { Command } from "commander";
2
- export declare function createTestCommand(): Command;
2
+ export declare function createTestCommand({ aigneFilePath }?: {
3
+ aigneFilePath?: string;
4
+ }): Command;
@@ -1,12 +1,12 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { isAbsolute, resolve } from "node:path";
3
3
  import { Command } from "commander";
4
- export function createTestCommand() {
4
+ export function createTestCommand({ aigneFilePath } = {}) {
5
5
  return new Command("test")
6
6
  .description("Run tests in the specified agents directory")
7
7
  .option("--url, --path <path_or_url>", "Path to the agents directory or URL to aigne project", ".")
8
8
  .action(async (options) => {
9
- const { path } = options;
9
+ const path = aigneFilePath || options.path;
10
10
  const absolutePath = isAbsolute(path) ? path : resolve(process.cwd(), path);
11
11
  spawnSync("node", ["--test"], { cwd: absolutePath, stdio: "inherit" });
12
12
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/cli",
3
- "version": "1.19.0",
3
+ "version": "1.20.1",
4
4
  "description": "cli for AIGNE framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -55,17 +55,17 @@
55
55
  "wrap-ansi": "^9.0.0",
56
56
  "yaml": "^2.7.1",
57
57
  "zod": "^3.24.4",
58
- "@aigne/anthropic": "^0.5.2",
59
- "@aigne/bedrock": "^0.5.2",
60
- "@aigne/core": "^1.28.2",
61
- "@aigne/deepseek": "^0.4.2",
62
- "@aigne/agent-library": "^1.17.7",
63
- "@aigne/gemini": "^0.4.2",
64
- "@aigne/observability-api": "^0.3.2",
65
- "@aigne/ollama": "^0.4.2",
66
- "@aigne/open-router": "^0.4.2",
67
- "@aigne/openai": "^0.6.2",
68
- "@aigne/xai": "^0.4.2"
58
+ "@aigne/agent-library": "^1.17.9",
59
+ "@aigne/anthropic": "^0.5.4",
60
+ "@aigne/bedrock": "^0.5.4",
61
+ "@aigne/core": "^1.29.1",
62
+ "@aigne/deepseek": "^0.4.4",
63
+ "@aigne/gemini": "^0.4.4",
64
+ "@aigne/observability-api": "^0.3.3",
65
+ "@aigne/ollama": "^0.4.4",
66
+ "@aigne/open-router": "^0.4.4",
67
+ "@aigne/openai": "^0.6.4",
68
+ "@aigne/xai": "^0.4.4"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/archiver": "^6.0.3",