feat: add Client.Capabilities() for remote capability discovery#360
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a consolidated remote-host capability discovery API (Client.Capabilities()) that gathers protocol/OS/remote FS/package manager/init system/sudo/interactive-exec support in one call, relying on existing lazy provider caching. Also standardizes human-readable names for init systems and package managers via String() methods, and documents the feature.
Changes:
- Add
Capabilitiesstruct plusClient.Capabilities()and summaryString()output. - Implement
String()for init system types and package managers (incl. universal and Windows multi-manager) to expose readable names. - Add documentation for capability discovery and caching behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| capabilities.go | Introduces Capabilities struct and Client.Capabilities() probe/summary logic |
| capabilities_test.go | Adds tests for capability discovery, string output, and memoization behavior |
| docs/capability-discovery.md | Documents the new capability discovery API, caching, and expected values |
| packagemanager/universal.go | Adds String() for universal package manager implementations |
| packagemanager/windowsmulti.go | Adds String() for Windows multi-manager implementation |
| initsystem/systemd.go | Adds String() for systemd service manager |
| initsystem/openrc.go | Adds String() for OpenRC service manager |
| initsystem/launchd.go | Adds String() for launchd service manager |
| initsystem/upstart.go | Adds String() for Upstart service manager |
| initsystem/sysvinit.go | Adds String() for SysVinit service manager |
| initsystem/runit.go | Adds String() for runit service manager |
| initsystem/winscm.go | Adds String() for Windows SCM service manager |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
83e2330 to
200d6e3
Compare
Adds a Capabilities struct and Client.Capabilities() method that probes all detectable aspects of a connected host in one call: OS, remote FS, package manager, init system, sudo availability, and protocol features. All detection is lazy and memoized via the existing provider chain — the first call per capability runs a remote command; subsequent calls return the cached result with no additional round-trips. Interleaved direct accessor calls (e.g. OS() before Capabilities()) share the same cache. Also adds String() methods to all concrete initsystem and packagemanager types so that Capabilities.InitSystem and Capabilities.PackageManager carry human-readable names (e.g. "systemd", "apt") rather than blank strings. Docs added at docs/capability-discovery.md. Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
b650ec3 to
2e74203
Compare
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.
Adds a Capabilities struct and Client.Capabilities() method that probes all detectable aspects of a connected host in one call: OS, remote FS, package manager, init system, sudo availability, and protocol features.
All detection is lazy and memoized via the existing provider chain — the first call per capability runs a remote command; subsequent calls return the cached result with no additional round-trips. Interleaved direct accessor calls (e.g. OS() before Capabilities()) share the same cache.
Also adds String() methods to all concrete initsystem and packagemanager types so that Capabilities.InitSystem and Capabilities.PackageManager carry human-readable names (e.g. "systemd", "apt") rather than blank strings.
Docs added at docs/capability-discovery.md.