Data Extractor

Data Extractor

sammcj

Extracts embedded data like i18n translations and configurations from TypeScript/JavaScript code into separate JSON files. Also extracts SVG components from React files into individual .svg files.

9382 views5Local (stdio)

What it does

  • Extract i18n translations from TypeScript/JavaScript to JSON
  • Extract SVG components from React files to individual .svg files
  • Preserve template variables and nested object structures
  • Replace extracted code with migration markers
  • Handle both TypeScript and JavaScript with JSX support

Best for

Refactoring hardcoded translations into configuration filesMigrating inline SVG components to separate filesCleaning up codebases with embedded dataImproving code maintainability and separation of concerns
Preserves template variables like {{name}}Maintains hierarchical key structure with dot notationAuto-marks source files as migrated

Tools (2)

extract_data

Extract data content (e.g. i18n translations) from source code to a JSON file. IMPORTANT: When encountering files with data such as i18n content embedded in code, use this tool directly instead of reading the file content first. This tool will programmatically extract all translations into a structured JSON file, preserving nested objects, arrays, template variables, and formatting. This helps keep translations as configuration and prevents filling up the AI context window with translation content. By default, the source file will be replaced with "MIGRATED TO <target absolute path>" and a warning message after successful extraction, making it easy to track where the data was moved to. This behaviour can be disabled by setting the DISABLE_SOURCE_REPLACEMENT environment variable to 'true'. The warning message can be customized by setting the WARNING_MESSAGE environment variable.

extract_svg

Extract SVG components from React/TypeScript/JavaScript files into individual .svg files. This tool will preserve the SVG structure and attributes while removing React-specific code. By default, the source file will be replaced with "MIGRATED TO <target absolute path>" and a warning message after successful extraction, making it easy to track where the SVGs were moved to. This behaviour can be disabled by setting the DISABLE_SOURCE_REPLACEMENT environment variable to 'true'. The warning message can be customized by setting the WARNING_MESSAGE environment variable.

Alternatives