Files
mcp/cmd/mcp/main.go
Kyle Isom f932dd64cc Add undeploy command: full inverse of deploy
Implements `mcp undeploy <service>` which tears down all infrastructure
for a service: removes mc-proxy routes, DNS records, TLS certificates,
stops and removes containers, releases allocated ports, and marks the
service inactive.

This fills the gap between `stop` (temporary pause) and `purge` (registry
cleanup). Undeploy is the complete teardown that returns the node to the
state before the service was deployed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 21:45:42 -07:00

59 lines
1.2 KiB
Go

package main
import (
"fmt"
"log"
"os"
"path/filepath"
"github.com/spf13/cobra"
)
var (
version = "dev"
cfgPath string
)
func main() {
root := &cobra.Command{
Use: "mcp",
Short: "Metacircular Control Plane CLI",
}
defaultCfg := ""
if home, err := os.UserHomeDir(); err == nil {
defaultCfg = filepath.Join(home, ".config", "mcp", "mcp.toml")
}
root.PersistentFlags().StringVarP(&cfgPath, "config", "c", defaultCfg, "config file path")
root.AddCommand(&cobra.Command{
Use: "version",
Short: "Print version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version)
},
})
root.AddCommand(loginCmd())
root.AddCommand(buildCmd())
root.AddCommand(deployCmd())
root.AddCommand(undeployCmd())
root.AddCommand(stopCmd())
root.AddCommand(startCmd())
root.AddCommand(restartCmd())
root.AddCommand(listCmd())
root.AddCommand(psCmd())
root.AddCommand(statusCmd())
root.AddCommand(syncCmd())
root.AddCommand(adoptCmd())
root.AddCommand(serviceCmd())
root.AddCommand(pushCmd())
root.AddCommand(pullCmd())
root.AddCommand(nodeCmd())
root.AddCommand(purgeCmd())
if err := root.Execute(); err != nil {
log.Fatal(err)
os.Exit(1)
}
}