agent/codex/code/skills/go/SKILL.md
Snider e90a84eaa0 feat: merge go-agent + go-agentic + php-devops into unified agent repo
Combines three repositories into a single workspace:
- go-agent → pkg/orchestrator (Clotho), pkg/jobrunner, pkg/loop, cmd/
- go-agentic → pkg/lifecycle (allowance, sessions, plans, dispatch)
- php-devops → repos.yaml, setup.sh, scripts/, .core/

Module path: forge.lthn.ai/core/agent

All packages build, all tests pass.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 15:23:00 +00:00

2.4 KiB

name description
core-go Use when creating Go packages or extending the core CLI.

Go Framework Patterns

Core CLI uses pkg/ for reusable packages. Use core go commands.

Package Structure

core/
├── main.go                 # CLI entry point
├── pkg/
│   ├── cli/               # CLI framework, output, errors
│   ├── {domain}/          # Domain package
│   │   ├── cmd_{name}.go  # Cobra command definitions
│   │   ├── service.go     # Business logic
│   │   └── *_test.go      # Tests
│   └── ...
└── internal/              # Private packages

Adding a CLI Command

  1. Create pkg/{domain}/cmd_{name}.go:
package domain

import (
    "github.com/host-uk/core/pkg/cli"
    "github.com/spf13/cobra"
)

func NewNameCmd() *cobra.Command {
    cmd := &cobra.Command{
        Use:   "name",
        Short: cli.T("domain.name.short"),
        RunE: func(cmd *cobra.Command, args []string) error {
            // Implementation
            cli.Success("Done")
            return nil
        },
    }
    return cmd
}
  1. Register in parent command.

CLI Output Helpers

import "github.com/host-uk/core/pkg/cli"

cli.Success("Operation completed")      // Green check
cli.Warning("Something to note")        // Yellow warning
cli.Error("Something failed")           // Red error
cli.Info("Informational message")       // Blue info
cli.Fatal(err)                          // Print error and exit 1

// Structured output
cli.Table(headers, rows)
cli.JSON(data)

i18n Pattern

// Use cli.T() for translatable strings
cli.T("domain.action.success")
cli.T("domain.action.error", "details", value)

// Define in pkg/i18n/locales/en.yaml:
domain:
  action:
    success: "Operation completed successfully"
    error: "Failed: {{.details}}"

Test Naming

func TestFeature_Good(t *testing.T) { /* happy path */ }
func TestFeature_Bad(t *testing.T)  { /* expected errors */ }
func TestFeature_Ugly(t *testing.T) { /* panics, edge cases */ }

Commands

Task Command
Run tests core go test
Coverage core go cov
Format core go fmt --fix
Lint core go lint
Build core build
Install core go install

Rules

  • CGO_ENABLED=0 for all builds
  • UK English in user-facing strings
  • All errors via cli.E("context", "message", err)
  • Table-driven tests preferred