@ww_nero/mini-cli 1.0.71 → 1.0.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ww_nero/mini-cli",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
4
4
  "description": "极简的 AI 命令行助手",
5
5
  "bin": {
6
6
  "mini": "bin/mini.js"
package/src/chat.js CHANGED
@@ -103,14 +103,20 @@ const formatReplaceOutput = (result) => {
103
103
  const lines = [];
104
104
 
105
105
  const searchLines = searchContent.split('\n');
106
- searchLines.forEach((line) => {
107
- lines.push(chalk.red(`-${line}`));
108
- });
109
-
110
106
  const replaceLines = replaceContent.split('\n');
111
- replaceLines.forEach((line) => {
112
- lines.push(chalk.green(`+${line}`));
113
- });
107
+ const maxLinesPerSide = 20;
108
+ const appendLimitedLines = (list, prefix, colorizer) => {
109
+ const limit = Math.min(list.length, maxLinesPerSide);
110
+ for (let i = 0; i < limit; i += 1) {
111
+ lines.push(colorizer(`${prefix}${list[i]}`));
112
+ }
113
+ if (list.length > maxLinesPerSide) {
114
+ lines.push(colorizer(`${prefix} ...(更多代码)`));
115
+ }
116
+ };
117
+
118
+ appendLimitedLines(searchLines, '-', chalk.red);
119
+ appendLimitedLines(replaceLines, '+', chalk.green);
114
120
 
115
121
  return lines.join('\n');
116
122
  };
@@ -22,7 +22,7 @@ const countLines = (text = '') => {
22
22
  const formatWriteHeader = (args = {}) => {
23
23
  const filePath = args.filePath || '';
24
24
  const lineCount = countLines(args.content);
25
- return ` (${filePath}, +${lineCount})`;
25
+ return ` (${filePath}, ${chalk.green(`+${lineCount}`)})`;
26
26
  };
27
27
 
28
28
  const formatReplaceHeader = (args = {}) => {
@@ -194,10 +194,13 @@ const splitThinkContent = (text = '') => {
194
194
  return { content, reasoning };
195
195
  };
196
196
 
197
- const summarizeReasoning = (text = '') => {
197
+ const summarizeReasoning = (text = '', maxLength = 100) => {
198
198
  if (!text) return '';
199
199
  const normalized = text.replace(/\s+/g, ' ').trim();
200
200
  if (!normalized) return '';
201
+ if (normalized.length > maxLength) {
202
+ return normalized.substring(0, maxLength) + '...';
203
+ }
201
204
  return normalized;
202
205
  };
203
206