new_pull
This commit is contained in:
@@ -2,7 +2,7 @@ import { mkdirSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "nod
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { AuthStorage } from "../src/core/auth-storage.ts";
|
||||
import { ExtensionRunner } from "../src/core/extensions/runner.ts";
|
||||
import { DefaultResourceLoader } from "../src/core/resource-loader.ts";
|
||||
@@ -355,6 +355,22 @@ Content`,
|
||||
expect(agentsFiles.some((f) => f.path.includes("AGENTS.md"))).toBe(true);
|
||||
});
|
||||
|
||||
it("should ignore context file candidates that are directories", async () => {
|
||||
mkdirSync(join(cwd, "AGENTS.md"));
|
||||
writeFileSync(join(cwd, "CLAUDE.md"), "Fallback instructions");
|
||||
const consoleError = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
|
||||
const loader = new DefaultResourceLoader({ cwd, agentDir });
|
||||
await loader.reload();
|
||||
|
||||
expect(loader.getAgentsFiles().agentsFiles).toContainEqual({
|
||||
path: join(cwd, "CLAUDE.md"),
|
||||
content: "Fallback instructions",
|
||||
});
|
||||
expect(consoleError).not.toHaveBeenCalledWith(expect.stringContaining(join(cwd, "AGENTS.md")));
|
||||
consoleError.mockRestore();
|
||||
});
|
||||
|
||||
it("should skip AGENTS.md and CLAUDE.md discovery when noContextFiles is true", async () => {
|
||||
writeFileSync(join(cwd, "AGENTS.md"), "# Project Guidelines\n\nBe helpful.");
|
||||
writeFileSync(join(cwd, "CLAUDE.md"), "# Claude Guidelines\n\nBe helpful.");
|
||||
|
||||
Reference in New Issue
Block a user