@aigne/cli 1.49.2-beta → 1.49.2-beta.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 +7 -0
- package/dist/cli.js +3 -2
- package/dist/commands/aigne.d.ts +1 -0
- package/dist/commands/aigne.js +1 -1
- package/dist/commands/app.d.ts +3 -1
- package/dist/commands/app.js +41 -30
- package/dist/utils/spinner.d.ts +1 -0
- package/dist/utils/spinner.js +14 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.49.2-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.49.2-beta...cli-v1.49.2-beta.1) (2025-09-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **cli:** improve app loading reliability with force upgrade on error ([#566](https://github.com/AIGNE-io/aigne-framework/issues/566)) ([d7c49cf](https://github.com/AIGNE-io/aigne-framework/commit/d7c49cfdfdc72c0d1a98c3033babe1392cb707c1))
|
|
9
|
+
|
|
3
10
|
## [1.49.2-beta](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.49.1...cli-v1.49.2-beta) (2025-09-29)
|
|
4
11
|
|
|
5
12
|
|
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,8 @@ function getAIGNEFilePath() {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const aigneFilePath = getAIGNEFilePath();
|
|
19
|
-
|
|
19
|
+
const argv = process.argv.slice(aigneFilePath ? 3 : 2);
|
|
20
|
+
export default createAIGNECommand({ argv, aigneFilePath })
|
|
20
21
|
.fail((message, error, yargs) => {
|
|
21
22
|
// We catch all errors below, here just print the help message non-error case like demandCommand
|
|
22
23
|
if (!error) {
|
|
@@ -25,7 +26,7 @@ export default createAIGNECommand({ aigneFilePath })
|
|
|
25
26
|
process.exit(1);
|
|
26
27
|
}
|
|
27
28
|
})
|
|
28
|
-
.parseAsync(
|
|
29
|
+
.parseAsync(argv)
|
|
29
30
|
.catch((error) => {
|
|
30
31
|
console.log(""); // Add an empty line for better readability
|
|
31
32
|
console.error(`${chalk.red("Error:")} ${highlightUrl(error.message)}`);
|
package/dist/commands/aigne.d.ts
CHANGED
package/dist/commands/aigne.js
CHANGED
|
@@ -21,7 +21,7 @@ export function createAIGNECommand(options) {
|
|
|
21
21
|
.command(createCreateCommand())
|
|
22
22
|
.command(createServeMCPCommand(options))
|
|
23
23
|
.command(createObservabilityCommand())
|
|
24
|
-
.command(createAppCommands())
|
|
24
|
+
.command(createAppCommands(options))
|
|
25
25
|
.command(createHubCommand())
|
|
26
26
|
.command(createDeployCommands())
|
|
27
27
|
.demandCommand()
|
package/dist/commands/app.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs";
|
|
2
2
|
import { type AgentInChildProcess, type LoadAIGNEInChildProcessResult } from "../utils/workers/run-aigne-in-child-process.js";
|
|
3
3
|
import { type AgentRunCommonOptions } from "../utils/yargs.js";
|
|
4
|
-
export declare function createAppCommands(
|
|
4
|
+
export declare function createAppCommands({ argv }?: {
|
|
5
|
+
argv?: string[];
|
|
6
|
+
}): CommandModule[];
|
|
5
7
|
export declare const agentCommandModule: ({ dir, agent, }: {
|
|
6
8
|
dir: string;
|
|
7
9
|
agent: AgentInChildProcess;
|
package/dist/commands/app.js
CHANGED
|
@@ -7,6 +7,7 @@ import { jsonSchemaToZod } from "@aigne/json-schema-to-zod";
|
|
|
7
7
|
import { Listr, PRESET_TIMER } from "@aigne/listr2";
|
|
8
8
|
import { joinURL } from "ufo";
|
|
9
9
|
import { downloadAndExtract } from "../utils/download.js";
|
|
10
|
+
import { withSpinner } from "../utils/spinner.js";
|
|
10
11
|
import { runAIGNEInChildProcess, } from "../utils/workers/run-aigne-in-child-process.js";
|
|
11
12
|
import { withAgentInputSchema } from "../utils/yargs.js";
|
|
12
13
|
import { serveMCPServerFromDir } from "./serve-mcp.js";
|
|
@@ -32,36 +33,36 @@ const builtinApps = [
|
|
|
32
33
|
aliases: ["websmith", "web"],
|
|
33
34
|
},
|
|
34
35
|
];
|
|
35
|
-
export function createAppCommands() {
|
|
36
|
+
export function createAppCommands({ argv } = {}) {
|
|
36
37
|
return builtinApps.map((app) => ({
|
|
37
38
|
command: app.name,
|
|
38
39
|
describe: app.describe,
|
|
39
40
|
aliases: app.aliases,
|
|
40
|
-
builder: async (
|
|
41
|
+
builder: async (y) => {
|
|
41
42
|
const dir = join(homedir(), ".aigne", "registry.npmjs.org", app.packageName);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
yargs.command({
|
|
49
|
-
...agentCommandModule({ dir, agent: aigne.cli.chat }),
|
|
50
|
-
command: "$0",
|
|
43
|
+
y.command(upgradeCommandModule({ packageName: app.packageName, dir }));
|
|
44
|
+
if (!argv || !isUpgradeCommand(argv)) {
|
|
45
|
+
const { aigne, version } = await loadApplication({
|
|
46
|
+
dir,
|
|
47
|
+
packageName: app.packageName,
|
|
48
|
+
install: true,
|
|
51
49
|
});
|
|
50
|
+
if (aigne.cli?.chat) {
|
|
51
|
+
y.command({
|
|
52
|
+
...agentCommandModule({ dir, agent: aigne.cli.chat }),
|
|
53
|
+
command: "$0",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
for (const agent of aigne.cli?.agents ?? []) {
|
|
57
|
+
y.command(agentCommandModule({ dir, agent }));
|
|
58
|
+
}
|
|
59
|
+
y.option("model", {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Model to use for the application, example: openai:gpt-4.1 or google:gemini-2.5-flash",
|
|
62
|
+
}).command(serveMcpCommandModule({ name: app.name, dir }));
|
|
63
|
+
y.version(`${app.name} v${version}`).alias("version", "v");
|
|
52
64
|
}
|
|
53
|
-
|
|
54
|
-
yargs.command(agentCommandModule({ dir, agent }));
|
|
55
|
-
}
|
|
56
|
-
yargs
|
|
57
|
-
.option("model", {
|
|
58
|
-
type: "string",
|
|
59
|
-
description: "Model to use for the application, example: openai:gpt-4.1 or google:gemini-2.5-flash",
|
|
60
|
-
})
|
|
61
|
-
.command(serveMcpCommandModule({ name: app.name, dir }))
|
|
62
|
-
.command(upgradeCommandModule({ packageName: app.packageName, dir }));
|
|
63
|
-
yargs.version(`${app.name} v${version}`).alias("version", "v");
|
|
64
|
-
return yargs.demandCommand();
|
|
65
|
+
return y.demandCommand();
|
|
65
66
|
},
|
|
66
67
|
handler: () => { },
|
|
67
68
|
}));
|
|
@@ -90,11 +91,15 @@ const serveMcpCommandModule = ({ name, dir, }) => ({
|
|
|
90
91
|
await serveMCPServerFromDir({ ...options, dir });
|
|
91
92
|
},
|
|
92
93
|
});
|
|
94
|
+
function isUpgradeCommand(argv) {
|
|
95
|
+
const skipGlobalOptions = ["-v", "--version"];
|
|
96
|
+
return argv[1] === "upgrade" && !argv.some((arg) => skipGlobalOptions.includes(arg));
|
|
97
|
+
}
|
|
93
98
|
const upgradeCommandModule = ({ packageName, dir, }) => ({
|
|
94
99
|
command: "upgrade",
|
|
95
100
|
describe: `Upgrade ${packageName} to the latest version`,
|
|
96
|
-
builder: (
|
|
97
|
-
return
|
|
101
|
+
builder: (yargs) => {
|
|
102
|
+
return yargs
|
|
98
103
|
.option("beta", {
|
|
99
104
|
type: "boolean",
|
|
100
105
|
describe: "Use beta versions if available",
|
|
@@ -112,11 +117,13 @@ const upgradeCommandModule = ({ packageName, dir, }) => ({
|
|
|
112
117
|
},
|
|
113
118
|
handler: async ({ beta, targetVersion, force }) => {
|
|
114
119
|
beta ??= shouldUseBetaApps();
|
|
115
|
-
|
|
116
|
-
const npm = await getNpmTgzInfo(packageName, { beta, version: targetVersion });
|
|
117
|
-
if (!app || force || npm.version !== app.version) {
|
|
120
|
+
const npm = await withSpinner("", async () => {
|
|
118
121
|
if (force)
|
|
119
122
|
await rm(dir, { force: true, recursive: true });
|
|
123
|
+
return await getNpmTgzInfo(packageName, { beta, version: targetVersion });
|
|
124
|
+
});
|
|
125
|
+
let app = await loadApplication({ packageName, dir });
|
|
126
|
+
if (!app || force || npm.version !== app.version) {
|
|
120
127
|
await installApp({ packageName, dir, beta, version: targetVersion });
|
|
121
128
|
app = await loadApplication({ dir, packageName, install: true });
|
|
122
129
|
console.log(`\n✅ Upgraded ${packageName} to version ${app.version}`);
|
|
@@ -149,8 +156,12 @@ export async function loadApplication(options) {
|
|
|
149
156
|
const { dir, packageName } = options;
|
|
150
157
|
const check = await checkInstallation(dir);
|
|
151
158
|
if (check && !check.expired) {
|
|
152
|
-
const aigne = await runAIGNEInChildProcess("loadAIGNE", dir).catch((error) => {
|
|
153
|
-
|
|
159
|
+
const aigne = await runAIGNEInChildProcess("loadAIGNE", dir).catch(async (error) => {
|
|
160
|
+
logger.error(`⚠️ Failed to load ${packageName}, trying to reinstall:`, error.message);
|
|
161
|
+
await withSpinner("", async () => {
|
|
162
|
+
await rm(options.dir, { recursive: true, force: true });
|
|
163
|
+
await mkdir(options.dir, { recursive: true });
|
|
164
|
+
});
|
|
154
165
|
});
|
|
155
166
|
if (aigne) {
|
|
156
167
|
return { aigne, version: check.version, isCache: true };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function withSpinner<T>(message: string, fn: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Spinner } from "@aigne/listr2";
|
|
2
|
+
export async function withSpinner(message, fn) {
|
|
3
|
+
const spinner = new Spinner();
|
|
4
|
+
spinner.start(() => {
|
|
5
|
+
process.stdout.write(`\r\x1b[K${spinner.fetch()} ${message}`);
|
|
6
|
+
});
|
|
7
|
+
try {
|
|
8
|
+
return await fn();
|
|
9
|
+
}
|
|
10
|
+
finally {
|
|
11
|
+
spinner.stop();
|
|
12
|
+
process.stdout.write("\r\x1b[K"); // Clear the spinner line
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/cli",
|
|
3
|
-
"version": "1.49.2-beta",
|
|
3
|
+
"version": "1.49.2-beta.1",
|
|
4
4
|
"description": "Your command center for agent development",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"zod": "^3.25.67",
|
|
86
86
|
"zod-to-json-schema": "^3.24.6",
|
|
87
87
|
"@aigne/agent-library": "^1.21.47-beta",
|
|
88
|
+
"@aigne/agentic-memory": "^1.0.47-beta",
|
|
88
89
|
"@aigne/aigne-hub": "^0.10.1-beta",
|
|
89
90
|
"@aigne/core": "^1.61.1-beta",
|
|
90
91
|
"@aigne/default-memory": "^1.2.10-beta",
|
|
91
|
-
"@aigne/agentic-memory": "^1.0.47-beta",
|
|
92
92
|
"@aigne/observability-api": "^0.11.1-beta",
|
|
93
93
|
"@aigne/openai": "^0.16.1-beta"
|
|
94
94
|
},
|