refactor(cli): restructure cmd packages into subdirectories
- Move CLI commands into subdirectories matching command hierarchy:
dev/, go/, php/, build/, ci/, sdk/, pkg/, vm/, docs/, setup/, doctor/, test/, ai/
- Create shared/ package for common styles and utilities
- Add new `core ai` root command with claude subcommand
- Update package declarations and imports across all files
- Create commands.go entry points for each package
- Remove GUI-related files (moved to core-gui repo)
This makes the filesystem structure match the CLI command structure,
improving context capture and code organization.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 18:02:43 +00:00
|
|
|
// Package testcmd provides test running commands.
|
|
|
|
|
//
|
|
|
|
|
// Note: Package named testcmd to avoid conflict with Go's test package.
|
|
|
|
|
package testcmd
|
2026-01-29 11:15:23 +00:00
|
|
|
|
|
|
|
|
import (
|
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:47:54 +00:00
|
|
|
"github.com/spf13/cobra"
|
2026-01-29 11:15:23 +00:00
|
|
|
)
|
|
|
|
|
|
2026-01-30 00:22:47 +00:00
|
|
|
// Style aliases from shared
|
2026-01-29 11:15:23 +00:00
|
|
|
var (
|
2026-01-30 10:32:05 +00:00
|
|
|
testHeaderStyle = cli.RepoNameStyle
|
|
|
|
|
testPassStyle = cli.SuccessStyle
|
|
|
|
|
testFailStyle = cli.ErrorStyle
|
|
|
|
|
testSkipStyle = cli.WarningStyle
|
|
|
|
|
testDimStyle = cli.DimStyle
|
|
|
|
|
testCovHighStyle = cli.CoverageHighStyle
|
|
|
|
|
testCovMedStyle = cli.CoverageMedStyle
|
|
|
|
|
testCovLowStyle = cli.CoverageLowStyle
|
2026-01-29 11:15:23 +00:00
|
|
|
)
|
|
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
// Flag variables for test command
|
|
|
|
|
var (
|
|
|
|
|
testVerbose bool
|
|
|
|
|
testCoverage bool
|
|
|
|
|
testShort bool
|
|
|
|
|
testPkg string
|
|
|
|
|
testRun string
|
|
|
|
|
testRace bool
|
|
|
|
|
testJSON bool
|
|
|
|
|
)
|
2026-01-29 11:15:23 +00:00
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
var testCmd = &cobra.Command{
|
|
|
|
|
Use: "test",
|
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.test.short"),
|
|
|
|
|
Long: i18n.T("cmd.test.long"),
|
2026-01-30 00:47:54 +00:00
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
|
return runTest(testVerbose, testCoverage, testShort, testPkg, testRun, testRace, testJSON)
|
|
|
|
|
},
|
|
|
|
|
}
|
2026-01-29 11:15:23 +00:00
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
func init() {
|
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
|
|
|
testCmd.Flags().BoolVar(&testVerbose, "verbose", false, i18n.T("cmd.test.flag.verbose"))
|
|
|
|
|
testCmd.Flags().BoolVar(&testCoverage, "coverage", false, i18n.T("cmd.test.flag.coverage"))
|
|
|
|
|
testCmd.Flags().BoolVar(&testShort, "short", false, i18n.T("cmd.test.flag.short"))
|
|
|
|
|
testCmd.Flags().StringVar(&testPkg, "pkg", "", i18n.T("cmd.test.flag.pkg"))
|
|
|
|
|
testCmd.Flags().StringVar(&testRun, "run", "", i18n.T("cmd.test.flag.run"))
|
|
|
|
|
testCmd.Flags().BoolVar(&testRace, "race", false, i18n.T("cmd.test.flag.race"))
|
|
|
|
|
testCmd.Flags().BoolVar(&testJSON, "json", false, i18n.T("cmd.test.flag.json"))
|
2026-01-29 11:15:23 +00:00
|
|
|
}
|