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
10 changes: 8 additions & 2 deletions src/workspaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const outsideRoot = await mkdtemp(join(tmpdir(), "devspace-workspace-outside-tes
try {
const agentDir = join(root, ".pi", "agent");
await mkdir(agentDir, { recursive: true });
await mkdir(join(agentDir, "skills"), { recursive: true });
await writeFile(join(agentDir, "skills", "AGENTS.md"), "global instructions\n");
if (platform() === "win32") {
await writeFile(join(agentDir, "AGENTS.md"), "global instructions\n");
} else {
await mkdir(join(agentDir, "skills"), { recursive: true });
await writeFile(join(agentDir, "skills", "AGENTS.md"), "global instructions\n");
await symlink("skills/AGENTS.md", join(agentDir, "AGENTS.md"));
}
await writeFile(join(root, "AGENTS.md"), "root instructions\n");
Expand Down Expand Up @@ -179,6 +179,12 @@ try {
mode: "worktree",
});
assert.equal(aliasWorkspace.workspace.sourceRoot, join(aliasRoot, "git-project"));

const aliasCheckout = await new WorkspaceRegistry(aliasConfig).openWorkspace(aliasRoot);
assert.deepEqual(
aliasCheckout.agentsFiles.map((file) => file.content),
["global instructions\n", "root instructions\n"],
);
}
} finally {
await rm(root, { recursive: true, force: true });
Expand Down
9 changes: 8 additions & 1 deletion src/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,19 @@ export class WorkspaceRegistry {

private async loadInitialAgentsFiles(root: string): Promise<LoadedAgentsFile[]> {
const agentDir = resolve(this.config.agentDir);
const resolvedRoot = (await tryRealpath(root)) ?? root;
const resolvedAgentDir = (await tryRealpath(agentDir)) ?? agentDir;
const loadedFiles: LoadedAgentsFile[] = [];

for (const file of loadProjectContextFiles({ cwd: root, agentDir })) {
const path = resolve(file.path);
if (!isInitialAgentsFilePath(path, root, agentDir)) continue;
const content = await readResolvedContextFile(path, file.content, root, agentDir);
const content = await readResolvedContextFile(
path,
file.content,
resolvedRoot,
resolvedAgentDir,
);
if (content === undefined) continue;

loadedFiles.push({
Expand Down
Loading