transform_code
Apply syntax and structural code transformations for renaming, performance optimization, framework migration, and modernization. Supports multiple programming languages and preserves business logic.
Instructions
š§ Apply code transformations including syntax changes, structural reorganization, framework migration, and modernization. Combines syntax-level and structural changes.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
code | Yes | Source code to transform | |
language | Yes | Programming language of the code | |
options | No | ||
target_framework | No | Target framework (for framework migration) | |
target_language | No | Target language (for language conversion) | |
transformations | Yes | List of transformations to apply |
Input Schema (JSON Schema)
{
"properties": {
"code": {
"description": "Source code to transform",
"type": "string"
},
"language": {
"description": "Programming language of the code",
"type": "string"
},
"options": {
"properties": {
"include_instructions": {
"default": true,
"description": "Include transformation instructions",
"type": "boolean"
},
"preserve_comments": {
"default": true,
"description": "Preserve code comments",
"type": "boolean"
},
"preserve_logic": {
"default": true,
"description": "Preserve business logic during transformation",
"type": "boolean"
},
"update_imports": {
"default": true,
"description": "Update import paths automatically",
"type": "boolean"
},
"validate_syntax": {
"default": true,
"description": "Validate syntax after transformation",
"type": "boolean"
}
},
"type": "object"
},
"target_framework": {
"description": "Target framework (for framework migration)",
"type": "string"
},
"target_language": {
"description": "Target language (for language conversion)",
"type": "string"
},
"transformations": {
"description": "List of transformations to apply",
"items": {
"properties": {
"options": {
"description": "Transformation-specific options",
"type": "object"
},
"type": {
"description": "Type of transformation",
"enum": [
"naming",
"modernize",
"framework",
"performance",
"security",
"structure",
"migration"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"code",
"transformations",
"language"
],
"type": "object"
}