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-29 18:13:51 +00:00
|
|
|
"github.com/host-uk/core/cmd/shared"
|
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 (
|
|
|
|
|
repoNameStyle = shared.RepoNameStyle
|
|
|
|
|
successStyle = shared.SuccessStyle
|
|
|
|
|
errorStyle = shared.ErrorStyle
|
|
|
|
|
dimStyle = shared.DimStyle
|
|
|
|
|
)
|
|
|
|
|
|
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",
|
|
|
|
|
Short: "Bootstrap workspace or clone packages from registry",
|
|
|
|
|
Long: `Sets up a development workspace.
|
|
|
|
|
|
|
|
|
|
REGISTRY MODE (repos.yaml exists):
|
|
|
|
|
Clones all repositories defined in repos.yaml into packages/.
|
|
|
|
|
Skips repos that already exist. Use --only to filter by type.
|
|
|
|
|
|
|
|
|
|
BOOTSTRAP MODE (no repos.yaml):
|
|
|
|
|
1. Clones core-devops to set up the workspace
|
|
|
|
|
2. Presents an interactive wizard to select packages
|
|
|
|
|
3. Clones selected packages
|
|
|
|
|
|
|
|
|
|
Use --all to skip the wizard and clone everything.`,
|
|
|
|
|
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
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
setupCmd.Flags().StringVar(®istryPath, "registry", "", "Path to repos.yaml (auto-detected if not specified)")
|
|
|
|
|
setupCmd.Flags().StringVar(&only, "only", "", "Only clone repos of these types (comma-separated: foundation,module,product)")
|
|
|
|
|
setupCmd.Flags().BoolVar(&dryRun, "dry-run", false, "Show what would be cloned without cloning")
|
|
|
|
|
setupCmd.Flags().BoolVar(&all, "all", false, "Skip wizard, clone all packages (non-interactive)")
|
|
|
|
|
setupCmd.Flags().StringVar(&name, "name", "", "Project directory name for bootstrap mode")
|
|
|
|
|
setupCmd.Flags().BoolVar(&build, "build", false, "Run build after cloning")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AddSetupCommand adds the 'setup' command to the given parent command.
|
|
|
|
|
func AddSetupCommand(root *cobra.Command) {
|
|
|
|
|
root.AddCommand(setupCmd)
|
2026-01-28 14:50:55 +00:00
|
|
|
}
|