codemod

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

internal/codemod/types.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeScript

type ChangeScript []FileChangeSet

ChangeScript is the top-level structure, representing a list of changes for multiple files.

type FileChangeSet

type FileChangeSet struct {
	FilePath   string      `json:"file_path"`
	Operations []Operation `json:"operations"`
}

FileChangeSet groups all operations for a single file.

type Operation

type Operation struct {
	// Type indicates the kind of operation (e.g., "regex_replace", "add_import").
	Type string `json:"type"`
	// Description provides a human-readable explanation of the operation.
	Description string `json:"description,omitempty"`

	// --- Fields for "regex_replace" type ---
	// FindRegex is the regular expression to find.
	FindRegex string `json:"find_regex,omitempty"`
	// ReplaceWith is the string to replace matches with.
	ReplaceWith string `json:"replace_with,omitempty"`
	// LineNumber can be used to target a specific line for some operations (not used by basic regex_replace yet).
	LineNumber *int `json:"line_number,omitempty"`
}

Operation defines a single modification to be performed on a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL