Skip to content

feat: add Client.Capabilities() for remote capability discovery#360

Merged
kke merged 1 commit into
mainfrom
remote-capability-discovery
Jun 2, 2026
Merged

feat: add Client.Capabilities() for remote capability discovery#360
kke merged 1 commit into
mainfrom
remote-capability-discovery

Conversation

@kke
Copy link
Copy Markdown
Contributor

@kke kke commented Jun 1, 2026

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Capabilities struct plus Client.Capabilities() and summary String() 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.

Comment thread capabilities.go
Comment thread capabilities.go
Comment thread docs/capability-discovery.md Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 10 comments.

Comment thread capabilities.go Outdated
Comment thread capabilities.go
Comment thread capabilities.go
Comment thread packagemanager/defaultprovider.go
Comment thread initsystem/defaultprovider.go
Comment thread capabilities.go Outdated
Comment thread capabilities.go
Comment thread capabilities.go
Comment thread packagemanager/defaultprovider.go
Comment thread initsystem/defaultprovider.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Comment thread docs/capability-discovery.md Outdated
Comment thread docs/capability-discovery.md Outdated
Comment thread docs/capability-discovery.md Outdated
@kke kke requested a review from Copilot June 1, 2026 18:06
@kke kke marked this pull request as ready for review June 1, 2026 18:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread capabilities.go Outdated
@kke kke force-pushed the remote-capability-discovery branch from 83e2330 to 200d6e3 Compare June 1, 2026 18:30
@kke kke requested a review from Copilot June 1, 2026 18:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread packagemanager/windowsmulti.go
Comment thread docs/capability-discovery.md Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Comment thread capabilities.go
Comment thread capabilities.go
Comment thread capabilities.go
Comment thread capabilities.go
Comment thread capabilities.go
Comment thread docs/capability-discovery.md
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread capabilities.go
Comment thread capabilities.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Comment thread capabilities.go
Comment thread capabilities.go Outdated
Comment thread docs/capability-discovery.md
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>
@kke kke force-pushed the remote-capability-discovery branch from b650ec3 to 2e74203 Compare June 2, 2026 07:37
@kke kke requested a review from Copilot June 2, 2026 07:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

@kke kke merged commit a81452e into main Jun 2, 2026
13 checks passed
@kke kke deleted the remote-capability-discovery branch June 2, 2026 07:51
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.

2 participants