Skip to content

Commit 45102d2

Browse files
authored
Fix CLAUDE.local.md and AGENTS.local.md not ignored during project render (#14200)
The .local.md variants of AI assistant config files were not excluded from project file discovery or extension templates. Extends the ignore patterns added in #13907 to also cover these files. Fixes #14198
1 parent 2547d69 commit 45102d2

5 files changed

Lines changed: 32 additions & 3 deletions

File tree

news/changelog-1.9.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ All changes included in 1.9:
217217
- ([#13856](https://github.com/quarto-dev/quarto-cli/issues/13856)): Add code annotation support for Typst and Observable.js code blocks. (author: @mcanouil)
218218
- ([#13890](https://github.com/quarto-dev/quarto-cli/issues/13890)): Fix render failure when using `embed-resources: true` with input path through a symlinked directory. The cleanup now resolves symlinks before comparing paths.
219219
- ([#13907](https://github.com/quarto-dev/quarto-cli/issues/13907)): Ignore AI assistant configuration files (`CLAUDE.md`, `AGENTS.md`) when scanning for project input files and in extension templates, similar to how `README.md` is handled.
220+
- ([#14198](https://github.com/quarto-dev/quarto-cli/issues/14198)): Ignore `.local.md` variants of AI assistant configuration files (`CLAUDE.local.md`, `AGENTS.local.md`) during project render and `quarto use template`.
220221
- ([#13935](https://github.com/quarto-dev/quarto-cli/issues/13935)): Fix `quarto install`, `quarto update`, and `quarto uninstall` interactive tool selection.
221222
- ([#13992](https://github.com/quarto-dev/quarto-cli/issues/13992)): Fix crash when rendering div with both cross-reference ID and conditional visibility to PDF.
222223
- ([#13997](https://github.com/quarto-dev/quarto-cli/issues/13997)): Fix Windows dart-sass theme compilation failing when Quarto is installed in a path with spaces (e.g., `C:\Program Files\`) and the project path also contains spaces.

src/extension/template.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,7 @@ const kBuiltInExcludes = [
5858
"LICENSE",
5959
"_extensions",
6060
"CLAUDE.md",
61+
"CLAUDE.local.md",
6162
"AGENTS.md",
63+
"AGENTS.local.md",
6264
];

src/project/project-context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,8 @@ function projectHiddenIgnoreGlob(dir: string) {
880880
.concat(["**/_*", "**/_*/**"]) // underscore prefix
881881
.concat(["**/.*", "**/.*/**"]) // hidden (dot prefix)
882882
.concat(["**/README.?([Rrq])md"]) // README
883-
.concat(["**/CLAUDE.md"]) // Anthropic claude code file
884-
.concat(["**/AGENTS.md"]) // https://agents.md/
883+
.concat(["**/CLAUDE.md", "**/CLAUDE.local.md"]) // Anthropic claude code file
884+
.concat(["**/AGENTS.md", "**/AGENTS.local.md"]) // https://agents.md/
885885
.concat(["**/*.llms.md"]); // llms.txt companion markdown files
886886
}
887887

tests/smoke/project/project-ai-config.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010
import { docs } from "../../utils.ts";
1111
import { join } from "../../../src/deno_ral/path.ts";
1212
import { existsSync } from "../../../src/deno_ral/fs.ts";
13+
import { removeIfExists } from "../../../src/core/path.ts";
1314
import { testQuartoCmd } from "../../test.ts";
1415
import { fileExists, pathDoNotExists, noErrors } from "../../verify.ts";
1516

1617
const projectDir = docs("project/ai-config-files");
1718
const outputDir = join(projectDir, "_site");
1819

20+
// .local.md fixture files are created at runtime to avoid .gitignore conflicts
21+
const localFiles = ["CLAUDE.local.md", "AGENTS.local.md"];
22+
1923
// Test that AI assistant config files are properly excluded
2024
testQuartoCmd(
2125
"render",
@@ -25,10 +29,22 @@ testQuartoCmd(
2529
fileExists(join(outputDir, "index.html")), // Control: regular file should be rendered
2630
pathDoNotExists(join(outputDir, "CLAUDE.html")), // CLAUDE.md should be ignored
2731
pathDoNotExists(join(outputDir, "AGENTS.html")), // AGENTS.md should be ignored
32+
pathDoNotExists(join(outputDir, "CLAUDE.local.html")), // CLAUDE.local.md should be ignored
33+
pathDoNotExists(join(outputDir, "AGENTS.local.html")), // AGENTS.local.md should be ignored
2834
],
2935
{
36+
setup: async () => {
37+
for (const file of localFiles) {
38+
await Deno.writeTextFile(
39+
join(projectDir, file),
40+
"This is a local AI config file that should be ignored during project scanning.\n",
41+
);
42+
}
43+
},
3044
teardown: async () => {
31-
// Clean up _site directory
45+
for (const file of localFiles) {
46+
removeIfExists(join(projectDir, file));
47+
}
3248
if (existsSync(outputDir)) {
3349
await Deno.remove(outputDir, { recursive: true });
3450
}

tests/smoke/use/template-ai-config.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ Deno.writeTextFileSync(
2929
join(templateSourceDir, "AGENTS.md"),
3030
"# Agents Configuration\n\nThis should be excluded."
3131
);
32+
Deno.writeTextFileSync(
33+
join(templateSourceDir, "CLAUDE.local.md"),
34+
"# Claude Local Configuration\n\nThis should be excluded."
35+
);
36+
Deno.writeTextFileSync(
37+
join(templateSourceDir, "AGENTS.local.md"),
38+
"# Agents Local Configuration\n\nThis should be excluded."
39+
);
3240
Deno.writeTextFileSync(
3341
join(templateSourceDir, "README.md"),
3442
"# Template README\n\nThis should also be excluded."
@@ -46,6 +54,8 @@ testQuartoCmd(
4654
fileExists(`${templateFolder}.qmd`), // Template file should be copied and renamed
4755
pathDoNotExists(join(workingDir, "CLAUDE.md")), // CLAUDE.md should be excluded
4856
pathDoNotExists(join(workingDir, "AGENTS.md")), // AGENTS.md should be excluded
57+
pathDoNotExists(join(workingDir, "CLAUDE.local.md")), // CLAUDE.local.md should be excluded
58+
pathDoNotExists(join(workingDir, "AGENTS.local.md")), // AGENTS.local.md should be excluded
4959
pathDoNotExists(join(workingDir, "README.md")), // README.md should also be excluded (sanity check)
5060
],
5161
{

0 commit comments

Comments
 (0)