Go · 1431 bytes Raw Blame History
1 // SPDX-License-Identifier: AGPL-3.0-or-later
2
3 package main
4
5 import (
6 "fmt"
7 "os"
8
9 "github.com/spf13/cobra"
10 )
11
12 var rootCmd = &cobra.Command{
13 Use: "shithubd",
14 Short: "shithub server: web, ssh, worker, and admin tooling",
15 Long: "shithubd is the entrypoint binary for shithub — a feature-complete, AGPL-licensed clone of GitHub.\nSubcommands cover the HTTP web server, the SSH dispatcher, background workers, migrations, and operational helpers.",
16 SilenceUsage: true,
17 SilenceErrors: true,
18 }
19
20 // Execute runs the root command and exits non-zero on error.
21 func Execute() {
22 if err := rootCmd.Execute(); err != nil {
23 fmt.Fprintln(os.Stderr, "shithubd:", err)
24 os.Exit(1)
25 }
26 }
27
28 func init() {
29 rootCmd.AddCommand(versionCmd)
30 rootCmd.AddCommand(webCmd)
31 rootCmd.AddCommand(migrateCmd)
32 rootCmd.AddCommand(seedCmd)
33
34 // Stubs for subcommands implemented in later sprints. They surface in
35 // `--help` so the operator-facing interface is discoverable from day one.
36 rootCmd.AddCommand(stubCmd("worker", "Run background workers", "S14"))
37 rootCmd.AddCommand(stubCmd("ssh-authkeys", "AuthorizedKeysCommand handler", "S07"))
38 rootCmd.AddCommand(stubCmd("ssh-shell", "Forced SSH shell dispatcher", "S07/S13"))
39 rootCmd.AddCommand(storageCmd)
40 rootCmd.AddCommand(stubCmd("hook", "Git hook entrypoint", "S14"))
41 rootCmd.AddCommand(stubCmd("admin", "Site-admin CLI", "S34"))
42 rootCmd.AddCommand(configCmd)
43 }
44