Commit 12664a3
authored
feat: add proto rm/remove command to uninstall protocol (#3)
* feat: add proto rm/remove command to uninstall protocol
Implement cueme proto rm/remove command as the reverse operation of
cueme proto apply. This allows users to cleanly remove the HAP protocol
from agent configuration files.
Features:
- Add protoRemove() function to remove managed blocks
- Support both 'rm' and 'remove' aliases
- Automatically delete file if it becomes empty after removal
- Preserve file content outside managed blocks
- Handle cases where file or managed block doesn't exist
Usage:
cueme proto rm <agent>
cueme proto remove <agent>
Examples:
cueme proto rm windsurf
cueme proto remove kiro
The command removes content between BEGIN_MARKER and END_MARKER,
preserving any other content in the file. If the file only contains
the managed block, it will be deleted entirely.
* fix: address code review feedback
Address all feedback from code review:
Must-fix items:
1. Remove unused 'exists' variable in protoRemove()
2. Throw error when file deletion fails instead of returning ok
- Changed from 'ok: ... but failed to delete' to throwing Error
- This ensures non-zero exit code and proper error handling
Improvements:
3. Removed trimEnd() to preserve original file formatting
- Keep trailing whitespace/newlines as they were
- Only remove the managed block itself
The function now:
- Cleanly removes managed blocks
- Preserves original file formatting
- Properly reports errors when file deletion fails
- Has no unused variables1 parent 4abf5b5 commit 12664a3
2 files changed
Lines changed: 56 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
261 | 273 | | |
262 | 274 | | |
263 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
402 | 444 | | |
403 | 445 | | |
404 | 446 | | |
| |||
417 | 459 | | |
418 | 460 | | |
419 | 461 | | |
| 462 | + | |
420 | 463 | | |
421 | 464 | | |
422 | 465 | | |
| |||
0 commit comments