3.3 KiB
3.3 KiB
allowed-tools, argument-hint, description, model
| allowed-tools | argument-hint | description | model | |
|---|---|---|---|---|
| Read, Bash(reqvire:*) |
|
Remove an element from the model | claude-sonnet-4-5-20250929 |
Remove Element
Remove an existing model element from the specifications.
Current Model Context
- Total elements: !
reqvire search --json | jq -r '.global_counters.total_elements'
User Request
${1:+Element name: $1} ${1:-The user will provide element name to remove.}
Steps
-
Understand the context:
- Identify the element to remove (by name)
- Verify element exists in the model
- Check if other elements have relations to this element
-
Preview the remove operation:
reqvire rm "<element-name>" --dry-runThis shows:
- Which file will be modified
- The element that will be removed
- Git-style diff showing the deletion
-
Apply the removal:
reqvire rm "<element-name>"The rm command automatically:
- Removes the element from its markdown file
- Removes the element from the model registry
- Deletes all relations from this element
- Note: Does NOT automatically update relations FROM other elements TO this element (you may need to clean those up)
-
Verify the changes:
reqvire validateImportant: After removing an element, validation may show errors if other elements still reference the removed element. You'll need to manually update or remove those relations.
Important Notes
- Global uniqueness: Element names are globally unique, so you only need the element name
- Relations cleanup: The removed element's outgoing relations are deleted, but incoming relations (from other elements) are NOT automatically removed
- Validation warnings: Removing elements that are referenced by others will cause validation errors
- Breaking changes: Removing requirements or verifications can break traceability chains
Remove Options
--dry-run: Preview changes without applying--json: Output results in JSON format
Error Cases
The rm operation will fail with a clear error if:
- The element name does not exist
- Multiple elements have the same name (should not happen due to uniqueness constraint)
Examples
Remove a requirement:
reqvire rm "Deprecated Feature"
Preview before removing:
reqvire rm "Old Requirement" --dry-run
Get JSON output:
reqvire rm "Obsolete Element" --json
When to Use rm
Use rm when:
- Removing deprecated or obsolete requirements
- Cleaning up test elements
- Removing duplicate or incorrect entries
- Refactoring the model structure
Warning: Be careful when removing elements that are referenced by other elements, as this will break those relations and cause validation errors.
Cleanup After Removal
After removing an element, you may need to:
- Find elements that referenced the removed element (validation will show these)
- Update or remove those relations manually
- Re-run validation to ensure model consistency
Related Commands
- Move element:
reqvire mv <element-name> <target-file> - Rename element:
reqvire rename <current-name> <new-name> - Add element:
reqvire add <file> < element.md - Search elements:
reqvire search --filter-name="<pattern>"