feat: add support for claude code context
- code context for: - add-task - update-subtask - update-task - update
This commit is contained in:
@@ -25,7 +25,8 @@ import {
|
||||
markMigrationForNotice
|
||||
} from '../utils.js';
|
||||
import { generateObjectService } from '../ai-services-unified.js';
|
||||
import { getDefaultPriority } from '../config-manager.js';
|
||||
import { getDefaultPriority, getMainProvider, getResearchProvider } from '../config-manager.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import ContextGatherer from '../utils/contextGatherer.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
@@ -109,6 +110,16 @@ async function addTask(
|
||||
context;
|
||||
const isMCP = !!mcpLog;
|
||||
|
||||
/**
|
||||
* Check if Claude Code is being used
|
||||
*/
|
||||
const isClaudeCode = () => {
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
return currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
};
|
||||
|
||||
// Create a consistent logFn object regardless of context
|
||||
const logFn = isMCP
|
||||
? mcpLog // Use MCP logger if provided
|
||||
@@ -425,7 +436,9 @@ async function addTask(
|
||||
contextFromArgs,
|
||||
useResearch,
|
||||
priority: effectivePriority,
|
||||
dependencies: numericDependencies
|
||||
dependencies: numericDependencies,
|
||||
isClaudeCode: isClaudeCode(),
|
||||
projectRoot: projectRoot
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ import {
|
||||
flattenTasksWithSubtasks
|
||||
} from '../utils.js';
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
import { getDebugFlag } from '../config-manager.js';
|
||||
import { getDebugFlag, getMainProvider, getResearchProvider } from '../config-manager.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||
@@ -52,6 +53,17 @@ async function updateSubtaskById(
|
||||
const logFn = mcpLog || consoleLog;
|
||||
const isMCP = !!mcpLog;
|
||||
|
||||
/**
|
||||
* Check if Claude Code is being used
|
||||
*/
|
||||
const isClaudeCode = () => {
|
||||
const projectRoot = providedProjectRoot || findProjectRoot();
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
return currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
};
|
||||
|
||||
// Report helper
|
||||
const report = (level, ...args) => {
|
||||
if (isMCP) {
|
||||
@@ -231,7 +243,9 @@ async function updateSubtaskById(
|
||||
currentDetails: subtask.details || '(No existing details)',
|
||||
updatePrompt: prompt,
|
||||
useResearch: useResearch,
|
||||
gatheredContext: gatheredContext || ''
|
||||
gatheredContext: gatheredContext || '',
|
||||
isClaudeCode: isClaudeCode(),
|
||||
projectRoot: projectRoot
|
||||
};
|
||||
|
||||
const variantKey = useResearch ? 'research' : 'default';
|
||||
|
||||
@@ -23,7 +23,8 @@ import {
|
||||
} from '../ui.js';
|
||||
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
import { getDebugFlag, isApiKeySet } from '../config-manager.js';
|
||||
import { getDebugFlag, isApiKeySet, getMainProvider, getResearchProvider } from '../config-manager.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||
import { FuzzyTaskSearch } from '../utils/fuzzyTaskSearch.js';
|
||||
@@ -279,6 +280,17 @@ async function updateTaskById(
|
||||
const logFn = mcpLog || consoleLog;
|
||||
const isMCP = !!mcpLog;
|
||||
|
||||
/**
|
||||
* Check if Claude Code is being used
|
||||
*/
|
||||
const isClaudeCode = () => {
|
||||
const projectRoot = providedProjectRoot || findProjectRoot();
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
return currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
};
|
||||
|
||||
// Use report helper for logging
|
||||
const report = (level, ...args) => {
|
||||
if (isMCP) {
|
||||
@@ -453,7 +465,9 @@ async function updateTaskById(
|
||||
appendMode: appendMode,
|
||||
useResearch: useResearch,
|
||||
currentDetails: taskToUpdate.details || '(No existing details)',
|
||||
gatheredContext: gatheredContext || ''
|
||||
gatheredContext: gatheredContext || '',
|
||||
isClaudeCode: isClaudeCode(),
|
||||
projectRoot: projectRoot
|
||||
};
|
||||
|
||||
const variantKey = appendMode
|
||||
|
||||
@@ -19,7 +19,8 @@ import {
|
||||
displayAiUsageSummary
|
||||
} from '../ui.js';
|
||||
|
||||
import { getDebugFlag } from '../config-manager.js';
|
||||
import { getDebugFlag, getMainProvider, getResearchProvider } from '../config-manager.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
@@ -300,6 +301,17 @@ async function updateTasks(
|
||||
// Flag to easily check which logger type we have
|
||||
const isMCP = !!mcpLog;
|
||||
|
||||
/**
|
||||
* Check if Claude Code is being used
|
||||
*/
|
||||
const isClaudeCode = () => {
|
||||
const projectRoot = providedProjectRoot || findProjectRoot();
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
return currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
};
|
||||
|
||||
if (isMCP)
|
||||
logFn.info(`updateTasks called with context: session=${!!session}`);
|
||||
else logFn('info', `updateTasks called`); // CLI log
|
||||
@@ -435,7 +447,9 @@ async function updateTasks(
|
||||
tasks: tasksToUpdate,
|
||||
updatePrompt: prompt,
|
||||
useResearch,
|
||||
projectContext: gatheredContext
|
||||
projectContext: gatheredContext,
|
||||
isClaudeCode: isClaudeCode(),
|
||||
projectRoot: projectRoot
|
||||
}
|
||||
);
|
||||
// --- End Build Prompts ---
|
||||
|
||||
Reference in New Issue
Block a user