Skip to content

feat: add codebase context capabilities to gemini-cli#1163

Merged
Crunchyman-ralph merged 8 commits into
nextfrom
feat/add.gemini.cli.support
Aug 28, 2025
Merged

feat: add codebase context capabilities to gemini-cli#1163
Crunchyman-ralph merged 8 commits into
nextfrom
feat/add.gemini.cli.support

Conversation

@Crunchyman-ralph

@Crunchyman-ralph Crunchyman-ralph commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • 🐛 Bug fix
  • ✨ Feature
  • 🔌 Integration
  • 📝 Docs
  • 🧹 Refactor
  • Other:

Description

Related Issues

How to Test This

# Example commands or steps

Expected result:

Contributor Checklist

  • Created changeset: npm run changeset
  • Tests pass: npm test
  • Format check passes: npm run format-check (or npm run format to fix)
  • Addressed CodeRabbit comments (if any)
  • Linked related issues (if any)
  • Manually tested the changes

Changelog Entry


For Maintainers

  • PR title follows conventional commits
  • Target branch correct
  • Labels added
  • Milestone assigned (if applicable)

Summary by CodeRabbit

  • New Features

    • Task/subtask generation and complexity analysis now use codebase-aware AI (Gemini CLI + Claude Code) with optional project-root context for richer, more accurate outputs.
  • Refactor

    • Provider handling unified into a single "codebase analysis" capability; prompt payloads now include a generic codebase-analysis flag.
  • Documentation

    • Prompt parameter descriptions and conditionals updated to reference codebase analysis.
  • Tests

    • Unit tests updated to mock the new codebase-analysis flag.
  • Chores

    • Added changeset and bumped Gemini CLI provider dependency.

@changeset-bot

changeset-bot Bot commented Aug 28, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 06b5a47

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Replaces provider-specific isClaudeCode checks with a generalized hasCodebaseAnalysis capability across config, task-manager modules, prompts, and tests; updates prompt parameters and payloads to include hasCodebaseAnalysis and projectRoot; adds a changeset documenting Gemini CLI codebase-aware task generation.

Changes

Cohort / File(s) Summary
Changeset
.changeset/curvy-moons-dig.md
Adds a minor-release changeset for task-master-ai describing Gemini CLI codebase-aware task generation.
Config manager API
scripts/modules/config-manager.js
Replaces provider-specific exports (isClaudeCode, getMainProvider, getResearchProvider) with hasCodebaseAnalysis(useResearch, projectRoot); updates JSDoc/comments and exported symbol set.
Task manager — core ops
scripts/modules/task-manager/add-task.js, .../expand-task.js, .../update-task-by-id.js, .../update-subtask-by-id.js, .../update-tasks.js, .../analyze-task-complexity.js
Replace imports/usages of isClaudeCode with hasCodebaseAnalysis; prompt payloads now include hasCodebaseAnalysis (and projectRoot where applicable); remove provider-specific gating logic in expand-task.
PRD parsing
scripts/modules/task-manager/parse-prd/parse-prd-config.js, .../parse-prd-helpers.js
Rename class method isClaudeCode()hasCodebaseAnalysis() and use centralized hasCodebaseAnalysis(this.research, this.projectRoot); helpers pass hasCodebaseAnalysis to prompts and drop local provider resolution.
Prompt templates
src/prompts/*.json (add-task, expand-task, parse-prd, update-subtask, update-task, update-tasks, analyze-complexity)
Rename parameter isClaudeCodehasCodebaseAnalysis (boolean, default false); update descriptions to reference codebase analysis availability (Claude Code or Gemini CLI); replace Mustache conditionals {{#if isClaudeCode}}{{#if hasCodebaseAnalysis}}.
Tests (mocks/updates)
tests/unit/** (add-task.test.js, analyze-task-complexity.test.js, expand-task.test.js, parse-prd.test.js, update-*.test.js, complexity-report-tag-isolation.test.js, etc.)
Update config-manager mocks/imports to provide hasCodebaseAnalysis: jest.fn(() => false) in place of isClaudeCode; adjust imports and minor formatting in tests.
Package dependency
package.json
Bumps optional dependency ai-sdk-provider-gemini-cli from ^0.1.1 to ^0.1.3.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as CLI Command
  participant TM as Task Manager
  participant CFG as Config Manager
  participant PR as Prompt Renderer
  participant AI as AI Provider

  User->>CLI: run command (add/expand/update/analyze)
  CLI->>TM: invoke operation (useResearch, projectRoot, ...)
  TM->>CFG: hasCodebaseAnalysis(useResearch, projectRoot)
  CFG-->>TM: boolean hasCodebaseAnalysis
  TM->>PR: loadPrompt(..., { hasCodebaseAnalysis, projectRoot, ... })
  PR-->>TM: rendered prompt
  TM->>AI: submit prompt
  AI-->>TM: response
  TM-->>CLI: present results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • eyaltoledano

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3552f94 and 06b5a47.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
package.json

📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)

Add and update test scripts in package.json to include test, test:watch, test:coverage, test:unit, test:integration, test:e2e, and test:ci

Files:

  • package.json
🧠 Learnings (1)
📚 Learning: 2025-08-07T13:00:22.966Z
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#1090
File: apps/extension/package.json:241-243
Timestamp: 2025-08-07T13:00:22.966Z
Learning: In monorepos, local packages should use "*" as the version constraint in package.json dependencies, as recommended by npm. This ensures the local version from within the same workspace is always used, rather than attempting to resolve from external registries. This applies to packages like task-master-ai within the eyaltoledano/claude-task-master monorepo.

Applied to files:

  • package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (2)
package.json (2)

91-91: Version bump LGTM.

Optional dependency ai-sdk-provider-gemini-cli upgraded to ^0.1.3 aligns with the PR’s Gemini CLI/codebase-analysis direction.


88-92: No action needed—ai-sdk-provider-gemini-cli is already loaded lazily under a guarded import()

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add.gemini.cli.support

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Crunchyman-ralph Crunchyman-ralph force-pushed the feat/add.gemini.cli.support branch from e45e0fc to 9f8cb08 Compare August 28, 2025 16:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (9)
scripts/modules/config-manager.js (1)

717-731: Add early return in getMcpApiKeyStatus for providers without API keys (includes gemini-cli).

Guidelines require an immediate-true check here, mirroring isApiKeySet. Without it, gemini-cli reports false.

Apply this diff:

 function getMcpApiKeyStatus(providerName, projectRoot = null) {
+	// Providers that do not require API keys (short-circuit true)
+	const providerKey = providerName?.toLowerCase();
+	if (
+		providerKey === 'gemini-cli' ||
+		providerKey === 'ollama' ||
+		providerKey === 'claude-code' ||
+		providerKey === 'bedrock' ||
+		providerKey === 'mcp'
+	) {
+		return true;
+	}
 	const rootDir = projectRoot || findProjectRoot(); // Use existing root finding
src/prompts/parse-prd.json (2)

44-49: Rename parameter to hasCodebaseAnalysis for consistency across prompts.

Aligns prompt API with code changes and other templates.

Apply this diff:

-		"isClaudeCode": {
+		"hasCodebaseAnalysis": {
 			"type": "boolean",
 			"required": false,
 			"default": false,
-			"description": "Whether codebase analysis is available (Claude Code or Gemini CLI)"
+			"description": "Whether codebase analysis is available (Claude Code or Gemini CLI)"
 		},

58-61: Update gating in user prompt to use hasCodebaseAnalysis.

Ensures the codebase analysis block renders when Gemini CLI/Claude Code is active.

Apply this diff:

-			"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required
+			"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required
scripts/modules/task-manager/parse-prd/parse-prd-helpers.js (2)

15-16: Import hasCodebaseAnalysis from config-manager.

You’re calling a method on config; use the exported getter to avoid coupling and to pass research/root explicitly.

Apply this diff:

-import { getDefaultPriority } from '../../config-manager.js';
+import { getDefaultPriority, hasCodebaseAnalysis } from '../../config-manager.js';

238-247: Pass research/root and rename payload key to hasCodebaseAnalysis.

Using default args may mis-detect provider when research role is active; also align key with prompt rename.

Apply this diff:

 	return promptManager.loadPrompt('parse-prd', {
 		research: config.research,
 		numTasks: config.numTasks,
 		nextId,
 		prdContent,
 		prdPath: config.prdPath,
 		defaultTaskPriority,
-		isClaudeCode: config.hasCodebaseAnalysis(),
+		hasCodebaseAnalysis: hasCodebaseAnalysis(!!config.research, config.projectRoot),
 		projectRoot: config.projectRoot || ''
 	});
scripts/modules/task-manager/update-tasks.js (1)

433-441: Remove all remaining isClaudeCode references and related conditional logic

  • Delete “isClaudeCode” schema entries and conditionals in JSON prompts:
    • src/prompts/update-tasks.json (lines 47–49)
    • src/prompts/parse-prd.json (lines 44–46)
    • src/prompts/update-task.json (lines 47–49)
    • src/prompts/expand-task.json (lines 55–57)
    • src/prompts/analyze-complexity.json (lines 34–36)
  • Remove code usages of isClaudeCode in analyze-task-complexity.js (lines 421–426) and deprecate the isClaudeCode helper in config-manager.js
  • Ensure prompt templates no longer include “## IMPORTANT: Codebase Analysis Required” blocks conditioned on isClaudeCode
scripts/modules/task-manager/update-task-by-id.js (1)

306-316: Move API-key-driven fallback out of core logic.
Per guidelines, avoid API key resolution and fallback logic here; delegate to ai-services-unified. This prevents drift and keeps policy centralized.

Apply:

-    if (useResearch && !isApiKeySet('perplexity', session)) {
-      report(
-        'warn',
-        'Perplexity research requested but API key not set. Falling back.'
-      );
-      if (outputFormat === 'text')
-        console.log(
-          chalk.yellow('Perplexity AI not available. Falling back to main AI.')
-        );
-      useResearch = false;
-    }
+    // Let ai-services-unified decide availability/fallback based on session/env.
scripts/modules/task-manager/add-task.js (1)

445-456: Consider switching to generateTextService + manual JSON parsing for robustness.
Guidelines note reliability issues with generateObjectService for some providers/schemas.

Minimal sketch:

- aiServiceResponse = await generateObjectService({
-   role: serviceRole,
-   session, projectRoot,
-   schema: AiTaskDataSchema,
-   objectName: 'newTaskData',
-   systemPrompt, prompt: userPrompt,
-   commandName: commandName || 'add-task',
-   outputType: outputType || (isMCP ? 'mcp' : 'cli')
- });
- const main = aiServiceResponse.mainResult;
- taskData = main.object ?? main;
+ aiServiceResponse = await generateTextService({
+   role: serviceRole,
+   session, projectRoot,
+   systemPrompt, prompt: userPrompt,
+   commandName: commandName || 'add-task',
+   outputType: outputType || (isMCP ? 'mcp' : 'cli')
+ });
+ const parsed = AiTaskDataSchema.safeParse(JSON.parse(aiServiceResponse.mainResult));
+ if (!parsed.success) throw new Error(parsed.error.message);
+ taskData = parsed.data;
scripts/modules/task-manager/expand-task.js (1)

461-471: Remove unused combinedAdditionalContext block.

It’s computed but never used. Drop to reduce noise.

-    // Combine all context sources into a single additionalContext parameter
-    let combinedAdditionalContext = '';
-    if (additionalContext || complexityReasoningContext) {
-      combinedAdditionalContext =
-        `\n\n${additionalContext}${complexityReasoningContext}`.trim();
-    }
-    if (gatheredContext) {
-      combinedAdditionalContext =
-        `${combinedAdditionalContext}\n\n# Project Context\n\n${gatheredContext}`.trim();
-    }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4dad2fd and 9f8cb08.

📒 Files selected for processing (15)
  • .changeset/curvy-moons-dig.md (1 hunks)
  • scripts/modules/config-manager.js (2 hunks)
  • scripts/modules/task-manager/add-task.js (2 hunks)
  • scripts/modules/task-manager/expand-task.js (3 hunks)
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js (2 hunks)
  • scripts/modules/task-manager/parse-prd/parse-prd-helpers.js (1 hunks)
  • scripts/modules/task-manager/update-subtask-by-id.js (2 hunks)
  • scripts/modules/task-manager/update-task-by-id.js (2 hunks)
  • scripts/modules/task-manager/update-tasks.js (2 hunks)
  • src/prompts/add-task.json (2 hunks)
  • src/prompts/expand-task.json (2 hunks)
  • src/prompts/parse-prd.json (1 hunks)
  • src/prompts/update-subtask.json (2 hunks)
  • src/prompts/update-task.json (2 hunks)
  • src/prompts/update-tasks.json (2 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
scripts/modules/**

📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)

When using the MCP server, restart it if core logic in scripts/modules or MCP tool/direct function definitions change.

Files:

  • scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
  • scripts/modules/config-manager.js
  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
scripts/modules/task-manager/**/*.js

📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)

scripts/modules/task-manager/**/*.js: Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.
Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
If the core logic function handles CLI output (outputFormat === 'text' or 'cli'), and aiServiceResponse.telemetryData is available, it must call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js.

Do not call AI-specific getters (like getMainModelId, getMainMaxTokens) from core logic functions in scripts/modules/task-manager/*; instead, pass the role to the unified AI service.

Files:

  • scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
**/*.js

📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)

**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.

Files:

  • scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
  • scripts/modules/config-manager.js
  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
.changeset/*.md

📄 CodeRabbit inference engine (.cursor/rules/changeset.mdc)

.changeset/*.md: When running npm run changeset or npx changeset add, provide a concise summary of the changes for the CHANGELOG.md in imperative mood, typically a single line, and not a detailed Git commit message.
The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.
Do not use your detailed Git commit message body as the changeset summary.

Files:

  • .changeset/curvy-moons-dig.md
.changeset/*

📄 CodeRabbit inference engine (.cursor/rules/new_features.mdc)

Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.

Files:

  • .changeset/curvy-moons-dig.md
scripts/modules/config-manager.js

📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)

scripts/modules/config-manager.js: Update scripts/modules/config-manager.js to add the new provider to MODEL_MAP, ensure it is included in VALID_PROVIDERS, and update API key handling logic.
If adding Ollama or another provider not requiring an API key, add a specific check at the beginning of isApiKeySet and getMcpApiKeyStatus in scripts/modules/config-manager.js to return true immediately for that provider.

scripts/modules/config-manager.js: Import and use specific getters from scripts/modules/config-manager.js to access configuration values needed for application logic; pass the explicitRoot parameter to getters if calling from MCP direct functions.
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before attempting an AI call.
Handle potential ConfigurationError if the .taskmasterconfig file is missing or invalid when accessed via getConfig.

Files:

  • scripts/modules/config-manager.js
scripts/modules/*.js

📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)

Each module in scripts/modules/ should be focused on a single responsibility, following the modular architecture (e.g., commands.js for CLI command handling, task-manager.js for task data and core logic, dependency-manager.js for dependency management, ui.js for CLI output formatting, ai-services-unified.js for AI service integration, config-manager.js for configuration management, utils.js for utility functions).

scripts/modules/*.js: Export all core functions, helper functions, and utility methods needed by your new function or command from their respective modules. Explicitly review the module's export block to ensure every required dependency is included.
Pass all required parameters to functions you call within your implementation and verify that direct function parameters match their core function counterparts.
Use consistent file naming conventions: 'task_${id.toString().padStart(3, '0')}.txt', use path.join for composing file paths, and use appropriate file extensions (.txt for tasks, .json for data).
Use structured error objects with code and message properties, include clear error messages, and handle both function-specific and file system errors.
Import all silent mode utilities together from 'scripts/modules/utils.js' and always use isSilentMode() to check global silent mode status. Wrap core function calls within direct functions using enableSilentMode() and disableSilentMode() in a try/finally block if the core function might produce console output.
Core functions should check outputFormat === 'text' before displaying UI elements and use internal logging that respects silent mode.
Design functions to accept dependencies as parameters (dependency injection) and avoid hard-coded dependencies that are difficult to mock.
Keep pure logic separate from I/O operations or UI rendering to allow testing the logic without mocking complex dependencies.
When implementing core logic for new features, do so in 'scripts/modules/' before CLI or MCP interfaces, and d...

Files:

  • scripts/modules/config-manager.js
scripts/modules/*

📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)

scripts/modules/*: Every command that reads or writes tasks.json must be tag-aware
All command files must import getCurrentTag from utils.js
Every CLI command that operates on tasks must include the --tag CLI option
All commands must resolve the tag using the pattern: options.tag || getCurrentTag(projectRoot) || 'master'
All commands must find projectRoot with error handling before proceeding
All commands must pass { projectRoot, tag } as context to core functions
MCP direct functions must accept and use a context object containing projectRoot and tag, and pass them to core functions
Do not hard-code tag resolution (e.g., const tag = options.tag || 'master';); always use getCurrentTag
Do not omit the --tag CLI option in commands that operate on tasks
Do not omit the context parameter when calling core functions from commands
Do not call readJSON or writeJSON without passing projectRoot and tag

Files:

  • scripts/modules/config-manager.js
scripts/modules/task-manager/*.js

📄 CodeRabbit inference engine (.cursor/rules/ai_services.mdc)

scripts/modules/task-manager/*.js: Centralize all LLM calls through generateTextService or generateObjectService.
Do not import or call anything from the old ai-services.js, ai-client-factory.js, or ai-client-utils.js files.
Do not initialize AI clients (Anthropic, Perplexity, etc.) directly within core logic (task-manager/) or MCP direct functions.
Do not fetch AI-specific parameters (model ID, max tokens, temp) using config-manager.js getters for the AI call. Pass the role instead.
Do not implement fallback or retry logic outside ai-services-unified.js.
Do not handle API key resolution outside the service layer (it uses utils.js internally).
Determine the appropriate role (main, research, fallback) in your core logic and pass it to the service.
Pass the session object (received in the context parameter, especially from direct function wrappers) to the service call when in MCP context.
Use generateTextService and implement robust manual JSON parsing (with Zod validation after parsing) when structured output is needed, as generateObjectService has shown unreliability with some providers/schemas.
Be aware of potential reliability issues with generateObjectService across different providers and complex schemas. Prefer generateTextService + manual parsing as a more robust alternative for structured data needs.

Files in scripts/modules/task-manager/ should each handle a specific action related to task management (e.g., add-task.js, expand-task.js), supporting the tagged task lists system and backward compatibility.

Files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
scripts/modules/task-manager/*

📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)

scripts/modules/task-manager/*: All core functions in scripts/modules/task-manager/ must accept a context parameter and use it to extract projectRoot and tag
All core functions in scripts/modules/task-manager/ must use readJSON(tasksPath, projectRoot, tag) and writeJSON(tasksPath, data, projectRoot, tag)

Files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
🧠 Learnings (36)
📚 Learning: 2025-07-20T01:35:05.831Z
Learnt from: rtmcrc
PR: eyaltoledano/claude-task-master#933
File: scripts/modules/task-manager/parse-prd.js:226-226
Timestamp: 2025-07-20T01:35:05.831Z
Learning: The parsePRD function in scripts/modules/task-manager/parse-prd.js has a different parameter structure than other task-manager functions - it uses `options` parameter instead of `context` parameter because it generates tasks from PRD documents rather than operating on existing tasks.

Applied to files:

  • scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI, create them in the current tag context (defaulting to 'master'), provide clear prompts to guide AI task generation, and validate/clean up AI-generated tasks.

Applied to files:

  • scripts/modules/task-manager/parse-prd/parse-prd-helpers.js
  • scripts/modules/task-manager/update-tasks.js
  • src/prompts/update-tasks.json
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:07:53.100Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/changeset.mdc:0-0
Timestamp: 2025-07-18T17:07:53.100Z
Learning: Applies to .changeset/*.md : The changeset summary should be user-facing, describing what changed in the released version that is relevant to users or consumers of the package.

Applied to files:

  • .changeset/curvy-moons-dig.md
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to .changeset/* : Create appropriate changesets for new features, use semantic versioning, include tagged system information in release notes, and document breaking changes if any.

Applied to files:

  • .changeset/curvy-moons-dig.md
📚 Learning: 2025-07-18T17:19:27.365Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: Use `task-master add-task` to add a new task to tasks.json using AI.

Applied to files:

  • .changeset/curvy-moons-dig.md
  • scripts/modules/task-manager/add-task.js
📚 Learning: 2025-08-03T12:13:33.875Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/test_workflow.mdc:0-0
Timestamp: 2025-08-03T12:13:33.875Z
Learning: Document testing setup and progress in TaskMaster subtasks using task-master update-subtask commands

Applied to files:

  • .changeset/curvy-moons-dig.md
📚 Learning: 2025-07-18T17:10:53.657Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/glossary.mdc:0-0
Timestamp: 2025-07-18T17:10:53.657Z
Learning: Guidelines for implementing and maintaining tests for Task Master CLI (tests.mdc).

Applied to files:

  • .changeset/curvy-moons-dig.md
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: For CLI usage, install Taskmaster globally with `npm install -g task-master-ai` or use locally via `npx task-master-ai ...`.

Applied to files:

  • .changeset/curvy-moons-dig.md
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to scripts/modules/config-manager.js : Update scripts/modules/config-manager.js to add the new provider to MODEL_MAP, ensure it is included in VALID_PROVIDERS, and update API key handling logic.

Applied to files:

  • scripts/modules/config-manager.js
📚 Learning: 2025-07-18T17:19:27.365Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: When implementation differs significantly from planned approach, call `node scripts/dev.js update --from=<futureTaskId> --prompt="<explanation>"` to update tasks.json.

Applied to files:

  • src/prompts/update-task.json
  • scripts/modules/task-manager/update-tasks.js
  • src/prompts/update-tasks.json
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use consistent formatting for task files, include all task properties in text files, and format dependencies with status indicators.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not import or call anything from the old `ai-services.js`, `ai-client-factory.js`, or `ai-client-utils.js` files.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:12:57.903Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-07-18T17:12:57.903Z
Learning: Applies to scripts/modules/*.js : Ensure new features work with existing projects seamlessly, supporting both legacy and tagged task data formats, and support silent migration during feature usage.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
📚 Learning: 2025-07-18T17:14:54.131Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-07-18T17:14:54.131Z
Learning: Applies to scripts/modules/task-manager/**/*.js : If the core logic function handles CLI output (outputFormat === 'text' or 'cli'), and aiServiceResponse.telemetryData is available, it must call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
📚 Learning: 2025-07-18T17:14:54.131Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-07-18T17:14:54.131Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not implement fallback or retry logic outside `ai-services-unified.js`.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/task-manager/**/*.js : Do not call AI-specific getters (like `getMainModelId`, `getMainMaxTokens`) from core logic functions in `scripts/modules/task-manager/*`; instead, pass the `role` to the unified AI service.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
📚 Learning: 2025-07-31T22:07:49.716Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/commands.mdc:0-0
Timestamp: 2025-07-31T22:07:49.716Z
Learning: Applies to scripts/modules/commands.js : For AI-powered commands that benefit from project context, use the ContextGatherer utility for multi-source context extraction, support task IDs, file paths, custom context, and project tree, implement fuzzy search for automatic task discovery, and display detailed token breakdown for transparency.

Applied to files:

  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Centralize all LLM calls through `generateTextService` or `generateObjectService`.

Applied to files:

  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:06:04.909Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-07-18T17:06:04.909Z
Learning: Applies to src/ai-providers/*.js : Provider modules must import the provider's create<ProviderName> function from ai-sdk/<provider-name>, and import generateText, streamText, generateObject from the core ai package, as well as the log utility from ../../scripts/modules/utils.js.

Applied to files:

  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils/contextGatherer.js : Use `ContextGatherer` in `scripts/modules/utils/contextGatherer.js` for AI-powered commands that need project context, supporting tasks, files, custom text, project tree context, token counting, and multiple output formats.

Applied to files:

  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/ai-services-unified.js : Do not import or call anything from the old `ai-services.js`, `ai-client-factory.js`, or `ai-client-utils.js` files.

Applied to files:

  • scripts/modules/task-manager/update-task-by-id.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use AI to generate detailed subtasks within the current tag context, considering complexity analysis for subtask counts and ensuring proper IDs for newly created subtasks.

Applied to files:

  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • src/prompts/expand-task.json
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Do not fetch AI-specific parameters (model ID, max tokens, temp) using `config-manager.js` getters for the AI call. Pass the `role` instead.

Applied to files:

  • scripts/modules/task-manager/add-task.js
📚 Learning: 2025-07-18T17:09:13.815Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/context_gathering.mdc:0-0
Timestamp: 2025-07-18T17:09:13.815Z
Learning: Commands such as `analyze-complexity`, `expand-task`, `update-task`, and `add-task` should consider adopting the context gathering pattern for improved AI-powered assistance.

Applied to files:

  • scripts/modules/task-manager/add-task.js
  • scripts/modules/task-manager/expand-task.js
📚 Learning: 2025-07-18T17:07:39.336Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-07-18T17:07:39.336Z
Learning: Applies to scripts/modules/task-manager/*.js : Files in scripts/modules/task-manager/ should each handle a specific action related to task management (e.g., add-task.js, expand-task.js), supporting the tagged task lists system and backward compatibility.

Applied to files:

  • scripts/modules/task-manager/add-task.js
📚 Learning: 2025-07-18T17:06:57.833Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-07-18T17:06:57.833Z
Learning: Applies to scripts/modules/task-manager/*.js : Be aware of potential reliability issues with `generateObjectService` across different providers and complex schemas. Prefer `generateTextService` + manual parsing as a more robust alternative for structured data needs.

Applied to files:

  • scripts/modules/task-manager/add-task.js
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Implement complete migration for all related files in the tagged task system, handle configuration and state file creation, and provide migration status tracking.

Applied to files:

  • scripts/modules/task-manager/add-task.js
📚 Learning: 2025-07-18T17:09:13.815Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/context_gathering.mdc:0-0
Timestamp: 2025-07-18T17:09:13.815Z
Learning: Applies to scripts/modules/utils/contextGatherer.js : Gracefully handle missing files with warnings, validate task IDs, continue processing even if some context sources fail, and provide fallback behavior when context gathering fails.

Applied to files:

  • scripts/modules/task-manager/add-task.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Each task object must include all required properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) and provide default values for optional properties. Extra properties not in the standard schema must not be added.

Applied to files:

  • src/prompts/add-task.json
📚 Learning: 2025-07-18T17:18:17.759Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-07-18T17:18:17.759Z
Learning: Applies to scripts/modules/utils.js : Implement reusable task finding utilities that support both task and subtask lookups and add context to subtask results.

Applied to files:

  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:09:13.815Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/context_gathering.mdc:0-0
Timestamp: 2025-07-18T17:09:13.815Z
Learning: Applies to scripts/modules/utils/contextGatherer.js : Set reasonable file size limits (50KB default) and limit project tree depth (3-5 levels) when gathering context for AI-powered commands.

Applied to files:

  • scripts/modules/task-manager/expand-task.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Provide functions for updating task status within the current tag context, handling both individual tasks and subtasks, and considering subtask status when updating parent tasks.

Applied to files:

  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Generate task files from the current tag context, include tag information in generated files, and do not mix tasks from different tags in file generation.

Applied to files:

  • scripts/modules/task-manager/update-subtask-by-id.js
📚 Learning: 2025-07-18T17:10:02.683Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:02.683Z
Learning: When breaking down complex tasks in Taskmaster, use the `expand_task` command with appropriate flags (`--num`, `--research`, `--force`, `--prompt`) and review generated subtasks for accuracy.

Applied to files:

  • src/prompts/expand-task.json
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: When breaking down complex tasks, use the `expand_task` command with appropriate flags (`--force`, `--research`, `--num`, `--prompt`) and review generated subtasks for accuracy.

Applied to files:

  • src/prompts/expand-task.json
🧬 Code graph analysis (3)
scripts/modules/config-manager.js (4)
scripts/modules/task-manager/analyze-task-complexity.js (2)
  • useResearch (97-97)
  • projectRoot (98-98)
mcp-server/src/core/direct-functions/expand-all-tasks.js (1)
  • useResearch (54-54)
scripts/modules/task-manager/research.js (1)
  • projectRoot (76-76)
src/constants/providers.js (2)
  • CUSTOM_PROVIDERS (18-27)
  • CUSTOM_PROVIDERS (18-27)
scripts/modules/task-manager/update-tasks.js (2)
scripts/modules/task-manager/analyze-task-complexity.js (2)
  • useResearch (97-97)
  • projectRoot (98-98)
scripts/modules/task-manager/expand-task.js (1)
  • projectRoot (322-322)
scripts/modules/task-manager/update-subtask-by-id.js (3)
scripts/modules/task-manager/analyze-task-complexity.js (2)
  • useResearch (97-97)
  • projectRoot (98-98)
mcp-server/src/core/direct-functions/update-subtask-by-id.js (1)
  • useResearch (94-94)
scripts/modules/task-manager/update-task-by-id.js (1)
  • projectRoot (322-322)
🪛 markdownlint-cli2 (0.17.2)
.changeset/curvy-moons-dig.md

5-5: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🪛 GitHub Actions: CI
scripts/modules/config-manager.js

[error] 440-443: Step 'npm run format-check' failed: Formatting differences detected in config-manager.js (lines 440-443). Run 'biome format .' to fix.

scripts/modules/task-manager/parse-prd/parse-prd-config.js

[error] 10-14: Step 'npm run format-check' failed: Formatting differences detected in scripts/modules/task-manager/parse-prd/parse-prd-config.js (lines 10-14). Run 'biome format .' to fix.

scripts/modules/task-manager/expand-task.js

[error] 459-462: Step 'npm run format-check' failed: Formatting differences detected in scripts/modules/task-manager/expand-task.js (lines 459-462). Run 'biome format .' to fix.

🔇 Additional comments (23)
.changeset/curvy-moons-dig.md (1)

1-6: Ignore MD041 for changeset frontmatter files.

markdownlint MD041 is a false positive for Changeset files that start with frontmatter.

scripts/modules/task-manager/update-tasks.js (2)

22-22: LGTM: imports reflect the new capability API.

Switch to hasCodebaseAnalysis is correct and scoped to config-manager.


439-441: LGTM: correct capability flag passed with role/root context.

Passing useResearch and projectRoot satisfies provider-agnostic gating.

scripts/modules/task-manager/update-task-by-id.js (1)

461-463: Approved: update-task.json correctly uses hasCodebaseAnalysis gating.

scripts/modules/task-manager/parse-prd/parse-prd-config.js (1)

78-82: API rename to hasCodebaseAnalysis is clean and centralized.
Delegation to config-manager keeps provider checks consistent.

scripts/modules/task-manager/update-subtask-by-id.js (2)

23-23: Import migration to hasCodebaseAnalysis looks good.
This matches the new capability flag usage across the codebase.


235-237: Correct gating param in prompt payload.
Passing hasCodebaseAnalysis(useResearch, projectRoot) ensures provider capabilities drive instructions.

src/prompts/add-task.json (2)

49-54: Param rename to hasCodebaseAnalysis is consistent and accurately described.
Matches the broader provider-agnostic capability.


65-65: User prompt correctly gates codebase-analysis instructions on hasCodebaseAnalysis.
Also includes projectRoot for provider tools context.

scripts/modules/task-manager/add-task.js (2)

28-29: Aligned import with new capability check.
No legacy isClaudeCode usage remains here.


429-431: Prompt payload uses hasCodebaseAnalysis and projectRoot correctly.
This enables provider-aware instructions in add-task prompt.

src/prompts/update-tasks.json (2)

31-36: Rename to hasCodebaseAnalysis is correct and provider-agnostic.

Parameter rename and description look consistent with PR intent.


47-47: Gating block updated to hasCodebaseAnalysis — good.

The conditional preface and Project Root reference align with the new capability flag.

src/prompts/update-task.json (3)

47-52: Parameter rename to hasCodebaseAnalysis is accurate.

Matches the new cross-provider capability.


63-63: Default prompt gating switched to hasCodebaseAnalysis — LGTM.


68-68: Append variant gating switched to hasCodebaseAnalysis — LGTM.

src/prompts/update-subtask.json (2)

48-53: Parameter rename to hasCodebaseAnalysis is correct.


64-64: User gating updated to hasCodebaseAnalysis — good.

src/prompts/expand-task.json (2)

55-60: Parameter rename to hasCodebaseAnalysis is consistent across prompts.


77-77: Research variant: gating updated to hasCodebaseAnalysis — LGTM.

scripts/modules/task-manager/expand-task.js (3)

24-25: Importing hasCodebaseAnalysis from config-manager is the right direction.

Aligns with unified capability detection and avoids provider-specific imports.


506-508: Passing hasCodebaseAnalysis and projectRoot into prompt params — good.

Matches prompt schema and coding guidelines (unified service + role-based call).


458-460: Confirm hasCodebaseAnalysis signature and replace any leftover isClaudeCode calls.

  • Locate the export of hasCodebaseAnalysis (e.g. in your config manager) to verify whether it’s declared async; if so, add await to its invocation in scripts/modules/task-manager/expand-task.js (around line 458).
  • Globally search for any remaining isClaudeCode( and update those calls to use hasCodebaseAnalysis where appropriate.

Comment thread .changeset/curvy-moons-dig.md Outdated
"task-master-ai": minor
---

Testing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use a user-facing, imperative changeset summary (not "Testing").

This will produce a meaningful CHANGELOG entry per guidelines.

Apply this diff:

-Testing
+Add Gemini CLI codebase analysis support and unify provider gating behind hasCodebaseAnalysis
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Testing
Add Gemini CLI codebase analysis support and unify provider gating behind hasCodebaseAnalysis
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🤖 Prompt for AI Agents
In .changeset/curvy-moons-dig.md around line 5, the changeset summary currently
reads "Testing", which is not a user-facing, imperative summary; replace that
single-word line with a concise, imperative description of the actual change
(e.g., "Add feature X" or "Fix bug Y") that clearly communicates what changed
for end users so the generated CHANGELOG entry is meaningful.

Comment thread scripts/modules/config-manager.js Outdated
Comment on lines +458 to 462
// 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 = '';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

CI is failing on formatting (Biome) at these lines.

Resolve by running: biome format . (or npm run format if available).


🏁 Script executed:

#!/bin/bash
# Fix and verify formatting
if command -v biome >/dev/null 2>&1; then
  biome format .
else
  echo "Biome not found; try: npm i -D @biomejs/biome && npx biome format ."
fi

# Show the exact region around the reported lines for local inspection
nl -ba scripts/modules/task-manager/expand-task.js | sed -n '450,470p'

Length of output: 1627


Fix invalid Biome configuration and format code

  • In biome.json, replace unsupported keys with the correct schema:
    • Under "files", change "ignore": [...] to a valid key (e.g. "experimentalScannerIgnores": [...] or update to "includes" with negation patterns).
    • Under "linter", rename "include""includes" and remove or migrate "ignore" to permitted keys.
  • Once the config is valid, run npx biome format . (or npm run format) to apply formatting to scripts/modules/task-manager/expand-task.js and resolve CI failures.
🧰 Tools
🪛 GitHub Actions: CI

[error] 459-462: Step 'npm run format-check' failed: Formatting differences detected in scripts/modules/task-manager/expand-task.js (lines 459-462). Run 'biome format .' to fix.

🤖 Prompt for AI Agents
scripts/modules/task-manager/expand-task.js lines 458-462: The CI failure is due
to an invalid Biome configuration and unformatted code; fix the Biome config by
replacing unsupported keys—under "files" change "ignore": [...] to a valid key
such as "experimentalScannerIgnores": [...] or convert to "includes" with
negated patterns, and under "linter" rename "include" → "includes" and remove or
migrate any "ignore" entries to permitted linter keys; after correcting
biome.json, run the Biome formatter (npx biome format . or npm run format) to
reformat scripts/modules/task-manager/expand-task.js and commit the updated
config and formatted file.

Comment thread scripts/modules/task-manager/parse-prd/parse-prd-config.js Outdated
Comment thread scripts/modules/task-manager/update-task-by-id.js
"default": {
"system": "You are an AI assistant helping with task breakdown for software development.\nYou need to break down a high-level task into {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks that can be implemented one by one.\n\nSubtasks should:\n1. Be specific and actionable implementation steps\n2. Follow a logical sequence\n3. Each handle a distinct part of the parent task\n4. Include clear guidance on implementation approach\n5. Have appropriate dependency chains between subtasks (using full subtask IDs)\n6. Collectively cover all aspects of the parent task\n\nFor each subtask, provide:\n- id: Sequential integer starting from the provided nextSubtaskId\n- title: Clear, specific title\n- description: Detailed description\n- dependencies: Array of prerequisite subtask IDs using full format like [\"{{task.id}}.1\", \"{{task.id}}.2\"]\n- details: Implementation details, the output should be in string\n- testStrategy: Optional testing approach\n\nRespond ONLY with a valid JSON object containing a single key \"subtasks\" whose value is an array matching the structure described. Do not include any explanatory text, markdown formatting, or code block markers.",
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Break down this task into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks:\n\nTask ID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nAdditional context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nReturn ONLY the JSON object containing the \"subtasks\" array, matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": {{nextSubtaskId}}, // First subtask ID\n \"title\": \"Specific subtask title\",\n \"description\": \"Detailed description\",\n \"dependencies\": [], // e.g., [\"{{task.id}}.1\", \"{{task.id}}.2\"] for dependencies. Use empty array [] if no dependencies\n \"details\": \"Implementation guidance\",\n \"testStrategy\": \"Optional testing approach\"\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}a total of {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs)\n ]\n}"
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Break down this task into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks:\n\nTask ID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nAdditional context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nReturn ONLY the JSON object containing the \"subtasks\" array, matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": {{nextSubtaskId}}, // First subtask ID\n \"title\": \"Specific subtask title\",\n \"description\": \"Detailed description\",\n \"dependencies\": [], // e.g., [\"{{task.id}}.1\", \"{{task.id}}.2\"] for dependencies. Use empty array [] if no dependencies\n \"details\": \"Implementation guidance\",\n \"testStrategy\": \"Optional testing approach\"\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}a total of {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs)\n ]\n}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Default variant: gating updated to hasCodebaseAnalysis — LGTM.

Optional: mirror the same codebase-analysis preface in the “complexity-report” variant for consistency.

Apply this diff to the “complexity-report” variant’s user prompt:

-      "user": "Break down the following task based on the analysis prompt:\n
+      "user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Break down the following task based on the analysis prompt:\n
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Break down this task into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks:\n\nTask ID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nAdditional context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nReturn ONLY the JSON object containing the \"subtasks\" array, matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": {{nextSubtaskId}}, // First subtask ID\n \"title\": \"Specific subtask title\",\n \"description\": \"Detailed description\",\n \"dependencies\": [], // e.g., [\"{{task.id}}.1\", \"{{task.id}}.2\"] for dependencies. Use empty array [] if no dependencies\n \"details\": \"Implementation guidance\",\n \"testStrategy\": \"Optional testing approach\"\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}a total of {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs)\n ]\n}"
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Break down the following task based on the analysis prompt:\n"
🤖 Prompt for AI Agents
In src/prompts/expand-task.json around line 81, the reviewer requests mirroring
the same codebase-analysis preface gated by hasCodebaseAnalysis into the
"complexity-report" variant; update the complexity-report user prompt to include
the identical "## IMPORTANT: Codebase Analysis Required" block (with the four
numbered steps, analysis checklist, and Project Root placeholder) gated by {{#if
hasCodebaseAnalysis}}...{{/if}} in the same relative position so both variants
show the same preface when hasCodebaseAnalysis is true.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (19)
src/prompts/analyze-complexity.json (1)

34-38: Fix parameter description to reflect both providers.

Update wording to match repo-wide rename and capability.

-        "hasCodebaseAnalysis": {
-            "type": "boolean",
-            "default": false,
-            "description": "Whether Claude Code is being used as the provider"
-        },
+        "hasCodebaseAnalysis": {
+            "type": "boolean",
+            "default": false,
+            "description": "Whether codebase analysis is available (Claude Code or Gemini CLI)"
+        },
scripts/modules/config-manager.js (1)

719-801: Add 'gemini-cli' to MCP API key status fast-path.

Providers not requiring keys should return true here as well; otherwise Gemini CLI may be reported as missing credentials.

 		switch (providerName) {
 			case 'anthropic':
 				apiKeyToCheck = mcpEnv.ANTHROPIC_API_KEY;
 				placeholderValue = 'YOUR_ANTHROPIC_API_KEY_HERE';
 				break;
+			case 'gemini-cli':
+				return true; // No key needed
 			case 'openai':
 				apiKeyToCheck = mcpEnv.OPENAI_API_KEY;
 				placeholderValue = 'YOUR_OPENAI_API_KEY_HERE'; // Assuming placeholder matches OPENAI
 				break;
tests/unit/scripts/modules/task-manager/add-task.test.js (2)

100-105: Keep mock signature consistent with implementation

Accept args to mirror hasCodebaseAnalysis(useResearch, projectRoot).

-    hasCodebaseAnalysis: jest.fn(() => false)
+    hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)

237-287: Add a branch test with hasCodebaseAnalysis = true

To cover Gemini/Claude-codebase path, toggle the mock to true and assert the context-aware behavior (e.g., contextGatherer usage, prompt enrichment).

I can draft a focused test that sets hasCodebaseAnalysis.mockReturnValueOnce(true) and verifies the additional context flow. Want me to add it?

tests/unit/parse-prd.test.js (2)

270-286: Prefer mock-fs over real filesystem writes

These tests touch the actual temp FS. Use mock-fs for isolation/speed and to align with repo guidelines.

I can replace the tempDir setup with mock-fs and ensure proper restore in afterEach—say the word.

Also applies to: 295-301


324-371: Add coverage for codebase-analysis path

Include one test run with hasCodebaseAnalysis.mockReturnValueOnce(true) to validate projectRoot propagation and any codebase-context branches in parsePRD.

Happy to supply the exact test snippet.

tests/unit/scripts/modules/task-manager/parse-prd.test.js (1)

177-193: Add coverage for hasCodebaseAnalysis=true and prompt propagation.

Great that the mock exists. Add a test asserting loadPrompt receives { hasCodebaseAnalysis: true, projectRoot } when the capability is enabled.

+test('passes hasCodebaseAnalysis true and projectRoot to prompt payload', async () => {
+  const { getPromptManager } = await import('../../../../../scripts/modules/prompt-manager.js');
+  const mockLoadPrompt = jest.fn().mockResolvedValue({ systemPrompt: 'x', userPrompt: 'y' });
+  getPromptManager.mockReturnValue({ loadPrompt: mockLoadPrompt });
+  const { hasCodebaseAnalysis } = await import('../../../../../scripts/modules/config-manager.js');
+  hasCodebaseAnalysis.mockReturnValue(true);
+  await parsePRD('path/to/prd.txt', 'tasks/tasks.json', 3, {
+    tag: 'master',
+    projectRoot: '/repo',
+    mcpLog: { info: jest.fn(), warn: jest.fn(), error: jest.fn(), debug: jest.fn(), success: jest.fn() }
+  });
+  expect(mockLoadPrompt).toHaveBeenCalledWith(
+    'parse-prd',
+    expect.objectContaining({ hasCodebaseAnalysis: true, projectRoot: '/repo' })
+  );
+});
tests/unit/scripts/modules/task-manager/expand-task.test.js (1)

121-131: Also assert prompt receives hasCodebaseAnalysis (true and false).

You mock the capability; add an assertion that expand-task passes it through to prompt params.

+test('propagates hasCodebaseAnalysis to prompt params', async () => {
+  const { getPromptManager } = await import('../../../../../scripts/modules/prompt-manager.js');
+  const mockLoadPrompt = jest.fn().mockResolvedValue({ systemPrompt: 's', userPrompt: 'u' });
+  getPromptManager.mockReturnValue({ loadPrompt: mockLoadPrompt });
+  const { hasCodebaseAnalysis } = await import('../../../../../scripts/modules/config-manager.js');
+  hasCodebaseAnalysis.mockReturnValue(true);
+  await expandTask('tasks/tasks.json', '2', 3, false, '', { projectRoot: '/mock/project/root' }, false);
+  expect(mockLoadPrompt).toHaveBeenCalledWith(
+    'expand-task',
+    expect.objectContaining({ hasCodebaseAnalysis: true, projectRoot: '/mock/project/root' }),
+    expect.any(String)
+  );
+});
scripts/modules/task-manager/analyze-task-complexity.js (5)

295-301: Stop using raw fs. for JSON; use readJSON for consistency and error handling.*
Per guidelines, prefer readJSON/writeJSON over fs.readFileSync/existsSync parsing.

Apply:

- if (fs.existsSync(outputPath)) {
-   existingReport = JSON.parse(fs.readFileSync(outputPath, 'utf8'));
+ try {
+   existingReport = readJSON(outputPath, projectRoot, tag);
+   if (existingReport) {
+     reportLog(`Found existing complexity report at ${outputPath}`, 'info');
+   }
+ } catch (_) {
+   existingReport = null;
+ }

355-360: Use writeJSON for reports; avoid fs.writeFileSync.
Keeps IO consistent, tag-aware, and centralized.

- fs.writeFileSync(
-   outputPath,
-   JSON.stringify(emptyReport, null, '\t'),
-   'utf8'
- );
+ writeJSON(outputPath, emptyReport, projectRoot, tag);
- fs.writeFileSync(outputPath, JSON.stringify(report, null, '\t'), 'utf8');
+ writeJSON(outputPath, report, projectRoot, tag);

Also applies to: 601-603


493-505: Add Zod validation for parsed analysis array.
We parse untrusted JSON; validate shape to avoid downstream surprises.

+ import { z } from 'zod';
...
- complexityAnalysis = JSON.parse(cleanedResponse);
+ const parsed = JSON.parse(cleanedResponse);
+ const AnalysisItem = z.object({
+   taskId: z.number().int().positive(),
+   taskTitle: z.string().min(1),
+   complexityScore: z.number().int().min(1).max(10),
+   recommendedSubtasks: z.number().int().min(0),
+   expansionPrompt: z.string().min(1),
+   reasoning: z.string().min(1)
+ });
+ const AnalysisArray = z.array(AnalysisItem);
+ const result = AnalysisArray.safeParse(parsed);
+ if (!result.success) {
+   throw new Error('Validation failed for complexity analysis JSON');
+ }
+ complexityAnalysis = result.data;

416-418: Nit: update stale comment referring to "Claude Code".
This module now uses capability gating.

- // Check if Claude Code is being used as the provider
+ // Check if a provider with codebase analysis capability is being used

714-714: Avoid process.exit in a module; let callers decide exit behavior.
Keeps this core function reusable in MCP/CLI/tests.

-       process.exit(1);
+       throw error;
scripts/modules/task-manager/expand-task.js (6)

464-474: Use the combinedAdditionalContext you built; it’s currently unused.
Right now, additionalContext excludes gathered/complexity context.

- let combinedAdditionalContext = '';
+ let combinedAdditionalContext = '';
  if (additionalContext || complexityReasoningContext) {
    combinedAdditionalContext =
      `\n\n${additionalContext}${complexityReasoningContext}`.trim();
  }
  if (gatheredContext) {
    combinedAdditionalContext =
      `${combinedAdditionalContext}\n\n# Project Context\n\n${gatheredContext}`.trim();
  }
...
- const promptParams = {
+ const promptParams = {
    task: task,
    subtaskCount: finalSubtaskCount,
    nextSubtaskId: nextSubtaskId,
-   additionalContext: additionalContext,
+   additionalContext: combinedAdditionalContext,
    complexityReasoningContext: complexityReasoningContext,
    gatheredContext: gatheredContextText || '',
    useResearch: useResearch,
    expansionPrompt: expansionPromptText || undefined,
    hasCodebaseAnalysis: hasCodebaseAnalysisCapability,
    projectRoot: projectRoot || ''
  };

Also applies to: 500-511


179-191: Incomplete advanced JSON extraction; consts prevent brace counting and no fallback implemented.
This path runs when simple parse fails; current code won’t repair JSON.

- const targetPattern = '{"subtasks":';
- const patternStartIndex = jsonToParse.indexOf(targetPattern);
- if (patternStartIndex !== -1) {
-   const openBraces = 0;
-   const firstBraceFound = false;
-   const extractedJsonBlock = '';
-   // ... (loop for brace counting as before) ...
- } else {
-   // ... (fallback to last '{' and '}' if targetPattern not found) ...
- }
+ const targetPattern = '{"subtasks":';
+ const patternStartIndex = jsonToParse.indexOf(targetPattern);
+ if (patternStartIndex !== -1) {
+   let openBraces = 0;
+   let started = false;
+   let buf = '';
+   for (let i = patternStartIndex; i < jsonToParse.length; i++) {
+     const ch = jsonToParse[i];
+     if (ch === '{') {
+       openBraces++;
+       started = true;
+     } else if (ch === '}') {
+       openBraces--;
+     }
+     if (started) buf += ch;
+     if (started && openBraces === 0) break;
+   }
+   if (buf && openBraces === 0) {
+     jsonToParse = buf;
+   }
+ } else {
+   // Fallback: take the longest balanced {...} block
+   const first = jsonToParse.indexOf('{');
+   const last = jsonToParse.lastIndexOf('}');
+   if (first !== -1 && last > first) {
+     jsonToParse = jsonToParse.slice(first, last + 1);
+   }
+ }

319-320: Align generateTextService.outputType to 'mcp' | 'cli' (not 'json' | 'text').
Avoids provider-conditional behavior drift between modules.

- const outputFormat = mcpLog ? 'json' : 'text';
+ const outputFormat = mcpLog ? 'json' : 'text';
+ const serviceOutputType = mcpLog ? 'mcp' : 'cli';
...
-   outputType: outputFormat
+   outputType: serviceOutputType

Also applies to: 565-566


396-423: Guard undefined complexityReportPath; compute a tag-aware default.
fs.existsSync(undefined) throws; derive path with getTagAwareFilePath.

- logger.info(
-   `Looking for complexity report at: ${complexityReportPath}${tag !== 'master' ? ` (tag-specific for '${tag}')` : ''}`
- );
+ const resolvedReportPath =
+   complexityReportPath ||
+   getTagAwareFilePath(COMPLEXITY_REPORT_FILE, projectRoot, tag);
+ logger.info(
+   `Looking for complexity report at: ${resolvedReportPath}${tag && tag !== 'master' ? ` (tag-specific for '${tag}')` : ''}`
+ );
...
- if (fs.existsSync(complexityReportPath)) {
-   const complexityReport = readJSON(complexityReportPath);
+ if (fs.existsSync(resolvedReportPath)) {
+   const complexityReport = readJSON(resolvedReportPath, projectRoot, tag);

588-593: Fix parse-error message check; current string never matches.
Ensures raw AI response is logged in debug when parsing fails.

- if (
-   error.message.includes('Failed to parse valid subtasks') &&
-   getDebugFlag(session)
- ) {
+ if (
+   (error.message.includes('Failed to parse JSON response object') ||
+     error.message.includes('subtasks')) &&
+   getDebugFlag(session)
+ ) {

402-406: Optional: pass projectRoot/tag to readJSON for consistency.

- const complexityReport = readJSON(resolvedReportPath);
+ const complexityReport = readJSON(resolvedReportPath, projectRoot, tag);
♻️ Duplicate comments (2)
.changeset/curvy-moons-dig.md (1)

5-9: Use a single-line, user-facing, imperative summary; fix typos.

Replace verbose body and “udpate-task” typo with a concise summary per guidelines.

-Enhanced Gemini CLI provider with codebase-aware task generation
-
-Added automatic codebase analysis for Gemini CLI provider in parse-prd, and analyze-complexity, add-task, udpate-task, update, update-subtask commands
-When using Gemini CLI as the AI provider, Task Master now instructs the AI to analyze the project structure, existing implementations, and patterns before generating tasks or subtasks
-Tasks and subtasks generated by Claude Code are now informed by actual codebase analysis, resulting in more accurate and contextual outputs
+Add Gemini CLI codebase analysis support and unify provider gating under hasCodebaseAnalysis (parse-prd, analyze-complexity, add-task, update-task, update-subtask, update-tasks)
scripts/modules/task-manager/expand-task.js (1)

458-462: Formatting note previously flagged by CI (Biome).
Same region as the earlier formatter failure; ensure config is fixed and file formatted.

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';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Import trimmed to the single used symbol.

Unused provider imports removed; should satisfy prior CI nit. Run formatter to clear any residual diffs.


🏁 Script executed:

#!/bin/bash
npm run format-check || npx biome format . && npm run format-check

Length of output: 4595


Fix biome.json configuration errors
The current biome.json uses unsupported keys (ignore, include): rename linter.include to linter.includes and replace top-level files.ignore with a valid key (for example experimentalScannerIgnores or adjust your includes globs). Then re-run npm run format-check.

🤖 Prompt for AI Agents
In scripts/modules/task-manager/parse-prd/parse-prd-config.js around line 9, the
project’s biome.json contains unsupported keys causing format-check failures;
update biome.json by renaming linter.include to linter.includes, remove or
replace the top-level files.ignore key with a valid key such as
experimentalScannerIgnores (or alternatively adjust your linter includes globs
to cover the files you intended to ignore), save the file, and then re-run npm
run format-check to verify the configuration passes.

Comment on lines 59 to 61
"system": "You are an AI assistant specialized in analyzing Product Requirements Documents (PRDs) and generating a structured, logically ordered, dependency-aware and sequenced list of development tasks in JSON format.{{#if research}}\nBefore breaking down the PRD into tasks, you will:\n1. Research and analyze the latest technologies, libraries, frameworks, and best practices that would be appropriate for this project\n2. Identify any potential technical challenges, security concerns, or scalability issues not explicitly mentioned in the PRD without discarding any explicit requirements or going overboard with complexity -- always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches\n3. Consider current industry standards and evolving trends relevant to this project (this step aims to solve LLM hallucinations and out of date information due to training data cutoff dates)\n4. Evaluate alternative implementation approaches and recommend the most efficient path\n5. Include specific library versions, helpful APIs, and concrete implementation guidance based on your research\n6. Always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches\n\nYour task breakdown should incorporate this research, resulting in more detailed implementation guidance, more accurate dependency mapping, and more precise technology recommendations than would be possible from the PRD text alone, while maintaining all explicit requirements and best practices and all details and nuances of the PRD.{{/if}}\n\nAnalyze the provided PRD content and generate {{#if (gt numTasks 0)}}approximately {{numTasks}}{{else}}an appropriate number of{{/if}} top-level development tasks. If the complexity or the level of detail of the PRD is high, generate more tasks relative to the complexity of the PRD\nEach task should represent a logical unit of work needed to implement the requirements and focus on the most direct and effective way to implement the requirements without unnecessary complexity or overengineering. Include pseudo-code, implementation details, and test strategy for each task. Find the most up to date information to implement each task.\nAssign sequential IDs starting from {{nextId}}. Infer title, description, details, and test strategy for each task based *only* on the PRD content.\nSet status to 'pending', dependencies to an empty array [], and priority to '{{defaultTaskPriority}}' initially for all tasks.\nRespond ONLY with a valid JSON object containing a single key \"tasks\", where the value is an array of task objects adhering to the provided Zod schema. Do not include any explanation or markdown formatting.\n\nEach task should follow this JSON structure:\n{\n\t\"id\": number,\n\t\"title\": string,\n\t\"description\": string,\n\t\"status\": \"pending\",\n\t\"dependencies\": number[] (IDs of tasks this depends on),\n\t\"priority\": \"high\" | \"medium\" | \"low\",\n\t\"details\": string (implementation details),\n\t\"testStrategy\": string (validation approach)\n}\n\nGuidelines:\n1. {{#if (gt numTasks 0)}}Unless complexity warrants otherwise{{else}}Depending on the complexity{{/if}}, create {{#if (gt numTasks 0)}}exactly {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, numbered sequentially starting from {{nextId}}\n2. Each task should be atomic and focused on a single responsibility following the most up to date best practices and standards\n3. Order tasks logically - consider dependencies and implementation sequence\n4. Early tasks should focus on setup, core functionality first, then advanced features\n5. Include clear validation/testing approach for each task\n6. Set appropriate dependency IDs (a task can only depend on tasks with lower IDs, potentially including existing tasks with IDs less than {{nextId}} if applicable)\n7. Assign priority (high/medium/low) based on criticality and dependency order\n8. Include detailed implementation guidance in the \"details\" field{{#if research}}, with specific libraries and version recommendations based on your research{{/if}}\n9. If the PRD contains specific requirements for libraries, database schemas, frameworks, tech stacks, or any other implementation details, STRICTLY ADHERE to these requirements in your task breakdown and do not discard them under any circumstance\n10. Focus on filling in any gaps left by the PRD or areas that aren't fully specified, while preserving all explicit requirements\n11. Always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches{{#if research}}\n12. For each task, include specific, actionable guidance based on current industry standards and best practices discovered through research{{/if}}",
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating tasks:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine key files like package.json, README.md, and main entry points\n4. Analyze the current state of implementation to understand what already exists\n\nBased on your analysis:\n- Identify what components/features are already implemented\n- Understand the technology stack, frameworks, and patterns in use\n- Generate tasks that build upon the existing codebase rather than duplicating work\n- Ensure tasks align with the project's current architecture and conventions\n\nProject Root: {{projectRoot}}\n\n{{/if}}Here's the Product Requirements Document (PRD) to break down into {{#if (gt numTasks 0)}}approximately {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, starting IDs from {{nextId}}:{{#if research}}\n\nRemember to thoroughly research current best practices and technologies before task breakdown to provide specific, actionable implementation details.{{/if}}\n\n{{prdContent}}\n\n\n\t\tReturn your response in this format:\n{\n \"tasks\": [\n {\n \"id\": 1,\n \"title\": \"Setup Project Repository\",\n \"description\": \"...\",\n ...\n },\n ...\n ],\n \"metadata\": {\n \"projectName\": \"PRD Implementation\",\n \"totalTasks\": {{#if (gt numTasks 0)}}{{numTasks}}{{else}}{number of tasks}{{/if}},\n \"sourceFile\": \"{{prdPath}}\",\n \"generatedAt\": \"YYYY-MM-DD\"\n }\n}"
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating tasks:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine key files like package.json, README.md, and main entry points\n4. Analyze the current state of implementation to understand what already exists\n\nBased on your analysis:\n- Identify what components/features are already implemented\n- Understand the technology stack, frameworks, and patterns in use\n- Generate tasks that build upon the existing codebase rather than duplicating work\n- Ensure tasks align with the project's current architecture and conventions\n\nProject Root: {{projectRoot}}\n\n{{/if}}Here's the Product Requirements Document (PRD) to break down into {{#if (gt numTasks 0)}}approximately {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, starting IDs from {{nextId}}:{{#if research}}\n\nRemember to thoroughly research current best practices and technologies before task breakdown to provide specific, actionable implementation details.{{/if}}\n\n{{prdContent}}\n\n\n\t\tReturn your response in this format:\n{\n \"tasks\": [\n {\n \"id\": 1,\n \"title\": \"Setup Project Repository\",\n \"description\": \"...\",\n ...\n },\n ...\n ],\n \"metadata\": {\n \"projectName\": \"PRD Implementation\",\n \"totalTasks\": {{#if (gt numTasks 0)}}{{numTasks}}{{else}}{number of tasks}{{/if}},\n \"sourceFile\": \"{{prdPath}}\",\n \"generatedAt\": \"YYYY-MM-DD\"\n }\n}"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Resolve output contract conflict between system and user messages.

System says “single key tasks”; user requires “tasks + metadata”. Align to avoid model confusion.

- "system": "You are an AI assistant specialized in analyzing Product Requirements Documents (PRDs) and generating a structured, logically ordered, dependency-aware and sequenced list of development tasks in JSON format.{{#if research}}...{{/if}}\n\nAnalyze ...\nRespond ONLY with a valid JSON object containing a single key \"tasks\", where the value is an array of task objects adhering to the provided Zod schema. Do not include any explanation or markdown formatting.\n\nEach task should follow this JSON structure:\n{\n\t\"id\": number,\n\t\"title\": string,\n\t\"description\": string,\n\t\"status\": \"pending\",\n\t\"dependencies\": number[] (IDs of tasks this depends on),\n\t\"priority\": \"high\" | \"medium\" | \"low\",\n\t\"details\": string (implementation details),\n\t\"testStrategy\": string (validation approach)\n}\n\nGuidelines:\n1. {{#if (gt numTasks 0)}}Unless complexity warrants otherwise{{else}}Depending on the complexity{{/if}}, create {{#if (gt numTasks 0)}}exactly {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, numbered sequentially starting from {{nextId}}\n2. Each task should be atomic and focused on a single responsibility following the most up to date best practices and standards\n3. Order tasks logically - consider dependencies and implementation sequence\n4. Early tasks should focus on setup, core functionality first, then advanced features\n5. Include clear validation/testing approach for each task\n6. Set appropriate dependency IDs (a task can only depend on tasks with lower IDs, potentially including existing tasks with IDs less than {{nextId}} if applicable)\n7. Assign priority (high/medium/low) based on criticality and dependency order\n8. Include detailed implementation guidance in the \"details\" field{{#if research}}, with specific libraries and version recommendations based on your research{{/if}}\n9. If the PRD contains specific requirements for libraries, database schemas, frameworks, tech stacks, or any other implementation details, STRICTLY ADHERE to these requirements in your task breakdown and do not discard them under any circumstance\n10. Focus on filling in any gaps left by the PRD or areas that aren't fully specified, while preserving all explicit requirements\n11. Always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches{{#if research}}\n12. For each task, include specific, actionable guidance based on current industry standards and best practices discovered through research{{/if}}",
+ "system": "You are an AI assistant specialized in analyzing Product Requirements Documents (PRDs) and generating a structured, logically ordered, dependency-aware and sequenced list of development tasks in JSON format.{{#if research}}...{{/if}}\n\nAnalyze ...\nRespond ONLY with a valid JSON object containing two keys: \"tasks\" (array of task objects adhering to the provided Zod schema) and \"metadata\" (object) exactly as specified by the user prompt. Do not include any explanation or markdown formatting.\n\nEach task should follow this JSON structure:\n{\n\t\"id\": number,\n\t\"title\": string,\n\t\"description\": string,\n\t\"status\": \"pending\",\n\t\"dependencies\": number[] (IDs of tasks this depends on),\n\t\"priority\": \"high\" | \"medium\" | \"low\",\n\t\"details\": string (implementation details),\n\t\"testStrategy\": string (validation approach)\n}\n\nGuidelines:\n1. {{#if (gt numTasks 0)}}Unless complexity warrants otherwise{{else}}Depending on the complexity{{/if}}, create {{#if (gt numTasks 0)}}exactly {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, numbered sequentially starting from {{nextId}}\n2. Each task should be atomic and focused on a single responsibility following the most up to date best practices and standards\n3. Order tasks logically - consider dependencies and implementation sequence\n4. Early tasks should focus on setup, core functionality first, then advanced features\n5. Include clear validation/testing approach for each task\n6. Set appropriate dependency IDs (a task can only depend on tasks with lower IDs, potentially including existing tasks with IDs less than {{nextId}} if applicable)\n7. Assign priority (high/medium/low) based on criticality and dependency order\n8. Include detailed implementation guidance in the \"details\" field{{#if research}}, with specific libraries and version recommendations based on your research{{/if}}\n9. If the PRD contains specific requirements for libraries, database schemas, frameworks, tech stacks, or any other implementation details, STRICTLY ADHERE to these requirements in your task breakdown and do not discard them under any circumstance\n10. Focus on filling in any gaps left by the PRD or areas that aren't fully specified, while preserving all explicit requirements\n11. Always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches{{#if research}}\n12. For each task, include specific, actionable guidance based on current industry standards and best practices discovered through research{{/if}}",
🤖 Prompt for AI Agents
In src/prompts/parse-prd.json around lines 59 to 61, the system prompt forces
"Respond ONLY with a valid JSON object containing a single key \"tasks\"" but
the user prompt requires "tasks + metadata", causing a contract conflict; fix by
making the system prompt accept the user-required shape (allow both "tasks" and
"metadata") or by changing the user prompt to match the system (only "tasks").
Update the system message text to remove the hard "single key" requirement and
instead require a JSON object with keys "tasks" and "metadata" (document
expected metadata fields), or alternatively update the user block to request
only "tasks" if metadata is undesired; ensure the final instruction lines and
examples consistently reflect the chosen contract so both system and user
prompts match exactly.

Comment on lines +55 to 57
isApiKeySet: jest.fn(() => true),
hasCodebaseAnalysis: jest.fn(() => false)
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Mock API parity: include parameters in hasCodebaseAnalysis

Minor signature sync for clarity and resilience.

- isApiKeySet: jest.fn(() => true),
- hasCodebaseAnalysis: jest.fn(() => false)
+ isApiKeySet: jest.fn(() => true),
+ hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
isApiKeySet: jest.fn(() => true),
hasCodebaseAnalysis: jest.fn(() => false)
}));
isApiKeySet: jest.fn(() => true),
hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
}));
🤖 Prompt for AI Agents
In tests/unit/parse-prd.test.js around lines 55 to 57, the jest mock for
hasCodebaseAnalysis lacks the same parameter signature as the real function;
update the mock to accept the same parameters (e.g., jest.fn((repo, options) =>
false) or the actual parameter names used in code) so tests mirror the real API
and avoid signature-related issues.

* Tests for the add-task.js module
*/
import { jest } from '@jest/globals';
import { hasCodebaseAnalysis } from '../../../../../scripts/modules/config-manager.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Remove direct import that bypasses Jest ESM mocking

