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>
77 lines
1.8 KiB
Go
77 lines
1.8 KiB
Go
// Package ai provides AI agent task management and Claude Code integration.
|
|
//
|
|
// Commands:
|
|
// - tasks: List tasks from the agentic service
|
|
// - task: View, claim, or auto-select tasks
|
|
// - task:update: Update task status and progress
|
|
// - task:complete: Mark tasks as completed or failed
|
|
// - task:commit: Create commits with task references
|
|
// - task:pr: Create pull requests linked to tasks
|
|
// - claude: Claude Code CLI integration (planned)
|
|
package ai
|
|
|
|
import (
|
|
"github.com/host-uk/core/pkg/cli"
|
|
"github.com/host-uk/core/pkg/i18n"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
cli.RegisterCommands(AddAICommands)
|
|
}
|
|
|
|
var aiCmd = &cobra.Command{
|
|
Use: "ai",
|
|
Short: i18n.T("cmd.ai.short"),
|
|
Long: i18n.T("cmd.ai.long"),
|
|
}
|
|
|
|
var claudeCmd = &cobra.Command{
|
|
Use: "claude",
|
|
Short: i18n.T("cmd.ai.claude.short"),
|
|
Long: i18n.T("cmd.ai.claude.long"),
|
|
}
|
|
|
|
var claudeRunCmd = &cobra.Command{
|
|
Use: "run",
|
|
Short: i18n.T("cmd.ai.claude.run.short"),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return runClaudeCode()
|
|
},
|
|
}
|
|
|
|
var claudeConfigCmd = &cobra.Command{
|
|
Use: "config",
|
|
Short: i18n.T("cmd.ai.claude.config.short"),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return showClaudeConfig()
|
|
},
|
|
}
|
|
|
|
func initCommands() {
|
|
// Add Claude subcommands
|
|
claudeCmd.AddCommand(claudeRunCmd)
|
|
claudeCmd.AddCommand(claudeConfigCmd)
|
|
|
|
// Add Claude command to ai
|
|
aiCmd.AddCommand(claudeCmd)
|
|
|
|
// Add agentic task commands
|
|
AddAgenticCommands(aiCmd)
|
|
}
|
|
|
|
// AddAICommands registers the 'ai' command and all subcommands.
|
|
func AddAICommands(root *cobra.Command) {
|
|
initCommands()
|
|
root.AddCommand(aiCmd)
|
|
}
|
|
|
|
func runClaudeCode() error {
|
|
// Placeholder - will integrate with claude CLI
|
|
return nil
|
|
}
|
|
|
|
func showClaudeConfig() error {
|
|
// Placeholder - will show claude configuration
|
|
return nil
|
|
}
|