@bniladridas/cursor 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/.clang-tidy +28 -0
  2. package/.dockerignore +56 -0
  3. package/.env.example +29 -0
  4. package/.github/CODEOWNERS +2 -0
  5. package/.github/ISSUE_TEMPLATE/blank.md +27 -0
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
  7. package/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
  8. package/.github/SECURITY.md +24 -0
  9. package/.github/codeql/codeql-config.yml +8 -0
  10. package/.github/dependabot.yml +14 -0
  11. package/.github/labeler.yml +50 -0
  12. package/.github/packaging/brand-cursor.png +0 -0
  13. package/.github/packaging/database/init.sql +48 -0
  14. package/.github/packaging/docker/Dockerfile +111 -0
  15. package/.github/packaging/docker/docker-compose.yml +56 -0
  16. package/.github/packaging/scripts/preflight.sh +413 -0
  17. package/.github/packaging/scripts/prepare-release.sh +141 -0
  18. package/.github/packaging/scripts/release.sh +22 -0
  19. package/.github/packaging/scripts/setup-git-hooks.sh +73 -0
  20. package/.github/pull_request_template.md +31 -0
  21. package/.github/signed.json +9 -0
  22. package/.github/workflows/README.md +23 -0
  23. package/.github/workflows/ci.yml +181 -0
  24. package/.github/workflows/cla.yml +33 -0
  25. package/.github/workflows/formula-sha.yml +63 -0
  26. package/.github/workflows/issue-response.yml +44 -0
  27. package/.github/workflows/labeler.yml +42 -0
  28. package/.github/workflows/pr-body.yml +49 -0
  29. package/.github/workflows/release.yml +176 -0
  30. package/.github/workflows/security.yml +94 -0
  31. package/.github/workflows/stale.yml +38 -0
  32. package/AGENTS.md +49 -0
  33. package/CHANGELOG.md +3 -0
  34. package/CMakeLists.txt +646 -0
  35. package/Formula/cursor.rb +46 -0
  36. package/LICENSE +201 -0
  37. package/Makefile +28 -0
  38. package/README.md +46 -0
  39. package/cli.js +16 -0
  40. package/include/agent.h +86 -0
  41. package/include/agent_mode.h +17 -0
  42. package/include/memory_manager.h +102 -0
  43. package/include/services/ai_service.h +31 -0
  44. package/include/services/auth_service.h +87 -0
  45. package/include/services/checkpoint_service.h +69 -0
  46. package/include/services/codebase_service.h +38 -0
  47. package/include/services/command_service.h +23 -0
  48. package/include/services/context_service.h +74 -0
  49. package/include/services/database_service.h +56 -0
  50. package/include/services/error_service.h +106 -0
  51. package/include/services/file_service.h +51 -0
  52. package/include/services/git_service.h +29 -0
  53. package/include/services/github_service.h +85 -0
  54. package/include/services/mcp_service.h +85 -0
  55. package/include/services/multi_file_service.h +93 -0
  56. package/include/services/sandbox_service.h +96 -0
  57. package/include/services/theme_service.h +67 -0
  58. package/include/services/web_service.h +52 -0
  59. package/include/utils/config.h +68 -0
  60. package/include/utils/memory_utils.h +79 -0
  61. package/include/utils/platform.h +56 -0
  62. package/include/utils/ui.h +43 -0
  63. package/include/utils/validation.h +63 -0
  64. package/include/utils/version.h.in +17 -0
  65. package/install.js +49 -0
  66. package/package.json +16 -0
  67. package/release/checksums.txt +3 -0
  68. package/release/cursor-linux/cursor_v0.1.7_linux_amd64.tar.gz +0 -0
  69. package/release/cursor-macos/cursor_v0.1.7_darwin_arm64.tar.gz +0 -0
  70. package/release/cursor-windows/cursor__windows_amd64.zip +0 -0
  71. package/src/agent.cpp +2026 -0
  72. package/src/main.cpp +97 -0
  73. package/src/memory_manager.cpp +814 -0
  74. package/src/services/ai_service.cpp +366 -0
  75. package/src/services/auth_service.cpp +779 -0
  76. package/src/services/checkpoint_service.cpp +465 -0
  77. package/src/services/codebase_service.cpp +233 -0
  78. package/src/services/command_service.cpp +82 -0
  79. package/src/services/context_service.cpp +348 -0
  80. package/src/services/database_service.cpp +148 -0
  81. package/src/services/error_service.cpp +438 -0
  82. package/src/services/file_service.cpp +349 -0
  83. package/src/services/git_service.cpp +148 -0
  84. package/src/services/github_service.cpp +435 -0
  85. package/src/services/mcp_service.cpp +481 -0
  86. package/src/services/multi_file_service.cpp +591 -0
  87. package/src/services/sandbox_service.cpp +678 -0
  88. package/src/services/theme_service.cpp +429 -0
  89. package/src/services/web_service.cpp +532 -0
  90. package/src/utils/config.cpp +77 -0
  91. package/src/utils/memory_utils.cpp +93 -0
  92. package/src/utils/ui.cpp +307 -0
  93. package/src/utils/validation.cpp +306 -0
  94. package/src/utils/version.cpp +175 -0
  95. package/tests/e2e/docker-compose.yml +195 -0
  96. package/tests/e2e/run_e2e_tests.sh +70 -0
  97. package/tests/e2e/run_tests_in_docker.sh +115 -0
  98. package/tests/main_test.cpp +16 -0
  99. package/tests/mocks/mock_ollama.py +98 -0
  100. package/tests/mocks/start_nginx.sh +64 -0
