Files
boshu2__agentops/cli/cmd/ao/init_composition.go
Bo 3a54d5ff53 refactor(cli): unify host-seam contract, shared writeJSON/ExitError, drift guards (age-6j9ee.1)
Collapse the four drifted cmd/ao host-seam shapes into one shared
clicontract.HostOptions consumed by all 17 command modules; delete the
positional-func and bespoke-struct seams and the doctor GlobalOptions bundle.

- clicontract/host.go: single HostOptions union (OutputMode/Verbose/Verbosef/
  DryRun/ProjectRoot/GoalsPath/LedgerPath/Version/Now/EnrichFlagErr), one shared
  WriteJSON (byte-identical to the three deleted copies), one shared ExitError
  (Label field preserves doctor's stderr surfacing; gate stays silent).
- config_module.go + doctor_module.go: package-level module/service singletons
  -> newConfigCommand()/newDoctorCommand() constructors; 7 allowlist rows removed.
- carveout_regression_test.go: three AST drift guards (shared seam type / no
  direct host effects / no module-service singleton vars), each RED-proven.
- docs/architecture/go-cli.md: document the intentional two-tier shape (5 full
  hexagonal, 12 app-seam); drop the stale opportunistic-extraction sentence.

Zero behavior change: ao -o json capabilities byte-identical; full suite +
-shuffle=on -count=2 green; 0 lint issues; gate check --full 67/67.
2026-07-20 10:14:04 -04:00

25 lines
753 B
Go

// practices: [hexagonal-architecture, ddd-bounded-context]
package main
import (
"github.com/spf13/cobra"
"github.com/boshu2/agentops/cli/internal/clicontract"
initcommands "github.com/boshu2/agentops/cli/internal/commands/init"
)
func init() {
rootCmd.AddCommand(newInitCommand())
}
// newInitCommand wires the init command module to its host seams. The dry-run
// selection comes from the global --dry-run flag; all filesystem effects are
// delegated to internal/initapp. The init family attaches no CommandContract to
// the command tree, preserving its pre-migration capabilities surface.
func newInitCommand() *cobra.Command {
module := initcommands.NewModule(clicontract.HostOptions{
DryRun: GetDryRun,
})
return module.Command()
}