Skip to content

feat: add optional feature flag for code context#1165

Merged
Crunchyman-ralph merged 3 commits into
nextfrom
feat/add.optional.code.context.feature.flag
Aug 28, 2025
Merged

feat: add optional feature flag for code context#1165
Crunchyman-ralph merged 3 commits into
nextfrom
feat/add.optional.code.context.feature.flag

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

# Run any ai command
tm add-task --prompt="testing task"

Make sure it doesn't use code context (check the generated system prompt)

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

    • Added a global toggle to enable/disable codebase analysis.
    • Honors a clear precedence: environment variables, session environment, then project config.
    • Quick opt-out via TASKMASTER_ENABLE_CODEBASE_ANALYSIS=false.
    • Automatically activates only when the selected provider supports codebase analysis.
  • Chores

    • Consolidated workspace and extension configuration formatting (no behavior changes).
  • Tests

    • Updated unit tests to reflect the new default and mocking for codebase analysis settings.

@changeset-bot

changeset-bot Bot commented Aug 28, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 70342eb

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

Adds a global feature flag for codebase analysis with multi-source precedence and exports new query utilities. Updates task-manager call sites to pass session into hasCodebaseAnalysis. Adjusts tests and default config. Applies formatting changes to package.json files. Adds a changeset documenting the new flag.

Changes

Cohort / File(s) Summary
Feature flag implementation
scripts/modules/config-manager.js, tests/unit/config-manager.test.js
Adds enableCodebaseAnalysis default, introduces isCodebaseAnalysisEnabled, hasCodebaseAnalysis, getCodebaseAnalysisEnabled, and exports them; implements env/MCP/global precedence; updates test default config.
Task manager session-plumbing
scripts/modules/task-manager/add-task.js, scripts/modules/task-manager/analyze-task-complexity.js, scripts/modules/task-manager/expand-task.js, scripts/modules/task-manager/update-subtask-by-id.js, scripts/modules/task-manager/update-task-by-id.js, scripts/modules/task-manager/update-tasks.js, scripts/modules/task-manager/parse-prd/parse-prd-config.js
Updates hasCodebaseAnalysis(...) calls to include session; no other flow changes.
Test import surface tweaks
tests/unit/scripts/modules/task-manager/analyze-task-complexity.test.js, tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
Removes direct imports of hasCodebaseAnalysis; relies on existing mocks; no behavior change.
Repo metadata formatting
package.json, apps/extension/package.json
Converts certain multi-line arrays to single-line arrays; no content changes.
Changeset
.changeset/sour-coins-lay.md
Documents the configurable codebase analysis feature flag and its precedence.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller as Caller (task-manager, PRD parser)
  participant CM as ConfigManager
  participant Env as .env / Process Env
  participant MCP as MCP Session Env
  participant CFG as Global Config
  participant Prov as Provider Resolver

  Caller->>CM: hasCodebaseAnalysis(useResearch, projectRoot, session)
  activate CM
  CM->>CM: get provider (useResearch, projectRoot)
  CM->>Env: read TASKMASTER_ENABLE_CODEBASE_ANALYSIS
  Env-->>CM: value or undefined
  alt env unset
    CM->>MCP: read session env
    MCP-->>CM: value or undefined
    alt mcp unset
      CM->>CFG: read enableCodebaseAnalysis(projectRoot)
      CFG-->>CM: true/false (default true)
    end
  end
  CM->>Prov: provider supports codebase analysis?
  Prov-->>CM: true/false
  CM-->>Caller: enabled && providerSupported
  deactivate CM
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • eyaltoledano
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add.optional.code.context.feature.flag

🪧 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 changed the base branch from main to next August 28, 2025 21:58
@Crunchyman-ralph Crunchyman-ralph force-pushed the feat/add.optional.code.context.feature.flag branch from 2ea58c4 to 667a794 Compare August 28, 2025 22:19
@Crunchyman-ralph Crunchyman-ralph merged commit c4f92f6 into next Aug 28, 2025
7 of 8 checks passed
@Crunchyman-ralph Crunchyman-ralph deleted the feat/add.optional.code.context.feature.flag branch August 28, 2025 22:28

@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: 2

Caution

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

⚠️ Outside diff range comments (8)
package.json (1)