@@ -0,0 +1,23 @@
1
+ # Workflows
2
+
3
+ | Workflow | Trigger | What it does |
4
+ |----------|---------|--------------|
5
+ | `ci.yml` | PR, push | Build, test, Docker push |
6
+ | `cla.yml` | PR | CLA check |
7
+ | `release.yml` | Tag `v*` | Build binaries, release, formula update, npm publish |
8
+ | `formula-sha.yml` | Manual | Update Homebrew formula SHA |
9
+ | `security.yml` | Push, PR | Trivy security scan |
10
+ | `version-bump.yml` | Tag `v*` | Bump version |
11
+ | `pr-body.yml` | PR | Clean PR body formatting |
12
+ | `issue-response.yml` | Issue opened | Label platform, respond |
13
+ | `stale.yml` | Weekly | Mark/close stale issues/PRs |
14
+
15
+ ## Secrets
16
+
17
+ | Secret | Used By |
18
+ |--------|---------|
19
+ | `NPM_TOKEN` | release.yml |
20
+ | `DOCKER_USERNAME` | ci.yml |
21
+ | `DOCKER_PASSWORD` | ci.yml |
22
+ | `CURSOR_BOT_CLIENT_ID` | formula-sha.yml, pr-body.yml, issue-response.yml, stale.yml |
23
+ | `CURSOR_BOT_PRIVATE_KEY` | formula-sha.yml, pr-body.yml, issue-response.yml, stale.yml |
@@ -0,0 +1,181 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: ["*"]
8
+ release:
9
+ types: [published]
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+ security-events: write
15
+ packages: write
16
+
17
+ concurrency:
18
+ group: ${{ github.workflow }}-${{ github.ref }}
19
+ cancel-in-progress: true
20
+
21
+ jobs:
22
+ build:
23
+ name: build (${{ matrix.os_short }}, ${{ matrix.build_type == 'Release' && 'release' || 'debug' }})
24
+ runs-on: ${{ matrix.os }}
25
+ if: github.repository_owner == 'bniladridas'
26
+ strategy:
27
+ matrix:
28
+ include:
29
+ - os: ubuntu-latest
30
+ os_short: ubuntu
31
+ build_type: release
32
+ - os: ubuntu-latest
33
+ os_short: ubuntu
34
+ build_type: debug
35
+ - os: macos-latest
36
+ os_short: macos
37
+ build_type: release
38
+ - os: macos-latest
39
+ os_short: macos
40
+ build_type: debug
41
+ - os: windows-latest
42
+ os_short: windows
43
+ build_type: release
44
+
45
+ steps:
46
+ - uses: actions/checkout@v6
47
+
48
+ - name: cache
49
+ uses: actions/cache@v5
50
+ with:
51
+ path: |
52
+ build
53
+ ~/.cache/vcpkg
54
+ C:\vcpkg\installed
55
+ key: ${{ runner.os }}-${{ matrix.build_type }}-${{ hashFiles('CMakeLists.txt') }}
56
+ restore-keys: |
57
+ ${{ runner.os }}-${{ matrix.build_type }}-
58
+
59
+ - name: setup
60
+ shell: bash
61
+ run: |
62
+ if [[ "$RUNNER_OS" == "Linux" ]]; then
63
+ sudo apt update
64
+ sudo apt install -y nlohmann-json3-dev cmake build-essential \
65
+ libcurl4-openssl-dev libpqxx-dev expect clang-tidy
66
+ elif [[ "$RUNNER_OS" == "macOS" ]]; then
67
+ export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
68
+ brew update
69
+ brew install cmake nlohmann-json cpr libpqxx expect llvm
70
+ else
71
+ powershell -Command "
72
+ Set-ExecutionPolicy Bypass -Scope Process -Force;
73
+ iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex;
74
+ choco install -y cmake --no-progress;
75
+ git clone https://github.com/microsoft/vcpkg.git C:\vcpkg;
76
+ C:\vcpkg\bootstrap-vcpkg.bat -disableMetrics;
77
+ C:\vcpkg\vcpkg.exe integrate install;
78
+ C:\vcpkg\vcpkg.exe install cpr nlohmann-json libpqxx --triplet x64-windows
79
+ "
80
+ fi
81
+
82
+ - name: build
83
+ shell: bash
84
+ run: |
85
+ if [[ "$RUNNER_OS" == "Windows" ]]; then
86
+ cmake -S . -B build \
87
+ -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
88
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
89
+ else
90
+ FLAGS=""
91
+ [[ "$RUNNER_OS" == "macOS" ]] && FLAGS="-DCMAKE_PREFIX_PATH=/opt/homebrew"
92
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} $FLAGS
93
+ fi
94
+ cmake --build build --config ${{ matrix.build_type }}
95
+
96
+ - name: test
97
+ shell: bash
98
+ run: |
99
+ cmake --build build --target preflight --config ${{ matrix.build_type }} || true
100
+
101
+ - uses: actions/upload-artifact@v6
102
+ with:
103
+ name: cursor-${{ matrix.os }}-${{ matrix.build_type }}
104
+ path: |
105
+ build/bin/cursor-agent*
106
+ build/bin/Release/cursor-agent.exe
107
+
108
+ coverage:
109
+ runs-on: ubuntu-latest
110
+ needs: build
111
+ if: github.event_name != 'release'
112
+ steps:
113
+ - uses: actions/checkout@v6
114
+ - run: |
115
+ sudo apt update
116
+ sudo apt install -y nlohmann-json3-dev cmake build-essential libcurl4-openssl-dev libpqxx-dev lcov
117
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
118
+ cmake --build build --target coverage
119
+ - uses: codecov/codecov-action@v7
120
+ with:
121
+ files: build/coverage/coverage.info
122
+ flags: unittests
123
+ name: codecov
124
+ fail_ci_if_error: false
125
+
126
+ lint:
127
+ runs-on: ubuntu-latest
128
+ steps:
129
+ - uses: actions/checkout@v6
130
+ - run: |
131
+ sudo apt update
132
+ sudo apt install -y clang-tidy cmake build-essential \
133
+ libcurl4-openssl-dev nlohmann-json3-dev libpqxx-dev
134
+ cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
135
+ echo "Running basic syntax check..."
136
+ clang-tidy --list-checks > /dev/null && echo "✅ Clang-tidy available"
137
+ echo "✅ Lint check completed (detailed linting handled by pre-commit hooks)"
138
+
139
+ e2e:
140
+ runs-on: ubuntu-latest
141
+ if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
142
+ steps:
143
+ - uses: actions/checkout@v6
144
+ - uses: docker/setup-buildx-action@v4
145
+ - run: docker compose -f tests/e2e/docker-compose.yml --project-directory . up --abort-on-container-exit --exit-code-from e2e-tests
146
+ - if: failure()
147
+ uses: actions/upload-artifact@v6
148
+ with:
149
+ name: e2e-logs
150
+ path: tests/e2e/e2e_test.log
151
+
152
+ docker:
153
+ runs-on: ubuntu-latest
154
+ if: github.ref == 'refs/heads/main' || github.event_name == 'release'
155
+ continue-on-error: true
156
+ steps:
157
+ - uses: actions/checkout@v6
158
+ - uses: docker/setup-buildx-action@v4
159
+ - uses: docker/login-action@v4
160
+ with:
161
+ registry: ghcr.io
162
+ username: ${{ github.actor }}
163
+ password: ${{ secrets.GITHUB_TOKEN }}
164
+ - id: meta
165
+ uses: docker/metadata-action@v5
166
+ with:
167
+ images: ghcr.io/${{ github.repository }}
168
+ tags: |
169
+ type=ref,event=branch
170
+ type=semver,pattern={{version}}
171
+ type=semver,pattern={{major}}.{{minor}}
172
+ - uses: docker/build-push-action@v7
173
+ with:
174
+ context: .
175
+ file: ./.github/packaging/docker/Dockerfile
176
+ push: true
177
+ tags: ${{ steps.meta.outputs.tags }}
178
+ labels: ${{ steps.meta.outputs.labels }}
179
+ cache-from: type=gha
180
+ cache-to: type=gha,mode=max
181
+
@@ -0,0 +1,33 @@
1
+ name: cla
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+
7
+ permissions:
8
+ contents: read
9
+ pull-requests: write
10
+
11
+ jobs:
12
+ cla:
13
+ runs-on: ubuntu-latest
14
+ if: github.repository_owner == 'bniladridas' && github.event.pull_request.user.type != 'Bot'
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ with:
18
+ sparse-checkout: |
19
+ .github/signed.json
20
+
21
+ - uses: actions/checkout@v6
22
+ with:
23
+ repository: palmshed/clabot
24
+ path: cla-bot
25
+
26
+ - name: Prepare CLA signers
27
+ run: cp .github/signed.json cla-signers.json
28
+
29
+ - name: CLA check
30
+ uses: ./cla-bot
31
+ with:
32
+ github-token: ${{ secrets.GITHUB_TOKEN }}
33
+ cla-url: "https://harpertoken.github.io/cla.html"
@@ -0,0 +1,63 @@
1
+ name: formula sha
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag:
7
+ description: Release tag
8
+ required: true
9
+ type: string
10
+
11
+ permissions:
12
+ contents: write
13
+ pull-requests: write
14
+
15
+ jobs:
16
+ update:
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - uses: actions/create-github-app-token@v3
25
+ id: app-token
26
+ with:
27
+ client-id: ${{ secrets.CURSOR_BOT_CLIENT_ID }}
28
+ private-key: ${{ secrets.CURSOR_BOT_PRIVATE_KEY }}
29
+
30
+ - name: Resolve tag
31
+ id: tag
32
+ run: printf 'tag=%s\n' "${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
33
+
34
+ - name: Apply sha
35
+ run: |
36
+ tag="${{ steps.tag.outputs.tag }}"
37
+ version="${tag#v}"
38
+
39
+ url="https://github.com/bniladridas/cursor/archive/refs/tags/${tag}.tar.gz"
40
+ curl -fsSL "$url" -o source.tar.gz
41
+ sha="$(sha256sum source.tar.gz | awk '{print $1}')"
42
+ TAG="$tag" SHA="$sha" ruby -0pi -e 'gsub(/url "https:\/\/github\.com\/bniladridas\/cursor\/archive\/refs\/tags\/v[^\"]+\.tar\.gz"/, "url \"https:\/\/github.com\/bniladridas\/cursor\/archive\/refs\/tags\/#{ENV.fetch("TAG")}.tar.gz\""); gsub(/sha256 "[0-9a-f]{64}"/, "sha256 \"#{ENV.fetch("SHA")}\"")' Formula/cursor.rb
43
+ rm source.tar.gz
44
+
45
+ bottle_url="https://github.com/bniladridas/cursor/releases/download/${tag}/cursor-${version}.arm64_sequoia.bottle.tar.gz"
46
+ if curl -fsSL "$bottle_url" -o bottle.tar.gz; then
47
+ bottle_sha="$(sha256sum bottle.tar.gz | awk '{print $1}')"
48
+ BOTTLE_SHA="$bottle_sha" ruby -0pi -e '
49
+ gsub(/sha256 arm64_sequoia: "[0-9a-f]{64}"/, "sha256 arm64_sequoia: \"#{ENV.fetch("BOTTLE_SHA")}\"")
50
+ ' Formula/cursor.rb
51
+ rm bottle.tar.gz
52
+ fi
53
+
54
+ - name: Open pull request
55
+ uses: peter-evans/create-pull-request@v8
56
+ with:
57
+ token: ${{ steps.app-token.outputs.token }}
58
+ base: main
59
+ branch: formula-sha-${{ steps.tag.outputs.tag }}
60
+ delete-branch: true
61
+ title: "chore: formula sha"
62
+ commit-message: "chore: formula sha"
63
+ body: ""
@@ -0,0 +1,44 @@
1
+ name: issue response
2
+
3
+ on:
4
+ issues:
5
+ types: [opened]
6
+
7
+ jobs:
8
+ respond:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+ issues: write
13
+
14
+ steps:
15
+ - id: app-token
16
+ uses: actions/create-github-app-token@v3
17
+ with:
18
+ client-id: ${{ secrets.CURSOR_BOT_CLIENT_ID }}
19
+ private-key: ${{ secrets.CURSOR_BOT_PRIVATE_KEY }}
20
+ permission-issues: write
21
+
22
+ - name: label platform
23
+ env:
24
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
25
+ ISSUE: ${{ github.event.issue.number }}
26
+ REPO: ${{ github.repository }}
27
+ BODY: ${{ github.event.issue.body }}
28
+ run: |
29
+ raw=$(echo "$BODY" | grep -A1 '^\*\*Platform:\*\*' | tail -1)
30
+ platform=$(echo "$raw" | grep -ioP 'macOS|Linux|Windows' | head -1)
31
+ if [ -n "$platform" ]; then
32
+ label=$(echo "$platform" | tr '[:upper:]' '[:lower:]')
33
+ gh issue edit "$ISSUE" --repo "$REPO" --add-label "$label"
34
+ fi
35
+
36
+ - name: comment
37
+ env:
38
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
39
+ ISSUE: ${{ github.event.issue.number }}
40
+ REPO: ${{ github.repository }}
41
+ run: |
42
+ gh issue comment "$ISSUE" \
43
+ --repo "$REPO" \
44
+ --body "Thanks for the report. We'll look into it."
@@ -0,0 +1,42 @@
1
+ name: labeler
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+
7
+ permissions:
8
+ contents: read
9
+ pull-requests: write
10
+
11
+ jobs:
12
+ label:
13
+ runs-on: ubuntu-latest
14
+ if: github.repository_owner == 'bniladridas'
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+
18
+ - name: Create labels
19
+ run: |
20
+ for label in "security:ff6b6b" "docs:74c9fd" "ci:4a9fe8" \
21
+ "config:ffd700" "tests:a8d5ff" "refactor:9b59b6" \
22
+ "feature:28a745" "bug:e74c3c" "emergency:dc3545"; do
23
+ IFS=':' read -r name color <<< "$label"
24
+ gh label create "$name" --color "$color" --force 2>/dev/null || true
25
+ done
26
+ env:
27
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+
29
+ - uses: actions/labeler@v5
30
+ with:
31
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
32
+ configuration-path: .github/labeler.yml
33
+
34
+ - name: Check for emergency keyword
35
+ if: >
36
+ contains(github.event.pull_request.title, '[emergency]') ||
37
+ contains(github.event.pull_request.title, '[urgent]') ||
38
+ contains(github.event.pull_request.title, '[critical]')
39
+ run: |
40
+ gh pr edit ${{ github.event.pull_request.number }} --add-label "emergency"
41
+ env:
42
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,49 @@
1
+ name: pr body
2
+
3
+ on:
4
+ pull_request_target:
5
+ types:
6
+ - opened
7
+ - edited
8
+ - reopened
9
+
10
+ permissions:
11
+ contents: read
12
+ pull-requests: write
13
+
14
+ jobs:
15
+ clean:
16
+ name: clean
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - name: token
21
+ id: app-token
22
+ uses: actions/create-github-app-token@v3
23
+ with:
24
+ client-id: ${{ secrets.CURSOR_BOT_CLIENT_ID }}
25
+ private-key: ${{ secrets.CURSOR_BOT_PRIVATE_KEY }}
26
+ permission-contents: read
27
+ permission-pull-requests: write
28
+
29
+ - name: body
30
+ uses: actions/github-script@v9
31
+ with:
32
+ github-token: ${{ steps.app-token.outputs.token }}
33
+ script: |
34
+ const body = context.payload.pull_request.body || "";
35
+ if (!body.includes("\\n")) {
36
+ return;
37
+ }
38
+
39
+ const next = body.replace(/\\n/g, "\n").trimEnd();
40
+ if (next === body) {
41
+ return;
42
+ }
43
+
44
+ await github.rest.pulls.update({
45
+ owner: context.repo.owner,
46
+ repo: context.repo.repo,
47
+ pull_number: context.payload.pull_request.number,
48
+ body: next,
49
+ });
@@ -0,0 +1,176 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+ id-token: write
12
+
13
+ jobs:
14
+ linux:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v6
19
+
20
+ - name: Install dependencies
21
+ run: |
22
+ sudo apt update
23
+ sudo apt install -y nlohmann-json3-dev cmake build-essential libcurl4-openssl-dev libpqxx-dev
24
+
25
+ - name: Configure
26
+ run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
27
+
28
+ - name: Build
29
+ run: cmake --build build --config Release
30
+
31
+ - name: Package
32
+ run: |
33
+ mkdir -p release
34
+ cp build/bin/cursor-agent release/cursor-linux
35
+ cd release && tar -czf cursor_${GITHUB_REF_NAME}_linux_amd64.tar.gz cursor-linux
36
+
37
+ - uses: actions/upload-artifact@v6
38
+ with:
39
+ name: cursor-linux
40
+ path: release/*.tar.gz
41
+
42
+ macos:
43
+ runs-on: macos-latest
44
+
45
+ steps:
46
+ - uses: actions/checkout@v6
47
+
48
+ - name: Install dependencies
49
+ run: |
50
+ export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
51
+ brew install cmake nlohmann-json curl
52
+
53
+ - name: Configure
54
+ run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
55
+
56
+ - name: Build
57
+ run: cmake --build build --config Release
58
+
59
+ - name: Package
60
+ run: |
61
+ mkdir -p release
62
+ cp build/bin/cursor-agent release/cursor-macos
63
+ cd release && tar -czf cursor_${GITHUB_REF_NAME}_darwin_arm64.tar.gz cursor-macos
64
+
65
+ - uses: actions/upload-artifact@v6
66
+ with:
67
+ name: cursor-macos
68
+ path: release/*.tar.gz
69
+
70
+ windows:
71
+ runs-on: windows-latest
72
+
73
+ steps:
74
+ - uses: actions/checkout@v6
75
+
76
+ - name: setup
77
+ run: |
78
+ powershell -Command "
79
+ Set-ExecutionPolicy Bypass -Scope Process -Force;
80
+ iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex;
81
+ choco install -y cmake --no-progress;
82
+ git clone https://github.com/microsoft/vcpkg.git C:\vcpkg;
83
+ C:\vcpkg\bootstrap-vcpkg.bat -disableMetrics;
84
+ C:\vcpkg\vcpkg.exe integrate install;
85
+ C:\vcpkg\vcpkg.exe install cpr nlohmann-json --triplet x64-windows
86
+ "
87
+
88
+ - name: Configure
89
+ run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
90
+
91
+ - name: Build
92
+ run: cmake --build build --config Release
93
+
94
+ - name: Package
95
+ run: |
96
+ mkdir -p release
97
+ cp build/bin/Release/cursor-agent.exe release/cursor-windows.exe
98
+ cd release && 7z a -tzip cursor_${GITHUB_REF_NAME}_windows_amd64.zip cursor-windows.exe
99
+
100
+ - uses: actions/upload-artifact@v6
101
+ with:
102
+ name: cursor-windows
103
+ path: release/*.zip
104
+
105
+ release:
106
+ needs: [linux, macos, windows]
107
+ runs-on: ubuntu-latest
108
+ env:
109
+ GH_TOKEN: ${{ github.token }}
110
+
111
+ steps:
112
+ - uses: actions/checkout@v6
113
+ with:
114
+ ref: main
115
+ fetch-depth: 0
116
+
117
+ - name: Download artifacts
118
+ uses: actions/download-artifact@v6
119
+ with:
120
+ path: release/
121
+
122
+ - name: Get version
123
+ id: version
124
+ run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
125
+
126
+ - name: Compute checksums
127
+ run: |
128
+ find release -type f \( -name '*.tar.gz' -o -name '*.zip' \) -exec shasum -a 256 {} + > release/checksums.txt || find release -type f \( -name '*.tar.gz' -o -name '*.zip' \) -exec sha256sum {} + > release/checksums.txt
129
+
130
+ - name: Compute source SHA
131
+ run: |
132
+ curl -sL "https://github.com/bniladridas/cursor/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz" -o /tmp/source.tar.gz
133
+ echo "SOURCE_SHA=$(sha256sum /tmp/source.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
134
+
135
+ - name: Publish release
136
+ run: |
137
+ gh release create "$GITHUB_REF_NAME" \
138
+ $(find release -name '*.tar.gz' -o -name '*.zip' | sed 's|^| |') \
139
+ release/checksums.txt \
140
+ --title "$GITHUB_REF_NAME" \
141
+ --generate-notes
142
+
143
+ - name: Update Homebrew formula
144
+ run: |
145
+ version="${GITHUB_REF_NAME#v}"
146
+ sed -i "s|url \".*\"|url \"https://github.com/bniladridas/cursor/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz\"|" Formula/cursor.rb
147
+ sed -i "s|sha256 \".*\"|sha256 \"${SOURCE_SHA}\"|" Formula/cursor.rb
148
+
149
+ - name: Update package version
150
+ run: |
151
+ version="${GITHUB_REF_NAME#v}"
152
+ npm version "$version" --no-git-tag-version --allow-same-version
153
+
154
+ - name: Publish npm
155
+ if: env.NPM_TOKEN != ''
156
+ env:
157
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
158
+ run: |
159
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
160
+ npm publish --access public --provenance 2>&1 || echo "already published"
161
+
162
+ - uses: actions/create-github-app-token@v3
163
+ id: app-token
164
+ with:
165
+ client-id: ${{ secrets.CURSOR_BOT_CLIENT_ID }}
166
+ private-key: ${{ secrets.CURSOR_BOT_PRIVATE_KEY }}
167
+
168
+ - name: Create version update PR
169
+ uses: peter-evans/create-pull-request@v8
170
+ with:
171
+ token: ${{ steps.app-token.outputs.token }}
172
+ base: main
173
+ branch: release/${{ github.ref_name }}
174
+ title: "chore: update formula and package for ${{ github.ref_name }}"
175
+ body: Updates formula and package for ${{ github.ref_name }}.
176
+ add-paths: Formula/cursor.rb, package.json