Skip to content

Commit bd3714c

Browse files
wuaclaude
authored andcommitted
Format Go code with goimports
Applied goimports formatting to all Go files in the project to ensure consistent import organization and code formatting. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 05714ba commit bd3714c

29 files changed

Lines changed: 3553 additions & 80 deletions

.github/workflows/pages.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Deploy GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths: [ 'docs/**' ]
7+
pull_request:
8+
branches: [ main ]
9+
paths: [ 'docs/**' ]
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Ruby
29+
uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: '3.1'
32+
bundler-cache: true
33+
working-directory: docs
34+
35+
- name: Setup Pages
36+
id: pages
37+
uses: actions/configure-pages@v4
38+
39+
- name: Create Gemfile
40+
run: |
41+
cat > docs/Gemfile << EOF
42+
source "https://rubygems.org"
43+
gem "jekyll", "~> 4.3"
44+
gem "minima", "~> 2.5"
45+
gem "jekyll-feed", "~> 0.12"
46+
gem "jekyll-sitemap", "~> 1.4"
47+
gem "jekyll-seo-tag", "~> 2.8"
48+
gem "webrick", "~> 1.7"
49+
EOF
50+
51+
- name: Install dependencies
52+
run: |
53+
cd docs
54+
bundle install
55+
56+
- name: Build with Jekyll
57+
run: |
58+
cd docs
59+
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
60+
env:
61+
JEKYLL_ENV: production
62+
63+
- name: Upload artifact
64+
uses: actions/upload-pages-artifact@v3
65+
with:
66+
path: docs/_site
67+
68+
deploy:
69+
if: github.ref == 'refs/heads/main'
70+
environment:
71+
name: github-pages
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
runs-on: ubuntu-latest
74+
needs: build
75+
steps:
76+
- name: Deploy to GitHub Pages
77+
id: deployment
78+
uses: actions/deploy-pages@v4

cmd/commands/add.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package commands
33
import (
44
"fmt"
55

6-
"github.com/spf13/cobra"
76
"github.com/albertywu/gitpool/config"
87
"github.com/albertywu/gitpool/internal"
98
"github.com/albertywu/gitpool/ipc"
9+
"github.com/spf13/cobra"
1010
)
1111

1212
var (
@@ -57,4 +57,4 @@ func NewAddCmd() *cobra.Command {
5757
cmd.Flags().StringVar(&addDefaultBranch, "default-branch", "main", "Default branch to checkout")
5858

5959
return cmd
60-
}
60+
}

cmd/commands/claim.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/spf13/cobra"
98
"github.com/albertywu/gitpool/config"
109
"github.com/albertywu/gitpool/internal"
1110
"github.com/albertywu/gitpool/ipc"
11+
"github.com/spf13/cobra"
1212
)
1313

