fix: add diagnostics cache trace config (#1370) (thanks @parubets)
This commit is contained in:
@@ -115,6 +115,10 @@ describe("exec approvals CLI", () => {
|
||||
runtimeErrors.length = 0;
|
||||
callGatewayFromCli.mockClear();
|
||||
|
||||
const execApprovals = await import("../infra/exec-approvals.js");
|
||||
const saveExecApprovals = vi.mocked(execApprovals.saveExecApprovals);
|
||||
saveExecApprovals.mockClear();
|
||||
|
||||
const { registerExecApprovalsCli } = await import("./exec-approvals-cli.js");
|
||||
const program = new Command();
|
||||
program.exitOverride();
|
||||
@@ -122,9 +126,17 @@ describe("exec approvals CLI", () => {
|
||||
|
||||
await program.parseAsync(["approvals", "allowlist", "add", "/usr/bin/uname"], { from: "user" });
|
||||
|
||||
const setCall = callGatewayFromCli.mock.calls.find((call) => call[0] === "exec.approvals.set");
|
||||
expect(setCall).toBeTruthy();
|
||||
const params = setCall?.[2] as { file: { agents?: Record<string, unknown> } };
|
||||
expect(params.file.agents?.["*"]).toBeTruthy();
|
||||
expect(callGatewayFromCli).not.toHaveBeenCalledWith(
|
||||
"exec.approvals.set",
|
||||
expect.anything(),
|
||||
{},
|
||||
);
|
||||
expect(saveExecApprovals).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
agents: expect.objectContaining({
|
||||
"*": expect.anything(),
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ import { formatDocsLink } from "../terminal/links.js";
|
||||
import { isRich, theme } from "../terminal/theme.js";
|
||||
import { renderTable } from "../terminal/table.js";
|
||||
import { callGatewayFromCli } from "./gateway-rpc.js";
|
||||
import { describeUnknownError } from "./gateway-cli/shared.js";
|
||||
import { nodesCallOpts, resolveNodeId } from "./nodes-cli/rpc.js";
|
||||
import type { NodesRpcOpts } from "./nodes-cli/types.js";
|
||||
|
||||
@@ -96,7 +97,7 @@ async function loadSnapshotTarget(opts: ExecApprovalsCliOpts): Promise<{
|
||||
}
|
||||
|
||||
function formatCliError(err: unknown): string {
|
||||
const msg = String(err ?? "unknown error");
|
||||
const msg = describeUnknownError(err);
|
||||
return msg.includes("\n") ? msg.split("\n")[0] : msg;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user