fix(agents-init): require a git repo to scaffold, and anchor the .gitignore fallback match #153
No Reviewers
Labels
Clear labels
Area/CI
Area/Completions
Area/Components
Area/Config
Area/Docs
Area/Functions
Area/Integrations
Area/Prompt & Theme
Area/Scripts
Area/Tests
Compat/Breaking
Kind/Bug
Kind/Chore
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Refactor
Kind/Security
Kind/Testing
good first issue
help wanted
.github/workflows and repository automation
completions/ - tab-completion scripts
The opinionated-component system (C1-C6)
config.fish and conf.d/ - startup and environment
docs/manual/ and the generated manual, man page, and site
functions/ - user-facing functions and helpers
integrations/ - third-party tool wiring
themes/ and prompt appearance
scripts/ - standalone helper scripts
tests/ - the syntax lint and functional suite
Breaking change that won't be backward compatible
Something is not working
Tooling, dependencies, and housekeeping
Documentation changes
Improve existing functionality
New functionality
Makes existing behavior faster or lighter
Restructures code without changing behavior
This is security issue
Issue or pull request related to testing
Well-scoped and self-contained; a good place to start
Maintainer is looking for someone to pick this up
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Milestone
No items
No Milestone
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: rootiest/fish-config#153
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Tasks 10 and 11 of
AGENTS/plans/2026-09-02-agent-memory-vault.md. Both were deliberately held back fromfeat/agent-memory-vaultbecause their tests needtests/test-agents-vault.fish, which only existed on that branch. The vault PR has merged, so they can land now.The plan asked for two branches. Both fixes are one-liners in the same function family, so they share this branch as two separate commits.
1. Only scaffold inside a git repository
functions/agents-init.fishresolved its target root to(pwd)whenevergit rev-parse --show-toplevelcame up empty. Because the function runs from an agent-CLI wrapper, something as incidental asclaude --versionin an arbitrary directory created anAGENTS/git repo, anAGENTS.md, two root symlinks, and adocs/tree there.Scaffolding now requires either a git repository or a directory that already has an
AGENTS.md,CLAUDE.md, orAGENTS/— the pre-existing-file case keeps working for projects that are intentionally not under git. Anywhere else the function is a no-op that returns 0, printing a dim skip line in verbose mode only.2. Anchor the .gitignore fallback match
functions/_agents_init_ensure_gitignore.fishusesgit check-ignorefor accurate rule matching, but falls back to a plaingrep -qFwhen the root is not a git repository. A substring match treats a negation line such as!AGENTS/fooas proof that the patternAGENTS/is already ignored, so the real rule was never appended. The fallback now matches whole lines (grep -qxF).Verification
Three new checks in
tests/test-agents-vault.fish, each confirmed failing before its fix and passing after:no scaffold in a non-git diran existing AGENTS.md still scaffoldsnegation does not count as ignoredSection 5 of the manual is generated from the function headers, and both headers were updated in place; no prose page in
docs/manual/**referencesagents-init.Follow-up: the
run-tests.fishline above was misread — the driver exited 1 on an indent lint failure despite the passing assertion total, which broke CI onmain. Fixed in #154.