Skip to content

feat: add mcpd config volumes clear command#253

Merged
peteski22 merged 1 commit intomainfrom
feature/config-volumes-clear
Mar 12, 2026
Merged

feat: add mcpd config volumes clear command#253
peteski22 merged 1 commit intomainfrom
feature/config-volumes-clear

Conversation

@peteski22
Copy link
Contributor

@peteski22 peteski22 commented Mar 9, 2026

Summary

  • Adds mcpd config volumes clear <server-name> --force command to clear all configured volume mappings for a server
  • Requires --force flag to prevent accidental deletion (consistent with env clear and args clear)
  • Follows existing patterns from sibling volume commands (set, remove, list)

Closes #199

Test plan

  • Unit tests for successful clear with --force
  • Unit test for error when --force is omitted
  • Unit test for server not found
  • Unit test for noop when server has no volumes
  • Unit tests for loader and upsert error paths
  • Full test suite passes (make test)
  • Linter passes (golangci-lint run --fix -v)

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a new CLI command to clear all volume mappings associated with a specified server.
    • Requires a mandatory --force flag as a safety mechanism to prevent accidental data loss.
    • Includes robust validation, error handling for missing servers and configuration issues, and comprehensive test coverage.

@peteski22 peteski22 requested a review from dni138 March 9, 2026 14:06
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3d553884-06c1-4ac4-a8a9-1b7293856c6f

📥 Commits

Reviewing files that changed from the base of the PR and between 3c3e4f6 and f6b9326.

📒 Files selected for processing (3)
  • cmd/config/volumes/clear.go
  • cmd/config/volumes/clear_test.go
  • cmd/config/volumes/cmd.go

Walkthrough

Adds a new CLI subcommand mcpd config volumes clear that removes all volume mappings for a specified server with a mandatory --force flag to prevent accidental data loss. Includes the command implementation, comprehensive test coverage, and registration within the volumes command hierarchy.

Changes

Cohort / File(s) Summary
Clear command implementation
cmd/config/volumes/clear.go, cmd/config/volumes/clear_test.go
Introduces the clear volumes command with a NewClearCmd function that validates input, enforces the --force guard, loads runtime context, fetches target server config, clears volumes via withVolumes transformation, upserts the updated server, and prints success output. Tests cover successful clearing with --force, destructive operation rejection without --force, missing server handling, empty volume noop scenarios, loader failures, and upsert error propagation.
Command registration
cmd/config/volumes/cmd.go
Registers NewClearCmd as a new subcommand in the volumes command, expanding available subcommands from [List, Remove, Set] to [Clear, List, Remove, Set].

Possibly related PRs

Suggested reviewers

  • agpituk
  • dpoulopoulos
  • javiermtorres
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarises the main change: adding a new CLI command to clear volume mappings, which is the primary objective of this pull request.
Linked Issues check ✅ Passed The pull request fully implements the requirements from issue #199: the mcpd config volumes clear command with server name argument and required --force flag.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the volumes clear command; no out-of-scope modifications detected in the implementation or tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/config-volumes-clear

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new mcpd config volumes clear <server-name> --force subcommand to remove all configured volume mappings for a specific server, aligning behavior with existing destructive “clear” commands (requires --force) and reusing the existing volumes upsert semantics.

Changes:

  • Registers the new clear subcommand under mcpd config volumes.
  • Implements volumes clear command logic (force-gated, loads runtime context, clears volumes, upserts, prints operation result).
  • Adds unit tests covering success, noop, missing --force, server-not-found, loader error, and upsert error paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cmd/config/volumes/cmd.go Wires NewClearCmd into the volumes command’s subcommand list.
cmd/config/volumes/clear.go Implements the volumes clear command and --force guard.
cmd/config/volumes/clear_test.go Adds comprehensive unit tests for the new command behavior and error paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@peteski22 peteski22 merged commit d7738ff into main Mar 12, 2026
7 checks passed
@peteski22 peteski22 deleted the feature/config-volumes-clear branch March 12, 2026 08:22
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.

mcpd config volumes clear

3 participants