Static import runs before jest.unstable_mockModule and pulls the real module. It’s also unused here.

-import { hasCodebaseAnalysis } from '../../../../../scripts/modules/config-manager.js';

🏁 Script executed:

#!/bin/bash
# Find other static imports that will bypass ESM mocks
rg -nP --type=js '\bimport\s+\{\s*hasCodebaseAnalysis\s*\}\s+from\s+["\'][^"\']*config-manager\.js["\']' tests

Length of output: 116


🏁 Script executed:

#!/bin/bash
# Search for any static imports of hasCodebaseAnalysis from config-manager.js in tests
rg -nP --type=js "\\bimport\\s+\\{\\s*hasCodebaseAnalysis\\s*\\}\\s+from\\s+['\"][^'\"]*config-manager\\.js['\"]" tests

Length of output: 597


Remove static imports of hasCodebaseAnalysis in test files
Static imports run before jest.unstable_mockModule, bypassing your ESM mocks and pulling in the real implementation (which isn’t used here). Remove the following lines:

  • tests/unit/scripts/modules/task-manager/add-task.test.js (line 5)
  • tests/unit/scripts/modules/task-manager/analyze-task-complexity.test.js (line 9)
  • tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js (line 9)
🤖 Prompt for AI Agents
In tests/unit/scripts/modules/task-manager/add-task.test.js around line 5,
remove the static import statement "import { hasCodebaseAnalysis } from
'../../../../../scripts/modules/config-manager.js';" because static imports
execute before jest.unstable_mockModule and bypass ESM mocks; instead rely on
mocking via jest.unstable_mockModule in the test setup (or use dynamic import
within the test after the mock is registered). Ensure any references to
hasCodebaseAnalysis in the test use the mocked module (via dynamic import or
jest.mock equivalent) so the real implementation is not pulled in.

