Merge pull request 'feat: add claude wrapper that auto-links AGENTS.md as CLAUDE.md' (#49) from feat/claude-wrapper-agents-link into main
Generate documentation / build-docs (push) Successful in 40s

Reviewed-on: #49
This commit was merged in pull request #49.
This commit is contained in:
2026-06-12 21:45:49 +00:00
3 changed files with 82 additions and 1 deletions
+1
View File
@@ -130,6 +130,7 @@ logs=### logs
smart-exit=### smart_exit smart-exit=### smart_exit
ai=## 5.12 AI and Developer Tools ai=## 5.12 AI and Developer Tools
antigravity=### antigravity antigravity=### antigravity
claude-cli=### claude
claude=### claude-resume claude=### claude-resume
claude-docs=### claude-docs claude-docs=### claude-docs
claude-pr=### claude-pr claude-pr=### claude-pr
+17 -1
View File
@@ -1106,6 +1106,20 @@ Add -i (interactive confirmation) to destructive commands:
file in the current directory, or opens an interactive fzf picker if no file in the current directory, or opens an interactive fzf picker if no
session file is found. session file is found.
### claude
Synopsis: claude [args...]
Wrapper for the claude CLI. Before launching, checks the current
directory and the git project root for CLAUDE.md; when it is absent but
AGENTS.md is present, creates a relative symlink CLAUDE.md -> AGENTS.md
so Claude Code picks up shared agent instructions without duplicating
the file. All arguments are forwarded verbatim. Command shadow (C1):
when __fish_config_op_aliases (or the master) is disabled, the call is
passed through to the real claude binary unchanged.
claude
claude --resume
### claude-resume ### claude-resume
Synopsis: claude-resume Synopsis: claude-resume
@@ -1459,7 +1473,8 @@ but a category with an explicit truthy value remains enabled regardless.
ping->prettyping, ssh->kitten, ping->prettyping, ssh->kitten,
du->duf/dust, mkdir/bash wrappers, du->duf/dust, mkdir/bash wrappers,
history timestamps, grep/cp/mv/wget history timestamps, grep/cp/mv/wget
flag injection, help intercept flag injection, help intercept, claude
AGENTS.md auto-link
__fish_config_op_autoexec Startup side-effects: Fisher __fish_config_op_autoexec Startup side-effects: Fisher
bootstrap, theme apply, paru/yay bootstrap, theme apply, paru/yay
wrapper generation, auto venv wrapper generation, auto venv
@@ -1545,6 +1560,7 @@ all of these commands.
grep/fgrep/egrep forced --color=auto system grep variants grep/fgrep/egrep forced --color=auto system grep variants
dir / vdir forced --color=auto system dir / vdir dir / vdir forced --color=auto system dir / vdir
help config intercepts "help config" → config-help fish builtin help help config intercepts "help config" → config-help fish builtin help
claude auto-links AGENTS.md as CLAUDE.md before launch command claude
When C1 is disabled, `rm` uses bare `command rm` with no wrapper — files When C1 is disabled, `rm` uses bare `command rm` with no wrapper — files
are permanently deleted, not trashed. There is no intermediate safety net. are permanently deleted, not trashed. There is no intermediate safety net.
+64
View File
@@ -0,0 +1,64 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# claude [ARGS...]
#
# DESCRIPTION
# Wrapper for the claude CLI that ensures CLAUDE.md exists before launch.
# Both the current directory and the git project root are checked. When
# CLAUDE.md is absent but AGENTS.md is present in a checked directory, a
# relative symlink CLAUDE.md -> AGENTS.md is created automatically so that
# Claude Code picks up shared agent instructions without duplicating the
# file. All arguments are forwarded verbatim to the real claude binary.
#
# Opinionated component (C1): when disabled via __fish_config_op_aliases
# (or the __fish_config_opinionated master), the command is passed through
# to the real claude binary unchanged.
#
# ARGUMENTS
# ARGS Any arguments forwarded verbatim to the underlying claude binary
#
# RETURNS
# Exit status of the underlying claude binary
#
# EXAMPLE
# claude
# claude --resume
# claude "Explain the recent changes"
function claude --wraps=claude --description 'claude wrapper: auto-links AGENTS.md as CLAUDE.md'
if not __fish_config_op_enabled __fish_config_op_aliases
command claude $argv
return $status
end
set -l c_ok (set_color green)
set -l c_reset (set_color normal)
# Build the list of directories to inspect: cwd always, git root when different.
set -l check_dirs (pwd)
set -l git_root (git rev-parse --show-toplevel 2>/dev/null)
if test -n "$git_root" -a "$git_root" != (pwd)
set check_dirs $check_dirs $git_root
end
# Anchor for relative display: git root when available, otherwise cwd.
set -l anchor $git_root
test -z "$anchor" && set anchor (pwd)
for dir in $check_dirs
if not test -e "$dir/CLAUDE.md"
if test -f "$dir/AGENTS.md"
ln -s AGENTS.md "$dir/CLAUDE.md"
set -l prefix ""
if test "$dir" != "$anchor"
set prefix (string replace "$anchor/" "" "$dir")/
end
set -l msg (string join "" "→ Linked " $prefix "CLAUDE.md → " $prefix "AGENTS.md")
echo $c_ok$msg$c_reset >&2
end
end
end
command claude $argv
end