feat: Make CapabilitySet public #111

Merged
nemith merged 1 commit from brb/push-wvtwrkwqypsq into main 2026-01-02 23:15:48 +00:00
nemith commented 2026-01-02 23:06:09 +00:00 (Migrated from github.com)

CapabilitySet was a unexported before with the public api being a []string. This exports it and has the session return the CapabilitySet instead of []string exposing the Has() method .

Right now this is a completely frozen/readonly interface which feels right.

CapabilitySet was a unexported before with the public api being a `[]string`. This exports it and has the session return the `CapabilitySet` instead of `[]string` exposing the `Has()` method . Right now this is a completely frozen/readonly interface which feels right.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-01-02 23:09:44 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR makes the CapabilitySet type public to provide a more ergonomic API for working with NETCONF capabilities. Instead of returning raw []string slices, the session now returns *CapabilitySet which provides useful methods like Has() for capability checking.

  • Exports CapabilitySet type with read-only methods (Has(), Len(), All())
  • Renames API methods from ClientCapabilities()/ServerCapabilities() to ClientCaps()/ServerCaps() and changes return type to *CapabilitySet
  • Adds constants CapNetConfig10 and CapNetConfig11 for common base capabilities

Reviewed changes

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

File Description
capability.go Exports CapabilitySet type, adds Len() method, converts All() to return iterator, and adds capability constants
session.go Updates method signatures to return *CapabilitySet, renames methods to shorter names, uses slices.Collect for iterator conversion
inttest/ssh_test.go Updates test to use new ServerCaps() method and Len() instead of checking slice length

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This PR makes the `CapabilitySet` type public to provide a more ergonomic API for working with NETCONF capabilities. Instead of returning raw `[]string` slices, the session now returns `*CapabilitySet` which provides useful methods like `Has()` for capability checking. - Exports `CapabilitySet` type with read-only methods (`Has()`, `Len()`, `All()`) - Renames API methods from `ClientCapabilities()`/`ServerCapabilities()` to `ClientCaps()`/`ServerCaps()` and changes return type to `*CapabilitySet` - Adds constants `CapNetConfig10` and `CapNetConfig11` for common base capabilities ### Reviewed changes Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments. | File | Description | | ---- | ----------- | | capability.go | Exports CapabilitySet type, adds Len() method, converts All() to return iterator, and adds capability constants | | session.go | Updates method signatures to return *CapabilitySet, renames methods to shorter names, uses slices.Collect for iterator conversion | | inttest/ssh_test.go | Updates test to use new ServerCaps() method and Len() instead of checking slice length | --- 💡 <a href="/nemith/netconf/new/main/.github/instructions?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -1,19 +1,24 @@
package netconf
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-01-02 23:09:44 +00:00

The constant names use "NetConfig" but the actual URN contains "netconf" (short for "Network Configuration"). Consider renaming to CapNetConf10 and CapNetConf11 to better match the actual capability string.

The constant names use "NetConfig" but the actual URN contains "netconf" (short for "Network Configuration"). Consider renaming to CapNetConf10 and CapNetConf11 to better match the actual capability string.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-01-02 23:09:44 +00:00

Grammatical error in the comment. Should be "its" instead of "it's" (possessive form, not contraction).

// its hello message.
Grammatical error in the comment. Should be "its" instead of "it's" (possessive form, not contraction). ```suggestion // its hello message. ```
Sign in to join this conversation.
No description provided.