mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
support hidden folders
This commit is contained in:
@@ -13,11 +13,16 @@ const MARKETPLACE_URL_REGEX =
|
|||||||
* @returns true if the input is a local path, false if it's a URL
|
* @returns true if the input is a local path, false if it's a URL
|
||||||
*/
|
*/
|
||||||
function isLocalPath(input: string): boolean {
|
function isLocalPath(input: string): boolean {
|
||||||
// Local paths start with ./, ../, /, or a drive letter (Windows)
|
// Local paths start with:
|
||||||
|
// - ./ or ../ (relative paths)
|
||||||
|
// - / (Unix absolute paths)
|
||||||
|
// - .something/ (hidden folders like .claude-marketplace/)
|
||||||
|
// - Drive letter (Windows paths like C:\)
|
||||||
return (
|
return (
|
||||||
input.startsWith("./") ||
|
input.startsWith("./") ||
|
||||||
input.startsWith("../") ||
|
input.startsWith("../") ||
|
||||||
input.startsWith("/") ||
|
input.startsWith("/") ||
|
||||||
|
/^\.[a-zA-Z0-9_-]+[\\\/]/.test(input) || // Hidden folders: .plugins/, .cache/
|
||||||
/^[a-zA-Z]:[\\\/]/.test(input)
|
/^[a-zA-Z]:[\\\/]/.test(input)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -703,4 +703,30 @@ describe("installPlugins", () => {
|
|||||||
{ stdio: "inherit" },
|
{ stdio: "inherit" },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("should accept hidden folder path (.folder-name/)", async () => {
|
||||||
|
const spy = createMockSpawn();
|
||||||
|
await installPlugins(".my-plugins/marketplace", "test-plugin");
|
||||||
|
|
||||||
|
expect(spy).toHaveBeenCalledTimes(2);
|
||||||
|
expect(spy).toHaveBeenNthCalledWith(
|
||||||
|
1,
|
||||||
|
"claude",
|
||||||
|
["plugin", "marketplace", "add", ".my-plugins/marketplace"],
|
||||||
|
{ stdio: "inherit" },
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("should accept hidden folder path with Windows backslash", async () => {
|
||||||
|
const spy = createMockSpawn();
|
||||||
|
await installPlugins(".hidden-folder\\marketplace", "test-plugin");
|
||||||
|
|
||||||
|
expect(spy).toHaveBeenCalledTimes(2);
|
||||||
|
expect(spy).toHaveBeenNthCalledWith(
|
||||||
|
1,
|
||||||
|
"claude",
|
||||||
|
["plugin", "marketplace", "add", ".hidden-folder\\marketplace"],
|
||||||
|
{ stdio: "inherit" },
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user