1414
func NewClaimCmd() *cobra.Command {
1515
var branch string
16-
16+
1717
cmd := &cobra.Command{
1818
Use: "claim <repo-name> --branch <branch-name>",
1919
Short: "Claim a worktree from the pool",
@@ -35,12 +35,12 @@ Output:
3535
Args: cobra.ExactArgs(1),
3636
RunE: func(cmd *cobra.Command, args []string) error {
3737
repoName := args[0]
38-
38+
3939
// Validate branch flag is provided
4040
if branch == "" {
4141
return fmt.Errorf("--branch flag is required")
4242
}
43-
43+
4444
// Validate branch name
4545
if err := validateBranchName(branch); err != nil {
4646
return fmt.Errorf("invalid branch name: %w", err)
@@ -73,7 +73,7 @@ Output:
7373
if err != nil {
7474
return fmt.Errorf("failed to marshal response: %w", err)
7575
}
76-
76+
7777
var claimResp ipc.ClaimResponse
7878
if err := json.Unmarshal(jsonData, &claimResp); err != nil {
7979
return fmt.Errorf("failed to parse response: %w", err)
@@ -85,7 +85,7 @@ Output:
8585
return nil
8686
},
8787
}
88-
88+
8989
cmd.Flags().StringVar(&branch, "branch", "", "Branch name for the workspace (required)")
9090
cmd.MarkFlagRequired("branch")
9191

@@ -98,31 +98,31 @@ func validateBranchName(branch string) error {
9898
if branch == "" {
9999
return fmt.Errorf("branch name cannot be empty")
100100
}
101-
101+
102102
// Check for invalid characters
103103
invalidChars := []string{" ", "..", "~", "^", ":", "?", "*", "[", "\\", "@{"}
104104
for _, char := range invalidChars {
105105
if strings.Contains(branch, char) {
106106
return fmt.Errorf("branch name contains invalid character: %s", char)
107107
}
108108
}
109-
109+
110110
// Check for invalid patterns
111111
if branch[0] == '.' || branch[0] == '-' {
112112
return fmt.Errorf("branch name cannot start with '.' or '-'")
113113
}
114-
114+
115115
if branch[len(branch)-1] == '.' || branch[len(branch)-1] == '/' {
116116
return fmt.Errorf("branch name cannot end with '.' or '/'")
117117
}
118-
118+
119119
if branch == "@" {
120120
return fmt.Errorf("branch name cannot be '@'")
121121
}
122-
122+
123123
if strings.Contains(branch, "//") {
124124
return fmt.Errorf("branch name cannot contain consecutive slashes")
125125
}
126-
126+
127127
return nil
128128
}

cmd/commands/daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
"fmt"
66
"time"
77

8-
"github.com/spf13/cobra"
98
"github.com/albertywu/gitpool/config"
109
"github.com/albertywu/gitpool/daemon"
1110
"github.com/albertywu/gitpool/internal"
1211
"github.com/albertywu/gitpool/ipc"
12+
"github.com/spf13/cobra"
1313
)
1414

1515
func NewDaemonCmd() *cobra.Command {

cmd/commands/list.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/spf13/cobra"
109
"github.com/albertywu/gitpool/config"
1110
"github.com/albertywu/gitpool/internal"
1211
"github.com/albertywu/gitpool/ipc"
1312
"github.com/albertywu/gitpool/models"
13+
"github.com/spf13/cobra"
1414
)
1515

1616
// ANSI color codes
@@ -69,17 +69,17 @@ func NewListCmd() *cobra.Command {
6969
maxWidth := len("MAX")
7070
branchWidth := len("BRANCH")
7171
lastSyncWidth := len("LAST_SYNC")
72-
72+
7373
// Find maximum widths based on actual data
7474
for _, detail := range details {
7575
wt := detail.Worktree
7676
repo := detail.Repository
77-
77+
7878
// ID column
7979
if len(wt.Name) > idWidth {
8080
idWidth = len(wt.Name)
8181
}
82-
82+
8383
// Workspace column
8484
workspaceLen := 0
8585
if wt.Status == models.WorktreeStatusInUse && wt.Branch != nil && *wt.Branch != "" {
@@ -90,12 +90,12 @@ func NewListCmd() *cobra.Command {
9090
if workspaceLen > workspaceWidth {
9191
workspaceWidth = workspaceLen
9292
}
93-
93+
9494
// Repo column
9595
if len(repo.Name) > repoWidth {
9696
repoWidth = len(repo.Name)
9797
}
98-
98+
9999
// Status column
100100
statusLen := 0
101101
switch wt.Status {
@@ -109,18 +109,18 @@ func NewListCmd() *cobra.Command {
109109
if statusLen > statusWidth {
110110
statusWidth = statusLen
111111
}
112-
112+
113113
// MAX column
114114
maxStr := fmt.Sprintf("%d", repo.MaxWorktrees)
115115
if len(maxStr) > maxWidth {
116116
maxWidth = len(maxStr)
117117
}
118-
118+
119119
// Branch column
120120
if len(repo.DefaultBranch) > branchWidth {
121121
branchWidth = len(repo.DefaultBranch)
122122
}
123-
123+
124124
// Last sync column
125125
var lastFetchLen int
126126
if repo.LastFetchTime != nil {
@@ -165,7 +165,7 @@ func NewListCmd() *cobra.Command {
165165
}
166166

167167
// Print table header
168-
fmt.Printf("%s%s%-*s %-*s %-*s %-*s %-*s %-*s %-*s%s\n",
168+
fmt.Printf("%s%s%-*s %-*s %-*s %-*s %-*s %-*s %-*s%s\n",
169169
colorBold, colorGray,
170170
idWidth, "ID",
171171
workspaceWidth, "WORKSPACE",
@@ -175,7 +175,7 @@ func NewListCmd() *cobra.Command {
175175
branchWidth, "BRANCH",
176176
lastSyncWidth, "LAST_SYNC",
177177
colorReset)
178-
178+
179179
// Print separator
180180
fmt.Printf("%s%s %s %s %s %s %s %s%s\n",
181181
colorGray,
@@ -192,7 +192,7 @@ func NewListCmd() *cobra.Command {
192192
for _, detail := range details {
193193
wt := detail.Worktree
194194
repo := detail.Repository
195-
195+
196196
// Choose color based on status
197197
statusColor := colorGreen
198198
statusText := "IDLE"
@@ -220,11 +220,11 @@ func NewListCmd() *cobra.Command {
220220
} else {
221221
lastFetchDisplay = "never"
222222
}
223-
223+
224224
// Format workspace display based on status
225225
var workspaceDisplay string
226226
var workspaceColor string
227-
227+
228228
if wt.Status == models.WorktreeStatusInUse && wt.Branch != nil && *wt.Branch != "" {
229229
// Show branch name in yellow for claimed workspaces
230230
workspaceDisplay = *wt.Branch
@@ -234,13 +234,13 @@ func NewListCmd() *cobra.Command {
234234
workspaceDisplay = "UNCLAIMED"
235235
workspaceColor = colorGray
236236
}
237-
237+
238238
// Add terminal hyperlink to workspace path
239239
// Format: OSC 8 ; params ; URI ST display_text OSC 8 ; ; ST
240240
// OSC = \033] ST = \033\\
241-
terminalLink := fmt.Sprintf("\033]8;;file://%s\033\\%s%s%s\033]8;;\033\\",
241+
terminalLink := fmt.Sprintf("\033]8;;file://%s\033\\%s%s%s\033]8;;\033\\",
242242
wt.Path, workspaceColor, padRight(workspaceDisplay, workspaceWidth), colorReset)
243-
243+
244244
// Format the row with fixed widths
245245
fmt.Printf("%s%-*s%s %s %s%-*s%s %s%-*s%s %-*d %s%-*s%s %s%-*s%s\n",
246246
colorBlue, idWidth, wt.Name, colorReset,
@@ -251,7 +251,7 @@ func NewListCmd() *cobra.Command {
251251
colorCyan, branchWidth, repo.DefaultBranch, colorReset,
252252
colorGray, lastSyncWidth, lastFetchDisplay, colorReset)
253253
}
254-
254+
255255
// Print summary
256256
idle := 0
257257
inUse := 0
@@ -266,7 +266,7 @@ func NewListCmd() *cobra.Command {
266266
corrupt++
267267
}
268268
}
269-
269+
270270
fmt.Printf("\n%s%s%s\n", colorGray, strings.Repeat("─", totalWidth), colorReset)
271271
fmt.Printf("%sSummary:%s Total: %s%d%s | Idle: %s%d%s | In-Use: %s%d%s | Corrupt: %s%d%s\n\n",
272272
colorBold, colorReset,
@@ -278,4 +278,4 @@ func NewListCmd() *cobra.Command {
278278
return nil
279279
},
280280
}
281-
}
281+
}

cmd/commands/pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import (
44
"encoding/json"
55
"fmt"
66

7-
"github.com/spf13/cobra"
87
"github.com/albertywu/gitpool/config"
98
"github.com/albertywu/gitpool/internal"
109
"github.com/albertywu/gitpool/ipc"
1110
"github.com/albertywu/gitpool/models"
11+
"github.com/spf13/cobra"
1212
)
1313

1414
var poolStatusRepo string

cmd/commands/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package commands
33
import (
44
"fmt"
55

6-
"github.com/spf13/cobra"
76
"github.com/albertywu/gitpool/config"
87
"github.com/albertywu/gitpool/internal"
98
"github.com/albertywu/gitpool/ipc"
9+
"github.com/spf13/cobra"
1010
)
1111

1212
func NewReleaseCmd() *cobra.Command {

cmd/commands/remove.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package commands
33
import (
44
"fmt"
55

6-
"github.com/spf13/cobra"
76
"github.com/albertywu/gitpool/config"
87
"github.com/albertywu/gitpool/internal"
98
"github.com/albertywu/gitpool/ipc"
9+
"github.com/spf13/cobra"
1010
)
1111

1212
func NewRemoveCmd() *cobra.Command {
@@ -38,4 +38,4 @@ func NewRemoveCmd() *cobra.Command {
3838
return nil
3939
},
4040
}
41-
}
41+
}

0 commit comments

Comments
 (0)