feat(plan): support configuring custom plans storage directory (#19577)

This commit is contained in:
Jerop Kipruto
2026-02-19 17:47:08 -05:00
committed by GitHub
parent 2cba2ab37a
commit 537e56ffae
24 changed files with 337 additions and 58 deletions

View File

@@ -21,7 +21,11 @@ import {
type MCPServerConfig,
} from '@google/gemini-cli-core';
import { loadCliConfig, parseArguments, type CliArgs } from './config.js';
import { type Settings, createTestMergedSettings } from './settings.js';
import {
type Settings,
type MergedSettings,
createTestMergedSettings,
} from './settings.js';
import * as ServerConfig from '@google/gemini-cli-core';
import { isWorkspaceTrusted } from './trustedFolders.js';
@@ -2599,6 +2603,21 @@ describe('loadCliConfig approval mode', () => {
expect(config.getApprovalMode()).toBe(ApprovalMode.DEFAULT);
});
it('should pass planSettings.directory from settings to config', async () => {
process.argv = ['node', 'script.js'];
const settings = createTestMergedSettings({
general: {
plan: {
directory: '.custom-plans',
},
},
} as unknown as MergedSettings);
const argv = await parseArguments(settings);
const config = await loadCliConfig(settings, 'test-session', argv);
const plansDir = config.storage.getPlansDir();
expect(plansDir).toContain('.custom-plans');
});
// --- Untrusted Folder Scenarios ---
describe('when folder is NOT trusted', () => {
beforeEach(() => {

View File

@@ -814,6 +814,7 @@ export async function loadCliConfig(
enableExtensionReloading: settings.experimental?.extensionReloading,
enableAgents: settings.experimental?.enableAgents,
plan: settings.experimental?.plan,
planSettings: settings.general.plan,
enableEventDrivenScheduler: true,
skillsSupport: settings.skills?.enabled ?? true,
disabledSkills: settings.skills?.disabled,

View File

@@ -107,6 +107,16 @@ describe('SettingsSchema', () => {
).toBe('boolean');
});
it('should have plan nested properties', () => {
expect(
getSettingsSchema().general?.properties?.plan?.properties?.directory,
).toBeDefined();
expect(
getSettingsSchema().general?.properties?.plan?.properties?.directory
.type,
).toBe('string');
});
it('should have fileFiltering nested properties', () => {
expect(
getSettingsSchema().context.properties.fileFiltering.properties

View File

@@ -266,6 +266,27 @@ const SETTINGS_SCHEMA = {
},
},
},
plan: {
type: 'object',
label: 'Plan',
category: 'General',
requiresRestart: true,
default: {},
description: 'Planning features configuration.',
showInDialog: false,
properties: {
directory: {
type: 'string',
label: 'Plan Directory',
category: 'General',
requiresRestart: true,
default: undefined as string | undefined,
description:
'The directory where planning artifacts are stored. If not specified, defaults to the system temporary directory.',
showInDialog: true,
},
},
},
enablePromptCompletion: {
type: 'boolean',
label: 'Enable Prompt Completion',
@@ -1313,6 +1334,7 @@ const SETTINGS_SCHEMA = {
},
},
},
useWriteTodos: {
type: 'boolean',
label: 'Use WriteTodos',