13-27: Add the missing test scripts per repo guidelines.

Root package.json should include test:unit, test:integration, and test:ci targets.

Apply:

   "scripts": {
     "test": "node --experimental-vm-modules node_modules/.bin/jest",
     "test:fails": "node --experimental-vm-modules node_modules/.bin/jest --onlyFailures",
     "test:watch": "node --experimental-vm-modules node_modules/.bin/jest --watch",
     "test:coverage": "node --experimental-vm-modules node_modules/.bin/jest --coverage",
+    "test:unit": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --selectProjects unit",
+    "test:integration": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --selectProjects integration",
     "test:e2e": "./tests/e2e/run_e2e.sh",
     "test:e2e-report": "./tests/e2e/run_e2e.sh --analyze-log",
+    "test:ci": "npm run format-check && npm run test:unit && npm run test:integration && npm run test:e2e",
     "prepare": "chmod +x bin/task-master.js mcp-server/server.js",
     "changeset": "changeset",
     "release": "changeset publish",
     "inspector": "npx @modelcontextprotocol/inspector node mcp-server/server.js",
     "mcp-server": "node mcp-server/server.js",
     "format-check": "biome format .",
     "format": "biome format . --write"
   },
scripts/modules/task-manager/analyze-task-complexity.js (4)

96-98: Use context for projectRoot/tag (per task-manager contract).

Core functions must read projectRoot and tag from context (with fallback to options).

Apply:

-  const projectRoot = options.projectRoot;
-  const tag = options.tag;
+  const projectRoot = context.projectRoot ?? options.projectRoot ?? null;
+  const tag = context.tag ?? options.tag ?? null;

709-722: Avoid process.exit in core logic.

Throw and let the CLI layer decide; MCP/CLI wrappers can map to exit codes.

Apply:

-      process.exit(1);
+      throw error;

If needed, handle exit in the CLI command wrapper.


471-523: Add schema validation for AI JSON.

After parsing, validate with Zod to hard-fail on structural drift.

Example insertion after JSON.parse:

+      const Item = z.object({
+        taskId: z.number(),
+        taskTitle: z.string(),
+        complexityScore: z.number().min(1).max(10),
+        recommendedSubtasks: z.number().int().nonnegative(),
+        expansionPrompt: z.string(),
+        reasoning: z.string()
+      });
+      z.array(Item).parse(complexityAnalysis);

349-351: Replace getProjectName(session) with getProjectName(projectRoot)
getProjectName requires a filesystem path, not the session object—passing session will break config lookup.

  • In scripts/modules/task-manager/analyze-task-complexity.js at lines 349 and 600:
-          projectName: getProjectName(session),
+          projectName: getProjectName(projectRoot),
tests/unit/config-manager.test.js (2)

368-377: Test expectations disagree with implementation.

validateProviderModelCombination returns true when provider list is empty (ollama/openrouter) or provider absent. These asserts expect false.

Update expectations:

- expect(configManager.validateProviderModelCombination('ollama', 'any-model')).toBe(false);
- expect(configManager.validateProviderModelCombination('openrouter', 'any/model')).toBe(false);
+ expect(configManager.validateProviderModelCombination('ollama', 'any-model')).toBe(true);
+ expect(configManager.validateProviderModelCombination('openrouter', 'any/model')).toBe(true);

1028-1048: Add tests for multi-source precedence of the new flag.

Cover ENV > session.env > config.

You can extend the suite with three cases:

  • process.env.TASKMASTER_ENABLE_CODEBASE_ANALYSIS='0' overrides config true
  • session.env.TASKMASTER_ENABLE_CODEBASE_ANALYSIS='1' overrides config false
  • no envs → falls back to DEFAULT_CONFIG.global.enableCodebaseAnalysis
scripts/modules/task-manager/add-task.js (1)

280-289: Bug: targetTag can be undefined, causing “Tag 'undefined' not found.”

If context.tag is omitted, const targetTag = tag; breaks the fallback behavior described in comments. Use current tag or 'master'.

Apply:

-    const targetTag = tag;
+    const targetTag = tag || getCurrentTag(projectRoot) || 'master';

