2026-01-30 00:22:47 +00:00
|
|
|
package docs
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
|
2026-01-30 10:32:05 +00:00
|
|
|
"github.com/host-uk/core/pkg/cli"
|
feat(i18n): add translation keys to all CLI commands
Replace hardcoded strings with i18n.T() calls across all cmd/* packages:
- ai, build, ci, dev, docs, doctor, go, php, pkg, sdk, setup, test, vm
Adds 500+ translation keys to en.json for command descriptions,
flag descriptions, labels, messages, and error strings.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 02:37:57 +00:00
|
|
|
"github.com/host-uk/core/pkg/i18n"
|
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-31 11:39:19 +00:00
|
|
|
var docsListCmd = &cli.Command{
|
2026-01-30 00:47:54 +00:00
|
|
|
Use: "list",
|
feat(i18n): add translation keys to all CLI commands
Replace hardcoded strings with i18n.T() calls across all cmd/* packages:
- ai, build, ci, dev, docs, doctor, go, php, pkg, sdk, setup, test, vm
Adds 500+ translation keys to en.json for command descriptions,
flag descriptions, labels, messages, and error strings.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 02:37:57 +00:00
|
|
|
Short: i18n.T("cmd.docs.list.short"),
|
|
|
|
|
Long: i18n.T("cmd.docs.list.long"),
|
2026-01-31 11:39:19 +00:00
|
|
|
RunE: func(cmd *cli.Command, args []string) error {
|
2026-01-30 00:47:54 +00:00
|
|
|
return runDocsList(docsListRegistryPath)
|
|
|
|
|
},
|
|
|
|
|
}
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
func init() {
|
refactor(i18n): consolidate duplicate translation keys into common section
Add common.* keys for reusable translations:
- common.label.* - UI labels (error, done, status, version, etc.)
- common.status.* - status words (running, stopped, dirty, synced)
- common.error.* - error messages (failed, not_found, working_dir)
- common.flag.* - CLI flag descriptions (registry, verbose, etc.)
- common.count.* - count templates (failed, passed, skipped)
- common.result.* - result messages (all_passed, no_issues)
- common.progress.* - progress messages (running, checking)
- common.hint.* - help hints (install_with, fix_deps)
Update all cmd/* files to use common keys instead of duplicated
command-specific keys. Reduces translation maintenance burden
and ensures consistency across the CLI.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 11:32:25 +00:00
|
|
|
docsListCmd.Flags().StringVar(&docsListRegistryPath, "registry", "", i18n.T("common.flag.registry"))
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func runDocsList(registryPath string) error {
|
|
|
|
|
reg, _, err := loadRegistry(registryPath)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-31 11:39:19 +00:00
|
|
|
cli.Print("\n%-20s %-8s %-8s %-10s %s\n",
|
refactor(i18n): migrate all pkg/* to grammar engine
Replace verbose map-based translation calls with concise grammar
engine helpers across all command packages:
- i18n.T("common.label.xxx") → i18n.Label("xxx")
- i18n.T("common.error.failed", map) → i18n.T("i18n.fail.verb", subj)
- i18n.T("common.progress.running", map) → i18n.ProgressSubject()
- i18n.T("common.count.xxx", map) → i18n.T("i18n.count.xxx", n)
Packages updated: ai, ci, dev, docs, php, pkgcmd, sdk, setup, test, vm
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 23:09:45 +00:00
|
|
|
headerStyle.Render(i18n.Label("repo")),
|
feat(i18n): add translation keys to all CLI commands
Replace hardcoded strings with i18n.T() calls across all cmd/* packages:
- ai, build, ci, dev, docs, doctor, go, php, pkg, sdk, setup, test, vm
Adds 500+ translation keys to en.json for command descriptions,
flag descriptions, labels, messages, and error strings.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 02:37:57 +00:00
|
|
|
headerStyle.Render(i18n.T("cmd.docs.list.header.readme")),
|
|
|
|
|
headerStyle.Render(i18n.T("cmd.docs.list.header.claude")),
|
|
|
|
|
headerStyle.Render(i18n.T("cmd.docs.list.header.changelog")),
|
|
|
|
|
headerStyle.Render(i18n.T("cmd.docs.list.header.docs")),
|
2026-01-30 00:22:47 +00:00
|
|
|
)
|
2026-01-31 11:39:19 +00:00
|
|
|
cli.Text(strings.Repeat("─", 70))
|
2026-01-30 00:22:47 +00:00
|
|
|
|
|
|
|
|
var withDocs, withoutDocs int
|
|
|
|
|
for _, repo := range reg.List() {
|
|
|
|
|
info := scanRepoDocs(repo)
|
|
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
readme := checkMark(info.Readme != "")
|
|
|
|
|
claude := checkMark(info.ClaudeMd != "")
|
|
|
|
|
changelog := checkMark(info.Changelog != "")
|
2026-01-30 00:22:47 +00:00
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
docsDir := checkMark(false)
|
2026-01-30 00:22:47 +00:00
|
|
|
if len(info.DocsFiles) > 0 {
|
refactor(i18n): consolidate duplicate translation keys into common section
Add common.* keys for reusable translations:
- common.label.* - UI labels (error, done, status, version, etc.)
- common.status.* - status words (running, stopped, dirty, synced)
- common.error.* - error messages (failed, not_found, working_dir)
- common.flag.* - CLI flag descriptions (registry, verbose, etc.)
- common.count.* - count templates (failed, passed, skipped)
- common.result.* - result messages (all_passed, no_issues)
- common.progress.* - progress messages (running, checking)
- common.hint.* - help hints (install_with, fix_deps)
Update all cmd/* files to use common keys instead of duplicated
command-specific keys. Reduces translation maintenance burden
and ensures consistency across the CLI.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 11:32:25 +00:00
|
|
|
docsDir = docsFoundStyle.Render(i18n.T("common.count.files", map[string]interface{}{"Count": len(info.DocsFiles)}))
|
2026-01-30 00:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-31 11:39:19 +00:00
|
|
|
cli.Print("%-20s %-8s %-8s %-10s %s\n",
|
2026-01-30 00:22:47 +00:00
|
|
|
repoNameStyle.Render(info.Name),
|
|
|
|
|
readme,
|
|
|
|
|
claude,
|
|
|
|
|
changelog,
|
|
|
|
|
docsDir,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if info.HasDocs {
|
|
|
|
|
withDocs++
|
|
|
|
|
} else {
|
|
|
|
|
withoutDocs++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-31 23:36:43 +00:00
|
|
|
cli.Blank()
|
2026-01-31 11:39:19 +00:00
|
|
|
cli.Print("%s %s\n",
|
2026-01-31 23:36:43 +00:00
|
|
|
cli.KeyStyle.Render(i18n.Label("coverage")),
|
feat(i18n): add translation keys to all CLI commands
Replace hardcoded strings with i18n.T() calls across all cmd/* packages:
- ai, build, ci, dev, docs, doctor, go, php, pkg, sdk, setup, test, vm
Adds 500+ translation keys to en.json for command descriptions,
flag descriptions, labels, messages, and error strings.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 02:37:57 +00:00
|
|
|
i18n.T("cmd.docs.list.coverage_summary", map[string]interface{}{"WithDocs": withDocs, "WithoutDocs": withoutDocs}),
|
2026-01-30 00:22:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
2026-01-31 23:36:43 +00:00
|
|
|
|
|
|
|
|
func checkMark(ok bool) string {
|
|
|
|
|
if ok {
|
|
|
|
|
return cli.Glyph(":check:")
|
|
|
|
|
}
|
|
|
|
|
return cli.Glyph(":cross:")
|
|
|
|
|
}
|