@polarityinc/paragon 0.0.9
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/LICENSE.md +134 -0
- package/README.md +206 -0
- package/package.json +49 -0
- package/scripts/npm-install.js +194 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2025 Polarity, Inc
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
MIT License
|
|
115
|
+
|
|
116
|
+
Copyright (c) 2025-03-21 - 2025-05-30 Kujtim Hoxha
|
|
117
|
+
|
|
118
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
119
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
120
|
+
in the Software without restriction, including without limitation the rights
|
|
121
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
122
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
123
|
+
furnished to do so, subject to the following conditions:
|
|
124
|
+
|
|
125
|
+
The above copyright notice and this permission notice shall be included in all
|
|
126
|
+
copies or substantial portions of the Software.
|
|
127
|
+
|
|
128
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
129
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
130
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
131
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
132
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
133
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
134
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Paragon
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img width="450" alt="Paragon Logo" src="https://www.polarity.cc/paragon.png" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h3 align="center">The Best Code Review Agent in the World</h3>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
Paragon catches more issues than any other tool, runs faster than competitors,<br/>
|
|
11
|
+
and maintains the highest security standards.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://polarity.cc/paragon"><strong>Learn more »</strong></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Why Paragon?
|
|
21
|
+
|
|
22
|
+
Paragon doesn't just score higher on tests—it sets the standard for what autonomous code review can achieve.
|
|
23
|
+
|
|
24
|
+
### 🎯 **81.2%** Issue Detection
|
|
25
|
+
Catches more issues than any other code review tool in the world. From security vulnerabilities to performance bottlenecks, Paragon finds what others miss.
|
|
26
|
+
|
|
27
|
+
*Highest accuracy on ReviewBenchLite benchmark*
|
|
28
|
+
|
|
29
|
+
### ⚡ **3x** Faster Than Competitors
|
|
30
|
+
The fastest code review agent in the world. Complete codebase analysis in minutes, not hours.
|
|
31
|
+
|
|
32
|
+
### 🔒 Highest Security Standards
|
|
33
|
+
SOC 2 compliant, enterprise-grade security, and zero-trust architecture. Paragon meets the highest security standards in the industry.
|
|
34
|
+
|
|
35
|
+
### ✨ **6.2%** False Positive Rate
|
|
36
|
+
World's most accurate code review agent. When Paragon flags an issue, it's real.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Benchmark Results
|
|
41
|
+
|
|
42
|
+
**ReviewBenchLite** - Accuracy comparison across leading code review agents:
|
|
43
|
+
|
|
44
|
+
| Agent | Accuracy |
|
|
45
|
+
|-------|----------|
|
|
46
|
+
| **Paragon Deep** | **81.2%** |
|
|
47
|
+
| Paragon Fast | 72.6% |
|
|
48
|
+
| Greptile V3 | 65.8% |
|
|
49
|
+
| Claude Code | 56.4% |
|
|
50
|
+
| Cursor | 51.3% |
|
|
51
|
+
| Codex | 44.4% |
|
|
52
|
+
| CodeRabbit | 22.2% |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## What Paragon Can Do
|
|
57
|
+
|
|
58
|
+
- ✅ **Catch All Security Flaws** - Comprehensive security scanning that identifies vulnerabilities before they reach production
|
|
59
|
+
- 🏗️ **Identify Infrastructure Issues** - Detect misconfigurations, security gaps, and performance bottlenecks
|
|
60
|
+
- 🚀 **Performance Optimization** - Advanced analysis that identifies bottlenecks, memory leaks, and inefficient algorithms
|
|
61
|
+
- ⚡ **10x Faster Code Reviews** - Automated PR reviews that catch issues instantly
|
|
62
|
+
- 🐛 **World's Best Bug Catcher** - Industry-leading bug detection for production environments
|
|
63
|
+
- 🤖 **Fix AI Slop** - Instantly detect and fix low-quality AI-generated code
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install -g @polarityinc/paragon
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Getting Started
|
|
76
|
+
|
|
77
|
+
### 1. Authenticate
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
paragon auth login
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
You'll need your API key from [home.polarity.cc](https://home.polarity.cc).
|
|
84
|
+
|
|
85
|
+
**Note:** Keep your API key secure. Do not share it publicly or commit it to version control.
|
|
86
|
+
|
|
87
|
+
### 2. Start Using Paragon
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
paragon
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Features
|
|
96
|
+
|
|
97
|
+
### Session-Based Workflow
|
|
98
|
+
Maintain multiple work sessions and contexts per project. Switch between tasks seamlessly.
|
|
99
|
+
|
|
100
|
+
### LSP-Enhanced Analysis
|
|
101
|
+
Paragon uses Language Server Protocol (LSP) for deep code understanding, just like your IDE.
|
|
102
|
+
|
|
103
|
+
### Extensible via MCP
|
|
104
|
+
Add capabilities through Model Context Protocol (`http`, `stdio`, and `sse` transports).
|
|
105
|
+
|
|
106
|
+
### Works Everywhere
|
|
107
|
+
First-class support in every terminal on macOS, Linux, Windows (PowerShell and WSL), FreeBSD, OpenBSD, and NetBSD.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Configuration
|
|
112
|
+
|
|
113
|
+
Paragon runs great with no configuration. For advanced usage, create a configuration file:
|
|
114
|
+
|
|
115
|
+
**Locations** (in priority order):
|
|
116
|
+
1. `.paragon.json` (project-local, hidden)
|
|
117
|
+
2. `paragon.json` (project-local)
|
|
118
|
+
3. `~/.config/paragon/paragon.json` (global)
|
|
119
|
+
|
|
120
|
+
### Example Configuration
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"$schema": "https://polarity.cc/paragon.json",
|
|
125
|
+
"lsp": {
|
|
126
|
+
"go": {
|
|
127
|
+
"command": "gopls"
|
|
128
|
+
},
|
|
129
|
+
"typescript": {
|
|
130
|
+
"command": "typescript-language-server",
|
|
131
|
+
"args": ["--stdio"]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"mcp": {
|
|
135
|
+
"filesystem": {
|
|
136
|
+
"type": "stdio",
|
|
137
|
+
"command": "node",
|
|
138
|
+
"args": ["/path/to/mcp-server.js"],
|
|
139
|
+
"timeout": 120,
|
|
140
|
+
"disabled": false
|
|
141
|
+
},
|
|
142
|
+
"api-service": {
|
|
143
|
+
"type": "http",
|
|
144
|
+
"url": "https://example.com/mcp/",
|
|
145
|
+
"timeout": 120,
|
|
146
|
+
"disabled": false,
|
|
147
|
+
"headers": {
|
|
148
|
+
"Authorization": "Bearer your-token"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"streaming-service": {
|
|
152
|
+
"type": "sse",
|
|
153
|
+
"url": "https://example.com/mcp/sse",
|
|
154
|
+
"timeout": 120,
|
|
155
|
+
"disabled": false
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Impact
|
|
164
|
+
|
|
165
|
+
### Real Results From Teams Worldwide
|
|
166
|
+
|
|
167
|
+
- **93%** Faster PR Merge Time
|
|
168
|
+
- **81.2%** Production Issues Found Before Deployment
|
|
169
|
+
- **100M** Lines of Code Processed Per Month
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Enterprise
|
|
174
|
+
|
|
175
|
+
Paragon offers enterprise-grade features for teams:
|
|
176
|
+
|
|
177
|
+
- **SOC 2 Compliance** - Industry-leading security standards
|
|
178
|
+
- **Self-Hosted Options** - Deploy on your infrastructure
|
|
179
|
+
- **Priority Support** - Dedicated support team
|
|
180
|
+
- **Custom Integrations** - Tailored to your workflow
|
|
181
|
+
- **SLA Guarantees** - 99.9% uptime commitment
|
|
182
|
+
|
|
183
|
+
[Book a demo →](https://polarity.cc/demo)
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
Paragon is proprietary software by [Polarity](https://polarity.cc).
|
|
190
|
+
|
|
191
|
+
For inquiries, contact [sales@polarity.cc](mailto:sales@polarity.cc).
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
<p align="center">
|
|
196
|
+
<strong>Experience the world's best code review agent</strong><br/>
|
|
197
|
+
Join teams worldwide who trust Paragon—the fastest, most accurate, and most secure code review agent.
|
|
198
|
+
</p>
|
|
199
|
+
|
|
200
|
+
<p align="center">
|
|
201
|
+
<a href="https://home.polarity.cc/"><strong>Get Started →</strong></a> |
|
|
202
|
+
<a href="https://polarity.cc/contact"><strong>Book a Demo →</strong></a>
|
|
203
|
+
</p>
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@polarityinc/paragon",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "Paragon is the First AI QA Engineer and the Worlds best code reviewer.",
|
|
5
|
+
"author": "Polarity Inc.",
|
|
6
|
+
"private": false,
|
|
7
|
+
"homepage": "https://polarity.cc/paragon",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Polarityinc/polarity-binaries.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Polarityinc/polarity-binaries/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ai",
|
|
17
|
+
"llm",
|
|
18
|
+
"coding-assistant",
|
|
19
|
+
"terminal",
|
|
20
|
+
"tui",
|
|
21
|
+
"paragon",
|
|
22
|
+
"anthropic",
|
|
23
|
+
"openai",
|
|
24
|
+
"cli"
|
|
25
|
+
],
|
|
26
|
+
"bin": {
|
|
27
|
+
"paragon": "./bin/paragon"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"postinstall": "node scripts/npm-install.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin/",
|
|
34
|
+
"scripts/npm-install.js",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=14.0.0"
|
|
39
|
+
},
|
|
40
|
+
"os": [
|
|
41
|
+
"darwin",
|
|
42
|
+
"linux",
|
|
43
|
+
"win32"
|
|
44
|
+
],
|
|
45
|
+
"cpu": [
|
|
46
|
+
"x64",
|
|
47
|
+
"arm64"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
// Get version from package.json
|
|
9
|
+
const packageJson = require('../package.json');
|
|
10
|
+
const VERSION = packageJson.version;
|
|
11
|
+
|
|
12
|
+
// Determine platform and architecture
|
|
13
|
+
const PLATFORM_MAP = {
|
|
14
|
+
darwin: 'darwin',
|
|
15
|
+
linux: 'linux',
|
|
16
|
+
win32: 'windows'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ARCH_MAP = {
|
|
20
|
+
x64: 'amd64',
|
|
21
|
+
arm64: 'arm64'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
25
|
+
const arch = ARCH_MAP[process.arch];
|
|
26
|
+
|
|
27
|
+
if (!platform || !arch) {
|
|
28
|
+
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
29
|
+
console.error('Supported: darwin-x64, darwin-arm64, linux-x64, linux-arm64, win32-x64, win32-arm64');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Construct binary name and URL
|
|
34
|
+
const binaryName = platform === 'windows'
|
|
35
|
+
? `polarity-${platform}-${arch}.exe`
|
|
36
|
+
: `polarity-${platform}-${arch}`;
|
|
37
|
+
|
|
38
|
+
const GITHUB_RELEASE_URL = `https://github.com/Polarityinc/polarity-binaries/releases/download/${VERSION}/${binaryName}`;
|
|
39
|
+
|
|
40
|
+
// Create bin directory
|
|
41
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
42
|
+
const binPath = path.join(binDir, platform === 'windows' ? 'paragon.exe' : 'paragon');
|
|
43
|
+
|
|
44
|
+
if (!fs.existsSync(binDir)) {
|
|
45
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(`Installing Paragon v${VERSION} for ${platform}-${arch}...`);
|
|
49
|
+
console.log(`Downloading from: ${GITHUB_RELEASE_URL}`);
|
|
50
|
+
|
|
51
|
+
// Download binary
|
|
52
|
+
function downloadFile(url, dest) {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
const file = fs.createWriteStream(dest);
|
|
55
|
+
|
|
56
|
+
https.get(url, (response) => {
|
|
57
|
+
// Handle redirects
|
|
58
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
59
|
+
file.close();
|
|
60
|
+
fs.unlinkSync(dest);
|
|
61
|
+
return downloadFile(response.headers.location, dest).then(resolve).catch(reject);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (response.statusCode !== 200) {
|
|
65
|
+
file.close();
|
|
66
|
+
fs.unlinkSync(dest);
|
|
67
|
+
return reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
response.pipe(file);
|
|
71
|
+
|
|
72
|
+
file.on('finish', () => {
|
|
73
|
+
file.close();
|
|
74
|
+
resolve();
|
|
75
|
+
});
|
|
76
|
+
}).on('error', (err) => {
|
|
77
|
+
file.close();
|
|
78
|
+
fs.unlinkSync(dest);
|
|
79
|
+
reject(err);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Check for ripgrep
|
|
85
|
+
function checkRipgrep() {
|
|
86
|
+
try {
|
|
87
|
+
execSync('rg --version', { stdio: 'ignore' });
|
|
88
|
+
return true;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Install ripgrep automatically
|
|
95
|
+
function installRipgrep() {
|
|
96
|
+
console.log('Installing ripgrep...');
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
if (platform === 'darwin') {
|
|
100
|
+
// macOS - try brew
|
|
101
|
+
try {
|
|
102
|
+
execSync('brew --version', { stdio: 'ignore' });
|
|
103
|
+
console.log('Installing ripgrep via Homebrew...');
|
|
104
|
+
execSync('brew install ripgrep', { stdio: 'inherit' });
|
|
105
|
+
return true;
|
|
106
|
+
} catch (e) {
|
|
107
|
+
console.error('✗ Homebrew not found. Please install Homebrew first: https://brew.sh');
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
} else if (platform === 'linux') {
|
|
111
|
+
// Linux - try various package managers
|
|
112
|
+
// Try apt (Debian/Ubuntu)
|
|
113
|
+
try {
|
|
114
|
+
execSync('apt --version', { stdio: 'ignore' });
|
|
115
|
+
console.log('Installing ripgrep via apt...');
|
|
116
|
+
execSync('sudo apt update && sudo apt install -y ripgrep', { stdio: 'inherit' });
|
|
117
|
+
return true;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
// Try dnf (Fedora)
|
|
120
|
+
try {
|
|
121
|
+
execSync('dnf --version', { stdio: 'ignore' });
|
|
122
|
+
console.log('Installing ripgrep via dnf...');
|
|
123
|
+
execSync('sudo dnf install -y ripgrep', { stdio: 'inherit' });
|
|
124
|
+
return true;
|
|
125
|
+
} catch (e2) {
|
|
126
|
+
// Try yum (RHEL/CentOS)
|
|
127
|
+
try {
|
|
128
|
+
execSync('yum --version', { stdio: 'ignore' });
|
|
129
|
+
console.log('Installing ripgrep via yum...');
|
|
130
|
+
execSync('sudo yum install -y ripgrep', { stdio: 'inherit' });
|
|
131
|
+
return true;
|
|
132
|
+
} catch (e3) {
|
|
133
|
+
console.error('✗ No supported package manager found (apt/dnf/yum)');
|
|
134
|
+
console.error('Please install ripgrep manually: https://github.com/BurntSushi/ripgrep');
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
} else if (platform === 'windows') {
|
|
140
|
+
// Windows - try choco first, then scoop
|
|
141
|
+
try {
|
|
142
|
+
execSync('choco --version', { stdio: 'ignore' });
|
|
143
|
+
console.log('Installing ripgrep via Chocolatey...');
|
|
144
|
+
execSync('choco install ripgrep -y', { stdio: 'inherit' });
|
|
145
|
+
return true;
|
|
146
|
+
} catch (e) {
|
|
147
|
+
try {
|
|
148
|
+
execSync('scoop --version', { stdio: 'ignore' });
|
|
149
|
+
console.log('Installing ripgrep via Scoop...');
|
|
150
|
+
execSync('scoop install ripgrep', { stdio: 'inherit' });
|
|
151
|
+
return true;
|
|
152
|
+
} catch (e2) {
|
|
153
|
+
console.error('✗ No supported package manager found (choco/scoop)');
|
|
154
|
+
console.error('Please install Chocolatey or Scoop first');
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
} catch (err) {
|
|
160
|
+
console.error('✗ Failed to install ripgrep:', err.message);
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
downloadFile(GITHUB_RELEASE_URL, binPath)
|
|
166
|
+
.then(() => {
|
|
167
|
+
// Make binary executable on Unix systems
|
|
168
|
+
if (platform !== 'windows') {
|
|
169
|
+
fs.chmodSync(binPath, 0o755);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
console.log('✓ Paragon installed successfully!');
|
|
173
|
+
|
|
174
|
+
// Check and install ripgrep if needed
|
|
175
|
+
if (!checkRipgrep()) {
|
|
176
|
+
console.log('\nripgrep is required but not found.');
|
|
177
|
+
if (!installRipgrep()) {
|
|
178
|
+
console.log('\n⚠️ Warning: Paragon requires ripgrep to function properly');
|
|
179
|
+
console.log('Please install it manually: https://github.com/BurntSushi/ripgrep#installation');
|
|
180
|
+
} else {
|
|
181
|
+
console.log('✓ ripgrep installed successfully!');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
console.log(`\nTo get started, run: paragon`);
|
|
186
|
+
console.log('For authentication, run: paragon auth login');
|
|
187
|
+
})
|
|
188
|
+
.catch((err) => {
|
|
189
|
+
console.error('✗ Installation failed:', err.message);
|
|
190
|
+
console.error('\nPlease try one of these alternatives:');
|
|
191
|
+
console.error('- Homebrew: brew install polarityinc/polarity/polarity');
|
|
192
|
+
console.error('- Direct download: https://github.com/Polarityinc/polarity-binaries/releases');
|
|
193
|
+
process.exit(1);
|
|
194
|
+
});
|