/**
 * normalize-agent-dir — cross-OS, cross-LLM path robustness for --agent-dir.
 *
 * Thomas 2026-06-05: clients may be on Windows / WSL / macOS / Linux and may
 * drive their agent with any LLM (Claude, OpenAI, DeepSeek, …). The pasted
 * directory must be normalized by the CLI itself, deterministically — never
 * relying on the LLM to translate it.
 */
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { normalizeAgentDir } from './normalize-agent-dir.js';
describe('normalizeAgentDir (POSIX host: linux/wsl/macOS)', () => {
    const linux = 'linux';
    it('WSL UNC \\\\wsl.localhost\\<distro>\\root\\x → /root/x', () => {
        assert.equal(normalizeAgentDir('\\\\wsl.localhost\\Ubuntu-24.04\\root\\onboarding-test-fleet', linux), '/root/onboarding-test-fleet');
    });
    it('older WSL UNC \\\\wsl$\\<distro>\\home\\me\\x → /home/me/x', () => {
        assert.equal(normalizeAgentDir('\\\\wsl$\\Ubuntu\\home\\me\\agents', linux), '/home/me/agents');
    });
    it('forward-slash WSL UNC //wsl.localhost/<distro>/root/x → /root/x', () => {
        assert.equal(normalizeAgentDir('//wsl.localhost/Ubuntu/root/x', linux), '/root/x');
    });
    it('Windows drive C:\\Users\\me\\fleet → /mnt/c/Users/me/fleet (WSL drvfs)', () => {
        assert.equal(normalizeAgentDir('C:\\Users\\me\\fleet', linux), '/mnt/c/Users/me/fleet');
    });
    it('lowercase + forward-slash drive d:/data/agents → /mnt/d/data/agents', () => {
        assert.equal(normalizeAgentDir('d:/data/agents', linux), '/mnt/d/data/agents');
    });
    it('generic UNC \\\\server\\share\\x → /x (best-effort)', () => {
        assert.equal(normalizeAgentDir('\\\\fileserver\\team\\x', linux), '/x');
    });
    it('POSIX paths pass through unchanged (Linux/macOS)', () => {
        assert.equal(normalizeAgentDir('/root/fleet', linux), '/root/fleet');
        assert.equal(normalizeAgentDir('/Users/me/fleet', linux), '/Users/me/fleet');
        assert.equal(normalizeAgentDir('./fleet', linux), './fleet');
    });
    it('strips surrounding quotes and whitespace', () => {
        assert.equal(normalizeAgentDir('  "\\\\wsl.localhost\\Ubuntu\\root\\x"  ', linux), '/root/x');
        assert.equal(normalizeAgentDir("'/root/fleet'", linux), '/root/fleet');
    });
});
describe('normalizeAgentDir (native Windows host)', () => {
    const win = 'win32';
    it('leaves a Windows drive path alone (Node-on-Windows resolves it natively)', () => {
        assert.equal(normalizeAgentDir('C:\\Users\\me\\fleet', win), 'C:\\Users\\me\\fleet');
    });
    it('leaves a real UNC path alone (must NOT be rewritten to /path on Windows)', () => {
        assert.equal(normalizeAgentDir('\\\\server\\share\\x', win), '\\\\server\\share\\x');
    });
    it('still strips wrapping quotes on Windows', () => {
        assert.equal(normalizeAgentDir('"C:\\a\\b"', win), 'C:\\a\\b');
    });
});
//# sourceMappingURL=normalize-agent-dir.test.js.map