feat: add claude wrapper that auto-links AGENTS.md as CLAUDE.md #49

Merged
rootiest merged 1 commits from feat/claude-wrapper-agents-link into main 2026-06-12 21:45:50 +00:00
Owner

Summary

Adds functions/claude.fish, a wrapper for the claude CLI. Before launching, it checks the current directory and the git project root; when CLAUDE.md is absent but AGENTS.md is present, it 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.

Details

  • C1 command shadow: guarded via __fish_config_op_enabled __fish_config_op_aliases. When disabled (or the master __fish_config_opinionated is off), the call passes through to the bare command claude $argv unchanged — per Convention §14.
  • Relative symlink: uses ln -s AGENTS.md "$dir/CLAUDE.md" so the link is portable and not tied to an absolute path.
  • Link notices print to stderr in green (set_color green), with paths shown relative to the git root.
  • Forwards -h/--help and every other flag straight to the real claude (thin wrapper exemption, §12).

Docs

  • docs/fish-config.md (SoT): new ### claude entry in §5.12, a row in the C1 component-reference table, and a mention in the C1 summary list.
  • docs/fish-config.index: new claude-cli anchor.
  • README already describes "AI workflow helpers for Claude" at overview altitude — left unchanged.

Manual Verification

  • In a directory with AGENTS.md but no CLAUDE.md, run claude --help. Confirm a green → Linked CLAUDE.md → AGENTS.md notice prints and the symlink is created (ls -l CLAUDE.md shows -> AGENTS.md).
  • Run claude again in the same directory — confirm no duplicate link notice (CLAUDE.md now exists).
  • From a subdirectory of a git repo whose root has AGENTS.md, run claude and confirm the root link is created with a relative path shown in the notice.
  • In a directory with neither file, confirm claude launches with no notice and no file created.
  • Set set -g __fish_config_op_aliases off, run claude in an AGENTS.md-only dir, and confirm it passes through with no symlink created.
  • Confirm arguments forward correctly: claude --resume behaves identically to the bare binary.
## Summary Adds `functions/claude.fish`, a wrapper for the `claude` CLI. Before launching, it checks the **current directory** and the **git project root**; when `CLAUDE.md` is absent but `AGENTS.md` is present, it 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. ## Details - **C1 command shadow:** guarded via `__fish_config_op_enabled __fish_config_op_aliases`. When disabled (or the master `__fish_config_opinionated` is off), the call passes through to the bare `command claude $argv` unchanged — per Convention §14. - **Relative symlink:** uses `ln -s AGENTS.md "$dir/CLAUDE.md"` so the link is portable and not tied to an absolute path. - **Link notices** print to **stderr** in green (`set_color green`), with paths shown relative to the git root. - Forwards `-h`/`--help` and every other flag straight to the real `claude` (thin wrapper exemption, §12). ## Docs - `docs/fish-config.md` (SoT): new `### claude` entry in §5.12, a row in the C1 component-reference table, and a mention in the C1 summary list. - `docs/fish-config.index`: new `claude-cli` anchor. - README already describes "AI workflow helpers for Claude" at overview altitude — left unchanged. ## Manual Verification - [x] In a directory with `AGENTS.md` but no `CLAUDE.md`, run `claude --help`. Confirm a green `→ Linked CLAUDE.md → AGENTS.md` notice prints and the symlink is created (`ls -l CLAUDE.md` shows `-> AGENTS.md`). - [x] Run `claude` again in the same directory — confirm **no** duplicate link notice (CLAUDE.md now exists). - [x] From a subdirectory of a git repo whose root has `AGENTS.md`, run `claude` and confirm the root link is created with a **relative** path shown in the notice. - [x] In a directory with neither file, confirm `claude` launches with no notice and no file created. - [x] Set `set -g __fish_config_op_aliases off`, run `claude` in an `AGENTS.md`-only dir, and confirm it passes through with **no** symlink created. - [x] Confirm arguments forward correctly: `claude --resume` behaves identically to the bare binary.
rootiest added 1 commit 2026-06-12 21:45:03 +00:00
New functions/claude.fish wraps the claude CLI. Before launch it checks the
current directory and the git project root; when CLAUDE.md is absent but
AGENTS.md is present, it creates a relative symlink CLAUDE.md -> AGENTS.md so
Claude Code picks up shared agent instructions without duplicating the file.
Arguments are forwarded verbatim.

Implemented as a C1 command shadow: when __fish_config_op_aliases (or the
master __fish_config_opinionated) is disabled, the call passes through to the
bare claude binary unchanged. Link-creation notices print to stderr in green.

Documents the new shadow in docs/fish-config.md (section 5.12 AI tools, C1
component reference table, and C1 summary list) and adds a claude-cli anchor
to docs/fish-config.index.
rootiest merged commit 045f141e30 into main 2026-06-12 21:45:50 +00:00
rootiest deleted branch feat/claude-wrapper-agents-link 2026-06-12 21:45:51 +00:00
Sign in to join this conversation.