fix: 收敛 trans 远端文本短路径

This commit is contained in:
Codex
2026-07-13 05:20:27 +02:00
parent 18937da9db
commit c04983455e
16 changed files with 498 additions and 70 deletions
+11 -1
View File
@@ -76,6 +76,9 @@ describe("ssh bounded progressive help", () => {
expect(scoped.contract.pathOrder).toEqual(["remote-file", "local-file"]);
expect(scoped.contract.transport).toBe("host.ssh.tcp-pool");
expect(scoped.contract.verification.automatic).toBe(true);
expect(scoped.usage[0]).toBe("trans <route> cat <remote-text-file>");
expect(serialized).toContain("text-transfer-discouraged");
expect(serialized).toContain("--allow-text-transfer");
expect(scoped.examples.host).toContain("download /tmp/trace.json ./trace.json");
expect(scoped.examples.k3sWorkload).toBe(
"trans NC01:k3s:hwlab-v03:hwlab-cloud-api:hwlab-cloud-api download /tmp/trace.json ./trace.json",
@@ -100,7 +103,8 @@ describe("ssh bounded progressive help", () => {
const applyPatch = runTransHelp("--help", "apply-patch");
expect(applyPatch.trim().split("\n").length).toBeLessThanOrEqual(8);
expect(applyPatch).toContain("TRANS HELP apply-patch");
expect(applyPatch).toContain("usage: trans <route> apply-patch");
expect(applyPatch).toContain("usage: trans <route> apply-patch <<'PATCH'");
expect(applyPatch).not.toContain("patch.diff");
expect(applyPatch).not.toContain("outputTruncated");
const exec = runTransHelp("--help", "exec");
@@ -110,8 +114,14 @@ describe("ssh bounded progressive help", () => {
const download = runTransHelp("--help", "download");
expect(download.trim().split("\n").length).toBeLessThanOrEqual(8);
expect(download).toContain("TRANS HELP download");
expect(download.indexOf("cat <remote-text-file>")).toBeLessThan(download.indexOf("download <remote-file> <local-file>"));
expect(download).toContain("download <remote-file> <local-file>");
expect(download).not.toContain("outputTruncated");
const upload = runTransHelp("--help", "upload");
expect(upload.trim().split("\n").length).toBeLessThanOrEqual(8);
expect(upload.indexOf("apply-patch <<'PATCH'")).toBeLessThan(upload.indexOf("upload <local-file> <remote-file>"));
expect(upload).toContain("text-transfer-discouraged");
});
test("returns the existing bounded JSON model only for explicit machine output", () => {