And import helper:

 import {
   readJSON,
   writeJSON,
   log as consoleLog,
   truncate,
   ensureTagMetadata,
   performCompleteTagMigration,
   markMigrationForNotice
-} from '../utils.js';
+ , getCurrentTag } from '../utils.js';
📜 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 be0c0f2 and 70342eb.

📒 Files selected for processing (14)
  • .changeset/sour-coins-lay.md (1 hunks)
  • apps/extension/package.json (3 hunks)
  • package.json (1 hunks)
  • scripts/modules/config-manager.js (4 hunks)
  • scripts/modules/task-manager/add-task.js (1 hunks)
  • scripts/modules/task-manager/analyze-task-complexity.js (1 hunks)
  • scripts/modules/task-manager/expand-task.js (1 hunks)
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js (1 hunks)
  • scripts/modules/task-manager/update-subtask-by-id.js (1 hunks)
  • scripts/modules/task-manager/update-task-by-id.js (1 hunks)
  • scripts/modules/task-manager/update-tasks.js (1 hunks)
  • tests/unit/config-manager.test.js (1 hunks)
  • tests/unit/scripts/modules/task-manager/analyze-task-complexity.test.js (0 hunks)
  • tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js (0 hunks)
💤 Files with no reviewable changes (2)
  • tests/unit/scripts/modules/task-manager/analyze-task-complexity.test.js
  • tests/unit/scripts/modules/task-manager/complexity-report-tag-isolation.test.js
🧰 Additional context used
📓 Path-based instructions (19)
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/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • scripts/modules/task-manager/add-task.js
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/update-tasks.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • scripts/modules/config-manager.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • scripts/modules/task-manager/add-task.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/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • scripts/modules/task-manager/add-task.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/update-tasks.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • scripts/modules/task-manager/add-task.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/update-tasks.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
  • tests/unit/config-manager.test.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • scripts/modules/config-manager.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • scripts/modules/task-manager/add-task.js
tests/{unit,integration,e2e,fixtures}/**/*.js

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

Test files must be organized as follows: unit tests in tests/unit/, integration tests in tests/integration/, end-to-end tests in tests/e2e/, and test fixtures in tests/fixtures/.

Files:

  • tests/unit/config-manager.test.js
tests/unit/*.js

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

Each module should have a corresponding unit test file in tests/unit/ that reflects the module structure (one test file per module).

Files:

  • tests/unit/config-manager.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

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

**/*.{test,spec}.{js,ts,jsx,tsx}: Create a test file and ensure all tests pass when all subtasks are complete; commit tests if added or modified
When all subtasks are complete, run final testing using the appropriate test runner (e.g., npm test, jest, or manual testing)

Files:

  • tests/unit/config-manager.test.js
