NAME

MCP::Wiki::Git::History - Section history tracking via heading paths

VERSION

version 0.001

SYNOPSIS

use MCP::Wiki::Git::History;

my $git = MCP::Wiki::Git::History->new(wiki_root => '/path/to/wiki');

# Get section history
my @commits = $git->get_section_commits('page.md', 'Intro#Background');

# Restore section from old commit
my $result = $git->restore_section(
    'page.md',
    'Intro#Background',
    'abc123',
    { current_content => $current_md }
);

DESCRIPTION

Tracks history of wiki sections via heading paths. When sections are modified, the history records which commits touched which heading paths.

wiki_root

Root directory of the wiki (must be a git repo)

repo

Git::Raw repository object

history_file

Path to the history tracking file

get_section_commits

Get commit history for a section identified by heading_path.

my @commits = $git->get_section_commits('page.md', 'Introduction#Background');

get_section_content_at_commit

Get the content of a section at a specific commit.

my $content = $git->get_section_content_at_commit(
    'page.md',
    'Introduction#Background',
    'abc123def456'
);

restore_section

Restore a section from a historical commit.

my $result = $git->restore_section(
    'page.md',
    'Introduction#Background',
    'abc123def456',
    {
        current_content => $current_md,
        reason          => 'Fixing error',
    }
);

Returns: { success => 1, content => $new_content, restored_from => $hash } Or: { conflict => 1, content => $conflicted_content, base => $base, theirs => $theirs }

auto_commit

Auto-commit a change with optional reason.

$git->auto_commit('page.md', 'Fix typo in introduction', reason => 'User reported typo');

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-mcp-wiki/issues.

CONTRIBUTING

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

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.