2026-01-30 00:22:47 +00:00
|
|
|
package docs
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
|
2026-01-30 01:09:03 +00:00
|
|
|
"github.com/host-uk/core/cmd/shared"
|
2026-01-30 00:47:54 +00:00
|
|
|
"github.com/spf13/cobra"
|
2026-01-30 00:22:47 +00:00
|
|
|
)
|
|
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
// Flag variable for list command
|
|
|
|
|
var docsListRegistryPath string
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
var docsListCmd = &cobra.Command{
|
|
|
|
|
Use: "list",
|
|
|
|
|
Short: "List documentation across repos",
|
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
|
return runDocsList(docsListRegistryPath)
|
|
|
|
|
},
|
|
|
|
|
}
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
func init() {
|
|
|
|
|
docsListCmd.Flags().StringVar(&docsListRegistryPath, "registry", "", "Path to repos.yaml")
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func runDocsList(registryPath string) error {
|
|
|
|
|
reg, _, err := loadRegistry(registryPath)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Printf("\n%-20s %-8s %-8s %-10s %s\n",
|
|
|
|
|
headerStyle.Render("Repo"),
|
|
|
|
|
headerStyle.Render("README"),
|
|
|
|
|
headerStyle.Render("CLAUDE"),
|
|
|
|
|
headerStyle.Render("CHANGELOG"),
|
|
|
|
|
headerStyle.Render("docs/"),
|
|
|
|
|
)
|
|
|
|
|
fmt.Println(strings.Repeat("─", 70))
|
|
|
|
|
|
|
|
|
|
var withDocs, withoutDocs int
|
|
|
|
|
for _, repo := range reg.List() {
|
|
|
|
|
info := scanRepoDocs(repo)
|
|
|
|
|
|
2026-01-30 01:09:03 +00:00
|
|
|
readme := shared.CheckMark(info.Readme != "")
|
|
|
|
|
claude := shared.CheckMark(info.ClaudeMd != "")
|
|
|
|
|
changelog := shared.CheckMark(info.Changelog != "")
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-30 01:09:03 +00:00
|
|
|
docsDir := shared.CheckMark(false)
|
2026-01-30 00:22:47 +00:00
|
|
|
if len(info.DocsFiles) > 0 {
|
|
|
|
|
docsDir = docsFoundStyle.Render(fmt.Sprintf("%d files", len(info.DocsFiles)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Printf("%-20s %-8s %-8s %-10s %s\n",
|
|
|
|
|
repoNameStyle.Render(info.Name),
|
|
|
|
|
readme,
|
|
|
|
|
claude,
|
|
|
|
|
changelog,
|
|
|
|
|
docsDir,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if info.HasDocs {
|
|
|
|
|
withDocs++
|
|
|
|
|
} else {
|
|
|
|
|
withoutDocs++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Println()
|
|
|
|
|
fmt.Printf("%s %d with docs, %d without\n",
|
2026-01-30 01:09:03 +00:00
|
|
|
shared.Label("Coverage"),
|
2026-01-30 00:22:47 +00:00
|
|
|
withDocs,
|
|
|
|
|
withoutDocs,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|