diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb9b537..98fa257 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,21 +9,8 @@ permissions: contents: read jobs: - test: - name: Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - - name: Run tests - run: make test - - lint: - name: Lint + ci: + name: CI runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -35,18 +22,14 @@ jobs: - name: Install golangci-lint run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin - - name: Lint - run: make lint - - vet: - name: Vet - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod + - name: Format check + run: test -z "$(gofmt -l .)" - name: Vet run: make vet + + - name: Lint + run: make lint + + - name: Test + run: make test diff --git a/internal/changeset/snapshot.go b/internal/changeset/snapshot.go index 4051ff1..44c4b0f 100644 --- a/internal/changeset/snapshot.go +++ b/internal/changeset/snapshot.go @@ -94,8 +94,8 @@ func Take(root string) (Snapshot, error) { // Change represents a single file change. type Change struct { - Path string `json:"path"` // relative to mount root - Type string `json:"type"` // "created", "modified", "deleted" + Path string `json:"path"` // relative to mount root + Type string `json:"type"` // "created", "modified", "deleted" OldSize int64 `json:"old_size,omitempty"` NewSize int64 `json:"new_size,omitempty"` } @@ -149,8 +149,8 @@ func Diff(before, after Snapshot) []Change { // MountChanges groups changes by mount source. type MountChanges struct { - Source string `json:"source"` // host path - Target string `json:"target"` // guest path + Source string `json:"source"` // host path + Target string `json:"target"` // guest path Changes []Change `json:"changes"` } diff --git a/internal/changeset/snapshot_test.go b/internal/changeset/snapshot_test.go index 946fdb9..c752e6f 100644 --- a/internal/changeset/snapshot_test.go +++ b/internal/changeset/snapshot_test.go @@ -182,7 +182,7 @@ func TestFilterNoise_RemovesDirectories(t *testing.T) { func TestFilterNoise_RemovesIgnoredPrefixes(t *testing.T) { before := Snapshot{} after := Snapshot{ - ".git/HEAD": FileEntry{Path: ".git/HEAD", Size: 40}, + ".git/HEAD": FileEntry{Path: ".git/HEAD", Size: 40}, ".omc/state.json": FileEntry{Path: ".omc/state.json", Size: 200}, ".claude/settings.json": FileEntry{Path: ".claude/settings.json", Size: 50}, "main.go": FileEntry{Path: "main.go", Size: 300}, diff --git a/internal/cmd/prune.go b/internal/cmd/prune.go index 5a19742..2fddc73 100644 --- a/internal/cmd/prune.go +++ b/internal/cmd/prune.go @@ -9,7 +9,7 @@ import ( ) var ( - pruneAll bool + pruneAll bool pruneArtifacts bool ) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 26c182e..218744e 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -77,8 +77,8 @@ func TestExpandPaths(t *testing.T) { expected: []string{filepath.Join(home, "project:rw")}, }, { - name: "multiple paths with mixed mount options", - input: []string{"~/.ssh", "~/.gitconfig:ro", "~/code:rw"}, + name: "multiple paths with mixed mount options", + input: []string{"~/.ssh", "~/.gitconfig:ro", "~/code:rw"}, expected: []string{ filepath.Join(home, ".ssh"), filepath.Join(home, ".gitconfig:ro"), diff --git a/internal/guest/init_test.go b/internal/guest/init_test.go index be970de..1631d45 100644 --- a/internal/guest/init_test.go +++ b/internal/guest/init_test.go @@ -14,10 +14,10 @@ func TestGenerateClaudeInitScript_DNSForcedWithAllowlist(t *testing.T) { // This prevents the bug where DHCP sets a different DNS server that iptables then blocks. tests := []struct { - name string - policy *network.Policy - wantDNSForced bool - wantIPTables bool + name string + policy *network.Policy + wantDNSForced bool + wantIPTables bool }{ { name: "domain allowlist forces DNS", diff --git a/internal/network/allowlist_test.go b/internal/network/allowlist_test.go index 742db5d..50491b1 100644 --- a/internal/network/allowlist_test.go +++ b/internal/network/allowlist_test.go @@ -43,30 +43,30 @@ func TestParse(t *testing.T) { wantDomains: []string{"registry.npmjs.org", "npmjs.com"}, }, { - name: "multiple presets", - input: []string{"npm", "github"}, - wantAll: false, + name: "multiple presets", + input: []string{"npm", "github"}, + wantAll: false, wantBlocked: false, wantDomains: []string{"registry.npmjs.org", "npmjs.com", "github.com", "api.github.com", "raw.githubusercontent.com"}, }, { - name: "preset with literal domain", - input: []string{"npm", "custom.example.com"}, - wantAll: false, + name: "preset with literal domain", + input: []string{"npm", "custom.example.com"}, + wantAll: false, wantBlocked: false, wantDomains: []string{"registry.npmjs.org", "npmjs.com", "custom.example.com"}, }, { - name: "case insensitive", - input: []string{"NPM", "GitHub"}, - wantAll: false, + name: "case insensitive", + input: []string{"NPM", "GitHub"}, + wantAll: false, wantBlocked: false, wantDomains: []string{"registry.npmjs.org", "npmjs.com", "github.com", "api.github.com", "raw.githubusercontent.com"}, }, { - name: "duplicate domains removed", - input: []string{"npm", "npm"}, - wantAll: false, + name: "duplicate domains removed", + input: []string{"npm", "npm"}, + wantAll: false, wantBlocked: false, wantDomains: []string{"registry.npmjs.org", "npmjs.com"}, }, diff --git a/internal/vm/types.go b/internal/vm/types.go index 424dc43..86d0392 100644 --- a/internal/vm/types.go +++ b/internal/vm/types.go @@ -8,15 +8,15 @@ import ( ) type Config struct { - ProjectDir string - Mounts []session.VMMount - Network []string - NetworkPolicy *network.Policy - CPUs int - Memory string - Timeout time.Duration - ClaudeMode bool - HostClaudeDir string + ProjectDir string + Mounts []session.VMMount + Network []string + NetworkPolicy *network.Policy + CPUs int + Memory string + Timeout time.Duration + ClaudeMode bool + HostClaudeDir string ToolchainDir string CredentialsDir string ExtraDeps []string