mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-17 05:20:23 -07:00
feat(core): Add tracker CRUD tools & visualization (#19489)
Co-authored-by: Jerop Kipruto <jerop@google.com>
This commit is contained in:
@@ -70,6 +70,14 @@ import {
|
||||
StandardFileSystemService,
|
||||
type FileSystemService,
|
||||
} from '../services/fileSystemService.js';
|
||||
import {
|
||||
TrackerCreateTaskTool,
|
||||
TrackerUpdateTaskTool,
|
||||
TrackerGetTaskTool,
|
||||
TrackerListTasksTool,
|
||||
TrackerAddDependencyTool,
|
||||
TrackerVisualizeTool,
|
||||
} from '../tools/trackerTools.js';
|
||||
import {
|
||||
logRipgrepFallback,
|
||||
logFlashFallback,
|
||||
@@ -96,6 +104,7 @@ import {
|
||||
} from '../services/modelConfigService.js';
|
||||
import { DEFAULT_MODEL_CONFIGS } from './defaultModelConfigs.js';
|
||||
import { ContextManager } from '../services/contextManager.js';
|
||||
import { TrackerService } from '../services/trackerService.js';
|
||||
import type { GenerateContentParameters } from '@google/genai';
|
||||
|
||||
// Re-export OAuth config type
|
||||
@@ -572,6 +581,7 @@ export interface ConfigParameters {
|
||||
toolOutputMasking?: Partial<ToolOutputMaskingConfig>;
|
||||
disableLLMCorrection?: boolean;
|
||||
plan?: boolean;
|
||||
tracker?: boolean;
|
||||
planSettings?: PlanSettings;
|
||||
modelSteering?: boolean;
|
||||
onModelChange?: (model: string) => void;
|
||||
@@ -605,6 +615,7 @@ export class Config implements McpContext {
|
||||
private sessionId: string;
|
||||
private clientVersion: string;
|
||||
private fileSystemService: FileSystemService;
|
||||
private trackerService?: TrackerService;
|
||||
private contentGeneratorConfig!: ContentGeneratorConfig;
|
||||
private contentGenerator!: ContentGenerator;
|
||||
readonly modelConfigService: ModelConfigService;
|
||||
@@ -783,6 +794,7 @@ export class Config implements McpContext {
|
||||
private readonly experimentalJitContext: boolean;
|
||||
private readonly disableLLMCorrection: boolean;
|
||||
private readonly planEnabled: boolean;
|
||||
private readonly trackerEnabled: boolean;
|
||||
private readonly planModeRoutingEnabled: boolean;
|
||||
private readonly modelSteering: boolean;
|
||||
private contextManager?: ContextManager;
|
||||
@@ -873,6 +885,7 @@ export class Config implements McpContext {
|
||||
this.agents = params.agents ?? {};
|
||||
this.disableLLMCorrection = params.disableLLMCorrection ?? true;
|
||||
this.planEnabled = params.plan ?? false;
|
||||
this.trackerEnabled = params.tracker ?? false;
|
||||
this.planModeRoutingEnabled = params.planSettings?.modelRouting ?? true;
|
||||
this.enableEventDrivenScheduler = params.enableEventDrivenScheduler ?? true;
|
||||
this.skillsSupport = params.skillsSupport ?? true;
|
||||
@@ -2193,6 +2206,15 @@ export class Config implements McpContext {
|
||||
return this.bugCommand;
|
||||
}
|
||||
|
||||
getTrackerService(): TrackerService {
|
||||
if (!this.trackerService) {
|
||||
this.trackerService = new TrackerService(
|
||||
this.storage.getProjectTempTrackerDir(),
|
||||
);
|
||||
}
|
||||
return this.trackerService;
|
||||
}
|
||||
|
||||
getFileService(): FileDiscoveryService {
|
||||
if (!this.fileDiscoveryService) {
|
||||
this.fileDiscoveryService = new FileDiscoveryService(this.targetDir, {
|
||||
@@ -2260,6 +2282,10 @@ export class Config implements McpContext {
|
||||
return this.planEnabled;
|
||||
}
|
||||
|
||||
isTrackerEnabled(): boolean {
|
||||
return this.trackerEnabled;
|
||||
}
|
||||
|
||||
getApprovedPlanPath(): string | undefined {
|
||||
return this.approvedPlanPath;
|
||||
}
|
||||
@@ -2825,6 +2851,29 @@ export class Config implements McpContext {
|
||||
);
|
||||
}
|
||||
|
||||
if (this.isTrackerEnabled()) {
|
||||
maybeRegister(TrackerCreateTaskTool, () =>
|
||||
registry.registerTool(new TrackerCreateTaskTool(this, this.messageBus)),
|
||||
);
|
||||
maybeRegister(TrackerUpdateTaskTool, () =>
|
||||
registry.registerTool(new TrackerUpdateTaskTool(this, this.messageBus)),
|
||||
);
|
||||
maybeRegister(TrackerGetTaskTool, () =>
|
||||
registry.registerTool(new TrackerGetTaskTool(this, this.messageBus)),
|
||||
);
|
||||
maybeRegister(TrackerListTasksTool, () =>
|
||||
registry.registerTool(new TrackerListTasksTool(this, this.messageBus)),
|
||||
);
|
||||
maybeRegister(TrackerAddDependencyTool, () =>
|
||||
registry.registerTool(
|
||||
new TrackerAddDependencyTool(this, this.messageBus),
|
||||
),
|
||||
);
|
||||
maybeRegister(TrackerVisualizeTool, () =>
|
||||
registry.registerTool(new TrackerVisualizeTool(this, this.messageBus)),
|
||||
);
|
||||
}
|
||||
|
||||
// Register Subagents as Tools
|
||||
this.registerSubAgentTools(registry);
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { Config } from './config.js';
|
||||
import { TRACKER_CREATE_TASK_TOOL_NAME } from '../tools/tool-names.js';
|
||||
import * as os from 'node:os';
|
||||
|
||||
describe('Config Tracker Feature Flag', () => {
|
||||
const baseParams = {
|
||||
sessionId: 'test-session',
|
||||
targetDir: os.tmpdir(),
|
||||
cwd: os.tmpdir(),
|
||||
model: 'gemini-1.5-pro',
|
||||
debugMode: false,
|
||||
};
|
||||
|
||||
it('should not register tracker tools by default', async () => {
|
||||
const config = new Config(baseParams);
|
||||
await config.initialize();
|
||||
const registry = config.getToolRegistry();
|
||||
expect(registry.getTool(TRACKER_CREATE_TASK_TOOL_NAME)).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should register tracker tools when tracker is enabled', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
tracker: true,
|
||||
});
|
||||
await config.initialize();
|
||||
const registry = config.getToolRegistry();
|
||||
expect(registry.getTool(TRACKER_CREATE_TASK_TOOL_NAME)).toBeDefined();
|
||||
});
|
||||
|
||||
it('should not register tracker tools when tracker is explicitly disabled', async () => {
|
||||
const config = new Config({
|
||||
...baseParams,
|
||||
tracker: false,
|
||||
});
|
||||
await config.initialize();
|
||||
const registry = config.getToolRegistry();
|
||||
expect(registry.getTool(TRACKER_CREATE_TASK_TOOL_NAME)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user