Skip to content

feat: Add Snowflake as AI Provider for Task Master (external SDK provider)#1496

Closed
sfc-gh-dflippo wants to merge 10 commits intoeyaltoledano:nextfrom
sfc-gh-dflippo:feat-Add-Snowflake-Provider-for-Task-Master
Closed

feat: Add Snowflake as AI Provider for Task Master (external SDK provider)#1496
sfc-gh-dflippo wants to merge 10 commits intoeyaltoledano:nextfrom
sfc-gh-dflippo:feat-Add-Snowflake-Provider-for-Task-Master

Conversation

@sfc-gh-dflippo
Copy link

@sfc-gh-dflippo sfc-gh-dflippo commented Dec 9, 2025

Updated PR with dependency on

"@sfc-gh-dflippo/ai-sdk-provider-snowflake": "github:sfc-gh-dflippo/ai-sdk-provider-snowflake#v0.1.0",

What type of PR is this?

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

Description

Adds Snowflake as AI Provider for Task Master

Related Issues

Fixes #1484

How to Test This

Option 1: Cortex Code CLI PrPr (No API Keys)

# Configure Snowflake connection
cat > ~/.snowflake/config.toml << EOF
[connections.default]
account = "xyz12345"
user = "your.name@company.com"
password = "your-personal-access-token"
EOF

# Set Task Master model
task-master models --set-main cortex/claude-sonnet-4-5

# Use normally - authentication is automatic
task-master add-task --prompt="Implement user authentication"

Option 2: REST API with Key Pair PuPr

export SNOWFLAKE_ACCOUNT="xyz12345"
export SNOWFLAKE_USER="your.name@company.com"
export SNOWFLAKE_PRIVATE_KEY_PATH="/path/to/rsa_key.p8"

task-master models --set-main cortex/claude-sonnet-4-5
task-master add-task --prompt="Implement user authentication"

Expected result:
Able to execute task-master CLI and MCP commands while utilizing Snowflake Cortex as a provider

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

Adds Snowflake as AI Provider for Task Master


For Maintainers

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

Summary by CodeRabbit

  • New Features

    • Added Snowflake as an AI provider (Claude & OpenAI models) and a new Cortex Code CLI profile.
  • Documentation

    • Added Snowflake provider guide, configuration samples, API key docs, and Task Master command/workflow guides.
  • Tests

    • Added unit and integration tests covering Snowflake provider behavior, models, modes, streaming, concurrency, and error cases.
  • Chores

    • Added Snowflake dependency, updated supported models list, and env/config examples.

✏️ Tip: You can customize this high-level summary in your review settings.

…n and configuration

- Bump version to 0.37.2-rc.0
- Add Snowflake API key requirements in README and configuration docs
- Add SnowflakeProvider for REST API and CLI integration
- Update package.json and package-lock.json to include Snowflake dependency
- Add documentation for Snowflake integration and usage
- Add tests for Snowflake provider functionality and error handling
@changeset-bot
Copy link

changeset-bot bot commented Dec 9, 2025

🦋 Changeset detected

Latest commit: 549f84d

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
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

Adds Snowflake (Cortex) as a new AI provider: provider implementation and export, SDK dependency, provider registration and config (SNOWFLAKE_API_KEY / SNOWFLAKE_BASE_URL), supported-models entries, a Cortex profile, docs/examples, and unit/integration tests.

Changes

