Skip to content

Commit 804252c

Browse files
refactor: prep cli for migration (#247)
# Refactor: Reorganize CLI code structure ## Overview This PR reorganizes the World CLI codebase into a more standard Go project structure. The code has been moved from a flat structure to a hierarchical one, with packages organized under `internal/app/world-cli` and shared utilities under `internal/pkg`. This improves maintainability and follows Go best practices for package organization. ## Brief Changelog - Moved command implementations from separate packages to a single `main` package - Renamed command structs to be more descriptive (e.g., `StartCmd` → `StartCardinalCmd`) - Relocated core functionality to `internal/app/world-cli` directory - Moved utility packages to `internal/pkg` directory - Removed `.vscode/launch.json` configuration file - Consolidated deployment type constants in the models package - Removed unused code and dependencies ## Testing and Verifying This change is a code reorganization without functional changes. The existing tests have been updated to work with the new structure and should continue to pass. --------- Co-authored-by: Ed Zavada <edmund@argus.gg>
1 parent fd55650 commit 804252c

210 files changed

Lines changed: 880 additions & 1221 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,36 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4
20+
2021
- name: Setup Golang
2122
uses: actions/setup-go@v5
2223
with:
2324
go-version: ${{ env.GO_VERSION }}
2425
## skip cache, use Namespace volume cache
2526
cache: false
27+
2628
- name: Init Dummy Git config for testing
2729
run: |
2830
git config --global user.email "github-action@mail.com"
2931
git config --global user.name "github-action"
32+
3033
- name: Setup Namespace cache
3134
uses: namespacelabs/nscloud-cache-action@v1
3235
with:
3336
cache: go
37+
3438
- name: Install Task
3539
run: |
3640
go install github.com/go-task/task/v3/cmd/task@latest
41+
42+
- name: Generate Protobuf files
43+
working-directory: internal/app/world-cli
44+
run: task buf:generate
45+
3746
- name: Run unit tests with coverage
47+
working-directory: internal/app/world-cli
3848
run: task test:coverage
49+
3950
- name: Upload coverage to Codecov
4051
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
4152
uses: codecov/codecov-action@v4
@@ -52,12 +63,14 @@ jobs:
5263
steps:
5364
- name: Checkout
5465
uses: actions/checkout@v4
66+
5567
- name: Setup Golang
5668
uses: actions/setup-go@v5
5769
with:
5870
go-version: ${{ env.GO_VERSION }}
5971
## skip cache, use Namespace volume cache
6072
cache: false
73+
6174
- name: Setup Namespace cache
6275
uses: namespacelabs/nscloud-cache-action@v1
6376
with:
@@ -66,17 +79,28 @@ jobs:
6679
/home/runner/go/pkg
6780
/home/runner/.cache/go-build
6881
/home/runner/.cache/golangci-lint
82+
6983
- name: Find go path
70-
id: go-dir
7184
run: echo "path=$(go list -f '{{.Dir}}/...' -m | xargs)" >> $GITHUB_OUTPUT
7285
## Equivalent to 'make lint' arguments
86+
87+
- name: Install Task
88+
run: |
89+
go install github.com/go-task/task/v3/cmd/task@latest
90+
91+
- name: Generate Protobuf files
92+
working-directory: internal/app/world-cli
93+
run: task buf:generate
94+
7395
- name: golangci-lint
7496
uses: golangci/golangci-lint-action@v7
7597
with:
98+
working-directory: internal/app/world-cli
7699
version: latest
77100
args: --timeout=10m -v ${{ steps.go-dir.outputs.path }}
78101
## skip cache, use Namespace volume cache
79102
skip-cache: true
103+
80104

81105
lint-md:
82106
name: Lint (markdown)
@@ -89,7 +113,7 @@ jobs:
89113
- uses: xt0rted/markdownlint-problem-matcher@v3
90114
- uses: articulate/actions-markdownlint@v1
91115
with:
92-
config: .markdownlint.yaml
116+
config: internal/app/world-cli/.markdownlint.yaml
93117
ignore: vendor
94118
version: 0.39.0
95119

@@ -99,12 +123,20 @@ jobs:
99123
steps:
100124
- name: Checkout
101125
uses: actions/checkout@v4
126+
102127
- name: Install Go
103128
uses: actions/setup-go@v5
104129
with:
105130
go-version: ${{ env.GO_VERSION }}
131+
106132
- name: Install Task
107133
run: |
108134
go install github.com/go-task/task/v3/cmd/task@latest
135+
136+
- name: Generate Protobuf files
137+
working-directory: internal/app/world-cli
138+
run: task buf:generate
139+
109140
- name: Build
141+
working-directory: internal/app/world-cli
110142
run: task build

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
distribution: goreleaser
3131
version: ${{ env.GORELEASER_VERSION }}
3232
args: release --clean
33+
working-directory: internal/app/world-cli
3334
env:
3435
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3536
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}

.gitignore

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,3 @@
1-
# =======================
2-
# General Go .gitignore
3-
# =======================
4-
5-
# Binaries for programs and plugins
6-
*.exe
7-
*.exe~
8-
*.dll
9-
*.so
10-
*.dylib
11-
*.a
12-
*.o
13-
*.obj
14-
15-
# Go test binaries and debug
16-
*.test
17-
debug
18-
debug.test
19-
20-
# Coverage and profiling outputs
21-
*.out
22-
*.prof
23-
*.trace
24-
coverage.*
25-
26-
# Dependency directories
27-
vendor/
28-
node_modules/
29-
30-
# Go workspace
31-
go.work
32-
go.work.sum
33-
34-
# Build artifacts
35-
/world-cli
36-
/world
37-
/dist/
38-
/bin/
39-
/build/
40-
41-
# IDEs and Editors
42-
.idea/
43-
.vscode/
44-
*.swp
45-
*.swo
46-
*~
47-
*.sublime-project
48-
*.sublime-workspace
49-
50-
# OS-generated files
511
.DS_Store
52-
.DS_Store?
53-
._*
54-
.Spotlight-V100
55-
.Trashes
56-
ehthumbs.db
57-
Thumbs.db
58-
59-
# Env files
60-
.env
61-
.env.local
62-
.env.*.local
63-
64-
# Test and temporary directories
65-
/starter-game
66-
/tmp/
67-
/temp/
68-
69-
# Logs
70-
*.log
71-
72-
# Generated Go files (protobuf, codegen)
73-
*.pb.go
74-
*.pb.gw.go
75-
*.gen.go
76-
77-
junit.xml
78-
**/junit.xml
2+
.idea/
3+
/dist/

.vscode/launch.json

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)