NAME
Langertha::Raider::Config::Migrate - Internal converter of the legacy project files to .raider/ (raider config migrate)
VERSION
version 0.503
SYNOPSIS
# Internal to Langertha-Raider -- no API promise.
my $migrate = Langertha::Raider::Config::Migrate->new(root => $root);
my $plan = $migrate->plan; # croaks when .raider.yml does not parse
die join "\n", @{ $plan->{refused} } if @{ $plan->{refused} };
for my $result ($migrate->apply($plan)) {
warn $result->{step}{from_label}.': '.$result->{error} if $result->{error};
}
DESCRIPTION
Internal module. Its interface may change without notice.
What raider config migrate does (ADR 0011): the legacy project files of "root" move to the .raider/ layout,
Each legacy file that exists is one step. A step writes the new file atomically (a temporary file next to it, renamed into place, with the legacy file's permissions), then renames the legacy file to its backup (.raider.yml.bak, .raider.md.bak), so afterwards only the new file is read and the effective config is the same (minus the api_key). A step that fails leaves its legacy file in use and no new file behind. .raider/ is created through "prepare_base" in Langertha::Raider::SessionStore, which also writes its .gitignore.
Nothing is merged: "plan" refuses the whole migration, before anything is written, when a new file or a backup already exists, when .raider is not a directory, or when "root" is the home directory (there .raider/config.yml would be the home config of every project).
root
The project directory. Required.
config
The Langertha::Raider::Config of "root".
instructions
The Langertha::Raider::Instructions of "root".
backup_suffix
.bak: the backup of .raider.yml is .raider.yml.bak.
plan
my $plan = $migrate->plan;
# { root => '/abs/project',
# steps => [ { kind => 'config', from => $path, to => $path, backup => $path,
# from_label => '.raider.yml', to_label => '.raider/config.yml',
# backup_label => '.raider.yml.bak', bytes => '...', lines => 12,
# changed => 1, api_keys => ['top'], removed_lines => [3],
# rewritten => 0 },
# { kind => 'instructions', ... } ],
# refused => [ 'reason', ... ],
# gitignore => 1 }
What a migration of "root" would do, without touching the disk: steps in order (the config first), refused the reasons it cannot be done (then nothing may be written), gitignore whether .raider/.gitignore would be created. changed is false when the new file is the legacy file byte for byte. Croaks like "data" in Langertha::Raider::Config when .raider.yml does not parse.
apply
my @results = $migrate->apply($plan);
# ( { step => $step }, { step => $step, error => '...' }, { step => $step, skipped => 1 } )
Carries out a "plan": creates .raider/ and its .gitignore, then the steps in order. Stops at the first step that fails; that step's result carries error (its legacy file is still in use, its new file is not there), the steps after it skipped. Croaks, writing nothing, when the plan was refused.
SEE ALSO
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-raider/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.