NAME
Skilletor::Gitignore - Managed .gitignore and .worktreeinclude blocks, skill .gitignore files, git's view (spec §6.4)
VERSION
version 0.001
SYNOPSIS
use Skilletor::Gitignore qw( update_gitignore PROJECT_CLAUDE_ENTRIES );
my $change = update_gitignore( dir => "$project/.claude", entries => [PROJECT_CLAUDE_ENTRIES], enabled => 1 );
# 'created', 'changed', 'removed' or 'unchanged'
DESCRIPTION
The reference's gitignore.ts (spec §6.4). The ignore rules are fixed, so a committed .gitignore does not change with the installed items: every installed skill directory carries its own .gitignore ("SKILL_GITIGNORE"), and agents and rules install as .local. files that fixed patterns cover. A target root's .gitignore holds one block between #> skilletor >>> >> and # <<< skilletor <<<, its entries sorted; text outside it is never touched, a block without entries is removed, and a file left empty is deleted. The project root's .worktreeinclude gets a block of the same form.
update_gitignore
update_gitignore( dir => $root, entries => \@entries, enabled => $bool );
update_worktree_include
The same for <dir>/.worktreeinclude.
block_entries
my @entries = block_entries($file); # none for a missing file or one without a block
has_block
True when <dir>/.gitignore holds a skilletor block.
skill_gitignore_path
skill_gitignore_path('foo'); # skills/foo/.gitignore
with_skill_gitignore
with_skill_gitignore( $output, 'foo' );
The output ([ [ rel, bytes ], ... ]) with skilletor's .gitignore at the skill's root, replacing one the source ships.
git_tracked
git_tracked( $dir, \@paths ); # the ones git tracks
is_git_work_tree
True when $dir lies inside a git work tree; git missing or failing counts as no. Both git questions run with "git_env" in Skilletor::GitEnv, so an exported GIT_DIR never decides them.
SKILL_GITIGNORE
PROJECT_CLAUDE_ENTRIES
LOCAL_ENTRIES
CODEX_ENTRIES
WORKTREE_INCLUDE
SUPPORT
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.