Documentation
¶
Overview ¶
Package file_replace implements the file_replace action handler.
The file_replace action performs in-place text replacement in files with support for: - Literal and regex-based pattern matching - Limited or unlimited replacements (count parameter) - Multiline and case-insensitive modes - Atomic writes (temp file + rename) - Backup creation before modification - Idempotency (no change if pattern doesn't match or already replaced)
Index ¶
- type Handler
- func (h *Handler) DryRun(ctx actions.Context, step *config.Step) error
- func (h *Handler) Execute(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Metadata() actions.ActionMetadata
- func (h *Handler) Run(ctx actions.Context, step *config.Step) (actions.Result, error)
- func (h *Handler) Validate(step *config.Step) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct{}
Handler implements the Handler interface for file_replace actions.
func (*Handler) Metadata ¶
func (h *Handler) Metadata() actions.ActionMetadata
Metadata returns metadata about the file_replace action.
func (*Handler) Run ¶
Run is the Spec 16 unified entry point. Performs the regex replacement in memory once and either reports the predicted change (ModePlan) or commits it atomically (ModeExecute). Drift between plan preview and real execution is impossible because both modes compute the same `newContent` and compare against the same on-disk content.