import { jest } from '@jest/globals';
import fs from 'fs';
import path from 'path';
import { hasCodebaseAnalysis } from '../../../../../scripts/modules/config-manager.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove direct import that bypasses Jest ESM mocks

This import executes before mocks and is unused.

-import { hasCodebaseAnalysis } from '../../../../../scripts/modules/config-manager.js';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { hasCodebaseAnalysis } from '../../../../../scripts/modules/config-manager.js';
// (remove the now-unused `hasCodebaseAnalysis` import)
🤖 Prompt for AI Agents
In
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
around line 9, remove the direct import "import { hasCodebaseAnalysis } from
'../../../../../scripts/modules/config-manager.js';" because it runs before Jest
ESM mocks and is unused; instead rely on the mocked module (use jest.mock at top
of the file) or import the function after mocks are set up inside the test scope
if needed, and delete the unused import line to prevent bypassing Jest mocks.

Comment on lines +306 to 307
hasCodebaseAnalysis: jest.fn(() => false)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Sync hasCodebaseAnalysis mock signature

Align with (useResearch, projectRoot) to avoid brittle tests if args are read.

-    hasCodebaseAnalysis: jest.fn(() => false)
+    hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
hasCodebaseAnalysis: jest.fn(() => false)
})
hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
})
🤖 Prompt for AI Agents
In
tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
around lines 306 to 307, the hasCodebaseAnalysis mock is declared as jest.fn(()
=> false) which doesn't match the real signature and can make tests brittle;
change the mock to accept the actual parameters (useResearch, projectRoot) —
e.g. jest.fn((useResearch, projectRoot) => false) — and update any other places
in this test that call or inspect mock arguments to use the two-argument
signature.

