myagent-ai 1.23.42 → 1.23.43
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/scripts/cli.py +19 -9
package/package.json
CHANGED
package/scripts/cli.py
CHANGED
|
@@ -340,23 +340,33 @@ async def cmd_rm(args):
|
|
|
340
340
|
async def cmd_grep(args):
|
|
341
341
|
"""搜索文件内容"""
|
|
342
342
|
import argparse
|
|
343
|
-
# [v1.23.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
# [v1.23.42] 预过滤不支持的参数,防止 Agent 把系统 grep 参数传进来
|
|
344
|
+
# 区分标志(无参数)和选项(带参数)
|
|
345
|
+
_unsupported_flags = {"-n", "--line-number", "-l", "--files-with-matches",
|
|
346
|
+
"-r", "-R", "--recursive", "-i", "--ignore-case",
|
|
347
|
+
"-c", "--count", "-w", "--word-regexp", "-v",
|
|
348
|
+
"--invert-match", "-E", "-F", "-P", "-m"}
|
|
349
|
+
_unsupported_opts = {"-e", "--regexp", "--include", "--exclude",
|
|
350
|
+
"--after-context", "--before-context", "--context",
|
|
351
|
+
"-A", "-B", "-C", "--max-count", "--color"}
|
|
348
352
|
_filtered = []
|
|
349
353
|
_skip_next = False
|
|
350
354
|
for i, a in enumerate(args):
|
|
351
355
|
if _skip_next:
|
|
352
356
|
_skip_next = False
|
|
353
357
|
continue
|
|
354
|
-
|
|
355
|
-
|
|
358
|
+
if a in _unsupported_flags:
|
|
359
|
+
# 标志参数,不跳过下一个
|
|
360
|
+
continue
|
|
361
|
+
if a in _unsupported_opts:
|
|
362
|
+
# 带参数选项,跳过下一个
|
|
356
363
|
_skip_next = True
|
|
357
364
|
continue
|
|
358
|
-
|
|
359
|
-
|
|
365
|
+
# 处理组合标志如 -rn、长选项 --name=Value
|
|
366
|
+
if any(a.startswith(k) for k in _unsupported_flags):
|
|
367
|
+
# -rn 或 -ni 等组合标志,不跳过下一个
|
|
368
|
+
continue
|
|
369
|
+
if any(a.startswith(k) for k in _unsupported_opts):
|
|
360
370
|
if "=" not in a:
|
|
361
371
|
_skip_next = True
|
|
362
372
|
continue
|