Skip to content

ci: Add CI workflow, linting, and version infrastructure (Phase 1)#10

Merged
rianjs merged 6 commits intoopen-cli-collective:mainfrom
rianjs:feature/phase1-foundation-infrastructure
Jan 11, 2026
Merged

ci: Add CI workflow, linting, and version infrastructure (Phase 1)#10
rianjs merged 6 commits intoopen-cli-collective:mainfrom
rianjs:feature/phase1-foundation-infrastructure

Conversation

@rianjs
Copy link
Copy Markdown
Collaborator

@rianjs rianjs commented Jan 11, 2026

Summary

  • Add GitHub Actions CI workflow for PRs (build, test, lint)
  • Add golangci-lint configuration with standard linters
  • Update Makefile with standard targets and build-time version injection via ldflags
  • Add internal/version package for version info
  • Update root command to display version with commit and build date

This is Phase 1 of the CLI guide alignment roadmap (Issue #1).

Changes

CI Workflow (.github/workflows/ci.yml)

  • Triggers on push to main and PRs
  • Build and test job with race detection
  • Lint job using golangci-lint v1.62.2

Linting (.golangci.yml)

  • Enables: errcheck, govet, ineffassign, staticcheck, unused, misspell
  • Formatters: gofmt, goimports with local prefix
  • Excludes test files from errcheck

Makefile Updates

  • Build-time ldflags for VERSION, COMMIT, DATE
  • New targets: test-cover, test-short, lint, fmt, deps, verify
  • Build output now goes to bin/ directory

Version Package (internal/version/version.go)

  • Version, Commit, Date variables set via ldflags
  • Info() helper for formatted version string

Root Command

  • Uses version package for --version output
  • Shows: slack-cli vX.Y.Z (commit: abc123, built: 2024-...)

Test plan

  • make build produces binary with version info
  • ./bin/slack-cli --version shows version, commit, date
  • make lint passes with no issues
  • make test runs tests (currently no test files)

Fixes #1

🤖 Generated with Claude Code

rianjs and others added 6 commits January 11, 2026 09:38
Add CI workflow that runs on every push to main and every PR:
- Build and test job with race detection and coverage
- Lint job using golangci-lint

This establishes the foundation for validating all future changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add .golangci.yml with standard linters:
- errcheck, govet, ineffassign, staticcheck, unused, misspell
- gofmt and goimports formatters with local prefix

Fix lint issues found:
- Replace fmt.Sscanf with strconv.ParseInt in formatTimestamp
- Properly handle resp.Body.Close() errors using named returns
- Fix import ordering with goimports

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add build-time version injection via ldflags:
- VERSION from git describe
- COMMIT from git rev-parse
- DATE from current time

Add new targets:
- test-cover: Run tests with coverage report
- test-short: Run quick tests
- lint: Run golangci-lint
- fmt: Run gofmt and goimports
- deps: Download and tidy dependencies
- verify: Verify go.mod

Update build target to output to bin/ directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add version package with variables set via ldflags:
- Version: semantic version from git tag
- Commit: git commit hash
- Date: build timestamp

Includes Info() helper for formatted version string.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add version information to root command:
- Set Version field from version package
- Custom version template showing commit and build date

Now `slack-cli --version` shows:
  slack-cli vX.Y.Z (commit: abc123, built: 2024-...)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Apply goimports formatting with local prefix to ensure consistent
import ordering across all command files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
rianjs added a commit to rianjs/slack-cli that referenced this pull request Jan 11, 2026
Refactor all 21 command files to use options structs with injectable
client parameters. This enables unit testing by allowing mock clients
to be injected during tests.

Changes:
- Add XxxOptions struct to each command file
- Change runXxx(cmd, args) to runXxx(opts, client) or runXxx(args..., opts, client)
- If client is nil, create default client (backward compatible)
- Bind flags directly to options struct fields using XxxVar()

This completes Issue open-cli-collective#10 of the CLI alignment roadmap.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rianjs rianjs merged commit b6abbae into open-cli-collective:main Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Epic: Phase 1 - Foundation & Infrastructure

1 participant