Comment on lines +55 to 56
hasCodebaseAnalysis: jest.fn(() => false)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Align hasCodebaseAnalysis mock with new signature

Match the updated API to future-proof the mock.

-    hasCodebaseAnalysis: jest.fn(() => false)
+    hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
hasCodebaseAnalysis: jest.fn(() => false)
})
hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
})
🤖 Prompt for AI Agents
In tests/unit/scripts/modules/task-manager/update-task-by-id.test.js around
lines 55-56, the hasCodebaseAnalysis mock is still defined as jest.fn(() =>
false) but the real API signature changed; update the mock to match the new
function signature (accept the same parameters) and return the appropriate async
type (e.g., use jest.fn(async (args...) => false) or jest.fn(() =>
Promise.resolve(false))) so callers receive the correct parameters and a
promise-based result.

Comment on lines +48 to 49
hasCodebaseAnalysis: jest.fn(() => false)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Mock signature consistency for hasCodebaseAnalysis

Mirror the real function’s parameters.

-    hasCodebaseAnalysis: jest.fn(() => false)
+    hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
hasCodebaseAnalysis: jest.fn(() => false)
})
hasCodebaseAnalysis: jest.fn((useResearch, projectRoot) => false)
})
🤖 Prompt for AI Agents
In tests/unit/scripts/modules/task-manager/update-tasks.test.js around lines
48-49, the mock for hasCodebaseAnalysis uses jest.fn(() => false) which doesn't
mirror the real function's parameter/signature; update the mock to accept the
same parameters as the real function (e.g., repoPath, options or a rest args
signature) and return the same type (synchronous boolean or a Promise resolving
to false if the real function is async) so callers receive the expected
signature and behavior.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
src/prompts/update-task.json (2)

