diff --git a/packages/cli/src/ui/commands/policiesCommand.ts b/packages/cli/src/ui/commands/policiesCommand.ts index 8a24dd11c9..55f1644730 100644 --- a/packages/cli/src/ui/commands/policiesCommand.ts +++ b/packages/cli/src/ui/commands/policiesCommand.ts @@ -5,18 +5,14 @@ */ import React from 'react'; -import type { PolicyRule } from '@google/gemini-cli-core'; +import type { Config, PolicyRule } from '@google/gemini-cli-core'; import { CommandKind, type SlashCommand } from './types.js'; import { MessageType } from '../types.js'; import { PoliciesDialog } from '../components/PoliciesDialog.js'; function buildToolDisplayNames( rules: readonly PolicyRule[], - config: { - getToolRegistry: () => { - getTool: (name: string) => { displayName: string } | undefined; - }; - }, + config: Config, ): Map { const toolDisplayNames = new Map(); const toolRegistry = config.getToolRegistry(); diff --git a/packages/cli/src/ui/components/PoliciesDialog.tsx b/packages/cli/src/ui/components/PoliciesDialog.tsx index a02320e01f..3fad7e7295 100644 --- a/packages/cli/src/ui/components/PoliciesDialog.tsx +++ b/packages/cli/src/ui/components/PoliciesDialog.tsx @@ -1,6 +1,6 @@ /** * @license - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ @@ -23,6 +23,8 @@ import { import { useUIState } from '../contexts/UIStateContext.js'; import { isNarrowWidth } from '../utils/isNarrowWidth.js'; +const ITEM_HEIGHT = 2; + interface PoliciesDialogProps { rules: readonly PolicyRule[]; toolDisplayNames: Map; @@ -98,7 +100,6 @@ export function PoliciesDialog({ if (showDesc) staticHeight += 1; if (showHelp) staticHeight += 1; - const ITEM_HEIGHT = 2; const availableForItems = dialogAvailableHeight - staticHeight; const maxItems = Math.max(1, Math.floor(availableForItems / ITEM_HEIGHT)); @@ -215,7 +216,6 @@ export function PoliciesDialog({ // Fixed height for the list area to prevent layout jumpiness in alternate // buffer mode. Each item is ITEM_HEIGHT lines, plus 2 for scroll arrows. - const ITEM_HEIGHT = 2; const listAreaHeight = effectiveMaxItemsToShow * ITEM_HEIGHT + 2; // Keyboard handling diff --git a/packages/cli/src/ui/utils/policyUtils.test.ts b/packages/cli/src/ui/utils/policyUtils.test.ts index 9ec927c734..f3077ca5b9 100644 --- a/packages/cli/src/ui/utils/policyUtils.test.ts +++ b/packages/cli/src/ui/utils/policyUtils.test.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ diff --git a/packages/cli/src/ui/utils/policyUtils.ts b/packages/cli/src/ui/utils/policyUtils.ts index 85319dbaeb..a1447a83f3 100644 --- a/packages/cli/src/ui/utils/policyUtils.ts +++ b/packages/cli/src/ui/utils/policyUtils.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ @@ -14,14 +14,10 @@ export interface PolicyListItem { key: string; /** The original policy rule */ rule: PolicyRule; - /** Uppercased decision string */ - decision: string; /** Resolved display name (e.g. "Shell") or fallback to internal name */ toolDisplayName: string; /** Formatted constraint string for parenthetical display, or undefined */ constraint: string | undefined; - /** Formatted priority string */ - priority: string; /** rule.source ?? '' */ source: string; /** Concatenated searchable fields */ @@ -46,7 +42,6 @@ export function buildPolicyListItems( ? (toolDisplayNames.get(rule.toolName) ?? rule.toolName) : 'all tools'; const constraint = rule.constraintDisplay; - const priority = String(rule.priority ?? 0); const source = rule.source ?? ''; const searchText = [toolDisplayName, rule.toolName, constraint, source] @@ -56,10 +51,8 @@ export function buildPolicyListItems( return { key: `policy-${index}`, rule, - decision: rule.decision.toUpperCase(), toolDisplayName, constraint, - priority, source, searchText, }; diff --git a/packages/core/src/policy/utils.ts b/packages/core/src/policy/utils.ts index 9885a3f171..968fccf9a4 100644 --- a/packages/core/src/policy/utils.ts +++ b/packages/core/src/policy/utils.ts @@ -44,7 +44,7 @@ export function isSafeRegExp(pattern: string): boolean { export interface ArgsPatternResult { pattern: string | undefined; - display?: string; + display: string | undefined; } /**