Skip to content

Commit e1fe9ec

Browse files
committed
fix: dot-prefixed paths not recognized correctly
Paths starting with dot like .claude, .github were incorrectly stripped to claude, github Fixed regex to only remove relative path prefix (./) instead of all leading dots fix #59
1 parent e1f201d commit e1fe9ec

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/pkg/push/files.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,22 @@ describe("Push Files - Integration Test", () => {
2828
it("should handle already normalized paths", () => {
2929
expect(normalizePath("src/index.ts")).toBe("src/index.ts");
3030
});
31+
32+
it("should preserve dot-prefixed paths like .claude", () => {
33+
expect(normalizePath(".claude")).toBe(".claude");
34+
});
35+
36+
it("should preserve dot-prefixed paths with subdirectories", () => {
37+
expect(normalizePath(".claude/commands")).toBe(".claude/commands");
38+
});
39+
40+
it("should preserve .github path", () => {
41+
expect(normalizePath(".github/workflows")).toBe(".github/workflows");
42+
});
43+
44+
it("should handle ./ prefix with dot-prefixed path", () => {
45+
expect(normalizePath("./.claude")).toBe(".claude");
46+
});
3147
});
3248

3349
describe("getRelativePath", () => {

src/pkg/push/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const getFileSize = async (filePath: string): Promise<number> => {
1313

1414
export const normalizePath = (path: string): string => {
1515
let normalized = normalize(path);
16-
normalized = normalized.replace(/^[./\\]+/, "");
16+
normalized = normalized.replace(/^\.[\\/]+/, "");
1717
normalized = normalized.replace(/\\/g, "/");
1818
return normalized;
1919
};

0 commit comments

Comments
 (0)