chore: generate

This commit is contained in:
GitHub Action
2026-01-28 12:05:24 +00:00
parent 4d2c130138
commit e33d789369
2 changed files with 17 additions and 20 deletions
+6 -9
View File
@@ -91,7 +91,8 @@ export const RunCommand = cmd({
type: "string",
describe: "model variant (provider-specific reasoning effort, e.g., high, max, minimal)",
})
.option("auto", { // kilocode_change
.option("auto", {
// kilocode_change
type: "boolean",
describe: "auto-approve all permissions (for autonomous/pipeline usage)",
})
@@ -213,7 +214,7 @@ export const RunCommand = cmd({
if (event.type === "permission.asked") {
const permission = event.properties
if (permission.sessionID !== sessionID) continue
// kilocode_change start - In auto mode, automatically approve all permissions without prompting
if (args.auto) {
await sdk.permission.respond({
@@ -224,7 +225,7 @@ export const RunCommand = cmd({
continue
}
// kilocode_change end
const result = await select({
message: `Permission required: ${permission.permission} (${permission.patterns.join(", ")})`,
options: [
@@ -315,7 +316,7 @@ export const RunCommand = cmd({
pattern: "*",
},
]
// kilocode_change start - In auto mode, allow all permissions by default except questions
// The question deny rule must come AFTER the wildcard to override it (findLast behavior)
const permissions = args.auto
@@ -415,11 +416,7 @@ export const RunCommand = cmd({
: undefined
const result = await sdk.session.create(
title
? { title, permission: permissions }
: permissions
? { permission: permissions }
: {},
title ? { title, permission: permissions } : permissions ? { permission: permissions } : {},
)
// kilocode_change end
return result.data?.id
+11 -11
View File
@@ -6,7 +6,7 @@ describe("Auto mode flag", () => {
// When --auto flag is set, the session should be created with:
// 1. Wildcard allow rule for all permissions
// 2. Explicit deny rule for questions (to prevent user interaction)
const autoPermissions = [
{
permission: "*",
@@ -19,14 +19,14 @@ describe("Auto mode flag", () => {
pattern: "*",
},
]
expect(autoPermissions).toHaveLength(2)
// First rule: allow all
expect(autoPermissions[0].permission).toBe("*")
expect(autoPermissions[0].action).toBe("allow")
expect(autoPermissions[0].pattern).toBe("*")
// Second rule: deny questions (comes after wildcard to override it)
expect(autoPermissions[1].permission).toBe("question")
expect(autoPermissions[1].action).toBe("deny")
@@ -36,19 +36,19 @@ describe("Auto mode flag", () => {
test("non-auto mode should not set allow-all permissions", () => {
// When --auto flag is NOT set, permissions should be undefined or default
const normalPermissions = undefined
expect(normalPermissions).toBeUndefined()
})
test("permission evaluation order matters (findLast behavior)", () => {
// The permission system uses findLast, so the last matching rule wins
// This test verifies that the question deny rule comes AFTER the wildcard
const autoPermissions = [
{ permission: "*", action: "allow" as const, pattern: "*" },
{ permission: "question", action: "deny" as const, pattern: "*" },
]
// Simulate findLast behavior
const findLastMatch = (permission: string) => {
for (let i = autoPermissions.length - 1; i >= 0; i--) {
@@ -58,18 +58,18 @@ describe("Auto mode flag", () => {
}
return null
}
// Test that "question" permission resolves to "deny"
const questionRule = findLastMatch("question")
expect(questionRule?.action).toBe("deny")
// Test that other permissions resolve to "allow"
const bashRule = findLastMatch("bash")
expect(bashRule?.action).toBe("allow")
const editRule = findLastMatch("edit")
expect(editRule?.action).toBe("allow")
const externalDirRule = findLastMatch("external_directory")
expect(externalDirRule?.action).toBe("allow")
})