"use strict";
/**
 * 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.
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_test_1 = require("node:test");
const strict_1 = __importDefault(require("node:assert/strict"));
const normalize_agent_dir_1 = require("./normalize-agent-dir");
(0, node_test_1.describe)('normalizeAgentDir (POSIX host: linux/wsl/macOS)', () => {
    const linux = 'linux';
    (0, node_test_1.it)('WSL UNC \\\\wsl.localhost\\<distro>\\root\\x → /root/x', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('\\\\wsl.localhost\\Ubuntu-24.04\\root\\onboarding-test-fleet', linux), '/root/onboarding-test-fleet');
    });
    (0, node_test_1.it)('older WSL UNC \\\\wsl$\\<distro>\\home\\me\\x → /home/me/x', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('\\\\wsl$\\Ubuntu\\home\\me\\agents', linux), '/home/me/agents');
    });
    (0, node_test_1.it)('forward-slash WSL UNC //wsl.localhost/<distro>/root/x → /root/x', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('//wsl.localhost/Ubuntu/root/x', linux), '/root/x');
    });
    (0, node_test_1.it)('Windows drive C:\\Users\\me\\fleet → /mnt/c/Users/me/fleet (WSL drvfs)', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('C:\\Users\\me\\fleet', linux), '/mnt/c/Users/me/fleet');
    });
    (0, node_test_1.it)('lowercase + forward-slash drive d:/data/agents → /mnt/d/data/agents', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('d:/data/agents', linux), '/mnt/d/data/agents');
    });
    (0, node_test_1.it)('generic UNC \\\\server\\share\\x → /x (best-effort)', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('\\\\fileserver\\team\\x', linux), '/x');
    });
    (0, node_test_1.it)('POSIX paths pass through unchanged (Linux/macOS)', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('/root/fleet', linux), '/root/fleet');
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('/Users/me/fleet', linux), '/Users/me/fleet');
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('./fleet', linux), './fleet');
    });
    (0, node_test_1.it)('strips surrounding quotes and whitespace', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('  "\\\\wsl.localhost\\Ubuntu\\root\\x"  ', linux), '/root/x');
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)("'/root/fleet'", linux), '/root/fleet');
    });
});
(0, node_test_1.describe)('normalizeAgentDir (native Windows host)', () => {
    const win = 'win32';
    (0, node_test_1.it)('leaves a Windows drive path alone (Node-on-Windows resolves it natively)', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('C:\\Users\\me\\fleet', win), 'C:\\Users\\me\\fleet');
    });
    (0, node_test_1.it)('leaves a real UNC path alone (must NOT be rewritten to /path on Windows)', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('\\\\server\\share\\x', win), '\\\\server\\share\\x');
    });
    (0, node_test_1.it)('still strips wrapping quotes on Windows', () => {
        strict_1.default.equal((0, normalize_agent_dir_1.normalizeAgentDir)('"C:\\a\\b"', win), 'C:\\a\\b');
    });
});
//# sourceMappingURL=normalize-agent-dir.test.js.map