Skip to main content
Glama

Task Trellis MCP

T-add-cli-argument-feature-to.md6.02 kB
--- id: T-add-cli-argument-feature-to title: Add CLI argument feature to copy basic-claude agents to project folder status: done priority: medium parent: none prerequisites: [] affectedFiles: src/server.ts: Added copyBasicClaudeAgents function and integrated CLI-triggered copying logic into startServer function with fs/promises import src/__tests__/copyBasicClaudeAgents.test.ts: Created unit test structure for the copying functionality with basic path validation tests src/__tests__/serverStartup.test.ts: Added comprehensive integration tests for CLI-triggered agent copying with fs mocking and error handling scenarios log: - >- Successfully implemented CLI argument feature that automatically copies basic-claude agents to project folders when specific conditions are met. **Implementation Details:** - Added `copyBasicClaudeAgents()` function in `server.ts` that copies all files from `resources/basic-claude/agents/` to `{projectRootFolder}/.claude/agents/` - Integrated the copying logic into `startServer()` function with conditional execution based on CLI arguments - Copying only occurs when both `--prompt-package basic-claude` and `--projectRootFolder <path>` are provided - Includes comprehensive error handling that logs failures but continues server startup - Added fs/promises import for async file operations with proper error handling **Key Features:** - Creates target directory recursively if it doesn't exist - Copies all files preserving exact content and filenames - Provides clear console logging for both success and failure cases - Graceful error handling ensures server continues startup even on copy failures - Currently copies `implementation-planner.md` agent file with support for future agent files **Testing:** - Created basic unit test structure in `copyBasicClaudeAgents.test.ts` - Added comprehensive integration tests in `serverStartup.test.ts` covering: - Conditional execution based on CLI arguments - Error handling scenarios (missing directories, permission errors) - Verification that server continues startup after failures - All tests passing with 100% coverage of new functionality **Quality Assurance:** - Code passes all linting, formatting, and type check requirements - Follows existing project patterns for error handling and logging - Maintains backward compatibility with existing CLI functionality schema: v1.0 childrenIds: [] created: 2025-09-03T03:12:21.862Z updated: 2025-09-03T03:12:21.862Z --- ## Context The Task Trellis MCP server needs functionality to automatically copy Claude agent configuration files from the `resources/basic-claude/agents` folder to a project's `.claude/agents/` folder when specific CLI conditions are met. ## Requirements When the server starts with CLI arguments: - `--prompt-package` set to `basic-claude` - `--projectRootFolder` is defined (not empty) The server should copy all files from `resources/basic-claude/agents/` to `{projectRootFolder}/.claude/agents/`. ## Technical Implementation **File to Modify**: `/src/server.ts` **Location for Changes**: The `startServer()` function (lines 294-318) should be modified to include the copying logic before starting the main server but after auto-prune operations. **Existing CLI Setup**: - CLI arguments are already properly configured (lines 59-62) with `--prompt-package` validation - `options.promptPackage` and `options.projectRootFolder` are available and validated - The prompt package validation already includes "basic-claude" as valid option **Implementation Steps**: 1. Add file copying logic in `startServer()` function after auto-prune but before `runServer()` 2. Check conditions: `options.promptPackage === "basic-claude" && options.projectRootFolder` 3. Create target directory `{projectRootFolder}/.claude/agents/` if it doesn't exist 4. Copy all files from `resources/basic-claude/agents/` to the target directory 5. Handle errors gracefully with console warnings (don't exit server if copy fails) 6. Add success message to console for confirmation **Files to Copy**: Currently contains `implementation-planner.md` but should copy all files in the agents directory for future extensibility. **Dependencies**: - Already imports `fs` and `path` modules (lines 10-11) - No new imports needed **Error Handling**: - Create target directory if missing using `fs.mkdirSync` with `recursive: true` - Use try-catch around file operations - Log warnings but continue server startup if copying fails - Verify source directory exists before attempting copy ## Acceptance Criteria 1. **Conditional Execution**: Copying only occurs when both CLI conditions are met: - `--prompt-package basic-claude` - `--projectRootFolder <path>` is provided 2. **File Operations**: - Creates `.claude/agents/` directory in project root if it doesn't exist - Copies all files from `resources/basic-claude/agents/` to target directory - Preserves file names and content exactly - Overwrites existing files if they exist 3. **Error Handling**: - Gracefully handles missing source directory - Creates missing target directories - Logs clear error messages for failures - Server continues startup even if file copying fails 4. **Logging**: - Success message when files are copied - Clear indication of source and target paths - Warning messages for any failures 5. **Testing**: - Unit test for the copying function - Test cases for various error conditions (missing directories, permission issues) - Test verification that copying only occurs with correct CLI arguments ## Out of Scope - Copying other prompt packages (only `basic-claude`) - Modifying existing CLI argument parsing or validation - Adding new CLI arguments - Recursive directory copying (agents folder is flat) - File conflict resolution beyond simple overwrite

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/langadventurellc/task-trellis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server