chore: Remove unused imports across modules

Removes unused import statements identified after the major refactoring of the AI service layer and other components. This cleanup improves code clarity and removes unnecessary dependencies.

Unused imports removed from:

- **`mcp-server/src/core/direct-functions/analyze-task-complexity.js`:**

    - Removed `path`

- **`mcp-server/src/core/direct-functions/complexity-report.js`:**

    - Removed `path`

- **`mcp-server/src/core/direct-functions/expand-all-tasks.js`:**

    - Removed `path`, `fs`

- **`mcp-server/src/core/direct-functions/generate-task-files.js`:**

    - Removed `path`

- **`mcp-server/src/core/direct-functions/parse-prd.js`:**

    - Removed `os`, `findTasksJsonPath`

- **`mcp-server/src/core/direct-functions/update-tasks.js`:**

    - Removed `isSilentMode`

- **`mcp-server/src/tools/add-task.js`:**

    - Removed `createContentResponse`, `executeTaskMasterCommand`

- **`mcp-server/src/tools/analyze.js`:**

    - Removed `getProjectRootFromSession` (as `projectRoot` is now required in args)

- **`mcp-server/src/tools/expand-task.js`:**

    - Removed `path`

- **`mcp-server/src/tools/initialize-project.js`:**

    - Removed `createContentResponse`

- **`mcp-server/src/tools/parse-prd.js`:**

    - Removed `findPRDDocumentPath`, `resolveTasksOutputPath` (logic moved or handled by `resolveProjectPaths`)

- **`mcp-server/src/tools/update.js`:**

    - Removed `getProjectRootFromSession` (as `projectRoot` is now required in args)

- **`scripts/modules/commands.js`:**

    - Removed `exec`, `readline`

    - Removed AI config getters (`getMainModelId`, etc.)

    - Removed MCP helpers (`getMcpApiKeyStatus`)

- **`scripts/modules/config-manager.js`:**

    - Removed `ZodError`, `readJSON`, `writeJSON`

- **`scripts/modules/task-manager/analyze-task-complexity.js`:**

    - Removed AI config getters (`getMainModelId`, etc.)

- **`scripts/modules/task-manager/expand-all-tasks.js`:**

    - Removed `fs`, `path`, `writeJSON`

- **`scripts/modules/task-manager/models.js`:**

    - Removed `VALID_PROVIDERS`

- **`scripts/modules/task-manager/update-subtask-by-id.js`:**

    - Removed AI config getters (`getMainModelId`, etc.)

- **`scripts/modules/task-manager/update-tasks.js`:**

    - Removed AI config getters (`getMainModelId`, etc.)

- **`scripts/modules/ui.js`:**

    - Removed `getDebugFlag`

- **`scripts/modules/utils.js`:**

    - Removed `ZodError`
This commit is contained in:
Eyal Toledano
2025-04-25 15:11:55 -04:00
parent 9b5c625bd0
commit 2654a252b9
26 changed files with 159 additions and 92 deletions

View File

@@ -2149,7 +2149,7 @@ These enhancements ensure the refactored file is robust, maintainable, and align
These enhancements ensure robust validation, unified service usage, and maintainable, predictable batch update behavior.
</info added on 2025-04-24T17:49:25.126Z>
## 42. Remove all unused imports [pending]
## 42. Remove all unused imports [done]
### Dependencies: None
### Description:
### Details:
@@ -2167,3 +2167,44 @@ These enhancements ensure robust validation, unified service usage, and maintain
### Details:
## 45. Add support for Bedrock provider with ai sdk and unified service [pending]
### Dependencies: None
### Description:
### Details:
<info added on 2025-04-25T19:03:42.584Z>
- Install the Bedrock provider for the AI SDK using your package manager (e.g., npm i @ai-sdk/amazon-bedrock) and ensure the core AI SDK is present[3][4].
- To integrate with your existing config manager, externalize all Bedrock-specific configuration (such as region, model name, and credential provider) into your config management system. For example, store values like region ("us-east-1") and model identifier ("meta.llama3-8b-instruct-v1:0") in your config files or environment variables, and load them at runtime.
- For credentials, leverage the AWS SDK credential provider chain to avoid hardcoding secrets. Use the @aws-sdk/credential-providers package and pass a credentialProvider (e.g., fromNodeProviderChain()) to the Bedrock provider. This allows your config manager to control credential sourcing via environment, profiles, or IAM roles, consistent with other AWS integrations[1].
- Example integration with config manager:
```js
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
// Assume configManager.get returns your config values
const region = configManager.get('bedrock.region');
const model = configManager.get('bedrock.model');
const bedrock = createAmazonBedrock({
region,
credentialProvider: fromNodeProviderChain(),
});
// Use with AI SDK methods
const { text } = await generateText({
model: bedrock(model),
prompt: 'Your prompt here',
});
```
- If your config manager supports dynamic provider selection, you can abstract the provider initialization so switching between Bedrock and other providers (like OpenAI or Anthropic) is seamless.
- Be aware that Bedrock exposes multiple models from different vendors, each with potentially different API behaviors. Your config should allow specifying the exact model string, and your integration should handle any model-specific options or response formats[5].
- For unified service integration, ensure your service layer can route requests to Bedrock using the configured provider instance, and normalize responses if you support multiple AI backends.
</info added on 2025-04-25T19:03:42.584Z>