summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/services/FileCommandLoader.test.ts57
-rw-r--r--packages/cli/src/services/FileCommandLoader.ts1
2 files changed, 58 insertions, 0 deletions
diff --git a/packages/cli/src/services/FileCommandLoader.test.ts b/packages/cli/src/services/FileCommandLoader.test.ts
index b86d36ac..0e3d781b 100644
--- a/packages/cli/src/services/FileCommandLoader.test.ts
+++ b/packages/cli/src/services/FileCommandLoader.test.ts
@@ -54,6 +54,63 @@ describe('FileCommandLoader', () => {
}
});
+ // Symlink creation on Windows requires special permissions that are not
+ // available in the standard CI environment. Therefore, we skip these tests
+ // on Windows to prevent CI failures. The core functionality is still
+ // validated on Linux and macOS.
+ const itif = (condition: boolean) => (condition ? it : it.skip);
+
+ itif(process.platform !== 'win32')(
+ 'loads commands from a symlinked directory',
+ async () => {
+ const userCommandsDir = getUserCommandsDir();
+ const realCommandsDir = '/real/commands';
+ mock({
+ [realCommandsDir]: {
+ 'test.toml': 'prompt = "This is a test prompt"',
+ },
+ // Symlink the user commands directory to the real one
+ [userCommandsDir]: mock.symlink({
+ path: realCommandsDir,
+ }),
+ });
+
+ const loader = new FileCommandLoader(null as unknown as Config);
+ const commands = await loader.loadCommands(signal);
+
+ expect(commands).toHaveLength(1);
+ const command = commands[0];
+ expect(command).toBeDefined();
+ expect(command.name).toBe('test');
+ },
+ );
+
+ itif(process.platform !== 'win32')(
+ 'loads commands from a symlinked subdirectory',
+ async () => {
+ const userCommandsDir = getUserCommandsDir();
+ const realNamespacedDir = '/real/namespaced-commands';
+ mock({
+ [userCommandsDir]: {
+ namespaced: mock.symlink({
+ path: realNamespacedDir,
+ }),
+ },
+ [realNamespacedDir]: {
+ 'my-test.toml': 'prompt = "This is a test prompt"',
+ },
+ });
+
+ const loader = new FileCommandLoader(null as unknown as Config);
+ const commands = await loader.loadCommands(signal);
+
+ expect(commands).toHaveLength(1);
+ const command = commands[0];
+ expect(command).toBeDefined();
+ expect(command.name).toBe('namespaced:my-test');
+ },
+ );
+
it('loads multiple commands', async () => {
const userCommandsDir = getUserCommandsDir();
mock({
diff --git a/packages/cli/src/services/FileCommandLoader.ts b/packages/cli/src/services/FileCommandLoader.ts
index 994762c1..23d5af19 100644
--- a/packages/cli/src/services/FileCommandLoader.ts
+++ b/packages/cli/src/services/FileCommandLoader.ts
@@ -71,6 +71,7 @@ export class FileCommandLoader implements ICommandLoader {
nodir: true,
dot: true,
signal,
+ follow: true,
};
try {