test(agents): what a consumer's AGENTS.md gets, and what stays put
The merge on its own: the section is appended after one blank line, merging again changes nothing, a moved section is rewritten where it stands, and removing it gives the file its own bytes back. Markers inside a fenced block, one quoting a fenced block of its own, are not the section's. Unbalanced markers, a document that ends inside a code block and notes that would break the section are refused, naming the line. End to end, through LoadProject on a staged fixture: app names lib and has tool as host tooling; lib builds against base and has libtool as its own. Transitive gives tool, lib and base in that order, and neither app's own notes nor libtool's. A second update writes nothing, mtime included. Direct drops base, edited notes replace the old ones in the one section, and None restores the original bytes. A project without an AGENTS.md does not get one, and a symlinked AGENTS.md is written through the link, which stays a link. Through Run in process, lint and run leave the file alone, while `test --list` and a build that fails at the link both refresh it. The fixture's AGENTS.md is checked in as AGENTS.md.in: an AGENTS.md in this tree would read as instructions for the agents working on it. Moving the CLI hook above the run and lint branches, or letting Direct walk past the first loaded project, fails four of the checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e87fb0cc12
commit
eb1c3a4b1d
13 changed files with 338 additions and 0 deletions
3
tests/DependencyNotes/fixture/lib/AGENTS.consumer.md
Normal file
3
tests/DependencyNotes/fixture/lib/AGENTS.consumer.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
## lib
|
||||
|
||||
Call lib through its module, never through its headers.
|
||||
21
tests/DependencyNotes/fixture/lib/project.cpp
Normal file
21
tests/DependencyNotes/fixture/lib/project.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||||
|
||||
import std;
|
||||
import Crafter.Build;
|
||||
#pragma crafter dependency "../libtool"
|
||||
using namespace Crafter;
|
||||
|
||||
// What app depends on. It builds against base, which app only reaches
|
||||
// through it. libtool is lib's own host tooling: it says nothing about using
|
||||
// lib, so its notes must not reach app.
|
||||
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view>) {
|
||||
Configuration cfg;
|
||||
cfg.path = "./";
|
||||
cfg.name = "lib";
|
||||
cfg.outputName = "lib";
|
||||
cfg.type = ConfigurationType::LibraryStatic;
|
||||
// Loaded from lib/, so this resolves against it.
|
||||
cfg.dependencies = { LocalProject({ .projectFile = "../base/project.cpp" }) };
|
||||
return cfg;
|
||||
}
|
||||
Loading…
Reference in a new issue