From b5c0e5ec3d99ec4d754c6722cbe15d49f7a11fed Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:25:24 +0700 Subject: [PATCH 01/11] feat: issue template and release ci/cd --- .github/ISSUE_TEMPLATE/BugReport.yml | 51 +++++++++++++++ .github/ISSUE_TEMPLATE/NewFeature.yml | 36 +++++++++++ .github/ISSUE_TEMPLATE/README.md | 17 +++++ .github/workflows/release.yml | 91 +++++++++++++++++++++++++++ 4 files changed, 195 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/BugReport.yml create mode 100644 .github/ISSUE_TEMPLATE/NewFeature.yml create mode 100644 .github/ISSUE_TEMPLATE/README.md create mode 100644 .github/workflows/release.yml diff --git a/.github/ISSUE_TEMPLATE/BugReport.yml b/.github/ISSUE_TEMPLATE/BugReport.yml new file mode 100644 index 0000000..c6dbede --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BugReport.yml @@ -0,0 +1,51 @@ +name: Bug Report +description: Report a bug +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Please fill out the sections below to help everyone identify and fix the bug + - type: textarea + id: description + attributes: + label: Describe your issue + placeholder: When I click here this happens + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce + placeholder: | + 1. Enhance this function + 2. Refactor this + 3. Refactor that + validations: + required: true + - type: textarea + id: expected + attributes: + label: What was the expected result? + placeholder: I expected this to happen + - type: textarea + id: screenshots + attributes: + label: Put here any screenshots or videos (optional) + - type: textarea + id: deviceinfo + attributes: + label: Your OS and Browser (optional) + placeholder: | + - OS: Windows 10 + - Browser: Chrome 90.0 + - type: dropdown + id: assign + attributes: + label: "Would you like to work on this issue?" + options: + - "Yes" + - type: markdown + attributes: + value: | + Thanks for reporting this issue! We will get back to you as soon as possible. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/NewFeature.yml b/.github/ISSUE_TEMPLATE/NewFeature.yml new file mode 100644 index 0000000..e284c58 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/NewFeature.yml @@ -0,0 +1,36 @@ +name: New feature +description: Suggest or request a new feature +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Please fill out the sections below to properly describe the new feature you are suggesting. + - type: textarea + id: description + attributes: + label: Describe the feature + placeholder: A feature X that allows to do Y + validations: + required: true + - type: textarea + id: rationale + attributes: + label: It should be implemented because + placeholder: It will allow to do Y that is needed for Z + - type: textarea + id: context + attributes: + label: Additional context + placeholder: | + Add any other context or screenshots about the feature request here. + - type: dropdown + id: assign + attributes: + label: "Would you like to work on this issue?" + options: + - "Yes" + - type: markdown + attributes: + value: | + Thanks for your suggestion! Let's see together if it can be implemented. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/README.md b/.github/ISSUE_TEMPLATE/README.md new file mode 100644 index 0000000..d3c7471 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/README.md @@ -0,0 +1,17 @@ +# Issues template + +I created this template to help you report bugs or suggest new features more easily without having to manually write them. + +If you have any questions, please submit a Pull Request (PR) or open Issues. + +If you can improve my issues template, please open a PR. + + +image +
You can choose one of these three
+ +image +
Bug Report
+ +image +
New Feature
\ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bf2b7fe --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,91 @@ +name: Release + +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + branches: [ '**' ] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + quality-and-release: + name: Quality & Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + cache: true + + - name: Run Linter + uses: golangci/golangci-lint-action@v6 + with: + version: latest + + - name: Run Tests + run: go test -v ./... + + - name: Build Binaries + if: startsWith(github.ref, 'refs/tags/v') + run: | + mkdir -p dist + platforms=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64") + for platform in "${platforms[@]}"; do + os_arch=(${platform//\// }) + GOOS=${os_arch[0]} + GOARCH=${os_arch[1]} + output_name="iris" + [ "$GOOS" == "windows" ] && output_name="iris.exe" + + echo "Building $GOOS/$GOARCH..." + GOOS=$GOOS GOARCH=$GOARCH go build \ + -ldflags="-s -w -X github.com/versenilvis/iris/root.Version=${{ github.ref_name }}" \ + -trimpath -o "dist/$output_name" main.go + + cd dist + tar -czf "iris_${GOOS}_${GOARCH}.tar.gz" "$output_name" + rm "$output_name" + cd .. + done + + - name: Prepare Release Notes + if: startsWith(github.ref, 'refs/tags/v') + run: | + # Generate standard GitHub release notes + GEN_NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes -f tag_name=${{ github.ref_name }} --jq .body) + + echo "RELEASE_BODY<> $GITHUB_ENV + echo "$GEN_NOTES" >> $GITHUB_ENV + echo "" >> $GITHUB_ENV + echo "## Installation" >> $GITHUB_ENV + echo "\`\`\`bash" >> $GITHUB_ENV + echo "curl -sS https://raw.githubusercontent.com/versenilvis/iris/main/scripts/install.sh | sudo sh" >> $GITHUB_ENV + echo "\`\`\`" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v1 + with: + name: ${{ github.ref_name }} + body: ${{ env.RELEASE_BODY }} + files: dist/*.tar.gz + generate_release_notes: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9981ff278127d0316bde3d20c09ae7269075dc45 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:28:08 +0700 Subject: [PATCH 02/11] chore(pkg): bump to v1.25 --- .github/workflows/release.yml | 6 ++---- go.mod | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf2b7fe..1ab5ea1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,13 +28,11 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.24' + go-version: '1.25' cache: true - name: Run Linter - uses: golangci/golangci-lint-action@v6 - with: - version: latest + run: go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run ./... - name: Run Tests run: go test -v ./... diff --git a/go.mod b/go.mod index 0de7f5d..cbb72bd 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/versenilvis/iris -go 1.26.1 +go 1.25.0 require ( github.com/charmbracelet/lipgloss v1.1.0 From e38300eec38bf3da0ae4ad418b812277509e0cbf Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:35:00 +0700 Subject: [PATCH 03/11] ci/cd: spelling --- .github/workflows/spelling.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/spelling.yml diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml new file mode 100644 index 0000000..8e21fe0 --- /dev/null +++ b/.github/workflows/spelling.yml @@ -0,0 +1,26 @@ +name: Spelling + +permissions: + contents: read + +on: + push: + branches: + - main + pull_request: + +env: + CLICOLOR: 1 + +jobs: + spelling: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Spell Check Repo + uses: crate-ci/typos@v1.29.4 From f3b94bbbb2a30d8bc4b1a96d0e257f676bb6bdb6 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:35:57 +0700 Subject: [PATCH 04/11] chore(lint): downgrade to v1 --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 75d886d..002aa5d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,4 @@ -version: 2 + run: timeout: 5m From 07b7d19347bfe3fe7188e331bfc6b10af937ad58 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:37:39 +0700 Subject: [PATCH 05/11] fix: typo --- _typos.toml | 2 ++ root/wrapper.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 _typos.toml diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..8078777 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +hel = "hel" diff --git a/root/wrapper.go b/root/wrapper.go index eeaceb0..f31b01b 100644 --- a/root/wrapper.go +++ b/root/wrapper.go @@ -121,7 +121,7 @@ func runWrapper() { case syscall.SIGWINCH: _ = pty.InheritSize(os.Stdin, ptmx) // handle terminal window resize // this is the core feature of reloading - // it helps IRIS reload itself that you dont need to restart the shell mannually + // it helps IRIS reload itself that you dont need to restart the shell manually // SIGUSR1 is the signal to active reload when you type "just reload" case syscall.SIGUSR1: // trigger iris reload by executing itself again @@ -508,10 +508,10 @@ func runWrapper() { _, _ = ptmx.Write([]byte{0x15}) // ctrl+u to clear line _, _ = ptmx.Write([]byte(selected)) - overlay.Cursor = 0 // this prevents when you tab, it switchs between suggestions non-stop + overlay.Cursor = 0 // this prevents when you tab, it switches between suggestions non-stop shouldOverlayDraw = true // <- rerender after tab to choose, if you set to false, - // when you press tab continuely, it will print all folder from menu suggestions + // when you press tab continually, it will print all folder from menu suggestions // and make the cursor jump to next line userNavigated = false } From 8108341130e45dd8ac690d7e3f1e3370257925fb Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:42:15 +0700 Subject: [PATCH 06/11] chore(pkg): remove local pkg --- go.mod | 4 ---- go.sum | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index cbb72bd..c8d0a8b 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,3 @@ require ( github.com/spf13/pflag v1.0.10 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect ) - -// this is my personal project, I want to point to my local folder to debug and develop -// the github version is the stable one -replace github.com/versenilvis/fuzzy => ../fuzzy diff --git a/go.sum b/go.sum index baf79b0..12854d3 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,8 @@ github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiT github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/versenilvis/fuzzy v0.1.0-rc h1:QfEBVtjSFPklFeLP4cxLLpjDNauOyzcegYvyI2tT7UY= +github.com/versenilvis/fuzzy v0.1.0-rc/go.mod h1:TCgCwxBa4px8NhCXH8SPePCyJsf/qPsl1i+G/HDdjyg= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= From bc4dacd9e51d8fbec09197fbd5b06e6cdf3038c9 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:51:59 +0700 Subject: [PATCH 07/11] ci/cd(lint): bump to v2 --- .github/workflows/release.yml | 4 +++- .golangci.yml | 2 +- tests/root/update_test.go | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ab5ea1..88cd452 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,9 @@ jobs: cache: true - name: Run Linter - run: go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run ./... + uses: golangci/golangci-lint-action@v8 + with: + version: v2.1.6 - name: Run Tests run: go test -v ./... diff --git a/.golangci.yml b/.golangci.yml index 002aa5d..75d886d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,4 @@ - +version: 2 run: timeout: 5m diff --git a/tests/root/update_test.go b/tests/root/update_test.go index 898f7e1..7a32314 100644 --- a/tests/root/update_test.go +++ b/tests/root/update_test.go @@ -37,12 +37,14 @@ func TestUpdateState(t *testing.T) { if err != nil { t.Fatal(err) } - defer os.RemoveAll(tmpDir) + defer func() { _ = os.RemoveAll(tmpDir) }() // Override home dir for testing homeBackup := os.Getenv("HOME") - os.Setenv("HOME", tmpDir) - defer os.Setenv("HOME", homeBackup) + if err := os.Setenv("HOME", tmpDir); err != nil { + t.Fatal(err) + } + defer func() { _ = os.Setenv("HOME", homeBackup) }() // Ensure .iris directory exists _ = os.MkdirAll(filepath.Join(tmpDir, ".iris"), 0755) From e062c0a80d169da7cacb593dd6e8d6733970f495 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 01:57:35 +0700 Subject: [PATCH 08/11] chore(pkg): downgrade to v1.24 --- .github/workflows/release.yml | 4 ++-- go.mod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88cd452..3e8a243 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,13 +28,13 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.25' + go-version: '1.24' cache: true - name: Run Linter uses: golangci/golangci-lint-action@v8 with: - version: v2.1.6 + version: v2.11.4 - name: Run Tests run: go test -v ./... diff --git a/go.mod b/go.mod index c8d0a8b..e8646e6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/versenilvis/iris -go 1.25.0 +go 1.24.0 require ( github.com/charmbracelet/lipgloss v1.1.0 From 56e04be4098b22662a7ad96b3a10cbe4cf8752e0 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 02:01:50 +0700 Subject: [PATCH 09/11] fix(lint):err check rules and fix config --- .golangci.yml | 62 +++++++++++++++++++++++++++++---------------------- ipc/server.go | 5 ++++- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 75d886d..35a51e0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,35 +1,43 @@ -version: 2 +version: "2" run: - timeout: 5m - tests: true + timeout: 5m + tests: true linters: - disable-all: true - enable: - - errcheck - - govet - - staticcheck - - errorlint - - errname - - bodyclose - - sqlclosecheck - - noctx - - ineffassign - - unconvert - - bidichk - -linters-settings: + default: none + enable: + - errcheck + - govet + - staticcheck + - errorlint + - errname + - bodyclose + - sqlclosecheck + - noctx + - ineffassign + - unconvert + - bidichk + settings: errcheck: - check-type-assertions: true - check-blank: true - + check-type-assertions: true + check-blank: false + exclude-functions: + - fmt.Print + - fmt.Println + - fmt.Printf + - fmt.Fprint + - fmt.Fprintln + - fmt.Fprintf govet: - enable-all: true - disable: - - fieldalignment + enable-all: true + disable: + - fieldalignment + exclusions: + rules: + - linters: [errcheck] + source: "^\\s*defer " issues: - exclude-use-default: false - max-issues-per-linter: 0 - max-same-issues: 0 + max-issues-per-linter: 0 + max-same-issues: 0 \ No newline at end of file diff --git a/ipc/server.go b/ipc/server.go index 10e50b1..d5a7702 100644 --- a/ipc/server.go +++ b/ipc/server.go @@ -24,7 +24,10 @@ func NewServer() (*Server, error) { return nil, err } - localAddr := conn.LocalAddr().(*net.UDPAddr) + localAddr, ok := conn.LocalAddr().(*net.UDPAddr) + if !ok { + return nil, net.InvalidAddrError("not a UDP address") + } s := &Server{ conn: conn, From f79cfa0e984e3b9e517df0e8c5bd261c17e4b2b7 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 02:10:12 +0700 Subject: [PATCH 10/11] ci/cd(release): run go mod tidy before linter --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e8a243..4ede34a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,9 @@ jobs: with: go-version: '1.24' cache: true + + - name: Tidy + run: go mod tidy - name: Run Linter uses: golangci/golangci-lint-action@v8 From ae067fa2004790f677f8350b744b3ff34f365ff1 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 10 May 2026 02:13:07 +0700 Subject: [PATCH 11/11] fix(test): add user email and name to support ci/cd --- tests/dev/git_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/dev/git_test.go b/tests/dev/git_test.go index 64147ce..2b01912 100644 --- a/tests/dev/git_test.go +++ b/tests/dev/git_test.go @@ -22,10 +22,14 @@ func TestGitSuggestions(t *testing.T) { ctx := context.Background() // Initialize git repo _ = exec.CommandContext(ctx, "git", "init").Run() + + _ = exec.CommandContext(ctx, "git", "config", "user.email", "iris-test@example.com").Run() // this is for ci/cd + _ = exec.CommandContext(ctx, "git", "config", "user.name", "Iris Test").Run() // this is for ci/cd + _ = os.WriteFile(filepath.Join(tmp, "file.go"), []byte("package main"), 0644) _ = exec.CommandContext(ctx, "git", "add", ".").Run() _ = exec.CommandContext(ctx, "git", "commit", "-m", "initial").Run() - + // Create branches _ = exec.CommandContext(ctx, "git", "branch", "feature/login").Run() _ = exec.CommandContext(ctx, "git", "branch", "dev").Run() @@ -87,7 +91,7 @@ func TestGitSuggestions(t *testing.T) { t.Run("git reset options", func(t *testing.T) { // git reset --soft origin/main -> should be accepted (just testing lookup doesn't crash) _ = core.Lookup("git reset --soft origin/main ") - + // git reset HEAD -> show files res := core.Lookup("git reset HEAD ") found := false @@ -145,7 +149,7 @@ func TestGitSuggestions(t *testing.T) { // find current branch out, _ := exec.CommandContext(ctx, "git", "rev-parse", "--abbrev-ref", "HEAD").Output() current := strings.TrimSpace(string(out)) - + res := core.Lookup("git checkout ") for _, r := range res { if strings.Contains(r.Cmd, current) && !strings.Contains(r.Cmd, "remotes/") {