Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-worktrees-snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eve": patch
---

Stop `eve dev` source snapshots from copying nested Git repositories and worktrees, preventing duplicate checkouts from inflating each development snapshot.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,45 @@ describe("development runtime artifact snapshots", () => {
expect(existsSync(join(snapshot.runtimeAppRoot, "dist"))).toBe(false);
});

it("stops copying at nested git repository boundaries", async () => {
const appRoot = await createScratchDirectory("eve-dev-runtime-nested-git-");
const agentRoot = join(appRoot, "agent");
const compileDirectoryPath = join(appRoot, ".eve", "compile");
const worktreeRoot = join(appRoot, ".claude", "worktrees", "review");
const nestedRepositoryRoot = join(appRoot, "vendor", "nested-repository");
const regularDirectoryRoot = join(appRoot, "vendor", "regular-directory");

await mkdir(agentRoot, { recursive: true });
await mkdir(worktreeRoot, { recursive: true });
await mkdir(join(nestedRepositoryRoot, ".git"), { recursive: true });
await mkdir(regularDirectoryRoot, { recursive: true });
await mkdir(compileDirectoryPath, { recursive: true });
await writeFile(join(appRoot, "package.json"), '{"type":"module"}\n');
await writeFile(join(agentRoot, "agent.ts"), "export const answer = 42;\n");
await writeFile(join(appRoot, ".claude", "notes.md"), "keep this file\n");
await writeFile(join(worktreeRoot, ".git"), "gitdir: ../../../../.git/worktrees/review\n");
await writeFile(join(worktreeRoot, "duplicate.ts"), "export const duplicate = true;\n");
await writeFile(join(nestedRepositoryRoot, "duplicate.ts"), "export const duplicate = true;\n");
await writeFile(join(regularDirectoryRoot, "source.ts"), "export const copied = true;\n");
await writeFile(
join(compileDirectoryPath, "compiled-agent-manifest.json"),
`${JSON.stringify({ agentRoot, appRoot }, null, 2)}\n`,
);

const snapshot = await stageDevelopmentRuntimeArtifactsSnapshot({
paths: { compileDirectoryPath },
project: { appRoot },
} as CompileAgentResult);

expect(existsSync(join(snapshot.runtimeAppRoot, "agent", "agent.ts"))).toBe(true);
expect(existsSync(join(snapshot.runtimeAppRoot, ".claude", "notes.md"))).toBe(true);
expect(existsSync(join(snapshot.runtimeAppRoot, ".claude", "worktrees", "review"))).toBe(false);
expect(existsSync(join(snapshot.runtimeAppRoot, "vendor", "nested-repository"))).toBe(false);
expect(
existsSync(join(snapshot.runtimeAppRoot, "vendor", "regular-directory", "source.ts")),
).toBe(true);
});

it("prunes stale snapshots while preserving the active and recent snapshots", async () => {
const appRoot = await createScratchDirectory("eve-dev-runtime-artifacts-prune-");
const snapshotsRoot = join(appRoot, ".eve", "dev-runtime", "snapshots");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ function shouldSkipSnapshotSource(
return true;
}

if (existsSync(join(sourcePath, ".git"))) {
return true;
}

return isDirectAppRootSkipPath({
appRoot: plan.appRoot,
sourcePath,
Expand Down
Loading