feat(agents): write AGENTS.md from a tracked AGENTS.template.md
The dependency notes were kept in a section of the AGENTS.md beside project.cpp, the file a project commits, so a build could change a tracked file at any time: a dependency editing its AGENTS.consumer.md, an unpinned one moving on, a flag pulling a dependency in or out, each showed up in the consumer's diff as a change nobody made. Users reported it as the feature clobbering their diffs. A project now commits its instructions as AGENTS.template.md, and a build and a test run write AGENTS.md from it: a first line saying the file is generated and where to edit, the template's text as written, then the notes section, after it or where the template's marker lines put it. AGENTS.md is build output and goes into .gitignore. It is created when missing, since a fresh clone has none, and otherwise written as before: only when its text changes, in place and under a lock, so links, ownership and a read-only file are respected. The first line is also how a build tells its own AGENTS.md from one someone wrote. Beside a template the second is easily there, as a committed AGENTS.md nobody has removed yet; it is never replaced, and each build warns until it is deleted. An empty file counts as a build's, since that is what a write cut short leaves of a new one. An AGENTS.md linked to the template is refused: writing it would write the committed file again. A template the notes cannot be placed in leaves no empty AGENTS.md behind. The in-place mode is removed rather than kept as the fallback for a project without a template. It is the default that put generated text into tracked files unasked, the moment any dependency started shipping notes. Without a template a build no longer touches AGENTS.md. One that still holds a section from 3.0.0 would go stale silently, under a preamble promising that every build rewrites it, so it gets a warning naming the move instead. MergeDependencyNotes keeps its rules and now runs on the template. The test changes in this commit rather than its own, because it pinned the in-place behaviour this removes: it now covers the generated file's shape, edits and markers in the template, the ownership check, a CRLF template, a link to the template and the cases without one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b26807f5aa
commit
74e8370b2b
8 changed files with 259 additions and 121 deletions
|
|
@ -1840,11 +1840,13 @@ Clean (after the `clean` subcommand):
|
|||
and dependency artifact under those trees goes with it.
|
||||
|
||||
AGENTS.md:
|
||||
When an AGENTS.md sits beside the project file, a build and a test run keep a
|
||||
section in it holding the AGENTS.consumer.md each dependency ships beside its
|
||||
project.cpp, and write the file only when that section changes. An AGENTS.md
|
||||
is never created. cfg.dependencyNotes picks the dependencies: Transitive (the
|
||||
default), Direct, or None, which removes the section.
|
||||
When an AGENTS.template.md sits beside the project file, a build and a test
|
||||
run write AGENTS.md from it, with a section holding the AGENTS.consumer.md
|
||||
each dependency ships beside its project.cpp, and only when the text changes.
|
||||
Commit the template and keep AGENTS.md out of version control. An AGENTS.md
|
||||
no build wrote is never replaced, and without a template AGENTS.md is left
|
||||
alone. cfg.dependencyNotes picks the dependencies: Transitive (the default),
|
||||
Direct, or None.
|
||||
|
||||
Project args:
|
||||
Any flag not consumed above is forwarded verbatim to CrafterBuildProject as
|
||||
|
|
|
|||
Loading…
Reference in a new issue