## Summary - Extract PHP/Laravel commands to `core/php` repo (42 files, standalone module) - Extract CI/release + SDK commands to `core/ci` repo (10 files) - Remove `internal/variants/` build tag system entirely - Move all 30 remaining command packages from `internal/cmd/` to top-level `cmd/` - Rewrite `main.go` with direct imports — no more variant selection - PHP and CI are now optional via commented import lines in main.go Co-authored-by: Claude <developers@lethean.io> Reviewed-on: #2 Co-authored-by: Charon <charon@lthn.ai> Co-committed-by: Charon <charon@lthn.ai>
58 lines
1.8 KiB
Go
58 lines
1.8 KiB
Go
// Package testcmd provides test running commands.
|
|
//
|
|
// Note: Package named testcmd to avoid conflict with Go's test package.
|
|
package testcmd
|
|
|
|
import (
|
|
"forge.lthn.ai/core/go/pkg/cli"
|
|
"forge.lthn.ai/core/go/pkg/i18n"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// Style aliases from shared
|
|
var (
|
|
testHeaderStyle = cli.RepoStyle
|
|
testPassStyle = cli.SuccessStyle
|
|
testFailStyle = cli.ErrorStyle
|
|
testSkipStyle = cli.WarningStyle
|
|
testDimStyle = cli.DimStyle
|
|
testCovHighStyle = cli.NewStyle().Foreground(cli.ColourGreen500)
|
|
testCovMedStyle = cli.NewStyle().Foreground(cli.ColourAmber500)
|
|
testCovLowStyle = cli.NewStyle().Foreground(cli.ColourRed500)
|
|
)
|
|
|
|
// Flag variables for test command
|
|
var (
|
|
testVerbose bool
|
|
testCoverage bool
|
|
testShort bool
|
|
testPkg string
|
|
testRun string
|
|
testRace bool
|
|
testJSON bool
|
|
)
|
|
|
|
var testCmd = &cobra.Command{
|
|
Use: "test",
|
|
Short: i18n.T("cmd.test.short"),
|
|
Long: i18n.T("cmd.test.long"),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return runTest(testVerbose, testCoverage, testShort, testPkg, testRun, testRace, testJSON)
|
|
},
|
|
}
|
|
|
|
func initTestFlags() {
|
|
testCmd.Flags().BoolVar(&testVerbose, "verbose", false, i18n.T("cmd.test.flag.verbose"))
|
|
testCmd.Flags().BoolVar(&testCoverage, "coverage", false, i18n.T("common.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"))
|
|
}
|
|
|
|
// AddTestCommands registers the 'test' command and all subcommands.
|
|
func AddTestCommands(root *cobra.Command) {
|
|
initTestFlags()
|
|
root.AddCommand(testCmd)
|
|
}
|