mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
refactor(permission-system): simplify policy and autoreview flow
This commit is contained in:
@@ -47,16 +47,6 @@ describe("normalizeInput — non-MCP surfaces", () => {
|
||||
expect(result.resultExtras).toEqual({});
|
||||
});
|
||||
|
||||
it("external_directory surface ignores input.path and returns ['*']", () => {
|
||||
const result = normalizeInput(
|
||||
"external_directory",
|
||||
{ path: "/other/project" },
|
||||
[],
|
||||
);
|
||||
expect(result.surface).toBe("external_directory");
|
||||
expect(result.values).toEqual(["*"]);
|
||||
expect(result.resultExtras).toEqual({});
|
||||
});
|
||||
|
||||
it("read surface ignores input.path and returns ['*']", () => {
|
||||
const result = normalizeInput("read", { path: ".env" }, []);
|
||||
@@ -68,7 +58,6 @@ describe("normalizeInput — non-MCP surfaces", () => {
|
||||
it("missing path also returns ['*'] (unchanged fallback)", () => {
|
||||
for (const surface of [
|
||||
"path",
|
||||
"external_directory",
|
||||
"read",
|
||||
"write",
|
||||
"edit",
|
||||
@@ -249,19 +238,6 @@ describe("buildAccessIntentForSurface", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("emits an access-path intent for the external_directory surface", () => {
|
||||
const intent = buildAccessIntentForSurface(
|
||||
"external_directory",
|
||||
"/outside/dir",
|
||||
normalizer,
|
||||
undefined,
|
||||
);
|
||||
expect(intent.kind).toBe("access-path");
|
||||
if (intent.kind === "access-path") {
|
||||
expect(intent.surface).toBe("external_directory");
|
||||
expect(intent.path.value()).toBe("/outside/dir");
|
||||
}
|
||||
});
|
||||
|
||||
it("emits an access-path intent for a path-bearing tool surface (read)", () => {
|
||||
const intent = buildAccessIntentForSurface(
|
||||
@@ -315,15 +291,6 @@ describe("buildAccessIntentForSurface", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("falls back to a tool intent for a whitespace-only path value", () => {
|
||||
const intent = buildAccessIntentForSurface(
|
||||
"external_directory",
|
||||
" ",
|
||||
normalizer,
|
||||
undefined,
|
||||
);
|
||||
expect(intent.kind).toBe("tool");
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildResolvedIntentFromMatchValues", () => {
|
||||
@@ -348,19 +315,6 @@ describe("buildResolvedIntentFromMatchValues", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("emits a path-values intent for the external_directory surface", () => {
|
||||
const intent = buildResolvedIntentFromMatchValues(
|
||||
"external_directory",
|
||||
["/tmp/x", "/real/tmp/x"],
|
||||
"Explore",
|
||||
);
|
||||
expect(intent).toEqual({
|
||||
kind: "path-values",
|
||||
surface: "external_directory",
|
||||
values: ["/tmp/x", "/real/tmp/x"],
|
||||
agentName: "Explore",
|
||||
});
|
||||
});
|
||||
|
||||
it("emits a tool intent from the single portable value for a non-path surface (bash)", () => {
|
||||
const intent = buildResolvedIntentFromMatchValues(
|
||||
|
||||
Reference in New Issue
Block a user