@aigne/cli 1.30.0 → 1.30.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,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.30.1](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.30.0...cli-v1.30.1) (2025-08-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **cli:** persist prompts log and improve terminal output ([#307](https://github.com/AIGNE-io/aigne-framework/issues/307)) ([ac8116f](https://github.com/AIGNE-io/aigne-framework/commit/ac8116fc46f26169e7619860c392fb9f66bc3fee))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @aigne/agent-library bumped to 1.21.10
16
+ * @aigne/agentic-memory bumped to 1.0.10
17
+ * @aigne/aigne-hub bumped to 0.4.1
18
+ * @aigne/openai bumped to 0.10.10
19
+ * @aigne/core bumped to 1.43.0
20
+ * @aigne/default-memory bumped to 1.0.10
21
+
3
22
  ## [1.30.0](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.29.0...cli-v1.30.0) (2025-08-01)
4
23
 
5
24
 
@@ -207,7 +207,6 @@ export async function loadApplication({ name, dir, forceUpgrade = false, }) {
207
207
  },
208
208
  {
209
209
  title: "Installing dependencies",
210
- skip: (ctx) => ctx.version === check?.version,
211
210
  task: async () => {
212
211
  await installDependencies(dir);
213
212
  },
@@ -70,9 +70,11 @@ export class TerminalTracer {
70
70
  return undefined;
71
71
  return async (config) => {
72
72
  const { taskWrapper } = await task.listr.promise;
73
- return taskWrapper
73
+ const result = await taskWrapper
74
74
  .prompt(ListrInquirerPromptAdapter)
75
75
  .run(method, config);
76
+ console.log(`${chalk.blue("✔")} ${chalk.bold(config.message)} ${result}`);
77
+ return result;
76
78
  };
77
79
  },
78
80
  }),
@@ -37,6 +37,7 @@ export declare class AIGNEListrRenderer extends DefaultRenderer {
37
37
  get _options(): AIGNEListrRendererOptions;
38
38
  get _spinner(): Spinner;
39
39
  update(): void;
40
+ private isPreviousPrompt;
40
41
  create({ running, ...options }: Parameters<DefaultRenderer["create"]>[0] & {
41
42
  running?: boolean;
42
43
  }): string;
@@ -47,21 +47,26 @@ export class AIGNEListr extends Listr {
47
47
  }
48
48
  async run(stream) {
49
49
  const originalLog = logger.logMessage;
50
+ const originalConsole = { ...console };
50
51
  try {
51
52
  this.ctx = {};
52
53
  this.spinner.start();
53
- logger.logMessage = (...args) => this.logs.push(format(...args));
54
54
  if (logger.enabled(LogLevel.INFO)) {
55
55
  const request = this.myOptions.formatRequest();
56
56
  if (request)
57
57
  console.log(request);
58
58
  }
59
+ logger.logMessage = (...args) => this.logs.push(format(...args));
60
+ for (const method of ["debug", "log", "info", "warn", "error"]) {
61
+ console[method] = (...args) => this.logs.push(format(...args));
62
+ }
59
63
  const _stream = await stream();
60
64
  this.add({ task: () => this.extractStream(_stream) });
61
65
  return await super.run().then(() => ({ ...this.result }));
62
66
  }
63
67
  finally {
64
68
  logger.logMessage = originalLog;
69
+ Object.assign(console, originalConsole);
65
70
  this.spinner.stop();
66
71
  }
67
72
  }
@@ -92,35 +97,44 @@ export class AIGNEListrRenderer extends DefaultRenderer {
92
97
  update() {
93
98
  this._updater(this.create({ running: true }));
94
99
  }
100
+ isPreviousPrompt = false;
95
101
  create({ running = false, ...options }) {
96
102
  const logs = this._options.aigne?.getStdoutLogs?.();
97
103
  if (logs?.length) {
98
104
  this._updater.clear();
99
105
  this._logger.toStdout(logs.join(EOL));
100
106
  }
101
- let tasks = super.create({ ...options, prompt: false });
102
- const bottomBar = this._options.aigne?.getBottomBarLogs?.({ running });
103
- if (bottomBar?.length) {
104
- tasks += EOL.repeat(2);
105
- const output = [...bottomBar, running ? this._spinner.fetch() : ""]
106
- .map((i) => this._wrap(i))
107
- .join(EOL);
108
- // If the task is not running, we show all lines
109
- if (!running) {
110
- tasks += output;
111
- }
112
- // For running tasks, we only show the last few lines
113
- else {
114
- const { rows } = process.stdout;
115
- const lines = rows - tasks.split(EOL).length - 2;
116
- tasks += output.split(EOL).slice(-Math.max(4, lines)).join(EOL);
117
- }
118
- }
107
+ let buffer = "";
119
108
  const prompt = super["renderPrompt"]();
120
109
  if (prompt.length) {
121
- tasks += `${EOL.repeat(2)}${prompt.join(EOL)}`;
110
+ buffer += prompt.join(EOL);
111
+ this.isPreviousPrompt = true;
112
+ }
113
+ // Skip a frame if previous render was a prompt, and reset the flag
114
+ else if (this.isPreviousPrompt) {
115
+ this.isPreviousPrompt = false;
116
+ }
117
+ else {
118
+ buffer += super.create({ ...options, prompt: false });
119
+ const bottomBar = this._options.aigne?.getBottomBarLogs?.({ running });
120
+ if (bottomBar?.length) {
121
+ buffer += EOL.repeat(2);
122
+ const output = [...bottomBar, running ? this._spinner.fetch() : ""]
123
+ .map((i) => this._wrap(i))
124
+ .join(EOL);
125
+ // If the task is not running, we show all lines
126
+ if (!running) {
127
+ buffer += output;
128
+ }
129
+ // For running tasks, we only show the last few lines
130
+ else {
131
+ const { rows } = process.stdout;
132
+ const lines = rows - buffer.split(EOL).length - 2;
133
+ buffer += output.split(EOL).slice(-Math.max(4, lines)).join(EOL);
134
+ }
135
+ }
122
136
  }
123
- return tasks;
137
+ return buffer;
124
138
  }
125
139
  _wrap(str) {
126
140
  return wrap(str, process.stdout.columns ?? 80, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/cli",
3
- "version": "1.30.0",
3
+ "version": "1.30.1",
4
4
  "description": "cli for AIGNE framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -70,13 +70,13 @@
70
70
  "yaml": "^2.8.0",
71
71
  "yargs": "^18.0.0",
72
72
  "zod": "^3.25.67",
73
- "@aigne/agent-library": "^1.21.9",
74
- "@aigne/agentic-memory": "^1.0.9",
75
- "@aigne/aigne-hub": "^0.4.0",
76
- "@aigne/openai": "^0.10.9",
77
- "@aigne/default-memory": "^1.0.9",
78
- "@aigne/core": "^1.42.0",
79
- "@aigne/observability-api": "^0.9.0"
73
+ "@aigne/aigne-hub": "^0.4.1",
74
+ "@aigne/agent-library": "^1.21.10",
75
+ "@aigne/openai": "^0.10.10",
76
+ "@aigne/default-memory": "^1.0.10",
77
+ "@aigne/agentic-memory": "^1.0.10",
78
+ "@aigne/observability-api": "^0.9.0",
79
+ "@aigne/core": "^1.43.0"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/archiver": "^6.0.3",