fix: improve trans windows route hints

This commit is contained in:
Codex
2026-06-27 02:05:42 +00:00
parent 3b2399c902
commit 4b71bed594
6 changed files with 100 additions and 5 deletions
+21
View File
@@ -42,6 +42,22 @@ describe("ssh windows fs read-only operations", () => {
expect(rgInvocation.parsed.requiresStdin).toBe(false);
});
test("routes git status, diff, and commit through Windows cmd convenience", () => {
const statusInvocation = parseSshInvocation("D601:win/F/Work/ConStart", ["git", "status", "--short", "--branch"]);
const diffInvocation = parseSshInvocation("D601:win/F/Work/ConStart", ["git", "diff", "--check"]);
const commitInvocation = parseSshInvocation("D601:win/F/Work/ConStart", ["git", "commit", "-m", "fix: update docs"]);
expect(statusInvocation.route.plane).toBe("win");
expect(statusInvocation.route.workspace).toBe("F:\\Work\\ConStart");
expect(statusInvocation.parsed.invocationKind).toBe("argv");
expect(statusInvocation.parsed.requiresStdin).toBe(false);
expect(statusInvocation.parsed.remoteCommand).toContain("powershell.exe");
expect(diffInvocation.parsed.invocationKind).toBe("argv");
expect(diffInvocation.parsed.requiresStdin).toBe(false);
expect(commitInvocation.parsed.invocationKind).toBe("argv");
expect(commitInvocation.parsed.requiresStdin).toBe(false);
});
test("builds bounded UTF-8 scripts for cat, ls, and rg", () => {
const catScript = windowsFsReadOnlyScript("F:\\Work\\demo", "cat", ["--max-bytes", "4096", "中文.md"]);
const lsScript = windowsFsReadOnlyScript("F:\\Work\\demo", "ls", ["-la", "--limit=5"]);
@@ -63,6 +79,11 @@ describe("ssh windows fs read-only operations", () => {
test("rejects unsupported Windows read operations instead of treating them as POSIX", () => {
expect(() => parseSshInvocation("D601:win/c/test", ["sed", "-n", "1p", "hello.md"])).toThrow("unsupported ssh win operation: sed");
});
test("reports route-aware hints for repeated win operation and interactive git commit", () => {
expect(() => parseSshInvocation("D601:win/F/Work/ConStart", ["win", "ps"])).toThrow("route D601:win/F/Work/ConStart already selects the Windows plane");
expect(() => parseSshInvocation("D601:win/F/Work/ConStart", ["git", "commit"])).toThrow("ssh win git commit would open an editor");
});
});
describe("ssh host apply-patch fs backend", () => {