#!/usr/bin/env perl
# PODNAME: codefork
# ABSTRACT: Worlds dumbest code forker

use strict;
use warnings;
use FindBin;
use lib $FindBin::Dir . "/../lib";
use App::codefork;

App::codefork->run(@ARGV);


1;

__END__

=pod

=encoding UTF-8

=head1 NAME

codefork - Worlds dumbest code forker

=head1 VERSION

version 1.000

=head1 SYNOPSIS

  # Preview changes as unified diff (default config: fork.conf)
  codefork

  # Preview with a different config file
  codefork other.conf

  # Apply changes to disk
  codefork apply
  codefork apply other.conf

  # Save diff to a file (e.g. for review or patch(1))
  codefork output patch.diff
  codefork output other.conf patch.diff

  # Enable debug output
  CODEFORK_DEBUG=1 codefork

=head1 DESCRIPTION

B<codefork> performs systematic text replacements across an entire directory
tree, modifying both filenames and file contents. It is intended for forking
a codebase by renaming a project, module, or namespace throughout.

By default, codefork does B<not> modify any files. It shows a unified diff
of what would change, so you can review before committing to the changes.
Use the C<apply> command to actually write changes to disk, or C<output> to
save the diff to a file for use with C<patch(1)>.

The default config file is C<fork.conf> in the current directory.

=head1 COMMANDS

=over 4

=item C<codefork> [I<config>]

Show a unified diff of all changes that would be made. This is the default
action and is completely safe — nothing is modified on disk.

=item C<codefork apply> [I<config>]

Apply all changes to files in the current directory tree. Filenames are
renamed and file contents are modified in place.

=item C<codefork output> [I<config>] I<filename>

Write the unified diff to I<filename> instead of printing it. The output
is compatible with C<patch -p1>.

=back

=head1 CONFIG FORMAT

The config file contains one replacement rule per line:

=over 4

=item C<from|to>

Regex replacement: applies C<s/from/to/g> to filenames and file contents.

=item C<from%to>

Word-boundary replacement: only replaces C<from> when surrounded by
non-alphanumeric characters, preventing partial matches inside longer words.

=back

Lines without a C<|> or C<%> separator are ignored.

Example config:

  HomeHive|AqHive
  homehive|aqhive
  hh%ah

=head1 UPGRADE NOTICE

B<The command-line interface changed in version 1.000.>

The old C<--config>, C<--dir>, and C<--debug> flags are no longer supported.
Use positional commands instead:

  # Old (no longer works):
  codefork --config fork.conf
  codefork --config fork.conf --debug

  # New:
  codefork fork.conf
  CODEFORK_DEBUG=1 codefork fork.conf

=head1 ENVIRONMENT

=over 4

=item C<CODEFORK_DEBUG>

Set to a true value to enable verbose debug output to STDERR.

=back

=head1 SUPPORT

Repository

  L<https://github.com/Getty/p5-app-codefork>
  Pull request and additional contributors are welcome

Issue Tracker

  L<https://github.com/Getty/p5-app-codefork/issues>

=head1 SUPPORT

=head2 Issues

Please report bugs and feature requests on GitHub at
L<https://github.com/Getty/p5-app-codefork/issues>.

=head1 CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

=head1 AUTHOR

Torsten Raudssus <torsten@raudssus.de>

=head1 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.

=cut
