[deckhouse-cli] New plugins contract support - refactor [1/2]#346
Merged
Conversation
…to internal This is for consistency with other commands and their layouts Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Some of them are likely copied from mirror command, but in plugins there is no use of them. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
…mand and plugins in general Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
…th builder functions) Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- `runInstalledPlugin` returns errors, so the run path is testable and the command body just logs and exits on failure. - `ensureInstallRoot` centralizes the homedir fallback used by both `NewCommand` and `NewPluginCommand`. - `cachedDescription` wraps the contract cache lookup and returns "" when the file is missing or unreadable. - All path joins flow through the `layout` package (`PluginsRoot`, `CurrentLinkPath`, `ContractFile`). Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
ldmonster
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pr is pure refactor before new contract support:
The implementation stage (PR
[2/2]) is stacked on top of this branch and ships separately.⭐ The problem refactor solves
cmd/plugins/plugins.go- a ~1000-line file mixing flag parsing, registry I/O, validation, filesystem layout and CLI output.There are several problems with it:
🚶♂️➡️ Refactor walkthrough
Split the monolithic file.
plugins.gowas broken into one file per concern - install, update, remove, list, contract, validators.internal/plugins/cmd/, matching the repo's existing "thincmd/, real code underinternal/" convention.Pruned dead flags.
mirrorand were never wired up. (removed them)Documented the plugin model itself.
doc.golays out what a d8 plugin actually isPromoted filesystem layout to a first-class concern.
internal/plugins/cmd/layoutpackage became the single source of truth for paths:Extracted install/run helpers.
os.Exitinline whenever anything went wrong - which made it impossible to unit-test and awkward to extend.Verification
go build ./...clean at every commit.Follow-up
PR
[2/2](the actual contract implementation) is stacked on this branch and will be opened against it.