@ww_nero/mini-cli 1.0.78 → 1.0.80

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.78",
3
+ "version": "1.0.80",
4
4
  "description": "极简的 AI 命令行助手",
5
5
  "bin": {
6
6
  "mini": "bin/mini.js"
package/src/chat.js CHANGED
@@ -113,7 +113,7 @@ const formatWriteOutput = (result) => {
113
113
  return lines.slice(0, 20).join('\n') + '\n...(更多内容)';
114
114
  };
115
115
 
116
- const formatReplaceOutput = (result) => {
116
+ const formatEditOutput = (result) => {
117
117
  if (!result || typeof result !== 'object' || !result.success) {
118
118
  return null;
119
119
  }
@@ -996,11 +996,11 @@ const startChatSession = async ({
996
996
  if (writeOutput) {
997
997
  console.log(writeOutput);
998
998
  }
999
- } else if (functionName === 'replace') {
1000
- // For replace, display diff-style output
1001
- const replaceOutput = formatReplaceOutput(toolResult);
1002
- if (replaceOutput) {
1003
- console.log(replaceOutput);
999
+ } else if (functionName === 'edit') {
1000
+ // For edit, display diff-style output
1001
+ const editOutput = formatEditOutput(toolResult);
1002
+ if (editOutput) {
1003
+ console.log(editOutput);
1004
1004
  }
1005
1005
  } else if (functionName === 'todos') {
1006
1006
  // For todos, display full formatted output without truncation
@@ -30,7 +30,7 @@ const computeDiffStats = (before = '', after = '') => {
30
30
  }, { added: 0, removed: 0 });
31
31
  };
32
32
 
33
- const replaceInFile = async ({ filePath, search, replace } = {}, context = {}) => {
33
+ const editFile = async ({ filePath, search, replace } = {}, context = {}) => {
34
34
  if (!filePath || typeof filePath !== 'string') {
35
35
  return 'filePath 参数不能为空';
36
36
  }
@@ -107,7 +107,7 @@ const replaceInFile = async ({ filePath, search, replace } = {}, context = {}) =
107
107
  const schema = {
108
108
  type: 'function',
109
109
  function: {
110
- name: 'replace',
110
+ name: 'edit',
111
111
  description: '在文件中搜索并替换指定的代码片段(简单字符串匹配,非正则)',
112
112
  parameters: {
113
113
  type: 'object',
@@ -131,7 +131,7 @@ const schema = {
131
131
  };
132
132
 
133
133
  module.exports = {
134
- name: 'replace',
134
+ name: 'edit',
135
135
  schema,
136
- handler: replaceInFile
136
+ handler: editFile
137
137
  };
@@ -1,13 +1,13 @@
1
1
  const bash = require('./bash');
2
2
  const read = require('./read');
3
3
  const write = require('./write');
4
- const replace = require('./replace');
4
+ const edit = require('./edit');
5
5
  const todos = require('./todos');
6
6
  const skills = require('./skills');
7
7
  const { createMcpManager } = require('./mcp');
8
8
  const { loadSettings } = require('../config');
9
9
 
10
- const TOOL_MODULES = [bash, read, write, replace, todos, skills];
10
+ const TOOL_MODULES = [bash, read, write, edit, todos, skills];
11
11
 
12
12
  const createToolRuntime = async (workspaceRoot, options = {}) => {
13
13
  const defaultToolNames = TOOL_MODULES.map((tool) => tool.name);
@@ -22,7 +22,7 @@ const printAssistantContent = (text, ensureNewline) => {
22
22
  return;
23
23
  }
24
24
  ensureNewline();
25
- const output = chalk.blue(text);
25
+ const output = chalk.white(text);
26
26
  process.stdout.write(output);
27
27
  if (!text.endsWith('\n')) {
28
28
  process.stdout.write('\n');
@@ -25,7 +25,7 @@ const formatWriteHeader = (args = {}) => {
25
25
  return ` (${filePath}, ${chalk.green(`+${lineCount}`)})`;
26
26
  };
27
27
 
28
- const formatReplaceHeader = (args = {}) => {
28
+ const formatEditHeader = (args = {}) => {
29
29
  const filePath = args.filePath || '';
30
30
  const searchLines = countLines(args.search);
31
31
  const replaceLines = countLines(args.replace);
@@ -40,8 +40,8 @@ const formatHeader = (name, args, options = {}) => {
40
40
  let specialHeader = '';
41
41
  if (name === 'write') {
42
42
  specialHeader = formatWriteHeader(args);
43
- } else if (name === 'replace') {
44
- specialHeader = formatReplaceHeader(args);
43
+ } else if (name === 'edit') {
44
+ specialHeader = formatEditHeader(args);
45
45
  }
46
46
 
47
47
  const labelWithInfo = `${labelBase}${specialHeader}`;