From 6717dad32bc8fbc000e417737b2238d0fe540a85 Mon Sep 17 00:00:00 2001 From: Madison Bullard Date: Fri, 2 Jan 2026 14:52:23 -0500 Subject: [PATCH] Private by default (#18) --- internal/cmd/gitinit.go | 27 +++++++++++++++++---------- internal/cmd/install.go | 21 ++++++++++----------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/internal/cmd/gitinit.go b/internal/cmd/gitinit.go index e271244d..cff19287 100644 --- a/internal/cmd/gitinit.go +++ b/internal/cmd/gitinit.go @@ -14,7 +14,7 @@ import ( var ( gitInitGitHub string - gitInitPrivate bool + gitInitPublic bool ) var gitInitCmd = &cobra.Command{ @@ -26,7 +26,7 @@ var gitInitCmd = &cobra.Command{ This command: 1. Creates a comprehensive .gitignore for Gas Town 2. Initializes a git repository if not already present - 3. Optionally creates a GitHub repository + 3. Optionally creates a GitHub repository (private by default) The .gitignore excludes: - Polecat worktrees and rig clones (recreated with 'gt sling' or 'gt rig add') @@ -39,15 +39,15 @@ And tracks: - Rig configs and hop/ directory Examples: - gt git-init # Init git with .gitignore - gt git-init --github=user/repo # Also create public GitHub repo - gt git-init --github=user/repo --private # Create private GitHub repo`, + gt git-init # Init git with .gitignore + gt git-init --github=user/repo # Create private GitHub repo (default) + gt git-init --github=user/repo --public # Create public GitHub repo`, RunE: runGitInit, } func init() { - gitInitCmd.Flags().StringVar(&gitInitGitHub, "github", "", "Create GitHub repo (format: owner/repo)") - gitInitCmd.Flags().BoolVar(&gitInitPrivate, "private", false, "Make GitHub repo private") + gitInitCmd.Flags().StringVar(&gitInitGitHub, "github", "", "Create GitHub repo (format: owner/repo, private by default)") + gitInitCmd.Flags().BoolVar(&gitInitPublic, "public", false, "Make GitHub repo public (repos are private by default)") rootCmd.AddCommand(gitInitCmd) } @@ -145,7 +145,7 @@ func runGitInit(cmd *cobra.Command, args []string) error { // Create GitHub repo if requested if gitInitGitHub != "" { - if err := createGitHubRepo(hqRoot, gitInitGitHub, gitInitPrivate); err != nil { + if err := createGitHubRepo(hqRoot, gitInitGitHub, !gitInitPublic); err != nil { return err } } @@ -222,7 +222,11 @@ func createGitHubRepo(hqRoot, repo string, private bool) error { return fmt.Errorf("invalid GitHub repo format (expected owner/repo): %s", repo) } - fmt.Printf(" → Creating GitHub repository %s...\n", repo) + visibility := "private" + if !private { + visibility = "public" + } + fmt.Printf(" → Creating %s GitHub repository %s...\n", visibility, repo) // Build gh repo create command args := []string{"repo", "create", repo, "--source", hqRoot} @@ -241,7 +245,10 @@ func createGitHubRepo(hqRoot, repo string, private bool) error { if err := cmd.Run(); err != nil { return fmt.Errorf("gh repo create failed: %w", err) } - fmt.Printf(" ✓ Created and pushed to GitHub: %s\n", repo) + fmt.Printf(" ✓ Created and pushed to GitHub: %s (%s)\n", repo, visibility) + if private { + fmt.Printf(" ℹ To make this repo public: %s\n", style.Dim.Render("gh repo edit "+repo+" --visibility public")) + } return nil } diff --git a/internal/cmd/install.go b/internal/cmd/install.go index b34d8465..fe76501b 100644 --- a/internal/cmd/install.go +++ b/internal/cmd/install.go @@ -24,7 +24,7 @@ var ( installNoBeads bool installGit bool installGitHub string - installPrivate bool + installPublic bool ) var installCmd = &cobra.Command{ @@ -46,11 +46,12 @@ See docs/hq.md for advanced HQ configurations including beads redirects, multi-system setups, and HQ templates. Examples: - gt install ~/gt # Create HQ at ~/gt - gt install . --name my-workspace # Initialize current dir - gt install ~/gt --no-beads # Skip .beads/ initialization - gt install ~/gt --git # Also init git with .gitignore - gt install ~/gt --github=user/repo # Also create GitHub repo`, + gt install ~/gt # Create HQ at ~/gt + gt install . --name my-workspace # Initialize current dir + gt install ~/gt --no-beads # Skip .beads/ initialization + gt install ~/gt --git # Also init git with .gitignore + gt install ~/gt --github=user/repo # Create private GitHub repo (default) + gt install ~/gt --github=user/repo --public # Create public GitHub repo`, Args: cobra.MaximumNArgs(1), RunE: runInstall, } @@ -62,8 +63,8 @@ func init() { installCmd.Flags().StringVar(&installPublicName, "public-name", "", "Public display name (defaults to town name)") installCmd.Flags().BoolVar(&installNoBeads, "no-beads", false, "Skip town beads initialization") installCmd.Flags().BoolVar(&installGit, "git", false, "Initialize git with .gitignore") - installCmd.Flags().StringVar(&installGitHub, "github", "", "Create GitHub repo (format: owner/repo)") - installCmd.Flags().BoolVar(&installPrivate, "private", false, "Make GitHub repo private (use with --github)") + installCmd.Flags().StringVar(&installGitHub, "github", "", "Create GitHub repo (format: owner/repo, private by default)") + installCmd.Flags().BoolVar(&installPublic, "public", false, "Make GitHub repo public (use with --github)") rootCmd.AddCommand(installCmd) } @@ -217,7 +218,7 @@ func runInstall(cmd *cobra.Command, args []string) error { // Initialize git if requested (--git or --github implies --git) if installGit || installGitHub != "" { fmt.Println() - if err := InitGitForHarness(absPath, installGitHub, installPrivate); err != nil { + if err := InitGitForHarness(absPath, installGitHub, !installPublic); err != nil { return fmt.Errorf("git initialization failed: %w", err) } } @@ -283,5 +284,3 @@ func initTownBeads(townPath string) error { } return nil } - -