**/*.test.js

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

**/*.test.js: Never use asynchronous operations in tests. Make all mocks return synchronous values when possible.
Always mock tests properly based on the way the tested functions are defined and used.
Follow the test file organization: mocks must be set up before importing modules under test, and spies on mocked modules should be set up after imports.
Use fixtures from tests/fixtures/ for consistent sample data across tests.
Always declare mocks before importing the modules being tested in Jest test files.
Use jest.spyOn() after imports to create spies on mock functions and reference these spies in test assertions.
When testing functions with callbacks, get the callback from your mock's call arguments, execute it directly with test inputs, and verify the results.
For ES modules, use jest.mock() before static imports and jest.unstable_mockModule() before dynamic imports to mock dependencies.
Reset mock functions (mockFn.mockReset()) before dynamic imports if they might have been called previously.
When verifying console assertions, assert against the actual arguments passed (single formatted string), not multiple arguments.
Use mock-fs to mock file system operations in tests, and restore the file system after each test.
Mock API calls (e.g., Anthropic/Claude) by mocking the entire module and providing predictable responses.
Set mock environment variables in test setup and restore them after each test.
Maintain test fixtures separate from test logic.
Follow the mock-first-then-import pattern for all Jest mocks.
Do not define mock variables before jest.mock() calls (they won't be accessible due to hoisting).
Use test-specific file paths (e.g., 'test-tasks.json') for all file operations in tests.
Mock readJSON and writeJSON to avoid real file system interactions in tests.
Verify file operations use the correct paths in expect statements.
Use different file paths for each test to avoid test interdependence.
Verify modifications on the in-memory task objects passed to w...

Files:

  • tests/unit/config-manager.test.js
tests/unit/**/*.test.js

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

tests/unit/**/*.test.js: Unit tests must be located in tests/unit/, test individual functions and utilities in isolation, mock all external dependencies, and keep tests small, focused, and fast.
Do not include actual command execution in unit tests.

Files:

  • tests/unit/config-manager.test.js
tests/{unit,integration,e2e}/**/*.test.js

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

tests/{unit,integration,e2e}/**/*.test.js: When testing CLI commands built with Commander.js, test the command action handlers directly rather than trying to mock the entire Commander.js chain.
When mocking the Commander.js chain, mock ALL chainable methods (option, argument, action, on, etc.) and return this (or the mock object) from all chainable method mocks.
Explicitly handle all options, including defaults and shorthand flags (e.g., -p for --prompt), and include null/undefined checks in test implementations for parameters that might be optional.
Do not try to use the real action implementation without proper mocking, and do not mock Commander partially—either mock it completely or test the action directly.
Mock the action handlers for CLI commands and verify they're called with correct arguments.
Use sample task fixtures for consistent test data, mock file system operations, and test both success and error paths for task operations.
Mock console output and verify correct formatting in UI function tests. Use flexible assertions like toContain() or toMatch() for formatted output.
Mock chalk functions to return the input text to make testing easier while still verifying correct function calls.

Files:

  • tests/unit/config-manager.test.js
**/*.{test,spec}.*

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

Test files should follow naming conventions: .test., .spec., or _test. depending on the language

Files:

  • tests/unit/config-manager.test.js
tests/{unit,integration,e2e}/**

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

Organize test directories by test type (unit, integration, e2e) and mirror source structure where possible

Files:

  • tests/unit/config-manager.test.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/sour-coins-lay.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/sour-coins-lay.md
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
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
🧠 Learnings (31)
📓 Common learnings
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 integrating new features into the Task Master CLI with tagged system considerations (new_features.mdc).
📚 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:

  • apps/extension/package.json
  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
📚 Learning: 2025-07-31T20:49:04.638Z
Learnt from: Crunchyman-ralph
PR: eyaltoledano/claude-task-master#997
File: apps/extension/package.publish.json:2-8
Timestamp: 2025-07-31T20:49:04.638Z
Learning: In the eyaltoledano/claude-task-master repository, the VS Code extension uses a 3-file packaging system where package.json (with name "extension") is for development within the monorepo, while package.publish.json (with name "task-master-hamster") contains the clean manifest for VS Code marketplace publishing. The different names are intentional and serve distinct purposes in the build and publishing workflow.

Applied to files:

  • apps/extension/package.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 : Pass the `session` object (received in the `context` parameter, especially from direct function wrappers) to the service call when in MCP context.

Applied to files:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/analyze-task-complexity.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:

  • scripts/modules/task-manager/update-tasks.js
  • scripts/modules/task-manager/expand-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/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/config-manager.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/task-manager.js : Features that create, read, update, or delete tasks belong in 'scripts/modules/task-manager.js'.

Applied to files:

  • scripts/modules/task-manager/update-tasks.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/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • 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 : 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-tasks.js
  • scripts/modules/task-manager/update-task-by-id.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 : 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/update-tasks.js
  • scripts/modules/task-manager/expand-task.js
  • 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 : 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/update-tasks.js
  • scripts/modules/task-manager/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • scripts/modules/task-manager/add-task.js
📚 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/update-tasks.js
  • scripts/modules/task-manager/parse-prd/parse-prd-config.js
  • scripts/modules/task-manager/analyze-task-complexity.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/expand-task.js
  • scripts/modules/task-manager/analyze-task-complexity.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/expand-task.js
  • 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/expand-task.js
  • scripts/modules/task-manager/update-task-by-id.js
  • scripts/modules/task-manager/analyze-task-complexity.js
  • scripts/modules/task-manager/update-subtask-by-id.js
  • 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 : 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/expand-task.js
  • scripts/modules/task-manager/add-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/analyze-task-complexity.js
  • scripts/modules/task-manager/add-task.js
📚 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 integrating new features into the Task Master CLI with tagged system considerations (new_features.mdc).

Applied to files:

  • .changeset/sour-coins-lay.md
📚 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: Applies to .taskmaster/config.json : Store Taskmaster configuration settings (AI model selections, parameters, logging level, default subtasks/priority, project name, tag management) in `.taskmaster/config.json` in the project root. Do not configure these via environment variables.

Applied to files:

  • .changeset/sour-coins-lay.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 scripts/modules/**/*.test.js : Test CLI and MCP interfaces with real task data, verify end-to-end workflows across tag contexts, and test error scenarios and recovery in integration tests.

Applied to files:

  • package.json
📚 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: Applies to package.json : Add and update test scripts in package.json to include test, test:watch, test:coverage, test:unit, test:integration, test:e2e, and test:ci

Applied to files:

  • package.json
📚 Learning: 2025-07-18T17:16:13.793Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-07-18T17:16:13.793Z
Learning: Applies to **/*.test.js : Do not modify real task files (tasks.json) during tests.

Applied to files:

  • package.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 mcp-server/src/{core/utils,tools}/**/*.js : Place utilities specifically designed to support the MCP server implementation into the appropriate subdirectories within `mcp-server/src/` (e.g., path/core logic helpers in `mcp-server/src/core/utils/`, tool execution/response helpers in `mcp-server/src/tools/utils.js`).

Applied to files:

  • package.json
📚 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: Run `node scripts/dev.js analyze-complexity --research` for comprehensive analysis and review the complexity report in scripts/task-complexity-report.json.

Applied to files:

  • scripts/modules/task-manager/analyze-task-complexity.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: Analyze task complexity with `task-master analyze-complexity --research` before breaking down tasks.

Applied to files:

  • scripts/modules/task-manager/analyze-task-complexity.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/analyze-task-complexity.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 trigger migration when needed, handle migration errors gracefully, test feature behavior with pre-migration projects, and do not assume projects are already migrated.

Applied to files:

  • scripts/modules/config-manager.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/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.

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: Use `task-master add-task` to add a new task to tasks.json using AI.

Applied to files:

  • scripts/modules/task-manager/add-task.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/add-task.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 : Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.

Applied to files:

  • scripts/modules/task-manager/add-task.js
🧬 Code graph analysis (2)
scripts/modules/task-manager/update-subtask-by-id.js (3)
scripts/modules/task-manager/analyze-task-complexity.js (2)
  • useResearch (95-95)
  • projectRoot (96-96)
mcp-server/src/core/direct-functions/update-subtask-by-id.js (1)
  • useResearch (94-94)
mcp-server/src/core/direct-functions/update-task-by-id.js (1)
  • useResearch (99-99)
scripts/modules/task-manager/add-task.js (1)
scripts/modules/task-manager/analyze-task-complexity.js (2)
  • useResearch (95-95)
  • projectRoot (96-96)
🪛 LanguageTool
.changeset/sour-coins-lay.md

[grammar] ~4-~4: There might be a mistake here.
Context: --- "task-master-ai": minor --- Add configurable codebase analysis feature ...

(QB_NEW_EN)


[grammar] ~5-~5: There might be a mistake here.
Context: ...flag with multiple configuration sources Users can now control whether codebase a...

(QB_NEW_EN_OTHER)


[grammar] ~7-~7: Use correct spacing
Context: ... configuration, or project config files. Priority order: .env > MCP session env >...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: Use correct spacing
Context: ...P session env > .taskmaster/config.json. Set `TASKMASTER_ENABLE_CODEBASE_ANALYSIS...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 markdownlint-cli2 (0.17.2)
.changeset/sour-coins-lay.md

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

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

⏰ 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). (3)
  • GitHub Check: typecheck
  • GitHub Check: build
  • GitHub Check: test
🔇 Additional comments (16)
package.json (1)

12-12: Formatting-only workspace change is fine.

No functional impact.

apps/extension/package.json (1)

12-12: Formatting-only updates look good.

Enums and arrays compacted to single-line; no behavioral change.

Also applies to: 14-14, 142-142, 203-203

scripts/modules/task-manager/analyze-task-complexity.js (1)

422-426: Good: session is now passed into hasCodebaseAnalysis.

Aligns with the session-aware API and feature flag precedence.

scripts/modules/config-manager.js (3)

75-77: Default enableCodebaseAnalysis: true is reasonable.

Matches PR intent and keeps behavior opt-out via env/config.


467-486: Provider gating for codebase analysis looks correct.

Checks feature flag first, then provider against CLAUDE_CODE/GEMINI_CLI.


603-607: Getter and exports for the flag are consistent.

Public API surface is coherent.

Also applies to: 1066-1068

tests/unit/config-manager.test.js (1)

148-150: Default config updated with enableCodebaseAnalysis: true — OK.

Keeps tests aligned with new defaults.

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

80-81: Session-aware hasCodebaseAnalysis wiring looks correct.

Passing (research, projectRoot, session) aligns with the new API and keeps this adaptor thin.

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

429-434: Good: session passed to hasCodebaseAnalysis.

Matches the new three-arg signature and keeps prompt params consistent across modules.

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

459-463: Good: session-aware hasCodebaseAnalysis usage.

Stores the boolean before passing into prompt params; clear and consistent.

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

439-444: Good: session forwarded to hasCodebaseAnalysis.

Keeps feature gating consistent with other flows.

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

461-466: Good: prompt params now use session-aware hasCodebaseAnalysis.

Aligned with unified config-manager API.

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

235-239: Session-aware gating passed correctly to hasCodebaseAnalysis.

Using the three-arg form with session aligns with the new API and keeps prompt construction provider- and session-aware.


235-241: No await needed for hasCodebaseAnalysis
It’s defined as a synchronous function returning a boolean, so no precompute or await is required.

Likely an incorrect or invalid review comment.

.changeset/sour-coins-lay.md (2)

7-11: Confirm env-var config doesn’t conflict with prior guidance.

Past guidance suggests preferring .taskmaster/config.json over env vars for user config. If this env var is an exception, reference and update the docs accordingly.


2-2: No changes needed: package name matches package.json

Comment on lines +5 to +11
Add configurable codebase analysis feature flag with multiple configuration sources

Users can now control whether codebase analysis features (Claude Code and Gemini CLI integration) are enabled through environment variables, MCP configuration, or project config files.

Priority order: .env > MCP session env > .taskmaster/config.json.

Set `TASKMASTER_ENABLE_CODEBASE_ANALYSIS=false` in `.env` to disable codebase analysis prompts and tool integration.

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)

Condense to a single user-facing summary per guidelines.

Changesets should have a concise, one-line, imperative summary; move details to docs/PR.

Apply:

--- 
 "task-master-ai": minor
 ---
 
-Add configurable codebase analysis feature flag with multiple configuration sources
-
-Users can now control whether codebase analysis features (Claude Code and Gemini CLI integration) are enabled through environment variables, MCP configuration, or project config files.
-
-Priority order: .env > MCP session env > .taskmaster/config.json.
-
-Set `TASKMASTER_ENABLE_CODEBASE_ANALYSIS=false` in `.env` to disable codebase analysis prompts and tool integration.
+Add optional codebase-analysis feature flag with precedence: .env > MCP session env > .taskmaster/config.json.
📝 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
Add configurable codebase analysis feature flag with multiple configuration sources
Users can now control whether codebase analysis features (Claude Code and Gemini CLI integration) are enabled through environment variables, MCP configuration, or project config files.
Priority order: .env > MCP session env > .taskmaster/config.json.
Set `TASKMASTER_ENABLE_CODEBASE_ANALYSIS=false` in `.env` to disable codebase analysis prompts and tool integration.
---
"task-master-ai": minor
---
Add optional codebase-analysis feature flag with precedence: .env > MCP session env > .taskmaster/config.json.
🧰 Tools
🪛 LanguageTool

[grammar] ~5-~5: There might be a mistake here.
Context: ...flag with multiple configuration sources Users can now control whether codebase a...

(QB_NEW_EN_OTHER)


[grammar] ~7-~7: Use correct spacing
Context: ... configuration, or project config files. Priority order: .env > MCP session env >...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: Use correct spacing
Context: ...P session env > .taskmaster/config.json. Set `TASKMASTER_ENABLE_CODEBASE_ANALYSIS...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 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
.changeset/sour-coins-lay.md around lines 5 to 11: The changeset contains a
multi-sentence explanation and implementation details; condense it to a single,
one-line imperative user-facing summary (e.g., "Add configurable codebase
analysis feature flag") and move the rest of the details (priority order, env
var name, usage) into the PR description or project docs/CHANGELOG for
reference.

Comment on lines +438 to +458
function isCodebaseAnalysisEnabled(session = null, projectRoot = null) {
// Priority 1: Environment variable
const envFlag = resolveEnvVariable(
'TASKMASTER_ENABLE_CODEBASE_ANALYSIS',
session,
projectRoot
);
if (envFlag !== null && envFlag !== undefined && envFlag !== '') {
return envFlag.toLowerCase() === 'true' || envFlag === '1';
}

// Priority 2: MCP session environment
if (session?.env?.TASKMASTER_ENABLE_CODEBASE_ANALYSIS) {
const mcpFlag = session.env.TASKMASTER_ENABLE_CODEBASE_ANALYSIS;
return mcpFlag.toLowerCase() === 'true' || mcpFlag === '1';
}

// Priority 3: Configuration file
const globalConfig = getGlobalConfig(projectRoot);
return globalConfig.enableCodebaseAnalysis !== false; // Default to true
}

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)

