feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
package unifi
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"github.com/host-uk/core/pkg/cli"
|
|
|
|
|
uf "github.com/host-uk/core/pkg/unifi"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Config command flags.
|
|
|
|
|
var (
|
2026-02-05 06:55:52 +00:00
|
|
|
configURL string
|
|
|
|
|
configUser string
|
|
|
|
|
configPass string
|
|
|
|
|
configAPIKey string
|
|
|
|
|
configInsecure bool
|
|
|
|
|
configTest bool
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// addConfigCommand adds the 'config' subcommand for UniFi connection setup.
|
|
|
|
|
func addConfigCommand(parent *cli.Command) {
|
|
|
|
|
cmd := &cli.Command{
|
|
|
|
|
Use: "config",
|
|
|
|
|
Short: "Configure UniFi connection",
|
|
|
|
|
Long: "Set the UniFi controller URL and credentials, or test the current connection.",
|
|
|
|
|
RunE: func(cmd *cli.Command, args []string) error {
|
2026-02-05 06:55:52 +00:00
|
|
|
return runConfig(cmd)
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cmd.Flags().StringVar(&configURL, "url", "", "UniFi controller URL")
|
|
|
|
|
cmd.Flags().StringVar(&configUser, "user", "", "UniFi username")
|
|
|
|
|
cmd.Flags().StringVar(&configPass, "pass", "", "UniFi password")
|
|
|
|
|
cmd.Flags().StringVar(&configAPIKey, "apikey", "", "UniFi API key")
|
2026-02-05 06:55:52 +00:00
|
|
|
cmd.Flags().BoolVar(&configInsecure, "insecure", false, "Allow insecure TLS connections (e.g. self-signed certs)")
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
cmd.Flags().BoolVar(&configTest, "test", false, "Test the current connection")
|
|
|
|
|
|
|
|
|
|
parent.AddCommand(cmd)
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-05 06:55:52 +00:00
|
|
|
func runConfig(cmd *cli.Command) error {
|
|
|
|
|
var insecure *bool
|
|
|
|
|
if cmd.Flags().Changed("insecure") {
|
|
|
|
|
insecure = &configInsecure
|
|
|
|
|
}
|
|
|
|
|
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
// If setting values, save them first
|
2026-02-05 06:55:52 +00:00
|
|
|
if configURL != "" || configUser != "" || configPass != "" || configAPIKey != "" || insecure != nil {
|
|
|
|
|
if err := uf.SaveConfig(configURL, configUser, configPass, configAPIKey, insecure); err != nil {
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if configURL != "" {
|
|
|
|
|
cli.Success(fmt.Sprintf("UniFi URL set to %s", configURL))
|
|
|
|
|
}
|
|
|
|
|
if configUser != "" {
|
|
|
|
|
cli.Success("UniFi username saved")
|
|
|
|
|
}
|
|
|
|
|
if configPass != "" {
|
|
|
|
|
cli.Success("UniFi password saved")
|
|
|
|
|
}
|
|
|
|
|
if configAPIKey != "" {
|
|
|
|
|
cli.Success("UniFi API key saved")
|
|
|
|
|
}
|
2026-02-05 06:55:52 +00:00
|
|
|
if insecure != nil {
|
|
|
|
|
cli.Success(fmt.Sprintf("UniFi insecure mode set to %v", *insecure))
|
|
|
|
|
}
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If testing, verify the connection
|
|
|
|
|
if configTest {
|
2026-02-05 06:55:52 +00:00
|
|
|
return runConfigTest(cmd)
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If no flags, show current config
|
|
|
|
|
if configURL == "" && configUser == "" && configPass == "" && configAPIKey == "" && !configTest {
|
|
|
|
|
return showConfig()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func showConfig() error {
|
2026-02-05 06:55:52 +00:00
|
|
|
url, user, pass, apikey, insecure, err := uf.ResolveConfig("", "", "", "", nil)
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cli.Blank()
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("URL:"), valueStyle.Render(url))
|
|
|
|
|
|
|
|
|
|
if user != "" {
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("User:"), valueStyle.Render(user))
|
|
|
|
|
} else {
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("User:"), warningStyle.Render("not set"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if pass != "" {
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("Pass:"), valueStyle.Render("****"))
|
|
|
|
|
} else {
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("Pass:"), warningStyle.Render("not set"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if apikey != "" {
|
|
|
|
|
masked := apikey
|
|
|
|
|
if len(apikey) >= 8 {
|
|
|
|
|
masked = apikey[:4] + "..." + apikey[len(apikey)-4:]
|
|
|
|
|
}
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("API Key:"), valueStyle.Render(masked))
|
|
|
|
|
} else {
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("API Key:"), warningStyle.Render("not set"))
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-05 06:55:52 +00:00
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("Insecure:"), valueStyle.Render(fmt.Sprintf("%v", insecure)))
|
|
|
|
|
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
cli.Blank()
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-05 06:55:52 +00:00
|
|
|
func runConfigTest(cmd *cli.Command) error {
|
|
|
|
|
var insecure *bool
|
|
|
|
|
if cmd.Flags().Changed("insecure") {
|
|
|
|
|
insecure = &configInsecure
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
client, err := uf.NewFromConfig(configURL, configUser, configPass, configAPIKey, insecure)
|
feat(release): add Homebrew tap support and fix artifact naming (#325)
* feat(release): add Homebrew tap support and fix artifact naming
- Fix platform naming: binaries now named core-{os}-{arch} instead of
just 'core', preventing collision when artifacts merge
- Add tar.gz archives for non-Windows builds (Homebrew requirement)
- Add update-tap job to alpha-release workflow that auto-updates
host-uk/homebrew-tap with checksums on each alpha release
- Add homebrew publisher to .core/release.yaml for formal releases
- Update install instructions to include brew install
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(unifi): add UniFi Go SDK integration and CLI commands
- Add pkg/unifi SDK wrapping unpoller/unifi with TLS, config resolution,
and typed accessors for sites, clients, devices, networks, and routes
- Add CLI commands: unifi sites, clients, devices, networks, routes, config
- Register unifi commands in full variant build
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(release): set AppVersion ldflags, git config, and tap token
- Set -X pkg/cli.AppVersion in ldflags so core --version reports the
correct version instead of "dev"
- Add git config user.name/email in update-tap job so commit succeeds
- Use HOMEBREW_TAP_TOKEN secret instead of GITHUB_TOKEN for cross-repo
push to host-uk/homebrew-tap
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(unifi): address CodeRabbit review feedback
- Reject conflicting --wired and --wireless flags in clients command
- Complete --type flag help text with bgp and ospf route types
- URL-escape site name in routes API path
- Wrap all command errors with log.E for contextual diagnostics
- Set TLS MinVersion to 1.2 on UniFi client
- Simplify redundant fmt.Sprintf in Print calls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:37:02 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sites, err := client.GetSites()
|
|
|
|
|
if err != nil {
|
|
|
|
|
cli.Error("Connection failed")
|
|
|
|
|
return cli.WrapVerb(err, "connect to", "UniFi controller")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cli.Blank()
|
|
|
|
|
cli.Success(fmt.Sprintf("Connected to %s", client.URL()))
|
|
|
|
|
cli.Print(" %s %s\n", dimStyle.Render("Sites:"), numberStyle.Render(fmt.Sprintf("%d", len(sites))))
|
|
|
|
|
for _, s := range sites {
|
|
|
|
|
cli.Print(" %s %s\n", valueStyle.Render(s.Name), dimStyle.Render(s.Desc))
|
|
|
|
|
}
|
|
|
|
|
cli.Blank()
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|