@ww_nero/mini-cli 1.0.67 → 1.0.69
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 +1 -1
- package/src/chat.js +1064 -1064
- package/src/prompt/tool.js +1 -1
- package/src/tools/bash.js +2 -2
- package/src/tools/read.js +2 -2
- package/src/tools/replace.js +2 -2
- package/src/tools/todos.js +2 -2
- package/src/tools/write.js +2 -2
- package/src/utils/renderer.js +4 -4
package/src/prompt/tool.js
CHANGED
package/src/tools/bash.js
CHANGED
|
@@ -208,7 +208,7 @@ const createBashToolSchema = (context = {}) => {
|
|
|
208
208
|
return {
|
|
209
209
|
type: 'function',
|
|
210
210
|
function: {
|
|
211
|
-
name: '
|
|
211
|
+
name: 'bash',
|
|
212
212
|
description: descriptionParts.join(' '),
|
|
213
213
|
parameters: {
|
|
214
214
|
type: 'object',
|
|
@@ -235,7 +235,7 @@ const createBashToolSchema = (context = {}) => {
|
|
|
235
235
|
};
|
|
236
236
|
|
|
237
237
|
module.exports = {
|
|
238
|
-
name: '
|
|
238
|
+
name: 'bash',
|
|
239
239
|
schema: createBashToolSchema,
|
|
240
240
|
handler: executeCommand
|
|
241
241
|
};
|
package/src/tools/read.js
CHANGED
|
@@ -22,7 +22,7 @@ const readFile = async ({ filePath } = {}, context = {}) => {
|
|
|
22
22
|
const schema = {
|
|
23
23
|
type: 'function',
|
|
24
24
|
function: {
|
|
25
|
-
name: '
|
|
25
|
+
name: 'read',
|
|
26
26
|
description: '读取指定相对路径的文本类文件完整内容,不支持二进制文件',
|
|
27
27
|
parameters: {
|
|
28
28
|
type: 'object',
|
|
@@ -38,7 +38,7 @@ const schema = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
module.exports = {
|
|
41
|
-
name: '
|
|
41
|
+
name: 'read',
|
|
42
42
|
schema,
|
|
43
43
|
handler: readFile
|
|
44
44
|
};
|
package/src/tools/replace.js
CHANGED
|
@@ -105,7 +105,7 @@ const replaceInFile = async ({ filePath, search, replace } = {}, context = {}) =
|
|
|
105
105
|
const schema = {
|
|
106
106
|
type: 'function',
|
|
107
107
|
function: {
|
|
108
|
-
name: '
|
|
108
|
+
name: 'replace',
|
|
109
109
|
description: '在文件中搜索并替换指定的代码片段(简单字符串匹配,非正则)',
|
|
110
110
|
parameters: {
|
|
111
111
|
type: 'object',
|
|
@@ -129,7 +129,7 @@ const schema = {
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
module.exports = {
|
|
132
|
-
name: '
|
|
132
|
+
name: 'replace',
|
|
133
133
|
schema,
|
|
134
134
|
handler: replaceInFile
|
|
135
135
|
};
|
package/src/tools/todos.js
CHANGED
|
@@ -53,7 +53,7 @@ const writeTodos = async ({ todos } = {}) => {
|
|
|
53
53
|
const schema = {
|
|
54
54
|
type: 'function',
|
|
55
55
|
function: {
|
|
56
|
-
name: '
|
|
56
|
+
name: 'todos',
|
|
57
57
|
description: '更新任务列表(创建、修改、完成)',
|
|
58
58
|
parameters: {
|
|
59
59
|
type: 'object',
|
|
@@ -83,7 +83,7 @@ const schema = {
|
|
|
83
83
|
const getLastTodos = () => lastTodos;
|
|
84
84
|
|
|
85
85
|
module.exports = {
|
|
86
|
-
name: '
|
|
86
|
+
name: 'todos',
|
|
87
87
|
schema,
|
|
88
88
|
handler: writeTodos,
|
|
89
89
|
getLastTodos
|
package/src/tools/write.js
CHANGED
|
@@ -26,7 +26,7 @@ const writeFile = async ({ filePath, content } = {}, context = {}) => {
|
|
|
26
26
|
const schema = {
|
|
27
27
|
type: 'function',
|
|
28
28
|
function: {
|
|
29
|
-
name: '
|
|
29
|
+
name: 'write',
|
|
30
30
|
description: '向文件写入完整内容(不存在则创建)',
|
|
31
31
|
parameters: {
|
|
32
32
|
type: 'object',
|
|
@@ -46,7 +46,7 @@ const schema = {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
module.exports = {
|
|
49
|
-
name: '
|
|
49
|
+
name: 'write',
|
|
50
50
|
schema,
|
|
51
51
|
handler: writeFile
|
|
52
52
|
};
|
package/src/utils/renderer.js
CHANGED
|
@@ -33,19 +33,19 @@ const formatHeader = (name, args, options = {}) => {
|
|
|
33
33
|
const statusTag = options.statusTag || '';
|
|
34
34
|
const extraMeta = Array.isArray(options.extraMeta) ? options.extraMeta : [];
|
|
35
35
|
const labelBase = `${chalk.yellow('🔧')} ${chalk.yellow(name)}`;
|
|
36
|
-
const writeTag = name === '
|
|
36
|
+
const writeTag = name === 'write' ? formatWriteLineCountTag(args) : '';
|
|
37
37
|
const labelWithWriteInfo = `${labelBase}${writeTag}`;
|
|
38
38
|
const label = statusTag ? `${labelWithWriteInfo}${statusTag}` : labelWithWriteInfo;
|
|
39
39
|
const metaParts = [...extraMeta];
|
|
40
40
|
|
|
41
|
-
if (name === '
|
|
41
|
+
if (name === 'bash') {
|
|
42
42
|
if (args.command) metaParts.push(`command="${truncateText(args.command)}"`);
|
|
43
43
|
if (args.workingDirectory && args.workingDirectory !== '.') {
|
|
44
44
|
metaParts.push(`dir=${args.workingDirectory}`);
|
|
45
45
|
}
|
|
46
|
-
} else if (['
|
|
46
|
+
} else if (['read', 'write', 'replace'].includes(name)) {
|
|
47
47
|
if (args.filePath) metaParts.push(args.filePath);
|
|
48
|
-
} else if (name === '
|
|
48
|
+
} else if (name === 'todos') {
|
|
49
49
|
const count = Array.isArray(args.todos) ? args.todos.length : 0;
|
|
50
50
|
metaParts.push(`${count} items`);
|
|
51
51
|
} else if (name === 'convert') {
|