ailock
Version:
AI-Proof File Guard - Protect sensitive files from accidental AI modifications
116 lines (100 loc) • 6.34 kB
JavaScript
/**
* Generate Fish completion script for ailock
*/
export function generateFishCompletion() {
return `# ailock fish completion script
# Generated by: ailock completion fish
# Disable file completion by default
complete -c ailock -f
complete -c aiunlock -f
# Helper function to get completion suggestions
function __ailock_complete_helper
ailock completion-helper --type $argv[1] --partial $argv[2] 2>/dev/null
end
# Check if we're using the subcommand
function __ailock_using_command
set -l cmd (commandline -opc)
if test (count $cmd) -gt 1
if test $cmd[2] = $argv[1]
return 0
end
end
return 1
end
# Check if no subcommand is used yet
function __ailock_needs_command
set -l cmd (commandline -opc)
if test (count $cmd) -eq 1
return 0
end
return 1
end
# Main commands
complete -c ailock -n __ailock_needs_command -a init -d "Initialize ailock configuration"
complete -c ailock -n __ailock_needs_command -a lock -d "Lock files to prevent modifications"
complete -c ailock -n __ailock_needs_command -a unlock -d "Unlock files to allow modifications"
complete -c ailock -n __ailock_needs_command -a status -d "Show protection status"
complete -c ailock -n __ailock_needs_command -a status-interactive -d "Interactive status dashboard"
complete -c ailock -n __ailock_needs_command -a list -d "List protected files"
complete -c ailock -n __ailock_needs_command -a ls -d "List protected files (alias)"
complete -c ailock -n __ailock_needs_command -a diagnose -d "Diagnose file protection issues"
complete -c ailock -n __ailock_needs_command -a generate -d "Generate CI/CD and container configs"
complete -c ailock -n __ailock_needs_command -a install-hooks -d "Install Git pre-commit hooks"
complete -c ailock -n __ailock_needs_command -a completion -d "Generate shell completion script"
complete -c ailock -n __ailock_needs_command -a setup-completion -d "Interactive completion setup"
complete -c ailock -n __ailock_needs_command -a help -d "Show help information"
# init command options
complete -c ailock -n "__ailock_using_command init" -l force -d "Force overwrite existing config"
complete -c ailock -n "__ailock_using_command init" -l interactive -d "Interactive configuration setup"
complete -c ailock -n "__ailock_using_command init" -l config-only -d "Only create config file without locking"
# lock command options and file completion
complete -c ailock -n "__ailock_using_command lock" -l verbose -d "Show detailed output"
complete -c ailock -n "__ailock_using_command lock" -l dry-run -d "Preview changes without applying"
complete -c ailock -n "__ailock_using_command lock" -l no-gitignore -d "Skip .gitignore integration"
complete -c ailock -n "__ailock_using_command lock" -a "(__ailock_complete_helper unlocked-files (commandline -ct))" -d "File to lock"
# unlock command options and file completion
complete -c ailock -n "__ailock_using_command unlock" -l verbose -d "Show detailed output"
complete -c ailock -n "__ailock_using_command unlock" -l dry-run -d "Preview changes without applying"
complete -c ailock -n "__ailock_using_command unlock" -l all -d "Unlock all files"
complete -c ailock -n "__ailock_using_command unlock" -l no-gitignore -d "Skip .gitignore integration"
complete -c ailock -n "__ailock_using_command unlock" -a "(__ailock_complete_helper locked-files (commandline -ct))" -d "File to unlock"
# status command options
complete -c ailock -n "__ailock_using_command status" -l verbose -d "Show detailed status"
complete -c ailock -n "__ailock_using_command status" -l simple -d "Simple output format"
complete -c ailock -n "__ailock_using_command status" -l json -d "JSON output format"
# list/ls command options
complete -c ailock -n "__ailock_using_command list" -l all -d "Show all files"
complete -c ailock -n "__ailock_using_command list" -l long -d "Long format with details"
complete -c ailock -n "__ailock_using_command list" -l locked-only -d "Show only locked files"
complete -c ailock -n "__ailock_using_command list" -l unlocked-only -d "Show only unlocked files"
complete -c ailock -n "__ailock_using_command list" -l json -d "JSON output format"
complete -c ailock -n "__ailock_using_command ls" -l all -d "Show all files"
complete -c ailock -n "__ailock_using_command ls" -l long -d "Long format with details"
complete -c ailock -n "__ailock_using_command ls" -l locked-only -d "Show only locked files"
complete -c ailock -n "__ailock_using_command ls" -l unlocked-only -d "Show only unlocked files"
complete -c ailock -n "__ailock_using_command ls" -l json -d "JSON output format"
# diagnose command options and file completion
complete -c ailock -n "__ailock_using_command diagnose" -l verbose -d "Show detailed diagnostics"
complete -c ailock -n "__ailock_using_command diagnose" -F -d "File to diagnose"
# generate command templates
complete -c ailock -n "__ailock_using_command generate" -a github -d "GitHub Actions workflow"
complete -c ailock -n "__ailock_using_command generate" -a gitlab -d "GitLab CI pipeline"
complete -c ailock -n "__ailock_using_command generate" -a bitbucket -d "Bitbucket Pipeline"
complete -c ailock -n "__ailock_using_command generate" -a jenkins -d "Jenkins pipeline"
complete -c ailock -n "__ailock_using_command generate" -a circleci -d "CircleCI config"
complete -c ailock -n "__ailock_using_command generate" -a docker -d "Dockerfile"
complete -c ailock -n "__ailock_using_command generate" -a devcontainer -d "VS Code devcontainer"
# install-hooks command options
complete -c ailock -n "__ailock_using_command install-hooks" -l force -d "Force overwrite existing hooks"
complete -c ailock -n "__ailock_using_command install-hooks" -l yes -d "Skip confirmation prompts"
# completion command shells
complete -c ailock -n "__ailock_using_command completion" -a bash -d "Bash shell"
complete -c ailock -n "__ailock_using_command completion" -a zsh -d "Zsh shell"
complete -c ailock -n "__ailock_using_command completion" -a fish -d "Fish shell"
complete -c ailock -n "__ailock_using_command completion" -a powershell -d "PowerShell"
complete -c ailock -n "__ailock_using_command completion" -l install-instructions -d "Show installation instructions"
# Also set up completion for aiunlock command
complete -c aiunlock -w ailock
`;
}
//# sourceMappingURL=fish.js.map