-
Notifications
You must be signed in to change notification settings - Fork 1
Develop #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Develop #1
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6dc9926
init the project
tutunak 2a8e1fe
added github actions
tutunak 6ab91df
fix the error
tutunak 04303a8
fix only own task
tutunak ffba119
fixed select issue
tutunak b4f7a04
fix the problem with tasks
tutunak 9a86291
rename task to issue to be more sonsistent
tutunak 451d78c
added readme
tutunak 799676c
added generated CLAUDE.md
tutunak 2251e6f
update CI and release workflows to use Go version 1.24
tutunak 659c465
sucomand was renamed
tutunak 326a7f7
format url as md
tutunak 416816d
fix the formatting for readme, tables, text
tutunak ace0a5c
fix path for module
tutunak 8d0a934
the default owner changed
tutunak e580be4
added error code processing in the clint test
tutunak f4ca9a1
complete rename of module
tutunak 1df7b2b
Fix env overrides when config file doesn't exist
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| - name: Download dependencies | ||
| run: go mod download | ||
|
|
||
| - name: Run tests | ||
| run: go test -v -race -coverprofile=coverage.out ./... | ||
|
|
||
| - name: Upload coverage | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| files: coverage.out | ||
| continue-on-error: true | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@v6 | ||
| with: | ||
| version: latest | ||
|
|
||
| build: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| goos: [linux, darwin] | ||
| goarch: [amd64, arm64] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| - name: Build | ||
| env: | ||
| GOOS: ${{ matrix.goos }} | ||
| GOARCH: ${{ matrix.goarch }} | ||
| run: | | ||
| go build -ldflags "-X main.version=${{ github.sha }}" -o jcli-${{ matrix.goos }}-${{ matrix.goarch }} . | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: jcli-${{ matrix.goos }}-${{ matrix.goarch }} | ||
| path: jcli-${{ matrix.goos }}-${{ matrix.goarch }} | ||
|
|
||
| integration: | ||
| runs-on: ubuntu-latest | ||
| needs: [test, build] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| - name: Run integration tests | ||
| run: go test -v -tags=integration ./tests/integration/... | ||
tutunak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| - name: Run tests | ||
| run: go test -v -race ./... | ||
|
|
||
| - name: Run integration tests | ||
| run: go test -v -tags=integration ./tests/integration/... | ||
|
|
||
tutunak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| release: | ||
| runs-on: ubuntu-latest | ||
| needs: test | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| - name: Calculate next version | ||
| id: version | ||
| run: | | ||
| # Get the latest tag | ||
| LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | ||
| echo "Latest tag: $LATEST_TAG" | ||
|
|
||
| # Extract version numbers | ||
| VERSION=${LATEST_TAG#v} | ||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | ||
|
|
||
| # Get commit messages since last tag | ||
| if [ "$LATEST_TAG" = "v0.0.0" ]; then | ||
| COMMITS=$(git log --pretty=format:"%s" HEAD) | ||
| else | ||
| COMMITS=$(git log --pretty=format:"%s" ${LATEST_TAG}..HEAD) | ||
| fi | ||
|
|
||
| # Determine version bump based on conventional commits | ||
| if echo "$COMMITS" | grep -qE "^BREAKING CHANGE:|^[a-z]+!:"; then | ||
| MAJOR=$((MAJOR + 1)) | ||
| MINOR=0 | ||
| PATCH=0 | ||
| elif echo "$COMMITS" | grep -qE "^feat(\(.+\))?:"; then | ||
| MINOR=$((MINOR + 1)) | ||
| PATCH=0 | ||
| else | ||
| PATCH=$((PATCH + 1)) | ||
| fi | ||
|
|
||
| NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" | ||
| echo "New version: $NEW_VERSION" | ||
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| # Check if this version already exists | ||
| if git tag | grep -q "^${NEW_VERSION}$"; then | ||
| echo "Tag $NEW_VERSION already exists, skipping release" | ||
| echo "skip=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "skip=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Run GoReleaser | ||
| if: steps.version.outputs.skip != 'true' | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: latest | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.version }} | ||
|
|
||
| - name: Create and push tag | ||
| if: steps.version.outputs.skip != 'true' | ||
| run: | | ||
| git config user.name "GitHub Actions" | ||
| git config user.email "actions@github.com" | ||
| git tag ${{ steps.version.outputs.version }} | ||
| git push origin ${{ steps.version.outputs.version }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Binaries | ||
| jcli | ||
| *.exe | ||
| *.exe~ | ||
| *.dll | ||
| *.so | ||
| *.dylib | ||
|
|
||
| # Test binary | ||
| *.test | ||
|
|
||
| # Output of go coverage tool | ||
| *.out | ||
| coverage.html | ||
|
|
||
| # Dependency directories | ||
| vendor/ | ||
|
|
||
| # Go workspace file | ||
| go.work | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Build output | ||
| dist/ | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| version: 2 | ||
|
|
||
| before: | ||
| hooks: | ||
| - go mod tidy | ||
|
|
||
| builds: | ||
| - env: | ||
| - CGO_ENABLED=0 | ||
| goos: | ||
| - linux | ||
| - darwin | ||
| goarch: | ||
| - amd64 | ||
| - arm64 | ||
| ldflags: | ||
| - -s -w -X main.version={{.Version}} | ||
|
|
||
| archives: | ||
| - format: tar.gz | ||
| name_template: >- | ||
| {{ .ProjectName }}_ | ||
| {{- .Version }}_ | ||
| {{- .Os }}_ | ||
| {{- .Arch }} | ||
| format_overrides: | ||
| - goos: windows | ||
| format: zip | ||
|
|
||
| checksum: | ||
| name_template: 'checksums.txt' | ||
|
|
||
| snapshot: | ||
| version_template: "{{ incpatch .Version }}-next" | ||
|
|
||
| changelog: | ||
| sort: asc | ||
| filters: | ||
| exclude: | ||
| - '^docs:' | ||
| - '^test:' | ||
| - '^chore:' | ||
|
|
||
| release: | ||
| github: | ||
| owner: tutunak | ||
| name: jcli | ||
| draft: false | ||
| prerelease: auto | ||
| name_template: "{{.Tag}}" | ||
tutunak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Build Commands | ||
|
|
||
| ```bash | ||
| make build # Build binary with version from git tags | ||
| make test # Run tests with race detection and coverage | ||
| make lint # Run golangci-lint | ||
| make test-integration # Run integration tests (requires Jira credentials) | ||
tutunak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| go test ./internal/branch/... # Run tests for a specific package | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| jcli is a CLI tool for Jira workflow management. It uses manual argument parsing (no CLI framework). | ||
|
|
||
| ### Package Structure | ||
|
|
||
| - **cmd/** - Command handlers. `root.go` routes to subcommands via switch statement on `os.Args[1]`. Each command file (e.g., `issue_select.go`) contains one handler function. | ||
|
|
||
| - **internal/jira/** - Jira API client using REST API v3. `Client` interface allows mocking. `HTTPClient` implements actual API calls with Basic Auth. Note: descriptions use `json.RawMessage` because Jira v3 returns ADF format, not strings. | ||
|
|
||
| - **internal/config/** - YAML config at `~/.config/jcli/config.yaml`. Supports `JIRA_API_TOKEN` env var override. | ||
|
|
||
| - **internal/state/** - JSON state at `~/.local/state/jcli/state.json`. Tracks currently selected issue. | ||
|
|
||
| - **internal/branch/** - Branch name generator. Format: `<ISSUE-KEY>-<normalized-summary>-<random>`. Issue key preserves original case; summary is lowercased. | ||
|
|
||
| - **internal/tui/** - Interactive issue selector using `github.com/charmbracelet/huh`. | ||
|
|
||
| ### Key Design Decisions | ||
|
|
||
| - No CLI framework (cobra, urfave/cli) - uses manual `os.Args` parsing | ||
| - `Client` interface in jira package enables `MockClient` for testing | ||
| - XDG Base Directory paths for config and state | ||
| - JQL query includes `assignee = currentUser()` to show only user's assigned issues | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| .PHONY: build test lint clean install all | ||
|
|
||
| VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") | ||
| LDFLAGS := -ldflags "-X main.version=$(VERSION)" | ||
|
|
||
| all: lint test build | ||
|
|
||
| build: | ||
| go build $(LDFLAGS) -o jcli . | ||
|
|
||
| build-all: | ||
| GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o dist/jcli-linux-amd64 . | ||
| GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o dist/jcli-linux-arm64 . | ||
| GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o dist/jcli-darwin-amd64 . | ||
| GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o dist/jcli-darwin-arm64 . | ||
tutunak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| test: | ||
| go test -v -race -coverprofile=coverage.out ./... | ||
|
|
||
| test-integration: | ||
| go test -v -tags=integration ./tests/integration/... | ||
|
|
||
| lint: | ||
| golangci-lint run ./... | ||
|
|
||
| clean: | ||
| rm -f jcli coverage.out | ||
| rm -rf dist/ | ||
|
|
||
| install: build | ||
| cp jcli $(GOPATH)/bin/ | ||
tutunak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| coverage: test | ||
| go tool cover -html=coverage.out -o coverage.html | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
Repository: tutunak/jcli
Length of output: 149
🏁 Script executed:
Repository: tutunak/jcli
Length of output: 1355
Pin golangci-lint to a specific version instead of
latest.Using
version: latestundermines CI reproducibility; other action versions (checkout, setup-go) and the Go version itself are pinned, but golangci-lint is left unpinned and can introduce breaking changes without notice. Specify a concrete version (e.g.,v1.61.0or newer) aligned with your project's requirements.♻️ Suggested change
- name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: latest + version: v1.61.0📝 Committable suggestion
🤖 Prompt for AI Agents