Skip to content
Open
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
270 changes: 123 additions & 147 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
"check": "tsgo --noEmit && biome check ."
},
"peerDependencies": {
"@mariozechner/pi-agent-core": "*",
"@mariozechner/pi-ai": "*",
"@mariozechner/pi-coding-agent": "*",
"@mariozechner/pi-tui": "*",
"@earendil-works/pi-agent-core": "*",
"@earendil-works/pi-ai": "*",
"@earendil-works/pi-coding-agent": "*",
"@earendil-works/pi-tui": "*",
"typebox": "*"
},
"devDependencies": {
Expand Down
18 changes: 11 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { mkdir, readFile, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
import path from "node:path";
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import type { Model } from "@mariozechner/pi-ai";
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
import type { Model } from "@earendil-works/pi-ai";
import {
defineTool,
type ExtensionAPI,
getLanguageFromPath,
highlightCode,
type ToolDefinition,
} from "@mariozechner/pi-coding-agent";
import { Box, Container, Spacer, Text } from "@mariozechner/pi-tui";
} from "@earendil-works/pi-coding-agent";
import { Box, Container, Spacer, Text } from "@earendil-works/pi-tui";
import * as Diff from "diff";
import { Type } from "typebox";

Expand Down Expand Up @@ -416,9 +416,13 @@ function formatLineCountSummary(added: number, removed: number): string {
return `(+${added} -${removed})`;
}

function normalizeDisplayPath(filePath: string): string {
return filePath.replaceAll(path.sep, "/");
}

export function displayPath(filePath: string, cwd: string): string {
if (!path.isAbsolute(filePath)) {
return filePath;
return normalizeDisplayPath(filePath);
}

const absoluteCwd = path.resolve(cwd);
Expand All @@ -427,10 +431,10 @@ export function displayPath(filePath: string, cwd: string): string {
relativePath === "" ||
(!relativePath.startsWith(`..${path.sep}`) && relativePath !== ".." && !path.isAbsolute(relativePath))
) {
return relativePath || ".";
return normalizeDisplayPath(relativePath || ".");
}

return filePath;
return normalizeDisplayPath(filePath);
}

export function formatPatchFilePath(file: ApplyPatchPreviewFile, cwd: string = process.cwd()): string {
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ EOF`;
// given
const directory = await createTempDirectory();
const outsideDirectory = await createTempDirectory();
await symlink(outsideDirectory, path.join(directory, "link"), "dir");
await symlink(outsideDirectory, path.join(directory, "link"), process.platform === "win32" ? "junction" : "dir");
const patch = `*** Begin Patch
*** Add File: link/outside.txt
+outside
Expand Down