During conflict resolution for PR #313 (streaming API), the agent incorrectly assumed that modify/delete conflicts meant the PR intended to remove these packages. This was wrong - PR #313 was only about adding streaming API to pkg/io. Restored packages: - pkg/workspace - workspace management service - pkg/unifi - UniFi controller client - pkg/gitea - Gitea API client - pkg/crypt/openpgp - OpenPGP encryption service - internal/cmd/gitea - Gitea CLI commands - internal/cmd/unifi - UniFi CLI commands Also restored: - Various test files (bench_test.go, integration_test.go, etc.) - pkg/framework/core/interfaces.go (Workspace/Crypt interfaces) - pkg/log/errors.go (error helpers) - Documentation (faq.md, user-guide.md) This allows PR #297 (MCP daemon mode) to proceed as it depends on pkg/workspace. Co-authored-by: Claude <developers@lethean.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package unifi
|
|
|
|
import (
|
|
"github.com/host-uk/core/pkg/cli"
|
|
"github.com/host-uk/core/pkg/log"
|
|
uf "github.com/host-uk/core/pkg/unifi"
|
|
)
|
|
|
|
// addSitesCommand adds the 'sites' subcommand for listing UniFi sites.
|
|
func addSitesCommand(parent *cli.Command) {
|
|
cmd := &cli.Command{
|
|
Use: "sites",
|
|
Short: "List controller sites",
|
|
Long: "List all sites configured on the UniFi controller.",
|
|
RunE: func(cmd *cli.Command, args []string) error {
|
|
return runSites()
|
|
},
|
|
}
|
|
|
|
parent.AddCommand(cmd)
|
|
}
|
|
|
|
func runSites() error {
|
|
client, err := uf.NewFromConfig("", "", "", "", nil)
|
|
if err != nil {
|
|
return log.E("unifi.sites", "failed to initialise client", err)
|
|
}
|
|
|
|
sites, err := client.GetSites()
|
|
if err != nil {
|
|
return log.E("unifi.sites", "failed to fetch sites", err)
|
|
}
|
|
|
|
if len(sites) == 0 {
|
|
cli.Text("No sites found.")
|
|
return nil
|
|
}
|
|
|
|
table := cli.NewTable("Name", "Description")
|
|
|
|
for _, s := range sites {
|
|
table.AddRow(
|
|
valueStyle.Render(s.Name),
|
|
dimStyle.Render(s.Desc),
|
|
)
|
|
}
|
|
|
|
cli.Blank()
|
|
cli.Print(" %d sites\n\n", len(sites))
|
|
table.Render()
|
|
|
|
return nil
|
|
}
|