Fix desktop CLI passthrough tty handling (#791)

* Fix desktop CLI passthrough tty handling

* Fix desktop daemon manager test drift

* Update daemon stop test after main merge

* test(cli): isolate npx cache per CLI test
This commit is contained in:
Mohamed Boudra
2026-05-07 15:14:18 +08:00
committed by GitHub
parent 6fb2fe2283
commit faf664d803
20 changed files with 868 additions and 461 deletions
+48
View File
@@ -0,0 +1,48 @@
import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { createCliParseArgv } from "./run";
describe("runCli", () => {
it("defaults an empty CLI invocation to onboard", () => {
expect(
createCliParseArgv({
argv: [],
cwd: process.cwd(),
nodeArgv: ["node", "paseo"],
}),
).toEqual(["node", "paseo", "onboard"]);
});
it("preserves known CLI command argv", () => {
expect(
createCliParseArgv({
argv: ["daemon", "set-password"],
cwd: process.cwd(),
nodeArgv: ["node", "paseo"],
}),
).toEqual(["node", "paseo", "daemon", "set-password"]);
});
it("classifies existing unknown directories as open-project invocations", () => {
const root = mkdtempSync(path.join(tmpdir(), "paseo-cli-run-"));
const project = path.join(root, "project");
mkdirSync(project);
try {
expect(
createCliParseArgv({
argv: ["project"],
cwd: root,
nodeArgv: ["node", "paseo"],
}),
).toEqual({
kind: "open-project",
resolvedPath: project,
});
} finally {
rmSync(root, { recursive: true, force: true });
}
});
});