codex-rtl 1.0.0 → 1.1.4
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/README.md +24 -10
- package/bin/index.js +87 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -17,12 +17,19 @@ This CLI tool automatically injects a sophisticated RTL engine into Codex, addin
|
|
|
17
17
|
|
|
18
18
|
You don't need to download any files. Just run the following command in your terminal:
|
|
19
19
|
|
|
20
|
-
### macOS
|
|
21
|
-
|
|
20
|
+
### macOS
|
|
21
|
+
Simply run:
|
|
22
|
+
```bash
|
|
23
|
+
npx codex-rtl
|
|
24
|
+
```
|
|
25
|
+
> **First time?** If you get a "Permission Denied" error, the tool will **automatically open** the App Management settings page for you. Just enable the toggle for your terminal app, then run the command again. No `sudo` needed!
|
|
26
|
+
>
|
|
27
|
+
> You can also grant permission manually: `System Settings > Privacy & Security > App Management`.
|
|
28
|
+
|
|
29
|
+
### Linux
|
|
22
30
|
```bash
|
|
23
31
|
sudo npx codex-rtl
|
|
24
32
|
```
|
|
25
|
-
> **macOS Users:** If you get a "Permission Denied" error even with sudo, ensure your terminal (e.g. Terminal, iTerm2, VS Code) has **App Management** permissions enabled in `System Settings > Privacy & Security > App Management`.
|
|
26
33
|
|
|
27
34
|
### Windows
|
|
28
35
|
Open **PowerShell** or **Command Prompt** as **Administrator** (Right-click -> Run as Administrator), then run:
|
|
@@ -40,9 +47,9 @@ npx codex-rtl
|
|
|
40
47
|
If you ever want to revert Codex back to its original state (before the patch), simply run the command with the `--restore` flag:
|
|
41
48
|
|
|
42
49
|
```bash
|
|
43
|
-
|
|
50
|
+
npx codex-rtl --restore
|
|
44
51
|
```
|
|
45
|
-
*(On
|
|
52
|
+
*(On Linux, run with `sudo`. On Windows, run in an Administrator terminal)*
|
|
46
53
|
|
|
47
54
|
## How it works
|
|
48
55
|
|
|
@@ -81,12 +88,19 @@ Feel free to open issues or submit pull requests. Let's make Codex accessible an
|
|
|
81
88
|
|
|
82
89
|
بدون نیاز به دانلود هیچ فایلی، فقط کافیست دستور زیر را در ترمینال سیستم خود اجرا کنید:
|
|
83
90
|
|
|
84
|
-
### در مک (macOS)
|
|
85
|
-
|
|
91
|
+
### در مک (macOS)
|
|
92
|
+
کافیست دستور زیر را اجرا کنید:
|
|
93
|
+
```bash
|
|
94
|
+
npx codex-rtl
|
|
95
|
+
```
|
|
96
|
+
> **اولین بار؟** اگر خطای Permission Denied دریافت کردید، ابزار به صورت **خودکار** صفحهٔ تنظیمات App Management را برای شما باز میکند. فقط سوئیچ ترمینال خود (مثلاً Terminal، iTerm2 یا VS Code) را فعال کنید و دوباره دستور را اجرا کنید. نیازی به `sudo` نیست!
|
|
97
|
+
>
|
|
98
|
+
> همچنین میتوانید به صورت دستی به مسیر `System Settings > Privacy & Security > App Management` بروید.
|
|
99
|
+
|
|
100
|
+
### در لینوکس
|
|
86
101
|
```bash
|
|
87
102
|
sudo npx codex-rtl
|
|
88
103
|
```
|
|
89
|
-
> **کاربران مک (macOS):** اگر با وجود استفاده از sudo باز هم خطای Permission Denied دریافت کردید، باید به ترمینال خود (مثل Terminal، iTerm2 یا VS Code) دسترسی **App Management** بدهید. برای این کار به مسیر `System Settings > Privacy & Security > App Management` بروید و دسترسی ترمینال خود را فعال کنید.
|
|
90
104
|
|
|
91
105
|
### در ویندوز
|
|
92
106
|
برنامهٔ **PowerShell** یا **Command Prompt** را در حالت **Administrator** (راستکلیک -> Run as Administrator) باز کنید و دستور زیر را بنویسید:
|
|
@@ -104,9 +118,9 @@ npx codex-rtl
|
|
|
104
118
|
اگر زمانی خواستید Codex را به حالتِ اولیه (قبل از نصب این پچ) برگردانید، فقط کافیست دستور بالا را با فلگ `--restore` اجرا کنید:
|
|
105
119
|
|
|
106
120
|
```bash
|
|
107
|
-
|
|
121
|
+
npx codex-rtl --restore
|
|
108
122
|
```
|
|
109
|
-
*(کاربران ویندوز این دستور را
|
|
123
|
+
*(در لینوکس با `sudo` اجرا کنید. کاربران ویندوز این دستور را در یک ترمینال ادمین اجرا کنند)*
|
|
110
124
|
|
|
111
125
|
## این ابزار چگونه کار میکند؟
|
|
112
126
|
|
package/bin/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import picocolors from 'picocolors';
|
|
|
7
7
|
import ora from 'ora';
|
|
8
8
|
import prompts from 'prompts';
|
|
9
9
|
import * as asar from '@electron/asar';
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import figlet from 'figlet';
|
|
10
12
|
|
|
11
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
14
|
const __dirname = path.dirname(__filename);
|
|
@@ -14,7 +16,89 @@ const { blue, cyan, green, red, yellow, bold } = picocolors;
|
|
|
14
16
|
|
|
15
17
|
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
16
18
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
17
|
-
|
|
19
|
+
|
|
20
|
+
function printBanner() {
|
|
21
|
+
try {
|
|
22
|
+
const fullArt = figlet.textSync('Codex RTL', { font: 'RubiFont' }).split('\n');
|
|
23
|
+
|
|
24
|
+
// Hex colors for the multi-color gradient
|
|
25
|
+
const hexColors = [
|
|
26
|
+
'#3126FF',
|
|
27
|
+
'#5770FF',
|
|
28
|
+
'#6F94FF',
|
|
29
|
+
'#7081FF',
|
|
30
|
+
'#BBA3FF',
|
|
31
|
+
'#C1C3FF'
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
// Parse hex to RGB
|
|
35
|
+
const colors = hexColors.map(hex => {
|
|
36
|
+
const bigint = parseInt(hex.replace('#', ''), 16);
|
|
37
|
+
return {
|
|
38
|
+
r: (bigint >> 16) & 255,
|
|
39
|
+
g: (bigint >> 8) & 255,
|
|
40
|
+
b: bigint & 255
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const applyGradient = (text) => {
|
|
45
|
+
let result = '';
|
|
46
|
+
const len = text.length;
|
|
47
|
+
for (let i = 0; i < len; i++) {
|
|
48
|
+
const char = text[i];
|
|
49
|
+
if (char === ' ' || char === '\n') {
|
|
50
|
+
result += char;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const factor = len > 1 ? i / (len - 1) : 0;
|
|
54
|
+
|
|
55
|
+
// Find current segment in the multi-color transition
|
|
56
|
+
const segments = colors.length - 1;
|
|
57
|
+
const segmentFloat = factor * segments;
|
|
58
|
+
const segmentIdx = Math.min(Math.floor(segmentFloat), segments - 1);
|
|
59
|
+
const segmentFactor = segmentFloat - segmentIdx;
|
|
60
|
+
|
|
61
|
+
const cStart = colors[segmentIdx];
|
|
62
|
+
const cEnd = colors[segmentIdx + 1];
|
|
63
|
+
|
|
64
|
+
const r = Math.round(cStart.r + segmentFactor * (cEnd.r - cStart.r));
|
|
65
|
+
const g = Math.round(cStart.g + segmentFactor * (cEnd.g - cStart.g));
|
|
66
|
+
const b = Math.round(cStart.b + segmentFactor * (cEnd.b - cStart.b));
|
|
67
|
+
|
|
68
|
+
result += `\x1b[38;2;${r};${g};${b}m${char}\x1b[0m`;
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
console.log('');
|
|
74
|
+
for (const line of fullArt) {
|
|
75
|
+
if (!line.trim()) continue;
|
|
76
|
+
console.log(applyGradient(line));
|
|
77
|
+
}
|
|
78
|
+
console.log('');
|
|
79
|
+
console.log(`\x1b[2m Patcher Version ${pkg.version} | RTL & UI Patcher for Codex\x1b[0m\n`);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
// Fallback banner in case figlet has issues loading
|
|
82
|
+
console.log(bold(cyan(`\n✨ Codex Smart RTL Patcher v${pkg.version}\n`)));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
printBanner();
|
|
87
|
+
|
|
88
|
+
function handleMacPermissionError(err) {
|
|
89
|
+
if (os.platform() === 'darwin') {
|
|
90
|
+
console.error(yellow('\nOn macOS, you can either:'));
|
|
91
|
+
console.error(yellow(' 1. Grant your terminal "App Management" permission to run without sudo.'));
|
|
92
|
+
console.error(yellow(' 2. Or, run this command with sudo (e.g. sudo npx codex-rtl)'));
|
|
93
|
+
console.log(blue('\nOpening System Settings directly to App Management for you...'));
|
|
94
|
+
try {
|
|
95
|
+
execSync('open "x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension?Privacy_AppBundles"');
|
|
96
|
+
console.log(green('✔ Settings opened! Please enable the toggle for your terminal, then try again.\n'));
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.error(yellow('To open manually, go to: System Settings > Privacy & Security > App Management\n'));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
18
102
|
|
|
19
103
|
function getDefaultPath() {
|
|
20
104
|
if (os.platform() === 'darwin') {
|
|
@@ -68,6 +152,7 @@ async function main() {
|
|
|
68
152
|
} catch (e) {
|
|
69
153
|
spinner.fail('Failed to restore.');
|
|
70
154
|
console.error(red(e.message));
|
|
155
|
+
handleMacPermissionError(e);
|
|
71
156
|
process.exit(1);
|
|
72
157
|
}
|
|
73
158
|
}
|
|
@@ -84,10 +169,7 @@ async function main() {
|
|
|
84
169
|
if (os.platform() === 'win32') {
|
|
85
170
|
console.error(yellow('\nPlease run your terminal (PowerShell/CMD) as Administrator and try again.\n'));
|
|
86
171
|
} else if (os.platform() === 'darwin') {
|
|
87
|
-
|
|
88
|
-
console.error(yellow('On macOS, you might also need to give your terminal "App Management" permission.'));
|
|
89
|
-
console.error(yellow('Go to: System Settings > Privacy & Security > App Management'));
|
|
90
|
-
console.error(yellow('And enable the toggle for your terminal, then try again.\n'));
|
|
172
|
+
handleMacPermissionError(e);
|
|
91
173
|
} else {
|
|
92
174
|
console.error(yellow('\nPlease run this command with sudo.\n'));
|
|
93
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-rtl",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "A smart RTL (Right-to-Left) patcher with UI settings for the Codex application.",
|
|
5
5
|
"main": "./bin/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"homepage": "https://github.com/mmnaderi/codex-rtl#readme",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@electron/asar": "^4.2.0",
|
|
38
|
+
"figlet": "^1.11.0",
|
|
38
39
|
"ora": "^9.4.1",
|
|
39
40
|
"picocolors": "^1.1.1",
|
|
40
41
|
"prompts": "^2.4.2"
|