Loading...
Loading...
Compare original and translation side by side
from api.filesystem import batch_copy
from api.code_analysis import find_functions
functions = find_functions('app.py', pattern='handle_.*')
operations = [{
'source_file': 'app.py',
'start_line': f['start_line'],
'end_line': f['end_line'],
'target_file': 'handlers.py',
'target_line': -1
} for f in functions]
batch_copy(operations)from api.filesystem import batch_copy
from api.code_analysis import find_functions
functions = find_functions('app.py', pattern='handle_.*')
operations = [{
'source_file': 'app.py',
'start_line': f['start_line'],
'end_line': f['end_line'],
'target_file': 'handlers.py',
'target_line': -1
} for f in functions]
batch_copy(operations)Read(file_path="src/auth.py") # Full file
Read(file_path="src/auth.py", offset=10, limit=20) # Line range
Grep(pattern="def authenticate", -n=true, -A=10) # Find functionRead(file_path="src/auth.py") # 读取整个文件
Read(file_path="src/auth.py", offset=10, limit=20) # 读取行范围
Grep(pattern="def authenticate", -n=true, -A=10) # 查找函数line_insert.pypython3 skills/code-transfer/scripts/line_insert.py <file> <line_number> <code> [--backup]undefinedline_insert.pypython3 skills/code-transfer/scripts/line_insert.py <file> <line_number> <code> [--backup]undefined
**When to use:**
- User specifies exact line number
- Inserting into new/empty files
- Inserting at beginning/end without context
**适用场景:**
- 用户指定了精确的行号
- 插入到新文件/空文件中
- 在文件开头/结尾插入且无需上下文Edit(
file_path="src/utils.py",
old_string="def existing():\n pass",
new_string="def existing():\n pass\n\ndef new():\n return True"
)Edit(
file_path="src/utils.py",
old_string="def existing():\n pass",
new_string="def existing():\n pass\n\ndef new():\n return True"
)Grep(pattern="def validate_user", -n=true, -A=20)Read(file_path="auth.py", offset=45, limit=15)Read(file_path="validators.py")line_insert.pyGrep(pattern="def validate_user", -n=true, -A=20)Read(file_path="auth.py", offset=45, limit=15)Read(file_path="validators.py")line_insert.pyGrep(pattern="class DatabaseConnection", -n=true, -A=50)Read(file_path="original.py", offset=100, limit=50)Write(file_path="database.py", content="<extracted>")EditEditGrep(pattern="class DatabaseConnection", -n=true, -A=50)Read(file_path="original.py", offset=100, limit=50)Write(file_path="database.py", content="<extracted>")Read(file_path="main.py", offset=20, limit=10)python3 skills/code-transfer/scripts/line_insert.py main.py 25 "logger.info('...')" --backupRead(file_path="main.py", offset=23, limit=5)Read(file_path="main.py", offset=20, limit=10)python3 skills/code-transfer/scripts/line_insert.py main.py 25 "logger.info('...')" --backupRead(file_path="main.py", offset=23, limit=5)Read(file_path="utils.py")Grep(pattern="^def |^class ", -n=true)WriteRead(file_path="utils.py")Grep(pattern="^def |^class ", -n=true)--backup--backup