Minor: dedupe env precedence logic.

resolveEnvVariable already considers process.env, session.env, and .env. The explicit session.env check is redundant.

Apply:

-  const envFlag = resolveEnvVariable('TASKMASTER_ENABLE_CODEBASE_ANALYSIS', session, projectRoot);
-  if (envFlag !== null && envFlag !== undefined && envFlag !== '') {
-    return envFlag.toLowerCase() === 'true' || envFlag === '1';
-  }
-
-  if (session?.env?.TASKMASTER_ENABLE_CODEBASE_ANALYSIS) {
-    const mcpFlag = session.env.TASKMASTER_ENABLE_CODEBASE_ANALYSIS;
-    return mcpFlag.toLowerCase() === 'true' || mcpFlag === '1';
-  }
+  const envFlag = resolveEnvVariable('TASKMASTER_ENABLE_CODEBASE_ANALYSIS', session, projectRoot);
+  if (envFlag !== null && envFlag !== undefined && envFlag !== '') {
+    const v = String(envFlag).toLowerCase();
+    return v === 'true' || v === '1';
+  }
📝 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
function isCodebaseAnalysisEnabled(session = null, projectRoot = null) {
// Priority 1: Environment variable
const envFlag = resolveEnvVariable(
'TASKMASTER_ENABLE_CODEBASE_ANALYSIS',
session,
projectRoot
);
if (envFlag !== null && envFlag !== undefined && envFlag !== '') {
return envFlag.toLowerCase() === 'true' || envFlag === '1';
}
// Priority 2: MCP session environment
if (session?.env?.TASKMASTER_ENABLE_CODEBASE_ANALYSIS) {
const mcpFlag = session.env.TASKMASTER_ENABLE_CODEBASE_ANALYSIS;
return mcpFlag.toLowerCase() === 'true' || mcpFlag === '1';
}
// Priority 3: Configuration file
const globalConfig = getGlobalConfig(projectRoot);
return globalConfig.enableCodebaseAnalysis !== false; // Default to true
}
function isCodebaseAnalysisEnabled(session = null, projectRoot = null) {
// Priority 1: Environment variable
const envFlag = resolveEnvVariable(
'TASKMASTER_ENABLE_CODEBASE_ANALYSIS',
session,
projectRoot
);
if (envFlag !== null && envFlag !== undefined && envFlag !== '') {
const v = String(envFlag).toLowerCase();
return v === 'true' || v === '1';
}
// Priority 3: Configuration file
const globalConfig = getGlobalConfig(projectRoot);
return globalConfig.enableCodebaseAnalysis !== false; // Default to true
}
🤖 Prompt for AI Agents
In scripts/modules/config-manager.js around lines 438 to 458, the function
duplicates environment precedence by checking session.env after calling
resolveEnvVariable which already inspects process.env, session.env and .env;
remove the explicit session.env branch and rely solely on resolveEnvVariable for
priority 1, then fall back to the global config check as currently implemented
(i.e., delete the if (session?.env?.TASKMASTER_ENABLE_CODEBASE_ANALYSIS) block
and return the resolved envFlag result when present, otherwise use
globalConfig.enableCodebaseAnalysis !== false).

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