Skip to content

Conversation

@sebyx07
Copy link
Collaborator

@sebyx07 sebyx07 commented Jan 25, 2026

Summary

  • Added delete_coding_style() method to FileOperationsMixin for deleting coding-style.md
  • Added REST API endpoint DELETE /coding-style with DeleteCodingStyleResponse model
  • Added MCP tool delete_coding_style with DeleteCodingStyleResult response model
  • Added comprehensive unit tests for core functionality, MCP tools, and REST API endpoint
  • Updated CLAUDE.md documentation with new endpoint and tool

Implementation Details

This feature allows users to delete the generated coding-style.md file via both REST API and MCP tools. The file is automatically regenerated on the next planning phase if needed.

Test Results

All tests passing:

  • ✅ 4551 tests passed
  • ✅ ruff check & format passed
  • ✅ mypy type checking passed

Related Files

  • src/claude_task_master/core/state_file_ops.py - Core delete method
  • src/claude_task_master/mcp/tools.py - MCP tool implementation
  • src/claude_task_master/mcp/server.py - MCP tool wrapper
  • src/claude_task_master/api/models.py - REST API response model
  • src/claude_task_master/api/routes.py - REST API endpoint
  • tests/core/test_state_file_ops.py - Core tests
  • tests/mcp/test_tools_coding_style.py - MCP tests
  • tests/api/test_routes_status.py - API tests
  • CLAUDE.md - Documentation

🤖 Generated with Claude Task Master

Greptile Overview

Greptile Summary

Added API to delete the coding-style.md file from the state directory, allowing users to force regeneration when project conventions change.

Key Changes:

  • Core delete_coding_style() method in FileOperationsMixin returns boolean indicating if file existed
  • REST API DELETE /coding-style endpoint with proper error handling (404 for no task, 500 for errors)
  • MCP tool delete_coding_style with DeleteCodingStyleResult response model
  • Comprehensive test coverage: 3 core tests, 5 MCP tests, 4 API tests
  • Updated CLAUDE.md documentation with new endpoint and tool

Implementation:
The implementation follows existing patterns in the codebase with proper separation of concerns. The core method is simple and safe (just file deletion), the MCP tool wraps it with proper error handling, and the API endpoint follows REST conventions. The response models differ between API (file_existed) and MCP (deleted) but both convey the same information. All tests pass including ruff, mypy, and 4551 existing tests.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects simple, well-tested implementation with comprehensive test coverage (12 new tests), passing CI checks (4551 tests, ruff, mypy), proper error handling, and consistency with existing codebase patterns. The change is low-risk file deletion functionality with proper validation and documentation.
  • No files require special attention

Important Files Changed

Filename Overview
src/claude_task_master/core/state_file_ops.py Added simple delete_coding_style() method that removes coding-style.md file and returns boolean status
src/claude_task_master/mcp/tools.py Added DeleteCodingStyleResult model and delete_coding_style() MCP tool with proper error handling
src/claude_task_master/api/routes.py Added DELETE /coding-style endpoint with proper 404/500 error handling and response models
tests/core/test_state_file_ops.py Added 3 comprehensive tests covering file exists, not exists, and content clearing scenarios
tests/mcp/test_tools_coding_style.py Added 5 MCP tool tests covering no task, file exists/not exists, state manager integration, and idempotency
tests/api/test_routes_status.py Added 4 API endpoint tests covering success, file not exists, no task, and idempotent deletion

Sequence Diagram

sequenceDiagram
    participant User
    participant API as REST API/MCP
    participant StateManager
    participant FileSystem

    User->>API: DELETE /coding-style OR delete_coding_style()
    API->>StateManager: Check if state exists
    alt No active task
        StateManager-->>API: exists() = False
        API-->>User: 404 Error (REST) / Error Response (MCP)
    else Active task exists
        StateManager-->>API: exists() = True
        API->>StateManager: delete_coding_style()
        StateManager->>FileSystem: Check if coding-style.md exists
        alt File exists
            FileSystem-->>StateManager: File found
            StateManager->>FileSystem: unlink() - delete file
            FileSystem-->>StateManager: Deleted
            StateManager-->>API: Return True
            API-->>User: Success (file_existed/deleted=True)
        else File does not exist
            FileSystem-->>StateManager: File not found
            StateManager-->>API: Return False
            API-->>User: Success (file_existed/deleted=False)
        end
    end
    
    Note over User,FileSystem: File regenerated automatically on next planning phase
Loading

Context used:

  • Context from dashboard - CLAUDE.md (source)

sebyx07 and others added 7 commits January 24, 2026 23:42
Add a method to delete the coding-style.md file from the state directory.
This is needed to support the upcoming REST and MCP API endpoints for
deleting the coding style guide.

- Returns True if file was deleted, False if it didn't exist
- Follows the pattern of existing save/load methods
- Includes comprehensive tests for the new method

Co-Authored-By: Claude <noreply@anthropic.com>
Add DeleteCodingStyleResult response model and delete_coding_style()
tool function for MCP. This allows deleting the cached coding style
guide to force regeneration when project conventions change.

- Added DeleteCodingStyleResult Pydantic model with success, message,
  deleted, and error fields
- Added delete_coding_style() tool function following existing patterns
- Tool uses StateManager.delete_coding_style() from FileOperationsMixin
- Returns appropriate response for success, file not found, or errors

Co-Authored-By: Claude <noreply@anthropic.com>
Add MCP tool wrapper that exposes the delete_coding_style
functionality from the tools module. This allows MCP clients to
delete the cached coding-style.md file to force regeneration
when project conventions have changed.

- Add DeleteCodingStyleResult re-export for convenience
- Add delete_coding_style tool with state_dir parameter
- Follows existing tool wrapper pattern

Co-Authored-By: Claude <noreply@anthropic.com>
Add response model for the delete coding-style.md API endpoint:
- success: Whether the deletion operation succeeded
- message: Human-readable result message
- file_existed: Whether the file existed before deletion
- error: Error message if deletion failed

This follows the same pattern as other deletion response models
(TaskDeleteResponse, ClearMailboxResponse).

Co-Authored-By: Claude <noreply@anthropic.com>
Add REST API endpoint to delete the coding-style.md file from the state
directory. The endpoint is part of the info router and follows the same
patterns as other info endpoints.

- Add DeleteCodingStyleResponse model import
- Add DELETE /coding-style endpoint with proper error handling
- Update module docstring to document new endpoint
- Add 4 tests covering success, file not exists, no task, and idempotency

Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive test coverage for delete_coding_style MCP tool:
- Test when no task exists (returns error)
- Test when coding-style.md doesn't exist (success, deleted=false)
- Test when coding-style.md exists (success, deleted=true, file removed)
- Test with state manager saved coding style
- Test idempotency (deleting twice in a row)

All tests verify proper response model structure and file system changes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…CP tool to CLAUDE.md

- Adds documentation for REST endpoint DELETE /coding-style under File Operations section
- Adds documentation for MCP tool delete_coding_style under File Operations section
- Completes API documentation for coding style file deletion feature

Co-Authored-By: Claude <noreply@anthropic.com>
@sebyx07 sebyx07 added the claudetm PRs created by Claude Task Master label Jan 25, 2026
@sebyx07 sebyx07 merged commit 24f4416 into main Jan 25, 2026
9 checks passed
@sebyx07 sebyx07 deleted the claudetm/feat/delete-coding-style-api branch January 25, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudetm PRs created by Claude Task Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants