Skip to content

Commit a4b1fb9

Browse files
committed
refactor(cli): rename auto-accept flag to camelCase
Rename AUTO_ACCEPT_WORKSPACE_POLICIES to autoAcceptWorkspacePolicies in policy.ts and update corresponding tests. This aligns with naming conventions for variables that are intended to be modified (e.g., during tests). - Rename variable and update setter in policy.ts. - Update references in policy.test.ts and workspace-policy-cli.test.ts.
1 parent 9469c5d commit a4b1fb9

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

packages/cli/src/config/policy.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as path from 'node:path';
1010
import * as os from 'node:os';
1111
import {
1212
resolveWorkspacePolicyState,
13-
AUTO_ACCEPT_WORKSPACE_POLICIES,
13+
autoAcceptWorkspacePolicies,
1414
setAutoAcceptWorkspacePolicies,
1515
} from './policy.js';
1616
import { writeToStderr } from '@google/gemini-cli-core';
@@ -106,7 +106,7 @@ describe('resolveWorkspacePolicyState', () => {
106106
});
107107

108108
it('should return confirmation request if changed in interactive mode when AUTO_ACCEPT is false', async () => {
109-
const originalValue = AUTO_ACCEPT_WORKSPACE_POLICIES;
109+
const originalValue = autoAcceptWorkspacePolicies;
110110
setAutoAcceptWorkspacePolicies(false);
111111

112112
try {
@@ -149,7 +149,7 @@ describe('resolveWorkspacePolicyState', () => {
149149
});
150150

151151
it('should warn and auto-accept if changed in non-interactive mode when AUTO_ACCEPT is false', async () => {
152-
const originalValue = AUTO_ACCEPT_WORKSPACE_POLICIES;
152+
const originalValue = autoAcceptWorkspacePolicies;
153153
setAutoAcceptWorkspacePolicies(false);
154154

155155
try {

packages/cli/src/config/policy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ import { type Settings } from './settings.js';
2525
* Temporary flag to automatically accept workspace policies to reduce friction.
2626
* Exported as 'let' to allow monkey patching in tests via the setter.
2727
*/
28-
export let AUTO_ACCEPT_WORKSPACE_POLICIES = true;
28+
export let autoAcceptWorkspacePolicies = true;
2929

3030
/**
31-
* Sets the AUTO_ACCEPT_WORKSPACE_POLICIES flag.
31+
* Sets the autoAcceptWorkspacePolicies flag.
3232
* Used primarily for testing purposes.
3333
*/
3434
export function setAutoAcceptWorkspacePolicies(value: boolean) {
35-
AUTO_ACCEPT_WORKSPACE_POLICIES = value;
35+
autoAcceptWorkspacePolicies = value;
3636
}
3737

3838
export async function createPolicyEngineConfig(
@@ -106,7 +106,7 @@ export async function resolveWorkspacePolicyState(options: {
106106
) {
107107
// No workspace policies found
108108
workspacePoliciesDir = undefined;
109-
} else if (interactive && !AUTO_ACCEPT_WORKSPACE_POLICIES) {
109+
} else if (interactive && !autoAcceptWorkspacePolicies) {
110110
// Policies changed or are new, and we are in interactive mode and auto-accept is disabled
111111
policyUpdateConfirmationRequest = {
112112
scope: 'workspace',

packages/cli/src/config/workspace-policy-cli.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ describe('Workspace-Level Policy CLI Integration', () => {
240240
});
241241

242242
it('should set policyUpdateConfirmationRequest if integrity MISMATCH in interactive mode when AUTO_ACCEPT is false', async () => {
243-
// Monkey patch AUTO_ACCEPT_WORKSPACE_POLICIES using setter
244-
const originalValue = Policy.AUTO_ACCEPT_WORKSPACE_POLICIES;
243+
// Monkey patch autoAcceptWorkspacePolicies using setter
244+
const originalValue = Policy.autoAcceptWorkspacePolicies;
245245
Policy.setAutoAcceptWorkspacePolicies(false);
246246

247247
try {

0 commit comments

Comments
 (0)