@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.
- package/.clang-tidy +28 -0
- package/.dockerignore +56 -0
- package/.env.example +29 -0
- package/.github/CODEOWNERS +2 -0
- package/.github/ISSUE_TEMPLATE/blank.md +27 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- package/.github/SECURITY.md +24 -0
- package/.github/codeql/codeql-config.yml +8 -0
- package/.github/dependabot.yml +14 -0
- package/.github/labeler.yml +50 -0
- package/.github/packaging/brand-cursor.png +0 -0
- package/.github/packaging/database/init.sql +48 -0
- package/.github/packaging/docker/Dockerfile +111 -0
- package/.github/packaging/docker/docker-compose.yml +56 -0
- package/.github/packaging/scripts/preflight.sh +413 -0
- package/.github/packaging/scripts/prepare-release.sh +141 -0
- package/.github/packaging/scripts/release.sh +22 -0
- package/.github/packaging/scripts/setup-git-hooks.sh +73 -0
- package/.github/pull_request_template.md +31 -0
- package/.github/signed.json +9 -0
- package/.github/workflows/README.md +23 -0
- package/.github/workflows/ci.yml +181 -0
- package/.github/workflows/cla.yml +33 -0
- package/.github/workflows/formula-sha.yml +63 -0
- package/.github/workflows/issue-response.yml +44 -0
- package/.github/workflows/labeler.yml +42 -0
- package/.github/workflows/pr-body.yml +49 -0
- package/.github/workflows/release.yml +176 -0
- package/.github/workflows/security.yml +94 -0
- package/.github/workflows/stale.yml +38 -0
- package/AGENTS.md +49 -0
- package/CHANGELOG.md +3 -0
- package/CMakeLists.txt +646 -0
- package/Formula/cursor.rb +46 -0
- package/LICENSE +201 -0
- package/Makefile +28 -0
- package/README.md +46 -0
- package/cli.js +16 -0
- package/include/agent.h +86 -0
- package/include/agent_mode.h +17 -0
- package/include/memory_manager.h +102 -0
- package/include/services/ai_service.h +31 -0
- package/include/services/auth_service.h +87 -0
- package/include/services/checkpoint_service.h +69 -0
- package/include/services/codebase_service.h +38 -0
- package/include/services/command_service.h +23 -0
- package/include/services/context_service.h +74 -0
- package/include/services/database_service.h +56 -0
- package/include/services/error_service.h +106 -0
- package/include/services/file_service.h +51 -0
- package/include/services/git_service.h +29 -0
- package/include/services/github_service.h +85 -0
- package/include/services/mcp_service.h +85 -0
- package/include/services/multi_file_service.h +93 -0
- package/include/services/sandbox_service.h +96 -0
- package/include/services/theme_service.h +67 -0
- package/include/services/web_service.h +52 -0
- package/include/utils/config.h +68 -0
- package/include/utils/memory_utils.h +79 -0
- package/include/utils/platform.h +56 -0
- package/include/utils/ui.h +43 -0
- package/include/utils/validation.h +63 -0
- package/include/utils/version.h.in +17 -0
- package/install.js +49 -0
- package/package.json +16 -0
- package/release/checksums.txt +3 -0
- package/release/cursor-linux/cursor_v0.1.7_linux_amd64.tar.gz +0 -0
- package/release/cursor-macos/cursor_v0.1.7_darwin_arm64.tar.gz +0 -0
- package/release/cursor-windows/cursor__windows_amd64.zip +0 -0
- package/src/agent.cpp +2026 -0
- package/src/main.cpp +97 -0
- package/src/memory_manager.cpp +814 -0
- package/src/services/ai_service.cpp +366 -0
- package/src/services/auth_service.cpp +779 -0
- package/src/services/checkpoint_service.cpp +465 -0
- package/src/services/codebase_service.cpp +233 -0
- package/src/services/command_service.cpp +82 -0
- package/src/services/context_service.cpp +348 -0
- package/src/services/database_service.cpp +148 -0
- package/src/services/error_service.cpp +438 -0
- package/src/services/file_service.cpp +349 -0
- package/src/services/git_service.cpp +148 -0
- package/src/services/github_service.cpp +435 -0
- package/src/services/mcp_service.cpp +481 -0
- package/src/services/multi_file_service.cpp +591 -0
- package/src/services/sandbox_service.cpp +678 -0
- package/src/services/theme_service.cpp +429 -0
- package/src/services/web_service.cpp +532 -0
- package/src/utils/config.cpp +77 -0
- package/src/utils/memory_utils.cpp +93 -0
- package/src/utils/ui.cpp +307 -0
- package/src/utils/validation.cpp +306 -0
- package/src/utils/version.cpp +175 -0
- package/tests/e2e/docker-compose.yml +195 -0
- package/tests/e2e/run_e2e_tests.sh +70 -0
- package/tests/e2e/run_tests_in_docker.sh +115 -0
- package/tests/main_test.cpp +16 -0
- package/tests/mocks/mock_ollama.py +98 -0
- package/tests/mocks/start_nginx.sh +64 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Cursor Agent - Unified Preflight Check Script
|
|
3
|
+
# Comprehensive validation for development, CI/CD, and deployment
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Configuration
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
+
cd "$PROJECT_ROOT"
|
|
11
|
+
|
|
12
|
+
# Auto-detect environment and set appropriate mode
|
|
13
|
+
AUTO_DETECT=${AUTO_DETECT:-true}
|
|
14
|
+
|
|
15
|
+
# Check if running in CI (multiple CI environment variables)
|
|
16
|
+
if [ "${CI:-false}" = "true" ] || [ "${GITHUB_ACTIONS:-false}" = "true" ] || [ "${GITLAB_CI:-false}" = "true" ] || [ "${JENKINS_URL:-}" != "" ] || [ "${TRAVIS:-false}" = "true" ]; then
|
|
17
|
+
CI_MODE=true
|
|
18
|
+
else
|
|
19
|
+
CI_MODE=false
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Auto-detect quick mode based on context
|
|
23
|
+
if [ "${QUICK:-false}" = "true" ]; then
|
|
24
|
+
QUICK_MODE=true
|
|
25
|
+
elif [ "$AUTO_DETECT" = "true" ] && [ "$CI_MODE" = "false" ]; then
|
|
26
|
+
# In development, check if this is a quick context (e.g., pre-commit)
|
|
27
|
+
if [ "${PRE_COMMIT:-false}" = "true" ] || [ "${GIT_HOOK:-false}" = "true" ]; then
|
|
28
|
+
QUICK_MODE=true
|
|
29
|
+
else
|
|
30
|
+
# Default to full checks in development
|
|
31
|
+
QUICK_MODE=false
|
|
32
|
+
fi
|
|
33
|
+
else
|
|
34
|
+
QUICK_MODE=${QUICK:-false}
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
echo "Cursor Agent Preflight Checks"
|
|
38
|
+
echo "===================================="
|
|
39
|
+
echo "Environment: $([ "$CI_MODE" = "true" ] && echo "CI/CD" || echo "Development")"
|
|
40
|
+
echo "Mode: $([ "$QUICK_MODE" = "true" ] && echo "Quick" || echo "Comprehensive")"
|
|
41
|
+
echo "Auto-detect: $([ "$AUTO_DETECT" = "true" ] && echo "Enabled" || echo "Disabled")"
|
|
42
|
+
echo "===================================="
|
|
43
|
+
|
|
44
|
+
# Colors (disabled in CI for clean logs)
|
|
45
|
+
if [ "$CI_MODE" = "true" ]; then
|
|
46
|
+
RED=''
|
|
47
|
+
GREEN=''
|
|
48
|
+
YELLOW=''
|
|
49
|
+
BLUE=''
|
|
50
|
+
NC=''
|
|
51
|
+
else
|
|
52
|
+
RED='\033[0;31m'
|
|
53
|
+
GREEN='\033[0;32m'
|
|
54
|
+
YELLOW='\033[1;33m'
|
|
55
|
+
BLUE='\033[0;34m'
|
|
56
|
+
NC='\033[0m'
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Status functions
|
|
60
|
+
print_status() {
|
|
61
|
+
if [ "$CI_MODE" = "true" ]; then
|
|
62
|
+
echo "::notice::INFO $1"
|
|
63
|
+
else
|
|
64
|
+
echo -e "${BLUE}[INFO]${NC} $1"
|
|
65
|
+
fi
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
print_success() {
|
|
69
|
+
if [ "$CI_MODE" = "true" ]; then
|
|
70
|
+
echo "::notice::PASS $1"
|
|
71
|
+
else
|
|
72
|
+
echo -e "${GREEN}[PASS]${NC} $1"
|
|
73
|
+
fi
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
print_warning() {
|
|
77
|
+
if [ "$CI_MODE" = "true" ]; then
|
|
78
|
+
echo "::warning::WARN $1"
|
|
79
|
+
else
|
|
80
|
+
echo -e "${YELLOW}[WARN]${NC} $1"
|
|
81
|
+
fi
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
print_error() {
|
|
85
|
+
if [ "$CI_MODE" = "true" ]; then
|
|
86
|
+
echo "::error::FAIL $1"
|
|
87
|
+
else
|
|
88
|
+
echo -e "${RED}[FAIL]${NC} $1"
|
|
89
|
+
fi
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Error counter
|
|
93
|
+
ERROR_COUNT=0
|
|
94
|
+
WARNING_COUNT=0
|
|
95
|
+
|
|
96
|
+
fail_check() {
|
|
97
|
+
ERROR_COUNT=$((ERROR_COUNT + 1))
|
|
98
|
+
print_error "$1"
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
warn_check() {
|
|
102
|
+
WARNING_COUNT=$((WARNING_COUNT + 1))
|
|
103
|
+
print_warning "$1"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# 1. Environment Validation
|
|
107
|
+
print_status "Validating build environment..."
|
|
108
|
+
|
|
109
|
+
if ! command -v cmake &> /dev/null; then
|
|
110
|
+
fail_check "CMake not found. Install CMake 3.14+"
|
|
111
|
+
else
|
|
112
|
+
CMAKE_VERSION=$(cmake --version | head -n1 | cut -d' ' -f3)
|
|
113
|
+
print_success "CMake version: $CMAKE_VERSION"
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
if ! command -v make &> /dev/null; then
|
|
117
|
+
fail_check "Make not found. Install build tools"
|
|
118
|
+
else
|
|
119
|
+
print_success "Make found"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Check C++ compiler
|
|
123
|
+
if ! command -v g++ &> /dev/null && ! command -v clang++ &> /dev/null; then
|
|
124
|
+
fail_check "No C++ compiler found (g++ or clang++)"
|
|
125
|
+
else
|
|
126
|
+
print_success "C++ compiler available"
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# 2. Dependency Validation
|
|
130
|
+
print_status "Checking dependencies..."
|
|
131
|
+
|
|
132
|
+
# Check libcpr
|
|
133
|
+
CPR_FOUND=false
|
|
134
|
+
if pkg-config --exists libcpr 2>/dev/null; then
|
|
135
|
+
CPR_FOUND=true
|
|
136
|
+
print_success "libcpr found via pkg-config"
|
|
137
|
+
elif [ -d "/opt/homebrew/include/cpr" ] || [ -d "/usr/local/include/cpr" ]; then
|
|
138
|
+
CPR_FOUND=true
|
|
139
|
+
print_success "libcpr found via Homebrew"
|
|
140
|
+
elif find /usr/include /usr/local/include /opt/homebrew/include -name "cpr" -type d 2>/dev/null | head -1 | grep -q cpr; then
|
|
141
|
+
CPR_FOUND=true
|
|
142
|
+
print_success "libcpr headers found"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if [ "$CPR_FOUND" = "false" ]; then
|
|
146
|
+
print_success "libcpr not found in system - CMake will fetch and build it automatically"
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
# Check nlohmann/json
|
|
150
|
+
JSON_FOUND=false
|
|
151
|
+
if [ -d "/opt/homebrew/include/nlohmann" ] || [ -d "/usr/local/include/nlohmann" ]; then
|
|
152
|
+
JSON_FOUND=true
|
|
153
|
+
print_success "nlohmann/json found via Homebrew"
|
|
154
|
+
elif find /usr/include /usr/local/include /opt/homebrew/include -name "nlohmann" -type d 2>/dev/null | head -1 | grep -q nlohmann; then
|
|
155
|
+
JSON_FOUND=true
|
|
156
|
+
print_success "nlohmann/json headers found"
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
if [ "$JSON_FOUND" = "false" ]; then
|
|
160
|
+
warn_check "nlohmann/json not found (build may still work if CMake finds it)"
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# If build succeeds later, dependencies are actually fine
|
|
164
|
+
DEPS_CHECK_PASSED=true
|
|
165
|
+
|
|
166
|
+
# 3. Project Structure Validation
|
|
167
|
+
print_status "Validating project structure..."
|
|
168
|
+
REQUIRED_DIRS=("src" "include" "package")
|
|
169
|
+
REQUIRED_FILES=("CMakeLists.txt" "Makefile" "README.md" "LICENSE" ".env.example")
|
|
170
|
+
|
|
171
|
+
for dir in "${REQUIRED_DIRS[@]}"; do
|
|
172
|
+
if [ ! -d "$dir" ]; then
|
|
173
|
+
fail_check "Required directory missing: $dir"
|
|
174
|
+
else
|
|
175
|
+
print_success "Directory found: $dir"
|
|
176
|
+
fi
|
|
177
|
+
done
|
|
178
|
+
|
|
179
|
+
for file in "${REQUIRED_FILES[@]}"; do
|
|
180
|
+
if [ ! -f "$file" ]; then
|
|
181
|
+
fail_check "Required file missing: $file"
|
|
182
|
+
else
|
|
183
|
+
print_success "File found: $file"
|
|
184
|
+
fi
|
|
185
|
+
done
|
|
186
|
+
|
|
187
|
+
# 4. Clean Build Process
|
|
188
|
+
print_status "Performing clean build..."
|
|
189
|
+
make clean > /dev/null 2>&1 || true
|
|
190
|
+
|
|
191
|
+
BUILD_LOG=$(mktemp)
|
|
192
|
+
if ! make build > "$BUILD_LOG" 2>&1; then
|
|
193
|
+
fail_check "Build failed. Check build log:"
|
|
194
|
+
if [ "$CI_MODE" != "true" ]; then
|
|
195
|
+
tail -20 "$BUILD_LOG"
|
|
196
|
+
fi
|
|
197
|
+
rm -f "$BUILD_LOG"
|
|
198
|
+
else
|
|
199
|
+
print_success "Build completed successfully"
|
|
200
|
+
rm -f "$BUILD_LOG"
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
# 5. Binary Validation
|
|
204
|
+
print_status "Validating binary..."
|
|
205
|
+
if [ ! -f "build/bin/cursor-agent" ]; then
|
|
206
|
+
fail_check "Binary not found at build/bin/cursor-agent"
|
|
207
|
+
elif [ ! -x "build/bin/cursor-agent" ]; then
|
|
208
|
+
fail_check "Binary is not executable"
|
|
209
|
+
else
|
|
210
|
+
BINARY_SIZE=$(stat -f%z "build/bin/cursor-agent" 2>/dev/null || stat -c%s "build/bin/cursor-agent" 2>/dev/null || echo "unknown")
|
|
211
|
+
print_success "Binary validation passed (size: $BINARY_SIZE bytes)"
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
# 5. Functionality Tests
|
|
215
|
+
print_status "Running functionality tests..."
|
|
216
|
+
|
|
217
|
+
# Test 1: Basic startup/shutdown
|
|
218
|
+
if ! printf "2\nexit\n" | ./build/bin/cursor-agent > /dev/null 2>&1; then
|
|
219
|
+
print_error "Basic startup test failed"
|
|
220
|
+
exit 1
|
|
221
|
+
fi
|
|
222
|
+
print_success "Basic startup test passed"
|
|
223
|
+
|
|
224
|
+
# Test 2: Help system
|
|
225
|
+
if ! printf "2\nhelp\nexit\n" | ./build/bin/cursor-agent > /dev/null 2>&1; then
|
|
226
|
+
print_error "Help system test failed"
|
|
227
|
+
exit 1
|
|
228
|
+
fi
|
|
229
|
+
print_success "Help system test passed"
|
|
230
|
+
|
|
231
|
+
# Test 3: Version command
|
|
232
|
+
if ! printf "2\nversion\nexit\n" | ./build/bin/cursor-agent > /dev/null 2>&1; then
|
|
233
|
+
print_error "Version command test failed"
|
|
234
|
+
exit 1
|
|
235
|
+
fi
|
|
236
|
+
print_success "Version command test passed"
|
|
237
|
+
|
|
238
|
+
# 6. E2E Tests (if available and not in quick mode)
|
|
239
|
+
if [ "$QUICK_MODE" = "false" ] && [ -d "tests/e2e" ] && [ -f "tests/e2e/run_e2e_tests.sh" ]; then
|
|
240
|
+
print_status "Running E2E tests..."
|
|
241
|
+
if command -v expect >/dev/null 2>&1; then
|
|
242
|
+
if ./tests/e2e/run_e2e_tests.sh > /dev/null 2>&1; then
|
|
243
|
+
print_success "E2E tests passed"
|
|
244
|
+
else
|
|
245
|
+
warn_check "E2E tests failed - check logs for details"
|
|
246
|
+
fi
|
|
247
|
+
else
|
|
248
|
+
warn_check "E2E tests skipped - expect not installed"
|
|
249
|
+
fi
|
|
250
|
+
else
|
|
251
|
+
print_status "E2E tests skipped (quick mode or not available)"
|
|
252
|
+
fi
|
|
253
|
+
|
|
254
|
+
# 7. File Operations Test
|
|
255
|
+
print_status "Testing file operations..."
|
|
256
|
+
TEST_FILE="test_preflight.txt"
|
|
257
|
+
TEST_CONTENT="Preflight test content"
|
|
258
|
+
|
|
259
|
+
if ! printf "2\nwrite:$TEST_FILE $TEST_CONTENT\nread:$TEST_FILE\nexit\n" | ./build/bin/cursor-agent > /dev/null 2>&1; then
|
|
260
|
+
print_error "File operations test failed"
|
|
261
|
+
exit 1
|
|
262
|
+
fi
|
|
263
|
+
|
|
264
|
+
# Cleanup test file
|
|
265
|
+
rm -f "$TEST_FILE" > /dev/null 2>&1 || true
|
|
266
|
+
print_success "File operations test passed"
|
|
267
|
+
|
|
268
|
+
# 8. Memory System Test
|
|
269
|
+
print_status "Testing memory system..."
|
|
270
|
+
if [ -f "data/memory.txt" ]; then
|
|
271
|
+
MEMORY_SIZE=$(wc -l < "data/memory.txt" 2>/dev/null || echo "0")
|
|
272
|
+
print_success "Memory system operational (${MEMORY_SIZE} lines)"
|
|
273
|
+
else
|
|
274
|
+
print_success "Memory system ready (no existing data)"
|
|
275
|
+
fi
|
|
276
|
+
|
|
277
|
+
# 9. Configuration Validation
|
|
278
|
+
print_status "Validating configuration..."
|
|
279
|
+
if [ ! -f ".env.example" ]; then
|
|
280
|
+
print_error "Configuration template (.env.example) missing"
|
|
281
|
+
exit 1
|
|
282
|
+
fi
|
|
283
|
+
print_success "Configuration template found"
|
|
284
|
+
|
|
285
|
+
# 10. Documentation Check
|
|
286
|
+
print_status "Checking documentation..."
|
|
287
|
+
REQUIRED_DOCS=("README.md" "LICENSE" ".github/packaging/docs/CHANGELOG.md")
|
|
288
|
+
for doc in "${REQUIRED_DOCS[@]}"; do
|
|
289
|
+
if [ ! -f "$doc" ]; then
|
|
290
|
+
print_warning "Documentation file missing: $doc"
|
|
291
|
+
fi
|
|
292
|
+
done
|
|
293
|
+
print_success "Documentation check completed"
|
|
294
|
+
|
|
295
|
+
# 11. Package Structure Validation
|
|
296
|
+
print_status "Validating package structure..."
|
|
297
|
+
REQUIRED_DIRS=("src" "include" "package" "build/bin")
|
|
298
|
+
for dir in "${REQUIRED_DIRS[@]}"; do
|
|
299
|
+
if [ ! -d "$dir" ]; then
|
|
300
|
+
print_error "Required directory missing: $dir"
|
|
301
|
+
exit 1
|
|
302
|
+
fi
|
|
303
|
+
done
|
|
304
|
+
print_success "Package structure validation passed"
|
|
305
|
+
|
|
306
|
+
# 12. Code Quality Check
|
|
307
|
+
print_status "Running code quality checks..."
|
|
308
|
+
if command -v clang-tidy > /dev/null 2>&1; then
|
|
309
|
+
if [ -f "build/compile_commands.json" ]; then
|
|
310
|
+
CLANG_TIDY_COUNT=$(make clang-tidy 2>&1 | grep -c "warnings generated" || echo "0")
|
|
311
|
+
if [ "$CLANG_TIDY_COUNT" -gt 0 ]; then
|
|
312
|
+
print_warning "Clang-tidy found $CLANG_TIDY_COUNT files with warnings"
|
|
313
|
+
else
|
|
314
|
+
print_success "Clang-tidy passed with no warnings"
|
|
315
|
+
fi
|
|
316
|
+
else
|
|
317
|
+
print_warning "Clang-tidy available but no compilation database found"
|
|
318
|
+
fi
|
|
319
|
+
else
|
|
320
|
+
print_warning "Clang-tidy not installed - recommended for code quality"
|
|
321
|
+
fi
|
|
322
|
+
|
|
323
|
+
# 13. Security Check (basic)
|
|
324
|
+
print_status "Running basic security checks..."
|
|
325
|
+
if grep -r "system(" src/ include/ > /dev/null 2>&1; then
|
|
326
|
+
print_warning "Direct system() calls found - review for security"
|
|
327
|
+
fi
|
|
328
|
+
|
|
329
|
+
if grep -r "TODO\|FIXME\|HACK" src/ include/ > /dev/null 2>&1; then
|
|
330
|
+
print_warning "Code contains TODO/FIXME/HACK comments"
|
|
331
|
+
fi
|
|
332
|
+
print_success "Basic security check completed"
|
|
333
|
+
|
|
334
|
+
# Skip extended checks in quick mode if no errors
|
|
335
|
+
if [ "$QUICK_MODE" = "true" ] && [ $ERROR_COUNT -eq 0 ]; then
|
|
336
|
+
print_status "Quick mode: Skipping extended checks..."
|
|
337
|
+
|
|
338
|
+
# Still do GitHub integration check if in development
|
|
339
|
+
if [ "$CI_MODE" = "false" ] && [ -d ".github" ]; then
|
|
340
|
+
print_status "Validating GitHub integration..."
|
|
341
|
+
|
|
342
|
+
if [ ! -f ".github/CODEOWNERS" ]; then
|
|
343
|
+
warn_check "CODEOWNERS file missing"
|
|
344
|
+
fi
|
|
345
|
+
|
|
346
|
+
if [ ! -f ".github/pull_request_template.md" ]; then
|
|
347
|
+
warn_check "PR template missing"
|
|
348
|
+
fi
|
|
349
|
+
|
|
350
|
+
if [ ! -d ".github/workflows" ]; then
|
|
351
|
+
warn_check "GitHub Actions workflows missing"
|
|
352
|
+
fi
|
|
353
|
+
fi
|
|
354
|
+
|
|
355
|
+
echo "===================================="
|
|
356
|
+
print_success "QUICK PREFLIGHT PASSED!"
|
|
357
|
+
echo "Errors: $ERROR_COUNT | Warnings: $WARNING_COUNT"
|
|
358
|
+
echo ""
|
|
359
|
+
if [ "$CI_MODE" = "false" ]; then
|
|
360
|
+
echo "Tip: Run 'make preflight' with QUICK=false for comprehensive checks"
|
|
361
|
+
fi
|
|
362
|
+
echo "===================================="
|
|
363
|
+
exit 0
|
|
364
|
+
fi
|
|
365
|
+
|
|
366
|
+
# 14. GitHub Integration Check (if .github exists)
|
|
367
|
+
if [ -d ".github" ]; then
|
|
368
|
+
print_status "Validating GitHub integration..."
|
|
369
|
+
|
|
370
|
+
if [ ! -f ".github/CODEOWNERS" ]; then
|
|
371
|
+
warn_check "CODEOWNERS file missing"
|
|
372
|
+
else
|
|
373
|
+
print_success "CODEOWNERS found"
|
|
374
|
+
fi
|
|
375
|
+
|
|
376
|
+
if [ ! -f ".github/pull_request_template.md" ]; then
|
|
377
|
+
warn_check "PR template missing"
|
|
378
|
+
else
|
|
379
|
+
print_success "PR template found"
|
|
380
|
+
fi
|
|
381
|
+
|
|
382
|
+
if [ ! -d ".github/workflows" ]; then
|
|
383
|
+
warn_check "GitHub Actions workflows missing"
|
|
384
|
+
else
|
|
385
|
+
WORKFLOW_COUNT=$(find .github/workflows -name "*.yml" -o -name "*.yaml" | wc -l)
|
|
386
|
+
print_success "GitHub Actions workflows found ($WORKFLOW_COUNT files)"
|
|
387
|
+
fi
|
|
388
|
+
fi
|
|
389
|
+
|
|
390
|
+
# Final Summary
|
|
391
|
+
echo ""
|
|
392
|
+
echo "===================================="
|
|
393
|
+
if [ $ERROR_COUNT -eq 0 ]; then
|
|
394
|
+
print_success "All checks passed"
|
|
395
|
+
echo ""
|
|
396
|
+
echo "Next steps:"
|
|
397
|
+
echo " make package # Create distribution package"
|
|
398
|
+
echo " make docker-build # Build container image"
|
|
399
|
+
echo " make install # Install locally"
|
|
400
|
+
echo ""
|
|
401
|
+
else
|
|
402
|
+
print_error "PREFLIGHT FAILED!"
|
|
403
|
+
echo ""
|
|
404
|
+
echo "Summary:"
|
|
405
|
+
echo " Errors: $ERROR_COUNT"
|
|
406
|
+
echo " Warnings: $WARNING_COUNT"
|
|
407
|
+
echo ""
|
|
408
|
+
echo "Please fix the errors above before proceeding."
|
|
409
|
+
exit 1
|
|
410
|
+
fi
|
|
411
|
+
|
|
412
|
+
echo "Errors: $ERROR_COUNT | Warnings: $WARNING_COUNT"
|
|
413
|
+
echo "===================================="
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Cursor Agent - Release Preparation Script
|
|
3
|
+
# Comprehensive pre-release validation and preparation
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
VERSION=$(cat ../../VERSION | tr -d '\n')
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
+
cd "$PROJECT_ROOT"
|
|
11
|
+
|
|
12
|
+
# Colors
|
|
13
|
+
RED='\033[0;31m'
|
|
14
|
+
GREEN='\033[0;32m'
|
|
15
|
+
YELLOW='\033[1;33m'
|
|
16
|
+
BLUE='\033[0;34m'
|
|
17
|
+
NC='\033[0m'
|
|
18
|
+
|
|
19
|
+
print_header() {
|
|
20
|
+
echo -e "${BLUE}Cursor v${VERSION} Release Prep${NC}"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
print_step() {
|
|
24
|
+
echo -e "${BLUE}>${NC} $1"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
print_success() {
|
|
28
|
+
echo -e "${GREEN}✓${NC} $1"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
print_warning() {
|
|
32
|
+
echo -e "${YELLOW}!${NC} $1"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
print_error() {
|
|
36
|
+
echo -e "${RED}✗${NC} $1"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
print_header
|
|
40
|
+
|
|
41
|
+
# Check clean working directory
|
|
42
|
+
print_step "Checking git status..."
|
|
43
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
44
|
+
print_error "Uncommitted changes found"
|
|
45
|
+
git status --short
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
print_success "Git status clean"
|
|
49
|
+
|
|
50
|
+
# Check branch
|
|
51
|
+
print_step "Checking branch..."
|
|
52
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
53
|
+
if [ "$CURRENT_BRANCH" != "main" ] && [ "$CURRENT_BRANCH" != "master" ]; then
|
|
54
|
+
print_warning "Not on main (on: $CURRENT_BRANCH)"
|
|
55
|
+
read -p "Continue? (y/N): " -n 1 -r
|
|
56
|
+
echo
|
|
57
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
else
|
|
61
|
+
print_success "On $CURRENT_BRANCH"
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Check version consistency
|
|
65
|
+
print_step "Checking versions..."
|
|
66
|
+
VERSION_HEADER=$(grep "CURSOR_VERSION_STRING" build/include/version.h | cut -d'"' -f2)
|
|
67
|
+
VERSION_RELEASE=$(cat ../../VERSION | tr -d '\n')
|
|
68
|
+
if [ "$VERSION_HEADER" != "$VERSION" ] || [ "$VERSION_RELEASE" != "$VERSION" ]; then
|
|
69
|
+
print_error "Version mismatch: header=$VERSION_HEADER, release=$VERSION_RELEASE, expected=$VERSION"
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
print_success "Versions match: $VERSION"
|
|
73
|
+
|
|
74
|
+
# Run preflight checks
|
|
75
|
+
print_step "Running preflight..."
|
|
76
|
+
if ! CI=false QUICK=false ./.github/packaging/scripts/preflight.sh > /dev/null 2>&1; then
|
|
77
|
+
print_error "Preflight failed"
|
|
78
|
+
exit 1
|
|
79
|
+
fi
|
|
80
|
+
print_success "Preflight passed"
|
|
81
|
+
|
|
82
|
+
# Test app modes
|
|
83
|
+
print_step "Testing app..."
|
|
84
|
+
if ! printf "2\n1\nversion\nexit\n" | timeout 10 ./build/bin/cursor-agent > /dev/null 2>&1; then
|
|
85
|
+
print_error "Offline test failed"
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
print_success "Offline test passed"
|
|
89
|
+
|
|
90
|
+
# Check docs
|
|
91
|
+
print_step "Checking docs..."
|
|
92
|
+
REQUIRED_DOCS=("README.md" "CHANGELOG.md" "CONTRIBUTING.md")
|
|
93
|
+
for doc in "${REQUIRED_DOCS[@]}"; do
|
|
94
|
+
[ -f "$doc" ] || { print_error "Missing: $doc"; exit 1; }
|
|
95
|
+
done
|
|
96
|
+
print_success "Docs present"
|
|
97
|
+
|
|
98
|
+
# Check TODOs
|
|
99
|
+
print_step "Checking TODOs..."
|
|
100
|
+
if grep -r "TODO\|FIXME\|HACK" src/ include/ --exclude-dir=build 2>/dev/null > /dev/null; then
|
|
101
|
+
print_warning "TODOs found"
|
|
102
|
+
read -p "Continue? (y/N): " -n 1 -r
|
|
103
|
+
echo
|
|
104
|
+
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
|
|
105
|
+
else
|
|
106
|
+
print_success "No TODOs"
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Check workflows
|
|
110
|
+
print_step "Checking workflows..."
|
|
111
|
+
[ -f ".github/workflows/ci.yml" ] || { print_error "Missing CI workflow"; exit 1; }
|
|
112
|
+
grep -q "name: CI/CD Pipeline" .github/workflows/ci.yml || { print_error "CI malformed"; exit 1; }
|
|
113
|
+
print_success "Workflows OK"
|
|
114
|
+
|
|
115
|
+
# Check build
|
|
116
|
+
print_step "Checking build..."
|
|
117
|
+
make clean > /dev/null 2>&1 && make build > /dev/null 2>&1 || { print_error "Build failed"; exit 1; }
|
|
118
|
+
print_success "Build OK"
|
|
119
|
+
|
|
120
|
+
# Check tag
|
|
121
|
+
print_step "Checking tag..."
|
|
122
|
+
TAG_NAME="v${VERSION}"
|
|
123
|
+
git tag -l | grep -q "^${TAG_NAME}$" && { print_error "Tag exists"; exit 1; }
|
|
124
|
+
print_success "Tag available: $TAG_NAME"
|
|
125
|
+
|
|
126
|
+
# Final summary
|
|
127
|
+
echo
|
|
128
|
+
echo -e "${GREEN}Release prep complete${NC}"
|
|
129
|
+
echo "Version: $VERSION | Branch: $CURRENT_BRANCH | Tag: $TAG_NAME"
|
|
130
|
+
echo
|
|
131
|
+
echo "Next: git tag -a $TAG_NAME -m 'Release $TAG_NAME' && git push origin $TAG_NAME"
|
|
132
|
+
|
|
133
|
+
# Optional tag creation
|
|
134
|
+
read -p "Create tag now? (y/N): " -n 1 -r
|
|
135
|
+
echo
|
|
136
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
137
|
+
git tag -a "$TAG_NAME" -m "Release $TAG_NAME" && git push origin "$TAG_NAME"
|
|
138
|
+
print_success "Tag pushed"
|
|
139
|
+
else
|
|
140
|
+
echo "Manual: git tag -a $TAG_NAME -m 'Release $TAG_NAME' && git push origin $TAG_NAME"
|
|
141
|
+
fi
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Cursor Agent - Release Script
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
VERSION=$(cat ../../VERSION | tr -d '\n')
|
|
7
|
+
RELEASE_DIR="release/v${VERSION}"
|
|
8
|
+
|
|
9
|
+
echo "Building release v${VERSION}..."
|
|
10
|
+
|
|
11
|
+
make clean && make build
|
|
12
|
+
|
|
13
|
+
mkdir -p "$RELEASE_DIR"
|
|
14
|
+
make package
|
|
15
|
+
cp -r .github/packaging/dist/* "$RELEASE_DIR/"
|
|
16
|
+
git archive --format=tar.gz --prefix="cursor-agent-${VERSION}/" HEAD > "$RELEASE_DIR/cursor-agent-${VERSION}-source.tar.gz"
|
|
17
|
+
|
|
18
|
+
cd "$RELEASE_DIR"
|
|
19
|
+
shasum -a 256 * > checksums.sha256
|
|
20
|
+
|
|
21
|
+
echo "Release ready: $RELEASE_DIR"
|
|
22
|
+
ls -la
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Setup Git hooks for automatic preflight checks
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
8
|
+
cd "$PROJECT_ROOT"
|
|
9
|
+
|
|
10
|
+
echo "Setting up Git hooks for Cursor Agent..."
|
|
11
|
+
|
|
12
|
+
# Create .git/hooks directory if it doesn't exist
|
|
13
|
+
mkdir -p .git/hooks
|
|
14
|
+
|
|
15
|
+
# Pre-commit hook (quick checks)
|
|
16
|
+
cat > .git/hooks/pre-commit << 'EOF'
|
|
17
|
+
#!/bin/bash
|
|
18
|
+
# Pre-commit hook - Quick preflight checks
|
|
19
|
+
|
|
20
|
+
echo "Running pre-commit preflight checks..."
|
|
21
|
+
|
|
22
|
+
# Set environment variables for quick mode
|
|
23
|
+
export PRE_COMMIT=true
|
|
24
|
+
export GIT_HOOK=true
|
|
25
|
+
|
|
26
|
+
# Run quick preflight
|
|
27
|
+
if ! make preflight-quick; then
|
|
28
|
+
echo ""
|
|
29
|
+
echo "Pre-commit checks failed!"
|
|
30
|
+
echo "Fix the issues above or use 'git commit --no-verify' to skip"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
echo "Pre-commit checks passed!"
|
|
35
|
+
EOF
|
|
36
|
+
|
|
37
|
+
# Pre-push hook (comprehensive checks)
|
|
38
|
+
cat > .git/hooks/pre-push << 'EOF'
|
|
39
|
+
#!/bin/bash
|
|
40
|
+
# Pre-push hook - Comprehensive preflight checks
|
|
41
|
+
|
|
42
|
+
echo "Running pre-push preflight checks..."
|
|
43
|
+
|
|
44
|
+
# Set environment variable for comprehensive mode
|
|
45
|
+
export GIT_HOOK=true
|
|
46
|
+
|
|
47
|
+
# Run full preflight
|
|
48
|
+
if ! make preflight; then
|
|
49
|
+
echo ""
|
|
50
|
+
echo "Pre-push checks failed!"
|
|
51
|
+
echo "Fix the issues above or use 'git push --no-verify' to skip"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo "Pre-push checks passed!"
|
|
56
|
+
EOF
|
|
57
|
+
|
|
58
|
+
# Make hooks executable
|
|
59
|
+
chmod +x .git/hooks/pre-commit
|
|
60
|
+
chmod +x .git/hooks/pre-push
|
|
61
|
+
|
|
62
|
+
echo "Git hooks installed successfully!"
|
|
63
|
+
echo ""
|
|
64
|
+
echo "What happens now:"
|
|
65
|
+
echo " • git commit → Runs quick preflight checks"
|
|
66
|
+
echo " • git push → Runs comprehensive preflight checks"
|
|
67
|
+
echo ""
|
|
68
|
+
echo "To bypass hooks (use carefully):"
|
|
69
|
+
echo " • git commit --no-verify"
|
|
70
|
+
echo " • git push --no-verify"
|
|
71
|
+
echo ""
|
|
72
|
+
echo "To remove hooks:"
|
|
73
|
+
echo " • rm .git/hooks/pre-commit .git/hooks/pre-push"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
## Pull Request
|
|
2
|
+
|
|
3
|
+
### Description
|
|
4
|
+
Brief description of what this PR does.
|
|
5
|
+
|
|
6
|
+
### Type of Change
|
|
7
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
8
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
9
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
10
|
+
- [ ] Documentation update
|
|
11
|
+
- [ ] Refactoring (no functional changes)
|
|
12
|
+
- [ ] Performance improvement
|
|
13
|
+
- [ ] Test improvements
|
|
14
|
+
|
|
15
|
+
### Testing
|
|
16
|
+
- [ ] I have tested the changes locally
|
|
17
|
+
- [ ] All existing tests pass
|
|
18
|
+
|
|
19
|
+
### Checklist
|
|
20
|
+
- My code follows the project's coding standards
|
|
21
|
+
- I have performed a self-review of my code
|
|
22
|
+
- I have commented my code, particularly in hard-to-understand areas
|
|
23
|
+
- I have made corresponding changes to the documentation
|
|
24
|
+
- My changes generate no new warnings
|
|
25
|
+
- I have checked my code compiles without errors
|
|
26
|
+
|
|
27
|
+
### Screenshots (if applicable)
|
|
28
|
+
Add screenshots to help explain your changes.
|
|
29
|
+
|
|
30
|
+
### Additional Notes
|
|
31
|
+
Any additional information or context about the PR.
|