devbox/cmd/devbox-hub/main.go
shoemoney 79f91597ad feat(M0): skeleton — cobra CLI, Ed25519 identity, machine config 🦴
- cmd/devbox: join/status/version + stubbed start/stop/publish
- cmd/devbox-hub: version + stubbed serve/token
- internal/identity: Ed25519 keypair gen/save/load (0600), fingerprint
- internal/config: daemon.toml read/write (hub + mounts), XDG-aware dir
- tests: identity round-trip/idempotent, config round-trip

devbox join now generates a device identity and records the hub locally.
2026-06-22 23:01:00 -05:00

43 lines
975 B
Go

// Command devbox-hub is the hub server + admin CLI.
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var version = "0.0.0-dev"
func main() {
root := &cobra.Command{
Use: "devbox-hub",
Short: "🛰️ devbox hub server",
SilenceUsage: true,
SilenceErrors: true,
}
root.AddCommand(
&cobra.Command{
Use: "version",
Short: "print version",
Run: func(c *cobra.Command, _ []string) { fmt.Fprintln(c.OutOrStdout(), "devbox-hub", version) },
},
hubStub("serve", "🚀 run the hub server", "M2"),
hubStub("token", "🎟️ mint/rotate the join token", "M2"),
)
if err := root.Execute(); err != nil {
fmt.Fprintln(os.Stderr, "error:", err)
os.Exit(1)
}
}
func hubStub(use, short, milestone string) *cobra.Command {
return &cobra.Command{
Use: use,
Short: short,
RunE: func(*cobra.Command, []string) error {
return fmt.Errorf("%q not implemented yet (arrives in %s)", use, milestone)
},
}
}