Cohort / File(s) Summary
Snowflake provider code & export
src/ai-providers/snowflake.js, src/ai-providers/index.js, package.json
New SnowflakeProvider class (auth, client creation, model support), re-exports createSnowflake, and adds @sfc-gh-dflippo/ai-sdk-provider-snowflake dependency.
Provider registration & runtime config
scripts/modules/ai-services-unified.js, scripts/modules/config-manager.js, scripts/modules/supported-models.json
Registers Snowflake in provider registry, adds getSnowflakeBaseURL, maps SNOWFLAKE_API_KEY, marks Snowflake in providersWithoutApiKeys, and adds 8 Snowflake model entries.
Profiles and constants
src/profiles/cortex.js, src/profiles/index.js, src/constants/profiles.js, packages/tm-core/src/common/constants/providers.ts
Adds cortex rules profile and export, introduces CUSTOM_PROVIDERS.SNOWFLAKE, and updates RULE_PROFILES.
Docs & examples
README.md, docs/configuration.md, docs/providers/snowflake.md, apps/docs/getting-started/api-keys.mdx, assets/cortex-skills/*, assets/env.example
New and updated documentation for Snowflake auth, env vars (SNOWFLAKE_API_KEY, SNOWFLAKE_BASE_URL), MCP examples, Cortex skills docs, and env example.
Tests — unit & integration
tests/unit/ai-providers/snowflake.test.js, tests/unit/ai-services-unified.test.js, tests/unit/profiles/rule-transformer.test.js, tests/integration/providers/temperature-support.test.js, tests/integration/snowflake-optional.test.js, tests/integration/profiles/hamster-rules-distribution.test.js
Adds unit tests for SnowflakeProvider (mocks), integrates Snowflake in unified tests, updates profile expectations, adds a gated real-integration suite, and extends provider temperature tests.
Changeset
.changeset/clean-laws-glow.md
Changeset entry bumping @tm/ai-sdk-provider-snowflake and task-master-ai to minor versions.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Task Master CLI / Runtime
    participant Config as ConfigManager
    participant Provider as SnowflakeProvider
    participant SDK as ai-sdk-provider-snowflake
    participant Snowflake as Cortex (REST/CLI)

    Client->>Config: resolve provider config & baseURL (SNOWFLAKE_BASE_URL)
    Client->>Provider: request client / generate with model & params
    Provider->>Config: getSnowflakeBaseURL & auth status
    Provider->>SDK: createSnowflake(executionMode, creds, baseURL, options)
    SDK->>Snowflake: call REST endpoint or invoke Cortex Code CLI
    Snowflake-->>SDK: inference / streaming / structured output
    SDK-->>Provider: response (stream or result)
    Provider-->>Client: normalized result (structured/text/stream)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing extra attention:
    • auth / executionMode handling in src/ai-providers/snowflake.js and scripts/modules/config-manager.js
    • provider registration and baseURL fallback in scripts/modules/ai-services-unified.js
    • consistency between supported-models.json entries and provider model-normalization checks
    • integration test gating and mocked expectations in unit tests
    • cortex profile behavior and MCP disabling in profile-related tests

Possibly related PRs

Suggested reviewers

  • Crunchyman-ralph
  • eyaltoledano

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding Snowflake as an AI provider for Task Master with an external SDK provider package.
Linked Issues check ✅ Passed All major requirements from issue #1484 are met: Snowflake provider implementation, three execution modes (REST, CLI, Auto), authentication support, configuration, supported models, and comprehensive testing.
Out of Scope Changes check ✅ Passed All changes are directly related to Snowflake provider integration. Minor additions (Cortex profile, temperature support test) are reasonable supporting changes for the feature.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sfc-gh-dflippo
Copy link
Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (10)
scripts/modules/supported-models.json (1)

1247-1296: Consider adding swe_score and cost_per_1m_tokens fields for consistency.

The Snowflake model entries are missing swe_score and cost_per_1m_tokens fields that are present in most other providers. According to coding guidelines, these should be included (though optional).

Recommendation:

  • If SWE benchmark scores are unavailable for Snowflake Cortex models, set "swe_score": null explicitly
  • If cost information is not available or not applicable (e.g., enterprise billing), set "cost_per_1m_tokens": null explicitly
  • This makes the intent clear and follows the pattern used by other providers (e.g., google provider has some models with "cost_per_1m_tokens": null)

Example for one model:

 {
   "id": "cortex/claude-sonnet-4-5",
+  "swe_score": null,
+  "cost_per_1m_tokens": null,
   "max_tokens": 64000,
   "allowed_roles": ["main", "fallback", "research"],
   "supported": true
 }
docs/providers/snowflake.md (1)

1-196: Excellent comprehensive integration guide!

This Snowflake Provider Integration Guide is well-structured and thorough:

  • Clear quick start instructions
  • Multiple authentication methods documented
  • Comprehensive model support tables with structured output indicators
  • Configuration examples (both basic and advanced)
  • Troubleshooting section with practical solutions
  • Security best practices
  • Links to official Snowflake documentation

The guide provides everything users need to successfully integrate Snowflake Cortex with Task Master.

Optional formatting improvement:
The static analysis tool flagged lines 9 and 19 where bold text is used for section headers. While this works, using proper heading syntax would be more semantic:

-**Option A: Environment Variables (Recommended)**
+#### Option A: Environment Variables (Recommended)

-**Option B: Connection Profile**
+#### Option B: Connection Profile

This is purely a markdown style nitpick and doesn't affect functionality.

assets/cortex-skills/taskmaster-commands/SKILL.md (1)

1-634: Excellent comprehensive command reference documentation!

This Task Master command reference is exceptionally thorough and well-organized:

  • Covers all 32 MCP tools and corresponding CLI commands
  • Organized into logical sections (Initialization, Task Management, Dependencies, Analysis, etc.)
  • Each command includes: tool name, CLI equivalent, description, parameters, usage guidance
  • Important notes about AI processing times for operations that can take up to a minute
  • Clear distinction between MCP and CLI usage patterns
  • Tagged task lists support documented throughout
  • Practical usage examples and warnings (e.g., research tool usage patterns)

The documentation provides Cortex Code users with a complete reference for all Task Master capabilities.

Note on static analysis:
The markdown linter flagged list indentation inconsistencies (MD007) throughout the file. These are stylistic and don't affect functionality or readability. If you want to address them for consistency:

  • Change 4-space indentation to 2-space for nested list items
  • Example: Line 36 onwards (Key CLI Options section)

This is entirely optional as the current formatting is clear and functional.

tests/unit/ai-services-unified.test.js (1)

155-161: isRequiredApiKey mock returns true, but actual provider returns false.

The mock returns true for isRequiredApiKey(), but src/ai-providers/snowflake.js returns false (since Snowflake supports key pair auth and CLI fallback). This inconsistency may cause tests to behave differently from production.

 const mockSnowflakeProvider = {
 	generateText: jest.fn(),
 	streamText: jest.fn(),
 	generateObject: jest.fn(),
 	getRequiredApiKeyName: jest.fn(() => 'SNOWFLAKE_API_KEY'),
-	isRequiredApiKey: jest.fn(() => true)
+	isRequiredApiKey: jest.fn(() => false)
 };
assets/cortex-skills/taskmaster-workflow/SKILL.md (1)

162-174: Add language specifier to fenced code block.

The project structure code block should have a language specifier for consistency and proper rendering. Per static analysis hint (MD040).

-```
+```text
 project/
 ├── .taskmaster/
 │   ├── tasks/
src/ai-providers/snowflake.js (2)

28-29: Package name mismatch in comment.

The comment references @tm/ai-sdk-provider-snowflake, but the actual import at line 19-23 uses @sfc-gh-dflippo/ai-sdk-provider-snowflake.

 /**
- * Snowflake provider - thin wrapper around @tm/ai-sdk-provider-snowflake
+ * Snowflake provider - thin wrapper around @sfc-gh-dflippo/ai-sdk-provider-snowflake
  */

