@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
package/src/main.cpp
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#include <cstdlib>
|
|
2
|
+
#include <filesystem>
|
|
3
|
+
#include <iostream>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#ifndef _WIN32
|
|
7
|
+
#include <unistd.h>
|
|
8
|
+
#endif
|
|
9
|
+
#ifdef __APPLE__
|
|
10
|
+
#include <mach-o/dyld.h>
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
#include "agent.h"
|
|
14
|
+
#include "memory_manager.h"
|
|
15
|
+
#include "services/ai_service.h"
|
|
16
|
+
#include "utils/config.h"
|
|
17
|
+
#include "utils/ui.h"
|
|
18
|
+
#include "version.h"
|
|
19
|
+
|
|
20
|
+
std::string get_exe_path() {
|
|
21
|
+
try {
|
|
22
|
+
return std::filesystem::canonical("/proc/self/exc").string();
|
|
23
|
+
} catch (...) {
|
|
24
|
+
}
|
|
25
|
+
#ifdef __APPLE__
|
|
26
|
+
char buf[1024];
|
|
27
|
+
uint32_t size = sizeof(buf);
|
|
28
|
+
if (_NSGetExecutablePath(buf, &size) == 0) {
|
|
29
|
+
return std::filesystem::canonical(buf).string();
|
|
30
|
+
}
|
|
31
|
+
#endif
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
int main(int argc, char *argv[]) {
|
|
36
|
+
for (int i = 1; i < argc; ++i) {
|
|
37
|
+
std::string arg = argv[i];
|
|
38
|
+
if (arg == "--version" || arg == "-v") {
|
|
39
|
+
Version::print_version_info();
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
if (arg == "--help" || arg == "-h") {
|
|
43
|
+
std::cout << "Usage: cursor [OPTIONS]\n\n"
|
|
44
|
+
<< "Options:\n"
|
|
45
|
+
<< " -v, --version Print version info and exit\n"
|
|
46
|
+
<< " -h, --help Show this help and exit\n"
|
|
47
|
+
<< " --update Update to latest release\n";
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
if (arg == "--update") {
|
|
51
|
+
std::string latest = Version::check_update();
|
|
52
|
+
if (latest.empty()) {
|
|
53
|
+
std::cout << "Already up to date (v" << Version::get_version()
|
|
54
|
+
<< ")\n";
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
return Version::download_and_install(latest) ? 0 : 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
Utils::Config::load_environment();
|
|
63
|
+
Utils::UI::print_logo();
|
|
64
|
+
|
|
65
|
+
std::string latest = Version::check_update();
|
|
66
|
+
if (!latest.empty()) {
|
|
67
|
+
std::cout << Utils::Color::YELLOW
|
|
68
|
+
<< "Update available: v" << Version::get_version() << " -> v"
|
|
69
|
+
<< latest << "\n"
|
|
70
|
+
<< Utils::Color::RESET;
|
|
71
|
+
std::cout << "[1] Update now\n[2] Later\n> ";
|
|
72
|
+
std::string choice;
|
|
73
|
+
std::getline(std::cin, choice);
|
|
74
|
+
if (choice == "1") {
|
|
75
|
+
if (Version::download_and_install(latest)) {
|
|
76
|
+
std::string exe = get_exe_path();
|
|
77
|
+
if (!exe.empty()) {
|
|
78
|
+
#ifndef _WIN32
|
|
79
|
+
execl(exe.c_str(), exe.c_str(), (char *)NULL);
|
|
80
|
+
#endif
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
Core::Agent agent;
|
|
88
|
+
agent.run();
|
|
89
|
+
std::cout << "Agent run completed" << std::endl;
|
|
90
|
+
} catch (const std::exception &e) {
|
|
91
|
+
std::cerr << Utils::Color::RED << "Fatal error: " << e.what()
|
|
92
|
+
<< Utils::Color::RESET << std::endl;
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return 0;
|
|
97
|
+
}
|