3-9: Version/metadata should reflect the public parameter addition.

Bump version to 1.1.0 and update the “updated” timestamp.

Apply:

-  "version": "1.0.0",
+  "version": "1.1.0",
@@
-    "updated": "2024-01-01T00:00:00Z",
+    "updated": "2025-08-28T00:00:00Z",

1-71: Remember to update tasks.json via windsufrules when prompt intent changes.

Per the repo convention, run: node scripts/dev.js update --from= --prompt="Rename isClaudeCode→hasCodebaseAnalysis and add projectRoot context to update-task prompt."

src/prompts/update-subtask.json (2)

3-9: Version/metadata should reflect the parameter rename.

Bump to 1.1.0 and refresh “updated”.

-  "version": "1.0.0",
+  "version": "1.1.0",
@@
-    "updated": "2024-01-01T00:00:00Z",
+    "updated": "2025-08-28T00:00:00Z",

27-32: Required + default on currentDetails is redundant.

If required is true, callers must supply it; otherwise rely on default. Pick one to simplify schema.

-      "required": true,
-      "default": "(No existing details)",
+      "required": false,
+      "default": "(No existing details)",
♻️ Duplicate comments (2)
src/prompts/parse-prd.json (1)

59-61: Resolve system/user response-shape conflict (tasks vs tasks+metadata).
System mandates a single key "tasks", while user requires "tasks" + "metadata". Align them to prevent model confusion.

Apply one of the following diffs (preferred: update system to match user):

-Respond ONLY with a valid JSON object containing a single key "tasks", where the value is an array of task objects adhering to the provided Zod schema. Do not include any explanation or markdown formatting.
+Respond ONLY with a valid JSON object containing two keys: "tasks" (array of task objects adhering to the provided Zod schema) and "metadata" (object with summary information). Do not include any explanation or markdown formatting.

Or, if metadata is not desired, remove the metadata block from the user prompt example and instructions for consistency.

src/prompts/expand-task.json (1)

81-81: Mirror the codebase-analysis preface in the “complexity-report” variant.
The research/default variants include the gated preface; complexity-report doesn’t. Add the same block for consistency.

Apply this change to the “complexity-report” user prompt:

-"user": "Break down the following task based on the analysis prompt:\n
+"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Break down the following task based on the analysis prompt:\n
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c34d141 and 3552f94.

📒 Files selected for processing (7)
  • src/prompts/add-task.json (2 hunks)
  • src/prompts/analyze-complexity.json (2 hunks)
  • src/prompts/expand-task.json (2 hunks)
  • src/prompts/parse-prd.json (2 hunks)
  • src/prompts/update-subtask.json (2 hunks)
  • src/prompts/update-task.json (2 hunks)
  • src/prompts/update-tasks.json (2 hunks)
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-07-18T17:19:27.365Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: assets/.windsurfrules:0-0
Timestamp: 2025-07-18T17:19:27.365Z
Learning: When implementation differs significantly from planned approach, call `node scripts/dev.js update --from=<futureTaskId> --prompt="<explanation>"` to update tasks.json.

Applied to files:

  • src/prompts/parse-prd.json
  • src/prompts/expand-task.json
  • src/prompts/update-tasks.json
  • src/prompts/update-task.json
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Extract tasks from PRD documents using AI, create them in the current tag context (defaulting to 'master'), provide clear prompts to guide AI task generation, and validate/clean up AI-generated tasks.

Applied to files:

  • src/prompts/parse-prd.json
  • src/prompts/update-tasks.json
📚 Learning: 2025-07-18T17:09:13.815Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/context_gathering.mdc:0-0
Timestamp: 2025-07-18T17:09:13.815Z
Learning: Commands such as `analyze-complexity`, `expand-task`, `update-task`, and `add-task` should consider adopting the context gathering pattern for improved AI-powered assistance.

Applied to files:

  • src/prompts/expand-task.json
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use AI to generate detailed subtasks within the current tag context, considering complexity analysis for subtask counts and ensuring proper IDs for newly created subtasks.

Applied to files:

  • src/prompts/expand-task.json
📚 Learning: 2025-07-18T17:10:02.683Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:02.683Z
Learning: When breaking down complex tasks in Taskmaster, use the `expand_task` command with appropriate flags (`--num`, `--research`, `--force`, `--prompt`) and review generated subtasks for accuracy.

Applied to files:

  • src/prompts/expand-task.json
📚 Learning: 2025-07-18T17:10:12.881Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-07-18T17:10:12.881Z
Learning: When breaking down complex tasks, use the `expand_task` command with appropriate flags (`--force`, `--research`, `--num`, `--prompt`) and review generated subtasks for accuracy.

Applied to files:

  • src/prompts/expand-task.json
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Each task object must include all required properties (id, title, description, status, dependencies, priority, details, testStrategy, subtasks) and provide default values for optional properties. Extra properties not in the standard schema must not be added.

Applied to files:

  • src/prompts/add-task.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (14)
src/prompts/analyze-complexity.json (3)

34-38: Rename to hasCodebaseAnalysis — LGTM.
Parameter name, type, and description are consistent with the PR-wide capability rename.


48-48: User prompt gating updated — LGTM.
The codebase-analysis preface is correctly gated by hasCodebaseAnalysis and uses projectRoot.


34-38: All clear—no lingering isClaudeCode references and every hasCodebaseAnalysis block includes projectRoot.

src/prompts/add-task.json (2)

49-54: Capability flag rename — LGTM.
Schema and description align with the generalized capability.


65-65: Confirm output contract matches downstream validator.
Prompt returns only {title, description, details, testStrategy, dependencies}. Our long-term rule expects full task objects (id, title, description, status, dependencies, priority, details, testStrategy, subtasks). If the add-task pipeline augments fields, fine; otherwise this will fail validation. Please confirm.

Would you like me to adjust this prompt to emit the full schema (with status='pending', priority from parameter, subtasks=[], and id=newTaskId)?

src/prompts/parse-prd.json (1)

44-49: Capability flag rename — LGTM.
Parameter change is consistent across prompts.

src/prompts/update-tasks.json (2)

31-36: Capability flag rename — LGTM.
Schema and description look good.


47-47: Codebase-analysis preface — LGTM.
Clear guidance, correctly gated by hasCodebaseAnalysis and uses projectRoot.

src/prompts/expand-task.json (1)

55-60: Capability flag rename — LGTM.
Parameter rename and description are consistent.

src/prompts/update-task.json (3)

47-52: Rename to hasCodebaseAnalysis: looks correct and consistent.

Schema change is clear and default behavior preserved.


47-58: hasCodebaseAnalysis & projectRoot wiring verified – all builder calls in default and append modes pass both parameters and there are no remaining isClaudeCode references.


68-68: Ensure json helper is registered or switch to taskJson
I didn't find any registerHelper('json',…) calls in the codebase; verify the json helper is available at runtime to prevent {{{json task}}} rendering as [object Object], or replace with the taskJson variable. (src/prompts/update-task.json:68)

src/prompts/update-subtask.json (2)

48-53: Rename to hasCodebaseAnalysis: consistent and safe.

Default remains false; behavior unchanged when omitted.


60-66: Confirm test coverage for codebase-analysis gating
No unit tests were found for hasCodebaseAnalysis true/false in update-subtask.json. Please verify and add tests asserting the presence/absence of the codebase-analysis block and ensuring research path additions don’t break the plain-string output constraint.

"condition": "useResearch === true && !expansionPrompt",
"system": "You are an AI assistant that responds ONLY with valid JSON objects as requested. The object should contain a 'subtasks' array.",
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Analyze the following task and break it down into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks using your research capabilities. Assign sequential IDs starting from {{nextSubtaskId}}.\n\nParent Task:\nID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nConsider this context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nCRITICAL: Respond ONLY with a valid JSON object containing a single key \"subtasks\". The value must be an array of the generated subtasks, strictly matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": <number>, // Sequential ID starting from {{nextSubtaskId}}\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"dependencies\": [\"<string>\"], // Use full subtask IDs like [\"{{task.id}}.1\", \"{{task.id}}.2\"]. If no dependencies, use an empty array [].\n \"details\": \"<string>\",\n \"testStrategy\": \"<string>\" // Optional\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}appropriate number of{{/if}} subtasks)\n ]\n}\n\nImportant: For the 'dependencies' field, if a subtask has no dependencies, you MUST use an empty array, for example: \"dependencies\": []. Do not use null or omit the field.\n\nDo not include ANY explanatory text, markdown, or code block markers. Just the JSON object."
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Analyze the following task and break it down into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks using your research capabilities. Assign sequential IDs starting from {{nextSubtaskId}}.\n\nParent Task:\nID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nConsider this context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nCRITICAL: Respond ONLY with a valid JSON object containing a single key \"subtasks\". The value must be an array of the generated subtasks, strictly matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": <number>, // Sequential ID starting from {{nextSubtaskId}}\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"dependencies\": [\"<string>\"], // Use full subtask IDs like [\"{{task.id}}.1\", \"{{task.id}}.2\"]. If no dependencies, use an empty array [].\n \"details\": \"<string>\",\n \"testStrategy\": \"<string>\" // Optional\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}appropriate number of{{/if}} subtasks)\n ]\n}\n\nImportant: For the 'dependencies' field, if a subtask has no dependencies, you MUST use an empty array, for example: \"dependencies\": []. Do not use null or omit the field.\n\nDo not include ANY explanatory text, markdown, or code block markers. Just the JSON object."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Unify subtask schema across variants.
Complexity-report requires “status” but omits “testStrategy”; other variants include optional “testStrategy”. Recommend standardizing to reduce consumer conditionals.

Proposed update to the complexity-report system text (key list only):

-Each subtask object in the array must have keys: "id", "title", "description", "dependencies", "details", "status".
+Each subtask object in the array must have keys: "id", "title", "description", "dependencies", "details", "status" and may include "testStrategy".

Committable suggestion skipped: line range outside the PR's diff.

