Skip to content

Feat : Add delete command to CLI - #607

Open
aniket866 wants to merge 2 commits into
microcks:masterfrom
aniket866:feat/delete-command
Open

aniket866 wants to merge 2 commits into
microcks:masterfrom
aniket866:feat/delete-command

Conversation

@aniket866

Copy link
Copy Markdown
Contributor

Changes Implemented

  • Added DeleteService(ref string) error to MicrocksClient, supporting both direct service IDs and name:version references.
  • Updated resolveServiceID to scan all matching services:
  • Returns KindNotFound when no service matches.
  • Returns a clear error with KindUsage listing the matched service IDs and types when multiple services match the reference.
  • Returns the single resolved ID on exact match.
  • Handled HTTP 204 / 200 as successful responses and mapped HTTP 404 to errors.KindNotFound.
  • Propagated the effective InsecureTLS setting to Keycloak client initialization during token refresh.

Command Layer (cmd/service.go & cmd/cmd.go)

  • Added newServiceDeleteCommand under microcks service delete (and registered a top-level microcks - delete alias for backwards compatibility).
  • Reused newCommandClient for authentication and client options.
  • Uses RunE returning wrapped internal errors (errors.Wrapf(errors.KindUsage, ...)).
  • Interactive terminal check via term.IsTerminal:
  • Prompts user [y/N] before deletion if in an interactive terminal.
  • Requires --force / -f flag in non-interactive/automated environments (e.g., CI/CD).
  • Skips prompt if --force is supplied.

Closes #294

Ai disclosure: Chatgpt is used to analyze related files and do required changes.

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
@aniket866
aniket866 force-pushed the feat/delete-command branch from dc4caf6 to 383a109 Compare October 30, 2026 21:40
@aniket866 aniket866 changed the title Feat : Add delete command to CLI- #295 Feat : Add delete command to CLI Oct 30, 2026
@Caesarsage

Copy link
Copy Markdown
Collaborator

Thanks @aniket866, the delete command itself looks close to what we asked for. But @DivyanshuVortex still has #295 open for the same issue, you can reach out to work with her or if she is still working on ti

please feel free to reopen this after an agreement

@Caesarsage Caesarsage closed this Oct 31, 2026
@aniket866

Copy link
Copy Markdown
Contributor Author

hi @Caesarsage we agreed to work on this: #294 (comment)

Please reopen and review

@Caesarsage

Copy link
Copy Markdown
Collaborator

Thank you for the clarification

@Caesarsage

Copy link
Copy Markdown
Collaborator

See my review here @aniket866
Could you take a look

#295 (comment)

@aniket866

Copy link
Copy Markdown
Contributor Author

hi @Caesarsage this PR is ready

@Caesarsage

Copy link
Copy Markdown
Collaborator

hi @Caesarsage this PR is ready

Thanks @aniket866! There are no new commits since my last review, so the TLS changes (tracked in #287/#605) and the hidden delete alias are still in. Could you drop those so this stays about service delete?

This branch was successfully deployed

1 active deployment
Build — 383a1092 Deployed Oct 31, 2026 by Caesarsage via build-verify-package #849
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.

Feature Request: Add delete command to CLI to remove APIs from Microcks

2 participants