chore: minor nits

This commit is contained in:
Jack Wotherspoon
2026-03-14 21:29:43 +01:00
parent 6a4f022a4f
commit e1febb6849
5 changed files with 8 additions and 19 deletions
@@ -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<string, string> {
const toolDisplayNames = new Map<string, string>();
const toolRegistry = config.getToolRegistry();
@@ -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<string, string>;
@@ -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
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2025 Google LLC
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
+1 -8
View File
@@ -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,
};