feat: allow local repo reference clones to save disk

Use git --reference-if-able when a local repo is provided so rigs and crew share objects without changing remotes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Dan Shapiro
2026-01-02 22:30:39 -08:00
parent 386dbf85fb
commit 4727f5079f
9 changed files with 240 additions and 14 deletions

View File

@@ -251,6 +251,7 @@ Examples:
// Flags
var (
rigAddPrefix string
rigAddLocalRepo string
rigResetHandoff bool
rigResetMail bool
rigResetStale bool
@@ -279,6 +280,7 @@ func init() {
rigCmd.AddCommand(rigStopCmd)
rigAddCmd.Flags().StringVar(&rigAddPrefix, "prefix", "", "Beads issue prefix (default: derived from name)")
rigAddCmd.Flags().StringVar(&rigAddLocalRepo, "local-repo", "", "Local repo path to share git objects (optional)")
rigResetCmd.Flags().BoolVar(&rigResetHandoff, "handoff", false, "Clear handoff content")
rigResetCmd.Flags().BoolVar(&rigResetMail, "mail", false, "Clear stale mail messages")
@@ -330,6 +332,9 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
fmt.Printf("Creating rig %s...\n", style.Bold.Render(name))
fmt.Printf(" Repository: %s\n", gitURL)
if rigAddLocalRepo != "" {
fmt.Printf(" Local repo: %s\n", rigAddLocalRepo)
}
startTime := time.Now()
@@ -338,6 +343,7 @@ func runRigAdd(cmd *cobra.Command, args []string) error {
Name: name,
GitURL: gitURL,
BeadsPrefix: rigAddPrefix,
LocalRepo: rigAddLocalRepo,
})
if err != nil {
return fmt.Errorf("adding rig: %w", err)