49-59: Add error handling to validateAuth.

The validateAuth method delegates to validateCredentials but lacks try/catch error handling. If the SDK function throws, the error will propagate unhandled. Per coding guidelines, provider functions must include basic try/catch error handling.

 async validateAuth(params) {
+	try {
 		const result = await validateCredentials({
 			connection: params.connection || 'default',
 			apiKey: params.apiKey,
 			baseURL: params.baseURL
 		});

 		if (!result.rest && result.cli) {
 			log('debug', 'REST API auth not available, will use Cortex Code CLI');
 		}
+	} catch (error) {
+		log('warn', `Snowflake auth validation failed: ${error.message}`);
+		throw error;
+	}
 }
tests/integration/snowflake-optional.test.js (2)

450-468: CLI mode test has a catch-all that may hide real failures.

The CLI mode test catches any error and treats it as acceptable. This could mask genuine bugs if CLI mode is actually expected to work but fails for unexpected reasons.

Consider being more specific about expected error types when CLI is not installed:

 			try {
 				await testBasicGeneration(cliClient, TEST_MODELS.claude);
 				expect(true).toBe(true); // CLI works
 			} catch (error) {
-				// Expected if CLI not installed or not working properly
-				// Accept any error as CLI mode is optional
-				console.log('🔍 CLI error (expected):', error.message.substring(0, 100));
-				expect(error).toBeDefined();
+				// Skip if CLI not installed, but fail for other unexpected errors
+				const isCliNotInstalled = error.message.includes('not found') || 
+					error.message.includes('not installed') ||
+					error.message.includes('command not found');
+				if (!isCliNotInstalled) {
+					console.warn('🔍 Unexpected CLI error:', error.message.substring(0, 100));
+				}
+				expect(error).toBeDefined();
 			}

