Skip to content

upsertShepherdIgnoreBlock

upsertShepherdIgnoreBlock(existing): object

Defined in: src/shepherd-exclude.ts:40

Insert or replace the managed shepherd:ignore block in gitignore-syntax content. Idempotent: replaces an existing managed block’s contents rather than appending a duplicate; treats a pre-existing bare .shepherd-* line (the glob already present outside the markers) as already-covered → no-op; otherwise appends a fresh block.

Generic over the target file — used for BOTH .git/info/exclude (via ensureShepherdExclude) and a committed .gitignore (via GitignoreAdopter), which share the same gitignore glob syntax + managed-block markers.

Modelled on upsertLearningsBlock in src/promote.ts.

string

object

changed: boolean

content: string