Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/project/project-ai-config.test.ts
12921 views
1
/*
2
* project-ai-config.test.ts
3
*
4
* Verifies that AI assistant configuration files (CLAUDE.md, AGENTS.md)
5
* are properly excluded from project file discovery and rendering.
6
*
7
* Copyright (C) 2020-2025 Posit Software, PBC
8
*/
9
10
import { docs } from "../../utils.ts";
11
import { join } from "../../../src/deno_ral/path.ts";
12
import { existsSync } from "../../../src/deno_ral/fs.ts";
13
import { removeIfExists } from "../../../src/core/path.ts";
14
import { testQuartoCmd } from "../../test.ts";
15
import { fileExists, pathDoNotExists, noErrors } from "../../verify.ts";
16
17
const projectDir = docs("project/ai-config-files");
18
const outputDir = join(projectDir, "_site");
19
20
// .local.md fixture files are created at runtime to avoid .gitignore conflicts
21
const localFiles = ["CLAUDE.local.md", "AGENTS.local.md"];
22
23
// Test that AI assistant config files are properly excluded
24
testQuartoCmd(
25
"render",
26
[projectDir],
27
[
28
noErrors,
29
fileExists(join(outputDir, "index.html")), // Control: regular file should be rendered
30
pathDoNotExists(join(outputDir, "CLAUDE.html")), // CLAUDE.md should be ignored
31
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
34
],
35
{
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
},
44
teardown: async () => {
45
for (const file of localFiles) {
46
removeIfExists(join(projectDir, file));
47
}
48
if (existsSync(outputDir)) {
49
await Deno.remove(outputDir, { recursive: true });
50
}
51
},
52
},
53
);
54
55