From d1949953df0c406972bad6c11a7baa0374dbc33b Mon Sep 17 00:00:00 2001 From: rootiest Date: Fri, 12 Jun 2026 21:48:25 -0400 Subject: [PATCH] feat(agents-init): add --agents mode (AGENTS.md move + symlinks + gitignore) --- functions/agents-init.fish | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/functions/agents-init.fish b/functions/agents-init.fish index 003ac55..f76285d 100644 --- a/functions/agents-init.fish +++ b/functions/agents-init.fish @@ -106,6 +106,38 @@ function agents-init --description 'scaffold AGENTS/ sub-repo with agent spec fi # ── Auto-commit (runs at end — defined here as a closure-style block) ───── # Implemented in Task 5; placeholder comment keeps structure clear. - # ── Mode dispatch ───────────────────────────────────────────────────────── - # --agents and --plugins blocks added in Tasks 3 and 4. + # ──────────────────────────── --agents mode ────────────────────────────── + if test $do_agents -eq 1 + # Move AGENTS.md from project root into sub-repo if it's a real file + if test -f "$root/AGENTS.md"; and not test -L "$root/AGENTS.md" + mv "$root/AGENTS.md" "$agents_dir/AGENTS.md" + echo "$c_ok→ Moved AGENTS.md → AGENTS/AGENTS.md$c_reset" + end + + # Create empty AGENTS.md in sub-repo if still missing + if not test -f "$agents_dir/AGENTS.md" + touch "$agents_dir/AGENTS.md" + echo "$c_ok→ Created AGENTS/AGENTS.md$c_reset" + end + + # Symlink AGENTS.md → AGENTS/AGENTS.md in project root + if not test -L "$root/AGENTS.md" + ln -s AGENTS/AGENTS.md "$root/AGENTS.md" + echo "$c_ok→ Linked AGENTS.md → AGENTS/AGENTS.md$c_reset" + end + + # Symlink CLAUDE.md → AGENTS/AGENTS.md in project root + if not test -L "$root/CLAUDE.md" + ln -s AGENTS/AGENTS.md "$root/CLAUDE.md" + echo "$c_ok→ Linked CLAUDE.md → AGENTS/AGENTS.md$c_reset" + end + + # Update .gitignore + for pattern in "AGENTS/" "AGENTS.md" "CLAUDE.md" + _agents_init_ensure_gitignore "$root" "$pattern" + end + end + + # ─────────────────────────── --plugins mode ────────────────────────────── + # Added in Task 4. end