520-542: The invalid maxTokens test doesn't actually validate error handling.

This test accepts both success and failure outcomes, which means it will never fail. If the goal is to document API behavior rather than enforce it, consider adding a comment or converting to a skip-able test.

If the API behavior is known to be lenient, consider documenting this more explicitly or removing the test:

 		it(
-			'throws for invalid maxTokens',
+			'handles invalid maxTokens (API may be lenient)',
 			async () => {
 				const provider = new SnowflakeProvider({ executionMode: 'rest' });
 				const client = provider.getClient();
 				
-				// Note: Some AI APIs may accept negative maxTokens and ignore them
-				// This test verifies error handling, but may pass if API is lenient
 				try {
 					const result = await generateText({
 						model: client(TEST_MODELS.claude),
 						messages: [{ role: 'user', content: 'Test' }],
 						maxTokens: -1
 					});
-					// If API accepts it, at least verify we got a response
+					// API accepted invalid value - document this behavior
+					console.log('⚠️ API accepted negative maxTokens');
 					expect(result.text).toBeDefined();
 				} catch (error) {
-					// If it throws, that's also acceptable
-					expect(error).toBeDefined();
+					// Expected: API rejected invalid value
+					expect(error.message).toMatch(/max|token|invalid/i);
 				}
 			},
tests/unit/ai-providers/snowflake.test.js (1)

231-238: This test doesn't exercise the provider's method.

This test validates standalone mapping logic rather than the provider's getSupportedModels method. Consider removing it or replacing with a test that actually uses the provider with string-only models in the mock.

If you want to test string model handling, modify the mock to return strings and test the provider:

-		it('should handle string models (not objects)', () => {
-			// Test via the mapping logic - if model is string, return as-is
-			const stringModels = ['cortex/model-a', 'cortex/model-b'];
-			const mapped = stringModels.map((m) =>
-				typeof m === 'object' ? m.id : m
-			);
-			expect(mapped).toEqual(['cortex/model-a', 'cortex/model-b']);
-		});
+		it('should handle string models (not objects)', async () => {
+			// Re-import with string-only mock
+			const { getSupportedModelsForProvider } = await import(
+				'../../../scripts/modules/config-manager.js'
+			);
+			getSupportedModelsForProvider.mockReturnValueOnce([
+				'cortex/model-a',
+				'cortex/model-b'
+			]);
+			const stringProvider = new SnowflakeProvider();
+			expect(stringProvider.getSupportedModels()).toEqual([
+				'cortex/model-a',
+				'cortex/model-b'
+			]);
+		});

…d-models.json

- Introduced SWE scores and cost per 1M tokens for several models including Claude and OpenAI GPT variants.
- Changed section headers for Environment Variables and Connection Profile to use a more prominent heading style.
…tegration tests

- Enhanced console log formatting for better clarity.
- Refactored message structures for consistency in test cases.
- Improved error handling for CLI-related issues and invalid maxTokens scenarios.
- Included 'SNOWFLAKE' as a new entry in the CUSTOM_PROVIDERS constant.
- Introduced a mock function for getSupportedModelsForProvider to streamline test cases.
- Updated tests to reset the mock and validate behavior with string-only models.
- Improved clarity and maintainability of the test suite for the SnowflakeProvider.
- Changed isRequiredApiKey mock function to return false, reflecting updated requirements for API key validation.
- Ensured consistency in test scenarios for the SnowflakeProvider.
…ved authentication handling

- Added comprehensive JSDoc comments for methods and class, improving clarity on usage and parameters.
- Enhanced the validateAuth method to include error logging for authentication failures.
- Updated the SnowflakeProvider class to support multiple execution modes and improved client configuration options.
@sfc-gh-dflippo
Copy link
Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46151ff and 30f1053.

📒 Files selected for processing (7)
  • docs/providers/snowflake.md (1 hunks)
  • packages/tm-core/src/common/constants/providers.ts (1 hunks)
  • scripts/modules/supported-models.json (1 hunks)
  • src/ai-providers/snowflake.js (1 hunks)
  • tests/integration/snowflake-optional.test.js (1 hunks)
  • tests/unit/ai-providers/snowflake.test.js (1 hunks)
  • tests/unit/ai-services-unified.test.js (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/unit/ai-providers/snowflake.test.js
  • tests/unit/ai-services-unified.test.js
  • tests/integration/snowflake-optional.test.js
  • docs/providers/snowflake.md
🧰 Additional context used
📓 Path-based instructions (8)
scripts/modules/supported-models.json

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

Update scripts/modules/supported-models.json to add a new provider key with an array of model objects, each containing id, name (optional), swe_score, cost_per_1m_tokens (optional), allowed_roles, and max_tokens (optional but recommended)

Files:

  • scripts/modules/supported-models.json
scripts/modules/**/*

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

Restart the MCP server if core logic in scripts/modules or MCP tool definitions change

Files:

  • scripts/modules/supported-models.json
**/*.ts

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

TypeScript test files must achieve minimum code coverage thresholds: 80% lines/functions and 70% branches globally, 90% for utilities, and 85% for middleware; new features must meet or exceed these thresholds

Files:

  • packages/tm-core/src/common/constants/providers.ts
**/*.{js,ts}

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

**/*.{js,ts}: Import and use specific getters from config-manager.js (e.g., getMainProvider(), getLogLevel(), getMainMaxTokens()) to access configuration values needed for application logic
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before potentially attempting an AI call
Do not add direct console.log calls outside the logging utility - use the central log function instead
Ensure silent mode is disabled in a finally block to prevent it from staying enabled
Do not access the global silentMode variable directly - use the exported silent mode control functions instead
Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Use ContextGatherer class from utils/contextGatherer.js for AI-powered commands that need project context, supporting tasks, files, custom text, and project tree context
Use FuzzyTaskSearch class from utils/fuzzyTaskSearch.js for automatic task relevance detection with configurable search parameters
Use fuzzy search to supplement user-provided task IDs and display discovered task IDs to users for transparency
Do not replace explicit user task selections with fuzzy results - fuzzy search should supplement, not replace user selections
Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync
Include error handling for JSON file operations and validate JSON structure after reading
Use path.join() for cross-platform path construction and path.resolve() for absolute paths, validating paths before file operations
Support both .env files and MCP session environment for environment variable resolution with fallbacks for missing values
Prefer updating the core function to accept an outputFormat parameter and check outputFormat === 'json' before displaying UI elements

Files:

  • packages/tm-core/src/common/constants/providers.ts
  • src/ai-providers/snowflake.js
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Import modules with .js extension even in TypeScript source files for ESM compatibility

Files:

  • packages/tm-core/src/common/constants/providers.ts
src/ai-providers/*.js

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

src/ai-providers/*.js: Create a new provider module in src/ai-providers/<provider-name>.js that implements generate<ProviderName>Text, stream<ProviderName>Text, and generate<ProviderName>Object functions using the Vercel AI SDK
Provider modules in src/ai-providers/ must import generateText, streamText, generateObject from the ai package, the provider's create<ProviderName> function from @ai-sdk/<provider-name>, and the log utility from ../../scripts/modules/utils.js
Provider functions must include basic validation and try/catch error handling

src/ai-providers/*.js files should contain provider-specific wrappers for Vercel AI SDK functions and interact directly with Vercel AI SDK adapters

Files:

  • src/ai-providers/snowflake.js
**/*.js

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

**/*.js: Always use isSilentMode() function to check current silent mode status instead of directly accessing the global silentMode variable or global.silentMode
Use try/finally block pattern when wrapping core function calls with enableSilentMode/disableSilentMode to ensure silent mode is always restored, even if errors occur
For functions that need to handle both a passed silentMode parameter and check global state, check both the function parameter and global state: const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode())
Functions should accept their dependencies as parameters rather than using globals to promote testability and explicit dependency injection
Define callbacks as separate functions for easier testing rather than inline functions

Files:

  • src/ai-providers/snowflake.js
**/*.{js,jsx}

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

JavaScript test files using Jest must follow the same testing patterns as TypeScript files, include proper mocking of external dependencies, and achieve the same coverage thresholds

Files:

  • src/ai-providers/snowflake.js
🧠 Learnings (16)
📓 Common learnings
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: To add a new AI provider with official Vercel AI SDK support, install the provider package via `npm install ai-sdk/<provider-name>`
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module in `src/ai-providers/<provider-name>.js` that implements `generate<ProviderName>Text`, `stream<ProviderName>Text`, and `generate<ProviderName>Object` functions using the Vercel AI SDK
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to **/*.md : Update relevant documentation (like `README.md`) mentioning supported providers or configuration when adding a new AI provider
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/supported-models.json : Update `scripts/modules/supported-models.json` to add a new provider key with an array of model objects, each containing `id`, `name` (optional), `swe_score`, `cost_per_1m_tokens` (optional), `allowed_roles`, and `max_tokens` (optional but recommended)

Applied to files:

  • scripts/modules/supported-models.json
📚 Learning: 2025-07-21T14:14:48.694Z
Learnt from: rtmcrc
Repo: eyaltoledano/claude-task-master PR: 933
File: scripts/modules/supported-models.json:238-238
Timestamp: 2025-07-21T14:14:48.694Z
Learning: Model version updates in scripts/modules/supported-models.json may be included in feature PRs if they provide practical improvements like reduced error rates, even if not directly related to the main feature being implemented.

Applied to files:

  • scripts/modules/supported-models.json
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, the supported models list is auto-generated by CI into docs/models.md from scripts/modules/supported-models.json via .github/workflows/update-models-md.yml and docs/scripts/models-json-to-markdown.js. Don’t request manual edits to the Markdown; ensure the JSON is correct instead.

Applied to files:

  • scripts/modules/supported-models.json
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: In this repo, supported-models.md is auto-generated by CI from supported-models.json; do not request manual edits to that file—ensure JSON entries are correct instead.

Applied to files:

  • scripts/modules/supported-models.json
📚 Learning: 2025-08-08T11:34:45.482Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: .changeset/vast-weeks-fetch.md:5-5
Timestamp: 2025-08-08T11:34:45.482Z
Learning: This repo’s supported models list is CI-generated into docs/models.md from scripts/modules/supported-models.json (workflow: .github/workflows/update-models-md.yml using docs/scripts/models-json-to-markdown.js). Don’t request manual edits to the Markdown; ensure the JSON is correct instead. README links to docs/models.md.

Applied to files:

  • scripts/modules/supported-models.json
📚 Learning: 2025-08-08T11:33:15.297Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.

Applied to files:

  • scripts/modules/supported-models.json
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/ai-services-unified.js : In `scripts/modules/ai-services-unified.js`, import new providers and add entries to the `PROVIDER_FUNCTIONS` map with `generateText`, `streamText`, and `generateObject` properties

Applied to files:

  • scripts/modules/supported-models.json
  • packages/tm-core/src/common/constants/providers.ts
  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/config-manager.js : In `scripts/modules/config-manager.js`, update `MODEL_MAP` to include the new provider, ensure `VALID_PROVIDERS` includes the provider, update API key handling in `keyMap` and the `switch` statement in `getMcpApiKeyStatus` and `isApiKeySet`

Applied to files:

  • scripts/modules/supported-models.json
  • packages/tm-core/src/common/constants/providers.ts
  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module in `src/ai-providers/<provider-name>.js` that implements `generate<ProviderName>Text`, `stream<ProviderName>Text`, and `generate<ProviderName>Object` functions using the Vercel AI SDK

Applied to files:

  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider modules in `src/ai-providers/` must import `generateText`, `streamText`, `generateObject` from the `ai` package, the provider's `create<ProviderName>` function from `ai-sdk/<provider-name>`, and the `log` utility from `../../scripts/modules/utils.js`

Applied to files:

  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to src/ai-providers/*.js : src/ai-providers/*.js files should contain provider-specific wrappers for Vercel AI SDK functions and interact directly with Vercel AI SDK adapters

Applied to files:

  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: To add a new AI provider with official Vercel AI SDK support, install the provider package via `npm install ai-sdk/<provider-name>`

Applied to files:

  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling

Applied to files:

  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider functions must include basic validation and try/catch error handling

Applied to files:

  • src/ai-providers/snowflake.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to scripts/modules/ai-services-unified.js : ai-services-unified.js should export generateTextService and generateObjectService, handle provider/model selection based on role and .taskmasterconfig, resolve API keys, implement fallback and retry logic, and orchestrate calls to provider-specific implementations

Applied to files:

  • src/ai-providers/snowflake.js
🧬 Code graph analysis (1)
src/ai-providers/snowflake.js (1)
src/ai-providers/base-provider.js (1)
  • BaseAIProvider (19-494)
🔇 Additional comments (8)
packages/tm-core/src/common/constants/providers.ts (1)

34-35: Verify companion changes in config-manager.js and ai-services-unified.js.

The SNOWFLAKE provider addition is correctly structured and follows the established pattern. The TypeScript types will automatically include the new provider via the mapped type definition.

Ensure the following companion changes are present:

  • scripts/modules/config-manager.js: Add SNOWFLAKE to VALID_PROVIDERS, update MODEL_MAP, keyMap, and add Snowflake cases to getMcpApiKeyStatus and isApiKeySet switch statements for handling key pair authentication.
  • scripts/modules/ai-services-unified.js: Add Snowflake entry to PROVIDER_FUNCTIONS map with generateText, streamText, and generateObject properties.
src/ai-providers/snowflake.js (7)

50-57: LGTM - Constructor follows standard provider pattern.

The constructor properly extends BaseAIProvider and initializes provider-specific configuration. Feature flags for structured outputs and temperature support are set based on the provider capabilities described in the PR objectives.


64-80: LGTM - Authentication configuration is correct.

The provider correctly indicates that API keys are not strictly required (isRequiredApiKey returns false) since Snowflake supports multiple authentication methods (key pair, CLI profiles), aligning with the flexible authentication approach described in the PR objectives.


124-131: LGTM - Client creation follows correct merge pattern.

The method properly merges constructor options with runtime parameters, with runtime params taking precedence, and ensures a sensible default ('auto') for executionMode.


141-166: LGTM - Model validation methods are well-implemented.

Both getSupportedModels and isModelSupported correctly handle model ID validation with proper normalization (case-insensitive, prefix handling) and support both string and object model configurations.


187-187: LGTM - Re-export provides convenient direct client access.

Re-exporting createSnowflake allows users to create clients directly when they need fine-grained control, which is a good API design pattern.


95-110: Verify external validateCredentials behavior and testing.

The validateAuth method delegates validation to validateCredentials from @sfc-gh-dflippo/ai-sdk-provider-snowflake. Ensure this external function properly validates both REST and CLI authentication methods, that its behavior is well-documented, and that adequate tests cover the fallback to CLI when REST API auth is unavailable.


1-27: Confirm accessibility and version of @sfc-gh-dflippo/ai-sdk-provider-snowflake

This file imports a provider from a private GitHub package; ensure downstream builds and contributors can install it.

  • Ensure the package is resolvable for all users: publish to npm (preferred) or provide a stable git URL/submodule and documented install steps.
  • Add/verify the dependency entry in package.json and a lockfile resolution (package-lock.yml / pnpm-lock.yaml / yarn.lock) that works for CI and local installs.
  • Document the package version (stable tag) and a migration plan/timeline to a public npm package or an official @ai-sdk/ package; if keeping private, include CI credentials/instruction for maintainers.

…d model specifications

- Renamed "Direct Token" to "Programmatic Access Token" for clarity.
- Added a new section on pricing for Task Master operations, including a detailed pricing table for various models.
- Included information on prompt caching and how costs are calculated.
- Expanded model specifications and availability by region for supported models.
@sfc-gh-dflippo
Copy link
Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
docs/providers/snowflake.md (1)

49-71: Clarify authentication method naming and prioritization.

The authentication section introduces a third method ("Programmatic Access Token" with SNOWFLAKE_API_KEY in the table, line 55), but the quick start and setup instructions only cover key pair and connection profile. The distinction between these approaches and when each is appropriate could be clearer. Also, verify that SNOWFLAKE_API_KEY is an actual supported authentication mechanism in the Snowflake provider implementation—this terminology differs from the key pair approach described earlier.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30f1053 and 8933955.

📒 Files selected for processing (1)
  • docs/providers/snowflake.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md

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

Update relevant documentation (like README.md) mentioning supported providers or configuration when adding a new AI provider

Files:

  • docs/providers/snowflake.md
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: To add a new AI provider with official Vercel AI SDK support, install the provider package via `npm install ai-sdk/<provider-name>`
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module in `src/ai-providers/<provider-name>.js` that implements `generate<ProviderName>Text`, `stream<ProviderName>Text`, and `generate<ProviderName>Object` functions using the Vercel AI SDK
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to **/*.md : Update relevant documentation (like `README.md`) mentioning supported providers or configuration when adding a new AI provider
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to src/ai-providers/*.js : src/ai-providers/*.js files should contain provider-specific wrappers for Vercel AI SDK functions and interact directly with Vercel AI SDK adapters
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to {.env.example,.cursor/mcp.json.example} : Add the new provider's API key to `.env.example` and to the `env` section for `taskmaster-ai` in `.cursor/mcp.json.example` with its placeholder value
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to **/*.md : Update relevant documentation (like `README.md`) mentioning supported providers or configuration when adding a new AI provider

Applied to files:

  • docs/providers/snowflake.md
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Task Master uses three roles for AI models: `main` (primary model for general tasks), `research` (model with web access when --research flag is used), and `fallback` (model used if primary fails). Each role is configured with a specific `provider:modelId` pair.

Applied to files:

  • docs/providers/snowflake.md
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Use the `models` MCP tool or the `task-master models` CLI command to manage AI configurations

Applied to files:

  • docs/providers/snowflake.md
📚 Learning: 2025-11-24T18:02:22.305Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/taskmaster.mdc:0-0
Timestamp: 2025-11-24T18:02:22.305Z
Learning: Applies to .taskmaster/config.json : The .taskmaster/config.json file stores AI model configuration (main, research, fallback models) managed via 'task-master models' command

Applied to files:

  • docs/providers/snowflake.md
📚 Learning: 2025-11-24T18:00:06.827Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-11-24T18:00:06.827Z
Learning: Applies to .taskmaster/config.json : Store non-API key settings like model selections and `MAX_TOKENS` in `.taskmaster/config.json`, managed via `task-master models` command, not environment variables

Applied to files:

  • docs/providers/snowflake.md
🪛 LanguageTool
docs/providers/snowflake.md

[grammar] ~128-~128: Use a hyphen to join words.
Context: ...window and output limits for Task Master supported models. For complete specifica...

(QB_NEW_EN_HYPHEN)

🔇 Additional comments (1)
docs/providers/snowflake.md (1)

1-274: Overall documentation structure is strong and well-aligned with provider integration guidelines.

The documentation provides comprehensive coverage of setup, authentication, pricing, model specifications, configuration, and troubleshooting. It correctly addresses the new Snowflake provider by documenting supported models, pricing details, and configuration examples. The structure and depth align well with the coding guideline to update documentation when adding new AI providers.

- Clarified authentication priority and security considerations for different methods.
- Improved formatting and consistency in model specifications and availability sections.
@Crunchyman-ralph
Copy link
Collaborator

Crunchyman-ralph commented Dec 10, 2025

Hey! Thanks for putting this together.
After discussing with the team, we've decided to pursue something similar internally that aligns closely with our flagship product (tryhamster.com). So we're going to pass on this one, but really appreciate you thinking of us!

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.

2 participants