"default": {
"system": "You are an AI assistant helping to update a subtask. You will be provided with the subtask's existing details, context about its parent and sibling tasks, and a user request string.{{#if useResearch}} You have access to current best practices and latest technical information to provide research-backed updates.{{/if}}\n\nYour Goal: Based *only* on the user's request and all the provided context (including existing details if relevant to the request), GENERATE the new text content that should be added to the subtask's details.\nFocus *only* on generating the substance of the update.\n\nOutput Requirements:\n1. Return *only* the newly generated text content as a plain string. Do NOT return a JSON object or any other structured data.\n2. Your string response should NOT include any of the subtask's original details, unless the user's request explicitly asks to rephrase, summarize, or directly modify existing text.\n3. Do NOT include any timestamps, XML-like tags, markdown, or any other special formatting in your string response.\n4. Ensure the generated text is concise yet complete for the update based on the user request. Avoid conversational fillers or explanations about what you are doing (e.g., do not start with \"Okay, here's the update...\").{{#if useResearch}}\n5. Include specific libraries, versions, and current best practices relevant to the subtask implementation.\n6. Provide research-backed technical recommendations and proven approaches.{{/if}}",
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating the subtask update:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine relevant files and understand current implementation\n4. Analyze the current codebase to inform your subtask update\n\nBased on your analysis:\n- Include specific file references, code patterns, or implementation details\n- Ensure suggestions align with the project's current architecture\n- Reference existing components or patterns when relevant\n- Make implementation notes specific to the codebase structure\n\nProject Root: {{projectRoot}}\n\n{{/if}}Task Context:\n\nParent Task: {{{json parentTask}}}\n{{#if prevSubtask}}Previous Subtask: {{{json prevSubtask}}}\n{{/if}}{{#if nextSubtask}}Next Subtask: {{{json nextSubtask}}}\n{{/if}}Current Subtask Details (for context only):\n{{currentDetails}}\n\nUser Request: \"{{updatePrompt}}\"\n\n{{#if useResearch}}Research and incorporate current best practices, latest stable versions, and proven approaches into your update. {{/if}}Based on the User Request and all the Task Context (including current subtask details provided above), what is the new information or text that should be appended to this subtask's details? Return ONLY this new text as a plain string.{{#if useResearch}} Include specific technical recommendations based on current industry standards.{{/if}}\n{{#if gatheredContext}}\n\n# Additional Project Context\n\n{{gatheredContext}}\n{{/if}}"
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating the subtask update:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine relevant files and understand current implementation\n4. Analyze the current codebase to inform your subtask update\n\nBased on your analysis:\n- Include specific file references, code patterns, or implementation details\n- Ensure suggestions align with the project's current architecture\n- Reference existing components or patterns when relevant\n- Make implementation notes specific to the codebase structure\n\nProject Root: {{projectRoot}}\n\n{{/if}}Task Context:\n\nParent Task: {{{json parentTask}}}\n{{#if prevSubtask}}Previous Subtask: {{{json prevSubtask}}}\n{{/if}}{{#if nextSubtask}}Next Subtask: {{{json nextSubtask}}}\n{{/if}}Current Subtask Details (for context only):\n{{currentDetails}}\n\nUser Request: \"{{updatePrompt}}\"\n\n{{#if useResearch}}Research and incorporate current best practices, latest stable versions, and proven approaches into your update. {{/if}}Based on the User Request and all the Task Context (including current subtask details provided above), what is the new information or text that should be appended to this subtask's details? Return ONLY this new text as a plain string.{{#if useResearch}} Include specific technical recommendations based on current industry standards.{{/if}}\n{{#if gatheredContext}}\n\n# Additional Project Context\n\n{{gatheredContext}}\n{{/if}}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Codebase-analysis preface duplicated across prompts—extract a partial.

Create a shared partial for the “Glob/Grep/Read” block to avoid future divergence.

Comment on lines +63 to 69
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before updating the task:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine relevant files and understand current implementation\n4. Analyze how the task changes relate to the existing codebase\n\nBased on your analysis:\n- Update task details to reference specific files, functions, or patterns from the codebase\n- Ensure implementation details align with the project's current architecture\n- Include specific code examples or file references where appropriate\n- Consider how changes impact existing components\n\nProject Root: {{projectRoot}}\n\n{{/if}}Here is the task to update{{#if useResearch}} with research-backed information{{/if}}:\n{{{taskJson}}}\n\nPlease {{#if useResearch}}research and {{/if}}update this task based on the following {{#if useResearch}}context:\n{{updatePrompt}}\n\nIncorporate current best practices, latest stable versions, and proven approaches.{{/if}}{{#if (not useResearch)}}new context:\n{{updatePrompt}}{{/if}}\n\nIMPORTANT: {{#if useResearch}}Preserve any subtasks marked as \"done\" or \"completed\".{{/if}}{{#if (not useResearch)}}In the task JSON above, any subtasks with \"status\": \"done\" or \"status\": \"completed\" should be preserved exactly as is. Build your changes around these completed items.{{/if}}\n{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}\n{{/if}}\n\nReturn only the updated task as a valid JSON object{{#if useResearch}} with research-backed improvements{{/if}}."
},
"append": {
"condition": "appendMode === true",
"system": "You are an AI assistant helping to append additional information to a software development task. You will be provided with the task's existing details, context, and a user request string.\n\nYour Goal: Based *only* on the user's request and all the provided context (including existing details if relevant to the request), GENERATE the new text content that should be added to the task's details.\nFocus *only* on generating the substance of the update.\n\nOutput Requirements:\n1. Return *only* the newly generated text content as a plain string. Do NOT return a JSON object or any other structured data.\n2. Your string response should NOT include any of the task's original details, unless the user's request explicitly asks to rephrase, summarize, or directly modify existing text.\n3. Do NOT include any timestamps, XML-like tags, markdown, or any other special formatting in your string response.\n4. Ensure the generated text is concise yet complete for the update based on the user request. Avoid conversational fillers or explanations about what you are doing (e.g., do not start with \"Okay, here's the update...\").",
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating the task update:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine relevant files and understand current implementation\n4. Analyze the current codebase to inform your update\n\nBased on your analysis:\n- Include specific file references, code patterns, or implementation details\n- Ensure suggestions align with the project's current architecture\n- Reference existing components or patterns when relevant\n\nProject Root: {{projectRoot}}\n\n{{/if}}Task Context:\n\nTask: {{{json task}}}\nCurrent Task Details (for context only):\n{{currentDetails}}\n\nUser Request: \"{{updatePrompt}}\"\n\nBased on the User Request and all the Task Context (including current task details provided above), what is the new information or text that should be appended to this task's details? Return ONLY this new text as a plain string.\n{{#if gatheredContext}}\n\n# Additional Project Context\n\n{{gatheredContext}}\n{{/if}}"
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating the task update:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine relevant files and understand current implementation\n4. Analyze the current codebase to inform your update\n\nBased on your analysis:\n- Include specific file references, code patterns, or implementation details\n- Ensure suggestions align with the project's current architecture\n- Reference existing components or patterns when relevant\n\nProject Root: {{projectRoot}}\n\n{{/if}}Task Context:\n\nTask: {{{json task}}}\nCurrent Task Details (for context only):\n{{currentDetails}}\n\nUser Request: \"{{updatePrompt}}\"\n\nBased on the User Request and all the Task Context (including current task details provided above), what is the new information or text that should be appended to this task's details? Return ONLY this new text as a plain string.\n{{#if gatheredContext}}\n\n# Additional Project Context\n\n{{gatheredContext}}\n{{/if}}"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Strong guardrails retained; small clarity tweak optional.

Consider prefixing the codebase-analysis preface with “Do not include any of the following instructions in your output” to further minimize model leakage into responses.

🤖 Prompt for AI Agents
In src/prompts/update-task.json around lines 63 to 69, the codebase-analysis
preface may leak instructions into the model's output; update the preface by
prepending a clear prohibitory sentence such as "Do not include any of the
following instructions in your output:" before the existing codebase-analysis
steps, ensuring the rest of the preface remains unchanged and the wording
integrates naturally so the guardrail is explicit and prevents those steps from
appearing in the generated response.

"default": {
"system": "You are an AI assistant helping to update a software development task based on new context.{{#if useResearch}} You have access to current best practices and latest technical information to provide research-backed updates.{{/if}}\nYou will be given a task and a prompt describing changes or new implementation details.\nYour job is to update the task to reflect these changes, while preserving its basic structure.\n\nGuidelines:\n1. VERY IMPORTANT: NEVER change the title of the task - keep it exactly as is\n2. Maintain the same ID, status, and dependencies unless specifically mentioned in the prompt{{#if useResearch}}\n3. Research and update the description, details, and test strategy with current best practices\n4. Include specific versions, libraries, and approaches that are current and well-tested{{/if}}{{#if (not useResearch)}}\n3. Update the description, details, and test strategy to reflect the new information\n4. Do not change anything unnecessarily - just adapt what needs to change based on the prompt{{/if}}\n5. Return a complete valid JSON object representing the updated task\n6. VERY IMPORTANT: Preserve all subtasks marked as \"done\" or \"completed\" - do not modify their content\n7. For tasks with completed subtasks, build upon what has already been done rather than rewriting everything\n8. If an existing completed subtask needs to be changed/undone based on the new context, DO NOT modify it directly\n9. Instead, add a new subtask that clearly indicates what needs to be changed or replaced\n10. Use the existence of completed subtasks as an opportunity to make new subtasks more specific and targeted\n11. Ensure any new subtasks have unique IDs that don't conflict with existing ones\n12. CRITICAL: For subtask IDs, use ONLY numeric values (1, 2, 3, etc.) NOT strings (\"1\", \"2\", \"3\")\n13. CRITICAL: Subtask IDs should start from 1 and increment sequentially (1, 2, 3...) - do NOT use parent task ID as prefix{{#if useResearch}}\n14. Include links to documentation or resources where helpful\n15. Focus on practical, implementable solutions using current technologies{{/if}}\n\nThe changes described in the prompt should be thoughtfully applied to make the task more accurate and actionable.",
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before updating the task:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine relevant files and understand current implementation\n4. Analyze how the task changes relate to the existing codebase\n\nBased on your analysis:\n- Update task details to reference specific files, functions, or patterns from the codebase\n- Ensure implementation details align with the project's current architecture\n- Include specific code examples or file references where appropriate\n- Consider how changes impact existing components\n\nProject Root: {{projectRoot}}\n\n{{/if}}Here is the task to update{{#if useResearch}} with research-backed information{{/if}}:\n{{{taskJson}}}\n\nPlease {{#if useResearch}}research and {{/if}}update this task based on the following {{#if useResearch}}context:\n{{updatePrompt}}\n\nIncorporate current best practices, latest stable versions, and proven approaches.{{/if}}{{#if (not useResearch)}}new context:\n{{updatePrompt}}{{/if}}\n\nIMPORTANT: {{#if useResearch}}Preserve any subtasks marked as \"done\" or \"completed\".{{/if}}{{#if (not useResearch)}}In the task JSON above, any subtasks with \"status\": \"done\" or \"status\": \"completed\" should be preserved exactly as is. Build your changes around these completed items.{{/if}}\n{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}\n{{/if}}\n\nReturn only the updated task as a valid JSON object{{#if useResearch}} with research-backed improvements{{/if}}."
"user": "{{#if hasCodebaseAnalysis}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before updating the task:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine relevant files and understand current implementation\n4. Analyze how the task changes relate to the existing codebase\n\nBased on your analysis:\n- Update task details to reference specific files, functions, or patterns from the codebase\n- Ensure implementation details align with the project's current architecture\n- Include specific code examples or file references where appropriate\n- Consider how changes impact existing components\n\nProject Root: {{projectRoot}}\n\n{{/if}}Here is the task to update{{#if useResearch}} with research-backed information{{/if}}:\n{{{taskJson}}}\n\nPlease {{#if useResearch}}research and {{/if}}update this task based on the following {{#if useResearch}}context:\n{{updatePrompt}}\n\nIncorporate current best practices, latest stable versions, and proven approaches.{{/if}}{{#if (not useResearch)}}new context:\n{{updatePrompt}}{{/if}}\n\nIMPORTANT: {{#if useResearch}}Preserve any subtasks marked as \"done\" or \"completed\".{{/if}}{{#if (not useResearch)}}In the task JSON above, any subtasks with \"status\": \"done\" or \"status\": \"completed\" should be preserved exactly as is. Build your changes around these completed items.{{/if}}\n{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}\n{{/if}}\n\nReturn only the updated task as a valid JSON object{{#if useResearch}} with research-backed improvements{{/if}}."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Codebase-analysis block: good gating; consider DRYing via a shared partial.

This block is duplicated across multiple prompts. Extract into a reusable partial (e.g., {{> codebaseAnalysisBlock}}) to reduce drift.

🤖 Prompt for AI Agents
In src/prompts/update-task.json around line 63, the long "Codebase Analysis
Required" block is duplicated across prompts; extract it into a shared
Handlebars partial (e.g., {{> codebaseAnalysisBlock}}) and replace the inline
block with that partial. Create the partial file (or add it to your existing
partials registry), move the entire block text into the partial, update any
template registration code to load the new partial, and run template rendering
tests to ensure no whitespace or context variables break; keep conditionals
(hasCodebaseAnalysis, projectRoot, etc.) intact inside the partial.

@Crunchyman-ralph Crunchyman-ralph merged commit 37af0f1 into next Aug 28, 2025
5 checks passed
Crunchyman-ralph added a commit that referenced this pull request Aug 28, 2025
* 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
@coderabbitai coderabbitai Bot mentioned this pull request Sep 12, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant