Split all cmd/* packages for maintainability, following the pattern established in cmd/php. Each package now has: - Main file with styles (using cmd/shared) and Add*Commands function - Separate files for logical command groupings Packages refactored: - cmd/dev: 13 files (was 2779 lines in one file) - cmd/build: 5 files (was 913 lines) - cmd/setup: 6 files (was 961 lines) - cmd/go: 5 files (was 655 lines) - cmd/pkg: 5 files (was 634 lines) - cmd/vm: 4 files (was 717 lines) - cmd/ai: 5 files (was 800 lines) - cmd/docs: 5 files (was 379 lines) - cmd/doctor: 5 files (was 301 lines) - cmd/test: 3 files (was 429 lines) - cmd/ci: 5 files (was 272 lines) All packages now import shared styles from cmd/shared instead of redefining them locally. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
83 lines
1.7 KiB
Go
83 lines
1.7 KiB
Go
package docs
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/leaanthony/clir"
|
|
)
|
|
|
|
func addDocsListCommand(parent *clir.Command) {
|
|
var registryPath string
|
|
|
|
listCmd := parent.NewSubCommand("list", "List documentation across repos")
|
|
listCmd.StringFlag("registry", "Path to repos.yaml", ®istryPath)
|
|
|
|
listCmd.Action(func() error {
|
|
return runDocsList(registryPath)
|
|
})
|
|
}
|
|
|
|
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)
|
|
|
|
readme := docsMissingStyle.Render("—")
|
|
if info.Readme != "" {
|
|
readme = docsFoundStyle.Render("✓")
|
|
}
|
|
|
|
claude := docsMissingStyle.Render("—")
|
|
if info.ClaudeMd != "" {
|
|
claude = docsFoundStyle.Render("✓")
|
|
}
|
|
|
|
changelog := docsMissingStyle.Render("—")
|
|
if info.Changelog != "" {
|
|
changelog = docsFoundStyle.Render("✓")
|
|
}
|
|
|
|
docsDir := docsMissingStyle.Render("—")
|
|
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",
|
|
dimStyle.Render("Coverage:"),
|
|
withDocs,
|
|
withoutDocs,
|
|
)
|
|
|
|
return nil
|
|
}
|