feat: add codebase context capabilities to gemini-cli (#1163)
* feat: add support for claude code context - code context for: - add-task - update-subtask - update-task - update * feat: fix CI and format + refactor * chore: format * chore: fix test * feat: add gemini-cli support for codebase context * feat: add google cli integration and fix tests * chore: apply requested coderabbit changes * chore: bump gemini cli package
This commit is contained in:
@@ -428,16 +428,19 @@ function getResearchProvider(explicitRoot = null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Claude Code is being used as the provider
|
||||
* Check if a codebase analysis provider is being used (Claude Code or Gemini CLI)
|
||||
* @param {boolean} useResearch - Whether to check research provider or main provider
|
||||
* @param {string|null} projectRoot - Project root path (optional)
|
||||
* @returns {boolean} True if Claude Code is the current provider
|
||||
* @returns {boolean} True if a codebase analysis provider is the current provider
|
||||
*/
|
||||
function isClaudeCode(useResearch = false, projectRoot = null) {
|
||||
function hasCodebaseAnalysis(useResearch = false, projectRoot = null) {
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
return currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
return (
|
||||
currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE ||
|
||||
currentProvider === CUSTOM_PROVIDERS.GEMINI_CLI
|
||||
);
|
||||
}
|
||||
|
||||
function getResearchModelId(explicitRoot = null) {
|
||||
@@ -996,7 +999,7 @@ export {
|
||||
getResearchModelId,
|
||||
getResearchMaxTokens,
|
||||
getResearchTemperature,
|
||||
isClaudeCode,
|
||||
hasCodebaseAnalysis,
|
||||
getFallbackProvider,
|
||||
getFallbackModelId,
|
||||
getFallbackMaxTokens,
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
markMigrationForNotice
|
||||
} from '../utils.js';
|
||||
import { generateObjectService } from '../ai-services-unified.js';
|
||||
import { getDefaultPriority, isClaudeCode } from '../config-manager.js';
|
||||
import { getDefaultPriority, hasCodebaseAnalysis } from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import ContextGatherer from '../utils/contextGatherer.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
@@ -426,7 +426,7 @@ async function addTask(
|
||||
useResearch,
|
||||
priority: effectivePriority,
|
||||
dependencies: numericDependencies,
|
||||
isClaudeCode: isClaudeCode(useResearch, projectRoot),
|
||||
hasCodebaseAnalysis: hasCodebaseAnalysis(useResearch, projectRoot),
|
||||
projectRoot: projectRoot
|
||||
}
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import boxen from 'boxen';
|
||||
import readline from 'readline';
|
||||
import fs from 'fs';
|
||||
|
||||
import { log, readJSON, writeJSON, isSilentMode } from '../utils.js';
|
||||
import { log, readJSON, isSilentMode } from '../utils.js';
|
||||
|
||||
import {
|
||||
startLoadingIndicator,
|
||||
@@ -16,9 +16,7 @@ import { generateTextService } from '../ai-services-unified.js';
|
||||
import {
|
||||
getDebugFlag,
|
||||
getProjectName,
|
||||
getMainProvider,
|
||||
getResearchProvider,
|
||||
isClaudeCode
|
||||
hasCodebaseAnalysis
|
||||
} from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import {
|
||||
@@ -421,7 +419,7 @@ async function analyzeTaskComplexity(options, context = {}) {
|
||||
tasks: tasksData.tasks,
|
||||
gatheredContext: gatheredContext || '',
|
||||
useResearch: useResearch,
|
||||
isClaudeCode: isClaudeCode(useResearch, projectRoot),
|
||||
hasCodebaseAnalysis: hasCodebaseAnalysis(useResearch, projectRoot),
|
||||
projectRoot: projectRoot || ''
|
||||
};
|
||||
|
||||
|
||||
@@ -21,13 +21,11 @@ import { generateTextService } from '../ai-services-unified.js';
|
||||
import {
|
||||
getDefaultSubtasks,
|
||||
getDebugFlag,
|
||||
getMainProvider,
|
||||
getResearchProvider
|
||||
hasCodebaseAnalysis
|
||||
} from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
import { COMPLEXITY_REPORT_FILE } from '../../../src/constants/paths.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||
import { FuzzyTaskSearch } from '../utils/fuzzyTaskSearch.js';
|
||||
import { flattenTasksWithSubtasks, findProjectRoot } from '../utils.js';
|
||||
@@ -457,11 +455,11 @@ async function expandTask(
|
||||
// Load prompts using PromptManager
|
||||
const promptManager = getPromptManager();
|
||||
|
||||
// Check if Claude Code is being used as the provider
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
const isClaudeCode = currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
// Check if a codebase analysis provider is being used
|
||||
const hasCodebaseAnalysisCapability = hasCodebaseAnalysis(
|
||||
useResearch,
|
||||
projectRoot
|
||||
);
|
||||
|
||||
// Combine all context sources into a single additionalContext parameter
|
||||
let combinedAdditionalContext = '';
|
||||
@@ -508,7 +506,7 @@ async function expandTask(
|
||||
gatheredContext: gatheredContextText || '',
|
||||
useResearch: useResearch,
|
||||
expansionPrompt: expansionPromptText || undefined,
|
||||
isClaudeCode: isClaudeCode,
|
||||
hasCodebaseAnalysis: hasCodebaseAnalysisCapability,
|
||||
projectRoot: projectRoot || ''
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ import { z } from 'zod';
|
||||
import { TASK_PRIORITY_OPTIONS } from '../../../../src/constants/task-priority.js';
|
||||
import { getCurrentTag, isSilentMode, log } from '../../utils.js';
|
||||
import { Duration } from '../../../../src/utils/timeout-manager.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../../src/constants/providers.js';
|
||||
import { getMainProvider, getResearchProvider } from '../../config-manager.js';
|
||||
import { hasCodebaseAnalysis } from '../../config-manager.js';
|
||||
|
||||
// ============================================================================
|
||||
// SCHEMAS
|
||||
@@ -75,13 +74,10 @@ export class PrdParseConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Claude Code is being used
|
||||
* Check if codebase analysis is available (Claude Code or Gemini CLI)
|
||||
*/
|
||||
isClaudeCode() {
|
||||
const currentProvider = this.research
|
||||
? getResearchProvider(this.projectRoot)
|
||||
: getMainProvider(this.projectRoot);
|
||||
return currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
hasCodebaseAnalysis() {
|
||||
return hasCodebaseAnalysis(this.research, this.projectRoot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import path from 'path';
|
||||
import boxen from 'boxen';
|
||||
import chalk from 'chalk';
|
||||
import { ensureTagMetadata, findTaskById } from '../../utils.js';
|
||||
import { getPriorityIndicators } from '../../../../src/ui/indicators.js';
|
||||
import { displayParsePrdSummary } from '../../../../src/ui/parse-prd.js';
|
||||
import { TimeoutManager } from '../../../../src/utils/timeout-manager.js';
|
||||
import { displayAiUsageSummary } from '../../ui.js';
|
||||
@@ -242,7 +241,7 @@ export async function buildPrompts(config, prdContent, nextId) {
|
||||
prdContent,
|
||||
prdPath: config.prdPath,
|
||||
defaultTaskPriority,
|
||||
isClaudeCode: config.isClaudeCode(),
|
||||
hasCodebaseAnalysis: config.hasCodebaseAnalysis(),
|
||||
projectRoot: config.projectRoot || ''
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
flattenTasksWithSubtasks
|
||||
} from '../utils.js';
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
import { getDebugFlag, isClaudeCode } from '../config-manager.js';
|
||||
import { getDebugFlag, hasCodebaseAnalysis } from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||
@@ -232,7 +232,7 @@ async function updateSubtaskById(
|
||||
updatePrompt: prompt,
|
||||
useResearch: useResearch,
|
||||
gatheredContext: gatheredContext || '',
|
||||
isClaudeCode: isClaudeCode(useResearch, projectRoot),
|
||||
hasCodebaseAnalysis: hasCodebaseAnalysis(useResearch, projectRoot),
|
||||
projectRoot: projectRoot
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,11 @@ import {
|
||||
} from '../ui.js';
|
||||
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
import { getDebugFlag, isApiKeySet, isClaudeCode } from '../config-manager.js';
|
||||
import {
|
||||
getDebugFlag,
|
||||
isApiKeySet,
|
||||
hasCodebaseAnalysis
|
||||
} from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||
import { FuzzyTaskSearch } from '../utils/fuzzyTaskSearch.js';
|
||||
@@ -454,7 +458,7 @@ async function updateTaskById(
|
||||
useResearch: useResearch,
|
||||
currentDetails: taskToUpdate.details || '(No existing details)',
|
||||
gatheredContext: gatheredContext || '',
|
||||
isClaudeCode: isClaudeCode(useResearch, projectRoot),
|
||||
hasCodebaseAnalysis: hasCodebaseAnalysis(useResearch, projectRoot),
|
||||
projectRoot: projectRoot
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
displayAiUsageSummary
|
||||
} from '../ui.js';
|
||||
|
||||
import { getDebugFlag, isClaudeCode } from '../config-manager.js';
|
||||
import { getDebugFlag, hasCodebaseAnalysis } from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
@@ -436,7 +436,7 @@ async function updateTasks(
|
||||
updatePrompt: prompt,
|
||||
useResearch,
|
||||
projectContext: gatheredContext,
|
||||
isClaudeCode: isClaudeCode(useResearch, projectRoot),
|
||||
hasCodebaseAnalysis: hasCodebaseAnalysis(useResearch, projectRoot),
|
||||
projectRoot: projectRoot
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user