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 setup provides workspace setup and bootstrap commands.
|
|
|
|
|
package setup
|
2026-01-28 14:50:55 +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-28 14:50:55 +00:00
|
|
|
)
|
|
|
|
|
|
2026-01-30 00:22:47 +00:00
|
|
|
// Style aliases from shared package
|
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
|
|
|
var (
|
2026-01-31 23:02:52 +00:00
|
|
|
repoNameStyle = cli.RepoStyle
|
2026-01-30 10:32:05 +00:00
|
|
|
successStyle = cli.SuccessStyle
|
|
|
|
|
errorStyle = cli.ErrorStyle
|
2026-02-01 03:37:06 +00:00
|
|
|
warningStyle = cli.WarningStyle
|
2026-01-30 10:32:05 +00:00
|
|
|
dimStyle = cli.DimStyle
|
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
|
|
|
)
|
|
|
|
|
|
2026-01-29 19:09:51 +00:00
|
|
|
// Default organization and devops repo for bootstrap
|
|
|
|
|
const (
|
2026-01-30 00:22:47 +00:00
|
|
|
defaultOrg = "host-uk"
|
|
|
|
|
devopsRepo = "core-devops"
|
|
|
|
|
devopsReposYaml = "repos.yaml"
|
2026-01-29 19:09:51 +00:00
|
|
|
)
|
|
|
|
|
|
2026-01-30 00:47:54 +00:00
|
|
|
// Setup command flags
|
|
|
|
|
var (
|
|
|
|
|
registryPath string
|
|
|
|
|
only string
|
|
|
|
|
dryRun bool
|
|
|
|
|
all bool
|
|
|
|
|
name string
|
|
|
|
|
build bool
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var setupCmd = &cobra.Command{
|
|
|
|
|
Use: "setup",
|
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.setup.short"),
|
|
|
|
|
Long: i18n.T("cmd.setup.long"),
|
2026-01-30 00:47:54 +00:00
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
2026-01-29 19:09:51 +00:00
|
|
|
return runSetupOrchestrator(registryPath, only, dryRun, all, name, build)
|
2026-01-30 00:47:54 +00:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
refactor(cli): move commands from cmd/ to pkg/ with self-registration
Implements defence in depth through build variants - only compiled code
exists in the binary. Commands now self-register via cli.RegisterCommands()
in their init() functions, mirroring the i18n.RegisterLocales() pattern.
Structure changes:
- cmd/{ai,build,ci,dev,docs,doctor,go,php,pkg,sdk,setup,test,vm}/ → pkg/*/cmd_*.go
- cmd/core_dev.go, cmd/core_ci.go → cmd/variants/{full,ci,php,minimal}.go
- Added pkg/cli/commands.go with RegisterCommands API
- Updated pkg/cli/runtime.go to attach registered commands
Build variants:
- go build → full (21MB, all 13 command groups)
- go build -tags ci → ci (18MB, build/ci/sdk/doctor)
- go build -tags php → php (14MB, php/doctor)
- go build -tags minimal → minimal (11MB, doctor only)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 21:55:55 +00:00
|
|
|
func initSetupFlags() {
|
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
|
|
|
setupCmd.Flags().StringVar(®istryPath, "registry", "", i18n.T("cmd.setup.flag.registry"))
|
|
|
|
|
setupCmd.Flags().StringVar(&only, "only", "", i18n.T("cmd.setup.flag.only"))
|
|
|
|
|
setupCmd.Flags().BoolVar(&dryRun, "dry-run", false, i18n.T("cmd.setup.flag.dry_run"))
|
|
|
|
|
setupCmd.Flags().BoolVar(&all, "all", false, i18n.T("cmd.setup.flag.all"))
|
|
|
|
|
setupCmd.Flags().StringVar(&name, "name", "", i18n.T("cmd.setup.flag.name"))
|
|
|
|
|
setupCmd.Flags().BoolVar(&build, "build", false, i18n.T("cmd.setup.flag.build"))
|
2026-01-30 00:47:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AddSetupCommand adds the 'setup' command to the given parent command.
|
|
|
|
|
func AddSetupCommand(root *cobra.Command) {
|
refactor(cli): move commands from cmd/ to pkg/ with self-registration
Implements defence in depth through build variants - only compiled code
exists in the binary. Commands now self-register via cli.RegisterCommands()
in their init() functions, mirroring the i18n.RegisterLocales() pattern.
Structure changes:
- cmd/{ai,build,ci,dev,docs,doctor,go,php,pkg,sdk,setup,test,vm}/ → pkg/*/cmd_*.go
- cmd/core_dev.go, cmd/core_ci.go → cmd/variants/{full,ci,php,minimal}.go
- Added pkg/cli/commands.go with RegisterCommands API
- Updated pkg/cli/runtime.go to attach registered commands
Build variants:
- go build → full (21MB, all 13 command groups)
- go build -tags ci → ci (18MB, build/ci/sdk/doctor)
- go build -tags php → php (14MB, php/doctor)
- go build -tags minimal → minimal (11MB, doctor only)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 21:55:55 +00:00
|
|
|
initSetupFlags()
|
2026-02-01 03:37:06 +00:00
|
|
|
addGitHubCommand(setupCmd)
|
2026-01-30 00:47:54 +00:00
|
|
|
root.AddCommand(setupCmd)
|
2026-01-28 14:50:55 +00:00
|
|
|
}
|